query
stringlengths
7
3.85k
document
stringlengths
11
430k
metadata
dict
negatives
sequencelengths
0
101
negative_scores
sequencelengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
AggregatedListInstances uses the override method ListInstancesFn or the real implementation.
func (c *TestClient) AggregatedListInstances(project string, opts ...ListCallOption) ([]*compute.Instance, error) { if c.AggregatedListInstancesFn != nil { return c.AggregatedListInstancesFn(project, opts...) } return c.client.AggregatedListInstances(project, opts...) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c Client) ListInstances() ([]models.Instance, error) {\n\tvar instances []models.Instance\n\tresp, err := c.get(\"/instances\")\n\tif err != nil {\n\t\treturn instances, err\n\t}\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn instances, parseError(resp.Body)\n\t}\n\n\tmaybeInstances, err := jsonapi.UnmarshalManyPayload(resp.Body, reflect.TypeOf(instances))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Convert from []interface{} to []Instance\n\tinstances = make([]models.Instance, 0)\n\tfor _, instance := range maybeInstances {\n\t\ti := instance.(*models.Instance)\n\t\tinstances = append(instances, *i)\n\t}\n\n\treturn instances, nil\n}", "func (i *IAM) ListInstances(kt *kit.Kit, resType client.TypeID, filter *types.ListInstanceFilter,\n\tpage types.Page) (*types.ListInstanceResult, error) {\n\n\tbizID, pbFilter, err := filter.GetBizIDAndPbFilter()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcountReq := &pbds.ListInstancesReq{\n\t\tBizId: bizID,\n\t\tResourceType: string(resType),\n\t\tFilter: pbFilter,\n\t\tPage: &pbbase.BasePage{Count: true},\n\t}\n\tcountResp, err := i.ds.ListInstances(kt.RpcCtx(), countReq)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq := &pbds.ListInstancesReq{\n\t\tBizId: bizID,\n\t\tResourceType: string(resType),\n\t\tFilter: pbFilter,\n\t\tPage: page.PbPage(),\n\t}\n\tresp, err := i.ds.ListInstances(kt.RpcCtx(), req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tinstances := make([]types.InstanceResource, 0)\n\tfor _, one := range resp.Details {\n\t\tinstances = append(instances, types.InstanceResource{\n\t\t\tID: types.InstanceID{\n\t\t\t\tBizID: bizID,\n\t\t\t\tInstanceID: one.Id,\n\t\t\t},\n\t\t\tDisplayName: one.Name,\n\t\t})\n\t}\n\n\tresult := &types.ListInstanceResult{\n\t\tCount: countResp.Count,\n\t\tResults: instances,\n\t}\n\treturn result, nil\n}", "func (instanceAPIs ContainerInstanceAPIs) ListInstances(w http.ResponseWriter, r *http.Request) {\n\tquery := r.URL.Query()\n\n\tif instanceAPIs.hasUnsupportedFilters(query) {\n\t\thttp.Error(w, unsupportedFilterClientErrMsg, http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tif instanceAPIs.hasRedundantFilters(query) {\n\t\thttp.Error(w, redundantFilterClientErrMsg, http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tstatus := strings.ToLower(query.Get(instanceStatusFilter))\n\tcluster := query.Get(instanceClusterFilter)\n\n\tif status != \"\" {\n\t\tif !instanceAPIs.isValidStatus(status) {\n\t\t\thttp.Error(w, invalidStatusClientErrMsg, http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t}\n\n\tif cluster != \"\" {\n\t\tif !regex.IsClusterARN(cluster) && !regex.IsClusterName(cluster) {\n\t\t\thttp.Error(w, invalidClusterClientErrMsg, http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t}\n\n\tvar instances []storetypes.VersionedContainerInstance\n\tvar err error\n\tswitch {\n\tcase status != \"\" && cluster != \"\":\n\t\tfilters := map[string]string{instanceStatusFilter: status, instanceClusterFilter: cluster}\n\t\tinstances, err = instanceAPIs.instanceStore.FilterContainerInstances(filters)\n\tcase status != \"\":\n\t\tfilters := map[string]string{instanceStatusFilter: status}\n\t\tinstances, err = instanceAPIs.instanceStore.FilterContainerInstances(filters)\n\tcase cluster != \"\":\n\t\tfilters := map[string]string{instanceClusterFilter: cluster}\n\t\tinstances, err = instanceAPIs.instanceStore.FilterContainerInstances(filters)\n\tdefault:\n\t\tinstances, err = instanceAPIs.instanceStore.ListContainerInstances()\n\t}\n\n\tif err != nil {\n\t\thttp.Error(w, internalServerErrMsg, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.Header().Set(contentTypeKey, contentTypeJSON)\n\tw.WriteHeader(http.StatusOK)\n\n\textInstanceItems := make([]*models.ContainerInstance, len(instances))\n\tfor i := range instances {\n\t\tins, err := ToContainerInstance(instances[i])\n\t\tif err != nil {\n\t\t\thttp.Error(w, internalServerErrMsg, http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\textInstanceItems[i] = &ins\n\t}\n\n\textInstances := models.ContainerInstances{\n\t\tItems: extInstanceItems,\n\t}\n\n\terr = json.NewEncoder(w).Encode(extInstances)\n\tif err != nil {\n\t\thttp.Error(w, encodingServerErrMsg, http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "func (client AccessGovernanceCPClient) listGovernanceInstances(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodGet, \"/governanceInstances\", binaryReqBody, extraHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response ListGovernanceInstancesResponse\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/access-governance-cp/20220518/GovernanceInstanceCollection/ListGovernanceInstances\"\n\t\terr = common.PostProcessServiceError(err, \"AccessGovernanceCP\", \"ListGovernanceInstances\", apiReferenceLink)\n\t\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponse(httpResponse, &response)\n\treturn response, err\n}", "func (m *pcpInstanceMetric) Instances() []string { return m.indom.Instances() }", "func getInstanceList(nodeNames sets.String) *compute.InstanceGroupsListInstances {\n\tinstanceNames := nodeNames.List()\n\tcomputeInstances := []*compute.InstanceWithNamedPorts{}\n\tfor _, name := range instanceNames {\n\t\tinstanceLink := getInstanceUrl(name)\n\t\tcomputeInstances = append(\n\t\t\tcomputeInstances, &compute.InstanceWithNamedPorts{\n\t\t\t\tInstance: instanceLink})\n\t}\n\treturn &compute.InstanceGroupsListInstances{\n\t\tItems: computeInstances,\n\t}\n}", "func (client AccessGovernanceCPClient) ListGovernanceInstances(ctx context.Context, request ListGovernanceInstancesRequest) (response ListGovernanceInstancesResponse, err error) {\n\tvar ociResponse common.OCIResponse\n\tpolicy := common.DefaultRetryPolicy()\n\tif client.RetryPolicy() != nil {\n\t\tpolicy = *client.RetryPolicy()\n\t}\n\tif request.RetryPolicy() != nil {\n\t\tpolicy = *request.RetryPolicy()\n\t}\n\tociResponse, err = common.Retry(ctx, request, client.listGovernanceInstances, 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 = ListGovernanceInstancesResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId}\n\t\t\t} else {\n\t\t\t\tresponse = ListGovernanceInstancesResponse{}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\tif convertedResponse, ok := ociResponse.(ListGovernanceInstancesResponse); ok {\n\t\tresponse = convertedResponse\n\t} else {\n\t\terr = fmt.Errorf(\"failed to convert OCIResponse into ListGovernanceInstancesResponse\")\n\t}\n\treturn\n}", "func (c *TestClient) ListInstances(project, zone string, opts ...ListCallOption) ([]*compute.Instance, error) {\n\tif c.ListInstancesFn != nil {\n\t\treturn c.ListInstancesFn(project, zone, opts...)\n\t}\n\treturn c.client.ListInstances(project, zone, opts...)\n}", "func (o *AggregatedDomain) OSPFInstances(info *bambou.FetchingInfo) (OSPFInstancesList, *bambou.Error) {\n\n\tvar list OSPFInstancesList\n\terr := bambou.CurrentSession().FetchChildren(o, OSPFInstanceIdentity, &list, info)\n\treturn list, err\n}", "func (pr *pluginRegistry) InstanceList() []*Instance {\n\tpr.mut.Lock()\n\tdefer pr.mut.Unlock()\n\n\t// this gets called in the router for every message that comes in, so it\n\t// might come to pass that this will perform poorly, but for now with a\n\t// relatively small number of instances we'll take the copy hit in exchange\n\t// for not having to think about concurrent access to the list\n\tout := make([]*Instance, len(pr.instances))\n\tcopy(out, pr.instances) // intentional shallow copy\n\treturn out\n}", "func (c *Client) ListInstances(args *ListInstancesArgs) (*ListInstancesResult, error) {\n\treturn ListInstances(c, args)\n}", "func GetInstances(asgc aws.ASGAPI, asgName *string) (aws.Instances, error) {\n\tgroup, err := findByName(asgc, asgName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tinstances := aws.Instances{}\n\n\tfor _, i := range group.instances {\n\t\tinstances.AddASGInstance(i)\n\t}\n\n\treturn instances, nil\n}", "func (c *TestClient) AggregatedListDisks(project string, opts ...ListCallOption) ([]*compute.Disk, error) {\n\tif c.AggregatedListDisksFn != nil {\n\t\treturn c.AggregatedListDisksFn(project, opts...)\n\t}\n\treturn c.client.AggregatedListDisks(project, opts...)\n}", "func (c Client) GetInstances(appName, serviceName, partitionName string) (*InstanceItemsPage, error) {\n\tvar aggregateInstanceItemsPages InstanceItemsPage\n\tvar continueToken string\n\tfor {\n\t\tbasePath := \"Applications/\" + appName + \"/$/GetServices/\" + serviceName + \"/$/GetPartitions/\" + partitionName + \"/$/GetReplicas\"\n\t\tres, err := c.getHTTP(basePath, withContinue(continueToken))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tvar instanceItemsPage InstanceItemsPage\n\t\terr = json.Unmarshal(res, &instanceItemsPage)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"could not deserialise JSON response: %+v\", err)\n\t\t}\n\n\t\taggregateInstanceItemsPages.Items = append(aggregateInstanceItemsPages.Items, instanceItemsPage.Items...)\n\n\t\tcontinueToken = getString(instanceItemsPage.ContinuationToken)\n\t\tif continueToken == \"\" {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn &aggregateInstanceItemsPages, nil\n}", "func (i *InstanceServiceHandler) List(ctx context.Context, options *ListOptions) ([]Instance, *Meta, error) {\n\treq, err := i.client.NewRequest(ctx, http.MethodGet, instancePath, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tnewValues, err := query.Values(options)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treq.URL.RawQuery = newValues.Encode()\n\n\tinstances := new(instancesBase)\n\tif err = i.client.DoWithContext(ctx, req, instances); err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn instances.Instances, instances.Meta, nil\n}", "func (c *Client) ListInstances(options *InstancesParameters) ([]Instance, *bmc.Error) {\n\tinstances := []Instance{}\n\tqueryString := url.QueryEscape(c.CompartmentID)\n\tif options != nil {\n\t\tv, _ := query.Values(*options)\n\t\tqueryString = queryString + \"&\" + v.Encode()\n\t}\n\tresp, err := c.Request(\"GET\", fmt.Sprintf(\"/instances?compartmentId=%s\", queryString), nil)\n\tif err != nil {\n\t\tlogrus.Error(err)\n\t\tbmcError := bmc.Error{Code: string(resp.StatusCode), Message: err.Error()}\n\t\treturn instances, &bmcError\n\t}\n\tlogrus.Debug(\"StatusCode: \", resp.StatusCode)\n\tif resp.StatusCode != 200 {\n\t\treturn instances, bmc.NewError(*resp)\n\t}\n\tdefer resp.Body.Close()\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tlogrus.Fatalf(\"Could not read JSON response: %s\", err)\n\t}\n\n\tif err = json.Unmarshal(body, &instances); err != nil {\n\t\tlogrus.Fatalf(\"Unmarshal impossible: %s\", err)\n\t}\n\tif options.Filter != nil {\n\t\tinstances = filterInstances(instances, *options.Filter)\n\t}\n\treturn instances, nil\n}", "func (s *Store) GetList(w http.ResponseWriter, r *http.Request, limit, offset int) (results interface{}, totalCount int, err error) {\n\tctx := r.Context()\n\tstateFilterQuery := r.URL.Query().Get(\"state\")\n\tdatasetFilterQuery := r.URL.Query().Get(\"dataset\")\n\tvar stateFilterList []string\n\tvar datasetFilterList []string\n\tlogData := log.Data{}\n\n\tif stateFilterQuery != \"\" {\n\t\tlogData[\"state_query\"] = stateFilterQuery\n\t\tstateFilterList = strings.Split(stateFilterQuery, \",\")\n\t}\n\n\tif datasetFilterQuery != \"\" {\n\t\tlogData[\"dataset_query\"] = datasetFilterQuery\n\t\tdatasetFilterList = strings.Split(datasetFilterQuery, \",\")\n\t}\n\n\tlog.Info(ctx, \"get list of instances\", logData)\n\n\tresults, totalCount, err = func() ([]*models.Instance, int, error) {\n\t\tif len(stateFilterList) > 0 {\n\t\t\tif err := models.ValidateStateFilter(stateFilterList); err != nil {\n\t\t\t\tlog.Error(ctx, \"get instances: filter state invalid\", err, logData)\n\t\t\t\treturn nil, 0, taskError{error: err, status: http.StatusBadRequest}\n\t\t\t}\n\t\t}\n\n\t\tinstancesResults, instancesTotalCount, err := s.GetInstances(ctx, stateFilterList, datasetFilterList, offset, limit)\n\t\tif err != nil {\n\t\t\tlog.Error(ctx, \"get instances: store.GetInstances returned an error\", err, logData)\n\t\t\treturn nil, 0, err\n\t\t}\n\n\t\treturn instancesResults, instancesTotalCount, nil\n\t}()\n\n\tif err != nil {\n\t\thandleInstanceErr(ctx, err, w, logData)\n\t\treturn nil, 0, err\n\t}\n\n\tlog.Info(ctx, \"get instances: request successful\", logData)\n\treturn results, totalCount, nil\n}", "func GetAutoscalingInstances(group *autoscaling.Group) []string {\n\tinstances := make([]string, len(group.Instances))\n\tfor i, v := range group.Instances {\n\t\tinstances[i] = *v.InstanceId\n\t}\n\tsort.Strings(instances)\n\treturn instances\n}", "func (f *FakeInstanceGroups) ListInstancesInInstanceGroup(name, zone string, state string) ([]*compute.InstanceWithNamedPorts, error) {\n\tig, err := f.getInstanceGroup(name, zone)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn getInstanceList(f.zonesToIGsToInstances[zone][ig]).Items, nil\n}", "func (r Virtual_ReservedCapacityGroup) GetInstances() (resp []datatypes.Virtual_ReservedCapacityGroup_Instance, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Virtual_ReservedCapacityGroup\", \"getInstances\", nil, &r.Options, &resp)\n\treturn\n}", "func GetInstances(albc aws.ALBAPI, arn *string, instances []string) (aws.Instances, error) {\n\thealthOutput, err := albc.DescribeTargetHealth(createDescribeTargetHealthInput(arn, instances))\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttgInstances := aws.Instances{}\n\tfor _, thd := range healthOutput.TargetHealthDescriptions {\n\t\ttgInstances.AddTargetGroupInstance(thd)\n\t}\n\n\treturn tgInstances, nil\n}", "func (f *gcpInstanceFetcher) GetInstances(ctx context.Context, _ bool) ([]Instances, error) {\n\t// Key by project ID, then by zone.\n\tinstanceMap := make(map[string]map[string][]*gcp.Instance)\n\tfor _, projectID := range f.ProjectIDs {\n\t\tinstanceMap[projectID] = make(map[string][]*gcp.Instance)\n\t\tfor _, zone := range f.Zones {\n\t\t\tinstanceMap[projectID][zone] = make([]*gcp.Instance, 0)\n\t\t\tvms, err := f.GCP.ListInstances(ctx, projectID, zone)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, trace.Wrap(err)\n\t\t\t}\n\t\t\tfilteredVMs := make([]*gcp.Instance, 0, len(vms))\n\t\t\tfor _, vm := range vms {\n\t\t\t\tif len(f.ServiceAccounts) > 0 && !slices.Contains(f.ServiceAccounts, vm.ServiceAccount) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif match, _, _ := services.MatchLabels(f.Labels, vm.Labels); !match {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tfilteredVMs = append(filteredVMs, vm)\n\t\t\t}\n\t\t\tinstanceMap[projectID][zone] = filteredVMs\n\t\t}\n\t}\n\n\tvar instances []Instances\n\tfor projectID, vmsByZone := range instanceMap {\n\t\tfor zone, vms := range vmsByZone {\n\t\t\tif len(vms) > 0 {\n\t\t\t\tinstances = append(instances, Instances{GCP: &GCPInstances{\n\t\t\t\t\tProjectID: projectID,\n\t\t\t\t\tZone: zone,\n\t\t\t\t\tInstances: vms,\n\t\t\t\t\tScriptName: f.Parameters[\"scriptName\"],\n\t\t\t\t\tPublicProxyAddr: f.Parameters[\"publicProxyAddr\"],\n\t\t\t\t\tParameters: []string{f.Parameters[\"token\"]},\n\t\t\t\t}})\n\t\t\t}\n\t\t}\n\t}\n\n\treturn instances, nil\n}", "func (p *Proc) GetInstances() ([]*Instance, error) {\n\tsp, err := p.GetSnapshot().FastForward()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tids, err := getProcInstanceIds(p, sp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tidStrs := []string{}\n\tfor _, id := range ids {\n\t\ts := strconv.FormatInt(id, 10)\n\t\tidStrs = append(idStrs, s)\n\t}\n\treturn getProcInstances(idStrs, sp)\n}", "func (c *MockRegistry) GetInstances(token string, url string) ([]Instance, error) {\n\treturn c.GetInstancesVal, c.GetInstancesError\n}", "func (o InstanceGroupOutput) Instances() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *InstanceGroup) pulumi.StringArrayOutput { return v.Instances }).(pulumi.StringArrayOutput)\n}", "func (l *LoadBalancer) GetInstances() []string {\n\tl.hostLock.Lock()\n\tdefer l.hostLock.Unlock()\n\tretVal := make([]string, len(l.hosts))\n\tcopy(retVal, l.hosts)\n\treturn retVal\n}", "func (m *manager) listIGInstances(name string) (sets.String, error) {\n\tnodeNames := sets.NewString()\n\tzones, err := m.ListZones(utils.AllNodesPredicate)\n\tif err != nil {\n\t\treturn nodeNames, err\n\t}\n\n\tfor _, zone := range zones {\n\t\tinstances, err := m.cloud.ListInstancesInInstanceGroup(name, zone, allInstances)\n\t\tif err != nil {\n\t\t\treturn nodeNames, err\n\t\t}\n\t\tfor _, ins := range instances {\n\t\t\tname, err := utils.KeyName(ins.Instance)\n\t\t\tif err != nil {\n\t\t\t\treturn nodeNames, err\n\t\t\t}\n\t\t\tnodeNames.Insert(name)\n\t\t}\n\t}\n\treturn nodeNames, nil\n}", "func (adm Admin) ListInstances(cluster string) (string, error) {\n\t// make sure the cluster is already setup\n\tif ok, err := adm.isClusterSetup(cluster); !ok || err != nil {\n\t\treturn \"\", ErrClusterNotSetup\n\t}\n\n\tbuilder := KeyBuilder{cluster}\n\tisPath := builder.instances()\n\tinstances, err := adm.zkClient.Children(isPath)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tvar buffer bytes.Buffer\n\tbuffer.WriteString(fmt.Sprintf(\"Existing instances in cluster %s:\\n\", cluster))\n\n\tfor _, r := range instances {\n\t\tbuffer.WriteString(\" \" + r + \"\\n\")\n\t}\n\n\treturn buffer.String(), nil\n}", "func (client BaseClient) GetFeatureInstances(ctx context.Context, featureName string, featureVersion string, versionRange string, instanceID string, tenant string) (result ListFeatureInstance, err error) {\n\tif err := validation.Validate([]validation.Validation{\n\t\t{TargetValue: featureVersion,\n\t\t\tConstraints: []validation.Constraint{{Target: \"featureVersion\", Name: validation.Pattern, Rule: `.*`, Chain: nil}}}}); err != nil {\n\t\treturn result, validation.NewError(\"beacon.BaseClient\", \"GetFeatureInstances\", err.Error())\n\t}\n\n\treq, err := client.GetFeatureInstancesPreparer(ctx, featureName, featureVersion, versionRange, instanceID, tenant)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"beacon.BaseClient\", \"GetFeatureInstances\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.GetFeatureInstancesSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"beacon.BaseClient\", \"GetFeatureInstances\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.GetFeatureInstancesResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"beacon.BaseClient\", \"GetFeatureInstances\", resp, \"Failure responding to request\")\n\t}\n\n\treturn\n}", "func (i *instances) GetInstances() map[string]resource.Instance {\n\treturn i.instances\n}", "func (p *plugin) DescribeInstances(tags map[string]string, properties bool) ([]instance.Description, error) {\n\tlog.Debug(fmt.Sprintf(\"describe-instances: %v\", tags))\n\tresults := []instance.Description{}\n\n\tgroupName := tags[group.GroupTag]\n\n\tinstances, err := findGroupInstances(p, groupName)\n\tif err != nil {\n\t\tlog.Error(\"Problems finding group instances\", \"err\", err)\n\t}\n\n\t// Iterate through group instances and find the sha from their annotation field\n\tfor _, vmInstance := range instances {\n\t\tctx, cancel := context.WithCancel(context.Background())\n\t\tdefer cancel()\n\n\t\tconfigSHA := returnDataFromVM(ctx, vmInstance, \"sha\")\n\t\tguestIP := returnDataFromVM(ctx, vmInstance, \"guestIP\")\n\n\t\t// Duplicate original tags\n\t\tvmTags := make(map[string]string)\n\t\tfor k, v := range tags {\n\t\t\tvmTags[k] = v\n\t\t}\n\n\t\tvmTags[group.ConfigSHATag] = configSHA\n\t\tvmTags[\"guestIP\"] = guestIP\n\t\tresults = append(results, instance.Description{\n\t\t\tID: instance.ID(vmInstance.Name()),\n\t\t\tLogicalID: nil,\n\t\t\tTags: vmTags,\n\t\t})\n\t}\n\tlog.Debug(\"Updating FSM\", \"Count\", len(p.fsm))\n\n\t// DIFF what the endpoint is saying as reported versus what we have in the FSM\n\tvar updatedFSM []provisioningFSM\n\tfor _, unprovisionedInstance := range p.fsm {\n\t\tvar provisioned bool\n\n\t\tfor _, provisionedInstance := range results {\n\n\t\t\tif string(provisionedInstance.ID) == unprovisionedInstance.instanceName {\n\t\t\t\tprovisioned = true\n\t\t\t\t// instance has been provisioned so break from loop\n\t\t\t\tbreak\n\t\t\t} else {\n\t\t\t\tprovisioned = false\n\t\t\t}\n\t\t}\n\t\tif provisioned == false && unprovisionedInstance.timer.After(time.Now()) && unprovisionedInstance.tags[group.GroupTag] == tags[group.GroupTag] {\n\t\t\tupdatedFSM = append(updatedFSM, unprovisionedInstance)\n\t\t}\n\t}\n\n\tp.fsm = make([]provisioningFSM, len(updatedFSM))\n\tcopy(p.fsm, updatedFSM)\n\n\tlog.Debug(\"FSM Updated\", \"Count\", len(p.fsm))\n\tfor _, unprovisionedInstances := range p.fsm {\n\t\tresults = append(results, instance.Description{\n\t\t\tID: instance.ID(unprovisionedInstances.instanceName),\n\t\t\tLogicalID: nil,\n\t\t\tTags: unprovisionedInstances.tags,\n\t\t})\n\t}\n\tif len(results) == 0 {\n\t\tlog.Info(\"No Instances found\")\n\t}\n\treturn results, nil\n}", "func (client *serviceManagerClient) ListInstances(q *Parameters) (*types.ServiceInstances, error) {\n\tinstances := &types.ServiceInstances{}\n\terr := client.list(&instances.ServiceInstances, web.ServiceInstancesURL, q)\n\n\treturn instances, err\n}", "func (c *Client) ListInstances(clusterID string) ([]CceInstance, error) {\n\tif clusterID == \"\" {\n\t\treturn nil, fmt.Errorf(\"clusterID should not be nil\")\n\t}\n\tparams := map[string]string{\n\t\t\"clusterid\": clusterID,\n\t}\n\treq, err := bce.NewRequest(\"GET\", c.GetURL(\"/v1/instance\", params), nil)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp, err := c.SendRequest(req, nil)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbodyContent, err := resp.GetBodyContent()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar insList ListInstancesResponse\n\terr = json.Unmarshal(bodyContent, &insList)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn insList.Instances, nil\n}", "func (taker TakerSQLAdminGCP) ListSQLInstances(project *reportProject) (gcpInstances []*sqladmin.DatabaseInstance, err error) {\n\tsqlInstanceResponse, silErr := taker.sqladminService.Instances.List(project.gcpProject.ProjectId).Do()\n\tif silErr == nil {\n\t\tgcpInstances = sqlInstanceResponse.Items\n\t}\n\terr = silErr\n\treturn\n}", "func (i *Instances) List(filter string) ([]string, error) {\n\tctx, cancel := context.WithCancel(context.Background())\n\tdefer cancel()\n\tc, err := vsphereLogin(i.cfg, ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer c.Logout(ctx)\n\n\tvmList, err := getInstances(i.cfg, ctx, c, filter)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tglog.V(3).Infof(\"Found %s instances matching %s: %s\",\n\t\tlen(vmList), filter, vmList)\n\n\treturn vmList, nil\n}", "func ListManagedInstances(c GCECloud, igm *compute.InstanceGroupManager) ([]*compute.ManagedInstance, error) {\n\tctx := context.Background()\n\tproject := c.Project()\n\n\tzoneName := LastComponent(igm.Zone)\n\n\t// TODO: Only select a subset of fields\n\t//\treq.Fields(\n\t//\t\tgoogleapi.Field(\"items/selfLink\"),\n\t//\t\tgoogleapi.Field(\"items/metadata/items[key='cluster-name']\"),\n\t//\t\tgoogleapi.Field(\"items/metadata/items[key='instance-template']\"),\n\t//\t)\n\n\tinstances, err := c.Compute().InstanceGroupManagers().ListManagedInstances(ctx, project, zoneName, igm.Name)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error listing ManagedInstances in %s: %v\", igm.Name, err)\n\t}\n\n\treturn instances, nil\n}", "func (cac *InstanceAdminClient) Instances(ctx context.Context) ([]*InstanceInfo, error) {\n\tctx = metadata.NewContext(ctx, cac.md)\n\treq := &btapb.ListInstancesRequest{\n\t\tParent: \"projects/\" + cac.project,\n\t}\n\tres, err := cac.iClient.ListInstances(ctx, req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar is []*InstanceInfo\n\tfor _, i := range res.Instances {\n\t\tm := instanceNameRegexp.FindStringSubmatch(i.Name)\n\t\tif m == nil {\n\t\t\treturn nil, fmt.Errorf(\"malformed instance name %q\", i.Name)\n\t\t}\n\t\tis = append(is, &InstanceInfo{\n\t\t\tName: m[2],\n\t\t\tDisplayName: i.DisplayName,\n\t\t})\n\t}\n\treturn is, nil\n}", "func ManagedInstances(ctx context.Context, logger logr.Logger, cl client.Client) error {\n\tlogger.Info(\"looking for managed instances to upgrade\")\n\n\topts := []client.ListOption{\n\t\tclient.MatchingLabels(map[string]string{\n\t\t\t\"app.kubernetes.io/managed-by\": \"opentelemetry-operator\",\n\t\t}),\n\t}\n\tlist := &v1alpha1.OpenTelemetryCollectorList{}\n\tif err := cl.List(ctx, list, opts...); err != nil {\n\t\treturn fmt.Errorf(\"failed to list: %w\", err)\n\t}\n\n\tfor _, j := range list.Items {\n\t\totelcol, err := ManagedInstance(ctx, logger, cl, &j)\n\t\tif err != nil {\n\t\t\t// nothing to do at this level, just go to the next instance\n\t\t\tcontinue\n\t\t}\n\n\t\tif !reflect.DeepEqual(otelcol, j) {\n\t\t\t// the resource update overrides the status, so, keep it so that we can reset it later\n\t\t\tst := otelcol.Status\n\t\t\tif err := cl.Update(ctx, otelcol); err != nil {\n\t\t\t\tlogger.Error(err, \"failed to apply changes to instance\", \"name\", otelcol.Name, \"namespace\", otelcol.Namespace)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// the status object requires its own update\n\t\t\totelcol.Status = st\n\t\t\tif err := cl.Status().Update(ctx, otelcol); err != nil {\n\t\t\t\tlogger.Error(err, \"failed to apply changes to instance's status object\", \"name\", otelcol.Name, \"namespace\", otelcol.Namespace)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tlogger.Info(\"instance upgraded\", \"name\", otelcol.Name, \"namespace\", otelcol.Namespace, \"version\", otelcol.Status.Version)\n\t\t}\n\t}\n\n\tif len(list.Items) == 0 {\n\t\tlogger.Info(\"no instances to upgrade\")\n\t}\n\n\treturn nil\n}", "func getInstances(ec2Service *ec2.EC2) ([]ec2.Instance, error) {\n\tresult, err := ec2Service.DescribeInstances(nil)\n\toutput := make([]ec2.Instance, 0)\n\n\tif err == nil {\n\t\tfor _, v := range result.Reservations {\n\t\t\tfor _, instance := range v.Instances {\n\t\t\t\toutput = append(output, *instance)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn output, err\n}", "func (a Access) ListDBInstances() (*DBInstances, error) {\n\turl := fmt.Sprintf(\"%s%s/instances\", RDB_URL, a.TenantID)\n\tbody, err := a.baseRequest(url, \"GET\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdbs := &DBInstances{}\n\terr = json.Unmarshal(body, dbs)\n\treturn dbs, err\n}", "func (p *OnPrem) GetInstances(ctx *Context) ([]CloudInstance, error) {\n\treturn nil, errors.New(\"un-implemented\")\n}", "func (sd *ServerDiscovery) GetInstances() (addresses []ServerAddress) {\n\tfor _, a := range sd.list {\n\t\taddresses = append(addresses, a)\n\t}\n\treturn addresses\n}", "func (p *ProxMox) ListInstances(ctx *lepton.Context) error {\n\n\treq, err := http.NewRequest(\"GET\", p.apiURL+\"/api2/json/nodes/\"+p.nodeNAME+\"/qemu\", nil)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn err\n\t}\n\n\ttr := &http.Transport{\n\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: true},\n\t}\n\tclient := &http.Client{Transport: tr}\n\n\treq.Header.Add(\"Authorization\", \"PVEAPIToken=\"+p.tokenID+\"=\"+p.secret)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\tbody, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn err\n\t}\n\n\tir := &InstanceResponse{}\n\tjson.Unmarshal([]byte(body), ir)\n\n\ttable := tablewriter.NewWriter(os.Stdout)\n\ttable.SetHeader([]string{\"ID\", \"Name\", \"MainIP\", \"Status\", \"ImageID\"})\n\ttable.SetHeaderColor(\n\t\ttablewriter.Colors{tablewriter.Bold, tablewriter.FgCyanColor},\n\t\ttablewriter.Colors{tablewriter.Bold, tablewriter.FgCyanColor},\n\t\ttablewriter.Colors{tablewriter.Bold, tablewriter.FgCyanColor},\n\t\ttablewriter.Colors{tablewriter.Bold, tablewriter.FgCyanColor},\n\t\ttablewriter.Colors{tablewriter.Bold, tablewriter.FgCyanColor})\n\ttable.SetRowLine(true)\n\n\tfor _, instance := range ir.Data {\n\t\tvar row []string\n\t\trow = append(row, strconv.Itoa(instance.VMID))\n\t\trow = append(row, instance.Name)\n\t\trow = append(row, \"\")\n\t\trow = append(row, instance.Status)\n\t\trow = append(row, \"\")\n\t\ttable.Append(row)\n\t}\n\n\ttable.Render()\n\n\treturn nil\n}", "func (adm Admin) ListInstances(cluster string) (string, error) {\n\tconn := newConnection(adm.ZkSvr)\n\terr := conn.Connect()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer conn.Disconnect()\n\n\t// make sure the cluster is already setup\n\tif ok, err := conn.IsClusterSetup(cluster); !ok || err != nil {\n\t\treturn \"\", ErrClusterNotSetup\n\t}\n\n\tkeys := KeyBuilder{cluster}\n\tisPath := keys.instances()\n\tinstances, err := conn.Children(isPath)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tvar buffer bytes.Buffer\n\tbuffer.WriteString(fmt.Sprintf(\"Existing instances in cluster %s:\\n\", cluster))\n\n\tfor _, r := range instances {\n\t\tbuffer.WriteString(\" \" + r + \"\\n\")\n\t}\n\n\treturn buffer.String(), nil\n}", "func (ec2Mgr *ec2InstanceManager) ListInstances(instanceIds ...string) ([]common.Instance, error) {\n\tec2InputParameters := &ec2.DescribeInstancesInput{\n\t\tInstanceIds: aws.StringSlice(instanceIds),\n\t}\n\n\tvar instances []common.Instance\n\tec2Mgr.ec2API.DescribeInstancesPages(ec2InputParameters, func(page *ec2.DescribeInstancesOutput, lastPage bool) bool {\n\t\tfor _, reservation := range page.Reservations {\n\t\t\tfor _, instance := range reservation.Instances {\n\t\t\t\tinstances = append(instances, instance)\n\t\t\t}\n\t\t}\n\t\treturn true\n\t})\n\n\treturn instances, nil\n}", "func (c *MetricsService) GetInstances(options ...OptionFunc) (*[]Instance, *Response, error) {\n\treq, err := c.client.newRequest(CONSOLE, \"GET\", \"v3/metrics/instances\", nil, options)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tvar response MetricsResponse\n\n\tresp, err := c.client.do(req, &response)\n\tif err != nil {\n\t\tif resp != nil {\n\t\t\tresp.Error = response.Error\n\t\t}\n\t\treturn nil, resp, err\n\t}\n\treturn &response.Data.Instances, resp, err\n}", "func (client *Client) Instances() ([]Instance, error) {\n\toutput := new(bytes.Buffer)\n\n\tif err := client.director.RunAuthenticatedCommand(\n\t\toutput,\n\t\tclient.stderr,\n\t\tfalse,\n\t\t\"--deployment\",\n\t\tconcourseDeploymentName,\n\t\t\"instances\",\n\t\t\"--json\",\n\t); err != nil {\n\t\t// if there is an error, copy the stdout to the main stdout to help debugging\n\t\treturn nil, err\n\t}\n\n\tjsonOutput := struct {\n\t\tTables []struct {\n\t\t\tRows []struct {\n\t\t\t\tInstance string `json:\"instance\"`\n\t\t\t\tIPs string `json:\"ips\"`\n\t\t\t\tProcessState string `json:\"process_state\"`\n\t\t\t} `json:\"Rows\"`\n\t\t} `json:\"Tables\"`\n\t}{}\n\n\tif err := json.NewDecoder(output).Decode(&jsonOutput); err != nil {\n\t\treturn nil, err\n\t}\n\n\tinstances := []Instance{}\n\n\tfor _, table := range jsonOutput.Tables {\n\t\tfor _, row := range table.Rows {\n\t\t\tinstances = append(instances, Instance{\n\t\t\t\tName: row.Instance,\n\t\t\t\tIP: row.IPs,\n\t\t\t\tState: row.ProcessState,\n\t\t\t})\n\t\t}\n\t}\n\n\treturn instances, nil\n}", "func TestListInstances(t *testing.T) {\n\tinstances := []*aws.Instance{\n\t\t{\n\t\t\tHostname: \"testHostname1\",\n\t\t\tIPAddress: \"10.10.10.1\",\n\t\t\tID: \"i-xxxxxxxxxxxxxxxx1\",\n\t\t\tPrivateDNSName: \"test1.local\",\n\t\t\tName: \"testNode1\",\n\t\t\tOSName: \"Amazon Linux\",\n\t\t\tOSType: \"Linux\",\n\t\t\tOSVersion: \"2\",\n\t\t},\n\t\t{\n\t\t\tHostname: \"testHostname2\",\n\t\t\tIPAddress: \"10.10.10.2\",\n\t\t\tID: \"i-xxxxxxxxxxxxxxxx2\",\n\t\t\tPrivateDNSName: \"test2.local\",\n\t\t\tName: \"testNode2\",\n\t\t\tOSName: \"Ubuntu\",\n\t\t\tOSType: \"Linux\",\n\t\t\tOSVersion: \"18.04\",\n\t\t},\n\t}\n\tinteractive := false\n\tformat := FormatText\n\tinput := StartInput{\n\t\tOutputFormat: &format,\n\t\tInteractive: &interactive,\n\t}\n\n\tctrl := gomock.NewController(t)\n\tdefer ctrl.Finish()\n\tm := NewMockCloudInstances(ctrl) // skipcq: SCC-compile\n\n\tm.EXPECT().ListInstances().Return(instances, nil)\n\n\tassert.NoError(t, input.listInstances(m))\n\t// TODO test integractive part\n}", "func (cl *Class) Instances() []*Instance {\n\tinstptr := C.EnvGetNextInstanceInClass(cl.env.env, cl.clptr, nil)\n\n\tret := make([]*Instance, 0, 10)\n\tfor instptr != nil {\n\t\tret = append(ret, createInstance(cl.env, instptr))\n\t\tinstptr = C.EnvGetNextInstanceInClass(cl.env.env, cl.clptr, instptr)\n\t}\n\treturn ret\n}", "func (c *InstancesAggregatedListCall) Do(call *v1.InstancesAggregatedListCall, opts ...googleapi.CallOption) (*v1.InstanceAggregatedList, error) {\n\treturn call.Do(opts...)\n}", "func TestGetAllInstances(t *testing.T) {\n\tctx, cancelFunc := context.WithTimeout(context.Background(), standardTimeout)\n\tdefer cancelFunc()\n\n\tinstances, err := bat.StartRandomInstances(ctx, \"\", 3)\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to launch instance: %v\", err)\n\t}\n\n\tscheduled, err := bat.WaitForInstancesLaunch(ctx, \"\", instances, false)\n\tdefer func() {\n\t\t_, err := bat.DeleteInstances(ctx, \"\", scheduled)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Failed to delete instances: %v\", err)\n\t\t}\n\t}()\n\tif err != nil {\n\t\tt.Fatalf(\"Instance %s did not launch: %v\", instances[0], err)\n\t}\n\n\tinstanceDetails, err := bat.GetAllInstances(ctx, \"\")\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to retrieve instances: %v\", err)\n\t}\n\n\tfor _, instance := range instances {\n\t\tinstanceDetail, ok := instanceDetails[instance]\n\t\tif !ok {\n\t\t\tt.Fatalf(\"Failed to retrieve instance %s\", instance)\n\t\t}\n\n\t\t// Check some basic information\n\n\t\tif instanceDetail.FlavorID == \"\" || instanceDetail.HostID == \"\" ||\n\t\t\tinstanceDetail.TenantID == \"\" || instanceDetail.MacAddress == \"\" ||\n\t\t\tinstanceDetail.PrivateIP == \"\" {\n\t\t\tt.Fatalf(\"Instance missing information: %+v\", instanceDetail)\n\t\t}\n\t}\n}", "func InstancesGet(w http.ResponseWriter, r *http.Request) {\n\tapp, err := contextimpl.GetApp(r.Context())\n\tif err != nil {\n\t\thelper.RespondWithMessage(w, r, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\n\twebContainerIDs, err := common.GetWebContainerIDs(app.Name)\n\tif err != nil {\n\t\thelper.RespondWithMessage(w, r, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\n\tis := service.NewInstancesService()\n\tinstances, status, message := is.GetInstancesInfo(webContainerIDs)\n\tif status != http.StatusOK {\n\t\thelper.RespondWithMessage(w, r, status, message)\n\t\treturn\n\t}\n\n\thelper.RespondWithData(w, r, status, instances)\n}", "func (taker *TakerGCP) ListVersionInstances(rv *reportVersion) (instances []*appengine.Instance, err error) {\n\tversionsService := appengine.NewAppsServicesVersionsService(taker.appEngine)\n\tif instancesResponse, instanceErr := versionsService.Instances.List(rv.service.application.gcpApplication.Id, rv.service.gcpService.Id, rv.gcpVersion.Id).Do(); instanceErr == nil {\n\t\tinstances = instancesResponse.Instances\n\t} else {\n\t\terr = instanceErr\n\t}\n\treturn\n}", "func (p *ProxMox) GetInstances(ctx *lepton.Context) ([]lepton.CloudInstance, error) {\n\tvar cloudInstances []lepton.CloudInstance\n\treturn cloudInstances, nil\n}", "func newInstances(pod *Pod, prov provider.DataCenter, cfg *config.Instances) (*instances, error) {\n\tlog.Debug(\"Initializing Instances\")\n\n\ti := &instances{\n\t\tResources: resource.NewResources(),\n\t\tpod: pod,\n\t\tinstances: map[string]resource.Instance{},\n\t}\n\n\t// The reference to the network resource.\n\tnet := pod.Cluster().Compute().DataCenter().Network()\n\n\t// The availability zones available to these instances.\n\tavailabilityZones := net.AvailabilityZones()\n\n\t// The subnet group associated with these instances.\n\tsubnetGroup := net.SubnetGroups().Find(pod.SubnetGroup())\n\tif subnetGroup == nil {\n\t\treturn nil, fmt.Errorf(\"Cannot find subnet group %s configured for pod %s\", pod.SubnetGroup(), pod.Name())\n\t}\n\n\t// The keypair to be used with these instances.\n\tkeypair := pod.Cluster().Compute().KeyPair()\n\n\tn := 0\n\tfor _, conf := range *cfg {\n\t\t// Ensure the instance is uniquely named.\n\t\tif i.Find(conf.Name()) != nil {\n\t\t\treturn nil, fmt.Errorf(\"Instance name %q must be unique but is used multiple times\", conf.Name())\n\t\t}\n\n\t\t// The availability zone for this instance. Chosing via round robin. Always starting at 0.\n\t\taz := availabilityZones[n%len(availabilityZones)]\n\n\t\t// Get the subnet associated with the AZ.\n\t\tsubnetName := pod.SubnetGroup() + \"-\" + az\n\t\tsubnet := subnetGroup.Find(subnetName)\n\t\tif subnet == nil {\n\t\t\treturn nil, fmt.Errorf(\"Cannot find subnet %s configured for instance %s\", subnetName, conf.Name())\n\t\t}\n\n\t\tinstance, err := newInstance(pod, subnet, keypair, prov, conf)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ti.instances[instance.Name()] = instance\n\t\ti.Append(instance)\n\n\t\tn++\n\t}\n\treturn i, nil\n}", "func (gc *GceCache) GetMigInstances(migRef GceRef) ([]cloudprovider.Instance, bool) {\n\tgc.cacheMutex.Lock()\n\tdefer gc.cacheMutex.Unlock()\n\n\tinstances, found := gc.instances[migRef]\n\tif found {\n\t\tklog.V(5).Infof(\"Instances cache hit for %s\", migRef)\n\t}\n\treturn append([]cloudprovider.Instance{}, instances...), found\n}", "func (a InstancePoolsAPI) List() (ipl InstancePoolList, err error) {\n\terr = a.C.Get(\"/instance-pools/list\", nil, &ipl)\n\treturn\n}", "func (c *InstanceManagerClient) InstanceList() (map[string]longhorn.InstanceProcess, error) {\n\tif err := CheckInstanceManagerCompatibility(c.apiMinVersion, c.apiVersion); err != nil {\n\t\treturn nil, err\n\t}\n\n\tresult := map[string]longhorn.InstanceProcess{}\n\n\tif c.GetAPIVersion() < 4 {\n\t\t/* Fall back to the old way of listing processes */\n\t\tprocesses, err := c.processManagerGrpcClient.ProcessList()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresult := map[string]longhorn.InstanceProcess{}\n\t\tfor name, process := range processes {\n\t\t\tresult[name] = *parseProcess(imapi.RPCToProcess(process))\n\t\t}\n\t\treturn result, nil\n\t}\n\n\tinstances, err := c.instanceServiceGrpcClient.InstanceList()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor name, instance := range instances {\n\t\tresult[name] = *parseInstance(instance)\n\t}\n\n\treturn result, nil\n}", "func ValidateInstances(sl validator.StructLevel) {\n\tinstances := sl.Current().Interface().(Instances)\n\n\tif (instances.Count == 0 || instances.Percentage == 0) && (float64(instances.Count)+instances.Percentage > 0) {\n\t\treturn\n\t}\n\n\tsl.ReportError(instances.Count, \"count\", \"Count\", \"count_or_percentage\", \"\")\n\tsl.ReportError(instances.Percentage, \"percentage\", \"Percentage\", \"count_or_percentage\", \"\")\n}", "func (f *FakeInstanceGroups) ListInstanceGroups(zone string) ([]*compute.InstanceGroup, error) {\n\tigs := []*compute.InstanceGroup{}\n\tfor ig := range f.zonesToIGsToInstances[zone] {\n\t\tigs = append(igs, ig)\n\t}\n\treturn igs, nil\n}", "func getInstances(client elasticsearchserviceiface.ElasticsearchServiceAPI) *elasticsearchservice.ListDomainNamesOutput {\n\tinput := &elasticsearchservice.ListDomainNamesInput{}\n\n\tresult, err := client.ListDomainNames(input)\n\tif err != nil {\n\t\tlog.Fatal(\"Not able to get instances\", err)\n\t}\n\treturn result\n}", "func (b *AccessReviewRequestBuilder) Instances() *AccessReviewInstancesCollectionRequestBuilder {\n\tbb := &AccessReviewInstancesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}\n\tbb.baseURL += \"/instances\"\n\treturn bb\n}", "func ExampleSQLServerInstancesClient_NewListPager() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclientFactory, err := armazurearcdata.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := clientFactory.NewSQLServerInstancesClient().NewListPager(nil)\n\tfor pager.More() {\n\t\tpage, err := pager.NextPage(ctx)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"failed to advance page: %v\", err)\n\t\t}\n\t\tfor _, v := range page.Value {\n\t\t\t// You could use page here. We use blank identifier for just demo purposes.\n\t\t\t_ = v\n\t\t}\n\t\t// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.\n\t\t// page.SQLServerInstanceListResult = armazurearcdata.SQLServerInstanceListResult{\n\t\t// \tValue: []*armazurearcdata.SQLServerInstance{\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"sqlServerInstance1\"),\n\t\t// \t\t\tType: to.Ptr(\"Microsoft.AzureArcData/SqlServerInstances\"),\n\t\t// \t\t\tID: to.Ptr(\"/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/SqlServerInstances/sqlServerInstance1\"),\n\t\t// \t\t\tSystemData: &armazurearcdata.SystemData{\n\t\t// \t\t\t\tCreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2020-01-01T17:18:19.1234567Z\"); return t}()),\n\t\t// \t\t\t\tCreatedBy: to.Ptr(\"user1\"),\n\t\t// \t\t\t\tCreatedByType: to.Ptr(armazurearcdata.CreatedByTypeUser),\n\t\t// \t\t\t\tLastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2020-01-02T17:18:19.1234567Z\"); return t}()),\n\t\t// \t\t\t\tLastModifiedBy: to.Ptr(\"user2\"),\n\t\t// \t\t\t\tLastModifiedByType: to.Ptr(armazurearcdata.CreatedByTypeUser),\n\t\t// \t\t\t},\n\t\t// \t\t\tLocation: to.Ptr(\"northeurope\"),\n\t\t// \t\t\tTags: map[string]*string{\n\t\t// \t\t\t\t\"mytag\": to.Ptr(\"myval\"),\n\t\t// \t\t\t},\n\t\t// \t\t\tProperties: &armazurearcdata.SQLServerInstanceProperties{\n\t\t// \t\t\t\tAzureDefenderStatus: to.Ptr(armazurearcdata.DefenderStatusProtected),\n\t\t// \t\t\t\tAzureDefenderStatusLastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2020-01-02T17:18:19.1234567Z\"); return t}()),\n\t\t// \t\t\t\tCollation: to.Ptr(\"collation\"),\n\t\t// \t\t\t\tContainerResourceID: to.Ptr(\"Resource id of hosting Arc Machine\"),\n\t\t// \t\t\t\tCreateTime: to.Ptr(\"01/01/2020 01:01:01\"),\n\t\t// \t\t\t\tCurrentVersion: to.Ptr(\"2008 R2\"),\n\t\t// \t\t\t\tEdition: to.Ptr(armazurearcdata.EditionTypeDeveloper),\n\t\t// \t\t\t\tHostType: to.Ptr(armazurearcdata.HostTypePhysicalServer),\n\t\t// \t\t\t\tInstanceName: to.Ptr(\"name of instance\"),\n\t\t// \t\t\t\tLicenseType: to.Ptr(armazurearcdata.ArcSQLServerLicenseTypeFree),\n\t\t// \t\t\t\tPatchLevel: to.Ptr(\"patchlevel\"),\n\t\t// \t\t\t\tProductID: to.Ptr(\"sql id\"),\n\t\t// \t\t\t\tStatus: to.Ptr(armazurearcdata.ConnectionStatusRegistered),\n\t\t// \t\t\t\tTCPDynamicPorts: to.Ptr(\"1433\"),\n\t\t// \t\t\t\tTCPStaticPorts: to.Ptr(\"1433\"),\n\t\t// \t\t\t\tVCore: to.Ptr(\"4\"),\n\t\t// \t\t\t\tVersion: to.Ptr(armazurearcdata.SQLVersionSQLServer2012),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"sqlServerInstance2\"),\n\t\t// \t\t\tType: to.Ptr(\"Microsoft.AzureArcData/SqlServerInstances\"),\n\t\t// \t\t\tID: to.Ptr(\"/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/SqlServerInstances/sqlServerInstance2\"),\n\t\t// \t\t\tSystemData: &armazurearcdata.SystemData{\n\t\t// \t\t\t\tCreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2020-01-01T17:18:19.1234567Z\"); return t}()),\n\t\t// \t\t\t\tCreatedBy: to.Ptr(\"user1\"),\n\t\t// \t\t\t\tCreatedByType: to.Ptr(armazurearcdata.CreatedByTypeUser),\n\t\t// \t\t\t\tLastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2020-01-02T17:18:19.1234567Z\"); return t}()),\n\t\t// \t\t\t\tLastModifiedBy: to.Ptr(\"user2\"),\n\t\t// \t\t\t\tLastModifiedByType: to.Ptr(armazurearcdata.CreatedByTypeUser),\n\t\t// \t\t\t},\n\t\t// \t\t\tLocation: to.Ptr(\"northeurope\"),\n\t\t// \t\t\tTags: map[string]*string{\n\t\t// \t\t\t\t\"mytag\": to.Ptr(\"myval\"),\n\t\t// \t\t\t},\n\t\t// \t\t\tProperties: &armazurearcdata.SQLServerInstanceProperties{\n\t\t// \t\t\t\tAzureDefenderStatus: to.Ptr(armazurearcdata.DefenderStatusProtected),\n\t\t// \t\t\t\tAzureDefenderStatusLastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2020-01-02T17:18:19.1234567Z\"); return t}()),\n\t\t// \t\t\t\tCollation: to.Ptr(\"collation\"),\n\t\t// \t\t\t\tContainerResourceID: to.Ptr(\"Arc Machine Name\"),\n\t\t// \t\t\t\tCreateTime: to.Ptr(\"01/01/2020 01:01:01\"),\n\t\t// \t\t\t\tCurrentVersion: to.Ptr(\"2008 R2\"),\n\t\t// \t\t\t\tEdition: to.Ptr(armazurearcdata.EditionTypeDeveloper),\n\t\t// \t\t\t\tInstanceName: to.Ptr(\"name of instance\"),\n\t\t// \t\t\t\tLicenseType: to.Ptr(armazurearcdata.ArcSQLServerLicenseTypeFree),\n\t\t// \t\t\t\tPatchLevel: to.Ptr(\"patchlevel\"),\n\t\t// \t\t\t\tProductID: to.Ptr(\"sql id\"),\n\t\t// \t\t\t\tStatus: to.Ptr(armazurearcdata.ConnectionStatusConnected),\n\t\t// \t\t\t\tTCPDynamicPorts: to.Ptr(\"1433\"),\n\t\t// \t\t\t\tTCPStaticPorts: to.Ptr(\"1433\"),\n\t\t// \t\t\t\tVCore: to.Ptr(\"4\"),\n\t\t// \t\t\t\tVersion: to.Ptr(armazurearcdata.SQLVersionSQLServer2017),\n\t\t// \t\t\t},\n\t\t// \t}},\n\t\t// }\n\t}\n}", "func (adm Admin) GetInstances(cluster string) error {\n\tkb := KeyBuilder{cluster}\n\tinstancesKey := kb.instances()\n\n\tdata, _, err := adm.zkClient.Get(instancesKey)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, c := range data {\n\t\tfmt.Println(c)\n\t}\n\n\treturn nil\n}", "func newBaseInstanceList(allocateCIDR bool, clusterCIDR *net.IPNet, subnetMaskSize int) *baseInstanceList {\n\tcidrSet, _ := cidrset.NewCIDRSet(clusterCIDR, subnetMaskSize)\n\treturn &baseInstanceList{\n\t\tallocateCIDR: allocateCIDR,\n\t\tclusterCIDR: clusterCIDR,\n\t\tsubnetMaskSize: subnetMaskSize,\n\t\tcidrSet: cidrSet,\n\t\tinstances: make(map[meta.Key]*baseInstance),\n\t}\n}", "func (r *InstanceRead) list(q *msg.Request, mr *msg.Result) {\n\tvar (\n\t\terr error\n\t\tversion int64\n\t\tisInherited bool\n\t\trows *sql.Rows\n\t\tnullRepositoryID, nullBucketID *sql.NullString\n\t\tinstanceID, checkID, configID string\n\t\tobjectID, objectType, status, nextStatus string\n\t\trepositoryID, bucketID, instanceConfigID string\n\t)\n\n\tswitch q.Instance.ObjectType {\n\tcase msg.EntityRepository:\n\t\tnullRepositoryID.String = q.Instance.ObjectID\n\t\tnullRepositoryID.Valid = true\n\tcase msg.EntityBucket:\n\t\tnullBucketID.String = q.Instance.ObjectID\n\t\tnullBucketID.Valid = true\n\tdefault:\n\t\t// only run an unscoped query if the flag has been explicitly\n\t\t// set\n\t\tif !(q.Flag.Unscoped && q.Action == msg.ActionAll) {\n\t\t\tmr.NotImplemented(\n\t\t\t\tfmt.Errorf(\"Instance listing for entity\"+\n\t\t\t\t\t\" type %s is currently not implemented\",\n\t\t\t\t\tq.Instance.ObjectType,\n\t\t\t\t),\n\t\t\t)\n\t\t\treturn\n\t\t}\n\t}\n\n\tif rows, err = r.stmtList.Query(\n\t\tnullRepositoryID,\n\t\tnullBucketID,\n\t); err != nil {\n\t\tmr.ServerError(err, q.Section)\n\t\treturn\n\t}\n\n\tfor rows.Next() {\n\t\tif err = rows.Scan(\n\t\t\t&instanceID,\n\t\t\t&version,\n\t\t\t&checkID,\n\t\t\t&configID,\n\t\t\t&instanceConfigID,\n\t\t\t&nullRepositoryID,\n\t\t\t&nullBucketID,\n\t\t\t&objectID,\n\t\t\t&objectType,\n\t\t\t&status,\n\t\t\t&nextStatus,\n\t\t\t&isInherited,\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\n\t\tif nullRepositoryID.Valid {\n\t\t\trepositoryID = nullRepositoryID.String\n\t\t}\n\t\tif nullBucketID.Valid {\n\t\t\tbucketID = nullBucketID.String\n\t\t}\n\n\t\tmr.Instance = append(mr.Instance, proto.Instance{\n\t\t\tID: instanceID,\n\t\t\tVersion: uint64(version),\n\t\t\tCheckID: checkID,\n\t\t\tConfigID: configID,\n\t\t\tInstanceConfigID: instanceConfigID,\n\t\t\tRepositoryID: repositoryID,\n\t\t\tBucketID: bucketID,\n\t\t\tObjectID: objectID,\n\t\t\tObjectType: objectType,\n\t\t\tCurrentStatus: status,\n\t\t\tNextStatus: nextStatus,\n\t\t\tIsInherited: isInherited,\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 List(client *golangsdk.ServiceClient, instanceId string, opts ListOptsBuilder) pagination.Pager {\n\turl := rootURL(client, instanceId)\n\tif opts != nil {\n\t\tquery, err := opts.ToListOptsQuery()\n\t\tif err != nil {\n\t\t\treturn pagination.Pager{Err: err}\n\t\t}\n\t\turl += query\n\t}\n\n\treturn pagination.NewPager(client, url, func(r pagination.PageResult) pagination.Page {\n\t\treturn APIPage{pagination.SinglePageBase(r)}\n\t})\n}", "func (r Virtual_ReservedCapacityGroup) GetAvailableInstances() (resp []datatypes.Virtual_ReservedCapacityGroup_Instance, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Virtual_ReservedCapacityGroup\", \"getAvailableInstances\", nil, &r.Options, &resp)\n\treturn\n}", "func (o *ListInstancesParams) WithHTTPClient(client *http.Client) *ListInstancesParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func GetInstances(cmd *cobra.Command, params util.ClusterParams, flagName string) ([]string, error) {\n\tif all, _ := cmd.Flags().GetBool(\"all\"); all {\n\t\treturn instances.List(params)\n\t}\n\treturn cmd.Flags().GetStringSlice(flagName)\n}", "func computeInstanceIAMPolicy(ctx context.Context, g *google, resourceType string, filters *filter.Filter) ([]provider.Resource, error) {\n\tf := initializeFilter(filters)\n\tlist, err := g.gcpr.ListInstances(ctx, f)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to list compute instances from reader\")\n\t}\n\tresources := make([]provider.Resource, 0)\n\tfor zone, instances := range list {\n\t\tfor _, instance := range instances {\n\t\t\tr := provider.NewResource(fmt.Sprintf(\"projects/%s/zones/%s/instances/%s\", g.Project(), zone, instance.Name), resourceType, g)\n\t\t\tresources = append(resources, r)\n\t\t}\n\t}\n\treturn resources, nil\n}", "func (h *httpCloud) List(filter string) ([]string, error) {\n\tvar resp []string\n\tif err := h.get(h.instancesURL+path.Join(InstancesPath, filter), &resp); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn resp, nil\n}", "func (client BaseClient) GetFeatureInstancesResponder(resp *http.Response) (result ListFeatureInstance, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result.Value),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "func FilterUploadableInstances() *list.List {\n\tsyncLock.Lock()\n\tdefer syncLock.Unlock()\n\n\tret := list.New()\n\tfor _, v := range syncInstances {\n\t\tif v.instance.Role == common.ROLE_STORAGE && v.instance.Attributes[\"readonly\"] != \"true\" {\n\t\t\tret.PushBack(v.instance)\n\t\t}\n\t}\n\treturn ret\n}", "func List(client *golangsdk.ServiceClient, instanceId string, opts ListOptsBuilder) pagination.Pager {\n\turl := rootURL(client, instanceId)\n\tif opts != nil {\n\t\tquery, err := opts.ToListQuery()\n\t\tif err != nil {\n\t\t\treturn pagination.Pager{Err: err}\n\t\t}\n\t\turl += query\n\t}\n\n\treturn pagination.NewPager(client, url, func(r pagination.PageResult) pagination.Page {\n\t\treturn CustomAuthPage{pagination.SinglePageBase(r)}\n\t})\n}", "func (api *API) GetGroupInstancesStats(groupID, duration string) (*InstancesStatusStats, error) {\n\tvar instancesStats InstancesStatusStats\n\tdurationString, _, err := durationParamToPostgresTimings(durationParam(duration))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tgroup, err := api.GetGroup(groupID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpackageVersion := \"\"\n\n\tif group.Channel != nil && group.Channel.Package != nil {\n\t\tpackageVersion = group.Channel.Package.Version\n\t}\n\n\tundefinedExpr := goqu.L(\"case when status IS NULL then 1 else 0 end\")\n\tcompletedExpr := goqu.L(\"case when status = ? then 1 else 0 end\", InstanceStatusComplete)\n\tif packageVersion != \"\" {\n\t\tundefinedExpr = goqu.L(\"case when version != ? and status IS NULL then 1 else 0 end\", packageVersion)\n\t\tcompletedExpr = goqu.L(\"case when (version = ? and status IS NULL) or (status = ?) then 1 else 0 end\", packageVersion, InstanceStatusComplete)\n\t}\n\n\tquery, _, err := goqu.From(\"instance_application\").Select(\n\t\tgoqu.COUNT(\"*\").As(\"total\"),\n\t\tgoqu.COALESCE(goqu.SUM(undefinedExpr), 0).As(\"undefined\"),\n\t\tgoqu.COALESCE(goqu.SUM(goqu.L(\"case when status = ? then 1 else 0 end\", InstanceStatusError)), 0).As(\"error\"),\n\t\tgoqu.COALESCE(goqu.SUM(goqu.L(\"case when status = ? then 1 else 0 end\", InstanceStatusUpdateGranted)), 0).As(\"update_granted\"),\n\t\tgoqu.COALESCE(goqu.SUM(completedExpr), 0).As(\"complete\"),\n\t\tgoqu.COALESCE(goqu.SUM(goqu.L(\"case when status = ? then 1 else 0 end\", InstanceStatusInstalled)), 0).As(\"installed\"),\n\t\tgoqu.COALESCE(goqu.SUM(goqu.L(\"case when status = ? then 1 else 0 end\", InstanceStatusDownloaded)), 0).As(\"downloaded\"),\n\t\tgoqu.COALESCE(goqu.SUM(goqu.L(\"case when status = ? then 1 else 0 end\", InstanceStatusDownloading)), 0).As(\"downloading\"),\n\t\tgoqu.COALESCE(goqu.SUM(goqu.L(\"case when status = ? then 1 else 0 end\", InstanceStatusOnHold)), 0).As(\"onhold\"),\n\t).Where(goqu.C(\"group_id\").Eq(groupID), goqu.L(\"last_check_for_updates > now() at time zone 'utc' - interval ?\", durationString),\n\t\tgoqu.L(ignoreFakeInstanceCondition(\"instance_id\")),\n\t).ToSQL()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = api.db.QueryRowx(query).StructScan(&instancesStats)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &instancesStats, nil\n}", "func (a ProcessInstanceApi) FindInstances(processId string, page int32, perPage int32) (*InstanceCollection, *APIResponse, error) {\n\n\tvar localVarHttpMethod = strings.ToUpper(\"Get\")\n\t// create path and map variables\n\tlocalVarPath := a.Configuration.BasePath + \"/processes/{process_id}/instances\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"process_id\"+\"}\", fmt.Sprintf(\"%v\", processId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := make(map[string]string)\n\tvar localVarPostBody interface{}\n\tvar localVarFileName string\n\tvar localVarFileBytes []byte\n\t// authentication '(PasswordGrant)' required\n\t// set key with prefix in header\n\tlocalVarHeaderParams[\"Authorization\"] = a.Configuration.GetAPIKeyWithPrefix(\"Authorization\")\n\t// add default headers if any\n\tfor key := range a.Configuration.DefaultHeader {\n\t\tlocalVarHeaderParams[key] = a.Configuration.DefaultHeader[key]\n\t}\n\tlocalVarQueryParams.Add(\"page\", a.Configuration.APIClient.ParameterToString(page, \"\"))\n\tlocalVarQueryParams.Add(\"per_page\", a.Configuration.APIClient.ParameterToString(perPage, \"\"))\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{ \"application/json\", }\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"application/json\",\n\t\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tvar successPayload = new(InstanceCollection)\n\tlocalVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\n\tvar localVarURL, _ = url.Parse(localVarPath)\n\tlocalVarURL.RawQuery = localVarQueryParams.Encode()\n\tvar localVarAPIResponse = &APIResponse{Operation: \"FindInstances\", Method: localVarHttpMethod, RequestURL: localVarURL.String()}\n\tif localVarHttpResponse != nil {\n\t\tlocalVarAPIResponse.Response = localVarHttpResponse.RawResponse\n\t\tlocalVarAPIResponse.Payload = localVarHttpResponse.Body()\n\t}\n\n\tif err != nil {\n\t\treturn successPayload, localVarAPIResponse, err\n\t}\n\terr = json.Unmarshal(localVarHttpResponse.Body(), &successPayload)\n\treturn successPayload, localVarAPIResponse, err\n}", "func (inv *Inventory) matchInstances(patterns ...string) ([]string, error) {\n\trows := make([][]string, 0, len(inv.Instances))\n\tfor name, cfg := range inv.Instances {\n\t\trow := make([]string, 2+len(cfg.Tags))\n\t\trow[0] = name\n\t\trow[1] = cfg.System\n\t\tcopy(row[2:], cfg.Tags)\n\t\trows = append(rows, row)\n\t}\n\treturn matchPatterns(patterns, rows...)\n}", "func GetInstances(entriesBytes []byte, kubeAuth bool, threadPoolSize int) []string {\n\tvar instances []Instance\n\tif err := yaml.Unmarshal(entriesBytes, &instances); err != nil {\n\t\tlog.WithError(err).Fatal(\"[Vault Instance] failed to decode instance configuration\")\n\t}\n\n\tinstanceCreds, err := processInstances(instances, kubeAuth)\n\tif err != nil {\n\t\tlog.WithError(err).Fatal(\"[Vault Instance] failed to retrieve access credentials\")\n\t}\n\tinitClients(instanceCreds, threadPoolSize)\n\n\t// return list of addresses that clients were initialized for\n\taddresses := []string{}\n\tfor address := range vaultClients {\n\t\taddresses = append(addresses, address)\n\t}\n\treturn addresses\n}", "func ExampleSQLServerInstancesClient_NewListByResourceGroupPager() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclientFactory, err := armazurearcdata.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := clientFactory.NewSQLServerInstancesClient().NewListByResourceGroupPager(\"testrg\", nil)\n\tfor pager.More() {\n\t\tpage, err := pager.NextPage(ctx)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"failed to advance page: %v\", err)\n\t\t}\n\t\tfor _, v := range page.Value {\n\t\t\t// You could use page here. We use blank identifier for just demo purposes.\n\t\t\t_ = v\n\t\t}\n\t\t// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.\n\t\t// page.SQLServerInstanceListResult = armazurearcdata.SQLServerInstanceListResult{\n\t\t// \tValue: []*armazurearcdata.SQLServerInstance{\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"sqlServerInstance1\"),\n\t\t// \t\t\tType: to.Ptr(\"Microsoft.AzureArcData/SqlServerInstances\"),\n\t\t// \t\t\tID: to.Ptr(\"/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/SqlServerInstances/sqlServerInstance1\"),\n\t\t// \t\t\tSystemData: &armazurearcdata.SystemData{\n\t\t// \t\t\t\tCreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2020-01-01T17:18:19.1234567Z\"); return t}()),\n\t\t// \t\t\t\tCreatedBy: to.Ptr(\"user1\"),\n\t\t// \t\t\t\tCreatedByType: to.Ptr(armazurearcdata.CreatedByTypeUser),\n\t\t// \t\t\t\tLastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2020-01-02T17:18:19.1234567Z\"); return t}()),\n\t\t// \t\t\t\tLastModifiedBy: to.Ptr(\"user2\"),\n\t\t// \t\t\t\tLastModifiedByType: to.Ptr(armazurearcdata.CreatedByTypeUser),\n\t\t// \t\t\t},\n\t\t// \t\t\tLocation: to.Ptr(\"northeurope\"),\n\t\t// \t\t\tTags: map[string]*string{\n\t\t// \t\t\t\t\"mytag\": to.Ptr(\"myval\"),\n\t\t// \t\t\t},\n\t\t// \t\t\tProperties: &armazurearcdata.SQLServerInstanceProperties{\n\t\t// \t\t\t\tAzureDefenderStatus: to.Ptr(armazurearcdata.DefenderStatusProtected),\n\t\t// \t\t\t\tAzureDefenderStatusLastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2020-01-02T17:18:19.1234567Z\"); return t}()),\n\t\t// \t\t\t\tCollation: to.Ptr(\"collation\"),\n\t\t// \t\t\t\tContainerResourceID: to.Ptr(\"Resource id of hosting Arc Machine\"),\n\t\t// \t\t\t\tCreateTime: to.Ptr(\"01/01/2020 01:01:01\"),\n\t\t// \t\t\t\tCurrentVersion: to.Ptr(\"2012\"),\n\t\t// \t\t\t\tEdition: to.Ptr(armazurearcdata.EditionTypeDeveloper),\n\t\t// \t\t\t\tHostType: to.Ptr(armazurearcdata.HostTypePhysicalServer),\n\t\t// \t\t\t\tInstanceName: to.Ptr(\"name of instance\"),\n\t\t// \t\t\t\tLicenseType: to.Ptr(armazurearcdata.ArcSQLServerLicenseTypeFree),\n\t\t// \t\t\t\tPatchLevel: to.Ptr(\"patchlevel\"),\n\t\t// \t\t\t\tProductID: to.Ptr(\"sql id\"),\n\t\t// \t\t\t\tStatus: to.Ptr(armazurearcdata.ConnectionStatusRegistered),\n\t\t// \t\t\t\tTCPDynamicPorts: to.Ptr(\"1433\"),\n\t\t// \t\t\t\tTCPStaticPorts: to.Ptr(\"1433\"),\n\t\t// \t\t\t\tVCore: to.Ptr(\"4\"),\n\t\t// \t\t\t\tVersion: to.Ptr(armazurearcdata.SQLVersionSQLServer2012),\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"sqlServerInstance2\"),\n\t\t// \t\t\tType: to.Ptr(\"Microsoft.AzureArcData/SqlServerInstances\"),\n\t\t// \t\t\tID: to.Ptr(\"/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/testrg/providers/Microsoft.AzureArcData/SqlServerInstances/sqlServerInstance2\"),\n\t\t// \t\t\tSystemData: &armazurearcdata.SystemData{\n\t\t// \t\t\t\tCreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2020-01-01T17:18:19.1234567Z\"); return t}()),\n\t\t// \t\t\t\tCreatedBy: to.Ptr(\"user1\"),\n\t\t// \t\t\t\tCreatedByType: to.Ptr(armazurearcdata.CreatedByTypeUser),\n\t\t// \t\t\t\tLastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2020-01-02T17:18:19.1234567Z\"); return t}()),\n\t\t// \t\t\t\tLastModifiedBy: to.Ptr(\"user2\"),\n\t\t// \t\t\t\tLastModifiedByType: to.Ptr(armazurearcdata.CreatedByTypeUser),\n\t\t// \t\t\t},\n\t\t// \t\t\tLocation: to.Ptr(\"northeurope\"),\n\t\t// \t\t\tTags: map[string]*string{\n\t\t// \t\t\t\t\"mytag\": to.Ptr(\"myval\"),\n\t\t// \t\t\t},\n\t\t// \t\t\tProperties: &armazurearcdata.SQLServerInstanceProperties{\n\t\t// \t\t\t\tAzureDefenderStatus: to.Ptr(armazurearcdata.DefenderStatusProtected),\n\t\t// \t\t\t\tAzureDefenderStatusLastUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2020-01-02T17:18:19.1234567Z\"); return t}()),\n\t\t// \t\t\t\tCollation: to.Ptr(\"collation\"),\n\t\t// \t\t\t\tContainerResourceID: to.Ptr(\"Arc Machine Name\"),\n\t\t// \t\t\t\tCreateTime: to.Ptr(\"01/01/2020 01:01:01\"),\n\t\t// \t\t\t\tCurrentVersion: to.Ptr(\"2008 R2\"),\n\t\t// \t\t\t\tEdition: to.Ptr(armazurearcdata.EditionTypeDeveloper),\n\t\t// \t\t\t\tInstanceName: to.Ptr(\"name of instance\"),\n\t\t// \t\t\t\tLicenseType: to.Ptr(armazurearcdata.ArcSQLServerLicenseTypeFree),\n\t\t// \t\t\t\tPatchLevel: to.Ptr(\"patchlevel\"),\n\t\t// \t\t\t\tProductID: to.Ptr(\"sql id\"),\n\t\t// \t\t\t\tStatus: to.Ptr(armazurearcdata.ConnectionStatusConnected),\n\t\t// \t\t\t\tTCPDynamicPorts: to.Ptr(\"1433\"),\n\t\t// \t\t\t\tTCPStaticPorts: to.Ptr(\"1433\"),\n\t\t// \t\t\t\tVCore: to.Ptr(\"4\"),\n\t\t// \t\t\t\tVersion: to.Ptr(armazurearcdata.SQLVersionSQLServer2017),\n\t\t// \t\t\t},\n\t\t// \t}},\n\t\t// }\n\t}\n}", "func (r Virtual_ReservedCapacityGroup) GetOccupiedInstances() (resp []datatypes.Virtual_ReservedCapacityGroup_Instance, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Virtual_ReservedCapacityGroup\", \"getOccupiedInstances\", nil, &r.Options, &resp)\n\treturn\n}", "func (o TargetPoolOutput) Instances() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *TargetPool) pulumi.StringArrayOutput { return v.Instances }).(pulumi.StringArrayOutput)\n}", "func (m *AccessReviewHistoryDefinitionItemRequestBuilder) Instances()(*i6b98e970eebf9cd01ff666e44d13e3bb10488d6747910f84a6d2c2578cefa739.InstancesRequestBuilder) {\n return i6b98e970eebf9cd01ff666e44d13e3bb10488d6747910f84a6d2c2578cefa739.NewInstancesRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "func runInstances(message string, fn runner) {\n logger.Log(fmt.Sprintf(\"%s %v\\n\", message, process))\n for i := 0; i < cfg.Instances; i++ {\n logger.Log(fmt.Sprintf(\"...Instance %d of %d %s\\n\", i, cfg.Instances, process))\n id, _ := pid(i)\n fn(i, id)\n }\n\n}", "func (c *Client) RunInstances(args *RunInstancesArgs) ([]Instance, error) {\n\tif err := args.validate(); err != nil {\n\t\treturn nil, err\n\t}\n\tresponse := RunInstancesResponse{}\n\terr := c.Invoke(\"RunInstances\", args, &response)\n\tif err == nil {\n\t\treturn response.InstancesSet.Item, nil\n\t}\n\treturn nil, err\n}", "func ExampleServiceDiscovery_ListInstances_shared00() {\n\tsvc := servicediscovery.New(session.New())\n\tinput := &servicediscovery.ListInstancesInput{\n\t\tServiceId: aws.String(\"srv-qzpwvt2tfqcegapy\"),\n\t}\n\n\tresult, err := svc.ListInstances(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.ErrCodeServiceNotFound:\n\t\t\t\tfmt.Println(servicediscovery.ErrCodeServiceNotFound, aerr.Error())\n\t\t\tcase servicediscovery.ErrCodeInvalidInput:\n\t\t\t\tfmt.Println(servicediscovery.ErrCodeInvalidInput, 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 (l *AuthFuncListSafe) AddInstances(instances ...AuthFuncInstance) error {\n\tl.listMutex.RLock()\n\tret := l.AuthFuncList.AddInstances(instances...)\n\tl.listMutex.RUnlock()\n\treturn ret\n}", "func (s *AppsServiceOp) ListInstanceSizes(ctx context.Context) ([]*AppInstanceSize, *Response, error) {\n\tpath := fmt.Sprintf(\"%s/tiers/instance_sizes\", appsBasePath)\n\treq, err := s.client.NewRequest(ctx, http.MethodGet, path, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\troot := new(instanceSizesRoot)\n\tresp, err := s.client.Do(ctx, req, root)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\treturn root.InstanceSizes, resp, nil\n}", "func (s *storage) GetInstances() (instances []*pb.SyncInstance) {\n\tinstances = make([]*pb.SyncInstance, 0, 10)\n\ts.getValue(getInstancesOp(), func(key, val []byte) (next bool) {\n\t\tnext = true\n\t\titem := &pb.SyncInstance{}\n\t\tif err := proto.Unmarshal(val, item); err != nil {\n\t\t\tlog.Errorf(err, \"Proto unmarshal '%s' failed: %s\", val, err)\n\t\t\treturn\n\t\t}\n\t\tinstances = append(instances, item)\n\t\treturn\n\t})\n\treturn\n}", "func NewListInstancesParamsWithHTTPClient(client *http.Client) *ListInstancesParams {\n\tvar ()\n\treturn &ListInstancesParams{\n\t\tHTTPClient: client,\n\t}\n}", "func (rs *RedisService) GetInstances() ([]string, error) {\n\tconnection := rs.pool.Get()\n\tdefer connection.Close()\n\n\tinstancesMap, err := redis.StringMap(connection.Do(\"HGETALL\", heartbeatKey))\n\tnoticeError(err)\n\tif err != nil && err != redis.ErrNil {\n\t\treturn nil, err\n\t}\n\n\tinstances := []string{}\n\tfor instance, lastHeartbeatTime := range instancesMap {\n\t\tt, err := time.Parse(time.RFC3339Nano, lastHeartbeatTime)\n\t\tif err != nil {\n\t\t\tlogging.SystemErrorf(\"Error parsing instance [%s] heartbeat time [%s] string into time: %v\", instance, lastHeartbeatTime, err)\n\t\t\tcontinue\n\t\t}\n\n\t\t//account only instances with last heartbeat less than 2 minutes ago\n\t\tif time.Now().UTC().Sub(t).Seconds() <= 120 {\n\t\t\tinstances = append(instances, instance)\n\t\t}\n\t}\n\n\treturn instances, nil\n}", "func NewListInstancesParams() *ListInstancesParams {\n\tvar ()\n\treturn &ListInstancesParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (ms *MemoryStorage) Instances() []*pb.InstanceState {\n\tvar insts []*pb.InstanceState\n\tfor _, replInsts := range ms.instances {\n\t\treplInsts.Ascend(func(i btree.Item) bool {\n\t\t\tinsts = append(insts, i.(*pb.InstanceState))\n\t\t\treturn true\n\t\t})\n\t}\n\treturn insts\n}", "func (p libvirtPlugin) DescribeInstances(tags map[string]string, properties bool) ([]instance.Description, error) {\n\tconn, err := libvirt.NewConnect(p.URI)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Connecting to libvirt\")\n\t}\n\tdefer conn.Close()\n\n\tdoms, err := conn.ListAllDomains(libvirt.CONNECT_LIST_DOMAINS_ACTIVE)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Listing all domains\")\n\t}\n\n\tvar descriptions []instance.Description\n\tfor _, d := range doms {\n\n\t\tinfo, err := d.GetInfo()\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"Getting domain info\")\n\t\t}\n\t\tif info.State != libvirt.DOMAIN_RUNNING {\n\t\t\tcontinue\n\t\t}\n\t\txmldoc, err := d.GetXMLDesc(0)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"Getting domain XML\")\n\t\t}\n\t\tvar domcfg domainWithMetadata\n\t\tif err := domcfg.Unmarshal(xmldoc); err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"Unmarshalling domain XML\")\n\t\t}\n\n\t\tmeta := infrakitMetadata{}\n\t\tif domcfg.Metadata != nil {\n\t\t\tif err := meta.Unmarshal(domcfg.Metadata.Data); err != nil {\n\t\t\t\t// Assume it is not one of ours.\n\t\t\t\tcontinue\n\t\t\t}\n\t\t} else {\n\t\t\t// Assume it is not one of ours.\n\t\t\tcontinue\n\t\t}\n\n\t\tinstanceTags := make(map[string]string)\n\t\tfor _, tag := range meta.Tags {\n\t\t\tinstanceTags[tag.Key] = tag.Value\n\t\t}\n\n\t\tallMatched := true\n\t\tfor k, v := range tags {\n\t\t\tvalue, exists := instanceTags[k]\n\t\t\tif !exists || v != value {\n\t\t\t\tallMatched = false\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tlid := instance.LogicalID(meta.LogicalID)\n\t\tif allMatched {\n\t\t\tdescriptions = append(descriptions, instance.Description{\n\t\t\t\tID: instance.ID(domcfg.Name),\n\t\t\t\tLogicalID: &lid,\n\t\t\t\tTags: instanceTags,\n\t\t\t})\n\t\t}\n\n\t}\n\n\treturn descriptions, nil\n}", "func (c *MonitorComponent) Instances() []Instance {\n\tservers := c.BaseTopo().Monitors\n\tins := make([]Instance, 0, len(servers))\n\n\tfor _, s := range servers {\n\t\ts := s\n\t\tmi := &MonitorInstance{BaseInstance{\n\t\t\tInstanceSpec: s,\n\t\t\tName: c.Name(),\n\t\t\tHost: s.Host,\n\t\t\tManageHost: s.ManageHost,\n\t\t\tPort: s.Port,\n\t\t\tSSHP: s.SSHPort,\n\n\t\t\tPorts: []int{\n\t\t\t\ts.Port,\n\t\t\t},\n\t\t\tDirs: []string{\n\t\t\t\ts.DeployDir,\n\t\t\t\ts.DataDir,\n\t\t\t},\n\t\t\tStatusFn: func(_ context.Context, timeout time.Duration, _ *tls.Config, _ ...string) string {\n\t\t\t\treturn statusByHost(s.GetManageHost(), s.Port, \"/-/ready\", timeout, nil)\n\t\t\t},\n\t\t\tUptimeFn: func(_ context.Context, timeout time.Duration, tlsCfg *tls.Config) time.Duration {\n\t\t\t\treturn UptimeByHost(s.GetManageHost(), s.Port, timeout, tlsCfg)\n\t\t\t},\n\t\t}, c.Topology}\n\t\tif s.NgPort > 0 {\n\t\t\tmi.BaseInstance.Ports = append(mi.BaseInstance.Ports, s.NgPort)\n\t\t}\n\t\tins = append(ins, mi)\n\t}\n\treturn ins\n}", "func (adm Admin) GetInstances(cluster string) {\n\tconn := newConnection(adm.ZkSvr)\n\terr := conn.Connect()\n\tif err != nil {\n\t\tfmt.Println(\"Failed to connect to zookeeper.\")\n\t}\n\tdefer conn.Disconnect()\n\n\tkb := KeyBuilder{cluster}\n\tinstancesKey := kb.instances()\n\n\tdata, err := conn.Get(instancesKey)\n\tmust(err)\n\n\tfor _, c := range data {\n\t\tfmt.Println(c)\n\t}\n\n}", "func List(client *gophercloud.ServiceClient, instanceID string) pagination.Pager {\n\treturn pagination.NewPager(client, baseURL(client, instanceID), func(r pagination.PageResult) pagination.Page {\n\t\treturn DBPage{pagination.LinkedPageBase{PageResult: r}}\n\t})\n}", "func (p *Provider) List() (vm.List, error) {\n\tvar vms vm.List\n\tfor _, prj := range p.GetProjects() {\n\t\targs := []string{\"compute\", \"instances\", \"list\", \"--project\", prj, \"--format\", \"json\"}\n\n\t\t// Run the command, extracting the JSON payload\n\t\tjsonVMS := make([]jsonVM, 0)\n\t\tif err := runJSONCommand(args, &jsonVMS); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// Now, convert the json payload into our common VM type\n\t\tfor _, jsonVM := range jsonVMS {\n\t\t\tvms = append(vms, *jsonVM.toVM(prj, &p.opts))\n\t\t}\n\t}\n\n\treturn vms, nil\n}", "func (m *manager) List() ([]string, error) {\n\tvar igs []*compute.InstanceGroup\n\n\tzones, err := m.ListZones(utils.AllNodesPredicate)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, zone := range zones {\n\t\tigsForZone, err := m.cloud.ListInstanceGroups(zone)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, ig := range igsForZone {\n\t\t\tigs = append(igs, ig)\n\t\t}\n\t}\n\n\tvar names []string\n\tfor _, ig := range igs {\n\t\tif m.namer.NameBelongsToCluster(ig.Name) {\n\t\t\tnames = append(names, ig.Name)\n\t\t}\n\t}\n\n\treturn names, nil\n}", "func (o *ListInstancesParams) WithContext(ctx context.Context) *ListInstancesParams {\n\to.SetContext(ctx)\n\treturn o\n}" ]
[ "0.6108793", "0.610489", "0.60578257", "0.603559", "0.5951576", "0.58895683", "0.58663744", "0.5859857", "0.58459777", "0.58217794", "0.5792085", "0.5788797", "0.576226", "0.5758945", "0.5758534", "0.57243484", "0.5719584", "0.5700647", "0.5683925", "0.56666297", "0.56403273", "0.5634305", "0.5631485", "0.5569479", "0.55679643", "0.554031", "0.5523499", "0.54978997", "0.54873323", "0.5477264", "0.5475619", "0.5471198", "0.54630375", "0.5459369", "0.5449296", "0.5439769", "0.5427606", "0.54275966", "0.5423199", "0.53761107", "0.5368564", "0.5353096", "0.5352816", "0.53495824", "0.5335757", "0.53283125", "0.5318867", "0.5303881", "0.5301611", "0.5251128", "0.52324677", "0.5219757", "0.52056366", "0.5184147", "0.5182132", "0.51756996", "0.5169652", "0.51606816", "0.5151518", "0.5146601", "0.5138652", "0.51267016", "0.51251376", "0.5110431", "0.50902164", "0.5087356", "0.5085751", "0.50817096", "0.5079383", "0.50730544", "0.50690836", "0.50591624", "0.5050166", "0.5049302", "0.5046546", "0.5033863", "0.5030879", "0.5018414", "0.5011147", "0.50084025", "0.5007129", "0.49919847", "0.49911788", "0.49666816", "0.49638158", "0.49622312", "0.49577567", "0.49448985", "0.49219584", "0.49203894", "0.49188718", "0.49109167", "0.4902054", "0.48882017", "0.48861542", "0.4865449", "0.48649734", "0.48589742", "0.485633", "0.48562157" ]
0.8075817
0
GetDisk uses the override method GetZoneFn or the real implementation.
func (c *TestClient) GetDisk(project, zone, name string) (*compute.Disk, error) { if c.GetDiskFn != nil { return c.GetDiskFn(project, zone, name) } return c.client.GetDisk(project, zone, name) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *MockAzureCloud) Disk() azure.DisksClient {\n\treturn c.DisksClient\n}", "func (m *DisksClientMock) Get(ctx context.Context, resourceGroupName string, diskName string) (result compute.Disk, rerr *retry.Error) {\n\treturn compute.Disk{}, nil\n}", "func (r *Resources) GetDisk() float64 {\n\treturn r.DISK\n}", "func (o LocalCopyPtrOutput) Disk() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *LocalCopy) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Disk\n\t}).(pulumi.StringPtrOutput)\n}", "func (t *Template) GetDisks() []shared.Disk {\n\n\tvecs := t.GetVectors(string(shared.DiskVec))\n\tdisks := make([]shared.Disk, len(vecs))\n\n\tfor i, v := range vecs {\n\t\tdisks[i] = shared.Disk{*v}\n\t}\n\n\treturn disks\n}", "func (o LocalCopyOutput) Disk() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LocalCopy) string { return v.Disk }).(pulumi.StringOutput)\n}", "func (o *Hdd) GetDisk() string {\n\tif o == nil || o.Disk == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Disk\n}", "func DiskFactory() worker.Worker {\n\treturn &Disk{}\n}", "func (c *Compute) Disk(name string) (string, error) {\n\tdisk, err := c.Disks.Get(c.Project, c.Zone, name).Do()\n\tif err == nil {\n\t\tlog.Printf(\"found existing root disk: %q\", disk.SelfLink)\n\t\treturn disk.SelfLink, nil\n\t}\n\tlog.Printf(\"not found, creating new root disk: %q\", name)\n\top, err := c.Disks.Insert(c.Project, c.Zone, &compute.Disk{\n\t\tName: name,\n\t}).SourceImage(*image).Do()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"disk insert api call failed: %v\", err)\n\t}\n\tif err := c.wait(op); err != nil {\n\t\treturn \"\", fmt.Errorf(\"disk insert operation failed: %v\", err)\n\t}\n\tlog.Printf(\"root disk created: %q\", op.TargetLink)\n\treturn op.TargetLink, nil\n}", "func (o LocalCopyResponseOutput) Disk() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LocalCopyResponse) string { return v.Disk }).(pulumi.StringOutput)\n}", "func (o *VirtualizationIweVirtualMachine) GetDisks() []VirtualizationVmDisk {\n\tif o == nil {\n\t\tvar ret []VirtualizationVmDisk\n\t\treturn ret\n\t}\n\treturn o.Disks\n}", "func (of OperatorFactory) DiskOrder() types.DiskOrder {\n\treturn operator{}.DiskOrder()\n}", "func (of OperatorFactory) DiskOrder() types.DiskOrder {\n\treturn Operator{}.DiskOrder()\n}", "func (c *clustermgrClient) GetDiskInfo(ctx context.Context, diskID proto.DiskID) (ret *DiskInfoSimple, err error) {\n\tc.rwLock.RLock()\n\tdefer c.rwLock.RUnlock()\n\n\tspan := trace.SpanFromContextSafe(ctx)\n\tinfo, err := c.client.DiskInfo(ctx, diskID)\n\tif err != nil {\n\t\tspan.Errorf(\"get disk info failed: disk_id[%d], err[%+v]\", diskID, err)\n\t\treturn nil, err\n\t}\n\tret = &DiskInfoSimple{}\n\tret.set(info)\n\treturn ret, nil\n}", "func (r *RPCTractserverTalker) GetDiskInfo(ctx context.Context, addr string) ([]core.FsStatus, core.Error) {\n\treq := core.GetDiskInfoReq{}\n\tvar reply core.GetDiskInfoReply\n\tif err := r.cc.Send(ctx, addr, core.GetDiskInfoMethod, req, &reply); err != nil {\n\t\tlog.Errorf(\"GetDiskInfo RPC error on tractserver %s: %s\", addr, err)\n\t\treturn nil, core.ErrRPC\n\t}\n\tif reply.Err != core.NoError {\n\t\tlog.Errorf(\"GetDiskInfo error on tractserver %s: %s\", addr, reply.Err)\n\t}\n\treturn reply.Disks, reply.Err\n}", "func (o KafkaMirrorMakerOutput) DiskSpace() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *KafkaMirrorMaker) pulumi.StringPtrOutput { return v.DiskSpace }).(pulumi.StringPtrOutput)\n}", "func OpenDisk(filename string) (SectorDisk, error) {\n\text := strings.ToLower(path.Ext(filename))\n\tswitch ext {\n\tcase \".dsk\":\n\t\treturn LoadDSK(filename)\n\t}\n\treturn nil, fmt.Errorf(\"Unimplemented/unknown disk file extension %q\", ext)\n}", "func (in *Disk) DeepCopy() *Disk {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Disk)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *Disk) DeepCopy() *Disk {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Disk)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func getVirtualHardDisk(c *wssdcloudstorage.VirtualHardDisk, group string) *storage.VirtualHardDisk {\n\treturn &storage.VirtualHardDisk{\n\t\tName: &c.Name,\n\t\tID: &c.Id,\n\t\tVersion: &c.Status.Version.Number,\n\t\tVirtualHardDiskProperties: &storage.VirtualHardDiskProperties{\n\t\t\tStatuses: status.GetStatuses(c.GetStatus()),\n\t\t\tDiskSizeBytes: &c.Size,\n\t\t\tDynamic: &c.Dynamic,\n\t\t\tBlocksizebytes: &c.Blocksizebytes,\n\t\t\tLogicalsectorbytes: &c.Logicalsectorbytes,\n\t\t\tPhysicalsectorbytes: &c.Physicalsectorbytes,\n\t\t\tControllernumber: &c.Controllernumber,\n\t\t\tControllerlocation: &c.Controllerlocation,\n\t\t\tDisknumber: &c.Disknumber,\n\t\t\tVirtualMachineName: &c.VirtualmachineName,\n\t\t\tScsipath: &c.Scsipath,\n\t\t\tHyperVGeneration: c.HyperVGeneration,\n\t\t\tDiskFileFormat: c.DiskFileFormat,\n\t\t},\n\t\tTags: tags.ProtoToMap(c.Tags),\n\t}\n}", "func (s *Module) DiskLookup(id string) (disk pkg.VDisk, err error) {\n\tpath, err := s.findDisk(id)\n\n\tif err != nil {\n\t\treturn disk, err\n\t}\n\n\tdisk.Path = path\n\tstat, err := os.Stat(path)\n\tif err != nil {\n\t\treturn disk, err\n\t}\n\n\tdisk.Size = stat.Size()\n\treturn\n}", "func NewDisk(radius float64, segments int) *Geometry {\n\treturn NewDiskSector(radius, segments, 0, 2*math.Pi)\n}", "func (z *zones) GetZone(ctx context.Context) (cloudprovider.Zone, error) {\n\tklog.V(5).Info(\"GetZone()\")\n\treturn cloudprovider.Zone{\n\t\tFailureDomain: \"laptop\",\n\t\tRegion: \"virtualbox\",\n\t}, nil\n}", "func (c *gceClient) getDiskTypeURL() string {\n\treturn gceComputeAPIEndpoint + strings.Join(\n\t\t[]string{\"projects\", c.projectID, \"zones\", c.zone, \"diskTypes\", \"pd-standard\"},\n\t\t\"/\",\n\t)\n}", "func (o ClusterNodeGroupOutput) SystemDisk() ClusterNodeGroupSystemDiskOutput {\n\treturn o.ApplyT(func(v ClusterNodeGroup) ClusterNodeGroupSystemDisk { return v.SystemDisk }).(ClusterNodeGroupSystemDiskOutput)\n}", "func NewDiskCookieJar(name, path string) CookieJar {\n\tjar := &DiskCookieJar{name: name, path: path}\n\n\treturn jar\n}", "func (db *Database) DiskDB() DatabaseReader {\n\treturn db.diskdb\n}", "func (fs *FS) GetDiskFormat(ctx context.Context, disk string) (string, error) {\n\treturn fs.getDiskFormat(ctx, disk)\n}", "func (o SourceDiskEncryptionKeyOutput) SourceDisk() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v SourceDiskEncryptionKey) *string { return v.SourceDisk }).(pulumi.StringPtrOutput)\n}", "func (r Virtual_Disk_Image) GetSourceDiskImage() (resp datatypes.Virtual_Disk_Image, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Virtual_Disk_Image\", \"getSourceDiskImage\", nil, &r.Options, &resp)\n\treturn\n}", "func NewDisk(period uint, level uint8, opts interface{}) *Disk {\n\n\tallowedDisks := map[string]struct{}{}\n\tif opts != nil {\n\t\tif options, ok := opts.(map[string]interface{}); ok {\n\t\t\tif val, ok := options[\"names\"]; ok {\n\t\t\t\tif diskNames, ok := val.([]interface{}); ok {\n\t\t\t\t\tfor _, v := range diskNames {\n\t\t\t\t\t\tif diskName, ok := v.(string); ok {\n\t\t\t\t\t\t\tallowedDisks[diskName] = struct{}{}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tc := &Disk{\n\t\tlevel: level,\n\t\tperiod: period,\n\t\tallowedDisks: allowedDisks,\n\t}\n\n\tif level > 0 {\n\t\ttick := time.Tick(time.Duration(period) * time.Millisecond)\n\t\tgo func() {\n\t\t\tfor range tick {\n\t\t\t\tif err := c.scrape(); err != nil {\n\t\t\t\t\tlog.Error(err)\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\t}\n\n\treturn c\n}", "func GetDiskStats(disks cmn.SimpleKVs) DiskStats {\n\tif len(disks) < largeNumDisks {\n\t\toutput := make(DiskStats, len(disks))\n\n\t\tfor disk := range disks {\n\t\t\tstat, ok := readSingleDiskStat(disk)\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\toutput[disk] = stat\n\t\t}\n\t\treturn output\n\t}\n\n\treturn readMultipleDiskStats(disks)\n}", "func (r *VmwareMapper) MapDisk(vmSpec *kubevirtv1.VirtualMachine, dv cdiv1.DataVolume) {\n\tname := fmt.Sprintf(\"dv-%v\", dv.Name)\n\tname = utils.EnsureLabelValueLength(name)\n\tvolume := kubevirtv1.Volume{\n\t\tName: name,\n\t\tVolumeSource: kubevirtv1.VolumeSource{\n\t\t\tDataVolume: &kubevirtv1.DataVolumeSource{\n\t\t\t\tName: dv.Name,\n\t\t\t},\n\t\t},\n\t}\n\n\tkubevirtDisk := kubevirtv1.Disk{\n\t\tName: name,\n\t\tDiskDevice: kubevirtv1.DiskDevice{\n\t\t\tDisk: &kubevirtv1.DiskTarget{\n\t\t\t\tBus: busTypeVirtio,\n\t\t\t},\n\t\t},\n\t}\n\n\tvmSpec.Spec.Template.Spec.Volumes = append(vmSpec.Spec.Template.Spec.Volumes, volume)\n\tdisks := append(vmSpec.Spec.Template.Spec.Domain.Devices.Disks, kubevirtDisk)\n\n\t// Since the import controller is iterating over a map of DVs,\n\t// MapDisk gets called for each DV in a nondeterministic order which results\n\t// in the disks being in an arbitrary order. This sort ensure the disks are\n\t// attached in the same order as the devices on the source VM.\n\tsort.Slice(disks, func(i, j int) bool {\n\t\treturn disks[i].Name < disks[j].Name\n\t})\n\tvmSpec.Spec.Template.Spec.Domain.Devices.Disks = disks\n}", "func (osUtils *OsUtils) GetDiskID(pubCtx map[string]string, log *zap.SugaredLogger) (string, error) {\n\tvar diskID string\n\tvar ok bool\n\tif diskID, ok = pubCtx[common.AttributeFirstClassDiskUUID]; !ok {\n\t\treturn \"\", logger.LogNewErrorCodef(log, codes.InvalidArgument,\n\t\t\t\"attribute: %s required in publish context\",\n\t\t\tcommon.AttributeFirstClassDiskUUID)\n\t}\n\treturn diskID, nil\n}", "func (c *TestClient) ListDisks(project, zone string, opts ...ListCallOption) ([]*compute.Disk, error) {\n\tif c.ListDisksFn != nil {\n\t\treturn c.ListDisksFn(project, zone, opts...)\n\t}\n\treturn c.client.ListDisks(project, zone, opts...)\n}", "func (r Virtual_Storage_Repository) GetDiskImages() (resp []datatypes.Virtual_Disk_Image, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Virtual_Storage_Repository\", \"getDiskImages\", nil, &r.Options, &resp)\n\treturn\n}", "func (d *DiskStore) Name() string { return nameDisk }", "func (o *Hdd) GetDiskOk() (*string, bool) {\n\tif o == nil || o.Disk == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Disk, true\n}", "func fakeListZonalDisk(cfg *config.Config, name string, zone string, policies []string, callCount int) gcpRequest {\n\tscope := fmt.Sprintf(\"zones/%s\", zone)\n\tdisk := fakeZonalDisk(cfg, name, zone, policies)\n\treturn fakeDiskAggregatedListRequest(cfg, scope, disk, callCount)\n}", "func (o FioSpecVolumeVolumeSourceAzureDiskOutput) DiskName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v FioSpecVolumeVolumeSourceAzureDisk) string { return v.DiskName }).(pulumi.StringOutput)\n}", "func (c *clustermgrClient) GetMigratingDisk(ctx context.Context, taskType proto.TaskType, diskID proto.DiskID) (meta *MigratingDiskMeta, err error) {\n\tspan := trace.SpanFromContextSafe(ctx)\n\tret, err := c.client.GetKV(ctx, genMigratingDiskID(taskType, diskID))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err = json.Unmarshal(ret.Value, &meta); err != nil {\n\t\treturn nil, err\n\t}\n\tif meta.TaskType != taskType {\n\t\tspan.Errorf(\"task type is invalid: expected[%s], actual[%s]\", taskType, meta.TaskType)\n\t\treturn meta, errcode.ErrIllegalTaskType\n\t}\n\tif meta.Disk.DiskID != diskID {\n\t\tspan.Errorf(\"disk_id is invalid: expected[%s], actual[%s]\", diskID, meta.Disk.DiskID)\n\t\treturn meta, errcode.ErrIllegalTaskType\n\t}\n\treturn\n}", "func availableScsiDisk(dss *object.HostDatastoreSystem, name string) (*types.HostScsiDisk, error) {\n\tctx, cancel := context.WithTimeout(context.Background(), defaultAPITimeout)\n\tdefer cancel()\n\tdisks, err := dss.QueryAvailableDisksForVmfs(ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"cannot query available disks: %s\", err)\n\t}\n\n\tvar disk *types.HostScsiDisk\n\tfor _, d := range disks {\n\t\tif d.CanonicalName == name {\n\t\t\tdisk = &d\n\t\t\tbreak\n\t\t}\n\t}\n\tif disk == nil {\n\t\treturn nil, fmt.Errorf(\"%s does not seem to be a disk available for VMFS\", name)\n\t}\n\treturn disk, nil\n}", "func (o IopingSpecVolumeVolumeSourceAzureDiskOutput) DiskName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v IopingSpecVolumeVolumeSourceAzureDisk) string { return v.DiskName }).(pulumi.StringOutput)\n}", "func (o IopingSpecVolumeVolumeSourceAzureDiskPtrOutput) DiskName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *IopingSpecVolumeVolumeSourceAzureDisk) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.DiskName\n\t}).(pulumi.StringPtrOutput)\n}", "func (m *MockStoreProvider) Disk(arg0 database.DB) (cluster.ServerStore, error) {\n\tret := m.ctrl.Call(m, \"Disk\", arg0)\n\tret0, _ := ret[0].(cluster.ServerStore)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func GetVmfsDisks(ctx *pulumi.Context, args *GetVmfsDisksArgs, opts ...pulumi.InvokeOption) (*GetVmfsDisksResult, error) {\n\tvar rv GetVmfsDisksResult\n\terr := ctx.Invoke(\"vsphere:index/getVmfsDisks:getVmfsDisks\", args, &rv, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &rv, nil\n}", "func GetDiskLocation() string {\n\treturn vboxmanage.GetVMInfoByRegexp(boxName, \"\\\"SATA Controller-0-0\\\"=\\\"(.*)\\\"\")\n}", "func (o SourceDiskEncryptionKeyResponseOutput) SourceDisk() pulumi.StringOutput {\n\treturn o.ApplyT(func(v SourceDiskEncryptionKeyResponse) string { return v.SourceDisk }).(pulumi.StringOutput)\n}", "func (m *Group) GetDrive()(Driveable) {\n return m.drive\n}", "func (o FioSpecVolumeVolumeSourceOutput) AzureDisk() FioSpecVolumeVolumeSourceAzureDiskPtrOutput {\n\treturn o.ApplyT(func(v FioSpecVolumeVolumeSource) *FioSpecVolumeVolumeSourceAzureDisk { return v.AzureDisk }).(FioSpecVolumeVolumeSourceAzureDiskPtrOutput)\n}", "func New(diskPath string) (Disk, *probe.Error) {\n\tif diskPath == \"\" {\n\t\treturn Disk{}, probe.NewError(InvalidArgument{})\n\t}\n\tst, err := os.Stat(diskPath)\n\tif err != nil {\n\t\treturn Disk{}, probe.NewError(err)\n\t}\n\n\tif !st.IsDir() {\n\t\treturn Disk{}, probe.NewError(syscall.ENOTDIR)\n\t}\n\ts := syscall.Statfs_t{}\n\terr = syscall.Statfs(diskPath, &s)\n\tif err != nil {\n\t\treturn Disk{}, probe.NewError(err)\n\t}\n\tdisk := Disk{\n\t\tlock: &sync.Mutex{},\n\t\tpath: diskPath,\n\t\tfsInfo: make(map[string]string),\n\t}\n\tif fsType := getFSType(s.Type); fsType != \"UNKNOWN\" {\n\t\tdisk.fsInfo[\"FSType\"] = fsType\n\t\tdisk.fsInfo[\"MountPoint\"] = disk.path\n\t\treturn disk, nil\n\t}\n\treturn Disk{}, probe.NewError(UnsupportedFilesystem{Type: strconv.FormatInt(int64(s.Type), 10)})\n}", "func findDisk(wwn, lun string, io ioHandler) (string, string) {\n\tfc_path := \"-fc-0x\" + wwn + \"-lun-\" + lun\n\tdev_path := \"/dev/disk/by-path/\"\n\tif dirs, err := io.ReadDir(dev_path); err == nil {\n\t\tfor _, f := range dirs {\n\t\t\tname := f.Name()\n\t\t\tif strings.Contains(name, fc_path) {\n\t\t\t\tif disk, err1 := io.EvalSymlinks(dev_path + name); err1 == nil {\n\t\t\t\t\tarr := strings.Split(disk, \"/\")\n\t\t\t\t\tl := len(arr) - 1\n\t\t\t\t\tdev := arr[l]\n\t\t\t\t\tdm := findMultipathDeviceMapper(dev, io)\n\t\t\t\t\treturn disk, dm\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn \"\", \"\"\n}", "func Disks() []*Disk {\n\tmsg := `\nThe Disks() function has been DEPRECATED and will be removed in the\n1.0 release of ghw. Please use the BlockInfo.Disks attribute.\n`\n\twarn(msg)\n\tctx := contextFromEnv()\n\treturn ctx.disks()\n}", "func (z zones) GetZone() (cloudprovider.Zone, error) {\n\treturn cloudprovider.Zone{Region: z.region}, nil\n}", "func TestFetcher_Disk(t *testing.T) {\n\tfetcher := (&diskFetcher{\"../fixtures\"}).fetch\n\n\tfakeSites := []struct {\n\t\turl string\n\t\texpected string\n\t}{\n\t\t{\"https://www.404s.com/nope.txt\", \"\"},\n\t\t{\"https://www.404s.com/hello.txt\", \"Hello, world!\"},\n\t}\n\tfor _, site := range fakeSites {\n\t\tt.Run(site.url, func(t *testing.T) {\n\t\t\tactual := fetchAsString(t, fetcher, site.url)\n\t\t\trequire.Equal(t, site.expected, actual)\n\t\t})\n\t}\n}", "func (o *StoragePhysicalDiskAllOf) GetDiskId() string {\n\tif o == nil || o.DiskId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.DiskId\n}", "func (o InstanceOutput) DiskEncryption() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Instance) pulumi.StringOutput { return v.DiskEncryption }).(pulumi.StringOutput)\n}", "func (o FioSpecVolumeVolumeSourceGcePersistentDiskOutput) Partition() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v FioSpecVolumeVolumeSourceGcePersistentDisk) *int { return v.Partition }).(pulumi.IntPtrOutput)\n}", "func (o IopingSpecVolumeVolumeSourceGcePersistentDiskOutput) Partition() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v IopingSpecVolumeVolumeSourceGcePersistentDisk) *int { return v.Partition }).(pulumi.IntPtrOutput)\n}", "func (o LocalDiskOutput) DiskType() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LocalDisk) *string { return v.DiskType }).(pulumi.StringPtrOutput)\n}", "func NewDiskCache() *DiskCache {\n\treturn &DiskCache{\n\t\tDir: os.TempDir(),\n\t\tMaxBytes: 1 << 20, // 1mb\n\t\tMaxFiles: 256,\n\t\tCleanupSleep: 60 * time.Second,\n\t}\n}", "func (o FioSpecVolumeVolumeSourceAzureDiskPtrOutput) DiskName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *FioSpecVolumeVolumeSourceAzureDisk) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.DiskName\n\t}).(pulumi.StringPtrOutput)\n}", "func getDiskUUID() string {\n\treturn vboxmanage.GetVMInfoByRegexp(boxName, \"\\\"SATA Controller-ImageUUID-0-0\\\"=\\\"(.*?)\\\"\")\n}", "func GetVirtualDiskImageService(sess *session.Session) Virtual_Disk_Image {\n\treturn Virtual_Disk_Image{Session: sess}\n}", "func (o SourceDiskEncryptionKeyOutput) DiskEncryptionKey() CustomerEncryptionKeyPtrOutput {\n\treturn o.ApplyT(func(v SourceDiskEncryptionKey) *CustomerEncryptionKey { return v.DiskEncryptionKey }).(CustomerEncryptionKeyPtrOutput)\n}", "func (m *List) GetDrive()(Driveable) {\n return m.drive\n}", "func (o LookupImageResultOutput) SourceDisk() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupImageResult) string { return v.SourceDisk }).(pulumi.StringOutput)\n}", "func (c *TestClient) DeleteDisk(project, zone, name string) error {\n\tif c.DeleteDiskFn != nil {\n\t\treturn c.DeleteDiskFn(project, zone, name)\n\t}\n\treturn c.client.DeleteDisk(project, zone, name)\n}", "func GetDisksToBeFormatted(inventory *models.Inventory) []*models.Disk {\n\tformatDisks := make([]*models.Disk, 0, len(inventory.Disks))\n\n\tskipDriveTypes := []string{string(models.DriveTypeFC), string(models.DriveTypeISCSI), string(models.DriveTypeLVM)}\n\tfor _, disk := range inventory.Disks {\n\t\tdiskRemovable := disk.Removable || strings.Contains(disk.ByPath, \"mmcblk\") //mmc devices should be treated as removable\n\n\t\tif disk.Bootable && !diskRemovable && !funk.Contains(skipDriveTypes, string(disk.DriveType)) && !disk.IsInstallationMedia {\n\t\t\tformatDisks = append(formatDisks, disk)\n\t\t}\n\t}\n\n\treturn formatDisks\n}", "func (o IopingSpecVolumeVolumeSourceOutput) AzureDisk() IopingSpecVolumeVolumeSourceAzureDiskPtrOutput {\n\treturn o.ApplyT(func(v IopingSpecVolumeVolumeSource) *IopingSpecVolumeVolumeSourceAzureDisk { return v.AzureDisk }).(IopingSpecVolumeVolumeSourceAzureDiskPtrOutput)\n}", "func getDiskType(udInfo disko.UdevInfo) (disko.DiskType, error) {\n\tvar kname = udInfo.Name\n\n\tif strings.HasPrefix(\"nvme\", kname) {\n\t\treturn disko.NVME, nil\n\t}\n\n\tif isKvm() {\n\t\tpsuedoSsd := regexp.MustCompile(\"^ssd[0-9-]\")\n\t\tif psuedoSsd.MatchString(udInfo.Properties[\"ID_SERIAL\"]) {\n\t\t\treturn disko.SSD, nil\n\t\t}\n\t}\n\n\tbd, err := getPartitionsBlockDevice(kname)\n\tif err != nil {\n\t\treturn disko.HDD, nil\n\t}\n\n\tsyspath, err := getSysPathForBlockDevicePath(bd)\n\tif err != nil {\n\t\treturn disko.HDD, nil\n\t}\n\n\tcontent, err := ioutil.ReadFile(\n\t\tfmt.Sprintf(\"%s/%s\", syspath, \"queue/rotational\"))\n\tif err != nil {\n\t\treturn disko.HDD,\n\t\t\tfmt.Errorf(\"failed to read %s/queue/rotational for %s\", syspath, kname)\n\t}\n\n\tif string(content) == \"0\\n\" {\n\t\treturn disko.SSD, nil\n\t}\n\n\treturn disko.HDD, nil\n}", "func (s stage) getPartitionMap(device string) (util.DiskInfo, error) {\n\tinfo := util.DiskInfo{}\n\terr := s.Logger.LogOp(\n\t\tfunc() error {\n\t\t\tvar err error\n\t\t\tinfo, err = util.DumpDisk(device)\n\t\t\treturn err\n\t\t}, \"reading partition table of %q\", device)\n\tif err != nil {\n\t\treturn util.DiskInfo{}, err\n\t}\n\treturn info, nil\n}", "func (o AttachedDiskInitializeParamsResponseOutput) DiskName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v AttachedDiskInitializeParamsResponse) string { return v.DiskName }).(pulumi.StringOutput)\n}", "func (p *PowerDNS) GetZone(domain string) (*Zone, error) {\n\tzone := &Zone{}\n\tmyError := new(Error)\n\tzoneSling := p.makeSling()\n\tresp, err := zoneSling.New().Get(\"servers/\"+p.VHost+\"/zones/\"+strings.TrimRight(domain, \".\")).Receive(zone, myError)\n\n\tif err == nil && resp.StatusCode >= 400 {\n\t\tmyError.Message = strings.Join([]string{resp.Status, myError.Message}, \" \")\n\t\treturn &Zone{}, myError\n\t}\n\n\tzone.PowerDNSHandle = p\n\treturn zone, err\n}", "func (o SavedAttachedDiskResponseOutput) DiskType() pulumi.StringOutput {\n\treturn o.ApplyT(func(v SavedAttachedDiskResponse) string { return v.DiskType }).(pulumi.StringOutput)\n}", "func (o KafkaMirrorMakerOutput) DiskSpaceDefault() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *KafkaMirrorMaker) pulumi.StringOutput { return v.DiskSpaceDefault }).(pulumi.StringOutput)\n}", "func New(cfg config.Cfg, locator storage.Locator, opts ...Option) *DiskCache {\n\tvar cacheConfig cacheConfig\n\tfor _, opt := range opts {\n\t\topt(&cacheConfig)\n\t}\n\n\tcache := &DiskCache{\n\t\tlocator: locator,\n\t\tstorages: cfg.Storages,\n\t\taf: activeFiles{\n\t\t\tMutex: &sync.Mutex{},\n\t\t\tm: map[string]int{},\n\t\t},\n\t\tcacheConfig: cacheConfig,\n\t\twalkersDone: make(chan struct{}),\n\n\t\trequestTotals: prometheus.NewCounter(\n\t\t\tprometheus.CounterOpts{\n\t\t\t\tName: \"gitaly_diskcache_requests_total\",\n\t\t\t\tHelp: \"Total number of disk cache requests\",\n\t\t\t},\n\t\t),\n\t\tmissTotals: prometheus.NewCounter(\n\t\t\tprometheus.CounterOpts{\n\t\t\t\tName: \"gitaly_diskcache_miss_total\",\n\t\t\t\tHelp: \"Total number of disk cache misses\",\n\t\t\t},\n\t\t),\n\t\tbytesStoredtotals: prometheus.NewCounter(\n\t\t\tprometheus.CounterOpts{\n\t\t\t\tName: \"gitaly_diskcache_bytes_stored_total\",\n\t\t\t\tHelp: \"Total number of disk cache bytes stored\",\n\t\t\t},\n\t\t),\n\t\tbytesFetchedtotals: prometheus.NewCounter(\n\t\t\tprometheus.CounterOpts{\n\t\t\t\tName: \"gitaly_diskcache_bytes_fetched_total\",\n\t\t\t\tHelp: \"Total number of disk cache bytes fetched\",\n\t\t\t},\n\t\t),\n\t\tbytesLoserTotals: prometheus.NewCounter(\n\t\t\tprometheus.CounterOpts{\n\t\t\t\tName: \"gitaly_diskcache_bytes_loser_total\",\n\t\t\t\tHelp: \"Total number of disk cache bytes from losing writes\",\n\t\t\t},\n\t\t),\n\t\terrTotal: prometheus.NewCounterVec(\n\t\t\tprometheus.CounterOpts{\n\t\t\t\tName: \"gitaly_diskcache_errors_total\",\n\t\t\t\tHelp: \"Total number of errors encountered by disk cache\",\n\t\t\t},\n\t\t\t[]string{\"error\"},\n\t\t),\n\t\twalkerCheckTotal: prometheus.NewCounter(\n\t\t\tprometheus.CounterOpts{\n\t\t\t\tName: \"gitaly_diskcache_walker_check_total\",\n\t\t\t\tHelp: \"Total number of events during diskcache filesystem walks\",\n\t\t\t},\n\t\t),\n\t\twalkerRemovalTotal: prometheus.NewCounter(\n\t\t\tprometheus.CounterOpts{\n\t\t\t\tName: \"gitaly_diskcache_walker_removal_total\",\n\t\t\t\tHelp: \"Total number of events during diskcache filesystem walks\",\n\t\t\t},\n\t\t),\n\t\twalkerErrorTotal: prometheus.NewCounter(\n\t\t\tprometheus.CounterOpts{\n\t\t\t\tName: \"gitaly_diskcache_walker_error_total\",\n\t\t\t\tHelp: \"Total number of errors during diskcache filesystem walks\",\n\t\t\t},\n\t\t),\n\t\twalkerEmptyDirTotal: prometheus.NewCounter(\n\t\t\tprometheus.CounterOpts{\n\t\t\t\tName: \"gitaly_diskcache_walker_empty_dir_total\",\n\t\t\t\tHelp: \"Total number of empty directories encountered\",\n\t\t\t},\n\t\t),\n\t\twalkerEmptyDirRemovalTotal: prometheus.NewCounter(\n\t\t\tprometheus.CounterOpts{\n\t\t\t\tName: \"gitaly_diskcache_walker_empty_dir_removal_total\",\n\t\t\t\tHelp: \"Total number of empty directories removed\",\n\t\t\t},\n\t\t),\n\t}\n\tcache.keyer = newLeaseKeyer(locator, cache.countErr)\n\n\treturn cache\n}", "func (o *StoragePhysicalDisk) GetDiskId() string {\n\tif o == nil || o.DiskId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.DiskId\n}", "func (o *StorageHitachiParityGroupAllOf) GetDiskType() string {\n\tif o == nil || o.DiskType == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.DiskType\n}", "func (s stage) partitionDisk(dev types.Disk, devAlias string) error {\n\tif cutil.IsTrue(dev.WipeTable) {\n\t\top := sgdisk.Begin(s.Logger, devAlias)\n\t\ts.Logger.Info(\"wiping partition table requested on %q\", devAlias)\n\t\top.WipeTable(true)\n\t\tif err := op.Commit(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Ensure all partitions with number 0 are last\n\tsort.Stable(PartitionList(dev.Partitions))\n\n\top := sgdisk.Begin(s.Logger, devAlias)\n\n\tdiskInfo, err := s.getPartitionMap(devAlias)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// get a list of parititions that have size and start 0 replaced with the real sizes\n\t// that would be used if all specified partitions were to be created anew.\n\t// Also calculate sectors for all of the start/size values.\n\tresolvedPartitions, err := s.getRealStartAndSize(dev, devAlias, diskInfo)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, part := range resolvedPartitions {\n\t\tshouldExist := partitionShouldExist(part)\n\t\tinfo, exists := diskInfo.GetPartition(part.Number)\n\t\tvar matchErr error\n\t\tif exists {\n\t\t\tmatchErr = partitionMatches(info, part)\n\t\t}\n\t\tmatches := exists && matchErr == nil\n\t\twipeEntry := cutil.IsTrue(part.WipePartitionEntry)\n\n\t\t// This is a translation of the matrix in the operator notes.\n\t\tswitch {\n\t\tcase !exists && !shouldExist:\n\t\t\ts.Logger.Info(\"partition %d specified as nonexistant and no partition was found. Success.\", part.Number)\n\t\tcase !exists && shouldExist:\n\t\t\top.CreatePartition(part)\n\t\tcase exists && !shouldExist && !wipeEntry:\n\t\t\treturn fmt.Errorf(\"partition %d exists but is specified as nonexistant and wipePartitionEntry is false\", part.Number)\n\t\tcase exists && !shouldExist && wipeEntry:\n\t\t\top.DeletePartition(part.Number)\n\t\tcase exists && shouldExist && matches:\n\t\t\ts.Logger.Info(\"partition %d found with correct specifications\", part.Number)\n\t\tcase exists && shouldExist && !wipeEntry && !matches:\n\t\t\tif partitionMatchesResize(info, part) {\n\t\t\t\ts.Logger.Info(\"resizing partition %d\", part.Number)\n\t\t\t\top.DeletePartition(part.Number)\n\t\t\t\tpart.Number = info.Number\n\t\t\t\tpart.GUID = &info.GUID\n\t\t\t\tpart.TypeGUID = &info.TypeGUID\n\t\t\t\tpart.Label = &info.Label\n\t\t\t\tpart.StartSector = &info.StartSector\n\t\t\t\top.CreatePartition(part)\n\t\t\t} else {\n\t\t\t\treturn fmt.Errorf(\"Partition %d didn't match: %v\", part.Number, matchErr)\n\t\t\t}\n\t\tcase exists && shouldExist && wipeEntry && !matches:\n\t\t\ts.Logger.Info(\"partition %d did not meet specifications, wiping partition entry and recreating\", part.Number)\n\t\t\top.DeletePartition(part.Number)\n\t\t\top.CreatePartition(part)\n\t\tdefault:\n\t\t\t// unfortunatey, golang doesn't check that all cases are handled exhaustively\n\t\t\treturn fmt.Errorf(\"Unreachable code reached when processing partition %d. golang--\", part.Number)\n\t\t}\n\t}\n\n\tif err := op.Commit(); err != nil {\n\t\treturn fmt.Errorf(\"commit failure: %v\", err)\n\t}\n\treturn nil\n}", "func (client DnsClient) GetZone(ctx context.Context, request GetZoneRequest) (response GetZoneResponse, err error) {\n\tvar ociResponse common.OCIResponse\n\tpolicy := common.NoRetryPolicy()\n\tif request.RetryPolicy() != nil {\n\t\tpolicy = *request.RetryPolicy()\n\t}\n\tociResponse, err = common.Retry(ctx, request, client.getZone, 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 = GetZoneResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId}\n\t\t\t} else {\n\t\t\t\tresponse = GetZoneResponse{}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\tif convertedResponse, ok := ociResponse.(GetZoneResponse); ok {\n\t\tresponse = convertedResponse\n\t} else {\n\t\terr = fmt.Errorf(\"failed to convert OCIResponse into GetZoneResponse\")\n\t}\n\treturn\n}", "func (o InstanceFromTemplateOutput) BootDisk() InstanceFromTemplateBootDiskOutput {\n\treturn o.ApplyT(func(v *InstanceFromTemplate) InstanceFromTemplateBootDiskOutput { return v.BootDisk }).(InstanceFromTemplateBootDiskOutput)\n}", "func (o operator) DiskOrder() types.DiskOrder {\n\treturn types.DiskOrderPO\n}", "func (m *MachineScope) DiskSpecs() []azure.ResourceSpecGetter {\n\tdiskSpecs := make([]azure.ResourceSpecGetter, 1+len(m.AzureMachine.Spec.DataDisks))\n\tdiskSpecs[0] = &disks.DiskSpec{\n\t\tName: azure.GenerateOSDiskName(m.Name()),\n\t\tResourceGroup: m.ResourceGroup(),\n\t}\n\n\tfor i, dd := range m.AzureMachine.Spec.DataDisks {\n\t\tdiskSpecs[i+1] = &disks.DiskSpec{\n\t\t\tName: azure.GenerateDataDiskName(m.Name(), dd.NameSuffix),\n\t\t\tResourceGroup: m.ResourceGroup(),\n\t\t}\n\t}\n\treturn diskSpecs\n}", "func (bc *Baiducloud) GetZone(ctx context.Context) (cloudprovider.Zone, error) {\n\tzone := cloudprovider.Zone{\n\t\tFailureDomain: \"unknow\",\n\t\tRegion: bc.Region,\n\t}\n\tif bc.NodeName != \"\" {\n\t\tins, err := bc.getInstanceByNodeName(ctx, types.NodeName(bc.NodeName))\n\t\t// ins, err := bc.getVirtualMachine(types.NodeName(bc.NodeIP))\n\t\tif err != nil {\n\t\t\treturn zone, err\n\t\t}\n\t\tzone.FailureDomain = ins.AvailableZone\n\t}\n\treturn zone, nil\n}", "func (o LocalDiskResponseOutput) DiskType() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LocalDiskResponse) string { return v.DiskType }).(pulumi.StringOutput)\n}", "func (o FioSpecVolumeVolumeSourcePtrOutput) AzureDisk() FioSpecVolumeVolumeSourceAzureDiskPtrOutput {\n\treturn o.ApplyT(func(v *FioSpecVolumeVolumeSource) *FioSpecVolumeVolumeSourceAzureDisk {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.AzureDisk\n\t}).(FioSpecVolumeVolumeSourceAzureDiskPtrOutput)\n}", "func (o IopingSpecVolumeVolumeSourceAzureDiskPtrOutput) DiskURI() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *IopingSpecVolumeVolumeSourceAzureDisk) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.DiskURI\n\t}).(pulumi.StringPtrOutput)\n}", "func (o Operator) DiskOrder() types.DiskOrder {\n\treturn types.DiskOrderRaw\n}", "func GetDiskUsage(rw http.ResponseWriter) error {\n\tu, r := disk.Usage(\"/\")\n\tif r != nil {\n\t\treturn r\n\t}\n\n\treturn share.JSONResponse(u, rw)\n}", "func (c *TestClient) GetZone(project, zone string) (*compute.Zone, error) {\n\tif c.GetZoneFn != nil {\n\t\treturn c.GetZoneFn(project, zone)\n\t}\n\treturn c.client.GetZone(project, zone)\n}", "func (o AttachedDiskInitializeParamsOutput) DiskName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v AttachedDiskInitializeParams) *string { return v.DiskName }).(pulumi.StringPtrOutput)\n}", "func (s *Module) DiskCreate(name string, size gridtypes.Unit) (disk pkg.VDisk, err error) {\n\tpath, err := s.findDisk(name)\n\tif err == nil {\n\t\treturn disk, errors.Wrapf(os.ErrExist, \"disk with id '%s' already exists\", name)\n\t}\n\n\tbase, err := s.diskFindCandidate(size)\n\tif err != nil {\n\t\treturn disk, errors.Wrapf(err, \"failed to find a candidate to host vdisk of size '%d'\", size)\n\t}\n\n\tpath, err = s.safePath(base, name)\n\tif err != nil {\n\t\treturn disk, err\n\t}\n\n\tdefer func() {\n\t\t// clean up disk file if error\n\t\tif err != nil {\n\t\t\tos.RemoveAll(path)\n\t\t}\n\t}()\n\n\tdefer syscall.Sync()\n\n\tvar file *os.File\n\tfile, err = os.Create(path)\n\tif err != nil {\n\t\treturn disk, err\n\t}\n\n\tdefer file.Close()\n\tif err = chattr.SetAttr(file, chattr.FS_NOCOW_FL); err != nil {\n\t\treturn disk, err\n\t}\n\n\tif err = syscall.Fallocate(int(file.Fd()), 0, 0, int64(size)); err != nil {\n\t\treturn disk, errors.Wrap(err, \"failed to truncate disk to size\")\n\t}\n\n\treturn pkg.VDisk{Path: path, Size: int64(size)}, nil\n}", "func getWssdVirtualHardDisk(c *storage.VirtualHardDisk, groupName, containerName string) (*wssdcloudstorage.VirtualHardDisk, error) {\n\tif c.Name == nil {\n\t\treturn nil, errors.Wrapf(errors.InvalidInput, \"Virtual Hard Disk name is missing\")\n\t}\n\n\tif len(groupName) == 0 {\n\t\treturn nil, errors.Wrapf(errors.InvalidGroup, \"Group not specified\")\n\t}\n\twssdvhd := &wssdcloudstorage.VirtualHardDisk{\n\t\tName: *c.Name,\n\t\tGroupName: groupName,\n\t\tContainerName: containerName,\n\t\tTags: tags.MapToProto(c.Tags),\n\t}\n\n\tif c.Version != nil {\n\t\tif wssdvhd.Status == nil {\n\t\t\twssdvhd.Status = status.InitStatus()\n\t\t}\n\t\twssdvhd.Status.Version.Number = *c.Version\n\t}\n\n\tif c.VirtualHardDiskProperties != nil {\n\t\tif c.Blocksizebytes != nil {\n\t\t\twssdvhd.Blocksizebytes = *c.Blocksizebytes\n\t\t}\n\t\tif c.Dynamic != nil {\n\t\t\twssdvhd.Dynamic = *c.Dynamic\n\t\t}\n\t\tif c.Physicalsectorbytes != nil {\n\t\t\twssdvhd.Physicalsectorbytes = *c.Physicalsectorbytes\n\t\t}\n\t\tif c.DiskSizeBytes != nil {\n\t\t\twssdvhd.Size = *c.DiskSizeBytes\n\t\t}\n\t\tif c.Logicalsectorbytes != nil {\n\t\t\twssdvhd.Logicalsectorbytes = *c.Logicalsectorbytes\n\t\t}\n\t\tif c.VirtualMachineName != nil {\n\t\t\twssdvhd.VirtualmachineName = *c.VirtualMachineName\n\t\t}\n\t\twssdvhd.HyperVGeneration = c.HyperVGeneration\n\t\twssdvhd.DiskFileFormat = c.DiskFileFormat\n\n\t\twssdvhd.CloudInitDataSource = c.CloudInitDataSource\n\t}\n\treturn wssdvhd, nil\n}", "func (d *portworx) GetDriver() (*v1.StorageCluster, error) {\n\t// TODO: Need to implement it for Daemonset deployment as well, right now its only for StorageCluster\n\tstcList, err := pxOperator.ListStorageClusters(d.namespace)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed get StorageCluster list from namespace [%s], Err: %v\", d.namespace, err)\n\t}\n\n\tstc, err := pxOperator.GetStorageCluster(stcList.Items[0].Name, stcList.Items[0].Namespace)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get StorageCluster [%s] from namespace [%s], Err: %v\", stcList.Items[0].Name, stcList.Items[0].Namespace, err.Error())\n\t}\n\n\treturn stc, nil\n}", "func NewDiskSyncer(am *AccountManager) *DiskSyncer {\n\treturn &DiskSyncer{\n\t\tflushAccount: make(chan *flushAccountRequest),\n\t\tscheduleWallet: make(chan *Account),\n\t\tscheduleTxStore: make(chan *Account),\n\t\twriteBatch: make(chan *writeBatchRequest),\n\t\texportAccount: make(chan *exportRequest),\n\t\tam: am,\n\t\tquit: make(chan struct{}),\n\t\tshutdown: make(chan struct{}),\n\t}\n}", "func (f *DynamicDiskBlockFactory) GetSector(block *Block, sectorIndex uint32) (*Sector, error) {\n\tblockIndex := block.BlockIndex\n\tif block.IsEmpty {\n\t\treturn f.sectorFactory.CreateEmptySector(blockIndex, sectorIndex), nil\n\t}\n\n\treturn f.sectorFactory.Create(block, sectorIndex)\n}", "func (s *Simple) DiskInfo(req *acomm.Request) (interface{}, *url.URL, error) {\n\tvar args CPUInfoArgs\n\tif err := req.UnmarshalArgs(&args); err != nil {\n\t\treturn nil, nil, err\n\t}\n\tif args.GuestID == \"\" {\n\t\treturn nil, nil, errors.New(\"missing guest_id\")\n\t}\n\n\tresult := &DiskInfoResult{\n\t\t&DiskInfo{\n\t\t\tDevice: \"vda1\",\n\t\t\tSize: 10 * (1024 * 1024 * 1024), // 10 GB in bytes\n\t\t},\n\t}\n\n\treturn result, nil, nil\n}", "func (o M3DbOutput) DiskSpace() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *M3Db) pulumi.StringPtrOutput { return v.DiskSpace }).(pulumi.StringPtrOutput)\n}", "func (o IopingSpecVolumeVolumeSourcePtrOutput) AzureDisk() IopingSpecVolumeVolumeSourceAzureDiskPtrOutput {\n\treturn o.ApplyT(func(v *IopingSpecVolumeVolumeSource) *IopingSpecVolumeVolumeSourceAzureDisk {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.AzureDisk\n\t}).(IopingSpecVolumeVolumeSourceAzureDiskPtrOutput)\n}" ]
[ "0.64615923", "0.6369213", "0.6226585", "0.6183977", "0.61018217", "0.60965484", "0.60953504", "0.6052362", "0.60464835", "0.60319567", "0.5828111", "0.55994195", "0.5550302", "0.55006295", "0.54711264", "0.546093", "0.5435943", "0.54339266", "0.54339266", "0.540985", "0.53907615", "0.5388717", "0.536705", "0.5362112", "0.53602713", "0.53457415", "0.53416264", "0.5339719", "0.53124595", "0.5309011", "0.5289521", "0.5272199", "0.5264423", "0.5258893", "0.52473164", "0.5242982", "0.52397203", "0.5227665", "0.5218559", "0.5217725", "0.52150255", "0.5207956", "0.5206203", "0.5196469", "0.51958007", "0.5193105", "0.5190823", "0.51676446", "0.5146998", "0.5146413", "0.5143971", "0.51301306", "0.51276153", "0.5125866", "0.5121059", "0.5119806", "0.51176584", "0.5112877", "0.5096579", "0.5082407", "0.50779194", "0.50771534", "0.5076617", "0.50713074", "0.5060785", "0.50602627", "0.5059829", "0.50595874", "0.5049908", "0.50467396", "0.50422573", "0.5041992", "0.5034238", "0.50240314", "0.5021638", "0.5019184", "0.5018247", "0.5011795", "0.50102204", "0.50082135", "0.5006434", "0.49992168", "0.4987694", "0.4985605", "0.49705032", "0.4969668", "0.49653596", "0.496265", "0.49624735", "0.49612892", "0.4956252", "0.49533337", "0.49433085", "0.49384642", "0.49383304", "0.49345648", "0.49316624", "0.49236196", "0.4921715", "0.4920643" ]
0.72663563
0
AggregatedListDisks uses the override method ListInstancesFn or the real implementation.
func (c *TestClient) AggregatedListDisks(project string, opts ...ListCallOption) ([]*compute.Disk, error) { if c.AggregatedListDisksFn != nil { return c.AggregatedListDisksFn(project, opts...) } return c.client.AggregatedListDisks(project, opts...) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *TestClient) ListDisks(project, zone string, opts ...ListCallOption) ([]*compute.Disk, error) {\n\tif c.ListDisksFn != nil {\n\t\treturn c.ListDisksFn(project, zone, opts...)\n\t}\n\treturn c.client.ListDisks(project, zone, opts...)\n}", "func (c *TestClient) AggregatedListInstances(project string, opts ...ListCallOption) ([]*compute.Instance, error) {\n\tif c.AggregatedListInstancesFn != nil {\n\t\treturn c.AggregatedListInstancesFn(project, opts...)\n\t}\n\treturn c.client.AggregatedListInstances(project, opts...)\n}", "func (c *MockDisksClient) List(ctx context.Context, resourceGroupName string) ([]compute.Disk, error) {\n\tvar l []compute.Disk\n\tfor _, disk := range c.Disks {\n\t\tl = append(l, disk)\n\t}\n\treturn l, nil\n}", "func (c *clustermgrClient) ListMigratingDisks(ctx context.Context, taskType proto.TaskType) (disks []*MigratingDiskMeta, err error) {\n\tspan := trace.SpanFromContextSafe(ctx)\n\n\tprefix := genMigratingDiskPrefix(taskType)\n\tmarker := defaultListTaskMarker\n\tfor {\n\t\targs := &cmapi.ListKvOpts{\n\t\t\tPrefix: prefix,\n\t\t\tCount: defaultListTaskNum,\n\t\t\tMarker: marker,\n\t\t}\n\t\tret, err := c.client.ListKV(ctx, args)\n\t\tif err != nil {\n\t\t\tspan.Errorf(\"list task failed: err[%+v]\", err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, v := range ret.Kvs {\n\t\t\tvar task *MigratingDiskMeta\n\t\t\terr = json.Unmarshal(v.Value, &task)\n\t\t\tif err != nil {\n\t\t\t\tspan.Errorf(\"unmarshal task failed: err[%+v]\", err)\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tif task.TaskType != taskType {\n\t\t\t\tspan.Errorf(\"task type is invalid: expected[%s], actual[%s]\", taskType, task.TaskType)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tdisks = append(disks, task)\n\t\t}\n\t\tmarker = ret.Marker\n\t\tif marker == defaultListTaskMarker {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn\n}", "func ListVdisks(cluster ardb.StorageCluster, pred func(vdiskID string) bool) ([]string, error) {\n\tctx, cancel := context.WithCancel(context.Background())\n\tdefer cancel()\n\n\tserverCh, err := cluster.ServerIterator(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttype serverResult struct {\n\t\tids []string\n\t\terr error\n\t}\n\tresultCh := make(chan serverResult)\n\n\tvar action listVdisksAction\n\tif pred == nil {\n\t\taction.filter = filterListedVdiskID\n\t} else {\n\t\taction.filter = func(str string) (string, bool) {\n\t\t\tstr, ok := filterListedVdiskID(str)\n\t\t\tif !ok {\n\t\t\t\treturn \"\", false\n\t\t\t}\n\t\t\treturn str, pred(str)\n\t\t}\n\t}\n\n\tvar serverCount int\n\tvar reply interface{}\n\tfor server := range serverCh {\n\t\tserver := server\n\t\tgo func() {\n\t\t\tvar result serverResult\n\t\t\tlog.Infof(\"listing all vdisks stored on %v\", server.Config())\n\t\t\treply, result.err = server.Do(action)\n\t\t\tif result.err == nil && reply != nil {\n\t\t\t\t// [NOTE] this line of code relies on the fact that our\n\t\t\t\t// custom `listVdisksAction` type returns a `[]string` value as a reply,\n\t\t\t\t// as soon as that logic changes, this line will start causing trouble.\n\t\t\t\tresult.ids = reply.([]string)\n\t\t\t}\n\t\t\tselect {\n\t\t\tcase resultCh <- result:\n\t\t\tcase <-ctx.Done():\n\t\t\t}\n\t\t}()\n\t\tserverCount++\n\t}\n\n\t// collect the ids from all servers within the given cluster\n\tvar ids []string\n\tvar result serverResult\n\tfor i := 0; i < serverCount; i++ {\n\t\tresult = <-resultCh\n\t\tif result.err != nil {\n\t\t\t// return early, an error has occured!\n\t\t\treturn nil, result.err\n\t\t}\n\t\tids = append(ids, result.ids...)\n\t}\n\n\tif len(ids) <= 1 {\n\t\treturn ids, nil // nothing to do\n\t}\n\n\t// sort and dedupe\n\tsort.Strings(ids)\n\tids = dedupStrings(ids)\n\n\treturn ids, nil\n}", "func (t *Template) GetDisks() []shared.Disk {\n\n\tvecs := t.GetVectors(string(shared.DiskVec))\n\tdisks := make([]shared.Disk, len(vecs))\n\n\tfor i, v := range vecs {\n\t\tdisks[i] = shared.Disk{*v}\n\t}\n\n\treturn disks\n}", "func GetDisksToBeFormatted(inventory *models.Inventory) []*models.Disk {\n\tformatDisks := make([]*models.Disk, 0, len(inventory.Disks))\n\n\tskipDriveTypes := []string{string(models.DriveTypeFC), string(models.DriveTypeISCSI), string(models.DriveTypeLVM)}\n\tfor _, disk := range inventory.Disks {\n\t\tdiskRemovable := disk.Removable || strings.Contains(disk.ByPath, \"mmcblk\") //mmc devices should be treated as removable\n\n\t\tif disk.Bootable && !diskRemovable && !funk.Contains(skipDriveTypes, string(disk.DriveType)) && !disk.IsInstallationMedia {\n\t\t\tformatDisks = append(formatDisks, disk)\n\t\t}\n\t}\n\n\treturn formatDisks\n}", "func TestEvalDisks(t *testing.T) {\n\tnDisks := 16\n\tdisks, err := getRandomDisks(nDisks)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tobjLayer, _, err := initObjectLayer(mustGetNewEndpointList(disks...))\n\tif err != nil {\n\t\tremoveRoots(disks)\n\t\tt.Fatal(err)\n\t}\n\tdefer removeRoots(disks)\n\txl := objLayer.(*xlObjects)\n\ttestShuffleDisks(t, xl)\n}", "func (s *Module) DiskList() ([]pkg.VDisk, error) {\n\tpools, err := s.diskPools()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar disks []pkg.VDisk\n\tfor _, pool := range pools {\n\n\t\titems, err := os.ReadDir(pool)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"failed to list virtual disks\")\n\t\t}\n\n\t\tfor _, item := range items {\n\t\t\tif item.IsDir() {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tinfo, err := item.Info()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.Wrapf(err, \"failed to get file info for '%s'\", item.Name())\n\t\t\t}\n\n\t\t\tdisks = append(disks, pkg.VDisk{\n\t\t\t\tPath: filepath.Join(pool, item.Name()),\n\t\t\t\tSize: info.Size(),\n\t\t\t})\n\t\t}\n\n\t\treturn disks, nil\n\t}\n\n\treturn disks, nil\n}", "func (h Hostingv4) ListImagesInRegion(region hosting.Region) ([]hosting.DiskImage, error) {\n\tif region.ID == \"\" {\n\t\treturn []hosting.DiskImage{}, errors.New(\"hosting.Region provided does not have an ID\")\n\t}\n\n\tregionid, err := strconv.Atoi(region.ID)\n\tif err != nil {\n\t\treturn nil,\n\t\t\tfmt.Errorf(\"Error parsing RegionID '%s' from hosting.Region %v\", region.ID, region)\n\t}\n\tfilter := map[string]interface{}{\"datacenter_id\": regionid}\n\n\tresponse := []diskImagev4{}\n\trequest := []interface{}{filter}\n\terr = h.Send(\"hosting.image.list\", request, &response)\n\tif err != nil {\n\t\treturn []hosting.DiskImage{}, err\n\t}\n\n\tif len(response) < 1 {\n\t\treturn []hosting.DiskImage{}, errors.New(\"No images\")\n\t}\n\tvar diskimages []hosting.DiskImage\n\tfor _, image := range response {\n\t\tdiskimages = append(diskimages, fromDiskImagev4(image))\n\t}\n\n\treturn diskimages, nil\n}", "func GuestConfigDisks(endpoint string, guestid string, body GuestConfigDiskList) (int, []byte) {\n\tputReq := buildGuestConfigDiskRequest(body)\n\n\tbuffer := getEndpointwithGuests(endpoint)\n\tbuffer.WriteString(\"/\")\n\tbuffer.WriteString(guestid)\n\tbuffer.WriteString(\"/disks\")\n\n\theaders := buildAuthContext(\"\")\n\tctxt := RequestContext{\n\t\tvalues: headers,\n\t}\n\n\tstatus, data := hq.Put(buffer.String(), putReq, ctxt)\n\n\treturn status, data\n}", "func BuildDisks(vmProperties *mo.VirtualMachine) []Disk {\n\tdisks := make([]Disk, 0)\n\n\tdevices := vmProperties.Config.Hardware.Device\n\tfor _, device := range devices {\n\t\t// is this device a VirtualDisk?\n\t\tif virtualDisk, ok := device.(*types.VirtualDisk); ok {\n\t\t\tvar datastoreMoRef string\n\t\t\tvar datastoreName string\n\t\t\tvar backingFileName string\n\t\t\tvar diskId string\n\n\t\t\tbacking := virtualDisk.Backing.(types.BaseVirtualDeviceFileBackingInfo)\n\t\t\tbackingInfo := backing.GetVirtualDeviceFileBackingInfo()\n\t\t\tif backingInfo.Datastore != nil {\n\t\t\t\tdatastoreMoRef = backingInfo.Datastore.Value\n\t\t\t}\n\t\t\tbackingFileName = backingInfo.FileName\n\t\t\tdatastoreName = getDatastoreNameFromBacking(backingFileName)\n\n\t\t\tif virtualDisk.VDiskId != nil {\n\t\t\t\tdiskId = virtualDisk.VDiskId.Id\n\t\t\t} else {\n\t\t\t\tdiskId = virtualDisk.DiskObjectId\n\t\t\t}\n\n\t\t\tdisk := Disk{\n\t\t\t\tBackingFileName: backingFileName,\n\t\t\t\tCapacity: getDiskCapacityInBytes(virtualDisk),\n\t\t\t\tDatastoreMoRef: datastoreMoRef,\n\t\t\t\tDatastoreName: datastoreName,\n\t\t\t\tID: diskId,\n\t\t\t\tKey: virtualDisk.Key,\n\t\t\t\tName: virtualDisk.DeviceInfo.GetDescription().Label,\n\t\t\t}\n\n\t\t\tdisks = append(disks, disk)\n\t\t\tcontinue\n\t\t}\n\n\t}\n\n\treturn disks\n}", "func (o *VirtualizationIweVirtualMachine) GetDisks() []VirtualizationVmDisk {\n\tif o == nil {\n\t\tvar ret []VirtualizationVmDisk\n\t\treturn ret\n\t}\n\treturn o.Disks\n}", "func (m *manager) listIGInstances(name string) (sets.String, error) {\n\tnodeNames := sets.NewString()\n\tzones, err := m.ListZones(utils.AllNodesPredicate)\n\tif err != nil {\n\t\treturn nodeNames, err\n\t}\n\n\tfor _, zone := range zones {\n\t\tinstances, err := m.cloud.ListInstancesInInstanceGroup(name, zone, allInstances)\n\t\tif err != nil {\n\t\t\treturn nodeNames, err\n\t\t}\n\t\tfor _, ins := range instances {\n\t\t\tname, err := utils.KeyName(ins.Instance)\n\t\t\tif err != nil {\n\t\t\t\treturn nodeNames, err\n\t\t\t}\n\t\t\tnodeNames.Insert(name)\n\t\t}\n\t}\n\treturn nodeNames, nil\n}", "func Disks() []*Disk {\n\tmsg := `\nThe Disks() function has been DEPRECATED and will be removed in the\n1.0 release of ghw. Please use the BlockInfo.Disks attribute.\n`\n\twarn(msg)\n\tctx := contextFromEnv()\n\treturn ctx.disks()\n}", "func NewListDisksOK() *ListDisksOK {\n\treturn &ListDisksOK{}\n}", "func initStorageDisks(endpoints EndpointList) ([]StorageAPI, error) {\n\t// Bootstrap disks.\n\tstorageDisks := make([]StorageAPI, len(endpoints))\n\tfor index, endpoint := range endpoints {\n\t\t// Intentionally ignore disk not found errors. XL is designed\n\t\t// to handle these errors internally.\n\t\tstorage, err := newStorageAPI(endpoint)\n\t\tif err != nil && err != errDiskNotFound {\n\t\t\treturn nil, err\n\t\t}\n\t\tstorageDisks[index] = storage\n\t}\n\treturn storageDisks, nil\n}", "func adjustInstanceFromTemplateDisks(d *schema.ResourceData, config *transport_tpg.Config, it *compute.InstanceTemplate, zone *compute.Zone, project string, isFromRegionalTemplate bool) ([]*compute.AttachedDisk, error) {\n\tdisks := []*compute.AttachedDisk{}\n\tif _, hasBootDisk := d.GetOk(\"boot_disk\"); hasBootDisk {\n\t\tbootDisk, err := expandBootDisk(d, config, project)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdisks = append(disks, bootDisk)\n\t} else {\n\t\t// boot disk was not overridden, so use the one from the instance template\n\t\tfor _, disk := range it.Properties.Disks {\n\t\t\tif disk.Boot {\n\t\t\t\tif disk.Source != \"\" && !isFromRegionalTemplate {\n\t\t\t\t\t// Instances need a URL for the disk, but instance templates only have the name\n\t\t\t\t\tdisk.Source = fmt.Sprintf(\"projects/%s/zones/%s/disks/%s\", project, zone.Name, disk.Source)\n\t\t\t\t}\n\t\t\t\tif disk.InitializeParams != nil {\n\t\t\t\t\tif dt := disk.InitializeParams.DiskType; dt != \"\" {\n\t\t\t\t\t\t// Instances need a URL for the disk type, but instance templates\n\t\t\t\t\t\t// only have the name (since they're global).\n\t\t\t\t\t\tdisk.InitializeParams.DiskType = fmt.Sprintf(\"zones/%s/diskTypes/%s\", zone.Name, dt)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tdisks = append(disks, disk)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\tif _, hasScratchDisk := d.GetOk(\"scratch_disk\"); hasScratchDisk {\n\t\tscratchDisks, err := expandScratchDisks(d, config, project)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdisks = append(disks, scratchDisks...)\n\t} else {\n\t\t// scratch disks were not overridden, so use the ones from the instance template\n\t\tfor _, disk := range it.Properties.Disks {\n\t\t\tif disk.Type == \"SCRATCH\" {\n\t\t\t\tif disk.InitializeParams != nil {\n\t\t\t\t\tif dt := disk.InitializeParams.DiskType; dt != \"\" {\n\t\t\t\t\t\t// Instances need a URL for the disk type, but instance templates\n\t\t\t\t\t\t// only have the name (since they're global).\n\t\t\t\t\t\tdisk.InitializeParams.DiskType = fmt.Sprintf(\"zones/%s/diskTypes/%s\", zone.Name, dt)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tdisks = append(disks, disk)\n\t\t\t}\n\t\t}\n\t}\n\n\tattachedDisksCount := d.Get(\"attached_disk.#\").(int)\n\tif attachedDisksCount > 0 {\n\t\tfor i := 0; i < attachedDisksCount; i++ {\n\t\t\tdiskConfig := d.Get(fmt.Sprintf(\"attached_disk.%d\", i)).(map[string]interface{})\n\t\t\tdisk, err := expandAttachedDisk(diskConfig, d, config)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tdisks = append(disks, disk)\n\t\t}\n\t} else {\n\t\t// attached disks were not overridden, so use the ones from the instance template\n\t\tfor _, disk := range it.Properties.Disks {\n\t\t\tif !disk.Boot && disk.Type != \"SCRATCH\" {\n\t\t\t\tif s := disk.Source; s != \"\" && !isFromRegionalTemplate {\n\t\t\t\t\t// Instances need a URL for the disk source, but instance templates\n\t\t\t\t\t// only have the name (since they're global).\n\t\t\t\t\tdisk.Source = fmt.Sprintf(\"zones/%s/disks/%s\", zone.Name, s)\n\t\t\t\t}\n\t\t\t\tif disk.InitializeParams != nil {\n\t\t\t\t\tif dt := disk.InitializeParams.DiskType; dt != \"\" {\n\t\t\t\t\t\t// Instances need a URL for the disk type, but instance templates\n\t\t\t\t\t\t// only have the name (since they're global).\n\t\t\t\t\t\tdisk.InitializeParams.DiskType = fmt.Sprintf(\"zones/%s/diskTypes/%s\", zone.Name, dt)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tdisks = append(disks, disk)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn disks, nil\n}", "func fakeListRegionalDisk(cfg *config.Config, name string, region string, policies []string, callCount int) gcpRequest {\n\tscope := fmt.Sprintf(\"regions/%s\", region)\n\tdisk := fakeRegionalDisk(cfg, name, region, policies)\n\treturn fakeDiskAggregatedListRequest(cfg, scope, disk, callCount)\n}", "func expandImageRawDiskSlice(c *Client, f []ImageRawDisk) ([]map[string]interface{}, error) {\n\tif f == nil {\n\t\treturn nil, nil\n\t}\n\n\titems := []map[string]interface{}{}\n\tfor _, item := range f {\n\t\ti, err := expandImageRawDisk(c, &item)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\titems = append(items, i)\n\t}\n\n\treturn items, nil\n}", "func (f *FakeInstanceGroups) ListInstanceGroups(zone string) ([]*compute.InstanceGroup, error) {\n\tigs := []*compute.InstanceGroup{}\n\tfor ig := range f.zonesToIGsToInstances[zone] {\n\t\tigs = append(igs, ig)\n\t}\n\treturn igs, nil\n}", "func MapRegistryDisks(vm *v1.VM) (*v1.VM, error) {\n\tvmCopy := &v1.VM{}\n\tmodel.Copy(vmCopy, vm)\n\n\tfor idx, disk := range vmCopy.Spec.Domain.Devices.Disks {\n\t\tif disk.Type == registryDiskV1Alpha {\n\t\t\tnewDisk := v1.Disk{}\n\n\t\t\tnewDisk.Type = \"network\"\n\t\t\tnewDisk.Device = \"disk\"\n\t\t\tnewDisk.Target = disk.Target\n\n\t\t\tnewDisk.Driver = &v1.DiskDriver{\n\t\t\t\tType: \"raw\",\n\t\t\t\tName: \"qemu\",\n\t\t\t\tCache: \"none\",\n\t\t\t}\n\n\t\t\tnewDisk.Source.Name = defaultIqn\n\t\t\tnewDisk.Source.Protocol = \"iscsi\"\n\t\t\tnewDisk.Source.Host = disk.Source.Host\n\n\t\t\tvmCopy.Spec.Domain.Devices.Disks[idx] = newDisk\n\t\t}\n\t}\n\n\treturn vmCopy, nil\n}", "func (client *XenClient) VMGuestMetricsGetDisks(self string) (result map[string]string, err error) {\n\tobj, err := client.APICall(\"VM_guest_metrics.get_disks\", self)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tinterim := reflect.ValueOf(obj)\n\tresult = map[string]string{}\n\tfor _, key := range interim.MapKeys() {\n\t\tobj := interim.MapIndex(key)\n\t\tresult[key.String()] = obj.String()\n\t}\n\n\treturn\n}", "func GetVmfsDisks(ctx *pulumi.Context, args *GetVmfsDisksArgs, opts ...pulumi.InvokeOption) (*GetVmfsDisksResult, error) {\n\tvar rv GetVmfsDisksResult\n\terr := ctx.Invoke(\"vsphere:index/getVmfsDisks:getVmfsDisks\", args, &rv, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &rv, nil\n}", "func (o InstanceOutput) Disks() DiskResponseArrayOutput {\n\treturn o.ApplyT(func(v *Instance) DiskResponseArrayOutput { return v.Disks }).(DiskResponseArrayOutput)\n}", "func (m *manager) List() ([]string, error) {\n\tvar igs []*compute.InstanceGroup\n\n\tzones, err := m.ListZones(utils.AllNodesPredicate)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, zone := range zones {\n\t\tigsForZone, err := m.cloud.ListInstanceGroups(zone)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, ig := range igsForZone {\n\t\t\tigs = append(igs, ig)\n\t\t}\n\t}\n\n\tvar names []string\n\tfor _, ig := range igs {\n\t\tif m.namer.NameBelongsToCluster(ig.Name) {\n\t\t\tnames = append(names, ig.Name)\n\t\t}\n\t}\n\n\treturn names, nil\n}", "func (cl *Client) gceVolumeList(ctx context.Context, vla *csp.VolumeListArgs, volumeType string) ([]*csp.Volume, error) {\n\tcomputeService, err := cl.getComputeService(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfilter := \"\"\n\tif volumeType != \"\" {\n\t\tfilter = fmt.Sprintf(`type=\"%s\"`, volumeType)\n\t}\n\tfor _, tag := range vla.Tags {\n\t\tif filter != \"\" {\n\t\t\tfilter += \" AND \"\n\t\t}\n\t\tkv := strings.SplitN(tag, \":\", 2)\n\t\tif len(kv) == 1 { // if just \"key\" is specified then the existence of a label with that key will be matched\n\t\t\tfilter += fmt.Sprintf(\"labels.%s:*\", kv[0])\n\t\t} else { // if specified here as \"key:value\" then both the key and value will be matched\n\t\t\tfilter += fmt.Sprintf(`labels.%s=\"%s\"`, kv[0], kv[1])\n\t\t}\n\t}\n\treq := computeService.Disks().List(cl.projectID, cl.attrs[AttrZone].Value).Filter(filter)\n\tresult := []*csp.Volume{}\n\tif err = req.Pages(ctx, func(page *compute.DiskList) error {\n\t\tfor _, disk := range page.Items {\n\t\t\tvol := gceDiskToVolume(disk)\n\t\t\tresult = append(result, vol)\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to list GC disks: %w\", err)\n\t}\n\treturn result, nil\n}", "func GetVolumes(mountHost bool, mountSecret bool, instanceName string) []corev1.Volume {\n\tvar hostPathDirectoryTypeForPtr = corev1.HostPathDirectory\n\n\tvolumes := []corev1.Volume{\n\t\t{\n\t\t\tName: \"osd-monitored-logs-local\",\n\t\t\tVolumeSource: corev1.VolumeSource{\n\t\t\t\tConfigMap: &corev1.ConfigMapVolumeSource{\n\t\t\t\t\tLocalObjectReference: corev1.LocalObjectReference{\n\t\t\t\t\t\tName: \"osd-monitored-logs-local\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tName: \"osd-monitored-logs-metadata\",\n\t\t\tVolumeSource: corev1.VolumeSource{\n\t\t\t\tConfigMap: &corev1.ConfigMapVolumeSource{\n\t\t\t\t\tLocalObjectReference: corev1.LocalObjectReference{\n\t\t\t\t\t\tName: \"osd-monitored-logs-metadata\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tName: \"splunk-state\",\n\t\t\tVolumeSource: corev1.VolumeSource{\n\t\t\t\tHostPath: &corev1.HostPathVolumeSource{\n\t\t\t\t\tPath: \"/var/lib/misc\",\n\t\t\t\t\tType: &hostPathDirectoryTypeForPtr,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tif mountHost {\n\t\tvolumes = append(volumes,\n\t\t\tcorev1.Volume{\n\t\t\t\tName: \"host\",\n\t\t\t\tVolumeSource: corev1.VolumeSource{\n\t\t\t\t\tHostPath: &corev1.HostPathVolumeSource{\n\t\t\t\t\t\tPath: \"/\",\n\t\t\t\t\t\tType: &hostPathDirectoryTypeForPtr,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t})\n\t} else {\n\t\t// if we aren't mounting the host dir, we're the hf\n\t\tvar hfName = instanceName + \"-hfconfig\"\n\t\tvolumes = append(volumes,\n\t\t\tcorev1.Volume{\n\t\t\t\tName: hfName,\n\t\t\t\tVolumeSource: corev1.VolumeSource{\n\t\t\t\t\tConfigMap: &corev1.ConfigMapVolumeSource{\n\t\t\t\t\t\tLocalObjectReference: corev1.LocalObjectReference{\n\t\t\t\t\t\t\tName: hfName,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t})\n\t}\n\n\tif mountSecret {\n\t\tvolumes = append(volumes,\n\t\t\tcorev1.Volume{\n\t\t\t\tName: config.SplunkAuthSecretName,\n\t\t\t\tVolumeSource: corev1.VolumeSource{\n\t\t\t\t\tSecret: &corev1.SecretVolumeSource{\n\t\t\t\t\t\tSecretName: config.SplunkAuthSecretName,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t})\n\t} else {\n\t\t// if we aren't mounting the secret, we're fwding to the splunk hf\n\t\tvar internalName = instanceName + \"-internalsplunk\"\n\t\tvolumes = append(volumes,\n\t\t\tcorev1.Volume{\n\t\t\t\tName: internalName,\n\t\t\t\tVolumeSource: corev1.VolumeSource{\n\t\t\t\t\tConfigMap: &corev1.ConfigMapVolumeSource{\n\t\t\t\t\t\tLocalObjectReference: corev1.LocalObjectReference{\n\t\t\t\t\t\t\tName: internalName,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t})\n\t}\n\n\treturn volumes\n}", "func getInstanceList(nodeNames sets.String) *compute.InstanceGroupsListInstances {\n\tinstanceNames := nodeNames.List()\n\tcomputeInstances := []*compute.InstanceWithNamedPorts{}\n\tfor _, name := range instanceNames {\n\t\tinstanceLink := getInstanceUrl(name)\n\t\tcomputeInstances = append(\n\t\t\tcomputeInstances, &compute.InstanceWithNamedPorts{\n\t\t\t\tInstance: instanceLink})\n\t}\n\treturn &compute.InstanceGroupsListInstances{\n\t\tItems: computeInstances,\n\t}\n}", "func InitializeDisks(client *govmomi.Client, host *object.HostSystem, hvs *object.HostVsanSystem, diskMap *types.VsanHostDiskMapping, apiTimeout time.Duration) error {\n\tctx, cancel := context.WithTimeout(context.Background(), apiTimeout)\n\tdefer cancel()\n\n\tntask := types.InitializeDisks_Task{\n\t\tThis: hvs.Reference(),\n\t\tMapping: []types.VsanHostDiskMapping{*diskMap},\n\t}\n\n\tresp, err := methods.InitializeDisks_Task(ctx, host.Client().RoundTripper, &ntask)\n\tif err != nil {\n\t\treturn err\n\t}\n\ttask := object.NewTask(client.Client, resp.Returnval)\n\treturn task.Wait(ctx)\n}", "func listDirFactory(ctx context.Context, disks ...StorageAPI) ListDirFunc {\n\t// Returns sorted merged entries from all the disks.\n\tlistDir := func(bucket, prefixDir, prefixEntry string) (mergedEntries []string) {\n\t\tfor _, disk := range disks {\n\t\t\tif disk == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tvar entries []string\n\t\t\tvar newEntries []string\n\t\t\tvar err error\n\t\t\tentries, err = disk.ListDir(bucket, prefixDir, -1, xlMetaJSONFile)\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Find elements in entries which are not in mergedEntries\n\t\t\tfor _, entry := range entries {\n\t\t\t\tidx := sort.SearchStrings(mergedEntries, entry)\n\t\t\t\t// if entry is already present in mergedEntries don't add.\n\t\t\t\tif idx < len(mergedEntries) && mergedEntries[idx] == entry {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tnewEntries = append(newEntries, entry)\n\t\t\t}\n\n\t\t\tif len(newEntries) > 0 {\n\t\t\t\t// Merge the entries and sort it.\n\t\t\t\tmergedEntries = append(mergedEntries, newEntries...)\n\t\t\t\tsort.Strings(mergedEntries)\n\t\t\t}\n\t\t}\n\t\treturn filterMatchingPrefix(mergedEntries, prefixEntry)\n\t}\n\treturn listDir\n}", "func (c *clustermgrClient) ListClusterDisks(ctx context.Context) (disks []*DiskInfoSimple, err error) {\n\tc.rwLock.RLock()\n\tdefer c.rwLock.RUnlock()\n\treturn c.listAllDisks(ctx, proto.DiskStatusNormal)\n}", "func ListManagedInstances(c GCECloud, igm *compute.InstanceGroupManager) ([]*compute.ManagedInstance, error) {\n\tctx := context.Background()\n\tproject := c.Project()\n\n\tzoneName := LastComponent(igm.Zone)\n\n\t// TODO: Only select a subset of fields\n\t//\treq.Fields(\n\t//\t\tgoogleapi.Field(\"items/selfLink\"),\n\t//\t\tgoogleapi.Field(\"items/metadata/items[key='cluster-name']\"),\n\t//\t\tgoogleapi.Field(\"items/metadata/items[key='instance-template']\"),\n\t//\t)\n\n\tinstances, err := c.Compute().InstanceGroupManagers().ListManagedInstances(ctx, project, zoneName, igm.Name)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error listing ManagedInstances in %s: %v\", igm.Name, err)\n\t}\n\n\treturn instances, nil\n}", "func (c *TestClient) ListInstances(project, zone string, opts ...ListCallOption) ([]*compute.Instance, error) {\n\tif c.ListInstancesFn != nil {\n\t\treturn c.ListInstancesFn(project, zone, opts...)\n\t}\n\treturn c.client.ListInstances(project, zone, opts...)\n}", "func (o *ClusterUninstaller) listCloudControllerInstanceGroups(ctx context.Context) ([]cloudResource, error) {\n\tfilter := fmt.Sprintf(\"name eq \\\"k8s-ig--%s\\\"\", o.cloudControllerUID)\n\treturn o.listInstanceGroupsWithFilter(ctx, \"items/*/instanceGroups(name,selfLink,zone),nextPageToken\", filter, nil)\n}", "func (r Virtual_Storage_Repository) GetDiskImages() (resp []datatypes.Virtual_Disk_Image, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Virtual_Storage_Repository\", \"getDiskImages\", nil, &r.Options, &resp)\n\treturn\n}", "func ListVmWithEphemeralDisk(localPath string) ([]*v1.VirtualMachineInstance, error) {\n\tvar keys []*v1.VirtualMachineInstance\n\n\texists, err := FileExists(localPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif exists == false {\n\t\treturn nil, nil\n\t}\n\n\terr = filepath.Walk(localPath, 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() == false {\n\t\t\treturn nil\n\t\t}\n\n\t\trelativePath := strings.TrimPrefix(path, localPath+\"/\")\n\t\tif relativePath == \"\" {\n\t\t\treturn nil\n\t\t}\n\t\tdirs := strings.Split(relativePath, \"/\")\n\t\tif len(dirs) != 2 {\n\t\t\treturn nil\n\t\t}\n\n\t\tnamespace := dirs[0]\n\t\tdomain := dirs[1]\n\t\tif namespace == \"\" || domain == \"\" {\n\t\t\treturn nil\n\t\t}\n\t\tkeys = append(keys, v1.NewVMIReferenceFromNameWithNS(dirs[0], dirs[1]))\n\t\treturn nil\n\t})\n\n\treturn keys, err\n}", "func (client *Client) ListDisks00(request *ListDisks00Request) (response *ListDisks00Response, err error) {\n\tresponse = CreateListDisks00Response()\n\terr = client.DoAction(request, response)\n\treturn\n}", "func GuestCreateDisks(endpoint string, guestid string, body GuestCreateDiskList) (int, []byte) {\n\n\tcreateReq, _ := json.Marshal(body)\n\n\tbuffer := getEndpointwithGuests(endpoint)\n\tbuffer.WriteString(\"/\")\n\tbuffer.WriteString(guestid)\n\tbuffer.WriteString(\"/disks\")\n\n\tstatus, data := hq.Post(buffer.String(), createReq)\n\n\treturn status, data\n}", "func FilterUploadableInstances() *list.List {\n\tsyncLock.Lock()\n\tdefer syncLock.Unlock()\n\n\tret := list.New()\n\tfor _, v := range syncInstances {\n\t\tif v.instance.Role == common.ROLE_STORAGE && v.instance.Attributes[\"readonly\"] != \"true\" {\n\t\t\tret.PushBack(v.instance)\n\t\t}\n\t}\n\treturn ret\n}", "func NeuraxDisks() error {\n\tselected_name := gen_haiku()\n\tif runtime.GOOS == \"windows\" {\n\t\tselected_name += \".exe\"\n\t}\n\tdisks, err := cf.Disks()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, d := range disks {\n\t\terr := cf.CopyFile(os.Args[0], d+\"/\"+selected_name)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func TestDiskAPIGroup(t *testing.T) {\n\tt.Run(\"ListDiskIDs\", func(t *testing.T) {\n\t\tskipTestOnCondition(t, isRunningOnGhActions())\n\t\tclient, err := v1beta3client.NewClient()\n\t\trequire.Nil(t, err)\n\t\tdefer client.Close()\n\n\t\tdiskNumber := 0\n\t\tid := \"page83\"\n\t\tlistRequest := &v1beta3.ListDiskIDsRequest{}\n\t\tdiskIDsResponse, err := client.ListDiskIDs(context.TODO(), listRequest)\n\t\trequire.Nil(t, err)\n\n\t\tcmd := \"hostname\"\n\t\thostname, err := runPowershellCmd(cmd)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Error: %v. Command: %s. Out: %s\", err, cmd, hostname)\n\t\t}\n\n\t\thostname = strings.TrimSpace(hostname)\n\n\t\tdiskIDsMap := diskIDsResponse.GetDiskIDs()\n\t\tif diskIDsMap != nil {\n\t\t\tdiskIDs, found := diskIDsMap[strconv.Itoa(diskNumber)]\n\t\t\tif !found {\n\t\t\t\tt.Errorf(\"Cannot find Disk %d\", diskNumber)\n\t\t\t}\n\n\t\t\tidValue, found := diskIDs.Identifiers[id]\n\t\t\tif !found {\n\t\t\t\tt.Errorf(\"Cannot find %s ID of Disk %d\", id, diskNumber)\n\t\t\t}\n\n\t\t\t// In GCE, the page83 ID of Disk 0 contains the hostname\n\t\t\tif !strings.Contains(idValue, hostname) {\n\t\t\t\tt.Errorf(\"%s ID of Disk %d is incorrect. Expected to contain: %s. Received: %s\", id, diskNumber, hostname, idValue)\n\t\t\t}\n\t\t}\n\t})\n\n\tt.Run(\"Get/SetAttachState\", func(t *testing.T) {\n\t\tskipTestOnCondition(t, isRunningOnGhActions())\n\t\tclient, err := v1beta3client.NewClient()\n\t\trequire.NoError(t, err)\n\n\t\tdefer client.Close()\n\n\t\ts1 := rand.NewSource(time.Now().UTC().UnixNano())\n\t\tr1 := rand.New(s1)\n\n\t\ttestPluginPath := fmt.Sprintf(\"C:\\\\var\\\\lib\\\\kubelet\\\\plugins\\\\testplugin-%d.csi.io\\\\\", r1.Intn(100))\n\t\tmountPath := fmt.Sprintf(\"%smount-%d\", testPluginPath, r1.Intn(100))\n\t\tvhdxPath := fmt.Sprintf(\"%sdisk-%d.vhdx\", testPluginPath, r1.Intn(100))\n\n\t\tdefer diskCleanup(t, vhdxPath, mountPath, testPluginPath)\n\t\tdiskNum := diskInit(t, vhdxPath, mountPath, testPluginPath)\n\n\t\tout, err := runPowershellCmd(fmt.Sprintf(\"Get-Disk -Number %s | Set-Disk -IsOffline $true\", diskNum))\n\t\trequire.NoError(t, err, \"failed setting disk offline, out=%v\", out)\n\n\t\tgetReq := &v1beta3.GetAttachStateRequest{DiskID: diskNum}\n\t\tgetResp, err := client.GetAttachState(context.TODO(), getReq)\n\n\t\tif assert.NoError(t, err) {\n\t\t\tassert.False(t, getResp.IsOnline, \"Expected disk to be offline\")\n\t\t}\n\n\t\tsetReq := &v1beta3.SetAttachStateRequest{DiskID: diskNum, IsOnline: true}\n\t\t_, err = client.SetAttachState(context.TODO(), setReq)\n\t\tassert.NoError(t, err)\n\n\t\tout, err = runPowershellCmd(fmt.Sprintf(\"Get-Disk -Number %s | Select-Object -ExpandProperty IsOffline\", diskNum))\n\t\tassert.NoError(t, err)\n\n\t\tresult, err := strconv.ParseBool(strings.TrimSpace(out))\n\t\tassert.NoError(t, err)\n\t\tassert.False(t, result, \"Expected disk to be online\")\n\n\t\tgetReq = &v1beta3.GetAttachStateRequest{DiskID: diskNum}\n\t\tgetResp, err = client.GetAttachState(context.TODO(), getReq)\n\n\t\tif assert.NoError(t, err) {\n\t\t\tassert.True(t, getResp.IsOnline, \"Expected disk is online\")\n\t\t}\n\n\t\tsetReq = &v1beta3.SetAttachStateRequest{DiskID: diskNum, IsOnline: false}\n\t\t_, err = client.SetAttachState(context.TODO(), setReq)\n\t\tassert.NoError(t, err)\n\n\t\tout, err = runPowershellCmd(fmt.Sprintf(\"Get-Disk -Number %s | Select-Object -ExpandProperty IsOffline\", diskNum))\n\t\tassert.NoError(t, err)\n\n\t\tresult, err = strconv.ParseBool(strings.TrimSpace(out))\n\t\tassert.NoError(t, err)\n\t\tassert.True(t, result, \"Expected disk to be offline\")\n\t})\n}", "func (s stack) ListImages(ctx context.Context, _ bool) (out []*abstract.Image, ferr fail.Error) {\n\tif valid.IsNil(s) {\n\t\treturn nil, fail.InvalidInstanceError()\n\t}\n\n\t// FIXME: It has to be remade from scratch...\n\n\tvar images []*abstract.Image\n\t// FIXME: Don't even add CentOS, our image selection algorithm is not able to select the right one, it has to be remade from scratch because it assumes that the the length of the full ID of an images is the same for all images, which is false for Azure; as a consequence, looking for \"ubuntu\" will return maybe a Centos, maybe something else...\n\t/*\n\t\timages = append(images, &abstract.Image{\n\t\t\tID: strings.Join([]string{\"OpenLogic\", \"CentOS\", \"8_5-gen2\"}, \":\"),\n\t\t\tName: strings.Join([]string{\"OpenLogic\", \"CentOS\", \"8_5-gen2\"}, \":\"),\n\t\t\tURL: \"\",\n\t\t\tDescription: \"\",\n\t\t\tStorageType: \"\",\n\t\t\tDiskSize: 0,\n\t\t\tPublisher: \"cognosys\",\n\t\t\tOffer: \"centos-8-latest\",\n\t\t\tSku: \"centos-8-latest\",\n\t\t})\n\t*/\n\timages = append(images, &abstract.Image{\n\t\tID: strings.Join([]string{\"Canonical\", \"UbuntuServer\", \"18.04-LTS\"}, \":\"),\n\t\tName: strings.Join([]string{\"Canonical\", \"UbuntuServer\", \"18.04-LTS\"}, \":\"),\n\t\tURL: \"\",\n\t\tDescription: \"\",\n\t\tStorageType: \"\",\n\t\tDiskSize: 30,\n\t\tPublisher: \"Canonical\",\n\t\tOffer: \"UbuntuServer\",\n\t\tSku: \"18.04-LTS\",\n\t})\n\timages = append(images, &abstract.Image{\n\t\tID: strings.Join([]string{\"Canonical\", \"0001-com-ubuntu-minimal-focal\", \"minimal-20_04-lts\"}, \":\"),\n\t\tName: strings.Join([]string{\"Canonical\", \"0001-com-ubuntu-minimal-focal\", \"minimal-20_04-lts\"}, \":\"),\n\t\tURL: \"\",\n\t\tDescription: \"\",\n\t\tStorageType: \"\",\n\t\tDiskSize: 30,\n\t\tPublisher: \"Canonical\",\n\t\tOffer: \"0001-com-ubuntu-minimal-focal\",\n\t\tSku: \"minimal-20_04-lts\",\n\t})\n\timages = append(images, &abstract.Image{\n\t\tID: strings.Join([]string{\"Canonical\", \"0001-com-ubuntu-server-jammy\", \"22_04-lts-gen2\"}, \":\"),\n\t\tName: strings.Join([]string{\"Canonical\", \"0001-com-ubuntu-server-jammy\", \"22_04-lts-gen2\"}, \":\"),\n\t\tURL: \"\",\n\t\tDescription: \"\",\n\t\tStorageType: \"\",\n\t\tDiskSize: 30,\n\t\tPublisher: \"Canonical\",\n\t\tOffer: \"0001-com-ubuntu-server-jammy\",\n\t\tSku: \"22_04-lts-gen2\",\n\t})\n\n\treturn images, nil\n}", "func (r Virtual_Disk_Image) GetStorageGroups() (resp []datatypes.Configuration_Storage_Group, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Virtual_Disk_Image\", \"getStorageGroups\", nil, &r.Options, &resp)\n\treturn\n}", "func (o *ClusterUninstaller) listImages() (cloudResources, error) {\n\to.Logger.Debugf(\"Listing images\")\n\n\tif o.imageClient == nil {\n\t\to.Logger.Infof(\"Skipping deleting images because no service instance was found\")\n\t\tresult := []cloudResource{}\n\t\treturn cloudResources{}.insert(result...), nil\n\t}\n\n\tctx, cancel := o.contextWithTimeout()\n\tdefer cancel()\n\n\tselect {\n\tcase <-ctx.Done():\n\t\to.Logger.Debugf(\"listImages: case <-ctx.Done()\")\n\t\treturn nil, o.Context.Err() // we're cancelled, abort\n\tdefault:\n\t}\n\n\timages, err := o.imageClient.GetAll()\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to list images\")\n\t}\n\n\tvar foundOne = false\n\n\tresult := []cloudResource{}\n\tfor _, image := range images.Images {\n\t\tif strings.Contains(*image.Name, o.InfraID) {\n\t\t\tfoundOne = true\n\t\t\to.Logger.Debugf(\"listImages: FOUND: %s, %s, %s\", *image.ImageID, *image.Name, *image.State)\n\t\t\tresult = append(result, cloudResource{\n\t\t\t\tkey: *image.ImageID,\n\t\t\t\tname: *image.Name,\n\t\t\t\tstatus: *image.State,\n\t\t\t\ttypeName: imageTypeName,\n\t\t\t\tid: *image.ImageID,\n\t\t\t})\n\t\t}\n\t}\n\tif !foundOne {\n\t\to.Logger.Debugf(\"listImages: NO matching image against: %s\", o.InfraID)\n\t\tfor _, image := range images.Images {\n\t\t\to.Logger.Debugf(\"listImages: image: %s\", *image.Name)\n\t\t}\n\t}\n\n\treturn cloudResources{}.insert(result...), nil\n}", "func (o InstancePropertiesOutput) Disks() AttachedDiskArrayOutput {\n\treturn o.ApplyT(func(v InstanceProperties) []AttachedDisk { return v.Disks }).(AttachedDiskArrayOutput)\n}", "func (instanceAPIs ContainerInstanceAPIs) ListInstances(w http.ResponseWriter, r *http.Request) {\n\tquery := r.URL.Query()\n\n\tif instanceAPIs.hasUnsupportedFilters(query) {\n\t\thttp.Error(w, unsupportedFilterClientErrMsg, http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tif instanceAPIs.hasRedundantFilters(query) {\n\t\thttp.Error(w, redundantFilterClientErrMsg, http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tstatus := strings.ToLower(query.Get(instanceStatusFilter))\n\tcluster := query.Get(instanceClusterFilter)\n\n\tif status != \"\" {\n\t\tif !instanceAPIs.isValidStatus(status) {\n\t\t\thttp.Error(w, invalidStatusClientErrMsg, http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t}\n\n\tif cluster != \"\" {\n\t\tif !regex.IsClusterARN(cluster) && !regex.IsClusterName(cluster) {\n\t\t\thttp.Error(w, invalidClusterClientErrMsg, http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t}\n\n\tvar instances []storetypes.VersionedContainerInstance\n\tvar err error\n\tswitch {\n\tcase status != \"\" && cluster != \"\":\n\t\tfilters := map[string]string{instanceStatusFilter: status, instanceClusterFilter: cluster}\n\t\tinstances, err = instanceAPIs.instanceStore.FilterContainerInstances(filters)\n\tcase status != \"\":\n\t\tfilters := map[string]string{instanceStatusFilter: status}\n\t\tinstances, err = instanceAPIs.instanceStore.FilterContainerInstances(filters)\n\tcase cluster != \"\":\n\t\tfilters := map[string]string{instanceClusterFilter: cluster}\n\t\tinstances, err = instanceAPIs.instanceStore.FilterContainerInstances(filters)\n\tdefault:\n\t\tinstances, err = instanceAPIs.instanceStore.ListContainerInstances()\n\t}\n\n\tif err != nil {\n\t\thttp.Error(w, internalServerErrMsg, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.Header().Set(contentTypeKey, contentTypeJSON)\n\tw.WriteHeader(http.StatusOK)\n\n\textInstanceItems := make([]*models.ContainerInstance, len(instances))\n\tfor i := range instances {\n\t\tins, err := ToContainerInstance(instances[i])\n\t\tif err != nil {\n\t\t\thttp.Error(w, internalServerErrMsg, http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\textInstanceItems[i] = &ins\n\t}\n\n\textInstances := models.ContainerInstances{\n\t\tItems: extInstanceItems,\n\t}\n\n\terr = json.NewEncoder(w).Encode(extInstances)\n\tif err != nil {\n\t\thttp.Error(w, encodingServerErrMsg, http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "func (o ClusterNodeGroupOutput) DataDisks() ClusterNodeGroupDataDiskArrayOutput {\n\treturn o.ApplyT(func(v ClusterNodeGroup) []ClusterNodeGroupDataDisk { return v.DataDisks }).(ClusterNodeGroupDataDiskArrayOutput)\n}", "func (o *VirtualizationVmwareVirtualMachineAllOf) GetVirtualDisks() []int64 {\n\tif o == nil {\n\t\tvar ret []int64\n\t\treturn ret\n\t}\n\treturn o.VirtualDisks\n}", "func (s *API) ListImages(req *ListImagesRequest, opts ...scw.RequestOption) (*ListImagesResponse, 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\tdefaultPageSize, exist := s.client.GetDefaultPageSize()\n\tif (req.PageSize == nil || *req.PageSize == 0) && exist {\n\t\treq.PageSize = &defaultPageSize\n\t}\n\n\tquery := url.Values{}\n\tparameter.AddToQuery(query, \"page\", req.Page)\n\tparameter.AddToQuery(query, \"page_size\", req.PageSize)\n\tparameter.AddToQuery(query, \"order_by\", req.OrderBy)\n\tparameter.AddToQuery(query, \"namespace_id\", req.NamespaceID)\n\tparameter.AddToQuery(query, \"name\", req.Name)\n\tparameter.AddToQuery(query, \"organization_id\", req.OrganizationID)\n\tparameter.AddToQuery(query, \"project_id\", req.ProjectID)\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: \"GET\",\n\t\tPath: \"/registry/v1/regions/\" + fmt.Sprint(req.Region) + \"/images\",\n\t\tQuery: query,\n\t\tHeaders: http.Header{},\n\t}\n\n\tvar resp ListImagesResponse\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 bootstrapDisks(disks []string) ([]StorageAPI, error) {\n\tstorageDisks := make([]StorageAPI, len(disks))\n\tfor index, disk := range disks {\n\t\tvar err error\n\t\t// Intentionally ignore disk not found errors while\n\t\t// initializing POSIX, so that we have successfully\n\t\t// initialized posix Storage. Subsequent calls to XL/Erasure\n\t\t// will manage any errors related to disks.\n\t\tstorageDisks[index], err = newStorageLayer(disk)\n\t\tif err != nil && err != errDiskNotFound {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn storageDisks, nil\n}", "func (c Client) GetInstances(appName, serviceName, partitionName string) (*InstanceItemsPage, error) {\n\tvar aggregateInstanceItemsPages InstanceItemsPage\n\tvar continueToken string\n\tfor {\n\t\tbasePath := \"Applications/\" + appName + \"/$/GetServices/\" + serviceName + \"/$/GetPartitions/\" + partitionName + \"/$/GetReplicas\"\n\t\tres, err := c.getHTTP(basePath, withContinue(continueToken))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tvar instanceItemsPage InstanceItemsPage\n\t\terr = json.Unmarshal(res, &instanceItemsPage)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"could not deserialise JSON response: %+v\", err)\n\t\t}\n\n\t\taggregateInstanceItemsPages.Items = append(aggregateInstanceItemsPages.Items, instanceItemsPage.Items...)\n\n\t\tcontinueToken = getString(instanceItemsPage.ContinuationToken)\n\t\tif continueToken == \"\" {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn &aggregateInstanceItemsPages, nil\n}", "func GuestDeleteDisks(endpoint string, guestid string, body GuestDeleteDiskBody) (int, []byte) {\n\tdeleteReq, _ := json.Marshal(body)\n\n\tbuffer := getEndpointwithGuests(endpoint)\n\tbuffer.WriteString(\"/\")\n\tbuffer.WriteString(guestid)\n\tbuffer.WriteString(\"/disks\")\n\n\tstatus, data := hq.Delete(buffer.String(), deleteReq)\n\n\treturn status, data\n}", "func (i *IAM) ListInstances(kt *kit.Kit, resType client.TypeID, filter *types.ListInstanceFilter,\n\tpage types.Page) (*types.ListInstanceResult, error) {\n\n\tbizID, pbFilter, err := filter.GetBizIDAndPbFilter()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcountReq := &pbds.ListInstancesReq{\n\t\tBizId: bizID,\n\t\tResourceType: string(resType),\n\t\tFilter: pbFilter,\n\t\tPage: &pbbase.BasePage{Count: true},\n\t}\n\tcountResp, err := i.ds.ListInstances(kt.RpcCtx(), countReq)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq := &pbds.ListInstancesReq{\n\t\tBizId: bizID,\n\t\tResourceType: string(resType),\n\t\tFilter: pbFilter,\n\t\tPage: page.PbPage(),\n\t}\n\tresp, err := i.ds.ListInstances(kt.RpcCtx(), req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tinstances := make([]types.InstanceResource, 0)\n\tfor _, one := range resp.Details {\n\t\tinstances = append(instances, types.InstanceResource{\n\t\t\tID: types.InstanceID{\n\t\t\t\tBizID: bizID,\n\t\t\t\tInstanceID: one.Id,\n\t\t\t},\n\t\t\tDisplayName: one.Name,\n\t\t})\n\t}\n\n\tresult := &types.ListInstanceResult{\n\t\tCount: countResp.Count,\n\t\tResults: instances,\n\t}\n\treturn result, nil\n}", "func (o LookupInstanceResultOutput) Disks() AttachedDiskResponseArrayOutput {\n\treturn o.ApplyT(func(v LookupInstanceResult) []AttachedDiskResponse { return v.Disks }).(AttachedDiskResponseArrayOutput)\n}", "func (f *gcpInstanceFetcher) GetInstances(ctx context.Context, _ bool) ([]Instances, error) {\n\t// Key by project ID, then by zone.\n\tinstanceMap := make(map[string]map[string][]*gcp.Instance)\n\tfor _, projectID := range f.ProjectIDs {\n\t\tinstanceMap[projectID] = make(map[string][]*gcp.Instance)\n\t\tfor _, zone := range f.Zones {\n\t\t\tinstanceMap[projectID][zone] = make([]*gcp.Instance, 0)\n\t\t\tvms, err := f.GCP.ListInstances(ctx, projectID, zone)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, trace.Wrap(err)\n\t\t\t}\n\t\t\tfilteredVMs := make([]*gcp.Instance, 0, len(vms))\n\t\t\tfor _, vm := range vms {\n\t\t\t\tif len(f.ServiceAccounts) > 0 && !slices.Contains(f.ServiceAccounts, vm.ServiceAccount) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif match, _, _ := services.MatchLabels(f.Labels, vm.Labels); !match {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tfilteredVMs = append(filteredVMs, vm)\n\t\t\t}\n\t\t\tinstanceMap[projectID][zone] = filteredVMs\n\t\t}\n\t}\n\n\tvar instances []Instances\n\tfor projectID, vmsByZone := range instanceMap {\n\t\tfor zone, vms := range vmsByZone {\n\t\t\tif len(vms) > 0 {\n\t\t\t\tinstances = append(instances, Instances{GCP: &GCPInstances{\n\t\t\t\t\tProjectID: projectID,\n\t\t\t\t\tZone: zone,\n\t\t\t\t\tInstances: vms,\n\t\t\t\t\tScriptName: f.Parameters[\"scriptName\"],\n\t\t\t\t\tPublicProxyAddr: f.Parameters[\"publicProxyAddr\"],\n\t\t\t\t\tParameters: []string{f.Parameters[\"token\"]},\n\t\t\t\t}})\n\t\t\t}\n\t\t}\n\t}\n\n\treturn instances, nil\n}", "func (c *clustermgrClient) ListRepairingDisks(ctx context.Context) (disks []*DiskInfoSimple, err error) {\n\tc.rwLock.RLock()\n\tdefer c.rwLock.RUnlock()\n\treturn c.listAllDisks(ctx, proto.DiskStatusRepairing)\n}", "func (f *FakeInstanceGroups) ListInstancesInInstanceGroup(name, zone string, state string) ([]*compute.InstanceWithNamedPorts, error) {\n\tig, err := f.getInstanceGroup(name, zone)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn getInstanceList(f.zonesToIGsToInstances[zone][ig]).Items, nil\n}", "func (s *GCSSnapStore) List() (SnapList, error) {\n\t// recursively list all \"files\", not directory\n\n\tit := s.client.Bucket(s.bucket).Objects(s.ctx, &storage.Query{Prefix: s.prefix})\n\n\tvar attrs []*storage.ObjectAttrs\n\tfor {\n\t\tattr, err := it.Next()\n\t\tif err == iterator.Done {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tattrs = append(attrs, attr)\n\t}\n\n\tvar snapList SnapList\n\tfor _, v := range attrs {\n\t\tname := strings.Replace(v.Name, s.prefix+\"/\", \"\", 1)\n\t\t//name := v.Name[len(s.prefix):]\n\t\tsnap, err := ParseSnapshot(name)\n\t\tif err != nil {\n\t\t\t// Warning\n\t\t\tfmt.Printf(\"Invalid snapshot found. Ignoring it:%s\\n\", name)\n\t\t} else {\n\t\t\tsnapList = append(snapList, snap)\n\t\t}\n\t}\n\n\tsort.Sort(snapList)\n\treturn snapList, nil\n}", "func (b BladeStorage) GetAllByDisksID(offset string, limit string, serials []string) (count int, blades []model.Blade, err error) {\n\tif offset != \"\" && limit != \"\" {\n\t\tif err = b.db.Limit(limit).Offset(offset).Joins(\"INNER JOIN disk ON disk.blade_serial = blade.serial\").Where(\"disk.serial in (?)\", serials).Find(&blades).Error; err != nil {\n\t\t\treturn count, blades, err\n\t\t}\n\t\tb.db.Model(&model.Blade{}).Joins(\"INNER JOIN disk ON disk.blade_serial = blade.serial\").Where(\"disk.serial in (?)\", serials).Count(&count)\n\t} else {\n\t\tif err = b.db.Joins(\"INNER JOIN disk ON disk.blade_serial = blade.serial\").Where(\"disk.serial in (?)\", serials).Find(&blades).Error; err != nil {\n\t\t\treturn count, blades, err\n\t\t}\n\t}\n\treturn count, blades, err\n}", "func fakeListZonalDisk(cfg *config.Config, name string, zone string, policies []string, callCount int) gcpRequest {\n\tscope := fmt.Sprintf(\"zones/%s\", zone)\n\tdisk := fakeZonalDisk(cfg, name, zone, policies)\n\treturn fakeDiskAggregatedListRequest(cfg, scope, disk, callCount)\n}", "func (c *TestClient) ListImages(project string, opts ...ListCallOption) ([]*compute.Image, error) {\n\tif c.ListImagesFn != nil {\n\t\treturn c.ListImagesFn(project, opts...)\n\t}\n\treturn c.client.ListImages(project, opts...)\n}", "func (c *Dg) ShowList() ([]string, error) {\n c.con.LogQuery(\"(show) list of device groups\")\n path := c.xpath(nil)\n return c.con.EntryListUsing(c.con.Show, path[:len(path) - 1])\n}", "func (a *cloudProviderAdapter) AggregatedListNetworkEndpointGroup(version meta.Version) (map[string][]*composite.NetworkEndpointGroup, error) {\n\t// TODO: filter for the region the cluster is in.\n\tall, err := composite.AggregatedListNetworkEndpointGroup(a.c, version)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tret := map[string][]*composite.NetworkEndpointGroup{}\n\tfor key, obj := range all {\n\t\t// key is scope\n\t\t// zonal key is \"zones/<zone name>\"\n\t\t// regional key is \"regions/<region name>\"\n\t\t// global key is \"global\"\n\t\t// TODO: use cloud provider meta.KeyType and scope name as key\n\t\tif key.Type() == meta.Global {\n\t\t\tklog.V(4).Infof(\"Ignoring key %v as it is global\", key)\n\t\t\tcontinue\n\t\t}\n\t\tif key.Zone == \"\" {\n\t\t\tklog.Warningf(\"Key %v does not have zone populated, ignoring\", key)\n\t\t\tcontinue\n\t\t}\n\t\tret[key.Zone] = append(ret[key.Zone], obj)\n\t}\n\treturn ret, nil\n}", "func (_m *Client) GetDisks(ctx context.Context, rgname string, logger log.Logger) ([]compute.Disk, error) {\n\tret := _m.Called(ctx, rgname, logger)\n\n\tvar r0 []compute.Disk\n\tif rf, ok := ret.Get(0).(func(context.Context, string, log.Logger) []compute.Disk); ok {\n\t\tr0 = rf(ctx, rgname, logger)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).([]compute.Disk)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(context.Context, string, log.Logger) error); ok {\n\t\tr1 = rf(ctx, rgname, logger)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "func (h StorageClassHandler) List(ctx *gin.Context) {\n\tstatus := h.Prepare(ctx)\n\tif status != http.StatusOK {\n\t\tctx.Status(status)\n\t\treturn\n\t}\n\tdb := h.Reconciler.DB()\n\tlist := []model.StorageClass{}\n\terr := db.List(\n\t\t&list,\n\t\tlibmodel.ListOptions{\n\t\t\tPage: &h.Page,\n\t\t})\n\tif err != nil {\n\t\tLog.Trace(err)\n\t\tctx.Status(http.StatusInternalServerError)\n\t\treturn\n\t}\n\tcontent := []interface{}{}\n\tfor _, m := range list {\n\t\tr := &StorageClass{}\n\t\tr.With(&m)\n\t\tr.SelfLink = h.Link(h.Provider, &m)\n\t\tcontent = append(content, r.Content(h.Detail))\n\t}\n\n\tctx.JSON(http.StatusOK, content)\n}", "func expandInstanceNetworksSlice(c *Client, f []InstanceNetworks) ([]map[string]interface{}, error) {\n\tif f == nil {\n\t\treturn nil, nil\n\t}\n\n\titems := []map[string]interface{}{}\n\tfor _, item := range f {\n\t\ti, err := expandInstanceNetworks(c, &item)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\titems = append(items, i)\n\t}\n\n\treturn items, nil\n}", "func (o LookupServerResultOutput) Disks() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v LookupServerResult) []string { return v.Disks }).(pulumi.StringArrayOutput)\n}", "func (o SourceInstancePropertiesResponseOutput) Disks() SavedAttachedDiskResponseArrayOutput {\n\treturn o.ApplyT(func(v SourceInstancePropertiesResponse) []SavedAttachedDiskResponse { return v.Disks }).(SavedAttachedDiskResponseArrayOutput)\n}", "func (c *TestClient) ListMachineImages(project string, opts ...ListCallOption) ([]*compute.MachineImage, error) {\n\tif c.ListMachineImagesFn != nil {\n\t\treturn c.ListMachineImagesFn(project, opts...)\n\t}\n\treturn c.client.ListMachineImages(project, opts...)\n}", "func flattenImageRawDiskSlice(c *Client, i interface{}) []ImageRawDisk {\n\ta, ok := i.([]interface{})\n\tif !ok {\n\t\treturn []ImageRawDisk{}\n\t}\n\n\tif len(a) == 0 {\n\t\treturn []ImageRawDisk{}\n\t}\n\n\titems := make([]ImageRawDisk, 0, len(a))\n\tfor _, item := range a {\n\t\titems = append(items, *flattenImageRawDisk(c, item.(map[string]interface{})))\n\t}\n\n\treturn items\n}", "func NewListDisksBadRequest() *ListDisksBadRequest {\n\treturn &ListDisksBadRequest{}\n}", "func (g Graph) getDrives(w http.ResponseWriter, r *http.Request, unrestricted bool) {\n\tsanitizedPath := strings.TrimPrefix(r.URL.Path, \"/graph/v1.0/\")\n\t// Parse the request with odata parser\n\todataReq, err := godata.ParseRequest(r.Context(), sanitizedPath, r.URL.Query())\n\tif err != nil {\n\t\tg.logger.Err(err).Interface(\"query\", r.URL.Query()).Msg(\"query error\")\n\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\tg.logger.Debug().\n\t\tInterface(\"query\", r.URL.Query()).\n\t\tBool(\"unrestricted\", unrestricted).\n\t\tMsg(\"Calling getDrives\")\n\tctx := r.Context()\n\n\tfilters, err := generateCs3Filters(odataReq)\n\tif err != nil {\n\t\tg.logger.Err(err).Interface(\"query\", r.URL.Query()).Msg(\"query error\")\n\t\terrorcode.NotSupported.Render(w, r, http.StatusNotImplemented, err.Error())\n\t\treturn\n\t}\n\tres, err := g.ListStorageSpacesWithFilters(ctx, filters, unrestricted)\n\tswitch {\n\tcase err != nil:\n\t\tg.logger.Error().Err(err).Msg(ListStorageSpacesTransportErr)\n\t\terrorcode.GeneralException.Render(w, r, http.StatusInternalServerError, err.Error())\n\t\treturn\n\tcase res.Status.Code != cs3rpc.Code_CODE_OK:\n\t\tif res.Status.Code == cs3rpc.Code_CODE_NOT_FOUND {\n\t\t\t// return an empty list\n\t\t\trender.Status(r, http.StatusOK)\n\t\t\trender.JSON(w, r, &listResponse{})\n\t\t\treturn\n\t\t}\n\t\tg.logger.Error().Err(err).Msg(ListStorageSpacesReturnsErr)\n\t\terrorcode.GeneralException.Render(w, r, http.StatusInternalServerError, res.Status.Message)\n\t\treturn\n\t}\n\n\twdu, err := url.Parse(g.config.Spaces.WebDavBase + g.config.Spaces.WebDavPath)\n\tif err != nil {\n\t\tg.logger.Error().Err(err).Msg(\"error parsing url\")\n\t\terrorcode.GeneralException.Render(w, r, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tspaces, err := g.formatDrives(ctx, wdu, res.StorageSpaces)\n\tif err != nil {\n\t\tg.logger.Error().Err(err).Msg(\"error encoding response as json\")\n\t\terrorcode.GeneralException.Render(w, r, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\n\tspaces, err = sortSpaces(odataReq, spaces)\n\tif err != nil {\n\t\tg.logger.Error().Err(err).Msg(\"error sorting the spaces list\")\n\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\n\trender.Status(r, http.StatusOK)\n\trender.JSON(w, r, &listResponse{Value: spaces})\n}", "func (page DiskListPageClient) Values() []azcompute.Disk {\n\tl := []azcompute.Disk{}\n\terr := DeepCopy(&l, page.dlp.Values())\n\tif err != nil {\n\t\tpage.err = fmt.Errorf(\"fail to get disk list, %s\", err) //nolint:staticcheck\n\t}\n\treturn l\n}", "func (o *VirtualizationIweVirtualMachine) SetDisks(v []VirtualizationVmDisk) {\n\to.Disks = v\n}", "func (h *httpCloud) List(filter string) ([]string, error) {\n\tvar resp []string\n\tif err := h.get(h.instancesURL+path.Join(InstancesPath, filter), &resp); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn resp, nil\n}", "func (c *Client) ListLocalDisks(ctx context.Context, params *ListLocalDisksInput, optFns ...func(*Options)) (*ListLocalDisksOutput, error) {\n\tif params == nil {\n\t\tparams = &ListLocalDisksInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"ListLocalDisks\", params, optFns, c.addOperationListLocalDisksMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*ListLocalDisksOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "func (taker TakerSQLAdminGCP) ListSQLInstances(project *reportProject) (gcpInstances []*sqladmin.DatabaseInstance, err error) {\n\tsqlInstanceResponse, silErr := taker.sqladminService.Instances.List(project.gcpProject.ProjectId).Do()\n\tif silErr == nil {\n\t\tgcpInstances = sqlInstanceResponse.Items\n\t}\n\terr = silErr\n\treturn\n}", "func (m *Group) GetDrives()([]Driveable) {\n return m.drives\n}", "func (r Virtual_ReservedCapacityGroup) GetInstances() (resp []datatypes.Virtual_ReservedCapacityGroup_Instance, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Virtual_ReservedCapacityGroup\", \"getInstances\", nil, &r.Options, &resp)\n\treturn\n}", "func (a Access) ListDBInstances() (*DBInstances, error) {\n\turl := fmt.Sprintf(\"%s%s/instances\", RDB_URL, a.TenantID)\n\tbody, err := a.baseRequest(url, \"GET\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdbs := &DBInstances{}\n\terr = json.Unmarshal(body, dbs)\n\treturn dbs, err\n}", "func ImageList() error {\n\timagesDir, err := getImagesDir()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdir, err := os.Open(imagesDir)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer dir.Close()\n\n\tnames, err := dir.Readdirnames(0)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, name := range names {\n\t\tif strings.HasSuffix(name, \".qcow2\") {\n\t\t\tfmt.Println(strings.TrimSuffix(name, \".qcow2\"))\n\t\t}\n\t}\n\n\treturn nil\n}", "func List(client *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager {\n\turl := baseURL(client)\n\n\tif opts != nil {\n\t\tquery, err := opts.ToBackupListQuery()\n\t\tif err != nil {\n\t\t\treturn pagination.Pager{Err: err}\n\t\t}\n\t\turl += query\n\t}\n\n\tpageFn := func(r pagination.PageResult) pagination.Page {\n\t\treturn BackupPage{pagination.SinglePageBase(r)}\n\t}\n\n\treturn pagination.NewPager(client, url, pageFn)\n}", "func (d *DiskStorage) List() ([]interface{}, error) {\n\treturn d.memory.List()\n}", "func (client AccessGovernanceCPClient) ListGovernanceInstances(ctx context.Context, request ListGovernanceInstancesRequest) (response ListGovernanceInstancesResponse, err error) {\n\tvar ociResponse common.OCIResponse\n\tpolicy := common.DefaultRetryPolicy()\n\tif client.RetryPolicy() != nil {\n\t\tpolicy = *client.RetryPolicy()\n\t}\n\tif request.RetryPolicy() != nil {\n\t\tpolicy = *request.RetryPolicy()\n\t}\n\tociResponse, err = common.Retry(ctx, request, client.listGovernanceInstances, 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 = ListGovernanceInstancesResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId}\n\t\t\t} else {\n\t\t\t\tresponse = ListGovernanceInstancesResponse{}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\tif convertedResponse, ok := ociResponse.(ListGovernanceInstancesResponse); ok {\n\t\tresponse = convertedResponse\n\t} else {\n\t\terr = fmt.Errorf(\"failed to convert OCIResponse into ListGovernanceInstancesResponse\")\n\t}\n\treturn\n}", "func (d ImagefsDriver) List() (*volume.ListResponse, error) {\n\tcontainers, err := d.cli.ContainerList(context.Background(), types.ContainerListOptions{\n\t\tAll: true,\n\t\tFilters: filters.NewArgs(filters.Arg(\"label\", \"com.docker.imagefs.version\")),\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unexpected error: %s\", err)\n\t}\n\tresponse := &volume.ListResponse{}\n\tfor i := range containers {\n\t\tresponse.Volumes = append(response.Volumes, &volume.Volume{\n\t\t\t// TODO(rabrams) fall back to id if no names\n\t\t\tName: containers[i].Names[0],\n\t\t})\n\t}\n\treturn response, nil\n}", "func (base *Base) List(ctx context.Context, path string) ([]string, error) {\n\tctx, done := dcontext.WithTrace(ctx)\n\tdefer done(\"%s.List(%q)\", base.Name(), path)\n\n\tif !storagedriver.PathRegexp.MatchString(path) && path != \"/\" {\n\t\treturn nil, storagedriver.InvalidPathError{Path: path, DriverName: base.StorageDriver.Name()}\n\t}\n\n\tstart := time.Now()\n\tstr, e := base.StorageDriver.List(ctx, path)\n\tstorageAction.WithValues(base.Name(), \"List\").UpdateSince(start)\n\treturn str, base.setDriverName(e)\n}", "func (client AccessGovernanceCPClient) listGovernanceInstances(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodGet, \"/governanceInstances\", binaryReqBody, extraHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response ListGovernanceInstancesResponse\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/access-governance-cp/20220518/GovernanceInstanceCollection/ListGovernanceInstances\"\n\t\terr = common.PostProcessServiceError(err, \"AccessGovernanceCP\", \"ListGovernanceInstances\", apiReferenceLink)\n\t\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponse(httpResponse, &response)\n\treturn response, err\n}", "func (c *Dg) GetList() ([]string, error) {\n c.con.LogQuery(\"(get) list of device groups\")\n path := c.xpath(nil)\n return c.con.EntryListUsing(c.con.Get, path[:len(path) - 1])\n}", "func (adm Admin) ListInstances(cluster string) (string, error) {\n\tconn := newConnection(adm.ZkSvr)\n\terr := conn.Connect()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer conn.Disconnect()\n\n\t// make sure the cluster is already setup\n\tif ok, err := conn.IsClusterSetup(cluster); !ok || err != nil {\n\t\treturn \"\", ErrClusterNotSetup\n\t}\n\n\tkeys := KeyBuilder{cluster}\n\tisPath := keys.instances()\n\tinstances, err := conn.Children(isPath)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tvar buffer bytes.Buffer\n\tbuffer.WriteString(fmt.Sprintf(\"Existing instances in cluster %s:\\n\", cluster))\n\n\tfor _, r := range instances {\n\t\tbuffer.WriteString(\" \" + r + \"\\n\")\n\t}\n\n\treturn buffer.String(), nil\n}", "func RunListDisk() {\n\n\t// dir, err := filepath.Abs(filepath.Dir(os.Args[0]))\n\t// if err != nil {\n\t// \tlog.Fatal(err)\n\t// \treturn\n\t// }\n\n\t// lsscsipath := path.Join(dir, \"lsscsi\")\n\t// if _, err := os.Stat(lsscsipath); os.IsNotExist(err) {\n\t// \tlsscsipath = \"lsscsi\"\n\t// }\n\tlsscsipath := \"lsscsi\"\n\tcmd := exec.Command(lsscsipath, \"-s\", \"-g\")\n\tstdout, err := cmd.StdoutPipe()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tif err := cmd.Start(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\ttimer := time.AfterFunc(10*time.Second, func() {\n\t\tcmd.Process.Kill()\n\t})\n\n\tscanner := bufio.NewScanner(stdout)\n\tvar hddinfo []string\n\tvar hddchanged bool\n\tvar wg sync.WaitGroup\n\tfor scanner.Scan() {\n\t\tss := scanner.Text()\n\t\tfmt.Println(ss)\n\t\thddinfo = append(hddinfo, ss)\n\t\tif !DetectData.MatchKey(ss) {\n\t\t\thddchanged = true\n\t\t}\n\t\tif !DetectData.ContainsKey(ss) {\n\t\t\t//\\s Matches any white-space character.\n\t\t\tr := regexp.MustCompile(`^([\\s\\S]{13})(disk[\\s\\S]{4})([\\s\\S]{9})([\\s\\S]{17})([\\s\\S]{6})([\\s\\S]{11})([\\s\\S]{11})([\\s\\S]+)$`)\n\t\t\tdiskinfos := r.FindStringSubmatch(ss)\n\t\t\tif len(diskinfos) == 9 {\n\t\t\t\tvar dddect = NewSyncDataDetect()\n\t\t\t\tdddect.detectHDD.Locpath = strings.Trim(diskinfos[1], \" \")\n\t\t\t\tdddect.detectHDD.Type = strings.Trim(diskinfos[2], \" \")\n\t\t\t\tdddect.detectHDD.Manufacture = strings.Trim(diskinfos[3], \" \")\n\t\t\t\tdddect.detectHDD.Model = strings.Trim(diskinfos[4], \" \")\n\t\t\t\tdddect.detectHDD.Version = strings.Trim(diskinfos[5], \" \")\n\t\t\t\tdddect.detectHDD.LinuxName = strings.Trim(diskinfos[6], \" \")\n\t\t\t\tdddect.detectHDD.SGLibName = strings.Trim(diskinfos[7], \" \")\n\t\t\t\tdddect.detectHDD.Size = strings.Trim(diskinfos[8], \" \")\n\n\t\t\t\tif strings.Index(dddect.detectHDD.LinuxName, `/dev/`) == -1 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\t//hddchanged = true\n\t\t\t\tDetectData.AddValue(ss, dddect)\n\t\t\t\twg.Add(1)\n\t\t\t\tgo dddect.ReadDataFromSmartCtl(&wg)\n\t\t\t}\n\t\t} else {\n\t\t\tif vv, ok := DetectData.Get(ss); ok {\n\t\t\t\tif len(vv.detectHDD.UILabel) == 0 && len(vv.detectHDD.Otherinfo) == 0 {\n\t\t\t\t\twg.Add(1)\n\t\t\t\t\tgo vv.ReadDataFromSmartCtl(&wg)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\ttimer.Stop()\n\tDetectData.RemoveOld(hddinfo)\n\n\ttime.Sleep(4 * time.Second)\n\n\tif hddchanged {\n\t\tfmt.Print(\"changed!\")\n\t\tcclist, err := configxmldata.Conf.GetCardListIndex()\n\t\tif err == nil {\n\t\t\tfor _, i := range cclist {\n\t\t\t\twg.Add(1)\n\t\t\t\tgo SASHDDinfo.RunCardInfo(i, &wg)\n\t\t\t}\n\t\t}\n\t\tfor i := 0; i < 30; i++ {\n\t\t\tif waitTimeout(&wg, 10*time.Second) {\n\t\t\t\tfmt.Println(\"Timed out waiting for wait group\")\n\t\t\t\tMergeCalibration()\n\t\t\t} else {\n\t\t\t\tfmt.Println(\"Wait group finished\")\n\t\t\t\tMergeCalibration()\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t} else {\n\t\twaitTimeout(&wg, 300*time.Second)\n\t}\n\n}", "func (r *StorageClusterReconciler) newCephFilesystemInstances(initData *ocsv1.StorageCluster) ([]*cephv1.CephFilesystem, error) {\n\tret := &cephv1.CephFilesystem{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: generateNameForCephFilesystem(initData),\n\t\t\tNamespace: initData.Namespace,\n\t\t},\n\t\tSpec: cephv1.FilesystemSpec{\n\t\t\tMetadataPool: cephv1.PoolSpec{\n\t\t\t\tReplicated: generateCephReplicatedSpec(initData, \"metadata\"),\n\t\t\t\tFailureDomain: initData.Status.FailureDomain,\n\t\t\t},\n\t\t\tMetadataServer: cephv1.MetadataServerSpec{\n\t\t\t\tActiveCount: 1,\n\t\t\t\tActiveStandby: true,\n\t\t\t\tPlacement: getPlacement(initData, \"mds\"),\n\t\t\t\tResources: defaults.GetDaemonResources(\"mds\", initData.Spec.Resources),\n\t\t\t\t// set PriorityClassName for the MDS pods\n\t\t\t\tPriorityClassName: openshiftUserCritical,\n\t\t\t},\n\t\t},\n\t}\n\n\tif initData.Spec.StorageProfiles == nil {\n\t\t// standalone deployment will not have storageProfile, we need to\n\t\t// define default dataPool, if storageProfile is set this will be\n\t\t// overridden.\n\t\tret.Spec.DataPools = []cephv1.NamedPoolSpec{\n\t\t\t{\n\t\t\t\tPoolSpec: cephv1.PoolSpec{\n\t\t\t\t\tDeviceClass: generateDeviceClass(initData),\n\t\t\t\t\tReplicated: generateCephReplicatedSpec(initData, \"data\"),\n\t\t\t\t\tFailureDomain: initData.Status.FailureDomain,\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t} else {\n\t\t// set deviceClass and parameters from storageProfile\n\t\tfor i := range initData.Spec.StorageProfiles {\n\t\t\tdeviceClass := initData.Spec.StorageProfiles[i].DeviceClass\n\t\t\tparameters := initData.Spec.StorageProfiles[i].SharedFilesystemConfiguration.Parameters\n\t\t\tret.Spec.DataPools = append(ret.Spec.DataPools, cephv1.NamedPoolSpec{\n\t\t\t\tName: deviceClass,\n\t\t\t\tPoolSpec: cephv1.PoolSpec{\n\t\t\t\t\tReplicated: generateCephReplicatedSpec(initData, \"data\"),\n\t\t\t\t\tDeviceClass: deviceClass,\n\t\t\t\t\tParameters: parameters,\n\t\t\t\t\tFailureDomain: initData.Status.FailureDomain,\n\t\t\t\t},\n\t\t\t})\n\t\t}\n\t}\n\n\terr := controllerutil.SetControllerReference(initData, ret, r.Scheme)\n\tif err != nil {\n\t\tr.Log.Error(err, \"Unable to set Controller Reference for CephFileSystem.\", \"CephFileSystem\", klog.KRef(ret.Namespace, ret.Name))\n\t\treturn nil, err\n\t}\n\n\treturn []*cephv1.CephFilesystem{ret}, nil\n}", "func (adm Admin) ListInstances(cluster string) (string, error) {\n\t// make sure the cluster is already setup\n\tif ok, err := adm.isClusterSetup(cluster); !ok || err != nil {\n\t\treturn \"\", ErrClusterNotSetup\n\t}\n\n\tbuilder := KeyBuilder{cluster}\n\tisPath := builder.instances()\n\tinstances, err := adm.zkClient.Children(isPath)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tvar buffer bytes.Buffer\n\tbuffer.WriteString(fmt.Sprintf(\"Existing instances in cluster %s:\\n\", cluster))\n\n\tfor _, r := range instances {\n\t\tbuffer.WriteString(\" \" + r + \"\\n\")\n\t}\n\n\treturn buffer.String(), nil\n}", "func (o InstancePropertiesResponseOutput) Disks() AttachedDiskResponseArrayOutput {\n\treturn o.ApplyT(func(v InstancePropertiesResponse) []AttachedDiskResponse { return v.Disks }).(AttachedDiskResponseArrayOutput)\n}", "func (o EcsLaunchTemplateOutput) DataDisks() EcsLaunchTemplateDataDiskArrayOutput {\n\treturn o.ApplyT(func(v *EcsLaunchTemplate) EcsLaunchTemplateDataDiskArrayOutput { return v.DataDisks }).(EcsLaunchTemplateDataDiskArrayOutput)\n}", "func (m *manager) Sync(nodes []string) (err error) {\n\tklog.V(2).Infof(\"Syncing nodes %v\", nodes)\n\n\tdefer func() {\n\t\t// The node pool is only responsible for syncing nodes to instance\n\t\t// groups. It never creates/deletes, so if an instance groups is\n\t\t// not found there's nothing it can do about it anyway. Most cases\n\t\t// this will happen because the backend pool has deleted the instance\n\t\t// group, however if it happens because a user deletes the IG by mistake\n\t\t// we should just wait till the backend pool fixes it.\n\t\tif utils.IsHTTPErrorCode(err, http.StatusNotFound) {\n\t\t\tklog.Infof(\"Node pool encountered a 404, ignoring: %v\", err)\n\t\t\terr = nil\n\t\t}\n\t}()\n\n\tpool, err := m.List()\n\tif err != nil {\n\t\tklog.Errorf(\"List error: %v\", err)\n\t\treturn err\n\t}\n\n\tfor _, igName := range pool {\n\t\tgceNodes := sets.NewString()\n\t\tgceNodes, err = m.listIGInstances(igName)\n\t\tif err != nil {\n\t\t\tklog.Errorf(\"list(%q) error: %v\", igName, err)\n\t\t\treturn err\n\t\t}\n\t\tkubeNodes := sets.NewString(nodes...)\n\n\t\t// Individual InstanceGroup has a limit for 1000 instances in it.\n\t\t// As a result, it's not possible to add more to it.\n\t\tif len(kubeNodes) > m.maxIGSize {\n\t\t\t// List() will return a sorted list so the kubeNodesList truncation will have a stable set of nodes.\n\t\t\tkubeNodesList := kubeNodes.List()\n\n\t\t\t// Store first 10 truncated nodes for logging\n\t\t\ttruncateForLogs := func(nodes []string) []string {\n\t\t\t\tmaxLogsSampleSize := 10\n\t\t\t\tif len(nodes) <= maxLogsSampleSize {\n\t\t\t\t\treturn nodes\n\t\t\t\t}\n\t\t\t\treturn nodes[:maxLogsSampleSize]\n\t\t\t}\n\n\t\t\tklog.Warningf(\"Total number of kubeNodes: %d, truncating to maximum Instance Group size = %d. Instance group name: %s. First truncated instances: %v\", len(kubeNodesList), m.maxIGSize, igName, truncateForLogs(nodes[m.maxIGSize:]))\n\t\t\tkubeNodes = sets.NewString(kubeNodesList[:m.maxIGSize]...)\n\t\t}\n\n\t\t// A node deleted via kubernetes could still exist as a gce vm. We don't\n\t\t// want to route requests to it. Similarly, a node added to kubernetes\n\t\t// needs to get added to the instance group so we do route requests to it.\n\n\t\tremoveNodes := gceNodes.Difference(kubeNodes).List()\n\t\taddNodes := kubeNodes.Difference(gceNodes).List()\n\n\t\tklog.V(2).Infof(\"Removing nodes: %v\", removeNodes)\n\t\tklog.V(2).Infof(\"Adding nodes: %v\", addNodes)\n\n\t\tstart := time.Now()\n\t\tif len(removeNodes) != 0 {\n\t\t\terr = m.remove(igName, removeNodes)\n\t\t\tklog.V(2).Infof(\"Remove(%q, _) = %v (took %s); nodes = %v\", igName, err, time.Now().Sub(start), removeNodes)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tstart = time.Now()\n\t\tif len(addNodes) != 0 {\n\t\t\terr = m.add(igName, addNodes)\n\t\t\tklog.V(2).Infof(\"Add(%q, _) = %v (took %s); nodes = %v\", igName, err, time.Now().Sub(start), addNodes)\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 (m *GraphBaseServiceClient) Drives()(*iefc72d8a17962d4db125c50866617eaa15d662c6e3fb13735d477380dcc0dbe3.DrivesRequestBuilder) {\n return iefc72d8a17962d4db125c50866617eaa15d662c6e3fb13735d477380dcc0dbe3.NewDrivesRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "func (m *GraphBaseServiceClient) Drives()(*iefc72d8a17962d4db125c50866617eaa15d662c6e3fb13735d477380dcc0dbe3.DrivesRequestBuilder) {\n return iefc72d8a17962d4db125c50866617eaa15d662c6e3fb13735d477380dcc0dbe3.NewDrivesRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "func (c *TestClient) AggregatedListSubnetworks(project string, opts ...ListCallOption) ([]*compute.Subnetwork, error) {\n\tif c.AggregatedListSubnetworksFn != nil {\n\t\treturn c.AggregatedListSubnetworksFn(project, opts...)\n\t}\n\treturn c.client.AggregatedListSubnetworks(project, opts...)\n}", "func (o *StorageEnclosure) GetPhysicalDisks() []StoragePhysicalDiskRelationship {\n\tif o == nil {\n\t\tvar ret []StoragePhysicalDiskRelationship\n\t\treturn ret\n\t}\n\treturn o.PhysicalDisks\n}" ]
[ "0.64483696", "0.6295886", "0.593534", "0.58032113", "0.55512005", "0.5495102", "0.5374072", "0.53085715", "0.5293681", "0.5251024", "0.52482766", "0.52414393", "0.521405", "0.5126801", "0.5123946", "0.5121574", "0.5113818", "0.51063365", "0.506762", "0.50647795", "0.5060763", "0.5055875", "0.5043116", "0.5039869", "0.5016953", "0.49765024", "0.49659705", "0.49506938", "0.49476403", "0.494065", "0.49377894", "0.49332768", "0.4927136", "0.49130556", "0.49105746", "0.49068007", "0.49050573", "0.48995242", "0.48980883", "0.48810685", "0.4880172", "0.48413908", "0.48336056", "0.482603", "0.48228633", "0.4801562", "0.47914696", "0.47885624", "0.47773555", "0.47714627", "0.47578102", "0.47514105", "0.47177964", "0.47171044", "0.47025922", "0.4693522", "0.4687579", "0.46864173", "0.46860507", "0.4681967", "0.46704695", "0.4665487", "0.465394", "0.4651258", "0.4650805", "0.46413115", "0.46322268", "0.46281448", "0.4621308", "0.46178418", "0.46130857", "0.46099228", "0.4608373", "0.46054098", "0.46013898", "0.4599118", "0.45879447", "0.45872247", "0.45842272", "0.45697847", "0.45581362", "0.45581254", "0.4556", "0.453395", "0.45278144", "0.45264366", "0.452339", "0.45213214", "0.45182952", "0.45113933", "0.45043957", "0.44978774", "0.44974744", "0.44964662", "0.4483638", "0.44833082", "0.4471496", "0.4471496", "0.44586936", "0.44551882" ]
0.78136164
0
ListDisks uses the override method ListDisksFn or the real implementation.
func (c *TestClient) ListDisks(project, zone string, opts ...ListCallOption) ([]*compute.Disk, error) { if c.ListDisksFn != nil { return c.ListDisksFn(project, zone, opts...) } return c.client.ListDisks(project, zone, opts...) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *MockDisksClient) List(ctx context.Context, resourceGroupName string) ([]compute.Disk, error) {\n\tvar l []compute.Disk\n\tfor _, disk := range c.Disks {\n\t\tl = append(l, disk)\n\t}\n\treturn l, nil\n}", "func ListVdisks(cluster ardb.StorageCluster, pred func(vdiskID string) bool) ([]string, error) {\n\tctx, cancel := context.WithCancel(context.Background())\n\tdefer cancel()\n\n\tserverCh, err := cluster.ServerIterator(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttype serverResult struct {\n\t\tids []string\n\t\terr error\n\t}\n\tresultCh := make(chan serverResult)\n\n\tvar action listVdisksAction\n\tif pred == nil {\n\t\taction.filter = filterListedVdiskID\n\t} else {\n\t\taction.filter = func(str string) (string, bool) {\n\t\t\tstr, ok := filterListedVdiskID(str)\n\t\t\tif !ok {\n\t\t\t\treturn \"\", false\n\t\t\t}\n\t\t\treturn str, pred(str)\n\t\t}\n\t}\n\n\tvar serverCount int\n\tvar reply interface{}\n\tfor server := range serverCh {\n\t\tserver := server\n\t\tgo func() {\n\t\t\tvar result serverResult\n\t\t\tlog.Infof(\"listing all vdisks stored on %v\", server.Config())\n\t\t\treply, result.err = server.Do(action)\n\t\t\tif result.err == nil && reply != nil {\n\t\t\t\t// [NOTE] this line of code relies on the fact that our\n\t\t\t\t// custom `listVdisksAction` type returns a `[]string` value as a reply,\n\t\t\t\t// as soon as that logic changes, this line will start causing trouble.\n\t\t\t\tresult.ids = reply.([]string)\n\t\t\t}\n\t\t\tselect {\n\t\t\tcase resultCh <- result:\n\t\t\tcase <-ctx.Done():\n\t\t\t}\n\t\t}()\n\t\tserverCount++\n\t}\n\n\t// collect the ids from all servers within the given cluster\n\tvar ids []string\n\tvar result serverResult\n\tfor i := 0; i < serverCount; i++ {\n\t\tresult = <-resultCh\n\t\tif result.err != nil {\n\t\t\t// return early, an error has occured!\n\t\t\treturn nil, result.err\n\t\t}\n\t\tids = append(ids, result.ids...)\n\t}\n\n\tif len(ids) <= 1 {\n\t\treturn ids, nil // nothing to do\n\t}\n\n\t// sort and dedupe\n\tsort.Strings(ids)\n\tids = dedupStrings(ids)\n\n\treturn ids, nil\n}", "func (s *Module) DiskList() ([]pkg.VDisk, error) {\n\tpools, err := s.diskPools()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar disks []pkg.VDisk\n\tfor _, pool := range pools {\n\n\t\titems, err := os.ReadDir(pool)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"failed to list virtual disks\")\n\t\t}\n\n\t\tfor _, item := range items {\n\t\t\tif item.IsDir() {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tinfo, err := item.Info()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.Wrapf(err, \"failed to get file info for '%s'\", item.Name())\n\t\t\t}\n\n\t\t\tdisks = append(disks, pkg.VDisk{\n\t\t\t\tPath: filepath.Join(pool, item.Name()),\n\t\t\t\tSize: info.Size(),\n\t\t\t})\n\t\t}\n\n\t\treturn disks, nil\n\t}\n\n\treturn disks, nil\n}", "func NewListDisksOK() *ListDisksOK {\n\treturn &ListDisksOK{}\n}", "func (client *Client) ListDisks00(request *ListDisks00Request) (response *ListDisks00Response, err error) {\n\tresponse = CreateListDisks00Response()\n\terr = client.DoAction(request, response)\n\treturn\n}", "func (c *TestClient) AggregatedListDisks(project string, opts ...ListCallOption) ([]*compute.Disk, error) {\n\tif c.AggregatedListDisksFn != nil {\n\t\treturn c.AggregatedListDisksFn(project, opts...)\n\t}\n\treturn c.client.AggregatedListDisks(project, opts...)\n}", "func (c *clustermgrClient) ListMigratingDisks(ctx context.Context, taskType proto.TaskType) (disks []*MigratingDiskMeta, err error) {\n\tspan := trace.SpanFromContextSafe(ctx)\n\n\tprefix := genMigratingDiskPrefix(taskType)\n\tmarker := defaultListTaskMarker\n\tfor {\n\t\targs := &cmapi.ListKvOpts{\n\t\t\tPrefix: prefix,\n\t\t\tCount: defaultListTaskNum,\n\t\t\tMarker: marker,\n\t\t}\n\t\tret, err := c.client.ListKV(ctx, args)\n\t\tif err != nil {\n\t\t\tspan.Errorf(\"list task failed: err[%+v]\", err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, v := range ret.Kvs {\n\t\t\tvar task *MigratingDiskMeta\n\t\t\terr = json.Unmarshal(v.Value, &task)\n\t\t\tif err != nil {\n\t\t\t\tspan.Errorf(\"unmarshal task failed: err[%+v]\", err)\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tif task.TaskType != taskType {\n\t\t\t\tspan.Errorf(\"task type is invalid: expected[%s], actual[%s]\", taskType, task.TaskType)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tdisks = append(disks, task)\n\t\t}\n\t\tmarker = ret.Marker\n\t\tif marker == defaultListTaskMarker {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn\n}", "func (c *clustermgrClient) ListClusterDisks(ctx context.Context) (disks []*DiskInfoSimple, err error) {\n\tc.rwLock.RLock()\n\tdefer c.rwLock.RUnlock()\n\treturn c.listAllDisks(ctx, proto.DiskStatusNormal)\n}", "func (c *Client) ListLocalDisks(ctx context.Context, params *ListLocalDisksInput, optFns ...func(*Options)) (*ListLocalDisksOutput, error) {\n\tif params == nil {\n\t\tparams = &ListLocalDisksInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"ListLocalDisks\", params, optFns, c.addOperationListLocalDisksMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*ListLocalDisksOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "func (t *Template) GetDisks() []shared.Disk {\n\n\tvecs := t.GetVectors(string(shared.DiskVec))\n\tdisks := make([]shared.Disk, len(vecs))\n\n\tfor i, v := range vecs {\n\t\tdisks[i] = shared.Disk{*v}\n\t}\n\n\treturn disks\n}", "func Disks() []*Disk {\n\tmsg := `\nThe Disks() function has been DEPRECATED and will be removed in the\n1.0 release of ghw. Please use the BlockInfo.Disks attribute.\n`\n\twarn(msg)\n\tctx := contextFromEnv()\n\treturn ctx.disks()\n}", "func (o *VirtualizationIweVirtualMachine) GetDisks() []VirtualizationVmDisk {\n\tif o == nil {\n\t\tvar ret []VirtualizationVmDisk\n\t\treturn ret\n\t}\n\treturn o.Disks\n}", "func (c *clustermgrClient) ListBrokenDisks(ctx context.Context) (disks []*DiskInfoSimple, err error) {\n\tc.rwLock.RLock()\n\tdefer c.rwLock.RUnlock()\n\treturn c.listAllDisks(ctx, proto.DiskStatusBroken)\n}", "func (c *clustermgrClient) ListRepairingDisks(ctx context.Context) (disks []*DiskInfoSimple, err error) {\n\tc.rwLock.RLock()\n\tdefer c.rwLock.RUnlock()\n\treturn c.listAllDisks(ctx, proto.DiskStatusRepairing)\n}", "func listDirFactory(ctx context.Context, disks ...StorageAPI) ListDirFunc {\n\t// Returns sorted merged entries from all the disks.\n\tlistDir := func(bucket, prefixDir, prefixEntry string) (mergedEntries []string) {\n\t\tfor _, disk := range disks {\n\t\t\tif disk == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tvar entries []string\n\t\t\tvar newEntries []string\n\t\t\tvar err error\n\t\t\tentries, err = disk.ListDir(bucket, prefixDir, -1, xlMetaJSONFile)\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Find elements in entries which are not in mergedEntries\n\t\t\tfor _, entry := range entries {\n\t\t\t\tidx := sort.SearchStrings(mergedEntries, entry)\n\t\t\t\t// if entry is already present in mergedEntries don't add.\n\t\t\t\tif idx < len(mergedEntries) && mergedEntries[idx] == entry {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tnewEntries = append(newEntries, entry)\n\t\t\t}\n\n\t\t\tif len(newEntries) > 0 {\n\t\t\t\t// Merge the entries and sort it.\n\t\t\t\tmergedEntries = append(mergedEntries, newEntries...)\n\t\t\t\tsort.Strings(mergedEntries)\n\t\t\t}\n\t\t}\n\t\treturn filterMatchingPrefix(mergedEntries, prefixEntry)\n\t}\n\treturn listDir\n}", "func (d *DiskStorage) List() ([]interface{}, error) {\n\treturn d.memory.List()\n}", "func RunListDisk() {\n\n\t// dir, err := filepath.Abs(filepath.Dir(os.Args[0]))\n\t// if err != nil {\n\t// \tlog.Fatal(err)\n\t// \treturn\n\t// }\n\n\t// lsscsipath := path.Join(dir, \"lsscsi\")\n\t// if _, err := os.Stat(lsscsipath); os.IsNotExist(err) {\n\t// \tlsscsipath = \"lsscsi\"\n\t// }\n\tlsscsipath := \"lsscsi\"\n\tcmd := exec.Command(lsscsipath, \"-s\", \"-g\")\n\tstdout, err := cmd.StdoutPipe()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tif err := cmd.Start(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\ttimer := time.AfterFunc(10*time.Second, func() {\n\t\tcmd.Process.Kill()\n\t})\n\n\tscanner := bufio.NewScanner(stdout)\n\tvar hddinfo []string\n\tvar hddchanged bool\n\tvar wg sync.WaitGroup\n\tfor scanner.Scan() {\n\t\tss := scanner.Text()\n\t\tfmt.Println(ss)\n\t\thddinfo = append(hddinfo, ss)\n\t\tif !DetectData.MatchKey(ss) {\n\t\t\thddchanged = true\n\t\t}\n\t\tif !DetectData.ContainsKey(ss) {\n\t\t\t//\\s Matches any white-space character.\n\t\t\tr := regexp.MustCompile(`^([\\s\\S]{13})(disk[\\s\\S]{4})([\\s\\S]{9})([\\s\\S]{17})([\\s\\S]{6})([\\s\\S]{11})([\\s\\S]{11})([\\s\\S]+)$`)\n\t\t\tdiskinfos := r.FindStringSubmatch(ss)\n\t\t\tif len(diskinfos) == 9 {\n\t\t\t\tvar dddect = NewSyncDataDetect()\n\t\t\t\tdddect.detectHDD.Locpath = strings.Trim(diskinfos[1], \" \")\n\t\t\t\tdddect.detectHDD.Type = strings.Trim(diskinfos[2], \" \")\n\t\t\t\tdddect.detectHDD.Manufacture = strings.Trim(diskinfos[3], \" \")\n\t\t\t\tdddect.detectHDD.Model = strings.Trim(diskinfos[4], \" \")\n\t\t\t\tdddect.detectHDD.Version = strings.Trim(diskinfos[5], \" \")\n\t\t\t\tdddect.detectHDD.LinuxName = strings.Trim(diskinfos[6], \" \")\n\t\t\t\tdddect.detectHDD.SGLibName = strings.Trim(diskinfos[7], \" \")\n\t\t\t\tdddect.detectHDD.Size = strings.Trim(diskinfos[8], \" \")\n\n\t\t\t\tif strings.Index(dddect.detectHDD.LinuxName, `/dev/`) == -1 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\t//hddchanged = true\n\t\t\t\tDetectData.AddValue(ss, dddect)\n\t\t\t\twg.Add(1)\n\t\t\t\tgo dddect.ReadDataFromSmartCtl(&wg)\n\t\t\t}\n\t\t} else {\n\t\t\tif vv, ok := DetectData.Get(ss); ok {\n\t\t\t\tif len(vv.detectHDD.UILabel) == 0 && len(vv.detectHDD.Otherinfo) == 0 {\n\t\t\t\t\twg.Add(1)\n\t\t\t\t\tgo vv.ReadDataFromSmartCtl(&wg)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\ttimer.Stop()\n\tDetectData.RemoveOld(hddinfo)\n\n\ttime.Sleep(4 * time.Second)\n\n\tif hddchanged {\n\t\tfmt.Print(\"changed!\")\n\t\tcclist, err := configxmldata.Conf.GetCardListIndex()\n\t\tif err == nil {\n\t\t\tfor _, i := range cclist {\n\t\t\t\twg.Add(1)\n\t\t\t\tgo SASHDDinfo.RunCardInfo(i, &wg)\n\t\t\t}\n\t\t}\n\t\tfor i := 0; i < 30; i++ {\n\t\t\tif waitTimeout(&wg, 10*time.Second) {\n\t\t\t\tfmt.Println(\"Timed out waiting for wait group\")\n\t\t\t\tMergeCalibration()\n\t\t\t} else {\n\t\t\t\tfmt.Println(\"Wait group finished\")\n\t\t\t\tMergeCalibration()\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t} else {\n\t\twaitTimeout(&wg, 300*time.Second)\n\t}\n\n}", "func GetDisksToBeFormatted(inventory *models.Inventory) []*models.Disk {\n\tformatDisks := make([]*models.Disk, 0, len(inventory.Disks))\n\n\tskipDriveTypes := []string{string(models.DriveTypeFC), string(models.DriveTypeISCSI), string(models.DriveTypeLVM)}\n\tfor _, disk := range inventory.Disks {\n\t\tdiskRemovable := disk.Removable || strings.Contains(disk.ByPath, \"mmcblk\") //mmc devices should be treated as removable\n\n\t\tif disk.Bootable && !diskRemovable && !funk.Contains(skipDriveTypes, string(disk.DriveType)) && !disk.IsInstallationMedia {\n\t\t\tformatDisks = append(formatDisks, disk)\n\t\t}\n\t}\n\n\treturn formatDisks\n}", "func GetVmfsDisks(ctx *pulumi.Context, args *GetVmfsDisksArgs, opts ...pulumi.InvokeOption) (*GetVmfsDisksResult, error) {\n\tvar rv GetVmfsDisksResult\n\terr := ctx.Invoke(\"vsphere:index/getVmfsDisks:getVmfsDisks\", args, &rv, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &rv, nil\n}", "func (base *Base) List(ctx context.Context, path string) ([]string, error) {\n\tctx, done := dcontext.WithTrace(ctx)\n\tdefer done(\"%s.List(%q)\", base.Name(), path)\n\n\tif !storagedriver.PathRegexp.MatchString(path) && path != \"/\" {\n\t\treturn nil, storagedriver.InvalidPathError{Path: path, DriverName: base.StorageDriver.Name()}\n\t}\n\n\tstart := time.Now()\n\tstr, e := base.StorageDriver.List(ctx, path)\n\tstorageAction.WithValues(base.Name(), \"List\").UpdateSince(start)\n\treturn str, base.setDriverName(e)\n}", "func fakeListZonalDisk(cfg *config.Config, name string, zone string, policies []string, callCount int) gcpRequest {\n\tscope := fmt.Sprintf(\"zones/%s\", zone)\n\tdisk := fakeZonalDisk(cfg, name, zone, policies)\n\treturn fakeDiskAggregatedListRequest(cfg, scope, disk, callCount)\n}", "func BuildDisks(vmProperties *mo.VirtualMachine) []Disk {\n\tdisks := make([]Disk, 0)\n\n\tdevices := vmProperties.Config.Hardware.Device\n\tfor _, device := range devices {\n\t\t// is this device a VirtualDisk?\n\t\tif virtualDisk, ok := device.(*types.VirtualDisk); ok {\n\t\t\tvar datastoreMoRef string\n\t\t\tvar datastoreName string\n\t\t\tvar backingFileName string\n\t\t\tvar diskId string\n\n\t\t\tbacking := virtualDisk.Backing.(types.BaseVirtualDeviceFileBackingInfo)\n\t\t\tbackingInfo := backing.GetVirtualDeviceFileBackingInfo()\n\t\t\tif backingInfo.Datastore != nil {\n\t\t\t\tdatastoreMoRef = backingInfo.Datastore.Value\n\t\t\t}\n\t\t\tbackingFileName = backingInfo.FileName\n\t\t\tdatastoreName = getDatastoreNameFromBacking(backingFileName)\n\n\t\t\tif virtualDisk.VDiskId != nil {\n\t\t\t\tdiskId = virtualDisk.VDiskId.Id\n\t\t\t} else {\n\t\t\t\tdiskId = virtualDisk.DiskObjectId\n\t\t\t}\n\n\t\t\tdisk := Disk{\n\t\t\t\tBackingFileName: backingFileName,\n\t\t\t\tCapacity: getDiskCapacityInBytes(virtualDisk),\n\t\t\t\tDatastoreMoRef: datastoreMoRef,\n\t\t\t\tDatastoreName: datastoreName,\n\t\t\t\tID: diskId,\n\t\t\t\tKey: virtualDisk.Key,\n\t\t\t\tName: virtualDisk.DeviceInfo.GetDescription().Label,\n\t\t\t}\n\n\t\t\tdisks = append(disks, disk)\n\t\t\tcontinue\n\t\t}\n\n\t}\n\n\treturn disks\n}", "func (o *VirtualizationIweVirtualMachine) SetDisks(v []VirtualizationVmDisk) {\n\to.Disks = v\n}", "func (client *Client) ListDisks00WithCallback(request *ListDisks00Request, callback func(response *ListDisks00Response, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *ListDisks00Response\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.ListDisks00(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (o LookupServerResultOutput) Disks() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v LookupServerResult) []string { return v.Disks }).(pulumi.StringArrayOutput)\n}", "func (srv *VolumeService) List() ([]api.Volume, error) {\n\treturn srv.provider.ListVolumes()\n}", "func (s *StackEbrc) ListVolumes() ([]abstract.Volume, fail.Error) {\n\tlogrus.Debug(\"ebrc.Client.ListVolumes() called\")\n\tdefer logrus.Debug(\"ebrc.Client.ListVolumes() done\")\n\n\tvar volumes []abstract.Volume\n\n\torg, vdc, err := s.getOrgVdc()\n\tif err != nil {\n\t\treturn volumes, fail.Wrap(err, fmt.Sprintf(\"Error listing volumes\"))\n\t}\n\n\t// Check if network is already there\n\trefs, err := getLinks(org, \"vnd.vmware.vcloud.disk+xml\")\n\tif err != nil {\n\t\treturn nil, fail.Wrap(err, fmt.Sprintf(\"Error recovering network information\"))\n\t}\n\tfor _, ref := range refs {\n\t\t// FIXME: Add data\n\t\tdr, err := vdc.QueryDisk(ref.Name)\n\t\tif err == nil {\n\t\t\tthed, err := vdc.FindDiskByHREF(dr.Disk.HREF)\n\t\t\tif err == nil {\n\t\t\t\tvolumes = append(volumes, abstract.Volume{Name: ref.Name, ID: ref.ID, Size: thed.Disk.Size})\n\t\t\t}\n\t\t}\n\t}\n\n\treturn volumes, nil\n}", "func fakeListRegionalDisk(cfg *config.Config, name string, region string, policies []string, callCount int) gcpRequest {\n\tscope := fmt.Sprintf(\"regions/%s\", region)\n\tdisk := fakeRegionalDisk(cfg, name, region, policies)\n\treturn fakeDiskAggregatedListRequest(cfg, scope, disk, callCount)\n}", "func initStorageDisks(endpoints EndpointList) ([]StorageAPI, error) {\n\t// Bootstrap disks.\n\tstorageDisks := make([]StorageAPI, len(endpoints))\n\tfor index, endpoint := range endpoints {\n\t\t// Intentionally ignore disk not found errors. XL is designed\n\t\t// to handle these errors internally.\n\t\tstorage, err := newStorageAPI(endpoint)\n\t\tif err != nil && err != errDiskNotFound {\n\t\t\treturn nil, err\n\t\t}\n\t\tstorageDisks[index] = storage\n\t}\n\treturn storageDisks, nil\n}", "func (yad *yandexDisk) ListPublicResources(fields []string, limit int, offset int, previewCrop bool, previewSize string, resourceType string) (l *PublicResourcesList, e error) {\n\tvalues := url.Values{}\n\tvalues.Add(\"fields\", strings.Join(fields, \",\"))\n\tvalues.Add(\"limit\", strconv.Itoa(limit))\n\tvalues.Add(\"offset\", strconv.Itoa(offset))\n\tvalues.Add(\"preview_crop\", strconv.FormatBool(previewCrop))\n\tvalues.Add(\"preview_size\", previewSize)\n\tvalues.Add(\"type\", resourceType)\n\n\treq, e := yad.client.request(http.MethodGet, \"/disk/resources/public?\"+values.Encode(), nil)\n\tif e != nil {\n\t\treturn nil, e\n\t}\n\n\tl = new(PublicResourcesList)\n\t_, e = yad.client.getResponse(req, &l)\n\tif e != nil {\n\t\treturn nil, e\n\t}\n\treturn\n}", "func (client VolumesClient) List(ctx context.Context, location string, storageSubSystem string, storagePool string, filter string) (result VolumeListPage, err error) {\n\tresult.fn = client.listNextResults\n\treq, err := client.ListPreparer(ctx, location, storageSubSystem, storagePool, filter)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"fabric.VolumesClient\", \"List\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.ListSender(req)\n\tif err != nil {\n\t\tresult.vl.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"fabric.VolumesClient\", \"List\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult.vl, err = client.ListResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"fabric.VolumesClient\", \"List\", resp, \"Failure responding to request\")\n\t}\n\n\treturn\n}", "func NeuraxDisks() error {\n\tselected_name := gen_haiku()\n\tif runtime.GOOS == \"windows\" {\n\t\tselected_name += \".exe\"\n\t}\n\tdisks, err := cf.Disks()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, d := range disks {\n\t\terr := cf.CopyFile(os.Args[0], d+\"/\"+selected_name)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (zk *dbZk) List(path string) ([]string, error) {\n\tb, _ := zk.ZkCli.Exist(path)\n\tif !b {\n\t\treturn nil, nil\n\t}\n\n\tvar failed bool\n\tstarted := time.Now()\n\n\tchilds, err := zk.ZkCli.GetChildren(path)\n\tif err != nil {\n\t\tfailed = true\n\t}\n\n\tstore.ReportStorageOperatorMetrics(store.StoreOperatorFetch, started, failed)\n\treturn childs, err\n}", "func List(c *golangsdk.ServiceClient, serverId string, opts ListOpts) ([]Nic, error) {\n\tu := listURL(c, serverId)\n\tpages, err := pagination.NewPager(c, u, func(r pagination.PageResult) pagination.Page {\n\t\treturn NicPage{pagination.LinkedPageBase{PageResult: r}}\n\t}).AllPages()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tallNICs, err := ExtractNics(pages)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn FilterNICs(allNICs, opts)\n}", "func List(d Driver) (*volume.ListResponse, error) {\n\tlog.Debugf(\"Entering List\")\n\td.GetLock().Lock()\n\tdefer d.GetLock().Unlock()\n\tvar vols []*volume.Volume\n\tfor name, v := range d.GetVolumes() {\n\t\tlog.Debugf(\"Volume found: %s\", v)\n\t\tm, err := getMount(d, v.GetMount())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tvols = append(vols, &volume.Volume{Name: name, Status: v.GetStatus(), Mountpoint: m.GetPath()})\n\t}\n\treturn &volume.ListResponse{Volumes: vols}, nil\n}", "func (d ImagefsDriver) List() (*volume.ListResponse, error) {\n\tcontainers, err := d.cli.ContainerList(context.Background(), types.ContainerListOptions{\n\t\tAll: true,\n\t\tFilters: filters.NewArgs(filters.Arg(\"label\", \"com.docker.imagefs.version\")),\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unexpected error: %s\", err)\n\t}\n\tresponse := &volume.ListResponse{}\n\tfor i := range containers {\n\t\tresponse.Volumes = append(response.Volumes, &volume.Volume{\n\t\t\t// TODO(rabrams) fall back to id if no names\n\t\t\tName: containers[i].Names[0],\n\t\t})\n\t}\n\treturn response, nil\n}", "func TestEvalDisks(t *testing.T) {\n\tnDisks := 16\n\tdisks, err := getRandomDisks(nDisks)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tobjLayer, _, err := initObjectLayer(mustGetNewEndpointList(disks...))\n\tif err != nil {\n\t\tremoveRoots(disks)\n\t\tt.Fatal(err)\n\t}\n\tdefer removeRoots(disks)\n\txl := objLayer.(*xlObjects)\n\ttestShuffleDisks(t, xl)\n}", "func (o InstanceOutput) Disks() DiskResponseArrayOutput {\n\treturn o.ApplyT(func(v *Instance) DiskResponseArrayOutput { return v.Disks }).(DiskResponseArrayOutput)\n}", "func (d *KrakenStorageDriver) List(ctx context.Context, path string) ([]string, error) {\n\tlog.Debugf(\"(*KrakenStorageDriver).List %s\", path)\n\tpathType, pathSubType, err := ParsePath(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar l []string\n\tswitch pathType {\n\tcase _uploads:\n\t\tl, err = d.uploads.list(path, pathSubType)\n\tcase _manifests:\n\t\tl, err = d.manifests.list(path)\n\tdefault:\n\t\treturn nil, InvalidRequestError{path}\n\t}\n\tif err != nil {\n\t\treturn nil, toDriverError(err, path)\n\t}\n\treturn l, nil\n}", "func bootstrapDisks(disks []string) ([]StorageAPI, error) {\n\tstorageDisks := make([]StorageAPI, len(disks))\n\tfor index, disk := range disks {\n\t\tvar err error\n\t\t// Intentionally ignore disk not found errors while\n\t\t// initializing POSIX, so that we have successfully\n\t\t// initialized posix Storage. Subsequent calls to XL/Erasure\n\t\t// will manage any errors related to disks.\n\t\tstorageDisks[index], err = newStorageLayer(disk)\n\t\tif err != nil && err != errDiskNotFound {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn storageDisks, nil\n}", "func (cl *Client) gceVolumeList(ctx context.Context, vla *csp.VolumeListArgs, volumeType string) ([]*csp.Volume, error) {\n\tcomputeService, err := cl.getComputeService(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfilter := \"\"\n\tif volumeType != \"\" {\n\t\tfilter = fmt.Sprintf(`type=\"%s\"`, volumeType)\n\t}\n\tfor _, tag := range vla.Tags {\n\t\tif filter != \"\" {\n\t\t\tfilter += \" AND \"\n\t\t}\n\t\tkv := strings.SplitN(tag, \":\", 2)\n\t\tif len(kv) == 1 { // if just \"key\" is specified then the existence of a label with that key will be matched\n\t\t\tfilter += fmt.Sprintf(\"labels.%s:*\", kv[0])\n\t\t} else { // if specified here as \"key:value\" then both the key and value will be matched\n\t\t\tfilter += fmt.Sprintf(`labels.%s=\"%s\"`, kv[0], kv[1])\n\t\t}\n\t}\n\treq := computeService.Disks().List(cl.projectID, cl.attrs[AttrZone].Value).Filter(filter)\n\tresult := []*csp.Volume{}\n\tif err = req.Pages(ctx, func(page *compute.DiskList) error {\n\t\tfor _, disk := range page.Items {\n\t\t\tvol := gceDiskToVolume(disk)\n\t\t\tresult = append(result, vol)\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to list GC disks: %w\", err)\n\t}\n\treturn result, nil\n}", "func GuestConfigDisks(endpoint string, guestid string, body GuestConfigDiskList) (int, []byte) {\n\tputReq := buildGuestConfigDiskRequest(body)\n\n\tbuffer := getEndpointwithGuests(endpoint)\n\tbuffer.WriteString(\"/\")\n\tbuffer.WriteString(guestid)\n\tbuffer.WriteString(\"/disks\")\n\n\theaders := buildAuthContext(\"\")\n\tctxt := RequestContext{\n\t\tvalues: headers,\n\t}\n\n\tstatus, data := hq.Put(buffer.String(), putReq, ctxt)\n\n\treturn status, data\n}", "func (s *GCSSnapStore) List() (SnapList, error) {\n\t// recursively list all \"files\", not directory\n\n\tit := s.client.Bucket(s.bucket).Objects(s.ctx, &storage.Query{Prefix: s.prefix})\n\n\tvar attrs []*storage.ObjectAttrs\n\tfor {\n\t\tattr, err := it.Next()\n\t\tif err == iterator.Done {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tattrs = append(attrs, attr)\n\t}\n\n\tvar snapList SnapList\n\tfor _, v := range attrs {\n\t\tname := strings.Replace(v.Name, s.prefix+\"/\", \"\", 1)\n\t\t//name := v.Name[len(s.prefix):]\n\t\tsnap, err := ParseSnapshot(name)\n\t\tif err != nil {\n\t\t\t// Warning\n\t\t\tfmt.Printf(\"Invalid snapshot found. Ignoring it:%s\\n\", name)\n\t\t} else {\n\t\t\tsnapList = append(snapList, snap)\n\t\t}\n\t}\n\n\tsort.Sort(snapList)\n\treturn snapList, nil\n}", "func NewListDisksBadRequest() *ListDisksBadRequest {\n\treturn &ListDisksBadRequest{}\n}", "func (fkw *FakeClientWrapper) List(ctx context.Context, list runtime.Object, opts ...k8sCl.ListOption) error {\n\tif fkw.shouldPatchNS(list) {\n\t\topts = fkw.removeNSFromListOptions(opts)\n\t}\n\treturn fkw.client.List(ctx, list, opts...)\n}", "func (h *httpCloud) List(filter string) ([]string, error) {\n\tvar resp []string\n\tif err := h.get(h.instancesURL+path.Join(InstancesPath, filter), &resp); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn resp, nil\n}", "func (r Virtual_Storage_Repository) GetDiskImages() (resp []datatypes.Virtual_Disk_Image, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Virtual_Storage_Repository\", \"getDiskImages\", nil, &r.Options, &resp)\n\treturn\n}", "func (d *driver) List(ctx context.Context, path string) ([]string, error) {\n\tdefer debugTime()()\n\toutput, err := d.shell.FileList(d.fullPath(path))\n\tif err != nil {\n\t\tif strings.HasPrefix(err.Error(), \"no link named\") {\n\t\t\treturn nil, storagedriver.PathNotFoundError{Path: path}\n\t\t}\n\t\treturn nil, err\n\t}\n\n\tkeys := make([]string, 0, len(output.Links))\n\tfor _, link := range output.Links {\n\t\tkeys = append(keys, _path.Join(path, link.Name))\n\t}\n\n\treturn keys, nil\n}", "func ImageList() error {\n\timagesDir, err := getImagesDir()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdir, err := os.Open(imagesDir)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer dir.Close()\n\n\tnames, err := dir.Readdirnames(0)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, name := range names {\n\t\tif strings.HasSuffix(name, \".qcow2\") {\n\t\t\tfmt.Println(strings.TrimSuffix(name, \".qcow2\"))\n\t\t}\n\t}\n\n\treturn nil\n}", "func (page DiskListPageClient) Values() []azcompute.Disk {\n\tl := []azcompute.Disk{}\n\terr := DeepCopy(&l, page.dlp.Values())\n\tif err != nil {\n\t\tpage.err = fmt.Errorf(\"fail to get disk list, %s\", err) //nolint:staticcheck\n\t}\n\treturn l\n}", "func GetVolumes(mountHost bool, mountSecret bool, instanceName string) []corev1.Volume {\n\tvar hostPathDirectoryTypeForPtr = corev1.HostPathDirectory\n\n\tvolumes := []corev1.Volume{\n\t\t{\n\t\t\tName: \"osd-monitored-logs-local\",\n\t\t\tVolumeSource: corev1.VolumeSource{\n\t\t\t\tConfigMap: &corev1.ConfigMapVolumeSource{\n\t\t\t\t\tLocalObjectReference: corev1.LocalObjectReference{\n\t\t\t\t\t\tName: \"osd-monitored-logs-local\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tName: \"osd-monitored-logs-metadata\",\n\t\t\tVolumeSource: corev1.VolumeSource{\n\t\t\t\tConfigMap: &corev1.ConfigMapVolumeSource{\n\t\t\t\t\tLocalObjectReference: corev1.LocalObjectReference{\n\t\t\t\t\t\tName: \"osd-monitored-logs-metadata\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tName: \"splunk-state\",\n\t\t\tVolumeSource: corev1.VolumeSource{\n\t\t\t\tHostPath: &corev1.HostPathVolumeSource{\n\t\t\t\t\tPath: \"/var/lib/misc\",\n\t\t\t\t\tType: &hostPathDirectoryTypeForPtr,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tif mountHost {\n\t\tvolumes = append(volumes,\n\t\t\tcorev1.Volume{\n\t\t\t\tName: \"host\",\n\t\t\t\tVolumeSource: corev1.VolumeSource{\n\t\t\t\t\tHostPath: &corev1.HostPathVolumeSource{\n\t\t\t\t\t\tPath: \"/\",\n\t\t\t\t\t\tType: &hostPathDirectoryTypeForPtr,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t})\n\t} else {\n\t\t// if we aren't mounting the host dir, we're the hf\n\t\tvar hfName = instanceName + \"-hfconfig\"\n\t\tvolumes = append(volumes,\n\t\t\tcorev1.Volume{\n\t\t\t\tName: hfName,\n\t\t\t\tVolumeSource: corev1.VolumeSource{\n\t\t\t\t\tConfigMap: &corev1.ConfigMapVolumeSource{\n\t\t\t\t\t\tLocalObjectReference: corev1.LocalObjectReference{\n\t\t\t\t\t\t\tName: hfName,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t})\n\t}\n\n\tif mountSecret {\n\t\tvolumes = append(volumes,\n\t\t\tcorev1.Volume{\n\t\t\t\tName: config.SplunkAuthSecretName,\n\t\t\t\tVolumeSource: corev1.VolumeSource{\n\t\t\t\t\tSecret: &corev1.SecretVolumeSource{\n\t\t\t\t\t\tSecretName: config.SplunkAuthSecretName,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t})\n\t} else {\n\t\t// if we aren't mounting the secret, we're fwding to the splunk hf\n\t\tvar internalName = instanceName + \"-internalsplunk\"\n\t\tvolumes = append(volumes,\n\t\t\tcorev1.Volume{\n\t\t\t\tName: internalName,\n\t\t\t\tVolumeSource: corev1.VolumeSource{\n\t\t\t\t\tConfigMap: &corev1.ConfigMapVolumeSource{\n\t\t\t\t\t\tLocalObjectReference: corev1.LocalObjectReference{\n\t\t\t\t\t\t\tName: internalName,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t})\n\t}\n\n\treturn volumes\n}", "func (digitalocean DigitalOcean) ListVolumes() ([]godo.Volume, error) {\n\tclient, err := DigitalOceanClient()\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tvolumes, _, err := client.client.Storage.ListVolumes(client.context, &godo.ListVolumeParams{})\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn volumes, err\n}", "func (d *driverInfo) List() ([]*Volume, error) {\n\tvar volumes []*Volume\n\n\tfor _, vol := range d.volumes {\n\t\tvolumes = append(volumes, vol)\n\t}\n\n\treturn volumes, nil\n}", "func (s stack) ListVolumes(ctx context.Context) ([]*abstract.Volume, fail.Error) {\n\tif valid.IsNil(s) {\n\t\treturn nil, fail.InvalidInstanceError()\n\t}\n\n\treturn nil, fail.NotImplementedError(\"implement me\")\n}", "func ListVolumes(ip string) (string, error) {\n\tlog.Printf(\"Listing volumes.\")\n\treturn ssh.InvokeCommand(ip, dockercli.ListVolumes)\n}", "func (c *restClient) ListVolumes(ctx context.Context, req *netapppb.ListVolumesRequest, opts ...gax.CallOption) *VolumeIterator {\n\tit := &VolumeIterator{}\n\treq = proto.Clone(req).(*netapppb.ListVolumesRequest)\n\tunm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}\n\tit.InternalFetch = func(pageSize int, pageToken string) ([]*netapppb.Volume, string, error) {\n\t\tresp := &netapppb.ListVolumesResponse{}\n\t\tif pageToken != \"\" {\n\t\t\treq.PageToken = pageToken\n\t\t}\n\t\tif pageSize > math.MaxInt32 {\n\t\t\treq.PageSize = math.MaxInt32\n\t\t} else if pageSize != 0 {\n\t\t\treq.PageSize = int32(pageSize)\n\t\t}\n\t\tbaseUrl, err := url.Parse(c.endpoint)\n\t\tif err != nil {\n\t\t\treturn nil, \"\", err\n\t\t}\n\t\tbaseUrl.Path += fmt.Sprintf(\"/v1/%v/volumes\", req.GetParent())\n\n\t\tparams := url.Values{}\n\t\tparams.Add(\"$alt\", \"json;enum-encoding=int\")\n\t\tif req.GetFilter() != \"\" {\n\t\t\tparams.Add(\"filter\", fmt.Sprintf(\"%v\", req.GetFilter()))\n\t\t}\n\t\tif req.GetOrderBy() != \"\" {\n\t\t\tparams.Add(\"orderBy\", fmt.Sprintf(\"%v\", req.GetOrderBy()))\n\t\t}\n\t\tif req.GetPageSize() != 0 {\n\t\t\tparams.Add(\"pageSize\", fmt.Sprintf(\"%v\", req.GetPageSize()))\n\t\t}\n\t\tif req.GetPageToken() != \"\" {\n\t\t\tparams.Add(\"pageToken\", fmt.Sprintf(\"%v\", req.GetPageToken()))\n\t\t}\n\n\t\tbaseUrl.RawQuery = params.Encode()\n\n\t\t// Build HTTP headers from client and context metadata.\n\t\thds := append(c.xGoogHeaders, \"Content-Type\", \"application/json\")\n\t\theaders := gax.BuildHeaders(ctx, hds...)\n\t\te := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {\n\t\t\tif settings.Path != \"\" {\n\t\t\t\tbaseUrl.Path = settings.Path\n\t\t\t}\n\t\t\thttpReq, err := http.NewRequest(\"GET\", baseUrl.String(), nil)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\thttpReq.Header = headers\n\n\t\t\thttpRsp, err := c.httpClient.Do(httpReq)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tdefer httpRsp.Body.Close()\n\n\t\t\tif err = googleapi.CheckResponse(httpRsp); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tbuf, err := io.ReadAll(httpRsp.Body)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif err := unm.Unmarshal(buf, resp); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\treturn nil\n\t\t}, opts...)\n\t\tif e != nil {\n\t\t\treturn nil, \"\", e\n\t\t}\n\t\tit.Response = resp\n\t\treturn resp.GetVolumes(), resp.GetNextPageToken(), nil\n\t}\n\n\tfetch := func(pageSize int, pageToken string) (string, error) {\n\t\titems, nextPageToken, err := it.InternalFetch(pageSize, pageToken)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tit.items = append(it.items, items...)\n\t\treturn nextPageToken, nil\n\t}\n\n\tit.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)\n\tit.pageInfo.MaxSize = int(req.GetPageSize())\n\tit.pageInfo.Token = req.GetPageToken()\n\n\treturn it\n}", "func (g Graph) getDrives(w http.ResponseWriter, r *http.Request, unrestricted bool) {\n\tsanitizedPath := strings.TrimPrefix(r.URL.Path, \"/graph/v1.0/\")\n\t// Parse the request with odata parser\n\todataReq, err := godata.ParseRequest(r.Context(), sanitizedPath, r.URL.Query())\n\tif err != nil {\n\t\tg.logger.Err(err).Interface(\"query\", r.URL.Query()).Msg(\"query error\")\n\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\tg.logger.Debug().\n\t\tInterface(\"query\", r.URL.Query()).\n\t\tBool(\"unrestricted\", unrestricted).\n\t\tMsg(\"Calling getDrives\")\n\tctx := r.Context()\n\n\tfilters, err := generateCs3Filters(odataReq)\n\tif err != nil {\n\t\tg.logger.Err(err).Interface(\"query\", r.URL.Query()).Msg(\"query error\")\n\t\terrorcode.NotSupported.Render(w, r, http.StatusNotImplemented, err.Error())\n\t\treturn\n\t}\n\tres, err := g.ListStorageSpacesWithFilters(ctx, filters, unrestricted)\n\tswitch {\n\tcase err != nil:\n\t\tg.logger.Error().Err(err).Msg(ListStorageSpacesTransportErr)\n\t\terrorcode.GeneralException.Render(w, r, http.StatusInternalServerError, err.Error())\n\t\treturn\n\tcase res.Status.Code != cs3rpc.Code_CODE_OK:\n\t\tif res.Status.Code == cs3rpc.Code_CODE_NOT_FOUND {\n\t\t\t// return an empty list\n\t\t\trender.Status(r, http.StatusOK)\n\t\t\trender.JSON(w, r, &listResponse{})\n\t\t\treturn\n\t\t}\n\t\tg.logger.Error().Err(err).Msg(ListStorageSpacesReturnsErr)\n\t\terrorcode.GeneralException.Render(w, r, http.StatusInternalServerError, res.Status.Message)\n\t\treturn\n\t}\n\n\twdu, err := url.Parse(g.config.Spaces.WebDavBase + g.config.Spaces.WebDavPath)\n\tif err != nil {\n\t\tg.logger.Error().Err(err).Msg(\"error parsing url\")\n\t\terrorcode.GeneralException.Render(w, r, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\tspaces, err := g.formatDrives(ctx, wdu, res.StorageSpaces)\n\tif err != nil {\n\t\tg.logger.Error().Err(err).Msg(\"error encoding response as json\")\n\t\terrorcode.GeneralException.Render(w, r, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\n\tspaces, err = sortSpaces(odataReq, spaces)\n\tif err != nil {\n\t\tg.logger.Error().Err(err).Msg(\"error sorting the spaces list\")\n\t\terrorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, err.Error())\n\t\treturn\n\t}\n\n\trender.Status(r, http.StatusOK)\n\trender.JSON(w, r, &listResponse{Value: spaces})\n}", "func (proxy *remoteDriverProxy) List() ([]*remoteVolumeDesc, error) {\n\tvar req remoteVolumeListReq\n\tvar resp remoteVolumeListResp\n\n\tif err := proxy.client.CallService(remoteVolumeListService, &req, &resp, true); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif resp.Err != \"\" {\n\t\treturn nil, errors.New(resp.Err)\n\t}\n\n\treturn resp.Volumes, nil\n}", "func (b BladeStorage) GetAllByDisksID(offset string, limit string, serials []string) (count int, blades []model.Blade, err error) {\n\tif offset != \"\" && limit != \"\" {\n\t\tif err = b.db.Limit(limit).Offset(offset).Joins(\"INNER JOIN disk ON disk.blade_serial = blade.serial\").Where(\"disk.serial in (?)\", serials).Find(&blades).Error; err != nil {\n\t\t\treturn count, blades, err\n\t\t}\n\t\tb.db.Model(&model.Blade{}).Joins(\"INNER JOIN disk ON disk.blade_serial = blade.serial\").Where(\"disk.serial in (?)\", serials).Count(&count)\n\t} else {\n\t\tif err = b.db.Joins(\"INNER JOIN disk ON disk.blade_serial = blade.serial\").Where(\"disk.serial in (?)\", serials).Find(&blades).Error; err != nil {\n\t\t\treturn count, blades, err\n\t\t}\n\t}\n\treturn count, blades, err\n}", "func NewCmdDiskList() *cobra.Command {\n\treq := base.BizClient.NewDescribeUDiskRequest()\n\ttypeMap := map[string]string{\n\t\t\"DataDisk\": \"Oridinary-Data-Disk\",\n\t\t\"SystemDisk\": \"Oridinary-System-Disk\",\n\t\t\"SSDDataDisk\": \"SSD-Data-Disk\",\n\t}\n\tarkModeMap := map[string]string{\n\t\t\"Yes\": \"true\",\n\t\t\"No\": \"false\",\n\t}\n\tcmd := &cobra.Command{\n\t\tUse: \"list\",\n\t\tShort: \"List udisk instance\",\n\t\tLong: \"List udisk instance\",\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\tfor key, val := range typeMap {\n\t\t\t\tif *req.DiskType == val {\n\t\t\t\t\t*req.DiskType = key\n\t\t\t\t}\n\t\t\t}\n\t\t\tresp, err := base.BizClient.DescribeUDisk(req)\n\t\t\tif err != nil {\n\t\t\t\tbase.HandleError(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlist := []DiskRow{}\n\t\t\tfor _, disk := range resp.DataSet {\n\t\t\t\trow := DiskRow{\n\t\t\t\t\tResourceID: disk.UDiskId,\n\t\t\t\t\tName: disk.Name,\n\t\t\t\t\tGroup: disk.Tag,\n\t\t\t\t\tSize: fmt.Sprintf(\"%dGB\", disk.Size),\n\t\t\t\t\tType: typeMap[disk.DiskType],\n\t\t\t\t\tEnableDataArk: arkModeMap[disk.UDataArkMode],\n\t\t\t\t\tMountUHost: fmt.Sprintf(\"%s/%s\", disk.UHostName, disk.UHostIP),\n\t\t\t\t\tMountPoint: disk.DeviceName,\n\t\t\t\t\tState: disk.Status,\n\t\t\t\t\tCreationTime: base.FormatDate(disk.CreateTime),\n\t\t\t\t\tExpirationTime: base.FormatDate(disk.ExpiredTime),\n\t\t\t\t}\n\t\t\t\tif disk.UHostIP == \"\" {\n\t\t\t\t\trow.MountUHost = \"\"\n\t\t\t\t}\n\t\t\t\tlist = append(list, row)\n\t\t\t}\n\t\t\tif global.json {\n\t\t\t\tbase.PrintJSON(list)\n\t\t\t} else {\n\t\t\t\tbase.PrintTableS(list)\n\t\t\t}\n\t\t},\n\t}\n\tflags := cmd.Flags()\n\tflags.SortFlags = false\n\treq.ProjectId = flags.String(\"project-id\", base.ConfigInstance.ProjectID, \"Optional. Assign project-id\")\n\treq.Region = flags.String(\"region\", base.ConfigInstance.Region, \"Optional. Assign region\")\n\treq.Zone = flags.String(\"zone\", base.ConfigInstance.Zone, \"Optional. Assign availability zone\")\n\treq.UDiskId = flags.String(\"resource-id\", \"\", \"Optional. Resource ID of the udisk to search\")\n\treq.DiskType = flags.String(\"udisk-type\", \"\", \"Optional. Optional. Type of the udisk to search. 'Oridinary-Data-Disk','Oridinary-System-Disk' or 'SSD-Data-Disk'\")\n\treq.Offset = cmd.Flags().Int(\"offset\", 0, \"Optional. Offset\")\n\treq.Limit = cmd.Flags().Int(\"limit\", 50, \"Optional. Limit\")\n\tflags.SetFlagValues(\"udisk-type\", \"Oridinary-Data-Disk\", \"Oridinary-System-Disk\", \"SSD-Data-Disk\")\n\treturn cmd\n}", "func (ld *LocalDeviceImplement) ListDevicesDetail(device string) ([]*types.LocalDisk, error) {\n\targs := []string{\"--pairs\", \"--paths\", \"--bytes\", \"--all\", \"--output\", \"NAME,FSTYPE,MOUNTPOINT,SIZE,STATE,TYPE,ROTA,RO,PKNAME\"}\n\tif device != \"\" {\n\t\targs = append(args, device)\n\t}\n\tdevices, err := ld.Executor.ExecuteCommandWithOutput(\"lsblk\", args...)\n\tif err != nil {\n\t\tlog.Error(\"exec lsblk failed\" + err.Error())\n\t\treturn nil, err\n\t}\n\n\treturn parseDiskString(devices), nil\n}", "func (client StorageGatewayClient) ListFileSystems(ctx context.Context, request ListFileSystemsRequest) (response ListFileSystemsResponse, 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.listFileSystems, 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 = ListFileSystemsResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId}\n\t\t\t} else {\n\t\t\t\tresponse = ListFileSystemsResponse{}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\tif convertedResponse, ok := ociResponse.(ListFileSystemsResponse); ok {\n\t\tresponse = convertedResponse\n\t} else {\n\t\terr = fmt.Errorf(\"failed to convert OCIResponse into ListFileSystemsResponse\")\n\t}\n\treturn\n}", "func (f *FakeImagesClient) List(ctx context.Context, listOpts *images.ListRequest, opts ...grpc.CallOption) (*images.ListResponse, error) {\n\tf.Lock()\n\tdefer f.Unlock()\n\tf.appendCalled(\"list\", listOpts)\n\tif err := f.getError(\"list\"); err != nil {\n\t\treturn nil, err\n\t}\n\tresp := &images.ListResponse{}\n\tfor _, image := range f.ImageList {\n\t\tresp.Images = append(resp.Images, image)\n\t}\n\treturn resp, nil\n}", "func (s *InMemoryState) GetListOfVolumes(ctx context.Context) ([]DotmeshVolume, error) {\n\tresult := []DotmeshVolume{}\n\n\tfilesystems := s.registry.FilesystemIdsIncludingClones()\n\n\tfor _, fs := range filesystems {\n\t\tone, err := s.getOne(ctx, fs)\n\t\t// Just skip this in the result list if the context (eg authenticated\n\t\t// user) doesn't have permission to read it.\n\t\tif err != nil {\n\t\t\tswitch err := err.(type) {\n\t\t\tcase PermissionDenied:\n\t\t\t\tcontinue\n\t\t\tdefault:\n\t\t\t\tlog.Errorf(\"[GetListOfVolumes] err: %v\", err)\n\t\t\t\t// If we got an error looking something up, it might just be\n\t\t\t\t// because the fsMachine list or the registry is temporarily\n\t\t\t\t// inconsistent wrt the mastersCache. Proceed, at the risk of\n\t\t\t\t// lying slightly...\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tresult = append(result, one)\n\t}\n\n\treturn result, nil\n}", "func (driver *Driver) ListVolumes(ctx context.Context, req *csi.ListVolumesRequest) (*csi.ListVolumesResponse, error) {\n\tklog.V(4).Infof(\"ListVolumes: called with args %#v\", req)\n\treturn nil, status.Error(codes.Unimplemented, \"\")\n}", "func (s *S3Storage) List(prefix string, maxSize int) ([]string, error) {\n\tprefix = s.addPrefix(prefix)\n\tpathSeparator := \"\"\n\tmarker := \"\"\n\n\titems := make([]string, 0, 1000)\n\tfor maxSize > 0 {\n\t\t// Don't ask for more than 1000 keys at a time. This makes\n\t\t// testing simpler because S3 will return at most 1000 keys even if you\n\t\t// ask for more, but s3test will return more than 1000 keys if you ask\n\t\t// for more. TODO(agf): Fix this behavior in s3test.\n\t\tmaxReqSize := 1000\n\t\tif maxSize < 1000 {\n\t\t\tmaxReqSize = maxSize\n\t\t}\n\t\tcontents, err := s.bucket.List(prefix, pathSeparator, marker, maxReqSize)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tmaxSize -= maxReqSize\n\n\t\tfor _, key := range contents.Contents {\n\t\t\titems = append(items, s.removePrefix(key.Key))\n\t\t}\n\t\tif contents.IsTruncated {\n\t\t\tmarker = s.addPrefix(items[len(items)-1])\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn items, nil\n}", "func (client *Client) ListDisks00WithChan(request *ListDisks00Request) (<-chan *ListDisks00Response, <-chan error) {\n\tresponseChan := make(chan *ListDisks00Response, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.ListDisks00(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "func (h Hostingv4) ListImagesInRegion(region hosting.Region) ([]hosting.DiskImage, error) {\n\tif region.ID == \"\" {\n\t\treturn []hosting.DiskImage{}, errors.New(\"hosting.Region provided does not have an ID\")\n\t}\n\n\tregionid, err := strconv.Atoi(region.ID)\n\tif err != nil {\n\t\treturn nil,\n\t\t\tfmt.Errorf(\"Error parsing RegionID '%s' from hosting.Region %v\", region.ID, region)\n\t}\n\tfilter := map[string]interface{}{\"datacenter_id\": regionid}\n\n\tresponse := []diskImagev4{}\n\trequest := []interface{}{filter}\n\terr = h.Send(\"hosting.image.list\", request, &response)\n\tif err != nil {\n\t\treturn []hosting.DiskImage{}, err\n\t}\n\n\tif len(response) < 1 {\n\t\treturn []hosting.DiskImage{}, errors.New(\"No images\")\n\t}\n\tvar diskimages []hosting.DiskImage\n\tfor _, image := range response {\n\t\tdiskimages = append(diskimages, fromDiskImagev4(image))\n\t}\n\n\treturn diskimages, nil\n}", "func (c *Core) ListVolumes(labels map[string]string) ([]*types.Volume, error) {\n\tvar retVolumes = make([]*types.Volume, 0)\n\n\t// list local meta store.\n\tmetaList, err := c.store.List()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// scan all drivers.\n\tlogrus.Debugf(\"probing all drivers for listing volume\")\n\tdrivers, err := driver.GetAll()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tctx := driver.Contexts()\n\n\tvar realVolumes = map[string]*types.Volume{}\n\tvar volumeDrivers = map[string]driver.Driver{}\n\n\tfor _, dv := range drivers {\n\t\tvolumeDrivers[dv.Name(ctx)] = dv\n\n\t\td, ok := dv.(driver.Lister)\n\t\tif !ok {\n\t\t\t// not Lister, ignore it.\n\t\t\tcontinue\n\t\t}\n\t\tvList, err := d.List(ctx)\n\t\tif err != nil {\n\t\t\tlogrus.Warnf(\"volume driver %s list error: %v\", dv.Name(ctx), err)\n\t\t\tcontinue\n\t\t}\n\n\t\tfor _, v := range vList {\n\t\t\trealVolumes[v.Name] = v\n\t\t}\n\t}\n\n\tfor name, obj := range metaList {\n\t\tv, ok := obj.(*types.Volume)\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\n\t\td, ok := volumeDrivers[v.Spec.Backend]\n\t\tif !ok {\n\t\t\t// driver not exist, ignore it\n\t\t\tcontinue\n\t\t}\n\n\t\t// the local driver and tmpfs driver\n\t\tif d.StoreMode(ctx).IsLocal() {\n\t\t\tretVolumes = append(retVolumes, v)\n\t\t\tcontinue\n\t\t}\n\n\t\trv, ok := realVolumes[name]\n\t\tif !ok {\n\t\t\t// real volume not exist, ignore it\n\t\t\tcontinue\n\t\t}\n\t\tv.Status.MountPoint = rv.Status.MountPoint\n\n\t\tdelete(realVolumes, name)\n\n\t\tretVolumes = append(retVolumes, v)\n\t}\n\n\tfor _, v := range realVolumes {\n\t\t// found new volumes, store the meta\n\t\tlogrus.Warningf(\"found new volume %s\", v.Name)\n\t\tc.store.Put(v)\n\n\t\tretVolumes = append(retVolumes, v)\n\n\t}\n\n\treturn retVolumes, nil\n}", "func GuestCreateDisks(endpoint string, guestid string, body GuestCreateDiskList) (int, []byte) {\n\n\tcreateReq, _ := json.Marshal(body)\n\n\tbuffer := getEndpointwithGuests(endpoint)\n\tbuffer.WriteString(\"/\")\n\tbuffer.WriteString(guestid)\n\tbuffer.WriteString(\"/disks\")\n\n\tstatus, data := hq.Post(buffer.String(), createReq)\n\n\treturn status, data\n}", "func (o SourceInstancePropertiesResponseOutput) Disks() SavedAttachedDiskResponseArrayOutput {\n\treturn o.ApplyT(func(v SourceInstancePropertiesResponse) []SavedAttachedDiskResponse { return v.Disks }).(SavedAttachedDiskResponseArrayOutput)\n}", "func (h StorageClassHandler) List(ctx *gin.Context) {\n\tstatus := h.Prepare(ctx)\n\tif status != http.StatusOK {\n\t\tctx.Status(status)\n\t\treturn\n\t}\n\tdb := h.Reconciler.DB()\n\tlist := []model.StorageClass{}\n\terr := db.List(\n\t\t&list,\n\t\tlibmodel.ListOptions{\n\t\t\tPage: &h.Page,\n\t\t})\n\tif err != nil {\n\t\tLog.Trace(err)\n\t\tctx.Status(http.StatusInternalServerError)\n\t\treturn\n\t}\n\tcontent := []interface{}{}\n\tfor _, m := range list {\n\t\tr := &StorageClass{}\n\t\tr.With(&m)\n\t\tr.SelfLink = h.Link(h.Provider, &m)\n\t\tcontent = append(content, r.Content(h.Detail))\n\t}\n\n\tctx.JSON(http.StatusOK, content)\n}", "func ListPartitions(dev string) ([]Partition, error) {\n\tcmd := exec.Command(\"parted\", \"-m\", dev, \"unit\", \"B\", \"print\", \"free\")\n\n\tout, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"list paritions in %s: %s\", dev, utils.OneLine(out))\n\t}\n\n\tvar parts []Partition\n\n\tfor _, l := range strings.Split(string(out), \"\\n\") {\n\t\tif len(l) == 0 {\n\t\t\tbreak\n\t\t}\n\n\t\tif l[1] != ':' {\n\t\t\tcontinue\n\t\t}\n\n\t\tt := strings.Split(l[:len(l)-1], \":\")\n\t\tif len(t) < 5 {\n\t\t\treturn nil, fmt.Errorf(\"list partitions in %s: invalid output from parted\", dev)\n\t\t}\n\n\t\tvar p Partition\n\n\t\tif v, err := strconv.Atoi(t[0]); err == nil {\n\t\t\tp.Number = v\n\t\t}\n\t\tif v, err := strconv.ParseInt(t[1][:len(t[1])-1], 10, 64); err == nil {\n\t\t\tp.Start = uint64(v)\n\t\t}\n\t\tif v, err := strconv.ParseInt(t[2][:len(t[2])-1], 10, 64); err == nil {\n\t\t\tp.End = uint64(v)\n\t\t}\n\t\tif v, err := strconv.ParseInt(t[3][:len(t[3])-1], 10, 64); err == nil {\n\t\t\tp.Size = uint64(v)\n\t\t}\n\n\t\tp.Filesystem = t[4]\n\n\t\tif p.Filesystem == \"free\" {\n\t\t\tp.Number = 0\n\t\t}\n\n\t\tparts = append(parts, p)\n\t}\n\n\treturn parts, nil\n}", "func (d *driver) List(ctx context.Context, opath string) ([]string, error) {\n\tpath := opath\n\tif path != \"/\" && opath[len(path)-1] != '/' {\n\t\tpath = path + \"/\"\n\t}\n\n\t// This is to cover for the cases when the rootDirectory of the driver is either \"\" or \"/\".\n\t// In those cases, there is no root prefix to replace and we must actually add a \"/\" to all\n\t// results in order to keep them as valid paths as recognized by storagedriver.PathRegexp\n\tprefix := \"\"\n\tif d.obsPath(\"\") == \"\" {\n\t\tprefix = \"/\"\n\t}\n\n\toutput, err := d.Client.ListObjects(&obs.ListObjectsInput{\n\t\tListObjsInput: obs.ListObjsInput{\n\t\t\tPrefix: d.obsPath(path),\n\t\t\tMaxKeys: listMax,\n\t\t\tDelimiter: \"/\",\n\t\t},\n\t\tBucket: d.Bucket,\n\t})\n\tif err != nil {\n\t\treturn nil, parseError(opath, err)\n\t}\n\n\tfiles := []string{}\n\tdirectories := []string{}\n\n\tfor {\n\t\tfor _, key := range output.Contents {\n\t\t\tfiles = append(files, strings.Replace(key.Key, d.obsPath(\"\"), prefix, 1))\n\t\t}\n\n\t\tfor _, commonPrefix := range output.CommonPrefixes {\n// commonPrefix := commonPrefix>Prefix\n\t\t\tdirectories = append(directories, strings.Replace(commonPrefix[0:len(commonPrefix)-1], d.obsPath(\"\"), prefix, 1))\n\t\t}\n\n\t\tif output.IsTruncated {\n\t\t\toutput, err = d.Client.ListObjects(&obs.ListObjectsInput{\n\t\t\t\tListObjsInput: obs.ListObjsInput{\n\t\t\t\t\tPrefix: d.obsPath(path),\n\t\t\t\t\tDelimiter: \"/\",\n\t\t\t\t\tMaxKeys: listMax,\n\t\t\t\t},\n\t\t\t\tBucket: d.Bucket,\n\t\t\t\tMarker: output.NextMarker,\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif opath != \"/\" {\n\t\tif len(files) == 0 && len(directories) == 0 {\n\t\t\t// Treat empty output as missing directory, since we don't actually\n\t\t\t// have directories in obs.\n\t\t\treturn nil, storagedriver.PathNotFoundError{Path: opath}\n\t\t}\n\t}\n\treturn append(files, directories...), nil\n}", "func (c *BlockVolumeClient) List(params *BlockVolumeParams) (*BlockVolumeList, error) {\n\tlist := &BlockVolumeList{}\n\n\terr := c.Backend.CallIntoInterface(\"v1/Storage/Block/Volume/list\", params, list)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn list, nil\n}", "func (s *LocalSnapStore) List() (brtypes.SnapList, error) {\n\tprefixTokens := strings.Split(s.prefix, \"/\")\n\t// Last element of the tokens is backup version\n\t// Consider the parent of the backup version level (Required for Backward Compatibility)\n\tprefix := path.Join(strings.Join(prefixTokens[:len(prefixTokens)-1], \"/\"))\n\n\tsnapList := brtypes.SnapList{}\n\terr := filepath.Walk(prefix, func(path string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"prevent panic by handling failure accessing a path %q: %v\\n\", path, err)\n\t\t\treturn err\n\t\t}\n\t\tif info.IsDir() {\n\t\t\treturn nil\n\t\t}\n\t\tif strings.Contains(path, backupVersionV1) || strings.Contains(path, backupVersionV2) {\n\t\t\tsnap, err := ParseSnapshot(path)\n\t\t\tif err != nil {\n\t\t\t\t// Warning\n\t\t\t\tlogrus.Warnf(\"Invalid snapshot found. Ignoring it:%s\\n\", path)\n\t\t\t} else {\n\t\t\t\tsnapList = append(snapList, snap)\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error walking the path %q: %v\", prefix, err)\n\t}\n\n\tsort.Sort(snapList)\n\treturn snapList, nil\n}", "func (fs *Ipfs) List(path string) ([]*oss.Object, error) {\n\tdir := ipath.New(path)\n\tentries, err := fs.coreAPI.Unixfs().Ls(context.Background(), dir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdl := make([]*oss.Object, 0)\n\tnow := time.Now()\nloop:\n\tfor {\n\t\tselect {\n\t\tcase entry, ok := <-entries:\n\t\t\tif !ok {\n\t\t\t\tbreak loop\n\t\t\t}\n\n\t\t\tvar n string\n\t\t\tp := entry.Cid.String()\n\t\t\tif strings.HasPrefix(p, \"/ipfs/\") {\n\t\t\t\tn = strings.Split(p, \"/\")[2]\n\t\t\t} else {\n\t\t\t\tn = p\n\t\t\t\tp = \"/ipfs/\" + p\n\t\t\t}\n\n\t\t\tdl = append(dl, &oss.Object{\n\t\t\t\tPath: p,\n\t\t\t\tName: n,\n\t\t\t\tLastModified: &now,\n\t\t\t\tStorageInterface: fs,\n\t\t\t})\n\t\t}\n\t}\n\n\treturn dl, nil\n}", "func (cs *controller) ListVolumes(\n\tctx context.Context,\n\treq *csi.ListVolumesRequest,\n) (*csi.ListVolumesResponse, error) {\n\n\treturn nil, status.Error(codes.Unimplemented, \"\")\n}", "func (s Storage) List(path string) ([]string, error) {\n\tdir, err := s.fullPath(path)\n\tif err != nil {\n\t\treturn []string{}, err\n\t}\n\n\td, err := os.Open(dir)\n\tif err != nil {\n\t\treturn []string{}, err\n\t}\n\tdefer d.Close()\n\n\treturn d.Readdirnames(-1)\n}", "func DiskPartitions(all bool) ([]DiskPartitionStat, error) {\n\n\tfilename := \"/etc/mtab\"\n\tlines, err := readLines(filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tret := make([]DiskPartitionStat, 0, len(lines))\n\n\tfor _, line := range lines {\n\t\tfields := strings.Fields(line)\n\t\td := DiskPartitionStat{\n\t\t\tMountpoint: fields[1],\n\t\t\tFstype: fields[2],\n\t\t\tOpts: fields[3],\n\t\t}\n\t\tret = append(ret, d)\n\t}\n\n\treturn ret, nil\n}", "func (d *MinioDriver) List(r volume.Request) volume.Response {\n\td.m.Lock()\n\tdefer d.m.Unlock()\n\n\tvar vols []*volume.Volume\n\tfor name, v := range d.volumes {\n\t\tvols = append(vols,\n\t\t\t&volume.Volume{\n\t\t\t\tName: name,\n\t\t\t\tMountpoint: v.mountpoint,\n\t\t\t})\n\t}\n\treturn volumeResp(\"\", \"\", vols, capability, \"\")\n}", "func (d *VolumeDriver) List(r volume.Request) volume.Response {\n\tlog.Errorf(\"VolumeDriver List to be implemented\")\n\treturn volume.Response{Err: \"\"}\n}", "func (_m *Client) GetDisks(ctx context.Context, rgname string, logger log.Logger) ([]compute.Disk, error) {\n\tret := _m.Called(ctx, rgname, logger)\n\n\tvar r0 []compute.Disk\n\tif rf, ok := ret.Get(0).(func(context.Context, string, log.Logger) []compute.Disk); ok {\n\t\tr0 = rf(ctx, rgname, logger)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).([]compute.Disk)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(context.Context, string, log.Logger) error); ok {\n\t\tr1 = rf(ctx, rgname, logger)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "func List(client *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager {\n\turl := baseURL(client)\n\n\tif opts != nil {\n\t\tquery, err := opts.ToBackupListQuery()\n\t\tif err != nil {\n\t\t\treturn pagination.Pager{Err: err}\n\t\t}\n\t\turl += query\n\t}\n\n\tpageFn := func(r pagination.PageResult) pagination.Page {\n\t\treturn BackupPage{pagination.SinglePageBase(r)}\n\t}\n\n\treturn pagination.NewPager(client, url, pageFn)\n}", "func ListVmWithEphemeralDisk(localPath string) ([]*v1.VirtualMachineInstance, error) {\n\tvar keys []*v1.VirtualMachineInstance\n\n\texists, err := FileExists(localPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif exists == false {\n\t\treturn nil, nil\n\t}\n\n\terr = filepath.Walk(localPath, 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() == false {\n\t\t\treturn nil\n\t\t}\n\n\t\trelativePath := strings.TrimPrefix(path, localPath+\"/\")\n\t\tif relativePath == \"\" {\n\t\t\treturn nil\n\t\t}\n\t\tdirs := strings.Split(relativePath, \"/\")\n\t\tif len(dirs) != 2 {\n\t\t\treturn nil\n\t\t}\n\n\t\tnamespace := dirs[0]\n\t\tdomain := dirs[1]\n\t\tif namespace == \"\" || domain == \"\" {\n\t\t\treturn nil\n\t\t}\n\t\tkeys = append(keys, v1.NewVMIReferenceFromNameWithNS(dirs[0], dirs[1]))\n\t\treturn nil\n\t})\n\n\treturn keys, err\n}", "func (o LookupInstanceResultOutput) Disks() AttachedDiskResponseArrayOutput {\n\treturn o.ApplyT(func(v LookupInstanceResult) []AttachedDiskResponse { return v.Disks }).(AttachedDiskResponseArrayOutput)\n}", "func (d *Driver) ListVolumes(ctx context.Context, req *csi.ListVolumesRequest) (*csi.ListVolumesResponse, error) {\n\treturn nil, status.Error(codes.Unimplemented, \"\")\n}", "func (d *Driver) ListVolumes(ctx context.Context, req *csi.ListVolumesRequest) (*csi.ListVolumesResponse, error) {\n\treturn nil, status.Error(codes.Unimplemented, \"\")\n}", "func (o *ClusterUninstaller) listImages() (cloudResources, error) {\n\to.Logger.Debugf(\"Listing images\")\n\n\tif o.imageClient == nil {\n\t\to.Logger.Infof(\"Skipping deleting images because no service instance was found\")\n\t\tresult := []cloudResource{}\n\t\treturn cloudResources{}.insert(result...), nil\n\t}\n\n\tctx, cancel := o.contextWithTimeout()\n\tdefer cancel()\n\n\tselect {\n\tcase <-ctx.Done():\n\t\to.Logger.Debugf(\"listImages: case <-ctx.Done()\")\n\t\treturn nil, o.Context.Err() // we're cancelled, abort\n\tdefault:\n\t}\n\n\timages, err := o.imageClient.GetAll()\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to list images\")\n\t}\n\n\tvar foundOne = false\n\n\tresult := []cloudResource{}\n\tfor _, image := range images.Images {\n\t\tif strings.Contains(*image.Name, o.InfraID) {\n\t\t\tfoundOne = true\n\t\t\to.Logger.Debugf(\"listImages: FOUND: %s, %s, %s\", *image.ImageID, *image.Name, *image.State)\n\t\t\tresult = append(result, cloudResource{\n\t\t\t\tkey: *image.ImageID,\n\t\t\t\tname: *image.Name,\n\t\t\t\tstatus: *image.State,\n\t\t\t\ttypeName: imageTypeName,\n\t\t\t\tid: *image.ImageID,\n\t\t\t})\n\t\t}\n\t}\n\tif !foundOne {\n\t\to.Logger.Debugf(\"listImages: NO matching image against: %s\", o.InfraID)\n\t\tfor _, image := range images.Images {\n\t\t\to.Logger.Debugf(\"listImages: image: %s\", *image.Name)\n\t\t}\n\t}\n\n\treturn cloudResources{}.insert(result...), nil\n}", "func adjustInstanceFromTemplateDisks(d *schema.ResourceData, config *transport_tpg.Config, it *compute.InstanceTemplate, zone *compute.Zone, project string, isFromRegionalTemplate bool) ([]*compute.AttachedDisk, error) {\n\tdisks := []*compute.AttachedDisk{}\n\tif _, hasBootDisk := d.GetOk(\"boot_disk\"); hasBootDisk {\n\t\tbootDisk, err := expandBootDisk(d, config, project)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdisks = append(disks, bootDisk)\n\t} else {\n\t\t// boot disk was not overridden, so use the one from the instance template\n\t\tfor _, disk := range it.Properties.Disks {\n\t\t\tif disk.Boot {\n\t\t\t\tif disk.Source != \"\" && !isFromRegionalTemplate {\n\t\t\t\t\t// Instances need a URL for the disk, but instance templates only have the name\n\t\t\t\t\tdisk.Source = fmt.Sprintf(\"projects/%s/zones/%s/disks/%s\", project, zone.Name, disk.Source)\n\t\t\t\t}\n\t\t\t\tif disk.InitializeParams != nil {\n\t\t\t\t\tif dt := disk.InitializeParams.DiskType; dt != \"\" {\n\t\t\t\t\t\t// Instances need a URL for the disk type, but instance templates\n\t\t\t\t\t\t// only have the name (since they're global).\n\t\t\t\t\t\tdisk.InitializeParams.DiskType = fmt.Sprintf(\"zones/%s/diskTypes/%s\", zone.Name, dt)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tdisks = append(disks, disk)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\tif _, hasScratchDisk := d.GetOk(\"scratch_disk\"); hasScratchDisk {\n\t\tscratchDisks, err := expandScratchDisks(d, config, project)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdisks = append(disks, scratchDisks...)\n\t} else {\n\t\t// scratch disks were not overridden, so use the ones from the instance template\n\t\tfor _, disk := range it.Properties.Disks {\n\t\t\tif disk.Type == \"SCRATCH\" {\n\t\t\t\tif disk.InitializeParams != nil {\n\t\t\t\t\tif dt := disk.InitializeParams.DiskType; dt != \"\" {\n\t\t\t\t\t\t// Instances need a URL for the disk type, but instance templates\n\t\t\t\t\t\t// only have the name (since they're global).\n\t\t\t\t\t\tdisk.InitializeParams.DiskType = fmt.Sprintf(\"zones/%s/diskTypes/%s\", zone.Name, dt)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tdisks = append(disks, disk)\n\t\t\t}\n\t\t}\n\t}\n\n\tattachedDisksCount := d.Get(\"attached_disk.#\").(int)\n\tif attachedDisksCount > 0 {\n\t\tfor i := 0; i < attachedDisksCount; i++ {\n\t\t\tdiskConfig := d.Get(fmt.Sprintf(\"attached_disk.%d\", i)).(map[string]interface{})\n\t\t\tdisk, err := expandAttachedDisk(diskConfig, d, config)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tdisks = append(disks, disk)\n\t\t}\n\t} else {\n\t\t// attached disks were not overridden, so use the ones from the instance template\n\t\tfor _, disk := range it.Properties.Disks {\n\t\t\tif !disk.Boot && disk.Type != \"SCRATCH\" {\n\t\t\t\tif s := disk.Source; s != \"\" && !isFromRegionalTemplate {\n\t\t\t\t\t// Instances need a URL for the disk source, but instance templates\n\t\t\t\t\t// only have the name (since they're global).\n\t\t\t\t\tdisk.Source = fmt.Sprintf(\"zones/%s/disks/%s\", zone.Name, s)\n\t\t\t\t}\n\t\t\t\tif disk.InitializeParams != nil {\n\t\t\t\t\tif dt := disk.InitializeParams.DiskType; dt != \"\" {\n\t\t\t\t\t\t// Instances need a URL for the disk type, but instance templates\n\t\t\t\t\t\t// only have the name (since they're global).\n\t\t\t\t\t\tdisk.InitializeParams.DiskType = fmt.Sprintf(\"zones/%s/diskTypes/%s\", zone.Name, dt)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tdisks = append(disks, disk)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn disks, nil\n}", "func (r *regulator) List(ctx context.Context, path string) ([]string, error) {\n\tr.enter()\n\tdefer r.exit()\n\n\treturn r.StorageDriver.List(ctx, path)\n}", "func (client *Client) listMonitoredVolumes() ([]api.Volume, error) {\n\tvar vols []api.Volume\n\tm := metadata.NewVolume(providers.FromClient(client))\n\terr := m.Browse(func(vol *api.Volume) error {\n\t\tvols = append(vols, *vol)\n\t\treturn nil\n\t})\n\tif len(vols) == 0 && err != nil {\n\t\treturn nil, fmt.Errorf(\"Error listing volumes : %s\", ProviderErrorToString(err))\n\t}\n\treturn vols, nil\n}", "func (d *DiskStore) list() ([]string, error) {\n\terr := d.initOnce()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn speedwalk.AllFiles(d.blobDir, true)\n}", "func (c *MockAzureCloud) Disk() azure.DisksClient {\n\treturn c.DisksClient\n}", "func ListNics(bridge *netlink.Bridge, physical bool) ([]netlink.Link, error) {\n\tlinks, err := netlink.LinkList()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfiltered := links[:0]\n\n\tfor _, link := range links {\n\t\tif link.Attrs().MasterIndex != bridge.Index {\n\t\t\tcontinue\n\t\t}\n\t\tif physical && link.Type() != \"device\" {\n\t\t\tcontinue\n\t\t}\n\t\tfiltered = append(filtered, link)\n\t}\n\n\treturn filtered, nil\n}", "func DiskPartitions(all bool) ([]DiskPartitionStat, error) {\n\n\tfilename := \"/etc/mtab\"\n\tlines, err := common.ReadLines(filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tret := make([]DiskPartitionStat, 0, len(lines))\n\n\tfor _, line := range lines {\n\t\tfields := strings.Fields(line)\n\t\td := DiskPartitionStat{\n\t\t\tDevice: fields[0],\n\t\t\tMountpoint: fields[1],\n\t\t\tFstype: fields[2],\n\t\t\tOpts: fields[3],\n\t\t}\n\t\tret = append(ret, d)\n\t}\n\n\treturn ret, nil\n}", "func (d *driver) List(ctx context.Context, path string) ([]string, error) {\n\tif path != delimiter && path[len(path)-1] != delimiter[0] {\n\t\tpath = path + delimiter\n\t}\n\n\titemLists, dirLists, _, err := d.Bucket.List(ctx, path, delimiter, \"\", listLimit)\n\tif err != nil && err != io.EOF {\n\t\treturn nil, err\n\t}\n\n\tfiles := make([]string, 0, len(itemLists) + len(dirLists))\n\tfor _, value := range itemLists{\n\t\tfiles = append(files, value.Key)\n\t}\n\n\treturn append(files, dirLists...), nil\n}", "func (client StorageGatewayClient) listFileSystems(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {\n\thttpRequest, err := request.HTTPRequest(http.MethodGet, \"/storageGateways/{storageGatewayId}/fileSystems\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response ListFileSystemsResponse\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 (m *manager) List() ([]string, error) {\n\tvar igs []*compute.InstanceGroup\n\n\tzones, err := m.ListZones(utils.AllNodesPredicate)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, zone := range zones {\n\t\tigsForZone, err := m.cloud.ListInstanceGroups(zone)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfor _, ig := range igsForZone {\n\t\t\tigs = append(igs, ig)\n\t\t}\n\t}\n\n\tvar names []string\n\tfor _, ig := range igs {\n\t\tif m.namer.NameBelongsToCluster(ig.Name) {\n\t\t\tnames = append(names, ig.Name)\n\t\t}\n\t}\n\n\treturn names, nil\n}", "func InitializeDisks(client *govmomi.Client, host *object.HostSystem, hvs *object.HostVsanSystem, diskMap *types.VsanHostDiskMapping, apiTimeout time.Duration) error {\n\tctx, cancel := context.WithTimeout(context.Background(), apiTimeout)\n\tdefer cancel()\n\n\tntask := types.InitializeDisks_Task{\n\t\tThis: hvs.Reference(),\n\t\tMapping: []types.VsanHostDiskMapping{*diskMap},\n\t}\n\n\tresp, err := methods.InitializeDisks_Task(ctx, host.Client().RoundTripper, &ntask)\n\tif err != nil {\n\t\treturn err\n\t}\n\ttask := object.NewTask(client.Client, resp.Returnval)\n\treturn task.Wait(ctx)\n}" ]
[ "0.73473185", "0.6889326", "0.6709524", "0.6656585", "0.66469353", "0.6623613", "0.6474759", "0.6460947", "0.63128275", "0.6271275", "0.6188937", "0.6117534", "0.60657895", "0.597199", "0.5935313", "0.5932397", "0.5918547", "0.59157044", "0.58519906", "0.5769483", "0.57280904", "0.57244724", "0.5631934", "0.5629166", "0.5608202", "0.5606273", "0.56012493", "0.55981314", "0.5597272", "0.55918014", "0.5573763", "0.557267", "0.55648035", "0.5561573", "0.55600023", "0.5534664", "0.5518355", "0.5495441", "0.549264", "0.5488888", "0.547564", "0.5460281", "0.54580444", "0.5440046", "0.54269725", "0.5422531", "0.5420965", "0.54080343", "0.5400465", "0.5390041", "0.5326888", "0.5324503", "0.53235257", "0.5316933", "0.5300988", "0.53005016", "0.5296388", "0.5284012", "0.5282301", "0.5281861", "0.52805215", "0.5279497", "0.5257656", "0.5256714", "0.5240582", "0.5240364", "0.52399284", "0.52317524", "0.5217366", "0.52124166", "0.5209428", "0.5207602", "0.52045596", "0.5203506", "0.519708", "0.51901805", "0.51887494", "0.5187134", "0.5181842", "0.5173939", "0.5170107", "0.5163281", "0.5154943", "0.5153656", "0.5153419", "0.51526624", "0.5151833", "0.5151833", "0.51480687", "0.5143961", "0.51434165", "0.5142717", "0.5136775", "0.513361", "0.51329076", "0.5131028", "0.5127128", "0.512619", "0.5123663", "0.51170707" ]
0.81188405
0
GetForwardingRule uses the override method GetForwardingRuleFn or the real implementation.
func (c *TestClient) GetForwardingRule(project, region, name string) (*compute.ForwardingRule, error) { if c.GetForwardingRuleFn != nil { return c.GetForwardingRuleFn(project, region, name) } return c.client.GetForwardingRule(project, region, name) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (f *fakeLB) GetForwardingRule(_ context.Context, _, _ string) (*govultr.ForwardingRule, *http.Response, error) {\n\tpanic(\"implement me\")\n}", "func (g *Google) getForwardingRule() (*compute.ForwardingRule, error) {\n\treturn g.computeService.GlobalForwardingRules.Get(g.project, forwardingRuleName).Do()\n}", "func GetForwardingRule(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *ForwardingRuleState, opts ...pulumi.ResourceOption) (*ForwardingRule, error) {\n\tvar resource ForwardingRule\n\terr := ctx.ReadResource(\"alicloud:ga/forwardingRule:ForwardingRule\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func NewForwardingRule(ctx *pulumi.Context,\n\tname string, args *ForwardingRuleArgs, opts ...pulumi.ResourceOption) (*ForwardingRule, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.AcceleratorId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'AcceleratorId'\")\n\t}\n\tif args.ListenerId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ListenerId'\")\n\t}\n\tif args.RuleActions == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'RuleActions'\")\n\t}\n\tif args.RuleConditions == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'RuleConditions'\")\n\t}\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource ForwardingRule\n\terr := ctx.RegisterResource(\"alicloud:ga/forwardingRule:ForwardingRule\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (f *fakeLB) CreateForwardingRule(_ context.Context, _ string, _ *govultr.ForwardingRule) (*govultr.ForwardingRule, *http.Response, error) {\n\tpanic(\"implement me\")\n}", "func (f *fakeLB) ListForwardingRules(_ context.Context, _ string, _ *govultr.ListOptions) ([]govultr.ForwardingRule, *govultr.Meta, *http.Response, error) {\n\treturn []govultr.ForwardingRule{{\n\t\t\tRuleID: \"1234\",\n\t\t\tFrontendProtocol: \"tcp\",\n\t\t\tFrontendPort: 80,\n\t\t\tBackendProtocol: \"tcp\",\n\t\t\tBackendPort: 80,\n\t\t}}, &govultr.Meta{\n\t\t\tTotal: 0,\n\t\t\tLinks: &govultr.Links{\n\t\t\t\tNext: \"\",\n\t\t\t\tPrev: \"\",\n\t\t\t},\n\t\t}, nil, nil\n}", "func (g *Google) createForwardingRule(targetLink string) (string, error) {\n\tif rule, err := g.getForwardingRule(); err == nil {\n\t\tlog.Infof(\"found ForwardingRule %s: %s\", forwardingRuleName, rule.SelfLink)\n\t\treturn rule.SelfLink, nil\n\t}\n\n\top, err := g.computeService.GlobalForwardingRules.Insert(g.project,\n\t\t&compute.ForwardingRule{\n\t\t\tName: forwardingRuleName,\n\t\t\tIPProtocol: cockroachProtocol,\n\t\t\tPortRange: fmt.Sprintf(\"%d\", g.context.Port),\n\t\t\tTarget: targetLink,\n\t\t}).Do()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif err := g.waitForOperation(op); err != nil {\n\t\treturn \"\", err\n\t}\n\n\tlog.Infof(\"created ForwardingRule %s: %s\", forwardingRuleName, op.TargetLink)\n\treturn op.TargetLink, nil\n}", "func (f *fakeLB) GetFirewallRule(_ context.Context, _, _ string) (*govultr.LBFirewallRule, *http.Response, error) {\n\treturn nil, nil, nil\n}", "func (cli *OpsGenieUserV2Client) ListForwardingRules(req userv2.ListUserForwardingRulesRequest) (*userv2.ListUserForwardingRulesResponse, error) {\n\tvar response userv2.ListUserForwardingRulesResponse\n\terr := cli.sendGetRequest(&req, &response)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &response, nil\n}", "func (f *fakeLB) DeleteForwardingRule(_ context.Context, _, _ string) error {\n\tpanic(\"implement me\")\n}", "func (s *p4RuntimeServer) GetForwardingPipelineConfig(ctx context.Context, cfgGetReq *p4.GetForwardingPipelineConfigRequest) (*p4.GetForwardingPipelineConfigResponse, error) {\n\n\treturn &p4.GetForwardingPipelineConfigResponse{}, nil\n}", "func (g *Google) getFirewallRule() (*compute.Firewall, error) {\n\treturn g.computeService.Firewalls.Get(g.project, firewallRuleName).Do()\n}", "func (c *TestClient) ListForwardingRules(project, region string, opts ...ListCallOption) ([]*compute.ForwardingRule, error) {\n\tif c.ListForwardingRulesFn != nil {\n\t\treturn c.ListForwardingRulesFn(project, region, opts...)\n\t}\n\treturn c.client.ListForwardingRules(project, region, opts...)\n}", "func (m *AssignmentFilterEvaluateRequest) GetRule()(*string) {\n val, err := m.GetBackingStore().Get(\"rule\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func (c *TestClient) GetFirewallRule(project, name string) (*compute.Firewall, error) {\n\tif c.GetFirewallRuleFn != nil {\n\t\treturn c.GetFirewallRuleFn(project, name)\n\t}\n\treturn c.client.GetFirewallRule(project, name)\n}", "func NewComputeForwardingRuleConverter() *ComputeForwardingRuleConverter {\n\treturn &ComputeForwardingRuleConverter{\n\t\tname: \"google_compute_forwarding_rule\",\n\t\tschema: schemaProvider.ResourcesMap[\"google_compute_forwarding_rule\"].Schema,\n\t}\n}", "func NewForwardingHook(logger Logger) Hook {\n\treturn &forwardingHook{logger}\n}", "func (m *Mock) GetRule(*nftables.Table, *nftables.Chain) ([]*nftables.Rule, error) {\n\treturn nil, nil\n}", "func (m *DeviceAndAppManagementAssignmentFilter) GetRule()(*string) {\n val, err := m.GetBackingStore().Get(\"rule\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func (c *TestClient) CreateForwardingRule(project, region string, fr *compute.ForwardingRule) error {\n\tif c.CreateForwardingRuleFn != nil {\n\t\treturn c.CreateForwardingRuleFn(project, region, fr)\n\t}\n\treturn c.client.CreateForwardingRule(project, region, fr)\n}", "func (s Service) GetTransitionRule(ctx context.Context, docID, ruleID []byte) (*coredocumentpb.TransitionRule, error) {\n\treturn s.pendingDocSrv.GetTransitionRule(ctx, docID, ruleID)\n}", "func (s *server) GetPortForward(req *runtimeapi.PortForwardRequest) (*runtimeapi.PortForwardResponse, error) {\n\tif req.PodSandboxId == \"\" {\n\t\treturn nil, grpc.Errorf(codes.InvalidArgument, \"missing required pod_sandbox_id\")\n\t}\n\ttoken, err := s.cache.Insert(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &runtimeapi.PortForwardResponse{\n\t\tUrl: s.buildURL(\"portforward\", token),\n\t}, nil\n}", "func getRule(bld *build.File, ruleKind string, rt ruleType) *build.Rule {\n\trs := buildRules(bld, ruleKind)\n\tfor i := len(rs) - 1; i >= 0; i-- {\n\t\tr := rs[i]\n\t\tif ruleMatches(bld, r, rt) {\n\t\t\treturn r\n\t\t}\n\t}\n\treturn nil\n}", "func (c *TestClient) DeleteForwardingRule(project, region, name string) error {\n\tif c.DeleteForwardingRuleFn != nil {\n\t\treturn c.DeleteForwardingRuleFn(project, region, name)\n\t}\n\treturn c.client.DeleteForwardingRule(project, region, name)\n}", "func Forward(in, out Link) rules.Rule {\n\treturn rules.Rule(fmt.Sprintf(\n\t\t\"-t filter -A fw-interfaces -j ACCEPT -i %v -o %v\",\n\t\tin.Name(), out.Name()))\n}", "func GetForward(c context.Context, r *http.Request) string {\n\tif val, ok := c.Get(r, context.BaseCtxKey(\"forward\")); ok {\n\t\treturn val.(string)\n\t}\n\treturn \"\"\n}", "func (c *Config) GetForwarderAddrWithScheme() string {\n\treturn fmt.Sprintf(\"http://%s:%d\", c.GlobalConfig.BindHost, c.GlobalConfig.ListenPort)\n}", "func (client *Client) GetRule(request *GetRuleRequest) (_result *GetRuleResponse, _err error) {\n\truntime := &util.RuntimeOptions{}\n\t_result = &GetRuleResponse{}\n\t_body, _err := client.GetRuleWithOptions(request, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_result = _body\n\treturn _result, _err\n}", "func GetRules() []Rule {\n\tupdateMux.RLock()\n\trules := rulesFrom(breakerRules)\n\tupdateMux.RUnlock()\n\tret := make([]Rule, 0, len(rules))\n\tfor _, rule := range rules {\n\t\tret = append(ret, *rule)\n\t}\n\treturn ret\n}", "func NewNetworkLoadBalancerForwardingRuleTarget(ip string, port int32, weight int32) *NetworkLoadBalancerForwardingRuleTarget {\n\tthis := NetworkLoadBalancerForwardingRuleTarget{}\n\n\tthis.Ip = &ip\n\tthis.Port = &port\n\tthis.Weight = &weight\n\n\treturn &this\n}", "func (s *Service) GetRule(ruleName string, params map[string]string, response handle.ResponseHandle) error {\n\treturn getRule(s.client, ruleName, params, response)\n}", "func (r *oauthProxy) createForwardingProxy() error {\n\tr.log.Info(\"enabling forward signing mode, listening on\", zap.String(\"interface\", r.config.Listen))\n\n\tif r.config.SkipUpstreamTLSVerify {\n\t\tr.log.Warn(\"tls verification switched off. In forward signing mode it's recommended you verify! (--skip-upstream-tls-verify=false)\")\n\t}\n\tif err := r.createUpstreamProxy(nil); err != nil {\n\t\treturn err\n\t}\n\tforwardingHandler := r.forwardProxyHandler()\n\n\t// set the http handler\n\tproxy := r.upstream.(*goproxy.ProxyHttpServer)\n\tr.router = proxy\n\n\t// setup the tls configuration\n\tif r.config.TLSCaCertificate != \"\" && r.config.TLSCaPrivateKey != \"\" {\n\t\tca, err := loadCA(r.config.TLSCaCertificate, r.config.TLSCaPrivateKey)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to load certificate authority, error: %s\", err)\n\t\t}\n\n\t\t// implement the goproxy connect method\n\t\tproxy.OnRequest().HandleConnectFunc(\n\t\t\tfunc(host string, ctx *goproxy.ProxyCtx) (*goproxy.ConnectAction, string) {\n\t\t\t\treturn &goproxy.ConnectAction{\n\t\t\t\t\tAction: goproxy.ConnectMitm,\n\t\t\t\t\tTLSConfig: goproxy.TLSConfigFromCA(ca),\n\t\t\t\t}, host\n\t\t\t},\n\t\t)\n\t} else {\n\t\t// use the default certificate provided by goproxy\n\t\tproxy.OnRequest().HandleConnect(goproxy.AlwaysMitm)\n\t}\n\n\tproxy.OnResponse().DoFunc(func(resp *http.Response, ctx *goproxy.ProxyCtx) *http.Response {\n\t\t// @NOTES, somewhat annoying but goproxy hands back a nil response on proxy client errors\n\t\tif resp != nil && r.config.EnableLogging {\n\t\t\tstart := ctx.UserData.(time.Time)\n\t\t\tlatency := time.Since(start)\n\t\t\tlatencyMetric.Observe(latency.Seconds())\n\t\t\tr.log.Info(\"client request\",\n\t\t\t\tzap.String(\"method\", resp.Request.Method),\n\t\t\t\tzap.String(\"path\", resp.Request.URL.Path),\n\t\t\t\tzap.Int(\"status\", resp.StatusCode),\n\t\t\t\tzap.Int64(\"bytes\", resp.ContentLength),\n\t\t\t\tzap.String(\"host\", resp.Request.Host),\n\t\t\t\tzap.String(\"path\", resp.Request.URL.Path),\n\t\t\t\tzap.String(\"latency\", latency.String()))\n\t\t}\n\n\t\treturn resp\n\t})\n\tproxy.OnRequest().DoFunc(func(req *http.Request, ctx *goproxy.ProxyCtx) (*http.Request, *http.Response) {\n\t\tctx.UserData = time.Now()\n\t\tforwardingHandler(req, ctx.Resp)\n\t\treturn req, ctx.Resp\n\t})\n\n\treturn nil\n}", "func (m *kubeGenericRuntimeManager) GetPortForward(ctx context.Context, podName, podNamespace string, podUID kubetypes.UID, ports []int32) (*url.URL, error) {\n\tsandboxIDs, err := m.getSandboxIDByPodUID(ctx, podUID, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to find sandboxID for pod %s: %v\", format.PodDesc(podName, podNamespace, podUID), err)\n\t}\n\tif len(sandboxIDs) == 0 {\n\t\treturn nil, fmt.Errorf(\"failed to find sandboxID for pod %s\", format.PodDesc(podName, podNamespace, podUID))\n\t}\n\treq := &runtimeapi.PortForwardRequest{\n\t\tPodSandboxId: sandboxIDs[0],\n\t\tPort: ports,\n\t}\n\tresp, err := m.runtimeService.PortForward(ctx, req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn url.Parse(resp.Url)\n}", "func (m *MockFirewallServiceIface) ListPortForwardingRules(p *ListPortForwardingRulesParams) (*ListPortForwardingRulesResponse, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListPortForwardingRules\", p)\n\tret0, _ := ret[0].(*ListPortForwardingRulesResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func GetRule(ctx *pulumi.Context,\n\tname string, id pulumi.ID, state *RuleState, opts ...pulumi.ResourceOpt) (*Rule, error) {\n\tinputs := make(map[string]interface{})\n\tif state != nil {\n\t\tinputs[\"arn\"] = state.Arn\n\t\tinputs[\"metricName\"] = state.MetricName\n\t\tinputs[\"name\"] = state.Name\n\t\tinputs[\"predicates\"] = state.Predicates\n\t\tinputs[\"tags\"] = state.Tags\n\t}\n\ts, err := ctx.ReadResource(\"aws:waf/rule:Rule\", name, id, inputs, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Rule{s: s}, nil\n}", "func (m *RuleBasedSubjectSet) GetRule()(*string) {\n val, err := m.GetBackingStore().Get(\"rule\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func DnsForwardingRulesetGenerator() gopter.Gen {\n\tif dnsForwardingRulesetGenerator != nil {\n\t\treturn dnsForwardingRulesetGenerator\n\t}\n\n\tgenerators := make(map[string]gopter.Gen)\n\tAddRelatedPropertyGeneratorsForDnsForwardingRuleset(generators)\n\tdnsForwardingRulesetGenerator = gen.Struct(reflect.TypeOf(DnsForwardingRuleset{}), generators)\n\n\treturn dnsForwardingRulesetGenerator\n}", "func (*PageRuleApiV1) NewPageRulesBodyActionsItemActionsForwardingURL(id string) (model *PageRulesBodyActionsItemActionsForwardingURL, err error) {\n\tmodel = &PageRulesBodyActionsItemActionsForwardingURL{\n\t\tID: core.StringPtr(id),\n\t}\n\terr = core.ValidateStruct(model, \"required parameters\")\n\treturn\n}", "func (t *Interface) IPv6Forwarding(ctrl bool) error {\n\tk := boolToByte(ctrl)\n\treturn ioutil.WriteFile(\"/proc/sys/net/ipv6/conf/\"+t.Name()+\"/forwarding\", []byte{k}, 0)\n}", "func (a *FunnelApiService) GetFunnel(ctx _context.Context, id string) FunnelApiApiGetFunnelRequest {\n\treturn FunnelApiApiGetFunnelRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tid: id,\n\t}\n}", "func NewNetworkLoadBalancerForwardingRuleTargetHealthCheck() *NetworkLoadBalancerForwardingRuleTargetHealthCheck {\n\tthis := NetworkLoadBalancerForwardingRuleTargetHealthCheck{}\n\n\treturn &this\n}", "func (o ForwardingRuleOutput) ForwardingRuleName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *ForwardingRule) pulumi.StringPtrOutput { return v.ForwardingRuleName }).(pulumi.StringPtrOutput)\n}", "func (m *MockFirewallServiceIface) CreatePortForwardingRule(p *CreatePortForwardingRuleParams) (*CreatePortForwardingRuleResponse, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"CreatePortForwardingRule\", p)\n\tret0, _ := ret[0].(*CreatePortForwardingRuleResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (o *ApplicationLoadBalancerForwardingRuleProperties) GetHttpRules() *[]ApplicationLoadBalancerHttpRule {\n\tif o == nil {\n\t\treturn nil\n\t}\n\n\treturn o.HttpRules\n\n}", "func (o RouteFilterOutput) Rule() RouteFilterRuleOutput {\n\treturn o.ApplyT(func(v *RouteFilter) RouteFilterRuleOutput { return v.Rule }).(RouteFilterRuleOutput)\n}", "func (f *Forward) Forward(state request.Request) (*dns.Msg, error) {\n\tif f == nil {\n\t\treturn nil, ErrNoForward\n\t}\n\n\tfails := 0\n\tvar upstreamErr error\n\tfor _, proxy := range f.List() {\n\t\tif proxy.Down(f.maxfails) {\n\t\t\tfails++\n\t\t\tif fails < len(f.proxies) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// All upstream proxies are dead, assume healtcheck is complete broken and randomly\n\t\t\t// select an upstream to connect to.\n\t\t\tproxy = f.List()[0]\n\t\t}\n\n\t\tret, err := proxy.Connect(context.Background(), state, f.opts)\n\n\t\tret, err = truncated(state, ret, err)\n\t\tupstreamErr = err\n\n\t\tif err != nil {\n\t\t\tif fails < len(f.proxies) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\n\t\t// Check if the reply is correct; if not return FormErr.\n\t\tif !state.Match(ret) {\n\t\t\treturn state.ErrorMessage(dns.RcodeFormatError), nil\n\t\t}\n\n\t\treturn ret, err\n\t}\n\n\tif upstreamErr != nil {\n\t\treturn nil, upstreamErr\n\t}\n\n\treturn nil, ErrNoHealthy\n}", "func GetRule(id string) (*Rule, error) {\n\tvar rule Rule\n\tfilters := map[string]interface{}{\"_id\": id}\n\terr := database.Client.GetOne(ruleTable, &rule, filters)\n\treturn &rule, err\n}", "func (a *Client) GetScopeRule(params *GetScopeRuleParams, authInfo runtime.ClientAuthInfoWriter) (*GetScopeRuleOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetScopeRuleParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"GetScopeRule\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/cdn/v1/stacks/{stack_id}/sites/{site_id}/scopes/{scope_id}/rules/{rule_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: &GetScopeRuleReader{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.(*GetScopeRuleOK), nil\n\n}", "func (m *Group) GetMembershipRule()(*string) {\n return m.membershipRule\n}", "func (d *RPCFactory) GetDispatcher() *yarpc.Dispatcher {\n\td.Lock()\n\tdefer d.Unlock()\n\n\tif d.dispatcher != nil {\n\t\treturn d.dispatcher\n\t}\n\n\td.dispatcher = d.createInboundDispatcher()\n\treturn d.dispatcher\n}", "func GetJumpRule(v, tableName, srcChainName, dstChainName string) (*nftables.Rule, error) {\n\tif err := isSupportedIPVersion(v); err != nil {\n\t\treturn nil, err\n\t}\n\tchainProps, err := GetChainProps(v, tableName, srcChainName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif chainProps.RuleCount == 0 {\n\t\treturn nil, nil\n\t}\n\n\tfor _, r := range chainProps.Rules {\n\t\tif len(r.Exprs) != 1 {\n\t\t\tcontinue\n\t\t}\n\t\trr, err := r.Exprs[0].(*expr.Verdict)\n\t\tif err == false {\n\t\t\tcontinue\n\t\t}\n\t\tif rr.Kind != expr.VerdictJump {\n\t\t\tcontinue\n\t\t}\n\t\tif rr.Chain != dstChainName {\n\t\t\tcontinue\n\t\t}\n\t\treturn r, nil\n\t}\n\n\treturn nil, nil\n}", "func (o *UpdateMetricRulesetRequest) GetRoutingRule() RoutingRule {\n\tif o == nil || isNil(o.RoutingRule) {\n\t\tvar ret RoutingRule\n\t\treturn ret\n\t}\n\treturn *o.RoutingRule\n}", "func (client FirewallPolicyRuleGroupsClient) Get(ctx context.Context, resourceGroupName string, firewallPolicyName string, ruleGroupName string) (result FirewallPolicyRuleGroup, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/FirewallPolicyRuleGroupsClient.Get\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.Response.Response != nil {\n\t\t\t\tsc = result.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\treq, err := client.GetPreparer(ctx, resourceGroupName, firewallPolicyName, ruleGroupName)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.FirewallPolicyRuleGroupsClient\", \"Get\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.GetSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"network.FirewallPolicyRuleGroupsClient\", \"Get\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.GetResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.FirewallPolicyRuleGroupsClient\", \"Get\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\n\treturn\n}", "func getForcedGetter(sourceUrl string) (string, string) {\n\tif matches := forcedRegexp.FindStringSubmatch(sourceUrl); matches != nil && len(matches) > 2 {\n\t\treturn matches[1], matches[2]\n\t}\n\n\treturn \"\", sourceUrl\n}", "func GetFirewallRule(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *FirewallRuleState, opts ...pulumi.ResourceOption) (*FirewallRule, error) {\n\tvar resource FirewallRule\n\terr := ctx.ReadResource(\"azure:mssql/firewallRule:FirewallRule\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func NewApplicationLoadBalancerForwardingRuleProperties(name string, protocol string, listenerIp string, listenerPort int32) *ApplicationLoadBalancerForwardingRuleProperties {\n\tthis := ApplicationLoadBalancerForwardingRuleProperties{}\n\n\tthis.Name = &name\n\tthis.Protocol = &protocol\n\tthis.ListenerIp = &listenerIp\n\tthis.ListenerPort = &listenerPort\n\n\treturn &this\n}", "func (o *ApplicationLoadBalancerForwardingRuleProperties) GetProtocol() *string {\n\tif o == nil {\n\t\treturn nil\n\t}\n\n\treturn o.Protocol\n\n}", "func (m *MockFirewallServiceIface) DeletePortForwardingRule(p *DeletePortForwardingRuleParams) (*DeletePortForwardingRuleResponse, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"DeletePortForwardingRule\", p)\n\tret0, _ := ret[0].(*DeletePortForwardingRuleResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (hm *hostportManager) getIPFamily() ipFamily {\n\tfamily := IPv4\n\tif hm.iptables.IsIPv6() {\n\t\tfamily = IPv6\n\t}\n\treturn family\n}", "func GetDestinationRule(k8sClient kubernetes.Interface, istioClient istio.Interface, name string, namespace string) (*DestinationRuleDetail, error) {\n\tdestinationRule, err := istioClient.NetworkingV1alpha3().DestinationRules(namespace).Get(name, metaV1.GetOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ToDestinationRuleDetail(destinationRule, nil), nil\n}", "func GetFwderHandler(cfg *config, cid2topic map[string]string) func(w http.ResponseWriter, r *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tcid := getCidFromPath(r.URL.Path[1:])\n\t\ttopic, ok := cid2topic[cid]\n\t\tif !ok {\n\t\t\thttp.Redirect(w, r, \"/gateway/\"+cid, 301)\n\t\t\treturn\n\t\t}\n\t\troutingTable := cfg.Topics[topic].routingTable\n\t\tIPprefix := getIPprefix(r.RemoteAddr)\n\t\tgway, ok := routingTable[IPprefix]\n\t\tif !ok {\n\t\t\thttp.Redirect(w, r, \"/gateway/\"+cid, 301)\n\t\t\treturn\n\t\t}\n\t\tfwdAddress := makeFwdPath(gway, cid)\n\t\thttp.Redirect(w, r, fwdAddress, 301)\n\t}\n}", "func GetRuleProtocol(v string) (rules.Protocol, error) {\n\tvar protocol rules.Protocol\n\tvar err error\n\n\tswitch v {\n\tcase \"any\":\n\t\tprotocol = rules.ProtocolAny\n\tcase \"icmp\":\n\t\tprotocol = rules.ProtocolICMP\n\tcase \"tcp\":\n\t\tprotocol = rules.ProtocolTCP\n\tcase \"udp\":\n\t\tprotocol = rules.ProtocolUDP\n\tdefault:\n\t\terr = fmt.Errorf(\"Invalid protocol\")\n\t}\n\n\treturn protocol, err\n}", "func (obj *ruleNode) Rule() Rule {\n\treturn obj.rule\n}", "func (m *MockFirewallServiceIface) UpdatePortForwardingRule(p *UpdatePortForwardingRuleParams) (*UpdatePortForwardingRuleResponse, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"UpdatePortForwardingRule\", p)\n\tret0, _ := ret[0].(*UpdatePortForwardingRuleResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (self *PolicyAgent) AddRule(rule *OfnetPolicyRule, ret *bool) error {\n\tvar ipDa *net.IP = nil\n\tvar ipDaMask *net.IP = nil\n\tvar ipSa *net.IP = nil\n\tvar ipSaMask *net.IP = nil\n\tvar md *uint64 = nil\n\tvar mdm *uint64 = nil\n\tvar flag, flagMask uint16\n\tvar flagPtr, flagMaskPtr *uint16\n\tvar err error\n\n\t// make sure switch is connected\n\tif !self.agent.IsSwitchConnected() {\n\t\tself.agent.WaitForSwitchConnection()\n\t}\n\n\t// check if we already have the rule\n\tself.mutex.RLock()\n\tif self.Rules[rule.RuleId] != nil {\n\t\toldRule := self.Rules[rule.RuleId].Rule\n\n\t\tif ruleIsSame(oldRule, rule) {\n\t\t\tself.mutex.RUnlock()\n\t\t\treturn nil\n\t\t} else {\n\t\t\tself.mutex.RUnlock()\n\t\t\tlog.Errorf(\"Rule already exists. new rule: {%+v}, old rule: {%+v}\", rule, oldRule)\n\t\t\treturn errors.New(\"Rule already exists\")\n\t\t}\n\t}\n\tself.mutex.RUnlock()\n\n\tlog.Infof(\"Received AddRule: %+v\", rule)\n\n\t// Parse dst ip\n\tif rule.DstIpAddr != \"\" {\n\t\tipDa, ipDaMask, err = ParseIPAddrMaskString(rule.DstIpAddr)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Error parsing dst ip %s. Err: %v\", rule.DstIpAddr, err)\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// parse src ip\n\tif rule.SrcIpAddr != \"\" {\n\t\tipSa, ipSaMask, err = ParseIPAddrMaskString(rule.SrcIpAddr)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Error parsing src ip %s. Err: %v\", rule.SrcIpAddr, err)\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// parse source/dst endpoint groups\n\tif rule.SrcEndpointGroup != 0 && rule.DstEndpointGroup != 0 {\n\t\tsrcMetadata, srcMetadataMask := SrcGroupMetadata(rule.SrcEndpointGroup)\n\t\tdstMetadata, dstMetadataMask := DstGroupMetadata(rule.DstEndpointGroup)\n\t\tmetadata := srcMetadata | dstMetadata\n\t\tmetadataMask := srcMetadataMask | dstMetadataMask\n\t\tmd = &metadata\n\t\tmdm = &metadataMask\n\t} else if rule.SrcEndpointGroup != 0 {\n\t\tsrcMetadata, srcMetadataMask := SrcGroupMetadata(rule.SrcEndpointGroup)\n\t\tmd = &srcMetadata\n\t\tmdm = &srcMetadataMask\n\t} else if rule.DstEndpointGroup != 0 {\n\t\tdstMetadata, dstMetadataMask := DstGroupMetadata(rule.DstEndpointGroup)\n\t\tmd = &dstMetadata\n\t\tmdm = &dstMetadataMask\n\t}\n\n\t// Setup TCP flags\n\tif rule.IpProtocol == 6 && rule.TcpFlags != \"\" {\n\t\tswitch rule.TcpFlags {\n\t\tcase \"syn\":\n\t\t\tflag = TCP_FLAG_SYN\n\t\t\tflagMask = TCP_FLAG_SYN\n\t\tcase \"syn,ack\":\n\t\t\tflag = TCP_FLAG_ACK | TCP_FLAG_SYN\n\t\t\tflagMask = TCP_FLAG_ACK | TCP_FLAG_SYN\n\t\tcase \"ack\":\n\t\t\tflag = TCP_FLAG_ACK\n\t\t\tflagMask = TCP_FLAG_ACK\n\t\tcase \"syn,!ack\":\n\t\t\tflag = TCP_FLAG_SYN\n\t\t\tflagMask = TCP_FLAG_ACK | TCP_FLAG_SYN\n\t\tcase \"!syn,ack\":\n\t\t\tflag = TCP_FLAG_ACK\n\t\t\tflagMask = TCP_FLAG_ACK | TCP_FLAG_SYN\n\t\tdefault:\n\t\t\tlog.Errorf(\"Unknown TCP flags: %s, in rule: %+v\", rule.TcpFlags, rule)\n\t\t\treturn errors.New(\"Unknown TCP flag\")\n\t\t}\n\n\t\tflagPtr = &flag\n\t\tflagMaskPtr = &flagMask\n\t}\n\t// Install the rule in policy table\n\truleFlow, err := self.policyTable.NewFlow(ofctrl.FlowMatch{\n\t\tPriority: uint16(FLOW_POLICY_PRIORITY_OFFSET + rule.Priority),\n\t\tEthertype: 0x0800,\n\t\tIpDa: ipDa,\n\t\tIpDaMask: ipDaMask,\n\t\tIpSa: ipSa,\n\t\tIpSaMask: ipSaMask,\n\t\tIpProto: rule.IpProtocol,\n\t\tTcpSrcPort: rule.SrcPort,\n\t\tTcpDstPort: rule.DstPort,\n\t\tUdpSrcPort: rule.SrcPort,\n\t\tUdpDstPort: rule.DstPort,\n\t\tMetadata: md,\n\t\tMetadataMask: mdm,\n\t\tTcpFlags: flagPtr,\n\t\tTcpFlagsMask: flagMaskPtr,\n\t})\n\tif err != nil {\n\t\tlog.Errorf(\"Error adding flow for rule {%v}. Err: %v\", rule, err)\n\t\treturn err\n\t}\n\n\t// Point it to next table\n\tif rule.Action == \"allow\" {\n\t\terr = ruleFlow.Next(self.nextTable)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Error installing flow {%+v}. Err: %v\", ruleFlow, err)\n\t\t\treturn err\n\t\t}\n\t} else if rule.Action == \"deny\" {\n\t\terr = ruleFlow.Next(self.ofSwitch.DropAction())\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Error installing flow {%+v}. Err: %v\", ruleFlow, err)\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tlog.Errorf(\"Unknown action in rule {%+v}\", rule)\n\t\treturn errors.New(\"Unknown action in rule\")\n\t}\n\n\t// save the rule\n\tpRule := PolicyRule{\n\t\tRule: rule,\n\t\tflow: ruleFlow,\n\t}\n\tself.mutex.Lock()\n\tself.Rules[rule.RuleId] = &pRule\n\tself.mutex.Unlock()\n\n\treturn nil\n}", "func (g *Google) createFirewallRule() (string, error) {\n\tif rule, err := g.getFirewallRule(); err == nil {\n\t\tlog.Infof(\"found FirewallRule %s: %s\", firewallRuleName, rule.SelfLink)\n\t\treturn rule.SelfLink, nil\n\t}\n\n\top, err := g.computeService.Firewalls.Insert(g.project,\n\t\t&compute.Firewall{\n\t\t\tName: firewallRuleName,\n\t\t\tAllowed: []*compute.FirewallAllowed{\n\t\t\t\t{\n\t\t\t\t\tIPProtocol: cockroachProtocol,\n\t\t\t\t\tPorts: []string{\n\t\t\t\t\t\tfmt.Sprintf(\"%d\", g.context.Port),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tSourceRanges: []string{\n\t\t\t\tallIPAddresses,\n\t\t\t},\n\t\t}).Do()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif err := g.waitForOperation(op); err != nil {\n\t\treturn \"\", err\n\t}\n\tlog.Infof(\"created FirewallRule %s: %s\", firewallRuleName, op.TargetLink)\n\treturn op.TargetLink, nil\n}", "func (egw *NsxtEdgeGateway) GetNsxtFirewall() (*NsxtFirewall, error) {\n\tclient := egw.client\n\tendpoint := types.OpenApiPathVersion1_0_0 + types.OpenApiEndpointNsxtFirewallRules\n\tminimumApiVersion, err := client.checkOpenApiEndpointCompatibility(endpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Insert Edge Gateway ID into endpoint path edgeGateways/%s/firewall/rules\n\turlRef, err := client.OpenApiBuildEndpoint(fmt.Sprintf(endpoint, egw.EdgeGateway.ID))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturnObject := &NsxtFirewall{\n\t\tNsxtFirewallRuleContainer: &types.NsxtFirewallRuleContainer{},\n\t\tclient: client,\n\t\tedgeGatewayId: egw.EdgeGateway.ID,\n\t}\n\n\terr = client.OpenApiGetItem(minimumApiVersion, urlRef, nil, returnObject.NsxtFirewallRuleContainer, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error retrieving NSX-T Firewall rules: %s\", err)\n\t}\n\n\t// Store Edge Gateway ID for later operations\n\treturnObject.edgeGatewayId = egw.EdgeGateway.ID\n\n\treturn returnObject, nil\n}", "func ForwardToSubnet(in, out Link, dst Addr) rules.Rule {\n\treturn rules.Rule(fmt.Sprintf(\n\t\t\"-t filter -A fw-interfaces -j ACCEPT -d %v -i %v -o %v\",\n\t\tdst, in.Name(), out.Name()))\n}", "func NewForwarder(cc *ClusterConfig) proto.Forwarder {\n\t// new Forwarder\n\tif _, ok := defaultForwardCacheTypes[cc.CacheType]; ok {\n\t\treturn newDefaultForwarder(cc)\n\t}\n\tif cc.CacheType == types.CacheTypeRedisCluster {\n\t\tdto := time.Duration(cc.DialTimeout) * time.Millisecond\n\t\trto := time.Duration(cc.ReadTimeout) * time.Millisecond\n\t\twto := time.Duration(cc.WriteTimeout) * time.Millisecond\n\t\treturn rclstr.NewForwarder(cc.Name, cc.ListenAddr, cc.Servers, cc.NodeConnections, cc.NodePipeCount, dto, rto, wto, []byte(cc.HashTag))\n\t}\n\tpanic(\"unsupported protocol\")\n}", "func (ruleset *DnsForwardingRuleset) Default() {\n\truleset.defaultImpl()\n\tvar temp any = ruleset\n\tif runtimeDefaulter, ok := temp.(genruntime.Defaulter); ok {\n\t\truntimeDefaulter.CustomDefault()\n\t}\n}", "func (pf *PortForwarder) ReverseForwardPort(ctx context.Context, req *waterfall_grpc_pb.PortForwardRequest) (*empty_pb.Empty, error) {\n\tpf.reverseSessionsMutex.Lock()\n\tdefer pf.reverseSessionsMutex.Unlock()\n\n\tlog.Printf(\"Reverse forwarding %s -> %s ...\\n\", req.Session.Src, req.Session.Dst)\n\tif rs, ok := pf.reverseSessions[req.Session.Src]; ok {\n\t\tif !req.Rebind {\n\t\t\treturn nil, status.Errorf(codes.AlreadyExists, \"no-rebind specified, can't forward address: %s\", req.Session.Src)\n\t\t}\n\t\tif err := pf.stopReverseForwarding(ctx, rs); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tsrcKind, srcAddr, err := parseAddr(req.Session.Src)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdstKind, dstAddr, err := parseAddr(req.Session.Dst)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsrcNtwk, err := networkKind(srcKind)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// The context we create in this case is scoped to the duration of the forwarding\n\t// session, which outlives this request, therefore we can't propagate the request\n\t// context and are forced to create a new one.\n\tfCtx, cancel := context.WithCancel(context.Background())\n\n\t// 1) Ask the server to listen for connections on src\n\tncs, err := pf.client.StartReverseForward(\n\t\tfCtx,\n\t\t&waterfall_grpc_pb.ForwardMessage{\n\t\t\tOp: waterfall_grpc_pb.ForwardMessage_OPEN,\n\t\t\tKind: srcNtwk,\n\t\t\tAddr: srcAddr})\n\tif err != nil {\n\t\tlog.Printf(\"Failed to start reverse forwarding session (%s -> %s): %v\", req.Session.Src, req.Session.Dst, err)\n\t\treturn nil, err\n\t}\n\n\tss := &forwardSession{src: req.Session.Src, dst: req.Session.Dst, cancel: cancel}\n\tpf.reverseSessions[req.Session.Src] = ss\n\n\t// Listen for new connections on a different goroutine so we can return to the client\n\tgo func() {\n\t\tdefer pf.stopReverseForwarding(fCtx, ss)\n\t\tfor {\n\t\t\tlog.Print(\"Waiting for new connection to forward...\")\n\t\t\tfwd, err := ncs.Recv()\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"Waterfall server error when listening for reverse forwarding connections: %v\", err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif fwd.Op != waterfall_grpc_pb.ForwardMessage_OPEN {\n\t\t\t\t// The only type of message the server can reply is with an OPEN message\n\t\t\t\tlog.Printf(\"Requested OP %v but only open is supported ...\\n\", fwd.Op)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// 2) Hand the server a stream to start forwarding the connection\n\t\t\tfs, err := pf.client.ReverseForward(fCtx)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"Failed to create new forwarding session: %v\", err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tntwk := srcNtwk\n\t\t\taddr := srcAddr\n\t\t\tif fwd.GetKind() != waterfall_grpc_pb.ForwardMessage_UNSET && len(fwd.Addr) > 0 {\n\t\t\t\tntwk = fwd.Kind\n\t\t\t\taddr = fwd.Addr\n\t\t\t}\n\t\t\tif err := fs.Send(&waterfall_grpc_pb.ForwardMessage{\n\t\t\t\tOp: waterfall_grpc_pb.ForwardMessage_OPEN,\n\t\t\t\tKind: ntwk,\n\t\t\t\tAddr: addr,\n\t\t\t}); err != nil {\n\t\t\t\tlog.Printf(\"Failed to create new forwarding request: %v\", err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconn, err := net.Dial(dstKind, dstAddr)\n\t\t\tif err != nil {\n\t\t\t\t// Ignore this error. The socket might not be open initially\n\t\t\t\t// but can be created after the forwarding session.\n\t\t\t\tlog.Printf(\"Failed to connect %s:%s: %v\", dstKind, dstAddr, err)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// 3) Forward the stream to the connection\n\t\t\tgo forward.NewStreamForwarder(fs, conn.(forward.HalfReadWriteCloser)).Forward()\n\t\t}\n\t}()\n\treturn &empty_pb.Empty{}, nil\n}", "func (client *Client) GetRuleWithOptions(request *GetRuleRequest, runtime *util.RuntimeOptions) (_result *GetRuleResponse, _err error) {\n\t_err = util.ValidateModel(request)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_result = &GetRuleResponse{}\n\t_body, _err := client.DoRequest(tea.String(\"getRule\"), tea.String(\"HTTP\"), tea.String(\"POST\"), tea.String(\"/openapi/getRule\"), nil, tea.ToMap(request), 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 GetBandwidthLimitRule(c *gophercloud.ServiceClient, policyID, ruleID string) (r GetBandwidthLimitRuleResult) {\n\t_, r.Err = c.Get(getBandwidthLimitRuleURL(c, policyID, ruleID), &r.Body, nil)\n\treturn\n}", "func (in *DnsForwardingRuleSetsForwardingRule) DeepCopy() *DnsForwardingRuleSetsForwardingRule {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DnsForwardingRuleSetsForwardingRule)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (i *Interest) ForwardingHint() []Delegation {\n\treturn i.forwardingHint\n}", "func ipForwardingBroken(routes []netaddr.IPPrefix) bool {\n\tif len(routes) == 0 {\n\t\t// Nothing to route, so no need to warn.\n\t\treturn false\n\t}\n\n\tif runtime.GOOS != \"linux\" {\n\t\t// We only do subnet routing on Linux for now.\n\t\t// It might work on darwin/macOS when building from source, so\n\t\t// don't return true for other OSes. We can OS-based warnings\n\t\t// already in the admin panel.\n\t\treturn false\n\t}\n\n\tv4Routes, v6Routes := false, false\n\tfor _, r := range routes {\n\t\tif r.IP.Is4() {\n\t\t\tv4Routes = true\n\t\t} else {\n\t\t\tv6Routes = true\n\t\t}\n\t}\n\n\tif v4Routes {\n\t\tout, err := ioutil.ReadFile(\"/proc/sys/net/ipv4/ip_forward\")\n\t\tif err != nil {\n\t\t\t// Try another way.\n\t\t\tout, err = exec.Command(\"sysctl\", \"-n\", \"net.ipv4.ip_forward\").Output()\n\t\t}\n\t\tif err != nil {\n\t\t\t// Oh well, we tried. This is just for debugging.\n\t\t\t// We don't want false positives.\n\t\t\t// TODO: maybe we want a different warning for inability to check?\n\t\t\treturn false\n\t\t}\n\t\tif strings.TrimSpace(string(out)) == \"0\" {\n\t\t\treturn true\n\t\t}\n\t}\n\tif v6Routes {\n\t\t// Note: you might be wondering why we check only the state of\n\t\t// conf.all.forwarding, rather than per-interface forwarding\n\t\t// configuration. According to kernel documentation, it seems\n\t\t// that to actually forward packets, you need to enable\n\t\t// forwarding globally, and the per-interface forwarding\n\t\t// setting only alters other things such as how router\n\t\t// advertisements are handled. The kernel itself warns that\n\t\t// enabling forwarding per-interface and not globally will\n\t\t// probably not work, so I feel okay calling those configs\n\t\t// broken until we have proof otherwise.\n\t\tout, err := ioutil.ReadFile(\"/proc/sys/net/ipv6/conf/all/forwarding\")\n\t\tif err != nil {\n\t\t\tout, err = exec.Command(\"sysctl\", \"-n\", \"net.ipv6.conf.all.forwarding\").Output()\n\t\t}\n\t\tif err != nil {\n\t\t\t// Oh well, we tried. This is just for debugging.\n\t\t\t// We don't want false positives.\n\t\t\t// TODO: maybe we want a different warning for inability to check?\n\t\t\treturn false\n\t\t}\n\t\tif strings.TrimSpace(string(out)) == \"0\" {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "func (m *MockFirewallServiceIface) GetPortForwardingRuleByID(id string, opts ...OptionFunc) (*PortForwardingRule, int, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{id}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"GetPortForwardingRuleByID\", varargs...)\n\tret0, _ := ret[0].(*PortForwardingRule)\n\tret1, _ := ret[1].(int)\n\tret2, _ := ret[2].(error)\n\treturn ret0, ret1, ret2\n}", "func (_class PIFClass) GetIpv6Gateway(sessionID SessionRef, self PIFRef) (_retval string, _err error) {\n\t_method := \"PIF.get_ipv6_gateway\"\n\t_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"session_id\"), sessionID)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_selfArg, _err := convertPIFRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"self\"), self)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_retval, _err = convertStringToGo(_method + \" -> \", _result.Value)\n\treturn\n}", "func GetNamedForward(c context.Context, r *http.Request) string {\n\tif val, ok := c.Get(r, context.BaseCtxKey(\"named-forward\")); ok {\n\t\treturn val.(string)\n\t}\n\treturn \"\"\n}", "func (s *RestServer) getIPv6FlowBehavioralMetricsHandler(r *http.Request) (interface{}, error) {\n\tlog.Infof(\"Got GET request IPv6FlowBehavioralMetrics/%s\", mux.Vars(r)[\"Meta.Name\"])\n\treturn nil, nil\n}", "func (s *PublicSfcAPI) GetDelegator(ctx context.Context, addr common.Address, verbosity hexutil.Uint64) (map[string]interface{}, error) {\n\tdelegator, err := s.b.GetDelegator(ctx, addr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif delegator == nil {\n\t\treturn nil, nil\n\t}\n\tit := sfctype.SfcDelegatorAndAddr{\n\t\tAddr: addr,\n\t\tDelegator: delegator,\n\t}\n\tdelegatorRPC := RPCMarshalDelegator(it)\n\tif verbosity <= 1 {\n\t\treturn delegatorRPC, nil\n\t}\n\treturn s.addDelegatorMetricFields(ctx, delegatorRPC, addr)\n}", "func (_class PIFClass) GetGateway(sessionID SessionRef, self PIFRef) (_retval string, _err error) {\n\t_method := \"PIF.get_gateway\"\n\t_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"session_id\"), sessionID)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_selfArg, _err := convertPIFRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"self\"), self)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_retval, _err = convertStringToGo(_method + \" -> \", _result.Value)\n\treturn\n}", "func (r Virtual_PlacementGroup) GetRule() (resp datatypes.Virtual_PlacementGroup_Rule, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Virtual_PlacementGroup\", \"getRule\", nil, &r.Options, &resp)\n\treturn\n}", "func (s *Service) GetNetworkRule(ruleID string) (NetworkRule, error) {\n\tbody, err := s.getNetworkRuleResponseBody(ruleID)\n\n\treturn body.Data, err\n}", "func (*RuleMessage) rtMessage() {}", "func (c *Config) GetForwarderAddr() string {\n\treturn fmt.Sprintf(\"%s:%d\", c.getBindHost(), c.GlobalConfig.ListenPort)\n}", "func (in *DnsForwardingRuleSetsForwardingRuleList) DeepCopy() *DnsForwardingRuleSetsForwardingRuleList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DnsForwardingRuleSetsForwardingRuleList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (client *ClientImpl) GetProcessWorkItemTypeRule(ctx context.Context, args GetProcessWorkItemTypeRuleArgs) (*ProcessRule, error) {\n\trouteValues := make(map[string]string)\n\tif args.ProcessId == nil {\n\t\treturn nil, &azuredevops.ArgumentNilError{ArgumentName: \"args.ProcessId\"}\n\t}\n\trouteValues[\"processId\"] = (*args.ProcessId).String()\n\tif args.WitRefName == nil || *args.WitRefName == \"\" {\n\t\treturn nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: \"args.WitRefName\"}\n\t}\n\trouteValues[\"witRefName\"] = *args.WitRefName\n\tif args.RuleId == nil {\n\t\treturn nil, &azuredevops.ArgumentNilError{ArgumentName: \"args.RuleId\"}\n\t}\n\trouteValues[\"ruleId\"] = (*args.RuleId).String()\n\n\tlocationId, _ := uuid.Parse(\"76fe3432-d825-479d-a5f6-983bbb78b4f3\")\n\tresp, err := client.Client.Send(ctx, http.MethodGet, locationId, \"6.0-preview.2\", routeValues, nil, nil, \"\", \"application/json\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar responseValue ProcessRule\n\terr = client.Client.UnmarshalBody(resp, &responseValue)\n\treturn &responseValue, err\n}", "func (t *OpenconfigQos_Qos_ForwardingGroups) NewForwardingGroup(Name string) (*OpenconfigQos_Qos_ForwardingGroups_ForwardingGroup, error){\n\n\t// Initialise the list within the receiver struct if it has not already been\n\t// created.\n\tif t.ForwardingGroup == nil {\n\t\tt.ForwardingGroup = make(map[string]*OpenconfigQos_Qos_ForwardingGroups_ForwardingGroup)\n\t}\n\n\tkey := Name\n\n\t// Ensure that this key has not already been used in the\n\t// list. Keyed YANG lists do not allow duplicate keys to\n\t// be created.\n\tif _, ok := t.ForwardingGroup[key]; ok {\n\t\treturn nil, fmt.Errorf(\"duplicate key %v for list ForwardingGroup\", key)\n\t}\n\n\tt.ForwardingGroup[key] = &OpenconfigQos_Qos_ForwardingGroups_ForwardingGroup{\n\t\tName: &Name,\n\t}\n\n\treturn t.ForwardingGroup[key], nil\n}", "func (pf *PortForwarder) ForwardPort(ctx context.Context, req *waterfall_grpc_pb.PortForwardRequest) (*empty_pb.Empty, error) {\n\tpf.sessionsMutex.Lock()\n\tdefer pf.sessionsMutex.Unlock()\n\n\tlog.Printf(\"Forwarding %s -> %s ...\\n\", req.Session.Src, req.Session.Dst)\n\n\tkind, addr, err := parseAddr(req.Session.Src)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Parse dst even if we don't use it. No point in sending it the server if its malformed.\n\tif _, _, err := parseAddr(req.Session.Dst); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif s, ok := pf.sessions[req.Session.Src]; ok {\n\t\tif !req.Rebind {\n\t\t\treturn nil, status.Errorf(codes.AlreadyExists, \"no-rebind specified, can't forward address: %s\", req.Session.Src)\n\t\t}\n\n\t\tdelete(pf.sessions, req.Session.Src)\n\n\t\tif err := s.lis.Close(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tlis, err := net.Listen(kind, addr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// The context we create in this case is scoped to the duration of the forwarding\n\t// session, which outlives this request, therefore we can't propagate the request\n\t// context and are forced to create a new one.\n\tfCtx, cancel := context.WithCancel(context.Background())\n\n\tpf.sessions[req.Session.Src] = &forwardSession{src: req.Session.Src, dst: req.Session.Dst, lis: lis, cancel: cancel}\n\tgo func() {\n\t\tdefer cancel()\n\t\tdefer lis.Close()\n\t\tfor {\n\t\t\tconn, err := lis.Accept()\n\t\t\tif err != nil {\n\t\t\t\t// Theres really not much else we can do\n\t\t\t\tlog.Printf(\"Error accepting connection: %v\\n\", err)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tfwdr, err := makeForwarder(fCtx, pf.client, req.Session.Dst, conn)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"Error creating forwarder: %v\\n\", err)\n\t\t\t\tconn.Close()\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tgo fwdr.Forward()\n\t\t}\n\t}()\n\n\treturn &empty_pb.Empty{}, nil\n}", "func (m *DetectionRule) GetSchedule()(RuleScheduleable) {\n val, err := m.GetBackingStore().Get(\"schedule\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(RuleScheduleable)\n }\n return nil\n}", "func (s *prometheusruleWebhook) Rules() []admissionregv1.RuleWithOperations {\n\treturn rules\n}", "func PortForwardGet(ctx context.Context, namespace string, resource string, localPort string, kubePort string, verbose bool, getPath string) (string, *exec.Cmd, error) {\n\n\t/** port-forward command **/\n\n\tportFwd, err := PortForward(namespace, resource, localPort, kubePort, verbose)\n\tif err != nil {\n\t\treturn \"\", nil, err\n\t}\n\n\tlocalCtx, cancel := context.WithTimeout(ctx, defaultTimeout)\n\tdefer cancel()\n\n\t// wait for port-forward to be ready\n\tretryInterval := time.Millisecond * 250\n\tresult := make(chan string)\n\terrs := make(chan error)\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-localCtx.Done():\n\t\t\t\treturn\n\t\t\tdefault:\n\t\t\t}\n\t\t\tres, err := http.Get(\"http://localhost:\" + localPort + getPath)\n\t\t\tif err != nil {\n\t\t\t\terrs <- err\n\t\t\t\ttime.Sleep(retryInterval)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif res.StatusCode != 200 {\n\t\t\t\terrs <- errors.Errorf(\"invalid status code: %v %v\", res.StatusCode, res.Status)\n\t\t\t\ttime.Sleep(retryInterval)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tb, err := io.ReadAll(res.Body)\n\t\t\tif err != nil {\n\t\t\t\terrs <- err\n\t\t\t\ttime.Sleep(retryInterval)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tres.Body.Close()\n\t\t\tresult <- string(b)\n\t\t\treturn\n\t\t}\n\t}()\n\n\tvar multiErr *multierror.Error\n\tfor {\n\t\tselect {\n\t\tcase err := <-errs:\n\t\t\tmultiErr = multierror.Append(multiErr, err)\n\t\tcase res := <-result:\n\t\t\treturn res, portFwd, nil\n\t\tcase <-localCtx.Done():\n\t\t\tif portFwd.Process != nil {\n\t\t\t\tportFwd.Process.Kill()\n\t\t\t\tportFwd.Process.Release()\n\t\t\t}\n\t\t\treturn \"\", nil, errors.Errorf(\"timed out trying to connect to localhost during port-forward, errors: %v\", multiErr)\n\t\t}\n\t}\n\n}", "func GetProxyTransportFunc(p *config.Proxy) func(*http.Request) (*url.URL, error) {\n\treturn func(r *http.Request) (*url.URL, error) {\n\t\t// check no_proxy list first\n\t\tfor _, host := range p.NoProxy {\n\t\t\tif r.URL.Host == host {\n\t\t\t\tlog.Debugf(\"URL match no_proxy list item '%s': not using any proxy\", host)\n\t\t\t\treturn nil, nil\n\t\t\t}\n\t\t}\n\n\t\t// check proxy by scheme\n\t\tconfProxy := \"\"\n\t\tif r.URL.Scheme == \"http\" {\n\t\t\tconfProxy = p.HTTP\n\t\t} else if r.URL.Scheme == \"https\" {\n\t\t\tconfProxy = p.HTTPS\n\t\t} else {\n\t\t\tlog.Warnf(\"Proxy configuration do not support scheme '%s'\", r.URL.Scheme)\n\t\t}\n\n\t\tif confProxy != \"\" {\n\t\t\tproxyURL, err := url.Parse(confProxy)\n\t\t\tif err != nil {\n\t\t\t\terr := fmt.Errorf(\"Could not parse the proxy URL for scheme %s from configuration: %s\", r.URL.Scheme, err)\n\t\t\t\tlog.Error(err.Error())\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tuserInfo := \"\"\n\t\t\tif proxyURL.User != nil {\n\t\t\t\tif _, isSet := proxyURL.User.Password(); isSet {\n\t\t\t\t\tuserInfo = \"*****:*****@\"\n\t\t\t\t} else {\n\t\t\t\t\tuserInfo = \"*****@\"\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlog.Debugf(\"Using proxy %s://%s%s for URL '%s'\", proxyURL.Scheme, userInfo, proxyURL.Host, SanitizeURL(r.URL.String()))\n\t\t\treturn proxyURL, nil\n\t\t}\n\n\t\t// no proxy set for this request\n\t\treturn nil, nil\n\t}\n}", "func (pf *PortForwarder) ForwardPort(ctx context.Context, req *waterfall_grpc.PortForwardRequest) (*empty_pb.Empty, error) {\n\tpf.sessionsMutex.Lock()\n\tdefer pf.sessionsMutex.Unlock()\n\n\tlog.Printf(\"Forwarding %s -> %s ...\\n\", req.Session.Src, req.Session.Dst)\n\n\tkind, addr, err := parseAddr(req.Session.Src)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Parse dst even if we don't use it. No point in sending it the server if its malformed.\n\tif _, _, err := parseAddr(req.Session.Dst); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif s, ok := pf.sessions[req.Session.Src]; ok {\n\t\tif !req.Rebind {\n\t\t\treturn nil, status.Errorf(codes.AlreadyExists, \"no-rebind specified, can't forward address: %s\", req.Session.Src)\n\t\t}\n\n\t\tdelete(pf.sessions, req.Session.Src)\n\n\t\tif err := s.lis.Close(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tlis, err := net.Listen(kind, addr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// The context we create in this case is scoped to the duration of the forwarding\n\t// session, which outlives this request, therefore we can't propagate the request\n\t// context and are forced to create a new one.\n\tfCtx, cancel := context.WithCancel(context.Background())\n\n\tpf.sessions[req.Session.Src] = &forwardSession{src: req.Session.Src, dst: req.Session.Dst, lis: lis, cancel: cancel}\n\tgo func() {\n\t\tdefer cancel()\n\t\tdefer lis.Close()\n\t\tfor {\n\t\t\tconn, err := lis.Accept()\n\t\t\tif err != nil {\n\t\t\t\t// Theres really not much else we can do\n\t\t\t\tlog.Printf(\"Error accepting connection: %v\\n\", err)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tfwdr, err := makeForwarder(fCtx, pf.client, req.Session.Dst, conn)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"Error creating forwarder: %v\\n\", err)\n\t\t\t\tconn.Close()\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tgo fwdr.Forward()\n\t\t}\n\t}()\n\n\treturn &empty_pb.Empty{}, nil\n}", "func (sdk *MockGoSDKClient) GetSQLFirewallRule(ctx context.Context, resourceGroupName string, serverName string, ruleName string) (result sql.FirewallRule, err error) {\n\n\tvar sqlFirewallRule = sql.FirewallRule{\n\t\tResponse: helpers.GetRestResponse(http.StatusCreated),\n\t}\n\n\tsdk.FirewallRule = sqlFirewallRule\n\n\treturn sqlFirewallRule, nil\n}", "func (r RuleFunc) Match(src net.Addr) bool {\n\treturn r(src)\n}", "func httpGetForward(store *ForwardStore) func(w http.ResponseWriter, r *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tkey := mux.Vars(r)[\"uid\"]\n\t\tforward, _ := store.get(key)\n\t\tjson.NewEncoder(w).Encode(forward)\n\t}\n}", "func (o *ApplicationLoadBalancerForwardingRuleProperties) GetName() *string {\n\tif o == nil {\n\t\treturn nil\n\t}\n\n\treturn o.Name\n\n}", "func (s *Service) GetAffinityRule(affinityruleID string) (AffinityRule, error) {\n\tbody, err := s.getAffinityRuleResponseBody(affinityruleID)\n\n\treturn body.Data, err\n}" ]
[ "0.8240909", "0.77609396", "0.70552754", "0.63556665", "0.61485547", "0.5953888", "0.58903307", "0.58691484", "0.58524245", "0.5820308", "0.55974543", "0.55410576", "0.54871243", "0.5418713", "0.53457665", "0.52787864", "0.5263818", "0.5261169", "0.5219486", "0.5213991", "0.5142813", "0.5141375", "0.5084235", "0.50621367", "0.50500107", "0.50473356", "0.5018121", "0.5001428", "0.49931318", "0.4965451", "0.4922969", "0.49057963", "0.48986742", "0.48941946", "0.48788553", "0.4871295", "0.47953776", "0.4787632", "0.47858357", "0.47844264", "0.475335", "0.4745937", "0.4699441", "0.46949592", "0.4682777", "0.46635416", "0.46608737", "0.4652348", "0.46494246", "0.4648189", "0.46390107", "0.46172097", "0.45999327", "0.45854145", "0.4567907", "0.455841", "0.45539048", "0.45464143", "0.45375207", "0.4536358", "0.4535524", "0.45213196", "0.4519712", "0.4516253", "0.4485446", "0.4485416", "0.448273", "0.44802412", "0.44792846", "0.44766232", "0.4476183", "0.44741747", "0.44736", "0.4467796", "0.4459669", "0.44547588", "0.44471067", "0.44282833", "0.44221887", "0.43976533", "0.43935692", "0.43885767", "0.4382969", "0.43739143", "0.43660933", "0.43654278", "0.43633464", "0.43526718", "0.4348259", "0.43472096", "0.43273035", "0.43240458", "0.43167531", "0.43125576", "0.4302997", "0.42978236", "0.42972425", "0.42971072", "0.42970708", "0.4295882" ]
0.7841723
1
ListForwardingRules uses the override method ListForwardingRulesFn or the real implementation.
func (c *TestClient) ListForwardingRules(project, region string, opts ...ListCallOption) ([]*compute.ForwardingRule, error) { if c.ListForwardingRulesFn != nil { return c.ListForwardingRulesFn(project, region, opts...) } return c.client.ListForwardingRules(project, region, opts...) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (f *fakeLB) ListForwardingRules(_ context.Context, _ string, _ *govultr.ListOptions) ([]govultr.ForwardingRule, *govultr.Meta, *http.Response, error) {\n\treturn []govultr.ForwardingRule{{\n\t\t\tRuleID: \"1234\",\n\t\t\tFrontendProtocol: \"tcp\",\n\t\t\tFrontendPort: 80,\n\t\t\tBackendProtocol: \"tcp\",\n\t\t\tBackendPort: 80,\n\t\t}}, &govultr.Meta{\n\t\t\tTotal: 0,\n\t\t\tLinks: &govultr.Links{\n\t\t\t\tNext: \"\",\n\t\t\t\tPrev: \"\",\n\t\t\t},\n\t\t}, nil, nil\n}", "func (cli *OpsGenieUserV2Client) ListForwardingRules(req userv2.ListUserForwardingRulesRequest) (*userv2.ListUserForwardingRulesResponse, error) {\n\tvar response userv2.ListUserForwardingRulesResponse\n\terr := cli.sendGetRequest(&req, &response)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &response, nil\n}", "func (m *MockFirewallServiceIface) ListPortForwardingRules(p *ListPortForwardingRulesParams) (*ListPortForwardingRulesResponse, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListPortForwardingRules\", p)\n\tret0, _ := ret[0].(*ListPortForwardingRulesResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (mr *MockFirewallServiceIfaceMockRecorder) ListPortForwardingRules(p interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ListPortForwardingRules\", reflect.TypeOf((*MockFirewallServiceIface)(nil).ListPortForwardingRules), p)\n}", "func (f *fakeLB) ListFirewallRules(_ context.Context, _ string, _ *govultr.ListOptions) ([]govultr.LBFirewallRule, *govultr.Meta, *http.Response, error) {\n\treturn nil, nil, nil, nil\n}", "func (f *fakeLB) GetForwardingRule(_ context.Context, _, _ string) (*govultr.ForwardingRule, *http.Response, error) {\n\tpanic(\"implement me\")\n}", "func (pf *PortForwarder) List(ctx context.Context, req *empty_pb.Empty) (*waterfall_grpc.ForwardedSessions, error) {\n\tss := []*waterfall_grpc.ForwardSession{}\n\tfor _, s := range pf.sessions {\n\t\tss = append(ss, &waterfall_grpc.ForwardSession{Src: s.src, Dst: s.dst})\n\t}\n\treturn &waterfall_grpc.ForwardedSessions{Sessions: ss}, nil\n}", "func (r *Router) ListRules(w http.ResponseWriter, req *http.Request, _ httprouter.Params) {\n\tvar readableRules []config.RuleConfig\n\tfor _, s := range r.services {\n\t\tfor _, rule := range s.Proxy.GetRules() {\n\t\t\t// Convert to human-readable\n\t\t\tc := rule.ToConfig()\n\t\t\treadableRules = append(readableRules, c)\n\t\t}\n\t}\n\tlog.WithField(\"rules\", readableRules).Debug(\"List rules:\")\n\t// Write it out\n\te := json.NewEncoder(w)\n\tif e.Encode(readableRules) != nil {\n\t\tlog.Error(\"Error encoding router rules to JSON\")\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tw.Write([]byte(\"Encoding rules problem\"))\n\t}\n}", "func (pf *PortForwarder) List(ctx context.Context, req *empty_pb.Empty) (*waterfall_grpc_pb.ForwardedSessions, error) {\n\tss := []*waterfall_grpc_pb.ForwardSession{}\n\tfor _, s := range pf.sessions {\n\t\tss = append(ss, &waterfall_grpc_pb.ForwardSession{Src: s.src, Dst: s.dst})\n\t}\n\treturn &waterfall_grpc_pb.ForwardedSessions{Sessions: ss}, nil\n}", "func (ks *kuiperService) ListRules(ctx context.Context, token string, offset, limit uint64, name string, metadata Metadata) (RulesPage, error) {\n\tres, err := ks.auth.Identify(ctx, &mainflux.Token{Value: token})\n\tif err != nil {\n\t\treturn RulesPage{}, ErrUnauthorizedAccess\n\t}\n\n\treturn ks.rules.RetrieveAll(ctx, res.GetValue(), offset, limit, name, metadata)\n}", "func (c *TestClient) ListFirewallRules(project string, opts ...ListCallOption) ([]*compute.Firewall, error) {\n\tif c.ListFirewallRulesFn != nil {\n\t\treturn c.ListFirewallRulesFn(project, opts...)\n\t}\n\treturn c.client.ListFirewallRules(project, opts...)\n}", "func (in *DnsForwardingRuleSetsForwardingRuleList) DeepCopy() *DnsForwardingRuleSetsForwardingRuleList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DnsForwardingRuleSetsForwardingRuleList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (r *rulesRPCHandler) ListRules(ctx context.Context, req *api.ListReq) (*api.RuleList, error) {\n\trules := api.RuleList{}\n\tif err := clients[0].List(ctx, \"/rules\", &rules); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &rules, nil\n}", "func (m *MockIPTService) ListRules() []string {\n\treturn []string{}\n}", "func (fw IPtables) ListRules() ([]IPtablesRule, error) {\n\treturn fw.Store.listIPtablesRules()\n}", "func (f *fakeLB) DeleteForwardingRule(_ context.Context, _, _ string) error {\n\tpanic(\"implement me\")\n}", "func (sys *System) ListRules(ctx *Context, location string, includeInherited bool) ([]string, error) {\n\tthen := Now()\n\tatomic.AddUint64(&sys.stats.TotalCalls, uint64(1))\n\tatomic.AddUint64(&sys.stats.ListRules, uint64(1))\n\ttimer := NewTimer(ctx, \"SystemListRules\")\n\tdefer timer.Stop()\n\n\tloc, err := sys.findLocation(ctx, location, true)\n\tdefer sys.releaseLocation(ctx, location)\n\tvar ss []string\n\tif err == nil {\n\t\tMetric(ctx, \"System.ListRules\", \"location\", location)\n\t\tss, err = loc.ListRules(ctx, includeInherited)\n\t}\n\tif err != nil {\n\t\tLog(ERROR, ctx, \"System.ListRules\", \"location\", location)\n\t}\n\n\tatomic.AddUint64(&sys.stats.TotalTime, uint64(Now()-then))\n\treturn ss, sys.stats.IncErrors(err)\n}", "func Forward(in, out Link) rules.Rule {\n\treturn rules.Rule(fmt.Sprintf(\n\t\t\"-t filter -A fw-interfaces -j ACCEPT -i %v -o %v\",\n\t\tin.Name(), out.Name()))\n}", "func (g *Google) getForwardingRule() (*compute.ForwardingRule, error) {\n\treturn g.computeService.GlobalForwardingRules.Get(g.project, forwardingRuleName).Do()\n}", "func (rules *Rules) ListOfRules() []Rule {\n\treturn rules.list\n}", "func (m *MockFirewallServiceIface) NewListPortForwardingRulesParams() *ListPortForwardingRulesParams {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"NewListPortForwardingRulesParams\")\n\tret0, _ := ret[0].(*ListPortForwardingRulesParams)\n\treturn ret0\n}", "func (in *DnsForwardingRulesetList) DeepCopy() *DnsForwardingRulesetList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DnsForwardingRulesetList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (p *PortForward) List(ctx context.Context, _ string) ([]runtime.Object, error) {\n\tconfig, ok := ctx.Value(internal.KeyBenchCfg).(*config.Bench)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"no benchconfig found in context\")\n\t}\n\n\tcc := config.Benchmarks.Containers\n\too := make([]runtime.Object, 0, len(p.Factory.Forwarders()))\n\tfor _, f := range p.Factory.Forwarders() {\n\t\tcfg := render.BenchCfg{\n\t\t\tC: config.Benchmarks.Defaults.C,\n\t\t\tN: config.Benchmarks.Defaults.N,\n\t\t}\n\t\tif config, ok := cc[containerID(f.Path(), f.Container())]; ok {\n\t\t\tcfg.C, cfg.N = config.C, config.N\n\t\t\tcfg.Host, cfg.Path = config.HTTP.Host, config.HTTP.Path\n\t\t}\n\t\too = append(oo, render.ForwardRes{\n\t\t\tForwarder: f,\n\t\t\tConfig: cfg,\n\t\t})\n\t}\n\n\treturn oo, nil\n}", "func (rs *RuleSet) ListRules() (rules []Rule, err error) {\n\treturn rs.Rules, nil\n}", "func (s *NamespaceWebhook) Rules() []admissionregv1.RuleWithOperations { return rules }", "func (client *Client) ListRules(request *ListRulesRequest) (_result *ListRulesResponse, _err error) {\n\truntime := &util.RuntimeOptions{}\n\t_result = &ListRulesResponse{}\n\t_body, _err := client.ListRulesWithOptions(request, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_result = _body\n\treturn _result, _err\n}", "func (c *TestClient) GetForwardingRule(project, region, name string) (*compute.ForwardingRule, error) {\n\tif c.GetForwardingRuleFn != nil {\n\t\treturn c.GetForwardingRuleFn(project, region, name)\n\t}\n\treturn c.client.GetForwardingRule(project, region, name)\n}", "func (t *Topology) Rules(cni, iptablesForwardRule bool) iptables.RuleSet {\n\trules := iptables.RuleSet{}\n\trules.AddToAppend(iptables.NewIPv4Chain(\"nat\", \"KILO-NAT\"))\n\trules.AddToAppend(iptables.NewIPv6Chain(\"nat\", \"KILO-NAT\"))\n\tif cni {\n\t\trules.AddToPrepend(iptables.NewRule(iptables.GetProtocol(t.subnet.IP), \"nat\", \"POSTROUTING\", \"-s\", t.subnet.String(), \"-m\", \"comment\", \"--comment\", \"Kilo: jump to KILO-NAT chain\", \"-j\", \"KILO-NAT\"))\n\t\t// Some linux distros or docker will set forward DROP in the filter table.\n\t\t// To still be able to have pod to pod communication we need to ALLOW packets from and to pod CIDRs within a location.\n\t\t// Leader nodes will forward packets from all nodes within a location because they act as a gateway for them.\n\t\t// Non leader nodes only need to allow packages from and to their own pod CIDR.\n\t\tif iptablesForwardRule && t.leader {\n\t\t\tfor _, s := range t.segments {\n\t\t\t\tif s.location == t.location {\n\t\t\t\t\t// Make sure packets to and from pod cidrs are not dropped in the forward chain.\n\t\t\t\t\tfor _, c := range s.cidrs {\n\t\t\t\t\t\trules.AddToPrepend(iptables.NewRule(iptables.GetProtocol(c.IP), \"filter\", \"FORWARD\", \"-m\", \"comment\", \"--comment\", \"Kilo: forward packets from the pod subnet\", \"-s\", c.String(), \"-j\", \"ACCEPT\"))\n\t\t\t\t\t\trules.AddToPrepend(iptables.NewRule(iptables.GetProtocol(c.IP), \"filter\", \"FORWARD\", \"-m\", \"comment\", \"--comment\", \"Kilo: forward packets to the pod subnet\", \"-d\", c.String(), \"-j\", \"ACCEPT\"))\n\t\t\t\t\t}\n\t\t\t\t\t// Make sure packets to and from allowed location IPs are not dropped in the forward chain.\n\t\t\t\t\tfor _, c := range s.allowedLocationIPs {\n\t\t\t\t\t\trules.AddToPrepend(iptables.NewRule(iptables.GetProtocol(c.IP), \"filter\", \"FORWARD\", \"-m\", \"comment\", \"--comment\", \"Kilo: forward packets from allowed location IPs\", \"-s\", c.String(), \"-j\", \"ACCEPT\"))\n\t\t\t\t\t\trules.AddToPrepend(iptables.NewRule(iptables.GetProtocol(c.IP), \"filter\", \"FORWARD\", \"-m\", \"comment\", \"--comment\", \"Kilo: forward packets to allowed location IPs\", \"-d\", c.String(), \"-j\", \"ACCEPT\"))\n\t\t\t\t\t}\n\t\t\t\t\t// Make sure packets to and from private IPs are not dropped in the forward chain.\n\t\t\t\t\tfor _, c := range s.privateIPs {\n\t\t\t\t\t\trules.AddToPrepend(iptables.NewRule(iptables.GetProtocol(c), \"filter\", \"FORWARD\", \"-m\", \"comment\", \"--comment\", \"Kilo: forward packets from private IPs\", \"-s\", oneAddressCIDR(c).String(), \"-j\", \"ACCEPT\"))\n\t\t\t\t\t\trules.AddToPrepend(iptables.NewRule(iptables.GetProtocol(c), \"filter\", \"FORWARD\", \"-m\", \"comment\", \"--comment\", \"Kilo: forward packets to private IPs\", \"-d\", oneAddressCIDR(c).String(), \"-j\", \"ACCEPT\"))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else if iptablesForwardRule {\n\t\t\trules.AddToPrepend(iptables.NewRule(iptables.GetProtocol(t.subnet.IP), \"filter\", \"FORWARD\", \"-m\", \"comment\", \"--comment\", \"Kilo: forward packets from the node's pod subnet\", \"-s\", t.subnet.String(), \"-j\", \"ACCEPT\"))\n\t\t\trules.AddToPrepend(iptables.NewRule(iptables.GetProtocol(t.subnet.IP), \"filter\", \"FORWARD\", \"-m\", \"comment\", \"--comment\", \"Kilo: forward packets to the node's pod subnet\", \"-d\", t.subnet.String(), \"-j\", \"ACCEPT\"))\n\t\t}\n\t}\n\tfor _, s := range t.segments {\n\t\trules.AddToPrepend(iptables.NewRule(iptables.GetProtocol(s.wireGuardIP), \"nat\", \"KILO-NAT\", \"-d\", oneAddressCIDR(s.wireGuardIP).String(), \"-m\", \"comment\", \"--comment\", \"Kilo: do not NAT packets destined for WireGuared IPs\", \"-j\", \"RETURN\"))\n\t\tfor _, aip := range s.allowedIPs {\n\t\t\trules.AddToPrepend(iptables.NewRule(iptables.GetProtocol(aip.IP), \"nat\", \"KILO-NAT\", \"-d\", aip.String(), \"-m\", \"comment\", \"--comment\", \"Kilo: do not NAT packets destined for known IPs\", \"-j\", \"RETURN\"))\n\t\t}\n\t\t// Make sure packets to allowed location IPs go through the KILO-NAT chain, so they can be MASQUERADEd,\n\t\t// Otherwise packets to these destinations will reach the destination, but never find their way back.\n\t\t// We only want to NAT in locations of the corresponding allowed location IPs.\n\t\tif t.location == s.location {\n\t\t\tfor _, alip := range s.allowedLocationIPs {\n\t\t\t\trules.AddToPrepend(iptables.NewRule(iptables.GetProtocol(alip.IP), \"nat\", \"POSTROUTING\", \"-d\", alip.String(), \"-m\", \"comment\", \"--comment\", \"Kilo: jump to NAT chain\", \"-j\", \"KILO-NAT\"))\n\t\t\t}\n\t\t}\n\t}\n\tfor _, p := range t.peers {\n\t\tfor _, aip := range p.AllowedIPs {\n\t\t\trules.AddToPrepend(iptables.NewRule(iptables.GetProtocol(aip.IP), \"nat\", \"POSTROUTING\", \"-s\", aip.String(), \"-m\", \"comment\", \"--comment\", \"Kilo: jump to NAT chain\", \"-j\", \"KILO-NAT\"))\n\t\t\trules.AddToPrepend(iptables.NewRule(iptables.GetProtocol(aip.IP), \"nat\", \"KILO-NAT\", \"-d\", aip.String(), \"-m\", \"comment\", \"--comment\", \"Kilo: do not NAT packets destined for peers\", \"-j\", \"RETURN\"))\n\t\t}\n\t}\n\tfor _, s := range t.serviceCIDRs {\n\t\trules.AddToAppend(iptables.NewRule(iptables.GetProtocol(s.IP), \"nat\", \"KILO-NAT\", \"-d\", s.String(), \"-m\", \"comment\", \"--comment\", \"Kilo: do not NAT packets destined for service CIDRs\", \"-j\", \"RETURN\"))\n\t}\n\trules.AddToAppend(iptables.NewIPv4Rule(\"nat\", \"KILO-NAT\", \"-m\", \"comment\", \"--comment\", \"Kilo: NAT remaining packets\", \"-j\", \"MASQUERADE\"))\n\trules.AddToAppend(iptables.NewIPv6Rule(\"nat\", \"KILO-NAT\", \"-m\", \"comment\", \"--comment\", \"Kilo: NAT remaining packets\", \"-j\", \"MASQUERADE\"))\n\treturn rules\n}", "func (f *fakeLB) CreateForwardingRule(_ context.Context, _ string, _ *govultr.ForwardingRule) (*govultr.ForwardingRule, *http.Response, error) {\n\tpanic(\"implement me\")\n}", "func Rules() []C.Rule {\n\treturn rules\n}", "func (m *MockFirewallServiceIface) ListFirewallRules(p *ListFirewallRulesParams) (*ListFirewallRulesResponse, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListFirewallRules\", p)\n\tret0, _ := ret[0].(*ListFirewallRulesResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (c *Client) ListRule(args *ListRuleArgs) (*ListRuleResult, error) {\n\tjsonBytes, jsonErr := json.Marshal(args)\n\tif jsonErr != nil {\n\t\treturn nil, jsonErr\n\t}\n\tbody, err := bce.NewBodyFromBytes(jsonBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ListRule(c, body)\n}", "func (mr *MockFirewallServiceIfaceMockRecorder) NewListPortForwardingRulesParams() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"NewListPortForwardingRulesParams\", reflect.TypeOf((*MockFirewallServiceIface)(nil).NewListPortForwardingRulesParams))\n}", "func (client FirewallPolicyRuleGroupsClient) List(ctx context.Context, resourceGroupName string, firewallPolicyName string) (result FirewallPolicyRuleGroupListResultPage, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/FirewallPolicyRuleGroupsClient.List\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.fprglr.Response.Response != nil {\n\t\t\t\tsc = result.fprglr.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tresult.fn = client.listNextResults\n\treq, err := client.ListPreparer(ctx, resourceGroupName, firewallPolicyName)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.FirewallPolicyRuleGroupsClient\", \"List\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.ListSender(req)\n\tif err != nil {\n\t\tresult.fprglr.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"network.FirewallPolicyRuleGroupsClient\", \"List\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult.fprglr, err = client.ListResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.FirewallPolicyRuleGroupsClient\", \"List\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\tif result.fprglr.hasNextLink() && result.fprglr.IsEmpty() {\n\t\terr = result.NextWithContext(ctx)\n\t\treturn\n\t}\n\n\treturn\n}", "func (s *prometheusruleWebhook) Rules() []admissionregv1.RuleWithOperations {\n\treturn rules\n}", "func ipForwardingBroken(routes []netaddr.IPPrefix) bool {\n\tif len(routes) == 0 {\n\t\t// Nothing to route, so no need to warn.\n\t\treturn false\n\t}\n\n\tif runtime.GOOS != \"linux\" {\n\t\t// We only do subnet routing on Linux for now.\n\t\t// It might work on darwin/macOS when building from source, so\n\t\t// don't return true for other OSes. We can OS-based warnings\n\t\t// already in the admin panel.\n\t\treturn false\n\t}\n\n\tv4Routes, v6Routes := false, false\n\tfor _, r := range routes {\n\t\tif r.IP.Is4() {\n\t\t\tv4Routes = true\n\t\t} else {\n\t\t\tv6Routes = true\n\t\t}\n\t}\n\n\tif v4Routes {\n\t\tout, err := ioutil.ReadFile(\"/proc/sys/net/ipv4/ip_forward\")\n\t\tif err != nil {\n\t\t\t// Try another way.\n\t\t\tout, err = exec.Command(\"sysctl\", \"-n\", \"net.ipv4.ip_forward\").Output()\n\t\t}\n\t\tif err != nil {\n\t\t\t// Oh well, we tried. This is just for debugging.\n\t\t\t// We don't want false positives.\n\t\t\t// TODO: maybe we want a different warning for inability to check?\n\t\t\treturn false\n\t\t}\n\t\tif strings.TrimSpace(string(out)) == \"0\" {\n\t\t\treturn true\n\t\t}\n\t}\n\tif v6Routes {\n\t\t// Note: you might be wondering why we check only the state of\n\t\t// conf.all.forwarding, rather than per-interface forwarding\n\t\t// configuration. According to kernel documentation, it seems\n\t\t// that to actually forward packets, you need to enable\n\t\t// forwarding globally, and the per-interface forwarding\n\t\t// setting only alters other things such as how router\n\t\t// advertisements are handled. The kernel itself warns that\n\t\t// enabling forwarding per-interface and not globally will\n\t\t// probably not work, so I feel okay calling those configs\n\t\t// broken until we have proof otherwise.\n\t\tout, err := ioutil.ReadFile(\"/proc/sys/net/ipv6/conf/all/forwarding\")\n\t\tif err != nil {\n\t\t\tout, err = exec.Command(\"sysctl\", \"-n\", \"net.ipv6.conf.all.forwarding\").Output()\n\t\t}\n\t\tif err != nil {\n\t\t\t// Oh well, we tried. This is just for debugging.\n\t\t\t// We don't want false positives.\n\t\t\t// TODO: maybe we want a different warning for inability to check?\n\t\t\treturn false\n\t\t}\n\t\tif strings.TrimSpace(string(out)) == \"0\" {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "func (mr *MockInterfaceMockRecorder) ListRules(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ListRules\", reflect.TypeOf((*MockInterface)(nil).ListRules), arg0, arg1)\n}", "func ApplRules() {\n\tipt, err := iptables.New()\n\n\tchain := \"GUO_OPENSHIFT_INPUT\"\n\t// Saving the list of chains before executing tests\n\t// chain now exists\t\n\terr = ipt.ClearChain(\"filter\", chain)\n\tif err != nil {\n\t\tlog.Warnf(\"ClearChain (of empty) failed: %v\", err)\n\t} else {\n\t\tlog.Infof(\"ClearChain done: %v\", chain)\n\t}\n\n\tlistChain, err := ipt.ListChains(\"filter\")\n\tif err != nil {\n\t\tfmt.Printf(\"ListChains of Initial failed: %v\", err)\n\t} else {\n\t\tlog.Infof(\"List Chain works: %v\", chain)\n\t}\n\n\t// check that chain is fully gone and that state similar to initial one\n\tlistChain, err = ipt.ListChains(\"filter\")\n\tif err != nil {\n\t\tfmt.Printf(\"ListChains failed: %v\", err)\n\t} else {\n\t\tlog.Infof(\"List Chain works: %v\", listChain)\n\t}\n\n\tfwRules := firewallRule{chain: \"GUO_OPENSHIFT_INPUT\", rule: []string{\"-p\", \"tcp\", \"--dport\", \"22\", \"-m\", \"conntrack\", \"--ctstate\", \"NEW,ESTABLISHED\", \"-j\", \"ACCEPT\", \"-m\", \"comment\", \"--comment\", \"\\\"tkggo test\\\"\"}}\n\tfwRules1 := firewallRule{chain: \"GUO_OPENSHIFT_INPUT\", rule: []string{\"-p\", \"tcp\", \"--dport\", \"23\", \"-m\", \"conntrack\", \"--ctstate\", \"NEW,ESTABLISHED\", \"-j\", \"ACCEPT\", \"-m\", \"comment\", \"--comment\", \"\\\"tkggo test 23\\\"\"}}\n\tfwRuelSet := firewallRules{[]firewallRule{fwRules, fwRules1}}\n\n\tfor _, rr := range fwRuelSet.rules {\n\t\tlog.Infoln(rr.chain, rr.rule)\n\t\terr = ipt.AppendUnique(\"filter\", rr.chain, rr.rule...)\n\t\tif err != nil {\n\t\t\tlog.Warnf(\"Append failed: %v\", err)\n\t\t} else {\n\t\t\tlog.Infof(\"LisAppend works: %v, %v\", fwRules.chain, fwRules.rule)\n\t\t}\n\t}\n\n\tstats, err := ipt.Stats(\"filter\", chain)\n\tif err != nil {\n\t\tfmt.Printf(\"stats failed: %v\", err)\n\t}\n\tfmt.Println(\"================>>\")\n\tfmt.Println(stats)\n\n}", "func (client *Client) ListRulesWithOptions(request *ListRulesRequest, runtime *util.RuntimeOptions) (_result *ListRulesResponse, _err error) {\n\t_err = util.ValidateModel(request)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_result = &ListRulesResponse{}\n\t_body, _err := client.DoRequest(tea.String(\"listRules\"), tea.String(\"HTTP\"), tea.String(\"POST\"), tea.String(\"/openapi/listRules\"), nil, tea.ToMap(request), 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 (kl *Kubelet) syncIPTablesRules(iptClient utiliptables.Interface) bool {\n\t// Create hint chain so other components can see whether we are using iptables-legacy\n\t// or iptables-nft.\n\tif _, err := iptClient.EnsureChain(utiliptables.TableMangle, KubeIPTablesHintChain); err != nil {\n\t\tklog.ErrorS(err, \"Failed to ensure that iptables hint chain exists\")\n\t\treturn false\n\t}\n\n\tif !iptClient.IsIPv6() { // ipv6 doesn't have this issue\n\t\t// Set up the KUBE-FIREWALL chain and martian packet protection rule.\n\t\t// (See below.)\n\n\t\t// NOTE: kube-proxy (in iptables mode) creates an identical copy of this\n\t\t// rule. If you want to change this rule in the future, you MUST do so in\n\t\t// a way that will interoperate correctly with skewed versions of the rule\n\t\t// created by kube-proxy.\n\n\t\tif _, err := iptClient.EnsureChain(utiliptables.TableFilter, KubeFirewallChain); err != nil {\n\t\t\tklog.ErrorS(err, \"Failed to ensure that filter table KUBE-FIREWALL chain exists\")\n\t\t\treturn false\n\t\t}\n\n\t\tif _, err := iptClient.EnsureRule(utiliptables.Prepend, utiliptables.TableFilter, utiliptables.ChainOutput, \"-j\", string(KubeFirewallChain)); err != nil {\n\t\t\tklog.ErrorS(err, \"Failed to ensure that OUTPUT chain jumps to KUBE-FIREWALL\")\n\t\t\treturn false\n\t\t}\n\t\tif _, err := iptClient.EnsureRule(utiliptables.Prepend, utiliptables.TableFilter, utiliptables.ChainInput, \"-j\", string(KubeFirewallChain)); err != nil {\n\t\t\tklog.ErrorS(err, \"Failed to ensure that INPUT chain jumps to KUBE-FIREWALL\")\n\t\t\treturn false\n\t\t}\n\n\t\t// Kube-proxy's use of `route_localnet` to enable NodePorts on localhost\n\t\t// creates a security hole (https://issue.k8s.io/90259) which this\n\t\t// iptables rule mitigates. This rule should have been added to\n\t\t// kube-proxy, but it mistakenly ended up in kubelet instead, and we are\n\t\t// keeping it in kubelet for now in case other third-party components\n\t\t// depend on it.\n\t\tif _, err := iptClient.EnsureRule(utiliptables.Append, utiliptables.TableFilter, KubeFirewallChain,\n\t\t\t\"-m\", \"comment\", \"--comment\", \"block incoming localnet connections\",\n\t\t\t\"--dst\", \"127.0.0.0/8\",\n\t\t\t\"!\", \"--src\", \"127.0.0.0/8\",\n\t\t\t\"-m\", \"conntrack\",\n\t\t\t\"!\", \"--ctstate\", \"RELATED,ESTABLISHED,DNAT\",\n\t\t\t\"-j\", \"DROP\"); err != nil {\n\t\t\tklog.ErrorS(err, \"Failed to ensure rule to drop invalid localhost packets in filter table KUBE-FIREWALL chain\")\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "func GetRules() []Rule {\n\tupdateMux.RLock()\n\trules := rulesFrom(breakerRules)\n\tupdateMux.RUnlock()\n\tret := make([]Rule, 0, len(rules))\n\tfor _, rule := range rules {\n\t\tret = append(ret, *rule)\n\t}\n\treturn ret\n}", "func (m *RuleConfigManager) List(opts ...RequestOption) (r []*RuleConfig, err error) {\n\terr = m.Request(\"GET\", m.URI(\"rules-configs\"), &r, applyListDefaults(opts))\n\treturn\n}", "func (s *dnsRuleLister) List(selector labels.Selector) (ret []*v1.DnsRule, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1.DnsRule))\n\t})\n\treturn ret, err\n}", "func (ruleset *DnsForwardingRuleset) updateValidations() []func(old runtime.Object) (admission.Warnings, error) {\n\treturn []func(old runtime.Object) (admission.Warnings, error){\n\t\tfunc(old runtime.Object) (admission.Warnings, error) {\n\t\t\treturn ruleset.validateResourceReferences()\n\t\t},\n\t\truleset.validateWriteOnceProperties}\n}", "func (c *CloudWatchEvents) ListRules(input *ListRulesInput) (*ListRulesOutput, error) {\n\treq, out := c.ListRulesRequest(input)\n\terr := req.Send()\n\treturn out, err\n}", "func (s *proxyRouteLister) List(selector labels.Selector) (ret []*v1alpha1.ProxyRoute, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.ProxyRoute))\n\t})\n\treturn ret, err\n}", "func (fw *IPtables) makeRules(netif FirewallEndpoint) error {\n\tlog.Infof(\"In makeRules() with %s\", netif.GetName())\n\n\tvar err error\n\tfw.u32filter, fw.chainPrefix, err = fw.prepareU32Rules(netif.GetIP())\n\tif err != nil {\n\t\t// TODO need personalized error here, or even panic\n\t\treturn err\n\t}\n\tfw.interfaceName = netif.GetName()\n\n\tfw.chains = append(fw.chains, IPtablesChain{\n\t\tBaseChain: \"INPUT\",\n\t\tDirections: []string{\"i\"},\n\t\tChainName: \"ROMANA-INPUT\",\n\t})\n\tfw.chains = append(fw.chains, IPtablesChain{\n\t\tBaseChain: \"OUTPUT\",\n\t\tDirections: []string{\"o\"},\n\t\tChainName: \"ROMANA-FORWARD-IN\",\n\t})\n\tfw.chains = append(fw.chains, IPtablesChain{\n\t\tBaseChain: \"FORWARD\",\n\t\tDirections: []string{\"i\"},\n\t\tChainName: \"ROMANA-FORWARD-OUT\",\n\t})\n\tfw.chains = append(fw.chains, IPtablesChain{\n\t\tBaseChain: \"FORWARD\",\n\t\tDirections: []string{\"o\"},\n\t\t// Using ROMANA-FORWARD-IN second time to capture both\n\t\t// traffic from host to endpoint and\n\t\t// traffic from endpoint to another endpoint.\n\t\tChainName: \"ROMANA-FORWARD-IN\",\n\t})\n\n\tlog.Infof(\"In makeRules() created chains %v\", fw.chains)\n\treturn nil\n}", "func forwardFunc(\n\tname string,\n\tforwardProcessors []*RunningProcessor,\n\tforwardSinks []*RunningSink,\n) func(optic.Event) {\n\n\tlenFilters := len(forwardProcessors)\n\tlenSinks := len(forwardSinks)\n\tlenForwards := lenFilters + lenSinks\n\n\tswitch {\n\tcase lenForwards == 1:\n\t\tif lenFilters == 1 {\n\t\t\treturn func(event optic.Event) {\n\t\t\t\tforwardProcessors[0].ForwardEvent(event)\n\t\t\t}\n\t\t}\n\t\treturn func(event optic.Event) {\n\t\t\tforwardSinks[0].WriteEvent(event)\n\t\t}\n\tcase lenForwards > 1:\n\t\tswitch {\n\t\tcase lenFilters == 1 && lenSinks == 1:\n\t\t\treturn func(event optic.Event) {\n\t\t\t\tforwardProcessors[0].ForwardEvent(event.Copy())\n\t\t\t\tforwardSinks[0].WriteEvent(event)\n\t\t\t}\n\t\tcase lenFilters > 0 && lenSinks > 0:\n\t\t\treturn func(event optic.Event) {\n\t\t\t\tfor _, ff := range forwardProcessors {\n\t\t\t\t\tff.ForwardEvent(event.Copy())\n\t\t\t\t}\n\t\t\t\tfor i, fs := range forwardSinks {\n\t\t\t\t\tif i == lenSinks-1 {\n\t\t\t\t\t\tfs.WriteEvent(event)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfs.WriteEvent(event.Copy())\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tcase lenFilters > 0:\n\t\t\treturn func(event optic.Event) {\n\t\t\t\tfor i, ff := range forwardProcessors {\n\t\t\t\t\tif i == lenFilters-1 {\n\t\t\t\t\t\tff.ForwardEvent(event)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tff.ForwardEvent(event.Copy())\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tcase lenSinks > 0:\n\t\t\treturn func(event optic.Event) {\n\t\t\t\tfor i, fs := range forwardSinks {\n\t\t\t\t\tif i == lenSinks-1 {\n\t\t\t\t\t\tfs.WriteEvent(event)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfs.WriteEvent(event.Copy())\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tlog.Printf(\"INFO [%s] will not forward events anywhere.\", name)\n\n\treturn func(event optic.Event) {\n\t\t// no-op\n\t}\n}", "func NewForwardingRule(ctx *pulumi.Context,\n\tname string, args *ForwardingRuleArgs, opts ...pulumi.ResourceOption) (*ForwardingRule, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.AcceleratorId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'AcceleratorId'\")\n\t}\n\tif args.ListenerId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ListenerId'\")\n\t}\n\tif args.RuleActions == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'RuleActions'\")\n\t}\n\tif args.RuleConditions == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'RuleConditions'\")\n\t}\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource ForwardingRule\n\terr := ctx.RegisterResource(\"alicloud:ga/forwardingRule:ForwardingRule\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (m *MockInterface) ListRules(arg0, arg1 string) ([]string, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListRules\", arg0, arg1)\n\tret0, _ := ret[0].([]string)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (s *AccessRuleService) List(path string, depth int, ancestors bool) ([]*api.AccessRule, error) {\n\treturn s.Lister.List(path, depth, ancestors)\n}", "func (mr *MockFirewallServiceIfaceMockRecorder) ListFirewallRules(p interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ListFirewallRules\", reflect.TypeOf((*MockFirewallServiceIface)(nil).ListFirewallRules), p)\n}", "func (f *Forward) Forward(state request.Request) (*dns.Msg, error) {\n\tif f == nil {\n\t\treturn nil, ErrNoForward\n\t}\n\n\tfails := 0\n\tvar upstreamErr error\n\tfor _, proxy := range f.List() {\n\t\tif proxy.Down(f.maxfails) {\n\t\t\tfails++\n\t\t\tif fails < len(f.proxies) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// All upstream proxies are dead, assume healtcheck is complete broken and randomly\n\t\t\t// select an upstream to connect to.\n\t\t\tproxy = f.List()[0]\n\t\t}\n\n\t\tret, err := proxy.Connect(context.Background(), state, f.opts)\n\n\t\tret, err = truncated(state, ret, err)\n\t\tupstreamErr = err\n\n\t\tif err != nil {\n\t\t\tif fails < len(f.proxies) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\n\t\t// Check if the reply is correct; if not return FormErr.\n\t\tif !state.Match(ret) {\n\t\t\treturn state.ErrorMessage(dns.RcodeFormatError), nil\n\t\t}\n\n\t\treturn ret, err\n\t}\n\n\tif upstreamErr != nil {\n\t\treturn nil, upstreamErr\n\t}\n\n\treturn nil, ErrNoHealthy\n}", "func BandwidthLimitRulesList(c *gophercloud.ServiceClient, policyID string, opts BandwidthLimitRulesListOptsBuilder) pagination.Pager {\n\turl := listBandwidthLimitRulesURL(c, policyID)\n\tif opts != nil {\n\t\tquery, err := opts.ToBandwidthLimitRulesListQuery()\n\t\tif err != nil {\n\t\t\treturn pagination.Pager{Err: err}\n\t\t}\n\t\turl += query\n\t}\n\treturn pagination.NewPager(c, url, func(r pagination.PageResult) pagination.Page {\n\t\treturn BandwidthLimitRulePage{pagination.LinkedPageBase{PageResult: r}}\n\n\t})\n}", "func (m *MockFirewallServiceIface) ListIpv6FirewallRules(p *ListIpv6FirewallRulesParams) (*ListIpv6FirewallRulesResponse, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListIpv6FirewallRules\", p)\n\tret0, _ := ret[0].(*ListIpv6FirewallRulesResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (o *AggregatedDomain) ForwardingPathLists(info *bambou.FetchingInfo) (ForwardingPathListsList, *bambou.Error) {\n\n\tvar list ForwardingPathListsList\n\terr := bambou.CurrentSession().FetchChildren(o, ForwardingPathListIdentity, &list, info)\n\treturn list, err\n}", "func (la *Lattice) Forward(m TokenizeMode) {\n\tfor i, size := 1, len(la.list); i < size; i++ {\n\t\tcurrentList := la.list[i]\n\t\tfor index, target := range currentList {\n\t\t\tprevList := la.list[target.Start]\n\t\t\tif len(prevList) == 0 {\n\t\t\t\tla.list[i][index].Cost = maximumCost\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor j, n := range prevList {\n\t\t\t\tvar c int16\n\t\t\t\tif n.Class != USER && target.Class != USER {\n\t\t\t\t\tc = la.dic.Connection.At(int(n.Right), int(target.Left))\n\t\t\t\t}\n\t\t\t\ttotalCost := int64(c) + int64(target.Weight) + int64(n.Cost)\n\t\t\t\tif m != Normal {\n\t\t\t\t\ttotalCost += int64(additionalCost(n))\n\t\t\t\t}\n\t\t\t\tif totalCost > maximumCost {\n\t\t\t\t\ttotalCost = maximumCost\n\t\t\t\t}\n\t\t\t\tif j == 0 || int32(totalCost) < la.list[i][index].Cost {\n\t\t\t\t\tla.list[i][index].Cost = int32(totalCost)\n\t\t\t\t\tla.list[i][index].prev = la.list[target.Start][j]\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "func (h *IptablesUtilsHandler) IptablesListRules(table string, chain string) ([]string, error) {\n\tiptablesObject, err := iptables.New()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trules, err := iptablesObject.List(table, chain)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// ignore rule of chain creation\n\treturn rules[1:], nil\n}", "func (s *AccessRuleLister) List(path string, depth int, ancestors bool) ([]*api.AccessRule, error) {\n\ts.ArgPath = path\n\ts.ArgDepth = depth\n\ts.ArgAncestors = ancestors\n\treturn s.ReturnsAccessRules, s.Err\n}", "func (in *DnsForwardingRuleSetsForwardingRule) DeepCopy() *DnsForwardingRuleSetsForwardingRule {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(DnsForwardingRuleSetsForwardingRule)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (handler *referralHandler) List(ctx context.Context, req *proto.ReferralListRequest, rsp *proto.ReferralPartnerList) (err error) {\n\tuserId := req.GetId()\n\tpage := req.GetPage()\n\n\tdata := []*proto.ReferralPartner{}\n\n\terr = handler.storage.GetReferralStatus(&data, userId, page)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trsp.Data = data\n\n\treturn nil\n}", "func (c *kaosRules) List(opts meta_v1.ListOptions) (result *v1.KaosRuleList, err error) {\n\tresult = &v1.KaosRuleList{}\n\terr = c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"kaosrules\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tDo().\n\t\tInto(result)\n\treturn\n}", "func (c *Client) ListRulesPackages(ctx context.Context, params *ListRulesPackagesInput, optFns ...func(*Options)) (*ListRulesPackagesOutput, error) {\n\tif params == nil {\n\t\tparams = &ListRulesPackagesInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"ListRulesPackages\", params, optFns, addOperationListRulesPackagesMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*ListRulesPackagesOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "func (c *snapshotRules) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.SnapshotRuleList, err error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\tresult = &v1alpha1.SnapshotRuleList{}\n\terr = c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"snapshotrules\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tDo(ctx).\n\t\tInto(result)\n\treturn\n}", "func (m *MockLoadBalancerServiceIface) ListLoadBalancerRules(p *ListLoadBalancerRulesParams) (*ListLoadBalancerRulesResponse, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListLoadBalancerRules\", p)\n\tret0, _ := ret[0].(*ListLoadBalancerRulesResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (s proxyRouteNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.ProxyRoute, err error) {\n\terr = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.ProxyRoute))\n\t})\n\treturn ret, 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 getIPForwardEntries() ([]ipForwardEntry, error) {\n\treturn nil, errors.New(\"getIPForwardEntries unimplemented on non Windows systems\")\n}", "func (api *API) ListWAFRules(zoneID, packageID string) ([]WAFRule, error) {\n\tvar r WAFRulesResponse\n\tvar rules []WAFRule\n\tvar res []byte\n\tvar err error\n\turi := \"/zones/\" + zoneID + \"/firewall/waf/packages/\" + packageID + \"/rules\"\n\tres, err = api.makeRequest(\"GET\", uri, nil)\n\tif err != nil {\n\t\treturn []WAFRule{}, errors.Wrap(err, errMakeRequestError)\n\t}\n\terr = json.Unmarshal(res, &r)\n\tif err != nil {\n\t\treturn []WAFRule{}, errors.Wrap(err, errUnmarshalError)\n\t}\n\tif !r.Success {\n\t\t// TODO: Provide an actual error message instead of always returning nil\n\t\treturn []WAFRule{}, err\n\t}\n\tfor ri := range r.Result {\n\t\trules = append(rules, r.Result[ri])\n\t}\n\treturn rules, nil\n}", "func ParseForwardPorts(h IptablesHandler, nat string, chain string) ([]int, error) {\n\trules, err := h.IptablesListRules(nat, chain)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treason := \"\"\n\tports := make([]int, 0)\n\tfor _, rule := range rules {\n\t\tflags := pflag.NewFlagSet(\"iptables-flag\", pflag.ContinueOnError)\n\t\tflags.ParseErrorsWhitelist.UnknownFlags = true\n\t\tforwardPort := flags.Int(\"dport\", 0, \"\")\n\t\terr := flags.Parse(strings.Split(rule, \" \"))\n\t\tif err != nil {\n\t\t\treason = fmt.Sprintf(\"%s; %s\", reason, err.Error())\n\t\t} else if *forwardPort != 0 {\n\t\t\tports = append(ports, *forwardPort)\n\t\t}\n\t}\n\n\treturn ports, nil\n}", "func (f Forwarder) Forward() error {\n\terrs := []string{}\n\tfor container := range f.Config.Forwards {\n\t\terr := f.ForwardContainer(container)\n\t\tif err != nil {\n\t\t\terrs = append(errs, container)\n\t\t}\n\t}\n\n\tvar err error\n\tif len(errs) > 0 {\n\t\terr = fmt.Errorf(\"Unable to forward ports for containers %s\", strings.Join(errs, \", \"))\n\t}\n\treturn err\n}", "func (o *AggregatedDomain) CreateForwardingPathList(child *ForwardingPathList) *bambou.Error {\n\n\treturn bambou.CurrentSession().CreateChild(o, child)\n}", "func (r *FirewallGlobalRulesStagedPolicyRulesResource) ListAll() (*FirewallGlobalRulesStagedPolicyRulesConfigList, error) {\n\tvar list FirewallGlobalRulesStagedPolicyRulesConfigList\n\tif err := r.c.ReadQuery(BasePath+FirewallGlobalRulesStagedPolicyRulesEndpoint, &list); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &list, nil\n}", "func processToRules(\n\tes *core_mesh.ExternalServiceResource,\n\trl core_model.ResourceList,\n) (core_rules.FromRules, error) {\n\tmatchedPolicies := []core_model.Resource{}\n\n\tfor _, policy := range rl.GetItems() {\n\t\tspec := policy.GetSpec().(core_model.Policy)\n\n\t\tto, ok := spec.(core_model.PolicyWithToList)\n\t\tif !ok {\n\t\t\treturn core_rules.FromRules{}, nil\n\t\t}\n\n\t\tfor _, item := range to.GetToList() {\n\t\t\tif externalServiceSelectedByTargetRef(item.GetTargetRef(), es) {\n\t\t\t\tmatchedPolicies = append(matchedPolicies, policy)\n\t\t\t}\n\t\t}\n\t}\n\n\tsort.Sort(ByTargetRef(matchedPolicies))\n\n\ttoList := []core_rules.PolicyItemWithMeta{}\n\tfor _, policy := range matchedPolicies {\n\t\tfor _, item := range policy.GetSpec().(core_model.PolicyWithToList).GetToList() {\n\t\t\tif !externalServiceSelectedByTargetRef(item.GetTargetRef(), es) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// convert 'to' policyItem to 'from' policyItem\n\t\t\tartificial := &artificialPolicyItem{\n\t\t\t\tconf: item.GetDefault(),\n\t\t\t\ttargetRef: policy.GetSpec().(core_model.Policy).GetTargetRef(),\n\t\t\t}\n\t\t\ttoList = append(toList, core_rules.BuildPolicyItemsWithMeta([]core_model.PolicyItem{artificial},\n\t\t\t\tpolicy.GetMeta())...)\n\t\t}\n\t}\n\n\trules, err := core_rules.BuildRules(toList)\n\tif err != nil {\n\t\treturn core_rules.FromRules{}, err\n\t}\n\n\treturn core_rules.FromRules{Rules: map[core_rules.InboundListener]core_rules.Rules{\n\t\t{}: rules,\n\t}}, nil\n}", "func (m *MockLoadBalancerServiceIface) ListGlobalLoadBalancerRules(p *ListGlobalLoadBalancerRulesParams) (*ListGlobalLoadBalancerRulesResponse, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListGlobalLoadBalancerRules\", p)\n\tret0, _ := ret[0].(*ListGlobalLoadBalancerRulesResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (s *RestServer) listIPv4FlowBehavioralMetricsHandler(r *http.Request) (interface{}, error) {\n\titer, err := goproto.NewIPv4FlowBehavioralMetricsIterator()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get metrics, error: %s\", err)\n\t}\n\n\t// for OSX tests\n\tif iter == nil {\n\t\treturn nil, nil\n\t}\n\n\tvar mtr []goproto.IPv4FlowBehavioralMetrics\n\n\tfor iter.HasNext() {\n\t\ttemp := iter.Next()\n\t\tif temp == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tobjMeta := s.GetObjectMeta(\"IPv4FlowBehavioralMetricsKey\", temp.GetKey())\n\t\tif objMeta == nil {\n\t\t\tlog.Errorf(\"failed to get objMeta for IPv4FlowBehavioralMetrics key %+v\", temp.GetKey())\n\t\t\tcontinue\n\t\t}\n\n\t\ttemp.ObjectMeta = *objMeta\n\t\tmtr = append(mtr, *temp)\n\t}\n\titer.Free()\n\treturn mtr, nil\n}", "func (ruleset *DnsForwardingRuleset) deleteValidations() []func() (admission.Warnings, error) {\n\treturn nil\n}", "func (s *RestServer) listIPv6FlowBehavioralMetricsHandler(r *http.Request) (interface{}, error) {\n\titer, err := goproto.NewIPv6FlowBehavioralMetricsIterator()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get metrics, error: %s\", err)\n\t}\n\n\t// for OSX tests\n\tif iter == nil {\n\t\treturn nil, nil\n\t}\n\n\tvar mtr []goproto.IPv6FlowBehavioralMetrics\n\n\tfor iter.HasNext() {\n\t\ttemp := iter.Next()\n\t\tif temp == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tobjMeta := s.GetObjectMeta(\"IPv6FlowBehavioralMetricsKey\", temp.GetKey())\n\t\tif objMeta == nil {\n\t\t\tlog.Errorf(\"failed to get objMeta for IPv6FlowBehavioralMetrics key %+v\", temp.GetKey())\n\t\t\tcontinue\n\t\t}\n\n\t\ttemp.ObjectMeta = *objMeta\n\t\tmtr = append(mtr, *temp)\n\t}\n\titer.Free()\n\treturn mtr, nil\n}", "func (m *MockFirewallServiceIface) ListEgressFirewallRules(p *ListEgressFirewallRulesParams) (*ListEgressFirewallRulesResponse, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListEgressFirewallRules\", p)\n\tret0, _ := ret[0].(*ListEgressFirewallRulesResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (d *Definition) Rules() Rules {\n\tout := Rules{}\n\tfor state, rules := range d.rules {\n\t\tfor _, rule := range rules {\n\t\t\tout[state] = append(out[state], rule.Rule)\n\t\t}\n\t}\n\treturn out\n}", "func (app *builder) WithRules(rules []Rule) Builder {\n\tapp.list = rules\n\treturn app\n}", "func (*PageRuleApiV1) NewPageRulesBodyActionsItemActionsForwardingURL(id string) (model *PageRulesBodyActionsItemActionsForwardingURL, err error) {\n\tmodel = &PageRulesBodyActionsItemActionsForwardingURL{\n\t\tID: core.StringPtr(id),\n\t}\n\terr = core.ValidateStruct(model, \"required parameters\")\n\treturn\n}", "func (o *ApplicationLoadBalancerForwardingRuleProperties) GetHttpRules() *[]ApplicationLoadBalancerHttpRule {\n\tif o == nil {\n\t\treturn nil\n\t}\n\n\treturn o.HttpRules\n\n}", "func DnsForwardingRulesetGenerator() gopter.Gen {\n\tif dnsForwardingRulesetGenerator != nil {\n\t\treturn dnsForwardingRulesetGenerator\n\t}\n\n\tgenerators := make(map[string]gopter.Gen)\n\tAddRelatedPropertyGeneratorsForDnsForwardingRuleset(generators)\n\tdnsForwardingRulesetGenerator = gen.Struct(reflect.TypeOf(DnsForwardingRuleset{}), generators)\n\n\treturn dnsForwardingRulesetGenerator\n}", "func (t *Interface) IPv6Forwarding(ctrl bool) error {\n\tk := boolToByte(ctrl)\n\treturn ioutil.WriteFile(\"/proc/sys/net/ipv6/conf/\"+t.Name()+\"/forwarding\", []byte{k}, 0)\n}", "func (rt *Router) forward() {\n\tfor i, v := range rt.InInterfaceL {\n\t\t//pktS := \"\"\n\n\t\t// TRYE\n\t\t// get packet from interface i\n\t\tif pktS, err := v.Get(); err == nil {\n\t\t\t//fmt.Println(\"in routher forward, packet from Get(): \", pktS)\n\t\t\t// if packet exists make a forwarding decision\n\t\t\tp, err := FromByteS(pktS)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"Could not get packet\")\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// HERE you will need to implement a lookup into the\n\t\t\t// forwarding table to find the appropriate outgoing interface\n\t\t\t// for now we assume the outgoing interface is also i\n\t\t\tfmt.Printf(\"%s: forwarding packet %s from interface %d to %d with mtu %d\\n\", rt.Str(), p.Str(), i, i, rt.OutInterfaceL[i].Mtu)\n\n\t\t\tif err = rt.OutInterfaceL[i].Put(p.ToByteS(), false); err != nil {\n\t\t\t\t//log.Printf(\"Could not put packet %s in router %s, into outInterface %d. Error: %s\", p.str, rt.forward, i, err)\n\t\t\t\tlog.Printf(\"%s: packet '%s' lost on interface %d\\n\", rt.Str(), i)\n\t\t\t}\n\t\t}\n\t\t//log.Println(\"no packet to forard in router\")\n\t}\n}", "func MakeForwardingClassSlice() []*ForwardingClass {\n\treturn []*ForwardingClass{}\n}", "func toIngressRules(hostRules map[string]utils.FakeIngressRuleValueMap) []extensions.IngressRule {\n\trules := []extensions.IngressRule{}\n\tfor host, pathMap := range hostRules {\n\t\trules = append(rules, extensions.IngressRule{\n\t\t\tHost: host,\n\t\t\tIngressRuleValue: extensions.IngressRuleValue{\n\t\t\t\tHTTP: &extensions.HTTPIngressRuleValue{\n\t\t\t\t\tPaths: toHTTPIngressPaths(pathMap),\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\t}\n\treturn rules\n}", "func (c *CloudWatchEvents) ListRulesRequest(input *ListRulesInput) (req *request.Request, output *ListRulesOutput) {\n\top := &request.Operation{\n\t\tName: opListRules,\n\t\tHTTPMethod: \"POST\",\n\t\tHTTPPath: \"/\",\n\t}\n\n\tif input == nil {\n\t\tinput = &ListRulesInput{}\n\t}\n\n\treq = c.newRequest(op, input, output)\n\toutput = &ListRulesOutput{}\n\treq.Data = output\n\treturn\n}", "func (client FirewallPolicyRuleGroupsClient) ListResponder(resp *http.Response) (result FirewallPolicyRuleGroupListResult, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "func (bi *BaseInstance) Rules() *Rules {\n\treturn bi.rules\n}", "func (bi *BaseInstance) Rules() *Rules {\n\treturn bi.rules\n}", "func (o WorkloadStatusConfigAutomaticPtrOutput) Rules() WorkloadStatusConfigAutomaticRuleArrayOutput {\n\treturn o.ApplyT(func(v *WorkloadStatusConfigAutomatic) []WorkloadStatusConfigAutomaticRule {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Rules\n\t}).(WorkloadStatusConfigAutomaticRuleArrayOutput)\n}", "func RuleListHandler(w http.ResponseWriter, req *http.Request) {\n\trules := api.RuleList{}\n\n\tif err := clients[0].List(context.Background(), \"/rules\", &rules); err != nil {\n\t\tif kvstore.IsKeyNotFoundError(err) {\n\t\t\terrors.SendNotFound(w, \"NodeList\", \"\")\n\t\t\treturn\n\t\t}\n\t\terrors.SendInternalError(w, err)\n\t\treturn\n\t}\n\n\tencoder := json.NewEncoder(w)\n\tbefore := time.Now()\n\tencoder.Encode(&rules)\n\tlog.Infof(\"Encode time %v\", time.Since(before))\n}", "func (i *Interest) ForwardingHint() []Delegation {\n\treturn i.forwardingHint\n}", "func (mr *MockLoadBalancerServiceIfaceMockRecorder) ListLoadBalancerRules(p interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ListLoadBalancerRules\", reflect.TypeOf((*MockLoadBalancerServiceIface)(nil).ListLoadBalancerRules), p)\n}", "func (o WorkloadStatusConfigAutomaticOutput) Rules() WorkloadStatusConfigAutomaticRuleArrayOutput {\n\treturn o.ApplyT(func(v WorkloadStatusConfigAutomatic) []WorkloadStatusConfigAutomaticRule { return v.Rules }).(WorkloadStatusConfigAutomaticRuleArrayOutput)\n}", "func (s *PolicySets) protoRuleToHnsRules(policyId string, pRule *proto.Rule, isInbound bool) ([]*hns.ACLPolicy, error) {\n\tlog.WithField(\"policyId\", policyId).Debug(\"protoRuleToHnsRules\")\n\n\t// Check IpVersion\n\tif pRule.IpVersion != 0 && pRule.IpVersion != proto.IPVersion(ipVersion) {\n\t\tlog.WithField(\"rule\", pRule).Info(\"Skipping rule because it is for an unsupported IP version.\")\n\t\treturn nil, SkipRule\n\t}\n\n\t// Skip rules with negative match criteria, these are not supported in this version\n\tif ruleHasNegativeMatches(pRule) {\n\t\tlog.WithField(\"rule\", pRule).Info(\"Skipping rule because it contains negative matches (currently unsupported).\")\n\t\treturn nil, SkipRule\n\t}\n\n\t// Skip rules with port ranges, only a single port is supported in this version\n\tif portsContainRanges(pRule.SrcPorts) || portsContainRanges(pRule.DstPorts) {\n\t\tlog.WithField(\"rule\", pRule).Info(\"Skipping rule because it contains port ranges (currently unsupported).\")\n\t\treturn nil, SkipRule\n\t}\n\n\t// Skip rules with ICMP type/codes, these are not supported\n\tif pRule.Icmp != nil {\n\t\tlog.WithField(\"rule\", pRule).Info(\"Skipping rule because it contains ICMP type or code (currently unsupported).\")\n\t\treturn nil, SkipRule\n\t}\n\n\t// Skip rules with name port ipsets\n\tif len(pRule.SrcNamedPortIpSetIds) > 0 || len(pRule.DstNamedPortIpSetIds) > 0 {\n\t\tlog.WithField(\"rule\", pRule).Info(\"Skipping rule because it contains named port ipsets (currently unsupported).\")\n\t\treturn nil, SkipRule\n\t}\n\n\t// Filter the Src and Dst CIDRs to only the IP version that we're rendering\n\tvar filteredAll bool\n\truleCopy := *pRule\n\n\truleCopy.SrcNet, filteredAll = filterNets(pRule.SrcNet, ipVersion)\n\tif filteredAll {\n\t\treturn nil, SkipRule\n\t}\n\n\truleCopy.NotSrcNet, filteredAll = filterNets(pRule.NotSrcNet, ipVersion)\n\tif filteredAll {\n\t\treturn nil, SkipRule\n\t}\n\n\truleCopy.DstNet, filteredAll = filterNets(pRule.DstNet, ipVersion)\n\tif filteredAll {\n\t\treturn nil, SkipRule\n\t}\n\n\truleCopy.NotDstNet, filteredAll = filterNets(pRule.NotDstNet, ipVersion)\n\tif filteredAll {\n\t\treturn nil, SkipRule\n\t}\n\n\t// Log with the rule details for context\n\tlogCxt := log.WithField(\"rule\", ruleCopy)\n\n\t// Start with a new empty hns aclPolicy (rule)\n\tvar aclPolicies []*hns.ACLPolicy\n\taclPolicy := s.NewRule(isInbound, rulePriority)\n\n\t//\n\t// Action\n\t//\n\tswitch strings.ToLower(ruleCopy.Action) {\n\tcase \"\", \"allow\":\n\t\taclPolicy.Action = hns.Allow\n\tcase \"deny\":\n\t\taclPolicy.Action = hns.Block\n\tcase \"next-tier\", \"pass\", \"log\":\n\t\tlogCxt.WithField(\"action\", ruleCopy.Action).Info(\"This rule action is not supported, rule will be skipped\")\n\t\treturn nil, SkipRule\n\tdefault:\n\t\tlogCxt.WithField(\"action\", ruleCopy.Action).Panic(\"Unknown rule action\")\n\t}\n\n\t//\n\t// Source ports\n\t//\n\tif len(ruleCopy.SrcPorts) > 0 {\n\t\t// Windows RS3 limitation, single port\n\t\tports := uint16(ruleCopy.SrcPorts[0].First)\n\n\t\tif isInbound {\n\t\t\taclPolicy.RemotePort = ports\n\t\t\tlogCxt.WithField(\"RemotePort\", aclPolicy.RemotePort).Debug(\"Adding Source Ports as RemotePort condition\")\n\t\t} else {\n\t\t\taclPolicy.LocalPort = ports\n\t\t\tlogCxt.WithField(\"LocalPort\", aclPolicy.LocalPort).Debug(\"Adding Source Ports as LocalPort condition\")\n\t\t}\n\t}\n\n\t//\n\t// Destination Ports\n\t//\n\tif len(ruleCopy.DstPorts) > 0 {\n\t\t// Windows RS3 limitation, single port (start port)\n\t\tports := uint16(ruleCopy.DstPorts[0].First)\n\n\t\tif isInbound {\n\t\t\taclPolicy.LocalPort = ports\n\t\t\tlogCxt.WithField(\"LocalPort\", aclPolicy.LocalPort).Debug(\"Adding Destination Ports as LocalPort condition\")\n\t\t} else {\n\t\t\taclPolicy.RemotePort = ports\n\t\t\tlogCxt.WithField(\"RemotePort\", aclPolicy.RemotePort).Debug(\"Adding Destination Ports as RemotePort condition\")\n\t\t}\n\t}\n\n\t//\n\t// Protocol\n\t//\n\tif ruleCopy.Protocol != nil {\n\t\tswitch p := ruleCopy.Protocol.NumberOrName.(type) {\n\t\tcase *proto.Protocol_Name:\n\t\t\tlogCxt.WithField(\"protoName\", p.Name).Debug(\"Adding Protocol Name condition\")\n\t\t\taclPolicy.Protocol = protocolNameToNumber(p.Name)\n\t\tcase *proto.Protocol_Number:\n\t\t\tlogCxt.WithField(\"protoNum\", p.Number).Debug(\"Adding Protocol number condition\")\n\t\t\taclPolicy.Protocol = uint16(p.Number)\n\t\t}\n\t}\n\n\t//\n\t// Source Neworks and IPSets\n\t//\n\tlocalAddresses := []string{\"\"} // ensures slice always has at least one value\n\tremoteAddresses := []string{\"\"}\n\n\tsrcAddresses := ruleCopy.SrcNet\n\n\tif len(ruleCopy.SrcIpSetIds) > 0 {\n\t\tipsetAddresses, err := s.getIPSetAddresses(ruleCopy.SrcIpSetIds)\n\t\tif err != nil {\n\t\t\tlogCxt.Info(\"SrcIpSetIds could not be resolved, rule will be skipped\")\n\t\t\treturn nil, SkipRule\n\t\t}\n\t\tsrcAddresses = append(srcAddresses, ipsetAddresses...)\n\t}\n\n\tif len(srcAddresses) > 0 {\n\t\tif isInbound {\n\t\t\tremoteAddresses = srcAddresses\n\t\t\tlogCxt.WithField(\"RemoteAddress\", remoteAddresses).Debug(\"Adding Source Networks/IPsets as RemoteAddress conditions\")\n\t\t} else {\n\t\t\tlocalAddresses = srcAddresses\n\t\t\tlogCxt.WithField(\"LocalAddress\", localAddresses).Debug(\"Adding Source Networks/IPsets as LocalAddress conditions\")\n\t\t}\n\t}\n\n\t//\n\t// Destination Networks and IPSets\n\t//\n\tdstAddresses := ruleCopy.DstNet\n\n\tif len(ruleCopy.DstIpSetIds) > 0 {\n\t\tipsetAddresses, err := s.getIPSetAddresses(ruleCopy.DstIpSetIds)\n\t\tif err != nil {\n\t\t\tlogCxt.Info(\"DstIpSetIds could not be resolved, rule will be skipped\")\n\t\t\treturn nil, SkipRule\n\t\t}\n\t\tdstAddresses = append(dstAddresses, ipsetAddresses...)\n\t}\n\n\tif len(dstAddresses) > 0 {\n\t\tif isInbound {\n\t\t\tlocalAddresses = dstAddresses\n\t\t\tlogCxt.WithField(\"LocalAddress\", localAddresses).Debug(\"Adding Destination Networks/IPsets as LocalAddress condition\")\n\t\t} else {\n\t\t\tremoteAddresses = dstAddresses\n\t\t\tlogCxt.WithField(\"RemoteAddress\", remoteAddresses).Debug(\"Adding Destination Networks/IPsets as RemoteAddress condition\")\n\t\t}\n\t}\n\n\t// For Windows RS3 only, there is a dataplane restriction of a single address/cidr per\n\t// source or destination condition. The behavior below will be removed in\n\t// the next iteration, but for now we have to break up the source and destination\n\t// ip address combinations and represent them using multiple rules\n\tfor _, localAddr := range localAddresses {\n\t\tfor _, remoteAddr := range remoteAddresses {\n\t\t\tnewPolicy := *aclPolicy\n\t\t\tnewPolicy.LocalAddresses = localAddr\n\t\t\tnewPolicy.RemoteAddresses = remoteAddr\n\t\t\t// Add this rule to the rules being returned\n\t\t\taclPolicies = append(aclPolicies, &newPolicy)\n\t\t}\n\t}\n\n\treturn aclPolicies, nil\n}", "func (pageRuleApi *PageRuleApiV1) ListPageRulesWithContext(ctx context.Context, listPageRulesOptions *ListPageRulesOptions) (result *PageRulesResponseListAll, response *core.DetailedResponse, err error) {\n\terr = core.ValidateStruct(listPageRulesOptions, \"listPageRulesOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tpathParamsMap := map[string]string{\n\t\t\"crn\": *pageRuleApi.Crn,\n\t\t\"zone_id\": *pageRuleApi.ZoneID,\n\t}\n\n\tbuilder := core.NewRequestBuilder(core.GET)\n\tbuilder = builder.WithContext(ctx)\n\tbuilder.EnableGzipCompression = pageRuleApi.GetEnableGzipCompression()\n\t_, err = builder.ResolveRequestURL(pageRuleApi.Service.Options.URL, `/v1/{crn}/zones/{zone_id}/pagerules`, pathParamsMap)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range listPageRulesOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"page_rule_api\", \"V1\", \"ListPageRules\")\n\tfor headerName, headerValue := range sdkHeaders {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\tbuilder.AddHeader(\"Accept\", \"application/json\")\n\n\tif listPageRulesOptions.Status != nil {\n\t\tbuilder.AddQuery(\"status\", fmt.Sprint(*listPageRulesOptions.Status))\n\t}\n\tif listPageRulesOptions.Order != nil {\n\t\tbuilder.AddQuery(\"order\", fmt.Sprint(*listPageRulesOptions.Order))\n\t}\n\tif listPageRulesOptions.Direction != nil {\n\t\tbuilder.AddQuery(\"direction\", fmt.Sprint(*listPageRulesOptions.Direction))\n\t}\n\tif listPageRulesOptions.Match != nil {\n\t\tbuilder.AddQuery(\"match\", fmt.Sprint(*listPageRulesOptions.Match))\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 = pageRuleApi.Service.Request(request, &rawResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(rawResponse, \"\", &result, UnmarshalPageRulesResponseListAll)\n\tif err != nil {\n\t\treturn\n\t}\n\tresponse.Result = result\n\n\treturn\n}", "func (c *FakeProxyRoutes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ProxyRouteList, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewListAction(proxyroutesResource, proxyroutesKind, c.ns, opts), &v1alpha1.ProxyRouteList{})\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.ProxyRouteList{ListMeta: obj.(*v1alpha1.ProxyRouteList).ListMeta}\n\tfor _, item := range obj.(*v1alpha1.ProxyRouteList).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}" ]
[ "0.82680327", "0.7888236", "0.6921475", "0.63297176", "0.6289042", "0.6282941", "0.62212247", "0.61823004", "0.61719257", "0.6101301", "0.59449106", "0.59108365", "0.5861905", "0.5781703", "0.577941", "0.5745746", "0.5659401", "0.56573445", "0.5643367", "0.5638673", "0.5571848", "0.5549332", "0.55241376", "0.54649734", "0.5416599", "0.54142624", "0.53245187", "0.5299173", "0.5280108", "0.52776766", "0.5271003", "0.5252514", "0.52461874", "0.5244467", "0.52158386", "0.5162184", "0.51547635", "0.51506245", "0.51470536", "0.51410973", "0.51277477", "0.51184356", "0.5117228", "0.50903153", "0.50761515", "0.5071731", "0.5042938", "0.5041151", "0.5029936", "0.50285536", "0.50143003", "0.50015867", "0.49838424", "0.49821314", "0.49760407", "0.49680597", "0.4965675", "0.49648738", "0.49621943", "0.4959716", "0.49477956", "0.49183542", "0.49165082", "0.4915442", "0.49050337", "0.49033695", "0.487942", "0.48649162", "0.48641405", "0.48637483", "0.48632795", "0.48399347", "0.4835803", "0.48303035", "0.48241124", "0.48183653", "0.48152313", "0.47913992", "0.47901064", "0.4776497", "0.475145", "0.47393137", "0.47350913", "0.472774", "0.47262707", "0.47237176", "0.4719813", "0.47096786", "0.4697745", "0.4696699", "0.46950704", "0.46950704", "0.4689596", "0.4683431", "0.46824902", "0.4677249", "0.46727356", "0.4670964", "0.46675697", "0.46638167" ]
0.8024552
1
GetFirewallRule uses the override method GetFirewallRuleFn or the real implementation.
func (c *TestClient) GetFirewallRule(project, name string) (*compute.Firewall, error) { if c.GetFirewallRuleFn != nil { return c.GetFirewallRuleFn(project, name) } return c.client.GetFirewallRule(project, name) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (f *fakeLB) GetFirewallRule(_ context.Context, _, _ string) (*govultr.LBFirewallRule, *http.Response, error) {\n\treturn nil, nil, nil\n}", "func (g *Google) getFirewallRule() (*compute.Firewall, error) {\n\treturn g.computeService.Firewalls.Get(g.project, firewallRuleName).Do()\n}", "func (f *fakeLB) GetForwardingRule(_ context.Context, _, _ string) (*govultr.ForwardingRule, *http.Response, error) {\n\tpanic(\"implement me\")\n}", "func GetFirewallRule(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *FirewallRuleState, opts ...pulumi.ResourceOption) (*FirewallRule, error) {\n\tvar resource FirewallRule\n\terr := ctx.ReadResource(\"azure:mssql/firewallRule:FirewallRule\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (c *TestClient) GetForwardingRule(project, region, name string) (*compute.ForwardingRule, error) {\n\tif c.GetForwardingRuleFn != nil {\n\t\treturn c.GetForwardingRuleFn(project, region, name)\n\t}\n\treturn c.client.GetForwardingRule(project, region, name)\n}", "func (sdk *MockGoSDKClient) GetSQLFirewallRule(ctx context.Context, resourceGroupName string, serverName string, ruleName string) (result sql.FirewallRule, err error) {\n\n\tvar sqlFirewallRule = sql.FirewallRule{\n\t\tResponse: helpers.GetRestResponse(http.StatusCreated),\n\t}\n\n\tsdk.FirewallRule = sqlFirewallRule\n\n\treturn sqlFirewallRule, nil\n}", "func LookupFirewallRule(ctx *pulumi.Context, args *LookupFirewallRuleArgs, opts ...pulumi.InvokeOption) (*LookupFirewallRuleResult, error) {\n\tvar rv LookupFirewallRuleResult\n\terr := ctx.Invoke(\"azure-native:datalakeanalytics/v20151001preview:getFirewallRule\", args, &rv, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &rv, nil\n}", "func (m *Mock) GetRule(*nftables.Table, *nftables.Chain) ([]*nftables.Rule, error) {\n\treturn nil, nil\n}", "func (g *Cloud) GetFirewall(name string) (*compute.Firewall, error) {\n\tctx, cancel := cloud.ContextWithCallTimeout()\n\tdefer cancel()\n\n\tmc := newFirewallMetricContext(\"get\")\n\tv, err := g.c.Firewalls().Get(ctx, meta.GlobalKey(name))\n\treturn v, mc.Observe(err)\n}", "func (g *Google) createFirewallRule() (string, error) {\n\tif rule, err := g.getFirewallRule(); err == nil {\n\t\tlog.Infof(\"found FirewallRule %s: %s\", firewallRuleName, rule.SelfLink)\n\t\treturn rule.SelfLink, nil\n\t}\n\n\top, err := g.computeService.Firewalls.Insert(g.project,\n\t\t&compute.Firewall{\n\t\t\tName: firewallRuleName,\n\t\t\tAllowed: []*compute.FirewallAllowed{\n\t\t\t\t{\n\t\t\t\t\tIPProtocol: cockroachProtocol,\n\t\t\t\t\tPorts: []string{\n\t\t\t\t\t\tfmt.Sprintf(\"%d\", g.context.Port),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tSourceRanges: []string{\n\t\t\t\tallIPAddresses,\n\t\t\t},\n\t\t}).Do()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif err := g.waitForOperation(op); err != nil {\n\t\treturn \"\", err\n\t}\n\tlog.Infof(\"created FirewallRule %s: %s\", firewallRuleName, op.TargetLink)\n\treturn op.TargetLink, nil\n}", "func (m *DeviceAndAppManagementAssignmentFilter) GetRule()(*string) {\n val, err := m.GetBackingStore().Get(\"rule\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func (c *Client) GetFirewall(ctx context.Context, id int) (*Firewall, error) {\n\te, err := c.Firewalls.Endpoint()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq := c.R(ctx)\n\n\te = fmt.Sprintf(\"%s/%d\", e, id)\n\tr, err := coupleAPIErrors(req.SetResult(&Firewall{}).Get(e))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn r.Result().(*Firewall), nil\n}", "func (g *Google) getForwardingRule() (*compute.ForwardingRule, error) {\n\treturn g.computeService.GlobalForwardingRules.Get(g.project, forwardingRuleName).Do()\n}", "func GetRule(ctx *pulumi.Context,\n\tname string, id pulumi.ID, state *RuleState, opts ...pulumi.ResourceOpt) (*Rule, error) {\n\tinputs := make(map[string]interface{})\n\tif state != nil {\n\t\tinputs[\"arn\"] = state.Arn\n\t\tinputs[\"metricName\"] = state.MetricName\n\t\tinputs[\"name\"] = state.Name\n\t\tinputs[\"predicates\"] = state.Predicates\n\t\tinputs[\"tags\"] = state.Tags\n\t}\n\ts, err := ctx.ReadResource(\"aws:waf/rule:Rule\", name, id, inputs, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Rule{s: s}, nil\n}", "func getRule(bld *build.File, ruleKind string, rt ruleType) *build.Rule {\n\trs := buildRules(bld, ruleKind)\n\tfor i := len(rs) - 1; i >= 0; i-- {\n\t\tr := rs[i]\n\t\tif ruleMatches(bld, r, rt) {\n\t\t\treturn r\n\t\t}\n\t}\n\treturn nil\n}", "func NewFirewallRule(ctx *pulumi.Context,\n\tname string, args *FirewallRuleArgs, opts ...pulumi.ResourceOption) (*FirewallRule, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.EndIpAddress == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'EndIpAddress'\")\n\t}\n\tif args.ServerId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ServerId'\")\n\t}\n\tif args.StartIpAddress == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'StartIpAddress'\")\n\t}\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource FirewallRule\n\terr := ctx.RegisterResource(\"azure:mssql/firewallRule:FirewallRule\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (manager *NetworkPolicyManager) getOrCreateFirewallManager(pod, prev *core_v1.Pod) (pcn_firewall.PcnFirewall, bool) {\n\tl := log.New().WithFields(log.Fields{\"by\": PM, \"method\": \"getOrCreateFirewallManager(\" + pod.Name + \")\"})\n\tfwKey := pod.Namespace + \"|\" + utils.ImplodeLabels(pod.Labels, \",\", true)\n\n\t//-------------------------------------\n\t// Already linked?\n\t//-------------------------------------\n\tlinkedFw, wasLinked := manager.linkedPods[pod.UID]\n\tif wasLinked && linkedFw != fwKey {\n\t\tprevFwKey := prev.Namespace + \"|\" + utils.ImplodeLabels(prev.Labels, \",\", true)\n\n\t\t// This pod was already linked to a firewall manager,\n\t\t// but it's not the one we expected. This means that someone\n\t\t// (user or plugin) changed this pod's labels,\n\t\t// so we now need to unlink the pod from its current fw manager.\n\t\tprevFw, exists := manager.localFirewalls[prevFwKey]\n\t\tif exists {\n\t\t\tunlinked, remaining := prevFw.Unlink(pod, pcn_firewall.CleanFirewall)\n\t\t\tif !unlinked {\n\t\t\t\tl.Warningf(\"%s was not linked in previous firewall manager!\", pod.UID)\n\t\t\t} else {\n\t\t\t\tif remaining == 0 {\n\t\t\t\t\tmanager.flagForDeletion(prevFw.Name())\n\t\t\t\t}\n\t\t\t\tdelete(manager.linkedPods, pod.UID)\n\t\t\t}\n\t\t} else {\n\t\t\tl.Warningf(\"Could not find %s previous firewall manager!\", pod.UID)\n\t\t}\n\t}\n\n\t//-------------------------------------\n\t// Create and link it\n\t//-------------------------------------\n\tfw, exists := manager.localFirewalls[fwKey]\n\tif !exists {\n\t\tmanager.localFirewalls[fwKey] = startFirewall(manager.fwAPI, manager.podController, manager.vPodsRange, fwKey, pod.Namespace, pod.Labels)\n\t\tfw = manager.localFirewalls[fwKey]\n\t\treturn fw, true\n\t}\n\treturn fw, false\n}", "func (r Virtual_Guest_Network_Component) GetNetworkComponentFirewall() (resp datatypes.Network_Component_Firewall, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Virtual_Guest_Network_Component\", \"getNetworkComponentFirewall\", nil, &r.Options, &resp)\n\treturn\n}", "func (s *LocalTests) createFirewallRule(c *gc.C) *cloudapi.FirewallRule {\n\tfwRule, err := s.testClient.CreateFirewallRule(cloudapi.CreateFwRuleOpts{Enabled: false, Rule: testFwRule})\n\tc.Assert(err, gc.IsNil)\n\tc.Assert(fwRule, gc.NotNil)\n\tc.Assert(fwRule.Rule, gc.Equals, testFwRule)\n\tc.Assert(fwRule.Enabled, gc.Equals, false)\n\ttime.Sleep(10 * time.Second)\n\n\treturn fwRule\n}", "func (f *fakeLB) ListFirewallRules(_ context.Context, _ string, _ *govultr.ListOptions) ([]govultr.LBFirewallRule, *govultr.Meta, *http.Response, error) {\n\treturn nil, nil, nil, nil\n}", "func (egw *NsxtEdgeGateway) GetNsxtFirewall() (*NsxtFirewall, error) {\n\tclient := egw.client\n\tendpoint := types.OpenApiPathVersion1_0_0 + types.OpenApiEndpointNsxtFirewallRules\n\tminimumApiVersion, err := client.checkOpenApiEndpointCompatibility(endpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Insert Edge Gateway ID into endpoint path edgeGateways/%s/firewall/rules\n\turlRef, err := client.OpenApiBuildEndpoint(fmt.Sprintf(endpoint, egw.EdgeGateway.ID))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturnObject := &NsxtFirewall{\n\t\tNsxtFirewallRuleContainer: &types.NsxtFirewallRuleContainer{},\n\t\tclient: client,\n\t\tedgeGatewayId: egw.EdgeGateway.ID,\n\t}\n\n\terr = client.OpenApiGetItem(minimumApiVersion, urlRef, nil, returnObject.NsxtFirewallRuleContainer, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error retrieving NSX-T Firewall rules: %s\", err)\n\t}\n\n\t// Store Edge Gateway ID for later operations\n\treturnObject.edgeGatewayId = egw.EdgeGateway.ID\n\n\treturn returnObject, nil\n}", "func GetRule(id string) (*Rule, error) {\n\tvar rule Rule\n\tfilters := map[string]interface{}{\"_id\": id}\n\terr := database.Client.GetOne(ruleTable, &rule, filters)\n\treturn &rule, err\n}", "func (m *AssignmentFilterEvaluateRequest) GetRule()(*string) {\n val, err := m.GetBackingStore().Get(\"rule\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func (client *Client) GetRule(request *GetRuleRequest) (_result *GetRuleResponse, _err error) {\n\truntime := &util.RuntimeOptions{}\n\t_result = &GetRuleResponse{}\n\t_body, _err := client.GetRuleWithOptions(request, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_result = _body\n\treturn _result, _err\n}", "func (manager *NetworkPolicyManager) getOrCreateFirewallManager(pod, prev *core_v1.Pod) (pcn_firewall.PcnFirewallManager, bool) {\n\tf := \"[Network Policies Manager](getOrCreateFirewallManager) \"\n\tfwKey := pod.Namespace + \"|\" + utils.ImplodeLabels(pod.Labels, \",\", true)\n\n\t//-------------------------------------\n\t// Already linked?\n\t//-------------------------------------\n\tlinkedFw, wasLinked := manager.linkedPods[pod.UID]\n\tif wasLinked && linkedFw != fwKey {\n\t\tprevFwKey := prev.Namespace + \"|\" + utils.ImplodeLabels(prev.Labels, \",\", true)\n\n\t\t// This pod was already linked to a firewall manager,\n\t\t// but it's not the one we expected. This means that someone\n\t\t// (user or plugin) changed this pod's labels,\n\t\t// so we now need to unlink the pod from its current fw manager.\n\t\tprevFw, exists := manager.localFirewalls[prevFwKey]\n\t\tif exists {\n\t\t\tunlinked, remaining := prevFw.Unlink(pod, pcn_firewall.CleanFirewall)\n\t\t\tif !unlinked {\n\t\t\t\tlogger.Warningf(f+\"%s was not linked in previous firewall manager!\", pod.UID)\n\t\t\t} else {\n\t\t\t\tif remaining == 0 {\n\t\t\t\t\tmanager.flagForDeletion(prevFw.Name())\n\t\t\t\t}\n\t\t\t\tdelete(manager.linkedPods, pod.UID)\n\t\t\t}\n\t\t} else {\n\t\t\tlogger.Warningf(f+\"Could not find %s previous firewall manager!\", pod.UID)\n\t\t}\n\t}\n\n\t//-------------------------------------\n\t// Create and link it\n\t//-------------------------------------\n\tfw, exists := manager.localFirewalls[fwKey]\n\tif !exists {\n\t\tmanager.localFirewalls[fwKey] = startFirewall(fwKey, pod.Namespace, pod.Labels)\n\t\tfw = manager.localFirewalls[fwKey]\n\t\treturn fw, true\n\t}\n\treturn fw, false\n}", "func GetBandwidthLimitRule(c *gophercloud.ServiceClient, policyID, ruleID string) (r GetBandwidthLimitRuleResult) {\n\t_, r.Err = c.Get(getBandwidthLimitRuleURL(c, policyID, ruleID), &r.Body, nil)\n\treturn\n}", "func (o *NetworkingProjectNetadpCreate) GetFirewall() string {\n\tif o == nil || o.Firewall == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Firewall\n}", "func (s *Service) GetRule(ruleName string, params map[string]string, response handle.ResponseHandle) error {\n\treturn getRule(s.client, ruleName, params, response)\n}", "func (s *Service) GetFirewallRulePort(ruleID string) (FirewallRulePort, error) {\n\tbody, err := s.getFirewallRulePortResponseBody(ruleID)\n\n\treturn body.Data, err\n}", "func (p *Provider) getFrontendRule(application marathon.Application, serviceName string) string {\n\tif label, ok := p.getLabel(application, types.LabelFrontendRule, serviceName); ok {\n\t\treturn label\n\t}\n\tif p.MarathonLBCompatibility {\n\t\tif label, ok := p.getAppLabel(application, \"HAPROXY_0_VHOST\"); ok {\n\t\t\treturn \"Host:\" + label\n\t\t}\n\t}\n\tif len(serviceName) > 0 {\n\t\treturn \"Host:\" + strings.ToLower(provider.Normalize(serviceName)) + \".\" + p.getSubDomain(application.ID) + \".\" + p.Domain\n\t}\n\treturn \"Host:\" + p.getSubDomain(application.ID) + \".\" + p.Domain\n}", "func (a *Client) GetScopeRule(params *GetScopeRuleParams, authInfo runtime.ClientAuthInfoWriter) (*GetScopeRuleOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetScopeRuleParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"GetScopeRule\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/cdn/v1/stacks/{stack_id}/sites/{site_id}/scopes/{scope_id}/rules/{rule_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: &GetScopeRuleReader{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.(*GetScopeRuleOK), nil\n\n}", "func GetForwardingRule(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *ForwardingRuleState, opts ...pulumi.ResourceOption) (*ForwardingRule, error) {\n\tvar resource ForwardingRule\n\terr := ctx.ReadResource(\"alicloud:ga/forwardingRule:ForwardingRule\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (s Service) GetTransitionRule(ctx context.Context, docID, ruleID []byte) (*coredocumentpb.TransitionRule, error) {\n\treturn s.pendingDocSrv.GetTransitionRule(ctx, docID, ruleID)\n}", "func GetListenerRule(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *ListenerRuleState, opts ...pulumi.ResourceOption) (*ListenerRule, error) {\n\tvar resource ListenerRule\n\terr := ctx.ReadResource(\"aws:lb/listenerRule:ListenerRule\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (m *RuleBasedSubjectSet) GetRule()(*string) {\n val, err := m.GetBackingStore().Get(\"rule\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func GetRuleProtocol(v string) (rules.Protocol, error) {\n\tvar protocol rules.Protocol\n\tvar err error\n\n\tswitch v {\n\tcase \"any\":\n\t\tprotocol = rules.ProtocolAny\n\tcase \"icmp\":\n\t\tprotocol = rules.ProtocolICMP\n\tcase \"tcp\":\n\t\tprotocol = rules.ProtocolTCP\n\tcase \"udp\":\n\t\tprotocol = rules.ProtocolUDP\n\tdefault:\n\t\terr = fmt.Errorf(\"Invalid protocol\")\n\t}\n\n\treturn protocol, err\n}", "func (g *Cloud) PatchFirewall(f *compute.Firewall) error {\n\tctx, cancel := cloud.ContextWithCallTimeout()\n\tdefer cancel()\n\n\tmc := newFirewallMetricContext(\"Patch\")\n\treturn mc.Observe(g.c.Firewalls().Patch(ctx, meta.GlobalKey(f.Name), f))\n}", "func (vf *ACLValidatorFactory) GetACLValidator(pr pb.PermissionRule) (ACLValidator, error) {\n\tswitch pr {\n\tcase pb.PermissionRule_NULL:\n\t\treturn NewNullValidator(), nil\n\tcase pb.PermissionRule_SIGN_THRESHOLD:\n\t\treturn NewThresholdValidator(), nil\n\tcase pb.PermissionRule_SIGN_AKSET:\n\t\treturn NewAKSetsValidator(), nil\n\tcase pb.PermissionRule_SIGN_RATE:\n\t\treturn vf.notImplementedValidator()\n\tcase pb.PermissionRule_SIGN_SUM:\n\t\treturn vf.notImplementedValidator()\n\tcase pb.PermissionRule_CA_SERVER:\n\t\treturn vf.notImplementedValidator()\n\tcase pb.PermissionRule_COMMUNITY_VOTE:\n\t\treturn vf.notImplementedValidator()\n\t}\n\treturn nil, errors.New(\"Unknown permission rule\")\n}", "func (_m *ComputeAPI) LookupFirewallRule(project string) ([]*compute.Firewall, error) {\n\tret := _m.Called(project)\n\n\tvar r0 []*compute.Firewall\n\tif rf, ok := ret.Get(0).(func(string) []*compute.Firewall); ok {\n\t\tr0 = rf(project)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).([]*compute.Firewall)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(string) error); ok {\n\t\tr1 = rf(project)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "func (s *Service) GetNetworkRule(ruleID string) (NetworkRule, error) {\n\tbody, err := s.getNetworkRuleResponseBody(ruleID)\n\n\treturn body.Data, err\n}", "func (c *TestClient) CreateFirewallRule(project string, i *compute.Firewall) error {\n\tif c.CreateFirewallRuleFn != nil {\n\t\treturn c.CreateFirewallRuleFn(project, i)\n\t}\n\treturn c.client.CreateFirewallRule(project, i)\n}", "func (m *Group) GetMembershipRule()(*string) {\n return m.membershipRule\n}", "func (fr *FirewallRule) UnmarshalJSON(body []byte) error {\n\tvar m map[string]*json.RawMessage\n\terr := json.Unmarshal(body, &m)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor k, v := range m {\n\t\tswitch k {\n\t\tcase \"properties\":\n\t\t\tif v != nil {\n\t\t\t\tvar firewallRuleProperties FirewallRuleProperties\n\t\t\t\terr = json.Unmarshal(*v, &firewallRuleProperties)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tfr.FirewallRuleProperties = &firewallRuleProperties\n\t\t\t}\n\t\tcase \"id\":\n\t\t\tif v != nil {\n\t\t\t\tvar ID string\n\t\t\t\terr = json.Unmarshal(*v, &ID)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tfr.ID = &ID\n\t\t\t}\n\t\tcase \"name\":\n\t\t\tif v != nil {\n\t\t\t\tvar name string\n\t\t\t\terr = json.Unmarshal(*v, &name)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tfr.Name = &name\n\t\t\t}\n\t\tcase \"type\":\n\t\t\tif v != nil {\n\t\t\t\tvar typeVar string\n\t\t\t\terr = json.Unmarshal(*v, &typeVar)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tfr.Type = &typeVar\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func NewFirewallRuleListResultIterator (page FirewallRuleListResultPage) FirewallRuleListResultIterator {\n return FirewallRuleListResultIterator{page: page}\n }", "func (_m *ComputeAPI) DeleteFirewallRule(project string, firewall string) {\n\t_m.Called(project, firewall)\n}", "func (obj *ruleNode) Rule() Rule {\n\treturn obj.rule\n}", "func (fr *FirewallRule) UnmarshalJSON(body []byte) error {\n var m map[string]*json.RawMessage\n err := json.Unmarshal(body, &m)\n if err != nil {\n return err\n }\n for k, v := range m {\n switch k {\n case \"properties\":\n if v != nil {\n var firewallRuleProperties FirewallRuleProperties\n err = json.Unmarshal(*v, &firewallRuleProperties)\n if err != nil {\n return err\n }\n fr.FirewallRuleProperties = &firewallRuleProperties\n }\n case \"id\":\n if v != nil {\n var ID string\n err = json.Unmarshal(*v, &ID)\n if err != nil {\n return err\n }\n fr.ID = &ID\n }\n case \"name\":\n if v != nil {\n var name string\n err = json.Unmarshal(*v, &name)\n if err != nil {\n return err\n }\n fr.Name = &name\n }\n case \"type\":\n if v != nil {\n var typeVar string\n err = json.Unmarshal(*v, &typeVar)\n if err != nil {\n return err\n }\n fr.Type = &typeVar\n }\n }\n }\n\n return nil\n }", "func (client *ClientImpl) GetProcessWorkItemTypeRule(ctx context.Context, args GetProcessWorkItemTypeRuleArgs) (*ProcessRule, error) {\n\trouteValues := make(map[string]string)\n\tif args.ProcessId == nil {\n\t\treturn nil, &azuredevops.ArgumentNilError{ArgumentName: \"args.ProcessId\"}\n\t}\n\trouteValues[\"processId\"] = (*args.ProcessId).String()\n\tif args.WitRefName == nil || *args.WitRefName == \"\" {\n\t\treturn nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: \"args.WitRefName\"}\n\t}\n\trouteValues[\"witRefName\"] = *args.WitRefName\n\tif args.RuleId == nil {\n\t\treturn nil, &azuredevops.ArgumentNilError{ArgumentName: \"args.RuleId\"}\n\t}\n\trouteValues[\"ruleId\"] = (*args.RuleId).String()\n\n\tlocationId, _ := uuid.Parse(\"76fe3432-d825-479d-a5f6-983bbb78b4f3\")\n\tresp, err := client.Client.Send(ctx, http.MethodGet, locationId, \"6.0-preview.2\", routeValues, nil, nil, \"\", \"application/json\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar responseValue ProcessRule\n\terr = client.Client.UnmarshalBody(resp, &responseValue)\n\treturn &responseValue, err\n}", "func (client *Client) GetRuleWithOptions(request *GetRuleRequest, runtime *util.RuntimeOptions) (_result *GetRuleResponse, _err error) {\n\t_err = util.ValidateModel(request)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_result = &GetRuleResponse{}\n\t_body, _err := client.DoRequest(tea.String(\"getRule\"), tea.String(\"HTTP\"), tea.String(\"POST\"), tea.String(\"/openapi/getRule\"), nil, tea.ToMap(request), 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 FirewallPolicyRuleGroupsClient) Get(ctx context.Context, resourceGroupName string, firewallPolicyName string, ruleGroupName string) (result FirewallPolicyRuleGroup, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/FirewallPolicyRuleGroupsClient.Get\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.Response.Response != nil {\n\t\t\t\tsc = result.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\treq, err := client.GetPreparer(ctx, resourceGroupName, firewallPolicyName, ruleGroupName)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.FirewallPolicyRuleGroupsClient\", \"Get\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.GetSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"network.FirewallPolicyRuleGroupsClient\", \"Get\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.GetResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.FirewallPolicyRuleGroupsClient\", \"Get\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\n\treturn\n}", "func (m *DetectionRule) GetSchedule()(RuleScheduleable) {\n val, err := m.GetBackingStore().Get(\"schedule\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(RuleScheduleable)\n }\n return nil\n}", "func (a *SyncApiService) GetSyncRule(ctx context.Context, syncRuleId string) (SyncRules, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Get\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t \tsuccessPayload SyncRules\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/platform/3/sync/rules/{SyncRuleId}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"SyncRuleId\"+\"}\", fmt.Sprintf(\"%v\", syncRuleId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{ \"application/json\", }\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"application/json\",\n\t\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn successPayload, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn successPayload, localVarHttpResponse, err\n\t}\n\tdefer localVarHttpResponse.Body.Close()\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tbodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)\n\t\treturn successPayload, localVarHttpResponse, reportError(\"Status: %v, Body: %s\", localVarHttpResponse.Status, bodyBytes)\n\t}\n\n\tif err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {\n\t\treturn successPayload, localVarHttpResponse, err\n\t}\n\n\n\treturn successPayload, localVarHttpResponse, err\n}", "func (p *Provider) getFrontendRule(task taskData) string {\n\tif v := label.GetStringValue(task.TraefikLabels, label.TraefikFrontendRule, \"\"); len(v) > 0 {\n\t\treturn v\n\t}\n\n\tdomain := label.GetStringValue(task.TraefikLabels, label.TraefikDomain, p.Domain)\n\tif len(domain) > 0 {\n\t\tdomain = \".\" + domain\n\t}\n\n\treturn \"Host:\" + p.getSegmentSubDomain(task) + domain\n}", "func (r *FirewallManagementIPRulesResource) Get(id string) (*FirewallManagementIPRulesConfig, error) {\n\tvar item FirewallManagementIPRulesConfig\n\tif err := r.c.ReadQuery(BasePath+FirewallManagementIPRulesEndpoint, &item); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &item, nil\n}", "func (*Kind) Rule(cfg *validate.RuleConfig) (validate.Rule, error) {\n\tcfg.Merge(defaultConfig)\n\treturn &Rule{BaseRule: validate.NewBaseRule(validate.Repository, *cfg)}, nil\n}", "func (api *API) DiscoveryRulesGet(params Params) (res LLDRules, err error) {\n\tif _, present := params[\"output\"]; !present {\n\t\tparams[\"output\"] = \"extend\"\n\t}\n\terr = api.CallWithErrorParse(\"discoveryrule.get\", params, &res)\n\treturn\n}", "func (s *FirewallServer) applyFirewall(ctx context.Context, c *compute.Client, request *computepb.ApplyComputeFirewallRequest) (*computepb.ComputeFirewall, error) {\n\tp := ProtoToFirewall(request.GetResource())\n\tres, err := c.ApplyFirewall(ctx, p)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tr := FirewallToProto(res)\n\treturn r, nil\n}", "func GetObfuscationRule(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *ObfuscationRuleState, opts ...pulumi.ResourceOption) (*ObfuscationRule, error) {\n\tvar resource ObfuscationRule\n\terr := ctx.ReadResource(\"newrelic:index/obfuscationRule:ObfuscationRule\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (c *TestClient) ListFirewallRules(project string, opts ...ListCallOption) ([]*compute.Firewall, error) {\n\tif c.ListFirewallRulesFn != nil {\n\t\treturn c.ListFirewallRulesFn(project, opts...)\n\t}\n\treturn c.client.ListFirewallRules(project, opts...)\n}", "func GetRules() []Rule {\n\tupdateMux.RLock()\n\trules := rulesFrom(breakerRules)\n\tupdateMux.RUnlock()\n\tret := make([]Rule, 0, len(rules))\n\tfor _, rule := range rules {\n\t\tret = append(ret, *rule)\n\t}\n\treturn ret\n}", "func NewFirewall() *Firewall {\n\treturn &Firewall{\n\t\tBlacklisting: true,\n\t\tErrorHandler: router.ErrorHandler(func(w http.ResponseWriter, r *http.Request, code int) {\n\t\t\tswitch code {\n\t\t\tcase 403:\n\t\t\t\thttp.Error(w, \"Forbidden\", 403)\n\t\t\t}\n\t\t}),\n\t}\n}", "func (w *WebApplicationFirewallCustomRule) 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\", w, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"action\":\n\t\t\terr = unpopulate(val, \"Action\", &w.Action)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"etag\":\n\t\t\terr = unpopulate(val, \"Etag\", &w.Etag)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"groupByUserSession\":\n\t\t\terr = unpopulate(val, \"GroupByUserSession\", &w.GroupByUserSession)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"matchConditions\":\n\t\t\terr = unpopulate(val, \"MatchConditions\", &w.MatchConditions)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &w.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"priority\":\n\t\t\terr = unpopulate(val, \"Priority\", &w.Priority)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"rateLimitDuration\":\n\t\t\terr = unpopulate(val, \"RateLimitDuration\", &w.RateLimitDuration)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"rateLimitThreshold\":\n\t\t\terr = unpopulate(val, \"RateLimitThreshold\", &w.RateLimitThreshold)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"ruleType\":\n\t\t\terr = unpopulate(val, \"RuleType\", &w.RuleType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"state\":\n\t\t\terr = unpopulate(val, \"State\", &w.State)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", w, err)\n\t\t}\n\t}\n\treturn nil\n}", "func (s *UpdateFirewallRuleOutput) SetFirewallRule(v *FirewallRule) *UpdateFirewallRuleOutput {\n\ts.FirewallRule = v\n\treturn s\n}", "func (fw *IPtables) injectRule(rule *IPtablesRule) error {\n\trule2arr := strings.Split(rule.GetBody(), \" \")\n\tif len(rule2arr) < 3 {\n\t\treturn fmt.Errorf(\"In injectRule() not enough elements in rule %s\", rule.GetBody())\n\t}\n\n\truleChain := rule2arr[0]\n\n\tfor i, chain := range fw.chains {\n\t\tif chain.ChainName == ruleChain {\n\t\t\tfw.chains[i].Rules = append(fw.chains[i].Rules, rule)\n\t\t\tlog.Infof(\"In injectRule() adding rule %s into chain %s\", rule.GetBody(), chain.ChainName)\n\t\t\treturn nil\n\t\t}\n\t}\n\n\t// TODO should we create new chain instead of throwing error?\n\treturn fmt.Errorf(\"In injectRule() firewall doesn't manage chain for rule %s\", rule.GetBody())\n}", "func (o RouteFilterOutput) Rule() RouteFilterRuleOutput {\n\treturn o.ApplyT(func(v *RouteFilter) RouteFilterRuleOutput { return v.Rule }).(RouteFilterRuleOutput)\n}", "func (s *DeleteFirewallRuleOutput) SetFirewallRule(v *FirewallRule) *DeleteFirewallRuleOutput {\n\ts.FirewallRule = v\n\treturn s\n}", "func (f *FirewallRule) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", f, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &f.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &f.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &f.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &f.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", f, err)\n\t\t}\n\t}\n\treturn nil\n}", "func (c *Firewall) Get() (Config, error) {\n\tans := c.container()\n\terr := c.ns.Object(util.Get, c.pather(), \"\", ans)\n\treturn first(ans, err)\n}", "func GetInsightRule(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *InsightRuleState, opts ...pulumi.ResourceOption) (*InsightRule, error) {\n\tvar resource InsightRule\n\terr := ctx.ReadResource(\"aws-native:cloudwatch:InsightRule\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (self *PolicyAgent) AddRule(rule *OfnetPolicyRule, ret *bool) error {\n\tvar ipDa *net.IP = nil\n\tvar ipDaMask *net.IP = nil\n\tvar ipSa *net.IP = nil\n\tvar ipSaMask *net.IP = nil\n\tvar md *uint64 = nil\n\tvar mdm *uint64 = nil\n\tvar flag, flagMask uint16\n\tvar flagPtr, flagMaskPtr *uint16\n\tvar err error\n\n\t// make sure switch is connected\n\tif !self.agent.IsSwitchConnected() {\n\t\tself.agent.WaitForSwitchConnection()\n\t}\n\n\t// check if we already have the rule\n\tself.mutex.RLock()\n\tif self.Rules[rule.RuleId] != nil {\n\t\toldRule := self.Rules[rule.RuleId].Rule\n\n\t\tif ruleIsSame(oldRule, rule) {\n\t\t\tself.mutex.RUnlock()\n\t\t\treturn nil\n\t\t} else {\n\t\t\tself.mutex.RUnlock()\n\t\t\tlog.Errorf(\"Rule already exists. new rule: {%+v}, old rule: {%+v}\", rule, oldRule)\n\t\t\treturn errors.New(\"Rule already exists\")\n\t\t}\n\t}\n\tself.mutex.RUnlock()\n\n\tlog.Infof(\"Received AddRule: %+v\", rule)\n\n\t// Parse dst ip\n\tif rule.DstIpAddr != \"\" {\n\t\tipDa, ipDaMask, err = ParseIPAddrMaskString(rule.DstIpAddr)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Error parsing dst ip %s. Err: %v\", rule.DstIpAddr, err)\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// parse src ip\n\tif rule.SrcIpAddr != \"\" {\n\t\tipSa, ipSaMask, err = ParseIPAddrMaskString(rule.SrcIpAddr)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Error parsing src ip %s. Err: %v\", rule.SrcIpAddr, err)\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// parse source/dst endpoint groups\n\tif rule.SrcEndpointGroup != 0 && rule.DstEndpointGroup != 0 {\n\t\tsrcMetadata, srcMetadataMask := SrcGroupMetadata(rule.SrcEndpointGroup)\n\t\tdstMetadata, dstMetadataMask := DstGroupMetadata(rule.DstEndpointGroup)\n\t\tmetadata := srcMetadata | dstMetadata\n\t\tmetadataMask := srcMetadataMask | dstMetadataMask\n\t\tmd = &metadata\n\t\tmdm = &metadataMask\n\t} else if rule.SrcEndpointGroup != 0 {\n\t\tsrcMetadata, srcMetadataMask := SrcGroupMetadata(rule.SrcEndpointGroup)\n\t\tmd = &srcMetadata\n\t\tmdm = &srcMetadataMask\n\t} else if rule.DstEndpointGroup != 0 {\n\t\tdstMetadata, dstMetadataMask := DstGroupMetadata(rule.DstEndpointGroup)\n\t\tmd = &dstMetadata\n\t\tmdm = &dstMetadataMask\n\t}\n\n\t// Setup TCP flags\n\tif rule.IpProtocol == 6 && rule.TcpFlags != \"\" {\n\t\tswitch rule.TcpFlags {\n\t\tcase \"syn\":\n\t\t\tflag = TCP_FLAG_SYN\n\t\t\tflagMask = TCP_FLAG_SYN\n\t\tcase \"syn,ack\":\n\t\t\tflag = TCP_FLAG_ACK | TCP_FLAG_SYN\n\t\t\tflagMask = TCP_FLAG_ACK | TCP_FLAG_SYN\n\t\tcase \"ack\":\n\t\t\tflag = TCP_FLAG_ACK\n\t\t\tflagMask = TCP_FLAG_ACK\n\t\tcase \"syn,!ack\":\n\t\t\tflag = TCP_FLAG_SYN\n\t\t\tflagMask = TCP_FLAG_ACK | TCP_FLAG_SYN\n\t\tcase \"!syn,ack\":\n\t\t\tflag = TCP_FLAG_ACK\n\t\t\tflagMask = TCP_FLAG_ACK | TCP_FLAG_SYN\n\t\tdefault:\n\t\t\tlog.Errorf(\"Unknown TCP flags: %s, in rule: %+v\", rule.TcpFlags, rule)\n\t\t\treturn errors.New(\"Unknown TCP flag\")\n\t\t}\n\n\t\tflagPtr = &flag\n\t\tflagMaskPtr = &flagMask\n\t}\n\t// Install the rule in policy table\n\truleFlow, err := self.policyTable.NewFlow(ofctrl.FlowMatch{\n\t\tPriority: uint16(FLOW_POLICY_PRIORITY_OFFSET + rule.Priority),\n\t\tEthertype: 0x0800,\n\t\tIpDa: ipDa,\n\t\tIpDaMask: ipDaMask,\n\t\tIpSa: ipSa,\n\t\tIpSaMask: ipSaMask,\n\t\tIpProto: rule.IpProtocol,\n\t\tTcpSrcPort: rule.SrcPort,\n\t\tTcpDstPort: rule.DstPort,\n\t\tUdpSrcPort: rule.SrcPort,\n\t\tUdpDstPort: rule.DstPort,\n\t\tMetadata: md,\n\t\tMetadataMask: mdm,\n\t\tTcpFlags: flagPtr,\n\t\tTcpFlagsMask: flagMaskPtr,\n\t})\n\tif err != nil {\n\t\tlog.Errorf(\"Error adding flow for rule {%v}. Err: %v\", rule, err)\n\t\treturn err\n\t}\n\n\t// Point it to next table\n\tif rule.Action == \"allow\" {\n\t\terr = ruleFlow.Next(self.nextTable)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Error installing flow {%+v}. Err: %v\", ruleFlow, err)\n\t\t\treturn err\n\t\t}\n\t} else if rule.Action == \"deny\" {\n\t\terr = ruleFlow.Next(self.ofSwitch.DropAction())\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Error installing flow {%+v}. Err: %v\", ruleFlow, err)\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tlog.Errorf(\"Unknown action in rule {%+v}\", rule)\n\t\treturn errors.New(\"Unknown action in rule\")\n\t}\n\n\t// save the rule\n\tpRule := PolicyRule{\n\t\tRule: rule,\n\t\tflow: ruleFlow,\n\t}\n\tself.mutex.Lock()\n\tself.Rules[rule.RuleId] = &pRule\n\tself.mutex.Unlock()\n\n\treturn nil\n}", "func (c *TestClient) DeleteFirewallRule(project, name string) error {\n\tif c.DeleteFirewallRuleFn != nil {\n\t\treturn c.DeleteFirewallRuleFn(project, name)\n\t}\n\treturn c.client.DeleteFirewallRule(project, name)\n}", "func (o BucketServerSideEncryptionConfigurationPtrOutput) Rule() BucketServerSideEncryptionConfigurationRulePtrOutput {\n\treturn o.ApplyT(func(v *BucketServerSideEncryptionConfiguration) *BucketServerSideEncryptionConfigurationRule {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Rule\n\t}).(BucketServerSideEncryptionConfigurationRulePtrOutput)\n}", "func (g *Cloud) UpdateFirewall(f *compute.Firewall) error {\n\tctx, cancel := cloud.ContextWithCallTimeout()\n\tdefer cancel()\n\n\tmc := newFirewallMetricContext(\"update\")\n\treturn mc.Observe(g.c.Firewalls().Update(ctx, meta.GlobalKey(f.Name), f))\n}", "func (s *Service) PatchFirewallRulePort(ruleID string, req PatchFirewallRulePortRequest) (TaskReference, error) {\n\tbody, err := s.patchFirewallRulePortResponseBody(ruleID, req)\n\n\treturn body.Data, err\n}", "func (s *LocalTests) deleteFwRule(c *gc.C, fwRuleId string) {\n\terr := s.testClient.DeleteFirewallRule(fwRuleId)\n\tc.Assert(err, gc.IsNil)\n}", "func (egw *NsxtEdgeGateway) GetNatRuleById(id string) (*NsxtNatRule, error) {\n\t// Ideally this function would use OpenAPI filters to perform server side filtering, but this endpoint does not\n\t// support any filters - even ID. Therefore one must retrieve all items and look if there is an item with the same ID\n\tallNatRules, err := egw.GetAllNatRules(nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error retriving all NSX-T NAT rules: %s\", err)\n\t}\n\n\tfor _, natRule := range allNatRules {\n\t\tif natRule.NsxtNatRule.ID == id {\n\t\t\treturn natRule, nil\n\t\t}\n\t}\n\n\treturn nil, ErrorEntityNotFound\n}", "func (r Virtual_PlacementGroup) GetRule() (resp datatypes.Virtual_PlacementGroup_Rule, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Virtual_PlacementGroup\", \"getRule\", nil, &r.Options, &resp)\n\treturn\n}", "func (a *UnsupportedApiService) ApplicationsTrafficRuleGET(ctx context.Context, appInstanceId string, trafficRuleId string) (TrafficRule, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Get\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue TrafficRule\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/applications/{appInstanceId}/traffic_rules/{trafficRuleId}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"appInstanceId\"+\"}\", fmt.Sprintf(\"%v\", appInstanceId), -1)\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"trafficRuleId\"+\"}\", fmt.Sprintf(\"%v\", trafficRuleId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"application/json\", \"application/problem+json\", \"text/plain\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tif localVarHttpResponse.StatusCode < 300 {\n\t\t// If we succeed, return the data, otherwise pass on to decode error.\n\t\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\tif err == nil {\n\t\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t\t}\n\t}\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\n\t\tif localVarHttpResponse.StatusCode == 200 {\n\t\t\tvar v TrafficRule\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\n\t\tif localVarHttpResponse.StatusCode == 400 {\n\t\t\tvar v ProblemDetails\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\n\t\tif localVarHttpResponse.StatusCode == 403 {\n\t\t\tvar v ProblemDetails\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\n\t\tif localVarHttpResponse.StatusCode == 404 {\n\t\t\tvar v ProblemDetails\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\n\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHttpResponse, nil\n}", "func (az *Cloud) reconcileFirewall(sg network.SecurityGroup, service *apiv1.Service, destAddr string) (network.SecurityGroup, bool, error) {\n\tserviceName := getServiceName(service)\n\twantLb := len(service.Spec.Ports) > 0\n\texpectedSecurityRules := make([]network.SecurityRule, len(service.Spec.Ports))\n\tfor i, port := range service.Spec.Ports {\n\t\tsecurityRuleName := getFwRuleName(service, port)\n\t\t_, securityProto, _, err := getProtocolsFromKubernetesProtocol(port.Protocol)\n\t\tif err != nil {\n\t\t\treturn sg, false, err\n\t\t}\n\n\t\texpectedSecurityRules[i] = network.SecurityRule{\n\t\t\tName: to.StringPtr(securityRuleName),\n\t\t\tSecurityRulePropertiesFormat: &network.SecurityRulePropertiesFormat{\n\t\t\t\tProtocol: securityProto,\n\t\t\t\tSourcePortRange: to.StringPtr(\"*\"),\n\t\t\t\tDestinationPortRange: to.StringPtr(strconv.Itoa(int(port.NodePort))),\n\t\t\t\tSourceAddressPrefix: to.StringPtr(\"Internet\"),\n\t\t\t\tDestinationAddressPrefix: to.StringPtr(destAddr),\n\t\t\t\tAccess: network.SecurityRuleAccessAllow,\n\t\t\t\tDirection: network.SecurityRuleDirectionInbound,\n\t\t\t},\n\t\t}\n\t}\n\n\t// update security rules\n\tdirtySg := false\n\tvar updatedRules []network.SecurityRule\n\tif sg.SecurityRules != nil {\n\t\tupdatedRules = *sg.SecurityRules\n\t}\n\t// update security rules: remove unwanted\n\tfor i := len(updatedRules) - 1; i >= 0; i-- {\n\t\texistingRule := updatedRules[i]\n\t\tif serviceOwnsRule(service, *existingRule.Name) {\n\t\t\tglog.V(10).Infof(\"reconcile(%s)(%t): sg rule(%s) - considering evicting\", serviceName, wantLb, *existingRule.Name)\n\t\t\tkeepRule := false\n\t\t\tif findSecurityRule(expectedSecurityRules, existingRule) {\n\t\t\t\tglog.V(10).Infof(\"reconcile(%s)(%t): sg rule(%s) - keeping\", serviceName, wantLb, *existingRule.Name)\n\t\t\t\tkeepRule = true\n\t\t\t}\n\t\t\tif !keepRule {\n\t\t\t\tglog.V(10).Infof(\"reconcile(%s)(%t): sg rule(%s) - dropping\", serviceName, wantLb, *existingRule.Name)\n\t\t\t\tupdatedRules = append(updatedRules[:i], updatedRules[i+1:]...)\n\t\t\t\tdirtySg = true\n\t\t\t}\n\t\t}\n\t}\n\t// update security rules: add needed\n\tfor _, expectedRule := range expectedSecurityRules {\n\t\tfoundRule := false\n\t\tif findSecurityRule(updatedRules, expectedRule) {\n\t\t\tglog.V(10).Infof(\"reconcile(%s)(%t): sg rule(%s) - already exists\", serviceName, wantLb, *expectedRule.Name)\n\t\t\tfoundRule = true\n\t\t}\n\t\tif !foundRule {\n\t\t\tglog.V(10).Infof(\"reconcile(%s)(%t): sg rule(%s) - adding\", serviceName, wantLb, *expectedRule.Name)\n\n\t\t\tnextAvailablePriority, err := getNextAvailablePriority(updatedRules)\n\t\t\tif err != nil {\n\t\t\t\treturn sg, false, err\n\t\t\t}\n\n\t\t\texpectedRule.Priority = to.Int32Ptr(nextAvailablePriority)\n\t\t\tupdatedRules = append(updatedRules, expectedRule)\n\t\t\tdirtySg = true\n\t\t}\n\t}\n\tif dirtySg {\n\t\tsg.SecurityRules = &updatedRules\n\t}\n\treturn sg, dirtySg, nil\n}", "func (a *Client) GetRules(params *GetRulesParams, opts ...ClientOption) (*GetRulesOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetRulesParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"get-rules\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/fwmgr/entities/rules/v1\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetRulesReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*GetRulesOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for get-rules: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func (in *FlexibleServersFirewallRule) DeepCopy() *FlexibleServersFirewallRule {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FlexibleServersFirewallRule)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (a *BackendOptionsApiService) GetServerSwitchingRule(ctx _context.Context, id int32, backend string, localVarOptionals *GetServerSwitchingRuleOpts) (InlineResponse20023, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue InlineResponse20023\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/services/haproxy/configuration/server_switching_rules/{id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", _neturl.QueryEscape(fmt.Sprintf(\"%v\", id)), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tlocalVarQueryParams.Add(\"backend\", parameterToString(backend, \"\"))\n\tif localVarOptionals != nil && localVarOptionals.TransactionId.IsSet() {\n\t\tlocalVarQueryParams.Add(\"transaction_id\", parameterToString(localVarOptionals.TransactionId.Value(), \"\"))\n\t}\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 200 {\n\t\t\tvar v InlineResponse20023\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v ModelError\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tvar v ModelError\n\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\tif err != nil {\n\t\t\tnewErr.error = err.Error()\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "func LoadRuleFunction(ruleID int64) (result data.RuleFunction, err error) {\n\n\t// init\n\tresult = data.RuleFunction{}\n\n\t// Create connection\n\tconn, err := dbconn.GetConnectionPoolAppDB()\n\n\tif err == nil {\n\n\t\t// Queue SQL\n\t\tsqlQueue := `SELECT rule_id, function_name, drescription FROM rule_function WHERE rule_id = $1`\n\n\t\t// Do execute\n\t\trows, err2 := conn.Query(sqlQueue, ruleID)\n\n\t\tif err2 != nil {\n\t\t\treturn result, err2\n\t\t}\n\t\tdefer rows.Close()\n\n\t\tfor rows.Next() {\n\t\t\terr = rows.Scan(&result.RuleID, &result.FunctionName, &result.Description)\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn result, err\n}", "func (api *API) TeamsRule(ctx context.Context, accountID string, ruleId string) (TeamsRule, error) {\n\turi := fmt.Sprintf(\"/accounts/%s/gateway/rules/%s\", accountID, ruleId)\n\n\tres, err := api.makeRequestContext(ctx, http.MethodGet, uri, nil)\n\tif err != nil {\n\t\treturn TeamsRule{}, err\n\t}\n\n\tvar teamsRuleResponse TeamsRuleResponse\n\terr = json.Unmarshal(res, &teamsRuleResponse)\n\tif err != nil {\n\t\treturn TeamsRule{}, fmt.Errorf(\"%s: %w\", errUnmarshalError, err)\n\t}\n\n\treturn teamsRuleResponse.Result, nil\n}", "func (a *FunnelApiService) GetFunnel(ctx _context.Context, id string) FunnelApiApiGetFunnelRequest {\n\treturn FunnelApiApiGetFunnelRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tid: id,\n\t}\n}", "func GetRulesOfResource(resource string) []Rule {\n\tupdateMux.RLock()\n\tresRules, ok := breakerRules[resource]\n\tupdateMux.RUnlock()\n\tif !ok {\n\t\treturn nil\n\t}\n\tret := make([]Rule, 0, len(resRules))\n\tfor _, rule := range resRules {\n\t\tret = append(ret, *rule)\n\t}\n\treturn ret\n}", "func GetRules(filtersMap map[string]interface{}, page int) ([]Rule, error) {\n\tvar rules []Rule\n\terr := database.Client.GetAll(ruleTable, &rules, filtersMap, nil, page)\n\treturn rules, err\n}", "func (s *CreateFirewallRuleOutput) SetFirewallRule(v *FirewallRule) *CreateFirewallRuleOutput {\n\ts.FirewallRule = v\n\treturn s\n}", "func (a *BackendOptionsApiService) GetHTTPRequestRule(ctx _context.Context, id int32, parentName string, parentType string, localVarOptionals *GetHTTPRequestRuleOpts) (InlineResponse20013, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue InlineResponse20013\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/services/haproxy/configuration/http_request_rules/{id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", _neturl.QueryEscape(fmt.Sprintf(\"%v\", id)), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tlocalVarQueryParams.Add(\"parent_name\", parameterToString(parentName, \"\"))\n\tlocalVarQueryParams.Add(\"parent_type\", parameterToString(parentType, \"\"))\n\tif localVarOptionals != nil && localVarOptionals.TransactionId.IsSet() {\n\t\tlocalVarQueryParams.Add(\"transaction_id\", parameterToString(localVarOptionals.TransactionId.Value(), \"\"))\n\t}\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 200 {\n\t\t\tvar v InlineResponse20013\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v ModelError\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tvar v ModelError\n\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\tif err != nil {\n\t\t\tnewErr.error = err.Error()\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "func convertHALFirewallRules(nsp netproto.NetworkSecurityPolicy, vrfID uint64, ruleIDToAppMapping *sync.Map) []*halapi.SecurityRule {\n\tvar fwRules []*halapi.SecurityRule\n\tfor idx, r := range nsp.Spec.Rules {\n\t\truleMatches, err := buildHALRuleMatches(r.Src, r.Dst, ruleIDToAppMapping, &idx)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Could not convert match criteria Err: %v\", err)\n\t\t}\n\t\tfor _, match := range ruleMatches {\n\t\t\truleAction, err := convertRuleAction(idx, ruleIDToAppMapping, r.Action)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"Failed to convert rule action. Err: %v\", err)\n\t\t\t}\n\t\t\trule := &halapi.SecurityRule{\n\t\t\t\tRuleId: r.ID,\n\t\t\t\tMatch: match,\n\t\t\t\tAction: ruleAction,\n\t\t\t}\n\t\t\tfwRules = append(fwRules, rule)\n\t\t}\n\n\t}\n\treturn fwRules\n}", "func (a *Client) GetScopeRuleConfiguration(params *GetScopeRuleConfigurationParams, authInfo runtime.ClientAuthInfoWriter) (*GetScopeRuleConfigurationOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetScopeRuleConfigurationParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"GetScopeRuleConfiguration\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/cdn/v1/stacks/{stack_id}/sites/{site_id}/scopes/{scope_id}/rules/{rule_id}/configuration\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetScopeRuleConfigurationReader{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.(*GetScopeRuleConfigurationOK), nil\n\n}", "func (f *fakeLB) CreateForwardingRule(_ context.Context, _ string, _ *govultr.ForwardingRule) (*govultr.ForwardingRule, *http.Response, error) {\n\tpanic(\"implement me\")\n}", "func (c *MetricsService) GetRuleByID(id string, options ...OptionFunc) (*Rule, *Response, error) {\n\treq, err := c.client.newRequest(CONSOLE, \"GET\", \"v3/metrics/rules/\"+id, nil, options)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tvar response struct {\n\t\tData Rule `json:\"data\"`\n\t\tStatus string `json:\"status\"`\n\t\tError Error `json:\"error,omitempty\"`\n\t}\n\n\tresp, err := c.client.do(req, &response)\n\tif err != nil {\n\t\tif resp != nil {\n\t\t\tresp.Error = response.Error\n\t\t}\n\t\treturn nil, resp, err\n\t}\n\treturn &response.Data, resp, err\n}", "func (nfr *nfRules) GetRuleHandle(id uint32) (uint64, error) {\n\trules, err := nfr.conn.GetRule(nfr.table, nfr.chain)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tfor _, rule := range rules {\n\t\tif rule.UserData != nil {\n\t\t\t// Rule ID TLV is stored in last 4 bytes of User data\n\t\t\tn := make([]byte, 4)\n\t\t\t// Rule ID TLV 4 bytes:\n\t\t\t// [0] - TLV type , must be 0x2\n\t\t\t// [1] - Value length, must be 2\n\t\t\t// [2:] - 2 bytes carrying Rule ID\n\t\t\tif rule.UserData[len(rule.UserData)-4] != 0x2 || rule.UserData[len(rule.UserData)-3] != 0x2 {\n\t\t\t\treturn 0, fmt.Errorf(\"did not find Rule ID TLV in user data\")\n\t\t\t}\n\t\t\t// Copy last 2 bytes of user data which carry rule id\n\t\t\tcopy(n[2:], rule.UserData[len(rule.UserData)-2:])\n\t\t\truleID := binaryutil.BigEndian.Uint32(n)\n\t\t\tif ruleID == id {\n\t\t\t\treturn rule.Handle, nil\n\t\t\t}\n\t\t}\n\t}\n\n\treturn 0, fmt.Errorf(\"rule with id %d is not found\", id)\n}", "func UnmarshalRulesGet(m map[string]json.RawMessage, result interface{}) (err error) {\n\tobj := new(RulesGet)\n\terr = core.UnmarshalPrimitive(m, \"enabled\", &obj.Enabled)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"event_type_filter\", &obj.EventTypeFilter)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"notification_filter\", &obj.NotificationFilter)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"updated_at\", &obj.UpdatedAt)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalPrimitive(m, \"id\", &obj.ID)\n\tif err != nil {\n\t\treturn\n\t}\n\treflect.ValueOf(result).Elem().Set(reflect.ValueOf(obj))\n\treturn\n}", "func GetTopicRule(ctx *pulumi.Context,\n\tname string, id pulumi.ID, state *TopicRuleState, opts ...pulumi.ResourceOpt) (*TopicRule, error) {\n\tinputs := make(map[string]interface{})\n\tif state != nil {\n\t\tinputs[\"arn\"] = state.Arn\n\t\tinputs[\"cloudwatchAlarm\"] = state.CloudwatchAlarm\n\t\tinputs[\"cloudwatchMetric\"] = state.CloudwatchMetric\n\t\tinputs[\"description\"] = state.Description\n\t\tinputs[\"dynamodb\"] = state.Dynamodb\n\t\tinputs[\"elasticsearch\"] = state.Elasticsearch\n\t\tinputs[\"enabled\"] = state.Enabled\n\t\tinputs[\"firehose\"] = state.Firehose\n\t\tinputs[\"kinesis\"] = state.Kinesis\n\t\tinputs[\"lambda\"] = state.Lambda\n\t\tinputs[\"name\"] = state.Name\n\t\tinputs[\"republish\"] = state.Republish\n\t\tinputs[\"s3\"] = state.S3\n\t\tinputs[\"sns\"] = state.Sns\n\t\tinputs[\"sql\"] = state.Sql\n\t\tinputs[\"sqlVersion\"] = state.SqlVersion\n\t\tinputs[\"sqs\"] = state.Sqs\n\t}\n\ts, err := ctx.ReadResource(\"aws:iot/topicRule:TopicRule\", name, id, inputs, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &TopicRule{s: s}, nil\n}", "func (client *FirewallRulesClient) getCreateRequest(ctx context.Context, resourceGroupName string, serverName string, firewallRuleName string, options *FirewallRulesGetOptions) (*azcore.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}\"\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\tif firewallRuleName == \"\" {\n\t\treturn nil, errors.New(\"parameter firewallRuleName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{firewallRuleName}\", url.PathEscape(firewallRuleName))\n\treq, err := azcore.NewRequest(ctx, http.MethodGet, azcore.JoinPaths(client.con.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Telemetry(telemetryInfo)\n\treqQP := req.URL.Query()\n\treqQP.Set(\"api-version\", \"2017-12-01\")\n\treq.URL.RawQuery = reqQP.Encode()\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "func NewFirewallRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *FirewallRulesClient {\n\tif options == nil {\n\t\toptions = &arm.ClientOptions{}\n\t}\n\tep := options.Endpoint\n\tif len(ep) == 0 {\n\t\tep = arm.AzurePublicCloud\n\t}\n\tclient := &FirewallRulesClient{\n\t\tsubscriptionID: subscriptionID,\n\t\thost: string(ep),\n\t\tpl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options),\n\t}\n\treturn client\n}", "func NewComputeFirewallRuleResource(f *compute.Firewall) *ComputeFirewallRuleResource {\n\tr := new(ComputeFirewallRuleResource)\n\tr.f = f\n\treturn r\n}", "func GetCloudConfigurationRule(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *CloudConfigurationRuleState, opts ...pulumi.ResourceOption) (*CloudConfigurationRule, error) {\n\tvar resource CloudConfigurationRule\n\terr := ctx.ReadResource(\"datadog:index/cloudConfigurationRule:CloudConfigurationRule\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}" ]
[ "0.80485743", "0.73840857", "0.6763698", "0.65429354", "0.6366744", "0.63008314", "0.6192727", "0.6079181", "0.6057715", "0.60016805", "0.5968655", "0.58597064", "0.58534664", "0.5852716", "0.5830666", "0.57886916", "0.57859206", "0.573865", "0.57350063", "0.5678612", "0.56656504", "0.5661296", "0.5631174", "0.5612664", "0.55740845", "0.5529636", "0.5461728", "0.5445767", "0.54391426", "0.54256266", "0.54050064", "0.5376994", "0.53341573", "0.5313319", "0.5310569", "0.5248909", "0.52162606", "0.52087086", "0.51776147", "0.5169769", "0.5152298", "0.5127225", "0.5119195", "0.5115796", "0.51069057", "0.507839", "0.50654376", "0.50629675", "0.5042192", "0.5041666", "0.5038327", "0.50014716", "0.49839368", "0.49774835", "0.49700692", "0.4943486", "0.4902208", "0.48988125", "0.4891485", "0.48876438", "0.48794663", "0.48641816", "0.48521554", "0.48414856", "0.48414624", "0.48411816", "0.48249292", "0.482467", "0.48018503", "0.479855", "0.47926754", "0.47867468", "0.4780696", "0.4775252", "0.4749614", "0.4746303", "0.47362417", "0.47303507", "0.47239703", "0.47214592", "0.47204667", "0.47191894", "0.47171414", "0.47159162", "0.4709917", "0.47095478", "0.47063205", "0.47000197", "0.4690337", "0.46900654", "0.46880263", "0.46864355", "0.46857083", "0.46820772", "0.4675166", "0.4671363", "0.46698955", "0.46690977", "0.46677148", "0.4664559" ]
0.74887437
1
ListFirewallRules uses the override method ListFirewallRulesFn or the real implementation.
func (c *TestClient) ListFirewallRules(project string, opts ...ListCallOption) ([]*compute.Firewall, error) { if c.ListFirewallRulesFn != nil { return c.ListFirewallRulesFn(project, opts...) } return c.client.ListFirewallRules(project, opts...) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (f *fakeLB) ListFirewallRules(_ context.Context, _ string, _ *govultr.ListOptions) ([]govultr.LBFirewallRule, *govultr.Meta, *http.Response, error) {\n\treturn nil, nil, nil, nil\n}", "func (r *Router) ListRules(w http.ResponseWriter, req *http.Request, _ httprouter.Params) {\n\tvar readableRules []config.RuleConfig\n\tfor _, s := range r.services {\n\t\tfor _, rule := range s.Proxy.GetRules() {\n\t\t\t// Convert to human-readable\n\t\t\tc := rule.ToConfig()\n\t\t\treadableRules = append(readableRules, c)\n\t\t}\n\t}\n\tlog.WithField(\"rules\", readableRules).Debug(\"List rules:\")\n\t// Write it out\n\te := json.NewEncoder(w)\n\tif e.Encode(readableRules) != nil {\n\t\tlog.Error(\"Error encoding router rules to JSON\")\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tw.Write([]byte(\"Encoding rules problem\"))\n\t}\n}", "func (ks *kuiperService) ListRules(ctx context.Context, token string, offset, limit uint64, name string, metadata Metadata) (RulesPage, error) {\n\tres, err := ks.auth.Identify(ctx, &mainflux.Token{Value: token})\n\tif err != nil {\n\t\treturn RulesPage{}, ErrUnauthorizedAccess\n\t}\n\n\treturn ks.rules.RetrieveAll(ctx, res.GetValue(), offset, limit, name, metadata)\n}", "func (f *fakeLB) ListForwardingRules(_ context.Context, _ string, _ *govultr.ListOptions) ([]govultr.ForwardingRule, *govultr.Meta, *http.Response, error) {\n\treturn []govultr.ForwardingRule{{\n\t\t\tRuleID: \"1234\",\n\t\t\tFrontendProtocol: \"tcp\",\n\t\t\tFrontendPort: 80,\n\t\t\tBackendProtocol: \"tcp\",\n\t\t\tBackendPort: 80,\n\t\t}}, &govultr.Meta{\n\t\t\tTotal: 0,\n\t\t\tLinks: &govultr.Links{\n\t\t\t\tNext: \"\",\n\t\t\t\tPrev: \"\",\n\t\t\t},\n\t\t}, nil, nil\n}", "func (c *TestClient) ListForwardingRules(project, region string, opts ...ListCallOption) ([]*compute.ForwardingRule, error) {\n\tif c.ListForwardingRulesFn != nil {\n\t\treturn c.ListForwardingRulesFn(project, region, opts...)\n\t}\n\treturn c.client.ListForwardingRules(project, region, opts...)\n}", "func (m *MockFirewallServiceIface) ListFirewallRules(p *ListFirewallRulesParams) (*ListFirewallRulesResponse, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListFirewallRules\", p)\n\tret0, _ := ret[0].(*ListFirewallRulesResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (r *rulesRPCHandler) ListRules(ctx context.Context, req *api.ListReq) (*api.RuleList, error) {\n\trules := api.RuleList{}\n\tif err := clients[0].List(ctx, \"/rules\", &rules); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &rules, nil\n}", "func (fw IPtables) ListRules() ([]IPtablesRule, error) {\n\treturn fw.Store.listIPtablesRules()\n}", "func (m *MockIPTService) ListRules() []string {\n\treturn []string{}\n}", "func (rs *RuleSet) ListRules() (rules []Rule, err error) {\n\treturn rs.Rules, nil\n}", "func (mr *MockFirewallServiceIfaceMockRecorder) ListFirewallRules(p interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ListFirewallRules\", reflect.TypeOf((*MockFirewallServiceIface)(nil).ListFirewallRules), p)\n}", "func (sys *System) ListRules(ctx *Context, location string, includeInherited bool) ([]string, error) {\n\tthen := Now()\n\tatomic.AddUint64(&sys.stats.TotalCalls, uint64(1))\n\tatomic.AddUint64(&sys.stats.ListRules, uint64(1))\n\ttimer := NewTimer(ctx, \"SystemListRules\")\n\tdefer timer.Stop()\n\n\tloc, err := sys.findLocation(ctx, location, true)\n\tdefer sys.releaseLocation(ctx, location)\n\tvar ss []string\n\tif err == nil {\n\t\tMetric(ctx, \"System.ListRules\", \"location\", location)\n\t\tss, err = loc.ListRules(ctx, includeInherited)\n\t}\n\tif err != nil {\n\t\tLog(ERROR, ctx, \"System.ListRules\", \"location\", location)\n\t}\n\n\tatomic.AddUint64(&sys.stats.TotalTime, uint64(Now()-then))\n\treturn ss, sys.stats.IncErrors(err)\n}", "func (rules *Rules) ListOfRules() []Rule {\n\treturn rules.list\n}", "func (c *Client) ListRule(args *ListRuleArgs) (*ListRuleResult, error) {\n\tjsonBytes, jsonErr := json.Marshal(args)\n\tif jsonErr != nil {\n\t\treturn nil, jsonErr\n\t}\n\tbody, err := bce.NewBodyFromBytes(jsonBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ListRule(c, body)\n}", "func (cli *OpsGenieUserV2Client) ListForwardingRules(req userv2.ListUserForwardingRulesRequest) (*userv2.ListUserForwardingRulesResponse, error) {\n\tvar response userv2.ListUserForwardingRulesResponse\n\terr := cli.sendGetRequest(&req, &response)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &response, nil\n}", "func (api *API) ListWAFRules(zoneID, packageID string) ([]WAFRule, error) {\n\tvar r WAFRulesResponse\n\tvar rules []WAFRule\n\tvar res []byte\n\tvar err error\n\turi := \"/zones/\" + zoneID + \"/firewall/waf/packages/\" + packageID + \"/rules\"\n\tres, err = api.makeRequest(\"GET\", uri, nil)\n\tif err != nil {\n\t\treturn []WAFRule{}, errors.Wrap(err, errMakeRequestError)\n\t}\n\terr = json.Unmarshal(res, &r)\n\tif err != nil {\n\t\treturn []WAFRule{}, errors.Wrap(err, errUnmarshalError)\n\t}\n\tif !r.Success {\n\t\t// TODO: Provide an actual error message instead of always returning nil\n\t\treturn []WAFRule{}, err\n\t}\n\tfor ri := range r.Result {\n\t\trules = append(rules, r.Result[ri])\n\t}\n\treturn rules, nil\n}", "func (client *Client) ListRules(request *ListRulesRequest) (_result *ListRulesResponse, _err error) {\n\truntime := &util.RuntimeOptions{}\n\t_result = &ListRulesResponse{}\n\t_body, _err := client.ListRulesWithOptions(request, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_result = _body\n\treturn _result, _err\n}", "func (c *CloudWatchEvents) ListRules(input *ListRulesInput) (*ListRulesOutput, error) {\n\treq, out := c.ListRulesRequest(input)\n\terr := req.Send()\n\treturn out, err\n}", "func (r *FirewallManagementIPRulesResource) ListAll() (*FirewallManagementIPRulesConfigList, error) {\n\tvar list FirewallManagementIPRulesConfigList\n\tif err := r.c.ReadQuery(BasePath+FirewallManagementIPRulesEndpoint, &list); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &list, nil\n}", "func NewFirewallRuleListResultIterator (page FirewallRuleListResultPage) FirewallRuleListResultIterator {\n return FirewallRuleListResultIterator{page: page}\n }", "func (c *Client) ListFirewalls(ctx context.Context, opts *ListOptions) ([]Firewall, error) {\n\tresponse := FirewallsPagedResponse{}\n\n\terr := c.listHelper(ctx, &response, opts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn response.Data, nil\n}", "func (client FirewallPolicyRuleGroupsClient) List(ctx context.Context, resourceGroupName string, firewallPolicyName string) (result FirewallPolicyRuleGroupListResultPage, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/FirewallPolicyRuleGroupsClient.List\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.fprglr.Response.Response != nil {\n\t\t\t\tsc = result.fprglr.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tresult.fn = client.listNextResults\n\treq, err := client.ListPreparer(ctx, resourceGroupName, firewallPolicyName)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.FirewallPolicyRuleGroupsClient\", \"List\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.ListSender(req)\n\tif err != nil {\n\t\tresult.fprglr.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"network.FirewallPolicyRuleGroupsClient\", \"List\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult.fprglr, err = client.ListResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.FirewallPolicyRuleGroupsClient\", \"List\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\tif result.fprglr.hasNextLink() && result.fprglr.IsEmpty() {\n\t\terr = result.NextWithContext(ctx)\n\t\treturn\n\t}\n\n\treturn\n}", "func (m *MockFirewallServiceIface) ListPortForwardingRules(p *ListPortForwardingRulesParams) (*ListPortForwardingRulesResponse, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListPortForwardingRules\", p)\n\tret0, _ := ret[0].(*ListPortForwardingRulesResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (s *API) ListInstanceACLRules(req *ListInstanceACLRulesRequest, opts ...scw.RequestOption) (*ListInstanceACLRulesResponse, 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\tdefaultPageSize, exist := s.client.GetDefaultPageSize()\n\tif (req.PageSize == nil || *req.PageSize == 0) && exist {\n\t\treq.PageSize = &defaultPageSize\n\t}\n\n\tquery := url.Values{}\n\tparameter.AddToQuery(query, \"page\", req.Page)\n\tparameter.AddToQuery(query, \"page_size\", req.PageSize)\n\n\tif fmt.Sprint(req.Region) == \"\" {\n\t\treturn nil, errors.New(\"field Region cannot be empty in request\")\n\t}\n\n\tif fmt.Sprint(req.InstanceID) == \"\" {\n\t\treturn nil, errors.New(\"field InstanceID cannot be empty in request\")\n\t}\n\n\tscwReq := &scw.ScalewayRequest{\n\t\tMethod: \"GET\",\n\t\tPath: \"/rdb/v1/regions/\" + fmt.Sprint(req.Region) + \"/instances/\" + fmt.Sprint(req.InstanceID) + \"/acls\",\n\t\tQuery: query,\n\t\tHeaders: http.Header{},\n\t}\n\n\tvar resp ListInstanceACLRulesResponse\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 (c *Client) ListAclRules(args *ListAclRulesArgs) (*ListAclRulesResult, error) {\n\tif args == nil {\n\t\treturn nil, fmt.Errorf(\"The listAclRulesArgs cannot be nil.\")\n\t}\n\tif args.MaxKeys == 0 {\n\t\targs.MaxKeys = 1000\n\t}\n\n\tresult := &ListAclRulesResult{}\n\terr := bce.NewRequestBuilder(c).\n\t\tWithURL(getURLForAclRule()).\n\t\tWithMethod(http.GET).\n\t\tWithQueryParamFilter(\"marker\", args.Marker).\n\t\tWithQueryParam(\"maxKeys\", strconv.Itoa(args.MaxKeys)).\n\t\tWithQueryParam(\"subnetId\", args.SubnetId).\n\t\tWithResult(result).\n\t\tDo()\n\n\treturn result, err\n}", "func (m *RuleConfigManager) List(opts ...RequestOption) (r []*RuleConfig, err error) {\n\terr = m.Request(\"GET\", m.URI(\"rules-configs\"), &r, applyListDefaults(opts))\n\treturn\n}", "func (c *Client) ListFirewallConfigs(ctx context.Context, params *ListFirewallConfigsInput, optFns ...func(*Options)) (*ListFirewallConfigsOutput, error) {\n\tif params == nil {\n\t\tparams = &ListFirewallConfigsInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"ListFirewallConfigs\", params, optFns, addOperationListFirewallConfigsMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*ListFirewallConfigsOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "func (client *Client) ListRulesWithOptions(request *ListRulesRequest, runtime *util.RuntimeOptions) (_result *ListRulesResponse, _err error) {\n\t_err = util.ValidateModel(request)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_result = &ListRulesResponse{}\n\t_body, _err := client.DoRequest(tea.String(\"listRules\"), tea.String(\"HTTP\"), tea.String(\"POST\"), tea.String(\"/openapi/listRules\"), nil, tea.ToMap(request), 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 *NamespaceWebhook) Rules() []admissionregv1.RuleWithOperations { return rules }", "func (c *Firewall) GetList() ([]string, error) {\n\tans := c.container()\n\treturn c.ns.Listing(util.Get, c.pather(), ans)\n}", "func (c *kaosRules) List(opts meta_v1.ListOptions) (result *v1.KaosRuleList, err error) {\n\tresult = &v1.KaosRuleList{}\n\terr = c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"kaosrules\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tDo().\n\t\tInto(result)\n\treturn\n}", "func (m *MockFirewallServiceIface) ListIpv6FirewallRules(p *ListIpv6FirewallRulesParams) (*ListIpv6FirewallRulesResponse, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListIpv6FirewallRules\", p)\n\tret0, _ := ret[0].(*ListIpv6FirewallRulesResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func BandwidthLimitRulesList(c *gophercloud.ServiceClient, policyID string, opts BandwidthLimitRulesListOptsBuilder) pagination.Pager {\n\turl := listBandwidthLimitRulesURL(c, policyID)\n\tif opts != nil {\n\t\tquery, err := opts.ToBandwidthLimitRulesListQuery()\n\t\tif err != nil {\n\t\t\treturn pagination.Pager{Err: err}\n\t\t}\n\t\turl += query\n\t}\n\treturn pagination.NewPager(c, url, func(r pagination.PageResult) pagination.Page {\n\t\treturn BandwidthLimitRulePage{pagination.LinkedPageBase{PageResult: r}}\n\n\t})\n}", "func RuleListHandler(w http.ResponseWriter, req *http.Request) {\n\trules := api.RuleList{}\n\n\tif err := clients[0].List(context.Background(), \"/rules\", &rules); err != nil {\n\t\tif kvstore.IsKeyNotFoundError(err) {\n\t\t\terrors.SendNotFound(w, \"NodeList\", \"\")\n\t\t\treturn\n\t\t}\n\t\terrors.SendInternalError(w, err)\n\t\treturn\n\t}\n\n\tencoder := json.NewEncoder(w)\n\tbefore := time.Now()\n\tencoder.Encode(&rules)\n\tlog.Infof(\"Encode time %v\", time.Since(before))\n}", "func (s *dnsRuleLister) List(selector labels.Selector) (ret []*v1.DnsRule, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1.DnsRule))\n\t})\n\treturn ret, err\n}", "func (c *CloudWatchEvents) ListRulesRequest(input *ListRulesInput) (req *request.Request, output *ListRulesOutput) {\n\top := &request.Operation{\n\t\tName: opListRules,\n\t\tHTTPMethod: \"POST\",\n\t\tHTTPPath: \"/\",\n\t}\n\n\tif input == nil {\n\t\tinput = &ListRulesInput{}\n\t}\n\n\treq = c.newRequest(op, input, output)\n\toutput = &ListRulesOutput{}\n\treq.Data = output\n\treturn\n}", "func (e *Environment) Firewall(environmentName string) ([]Firewall, error) {\n\tc := fmt.Sprintf(\"list environment firewall %s\", environmentName)\n\tb, err := cmd.RunCommand(c)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfirewalls := []Firewall{}\n\terr = json.Unmarshal(b, &firewalls)\n\tif err != nil {\n\t\t// it may have been just an empty output from the Frontend\n\t\tnullOutput := NullOutput{}\n\t\terr = json.Unmarshal(b, &nullOutput)\n\t\tif err != nil {\n\t\t\t// if we still can't recognize the output, return an error\n\t\t\treturn nil, err\n\t\t}\n\t\treturn firewalls, err\n\t}\n\treturn firewalls, err\n}", "func (in *FlexibleServersFirewallRuleList) DeepCopy() *FlexibleServersFirewallRuleList {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FlexibleServersFirewallRuleList)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func NewFirewallRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *FirewallRulesClient {\n\tif options == nil {\n\t\toptions = &arm.ClientOptions{}\n\t}\n\tep := options.Endpoint\n\tif len(ep) == 0 {\n\t\tep = arm.AzurePublicCloud\n\t}\n\tclient := &FirewallRulesClient{\n\t\tsubscriptionID: subscriptionID,\n\t\thost: string(ep),\n\t\tpl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options),\n\t}\n\treturn client\n}", "func (r *NATPolicyRulesResource) ListAll() (*NATPolicyRulesConfigList, error) {\n\tvar list NATPolicyRulesConfigList\n\tif err := r.c.ReadQuery(BasePath+NATPolicyRulesEndpoint, &list); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &list, nil\n}", "func (r *FirewallGlobalRulesStagedPolicyRulesResource) ListAll() (*FirewallGlobalRulesStagedPolicyRulesConfigList, error) {\n\tvar list FirewallGlobalRulesStagedPolicyRulesConfigList\n\tif err := r.c.ReadQuery(BasePath+FirewallGlobalRulesStagedPolicyRulesEndpoint, &list); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &list, nil\n}", "func (mr *MockInterfaceMockRecorder) ListRules(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ListRules\", reflect.TypeOf((*MockInterface)(nil).ListRules), arg0, arg1)\n}", "func (m *MockFirewallServiceIface) ListEgressFirewallRules(p *ListEgressFirewallRulesParams) (*ListEgressFirewallRulesResponse, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListEgressFirewallRules\", p)\n\tret0, _ := ret[0].(*ListEgressFirewallRulesResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func ApplRules() {\n\tipt, err := iptables.New()\n\n\tchain := \"GUO_OPENSHIFT_INPUT\"\n\t// Saving the list of chains before executing tests\n\t// chain now exists\t\n\terr = ipt.ClearChain(\"filter\", chain)\n\tif err != nil {\n\t\tlog.Warnf(\"ClearChain (of empty) failed: %v\", err)\n\t} else {\n\t\tlog.Infof(\"ClearChain done: %v\", chain)\n\t}\n\n\tlistChain, err := ipt.ListChains(\"filter\")\n\tif err != nil {\n\t\tfmt.Printf(\"ListChains of Initial failed: %v\", err)\n\t} else {\n\t\tlog.Infof(\"List Chain works: %v\", chain)\n\t}\n\n\t// check that chain is fully gone and that state similar to initial one\n\tlistChain, err = ipt.ListChains(\"filter\")\n\tif err != nil {\n\t\tfmt.Printf(\"ListChains failed: %v\", err)\n\t} else {\n\t\tlog.Infof(\"List Chain works: %v\", listChain)\n\t}\n\n\tfwRules := firewallRule{chain: \"GUO_OPENSHIFT_INPUT\", rule: []string{\"-p\", \"tcp\", \"--dport\", \"22\", \"-m\", \"conntrack\", \"--ctstate\", \"NEW,ESTABLISHED\", \"-j\", \"ACCEPT\", \"-m\", \"comment\", \"--comment\", \"\\\"tkggo test\\\"\"}}\n\tfwRules1 := firewallRule{chain: \"GUO_OPENSHIFT_INPUT\", rule: []string{\"-p\", \"tcp\", \"--dport\", \"23\", \"-m\", \"conntrack\", \"--ctstate\", \"NEW,ESTABLISHED\", \"-j\", \"ACCEPT\", \"-m\", \"comment\", \"--comment\", \"\\\"tkggo test 23\\\"\"}}\n\tfwRuelSet := firewallRules{[]firewallRule{fwRules, fwRules1}}\n\n\tfor _, rr := range fwRuelSet.rules {\n\t\tlog.Infoln(rr.chain, rr.rule)\n\t\terr = ipt.AppendUnique(\"filter\", rr.chain, rr.rule...)\n\t\tif err != nil {\n\t\t\tlog.Warnf(\"Append failed: %v\", err)\n\t\t} else {\n\t\t\tlog.Infof(\"LisAppend works: %v, %v\", fwRules.chain, fwRules.rule)\n\t\t}\n\t}\n\n\tstats, err := ipt.Stats(\"filter\", chain)\n\tif err != nil {\n\t\tfmt.Printf(\"stats failed: %v\", err)\n\t}\n\tfmt.Println(\"================>>\")\n\tfmt.Println(stats)\n\n}", "func NewFirewallRulesClient(con *armcore.Connection, subscriptionID string) *FirewallRulesClient {\n\treturn &FirewallRulesClient{con: con, subscriptionID: subscriptionID}\n}", "func (s *wafregionalRuleLister) List(selector labels.Selector) (ret []*v1alpha1.WafregionalRule, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.WafregionalRule))\n\t})\n\treturn ret, err\n}", "func (s *prometheusruleWebhook) Rules() []admissionregv1.RuleWithOperations {\n\treturn rules\n}", "func (s *AccessRuleService) List(path string, depth int, ancestors bool) ([]*api.AccessRule, error) {\n\treturn s.Lister.List(path, depth, ancestors)\n}", "func (h *IptablesUtilsHandler) IptablesListRules(table string, chain string) ([]string, error) {\n\tiptablesObject, err := iptables.New()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trules, err := iptablesObject.List(table, chain)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// ignore rule of chain creation\n\treturn rules[1:], nil\n}", "func Firewalls() []Firewall {\n\tvar firewalls = make([]Firewall, 2)\n\n\tvar userProject UserProject\n\tvar email Email\n\tfirewalls[0] = userProject\n\tfirewalls[1] = email\n\n\treturn firewalls\n}", "func (c *Client) ListEscalationRules(escID string) (*ListEscalationRulesResponse, error) {\n\tresp, err := c.get(escPath + \"/\" + escID + \"/escalation_rules\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar result ListEscalationRulesResponse\n\treturn &result, c.decodeJSON(resp, &result)\n}", "func (d TinkDB) ListWorkflows(fn func(wf Workflow) error) error {\n\trows, err := d.instance.Query(`\n\tSELECT id, template, devices, created_at, updated_at\n\tFROM workflow\n\tWHERE\n\t\tdeleted_at IS NULL;\n\t`)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer rows.Close()\n\tvar (\n\t\tid, tmp, tar string\n\t\tcrAt, upAt time.Time\n\t)\n\n\tfor rows.Next() {\n\t\terr = rows.Scan(&id, &tmp, &tar, &crAt, &upAt)\n\t\tif err != nil {\n\t\t\terr = errors.Wrap(err, \"SELECT\")\n\t\t\td.logger.Error(err)\n\t\t\treturn err\n\t\t}\n\n\t\twf := Workflow{\n\t\t\tID: id,\n\t\t\tTemplate: tmp,\n\t\t\tHardware: tar,\n\t\t}\n\t\twf.CreatedAt, _ = ptypes.TimestampProto(crAt)\n\t\twf.UpdatedAt, _ = ptypes.TimestampProto(upAt)\n\t\terr = fn(wf)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\terr = rows.Err()\n\tif err == sql.ErrNoRows {\n\t\terr = nil\n\t}\n\treturn err\n}", "func (f *fakeLB) GetFirewallRule(_ context.Context, _, _ string) (*govultr.LBFirewallRule, *http.Response, error) {\n\treturn nil, nil, nil\n}", "func NewFirewallRuleListResultPage (getNextPage func(context.Context, FirewallRuleListResult) (FirewallRuleListResult, error)) FirewallRuleListResultPage {\n return FirewallRuleListResultPage{fn: getNextPage}\n }", "func (m *MockInterface) ListRules(arg0, arg1 string) ([]string, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListRules\", arg0, arg1)\n\tret0, _ := ret[0].([]string)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func Rules() []C.Rule {\n\treturn rules\n}", "func (c *snapshotRules) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.SnapshotRuleList, err error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\tresult = &v1alpha1.SnapshotRuleList{}\n\terr = c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"snapshotrules\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tDo(ctx).\n\t\tInto(result)\n\treturn\n}", "func (mr *MockFirewallServiceIfaceMockRecorder) ListPortForwardingRules(p interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ListPortForwardingRules\", reflect.TypeOf((*MockFirewallServiceIface)(nil).ListPortForwardingRules), p)\n}", "func (c *AuditClient) GetRules() ([][]byte, error) {\n\tmsg := syscall.NetlinkMessage{\n\t\tHeader: syscall.NlMsghdr{\n\t\t\tType: uint16(auparse.AUDIT_LIST_RULES),\n\t\t\tFlags: syscall.NLM_F_REQUEST | syscall.NLM_F_ACK,\n\t\t},\n\t\tData: nil,\n\t}\n\n\t// Send AUDIT_LIST_RULES message to the kernel.\n\tseq, err := c.Netlink.Send(msg)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed sending request: %w\", err)\n\t}\n\n\t// Get the ack message which is a NLMSG_ERROR type whose error code is SUCCESS.\n\tack, err := c.getReply(seq)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get audit ACK: %w\", err)\n\t}\n\n\tif ack.Header.Type != syscall.NLMSG_ERROR {\n\t\treturn nil, fmt.Errorf(\"unexpected ACK to LIST_RULES, got type=%d\", ack.Header.Type)\n\t}\n\n\tif err = ParseNetlinkError(ack.Data); err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar rules [][]byte\n\tfor {\n\t\treply, err := c.getReply(seq)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed receiving rule data: %w\", err)\n\t\t}\n\n\t\tif reply.Header.Type == syscall.NLMSG_DONE {\n\t\t\tbreak\n\t\t}\n\n\t\tif reply.Header.Type != uint16(auparse.AUDIT_LIST_RULES) {\n\t\t\treturn nil, fmt.Errorf(\"unexpected message type %d while receiving rules\", reply.Header.Type)\n\t\t}\n\n\t\trule := make([]byte, len(reply.Data))\n\t\tcopy(rule, reply.Data)\n\t\trules = append(rules, rule)\n\t}\n\n\treturn rules, nil\n}", "func (c *Client) ListRulesPackages(ctx context.Context, params *ListRulesPackagesInput, optFns ...func(*Options)) (*ListRulesPackagesOutput, error) {\n\tif params == nil {\n\t\tparams = &ListRulesPackagesInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"ListRulesPackages\", params, optFns, addOperationListRulesPackagesMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*ListRulesPackagesOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "func (s *FirewallServer) ListComputeFirewall(ctx context.Context, request *computepb.ListComputeFirewallRequest) (*computepb.ListComputeFirewallResponse, error) {\n\tcl, err := createConfigFirewall(ctx, request.ServiceAccountFile)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresources, err := cl.ListFirewall(ctx, request.Project)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar protos []*computepb.ComputeFirewall\n\tfor _, r := range resources.Items {\n\t\trp := FirewallToProto(r)\n\t\tprotos = append(protos, rp)\n\t}\n\treturn &computepb.ListComputeFirewallResponse{Items: protos}, nil\n}", "func (c *Client) ListAccessRules(dirBlindName string, depth int, withAncestors bool) ([]*api.AccessRule, error) {\n\tout := []*api.AccessRule{}\n\trawURL := fmt.Sprintf(pathDirRules, c.base.String(), dirBlindName)\n\trawURL = fmt.Sprintf(rawURL+\"?depth=%d&ancestors=%v\", depth, withAncestors)\n\terr := c.get(rawURL, true, &out)\n\treturn out, errio.Error(err)\n}", "func (rc *RouteController) ConfigureFirewall() error {\n\tiptHandler, err := iptables.New()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trc.firewallChan = make(chan bool)\n\tfwRules := generateRules(rc.vxlanDev.Link.Name)\n\n\tgo func() {\n\t\tticker := time.NewTicker(5 * time.Second)\n\t\tdefer ticker.Stop()\n\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-ticker.C: // every five seconds we enforce the firewall rules.\n\t\t\t\tfor i := range fwRules {\n\t\t\t\t\tif err := addRule(iptHandler, &fwRules[i]); err != nil {\n\t\t\t\t\t\tklog.Errorf(\"unable to insert firewall rule {%s}: %v\", fwRules[i].String(), err)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tklog.V(5).Infof(\"firewall rule {%s} configured\", fwRules[i].String())\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tcase <-rc.firewallChan:\n\t\t\t\tfor i := range fwRules {\n\t\t\t\t\tif err := deleteRule(iptHandler, &fwRules[i]); err != nil {\n\t\t\t\t\t\tklog.Errorf(\"unable to remove firewall rule {%s}: %v\", fwRules[i].String(), err)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tklog.V(5).Infof(\"firewall rule {%s} removed\", fwRules[i].String())\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tclose(rc.firewallChan)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn nil\n}", "func (f *FirewallRuleListResult) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", f, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"nextLink\":\n\t\t\terr = unpopulate(val, \"NextLink\", &f.NextLink)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"value\":\n\t\t\terr = unpopulate(val, \"Value\", &f.Value)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", f, err)\n\t\t}\n\t}\n\treturn nil\n}", "func (s *AccessRuleLister) List(path string, depth int, ancestors bool) ([]*api.AccessRule, error) {\n\ts.ArgPath = path\n\ts.ArgDepth = depth\n\ts.ArgAncestors = ancestors\n\treturn s.ReturnsAccessRules, s.Err\n}", "func (r *AccountsContainersRulesService) List(accountId string, containerId string) *AccountsContainersRulesListCall {\n\treturn &AccountsContainersRulesListCall{\n\t\ts: r.s,\n\t\taccountId: accountId,\n\t\tcontainerId: containerId,\n\t\tcaller_: googleapi.JSONCall{},\n\t\tparams_: make(map[string][]string),\n\t\tpathTemplate_: \"accounts/{accountId}/containers/{containerId}/rules\",\n\t\tcontext_: googleapi.NoContext,\n\t}\n}", "func (frlr FirewallRuleListResult) firewallRuleListResultPreparer(ctx context.Context) (*http.Request, error) {\n if !frlr.hasNextLink() {\n return nil, nil\n }\n return autorest.Prepare((&http.Request{}).WithContext(ctx),\n autorest.AsJSON(),\n autorest.AsGet(),\n autorest.WithBaseURL(to.String( frlr.NextLink)));\n }", "func (m *MockLoadBalancerServiceIface) ListLoadBalancerRules(p *ListLoadBalancerRulesParams) (*ListLoadBalancerRulesResponse, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListLoadBalancerRules\", p)\n\tret0, _ := ret[0].(*ListLoadBalancerRulesResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (m *MockFirewallServiceIface) ListPaloAltoFirewalls(p *ListPaloAltoFirewallsParams) (*ListPaloAltoFirewallsResponse, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListPaloAltoFirewalls\", p)\n\tret0, _ := ret[0].(*ListPaloAltoFirewallsResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (mr *MockFirewallServiceIfaceMockRecorder) ListIpv6FirewallRules(p interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ListIpv6FirewallRules\", reflect.TypeOf((*MockFirewallServiceIface)(nil).ListIpv6FirewallRules), p)\n}", "func GetRules(filtersMap map[string]interface{}, page int) ([]Rule, error) {\n\tvar rules []Rule\n\terr := database.Client.GetAll(ruleTable, &rules, filtersMap, nil, page)\n\treturn rules, err\n}", "func MakeFirewallRuleSlice() []*FirewallRule {\n\treturn []*FirewallRule{}\n}", "func (r *FirewallScheduleResource) ListAll() (*FirewallScheduleConfigList, error) {\n\tvar list FirewallScheduleConfigList\n\tif err := r.c.ReadQuery(BasePath+FirewallScheduleEndpoint, &list); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &list, nil\n}", "func convertHALFirewallRules(nsp netproto.NetworkSecurityPolicy, vrfID uint64, ruleIDToAppMapping *sync.Map) []*halapi.SecurityRule {\n\tvar fwRules []*halapi.SecurityRule\n\tfor idx, r := range nsp.Spec.Rules {\n\t\truleMatches, err := buildHALRuleMatches(r.Src, r.Dst, ruleIDToAppMapping, &idx)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Could not convert match criteria Err: %v\", err)\n\t\t}\n\t\tfor _, match := range ruleMatches {\n\t\t\truleAction, err := convertRuleAction(idx, ruleIDToAppMapping, r.Action)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"Failed to convert rule action. Err: %v\", err)\n\t\t\t}\n\t\t\trule := &halapi.SecurityRule{\n\t\t\t\tRuleId: r.ID,\n\t\t\t\tMatch: match,\n\t\t\t\tAction: ruleAction,\n\t\t\t}\n\t\t\tfwRules = append(fwRules, rule)\n\t\t}\n\n\t}\n\treturn fwRules\n}", "func (s dnsRuleNamespaceLister) List(selector labels.Selector) (ret []*v1.DnsRule, err error) {\n\terr = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1.DnsRule))\n\t})\n\treturn ret, err\n}", "func (c *Config) Rules() []C.Rule {\n\treturn c.rules\n}", "func (firewall *NsxtFirewall) DeleteAllRules() error {\n\n\tif firewall.edgeGatewayId == \"\" {\n\t\treturn fmt.Errorf(\"missing Edge Gateway ID\")\n\t}\n\n\tendpoint := types.OpenApiPathVersion1_0_0 + types.OpenApiEndpointNsxtFirewallRules\n\tminimumApiVersion, err := firewall.client.checkOpenApiEndpointCompatibility(endpoint)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\turlRef, err := firewall.client.OpenApiBuildEndpoint(fmt.Sprintf(endpoint, firewall.edgeGatewayId))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = firewall.client.OpenApiDeleteItem(minimumApiVersion, urlRef, nil, nil)\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error deleting all NSX-T Firewall Rules: %s\", err)\n\t}\n\n\treturn nil\n}", "func (fw *IPtables) makeRules(netif FirewallEndpoint) error {\n\tlog.Infof(\"In makeRules() with %s\", netif.GetName())\n\n\tvar err error\n\tfw.u32filter, fw.chainPrefix, err = fw.prepareU32Rules(netif.GetIP())\n\tif err != nil {\n\t\t// TODO need personalized error here, or even panic\n\t\treturn err\n\t}\n\tfw.interfaceName = netif.GetName()\n\n\tfw.chains = append(fw.chains, IPtablesChain{\n\t\tBaseChain: \"INPUT\",\n\t\tDirections: []string{\"i\"},\n\t\tChainName: \"ROMANA-INPUT\",\n\t})\n\tfw.chains = append(fw.chains, IPtablesChain{\n\t\tBaseChain: \"OUTPUT\",\n\t\tDirections: []string{\"o\"},\n\t\tChainName: \"ROMANA-FORWARD-IN\",\n\t})\n\tfw.chains = append(fw.chains, IPtablesChain{\n\t\tBaseChain: \"FORWARD\",\n\t\tDirections: []string{\"i\"},\n\t\tChainName: \"ROMANA-FORWARD-OUT\",\n\t})\n\tfw.chains = append(fw.chains, IPtablesChain{\n\t\tBaseChain: \"FORWARD\",\n\t\tDirections: []string{\"o\"},\n\t\t// Using ROMANA-FORWARD-IN second time to capture both\n\t\t// traffic from host to endpoint and\n\t\t// traffic from endpoint to another endpoint.\n\t\tChainName: \"ROMANA-FORWARD-IN\",\n\t})\n\n\tlog.Infof(\"In makeRules() created chains %v\", fw.chains)\n\treturn nil\n}", "func (f *FirewallRule) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", f, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"id\":\n\t\t\terr = unpopulate(val, \"ID\", &f.ID)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &f.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"properties\":\n\t\t\terr = unpopulate(val, \"Properties\", &f.Properties)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"type\":\n\t\t\terr = unpopulate(val, \"Type\", &f.Type)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", f, err)\n\t\t}\n\t}\n\treturn nil\n}", "func GetRules() []Rule {\n\tupdateMux.RLock()\n\trules := rulesFrom(breakerRules)\n\tupdateMux.RUnlock()\n\tret := make([]Rule, 0, len(rules))\n\tfor _, rule := range rules {\n\t\tret = append(ret, *rule)\n\t}\n\treturn ret\n}", "func (o *AggregatedDomain) VirtualFirewallRules(info *bambou.FetchingInfo) (VirtualFirewallRulesList, *bambou.Error) {\n\n\tvar list VirtualFirewallRulesList\n\terr := bambou.CurrentSession().FetchChildren(o, VirtualFirewallRuleIdentity, &list, info)\n\treturn list, err\n}", "func findFirewallRulesByTarget(rules []*gkeCompute.Firewall, clusterName string) []*gkeCompute.Firewall {\n\tvar firewalls []*gkeCompute.Firewall\n\tfor _, r := range rules {\n\t\tif r != nil {\n\t\t\tif strings.Contains(r.Description, kubernetesIO) {\n\t\t\t\tfor _, tag := range r.TargetTags {\n\t\t\t\t\tlog.Debugf(\"firewall rule[%s] target tag: %s\", r.Name, tag)\n\t\t\t\t\tif strings.HasPrefix(tag, targetPrefix+clusterName) {\n\t\t\t\t\t\tlog.Debugf(\"append firewall list[%s]\", r.Name)\n\t\t\t\t\t\tfirewalls = append(firewalls, r)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn firewalls\n}", "func (s wafregionalRuleNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.WafregionalRule, err error) {\n\terr = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.WafregionalRule))\n\t})\n\treturn ret, err\n}", "func (c *awsWafregionalRuleGroups) List(opts meta_v1.ListOptions) (result *v1.AwsWafregionalRuleGroupList, err error) {\n\tresult = &v1.AwsWafregionalRuleGroupList{}\n\terr = c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"awswafregionalrulegroups\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tDo().\n\t\tInto(result)\n\treturn\n}", "func (c *Route53Resolver) ListFirewallRulesWithContext(ctx aws.Context, input *ListFirewallRulesInput, opts ...request.Option) (*ListFirewallRulesOutput, error) {\n\treq, out := c.ListFirewallRulesRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func (c *Route53Resolver) ListFirewallRulesPagesWithContext(ctx aws.Context, input *ListFirewallRulesInput, fn func(*ListFirewallRulesOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListFirewallRulesInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListFirewallRulesRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListFirewallRulesOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "func (fr *FirewallRule) UnmarshalJSON(body []byte) error {\n\tvar m map[string]*json.RawMessage\n\terr := json.Unmarshal(body, &m)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor k, v := range m {\n\t\tswitch k {\n\t\tcase \"properties\":\n\t\t\tif v != nil {\n\t\t\t\tvar firewallRuleProperties FirewallRuleProperties\n\t\t\t\terr = json.Unmarshal(*v, &firewallRuleProperties)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tfr.FirewallRuleProperties = &firewallRuleProperties\n\t\t\t}\n\t\tcase \"id\":\n\t\t\tif v != nil {\n\t\t\t\tvar ID string\n\t\t\t\terr = json.Unmarshal(*v, &ID)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tfr.ID = &ID\n\t\t\t}\n\t\tcase \"name\":\n\t\t\tif v != nil {\n\t\t\t\tvar name string\n\t\t\t\terr = json.Unmarshal(*v, &name)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tfr.Name = &name\n\t\t\t}\n\t\tcase \"type\":\n\t\t\tif v != nil {\n\t\t\t\tvar typeVar string\n\t\t\t\terr = json.Unmarshal(*v, &typeVar)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tfr.Type = &typeVar\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (page * FirewallRuleListResultPage) Next() error {\n return page.NextWithContext(context.Background())\n }", "func (d DB) ListWorkflows(fn func(wf db.Workflow) error) error {\n\treturn nil\n}", "func NewFirewallRuleListResultIterator(page FirewallRuleListResultPage) FirewallRuleListResultIterator {\n\treturn FirewallRuleListResultIterator{page: page}\n}", "func (m *L3FirewallRule) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateDestCidr(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validatePolicy(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateProtocol(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 (client *LocalRulestacksClient) listFirewallsHandleResponse(resp *http.Response) (LocalRulestacksClientListFirewallsResponse, error) {\n\tresult := LocalRulestacksClientListFirewallsResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.ListFirewallsResponse); err != nil {\n\t\treturn LocalRulestacksClientListFirewallsResponse{}, err\n\t}\n\treturn result, nil\n}", "func NewFirewallRuleListResultPage(getNextPage func(context.Context, FirewallRuleListResult) (FirewallRuleListResult, error)) FirewallRuleListResultPage {\n\treturn FirewallRuleListResultPage{fn: getNextPage}\n}", "func (app *builder) WithRules(rules []Rule) Builder {\n\tapp.list = rules\n\treturn app\n}", "func (w *WebApplicationFirewallCustomRule) 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\", w, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"action\":\n\t\t\terr = unpopulate(val, \"Action\", &w.Action)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"etag\":\n\t\t\terr = unpopulate(val, \"Etag\", &w.Etag)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"groupByUserSession\":\n\t\t\terr = unpopulate(val, \"GroupByUserSession\", &w.GroupByUserSession)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"matchConditions\":\n\t\t\terr = unpopulate(val, \"MatchConditions\", &w.MatchConditions)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"name\":\n\t\t\terr = unpopulate(val, \"Name\", &w.Name)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"priority\":\n\t\t\terr = unpopulate(val, \"Priority\", &w.Priority)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"rateLimitDuration\":\n\t\t\terr = unpopulate(val, \"RateLimitDuration\", &w.RateLimitDuration)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"rateLimitThreshold\":\n\t\t\terr = unpopulate(val, \"RateLimitThreshold\", &w.RateLimitThreshold)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"ruleType\":\n\t\t\terr = unpopulate(val, \"RuleType\", &w.RuleType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"state\":\n\t\t\terr = unpopulate(val, \"State\", &w.State)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", w, err)\n\t\t}\n\t}\n\treturn nil\n}", "func (c *FakeL4Rules) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.L4RuleList, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewListAction(l4rulesResource, l4rulesKind, c.ns, opts), &v1alpha2.L4RuleList{})\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 := &v1alpha2.L4RuleList{ListMeta: obj.(*v1alpha2.L4RuleList).ListMeta}\n\tfor _, item := range obj.(*v1alpha2.L4RuleList).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 NewFirewallRule(ctx *pulumi.Context,\n\tname string, args *FirewallRuleArgs, opts ...pulumi.ResourceOption) (*FirewallRule, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.EndIpAddress == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'EndIpAddress'\")\n\t}\n\tif args.ServerId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ServerId'\")\n\t}\n\tif args.StartIpAddress == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'StartIpAddress'\")\n\t}\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource FirewallRule\n\terr := ctx.RegisterResource(\"azure:mssql/firewallRule:FirewallRule\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (client FirewallPolicyRuleGroupsClient) ListResponder(resp *http.Response) (result FirewallPolicyRuleGroupListResult, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "func (o FirewallNetworkRuleCollectionOutput) Rules() FirewallNetworkRuleCollectionRuleArrayOutput {\n\treturn o.ApplyT(func(v *FirewallNetworkRuleCollection) FirewallNetworkRuleCollectionRuleArrayOutput { return v.Rules }).(FirewallNetworkRuleCollectionRuleArrayOutput)\n}", "func (m *Manager) Rules() []*Rule {\n\tif m == nil {\n\t\treturn nil\n\t}\n\tm.mu.Lock()\n\tdefer m.mu.Unlock()\n\tvar rs []*Rule\n\tfor _, r := range m.rules {\n\t\trs = append(rs, r)\n\t}\n\treturn rs\n}" ]
[ "0.8229573", "0.69925135", "0.68653804", "0.6838797", "0.67594063", "0.67395663", "0.67272943", "0.6674047", "0.66488814", "0.64917105", "0.6449903", "0.63024914", "0.62687075", "0.6259945", "0.6221578", "0.6216661", "0.62053233", "0.615265", "0.61306965", "0.6089634", "0.60825974", "0.60585654", "0.60418975", "0.59999436", "0.59845006", "0.5961354", "0.59537804", "0.59432423", "0.5943135", "0.59415585", "0.58878267", "0.5865792", "0.5812517", "0.57598764", "0.5754358", "0.57518536", "0.5734611", "0.5698956", "0.5646426", "0.563643", "0.56313944", "0.56042504", "0.5573081", "0.5572294", "0.5572088", "0.55619305", "0.55317616", "0.55262774", "0.55129796", "0.55043525", "0.54923695", "0.5486059", "0.5467842", "0.5465653", "0.5462204", "0.5457476", "0.5454502", "0.5452204", "0.54382885", "0.54382414", "0.542821", "0.54164356", "0.54025745", "0.53725964", "0.53690326", "0.53637666", "0.5362928", "0.53463644", "0.53455746", "0.5343785", "0.5340399", "0.5315248", "0.5312048", "0.5309237", "0.53064805", "0.53059274", "0.52803075", "0.52744806", "0.52688396", "0.5256634", "0.52557546", "0.5251606", "0.5246028", "0.5187086", "0.5187013", "0.51573825", "0.51386666", "0.51376253", "0.5134937", "0.5132163", "0.5128081", "0.51165926", "0.5095642", "0.50911576", "0.5090136", "0.5084974", "0.50759697", "0.50721544", "0.5069976", "0.5062062" ]
0.78728414
1
GetImage uses the override method GetImageFn or the real implementation.
func (c *TestClient) GetImage(project, name string) (*compute.Image, error) { if c.GetImageFn != nil { return c.GetImageFn(project, name) } return c.client.GetImage(project, name) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (b *ecrBase) getImage(ctx context.Context) (*ecr.Image, error) {\n\treturn b.runGetImage(ctx, ecr.BatchGetImageInput{\n\t\tImageIds: []*ecr.ImageIdentifier{b.ecrSpec.ImageID()},\n\t\tAcceptedMediaTypes: aws.StringSlice(supportedImageMediaTypes),\n\t})\n}", "func (b *ecrBase) runGetImage(ctx context.Context, batchGetImageInput ecr.BatchGetImageInput) (*ecr.Image, error) {\n\t// Allow only a single image to be fetched at a time.\n\tif len(batchGetImageInput.ImageIds) != 1 {\n\t\treturn nil, errGetImageUnhandled\n\t}\n\n\tbatchGetImageInput.RegistryId = aws.String(b.ecrSpec.Registry())\n\tbatchGetImageInput.RepositoryName = aws.String(b.ecrSpec.Repository)\n\n\tlog.G(ctx).WithField(\"batchGetImageInput\", batchGetImageInput).Trace(\"ecr.base.image: requesting images\")\n\n\tbatchGetImageOutput, err := b.client.BatchGetImageWithContext(ctx, &batchGetImageInput)\n\tif err != nil {\n\t\tlog.G(ctx).WithError(err).Error(\"ecr.base.image: failed to get image\")\n\t\treturn nil, err\n\t}\n\tlog.G(ctx).WithField(\"batchGetImageOutput\", batchGetImageOutput).Trace(\"ecr.base.image: api response\")\n\n\t// Summarize image request failures for handled errors. Only the first\n\t// failure is checked as only a single ImageIdentifier is allowed to be\n\t// queried for.\n\tif len(batchGetImageOutput.Failures) > 0 {\n\t\tfailure := batchGetImageOutput.Failures[0]\n\t\tswitch aws.StringValue(failure.FailureCode) {\n\t\t// Requested image with a corresponding tag and digest does not exist.\n\t\t// This failure will generally occur when pushing an updated (or new)\n\t\t// image with a tag.\n\t\tcase ecr.ImageFailureCodeImageTagDoesNotMatchDigest:\n\t\t\tlog.G(ctx).WithField(\"failure\", failure).Debug(\"ecr.base.image: no matching image with specified digest\")\n\t\t\treturn nil, errImageNotFound\n\t\t// Requested image doesn't resolve to a known image. A new image will\n\t\t// result in an ImageNotFound error when checked before push.\n\t\tcase ecr.ImageFailureCodeImageNotFound:\n\t\t\tlog.G(ctx).WithField(\"failure\", failure).Debug(\"ecr.base.image: no image found\")\n\t\t\treturn nil, errImageNotFound\n\t\t// Requested image identifiers are invalid.\n\t\tcase ecr.ImageFailureCodeInvalidImageDigest, ecr.ImageFailureCodeInvalidImageTag:\n\t\t\tlog.G(ctx).WithField(\"failure\", failure).Error(\"ecr.base.image: invalid image identifier\")\n\t\t\treturn nil, reference.ErrInvalid\n\t\t// Unhandled failure reported for image request made.\n\t\tdefault:\n\t\t\tlog.G(ctx).WithField(\"failure\", failure).Warn(\"ecr.base.image: unhandled image request failure\")\n\t\t\treturn nil, errGetImageUnhandled\n\t\t}\n\t}\n\n\treturn batchGetImageOutput.Images[0], nil\n}", "func GetImage(c echo.Context) error {\n\tidStr := c.Param(\"id\")\n\tid, _ := strconv.Atoi(idStr)\n\tfilepath := fmt.Sprintf(\"./img/storage/%d.jpg\", id)\n\treturn c.File(filepath)\n}", "func (f ProviderFunc) Get(source interface{}, parameters imageserver.Parameters) (*imageserver.Image, error) {\n\treturn f(source, parameters)\n}", "func (s *API) GetImage(req *GetImageRequest, opts ...scw.RequestOption) (*Image, 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 fmt.Sprint(req.Region) == \"\" {\n\t\treturn nil, errors.New(\"field Region cannot be empty in request\")\n\t}\n\n\tif fmt.Sprint(req.ImageID) == \"\" {\n\t\treturn nil, errors.New(\"field ImageID cannot be empty in request\")\n\t}\n\n\tscwReq := &scw.ScalewayRequest{\n\t\tMethod: \"GET\",\n\t\tPath: \"/registry/v1/regions/\" + fmt.Sprint(req.Region) + \"/images/\" + fmt.Sprint(req.ImageID) + \"\",\n\t\tHeaders: http.Header{},\n\t}\n\n\tvar resp Image\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 (reg *registry) GetImage(img Repository, tag string) (_ flux.Image, err error) {\n\trem, err := reg.newRemote(img)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn rem.Manifest(img, tag)\n}", "func (a *ImagesApiService) GetImage(ctx context.Context, imageDigest string) ApiGetImageRequest {\n\treturn ApiGetImageRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\timageDigest: imageDigest,\n\t}\n}", "func (c *APIContext) ImageGet(res web.ResponseWriter, req *web.Request) {\n\n\tid := req.PathParams[\"image_id\"]\n\timg, err := models.LoadImage(c.Database, req.PathParams[\"image_id\"])\n\tif err != nil {\n\t\tif err == mgo.ErrNotFound {\n\t\t\tres.WriteHeader(http.StatusNotFound)\n\t\t\treturn\n\t\t} else {\n\t\t\tlog.Printf(\"Error while loading image %s from database for user %s (%s)\", id, c.User, err)\n\t\t\tres.WriteHeader(http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Write it out as json\n\tdata, err := json.Marshal(img)\n\tif err != nil {\n\t\tlog.Printf(\"Error while marshalling image %s to JSON for user %s (%s)\", id, c.User, err)\n\t\tres.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tres.WriteHeader(http.StatusOK)\n\tfmt.Fprint(res, string(data[:]))\n\n}", "func (d *Data) GetImage(v dvid.VersionID, vox *Labels, supervoxels bool, scale uint8, roiname dvid.InstanceName) (*dvid.Image, error) {\n\tr, err := imageblk.GetROI(v, roiname, vox)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err := d.GetLabels(v, supervoxels, scale, vox, r); err != nil {\n\t\treturn nil, err\n\t}\n\treturn vox.GetImage2d()\n}", "func (s *VarlinkInterface) GetImage(ctx context.Context, c VarlinkCall, id_ string) error {\n\treturn c.ReplyMethodNotImplemented(ctx, \"io.podman.GetImage\")\n}", "func (c *CachedImages) GetImage() string {\n\tretval := c.ImageData\n\tif c.isPDF {\n\t\tretval = c.PDFData\n\t}\n\tif c.isRawData {\n\t\tretval = c.RawData\n\t}\n\tc.Clear()\n\treturn retval\n}", "func GetImage(imageid string) Instance {\n\tpath := image_path(imageid)\n\treturn is_get(path)\n}", "func (s *SpecGenerator) GetImage() (*libimage.Image, string) {\n\treturn s.image, s.resolvedImageName\n}", "func (c *Conn) GetImage(name string) (dbus.ObjectPath, error) {\n\treturn c.getPath(\"GetImage\", name)\n}", "func (i Image) GetImage(c echo.Context) error {\n\tvar file *os.File\n\t// Get ID\n\tid := c.FormValue(\"id\")\n\n\t// Get image by id\n\tsrc, err := i.session.DB(\"test\").GridFS(\"fs\").OpenId(bson.ObjectIdHex(id))\n\tif err != nil {\n\t\tc.Logger().Error(err)\n\t\treturn err\n\t}\n\n\t// Create file to send it\n\tif file, err = os.Create(id); err != nil {\n\t\tc.Logger().Error(err)\n\t\treturn err\n\t}\n\tdefer file.Close()\n\t// delete file\n\tdefer deleteFile(id)\n\n\t// Write on the new file\n\tif _, err = io.Copy(file, src); err != nil {\n\t\tc.Logger().Error(err)\n\t\treturn err\n\t}\n\n\t// send it\n\treturn c.Attachment(id, src.Name())\n}", "func (m Model) GetImage() image.Image {\n\treturn m.Image\n}", "func (t *ThirdPartyServiceParse) GetImage() Image {\n\treturn Image{}\n}", "func GetImage(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *ImageState, opts ...pulumi.ResourceOption) (*Image, error) {\n\tvar resource Image\n\terr := ctx.ReadResource(\"alicloud:ecs/image:Image\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func GetImage(imageSpec *commonv1.AgentImageConfig, registry *string) string {\n\tif defaulting.IsImageNameContainsTag(imageSpec.Name) {\n\t\treturn imageSpec.Name\n\t}\n\n\timg := defaulting.NewImage(imageSpec.Name, imageSpec.Tag, imageSpec.JMXEnabled)\n\n\tif registry != nil && *registry != \"\" {\n\t\tdefaulting.WithRegistry(defaulting.ContainerRegistry(*registry))(img)\n\t}\n\n\treturn img.String()\n}", "func (client *Client) GetImage(id string) (*model.Image, error) {\n\treturn client.feclt.GetImage(id)\n}", "func imageGet(L *lua.LState) int {\n\tp := checkImage(L)\n\n\tL.Push(lua.LNumber(*p))\n\n\treturn 1\n}", "func GetImage(w http.ResponseWriter, r *http.Request) {\n\n\t//Response Parameter\n\tvars := mux.Vars(r)\n\timageID := vars[\"imageID\"]\n\n\t//Get Data and make Response\n\timage, mimeType, err := model.GetImage(imageID)\n\tif err != nil {\n\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\tw.Write([]byte(err.Error()))\n\t\treturn\n\n\t}\n\n\t//Write Response\n\tw.Header().Set(\"Content-Type\", mimeType)\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(image)\n\n}", "func GetImage(c *gin.Context) {\n\tid := c.Params.ByName(\"id\")\n\tvar image []models.Image\n\tmodels.DB.First(&image, id)\n\tc.JSON(http.StatusOK, gin.H{\"data\": image})\n}", "func (f *Frontend) fetchImage(i *img.Image) (*img.Image, error) {\n\tvar err error\n\n\t// go through image proxy to resize and cache the image\n\tkey := hmacKey(i.ID)\n\tu := fmt.Sprintf(\"%v/image/225x,s%v/%v\", f.Host, key, i.ID)\n\tfmt.Println(u)\n\n\tresp, err := f.Images.Client.Get(u)\n\tif err != nil {\n\t\treturn i, err\n\t}\n\n\tdefer resp.Body.Close()\n\n\tbdy, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn i, err\n\t}\n\n\ti.Base64 = base64.StdEncoding.EncodeToString(bdy)\n\treturn i, err\n}", "func GetImage(u string) (*Image, error) {\n\tparsedURL, err := url.Parse(u)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient := &http.Client{\n\t\tTimeout: time.Second * 10,\n\t}\n\tresp, err := client.Get(parsedURL.String())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\tconfig, format, err := image.DecodeConfig(resp.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Image{\n\t\tURL: parsedURL.String(),\n\t\tWidth: config.Width,\n\t\tHeight: config.Height,\n\t\tResolution: config.Width * config.Height,\n\t\tFormat: format,\n\t}, nil\n}", "func (c *Client) GetImageStream(imageNS string, imageName string, imageTag string) (*imagev1.ImageStream, error) {\n\tvar err error\n\tvar imageStream *imagev1.ImageStream\n\tcurrentProjectName := c.GetCurrentProjectName()\n\t/*\n\t\tIf User has not chosen image NS then,\n\t\t\t1. Use image from current NS if available\n\t\t\t2. If not 1, use default openshift NS\n\t\t\t3. If not 2, return errors from both 1 and 2\n\t\telse\n\t\t\tUse user chosen namespace\n\t\t\tIf image doesn't exist in user chosen namespace,\n\t\t\t\terror out\n\t\t\telse\n\t\t\t\tProceed\n\t*/\n\t// User has not passed any particular ImageStream\n\tif imageNS == \"\" {\n\n\t\t// First try finding imagestream from current namespace\n\t\tcurrentNSImageStream, e := c.imageClient.ImageStreams(currentProjectName).Get(context.TODO(), imageName, metav1.GetOptions{})\n\t\tif e != nil {\n\t\t\terr = errors.Wrapf(e, \"no match found for : %s in namespace %s\", imageName, currentProjectName)\n\t\t} else {\n\t\t\tif isTagInImageStream(*currentNSImageStream, imageTag) {\n\t\t\t\treturn currentNSImageStream, nil\n\t\t\t}\n\t\t}\n\n\t\t// If not in current namespace, try finding imagestream from openshift namespace\n\t\topenshiftNSImageStream, e := c.imageClient.ImageStreams(OpenShiftNameSpace).Get(context.TODO(), imageName, metav1.GetOptions{})\n\t\tif e != nil {\n\t\t\t// The image is not available in current Namespace.\n\t\t\terr = errors.Wrapf(e, \"no match found for : %s in namespace %s\", imageName, OpenShiftNameSpace)\n\t\t} else {\n\t\t\tif isTagInImageStream(*openshiftNSImageStream, imageTag) {\n\t\t\t\treturn openshiftNSImageStream, nil\n\t\t\t}\n\t\t}\n\t\tif e != nil && err != nil {\n\t\t\treturn nil, fmt.Errorf(\"component type %q not found\", imageName)\n\t\t}\n\n\t\t// Required tag not in openshift and current namespaces\n\t\treturn nil, fmt.Errorf(\"image stream %s with tag %s not found in openshift and %s namespaces\", imageName, imageTag, currentProjectName)\n\n\t}\n\n\t// Fetch imagestream from requested namespace\n\timageStream, err = c.imageClient.ImageStreams(imageNS).Get(context.TODO(), imageName, metav1.GetOptions{})\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(\n\t\t\terr, \"no match found for %s in namespace %s\", imageName, imageNS,\n\t\t)\n\t}\n\tif !isTagInImageStream(*imageStream, imageTag) {\n\t\treturn nil, fmt.Errorf(\"image stream %s with tag %s not found in %s namespaces\", imageName, imageTag, currentProjectName)\n\t}\n\n\treturn imageStream, nil\n}", "func (self *GameObjectCreator) ImageI(args ...interface{}) *Image{\n return &Image{self.Object.Call(\"image\", args)}\n}", "func (f *FakeImagesClient) Get(ctx context.Context, getOpts *images.GetRequest, opts ...grpc.CallOption) (*images.GetResponse, error) {\n\tf.Lock()\n\tdefer f.Unlock()\n\tf.appendCalled(\"get\", getOpts)\n\tif err := f.getError(\"get\"); err != nil {\n\t\treturn nil, err\n\t}\n\timage, ok := f.ImageList[getOpts.Name]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"image does not exist\")\n\t}\n\treturn &images.GetResponse{\n\t\tImage: &image,\n\t}, nil\n}", "func LookupImage(ctx *pulumi.Context, args *LookupImageArgs, opts ...pulumi.InvokeOption) (*LookupImageResult, error) {\n\topts = internal.PkgInvokeDefaultOpts(opts)\n\tvar rv LookupImageResult\n\terr := ctx.Invoke(\"google-native:compute/alpha:getImage\", args, &rv, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &rv, nil\n}", "func GetImage(ctx context.Context, sharedDownload map[string]*DownloadState, params *Params) (io.Reader, error) {\n\tlogger := logging.FromContext(ctx)\n\ttimeout := params.Timeout\n\tURL := params.URL\n\tvar imageReader io.Reader\n\n\tif dnState, ok := sharedDownload[URL]; ok {\n\t\tlogger.WithField(\"url\", URL).Trace(\"is fetching by another client\")\n\t\terrCh := make(chan error, 1)\n\t\tdnState.Subs = append(dnState.Subs, errCh)\n\t\tif err := <-errCh; err != nil {\n\t\t\tlogger.WithError(err).WithField(\"url\", URL).Trace(\"fetch failed\")\n\t\t\tdelete(sharedDownload, URL)\n\t\t\treturn nil, err\n\t\t}\n\t\timageReader = bytes.NewReader(dnState.Data)\n\t\tlogger.WithField(\"url\", URL).Trace(\"fetched shared\")\n\t} else {\n\t\tsubscribers := make([]chan error, 0, 1)\n\t\tdownloadState := &DownloadState{\n\t\t\tData: nil,\n\t\t\tSubs: subscribers,\n\t\t}\n\t\tsharedDownload[URL] = downloadState\n\t\tdefer func(sd map[string]*DownloadState, url string) {\n\t\t\tdelete(sd, url)\n\t\t}(sharedDownload, URL)\n\t\thttpClient := httpclient.NewHTTPClient(timeout)\n\t\tresponse, err := httpClient.Get(ctx, URL)\n\t\tif err != nil {\n\t\t\tlogger.WithError(err).WithField(\"url\", URL).Error(\"fetch image failed\")\n\t\t\tfor _, subs := range downloadState.Subs {\n\t\t\t\tsubs <- err\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\n\t\tdownloadState.Data = response.RawBody\n\t\tfor _, subs := range downloadState.Subs {\n\t\t\tsubs <- nil\n\t\t}\n\t\timageReader = bytes.NewReader(response.RawBody)\n\t}\n\n\treturn imageReader, nil\n}", "func GetImage(hub *registry.Registry, repo string, tag string) (*Image, error) {\n\t// Default maniftest will be a v2\n\tdigest, err := hub.ManifestDigestV2(repo, tag)\n\tif err != nil {\n\t\tlog.Debug(fmt.Sprintf(\"Error getting v2 content digest: %s\", err))\n\t\t// Attempt to obtain v1 if v2 is unavailable\n\t\tdigest, err = hub.ManifestDigest(repo, tag)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Unable to obtain either v1 or v2 digest: %s\", err)\n\t\t}\n\t}\n\n\t// Both V1 and V2 manifests contain useful data we want to store\n\tvar layers []string\n\tvar manifestV2Map map[string]interface{}\n\tmanifest, err := hub.ManifestV2(repo, tag)\n\tif err != nil {\n\t\tlog.Debug(fmt.Sprintf(\"Error getting v2 manifest: %s for Image %s/%s:%s\", err, hub.URL, repo, tag))\n\t} else {\n\t\tmanifestV2Map = structs.Map(manifest.Manifest)\n\n\t\t// Will use v2 manifest to build layers if its availble.\n\t\t// V1 and V2 layer order is reversed.\n\t\tfor i := len(manifest.Layers) - 1; i >= 0; i-- {\n\t\t\tif string(manifest.Layers[i].Digest) != emptyLayer {\n\t\t\t\tlayers = append(layers, string(manifest.Layers[i].Digest))\n\t\t\t}\n\t\t}\n\t}\n\n\tvar manifestV1Map map[string]interface{}\n\tmanifestV1, err := hub.Manifest(repo, tag)\n\tif err != nil {\n\t\tlog.Debug(fmt.Sprintf(\"Error getting v1 manifest: %s for Image %s/%s:%s\", err, hub.URL, repo, tag))\n\t} else {\n\t\tmanifestV1Map = structs.Map(manifestV1.Manifest)\n\n\t\t// If layers from V1 aren't available attempt to use the V1.\n\t\t// V1 and V2 layer order is reversed.\n\t\tif len(layers) == 0 {\n\t\t\tfor i := 0; i <= len(manifestV1.FSLayers)-1; i++ {\n\t\t\t\tif string(manifestV1.FSLayers[i].BlobSum) != emptyLayer {\n\t\t\t\t\tlayers = append(layers, string(manifestV1.FSLayers[i].BlobSum))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif err != nil && manifest == nil && manifestV1 == nil {\n\t\treturn nil, fmt.Errorf(\"Docker V1 or V2 could be obtained: %s\", err)\n\t}\n\n\tif len(layers) == 0 {\n\t\treturn nil, fmt.Errorf(\"Image manifest contaied no layers: %s/%s:%s\", hub.URL, repo, tag)\n\t}\n\n\timage := &Image{\n\t\tRegistry: hub.URL,\n\t\tRepo: repo,\n\t\tTag: tag,\n\t\tDigest: string(digest),\n\t\tManifestV1: manifestV1Map,\n\t\tManifestV2: manifestV2Map,\n\t\tLayers: layers,\n\t}\n\treturn image, nil\n}", "func getImage(ctx *fiber.Ctx) error {\n\t// check data\n\tid := ctx.Params(\"id\")\n\tif id == \"\" {\n\t\treturn utilities.Response(utilities.ResponseParams{\n\t\t\tCtx: ctx,\n\t\t\tInfo: configuration.ResponseMessages.MissingUserID,\n\t\t\tStatus: fiber.StatusBadRequest,\n\t\t})\n\t}\n\n\t// parse ID into an ObjectID\n\tparsedId, parsingError := primitive.ObjectIDFromHex(id)\n\tif parsingError != nil {\n\t\treturn utilities.Response(utilities.ResponseParams{\n\t\t\tCtx: ctx,\n\t\t\tInfo: configuration.ResponseMessages.InvalidData,\n\t\t\tStatus: fiber.StatusNotFound,\n\t\t})\n\t}\n\n\t// get User record\n\tUserCollection := Instance.Database.Collection(Collections.User)\n\trawUserRecord := UserCollection.FindOne(\n\t\tctx.Context(),\n\t\tbson.D{{Key: \"_id\", Value: parsedId}},\n\t)\n\tuserRecord := &User{}\n\trawUserRecord.Decode(userRecord)\n\tif userRecord.ID == \"\" {\n\t\treturn utilities.Response(utilities.ResponseParams{\n\t\t\tCtx: ctx,\n\t\t\tInfo: configuration.ResponseMessages.NotFound,\n\t\t\tStatus: fiber.StatusNotFound,\n\t\t})\n\t}\n\n\t// get Image record\n\tImageCollection := Instance.Database.Collection(Collections.Image)\n\trawImageRecord := ImageCollection.FindOne(\n\t\tctx.Context(),\n\t\tbson.D{{Key: \"userId\", Value: id}},\n\t)\n\timageRecord := &Image{}\n\trawImageRecord.Decode(imageRecord)\n\tif imageRecord.ID == \"\" {\n\t\treturn utilities.Response(utilities.ResponseParams{\n\t\t\tCtx: ctx,\n\t\t\tInfo: configuration.ResponseMessages.NotFound,\n\t\t\tStatus: fiber.StatusNotFound,\n\t\t})\n\t}\n\n\treturn utilities.Response(utilities.ResponseParams{\n\t\tCtx: ctx,\n\t\tData: fiber.Map{\n\t\t\t\"image\": imageRecord,\n\t\t},\n\t})\n}", "func (self *GameObjectCreator) Image(x int, y int, key interface{}) *Image{\n return &Image{self.Object.Call(\"image\", x, y, key)}\n}", "func IMAGE_API_GetImageFromCS(res http.ResponseWriter, req *http.Request, params httprouter.Params) {\n\tid := req.FormValue(\"id\") // this is an id request only.\n\tif id == \"\" { // if no id, exit with failure.\n\t\tfmt.Fprint(res, `{\"result\":\"failure\",\"reason\":\"missing image id\",\"code\":400}`)\n\t\treturn\n\t}\n\n\tctx := appengine.NewContext(req) // quickly get a handle into CS\n\tclient, clientErr := storage.NewClient(ctx)\n\tHandleError(res, clientErr)\n\tdefer client.Close()\n\n\tobj := client.Bucket(GCS_BucketID).Object(id) // pull the object from cs\n\n\t// We'll just copy the image data onto the response, letting the browser know that we're sending an image.\n\tctype, ok := Content_Types[stringedExt(id)]\n\tif !ok {\n\t\tctype = \"image/png\"\n\t}\n\tres.Header().Set(\"Content-Type\", ctype+\"; charset=utf-8\")\n\trdr, _ := obj.NewReader(ctx)\n\tio.Copy(res, rdr)\n}", "func CtrGetImage(reference string) (containerd.Image, error) {\n\tif err := verifyCtr(); err != nil {\n\t\treturn nil, fmt.Errorf(\"CtrGetImage: exception while verifying ctrd client: %s\", err.Error())\n\t}\n\timage, err := CtrdClient.GetImage(ctrdCtx, reference)\n\tif err != nil {\n\t\tlog.Errorf(\"CtrGetImage: could not get image %s from containerd: %+s\", reference, err.Error())\n\t\treturn nil, err\n\t}\n\treturn image, nil\n}", "func GetImage(ctx context.Context, nameOrID string, options *GetOptions) (*entities.ImageInspectReport, error) {\n\tif options == nil {\n\t\toptions = new(GetOptions)\n\t}\n\tconn, err := bindings.GetClient(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tparams, err := options.ToParams()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tinspectedData := entities.ImageInspectReport{}\n\tresponse, err := conn.DoRequest(ctx, nil, http.MethodGet, \"/images/%s/json\", params, nil, nameOrID)\n\tif err != nil {\n\t\treturn &inspectedData, err\n\t}\n\tdefer response.Body.Close()\n\n\treturn &inspectedData, response.Process(&inspectedData)\n}", "func (a *ImageApiService) GetUserImage(ctx _context.Context, userId string, imageType ImageType, imageIndex int32, localVarOptionals *GetUserImageOpts) (*os.File, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue *os.File\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/Users/{userId}/Images/{imageType}/{imageIndex}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"userId\"+\"}\", _neturl.QueryEscape(parameterToString(userId, \"\")) , -1)\n\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"imageType\"+\"}\", _neturl.QueryEscape(parameterToString(imageType, \"\")) , -1)\n\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"imageIndex\"+\"}\", _neturl.QueryEscape(parameterToString(imageIndex, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif localVarOptionals != nil && localVarOptionals.Tag.IsSet() {\n\t\tlocalVarQueryParams.Add(\"tag\", parameterToString(localVarOptionals.Tag.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Format.IsSet() {\n\t\tlocalVarQueryParams.Add(\"format\", parameterToString(localVarOptionals.Format.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.MaxWidth.IsSet() {\n\t\tlocalVarQueryParams.Add(\"maxWidth\", parameterToString(localVarOptionals.MaxWidth.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.MaxHeight.IsSet() {\n\t\tlocalVarQueryParams.Add(\"maxHeight\", parameterToString(localVarOptionals.MaxHeight.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.PercentPlayed.IsSet() {\n\t\tlocalVarQueryParams.Add(\"percentPlayed\", parameterToString(localVarOptionals.PercentPlayed.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.UnplayedCount.IsSet() {\n\t\tlocalVarQueryParams.Add(\"unplayedCount\", parameterToString(localVarOptionals.UnplayedCount.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Width.IsSet() {\n\t\tlocalVarQueryParams.Add(\"width\", parameterToString(localVarOptionals.Width.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Height.IsSet() {\n\t\tlocalVarQueryParams.Add(\"height\", parameterToString(localVarOptionals.Height.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Quality.IsSet() {\n\t\tlocalVarQueryParams.Add(\"quality\", parameterToString(localVarOptionals.Quality.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.CropWhitespace.IsSet() {\n\t\tlocalVarQueryParams.Add(\"cropWhitespace\", parameterToString(localVarOptionals.CropWhitespace.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.AddPlayedIndicator.IsSet() {\n\t\tlocalVarQueryParams.Add(\"addPlayedIndicator\", parameterToString(localVarOptionals.AddPlayedIndicator.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Blur.IsSet() {\n\t\tlocalVarQueryParams.Add(\"blur\", parameterToString(localVarOptionals.Blur.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.BackgroundColor.IsSet() {\n\t\tlocalVarQueryParams.Add(\"backgroundColor\", parameterToString(localVarOptionals.BackgroundColor.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.ForegroundLayer.IsSet() {\n\t\tlocalVarQueryParams.Add(\"foregroundLayer\", parameterToString(localVarOptionals.ForegroundLayer.Value(), \"\"))\n\t}\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"image/_*\", \"application/json\", \"application/json; profile=CamelCase\", \"application/json; profile=PascalCase\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarHeaderParams[\"X-Emby-Authorization\"] = key\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v ProblemDetails\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "func (client *Client) GetImage(id string) (*model.Image, error) {\n\treturn client.osclt.GetImage(id)\n}", "func (is *ImageServer) GetImageHTTP(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {\n\n\twidth, err := strconv.Atoi(ps.ByName(\"width_px\"))\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\theight, err := strconv.Atoi(ps.ByName(\"height_px\"))\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tblackColor := color.RGBA{0, 0, 0, 255}\n\n\tm := image.NewNRGBA(image.Rect(0, 0, width, height))\n\tfor x := 0; x < width; x++ {\n\t\tfor y := 0; y < height; y++ {\n\t\t\tm.Set(x, y, blackColor)\n\t\t}\n\t}\n\n\tswitch ps.ByName(\"img_type\") {\n\tcase \"jpg\":\n\t\tjpeg.Encode(w, m, nil)\n\tcase \"png\":\n\t\tpng.Encode(w, m)\n\t}\n\tis.AddStats(width, height)\n}", "func (a *ImageApiService) GetPersonImage(ctx _context.Context, name string, imageType ImageType, imageIndex int32, localVarOptionals *GetPersonImageOpts) (*os.File, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue *os.File\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/Persons/{name}/Images/{imageType}/{imageIndex}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", _neturl.QueryEscape(parameterToString(name, \"\")) , -1)\n\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"imageType\"+\"}\", _neturl.QueryEscape(parameterToString(imageType, \"\")) , -1)\n\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"imageIndex\"+\"}\", _neturl.QueryEscape(parameterToString(imageIndex, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif localVarOptionals != nil && localVarOptionals.Tag.IsSet() {\n\t\tlocalVarQueryParams.Add(\"tag\", parameterToString(localVarOptionals.Tag.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Format.IsSet() {\n\t\tlocalVarQueryParams.Add(\"format\", parameterToString(localVarOptionals.Format.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.MaxWidth.IsSet() {\n\t\tlocalVarQueryParams.Add(\"maxWidth\", parameterToString(localVarOptionals.MaxWidth.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.MaxHeight.IsSet() {\n\t\tlocalVarQueryParams.Add(\"maxHeight\", parameterToString(localVarOptionals.MaxHeight.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.PercentPlayed.IsSet() {\n\t\tlocalVarQueryParams.Add(\"percentPlayed\", parameterToString(localVarOptionals.PercentPlayed.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.UnplayedCount.IsSet() {\n\t\tlocalVarQueryParams.Add(\"unplayedCount\", parameterToString(localVarOptionals.UnplayedCount.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Width.IsSet() {\n\t\tlocalVarQueryParams.Add(\"width\", parameterToString(localVarOptionals.Width.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Height.IsSet() {\n\t\tlocalVarQueryParams.Add(\"height\", parameterToString(localVarOptionals.Height.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Quality.IsSet() {\n\t\tlocalVarQueryParams.Add(\"quality\", parameterToString(localVarOptionals.Quality.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.CropWhitespace.IsSet() {\n\t\tlocalVarQueryParams.Add(\"cropWhitespace\", parameterToString(localVarOptionals.CropWhitespace.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.AddPlayedIndicator.IsSet() {\n\t\tlocalVarQueryParams.Add(\"addPlayedIndicator\", parameterToString(localVarOptionals.AddPlayedIndicator.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Blur.IsSet() {\n\t\tlocalVarQueryParams.Add(\"blur\", parameterToString(localVarOptionals.Blur.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.BackgroundColor.IsSet() {\n\t\tlocalVarQueryParams.Add(\"backgroundColor\", parameterToString(localVarOptionals.BackgroundColor.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.ForegroundLayer.IsSet() {\n\t\tlocalVarQueryParams.Add(\"foregroundLayer\", parameterToString(localVarOptionals.ForegroundLayer.Value(), \"\"))\n\t}\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"image/_*\", \"application/json\", \"application/json; profile=CamelCase\", \"application/json; profile=PascalCase\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarHeaderParams[\"X-Emby-Authorization\"] = key\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v ProblemDetails\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "func (ap *AnimeParser) getImage(eachTop *goquery.Selection) string {\n\timage, _ := eachTop.Find(\"td:nth-of-type(2) a img\").Attr(\"data-src\")\n\treturn utils.URLCleaner(image, \"image\", ap.Config.CleanImageURL)\n}", "func GetImageFlavor(label string, encryptionRequired bool, keyURL string, digest string) (*ImageFlavor, error) {\n\tlog.Trace(\"flavor/image_flavor:GetImageFlavor() Entering\")\n\tdefer log.Trace(\"flavor/image_flavor:GetImageFlavor() Leaving\")\n\tvar encryption *model.Encryption\n\n\tdescription := map[string]interface{}{\n\t\tmodel.Label: label,\n\t\tmodel.FlavorPart: \"IMAGE\",\n\t}\n\n\tmeta := model.Meta{\n\t\tDescription: description,\n\t}\n\tnewUuid, err := uuid.NewRandom()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to create new UUID\")\n\t}\n\tmeta.ID = newUuid\n\n\tif encryptionRequired {\n\t\tencryption = &model.Encryption{\n\t\t\tKeyURL: keyURL,\n\t\t\tDigest: digest,\n\t\t}\n\t}\n\n\timageflavor := model.Image{\n\t\tMeta: meta,\n\t\tEncryptionRequired: encryptionRequired,\n\t\tEncryption: encryption,\n\t}\n\n\tflavor := ImageFlavor{\n\t\tImage: imageflavor,\n\t}\n\treturn &flavor, nil\n}", "func handler_image(w http.ResponseWriter, r *http.Request) {\n\tgetImage(w, num) // fetch the base64 encoded png image\n}", "func (server *Server) Get(params imageserver.Params) (*imageserver.Image, error) {\n\tsourceURL, err := getSourceURL(params)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresponse, err := doRequest(sourceURL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer response.Body.Close()\n\timage, err := parseResponse(response)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn image, nil\n}", "func (c *Client) GetImage(imageURI string) ([]byte, error) {\n\turl := fmt.Sprint(c.BaseURL, APIVersion, \"/image/\", imageURI)\n\n\tif strings.HasPrefix(imageURI, \"https://s3.amazonaws.com\") {\n\t\turl = imageURI\n\t}\n\n\t// setup the request\n\treq, httpErr := http.NewRequest(\"GET\", url, nil)\n\tif httpErr != nil {\n\t\treturn nil, httpErr\n\t}\n\n\t_, data, err := c.SendRequest(req, true)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn data, nil\n}", "func (m *Manager) GetImage(name string) (img image.Image, err error) {\n\timg, ok := m.images[name]\n\tif !ok {\n\t\tfile, err := os.Open(name + \".png\")\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\timg, _, err = image.Decode(file)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tm.images[name] = img\n\t}\n\treturn img, nil\n}", "func (c *PreviewCache) GetImage(imgPath string) (CachedImage, error) {\n\tif cache, ok := c.cache.Load(imgPath); ok {\n\t\treturn cache.(CachedImage), nil\n\t}\n\terr := c.cacheImage(imgPath)\n\tif err != nil {\n\t\treturn CachedImage{Image: \"\"}, err\n\t}\n\timg, _ := c.cache.Load(imgPath)\n\treturn img.(CachedImage), nil\n}", "func (a *App) GetImage(id int64) (*model.ProductImage, *model.AppErr) {\n\treturn a.Srv().Store.ProductImage().Get(id)\n}", "func (s *Server) GetImage(w http.ResponseWriter, r *http.Request, params httprouter.Params) {\n\tUUID := params.ByName(\"UUID\")\n\tthumbnail := r.URL.Query().Get(\"thumbnail\")\n\timage, err := s.imageDao.Load(UUID)\n\tif err != nil || image == nil {\n\t\ts.NotFound(w, nil, nil)\n\t\treturn\n\t}\n\n\t// Check file is present before trying to serve. If it does not, ServeFile will\n\t// do some redirects trying to help.\n\torig, thumb := s.fs.Ensure(image)\n\n\tif thumbnail != \"\" && thumb {\n\t\thttp.ServeFile(w, r, image.thumbPath)\n\t} else if orig {\n\t\thttp.ServeFile(w, r, image.path)\n\t} else {\n\t\t// Something is wrong here.\n\t\ts.NotFound(w, nil, nil)\n\t}\n}", "func (img Image) GetItem() interface{} {\n\treturn img\n}", "func (a *ImagesApiService) GetImageExecute(r ApiGetImageRequest) ([]AnchoreImage, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue []AnchoreImage\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"ImagesApiService.GetImage\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/images/{imageDigest}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"imageDigest\"+\"}\", url.PathEscape(parameterToString(r.imageDigest, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif r.xAnchoreAccount != nil {\n\t\tlocalVarHeaderParams[\"x-anchore-account\"] = parameterToString(*r.xAnchoreAccount, \"\")\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 500 {\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\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "func (client *AWSClient) GetImage(ctx context.Context, imageID string) (*ec2.Image, error) {\n\tresult, err := client.svcEC2.DescribeImagesWithContext(ctx, &ec2.DescribeImagesInput{\n\t\tImageIds: []*string{aws.String(imageID)},\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(result.Images) < 1 {\n\t\treturn nil, fmt.Errorf(\"can't find image: %s\", imageID)\n\t}\n\n\treturn result.Images[0], nil\n}", "func (o FioSpecOutput) Image() FioSpecImageOutput {\n\treturn o.ApplyT(func(v FioSpec) FioSpecImage { return v.Image }).(FioSpecImageOutput)\n}", "func (v *ImageClient) Get(imageName string) (Image, error) {\n\n\t//Construct the composite key to select the entry\n\tkey := ImageKey{\n\t\t// Owner:\townerName,\n\t\t// ClusterName:\tclusterName,\n\t\tImageName: imageName,\n\t}\n\n\tvalue, err := v.util.DBRead(v.storeName, key, v.tagMeta)\n\tif err != nil {\n\t\treturn Image{}, pkgerrors.Wrap(err, \"Get Image\")\n\t}\n\n\t//value is a byte array\n\tif value != nil {\n\t\tc, err := v.util.DBUnmarshal(value)\n\t\tif err != nil {\n\t\t\treturn Image{}, pkgerrors.Wrap(err, \"Unmarshaling Value\")\n\t\t}\n\t\treturn c, nil\n\t}\n\n\treturn Image{}, pkgerrors.New(\"Error getting Connection\")\n}", "func (k *Key) Image(width uint32, height uint32) (image.Image, error) {\n\treturn k.base.Image(int(width), int(height))\n}", "func (m *Manager) GetImage(hash string) *schema.ImageManifest {\n\tm.imagesLock.RLock()\n\tdefer m.imagesLock.RUnlock()\n\treturn m.images[hash]\n}", "func (object Object) Image(value interface{}) Object {\n\treturn object.Property(as.PropertyImage, value)\n}", "func GetImageURL(msg *disgord.Message, args []string, size int, session disgord.Session) string {\n\tif len(msg.Mentions) > 0 {\n\t\tavatar, _ := msg.Mentions[0].AvatarURL(size, false)\n\t\treturn avatar\n\t}\n\tif len(args) > 0 {\n\t\tconverted := StringToID(args[0])\n\t\tuser, err := session.User(converted).Get()\n\t\tif err == nil {\n\t\t\tavatar, _ := user.AvatarURL(size, false)\n\t\t\treturn avatar\n\t\t}\n\t}\n\tif checkImage(strings.Join(args, \"\")) {\n\t\treturn strings.Join(args, \"\")\n\t}\n\tavatar, _ := msg.Author.AvatarURL(size, false)\n\treturn avatar\n}", "func GetImage(path string) (image.Image, string, error) {\n\treader, err := os.Open(path)\n\tif err != nil {\n\t\tlog.Panicln(err.Error())\n\t}\n\tdefer reader.Close()\n\treturn image.Decode(reader)\n}", "func (p *OnPrem) GetImages(ctx *Context) ([]CloudImage, error) {\n\treturn nil, errors.New(\"un-implemented\")\n}", "func (user *UserFriendParser) getImage(friendArea *goquery.Selection) string {\n\timage, _ := friendArea.Find(\"a img\").Attr(\"src\")\n\treturn utils.URLCleaner(image, \"image\", user.Config.CleanImageURL)\n}", "func (c *TestClient) GetImageFromFamily(project, family string) (*compute.Image, error) {\n\tif c.GetImageFromFamilyFn != nil {\n\t\treturn c.GetImageFromFamilyFn(project, family)\n\t}\n\treturn c.client.GetImageFromFamily(project, family)\n}", "func GetImage(id uint, db *gorm.DB) *Image {\n\timage := new(Image)\n\tdb.Find(image, id)\n\tif image.ID == id {\n\t\treturn image\n\t}\n\treturn nil\n}", "func Image(id, ref string) imageapi.Image {\n\treturn AgedImage(id, ref, 120)\n}", "func getVMImage(scope *scope.MachineScope) (infrav1.Image, error) {\n\t// Use custom Marketplace image, Image ID or a Shared Image Gallery image if provided\n\tif scope.AzureMachine.Spec.Image != nil {\n\t\treturn *scope.AzureMachine.Spec.Image, nil\n\t}\n\treturn azure.GetDefaultUbuntuImage(to.String(scope.Machine.Spec.Version))\n}", "func (c *Client) Image(ctx context.Context, number int) (io.Reader, string, error) {\n\tcomic, err := c.Get(ctx, number)\n\tif err != nil {\n\t\treturn nil, \"\", err\n\t}\n\n\treq, err := http.NewRequest(\"GET\", comic.ImageURL, nil)\n\tif err != nil {\n\t\treturn nil, \"\", fmt.Errorf(\"failed to build image request: %s\", err)\n\t}\n\treq = req.WithContext(ctx)\n\n\trsp, err := c.HTTPClient.Do(req)\n\tif err != nil {\n\t\treturn nil, \"\", fmt.Errorf(\"failed to do image request: %s\", err)\n\t}\n\tdefer drainAndClose(rsp.Body)\n\n\tif rsp.StatusCode != 200 {\n\t\treturn nil, \"\", StatusError{Code: rsp.StatusCode}\n\t}\n\n\tvar buf bytes.Buffer\n\tif _, err := io.Copy(&buf, rsp.Body); err != nil {\n\t\treturn nil, \"\", fmt.Errorf(\"failed to do copy image: %s\", err)\n\t}\n\n\treturn &buf, rsp.Header.Get(\"Content-Type\"), nil\n}", "func (g *Generator) Image() ispec.Image {\n\treturn g.image\n}", "func (i ImageFetcher) Fetch(path string) (image.Image, error) {\n\tresp, err := http.Get(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\treturn png.Decode(resp.Body)\n}", "func (a *ImageApiService) GetItemImage(ctx _context.Context, itemId string, imageType ImageType, imageIndex int32, localVarOptionals *GetItemImageOpts) (*os.File, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue *os.File\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/Items/{itemId}/Images/{imageType}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"itemId\"+\"}\", _neturl.QueryEscape(parameterToString(itemId, \"\")) , -1)\n\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"imageType\"+\"}\", _neturl.QueryEscape(parameterToString(imageType, \"\")) , -1)\n\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"imageIndex\"+\"}\", _neturl.QueryEscape(parameterToString(imageIndex, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif localVarOptionals != nil && localVarOptionals.MaxWidth.IsSet() {\n\t\tlocalVarQueryParams.Add(\"maxWidth\", parameterToString(localVarOptionals.MaxWidth.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.MaxHeight.IsSet() {\n\t\tlocalVarQueryParams.Add(\"maxHeight\", parameterToString(localVarOptionals.MaxHeight.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Width.IsSet() {\n\t\tlocalVarQueryParams.Add(\"width\", parameterToString(localVarOptionals.Width.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Height.IsSet() {\n\t\tlocalVarQueryParams.Add(\"height\", parameterToString(localVarOptionals.Height.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Quality.IsSet() {\n\t\tlocalVarQueryParams.Add(\"quality\", parameterToString(localVarOptionals.Quality.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Tag.IsSet() {\n\t\tlocalVarQueryParams.Add(\"tag\", parameterToString(localVarOptionals.Tag.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.CropWhitespace.IsSet() {\n\t\tlocalVarQueryParams.Add(\"cropWhitespace\", parameterToString(localVarOptionals.CropWhitespace.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Format.IsSet() {\n\t\tlocalVarQueryParams.Add(\"format\", parameterToString(localVarOptionals.Format.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.AddPlayedIndicator.IsSet() {\n\t\tlocalVarQueryParams.Add(\"addPlayedIndicator\", parameterToString(localVarOptionals.AddPlayedIndicator.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.PercentPlayed.IsSet() {\n\t\tlocalVarQueryParams.Add(\"percentPlayed\", parameterToString(localVarOptionals.PercentPlayed.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.UnplayedCount.IsSet() {\n\t\tlocalVarQueryParams.Add(\"unplayedCount\", parameterToString(localVarOptionals.UnplayedCount.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Blur.IsSet() {\n\t\tlocalVarQueryParams.Add(\"blur\", parameterToString(localVarOptionals.Blur.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.BackgroundColor.IsSet() {\n\t\tlocalVarQueryParams.Add(\"backgroundColor\", parameterToString(localVarOptionals.BackgroundColor.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.ForegroundLayer.IsSet() {\n\t\tlocalVarQueryParams.Add(\"foregroundLayer\", parameterToString(localVarOptionals.ForegroundLayer.Value(), \"\"))\n\t}\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"image/_*\", \"application/json\", \"application/json; profile=CamelCase\", \"application/json; profile=PascalCase\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarHeaderParams[\"X-Emby-Authorization\"] = key\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v ProblemDetails\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "func newImage(ctx context.Context, sys *types.SystemContext, s storageReference) (types.ImageCloser, error) {\n\tsrc, err := newImageSource(s)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\timg, err := image.FromSource(ctx, sys, src)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsize, err := src.getSize()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &storageImageCloser{ImageCloser: img, size: size}, nil\n}", "func newImage(vres *artworksviews.ImageView) *Image {\n\tres := &Image{}\n\tif vres.ImageID != nil {\n\t\tres.ImageID = *vres.ImageID\n\t}\n\tif vres.ExpiresIn != nil {\n\t\tres.ExpiresIn = *vres.ExpiresIn\n\t}\n\treturn res\n}", "func (s *Store) GetImage(id string) (io.Reader, error) {\n\t// We're going to be reading from our items slice - lock for reading.\n\ts.mutex.RLock()\n\n\t// Unlock once we're done.\n\tdefer s.mutex.RUnlock()\n\n\t// Return the image for the first item we find with a matching ID.\n\tfor i := range s.items {\n\t\tif s.items[i].id == id {\n\t\t\treturn bytes.NewReader(s.items[i].image), nil\n\t\t}\n\t}\n\n\treturn nil, moodboard.ErrNoSuchItem\n}", "func (e *Education) GetImages(ctx context.Context, entities Educations) {\n\t// Get a map of all img keys in my educations\n\timgs := make(map[int64]*datastore.Key)\n\n\tfor _, v := range entities {\n\t\tif _, ok := imgs[v.ImageKey.IntID()]; !ok {\n\t\t\timgs[v.ImageKey.IntID()] = v.ImageKey\n\t\t}\n\t}\n\n\t// Get all Images\n\torderedImgs := GetOrderedImgs(ctx, imgs)\n\n\t// Set Image to each edu\n\tfor i := 0; i < len(entities); i++ {\n\t\tentities[i].Image = orderedImgs[entities[i].ImageKey.IntID()]\n\t}\n}", "func (i *ImagesModel) GetImage(id string) (*images.SoftwareImage, error) {\n\n\timage, err := i.imagesStorage.FindByID(id)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Searching for image with specified ID\")\n\t}\n\n\tif image == nil {\n\t\treturn nil, nil\n\t}\n\n\treturn image, nil\n}", "func (r *REST) Get(ctx kapi.Context, id string) (runtime.Object, error) {\n\tname, tag, err := nameAndTag(id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trepo, err := r.imageRepositoryRegistry.GetImageRepository(ctx, name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tevent, err := api.LatestTaggedImage(repo, tag)\n\tif err != nil {\n\t\treturn nil, errors.NewNotFound(\"imageRepositoryTag\", tag)\n\t}\n\n\tif len(event.Image) != 0 {\n\t\timage, err := r.imageRegistry.GetImage(ctx, event.Image)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn api.ImageWithMetadata(*image)\n\t}\n\tif len(event.DockerImageReference) == 0 {\n\t\treturn nil, errors.NewNotFound(\"imageRepositoryTag\", tag)\n\t}\n\n\treturn &api.Image{\n\t\tObjectMeta: kapi.ObjectMeta{\n\t\t\tCreationTimestamp: event.Created,\n\t\t},\n\t\tDockerImageReference: event.DockerImageReference,\n\t}, nil\n}", "func (o IopingSpecOutput) Image() IopingSpecImageOutput {\n\treturn o.ApplyT(func(v IopingSpec) IopingSpecImage { return v.Image }).(IopingSpecImageOutput)\n}", "func (i *ImageTemplateSource) GetImageTemplateSource() *ImageTemplateSource { return i }", "func (t *Thumbnail) GetImage() image.Image {\n\treturn t.image\n}", "func GetImg(fileName string) (*image.Image, error) {\n localFile := fmt.Sprintf(\"/data/edgebox/local/%s\", fileName)\n existingImageFile, err := os.Open(localFile)\n if err == nil {\n defer existingImageFile.Close()\n imageData, _, err := image.Decode(existingImageFile)\n if err != nil {\n return nil, err\n }\n return &imageData, nil\n }\n\n remoteFile := fmt.Sprintf(\"/data/edgebox/remote/%s\", fileName)\n existingImageFile, err = os.Open(remoteFile)\n if err == nil {\n defer existingImageFile.Close()\n imageData, _, err := image.Decode(existingImageFile)\n if err != nil {\n return nil, err\n }\n return &imageData, nil\n }\n return nil, err\n}", "func RunImagesGet(ns string, config doit.Config, out io.Writer, args []string) error {\n\tclient := config.GetGodoClient()\n\n\tif len(args) != 1 {\n\t\treturn doit.NewMissingArgsErr(ns)\n\t}\n\n\trawID := args[0]\n\n\tvar i *godo.Image\n\tvar err error\n\n\tif id, cerr := strconv.Atoi(rawID); cerr == nil {\n\t\ti, _, err = client.Images.GetByID(id)\n\t} else {\n\t\tif len(rawID) > 0 {\n\t\t\ti, _, err = client.Images.GetBySlug(rawID)\n\t\t} else {\n\t\t\terr = fmt.Errorf(\"image identifier is required\")\n\t\t}\n\t}\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn displayOutput(&image{images: images{*i}}, out)\n}", "func GetProductImage(c buffalo.Context) error {\n\timages := &models.Images{}\n\n\ttx, ok := c.Value(\"tx\").(*pop.Connection)\n\tif !ok {\n\t\treturn errors.New(\"Transaction not found\")\n\t}\n\n\tif err := tx.All(images); err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\treturn c.Render(http.StatusOK, r.JSON(images))\n}", "func (s *Client) Image(fileID string, page int) (file []byte, err error) {\n\tif page <= 0 {\n\t\tpage = 1\n\t}\n\tqueryParam := fmt.Sprintf(\"?page=%d\", page)\n\turl := strings.Join([]string{s.config.apiBaseURL, \"/result/image/\", fileID, queryParam}, \"\")\n\n\tlog.Printf(\"get image url %s\", url)\n\treq, err := http.NewRequest(\"GET\", url, strings.NewReader(\"\"))\n\tif err != nil {\n\t\treturn\n\t}\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Authorization\", strings.Join([]string{\"Bearer \", s.getToken()}, \"\"))\n\n\tres, err := s.httpClient.Do(req)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer res.Body.Close()\n\tfile, err = ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn\n}", "func getImage(windowsServerVersion windows.ServerVersion) string {\n\tswitch windowsServerVersion {\n\tcase windows.Server2019:\n\t\treturn \"projects/windows-cloud/global/images/family/windows-2019-core\"\n\tcase windows.Server2022:\n\tdefault:\n\t}\n\t// use the latest image from the `windows-2022-core` family in the `windows-cloud` project\n\treturn \"projects/windows-cloud/global/images/family/windows-2022-core\"\n}", "func (i *ImageService) LoadImage(inTar io.ReadCloser, outStream io.Writer, quiet bool) error {\n\tpanic(\"not implemented\")\n}", "func GetImages(ctx *pulumi.Context, args *GetImagesArgs, opts ...pulumi.InvokeOption) (*GetImagesResult, error) {\n\topts = internal.PkgInvokeDefaultOpts(opts)\n\tvar rv GetImagesResult\n\terr := ctx.Invoke(\"alicloud:simpleapplicationserver/getImages:getImages\", args, &rv, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &rv, nil\n}", "func (c Comic) Image() (*http.Response, error) {\n\tcomicData, err := http.Get(c.ImgSrc())\n\treturn comicData, err\n}", "func (d UserData) Image() string {\n\tval := d.ModelData.Get(models.NewFieldName(\"Image\", \"image\"))\n\tif !d.Has(models.NewFieldName(\"Image\", \"image\")) {\n\t\treturn *new(string)\n\t}\n\treturn val.(string)\n}", "func (d *Descriptor) Image() (v1.Image, error) {\n\tswitch d.MediaType {\n\tcase types.DockerManifestSchema1, types.DockerManifestSchema1Signed:\n\t\t// We don't care to support schema 1 images:\n\t\t// https://github.com/google/go-containerregistry/issues/377\n\t\treturn nil, newErrSchema1(d.MediaType)\n\tcase types.OCIImageIndex, types.DockerManifestList:\n\t\t// We want an image but the registry has an index, resolve it to an image.\n\t\treturn d.remoteIndex().imageByPlatform(d.platform)\n\tcase types.OCIManifestSchema1, types.DockerManifestSchema2:\n\t\t// These are expected. Enumerated here to allow a default case.\n\tdefault:\n\t\t// We could just return an error here, but some registries (e.g. static\n\t\t// registries) don't set the Content-Type headers correctly, so instead...\n\t\tlogs.Warn.Printf(\"Unexpected media type for Image(): %s\", d.MediaType)\n\t}\n\n\t// Wrap the v1.Layers returned by this v1.Image in a hint for downstream\n\t// remote.Write calls to facilitate cross-repo \"mounting\".\n\timgCore, err := partial.CompressedToImage(d.remoteImage())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &mountableImage{\n\t\tImage: imgCore,\n\t\tReference: d.ref,\n\t}, nil\n}", "func GetImageData(builtImages map[string][]byte, imageID string) ([]byte, error) {\n\n\tvar imageData []byte\n\tvar err error\n\n\tif value, ok := builtImages[imageID]; ok {\n\t\timageData = value\n\t} else {\n\t\terr = errors.New(\"Image not found\")\n\t}\n\treturn imageData, err\n}", "func (o FioSpecVolumeVolumeSourceRbdOutput) Image() pulumi.StringOutput {\n\treturn o.ApplyT(func(v FioSpecVolumeVolumeSourceRbd) string { return v.Image }).(pulumi.StringOutput)\n}", "func (c MockDockerClient) ImagePull(ctx context.Context, imageName string) error {\n\tif c.ImagePullFn != nil {\n\t\tfmt.Println(\"[MockDockerClient] In \", utils.CurrentFunctionName())\n\t\tfmt.Println(\"[MockDockerClient] - ctx: \", ctx)\n\t\tfmt.Println(\"[MockDockerClient] - imageName: \", imageName)\n\t\treturn c.ImagePullFn(ctx, imageName)\n\t}\n\tpanic(fmt.Sprintf(\"No function defined for: %s\", utils.CurrentFunctionName()))\n}", "func (d *imageDirectory) handlerGetImage(w http.ResponseWriter, r *http.Request) {\n\t//parse vars from path\n\tvars := mux.Vars(r)\n\timageID := vars[\"sha256\"]\n\t//Join all the strings in the image entry\n\timageData, err := GetImageData((*d).builtImages, imageID)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\tw.Write(nil)\n\t} else {\n\t\tw.Write([]byte(imageData))\n\t}\n}", "func (v *Virt) ImagePush(ctx context.Context, ref string) (rc io.ReadCloser, err error) {\n\tlog.Warnf(ctx, \"does not implement\")\n\treturn\n}", "func (r *RGBARotator) Image() image.Image {\n\treturn r.Img\n}", "func (w *Worker) getImage(u string) ([]byte, error) {\n\t// Image in data url\n\tif strings.HasPrefix(u, \"data:\") {\n\t\tdataURL, err := dataurl.DecodeString(u)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn dataURL.Data, nil\n\t}\n\n\t// Download image using url provided\n\tresp, err := w.hg.Get(u)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode == http.StatusOK {\n\t\treturn ioutil.ReadAll(resp.Body)\n\t}\n\treturn nil, fmt.Errorf(\"unexpected status code received: %d\", resp.StatusCode)\n}", "func LookupMyImage(connConfig string, myImageId string) (SpiderMyImageInfo, error) {\n\n\tif connConfig == \"\" {\n\t\terr := fmt.Errorf(\"LookupMyImage() called with empty connConfig.\")\n\t\tcommon.CBLog.Error(err)\n\t\treturn SpiderMyImageInfo{}, err\n\t} else if myImageId == \"\" {\n\t\terr := fmt.Errorf(\"LookupMyImage() called with empty myImageId.\")\n\t\tcommon.CBLog.Error(err)\n\t\treturn SpiderMyImageInfo{}, err\n\t}\n\n\turl := common.SpiderRestUrl + \"/myimage/\" + url.QueryEscape(myImageId)\n\n\t// Create Req body\n\ttempReq := common.SpiderConnectionName{}\n\ttempReq.ConnectionName = connConfig\n\n\tclient := resty.New().SetCloseConnection(true)\n\tclient.SetAllowGetMethodPayload(true)\n\n\tresp, err := client.R().\n\t\tSetHeader(\"Content-Type\", \"application/json\").\n\t\tSetBody(tempReq).\n\t\tSetResult(&SpiderMyImageInfo{}). // or SetResult(AuthSuccess{}).\n\t\t//SetError(&AuthError{}). // or SetError(AuthError{}).\n\t\tGet(url)\n\n\tif err != nil {\n\t\tcommon.CBLog.Error(err)\n\t\terr := fmt.Errorf(\"an error occurred while requesting to CB-Spider\")\n\t\treturn SpiderMyImageInfo{}, err\n\t}\n\n\tfmt.Println(string(resp.Body()))\n\n\tfmt.Println(\"HTTP Status code: \" + strconv.Itoa(resp.StatusCode()))\n\tswitch {\n\tcase resp.StatusCode() >= 400 || resp.StatusCode() < 200:\n\t\terr := fmt.Errorf(string(resp.Body()))\n\t\tcommon.CBLog.Error(err)\n\t\treturn SpiderMyImageInfo{}, err\n\t}\n\n\ttemp := resp.Result().(*SpiderMyImageInfo)\n\treturn *temp, nil\n\n}", "func (v *Virt) ImagePull(ctx context.Context, ref string, all bool) (rc io.ReadCloser, err error) {\n\treturn\n}", "func (h *Handler) GetImages(w http.ResponseWriter, r *http.Request) {\n\t// first list all the pools so that we can retrieve images from all pools\n\tpools, err := ceph.ListPoolSummaries(h.context, h.config.clusterInfo.Name)\n\tif err != nil {\n\t\tlogger.Errorf(\"failed to list pools: %+v\", err)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tresult := []model.BlockImage{}\n\n\t// for each pool, get further details about all the images in the pool\n\tfor _, p := range pools {\n\t\timages, ok := h.getImagesForPool(w, p.Name)\n\t\tif !ok {\n\t\t\treturn\n\t\t}\n\n\t\tresult = append(result, images...)\n\t}\n\n\tFormatJsonResponse(w, result)\n}", "func (bm *BingManager) getImageUrl(query string) (string, error) {\n\tfound, val, err := bm.queryCachedImageUrl(query)\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif !found {\n\t\tval, err = bm.queryNewImageUrl(query)\n\t\tif err != nil || val == \"\" {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\t// todo: check for race condition replacement?\n\t\t// no real reason to do so...\n\t\t// it's unlikely that an image would be double set fast enough\n\t\t// and would also have a different result from the search api\n\t\t// and it wouldn't matter\n\t\terr = bm.Client.Set(query, val, 0).Err()\n\t}\n\n\treturn val, err\n}", "func (f *fetcher) fetchImage(img string, asc string, discover bool) (string, error) {\n\tif f.withDeps && !discover {\n\t\treturn \"\", fmt.Errorf(\"cannot fetch image's dependencies with discovery disabled\")\n\t}\n\thash, err := f.fetchSingleImage(img, asc, discover)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif f.withDeps {\n\t\terr = f.fetchImageDeps(hash)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\treturn hash, nil\n}" ]
[ "0.65029436", "0.64669365", "0.64437854", "0.6379381", "0.63469005", "0.63291", "0.6281645", "0.62751305", "0.6213703", "0.620394", "0.61851525", "0.61699486", "0.6123725", "0.6068116", "0.6035613", "0.6026102", "0.59843147", "0.5976891", "0.5946499", "0.5945196", "0.5907145", "0.58734566", "0.58700013", "0.5869841", "0.58391315", "0.5836688", "0.582047", "0.5802332", "0.57665294", "0.57400703", "0.5727809", "0.5718604", "0.57002515", "0.56802166", "0.5674663", "0.5673927", "0.5671319", "0.5663464", "0.56516916", "0.5637355", "0.5626849", "0.5621457", "0.5614859", "0.55717367", "0.55715615", "0.55670106", "0.55585545", "0.5555079", "0.5542508", "0.5524181", "0.5509738", "0.55038327", "0.55010116", "0.5494555", "0.54854316", "0.5473468", "0.546149", "0.54513013", "0.5438815", "0.5426039", "0.5423593", "0.5419687", "0.54107356", "0.54035854", "0.5398353", "0.539487", "0.5391896", "0.5389362", "0.53880364", "0.53821903", "0.53818625", "0.5378621", "0.5376069", "0.53625995", "0.5352791", "0.5347237", "0.5341257", "0.53371114", "0.5328403", "0.53270435", "0.53233314", "0.531345", "0.5306689", "0.53022313", "0.5300697", "0.5291379", "0.52897197", "0.52867645", "0.5285845", "0.52841806", "0.52831995", "0.5273602", "0.5270419", "0.52700615", "0.5263185", "0.5262967", "0.5256124", "0.5253552", "0.5252291", "0.5251629" ]
0.62485206
8
GetImageFromFamily uses the override method GetImageFromFamilyFn or the real implementation.
func (c *TestClient) GetImageFromFamily(project, family string) (*compute.Image, error) { if c.GetImageFromFamilyFn != nil { return c.GetImageFromFamilyFn(project, family) } return c.client.GetImageFromFamily(project, family) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o InstanceVmImageOutput) ImageFamily() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v InstanceVmImage) *string { return v.ImageFamily }).(pulumi.StringPtrOutput)\n}", "func (o EnvironmentVmImageOutput) ImageFamily() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v EnvironmentVmImage) *string { return v.ImageFamily }).(pulumi.StringPtrOutput)\n}", "func (o InstanceVmImagePtrOutput) ImageFamily() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *InstanceVmImage) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ImageFamily\n\t}).(pulumi.StringPtrOutput)\n}", "func (o EnvironmentVmImagePtrOutput) ImageFamily() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *EnvironmentVmImage) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ImageFamily\n\t}).(pulumi.StringPtrOutput)\n}", "func GetImageFlavor(label string, encryptionRequired bool, keyURL string, digest string) (*ImageFlavor, error) {\n\tlog.Trace(\"flavor/image_flavor:GetImageFlavor() Entering\")\n\tdefer log.Trace(\"flavor/image_flavor:GetImageFlavor() Leaving\")\n\tvar encryption *model.Encryption\n\n\tdescription := map[string]interface{}{\n\t\tmodel.Label: label,\n\t\tmodel.FlavorPart: \"IMAGE\",\n\t}\n\n\tmeta := model.Meta{\n\t\tDescription: description,\n\t}\n\tnewUuid, err := uuid.NewRandom()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to create new UUID\")\n\t}\n\tmeta.ID = newUuid\n\n\tif encryptionRequired {\n\t\tencryption = &model.Encryption{\n\t\t\tKeyURL: keyURL,\n\t\t\tDigest: digest,\n\t\t}\n\t}\n\n\timageflavor := model.Image{\n\t\tMeta: meta,\n\t\tEncryptionRequired: encryptionRequired,\n\t\tEncryption: encryption,\n\t}\n\n\tflavor := ImageFlavor{\n\t\tImage: imageflavor,\n\t}\n\treturn &flavor, nil\n}", "func getImageName(project, family string) (string, error) {\n\t// Use oauth2.NoContext if there isn't a good context to pass in.\n\tctx := context.Background()\n\n\tclient, err := google.DefaultClient(ctx, compute.ComputeScope)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tcomputeService, err := compute.New(client)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\timage, err := computeService.Images.GetFromFamily(project, family).Do()\n\treturn image.Name, err\n}", "func GetImage(hub *registry.Registry, repo string, tag string) (*Image, error) {\n\t// Default maniftest will be a v2\n\tdigest, err := hub.ManifestDigestV2(repo, tag)\n\tif err != nil {\n\t\tlog.Debug(fmt.Sprintf(\"Error getting v2 content digest: %s\", err))\n\t\t// Attempt to obtain v1 if v2 is unavailable\n\t\tdigest, err = hub.ManifestDigest(repo, tag)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Unable to obtain either v1 or v2 digest: %s\", err)\n\t\t}\n\t}\n\n\t// Both V1 and V2 manifests contain useful data we want to store\n\tvar layers []string\n\tvar manifestV2Map map[string]interface{}\n\tmanifest, err := hub.ManifestV2(repo, tag)\n\tif err != nil {\n\t\tlog.Debug(fmt.Sprintf(\"Error getting v2 manifest: %s for Image %s/%s:%s\", err, hub.URL, repo, tag))\n\t} else {\n\t\tmanifestV2Map = structs.Map(manifest.Manifest)\n\n\t\t// Will use v2 manifest to build layers if its availble.\n\t\t// V1 and V2 layer order is reversed.\n\t\tfor i := len(manifest.Layers) - 1; i >= 0; i-- {\n\t\t\tif string(manifest.Layers[i].Digest) != emptyLayer {\n\t\t\t\tlayers = append(layers, string(manifest.Layers[i].Digest))\n\t\t\t}\n\t\t}\n\t}\n\n\tvar manifestV1Map map[string]interface{}\n\tmanifestV1, err := hub.Manifest(repo, tag)\n\tif err != nil {\n\t\tlog.Debug(fmt.Sprintf(\"Error getting v1 manifest: %s for Image %s/%s:%s\", err, hub.URL, repo, tag))\n\t} else {\n\t\tmanifestV1Map = structs.Map(manifestV1.Manifest)\n\n\t\t// If layers from V1 aren't available attempt to use the V1.\n\t\t// V1 and V2 layer order is reversed.\n\t\tif len(layers) == 0 {\n\t\t\tfor i := 0; i <= len(manifestV1.FSLayers)-1; i++ {\n\t\t\t\tif string(manifestV1.FSLayers[i].BlobSum) != emptyLayer {\n\t\t\t\t\tlayers = append(layers, string(manifestV1.FSLayers[i].BlobSum))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif err != nil && manifest == nil && manifestV1 == nil {\n\t\treturn nil, fmt.Errorf(\"Docker V1 or V2 could be obtained: %s\", err)\n\t}\n\n\tif len(layers) == 0 {\n\t\treturn nil, fmt.Errorf(\"Image manifest contaied no layers: %s/%s:%s\", hub.URL, repo, tag)\n\t}\n\n\timage := &Image{\n\t\tRegistry: hub.URL,\n\t\tRepo: repo,\n\t\tTag: tag,\n\t\tDigest: string(digest),\n\t\tManifestV1: manifestV1Map,\n\t\tManifestV2: manifestV2Map,\n\t\tLayers: layers,\n\t}\n\treturn image, nil\n}", "func (o LookupImageResultOutput) Family() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupImageResult) string { return v.Family }).(pulumi.StringOutput)\n}", "func (*GetImageLatestByFamilyRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_compute_v1_image_service_proto_rawDescGZIP(), []int{1}\n}", "func getImage(windowsServerVersion windows.ServerVersion) string {\n\tswitch windowsServerVersion {\n\tcase windows.Server2019:\n\t\treturn \"projects/windows-cloud/global/images/family/windows-2019-core\"\n\tcase windows.Server2022:\n\tdefault:\n\t}\n\t// use the latest image from the `windows-2022-core` family in the `windows-cloud` project\n\treturn \"projects/windows-cloud/global/images/family/windows-2022-core\"\n}", "func (b *ecrBase) runGetImage(ctx context.Context, batchGetImageInput ecr.BatchGetImageInput) (*ecr.Image, error) {\n\t// Allow only a single image to be fetched at a time.\n\tif len(batchGetImageInput.ImageIds) != 1 {\n\t\treturn nil, errGetImageUnhandled\n\t}\n\n\tbatchGetImageInput.RegistryId = aws.String(b.ecrSpec.Registry())\n\tbatchGetImageInput.RepositoryName = aws.String(b.ecrSpec.Repository)\n\n\tlog.G(ctx).WithField(\"batchGetImageInput\", batchGetImageInput).Trace(\"ecr.base.image: requesting images\")\n\n\tbatchGetImageOutput, err := b.client.BatchGetImageWithContext(ctx, &batchGetImageInput)\n\tif err != nil {\n\t\tlog.G(ctx).WithError(err).Error(\"ecr.base.image: failed to get image\")\n\t\treturn nil, err\n\t}\n\tlog.G(ctx).WithField(\"batchGetImageOutput\", batchGetImageOutput).Trace(\"ecr.base.image: api response\")\n\n\t// Summarize image request failures for handled errors. Only the first\n\t// failure is checked as only a single ImageIdentifier is allowed to be\n\t// queried for.\n\tif len(batchGetImageOutput.Failures) > 0 {\n\t\tfailure := batchGetImageOutput.Failures[0]\n\t\tswitch aws.StringValue(failure.FailureCode) {\n\t\t// Requested image with a corresponding tag and digest does not exist.\n\t\t// This failure will generally occur when pushing an updated (or new)\n\t\t// image with a tag.\n\t\tcase ecr.ImageFailureCodeImageTagDoesNotMatchDigest:\n\t\t\tlog.G(ctx).WithField(\"failure\", failure).Debug(\"ecr.base.image: no matching image with specified digest\")\n\t\t\treturn nil, errImageNotFound\n\t\t// Requested image doesn't resolve to a known image. A new image will\n\t\t// result in an ImageNotFound error when checked before push.\n\t\tcase ecr.ImageFailureCodeImageNotFound:\n\t\t\tlog.G(ctx).WithField(\"failure\", failure).Debug(\"ecr.base.image: no image found\")\n\t\t\treturn nil, errImageNotFound\n\t\t// Requested image identifiers are invalid.\n\t\tcase ecr.ImageFailureCodeInvalidImageDigest, ecr.ImageFailureCodeInvalidImageTag:\n\t\t\tlog.G(ctx).WithField(\"failure\", failure).Error(\"ecr.base.image: invalid image identifier\")\n\t\t\treturn nil, reference.ErrInvalid\n\t\t// Unhandled failure reported for image request made.\n\t\tdefault:\n\t\t\tlog.G(ctx).WithField(\"failure\", failure).Warn(\"ecr.base.image: unhandled image request failure\")\n\t\t\treturn nil, errGetImageUnhandled\n\t\t}\n\t}\n\n\treturn batchGetImageOutput.Images[0], nil\n}", "func (reg *registry) GetImage(img Repository, tag string) (_ flux.Image, err error) {\n\trem, err := reg.newRemote(img)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn rem.Manifest(img, tag)\n}", "func (d *Descriptor) Image() (v1.Image, error) {\n\tswitch d.MediaType {\n\tcase types.DockerManifestSchema1, types.DockerManifestSchema1Signed:\n\t\t// We don't care to support schema 1 images:\n\t\t// https://github.com/google/go-containerregistry/issues/377\n\t\treturn nil, newErrSchema1(d.MediaType)\n\tcase types.OCIImageIndex, types.DockerManifestList:\n\t\t// We want an image but the registry has an index, resolve it to an image.\n\t\treturn d.remoteIndex().imageByPlatform(d.platform)\n\tcase types.OCIManifestSchema1, types.DockerManifestSchema2:\n\t\t// These are expected. Enumerated here to allow a default case.\n\tdefault:\n\t\t// We could just return an error here, but some registries (e.g. static\n\t\t// registries) don't set the Content-Type headers correctly, so instead...\n\t\tlogs.Warn.Printf(\"Unexpected media type for Image(): %s\", d.MediaType)\n\t}\n\n\t// Wrap the v1.Layers returned by this v1.Image in a hint for downstream\n\t// remote.Write calls to facilitate cross-repo \"mounting\".\n\timgCore, err := partial.CompressedToImage(d.remoteImage())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &mountableImage{\n\t\tImage: imgCore,\n\t\tReference: d.ref,\n\t}, nil\n}", "func (b *ecrBase) getImage(ctx context.Context) (*ecr.Image, error) {\n\treturn b.runGetImage(ctx, ecr.BatchGetImageInput{\n\t\tImageIds: []*ecr.ImageIdentifier{b.ecrSpec.ImageID()},\n\t\tAcceptedMediaTypes: aws.StringSlice(supportedImageMediaTypes),\n\t})\n}", "func (b *ecrBase) getImageByDescriptor(ctx context.Context, desc ocispec.Descriptor) (*ecr.Image, error) {\n\t// If the reference includes both a digest & tag for an image and that\n\t// digest matches the descriptor's digest then both are specified when\n\t// requesting an image from ECR. Mutation of the image that pushes an image\n\t// with a new digest to the tag, will cause the query to fail as the\n\t// combination of tag AND digest does not match this modified tag.\n\t//\n\t// This stronger matching works well for repositories using immutable tags;\n\t// in the case of immutable tags, a ref like\n\t// ecr.aws/arn:aws:ecr:us-west-2:111111111111:repository/example-name:tag-name@sha256:$digest\n\t// would necessarily refer to the same image unless tag-name is deleted and\n\t// recreated with an different image.\n\t//\n\t// Consumers wanting to use a strong reference without assuming immutable\n\t// tags should instead provide refs that specify digests, excluding its\n\t// corresponding tag.\n\t//\n\t// See the ECR docs on image tag mutability for details:\n\t//\n\t// https://docs.aws.amazon.com/AmazonECR/latest/userguide/image-tag-mutability.html\n\t//\n\tident := &ecr.ImageIdentifier{ImageDigest: aws.String(desc.Digest.String())}\n\tif b.ecrSpec.Spec().Digest() == desc.Digest {\n\t\tif tag, _ := b.ecrSpec.TagDigest(); tag != \"\" {\n\t\t\tident.ImageTag = aws.String(tag)\n\t\t}\n\t}\n\n\tinput := ecr.BatchGetImageInput{\n\t\tImageIds: []*ecr.ImageIdentifier{ident},\n\t}\n\n\t// Request exact mediaType when known.\n\tif desc.MediaType != \"\" {\n\t\tinput.AcceptedMediaTypes = []*string{aws.String(desc.MediaType)}\n\t} else {\n\t\tinput.AcceptedMediaTypes = aws.StringSlice(supportedImageMediaTypes)\n\t}\n\n\treturn b.runGetImage(ctx, input)\n}", "func LookupImage(ctx *pulumi.Context, args *LookupImageArgs, opts ...pulumi.InvokeOption) (*LookupImageResult, error) {\n\topts = internal.PkgInvokeDefaultOpts(opts)\n\tvar rv LookupImageResult\n\terr := ctx.Invoke(\"google-native:compute/alpha:getImage\", args, &rv, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &rv, nil\n}", "func (s *API) GetImage(req *GetImageRequest, opts ...scw.RequestOption) (*Image, 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 fmt.Sprint(req.Region) == \"\" {\n\t\treturn nil, errors.New(\"field Region cannot be empty in request\")\n\t}\n\n\tif fmt.Sprint(req.ImageID) == \"\" {\n\t\treturn nil, errors.New(\"field ImageID cannot be empty in request\")\n\t}\n\n\tscwReq := &scw.ScalewayRequest{\n\t\tMethod: \"GET\",\n\t\tPath: \"/registry/v1/regions/\" + fmt.Sprint(req.Region) + \"/images/\" + fmt.Sprint(req.ImageID) + \"\",\n\t\tHeaders: http.Header{},\n\t}\n\n\tvar resp Image\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 GetImage(c echo.Context) error {\n\tidStr := c.Param(\"id\")\n\tid, _ := strconv.Atoi(idStr)\n\tfilepath := fmt.Sprintf(\"./img/storage/%d.jpg\", id)\n\treturn c.File(filepath)\n}", "func (a *ImageApiService) GetPersonImage(ctx _context.Context, name string, imageType ImageType, imageIndex int32, localVarOptionals *GetPersonImageOpts) (*os.File, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue *os.File\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/Persons/{name}/Images/{imageType}/{imageIndex}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"name\"+\"}\", _neturl.QueryEscape(parameterToString(name, \"\")) , -1)\n\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"imageType\"+\"}\", _neturl.QueryEscape(parameterToString(imageType, \"\")) , -1)\n\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"imageIndex\"+\"}\", _neturl.QueryEscape(parameterToString(imageIndex, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif localVarOptionals != nil && localVarOptionals.Tag.IsSet() {\n\t\tlocalVarQueryParams.Add(\"tag\", parameterToString(localVarOptionals.Tag.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Format.IsSet() {\n\t\tlocalVarQueryParams.Add(\"format\", parameterToString(localVarOptionals.Format.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.MaxWidth.IsSet() {\n\t\tlocalVarQueryParams.Add(\"maxWidth\", parameterToString(localVarOptionals.MaxWidth.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.MaxHeight.IsSet() {\n\t\tlocalVarQueryParams.Add(\"maxHeight\", parameterToString(localVarOptionals.MaxHeight.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.PercentPlayed.IsSet() {\n\t\tlocalVarQueryParams.Add(\"percentPlayed\", parameterToString(localVarOptionals.PercentPlayed.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.UnplayedCount.IsSet() {\n\t\tlocalVarQueryParams.Add(\"unplayedCount\", parameterToString(localVarOptionals.UnplayedCount.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Width.IsSet() {\n\t\tlocalVarQueryParams.Add(\"width\", parameterToString(localVarOptionals.Width.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Height.IsSet() {\n\t\tlocalVarQueryParams.Add(\"height\", parameterToString(localVarOptionals.Height.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Quality.IsSet() {\n\t\tlocalVarQueryParams.Add(\"quality\", parameterToString(localVarOptionals.Quality.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.CropWhitespace.IsSet() {\n\t\tlocalVarQueryParams.Add(\"cropWhitespace\", parameterToString(localVarOptionals.CropWhitespace.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.AddPlayedIndicator.IsSet() {\n\t\tlocalVarQueryParams.Add(\"addPlayedIndicator\", parameterToString(localVarOptionals.AddPlayedIndicator.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Blur.IsSet() {\n\t\tlocalVarQueryParams.Add(\"blur\", parameterToString(localVarOptionals.Blur.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.BackgroundColor.IsSet() {\n\t\tlocalVarQueryParams.Add(\"backgroundColor\", parameterToString(localVarOptionals.BackgroundColor.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.ForegroundLayer.IsSet() {\n\t\tlocalVarQueryParams.Add(\"foregroundLayer\", parameterToString(localVarOptionals.ForegroundLayer.Value(), \"\"))\n\t}\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"image/_*\", \"application/json\", \"application/json; profile=CamelCase\", \"application/json; profile=PascalCase\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarHeaderParams[\"X-Emby-Authorization\"] = key\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v ProblemDetails\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "func getVMImage(scope *scope.MachineScope) (infrav1.Image, error) {\n\t// Use custom Marketplace image, Image ID or a Shared Image Gallery image if provided\n\tif scope.AzureMachine.Spec.Image != nil {\n\t\treturn *scope.AzureMachine.Spec.Image, nil\n\t}\n\treturn azure.GetDefaultUbuntuImage(to.String(scope.Machine.Spec.Version))\n}", "func newImage(ctx context.Context, sys *types.SystemContext, s storageReference) (types.ImageCloser, error) {\n\tsrc, err := newImageSource(s)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\timg, err := image.FromSource(ctx, sys, src)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsize, err := src.getSize()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &storageImageCloser{ImageCloser: img, size: size}, nil\n}", "func (o FioSpecOutput) Image() FioSpecImageOutput {\n\treturn o.ApplyT(func(v FioSpec) FioSpecImage { return v.Image }).(FioSpecImageOutput)\n}", "func GetImageURL(msg *disgord.Message, args []string, size int, session disgord.Session) string {\n\tif len(msg.Mentions) > 0 {\n\t\tavatar, _ := msg.Mentions[0].AvatarURL(size, false)\n\t\treturn avatar\n\t}\n\tif len(args) > 0 {\n\t\tconverted := StringToID(args[0])\n\t\tuser, err := session.User(converted).Get()\n\t\tif err == nil {\n\t\t\tavatar, _ := user.AvatarURL(size, false)\n\t\t\treturn avatar\n\t\t}\n\t}\n\tif checkImage(strings.Join(args, \"\")) {\n\t\treturn strings.Join(args, \"\")\n\t}\n\tavatar, _ := msg.Author.AvatarURL(size, false)\n\treturn avatar\n}", "func (d *Data) GetImage(v dvid.VersionID, vox *Labels, supervoxels bool, scale uint8, roiname dvid.InstanceName) (*dvid.Image, error) {\n\tr, err := imageblk.GetROI(v, roiname, vox)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err := d.GetLabels(v, supervoxels, scale, vox, r); err != nil {\n\t\treturn nil, err\n\t}\n\treturn vox.GetImage2d()\n}", "func GetImage(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *ImageState, opts ...pulumi.ResourceOption) (*Image, error) {\n\tvar resource Image\n\terr := ctx.ReadResource(\"alicloud:ecs/image:Image\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (c *Client) GetImageStream(imageNS string, imageName string, imageTag string) (*imagev1.ImageStream, error) {\n\tvar err error\n\tvar imageStream *imagev1.ImageStream\n\tcurrentProjectName := c.GetCurrentProjectName()\n\t/*\n\t\tIf User has not chosen image NS then,\n\t\t\t1. Use image from current NS if available\n\t\t\t2. If not 1, use default openshift NS\n\t\t\t3. If not 2, return errors from both 1 and 2\n\t\telse\n\t\t\tUse user chosen namespace\n\t\t\tIf image doesn't exist in user chosen namespace,\n\t\t\t\terror out\n\t\t\telse\n\t\t\t\tProceed\n\t*/\n\t// User has not passed any particular ImageStream\n\tif imageNS == \"\" {\n\n\t\t// First try finding imagestream from current namespace\n\t\tcurrentNSImageStream, e := c.imageClient.ImageStreams(currentProjectName).Get(context.TODO(), imageName, metav1.GetOptions{})\n\t\tif e != nil {\n\t\t\terr = errors.Wrapf(e, \"no match found for : %s in namespace %s\", imageName, currentProjectName)\n\t\t} else {\n\t\t\tif isTagInImageStream(*currentNSImageStream, imageTag) {\n\t\t\t\treturn currentNSImageStream, nil\n\t\t\t}\n\t\t}\n\n\t\t// If not in current namespace, try finding imagestream from openshift namespace\n\t\topenshiftNSImageStream, e := c.imageClient.ImageStreams(OpenShiftNameSpace).Get(context.TODO(), imageName, metav1.GetOptions{})\n\t\tif e != nil {\n\t\t\t// The image is not available in current Namespace.\n\t\t\terr = errors.Wrapf(e, \"no match found for : %s in namespace %s\", imageName, OpenShiftNameSpace)\n\t\t} else {\n\t\t\tif isTagInImageStream(*openshiftNSImageStream, imageTag) {\n\t\t\t\treturn openshiftNSImageStream, nil\n\t\t\t}\n\t\t}\n\t\tif e != nil && err != nil {\n\t\t\treturn nil, fmt.Errorf(\"component type %q not found\", imageName)\n\t\t}\n\n\t\t// Required tag not in openshift and current namespaces\n\t\treturn nil, fmt.Errorf(\"image stream %s with tag %s not found in openshift and %s namespaces\", imageName, imageTag, currentProjectName)\n\n\t}\n\n\t// Fetch imagestream from requested namespace\n\timageStream, err = c.imageClient.ImageStreams(imageNS).Get(context.TODO(), imageName, metav1.GetOptions{})\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(\n\t\t\terr, \"no match found for %s in namespace %s\", imageName, imageNS,\n\t\t)\n\t}\n\tif !isTagInImageStream(*imageStream, imageTag) {\n\t\treturn nil, fmt.Errorf(\"image stream %s with tag %s not found in %s namespaces\", imageName, imageTag, currentProjectName)\n\t}\n\n\treturn imageStream, nil\n}", "func (f *fetcher) fetchImage(img string, asc string, discover bool) (string, error) {\n\tif f.withDeps && !discover {\n\t\treturn \"\", fmt.Errorf(\"cannot fetch image's dependencies with discovery disabled\")\n\t}\n\thash, err := f.fetchSingleImage(img, asc, discover)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif f.withDeps {\n\t\terr = f.fetchImageDeps(hash)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\treturn hash, nil\n}", "func (c *Client) GetCommonImage(args *GetFlavorImageArgs) (*GetImagesResult, error) {\n\tjsonBytes, jsonErr := json.Marshal(args)\n\tif jsonErr != nil {\n\t\treturn nil, jsonErr\n\t}\n\tbody, err := bce.NewBodyFromBytes(jsonBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn GetCommonImage(c, body)\n}", "func (a *ImageApiService) GetUserImage(ctx _context.Context, userId string, imageType ImageType, imageIndex int32, localVarOptionals *GetUserImageOpts) (*os.File, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue *os.File\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/Users/{userId}/Images/{imageType}/{imageIndex}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"userId\"+\"}\", _neturl.QueryEscape(parameterToString(userId, \"\")) , -1)\n\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"imageType\"+\"}\", _neturl.QueryEscape(parameterToString(imageType, \"\")) , -1)\n\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"imageIndex\"+\"}\", _neturl.QueryEscape(parameterToString(imageIndex, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif localVarOptionals != nil && localVarOptionals.Tag.IsSet() {\n\t\tlocalVarQueryParams.Add(\"tag\", parameterToString(localVarOptionals.Tag.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Format.IsSet() {\n\t\tlocalVarQueryParams.Add(\"format\", parameterToString(localVarOptionals.Format.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.MaxWidth.IsSet() {\n\t\tlocalVarQueryParams.Add(\"maxWidth\", parameterToString(localVarOptionals.MaxWidth.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.MaxHeight.IsSet() {\n\t\tlocalVarQueryParams.Add(\"maxHeight\", parameterToString(localVarOptionals.MaxHeight.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.PercentPlayed.IsSet() {\n\t\tlocalVarQueryParams.Add(\"percentPlayed\", parameterToString(localVarOptionals.PercentPlayed.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.UnplayedCount.IsSet() {\n\t\tlocalVarQueryParams.Add(\"unplayedCount\", parameterToString(localVarOptionals.UnplayedCount.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Width.IsSet() {\n\t\tlocalVarQueryParams.Add(\"width\", parameterToString(localVarOptionals.Width.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Height.IsSet() {\n\t\tlocalVarQueryParams.Add(\"height\", parameterToString(localVarOptionals.Height.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Quality.IsSet() {\n\t\tlocalVarQueryParams.Add(\"quality\", parameterToString(localVarOptionals.Quality.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.CropWhitespace.IsSet() {\n\t\tlocalVarQueryParams.Add(\"cropWhitespace\", parameterToString(localVarOptionals.CropWhitespace.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.AddPlayedIndicator.IsSet() {\n\t\tlocalVarQueryParams.Add(\"addPlayedIndicator\", parameterToString(localVarOptionals.AddPlayedIndicator.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Blur.IsSet() {\n\t\tlocalVarQueryParams.Add(\"blur\", parameterToString(localVarOptionals.Blur.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.BackgroundColor.IsSet() {\n\t\tlocalVarQueryParams.Add(\"backgroundColor\", parameterToString(localVarOptionals.BackgroundColor.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.ForegroundLayer.IsSet() {\n\t\tlocalVarQueryParams.Add(\"foregroundLayer\", parameterToString(localVarOptionals.ForegroundLayer.Value(), \"\"))\n\t}\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"image/_*\", \"application/json\", \"application/json; profile=CamelCase\", \"application/json; profile=PascalCase\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarHeaderParams[\"X-Emby-Authorization\"] = key\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v ProblemDetails\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "func getImage(ctx *fiber.Ctx) error {\n\t// check data\n\tid := ctx.Params(\"id\")\n\tif id == \"\" {\n\t\treturn utilities.Response(utilities.ResponseParams{\n\t\t\tCtx: ctx,\n\t\t\tInfo: configuration.ResponseMessages.MissingUserID,\n\t\t\tStatus: fiber.StatusBadRequest,\n\t\t})\n\t}\n\n\t// parse ID into an ObjectID\n\tparsedId, parsingError := primitive.ObjectIDFromHex(id)\n\tif parsingError != nil {\n\t\treturn utilities.Response(utilities.ResponseParams{\n\t\t\tCtx: ctx,\n\t\t\tInfo: configuration.ResponseMessages.InvalidData,\n\t\t\tStatus: fiber.StatusNotFound,\n\t\t})\n\t}\n\n\t// get User record\n\tUserCollection := Instance.Database.Collection(Collections.User)\n\trawUserRecord := UserCollection.FindOne(\n\t\tctx.Context(),\n\t\tbson.D{{Key: \"_id\", Value: parsedId}},\n\t)\n\tuserRecord := &User{}\n\trawUserRecord.Decode(userRecord)\n\tif userRecord.ID == \"\" {\n\t\treturn utilities.Response(utilities.ResponseParams{\n\t\t\tCtx: ctx,\n\t\t\tInfo: configuration.ResponseMessages.NotFound,\n\t\t\tStatus: fiber.StatusNotFound,\n\t\t})\n\t}\n\n\t// get Image record\n\tImageCollection := Instance.Database.Collection(Collections.Image)\n\trawImageRecord := ImageCollection.FindOne(\n\t\tctx.Context(),\n\t\tbson.D{{Key: \"userId\", Value: id}},\n\t)\n\timageRecord := &Image{}\n\trawImageRecord.Decode(imageRecord)\n\tif imageRecord.ID == \"\" {\n\t\treturn utilities.Response(utilities.ResponseParams{\n\t\t\tCtx: ctx,\n\t\t\tInfo: configuration.ResponseMessages.NotFound,\n\t\t\tStatus: fiber.StatusNotFound,\n\t\t})\n\t}\n\n\treturn utilities.Response(utilities.ResponseParams{\n\t\tCtx: ctx,\n\t\tData: fiber.Map{\n\t\t\t\"image\": imageRecord,\n\t\t},\n\t})\n}", "func (i *imageHandler) resolveImage() (string, error) {\n\tif i.client.IsOpenshift() {\n\t\tis := &imgv1.ImageStream{ObjectMeta: v1.ObjectMeta{Name: i.imageStream.Name, Namespace: i.imageStream.Namespace}}\n\t\tif exists, err := kubernetes.ResourceC(i.client).Fetch(is); err != nil {\n\t\t\treturn \"\", err\n\t\t} else if !exists {\n\t\t\treturn \"\", nil\n\t\t}\n\t\t// the image is on an ImageStreamTag object\n\t\tfor _, tag := range is.Spec.Tags {\n\t\t\tif tag.From != nil && tag.From.Name == i.resolveRegistryImage() {\n\t\t\t\tist, err := openshift.ImageStreamC(i.client).FetchTag(\n\t\t\t\t\ttypes.NamespacedName{\n\t\t\t\t\t\tName: i.defaultImageName,\n\t\t\t\t\t\tNamespace: i.imageStream.Namespace,\n\t\t\t\t\t}, i.resolveTag())\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn \"\", err\n\t\t\t\t} else if ist == nil {\n\t\t\t\t\treturn \"\", nil\n\t\t\t\t}\n\t\t\t\treturn ist.Image.DockerImageReference, nil\n\t\t\t}\n\t\t}\n\t\treturn \"\", nil\n\t}\n\n\treturn i.resolveRegistryImage(), nil\n}", "func (a *ImagesApiService) GetImage(ctx context.Context, imageDigest string) ApiGetImageRequest {\n\treturn ApiGetImageRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\timageDigest: imageDigest,\n\t}\n}", "func GetImage(imageid string) Instance {\n\tpath := image_path(imageid)\n\treturn is_get(path)\n}", "func GetImage(imageSpec *commonv1.AgentImageConfig, registry *string) string {\n\tif defaulting.IsImageNameContainsTag(imageSpec.Name) {\n\t\treturn imageSpec.Name\n\t}\n\n\timg := defaulting.NewImage(imageSpec.Name, imageSpec.Tag, imageSpec.JMXEnabled)\n\n\tif registry != nil && *registry != \"\" {\n\t\tdefaulting.WithRegistry(defaulting.ContainerRegistry(*registry))(img)\n\t}\n\n\treturn img.String()\n}", "func (f ProviderFunc) Get(source interface{}, parameters imageserver.Parameters) (*imageserver.Image, error) {\n\treturn f(source, parameters)\n}", "func (m *Manager) GetImage(hash string) *schema.ImageManifest {\n\tm.imagesLock.RLock()\n\tdefer m.imagesLock.RUnlock()\n\treturn m.images[hash]\n}", "func GetImage(u string) (*Image, error) {\n\tparsedURL, err := url.Parse(u)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient := &http.Client{\n\t\tTimeout: time.Second * 10,\n\t}\n\tresp, err := client.Get(parsedURL.String())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\tconfig, format, err := image.DecodeConfig(resp.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Image{\n\t\tURL: parsedURL.String(),\n\t\tWidth: config.Width,\n\t\tHeight: config.Height,\n\t\tResolution: config.Width * config.Height,\n\t\tFormat: format,\n\t}, nil\n}", "func (t *ThirdPartyServiceParse) GetImage() Image {\n\treturn Image{}\n}", "func (s *AvatarsService) Get (ctx context.Context, entityType string, entityID string) (*Avatars, *http.Response, error) {\n\n\tendpoint := fmt.Sprintf(\"universal_avatar/type/%v/owner/%v\", entityType, entityID)\n\treq, err := s.client.NewRequest(\"GET\", endpoint, nil, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tvar a *Avatars\n\tresp, err := s.client.Do(ctx, req, &a)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn a, resp, err\n}", "func componentImageFor(component v1.ComponentKind) (types.Image, error) {\n\tenvVarFor := map[v1.ComponentKind]string{\n\t\tv1.ComponentQuay: componentImagePrefix + \"QUAY\",\n\t\tv1.ComponentClair: componentImagePrefix + \"CLAIR\",\n\t\tv1.ComponentRedis: componentImagePrefix + \"REDIS\",\n\t\tv1.ComponentPostgres: componentImagePrefix + \"POSTGRES\",\n\t}\n\tdefaultImagesFor := map[v1.ComponentKind]string{\n\t\tv1.ComponentQuay: \"quay.io/projectquay/quay\",\n\t\tv1.ComponentClair: \"quay.io/projectquay/clair\",\n\t\tv1.ComponentRedis: \"centos/redis-32-centos7\",\n\t\tv1.ComponentPostgres: \"centos/postgresql-10-centos7\",\n\t}\n\n\timageOverride := types.Image{\n\t\tName: defaultImagesFor[component],\n\t}\n\n\timage := os.Getenv(envVarFor[component])\n\tif image == \"\" {\n\t\treturn imageOverride, nil\n\t}\n\n\tif len(strings.Split(image, \"@\")) == 2 {\n\t\timageOverride.NewName = strings.Split(image, \"@\")[0]\n\t\timageOverride.Digest = strings.Split(image, \"@\")[1]\n\t} else if len(strings.Split(image, \":\")) == 2 {\n\t\timageOverride.NewName = strings.Split(image, \":\")[0]\n\t\timageOverride.NewTag = strings.Split(image, \":\")[1]\n\t} else {\n\t\treturn types.Image{}, fmt.Errorf(\n\t\t\t\"image override must be reference by tag or digest: %s\", image,\n\t\t)\n\t}\n\n\treturn imageOverride, nil\n}", "func GetImage(ctx context.Context, nameOrID string, options *GetOptions) (*entities.ImageInspectReport, error) {\n\tif options == nil {\n\t\toptions = new(GetOptions)\n\t}\n\tconn, err := bindings.GetClient(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tparams, err := options.ToParams()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tinspectedData := entities.ImageInspectReport{}\n\tresponse, err := conn.DoRequest(ctx, nil, http.MethodGet, \"/images/%s/json\", params, nil, nameOrID)\n\tif err != nil {\n\t\treturn &inspectedData, err\n\t}\n\tdefer response.Body.Close()\n\n\treturn &inspectedData, response.Process(&inspectedData)\n}", "func findImage(n *hetznerNodeGroup, serverType *hcloud.ServerType) (*hcloud.Image, error) {\n\t// Select correct image based on server type architecture\n\timage, _, err := n.manager.client.Image.GetForArchitecture(context.TODO(), n.manager.image, serverType.Architecture)\n\tif err != nil {\n\t\t// Keep looking for label if image was not found by id or name\n\t\tif !strings.HasPrefix(err.Error(), \"image not found\") {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif image != nil {\n\t\treturn image, nil\n\t}\n\n\t// Look for snapshot with label\n\timages, err := n.manager.client.Image.AllWithOpts(context.TODO(), hcloud.ImageListOpts{\n\t\tType: []hcloud.ImageType{hcloud.ImageTypeSnapshot},\n\t\tStatus: []hcloud.ImageStatus{hcloud.ImageStatusAvailable},\n\t\tSort: []string{\"created:desc\"},\n\t\tArchitecture: []hcloud.Architecture{serverType.Architecture},\n\t\tListOpts: hcloud.ListOpts{\n\t\t\tLabelSelector: n.manager.image,\n\t\t},\n\t})\n\n\tif err != nil || len(images) == 0 {\n\t\treturn nil, fmt.Errorf(\"unable to find image %s with architecture %s: %v\", n.manager.image, serverType.Architecture, err)\n\t}\n\n\treturn images[0], nil\n}", "func (m *MachineScope) GetVMImage(ctx context.Context) (*infrav1.Image, error) {\n\tctx, log, done := tele.StartSpanWithLogger(ctx, \"scope.MachineScope.GetVMImage\")\n\tdefer done()\n\n\t// Use custom Marketplace image, Image ID or a Shared Image Gallery image if provided\n\tif m.AzureMachine.Spec.Image != nil {\n\t\treturn m.AzureMachine.Spec.Image, nil\n\t}\n\n\tsvc := virtualmachineimages.New(m)\n\n\tif m.AzureMachine.Spec.OSDisk.OSType == azure.WindowsOS {\n\t\truntime := m.AzureMachine.Annotations[\"runtime\"]\n\t\twindowsServerVersion := m.AzureMachine.Annotations[\"windowsServerVersion\"]\n\t\tlog.Info(\"No image specified for machine, using default Windows Image\", \"machine\", m.AzureMachine.GetName(), \"runtime\", runtime, \"windowsServerVersion\", windowsServerVersion)\n\t\treturn svc.GetDefaultWindowsImage(ctx, m.Location(), ptr.Deref(m.Machine.Spec.Version, \"\"), runtime, windowsServerVersion)\n\t}\n\n\tlog.Info(\"No image specified for machine, using default Linux Image\", \"machine\", m.AzureMachine.GetName())\n\treturn svc.GetDefaultUbuntuImage(ctx, m.Location(), ptr.Deref(m.Machine.Spec.Version, \"\"))\n}", "func (f *fetcher) fetchImageFrom(appName string, aciURL, ascURL, scheme string, ascFile *os.File, latest bool) (string, error) {\n\tvar rem *store.Remote\n\n\tif f.insecureSkipVerify {\n\t\tif f.ks != nil {\n\t\t\tstderr(\"rkt: warning: TLS verification and signature verification has been disabled\")\n\t\t}\n\t} else if scheme == \"docker\" {\n\t\treturn \"\", fmt.Errorf(\"signature verification for docker images is not supported (try --insecure-skip-verify)\")\n\t}\n\n\tif (f.local && scheme != \"file\") || (scheme != \"file\" && !latest) {\n\t\tvar err error\n\t\tok := false\n\t\trem, ok, err = f.s.GetRemote(aciURL)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tif ok {\n\t\t\tif f.local {\n\t\t\t\tstderr(\"rkt: using image in local store for app %s\", appName)\n\t\t\t\treturn rem.BlobKey, nil\n\t\t\t}\n\t\t\tif useCached(rem.DownloadTime, rem.CacheMaxAge) {\n\t\t\t\tstderr(\"rkt: found image in local store, skipping fetching from %s\", aciURL)\n\t\t\t\treturn rem.BlobKey, nil\n\t\t\t}\n\t\t}\n\t\tif f.local {\n\t\t\treturn \"\", fmt.Errorf(\"url %s not available in local store\", aciURL)\n\t\t}\n\t}\n\n\tif scheme != \"file\" && f.debug {\n\t\tstderr(\"rkt: fetching image from %s\", aciURL)\n\t}\n\n\tvar etag string\n\tif rem != nil {\n\t\tetag = rem.ETag\n\t}\n\tentity, aciFile, cd, err := f.fetch(appName, aciURL, ascURL, ascFile, etag)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif cd != nil && cd.useCached {\n\t\tif rem != nil {\n\t\t\treturn rem.BlobKey, nil\n\t\t} else {\n\t\t\t// should never happen\n\t\t\tpanic(\"asked to use cached image but remote is nil\")\n\t\t}\n\t}\n\tif scheme != \"file\" {\n\t\tdefer os.Remove(aciFile.Name())\n\t}\n\n\tif entity != nil && !f.insecureSkipVerify {\n\t\tstderr(\"rkt: signature verified:\")\n\t\tfor _, v := range entity.Identities {\n\t\t\tstderr(\" %s\", v.Name)\n\t\t}\n\t}\n\tkey, err := f.s.WriteACI(aciFile, latest)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif scheme != \"file\" {\n\t\trem := store.NewRemote(aciURL, ascURL)\n\t\trem.BlobKey = key\n\t\trem.DownloadTime = time.Now()\n\t\tif cd != nil {\n\t\t\trem.ETag = cd.etag\n\t\t\trem.CacheMaxAge = cd.maxAge\n\t\t}\n\t\terr = f.s.WriteRemote(rem)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\n\treturn key, nil\n}", "func (client *Client) GetImage(id string) (*model.Image, error) {\n\treturn client.feclt.GetImage(id)\n}", "func (c *Conn) GetImage(name string) (dbus.ObjectPath, error) {\n\treturn c.getPath(\"GetImage\", name)\n}", "func (o FioSpecPtrOutput) Image() FioSpecImagePtrOutput {\n\treturn o.ApplyT(func(v *FioSpec) *FioSpecImage {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Image\n\t}).(FioSpecImagePtrOutput)\n}", "func (o StorageClusterSpecUserInterfaceOutput) Image() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v StorageClusterSpecUserInterface) *string { return v.Image }).(pulumi.StringPtrOutput)\n}", "func (s *SpecGenerator) GetImage() (*libimage.Image, string) {\n\treturn s.image, s.resolvedImageName\n}", "func GetImg(fileName string) (*image.Image, error) {\n localFile := fmt.Sprintf(\"/data/edgebox/local/%s\", fileName)\n existingImageFile, err := os.Open(localFile)\n if err == nil {\n defer existingImageFile.Close()\n imageData, _, err := image.Decode(existingImageFile)\n if err != nil {\n return nil, err\n }\n return &imageData, nil\n }\n\n remoteFile := fmt.Sprintf(\"/data/edgebox/remote/%s\", fileName)\n existingImageFile, err = os.Open(remoteFile)\n if err == nil {\n defer existingImageFile.Close()\n imageData, _, err := image.Decode(existingImageFile)\n if err != nil {\n return nil, err\n }\n return &imageData, nil\n }\n return nil, err\n}", "func FindImageFromCloudProfile(cloudProfileConfig *api.CloudProfileConfig, imageName, imageVersion, regionName string) (*api.MachineImage, error) {\n\tif cloudProfileConfig != nil {\n\t\tfor _, machineImage := range cloudProfileConfig.MachineImages {\n\t\t\tif machineImage.Name != imageName {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor _, version := range machineImage.Versions {\n\t\t\t\tif imageVersion != version.Version {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tfor _, region := range version.Regions {\n\t\t\t\t\tif regionName == region.Name {\n\t\t\t\t\t\treturn &api.MachineImage{\n\t\t\t\t\t\t\tName: imageName,\n\t\t\t\t\t\t\tVersion: imageVersion,\n\t\t\t\t\t\t\tID: region.ID,\n\t\t\t\t\t\t}, nil\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif version.Image != \"\" {\n\t\t\t\t\treturn &api.MachineImage{\n\t\t\t\t\t\tName: imageName,\n\t\t\t\t\t\tVersion: imageVersion,\n\t\t\t\t\t\tImage: version.Image,\n\t\t\t\t\t}, nil\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil, fmt.Errorf(\"could not find an image for name %q in version %q for region %q\", imageName, imageVersion, regionName)\n}", "func (m Model) GetImage() image.Image {\n\treturn m.Image\n}", "func (c *TestClient) GetImage(project, name string) (*compute.Image, error) {\n\tif c.GetImageFn != nil {\n\t\treturn c.GetImageFn(project, name)\n\t}\n\treturn c.client.GetImage(project, name)\n}", "func (es *etcdStore) GetBySource(imageSource string) (*Image, error) {\n\t// Look up the prefix to get a list of imageIDs\n\tresp, err := es.client.Get(es.prefix, false, false)\n\tif err != nil {\n\t\tlog.WithFields(etcdLogFields).WithFields(log.Fields{\n\t\t\t\"error\": err,\n\t\t\t\"key\": es.prefix,\n\t\t}).Error(\"failed to look up images dir\")\n\t\treturn nil, err\n\t}\n\n\t// Look up metadata for each imageID and return if the right image is found\n\tfor _, node := range resp.Node.Nodes {\n\t\timageID := path.Base(node.Key)\n\t\timage, err := es.GetByID(imageID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif imageSource == image.Source {\n\t\t\treturn image, nil\n\t\t}\n\t}\n\n\treturn nil, ErrNotFound\n}", "func (o StorageClusterSpecUserInterfacePtrOutput) Image() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *StorageClusterSpecUserInterface) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Image\n\t}).(pulumi.StringPtrOutput)\n}", "func (s *VarlinkInterface) GetImage(ctx context.Context, c VarlinkCall, id_ string) error {\n\treturn c.ReplyMethodNotImplemented(ctx, \"io.podman.GetImage\")\n}", "func (m *Manager) GetImage(name string) (img image.Image, err error) {\n\timg, ok := m.images[name]\n\tif !ok {\n\t\tfile, err := os.Open(name + \".png\")\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\timg, _, err = image.Decode(file)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tm.images[name] = img\n\t}\n\treturn img, nil\n}", "func NewFromImage(img *image.Image, scope Scope, userImageStr string) (Source, error) {\n\tif img == nil {\n\t\treturn Source{}, fmt.Errorf(\"no image given\")\n\t}\n\n\tresolver, err := getImageResolver(img, scope)\n\tif err != nil {\n\t\treturn Source{}, fmt.Errorf(\"could not determine file resolver: %w\", err)\n\t}\n\n\treturn Source{\n\t\tResolver: resolver,\n\t\tImage: img,\n\t\tMetadata: Metadata{\n\t\t\tScheme: ImageScheme,\n\t\t\tImageMetadata: NewImageMetadata(img, userImageStr, scope),\n\t\t},\n\t}, nil\n}", "func getImageFromFileSystem(imageFile string) (image.Image, error) {\n\tvar imageData image.Image\n\tfileData, err := getFileDataFromFileSystem(imageFile)\n\tif err != nil {\n\t\terr = errors.New(fmt.Sprintf(\"Could not get image data from '%s': %s\", imageFile, err.Error()))\n\t\treturn nil, err\n\t}\n\tif strings.HasSuffix(strings.ToLower(imageFile), \".jpg\") || strings.HasSuffix(strings.ToLower(imageFile), \".jpeg\"){\n\t\timageData, err = jpeg.Decode(bytes.NewReader(fileData))\n\t}\n\tif strings.HasSuffix(strings.ToLower(imageFile), \".png\") {\n\t\timageData, err = png.Decode(bytes.NewReader(fileData))\n\t}\n\tif err != nil {\n\t\terr = errors.New(fmt.Sprintf(\"Could not decode the image '%s': %s\", imageFile, err.Error()))\n\t\treturn nil, err\n\t}\n\treturn imageData, err\n}", "func (o FioSpecVolumeVolumeSourceRbdOutput) Image() pulumi.StringOutput {\n\treturn o.ApplyT(func(v FioSpecVolumeVolumeSourceRbd) string { return v.Image }).(pulumi.StringOutput)\n}", "func newImageSource(imageRef storageReference) (*storageImageSource, error) {\n\t// First, locate the image.\n\timg, err := imageRef.resolveImage()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Build the reader object.\n\timage := &storageImageSource{\n\t\timageRef: imageRef,\n\t\timage: img,\n\t\tlayerPosition: make(map[digest.Digest]int),\n\t\tSignatureSizes: []int{},\n\t}\n\tif img.Metadata != \"\" {\n\t\tif err := json.Unmarshal([]byte(img.Metadata), image); err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"error decoding metadata for source image\")\n\t\t}\n\t}\n\treturn image, nil\n}", "func GetImage(runtime connector.ModuleRuntime, kubeConf *common.KubeConf, name string) Image {\n\tvar image Image\n\tpauseTag, corednsTag := \"3.2\", \"1.6.9\"\n\n\tif versionutil.MustParseSemantic(kubeConf.Cluster.Kubernetes.Version).LessThan(versionutil.MustParseSemantic(\"v1.21.0\")) {\n\t\tpauseTag = \"3.2\"\n\t\tcorednsTag = \"1.6.9\"\n\t}\n\tif versionutil.MustParseSemantic(kubeConf.Cluster.Kubernetes.Version).AtLeast(versionutil.MustParseSemantic(\"v1.21.0\")) ||\n\t\t(kubeConf.Cluster.Kubernetes.ContainerManager != \"\" && kubeConf.Cluster.Kubernetes.ContainerManager != \"docker\") {\n\t\tpauseTag = \"3.4.1\"\n\t\tcorednsTag = \"1.8.0\"\n\t}\n\tif versionutil.MustParseSemantic(kubeConf.Cluster.Kubernetes.Version).AtLeast(versionutil.MustParseSemantic(\"v1.22.0\")) {\n\t\tpauseTag = \"3.5\"\n\t\tcorednsTag = \"1.8.0\"\n\t}\n\tif versionutil.MustParseSemantic(kubeConf.Cluster.Kubernetes.Version).AtLeast(versionutil.MustParseSemantic(\"v1.23.0\")) {\n\t\tpauseTag = \"3.6\"\n\t\tcorednsTag = \"1.8.6\"\n\t}\n\tif versionutil.MustParseSemantic(kubeConf.Cluster.Kubernetes.Version).AtLeast(versionutil.MustParseSemantic(\"v1.24.0\")) {\n\t\tpauseTag = \"3.7\"\n\t\tcorednsTag = \"1.8.6\"\n\t}\n\tif versionutil.MustParseSemantic(kubeConf.Cluster.Kubernetes.Version).AtLeast(versionutil.MustParseSemantic(\"v1.25.0\")) {\n\t\tpauseTag = \"3.8\"\n\t\tcorednsTag = \"1.9.3\"\n\t}\n\n\tlogger.Log.Debugf(\"pauseTag: %s, corednsTag: %s\", pauseTag, corednsTag)\n\n\tImageList := map[string]Image{\n\t\t\"pause\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: kubekeyv1alpha2.DefaultKubeImageNamespace, Repo: \"pause\", Tag: pauseTag, Group: kubekeyv1alpha2.K8s, Enable: true},\n\t\t\"etcd\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: kubekeyv1alpha2.DefaultKubeImageNamespace, Repo: \"etcd\", Tag: kubekeyv1alpha2.DefaultEtcdVersion, Group: kubekeyv1alpha2.Master, Enable: strings.EqualFold(kubeConf.Cluster.Etcd.Type, kubekeyv1alpha2.Kubeadm)},\n\t\t\"kube-apiserver\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: kubekeyv1alpha2.DefaultKubeImageNamespace, Repo: \"kube-apiserver\", Tag: kubeConf.Cluster.Kubernetes.Version, Group: kubekeyv1alpha2.Master, Enable: true},\n\t\t\"kube-controller-manager\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: kubekeyv1alpha2.DefaultKubeImageNamespace, Repo: \"kube-controller-manager\", Tag: kubeConf.Cluster.Kubernetes.Version, Group: kubekeyv1alpha2.Master, Enable: true},\n\t\t\"kube-scheduler\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: kubekeyv1alpha2.DefaultKubeImageNamespace, Repo: \"kube-scheduler\", Tag: kubeConf.Cluster.Kubernetes.Version, Group: kubekeyv1alpha2.Master, Enable: true},\n\t\t\"kube-proxy\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: kubekeyv1alpha2.DefaultKubeImageNamespace, Repo: \"kube-proxy\", Tag: kubeConf.Cluster.Kubernetes.Version, Group: kubekeyv1alpha2.K8s, Enable: !kubeConf.Cluster.Kubernetes.DisableKubeProxy},\n\n\t\t// network\n\t\t\"coredns\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: \"coredns\", Repo: \"coredns\", Tag: corednsTag, Group: kubekeyv1alpha2.K8s, Enable: true},\n\t\t\"k8s-dns-node-cache\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: kubekeyv1alpha2.DefaultKubeImageNamespace, Repo: \"k8s-dns-node-cache\", Tag: \"1.15.12\", Group: kubekeyv1alpha2.K8s, Enable: kubeConf.Cluster.Kubernetes.EnableNodelocaldns()},\n\t\t\"calico-kube-controllers\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: \"calico\", Repo: \"kube-controllers\", Tag: kubekeyv1alpha2.DefaultCalicoVersion, Group: kubekeyv1alpha2.K8s, Enable: strings.EqualFold(kubeConf.Cluster.Network.Plugin, \"calico\")},\n\t\t\"calico-cni\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: \"calico\", Repo: \"cni\", Tag: kubekeyv1alpha2.DefaultCalicoVersion, Group: kubekeyv1alpha2.K8s, Enable: strings.EqualFold(kubeConf.Cluster.Network.Plugin, \"calico\")},\n\t\t\"calico-node\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: \"calico\", Repo: \"node\", Tag: kubekeyv1alpha2.DefaultCalicoVersion, Group: kubekeyv1alpha2.K8s, Enable: strings.EqualFold(kubeConf.Cluster.Network.Plugin, \"calico\")},\n\t\t\"calico-flexvol\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: \"calico\", Repo: \"pod2daemon-flexvol\", Tag: kubekeyv1alpha2.DefaultCalicoVersion, Group: kubekeyv1alpha2.K8s, Enable: strings.EqualFold(kubeConf.Cluster.Network.Plugin, \"calico\")},\n\t\t\"calico-typha\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: \"calico\", Repo: \"typha\", Tag: kubekeyv1alpha2.DefaultCalicoVersion, Group: kubekeyv1alpha2.K8s, Enable: strings.EqualFold(kubeConf.Cluster.Network.Plugin, \"calico\") && len(runtime.GetHostsByRole(common.K8s)) > 50},\n\t\t\"flannel\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: \"flannel\", Repo: \"flannel\", Tag: kubekeyv1alpha2.DefaultFlannelVersion, Group: kubekeyv1alpha2.K8s, Enable: strings.EqualFold(kubeConf.Cluster.Network.Plugin, \"flannel\")},\n\t\t\"flannel-cni-plugin\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: \"flannel\", Repo: \"flannel-cni-plugin\", Tag: kubekeyv1alpha2.DefaultFlannelCniPluginVersion, Group: kubekeyv1alpha2.K8s, Enable: strings.EqualFold(kubeConf.Cluster.Network.Plugin, \"flannel\")},\n\t\t\"cilium\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: \"cilium\", Repo: \"cilium\", Tag: kubekeyv1alpha2.DefaultCiliumVersion, Group: kubekeyv1alpha2.K8s, Enable: strings.EqualFold(kubeConf.Cluster.Network.Plugin, \"cilium\")},\n\t\t\"cilium-operator-generic\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: \"cilium\", Repo: \"operator-generic\", Tag: kubekeyv1alpha2.DefaultCiliumVersion, Group: kubekeyv1alpha2.K8s, Enable: strings.EqualFold(kubeConf.Cluster.Network.Plugin, \"cilium\")},\n\t\t\"kubeovn\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: \"kubeovn\", Repo: \"kube-ovn\", Tag: kubekeyv1alpha2.DefaultKubeovnVersion, Group: kubekeyv1alpha2.K8s, Enable: strings.EqualFold(kubeConf.Cluster.Network.Plugin, \"kubeovn\")},\n\t\t\"multus\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: kubekeyv1alpha2.DefaultKubeImageNamespace, Repo: \"multus-cni\", Tag: kubekeyv1alpha2.DefalutMultusVersion, Group: kubekeyv1alpha2.K8s, Enable: strings.Contains(kubeConf.Cluster.Network.Plugin, \"multus\")},\n\t\t// storage\n\t\t\"provisioner-localpv\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: \"openebs\", Repo: \"provisioner-localpv\", Tag: \"3.3.0\", Group: kubekeyv1alpha2.Worker, Enable: false},\n\t\t\"linux-utils\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: \"openebs\", Repo: \"linux-utils\", Tag: \"3.3.0\", Group: kubekeyv1alpha2.Worker, Enable: false},\n\t\t// load balancer\n\t\t\"haproxy\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: \"library\", Repo: \"haproxy\", Tag: \"2.3\", Group: kubekeyv1alpha2.Worker, Enable: kubeConf.Cluster.ControlPlaneEndpoint.IsInternalLBEnabled()},\n\t\t\"kubevip\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: \"plndr\", Repo: \"kube-vip\", Tag: \"v0.5.0\", Group: kubekeyv1alpha2.Master, Enable: kubeConf.Cluster.ControlPlaneEndpoint.IsInternalLBEnabledVip()},\n\t\t// kata-deploy\n\t\t\"kata-deploy\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: kubekeyv1alpha2.DefaultKubeImageNamespace, Repo: \"kata-deploy\", Tag: \"stable\", Group: kubekeyv1alpha2.Worker, Enable: kubeConf.Cluster.Kubernetes.EnableKataDeploy()},\n\t\t// node-feature-discovery\n\t\t\"node-feature-discovery\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: kubekeyv1alpha2.DefaultKubeImageNamespace, Repo: \"node-feature-discovery\", Tag: \"v0.10.0\", Group: kubekeyv1alpha2.K8s, Enable: kubeConf.Cluster.Kubernetes.EnableNodeFeatureDiscovery()},\n\t}\n\n\timage = ImageList[name]\n\tif kubeConf.Cluster.Registry.NamespaceOverride != \"\" {\n\t\timage.NamespaceOverride = kubeConf.Cluster.Registry.NamespaceOverride\n\t}\n\treturn image\n}", "func getImageFormat(filename string) (string, error) {\n\tmime, _, err := mimetype.DetectFile(filename)\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"can't detect image's type\")\n\t} else {\n\t\treturn mime, nil\n\t}\n}", "func (bi *BinaryInfo) funcToImage(fn *Function) *Image {\n\tif fn == nil {\n\t\treturn bi.Images[0]\n\t}\n\treturn fn.cu.image\n}", "func IMAGE_API_GetImageFromCS(res http.ResponseWriter, req *http.Request, params httprouter.Params) {\n\tid := req.FormValue(\"id\") // this is an id request only.\n\tif id == \"\" { // if no id, exit with failure.\n\t\tfmt.Fprint(res, `{\"result\":\"failure\",\"reason\":\"missing image id\",\"code\":400}`)\n\t\treturn\n\t}\n\n\tctx := appengine.NewContext(req) // quickly get a handle into CS\n\tclient, clientErr := storage.NewClient(ctx)\n\tHandleError(res, clientErr)\n\tdefer client.Close()\n\n\tobj := client.Bucket(GCS_BucketID).Object(id) // pull the object from cs\n\n\t// We'll just copy the image data onto the response, letting the browser know that we're sending an image.\n\tctype, ok := Content_Types[stringedExt(id)]\n\tif !ok {\n\t\tctype = \"image/png\"\n\t}\n\tres.Header().Set(\"Content-Type\", ctype+\"; charset=utf-8\")\n\trdr, _ := obj.NewReader(ctx)\n\tio.Copy(res, rdr)\n}", "func (i ImageFetcher) Fetch(path string) (image.Image, error) {\n\tresp, err := http.Get(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\treturn png.Decode(resp.Body)\n}", "func (s *AvatarsService) LoadAvatar (ctx context.Context, entityType string, entityID string, imageType string, imageData *[]byte, queryParams *LoadAvatarQueryParams) (*Avatar, *http.Response, error) {\n\n\tendpoint := fmt.Sprintf(\"universal_avatar/type/%v/owner/%v\", entityType, entityID)\n\n\tu, err := addQueryParams(endpoint, queryParams)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treqHeaders := make(map[string]string)\n\n\treqHeaders[\"Content-Type\"] = fmt.Sprintf(\"image/%v\", imageType)\n\treqHeaders[\"X-Atlassian-Token\"] = \"no-check\"\n\n\treq, err := s.client.NewRequest(\"POST\", u, reqHeaders, imageData)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tvar a *Avatar\n\tresp, err := s.client.Do(ctx, req, &a)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn a, resp, err\n}", "func (i Image) GetImage(c echo.Context) error {\n\tvar file *os.File\n\t// Get ID\n\tid := c.FormValue(\"id\")\n\n\t// Get image by id\n\tsrc, err := i.session.DB(\"test\").GridFS(\"fs\").OpenId(bson.ObjectIdHex(id))\n\tif err != nil {\n\t\tc.Logger().Error(err)\n\t\treturn err\n\t}\n\n\t// Create file to send it\n\tif file, err = os.Create(id); err != nil {\n\t\tc.Logger().Error(err)\n\t\treturn err\n\t}\n\tdefer file.Close()\n\t// delete file\n\tdefer deleteFile(id)\n\n\t// Write on the new file\n\tif _, err = io.Copy(file, src); err != nil {\n\t\tc.Logger().Error(err)\n\t\treturn err\n\t}\n\n\t// send it\n\treturn c.Attachment(id, src.Name())\n}", "func (f *Face) Image(dst draw.Image, pt image.Point, ch rune) error {\n\terrno := C.FT_Load_Char(f.handle, C.FT_ULong(ch), C.FT_LOAD_RENDER)\n\tif errno != 0 {\n\t\treturn fmt.Errorf(\"freetype2: %s\", errstr(errno))\n\t}\n\tbitmap := &f.handle.glyph.bitmap\n\tif bitmap.pixel_mode != C.FT_PIXEL_MODE_GRAY || bitmap.num_grays != 256 {\n\t\treturn fmt.Errorf(\"freetype2: unsupported pixel mode\")\n\t}\n\tsrc := imageFromBitmap(bitmap)\n\tswitch dst.(type) {\n\tcase *image.Alpha:\n\t\tdrawAlpha(dst.(*image.Alpha), pt, src)\n\tdefault:\n\t\treturn fmt.Errorf(\"freetype2: unsupported dst type %T\", dst)\n\t}\n\treturn nil\n}", "func (user *UserFriendParser) getImage(friendArea *goquery.Selection) string {\n\timage, _ := friendArea.Find(\"a img\").Attr(\"src\")\n\treturn utils.URLCleaner(image, \"image\", user.Config.CleanImageURL)\n}", "func (d Docker) LookupImage(name string) (*image.Image, error) {\n\treturn d.Daemon.GetImage(name)\n}", "func GetContainerImageFlavor(label string, encryptionRequired bool, keyURL string, integrityEnforced bool, notaryURL string) (*ImageFlavor, error) {\n\tlog.Trace(\"flavor/image_flavor:GetContainerImageFlavor() Entering\")\n\tdefer log.Trace(\"flavor/image_flavor:GetContainerImageFlavor() Leaving\")\n\tvar encryption *model.Encryption\n\tvar integrity *model.Integrity\n\n\tif label == \"\" {\n\t\treturn nil, errors.Errorf(\"label cannot be empty\")\n\t}\n\n\tdescription := map[string]interface{}{\n\t\tmodel.Label: label,\n\t\tmodel.FlavorPart: \"CONTAINER_IMAGE\",\n\t}\n\n\tmeta := model.Meta{\n\t\tDescription: description,\n\t}\n\tnewUuid, err := uuid.NewRandom()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to create new UUID\")\n\t}\n\tmeta.ID = newUuid\n\n\tencryption = &model.Encryption{\n\t\tKeyURL: keyURL,\n\t}\n\n\tintegrity = &model.Integrity{\n\t\tNotaryURL: notaryURL,\n\t}\n\n\tcontainerImageFlavor := model.Image{\n\t\tMeta: meta,\n\t\tEncryptionRequired: encryptionRequired,\n\t\tEncryption: encryption,\n\t\tIntegrityEnforced: integrityEnforced,\n\t\tIntegrity: integrity,\n\t}\n\n\tflavor := ImageFlavor{\n\t\tImage: containerImageFlavor,\n\t}\n\treturn &flavor, nil\n}", "func GetImage(path string) (image.Image, string, error) {\n\treader, err := os.Open(path)\n\tif err != nil {\n\t\tlog.Panicln(err.Error())\n\t}\n\tdefer reader.Close()\n\treturn image.Decode(reader)\n}", "func LookupMyImage(connConfig string, myImageId string) (SpiderMyImageInfo, error) {\n\n\tif connConfig == \"\" {\n\t\terr := fmt.Errorf(\"LookupMyImage() called with empty connConfig.\")\n\t\tcommon.CBLog.Error(err)\n\t\treturn SpiderMyImageInfo{}, err\n\t} else if myImageId == \"\" {\n\t\terr := fmt.Errorf(\"LookupMyImage() called with empty myImageId.\")\n\t\tcommon.CBLog.Error(err)\n\t\treturn SpiderMyImageInfo{}, err\n\t}\n\n\turl := common.SpiderRestUrl + \"/myimage/\" + url.QueryEscape(myImageId)\n\n\t// Create Req body\n\ttempReq := common.SpiderConnectionName{}\n\ttempReq.ConnectionName = connConfig\n\n\tclient := resty.New().SetCloseConnection(true)\n\tclient.SetAllowGetMethodPayload(true)\n\n\tresp, err := client.R().\n\t\tSetHeader(\"Content-Type\", \"application/json\").\n\t\tSetBody(tempReq).\n\t\tSetResult(&SpiderMyImageInfo{}). // or SetResult(AuthSuccess{}).\n\t\t//SetError(&AuthError{}). // or SetError(AuthError{}).\n\t\tGet(url)\n\n\tif err != nil {\n\t\tcommon.CBLog.Error(err)\n\t\terr := fmt.Errorf(\"an error occurred while requesting to CB-Spider\")\n\t\treturn SpiderMyImageInfo{}, err\n\t}\n\n\tfmt.Println(string(resp.Body()))\n\n\tfmt.Println(\"HTTP Status code: \" + strconv.Itoa(resp.StatusCode()))\n\tswitch {\n\tcase resp.StatusCode() >= 400 || resp.StatusCode() < 200:\n\t\terr := fmt.Errorf(string(resp.Body()))\n\t\tcommon.CBLog.Error(err)\n\t\treturn SpiderMyImageInfo{}, err\n\t}\n\n\ttemp := resp.Result().(*SpiderMyImageInfo)\n\treturn *temp, nil\n\n}", "func UserImageService(imageid string) (*domain.Image, error) {\n\timage, err := domain.UserItem(imageid)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfmt.Println(image)\n\treturn image, err\n}", "func (m *Manifest) GetReleaseImage(instanceGroupName, jobName string) (string, error) {\n\tvar instanceGroup *InstanceGroup\n\tfor i := range m.InstanceGroups {\n\t\tif m.InstanceGroups[i].Name == instanceGroupName {\n\t\t\tinstanceGroup = m.InstanceGroups[i]\n\t\t\tbreak\n\t\t}\n\t}\n\tif instanceGroup == nil {\n\t\treturn \"\", fmt.Errorf(\"instance group '%s' not found\", instanceGroupName)\n\t}\n\n\tvar stemcell *Stemcell\n\tfor i := range m.Stemcells {\n\t\tif m.Stemcells[i].Alias == instanceGroup.Stemcell {\n\t\t\tstemcell = m.Stemcells[i]\n\t\t}\n\t}\n\n\tvar job *Job\n\tfor i := range instanceGroup.Jobs {\n\t\tif instanceGroup.Jobs[i].Name == jobName {\n\t\t\tjob = &instanceGroup.Jobs[i]\n\t\t\tbreak\n\t\t}\n\t}\n\tif job == nil {\n\t\treturn \"\", fmt.Errorf(\"job '%s' not found in instance group '%s'\", jobName, instanceGroupName)\n\t}\n\n\tfor i := range m.Releases {\n\t\tif m.Releases[i].Name == job.Release {\n\t\t\trelease := m.Releases[i]\n\t\t\tname := strings.TrimRight(release.URL, \"/\")\n\n\t\t\tvar stemcellVersion string\n\n\t\t\tif release.Stemcell != nil {\n\t\t\t\tstemcellVersion = release.Stemcell.OS + \"-\" + release.Stemcell.Version\n\t\t\t} else {\n\t\t\t\tif stemcell == nil {\n\t\t\t\t\treturn \"\", fmt.Errorf(\"stemcell could not be resolved for instance group %s\", instanceGroup.Name)\n\t\t\t\t}\n\t\t\t\tstemcellVersion = stemcell.OS + \"-\" + stemcell.Version\n\t\t\t}\n\t\t\treturn fmt.Sprintf(\"%s/%s:%s-%s\", name, release.Name, stemcellVersion, release.Version), nil\n\t\t}\n\t}\n\treturn \"\", fmt.Errorf(\"release '%s' not found\", job.Release)\n}", "func (o FioSpecVolumeVolumeSourceRbdPtrOutput) Image() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *FioSpecVolumeVolumeSourceRbd) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Image\n\t}).(pulumi.StringPtrOutput)\n}", "func (a ArtifactSpec_Name) Family() ArtifactSpec_Name {\n\tif a.ArtifactType() == ArtifactSpec_STONE_INGREDIENT {\n\t\treturn a.CorrespondingStone()\n\t}\n\treturn a\n}", "func (c *Client) GetCustomImage(args *GetFlavorImageArgs) (*GetImagesResult, error) {\n\tjsonBytes, jsonErr := json.Marshal(args)\n\tif jsonErr != nil {\n\t\treturn nil, jsonErr\n\t}\n\tbody, err := bce.NewBodyFromBytes(jsonBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn GetCustomImage(c, body)\n}", "func (i *ImagesModel) GetImage(id string) (*images.SoftwareImage, error) {\n\n\timage, err := i.imagesStorage.FindByID(id)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Searching for image with specified ID\")\n\t}\n\n\tif image == nil {\n\t\treturn nil, nil\n\t}\n\n\treturn image, nil\n}", "func (s *TagStore) Lookup(name string) (*types.ImageInspect, error) {\n\timage, err := s.LookupImage(name)\n\tif err != nil || image == nil {\n\t\treturn nil, fmt.Errorf(\"No such image: %s\", name)\n\t}\n\n\timageInspect := &types.ImageInspect{\n\t\ttypes.ImageInspectBase{\n\t\t\tId: image.ID,\n\t\t\tParent: image.Parent,\n\t\t\tComment: image.Comment,\n\t\t\tCreated: image.Created.Format(time.RFC3339Nano),\n\t\t\tContainer: image.Container,\n\t\t\tContainerConfig: &image.ContainerConfig,\n\t\t\tDockerVersion: image.DockerVersion,\n\t\t\tAuthor: image.Author,\n\t\t\tConfig: image.Config,\n\t\t\tArchitecture: image.Architecture,\n\t\t\tOs: image.OS,\n\t\t\tSize: image.Size,\n\t\t},\n\t\ts.graph.GetParentsSize(image, 0) + image.Size,\n\t\ttypes.GraphDriverData{\n\t\t\tName: s.graph.driver.String(),\n\t\t},\n\t}\n\n\timageInspect.GraphDriver.Name = s.graph.driver.String()\n\n\tgraphDriverData, err := s.graph.driver.GetMetadata(image.ID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\timageInspect.GraphDriver.Data = graphDriverData\n\treturn imageInspect, nil\n}", "func (c *TestClient) GetMachineImage(project, name string) (*compute.MachineImage, error) {\n\tif c.GetMachineImageFn != nil {\n\t\treturn c.GetMachineImageFn(project, name)\n\t}\n\treturn c.client.GetMachineImage(project, name)\n}", "func (snake *Snake) GetImageForSize(size int) *ebiten.Image {\n\n\timage := snake.image.images[int(size)]\n\n\t//this is inefficient, but should only be called\n\t//once for non-advanced snek ( it does not change size )\n\n\tif !snake.advanced {\n\t\tfmt.Println(\"im not advanced\")\n\t\timage.Fill(color.White)\n\t}\n\n\treturn image\n\n}", "func (c *Conn) getFamily(name string) (Family, error) {\n\tb, err := netlink.MarshalAttributes([]netlink.Attribute{{\n\t\tType: unix.CTRL_ATTR_FAMILY_NAME,\n\t\tData: nlenc.Bytes(name),\n\t}})\n\tif err != nil {\n\t\treturn Family{}, err\n\t}\n\n\treq := Message{\n\t\tHeader: Header{\n\t\t\tCommand: unix.CTRL_CMD_GETFAMILY,\n\t\t\t// TODO(mdlayher): grab nlctrl version?\n\t\t\tVersion: 1,\n\t\t},\n\t\tData: b,\n\t}\n\n\tmsgs, err := c.Execute(req, unix.GENL_ID_CTRL, netlink.Request)\n\tif err != nil {\n\t\treturn Family{}, err\n\t}\n\n\t// TODO(mdlayher): consider interpreting generic netlink header values\n\n\tfamilies, err := buildFamilies(msgs)\n\tif err != nil {\n\t\treturn Family{}, err\n\t}\n\tif len(families) != 1 {\n\t\t// If this were to ever happen, netlink must be in a state where\n\t\t// its answers cannot be trusted\n\t\tpanic(fmt.Sprintf(\"netlink returned multiple families for name: %q\", name))\n\t}\n\n\treturn families[0], nil\n}", "func (f *FakeImagesClient) Get(ctx context.Context, getOpts *images.GetRequest, opts ...grpc.CallOption) (*images.GetResponse, error) {\n\tf.Lock()\n\tdefer f.Unlock()\n\tf.appendCalled(\"get\", getOpts)\n\tif err := f.getError(\"get\"); err != nil {\n\t\treturn nil, err\n\t}\n\timage, ok := f.ImageList[getOpts.Name]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"image does not exist\")\n\t}\n\treturn &images.GetResponse{\n\t\tImage: &image,\n\t}, nil\n}", "func (img *image) populateImage() (err error) {\n\tmu.Lock()\n\tdefer mu.Unlock()\n\n\t// img.Image is already initialized, so we don't have to do it again.\n\tif img.Image != nil {\n\t\treturn nil\n\t}\n\n\timg.Image, err = img.opener()\n\tif err != nil {\n\t\treturn xerrors.Errorf(\"unable to open: %w\", err)\n\t}\n\n\treturn nil\n}", "func (fb *FrameBuffer) ToImage() *ebiten.Image {\n\treturn fb.img\n}", "func (c *Client) GetImageStreamImage(imageStream *imagev1.ImageStream, imageTag string) (*imagev1.ImageStreamImage, error) {\n\timageNS := imageStream.ObjectMeta.Namespace\n\timageName := imageStream.ObjectMeta.Name\n\n\tfor _, tag := range imageStream.Status.Tags {\n\t\t// look for matching tag\n\t\tif tag.Tag == imageTag {\n\t\t\tklog.V(3).Infof(\"Found exact image tag match for %s:%s\", imageName, imageTag)\n\n\t\t\tif len(tag.Items) > 0 {\n\t\t\t\ttagDigest := tag.Items[0].Image\n\t\t\t\timageStreamImageName := fmt.Sprintf(\"%s@%s\", imageName, tagDigest)\n\n\t\t\t\t// look for imageStreamImage for given tag (reference by digest)\n\t\t\t\timageStreamImage, err := c.imageClient.ImageStreamImages(imageNS).Get(context.TODO(), imageStreamImageName, metav1.GetOptions{})\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, errors.Wrapf(err, \"unable to find ImageStreamImage with %s digest\", imageStreamImageName)\n\t\t\t\t}\n\t\t\t\treturn imageStreamImage, nil\n\t\t\t}\n\n\t\t\treturn nil, fmt.Errorf(\"unable to find tag %s for image %s\", imageTag, imageName)\n\n\t\t}\n\t}\n\n\t// return error since its an unhandled case if code reaches here\n\treturn nil, fmt.Errorf(\"unable to find tag %s for image %s\", imageTag, imageName)\n}", "func (g *GLTF) LoadImage(imgIdx int) (*image.RGBA, error) {\n\n\t// Check if provided image index is valid\n\tif imgIdx < 0 || imgIdx >= len(g.Images) {\n\t\treturn nil, fmt.Errorf(\"invalid image index\")\n\t}\n\timgData := g.Images[imgIdx]\n\t// Return cached if available\n\tif imgData.cache != nil {\n\t\tlog.Debug(\"Fetching Image %d (cached)\", imgIdx)\n\t\treturn imgData.cache, nil\n\t}\n\tlog.Debug(\"Loading Image %d\", imgIdx)\n\n\tvar data []byte\n\tvar err error\n\t// If Uri is empty, load image from GLB binary chunk\n\tif imgData.Uri == \"\" {\n\t\tif imgData.BufferView == nil {\n\t\t\treturn nil, fmt.Errorf(\"image has empty URI and no BufferView\")\n\t\t}\n\t\tdata, err = g.loadBufferView(*imgData.BufferView)\n\t} else if isDataURL(imgData.Uri) {\n\t\t// Checks if image URI is data URL\n\t\tdata, err = loadDataURL(imgData.Uri)\n\t} else {\n\t\t// Load image data from file\n\t\tdata, err = g.loadFileBytes(imgData.Uri)\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Decodes image data\n\tbb := bytes.NewBuffer(data)\n\timg, _, err := image.Decode(bb)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Converts image to RGBA format\n\trgba := image.NewRGBA(img.Bounds())\n\tif rgba.Stride != rgba.Rect.Size().X*4 {\n\t\treturn nil, fmt.Errorf(\"unsupported stride\")\n\t}\n\tdraw.Draw(rgba, rgba.Bounds(), img, image.Point{0, 0}, draw.Src)\n\n\t// Cache image\n\tg.Images[imgIdx].cache = rgba\n\n\treturn rgba, nil\n}", "func (i *Image) UnderlyingImage() v1.Image {\n\treturn i.image\n}", "func getOrCreateImage() []byte {\n\tsett := settings\n\tsett.makeCachePath()\n\n\tvar c *cache.Cache\n\tvar image []byte\n\tvar err error\n\n\tif image, err = c.Get(sett.Context.CachePath); err == nil {\n\t\treturn image\n\t}\n\n\tswitch sett.Context.Storage {\n\tcase \"loc\":\n\t\timage, err = getLocalImage(&sett)\n\t\tif err != nil {\n\t\t\tlog.Println(\"Can't get orig local file, reason - \", err)\n\t\t}\n\n\tcase \"rem\":\n\t\timgUrl := fmt.Sprintf(\"%s://%s\", sett.Scheme, sett.Context.Path)\n\t\timage, err = getRemoteImage(imgUrl)\n\t\tif err != nil {\n\t\t\tlog.Println(\"Can't get orig remote file, reason - \", err)\n\t\t}\n\t}\n\n\tif !stringIsExists(sett.Context.Format, supportedFormats) {\n\t\terr = c.Set(sett.Context.CachePath, image)\n\t\tif err != nil {\n\t\t\tlog.Println(\"Can't set cache, reason - \", err)\n\t\t}\n\t\treturn image\n\t}\n\n\tbuf, err := vips.Resize(image, sett.Options)\n\tif err != nil {\n\t\tlog.Println(\"Can't resize image, reason - \", err)\n\t}\n\n\terr = c.Set(sett.Context.CachePath, buf)\n\tif err != nil {\n\t\tlog.Println(\"Can't set cache, reason - \", err)\n\t}\n\n\treturn buf\n}", "func (td *OsmTestData) LoadImagesToKind(imageNames []string) error {\n\tif td.InstType != KindCluster {\n\t\ttd.T.Log(\"Not a Kind cluster, nothing to load\")\n\t\treturn nil\n\t}\n\n\ttd.T.Log(\"Getting image data\")\n\tdocker, err := client.NewClientWithOpts(client.WithAPIVersionNegotiation())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create docker client\")\n\t}\n\tvar imageIDs []string\n\tfor _, name := range imageNames {\n\t\timageName := fmt.Sprintf(\"%s/%s:%s\", td.CtrRegistryServer, name, td.OsmImageTag)\n\t\timageIDs = append(imageIDs, imageName)\n\t}\n\timageData, err := docker.ImageSave(context.TODO(), imageIDs)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get image data\")\n\t}\n\n\timageReader, err := io.ReadAll(imageData)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to read images\")\n\t}\n\n\treader := bytes.NewReader(imageReader)\n\t//nolint: errcheck\n\t//#nosec G307\n\tdefer imageData.Close()\n\tnodes, err := td.ClusterProvider.ListNodes(td.ClusterName)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to list kind nodes\")\n\t}\n\n\tfor _, n := range nodes {\n\t\ttd.T.Log(\"Loading images onto node\", n)\n\t\tif _, err := reader.Seek(0, io.SeekStart); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to reset images\")\n\t\t}\n\t\tif err = nodeutils.LoadImageArchive(n, reader); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to load images\")\n\t\t}\n\t}\n\n\treturn nil\n}", "func (f *fetcher) fetchSingleImage(img string, asc string, discover bool) (string, error) {\n\tvar (\n\t\tascFile *os.File\n\t\terr error\n\t\tlatest bool\n\t)\n\tif asc != \"\" && f.ks != nil {\n\t\tascFile, err = os.Open(asc)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"unable to open signature file: %v\", err)\n\t\t}\n\t\tdefer ascFile.Close()\n\t}\n\n\tu, err := url.Parse(img)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"not a valid image reference (%s)\", img)\n\t}\n\n\t// if img refers to a local file, ensure the scheme is file:// and make the url path absolute\n\t_, err = os.Stat(u.Path)\n\tif err == nil {\n\t\tu.Path, err = filepath.Abs(u.Path)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"unable to get abs path: %v\", err)\n\t\t}\n\t\tu.Scheme = \"file\"\n\t} else if !os.IsNotExist(err) {\n\t\treturn \"\", fmt.Errorf(\"unable to access %q: %v\", img, err)\n\t}\n\n\tif discover && u.Scheme == \"\" {\n\t\tif app := newDiscoveryApp(img); app != nil {\n\t\t\tvar discoveryError error\n\t\t\tif !f.local {\n\t\t\t\tstderr(\"rkt: searching for app image %s\", img)\n\t\t\t\tep, err := discoverApp(app, true)\n\t\t\t\tif err != nil {\n\t\t\t\t\tdiscoveryError = err\n\t\t\t\t} else {\n\t\t\t\t\t// No specified version label, mark it as latest\n\t\t\t\t\tif _, ok := app.Labels[\"version\"]; !ok {\n\t\t\t\t\t\tlatest = true\n\t\t\t\t\t}\n\t\t\t\t\treturn f.fetchImageFromEndpoints(app.Name.String(), ep, ascFile, latest)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif discoveryError != nil {\n\t\t\t\tstderr(\"discovery failed for %q: %v. Trying to find image in the store.\", img, discoveryError)\n\t\t\t}\n\t\t\tif f.local || discoveryError != nil {\n\t\t\t\treturn f.fetchImageFromStore(img)\n\t\t\t}\n\t\t}\n\t}\n\n\tswitch u.Scheme {\n\tcase \"http\", \"https\", \"file\":\n\tcase \"docker\":\n\t\tdockerURL := common.ParseDockerURL(path.Join(u.Host, u.Path))\n\t\tif dockerURL.Tag == \"latest\" {\n\t\t\tlatest = true\n\t\t}\n\tdefault:\n\t\treturn \"\", fmt.Errorf(\"rkt only supports http, https, docker or file URLs (%s)\", img)\n\t}\n\treturn f.fetchImageFromURL(u.String(), u.Scheme, ascFile, latest)\n}", "func (e *Education) GetImages(ctx context.Context, entities Educations) {\n\t// Get a map of all img keys in my educations\n\timgs := make(map[int64]*datastore.Key)\n\n\tfor _, v := range entities {\n\t\tif _, ok := imgs[v.ImageKey.IntID()]; !ok {\n\t\t\timgs[v.ImageKey.IntID()] = v.ImageKey\n\t\t}\n\t}\n\n\t// Get all Images\n\torderedImgs := GetOrderedImgs(ctx, imgs)\n\n\t// Set Image to each edu\n\tfor i := 0; i < len(entities); i++ {\n\t\tentities[i].Image = orderedImgs[entities[i].ImageKey.IntID()]\n\t}\n}", "func (i *ImageStore) getImageHash(\n\tctx context.Context, from types.ImageReference, sysctx *types.SystemContext,\n) (types.ImageReference, error) {\n\timg, err := from.NewImage(ctx, sysctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to create image closer: %w\", err)\n\t}\n\tdefer img.Close()\n\n\tmanifestBlob, _, err := img.Manifest(ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to fetch image manifest: %w\", err)\n\t}\n\n\tdgst, err := manifest.Digest(manifestBlob)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error calculating manifest digest: %w\", err)\n\t}\n\n\trefstr := fmt.Sprintf(\"docker://%s@%s\", from.DockerReference().Name(), dgst)\n\thashref, err := alltransports.ParseImageName(refstr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn hashref, nil\n}", "func (f *familyAndMetrics) copyFamily() dto.MetricFamily {\n\treturn *f.family\n}", "func (f *finder) findImage(img string, asc string, discover bool) (*types.Hash, error) {\n\t// check if it is a valid hash, if so let it pass through\n\th, err := types.NewHash(img)\n\tif err == nil {\n\t\tfullKey, err := f.s.ResolveKey(img)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"could not resolve key: %v\", err)\n\t\t}\n\t\th, err = types.NewHash(fullKey)\n\t\tif err != nil {\n\t\t\t// should never happen\n\t\t\tpanic(err)\n\t\t}\n\t\treturn h, nil\n\t}\n\n\t// try fetching the image, potentially remotely\n\tft := &fetcher{\n\t\timageActionData: f.imageActionData,\n\t\tlocal: f.local,\n\t\twithDeps: f.withDeps,\n\t}\n\tkey, err := ft.fetchImage(img, asc, discover)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\th, err = types.NewHash(key)\n\tif err != nil {\n\t\t// should never happen\n\t\tpanic(err)\n\t}\n\n\treturn h, nil\n}", "func GetImage(id uint, db *gorm.DB) *Image {\n\timage := new(Image)\n\tdb.Find(image, id)\n\tif image.ID == id {\n\t\treturn image\n\t}\n\treturn nil\n}", "func (rs *ResourceLoader) LoadImageWithPalette(pth string, paletteNr int) (image.Image, error) {\n\n\tmeta, ok := Images[pth]\n\tif !ok {\n\t\treturn nil, ErrImageNotFound\n\t}\n\n\timgPath := path.Join(rs.rootPath, pth)\n\ttabPath := path.Join(rs.rootPath, meta.TabFile)\n\tpalette := rs.palettes[paletteNr]\n\n\text := path.Ext(pth)\n\tswitch ext {\n\tcase \".PCK\":\n\n\t\tif meta.TabFile != \"\" {\n\t\t\ttabs, err := LoadTAB(tabPath, meta.TabOffset)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tif len(tabs) == 0 {\n\t\t\t\treturn nil, ErrNotEnoughTabs\n\t\t\t}\n\n\t\t\tcollection, err := LoadImageCollectionFromPCK(imgPath, meta.Width, tabs)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\treturn collection.Gallery(10, meta.Height, palette)\n\t\t}\n\n\t\timg, err := LoadPCK(imgPath, meta.Width, 0)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn img.Image(palette), nil\n\n\tcase \".SPK\":\n\n\t\timg, err := LoadSPK(imgPath)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn img.Image(palette), nil\n\n\tcase \".SCR\":\n\n\t\timg, err := LoadSCR(imgPath, meta.Width)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn img.Image(palette), nil\n\n\t}\n\n\t// unsupported file extension!\n\treturn nil, ErrNotImplemented\n}", "func (o IopingSpecOutput) Image() IopingSpecImageOutput {\n\treturn o.ApplyT(func(v IopingSpec) IopingSpecImage { return v.Image }).(IopingSpecImageOutput)\n}" ]
[ "0.67531455", "0.66682357", "0.6485441", "0.63729674", "0.6130022", "0.58885306", "0.5828167", "0.5703538", "0.56975114", "0.56506765", "0.5626419", "0.5596774", "0.5537735", "0.5449357", "0.5420624", "0.5418655", "0.53192335", "0.520438", "0.5201472", "0.51859754", "0.5176008", "0.51604766", "0.5157328", "0.51546335", "0.51326454", "0.5093664", "0.5069962", "0.5068854", "0.5063238", "0.5047139", "0.50385904", "0.503365", "0.5030696", "0.5010592", "0.49971706", "0.49908027", "0.49835512", "0.49649704", "0.49426916", "0.49332666", "0.49179447", "0.4915654", "0.49099538", "0.49097377", "0.4906706", "0.49064195", "0.4906233", "0.4897668", "0.48813778", "0.4863718", "0.48527485", "0.4851077", "0.48215327", "0.4813267", "0.48049653", "0.48032105", "0.4792043", "0.47848892", "0.47836804", "0.4775991", "0.47757503", "0.47735196", "0.47537464", "0.47426015", "0.4734915", "0.4733744", "0.47308218", "0.47169968", "0.4711036", "0.4697627", "0.46919554", "0.46842548", "0.46797344", "0.46784005", "0.46764567", "0.46572018", "0.46515417", "0.46488383", "0.46426964", "0.46426746", "0.46416822", "0.46309912", "0.46264306", "0.4623527", "0.4619886", "0.46044612", "0.46040908", "0.45934772", "0.4593074", "0.45910066", "0.45894483", "0.45844567", "0.458174", "0.4580844", "0.45790684", "0.45718443", "0.4570947", "0.45683253", "0.45676702", "0.45675454" ]
0.77261657
0
ListImages uses the override method ListImagesFn or the real implementation.
func (c *TestClient) ListImages(project string, opts ...ListCallOption) ([]*compute.Image, error) { if c.ListImagesFn != nil { return c.ListImagesFn(project, opts...) } return c.client.ListImages(project, opts...) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s *API) ListImages(req *ListImagesRequest, opts ...scw.RequestOption) (*ListImagesResponse, 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\tdefaultPageSize, exist := s.client.GetDefaultPageSize()\n\tif (req.PageSize == nil || *req.PageSize == 0) && exist {\n\t\treq.PageSize = &defaultPageSize\n\t}\n\n\tquery := url.Values{}\n\tparameter.AddToQuery(query, \"page\", req.Page)\n\tparameter.AddToQuery(query, \"page_size\", req.PageSize)\n\tparameter.AddToQuery(query, \"order_by\", req.OrderBy)\n\tparameter.AddToQuery(query, \"namespace_id\", req.NamespaceID)\n\tparameter.AddToQuery(query, \"name\", req.Name)\n\tparameter.AddToQuery(query, \"organization_id\", req.OrganizationID)\n\tparameter.AddToQuery(query, \"project_id\", req.ProjectID)\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: \"GET\",\n\t\tPath: \"/registry/v1/regions/\" + fmt.Sprint(req.Region) + \"/images\",\n\t\tQuery: query,\n\t\tHeaders: http.Header{},\n\t}\n\n\tvar resp ListImagesResponse\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 (i *LibpodAPI) ListImages(call ioprojectatomicpodman.VarlinkCall) error {\n\truntime, err := libpodruntime.GetRuntime(i.Cli)\n\tif err != nil {\n\t\treturn call.ReplyRuntimeError(err.Error())\n\t}\n\timages, err := runtime.ImageRuntime().GetImages()\n\tif err != nil {\n\t\treturn call.ReplyErrorOccurred(fmt.Sprintf(\"unable to get list of images %q\", err))\n\t}\n\tvar imageList []ioprojectatomicpodman.ImageInList\n\tfor _, image := range images {\n\t\t//size, _:= image.Size(getContext())\n\t\tlabels, _ := image.Labels(getContext())\n\t\tcontainers, _ := image.Containers()\n\n\t\ti := ioprojectatomicpodman.ImageInList{\n\t\t\tId: image.ID(),\n\t\t\tParentId: image.Parent,\n\t\t\tRepoTags: image.Names(),\n\t\t\tRepoDigests: image.RepoDigests(),\n\t\t\tCreated: image.Created().String(),\n\t\t\t//Size: size,\n\t\t\tVirtualSize: image.VirtualSize,\n\t\t\tContainers: int64(len(containers)),\n\t\t\tLabels: labels,\n\t\t}\n\t\timageList = append(imageList, i)\n\t}\n\treturn call.ReplyListImages(imageList)\n}", "func (s stack) ListImages(ctx context.Context, _ bool) (out []*abstract.Image, ferr fail.Error) {\n\tif valid.IsNil(s) {\n\t\treturn nil, fail.InvalidInstanceError()\n\t}\n\n\t// FIXME: It has to be remade from scratch...\n\n\tvar images []*abstract.Image\n\t// FIXME: Don't even add CentOS, our image selection algorithm is not able to select the right one, it has to be remade from scratch because it assumes that the the length of the full ID of an images is the same for all images, which is false for Azure; as a consequence, looking for \"ubuntu\" will return maybe a Centos, maybe something else...\n\t/*\n\t\timages = append(images, &abstract.Image{\n\t\t\tID: strings.Join([]string{\"OpenLogic\", \"CentOS\", \"8_5-gen2\"}, \":\"),\n\t\t\tName: strings.Join([]string{\"OpenLogic\", \"CentOS\", \"8_5-gen2\"}, \":\"),\n\t\t\tURL: \"\",\n\t\t\tDescription: \"\",\n\t\t\tStorageType: \"\",\n\t\t\tDiskSize: 0,\n\t\t\tPublisher: \"cognosys\",\n\t\t\tOffer: \"centos-8-latest\",\n\t\t\tSku: \"centos-8-latest\",\n\t\t})\n\t*/\n\timages = append(images, &abstract.Image{\n\t\tID: strings.Join([]string{\"Canonical\", \"UbuntuServer\", \"18.04-LTS\"}, \":\"),\n\t\tName: strings.Join([]string{\"Canonical\", \"UbuntuServer\", \"18.04-LTS\"}, \":\"),\n\t\tURL: \"\",\n\t\tDescription: \"\",\n\t\tStorageType: \"\",\n\t\tDiskSize: 30,\n\t\tPublisher: \"Canonical\",\n\t\tOffer: \"UbuntuServer\",\n\t\tSku: \"18.04-LTS\",\n\t})\n\timages = append(images, &abstract.Image{\n\t\tID: strings.Join([]string{\"Canonical\", \"0001-com-ubuntu-minimal-focal\", \"minimal-20_04-lts\"}, \":\"),\n\t\tName: strings.Join([]string{\"Canonical\", \"0001-com-ubuntu-minimal-focal\", \"minimal-20_04-lts\"}, \":\"),\n\t\tURL: \"\",\n\t\tDescription: \"\",\n\t\tStorageType: \"\",\n\t\tDiskSize: 30,\n\t\tPublisher: \"Canonical\",\n\t\tOffer: \"0001-com-ubuntu-minimal-focal\",\n\t\tSku: \"minimal-20_04-lts\",\n\t})\n\timages = append(images, &abstract.Image{\n\t\tID: strings.Join([]string{\"Canonical\", \"0001-com-ubuntu-server-jammy\", \"22_04-lts-gen2\"}, \":\"),\n\t\tName: strings.Join([]string{\"Canonical\", \"0001-com-ubuntu-server-jammy\", \"22_04-lts-gen2\"}, \":\"),\n\t\tURL: \"\",\n\t\tDescription: \"\",\n\t\tStorageType: \"\",\n\t\tDiskSize: 30,\n\t\tPublisher: \"Canonical\",\n\t\tOffer: \"0001-com-ubuntu-server-jammy\",\n\t\tSku: \"22_04-lts-gen2\",\n\t})\n\n\treturn images, nil\n}", "func (this *DoClient) ListImages() (interface{}, error) {\n\treturn this.client.ListImages()\n}", "func (s *VarlinkInterface) ListImages(ctx context.Context, c VarlinkCall) error {\n\treturn c.ReplyMethodNotImplemented(ctx, \"io.podman.ListImages\")\n}", "func ListImages(rs io.ReadSeeker, selectedPages []string, conf *model.Configuration) ([]string, error) {\n\tif rs == nil {\n\t\treturn nil, errors.New(\"pdfcpu: ListImages: Please provide rs\")\n\t}\n\tif conf == nil {\n\t\tconf = model.NewDefaultConfiguration()\n\t\tconf.Cmd = model.LISTIMAGES\n\t}\n\tctx, _, _, _, err := readValidateAndOptimize(rs, conf, time.Now())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err := ctx.EnsurePageCount(); err != nil {\n\t\treturn nil, err\n\t}\n\tpages, err := PagesForPageSelection(ctx.PageCount, selectedPages, true)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn pdfcpu.ListImages(ctx, pages)\n}", "func (cli *Client) ImageList(ctx context.Context, options types.ImageListOptions) ([]types.Image, error) {\n\tvar images []types.Image\n\tquery := url.Values{}\n\n\tif options.Filters.Len() > 0 {\n\t\tfilterJSON, err := filters.ToParam(options.Filters)\n\t\tif err != nil {\n\t\t\treturn images, err\n\t\t}\n\t\tquery.Set(\"filters\", filterJSON)\n\t}\n\tif options.MatchName != \"\" {\n\t\t// FIXME rename this parameter, to not be confused with the filters flag\n\t\tquery.Set(\"filter\", options.MatchName)\n\t}\n\tif options.All {\n\t\tquery.Set(\"all\", \"1\")\n\t}\n\n\tserverResp, err := cli.get(ctx, \"/images/json\", query, nil)\n\tif err != nil {\n\t\treturn images, err\n\t}\n\n\terr = json.NewDecoder(serverResp.body).Decode(&images)\n\tensureReaderClosed(serverResp)\n\treturn images, err\n}", "func (s *FileStore) ListImages(filter string) ([]*Image, error) {\n\ts.Lock()\n\tdefer s.Unlock()\n\treturn s.listImagesUnlocked(filter)\n}", "func (a *ImagesApiService) ListImages(ctx context.Context) ApiListImagesRequest {\n\treturn ApiListImagesRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "func (f *FakeImagesClient) List(ctx context.Context, listOpts *images.ListRequest, opts ...grpc.CallOption) (*images.ListResponse, error) {\n\tf.Lock()\n\tdefer f.Unlock()\n\tf.appendCalled(\"list\", listOpts)\n\tif err := f.getError(\"list\"); err != nil {\n\t\treturn nil, err\n\t}\n\tresp := &images.ListResponse{}\n\tfor _, image := range f.ImageList {\n\t\tresp.Images = append(resp.Images, image)\n\t}\n\treturn resp, nil\n}", "func (c Client) ListImages() ([]models.Image, error) {\n\tvar images []models.Image\n\tresp, err := c.get(\"/images\")\n\tif err != nil {\n\t\treturn images, err\n\t}\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn images, parseError(resp.Body)\n\t}\n\n\tmaybeImages, err := jsonapi.UnmarshalManyPayload(resp.Body, reflect.TypeOf(images))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Convert from []interface{} to []Image\n\timages = make([]models.Image, 0)\n\tfor _, image := range maybeImages {\n\t\ti := image.(*models.Image)\n\t\timages = append(images, *i)\n\t}\n\n\treturn images, nil\n}", "func (c *ECRClientImpl) ListImages(repositoryName *string, registryID *string) ([]*ecr.ImageDetail, error) {\n\timages := []*ecr.ImageDetail{}\n\n\tif repositoryName == nil {\n\t\treturn images, nil\n\t}\n\n\t// If the user has specified a registryID (account ID), then use it here. If not\n\t// then don't set it so that the default will be assumed.\n\tinput := &ecr.DescribeImagesInput{}\n\tif registryID == nil {\n\t\tinput = &ecr.DescribeImagesInput{\n\t\t\tRepositoryName: repositoryName,\n\t\t}\n\t} else {\n\t\tinput = &ecr.DescribeImagesInput{\n\t\t\tRepositoryName: repositoryName,\n\t\t\tRegistryId: registryID,\n\t\t}\n\t}\n\n\tcallback := func(page *ecr.DescribeImagesOutput, lastPage bool) bool {\n\t\timages = append(images, page.ImageDetails...)\n\t\treturn !lastPage\n\t}\n\n\terr := c.ECRClient.DescribeImagesPages(input, callback)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn images, nil\n}", "func (c *criContainerdService) ListImages(ctx context.Context, r *runtime.ListImagesRequest) (*runtime.ListImagesResponse, error) {\n\timageMetadataA, err := c.imageMetadataStore.List()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to list image metadata from store %v\", err)\n\t}\n\t// TODO(mikebrow): Get the id->tags, and id->digest mapping from our checkpoint;\n\t// Get other information from containerd image/content store\n\n\tvar images []*runtime.Image\n\tfor _, image := range imageMetadataA { // TODO(mikebrow): write a ImageMetadata to runtime.Image converter\n\t\tri := &runtime.Image{\n\t\t\tId: image.ID,\n\t\t\tRepoTags: image.RepoTags,\n\t\t\tRepoDigests: image.RepoDigests,\n\t\t\tSize_: image.Size,\n\t\t\t// TODO(mikebrow): Uid and Username?\n\t\t}\n\t\timages = append(images, ri)\n\t}\n\n\treturn &runtime.ListImagesResponse{Images: images}, nil\n}", "func (cli *DockerCli) ListImages(context context.Context) ([]types.ImageSummary, error) {\n\n\timages, err := cli.client.ImageList(context, types.ImageListOptions{})\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\treturn images, nil\n}", "func (c *ImageController) List(ctx *app.ListImageContext) error {\n\t// ImageController_List: start_implement\n\n\t// Put your logic here\n\n\t// ImageController_List: end_implement\n\tres := app.ImageCollection{}\n\treturn ctx.OK(res)\n}", "func List(ctx context.Context, dbConn *db.DB, queryParams url.Values) ([]Image, error) {\n\tsqlQuery := \"SELECT * from images\"\n\tif len(queryParams) > 0 {\n\t\twhere, err := dbConn.BuildWhere(queryParams)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"List\")\n\t\t}\n\t\tsqlQuery += where\n\t}\n\n\timages := make([]Image, 0)\n\trows, err := dbConn.PSQLQuerier(ctx, sqlQuery)\n\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"List\")\n\t}\n\tfor rows.Next() {\n\t\tdata := Image{}\n\t\terr := rows.StructScan(&data)\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\timages = append(images, data)\n\t}\n\treturn images, nil\n}", "func (client *Client) ListImages(all bool) ([]model.Image, error) {\n\timages, err := client.feclt.ListImages(true)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif all {\n\t\treturn images, nil\n\t}\n\n\timageFilter := imgfilters.NewFilter(isLatestImage).And(imgfilters.NewFilter(isWindowsImage).Not()).And(imgfilters.NewFilter(isSpecializedImage).Not())\n\treturn imgfilters.FilterImages(images, imageFilter), nil\n}", "func ListImages() Collection {\n\tpath := image_col_path()\n\treturn is_list(path)\n}", "func ListImages(client *httputil.ClientConn) ([]string, error) {\n\tbody, err := utils.Do(client, \"GET\", \"/1.0/images\", nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to list images: %v\", err)\n\t}\n\tvar res utils.ListContainerResponse\n\tif err := json.Unmarshal(body, &res); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to unmarshal ListImages: %v\", err)\n\t}\n\treturn res.Metadata, nil\n}", "func ImageList(images ...imageapi.Image) imageapi.ImageList {\n\treturn imageapi.ImageList{\n\t\tItems: images,\n\t}\n}", "func (p *AWS) ListImages(ctx *lepton.Context) error {\n\tcimages, err := p.GetImages(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttable := tablewriter.NewWriter(os.Stdout)\n\ttable.SetHeader([]string{\"Name\", \"Id\", \"Status\", \"Created\"})\n\ttable.SetHeaderColor(\n\t\ttablewriter.Colors{tablewriter.Bold, tablewriter.FgCyanColor},\n\t\ttablewriter.Colors{tablewriter.Bold, tablewriter.FgCyanColor},\n\t\ttablewriter.Colors{tablewriter.Bold, tablewriter.FgCyanColor},\n\t\ttablewriter.Colors{tablewriter.Bold, tablewriter.FgCyanColor})\n\ttable.SetRowLine(true)\n\n\tfor _, image := range cimages {\n\t\tvar row []string\n\n\t\trow = append(row, image.Name)\n\t\trow = append(row, image.ID)\n\t\trow = append(row, image.Status)\n\t\trow = append(row, lepton.Time2Human(image.Created))\n\n\t\ttable.Append(row)\n\t}\n\n\ttable.Render()\n\n\treturn nil\n}", "func (c *Client) ListImage(args *ListImageArgs) (*ListImageResult, error) {\n\treturn ListImage(c, args)\n}", "func List(ctx context.Context, options *ListOptions) ([]*entities.ImageSummary, error) {\n\tif options == nil {\n\t\toptions = new(ListOptions)\n\t}\n\tvar imageSummary []*entities.ImageSummary\n\tconn, err := bindings.GetClient(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tparams, err := options.ToParams()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresponse, err := conn.DoRequest(ctx, nil, http.MethodGet, \"/images/json\", params, nil)\n\tif err != nil {\n\t\treturn imageSummary, err\n\t}\n\tdefer response.Body.Close()\n\n\treturn imageSummary, response.Process(&imageSummary)\n}", "func (v *IBM) ListImages(ctx *lepton.Context) error {\n\timages, err := v.GetImages(ctx)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\ttable := tablewriter.NewWriter(os.Stdout)\n\ttable.SetHeader([]string{\"ID\", \"Name\", \"Date created\", \"Size\", \"Status\"})\n\ttable.SetHeaderColor(\n\t\ttablewriter.Colors{tablewriter.Bold, tablewriter.FgCyanColor},\n\t\ttablewriter.Colors{tablewriter.Bold, tablewriter.FgCyanColor},\n\t\ttablewriter.Colors{tablewriter.Bold, tablewriter.FgCyanColor},\n\t\ttablewriter.Colors{tablewriter.Bold, tablewriter.FgCyanColor},\n\t\ttablewriter.Colors{tablewriter.Bold, tablewriter.FgCyanColor})\n\ttable.SetRowLine(true)\n\n\tfor _, image := range images {\n\t\tvar row []string\n\t\trow = append(row, image.ID)\n\t\trow = append(row, image.Name)\n\t\trow = append(row, \"\")\n\t\trow = append(row, humanize.Bytes(uint64(image.Size)))\n\t\trow = append(row, image.Status)\n\t\ttable.Append(row)\n\t}\n\n\ttable.Render()\n\n\treturn nil\n}", "func (d *Docker) ListImages() []types.ImageSummary {\n\timages, err := d.client.ImageList(context.Background(), types.ImageListOptions{All: true})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfor _, image := range images {\n\t\tfmt.Printf(\"Containers: %d, Created: %d, ID: %s, ParentID: %s, Size: %d, RepoTags: %s\\n\", image.Containers, image.Created, image.ID[:10], image.ParentID, image.Size, image.RepoTags)\n\t}\n\treturn images\n}", "func ImageList() error {\n\timagesDir, err := getImagesDir()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdir, err := os.Open(imagesDir)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer dir.Close()\n\n\tnames, err := dir.Readdirnames(0)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, name := range names {\n\t\tif strings.HasSuffix(name, \".qcow2\") {\n\t\t\tfmt.Println(strings.TrimSuffix(name, \".qcow2\"))\n\t\t}\n\t}\n\n\treturn nil\n}", "func (jb *JobBoard) ListImages(ctx context.Context) ([]JobBoardImage, error) {\n\treq, err := jb.newRequest(\"GET\", \"/images?infra=jupiterbrain\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp, err := jb.client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar imageList imageListPayload\n\tif err = json.Unmarshal(body, &imageList); err != nil {\n\t\treturn nil, err\n\t}\n\n\timages := make([]JobBoardImage, len(imageList.Data))\n\tfor i, payload := range imageList.Data {\n\t\timages[i] = JobBoardImage{\n\t\t\tID: payload.ID,\n\t\t\tTag: payload.Tags[\"osx_image\"],\n\t\t\tName: payload.Name,\n\t\t}\n\t}\n\n\treturn images, nil\n}", "func (i *ImagesModel) ListImages(filters map[string]string) ([]*images.SoftwareImage, error) {\n\n\timageList, err := i.imagesStorage.FindAll()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Searching for image metadata\")\n\t}\n\n\tif imageList == nil {\n\t\treturn make([]*images.SoftwareImage, 0), nil\n\t}\n\n\treturn imageList, nil\n}", "func (r *Registry) ListImages(\n\trepoName string,\n\trepo repository.Repository,\n\tdoAuth *oauth2.Config, // only required if using DOCR\n) ([]*Image, error) {\n\t// switch on the auth mechanism to get a token\n\tif r.AWSIntegrationID != 0 {\n\t\treturn r.listECRImages(repoName, repo)\n\t}\n\n\tif r.GCPIntegrationID != 0 {\n\t\treturn r.listGCRImages(repoName, repo)\n\t}\n\n\tif r.DOIntegrationID != 0 {\n\t\treturn r.listDOCRImages(repoName, repo, doAuth)\n\t}\n\n\tif r.BasicIntegrationID != 0 {\n\t\treturn r.listPrivateRegistryImages(repoName, repo)\n\t}\n\n\treturn nil, fmt.Errorf(\"error listing images\")\n}", "func (c *Client) ImageList(imgID *int, pendingOnly *bool) ([]Image, error) {\n\targs := make(map[string]interface{})\n\targs[\"ImageID\"] = imgID\n\n\t// special handle weird bool arg for this method\n\tif pendingOnly != nil {\n\t\tif *pendingOnly == true {\n\t\t\targs[\"pendingOnly\"] = 1\n\t\t} else {\n\t\t\targs[\"pendingOnly\"] = 0\n\t\t}\n\t}\n\n\tdata, err := c.apiCall(\"image.list\", args)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar imgs []Image\n\terr = unmarshalMultiMap(data, &imgs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn imgs, nil\n}", "func (client *Client) ListImages(all bool) ([]model.Image, error) {\n\treturn client.osclt.ListImages(all)\n}", "func GetImageLists(c echo.Context) error {\n\treturn c.JSON(http.StatusOK, model.GetFilePaths())\n}", "func (m *Manager) ListImages() map[string]*schema.ImageManifest {\n\tm.imagesLock.RLock()\n\tdefer m.imagesLock.RUnlock()\n\treturn m.images\n}", "func imageListWrapper(\n\tc *client.Client,\n\tctx context.Context,\n\toptions types.ImageListOptions,\n) ([]types.ImageSummary, error) {\n\tif c != nil {\n\t\treturn c.ImageList(ctx, options)\n\t}\n\tfc := FakeDockerClient{}\n\treturn fc.ImageList(ctx, options)\n}", "func ListImages(ctx *model.Context, selectedPages types.IntSet) ([]string, error) {\n\n\tmm, maxLen, err := Images(ctx, selectedPages)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tss, j, size, err := listImages(ctx, mm, maxLen)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn append([]string{fmt.Sprintf(\"%d images available(%s)\", j, types.ByteSize(size))}, ss...), nil\n}", "func ListImage(cli bce.Client, queryArgs *ListImageArgs) (*ListImageResult, error) {\n\t// Build the request\n\treq := &bce.BceRequest{}\n\treq.SetUri(getImageUri())\n\treq.SetMethod(http.GET)\n\n\tif queryArgs != nil {\n\t\tif len(queryArgs.Marker) != 0 {\n\t\t\treq.SetParam(\"marker\", queryArgs.Marker)\n\t\t}\n\t\tif queryArgs.MaxKeys != 0 {\n\t\t\treq.SetParam(\"maxKeys\", strconv.Itoa(queryArgs.MaxKeys))\n\t\t}\n\t\tif len(queryArgs.ImageName) != 0 {\n\t\t\tif len(queryArgs.ImageType) != 0 && strings.EqualFold(\"custom\", queryArgs.ImageType) {\n\t\t\t\treq.SetParam(\"imageName\", queryArgs.ImageName)\n\t\t\t} else {\n\t\t\t\treturn nil, errors.New(\"only the custom image type could filter by name\")\n\t\t\t}\n\t\t}\n\t\tif len(queryArgs.ImageType) != 0 {\n\t\t\treq.SetParam(\"imageType\", queryArgs.ImageType)\n\t\t}\n\t}\n\n\tif queryArgs == nil || queryArgs.MaxKeys == 0 {\n\t\treq.SetParam(\"maxKeys\", \"1000\")\n\t}\n\n\t// Send request and get response\n\tresp := &bce.BceResponse{}\n\tif err := cli.SendRequest(req, resp); err != nil {\n\t\treturn nil, err\n\t}\n\tif resp.IsFail() {\n\t\treturn nil, resp.ServiceError()\n\t}\n\n\tjsonBody := &ListImageResult{}\n\tif err := resp.ParseJsonBody(jsonBody); err != nil {\n\t\treturn nil, err\n\t}\n\treturn jsonBody, nil\n}", "func (c *ComicFile) ListImages() ([]string, error) {\n\tvar filenames []string\n\terr := c.archiver.Walk(c.filepath, func(f archiver.File) error {\n\t\tif isImageFile(f) {\n\t\t\tfilenames = append(filenames, f.Name())\n\t\t}\n\t\treturn nil\n\t})\n\n\tsort.Sort(utils.Natural(filenames))\n\n\treturn filenames, err\n}", "func (i *ImagesClient) List(planID int) ([]Images, *Response, error) {\n\t//root := new(teamRoot)\n\n\tplanIDString := strconv.Itoa(planID)\n\n\tplansPath := strings.Join([]string{baseImagePath, planIDString, endImagePath}, \"/\")\n\n\tvar trans []Images\n\n\tresp, err := i.client.MakeRequest(\"GET\", plansPath, nil, &trans)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Error: %v\", err)\n\t}\n\n\treturn trans, resp, err\n}", "func listMyImages(w http.ResponseWriter, r *http.Request, parms martini.Params) {\r\n\tuid, _ := strconv.ParseInt(parms[\"id\"], 10, 64)\r\n\tvar i CRImage\r\n\tlogger.Println(uid)\r\n\timage := i.QuerybyUser(uid)\r\n\tlogger.Println(image)\r\n\tif err := json.NewEncoder(w).Encode(image); err != nil {\r\n\t\tlogger.Error(err)\r\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\r\n\t}\r\n}", "func RunImagesListApplication(ns string, config doit.Config, out io.Writer, args []string) error {\n\tclient := config.GetGodoClient()\n\treturn listImages(ns, config, out, client.Images.ListApplication)\n}", "func (r *Resolver) ImageFindList() runtime.ImageFindListResolver { return &imageFindListResolver{r} }", "func ListBaseImages() []string {\n\td, _ := os.Open(C.ImageDir)\n\tfiles, _ := d.Readdir(0)\n\n\tnames := []string{}\n\tfor _, f := range files {\n\t\tnames = append(names, f.Name())\n\t}\n\n\treturn names\n}", "func (d *Docker) Images(opt types.ImageListOptions) ([]types.ImageSummary, error) {\n\treturn d.ImageList(context.TODO(), opt)\n}", "func (db *ImageDB) ImageList(uploaderID primitive.ObjectID) ([]bson.M, error) {\n\tvar data []bson.M\n\tmatchStage := bson.D{{\"$match\", bson.D{{\"metadata.uploader\", uploaderID}}}}\n\tprojectStage := bson.D{{\"$project\", bson.D{{\"id\", \"$_id\"}, {\"_id\", 0}, {\"uploadDate\", \"$uploadDate\"}}}}\n\n\tcursor, err := db.collection.Aggregate(timeoutContext(),\n\t\tmongo.Pipeline{matchStage, projectStage})\n\tif err != nil {\n\t\treturn data, err\n\t}\n\terr = cursor.All(timeoutContext(), &data)\n\tif err != nil {\n\t\treturn data, err\n\t}\n\n\treturn data, nil\n}", "func (_mr *MockECRAPIMockRecorder) ListImages(arg0 interface{}) *gomock.Call {\n\treturn _mr.mock.ctrl.RecordCall(_mr.mock, \"ListImages\", arg0)\n}", "func (es *etcdStore) List(imageType string) ([]*Image, error) {\n\tvar images []*Image\n\n\t// Look up the prefix to get a list of imageIDs\n\tresp, err := es.client.Get(es.prefix, false, false)\n\tif err != nil {\n\t\tlog.WithFields(etcdLogFields).WithFields(log.Fields{\n\t\t\t\"error\": err,\n\t\t\t\"key\": es.prefix,\n\t\t}).Error(\"failed to look up images dir\")\n\t\treturn nil, err\n\t}\n\n\t// Look up metadata for each imageID and filter by type\n\tfor _, node := range resp.Node.Nodes {\n\t\timageID := path.Base(node.Key)\n\t\timage, err := es.GetByID(imageID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif imageType == \"\" || imageType == image.Type {\n\t\t\timages = append(images, image)\n\t\t}\n\t}\n\n\treturn images, nil\n}", "func (d *Daemon) ListImages(ctx context.Context, spec update.ResourceSpec) ([]v6.ImageStatus, error) {\n\treturn d.ListImagesWithOptions(ctx, v10.ListImagesOptions{Spec: spec})\n}", "func (_m *MockECRAPI) ListImages(_param0 *ecr.ListImagesInput) (*ecr.ListImagesOutput, error) {\n\tret := _m.ctrl.Call(_m, \"ListImages\", _param0)\n\tret0, _ := ret[0].(*ecr.ListImagesOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (s *engineImageLister) List(selector labels.Selector) (ret []*v1beta1.EngineImage, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1beta1.EngineImage))\n\t})\n\treturn ret, err\n}", "func listImages(w http.ResponseWriter, r *http.Request, parms martini.Params) {\r\n\t//\tval, err := redis_client.Get(\"hotimage\")\r\n\t//\tif err != nil {\r\n\t//\t\tlogger.Error(err)\r\n\t//\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\r\n\t//\t}\r\n\t//\tvar list HotImages\r\n\t//\tif err = json.Unmarshal(val, &list); err != nil {\r\n\t//\t\tlogger.Error(err)\r\n\t//\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\r\n\t//\t}\r\n\t//\tvar images []CRImage\r\n\t//\tif len(list.List) > 50 {\r\n\t//\t\timages = list.List[0:50]\r\n\t//\t} else {\r\n\t//\t\timages = list.List[0:]\r\n\t//\t}\r\n\t//\tif err := json.NewEncoder(w).Encode(images); err != nil {\r\n\t//\t\tlogger.Error(err)\r\n\t//\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\r\n\t//\t}\r\n\tqs := r.URL.Query()\r\n\tkey := qs.Get(\"key\")\r\n\tpage, err := strconv.Atoi(qs.Get(\"page\"))\r\n\tif err != nil {\r\n\t\tpage = 1\r\n\t}\r\n\tif page <= 0 {\r\n\t\tpage = 1\r\n\t}\r\n\tnum, err := strconv.Atoi(qs.Get(\"num\"))\r\n\tif err != nil {\r\n\t\tnum = 8\r\n\t}\r\n\tif num == 0 {\r\n\t\tnum = 8\r\n\t}\r\n\tstart := (page - 1) * num\r\n\tend := start + num\r\n\tvar list ImageList\r\n\tvar result HotImages\r\n\tif key == \"\" {\r\n\t\tresult.Num = num\r\n\t\tresult.Page = page\r\n\t\tconn := pool.Get()\r\n\t\tdefer conn.Close()\r\n\t\tval, err := conn.Do(\"GET\", \"hotimage\")\r\n\t\tlog.Println(val)\r\n\t\tlog.Println(err)\r\n\t\tif val == nil {\r\n\t\t\t// logger.Error(err)\r\n\t\t\t// http.Error(w, err.Error(), http.StatusInternalServerError)\r\n\t\t\t// return\r\n\t\t\tlist.List = HotTimerList()\r\n\t\t} else {\r\n\t\t\ttmp, _ := val.([]byte)\r\n\t\t\tif err = json.Unmarshal(tmp, &list); err != nil {\r\n\t\t\t\tlogger.Error(err)\r\n\t\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t\t// convert interface to []byte\r\n\r\n\t\tif end > 50 {\r\n\t\t\tresult.List = list.List[start:50]\r\n\t\t} else if end > len(list.List) {\r\n\t\t\tresult.List = list.List[start:]\r\n\t\t} else {\r\n\t\t\tresult.List = list.List[start:end]\r\n\t\t}\r\n\t\tif len(list.List) > 50 {\r\n\t\t\tresult.Total = 50\r\n\t\t} else {\r\n\t\t\tresult.Total = int64(len(list.List))\r\n\t\t}\r\n\t} else {\r\n\t\tresult = QuerybyName(key, page, num)\r\n\t}\r\n\tif err := json.NewEncoder(w).Encode(result); err != nil {\r\n\t\tlogger.Error(err)\r\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\r\n\t}\r\n}", "func RunImagesListUser(ns string, config doit.Config, out io.Writer, args []string) error {\n\tclient := config.GetGodoClient()\n\treturn listImages(ns, config, out, client.Images.ListUser)\n}", "func RunImagesListDistribution(ns string, config doit.Config, out io.Writer, args []string) error {\n\tclient := config.GetGodoClient()\n\treturn listImages(ns, config, out, client.Images.ListDistribution)\n}", "func (c *TestClient) ListMachineImages(project string, opts ...ListCallOption) ([]*compute.MachineImage, error) {\n\tif c.ListMachineImagesFn != nil {\n\t\treturn c.ListMachineImagesFn(project, opts...)\n\t}\n\treturn c.client.ListMachineImages(project, opts...)\n}", "func (addon Addon) Images(clusterVersion *version.Version, imageTag string) []string {\n\timages := []string{}\n\tfor _, cb := range addon.getImageCallbacks {\n\t\timage := cb(clusterVersion, imageTag)\n\t\tif image != \"\" {\n\t\t\timages = append(images, image)\n\t\t}\n\t}\n\treturn images\n}", "func (imageService Service) Images() (image []Response, err error) {\n\treturn imageService.QueryImages(nil)\n}", "func (imageService Service) Images() (image []Response, err error) {\n\treturn imageService.QueryImages(nil)\n}", "func (a *Client) PostImagesList(params *PostImagesListParams, authInfo runtime.ClientAuthInfoWriter) (*PostImagesListOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPostImagesListParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"PostImagesList\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/images/list\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &PostImagesListReader{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.(*PostImagesListOK), nil\n\n}", "func (client *Client) ListDevicesImages(request *ListDevicesImagesRequest) (response *ListDevicesImagesResponse, err error) {\n\tresponse = CreateListDevicesImagesResponse()\n\terr = client.DoAction(request, response)\n\treturn\n}", "func ListImageOnCloud(client *s3.Client) {\n\tbucket := &bucketName\n\tinput := &s3.ListObjectsV2Input{\n\t\tBucket: bucket,\n\t}\n\n\tresp, err := GetObjects(context.TODO(), client, input)\n\tif err != nil {\n\t\tfmt.Println(\"Got error retrieving list of Images:\")\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\n\tfmt.Printf(\"Images:\\n\")\n\n\tfor i, item := range resp.Contents {\n\t\tfmt.Printf(\"=== Image %06d Begin ===\\n\", i)\n\t\tfmt.Println(\"Name: \", *item.Key)\n\t\tfmt.Println(\"Last modified: \", *item.LastModified)\n\t\tfmt.Println(\"Size: \", item.Size)\n\t\tfmt.Println(\"Storage class: \", item.StorageClass)\n\t\tfmt.Printf(\"=== Image %06d End ===\\n\", i)\n\n\t}\n\n\tfmt.Println(\"Found\", len(resp.Contents), \"images\", *bucket)\n}", "func (s *ImagesByRepositoryRegistryStorage) List(selector labels.Selector) (interface{}, error) {\n\treturn nil, errors.New(\"not supported\")\n}", "func listMatchboxImagesHandler(w http.ResponseWriter, req *http.Request, _ *Context) error {\n\tendpoint := req.URL.Query().Get(\"endpoint\")\n\tif endpoint == \"\" {\n\t\treturn newBadRequestError(\"No endpoint provided\")\n\t}\n\n\timages, err := containerlinux.ListMatchboxImages(endpoint, *containerLinuxMinVersion, containerLinuxListTimeout)\n\tif err != nil {\n\t\treturn newInternalServerError(\"Failed to query available images: %s\", err)\n\t}\n\n\ttype Image struct {\n\t\tVersion string `json:\"version\"`\n\t}\n\tresponse := struct {\n\t\tCoreOS []Image `json:\"coreos\"`\n\t}{}\n\tfor _, image := range images {\n\t\tresponse.CoreOS = append(response.CoreOS, Image{Version: image.String()})\n\t}\n\n\treturn writeJSONResponse(w, req, http.StatusOK, response)\n}", "func (s engineImageNamespaceLister) List(selector labels.Selector) (ret []*v1beta1.EngineImage, err error) {\n\terr = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1beta1.EngineImage))\n\t})\n\treturn ret, err\n}", "func getImages() ([]types.ImageSummary, error) {\n\timages, err := client.ImageList(context.Background(), types.ImageListOptions{})\n\tif err != nil {\n\t\treturn []types.ImageSummary{}, err\n\t}\n\treturn images, nil\n}", "func (c *containerdCAS) ListImages() ([]string, error) {\n\timageObjectList, err := ctrdClient.ImageService().List(ctrdCtx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ListImages: Exception while getting image list. %s\", err.Error())\n\t}\n\timageNameList := make([]string, 0)\n\tfor _, image := range imageObjectList {\n\t\timageNameList = append(imageNameList, image.Name)\n\t}\n\treturn imageNameList, nil\n}", "func (o *ClusterUninstaller) listImages() (cloudResources, error) {\n\to.Logger.Debugf(\"Listing images\")\n\n\tif o.imageClient == nil {\n\t\to.Logger.Infof(\"Skipping deleting images because no service instance was found\")\n\t\tresult := []cloudResource{}\n\t\treturn cloudResources{}.insert(result...), nil\n\t}\n\n\tctx, cancel := o.contextWithTimeout()\n\tdefer cancel()\n\n\tselect {\n\tcase <-ctx.Done():\n\t\to.Logger.Debugf(\"listImages: case <-ctx.Done()\")\n\t\treturn nil, o.Context.Err() // we're cancelled, abort\n\tdefault:\n\t}\n\n\timages, err := o.imageClient.GetAll()\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to list images\")\n\t}\n\n\tvar foundOne = false\n\n\tresult := []cloudResource{}\n\tfor _, image := range images.Images {\n\t\tif strings.Contains(*image.Name, o.InfraID) {\n\t\t\tfoundOne = true\n\t\t\to.Logger.Debugf(\"listImages: FOUND: %s, %s, %s\", *image.ImageID, *image.Name, *image.State)\n\t\t\tresult = append(result, cloudResource{\n\t\t\t\tkey: *image.ImageID,\n\t\t\t\tname: *image.Name,\n\t\t\t\tstatus: *image.State,\n\t\t\t\ttypeName: imageTypeName,\n\t\t\t\tid: *image.ImageID,\n\t\t\t})\n\t\t}\n\t}\n\tif !foundOne {\n\t\to.Logger.Debugf(\"listImages: NO matching image against: %s\", o.InfraID)\n\t\tfor _, image := range images.Images {\n\t\t\to.Logger.Debugf(\"listImages: image: %s\", *image.Name)\n\t\t}\n\t}\n\n\treturn cloudResources{}.insert(result...), nil\n}", "func (s *PhotoStreamServer) ListHandler(w http.ResponseWriter, r *http.Request) {\n\tfmt.Println(\"received list request\")\n\n\timageDir := s.RootDir + \"/assets/images\"\n\tfiles, err := ioutil.ReadDir(imageDir)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\timageListResponse := &ImageListResponse{Images: make([]*ImageFileInfo, len(files))}\n\tfor i, f := range files {\n\t\tinfo := &ImageFileInfo{\n\t\t\tFilename: f.Name(),\n\t\t\tCreatedAt: fmt.Sprintf(\"%v\", f.ModTime()),\n\t\t}\n\t\timageListResponse.Images[i] = info\n\t}\n\n\tres, err := json.Marshal(imageListResponse)\n\tif err != nil {\n\t\tfmt.Println(\"problem marshalling json list response:\", err)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.Header().Add(\"Content-Type\", \"application/json\")\n\tw.Write(res)\n}", "func (client *Client) ListVirtualImages(req *Request) (*Response, error) {\n\treturn client.Execute(&Request{\n\t\tMethod: \"GET\",\n\t\tPath: VirtualImagesPath,\n\t\tQueryParams: req.QueryParams,\n\t\tResult: &ListVirtualImagesResult{},\n\t})\n}", "func getImages(app App) []docker.APIImages {\n\tpDebug(\"Getting images %s\", app.Image)\n\timgs, _ := client.ListImages(docker.ListImagesOptions{All: false, Filter: app.Image})\n\treturn imgs\n}", "func GenImgList(ext string, fileSeeker io.ReadSeeker, opts ...OptStruct) ([]string, error) {\n\topFileList := []string{}\n\tfor _, value := range opts {\n\t\tfileSeeker.Seek(0, 0)\n\t\topFileName, err := GenImgFunc(fileSeeker, ext, value.num, value.mode)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\topFileList = append(opFileList, opFileName)\n\t}\n\treturn opFileList, nil\n}", "func CtrListImages() ([]images.Image, error) {\n\tif err := verifyCtr(); err != nil {\n\t\treturn nil, fmt.Errorf(\"CtrListImages: exception while verifying ctrd client: %s\", err.Error())\n\t}\n\treturn CtrdClient.ImageService().List(ctrdCtx)\n}", "func (lc *imgListCfg) displayImagesOnRegistry(ims []utils.Repositories) {\n\n\t// get \"username/\"\n\tu := lc.pf.username + \"/\"\n\n\tfor _, r := range ims {\n\t\tfor _, i := range r.ImgNames {\n\n\t\t\t// display image excluding top of \"username/\"\n\t\t\tp := strings.Index(i, u)\n\t\t\tif p == -1 { // not display image whose top is not \"username/\"\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfmt.Println(i[len(u):])\n\t\t}\n\t}\n}", "func (cmd *SLCommand) List(args []string) error {\n\tl := newListFlags()\n\tif err := l.flagSet.Parse(args); err != nil {\n\t\treturn nil // we don't return error, the usage will be printed instead\n\t}\n\n\tif len(l.imageIds) == 1 {\n\t\timage, err := cmd.ImageByID(l.imageIds[0])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn (Images{image}).Print(l.output)\n\t}\n\n\tif len(l.imageIds) != 0 {\n\t\timages, err := cmd.ImagesByIDs(l.imageIds...)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn images.Print(l.output)\n\t}\n\n\timages, err := cmd.Images()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif l.all {\n\t\treturn images.Print(l.output)\n\t}\n\n\tvar filtered Images\n\t// Filter out system images and not taggable ones.\n\tfor _, img := range images {\n\t\tisSystem := strings.HasSuffix(img.Name, \"-SWAP\") || strings.HasSuffix(img.Name, \"-METADATA\") || img.GlobalID == \"\"\n\t\tif isSystem || img.NotTaggable {\n\t\t\tcontinue\n\t\t}\n\t\tfiltered = append(filtered, img)\n\t}\n\treturn filtered.Print(l.output)\n}", "func ListImagesFile(inFiles []string, selectedPages []string, conf *model.Configuration) ([]string, error) {\n\tif len(selectedPages) == 0 {\n\t\tlog.CLI.Printf(\"pages: all\\n\")\n\t}\n\tss := []string{}\n\tfor _, fn := range inFiles {\n\t\tf, err := os.Open(fn)\n\t\tif err != nil {\n\t\t\tif len(inFiles) > 1 {\n\t\t\t\tss = append(ss, fmt.Sprintf(\"\\ncan't open %s: %v\", fn, err))\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t\tdefer f.Close()\n\t\toutput, err := ListImages(f, selectedPages, conf)\n\t\tif err != nil {\n\t\t\tif len(inFiles) > 1 {\n\t\t\t\tss = append(ss, fmt.Sprintf(\"\\n%s: %v\", fn, err))\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t\tss = append(ss, \"\\n\"+fn)\n\t\tss = append(ss, output...)\n\t}\n\treturn ss, nil\n}", "func (client ArtifactsClient) ListContainerImages(ctx context.Context, request ListContainerImagesRequest) (response ListContainerImagesResponse, 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.listContainerImages, 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 = ListContainerImagesResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId}\n\t\t\t} else {\n\t\t\t\tresponse = ListContainerImagesResponse{}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\tif convertedResponse, ok := ociResponse.(ListContainerImagesResponse); ok {\n\t\tresponse = convertedResponse\n\t} else {\n\t\terr = fmt.Errorf(\"failed to convert OCIResponse into ListContainerImagesResponse\")\n\t}\n\treturn\n}", "func (a *ImagesApiService) ListImagesExecute(r ApiListImagesRequest) ([]AnchoreImage, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue []AnchoreImage\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"ImagesApiService.ListImages\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/images\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\tif r.history != nil {\n\t\tlocalVarQueryParams.Add(\"history\", parameterToString(*r.history, \"\"))\n\t}\n\tif r.fulltag != nil {\n\t\tlocalVarQueryParams.Add(\"fulltag\", parameterToString(*r.fulltag, \"\"))\n\t}\n\tif r.imageStatus != nil {\n\t\tlocalVarQueryParams.Add(\"image_status\", parameterToString(*r.imageStatus, \"\"))\n\t}\n\tif r.analysisStatus != nil {\n\t\tlocalVarQueryParams.Add(\"analysis_status\", parameterToString(*r.analysisStatus, \"\"))\n\t}\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif r.xAnchoreAccount != nil {\n\t\tlocalVarHeaderParams[\"x-anchore-account\"] = parameterToString(*r.xAnchoreAccount, \"\")\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 500 {\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\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "func (az *AzureClient) ListVirtualMachineImages(ctx context.Context, location, publisherName, offer, skus string) (compute.ListVirtualMachineImageResource, error) {\n\t// random value\n\ttop := int32(10)\n\tlist, err := az.virtualMachineImagesClient.List(ctx, location, publisherName, offer, skus, \"\", &top, \"\")\n\tif err != nil {\n\t\treturn compute.ListVirtualMachineImageResource{}, fmt.Errorf(\"failed to list virtual machine images, %s\", err)\n\t}\n\tr := compute.ListVirtualMachineImageResource{}\n\tif err = DeepCopy(&r, list); err != nil {\n\t\treturn r, fmt.Errorf(\"failed to deep copy virtual machine images, %s\", err)\n\t}\n\treturn r, err\n}", "func (v *IBM) GetImages(ctx *lepton.Context) ([]lepton.CloudImage, error) {\n\tclient := &http.Client{}\n\n\tc := ctx.Config()\n\tzone := c.CloudConfig.Zone\n\n\tregion := extractRegionFromZone(zone)\n\n\turi := \"https://\" + region + \".iaas.cloud.ibm.com/v1/images?version=2023-02-28&generation=2&visibility=private\"\n\n\treq, err := http.NewRequest(\"GET\", uri, nil)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"Authorization\", \"Bearer \"+v.iam)\n\n\tres, err := client.Do(req)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\tdefer res.Body.Close()\n\n\tbody, err := io.ReadAll(res.Body)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\tilr := &ImageListResponse{}\n\terr = json.Unmarshal(body, &ilr)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\tvar images []lepton.CloudImage\n\n\tfor _, img := range ilr.Images {\n\t\timages = append(images, lepton.CloudImage{\n\t\t\tID: img.ID,\n\t\t\tName: img.Name,\n\t\t\tStatus: img.Status,\n\t\t\tPath: \"\",\n\t\t})\n\t}\n\n\treturn images, nil\n\n}", "func (client ArtifactsClient) listContainerImages(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodGet, \"/container/images\", binaryReqBody, extraHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response ListContainerImagesResponse\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/registry/20160918/ContainerImageSummary/ListContainerImages\"\n\t\terr = common.PostProcessServiceError(err, \"Artifacts\", \"ListContainerImages\", apiReferenceLink)\n\t\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponse(httpResponse, &response)\n\treturn response, err\n}", "func (d ImagefsDriver) List() (*volume.ListResponse, error) {\n\tcontainers, err := d.cli.ContainerList(context.Background(), types.ContainerListOptions{\n\t\tAll: true,\n\t\tFilters: filters.NewArgs(filters.Arg(\"label\", \"com.docker.imagefs.version\")),\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unexpected error: %s\", err)\n\t}\n\tresponse := &volume.ListResponse{}\n\tfor i := range containers {\n\t\tresponse.Volumes = append(response.Volumes, &volume.Volume{\n\t\t\t// TODO(rabrams) fall back to id if no names\n\t\t\tName: containers[i].Names[0],\n\t\t})\n\t}\n\treturn response, nil\n}", "func (a *TorrentImages) Images() []Image {\n\treturn a.images\n}", "func GetImages(\n\tstatus string, opts model.ImageOptions, categories []string,\n) ([]model.Image, error) {\n\n\tswitch status {\n\tcase \"unprocessed\":\n\t\treturn GetUnprocessedImages(opts)\n\tcase \"uncategorized\":\n\t\treturn mongodb.GetImages(opts, nil)\n\tcase \"autocategorized\":\n\t\treturn mongodb.GetImages(opts, &model.CategoryMap{\n\t\t\tProposed: categories,\n\t\t})\n\tcase \"categorized\":\n\t\treturn mongodb.GetImages(opts, &model.CategoryMap{\n\t\t\tAssigned: categories,\n\t\t})\n\tdefault:\n\t\treturn mongodb.GetImages(opts, &model.CategoryMap{})\n\t}\n}", "func (r *CCMRequest) ListImageInfo() (*pb.ListImageInfoResponse, error) {\r\n if r.InData == \"\" {\r\n return nil, errors.New(\"input data required\")\r\n }\r\n\r\n var item pb.ImageAllQryRequest\r\n err := gc.ConvertToMessage(r.InType, r.InData, &item)\r\n if err != nil {\r\n return nil, err\r\n }\r\n\r\n ctx, cancel := context.WithTimeout(context.Background(), r.Timeout)\r\n defer cancel()\r\n\r\n return r.Client.ListImage(ctx, &item)\r\n}", "func (d *DigitalOcean) Images(myImages bool) (Images, error) {\n\tv := url.Values{}\n\n\tif myImages {\n\t\tv.Set(\"filter\", \"my_images\")\n\t}\n\n\tresp, err := digitalocean.NewRequest(*d.Client, \"images\", v)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar result digitalocean.ImagesResp\n\tif err := mapstructure.Decode(resp, &result); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn result.Images, nil\n}", "func (p *OnPrem) GetImages(ctx *Context) ([]CloudImage, error) {\n\treturn nil, errors.New(\"un-implemented\")\n}", "func (a *ImagesApiService) ListImageContent(ctx context.Context, imageDigest string) ApiListImageContentRequest {\n\treturn ApiListImageContentRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\timageDigest: imageDigest,\n\t}\n}", "func getImages(hostBase string, organization string, application string) (*http.Response, []*server.Image, error) {\n\n\turl := getImagesURL(hostBase, organization, application)\n\n\tkiln.LogInfo.Printf(\"Invoking get at URL %s\", url)\n\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\treq.Header.Add(\"Accept\", \"application/json\")\n\treq.Header.Set(\"Authorization\", fmt.Sprintf(\"Bearer %s\", \"e30K.e30K.e30K\"))\n\tclient := &http.Client{}\n\tresponse, err := client.Do(req)\n\n\timages := []*server.Image{}\n\n\tbytes, err := ioutil.ReadAll(response.Body)\n\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tbody := string(bytes)\n\n\tkiln.LogInfo.Printf(\"Response is %s\", body)\n\n\tjson.Unmarshal(bytes, &images)\n\n\treturn response, images, err\n\n}", "func ListContainerImages(settings *playfab.Settings, postData *ListContainerImagesRequestModel, entityToken string) (*ListContainerImagesResponseModel, error) {\n if entityToken == \"\" {\n return nil, playfab.NewCustomError(\"entityToken should not be an empty string\", playfab.ErrorGeneric)\n }\n b, errMarshal := json.Marshal(postData)\n if errMarshal != nil {\n return nil, playfab.NewCustomError(errMarshal.Error(), playfab.ErrorMarshal)\n }\n\n sourceMap, err := playfab.Request(settings, b, \"/MultiplayerServer/ListContainerImages\", \"X-EntityToken\", entityToken)\n if err != nil {\n return nil, err\n }\n \n result := &ListContainerImagesResponseModel{}\n\n config := mapstructure.DecoderConfig{\n DecodeHook: playfab.StringToDateTimeHook,\n Result: result,\n }\n \n decoder, errDecoding := mapstructure.NewDecoder(&config)\n if errDecoding != nil {\n return nil, playfab.NewCustomError(errDecoding.Error(), playfab.ErrorDecoding)\n }\n \n errDecoding = decoder.Decode(sourceMap)\n if errDecoding != nil {\n return nil, playfab.NewCustomError(errDecoding.Error(), playfab.ErrorDecoding)\n }\n\n return result, nil\n}", "func ReadAllImages(output http.ResponseWriter, reader *http.Request) {\n\tLog(\"info\", \"Endpoint Hit: ReadAllImages\")\n\tresults, err := DB.Query(\"SELECT * FROM images\")\n\tErrorHandler(err)\n\n\tvar images Images\n\tfor results.Next() {\n\t\tvar img Image\n\t\t// for each row, scan the result into our image composite object\n\t\terr = results.Scan(&img.ID, &img.Image, &img.Thumbnail, &img.Caption)\n\t\tErrorHandler(err)\n\n\t\t// Append images to array\n\t\timages = append(images, img)\n\t}\n\n\tdefer results.Close()\n\toutput.Header().Set(\"Content-Type\", \"application/json\")\n\toutput.WriteHeader(http.StatusOK)\n\tJSON.NewEncoder(output).Encode(images)\n}", "func GetAllImages() []Image {\n\treturn []Image{}\n}", "func (h *Handler) GetImages(w http.ResponseWriter, r *http.Request) {\n\t// first list all the pools so that we can retrieve images from all pools\n\tpools, err := ceph.ListPoolSummaries(h.context, h.config.clusterInfo.Name)\n\tif err != nil {\n\t\tlogger.Errorf(\"failed to list pools: %+v\", err)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tresult := []model.BlockImage{}\n\n\t// for each pool, get further details about all the images in the pool\n\tfor _, p := range pools {\n\t\timages, ok := h.getImagesForPool(w, p.Name)\n\t\tif !ok {\n\t\t\treturn\n\t\t}\n\n\t\tresult = append(result, images...)\n\t}\n\n\tFormatJsonResponse(w, result)\n}", "func imgListMain(cmd *cobra.Command, args []string) {\n\n\t//parameter check, init parameters\n\tfmt.Println(\"*** CHECK PARAMS ***\")\n\tlc := imgListCfg{}\n\terr := lc.checkParams(cmd, args)\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\tos.Exit(1)\n\t}\n\tfmt.Println(\"completed\")\n\n\t// display exec paramenters\n\tfmt.Println(\"*** exec parameters ***\")\n\tlc.displayParams()\n\n\t// create docker client\n\tlc.cli = utils.NewDockerClient(lc.pf.docker, lc.pf.registry)\n\n\t// if image name is specified\n\tif lc.params.Image != \"\" {\n\t\tfmt.Println(\"*** image ***\")\n\n\t\t// check image exist on private registry\n\t\texist := false\n\t\texist, err = lc.cli.IsImageExistOnRegistry(lc.params.Image, lc.pf.username)\n\t\tif err != nil {\n\t\t\tfmt.Println(err.Error())\n\t\t\tos.Exit(1)\n\t\t}\n\t\tif !exist {\n\t\t\tfmt.Println(\"Specified image does not exist on private registry\")\n\t\t\treturn\n\t\t}\n\n\t\t// get tags corresponding to image from private registry\n\t\tvar tags *utils.Tags\n\t\ttags, err = lc.cli.SearchOnRegistry(lc.params.Image, lc.pf.username)\n\t\tif err != nil {\n\t\t\tfmt.Println(err.Error())\n\t\t\tos.Exit(1)\n\t\t}\n\t\t// display image and its tags\n\t\tdisplayImageTagsOnRegistry(lc.params.Image, tags)\n\n\t\treturn\n\t}\n\n\t// get all images on private registry\n\tvar imgs []utils.Repositories\n\timgs, err = lc.cli.GetImageListOnRegistry()\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\tos.Exit(1)\n\t}\n\n\t// display all user's images\n\tfmt.Println(\"*** image ***\")\n\tlc.displayImagesOnRegistry(imgs)\n}", "func (qs *QueryServer) ListContainerImages() (cImages []types.ContainerImage, fnerr error) {\n\tdata, err := qs.List([]byte(ContainerImagePrefix))\n\tif err != nil {\n\t\tfnerr = err\n\t}\n\n\tfor _, rawbytes := range data {\n\t\tci := types.ContainerImage{}\n\t\tif err := json.Unmarshal(rawbytes, &ci); err != nil {\n\t\t\tbase.Errorf(err.Error())\n\t\t}\n\t\tcImages = append(cImages, ci)\n\t}\n\n\treturn\n}", "func (c *Client) GetImages() ([]*types.ImageInfo, error) {\n\tctx, cancel := getContextWithTimeout(hyperContextTimeout)\n\tdefer cancel()\n\n\treq := types.ImageListRequest{}\n\timageList, err := c.client.ImageList(ctx, &req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn imageList.ImageList, nil\n}", "func GetAllImages(cfg *v1.ClusterConfiguration, kubeadmCfg *kubeadmapi.ClusterConfiguration, operatorVersion string) []string {\n\timgs := images.GetControlPlaneImages(kubeadmCfg)\n\t//for _, component := range []string{\n\t//constants.OnecloudOperator,\n\t//} {\n\t//imgs = append(imgs, GetOnecloudImage(component, cfg, kubeadmCfg))\n\t//}\n\trepoPrefix := kubeadmCfg.ImageRepository\n\tfor img, version := range map[string]string{\n\t\tconstants.CalicoKubeControllers: constants.DefaultCalicoVersion,\n\t\tconstants.CalicoNode: constants.DefaultCalicoVersion,\n\t\tconstants.CalicoCNI: constants.DefaultCalicoVersion,\n\t\tconstants.RancherLocalPathProvisioner: constants.DefaultLocalProvisionerVersion,\n\t\tconstants.IngressControllerTraefik: constants.DefaultTraefikVersion,\n\t\tconstants.OnecloudOperator: operatorVersion,\n\t} {\n\t\timgs = append(imgs, GetGenericImage(repoPrefix, img, version))\n\t}\n\treturn imgs\n}", "func (a *ImagesApiService) ListImageMetadata(ctx context.Context, imageDigest string) ApiListImageMetadataRequest {\n\treturn ApiListImageMetadataRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\timageDigest: imageDigest,\n\t}\n}", "func (client *Client) ListDevicesImagesWithCallback(request *ListDevicesImagesRequest, callback func(response *ListDevicesImagesResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *ListDevicesImagesResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.ListDevicesImages(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (be *RetryBackend) List(ctx context.Context, t restic.FileType, fn func(restic.FileInfo) error) error {\n\t// create a new context that we can cancel when fn returns an error, so\n\t// that listing is aborted\n\tlistCtx, cancel := context.WithCancel(ctx)\n\tdefer cancel()\n\n\tlisted := make(map[string]struct{}) // remember for which files we already ran fn\n\tvar innerErr error // remember when fn returned an error, so we can return that to the caller\n\n\terr := be.retry(listCtx, fmt.Sprintf(\"List(%v)\", t), func() error {\n\t\treturn be.Backend.List(ctx, t, func(fi restic.FileInfo) error {\n\t\t\tif _, ok := listed[fi.Name]; ok {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tlisted[fi.Name] = struct{}{}\n\n\t\t\tinnerErr = fn(fi)\n\t\t\tif innerErr != nil {\n\t\t\t\t// if fn returned an error, listing is aborted, so we cancel the context\n\t\t\t\tcancel()\n\t\t\t}\n\t\t\treturn innerErr\n\t\t})\n\t})\n\n\t// the error fn returned takes precedence\n\tif innerErr != nil {\n\t\treturn innerErr\n\t}\n\n\treturn err\n}", "func ListImages(aFlags AWSFlags) map[string][]*ecr.ImageIdentifier {\n\timgTags := make(map[string][]*ecr.ImageIdentifier)\n\trepos := ListRepos(aFlags)\n\tfor _, repo := range repos.Repositories {\n\t\timg, err := client.ECR().ListImages(&ecr.ListImagesInput{RepositoryName: repo.RepositoryName})\n\t\tif err != nil {\n\t\t\tFailf(\"error obtaining images for repo %s: %v\", repo.RepositoryName, err)\n\t\t}\n\t\timgTags[*repo.RepositoryUri] = img.ImageIds\n\t}\n\treturn imgTags\n}", "func NewGetImagesListDefault(code int) *GetImagesListDefault {\n\tif code <= 0 {\n\t\tcode = 500\n\t}\n\n\treturn &GetImagesListDefault{\n\t\t_statusCode: code,\n\t}\n}", "func ListImagesInDirectory(directory string) ([]os.DirEntry, error) {\r\n\treturn ListFilesInDirectoryOptions(directory, &FilterOptions{\r\n\t\tFilterDirectories: true,\r\n\t\tFilterFuncs: []DirEntryFilterFunc{onlyImagesFunc},\r\n\t})\r\n}" ]
[ "0.77917314", "0.7673172", "0.7582107", "0.74669564", "0.7461918", "0.74567795", "0.7455492", "0.74470425", "0.74421465", "0.74403477", "0.7386146", "0.7381981", "0.73778903", "0.73704207", "0.7305356", "0.72899914", "0.7286422", "0.72794557", "0.72736394", "0.72516084", "0.72406375", "0.72348714", "0.7195996", "0.71736777", "0.7136329", "0.71141815", "0.7108417", "0.71006685", "0.71002394", "0.70838326", "0.7063304", "0.705481", "0.6996087", "0.6987704", "0.69676757", "0.69568944", "0.69480866", "0.684422", "0.6800629", "0.6792444", "0.672095", "0.66982263", "0.66965574", "0.66936284", "0.6679717", "0.6676399", "0.6676157", "0.66619265", "0.6641415", "0.66336805", "0.6624233", "0.657508", "0.65212667", "0.65205914", "0.6516411", "0.6516411", "0.6510291", "0.6484948", "0.6458707", "0.64415306", "0.6437403", "0.6436285", "0.64303833", "0.6420948", "0.6411805", "0.6358046", "0.6351356", "0.63269204", "0.62888247", "0.6288699", "0.6281397", "0.6278679", "0.62761813", "0.62716454", "0.6270008", "0.6251739", "0.61987317", "0.618795", "0.6142323", "0.61417854", "0.61054754", "0.60780126", "0.60660416", "0.60615796", "0.6060274", "0.60538524", "0.60478", "0.60438097", "0.6041783", "0.6029246", "0.6028009", "0.60252416", "0.6014967", "0.59774804", "0.5968631", "0.59495205", "0.5946363", "0.59461725", "0.593584", "0.5920315" ]
0.7580764
3
GetLicense uses the override method GetLicenseFn or the real implementation.
func (c *TestClient) GetLicense(project, name string) (*compute.License, error) { if c.GetLicenseFn != nil { return c.GetLicenseFn(project, name) } return c.client.GetLicense(project, name) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GetLicense(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *LicenseState, opts ...pulumi.ResourceOption) (*License, error) {\n\tvar resource License\n\terr := ctx.ReadResource(\"consul:index/license:License\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (c *Client) GetLicense(ctx context.Context, p *LicenseObject) (res int, err error) {\n\tvar ires interface{}\n\tires, err = c.GetLicenseEndpoint(ctx, p)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn ires.(int), nil\n}", "func (s *LicensesService) GetLicense(licenseID string) (*License, *resty.Response, error) {\n\n\tpath := \"/licenses/{licenseId}\"\n\tpath = strings.Replace(path, \"{\"+\"licenseId\"+\"}\", fmt.Sprintf(\"%v\", licenseID), -1)\n\n\tresponse, err := RestyClient.R().\n\t\tSetResult(&License{}).\n\t\tGet(path)\n\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tresult := response.Result().(*License)\n\treturn result, response, err\n\n}", "func (r *Repository) GetLicense() *License {\n\tif r == nil {\n\t\treturn nil\n\t}\n\treturn r.License\n}", "func (c *CommunityHealthFiles) GetLicense() *Metric {\n\tif c == nil {\n\t\treturn nil\n\t}\n\treturn c.License\n}", "func (s *Server) getLicense(w http.ResponseWriter, r *http.Request) {\n\twriteXML(w, func(c *container) {\n\t\t// A license that indicates valid \"true\" allows Subsonic\n\t\t// clients to connect to this server\n\t\tc.License = &license{Valid: true}\n\t})\n}", "func NewLicense() *GetLicense {\n\trequest := gorequest.New()\n\tdownloader := GetLicense{\n\t\trequest: request,\n\t\tlicenseMap: make(map[string]string),\n\t}\n\treturn &downloader\n}", "func (i Intangible) AsLicense() (*License, bool) {\n\treturn nil, false\n}", "func (s *SPDX) License(id string) (*License, error) {\n\tresp, err := s.hc.Get(fmt.Sprintf(s.detailsURL, id))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tvar result License\n\tif err := json.NewDecoder(resp.Body).Decode(&result); err != nil {\n\t\treturn nil, err\n\t}\n\n\trespDetails, err := s.hc.Get(result.DetailsURL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer respDetails.Body.Close()\n\n\tvar details Details\n\tif err := json.NewDecoder(respDetails.Body).Decode(&details); err != nil {\n\t\treturn nil, err\n\t}\n\tresult.Details = details\n\n\treturn &result, nil\n}", "func provideLicense(client *scm.Client, config config.Config) *core.License {\n\tl, err := license.Load(config.License)\n\tif config.License == \"\" {\n\t\tl = license.Trial(client.Driver.String())\n\t} else if err != nil {\n\t\tlogrus.WithError(err).\n\t\t\tFatalln(\"main: invalid or expired license\")\n\t}\n\tlogrus.WithFields(\n\t\tlogrus.Fields{\n\t\t\t\"kind\": l.Kind,\n\t\t\t\"expires\": l.Expires,\n\t\t\t\"repo.limit\": l.Repos,\n\t\t\t\"user.limit\": l.Users,\n\t\t\t\"build.limit\": l.Builds,\n\t\t},\n\t).Debugln(\"main: license loaded\")\n\treturn l\n}", "func (lb LodgingBusiness) AsLicense() (*License, bool) {\n\treturn nil, false\n}", "func (r *RepositoryLicense) GetLicense() *License {\n\tif r == nil {\n\t\treturn nil\n\t}\n\treturn r.License\n}", "func (a *SyncApiService) GetSyncLicense(ctx context.Context) (LicenseLicense, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Get\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t \tsuccessPayload LicenseLicense\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/platform/5/sync/license\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{ \"application/json\", }\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"application/json\",\n\t\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn successPayload, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn successPayload, localVarHttpResponse, err\n\t}\n\tdefer localVarHttpResponse.Body.Close()\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tbodyBytes, _ := ioutil.ReadAll(localVarHttpResponse.Body)\n\t\treturn successPayload, localVarHttpResponse, reportError(\"Status: %v, Body: %s\", localVarHttpResponse.Status, bodyBytes)\n\t}\n\n\tif err = json.NewDecoder(localVarHttpResponse.Body).Decode(&successPayload); err != nil {\n\t\treturn successPayload, localVarHttpResponse, err\n\t}\n\n\n\treturn successPayload, localVarHttpResponse, err\n}", "func (lb LocalBusiness) AsLicense() (*License, bool) {\n\treturn nil, false\n}", "func GetLicenseResource(ctx context.Context, req licenseproto.GetLicenseResourceRequest) (*licenseproto.GetLicenseResponse, error) {\n\tctx = common.CreateMetadata(ctx)\n\tconn, err := services.ODIMService.Client(services.Licenses)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to create client connection: %v\", err)\n\t}\n\tdefer conn.Close()\n\tlicenseService := licenseproto.NewLicensesClient(conn)\n\tresp, err := licenseService.GetLicenseResource(ctx, &req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"RPC error: %v\", err)\n\t}\n\treturn resp, nil\n}", "func (o LicenseOutput) License() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *License) pulumi.StringOutput { return v.License }).(pulumi.StringOutput)\n}", "func (h Hotel) AsLicense() (*License, bool) {\n\treturn nil, false\n}", "func (t Thing) AsLicense() (*License, bool) {\n\treturn nil, false\n}", "func (fe FoodEstablishment) AsLicense() (*License, bool) {\n\treturn nil, false\n}", "func (l License) AsLicense() (*License, bool) {\n\treturn &l, true\n}", "func (i Identifiable) AsLicense() (*License, bool) {\n\treturn nil, false\n}", "func (o LicenseResourceCommitmentOutput) License() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LicenseResourceCommitment) *string { return v.License }).(pulumi.StringPtrOutput)\n}", "func (a Airport) AsLicense() (*License, bool) {\n\treturn nil, false\n}", "func (s *LicenseService) GetLicenseCommand() (result *LicenseView, resp *http.Response, err error) {\n\tpath := \"/license\"\n\trel := &url.URL{Path: fmt.Sprintf(\"%s%s\", s.client.Context, path)}\n\treq, err := s.client.newRequest(\"GET\", rel, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tresp, err = s.client.do(req, &result)\n\tif err != nil {\n\t\treturn result, resp, err\n\t}\n\treturn result, resp, nil\n\n}", "func (rb ResponseBase) AsLicense() (*License, bool) {\n\treturn nil, false\n}", "func GetLicenseFromSecret(client *kubernetes.Clientset) (string, error) {\n\tsecret, err := client.CoreV1().Secrets(defaults.KubeSystemNamespace).\n\t\tGet(context.TODO(), constants.LicenseSecretName, metav1.GetOptions{})\n\tif err != nil {\n\t\treturn \"\", trace.Wrap(rigging.ConvertError(err))\n\t}\n\n\tlicenseData, ok := secret.Data[constants.LicenseSecretName]\n\tif !ok {\n\t\treturn \"\", trace.NotFound(\"no license data in Kubernetes secret\")\n\t}\n\n\treturn string(licenseData), nil\n}", "func (r Restaurant) AsLicense() (*License, bool) {\n\treturn nil, false\n}", "func (cw CreativeWork) AsLicense() (*License, bool) {\n\treturn nil, false\n}", "func (o Organization) AsLicense() (*License, bool) {\n\treturn nil, false\n}", "func (p Place) AsLicense() (*License, bool) {\n\treturn nil, false\n}", "func (e Entities) AsLicense() (*License, bool) {\n\treturn nil, false\n}", "func (mt MovieTheater) AsLicense() (*License, bool) {\n\treturn nil, false\n}", "func (eb EntertainmentBusiness) AsLicense() (*License, bool) {\n\treturn nil, false\n}", "func (o LicenseResourceCommitmentPtrOutput) License() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *LicenseResourceCommitment) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.License\n\t}).(pulumi.StringPtrOutput)\n}", "func (o LicenseResourceCommitmentResponseOutput) License() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LicenseResourceCommitmentResponse) string { return v.License }).(pulumi.StringOutput)\n}", "func (p *Project) License() License {\n\tif p.license.Text == \"\" && p.license.Name != \"None\" {\n\t\tp.license = getLicense()\n\t}\n\n\treturn p.license\n}", "func (p *PassportElementDriverLicense) GetDriverLicense() (value IdentityDocument) {\n\tif p == nil {\n\t\treturn\n\t}\n\treturn p.DriverLicense\n}", "func NewLicense() *License {\n\treturn &License{\n\t\txml.Name{},\n\t\ttrue,\n\t}\n}", "func (a *LicenseAgreementApiService) GetLicenseAgreement(ctx _context.Context) ApiGetLicenseAgreementRequest {\n\treturn ApiGetLicenseAgreementRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "func License() string {\n\treturn C.GoString(C.avformat_license())\n}", "func GetLicence(userName, licenceName string) (txt, format string, err error) {\n\tdbQuery := `\n\t\tSELECT licence_text, file_format\n\t\tFROM database_licences\n\t\tWHERE friendly_name ILIKE $2\n\t\tAND (\n\t\t\t\tuser_id = (\n\t\t\t\t\tSELECT user_id\n\t\t\t\t\tFROM users\n\t\t\t\t\tWHERE lower(user_name) = lower($1)\n\t\t\t\t) OR\n\t\t\t\tuser_id = (\n\t\t\t\t\tSELECT user_id\n\t\t\t\t\tFROM users\n\t\t\t\t\tWHERE user_name = 'default'\n\t\t\t\t)\n\t\t\t)`\n\terr = pdb.QueryRow(dbQuery, userName, licenceName).Scan(&txt, &format)\n\tif err != nil {\n\t\tif err == pgx.ErrNoRows {\n\t\t\t// The requested licence text wasn't found\n\t\t\treturn \"\", \"\", errors.New(\"unknown licence\")\n\t\t}\n\t\tlog.Printf(\"Error when retrieving licence '%s', user '%s': %v\\n\", licenceName, userName, err)\n\t\treturn \"\", \"\", err\n\t}\n\treturn txt, format, nil\n}", "func (o LicenseResourceCommitmentResponsePtrOutput) License() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *LicenseResourceCommitmentResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.License\n\t}).(pulumi.StringPtrOutput)\n}", "func (r Response) AsLicense() (*License, bool) {\n\treturn nil, false\n}", "func (p Places) AsLicense() (*License, bool) {\n\treturn nil, false\n}", "func (cs CivicStructure) AsLicense() (*License, bool) {\n\treturn nil, false\n}", "func (a Answer) AsLicense() (*License, bool) {\n\treturn nil, false\n}", "func (sr SearchResponse) AsLicense() (*License, bool) {\n\treturn nil, false\n}", "func (s *ManagedLicensesService) GetManagedLicense(pid, mlid interface{}, options ...RequestOptionFunc) (*ManagedLicense, *Response, error) {\n\tproject, err := parseID(pid)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tlicense, err := parseID(mlid)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tu := fmt.Sprintf(\"projects/%s/managed_licenses/%s\", PathEscape(project), PathEscape(license))\n\n\treq, err := s.client.NewRequest(http.MethodGet, u, nil, options)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tml := new(ManagedLicense)\n\tresp, err := s.client.Do(req, ml)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn ml, resp, nil\n}", "func (endpoint *Endpoint) GetLicensePool(ctx context.Context, fields string) (*LicensePool, error) {\n\t// Options\n\toptions := []Option{}\n\tif fields != \"\" {\n\t\toptions = append(options, WithParam(\"fields\", fields))\n\t}\n\n\t// Do the request\n\tresp, err := endpoint.client.do(ctx, http.MethodGet, \"/config/deployment/license_pool\", options...)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error while calling the endpoint: %s\", err)\n\t}\n\n\tif resp.StatusCode != 200 {\n\t\treturn nil, fmt.Errorf(\"error with the status code: %d\", resp.StatusCode)\n\t}\n\n\t// Read the respsonse\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error while reading the request : %s\", err)\n\t}\n\n\t// Prepare the response\n\tvar response *LicensePool\n\n\t// Unmarshal the response\n\terr = json.Unmarshal([]byte(body), &response)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error while unmarshalling the response : %s. HTTP response is : %s\", err, string(body))\n\t}\n\n\treturn response, nil\n}", "func (ioVar ImageObject) AsLicense() (*License, bool) {\n\treturn nil, false\n}", "func (o KubernetesClusterWindowsProfilePtrOutput) License() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *KubernetesClusterWindowsProfile) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.License\n\t}).(pulumi.StringPtrOutput)\n}", "func (o KubernetesClusterWindowsProfileOutput) License() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v KubernetesClusterWindowsProfile) *string { return v.License }).(pulumi.StringPtrOutput)\n}", "func GetLicenseService(ctx context.Context, req licenseproto.GetLicenseServiceRequest) (*licenseproto.GetLicenseResponse, error) {\n\tctx = common.CreateMetadata(ctx)\n\tconn, err := services.ODIMService.Client(services.Licenses)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to create client connection: %v\", err)\n\t}\n\tdefer conn.Close()\n\tlicenseService := licenseproto.NewLicensesClient(conn)\n\tresp, err := licenseService.GetLicenseService(ctx, &req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"RPC error: %v\", err)\n\t}\n\treturn resp, nil\n}", "func (ta TouristAttraction) AsLicense() (*License, bool) {\n\treturn nil, false\n}", "func (repo *GitHubProject) FetchLicense(context *Context) (*License, error) {\n\tif !context.Allow(NetworkAccessFlag) {\n\t\treturn nil, fmt.Errorf(\"network access denied\")\n\t}\n\tlicense, err := fetchLicensesByGitHubAPI(repo)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trepo.license = license\n\treturn license, nil\n}", "func getLicenseFile(licenses []string, files []string) (string, error) {\n\tmatches := matchLicenseFile(licenses, files)\n\n\tswitch len(matches) {\n\tcase 0:\n\t\treturn \"\", ErrNoLicenseFile\n\tcase 1:\n\t\treturn matches[0], nil\n\tdefault:\n\t\treturn \"\", ErrMultipleLicenses\n\t}\n}", "func (c Config) LicenseOrDefault() string {\n\tif c.License != \"\" {\n\t\treturn c.License\n\t}\n\treturn DefaultOpenSourceLicense\n}", "func (d *DBGenerator) readLicense(ctx context.Context) error {\n\t// If no license file given, then we omit the license from the manifests\n\tif d.Opts.LicenseFile == \"\" {\n\t\treturn nil\n\t}\n\n\tvar err error\n\td.LicenseData, err = ioutil.ReadFile(d.Opts.LicenseFile)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (hdr RPMHeader) License() string {\n\treturn hdr.Tag(\"License\")[0]\n}", "func (o *V0037JobProperties) GetLicenses() string {\n\tif o == nil || o.Licenses == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Licenses\n}", "func (r *Repository) GetLicenseTemplate() string {\n\tif r == nil || r.LicenseTemplate == nil {\n\t\treturn \"\"\n\t}\n\treturn *r.LicenseTemplate\n}", "func (sv StructuredValue) AsLicense() (*License, bool) {\n\treturn nil, false\n}", "func GetNSLicense(c *NitroClient, querystring string) (NSAPIResponse, error) {\n\tcfg, err := c.GetConfig(\"nslicense\", querystring)\n\tif err != nil {\n\t\treturn NSAPIResponse{}, err\n\t}\n\n\tvar response = new(NSAPIResponse)\n\n\terr = json.Unmarshal(cfg, &response)\n\tif err != nil {\n\t\treturn NSAPIResponse{}, errors.Wrap(err, \"error unmarshalling response body\")\n\t}\n\n\treturn *response, nil\n}", "func (o *Operator) NewLicense(ctx context.Context, req ops.NewLicenseRequest) (string, error) {\n\tif !o.isOpsCenter() {\n\t\treturn \"\", trace.AccessDenied(\"cannot generate licenses\")\n\t}\n\n\terr := req.Validate()\n\tif err != nil {\n\t\treturn \"\", trace.Wrap(err)\n\t}\n\n\to.Infof(\"Generating new license: %v\", req)\n\n\tca, err := pack.ReadCertificateAuthority(o.packages())\n\tif err != nil {\n\t\treturn \"\", trace.Wrap(err)\n\t}\n\n\tlicense, err := licenseapi.NewLicense(licenseapi.NewLicenseInfo{\n\t\tMaxNodes: req.MaxNodes,\n\t\tValidFor: req.ValidFor,\n\t\tStopApp: req.StopApp,\n\t\tTLSKeyPair: *ca,\n\t})\n\tif err != nil {\n\t\treturn \"\", trace.Wrap(err)\n\t}\n\n\tparsed, err := licenseapi.ParseLicense(license)\n\tif err != nil {\n\t\treturn \"\", trace.Wrap(err)\n\t}\n\n\tlibevents.Emit(ctx, o, events.LicenseGenerated, libevents.Fields{\n\t\tevents.FieldExpires: parsed.GetPayload().Expiration,\n\t\tevents.FieldMaxNodes: parsed.GetPayload().MaxNodes,\n\t})\n\n\treturn license, nil\n}", "func (pa PostalAddress) AsLicense() (*License, bool) {\n\treturn nil, false\n}", "func License() string {\n\treturn C.GoString(C.avfilter_license())\n}", "func getLicenceString() string {\n\tlicence :=\n\t\t\"\\nCopyright (c) 2015, Lindsay Bradford\\n\" +\n\t\t\t\"All rights reserved.\\n\\n\" +\n\t\t\t\"Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\\n\\n\" +\n\t\t\t\"1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\\n\\n\" +\n\t\t\t\"2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\\n\\n\" +\n\t\t\t\"3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.\\n\\n\" +\n\t\t\t\"THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \\\"AS IS\\\" AND ANY EXPRESS OR IMPLIED \" +\n\t\t\t\"WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A \" +\n\t\t\t\"PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY \" +\n\t\t\t\"DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, \" +\n\t\t\t\"PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER \" +\n\t\t\t\"CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR \" +\n\t\t\t\"OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\\n\"\n\n\treturn licence\n}", "func NewLicense(ctx *pulumi.Context,\n\tname string, args *LicenseArgs, opts ...pulumi.ResourceOption) (*License, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.License == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'License'\")\n\t}\n\tif args.License != nil {\n\t\targs.License = pulumi.ToSecret(args.License).(pulumi.StringInput)\n\t}\n\tsecrets := pulumi.AdditionalSecretOutputs([]string{\n\t\t\"license\",\n\t})\n\topts = append(opts, secrets)\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource License\n\terr := ctx.RegisterResource(\"consul:index/license:License\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func License() string {\n\treturn \"Licensed under the Apache License 2.0\"\n}", "func License() string {\n\treturn \"Licensed under the Apache License 2.0\"\n}", "func License() string {\n\treturn \"Licensed under the Apache License 2.0\"\n}", "func License() string {\n\treturn \"Licensed under the Apache License 2.0\"\n}", "func License() string {\n\treturn \"Licensed under the Apache License 2.0\"\n}", "func NewLicense(name string, expiry time.Time) *LicenseData {\n\treturn &LicenseData{Info: LicenseInfo{Name: name, Expiration: expiry}}\n}", "func (ctrler CtrlDefReactor) OnLicenseUpdate(oldObj *License, newObj *cluster.License) error {\n\tlog.Info(\"OnLicenseUpdate is not implemented\")\n\treturn nil\n}", "func GetBigIpLicense(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *BigIpLicenseState, opts ...pulumi.ResourceOption) (*BigIpLicense, error) {\n\tvar resource BigIpLicense\n\terr := ctx.ReadResource(\"f5bigip:sys/bigIpLicense:BigIpLicense\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (d *DefaultDriver) GetLicenseSummary() (LicenseSummary, error) {\n\treturn LicenseSummary{}, nil\n}", "func (o LookupRegionCommitmentResultOutput) LicenseResource() LicenseResourceCommitmentResponseOutput {\n\treturn o.ApplyT(func(v LookupRegionCommitmentResult) LicenseResourceCommitmentResponse { return v.LicenseResource }).(LicenseResourceCommitmentResponseOutput)\n}", "func (m *User) GetLicenseDetails()([]LicenseDetailsable) {\n return m.licenseDetails\n}", "func (mo MediaObject) AsLicense() (*License, bool) {\n\treturn nil, false\n}", "func (m *MicrosoftStoreForBusinessApp) GetLicenseType()(*MicrosoftStoreForBusinessLicenseType) {\n val, err := m.GetBackingStore().Get(\"licenseType\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*MicrosoftStoreForBusinessLicenseType)\n }\n return nil\n}", "func (o *Dig) GetLicenseID() int32 {\n\tif o == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\n\treturn o.LicenseID\n}", "func (ctrler CtrlDefReactor) GetLicenseWatchOptions() *api.ListWatchOptions {\n\tlog.Info(\"GetLicenseWatchOptions is not implemented\")\n\topts := &api.ListWatchOptions{}\n\treturn opts\n}", "func (a *HyperflexApiService) GetHyperflexLicenseByMoid(ctx context.Context, moid string) ApiGetHyperflexLicenseByMoidRequest {\n\treturn ApiGetHyperflexLicenseByMoidRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tmoid: moid,\n\t}\n}", "func AvformatLicense() string {\n\treturn C.GoString(C.avformat_license())\n}", "func GetLicenseFromConfigMap(client *kubernetes.Clientset) (string, error) {\n\tconfigMap, err := client.CoreV1().ConfigMaps(defaults.KubeSystemNamespace).\n\t\tGet(context.TODO(), constants.LicenseConfigMapName, metav1.GetOptions{})\n\tif err != nil {\n\t\treturn \"\", trace.Wrap(rigging.ConvertError(err))\n\t}\n\n\tlicenseData, ok := configMap.Data[constants.LicenseConfigMapName]\n\tif !ok {\n\t\treturn \"\", trace.NotFound(\"no license data in Kubernetes config map\")\n\t}\n\n\treturn licenseData, nil\n}", "func (sra SearchResultsAnswer) AsLicense() (*License, bool) {\n\treturn nil, false\n}", "func GetLicenseKey(licenseKey *string) int {\n\tvar cLicenseKey = getCArray()\n\tstatus := C.GetLicenseKey(&cLicenseKey[0], maxCArrayLength)\n\t*licenseKey = ctoGoString(&cLicenseKey[0])\n\treturn int(status)\n}", "func GetLicenseExpiryDate(expiryDate *uint) int {\n\tvar cExpiryDate C.uint\n\tstatus := C.GetLicenseExpiryDate(&cExpiryDate)\n\t*expiryDate = uint(cExpiryDate)\n\treturn int(status)\n}", "func New(licenseType, licenseText string) *License {\n\tl := &License{\n\t\tType: licenseType,\n\t\tText: licenseText,\n\t}\n\treturn l\n}", "func (client *LicenseStatusClient) Get(uuid string, options ...session.ApiOptionsParams) (*models.LicenseStatus, error) {\n\tvar obj *models.LicenseStatus\n\terr := client.aviSession.Get(client.getAPIPath(uuid), &obj, options...)\n\treturn obj, err\n}", "func GetLicenseCollection(ctx context.Context, req licenseproto.GetLicenseRequest) (*licenseproto.GetLicenseResponse, error) {\n\tctx = common.CreateMetadata(ctx)\n\tconn, err := services.ODIMService.Client(services.Licenses)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to create client connection: %v\", err)\n\t}\n\tdefer conn.Close()\n\tlicenseService := licenseproto.NewLicensesClient(conn)\n\tresp, err := licenseService.GetLicenseCollection(ctx, &req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"RPC error: %v\", err)\n\t}\n\treturn resp, nil\n}", "func (ct *ctrlerCtx) WatchLicense(handler LicenseHandler) error {\n\tkind := \"License\"\n\n\t// see if we already have a watcher\n\tct.Lock()\n\t_, ok := ct.watchCancel[kind]\n\tct.Unlock()\n\tif ok {\n\t\treturn fmt.Errorf(\"License watcher already exists\")\n\t}\n\n\t// save handler\n\tct.Lock()\n\tct.handlers[kind] = handler\n\tct.Unlock()\n\n\t// run License watcher in a go routine\n\tct.runLicenseWatcher()\n\n\treturn nil\n}", "func (d *portworx) GetLicenseSummary() (torpedovolume.LicenseSummary, error) {\n\tlicenseMgr := d.getLicenseManager()\n\tfeatureMgr := d.getLicenseFeatureManager()\n\tlicenseSummary := torpedovolume.LicenseSummary{}\n\n\tlic, err := licenseMgr.Status(d.getContext(), &pxapi.PxLicenseStatusRequest{})\n\tif err != nil {\n\t\treturn licenseSummary, err\n\t}\n\n\tlicenseSummary.SKU = lic.GetStatus().GetSku()\n\tif lic != nil && lic.Status != nil &&\n\t\tlic.Status.GetConditions() != nil &&\n\t\tlen(lic.Status.GetConditions()) > 0 {\n\t\tlicenseSummary.LicenesConditionMsg = lic.Status.GetConditions()[0].GetMessage()\n\t}\n\n\tfeatures, err := featureMgr.Enumerate(d.getContext(), &pxapi.PxLicensedFeatureEnumerateRequest{})\n\tif err != nil {\n\t\treturn licenseSummary, err\n\t}\n\tlicenseSummary.Features = features.GetFeatures()\n\treturn licenseSummary, nil\n}", "func ProvideLicenseRepo(engine *core.Engine) LicenseRepo {\n\treturn LicenseRepo{Engine: engine}\n}", "func (api *API) ListLicenses() (*List, error) {\n\treq, err := http.NewRequest(http.MethodGet, EndpointLicenses, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tapi.authorizeRequest(req)\n\n\tresp, err := api.Client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tswitch resp.StatusCode {\n\tcase 200:\n\t\tbreak\n\tcase 404:\n\t\treturn nil, ErrLicenseNotFound\n\tcase 401:\n\t\treturn nil, ErrUnauthorized\n\tdefault:\n\t\treturn nil, ErrUnknown\n\t}\n\n\tlicenesList := &List{}\n\terr = json.NewDecoder(resp.Body).Decode(licenesList)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn licenesList, nil\n}", "func (o *ClientConfiguration) GetMandatorLicense() MandatorLicense {\n\tif o == nil {\n\t\tvar ret MandatorLicense\n\t\treturn ret\n\t}\n\n\treturn o.MandatorLicense\n}", "func licFromName(commonLicenses []DOILicense, licenseName string) (DOILicense, bool) {\n\tlicname := cleancompstr(licenseName)\n\tfor _, lic := range commonLicenses {\n\t\tfor _, alias := range lic.Alias {\n\t\t\tif licname == strings.ToLower(alias) {\n\t\t\t\treturn lic, true\n\t\t\t}\n\t\t}\n\t}\n\n\tvar emptyLicense DOILicense\n\treturn emptyLicense, false\n}", "func DecodeGetLicenseRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error) {\n\treturn func(r *http.Request) (interface{}, error) {\n\t\tvar (\n\t\t\tlicenseID int\n\t\t\terr error\n\n\t\t\tparams = mux.Vars(r)\n\t\t)\n\t\t{\n\t\t\tlicenseIDRaw := params[\"LicenseID\"]\n\t\t\tv, err2 := strconv.ParseInt(licenseIDRaw, 10, strconv.IntSize)\n\t\t\tif err2 != nil {\n\t\t\t\terr = goa.MergeErrors(err, goa.InvalidFieldTypeError(\"licenseID\", licenseIDRaw, \"integer\"))\n\t\t\t}\n\t\t\tlicenseID = int(v)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewGetLicenseLicenseObject(licenseID)\n\n\t\treturn payload, nil\n\t}\n}", "func (m *SmsLogRow) GetLicenseCapability()(*string) {\n val, err := m.GetBackingStore().Get(\"licenseCapability\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}" ]
[ "0.7090552", "0.6955965", "0.6934079", "0.67250156", "0.67134714", "0.6709287", "0.66754115", "0.65543115", "0.6504969", "0.65022683", "0.6480724", "0.6461949", "0.64575154", "0.6453709", "0.6448852", "0.6417776", "0.6363142", "0.6313223", "0.6278519", "0.6242745", "0.62310004", "0.6208589", "0.6205943", "0.6205669", "0.62025934", "0.6179216", "0.6174353", "0.6133381", "0.6124724", "0.61214787", "0.610836", "0.60810775", "0.6066632", "0.60444427", "0.6012203", "0.60022223", "0.59773004", "0.5963962", "0.5950753", "0.59458333", "0.59142596", "0.590891", "0.5888774", "0.5878751", "0.5870941", "0.5855935", "0.58479095", "0.58454835", "0.583481", "0.58330387", "0.5828616", "0.5823179", "0.5799344", "0.57773715", "0.5772893", "0.57659256", "0.5755419", "0.5750581", "0.57475173", "0.57425874", "0.57389486", "0.5730051", "0.5718968", "0.571781", "0.5692911", "0.56679034", "0.5649487", "0.56330496", "0.5620567", "0.5620567", "0.5620567", "0.5620567", "0.5620567", "0.5598278", "0.55927664", "0.558066", "0.557885", "0.5538301", "0.55302316", "0.5529116", "0.55239004", "0.5519339", "0.5512774", "0.54688555", "0.5456008", "0.54234535", "0.5410318", "0.5407046", "0.5398751", "0.539119", "0.5371671", "0.53599757", "0.53551173", "0.53514713", "0.5335625", "0.5326099", "0.53100747", "0.53099626", "0.5307785", "0.5306133" ]
0.7449262
0
ListLicenses uses the override method ListLicensesFn or the real implementation.
func (c *TestClient) ListLicenses(project string, opts ...ListCallOption) ([]*compute.License, error) { if c.ListLicensesFn != nil { return c.ListLicensesFn(project) } return c.client.ListLicenses(project) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (api *API) ListLicenses() (*List, error) {\n\treq, err := http.NewRequest(http.MethodGet, EndpointLicenses, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tapi.authorizeRequest(req)\n\n\tresp, err := api.Client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tswitch resp.StatusCode {\n\tcase 200:\n\t\tbreak\n\tcase 404:\n\t\treturn nil, ErrLicenseNotFound\n\tcase 401:\n\t\treturn nil, ErrUnauthorized\n\tdefault:\n\t\treturn nil, ErrUnknown\n\t}\n\n\tlicenesList := &List{}\n\terr = json.NewDecoder(resp.Body).Decode(licenesList)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn licenesList, nil\n}", "func (s *LicensesService) ListLicenses(queryParams *ListLicensesQueryParams) (*Licenses, *resty.Response, error) {\n\n\tpath := \"/licenses/\"\n\n\tqueryParamsString, _ := query.Values(queryParams)\n\n\tresponse, err := RestyClient.R().\n\t\tSetQueryString(queryParamsString.Encode()).\n\t\tSetResult(&Licenses{}).\n\t\tGet(path)\n\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tresult := response.Result().(*Licenses)\n\treturn result, response, err\n\n}", "func (gl *GetLicense) ListLicenses(display bool) {\n\tvar licResp licenseResponse\n\t_, body, errs := gl.request.Get(baseLicensesURL).Set(\"Accept\", \"application/vnd.github.drax-preview+json\").End()\n\tcheck(errs)\n\n\terr := json.Unmarshal([]byte(body), &licResp.Licenses)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfor idx, val := range licResp.Licenses {\n\t\toutput, err := normalizeString(val.Key)\n\t\tif err != nil {\n\t\t\tlog.Fatalln(\"Unable to parse string\", val.Key)\n\t\t}\n\t\tgl.licenseMap[output] = val.URL\n\t\tif display == true {\n\t\t\tfmt.Println(idx, \":\", val.Key)\n\t\t}\n\t}\n}", "func (s *SPDX) List() (*LicenseList, error) {\n\tresp, err := s.hc.Get(s.listURL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tvar result LicenseList\n\treturn &result, json.NewDecoder(resp.Body).Decode(&result)\n}", "func ListLicenses(w http.ResponseWriter, r *http.Request, s Server) {\n\tvar page int64\n\tvar per_page int64\n\tvar err error\n\tif r.FormValue(\"page\") != \"\" {\n\t\tpage, err = strconv.ParseInt((r).FormValue(\"page\"), 10, 32)\n\t\tif err != nil {\n\t\t\tproblem.Error(w, r, problem.Problem{Detail: err.Error()}, http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t} else {\n\t\tpage = 1\n\t}\n\tif r.FormValue(\"per_page\") != \"\" {\n\t\tper_page, err = strconv.ParseInt((r).FormValue(\"per_page\"), 10, 32)\n\t\tif err != nil {\n\t\t\tproblem.Error(w, r, problem.Problem{Detail: err.Error()}, http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t} else {\n\t\tper_page = 30\n\t}\n\tif page > 0 { //pagenum starting at 0 in code, but user interface starting at 1\n\t\tpage--\n\t}\n\tif page < 0 {\n\t\tproblem.Error(w, r, problem.Problem{Detail: \"page must be positive integer\"}, http.StatusBadRequest)\n\t\treturn\n\t}\n\tlicenses := make([]license.LicenseReport, 0)\n\t//log.Println(\"ListAll(\" + strconv.Itoa(int(per_page)) + \",\" + strconv.Itoa(int(page)) + \")\")\n\tfn := s.Licenses().ListAll(int(per_page), int(page))\n\tfor it, err := fn(); err == nil; it, err = fn() {\n\t\tlicenses = append(licenses, it)\n\t}\n\tif len(licenses) > 0 {\n\t\tnextPage := strconv.Itoa(int(page) + 1)\n\t\tw.Header().Set(\"Link\", \"</licenses/?page=\"+nextPage+\">; rel=\\\"next\\\"; title=\\\"next\\\"\")\n\t}\n\tif page > 1 {\n\t\tpreviousPage := strconv.Itoa(int(page) - 1)\n\t\tw.Header().Set(\"Link\", \"</licenses/?page=\"+previousPage+\">; rel=\\\"previous\\\"; title=\\\"previous\\\"\")\n\t}\n\tw.Header().Set(\"Content-Type\", api.ContentType_JSON)\n\n\tenc := json.NewEncoder(w)\n\terr = enc.Encode(licenses)\n\tif err != nil {\n\t\tproblem.Error(w, r, problem.Problem{Detail: err.Error()}, http.StatusBadRequest)\n\t\treturn\n\t}\n}", "func (api *licenseAPI) List(ctx context.Context, opts *api.ListWatchOptions) ([]*License, error) {\n\tvar objlist []*License\n\tobjs, err := api.ct.List(\"License\", ctx, opts)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, obj := range objs {\n\t\tswitch tp := obj.(type) {\n\t\tcase *License:\n\t\t\teobj := obj.(*License)\n\t\t\tobjlist = append(objlist, eobj)\n\t\tdefault:\n\t\t\tlog.Fatalf(\"Got invalid object type %v while looking for License\", tp)\n\t\t}\n\t}\n\n\treturn objlist, nil\n}", "func ListLicensesForContent(w http.ResponseWriter, r *http.Request, s Server) {\n\tvars := mux.Vars(r)\n\tvar page int64\n\tvar per_page int64\n\tvar err error\n\tcontentId := vars[\"key\"]\n\t//check if license exists\n\t_, err = s.Index().Get(contentId)\n\tif err == index.NotFound {\n\t\tproblem.Error(w, r, problem.Problem{Detail: err.Error()}, http.StatusNotFound)\n\t\treturn\n\t} //other errors pass, but will probably reoccur\n\tif r.FormValue(\"page\") != \"\" {\n\t\tpage, err = strconv.ParseInt(r.FormValue(\"page\"), 10, 32)\n\t\tif err != nil {\n\t\t\tproblem.Error(w, r, problem.Problem{Detail: err.Error()}, http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t} else {\n\t\tpage = 1\n\t}\n\n\tif r.FormValue(\"per_page\") != \"\" {\n\t\tper_page, err = strconv.ParseInt((r).FormValue(\"per_page\"), 10, 32)\n\t\tif err != nil {\n\t\t\tproblem.Error(w, r, problem.Problem{Detail: err.Error()}, http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t} else {\n\t\tper_page = 30\n\t}\n\tif page > 0 {\n\t\tpage-- //pagenum starting at 0 in code, but user interface starting at 1\n\t}\n\tif page < 0 {\n\t\tproblem.Error(w, r, problem.Problem{Detail: \"page must be positive integer\"}, http.StatusBadRequest)\n\t\treturn\n\t}\n\tlicenses := make([]license.LicenseReport, 0)\n\t//log.Println(\"List(\" + contentId + \",\" + strconv.Itoa(int(per_page)) + \",\" + strconv.Itoa(int(page)) + \")\")\n\tfn := s.Licenses().List(contentId, int(per_page), int(page))\n\tfor it, err := fn(); err == nil; it, err = fn() {\n\t\tlicenses = append(licenses, it)\n\t}\n\tif len(licenses) > 0 {\n\t\tnextPage := strconv.Itoa(int(page) + 1)\n\t\tw.Header().Set(\"Link\", \"</licenses/?page=\"+nextPage+\">; rel=\\\"next\\\"; title=\\\"next\\\"\")\n\t}\n\tif page > 1 {\n\t\tpreviousPage := strconv.Itoa(int(page) - 1)\n\t\tw.Header().Set(\"Link\", \"</licenses/?page=\"+previousPage+\">; rel=\\\"previous\\\"; title=\\\"previous\\\"\")\n\t}\n\tw.Header().Set(\"Content-Type\", api.ContentType_JSON)\n\tenc := json.NewEncoder(w)\n\terr = enc.Encode(licenses)\n\tif err != nil {\n\t\tproblem.Error(w, r, problem.Problem{Detail: err.Error()}, http.StatusBadRequest)\n\t\treturn\n\t}\n\n}", "func (api *licenseAPI) ApisrvList(ctx context.Context, opts *api.ListWatchOptions) ([]*cluster.License, error) {\n\tif api.ct.resolver != nil {\n\t\tapicl, err := api.ct.apiClient()\n\t\tif err != nil {\n\t\t\tapi.ct.logger.Errorf(\"Error creating API server clent. Err: %v\", err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn apicl.ClusterV1().License().List(context.Background(), opts)\n\t}\n\n\t// List from local cache\n\tctkitObjs, err := api.List(ctx, opts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar ret []*cluster.License\n\tfor _, obj := range ctkitObjs {\n\t\tret = append(ret, &obj.License)\n\t}\n\treturn ret, nil\n}", "func (m *MockRepoClient) ListLicenses() ([]clients.License, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListLicenses\")\n\tret0, _ := ret[0].([]clients.License)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (s *ManagedLicensesService) ListManagedLicenses(pid interface{}, options ...RequestOptionFunc) ([]*ManagedLicense, *Response, error) {\n\tproject, err := parseID(pid)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tu := fmt.Sprintf(\"projects/%s/managed_licenses\", PathEscape(project))\n\n\treq, err := s.client.NewRequest(http.MethodGet, u, nil, options)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tvar mls []*ManagedLicense\n\tresp, err := s.client.Do(req, &mls)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn mls, resp, nil\n}", "func (m *MockLicenseDao) ListLicenses() ([]*model.LicenseInfo, error) {\n\tret := m.ctrl.Call(m, \"ListLicenses\")\n\tret0, _ := ret[0].([]*model.LicenseInfo)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (mr *MockRepoClientMockRecorder) ListLicenses() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ListLicenses\", reflect.TypeOf((*MockRepoClient)(nil).ListLicenses))\n}", "func (a *HyperflexApiService) GetHyperflexLicenseList(ctx context.Context) ApiGetHyperflexLicenseListRequest {\n\treturn ApiGetHyperflexLicenseListRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "func (c Client) Licenses() licenses.Client {\n\treturn licenses.NewClient(c...)\n}", "func PrintLicenseList() error {\n\tkeys, err := GetLicenseKeys()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tprintln(\"key : id : name\")\n\tfor _, key := range keys {\n\t\tfmt.Printf(\"%s : %s : %s\\n\", key.Key, key.SpdxID, key.Name)\n\t}\n\treturn nil\n}", "func (project *Project) Licenses() Licenses {\n\treturn project.LicenseList\n}", "func (o AttachedDiskResponseOutput) Licenses() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AttachedDiskResponse) []string { return v.Licenses }).(pulumi.StringArrayOutput)\n}", "func (o SavedAttachedDiskResponseOutput) Licenses() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v SavedAttachedDiskResponse) []string { return v.Licenses }).(pulumi.StringArrayOutput)\n}", "func (client IdentityClient) listAllowedDomainLicenseTypes(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodGet, \"/allowedDomainLicenseTypes\", binaryReqBody, extraHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response ListAllowedDomainLicenseTypesResponse\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 printList(licenses []License) {\n\tsort.Sort(ByLicenseKey(licenses))\n\n\tfmt.Print(\"Available licenses:\\n\\n\")\n\tfor _, l := range licenses {\n\t\tfmt.Printf(\"%s%-14s(%s)\\n\", indent, l.Key, l.Name)\n\t}\n\tfmt.Println()\n}", "func GenerateLicenses(refs []string) []string {\n\tlicenses := []string{}\n\tfor _, license := range refs {\n\t\tlicenses = append(licenses, base64.StdEncoding.EncodeToString([]byte(license)))\n\t}\n\treturn licenses\n}", "func (mr *MockLicenseDaoMockRecorder) ListLicenses() *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ListLicenses\", reflect.TypeOf((*MockLicenseDao)(nil).ListLicenses))\n}", "func (o *V0037JobProperties) SetLicenses(v string) {\n\to.Licenses = &v\n}", "func (a *HyperflexApiService) GetHyperflexLicenseListExecute(r ApiGetHyperflexLicenseListRequest) (*HyperflexLicenseResponse, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue *HyperflexLicenseResponse\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"HyperflexApiService.GetHyperflexLicenseList\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/hyperflex/Licenses\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\tif r.filter != nil {\n\t\tlocalVarQueryParams.Add(\"$filter\", parameterToString(*r.filter, \"\"))\n\t}\n\tif r.orderby != nil {\n\t\tlocalVarQueryParams.Add(\"$orderby\", parameterToString(*r.orderby, \"\"))\n\t}\n\tif r.top != nil {\n\t\tlocalVarQueryParams.Add(\"$top\", parameterToString(*r.top, \"\"))\n\t}\n\tif r.skip != nil {\n\t\tlocalVarQueryParams.Add(\"$skip\", parameterToString(*r.skip, \"\"))\n\t}\n\tif r.select_ != nil {\n\t\tlocalVarQueryParams.Add(\"$select\", parameterToString(*r.select_, \"\"))\n\t}\n\tif r.expand != nil {\n\t\tlocalVarQueryParams.Add(\"$expand\", parameterToString(*r.expand, \"\"))\n\t}\n\tif r.apply != nil {\n\t\tlocalVarQueryParams.Add(\"$apply\", parameterToString(*r.apply, \"\"))\n\t}\n\tif r.count != nil {\n\t\tlocalVarQueryParams.Add(\"$count\", parameterToString(*r.count, \"\"))\n\t}\n\tif r.inlinecount != nil {\n\t\tlocalVarQueryParams.Add(\"$inlinecount\", parameterToString(*r.inlinecount, \"\"))\n\t}\n\tif r.at != nil {\n\t\tlocalVarQueryParams.Add(\"at\", parameterToString(*r.at, \"\"))\n\t}\n\tif r.tags != nil {\n\t\tlocalVarQueryParams.Add(\"tags\", parameterToString(*r.tags, \"\"))\n\t}\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\", \"text/csv\", \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tvar v Error\n\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\tif err != nil {\n\t\t\tnewErr.error = err.Error()\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tnewErr.model = v\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := &GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "func (r *Reader) ReadLicenses(path string) (\n\tlicenseList []*ClassifyResult, unknownPaths []string, err error,\n) {\n\tlicenseFiles, err := r.impl.FindLicenseFiles(path)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"searching for license files: %w\", err)\n\t}\n\n\tlicenseList, unknownPaths, err = r.impl.ClassifyLicenseFiles(licenseFiles)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"classifying found licenses: %w\", err)\n\t}\n\treturn licenseList, unknownPaths, nil\n}", "func (l *LicenseRepository) licensesForQueryAll(ctx context.Context, q string) (*license, error) {\n\tresp, err := l.dg.NewTxn().Query(ctx, q)\n\tif err != nil {\n\t\tlogger.Log.Error(\"dgraph/MetricOPSComputedLicenses - query failed\", zap.Error(err), zap.String(\"query\", q))\n\t\treturn nil, err\n\t}\n\n\ttype totalLicenses struct {\n\t\tLicenses []*license\n\t}\n\n\tdata := &totalLicenses{}\n\n\tif err := json.Unmarshal(resp.Json, data); err != nil {\n\t\tlogger.Log.Error(\"dgraph/MetricOPSComputedLicenses - Unmarshal failed\", zap.Error(err), zap.String(\"query\", q))\n\t\treturn nil, errors.New(\"unmarshal failed\")\n\t}\n\n\tif len(data.Licenses) == 0 {\n\t\treturn nil, v1.ErrNoData\n\t}\n\n\tif len(data.Licenses) == 2 {\n\t\tdata.Licenses[0].LicensesNoCeil = data.Licenses[1].LicensesNoCeil\n\t}\n\n\treturn data.Licenses[0], nil\n}", "func (s *marketplaceAgreementLister) List(selector labels.Selector) (ret []*v1alpha1.MarketplaceAgreement, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.MarketplaceAgreement))\n\t})\n\treturn ret, err\n}", "func (o LookupImageResultOutput) Licenses() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v LookupImageResult) []string { return v.Licenses }).(pulumi.StringArrayOutput)\n}", "func (m *User) GetAssignedLicenses()([]AssignedLicenseable) {\n return m.assignedLicenses\n}", "func (m *Group) GetAssignedLicenses()([]AssignedLicenseable) {\n return m.assignedLicenses\n}", "func searchForLicenses(dirs []string) ([]string, error) {\n\tvar licenses []string\n\n\tfindLicense := func(path string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\treturn nil\n\t\t}\n\n\t\tif !info.Mode().IsRegular() {\n\t\t\treturn nil\n\t\t}\n\n\t\tif strings.Contains(path, \".git\"+pathSeparator) {\n\t\t\treturn nil\n\t\t}\n\n\t\tif !strings.Contains(path, vendirDirMatch) {\n\t\t\treturn nil\n\t\t}\n\n\t\tif strings.HasPrefix(filepath.Base(path), \"LICENSE\") {\n\t\t\tlicenses = append(licenses, path)\n\t\t}\n\n\t\treturn nil\n\t}\n\n\tfor _, d := range dirs {\n\t\tif err := filepath.Walk(d, findLicense); err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"filepath walk failed for dir=%v\", d)\n\t\t}\n\t}\n\n\treturn licenses, nil\n}", "func (c Config) allowsLicense(name string) bool {\n\tfor _, l := range c.Licenses {\n\t\tif l == name {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (*ListOpenSourceLicensesRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{97}\n}", "func GetLicensesFiles() []string {\n\treturn []string{LicenseTxt, LicenseMd, License, Copying, Legal, COPYINGv3,\n\t\tReadme, Ftl, GPLv2, gpl20, Bsdl, Copyright, MITtxt, LisenseRst,\n\t\tLisenceHTML, Licenses2}\n}", "func (o AttachedDiskResponseOutput) UserLicenses() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AttachedDiskResponse) []string { return v.UserLicenses }).(pulumi.StringArrayOutput)\n}", "func (repo *GitHubProject) Licenses() []*License {\n\tif repo.license == nil {\n\t\treturn []*License{}\n\t}\n\treturn []*License{repo.license}\n}", "func ReadCommonLicenses() []DOILicense {\n\t// try to load custom license file from the env var directory\n\tfilepath := filepath.Join(libgin.ReadConf(\"configdir\"), \"doi-licenses.json\")\n\tlicenses, err := licenseFromFile(filepath)\n\tif err == nil {\n\t\tlog.Println(\"Using custom licenses\")\n\t\treturn licenses\n\t}\n\n\t// if a custom license is not available, fetch default licenses\n\tvar defaultLicenses []DOILicense\n\tif err = json.Unmarshal([]byte(defaultLicensesJSON), &defaultLicenses); err == nil {\n\t\tlog.Println(\"Using default licenses\")\n\t\treturn defaultLicenses\n\t}\n\n\t// everything failed, return empty licenses struct\n\tlog.Println(\"Could not load licenses\")\n\tvar emptyLicenses []DOILicense\n\treturn emptyLicenses\n}", "func (*ListOpenSourceLicensesResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{98}\n}", "func (s marketplaceAgreementNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.MarketplaceAgreement, err error) {\n\terr = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.MarketplaceAgreement))\n\t})\n\treturn ret, err\n}", "func (m *User) SetAssignedLicenses(value []AssignedLicenseable)() {\n m.assignedLicenses = value\n}", "func (m *Group) SetAssignedLicenses(value []AssignedLicenseable)() {\n m.assignedLicenses = value\n}", "func (ct *ctrlerCtx) diffLicense(apicl apiclient.Services) {\n\topts := api.ListWatchOptions{}\n\n\t// get a list of all objects from API server\n\tobjlist, err := apicl.ClusterV1().License().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(\"diffLicense(): LicenseList returned %d objects\", len(objlist))\n\n\t// build an object map\n\tobjmap := make(map[string]*cluster.License)\n\tfor _, obj := range objlist {\n\t\tobjmap[obj.GetKey()] = obj\n\t}\n\n\tlist, err := ct.License().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(\"diffLicense(): 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.License,\n\t\t\t}\n\t\t\tct.handleLicenseEvent(&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(\"diffLicense(): 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.handleLicenseEvent(&evt)\n\t}\n}", "func (o *V0037JobProperties) GetLicenses() string {\n\tif o == nil || o.Licenses == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Licenses\n}", "func (o LookupImageResultOutput) UserLicenses() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v LookupImageResult) []string { return v.UserLicenses }).(pulumi.StringArrayOutput)\n}", "func (l License) MarshalJSON() ([]byte, error) {\n\tl.Type = TypeLicense\n\tobjectMap := make(map[string]interface{})\n\tif l.ThumbnailURL != nil {\n\t\tobjectMap[\"thumbnailUrl\"] = l.ThumbnailURL\n\t}\n\tif l.Provider != nil {\n\t\tobjectMap[\"provider\"] = l.Provider\n\t}\n\tif l.Text != nil {\n\t\tobjectMap[\"text\"] = l.Text\n\t}\n\tif l.Name != nil {\n\t\tobjectMap[\"name\"] = l.Name\n\t}\n\tif l.URL != nil {\n\t\tobjectMap[\"url\"] = l.URL\n\t}\n\tif l.Image != nil {\n\t\tobjectMap[\"image\"] = l.Image\n\t}\n\tif l.Description != nil {\n\t\tobjectMap[\"description\"] = l.Description\n\t}\n\tif l.EntityPresentationInfo != nil {\n\t\tobjectMap[\"entityPresentationInfo\"] = l.EntityPresentationInfo\n\t}\n\tif l.BingID != nil {\n\t\tobjectMap[\"bingId\"] = l.BingID\n\t}\n\tif l.ContractualRules != nil {\n\t\tobjectMap[\"contractualRules\"] = l.ContractualRules\n\t}\n\tif l.WebSearchURL != nil {\n\t\tobjectMap[\"webSearchUrl\"] = l.WebSearchURL\n\t}\n\tif l.ID != nil {\n\t\tobjectMap[\"id\"] = l.ID\n\t}\n\tif l.Type != \"\" {\n\t\tobjectMap[\"_type\"] = l.Type\n\t}\n\treturn json.Marshal(objectMap)\n}", "func licenseFromFile(filepath string) ([]DOILicense, error) {\n\tfp, err := os.Open(filepath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer fp.Close()\n\n\tjdata, err := ioutil.ReadAll(fp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar licenses []DOILicense\n\tif err = json.Unmarshal(jdata, &licenses); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn licenses, nil\n}", "func (s *CreativeCommonsService) List(opt ...CallOption) ([]*CreativeCommon, *Response, error) {\n\tu, err := addOptions(\"creativecommons\", opt...)\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\n\tcommons := &creativeCommonList{}\n\n\tresp, err := s.client.Do(req, commons)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\tresp.setPaging(commons)\n\n\treturn commons.Data, resp, err\n}", "func getCombinedLicenses(licensePaths []string, importPaths map[string]string) []License {\n\tlicenses := make([]License, 1)\n\tfor pkg, ipath := range importPaths {\n\t\tfoundLicense := false\n\t\tfor _, lpath := range licensePaths {\n\t\t\tif filepath.Dir(lpath) == ipath || strings.HasPrefix(ipath, filepath.Dir(lpath)) {\n\t\t\t\tupdatedLicense := false\n\t\t\t\tfor idx, _ := range licenses {\n\t\t\t\t\tif licenses[idx].Path == lpath {\n\t\t\t\t\t\tlicenses[idx].Imports = append(licenses[idx].Imports, pkg)\n\t\t\t\t\t\tupdatedLicense = true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif !updatedLicense {\n\t\t\t\t\tlicenses = append(licenses, License{lpath, []string{pkg}})\n\t\t\t\t}\n\t\t\t\tfoundLicense = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !foundLicense {\n\t\t\tlicenses[0].Imports = append(licenses[0].Imports, pkg)\n\t\t}\n\t}\n\treturn licenses\n}", "func licFromName(commonLicenses []DOILicense, licenseName string) (DOILicense, bool) {\n\tlicname := cleancompstr(licenseName)\n\tfor _, lic := range commonLicenses {\n\t\tfor _, alias := range lic.Alias {\n\t\t\tif licname == strings.ToLower(alias) {\n\t\t\t\treturn lic, true\n\t\t\t}\n\t\t}\n\t}\n\n\tvar emptyLicense DOILicense\n\treturn emptyLicense, false\n}", "func GetLicenseCollection(ctx context.Context, req licenseproto.GetLicenseRequest) (*licenseproto.GetLicenseResponse, error) {\n\tctx = common.CreateMetadata(ctx)\n\tconn, err := services.ODIMService.Client(services.Licenses)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to create client connection: %v\", err)\n\t}\n\tdefer conn.Close()\n\tlicenseService := licenseproto.NewLicensesClient(conn)\n\tresp, err := licenseService.GetLicenseCollection(ctx, &req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"RPC error: %v\", err)\n\t}\n\treturn resp, nil\n}", "func (c *AccessPackageCatalogClient) List(ctx context.Context, query odata.Query) (*[]AccessPackageCatalog, int, error) {\n\tresp, status, _, err := c.BaseClient.Get(ctx, GetHttpRequestInput{\n\t\tDisablePaging: query.Top > 0,\n\t\tOData: query,\n\t\tValidStatusCodes: []int{http.StatusOK},\n\t\tUri: Uri{\n\t\t\tEntity: \"/identityGovernance/entitlementManagement/catalogs\",\n\t\t\tHasTenantId: true,\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn nil, status, fmt.Errorf(\"AccessPackageCatalogClient.BaseClient.Get(): %v\", err)\n\t}\n\n\tdefer resp.Body.Close()\n\trespBody, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, status, fmt.Errorf(\"io.ReadAll(): %v\", err)\n\t}\n\n\tvar data struct {\n\t\tAccessPackageCatalogs []AccessPackageCatalog `json:\"value\"`\n\t}\n\tif err := json.Unmarshal(respBody, &data); err != nil {\n\t\treturn nil, status, fmt.Errorf(\"json.Unmarshal(): %v\", err)\n\t}\n\n\treturn &data.AccessPackageCatalogs, status, nil\n}", "func (s *Server) getLicense(w http.ResponseWriter, r *http.Request) {\n\twriteXML(w, func(c *container) {\n\t\t// A license that indicates valid \"true\" allows Subsonic\n\t\t// clients to connect to this server\n\t\tc.License = &license{Valid: true}\n\t})\n}", "func (a *API) ListLicenseProperties(namespacePrefix, namePrefix string) (objects.Properties, error) {\n\tvar resp objects.Properties\n\terr := a.Call(\"list_license_properties\", &listLicensePropertiesRequest{\n\t\tNamespacePrefix: namespacePrefix,\n\t\tNamePrefix: namePrefix,\n\t}, &resp)\n\treturn resp, err\n}", "func (m *User) GetLicenseDetails()([]LicenseDetailsable) {\n return m.licenseDetails\n}", "func (lb *ListBuilder) List() *CSPIList {\n\tif lb.filters == nil || len(lb.filters) == 0 {\n\t\treturn lb.CSPList\n\t}\n\tfiltered := NewListBuilder().List()\n\tfor _, cspAPI := range lb.CSPList.ObjectList.Items {\n\t\tcspAPI := cspAPI // pin it\n\t\tcsp := BuilderForAPIObject(&cspAPI).CSPI\n\t\tif lb.filters.all(csp) {\n\t\t\tfiltered.ObjectList.Items = append(filtered.ObjectList.Items, *csp.Object)\n\t\t}\n\t}\n\treturn filtered\n}", "func (client AccountClient) ListBySubscription(ctx context.Context) (result AccountResourceDescriptionListPage, err error) {\n if tracing.IsEnabled() {\n ctx = tracing.StartSpan(ctx, fqdn + \"/AccountClient.ListBySubscription\")\n defer func() {\n sc := -1\n if result.ardl.Response.Response != nil {\n sc = result.ardl.Response.Response.StatusCode\n }\n tracing.EndSpan(ctx, sc, err)\n }()\n }\n result.fn = client.listBySubscriptionNextResults\n req, err := client.ListBySubscriptionPreparer(ctx)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"microsoftazuremanagementaisupercomputer.AccountClient\", \"ListBySubscription\", nil , \"Failure preparing request\")\n return\n }\n\n resp, err := client.ListBySubscriptionSender(req)\n if err != nil {\n result.ardl.Response = autorest.Response{Response: resp}\n err = autorest.NewErrorWithError(err, \"microsoftazuremanagementaisupercomputer.AccountClient\", \"ListBySubscription\", resp, \"Failure sending request\")\n return\n }\n\n result.ardl, err = client.ListBySubscriptionResponder(resp)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"microsoftazuremanagementaisupercomputer.AccountClient\", \"ListBySubscription\", resp, \"Failure responding to request\")\n }\n if result.ardl.hasNextLink() && result.ardl.IsEmpty() {\n err = result.NextWithContext(ctx)\n }\n\n return\n}", "func newLicenseRequests(c *ProxyserverV1alpha1Client) *licenseRequests {\n\treturn &licenseRequests{\n\t\tclient: c.RESTClient(),\n\t}\n}", "func (s *SPDX) License(id string) (*License, error) {\n\tresp, err := s.hc.Get(fmt.Sprintf(s.detailsURL, id))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tvar result License\n\tif err := json.NewDecoder(resp.Body).Decode(&result); err != nil {\n\t\treturn nil, err\n\t}\n\n\trespDetails, err := s.hc.Get(result.DetailsURL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer respDetails.Body.Close()\n\n\tvar details Details\n\tif err := json.NewDecoder(respDetails.Body).Decode(&details); err != nil {\n\t\treturn nil, err\n\t}\n\tresult.Details = details\n\n\treturn &result, nil\n}", "func provideLicense(client *scm.Client, config config.Config) *core.License {\n\tl, err := license.Load(config.License)\n\tif config.License == \"\" {\n\t\tl = license.Trial(client.Driver.String())\n\t} else if err != nil {\n\t\tlogrus.WithError(err).\n\t\t\tFatalln(\"main: invalid or expired license\")\n\t}\n\tlogrus.WithFields(\n\t\tlogrus.Fields{\n\t\t\t\"kind\": l.Kind,\n\t\t\t\"expires\": l.Expires,\n\t\t\t\"repo.limit\": l.Repos,\n\t\t\t\"user.limit\": l.Users,\n\t\t\t\"build.limit\": l.Builds,\n\t\t},\n\t).Debugln(\"main: license loaded\")\n\treturn l\n}", "func (o LookupImageResultOutput) LicenseCodes() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v LookupImageResult) []string { return v.LicenseCodes }).(pulumi.StringArrayOutput)\n}", "func (s *cloudfrontDistributionLister) List(selector labels.Selector) (ret []*v1alpha1.CloudfrontDistribution, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.CloudfrontDistribution))\n\t})\n\treturn ret, err\n}", "func GetContractsByList(filepath string) {\n\terr := commonGetContracts(filepath)\n\tif err != nil {\n\t\tfmt.Println(\"Error:\", err)\n\t}\n\treturn\n}", "func licFromURL(commonLicenses []DOILicense, licenseURL string) (DOILicense, bool) {\n\turl := cleancompstr(licenseURL)\n\tfor _, lic := range commonLicenses {\n\t\t// provided licenses URLs can be more verbose than the default license URL\n\t\tif strings.Contains(url, strings.ToLower(lic.URL)) {\n\t\t\treturn lic, true\n\t\t}\n\t}\n\n\tvar emptyLicense DOILicense\n\treturn emptyLicense, false\n}", "func (l *LicenseRepository) licensesForQuery(ctx context.Context, q string) (uint64, error) {\n\tlic, err := l.licensesForQueryAll(ctx, q)\n\tif err != nil && err == v1.ErrNoData {\n\t\tlogger.Log.Error(\"repo-dgraph/licensesForQuery licensesForQueryAll - no licesnse were found for query\")\n\t\treturn 0, nil\n\t} else if err != nil {\n\t\treturn 0, err\n\t}\n\treturn uint64(lic.Licenses), nil\n}", "func (o LicenseOutput) License() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *License) pulumi.StringOutput { return v.License }).(pulumi.StringOutput)\n}", "func (m *MockProduct) GetSharedLicenses(arg0 context.Context, arg1 db.GetSharedLicensesParams) ([]db.SharedLicense, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetSharedLicenses\", arg0, arg1)\n\tret0, _ := ret[0].([]db.SharedLicense)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (client ServicesClient) ListBySubscriptionResponder(resp *http.Response) (result ServiceResourceList, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "func (ss *SubscriptionsService) List(ctx context.Context, cID string, opts *SubscriptionListOptions) (\n\tres *Response,\n\tsl *SubscriptionList,\n\terr error,\n) {\n\tu := fmt.Sprintf(\"v2/customers/%s/subscriptions\", cID)\n\n\tres, err = ss.list(ctx, u, opts)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif err = json.Unmarshal(res.content, &sl); err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "func (b *ListBuilder) List() *CSPList {\n\treturn b.CspList\n}", "func (m *License) Validate(formats strfmt.Registry) error {\n\tvar res []error\n\n\tif err := m.validateExpireDate(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.validateLicenseSerial(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateMaxChunkNum(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateMaxClusterNum(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateSignDate(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateSoftwareEdition(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif err := m.validateType(formats); err != nil {\n\t\tres = append(res, err)\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "func GetLicensesFilesPrefix() []string {\n\treturn []string{LicenseDot, CopyingDot, Copyright, CopyingDash}\n}", "func (client *LicenseStatusClient) GetAll(options ...session.ApiOptionsParams) ([]*models.LicenseStatus, error) {\n\tvar plist []*models.LicenseStatus\n\terr := client.aviSession.GetCollection(client.getAPIPath(\"\"), &plist, options...)\n\treturn plist, err\n}", "func (client ServicesClient) ListBySubscription(ctx context.Context) (result ServiceResourceListPage, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ServicesClient.ListBySubscription\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.srl.Response.Response != nil {\n\t\t\t\tsc = result.srl.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tresult.fn = client.listBySubscriptionNextResults\n\treq, err := client.ListBySubscriptionPreparer(ctx)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"appplatform.ServicesClient\", \"ListBySubscription\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.ListBySubscriptionSender(req)\n\tif err != nil {\n\t\tresult.srl.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"appplatform.ServicesClient\", \"ListBySubscription\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult.srl, err = client.ListBySubscriptionResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"appplatform.ServicesClient\", \"ListBySubscription\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\tif result.srl.hasNextLink() && result.srl.IsEmpty() {\n\t\terr = result.NextWithContext(ctx)\n\t\treturn\n\t}\n\n\treturn\n}", "func (s cloudfrontDistributionNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.CloudfrontDistribution, err error) {\n\terr = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.CloudfrontDistribution))\n\t})\n\treturn ret, err\n}", "func licenseWarnings(yada *libgin.RepositoryYAML, repoLicenseURL string, warnings []string) []string {\n\t// check datacite license URL, name and license file title to spot mismatches\n\tcommonLicenses := ReadCommonLicenses()\n\n\t// check if the datacite license can be matched to a common license via URL\n\tlicenseURL, ok := licFromURL(commonLicenses, yada.License.URL)\n\tif !ok {\n\t\twarnings = append(warnings, fmt.Sprintf(\"License URL (datacite) not found: '%s'\", yada.License.URL))\n\t}\n\n\t// check if the license can be matched to a common license via datacite license name\n\tlicenseName, ok := licFromName(commonLicenses, yada.License.Name)\n\tif !ok {\n\t\twarnings = append(warnings, fmt.Sprintf(\"License name (datacite) not found: '%s'\", yada.License.Name))\n\t}\n\n\t// check if the license can be matched to a common license via the header line of the license file\n\tvar licenseHeader DOILicense\n\tcontent, err := readFileAtURL(repoLicenseURL)\n\tif err != nil {\n\t\twarnings = append(warnings, \"Could not access license file\")\n\t} else {\n\t\theadstr := string(content)\n\t\tfileHeader := strings.Split(strings.Replace(headstr, \"\\r\\n\", \"\\n\", -1), \"\\n\")\n\t\tvar ok bool // false if fileHeader 0 or licFromName returns !ok\n\t\tif len(fileHeader) > 0 {\n\t\t\tlicenseHeader, ok = licFromName(commonLicenses, fileHeader[0])\n\t\t}\n\t\tif !ok {\n\t\t\t// Limit license file content in warning message\n\t\t\tif len(headstr) > 20 {\n\t\t\t\theadstr = fmt.Sprintf(\"%s...\", headstr[0:20])\n\t\t\t}\n\t\t\twarnings = append(warnings, fmt.Sprintf(\"License file content header not found: '%s'\", headstr))\n\t\t}\n\t}\n\n\t// check license URL against license name\n\tif licenseURL.Name != licenseName.Name {\n\t\twarnings = append(warnings, fmt.Sprintf(\"License URL/Name mismatch: '%s'/'%s'\", licenseURL.Name, licenseName.Name))\n\t}\n\n\t// check license name against license file header\n\tif licenseName.Name != licenseHeader.Name {\n\t\twarnings = append(warnings, fmt.Sprintf(\"License name/file header mismatch: '%s'/'%s'\", licenseName.Name, licenseHeader.Name))\n\t}\n\n\treturn warnings\n}", "func (api *distributedservicecardAPI) ApisrvList(ctx context.Context, opts *api.ListWatchOptions) ([]*cluster.DistributedServiceCard, error) {\n\tif api.ct.resolver != nil {\n\t\tapicl, err := api.ct.apiClient()\n\t\tif err != nil {\n\t\t\tapi.ct.logger.Errorf(\"Error creating API server clent. Err: %v\", err)\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn apicl.ClusterV1().DistributedServiceCard().List(context.Background(), opts)\n\t}\n\n\t// List from local cache\n\tctkitObjs, err := api.List(ctx, opts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar ret []*cluster.DistributedServiceCard\n\tfor _, obj := range ctkitObjs {\n\t\tret = append(ret, &obj.DistributedServiceCard)\n\t}\n\treturn ret, nil\n}", "func (client AccountClient) ListBySubscriptionResponder(resp *http.Response) (result AccountResourceDescriptionList, err error) {\n err = autorest.Respond(\n resp,\n azure.WithErrorUnlessStatusCode(http.StatusOK),\n autorest.ByUnmarshallingJSON(&result),\n autorest.ByClosing())\n result.Response = autorest.Response{Response: resp}\n return\n }", "func GenerateBetterLicenses(user string, refs []string) []string {\n\n\tlicenses := []string{}\n\thd := hashids.NewData()\n\thd.MinLength = 30\n\n\tfor _, license := range refs {\n\t\thd.Salt = fmt.Sprintf(\"%s:%s\", user, license)\n\t\th, _ := hashids.NewWithData(hd)\n\t\te, _ := h.Encode([]int{45, 434, 1313, 99})\n\n\t\tlicenses = append(licenses, e)\n\t}\n\treturn licenses\n}", "func GetNSLicense(c *NitroClient, querystring string) (NSAPIResponse, error) {\n\tcfg, err := c.GetConfig(\"nslicense\", querystring)\n\tif err != nil {\n\t\treturn NSAPIResponse{}, err\n\t}\n\n\tvar response = new(NSAPIResponse)\n\n\terr = json.Unmarshal(cfg, &response)\n\tif err != nil {\n\t\treturn NSAPIResponse{}, errors.Wrap(err, \"error unmarshalling response body\")\n\t}\n\n\treturn *response, nil\n}", "func (r ApiGetHyperflexLicenseListRequest) Count(count bool) ApiGetHyperflexLicenseListRequest {\n\tr.count = &count\n\treturn r\n}", "func ListLocal() error {\n\tlicenses, err := getLocalList()\n\n\tif err != nil {\n\t\treturn newErrReadFailed()\n\t}\n\n\tprintList(licenses)\n\treturn nil\n}", "func (a *HyperflexApiService) GetHyperflexSoftwareDistributionVersionList(ctx context.Context) ApiGetHyperflexSoftwareDistributionVersionListRequest {\n\treturn ApiGetHyperflexSoftwareDistributionVersionListRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "func (m *MockProduct) GetAvailableAcqLicenses(arg0 context.Context, arg1 db.GetAvailableAcqLicensesParams) (int32, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetAvailableAcqLicenses\", arg0, arg1)\n\tret0, _ := ret[0].(int32)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (a SecretAclsAPI) List(scope string) ([]ACLItem, error) {\n\tvar aclItem struct {\n\t\tItems []ACLItem `json:\"items,omitempty\"`\n\t}\n\terr := a.client.Get(\"/secrets/acls/list\", map[string]string{\n\t\t\"scope\": scope,\n\t}, &aclItem)\n\treturn aclItem.Items, err\n}", "func (m *Master) ListThirdPartyResources() []string {\n\tm.thirdPartyResourcesLock.RLock()\n\tdefer m.thirdPartyResourcesLock.RUnlock()\n\tresult := []string{}\n\tfor key := range m.thirdPartyResources {\n\t\tresult = append(result, key)\n\t}\n\treturn result\n}", "func (s *service) List() (*Collection, error) {\n\ti, err := s.repo.List()\n\tif err != nil {\n\t\treturn nil, log.Errors(ErrPaymentLookup, err)\n\t}\n\n\tl, ok := i.(*Collection)\n\tif !ok {\n\t\treturn nil, log.Errors(ErrValidationFailed)\n\t}\n\n\treturn l, nil\n}", "func (a *Client) ListScopes(params *ListScopesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListScopesOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewListScopesParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"listScopes\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/api/v1/customers/{cUUID}/runtime_config/scopes\",\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: &ListScopesReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*ListScopesOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for listScopes: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func License() string {\n\treturn \"Licensed under the Apache License 2.0\"\n}", "func License() string {\n\treturn \"Licensed under the Apache License 2.0\"\n}", "func License() string {\n\treturn \"Licensed under the Apache License 2.0\"\n}", "func License() string {\n\treturn \"Licensed under the Apache License 2.0\"\n}", "func License() string {\n\treturn \"Licensed under the Apache License 2.0\"\n}", "func (b *ListBuilder) List() (*CSPCList, error) {\n\tif len(b.errs) > 0 {\n\t\treturn nil, errors.Errorf(\"failed to list cspc: %+v\", b.errs)\n\t}\n\tif b.filters == nil || len(b.filters) == 0 {\n\t\treturn b.list, nil\n\t}\n\tfilteredList := &CSPCList{}\n\tfor _, cspc := range b.list.items {\n\t\tif b.filters.all(cspc) {\n\t\t\tfilteredList.items = append(filteredList.items, cspc)\n\t\t}\n\t}\n\treturn filteredList, nil\n}", "func (License) Values() []License {\n\treturn []License{\n\t\t\"Basic\",\n\t\t\"Plus\",\n\t\t\"Pro\",\n\t\t\"ProTrial\",\n\t}\n}", "func (r *CseService) List(q string) *CseListCall {\n\tc := &CseListCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.urlParams_.Set(\"q\", q)\n\treturn c\n}", "func (s *salesforceSourceLister) List(selector labels.Selector) (ret []*v1alpha1.SalesforceSource, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.SalesforceSource))\n\t})\n\treturn ret, err\n}", "func (ctrler CtrlDefReactor) GetLicenseWatchOptions() *api.ListWatchOptions {\n\tlog.Info(\"GetLicenseWatchOptions is not implemented\")\n\topts := &api.ListWatchOptions{}\n\treturn opts\n}", "func (m *MockProduct) ListAcqrightsProductsByScope(arg0 context.Context, arg1 string) ([]db.ListAcqrightsProductsByScopeRow, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListAcqrightsProductsByScope\", arg0, arg1)\n\tret0, _ := ret[0].([]db.ListAcqrightsProductsByScopeRow)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (l *LicenseRepository) MetricOPSComputedLicenses(ctx context.Context, id string, mat *v1.MetricOPSComputed, scopes ...string) (uint64, error) {\n\tq := queryBuilder(mat, scopes, id)\n\tfmt.Println(q)\n\tlicenses, err := l.licensesForQuery(ctx, q)\n\tif err != nil {\n\t\tlogger.Log.Error(\"dgraph/MetricOPSComputedLicenses - query failed\", zap.Error(err), zap.String(\"query\", q))\n\t\treturn 0, errors.New(\"dgraph/MetricOPSComputedLicenses - query failed\")\n\t}\n\n\treturn licenses, nil\n}", "func (c *CommerceController) List(ctx *app.ListCommerceContext) error {\n\taggOptions, err := aggregateOptionsFromCommerceOptions(ctx.Payload.Conditions)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\to := model.ListOptions{\n\t\tAggregateOptions: aggOptions,\n\t\tSelectFields: ctx.Payload.SelectFields,\n\t}\n\n\tcrc, err := c.CommerceStorage.List(o)\n\tif err != nil {\n\t\treturn err\n\t}\n\tmt, err := CommerceRowCollection(crc).ToMediaType()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn ctx.OK(mt)\n}" ]
[ "0.82132787", "0.8122132", "0.77634954", "0.7607033", "0.7551099", "0.74149233", "0.72158426", "0.7214003", "0.7057637", "0.68564796", "0.6803903", "0.6795801", "0.66743034", "0.65227604", "0.6411051", "0.6395375", "0.61511445", "0.6122633", "0.61224246", "0.6100722", "0.60902876", "0.60623705", "0.59788066", "0.5938769", "0.5906188", "0.5902253", "0.5894035", "0.5857911", "0.582309", "0.58030427", "0.5734907", "0.5696847", "0.56952775", "0.56289077", "0.5620182", "0.56056166", "0.55949354", "0.5588513", "0.55740696", "0.5563071", "0.5525501", "0.54690605", "0.5438667", "0.5396264", "0.5371301", "0.5364999", "0.5337299", "0.52904975", "0.5274588", "0.52643996", "0.5232295", "0.52054995", "0.5189864", "0.5189015", "0.51875323", "0.5183895", "0.51641417", "0.5152699", "0.512703", "0.5123018", "0.5106867", "0.5105472", "0.5091933", "0.506367", "0.5058273", "0.505795", "0.50551295", "0.50345623", "0.5028822", "0.5012861", "0.501079", "0.499366", "0.49807122", "0.49492696", "0.4940682", "0.49381673", "0.4936269", "0.49319512", "0.49286935", "0.49164665", "0.49051422", "0.49043468", "0.49013475", "0.4897992", "0.48967412", "0.48953792", "0.48921356", "0.48874027", "0.48874027", "0.48874027", "0.48874027", "0.48874027", "0.48843", "0.48796886", "0.4870218", "0.4869084", "0.48606807", "0.4856482", "0.48558912", "0.48490745" ]
0.81073403
2
GetNetwork uses the override method GetNetworkFn or the real implementation.
func (c *TestClient) GetNetwork(project, name string) (*compute.Network, error) { if c.GetNetworkFn != nil { return c.GetNetworkFn(project, name) } return c.client.GetNetwork(project, name) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (gw *Gateway) GetNetwork(name string) (*Network, error) {\n\tvar channelProvider context.ChannelProvider\n\tif gw.options.Identity != nil {\n\t\tchannelProvider = gw.sdk.ChannelContext(name, fabsdk.WithIdentity(gw.options.Identity), fabsdk.WithOrg(gw.org))\n\t} else {\n\t\tchannelProvider = gw.sdk.ChannelContext(name, fabsdk.WithUser(gw.options.User), fabsdk.WithOrg(gw.org))\n\t}\n\treturn newNetwork(gw, channelProvider)\n}", "func (_class PIFClass) GetNetwork(sessionID SessionRef, self PIFRef) (_retval NetworkRef, _err error) {\n\t_method := \"PIF.get_network\"\n\t_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"session_id\"), sessionID)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_selfArg, _err := convertPIFRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"self\"), self)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_retval, _err = convertNetworkRefToGo(_method + \" -> \", _result.Value)\n\treturn\n}", "func (c *Client) GetNetwork() (*peer.Network, error) {\n\tnetwork := &peer.Network{}\n\treturn network, c.Get(\"/\", network)\n}", "func GetNetwork() (network build.Network, err error) {\n\tenv, err := agoraenv.FromEnvVariable()\n\tif err != nil {\n\t\treturn build.Network{}, err\n\t}\n\n\tswitch env {\n\tcase agoraenv.AgoraEnvironmentProd:\n\t\treturn prodNetwork, nil\n\tdefault:\n\t\treturn testNetwork, nil\n\t}\n}", "func GetNetwork() *Network {\n\tonce.Do(func() {\n\t\tinstance = unmarshalNetwork()\n\t})\n\treturn instance\n}", "func (s *Server) GetNetwork(w http.ResponseWriter, req *http.Request) {\n\ts.JSON(w, http.StatusOK, s.network)\n}", "func GetNetwork(ctx *pulumi.Context,\n\tname string, id pulumi.ID, state *NetworkState, opts ...pulumi.ResourceOpt) (*Network, error) {\n\tinputs := make(map[string]interface{})\n\tif state != nil {\n\t\tinputs[\"attachable\"] = state.Attachable\n\t\tinputs[\"checkDuplicate\"] = state.CheckDuplicate\n\t\tinputs[\"driver\"] = state.Driver\n\t\tinputs[\"ingress\"] = state.Ingress\n\t\tinputs[\"internal\"] = state.Internal\n\t\tinputs[\"ipamConfigs\"] = state.IpamConfigs\n\t\tinputs[\"ipamDriver\"] = state.IpamDriver\n\t\tinputs[\"ipv6\"] = state.Ipv6\n\t\tinputs[\"labels\"] = state.Labels\n\t\tinputs[\"name\"] = state.Name\n\t\tinputs[\"options\"] = state.Options\n\t\tinputs[\"scope\"] = state.Scope\n\t}\n\ts, err := ctx.ReadResource(\"docker:index/network:Network\", name, id, inputs, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Network{s: s}, nil\n}", "func GetNetworker(opts ...options.OptionFunc) Networker {\n\topt := options.BuildOptions(opts)\n\tinternet := &Internet{\n\t\tfakerOption: *opt,\n\t}\n\treturn internet\n}", "func GetNetwork(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *NetworkState, opts ...pulumi.ResourceOption) (*Network, error) {\n\tvar resource Network\n\terr := ctx.ReadResource(\"openstack:networking/network:Network\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (vc *client) GetNetwork(networkPath string) (object.NetworkReference, error) {\n\tlog.Info(fmt.Sprintf(\"Getting Network `%s`\", networkPath))\n\n\tnetwork, err := vc.finder.Network(vc.context, networkPath)\n\tif err != nil {\n\t\tlog.Error(err, fmt.Sprintf(\"Error getting Network `%s`\", networkPath))\n\t\treturn nil, err\n\t}\n\n\treturn network, nil\n}", "func (r *ComputeFirewallRuleResource) Network() string {\n\treturn r.f.Network\n}", "func (t *KCPTransport) GetNetwork() string {\n\treturn \"udp\"\n}", "func (o RegionNetworkEndpointGroupOutput) Network() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *RegionNetworkEndpointGroup) pulumi.StringPtrOutput { return v.Network }).(pulumi.StringPtrOutput)\n}", "func GetNetwork(ctx context.Context, ID string) (types.NetworkResource, error) {\n\tdocker, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())\n\tif err != nil {\n\t\tlog.Errorln(\"Failed to create docker client\")\n\t\treturn types.NetworkResource{}, err\n\t}\n\tdefer docker.Close()\n\treturn docker.NetworkInspect(ctx, ID, types.NetworkInspectOptions{})\n}", "func (c *Client) GetNetwork(id string) (*Network, error) {\n\treq, err := http.NewRequest(\"GET\", hetznerAPIBaseURL+\"/networks/\"+id, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating request: %w\", err)\n\t}\n\treq.Header.Add(\"Authorization\", \"Bearer \"+c.hCloudToken)\n\tresp, err := c.httpClient.Do(req)\n\tif err != nil {\n\t\tvar neterr net.Error\n\t\tif errors.As(err, &neterr) && (neterr.Timeout() || neterr.Temporary()) {\n\t\t\treturn nil, &errorx.RetryableError{Message: \"timeout or temporary error in HTTP request\", Err: neterr}\n\t\t}\n\t\treturn nil, fmt.Errorf(\"error in http request: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != 200 {\n\t\treturn nil, fmt.Errorf(\"unexpected status code %d != 200\", resp.StatusCode)\n\t}\n\tvar rawNetwork struct {\n\t\tNetwork struct {\n\t\t\tIPRange string `json:\"ip_range\"`\n\t\t\tSubnets []struct {\n\t\t\t\tGateway string `json:\"gateway\"`\n\t\t\t} `json:\"subnets\"`\n\t\t} `json:\"network\"`\n\t}\n\tdecoder := json.NewDecoder(resp.Body)\n\terr = decoder.Decode(&rawNetwork)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error unmarshalling JSON: %w\", err)\n\t}\n\tif len(rawNetwork.Network.Subnets) != 1 {\n\t\treturn nil, fmt.Errorf(\"invalid number of subnets for network %s: %d != 1\", id, len(rawNetwork.Network.Subnets))\n\t}\n\tnetwork := Network{IPRange: rawNetwork.Network.IPRange, GatewayIP: rawNetwork.Network.Subnets[0].Gateway}\n\treturn &network, nil\n}", "func (s *Stack) GetNetwork(ref string) (*abstract.Network, fail.Error) {\n\tnets, err := s.ListNetworks()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, net := range nets {\n\t\tif net.ID == ref {\n\t\t\treturn net, nil\n\t\t}\n\t}\n\n\treturn nil, abstract.ResourceNotFoundError(\"network\", ref)\n}", "func NetworkGet(w http.ResponseWriter, r *http.Request) {\n\tresp, err := goreq.Request{\n\t\tMethod: \"GET\",\n\t\tUri: remoteURL + \"/networks/current\",\n\t}.Do()\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer resp.Body.Close()\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.WriteHeader(resp.StatusCode)\n\tbody, _ := ioutil.ReadAll(resp.Body)\n\tw.Write(body)\n}", "func (c *Client) GetNetwork(id string) ([]byte, error) {\n\treturn c.doGet(fmt.Sprintf(\"/%s/%s\", master.GetNetworkRESTEndpoint, id))\n}", "func (o LookupRegionNetworkEndpointGroupResultOutput) Network() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupRegionNetworkEndpointGroupResult) string { return v.Network }).(pulumi.StringOutput)\n}", "func (o *Transfer) GetNetwork() TransferNetwork {\n\tif o == nil {\n\t\tvar ret TransferNetwork\n\t\treturn ret\n\t}\n\n\treturn o.Network\n}", "func (fa TestAddr) Network() string { return fa.Addr }", "func (msg CmdMsg) GetNetwork() EntityInfo {\n\treturn msg.Network\n}", "func (a *AssetRegistry) Network() string {\n\treturn a.assetRegistryInner.Network\n}", "func (o *NetworkingProjectNetadpCreate) GetNetwork() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Network\n}", "func (a Addr) Network() string {\n\treturn a.network\n}", "func (a *Addr) Network() string {\n\treturn a.NetworkStr\n}", "func (h *BasicHost) Network() net.Network {\n\treturn h.host.Network()\n}", "func (c *ServiceConfig) GetNetNetwork() string {\n\tif c != nil && c.NetNetwork != \"\" {\n\t\treturn c.NetNetwork\n\t}\n\treturn \"tcp\"\n}", "func (w *rpcWallet) Network(ctx context.Context) (wire.CurrencyNet, error) {\n\tnet, err := w.client().GetCurrentNet(ctx)\n\treturn net, translateRPCCancelErr(err)\n}", "func (o NetworkInterfaceOutput) Network() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v NetworkInterface) *string { return v.Network }).(pulumi.StringPtrOutput)\n}", "func (t DNSOverTCP) Network() string {\n\treturn t.network\n}", "func newNetwork(networkType NetworkModel) network {\n\tswitch networkType {\n\tcase NoopNetworkModel:\n\t\treturn &noopNetwork{}\n\tcase DefaultNetworkModel:\n\t\treturn &defNetwork{}\n\tdefault:\n\t\treturn &noopNetwork{}\n\t}\n}", "func (c *Client) Network() NetworkType {\n\treturn c.network\n}", "func GetConfig() (*Network, error) {\n\tif instance != nil {\n\t\treturn instance, nil\n\t}\n\tnetwork := Network{}\n\n\tif runtime.GOOS == \"windows\" {\n\t\tconn, err := net.Dial(\"udp\", \"8.8.8.8:80\")\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdefer conn.Close()\n\t\tnetwork.LocalIP = conn.LocalAddr().(*net.UDPAddr).IP\n\n\t\tinterfaces, _ := net.Interfaces()\n\t\tfor _, interf := range interfaces {\n\n\t\t\tif addrs, err := interf.Addrs(); err == nil {\n\t\t\t\tfor _, addr := range addrs {\n\t\t\t\t\tif strings.Contains(addr.String(), network.LocalIP.String()) {\n\t\t\t\t\t\tnetwork.InterfaceName = interf.Name\n\t\t\t\t\t\tnetwork.HardwareAddress = interf.HardwareAddr\n\t\t\t\t\t\tnetwork.Interface = &interf\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tnetwork.getWindows()\n\t} else {\n\t\tnetwork.getLinux()\n\t}\n\tinstance = &network\n\treturn &network, nil\n}", "func getNetwork() string {\n\thostname, err := os.Hostname()\n\tif err != nil {\n\t\treturn \"unknown\"\n\t}\n\n\taddrs, err := net.LookupIP(hostname)\n\tif err != nil {\n\t\treturn hostname\n\t}\n\n\tfor _, addr := range addrs {\n\t\tif ipv4 := addr.To4(); ipv4 != nil {\n\t\t\tip, err := ipv4.MarshalText()\n\t\t\tif err != nil {\n\t\t\t\treturn hostname\n\t\t\t}\n\t\t\thosts, err := net.LookupAddr(string(ip))\n\t\t\tif err != nil || len(hosts) == 0 {\n\t\t\t\treturn hostname\n\t\t\t}\n\t\t\tfqdn := hosts[0]\n\t\t\treturn strings.TrimSuffix(fqdn, \".\") // return fqdn without trailing dot\n\t\t}\n\t}\n\treturn hostname\n}", "func (a UnresolvedAddr) Network() string {\n\treturn a.NetworkField\n}", "func (m *MockCountryRecord) GetNetwork() *net.IPNet {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetNetwork\")\n\tret0, _ := ret[0].(*net.IPNet)\n\treturn ret0\n}", "func getNetwork(net string, zoneID *egoscale.UUID) (*egoscale.Network, error) {\n\tvar found *egoscale.Network\n\n\treq := &egoscale.Network{\n\t\tZoneID: zoneID,\n\t\tType: \"Isolated\",\n\t\tCanUseForDeploy: true,\n\t}\n\n\tid, errUUID := egoscale.ParseUUID(net)\n\tif errUUID != nil {\n\t\treq.Name = net\n\t} else {\n\t\treq.ID = id\n\t}\n\n\tresp, err := cs.ListWithContext(gContext, req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, item := range resp {\n\t\tnetwork := item.(*egoscale.Network)\n\n\t\t// If search criterion is an unique ID, return the first (i.e. only) match\n\t\tif id != nil && network.ID.Equal(*id) {\n\t\t\treturn network, nil\n\t\t}\n\n\t\t// If search criterion is a name, check that there isn't multiple networks named\n\t\t// identically before returning a match\n\t\tif network.Name == net {\n\t\t\t// We already found a match before -> multiple results\n\t\t\tif found != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"found multiple networks named %q, please specify a unique ID instead\", net)\n\t\t\t}\n\t\t\tfound = network\n\t\t}\n\t}\n\n\tif found != nil {\n\t\treturn found, nil\n\t}\n\n\treturn nil, fmt.Errorf(\"network %q not found\", net)\n}", "func (a *MockAddr) Network() string {\n\treturn \"mock\"\n}", "func (c *ChromeTarget) Network() *ChromeNetwork {\n\tif c.network == nil {\n\t\tc.network = newChromeNetwork(c)\n\t}\n\treturn c.network\n}", "func (i *Ibmc) Network(cfg *cfgresources.Network) error {\n\treturn nil\n}", "func (m *MockRecord) GetNetwork() *net.IPNet {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetNetwork\")\n\tret0, _ := ret[0].(*net.IPNet)\n\treturn ret0\n}", "func (m *MockCityRecord) GetNetwork() *net.IPNet {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetNetwork\")\n\tret0, _ := ret[0].(*net.IPNet)\n\treturn ret0\n}", "func (m *MockStore) GetNetwork(arg0 string) (*network.Network, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetNetwork\", arg0)\n\tret0, _ := ret[0].(*network.Network)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (i *IP) Network() *IP {\n\tcl := i.Clone()\n\tcl.NetworkInPlace()\n\treturn cl\n}", "func GetNetworkByKinNetwork(net network.KinNetwork) (buildNetwork build.Network, err error) {\n\tif !net.IsValid() {\n\t\treturn build.Network{}, ErrInvalidKinNetwork\n\t}\n\n\tswitch net {\n\tcase network.MainNetwork:\n\t\treturn prodNetwork, nil\n\tdefault:\n\t\treturn testNetwork, nil\n\t}\n}", "func (o NetworkInterfaceResponseOutput) Network() pulumi.StringOutput {\n\treturn o.ApplyT(func(v NetworkInterfaceResponse) string { return v.Network }).(pulumi.StringOutput)\n}", "func (t *DNSOverTCPTransport) Network() string {\n\treturn t.network\n}", "func NetworkResourceGet(w http.ResponseWriter, r *http.Request) {\n\tnrID := mux.Vars(r)[\"nr_id\"]\n\tcp := r.URL.Query().Get(\"cloud_provider\")\n\tif nrID == \"\" || cp == \"\" {\n\t\thandleError(w, http.StatusBadRequest,\n\t\t\t\"url params 'nr_id' or 'cloud_provider' is missing\")\n\t\treturn\n\t}\n\n\tnetwork, err := ctr.GetStorageResource(nrID)\n\tif err != nil {\n\t\thandleError(w, http.StatusNotFound, err.Error())\n\t\treturn\n\t}\n\n\thandleResult(w, http.StatusOK, network)\n\treturn\n}", "func (pk PacketBufferPtr) Network() header.Network {\n\tswitch netProto := pk.NetworkProtocolNumber; netProto {\n\tcase header.IPv4ProtocolNumber:\n\t\treturn header.IPv4(pk.NetworkHeader().Slice())\n\tcase header.IPv6ProtocolNumber:\n\t\treturn header.IPv6(pk.NetworkHeader().Slice())\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"unknown network protocol number %d\", netProto))\n\t}\n}", "func (w WithdrawEvent) Network() string {\n\treturn w.network\n}", "func (o NetworkAttachmentOutput) Network() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *NetworkAttachment) pulumi.StringOutput { return v.Network }).(pulumi.StringOutput)\n}", "func (socket *MockSocket) Network() *socket.NetworkProtocol {\n\treturn socket.network\n}", "func (o VpnGatewayOutput) Network() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *VpnGateway) pulumi.StringOutput { return v.Network }).(pulumi.StringOutput)\n}", "func getNetworkConfig() (*networkConfig, error) {\n\treq, err := http.NewRequest(http.MethodGet, fmt.Sprintf(\"%s/network/config\", proxyHost), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient := http.DefaultClient\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tdefer func() {\n\t\t_ = resp.Body.Close()\n\t}()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tnetConfig := &networkConfig{}\n\terr = json.Unmarshal(body, netConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn netConfig, nil\n}", "func (o *NetworkingProjectIpCreate) GetNetwork() string {\n\tif o == nil || o.Network == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Network\n}", "func (o LookupWorkstationClusterResultOutput) Network() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupWorkstationClusterResult) string { return v.Network }).(pulumi.StringOutput)\n}", "func (o StorageClusterSpecOutput) Network() StorageClusterSpecNetworkPtrOutput {\n\treturn o.ApplyT(func(v StorageClusterSpec) *StorageClusterSpecNetwork { return v.Network }).(StorageClusterSpecNetworkPtrOutput)\n}", "func (a *Addr) Network() string {\n\treturn \"raw\"\n}", "func (h networkHandler) getNetworkHandler(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tclusterProvider := vars[\"provider-name\"]\n\tcluster := vars[\"cluster-name\"]\n\tname := vars[\"name\"]\n\tvar ret interface{}\n\tvar err error\n\n\tif len(name) == 0 {\n\t\tret, err = h.client.GetNetworks(clusterProvider, cluster)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t} else {\n\t\tret, err = h.client.GetNetwork(name, clusterProvider, cluster)\n\t\tif err != nil {\n\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\terr = json.NewEncoder(w).Encode(ret)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "func LoadNetwork(svc iaas.Service, ref string) (rn resources.Network, xerr fail.Error) {\n\tif svc == nil {\n\t\treturn nil, fail.InvalidParameterError(\"svc\", \"cannot be null value\")\n\t}\n\tif ref = strings.TrimSpace(ref); ref == \"\" {\n\t\treturn nil, fail.InvalidParameterError(\"ref\", \"cannot be empty string\")\n\t}\n\n\tnetworkCache, xerr := svc.GetCache(networkKind)\n\txerr = debug.InjectPlannedFail(xerr)\n\tif xerr != nil {\n\t\treturn nil, xerr\n\t}\n\n\toptions := []data.ImmutableKeyValue{\n\t\tdata.NewImmutableKeyValue(\"onMiss\", func() (cache.Cacheable, fail.Error) {\n\t\t\trn, innerXErr := NewNetwork(svc)\n\t\t\tif innerXErr != nil {\n\t\t\t\treturn nil, innerXErr\n\t\t\t}\n\n\t\t\t// TODO: core.ReadByID() does not check communication failure, side effect of limitations of Stow (waiting for stow replacement by rclone)\n\t\t\tif innerXErr = rn.Read(ref); innerXErr != nil {\n\t\t\t\treturn nil, innerXErr\n\t\t\t}\n\n\t\t\t// VPL: disabled silent metadata upgrade; will be implemented in a global one-pass migration\n\t\t\t// // Deal with legacy\n\t\t\t// xerr = rn.(*network).upgradeNetworkMetadataIfNeeded()\n\t\t\t// xerr = debug.InjectPlannedFail(xerr)\n\t\t\t// if xerr != nil {\n\t\t\t// \tswitch xerr.(type) {\n\t\t\t// \tcase *fail.ErrAlteredNothing:\n\t\t\t// \t\t// ignore\n\t\t\t// \tdefault:\n\t\t\t// \t\treturn nil, fail.Wrap(xerr, \"failed to upgrade Network properties\")\n\t\t\t// \t}\n\t\t\t// }\n\n\t\t\treturn rn, nil\n\t\t}),\n\t}\n\tcacheEntry, xerr := networkCache.Get(ref, options...)\n\txerr = debug.InjectPlannedFail(xerr)\n\tif xerr != nil {\n\t\tswitch xerr.(type) {\n\t\tcase *fail.ErrNotFound:\n\t\t\t// rewrite NotFoundError, user does not bother about metadata stuff\n\t\t\treturn nil, fail.NotFoundError(\"failed to find Network '%s'\", ref)\n\t\tdefault:\n\t\t\treturn nil, xerr\n\t\t}\n\t}\n\n\tif rn = cacheEntry.Content().(resources.Network); rn == nil {\n\t\treturn nil, fail.InconsistentError(\"nil value found in Network cache for key '%s'\", ref)\n\t}\n\t_ = cacheEntry.LockContent()\n\tdefer func() {\n\t\txerr = debug.InjectPlannedFail(xerr)\n\t\tif xerr != nil {\n\t\t\t_ = cacheEntry.UnlockContent()\n\t\t}\n\t}()\n\n\treturn rn, nil\n}", "func (o NetworkPeeringResponseOutput) Network() pulumi.StringOutput {\n\treturn o.ApplyT(func(v NetworkPeeringResponse) string { return v.Network }).(pulumi.StringOutput)\n}", "func (o InstanceGroupOutput) Network() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *InstanceGroup) pulumi.StringOutput { return v.Network }).(pulumi.StringOutput)\n}", "func (r *reader) GetNetworkProtocol() (protocol models.NetworkProtocol, err error) {\n\ts, err := r.envParams.GetValueIfInside(\"PROTOCOL\", []string{\"tcp\", \"udp\"}, libparams.Default(\"udp\"))\n\treturn models.NetworkProtocol(s), err\n}", "func (o NodeOutput) Network() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Node) pulumi.StringOutput { return v.Network }).(pulumi.StringOutput)\n}", "func (o NodeOutput) Network() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Node) pulumi.StringOutput { return v.Network }).(pulumi.StringOutput)\n}", "func (o ClusterOutput) Network() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Cluster) pulumi.StringPtrOutput { return v.Network }).(pulumi.StringPtrOutput)\n}", "func (in *Database) GetNetwork(id string) (*types.Network, error) {\n\ttxn := in.db.Txn(false)\n\tdefer txn.Abort()\n\tidx := \"id\"\n\tif stringid.IsShortID(id) {\n\t\tidx = \"shortid\"\n\t}\n\traw, err := txn.First(\"network\", idx, id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif raw == nil {\n\t\treturn nil, fmt.Errorf(\"network %s not found\", id)\n\t}\n\treturn raw.(*types.Network), nil\n}", "func (f FakeContainerImpl) GetNetworkMetrics(containerID string, networks map[string]string) (metrics.ContainerNetStats, error) {\n\treturn nil, nil\n}", "func (c *StaticCoreServer) GetNetworkInfo(_ btcjson.GetNetworkInfoCmd) btcjson.GetNetworkInfoResult {\n\treturn c.GetNetworkInfoResult\n}", "func (s stack) GetDefaultNetwork() (*abstract.Network, fail.Error) {\n\treturn nil, fail.NotFoundError(\"no default network in stack\")\n}", "func (m *cniNetworkManager) NetworkOptions() types.NetworkOptions {\n\treturn m.netOpts\n}", "func (c *clusterNetwork) Get(networkName string) (result *sdnapi.ClusterNetwork, err error) {\n\tresult = &sdnapi.ClusterNetwork{}\n\terr = c.r.Get().Resource(\"clusterNetworks\").Name(networkName).Do().Into(result)\n\treturn\n}", "func Get() NetworkInfo {\n\tn := NetworkInfo{}\n\tn.IPv4Method, n.IPv6Method = \"https://v4.ident.me/\", \"https://v6.ident.me/\"\n\tn.IPv4, n.IPv6 = getIP(n.IPv4Method), getIP(n.IPv6Method)\n\n\t// Grab all network interfaces.\n\tifaces, _ := net.Interfaces()\n\tfor _, i := range ifaces {\n\t\tvar addresses []string\n\n\t\t// Grab all iface addresses.\n\t\taddrs, _ := i.Addrs()\n\t\tfor _, addr := range addrs {\n\t\t\taddresses = append(addresses, addr.String())\n\t\t}\n\n\t\tn.Ifaces = append(n.Ifaces, iface{\n\t\t\tMTU: i.MTU,\n\t\t\tName: i.Name,\n\t\t\tPhysicalAddr: i.HardwareAddr.String(),\n\t\t\tAddresses: addresses,\n\t\t})\n\t}\n\n\treturn n\n}", "func (o StorageClusterSpecPtrOutput) Network() StorageClusterSpecNetworkPtrOutput {\n\treturn o.ApplyT(func(v *StorageClusterSpec) *StorageClusterSpecNetwork {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Network\n\t}).(StorageClusterSpecNetworkPtrOutput)\n}", "func (r *Finder) Network(ref *base.Ref) (object interface{}, err error) {\n\tnetwork := &Network{}\n\terr = r.ByRef(network, *ref)\n\tif err == nil {\n\t\tref.ID = network.ID\n\t\tref.Name = network.Name\n\t\tobject = network\n\t}\n\n\treturn\n}", "func (addr *Address) Network() string { return \"tcp\" }", "func NewNetwork(dht *DHT, self *Node) (*Network, error) {\n\ts := &Network{\n\t\tdht: dht,\n\t\tself: self,\n\t\tdone: make(chan struct{}),\n\t}\n\t// init the rate limiter\n\ts.limiter = ratelimit.New(defaultConnRate)\n\n\taddr := fmt.Sprintf(\"%s:%d\", self.IP, self.Port)\n\t// new the network socket\n\tsocket, err := utp.NewSocket(\"udp\", addr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts.socket = socket\n\n\treturn s, nil\n}", "func (a *TCPAddr) Network() string { return \"tcp\" }", "func getNetwork() string {\n\t// Default network for dev environment\n\tnetworkSegment := \"dev-segment\"\n\tif os.Getenv(\"OPENSHIFT_CI\") == \"true\" {\n\t\t// $LEASED_RESOURCE holds the network the CI cluster is in\n\t\tnetworkSegment = os.Getenv(\"LEASED_RESOURCE\")\n\t\t// Default to \"ci-segment\" if the environment variable is not set.\n\t\tif networkSegment == \"\" {\n\t\t\tnetworkSegment = \"ci-segment\"\n\t\t}\n\t}\n\treturn networkSegment\n}", "func (m *noneNetworkManager) NetworkOptions() types.NetworkOptions {\n\treturn m.netOpts\n}", "func (o *Transfer) GetNetworkOk() (*TransferNetwork, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Network, true\n}", "func (a *UDPAddr) Network() string { return \"udp\" }", "func (m *Media) GetCallerNetwork()(NetworkInfoable) {\n return m.callerNetwork\n}", "func NewNetwork(svc iaas.Service) (resources.Network, fail.Error) {\n\tif svc == nil {\n\t\treturn NullValue(), fail.InvalidParameterCannotBeNilError(\"svc\")\n\t}\n\n\tcoreInstance, xerr := NewCore(svc, networkKind, networksFolderName, &abstract.Network{})\n\txerr = debug.InjectPlannedFail(xerr)\n\tif xerr != nil {\n\t\treturn NullValue(), xerr\n\t}\n\n\tinstance := &Network{\n\t\tMetadataCore: coreInstance,\n\t}\n\treturn instance, nil\n}", "func (bh *BlankHost) Network() inet.Network {\n\treturn bh.n\n}", "func (conf *ConfigType) GetNetworkType() NetworkType {\n\treturn conf.networkType\n}", "func (m *hostNetworkManager) NetworkOptions() types.NetworkOptions {\n\treturn m.netOpts\n}", "func (o StorageClusterSpecNodesOutput) Network() StorageClusterSpecNodesNetworkPtrOutput {\n\treturn o.ApplyT(func(v StorageClusterSpecNodes) *StorageClusterSpecNodesNetwork { return v.Network }).(StorageClusterSpecNodesNetworkPtrOutput)\n}", "func (d *Domain) Network(idx uint) *Network {\n\tif n := C.xenstat_domain_network(d.d, C.uint(idx)); n != nil {\n\t\treturn &Network{\n\t\t\tIdx: idx,\n\t\t\tn: n,\n\t\t}\n\t}\n\n\treturn nil\n}", "func NewNetwork(dockerClient *client.Client, cfg NetworkConfig) (out *Network, err error) {\n\tscopes.Framework.Infof(\"Creating Docker network %s\", cfg.Name)\n\tresp, err := dockerClient.NetworkCreate(context.Background(), cfg.Name, types.NetworkCreate{\n\t\tCheckDuplicate: true,\n\t\tLabels: cfg.Labels,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tscopes.Framework.Infof(\"Docker network %s created (ID=%s)\", cfg.Name, resp.ID)\n\n\tn := &Network{\n\t\tNetworkConfig: cfg,\n\t\tdockerClient: dockerClient,\n\t\tid: resp.ID,\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\t_ = n.Close()\n\t\t}\n\t}()\n\n\t// Retrieve the subnet for the network.\n\tiresp, err := dockerClient.NetworkInspect(context.Background(), resp.ID, types.NetworkInspectOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif _, n.Subnet, err = net.ParseCIDR(iresp.IPAM.Config[0].Subnet); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn n, nil\n}", "func (m *exampleNetworkConfig) NetworkConfig() *fab.NetworkConfig {\n\treturn &networkConfig\n}", "func getNonDefaultNetwork(userCmdArgs []string) string {\n\n\tfor _, item := range userCmdArgs {\n\t\tif strings.Contains(item, \"--net=\") == false {\n\t\t\tcontinue\n\t\t}\n\t\tname := strings.Split(item, \"=\")\n\t\tif len(name) < 2 {\n\t\t\treturn \"\"\n\t\t}\n\t\treturn name[1]\n\t}\n\treturn \"\"\n}", "func (c *Controller) defaultGwNetwork() (*Network, error) {\n\tprocGwNetwork <- true\n\tdefer func() { <-procGwNetwork }()\n\n\tn, err := c.NetworkByName(libnGWNetwork)\n\tif _, ok := err.(types.NotFoundError); ok {\n\t\tn, err = c.createGWNetwork()\n\t}\n\treturn n, err\n}", "func (addr *Addr) Network() string {\n\treturn \"websocket\"\n}", "func GetOneNetwork(nad, ns string, podName string) *corev1.Pod {\n\tpod := GetPodDefinition(ns, podName)\n\tpod.Annotations = map[string]string{\"k8s.v1.cni.cncf.io/networks\": nad}\n\treturn pod\n}", "func (o *NetworkingProjectNetadpCreate) GetNetworkOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Network, true\n}", "func (n NetworkMode) NetworkName() string {\n\tif n.IsDefault() {\n\t\treturn \"default\"\n\t}\n\treturn \"\"\n}", "func (m *Media) GetCalleeNetwork()(NetworkInfoable) {\n return m.calleeNetwork\n}", "func (m *containerNetworkManager) NetworkOptions() types.NetworkOptions {\n\treturn m.netOpts\n}" ]
[ "0.7653632", "0.74411637", "0.74013144", "0.72364", "0.7178163", "0.7117932", "0.7060937", "0.7059139", "0.69026905", "0.68915313", "0.6888566", "0.6884568", "0.686258", "0.6832988", "0.67739797", "0.6729134", "0.6717261", "0.6694673", "0.668241", "0.6668585", "0.6640677", "0.660622", "0.65950453", "0.65789163", "0.6574575", "0.6573323", "0.6566406", "0.6563995", "0.65476763", "0.65448284", "0.65365297", "0.6534839", "0.6526281", "0.6509831", "0.6481226", "0.64662844", "0.64598066", "0.6423644", "0.64217365", "0.64211804", "0.64197564", "0.6408564", "0.6401279", "0.63774365", "0.63612497", "0.6344481", "0.6330427", "0.6312537", "0.6287136", "0.62804705", "0.62752265", "0.6272093", "0.6267602", "0.6259268", "0.6220397", "0.6210297", "0.62022054", "0.6197596", "0.6192312", "0.618958", "0.61859643", "0.6183153", "0.61722314", "0.61698484", "0.6160217", "0.6160217", "0.614648", "0.61462355", "0.61412793", "0.6140707", "0.612676", "0.6097207", "0.6091053", "0.6083661", "0.6080816", "0.60766244", "0.6075921", "0.6065172", "0.6053251", "0.6049404", "0.6029067", "0.6021539", "0.6010239", "0.6003055", "0.5999516", "0.5981761", "0.5973392", "0.59722924", "0.59529924", "0.5936948", "0.59148884", "0.59100115", "0.58962816", "0.5889404", "0.5885369", "0.58838606", "0.58807343", "0.58447474", "0.5835448", "0.5834987" ]
0.746736
1
ListNetworks uses the override method ListNetworksFn or the real implementation.
func (c *TestClient) ListNetworks(project string, opts ...ListCallOption) ([]*compute.Network, error) { if c.ListNetworksFn != nil { return c.ListNetworksFn(project, opts...) } return c.client.ListNetworks(project, opts...) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s *Stack) ListNetworks() ([]*abstract.Network, fail.Error) {\n\tvar networks []*abstract.Network\n\n\tcompuService := s.ComputeService\n\n\ttoken := \"\"\n\tfor paginate := true; paginate; {\n\t\tresp, err := compuService.Networks.List(s.GcpConfig.ProjectID).PageToken(token).Do()\n\t\tif err != nil {\n\t\t\treturn networks, fail.Errorf(fmt.Sprintf(\"cannot list networks ...: %s\", err), err)\n\t\t}\n\n\t\tfor _, nett := range resp.Items {\n\t\t\tnewNet := abstract.NewNetwork()\n\t\t\tnewNet.Name = nett.Name\n\t\t\tnewNet.ID = strconv.FormatUint(nett.Id, 10)\n\t\t\tnewNet.CIDR = nett.IPv4Range\n\n\t\t\tnetworks = append(networks, newNet)\n\t\t}\n\t\ttoken := resp.NextPageToken\n\t\tpaginate = token != \"\"\n\t}\n\n\ttoken = \"\"\n\tfor paginate := true; paginate; {\n\t\tresp, err := compuService.Subnetworks.List(s.GcpConfig.ProjectID, s.GcpConfig.Region).PageToken(token).Do()\n\t\tif err != nil {\n\t\t\treturn networks, fail.Errorf(fmt.Sprintf(\"cannot list subnetworks ...: %s\", err), err)\n\t\t}\n\n\t\tfor _, nett := range resp.Items {\n\t\t\tnewNet := abstract.NewNetwork()\n\t\t\tnewNet.Name = nett.Name\n\t\t\tnewNet.ID = strconv.FormatUint(nett.Id, 10)\n\t\t\tnewNet.CIDR = nett.IpCidrRange\n\n\t\t\tnetworks = append(networks, newNet)\n\t\t}\n\t\ttoken := resp.NextPageToken\n\t\tpaginate = token != \"\"\n\t}\n\n\treturn networks, nil\n}", "func networkListExample() string {\n\treturn `$ pouch network ls\nNETWORK ID NAME DRIVER SCOPE\n6f7aba8a58 net2 bridge\n55f134176c net3 bridge\ne495f50913 net1 bridge\n`\n}", "func (n *NetworkServiceHandler) List(ctx context.Context) ([]Network, error) {\n\turi := \"/v1/network/list\"\n\n\treq, err := n.client.NewRequest(ctx, http.MethodGet, uri, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar networkMap map[string]Network\n\terr = n.client.DoWithContext(ctx, req, &networkMap)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar networks []Network\n\tfor _, network := range networkMap {\n\t\tnetworks = append(networks, network)\n\t}\n\n\treturn networks, nil\n}", "func (s *logicalNetworkLister) List(selector labels.Selector) (ret []*v1.LogicalNetwork, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1.LogicalNetwork))\n\t})\n\treturn ret, err\n}", "func (n *NetworkListCommand) runNetworkList(args []string) error {\n\tlogrus.Debugf(\"list the networks\")\n\n\tctx := context.Background()\n\tapiClient := n.cli.Client()\n\trespNetworkResource, err := apiClient.NetworkList(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdisplay := n.cli.NewTableDisplay()\n\tdisplay.AddRow([]string{\"NETWORK ID\", \"NAME\", \"DRIVER\", \"SCOPE\"})\n\tfor _, network := range respNetworkResource {\n\t\tdisplay.AddRow([]string{\n\t\t\tnetwork.ID[:10],\n\t\t\tnetwork.Name,\n\t\t\tnetwork.Driver,\n\t\t\tnetwork.Scope,\n\t\t})\n\t}\n\n\tdisplay.Flush()\n\treturn nil\n}", "func (l *Libvirt) ConnectListNetworks(Maxnames int32) (rNames []string, err error) {\n\tvar buf []byte\n\n\targs := ConnectListNetworksArgs {\n\t\tMaxnames: Maxnames,\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(38, 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// Names: []string\n\t_, err = dec.Decode(&rNames)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "func (vns *VirtualNetworkService) List(ctx context.Context, pageOffset int, pageSize int,\n\tfilter OwnershipFilter) ([]*resources.VirtualNetwork, error) {\n\treturn vns.list(ctx, int(filter), (pageOffset-1)*pageSize, -pageSize)\n}", "func (f *FakeInstance) ListPrivateNetworks(_ context.Context, _ string, _ *govultr.ListOptions) ([]govultr.PrivateNetwork, *govultr.Meta, *http.Response, error) {\n\tpanic(\"implement me\")\n}", "func (l *Libvirt) ConnectListDefinedNetworks(Maxnames int32) (rNames []string, err error) {\n\tvar buf []byte\n\n\targs := ConnectListDefinedNetworksArgs {\n\t\tMaxnames: Maxnames,\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(36, 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// Names: []string\n\t_, err = dec.Decode(&rNames)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "func (s logicalNetworkNamespaceLister) List(selector labels.Selector) (ret []*v1.LogicalNetwork, err error) {\n\terr = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1.LogicalNetwork))\n\t})\n\treturn ret, err\n}", "func (c *MockVirtualNetworksClient) List(ctx context.Context, resourceGroupName string) ([]network.VirtualNetwork, error) {\n\tvar l []network.VirtualNetwork\n\tfor _, vnet := range c.VNets {\n\t\tl = append(l, vnet)\n\t}\n\treturn l, nil\n}", "func (o *GetClientConfig200ResponseDenylist) GetNetworks() GetClientConfig200ResponseNetworks1 {\n\tif o == nil || o.Networks == nil {\n\t\tvar ret GetClientConfig200ResponseNetworks1\n\t\treturn ret\n\t}\n\treturn *o.Networks\n}", "func (s *logicalNetworkLister) LogicalNetworks(namespace string) LogicalNetworkNamespaceLister {\n\treturn logicalNetworkNamespaceLister{indexer: s.indexer, namespace: namespace}\n}", "func (vcd *TestVCD) Test_GetNetworkList(check *C) {\n\tfmt.Printf(\"Running: %s\\n\", check.TestName())\n\tnetworkName := vcd.config.VCD.Network.Net1\n\tif networkName == \"\" {\n\t\tcheck.Skip(\"no network name provided\")\n\t}\n\tnetworks, err := vcd.vdc.GetNetworkList()\n\tcheck.Assert(err, IsNil)\n\tfound := false\n\tfor _, net := range networks {\n\t\t// Check that we don't get invalid fields\n\t\tknownType := net.LinkType == 0 || net.LinkType == 1 || net.LinkType == 2\n\t\tcheck.Assert(knownType, Equals, true)\n\t\t// Check that the `ConnectTo` field is not empty\n\t\tcheck.Assert(net.ConnectedTo, Not(Equals), \"\")\n\t\tif net.Name == networkName {\n\t\t\tfound = true\n\t\t}\n\t}\n\tcheck.Assert(found, Equals, true)\n}", "func (a *Client) ListOpenstackNetworks(params *ListOpenstackNetworksParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListOpenstackNetworksOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewListOpenstackNetworksParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"listOpenstackNetworks\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/api/v1/providers/openstack/networks\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &ListOpenstackNetworksReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*ListOpenstackNetworksOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\tunexpectedSuccess := result.(*ListOpenstackNetworksDefault)\n\treturn nil, runtime.NewAPIError(\"unexpected success response: content available as default response in error\", unexpectedSuccess, unexpectedSuccess.Code())\n}", "func ListWifiNetworks() []string {\n\ts := spinner.New(spinner.CharSets[11], 100*time.Millisecond)\n\ts.Prefix = \"Searching networks: \"\n\ts.Start()\n\n\tlistWifiCmd := exec.Command(\"bash\", \"-c\", \"/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport scan\")\n\twifiList, err := listWifiCmd.Output()\n\tHandleError(err)\n\ts.Stop()\n\n\tif len(wifiList) == 0 {\n\t\tfmt.Println(\"There are no available networks\")\n\t\tif isWifiOff() {\n\t\t\tfmt.Println(\"It looks like the wifi is off. You can turn it on running `wificli on`\")\n\t\t}\n\t\tos.Exit(1)\n\t}\n\n\tvar list []string\n\twifiListArray := strings.Split(string(wifiList), \"\\n\")[1:]\n\tfor _, network := range wifiListArray {\n\t\tnetworkFields := strings.Fields(network)\n\t\tif len(networkFields) > 0 {\n\t\t\tlist = append(list, networkFields[0])\n\t\t}\n\t}\n\n\treturn list\n}", "func ValidateNetworks(Validations Validations, Service types.ServiceConfig) error {\n\tfor Network := range Service.Networks {\n\t\tif !goutil.StringInSlice(Network, Validations.Networks) {\n\t\t\treturn fmt.Errorf(\"Network '%s' not in the whitelist\", Network)\n\t\t}\n\t}\n\treturn nil\n}", "func (c *networkStatuses) List(opts v1.ListOptions) (result *batch.NetworkStatusList, err error) {\n\tresult = &batch.NetworkStatusList{}\n\terr = c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"networkstatuses\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tDo().\n\t\tInto(result)\n\treturn\n}", "func (d *Domain) NumNetworks() uint {\n\treturn uint(C.xenstat_domain_num_networks(d.d))\n}", "func (client WorkloadNetworksClient) ListGateways(ctx context.Context, resourceGroupName string, privateCloudName string) (result WorkloadNetworkGatewayListPage, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/WorkloadNetworksClient.ListGateways\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.wngl.Response.Response != nil {\n\t\t\t\tsc = result.wngl.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tif err := validation.Validate([]validation.Validation{\n\t\t{TargetValue: client.SubscriptionID,\n\t\t\tConstraints: []validation.Constraint{{Target: \"client.SubscriptionID\", Name: validation.MinLength, Rule: 1, Chain: nil}}},\n\t\t{TargetValue: resourceGroupName,\n\t\t\tConstraints: []validation.Constraint{{Target: \"resourceGroupName\", Name: validation.MaxLength, Rule: 90, Chain: nil},\n\t\t\t\t{Target: \"resourceGroupName\", Name: validation.MinLength, Rule: 1, Chain: nil},\n\t\t\t\t{Target: \"resourceGroupName\", Name: validation.Pattern, Rule: `^[-\\w\\._\\(\\)]+$`, Chain: nil}}}}); err != nil {\n\t\treturn result, validation.NewError(\"avs.WorkloadNetworksClient\", \"ListGateways\", err.Error())\n\t}\n\n\tresult.fn = client.listGatewaysNextResults\n\treq, err := client.ListGatewaysPreparer(ctx, resourceGroupName, privateCloudName)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"avs.WorkloadNetworksClient\", \"ListGateways\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.ListGatewaysSender(req)\n\tif err != nil {\n\t\tresult.wngl.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"avs.WorkloadNetworksClient\", \"ListGateways\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult.wngl, err = client.ListGatewaysResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"avs.WorkloadNetworksClient\", \"ListGateways\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\tif result.wngl.hasNextLink() && result.wngl.IsEmpty() {\n\t\terr = result.NextWithContext(ctx)\n\t\treturn\n\t}\n\n\treturn\n}", "func (d *Dry) ShowNetworks() {\n\tif networks, err := d.dockerDaemon.Networks(); err == nil {\n\t\td.changeViewMode(Networks)\n\t\td.networks = networks\n\t} else {\n\t\td.appmessage(\n\t\t\tfmt.Sprintf(\n\t\t\t\t\"Could not retrieve network list: %s \", err.Error()))\n\t}\n}", "func GetAllNetworks(l DigestStore) ([]string, error) {\n\tdigestInfos, err := l.GetDigests([]string{}, clock.Now().Unix())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tnetworks := digestInfos.Networks()\n\tnetworksUniq := funk.UniqString(networks)\n\treturn networksUniq, nil\n}", "func (client WorkloadNetworksClient) ListPortMirroringSender(req *http.Request) (*http.Response, error) {\n\treturn client.Send(req, azure.DoRetryWithRegistration(client.Client))\n}", "func TestGetNetworks(t *testing.T) {\n\trecord(t, \"getnetworks\", func(t *testing.T, svc *Service) {\n\t\t_, err := createServer(svc, \"TestGetNetworks\")\n\t\trequire.NoError(t, err)\n\n\t\tnetworks, err := svc.GetNetworks()\n\t\trequire.NoError(t, err)\n\n\t\tassert.NotEmpty(t, networks.Networks)\n\n\t\tassert.NotEmpty(t, networks.Networks[0].IPNetworks)\n\t\tassert.NotEmpty(t, networks.Networks[0].Name)\n\t\tassert.NotEmpty(t, networks.Networks[0].Type)\n\t\tassert.NotEmpty(t, networks.Networks[0].UUID)\n\t\tassert.NotEmpty(t, networks.Networks[0].Zone)\n\n\t\t// Find a network with a server\n\t\tvar found bool\n\t\tfor _, n := range networks.Networks {\n\t\t\tif len(n.Servers) > 0 {\n\t\t\t\tfound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tassert.True(t, found)\n\t})\n}", "func (c *Client) GetAllNetworks() ([]byte, error) {\n\treturn c.doGet(master.GetNetworksRESTEndpoint)\n}", "func (r *ProjectsLocationsNetworksService) List(parent string) *ProjectsLocationsNetworksListCall {\n\tc := &ProjectsLocationsNetworksListCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.parent = parent\n\treturn c\n}", "func (ctx *DevModelParallels) Networks() []*config.NetworkConfig {\n\treturn ctx.networks\n}", "func (client *Client) ListNetworkPools(req *Request) (*Response, error) {\n\treturn client.Execute(&Request{\n\t\tMethod: \"GET\",\n\t\tPath: NetworkPoolsPath,\n\t\tQueryParams: req.QueryParams,\n\t\tResult: &ListNetworkPoolsResult{},\n\t})\n}", "func (o *GetClientConfig200ResponseDenylist) GetNetworksOk() (*GetClientConfig200ResponseNetworks1, bool) {\n\tif o == nil || o.Networks == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Networks, true\n}", "func (i *InstanceServiceHandler) ListPrivateNetworks(ctx context.Context, instanceID string, options *ListOptions) ([]PrivateNetwork, *Meta, error) {\n\turi := fmt.Sprintf(\"%s/%s/private-networks\", instancePath, instanceID)\n\treq, err := i.client.NewRequest(ctx, http.MethodGet, uri, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tnewValues, err := query.Values(options)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treq.URL.RawQuery = newValues.Encode()\n\n\tnetworks := new(privateNetworksBase)\n\tif err = i.client.DoWithContext(ctx, req, networks); err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn networks.PrivateNetworks, networks.Meta, nil\n}", "func (d *Dry) SortNetworks() {\n\td.state.mutex.Lock()\n\tdefer d.state.mutex.Unlock()\n\tswitch d.state.SortNetworksMode {\n\tcase drydocker.SortNetworksByID:\n\t\td.state.SortNetworksMode = drydocker.SortNetworksByName\n\tcase drydocker.SortNetworksByName:\n\t\td.state.SortNetworksMode = drydocker.SortNetworksByDriver\n\tcase drydocker.SortNetworksByDriver:\n\t\td.state.SortNetworksMode = drydocker.SortNetworksByID\n\tdefault:\n\t}\n\td.dockerDaemon.SortNetworks(d.state.SortNetworksMode)\n\td.state.changed = true\n}", "func (o *GetClientConfig200ResponseDenylist) SetNetworks(v GetClientConfig200ResponseNetworks1) {\n\to.Networks = &v\n}", "func (l *Libvirt) ConnectListAllNetworks(NeedResults int32, Flags ConnectListAllNetworksFlags) (rNets []Network, rRet uint32, err error) {\n\tvar buf []byte\n\n\targs := ConnectListAllNetworksArgs {\n\t\tNeedResults: NeedResults,\n\t\tFlags: Flags,\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(283, 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// Nets: []Network\n\t_, err = dec.Decode(&rNets)\n\tif err != nil {\n\t\treturn\n\t}\n\t// Ret: uint32\n\t_, err = dec.Decode(&rRet)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "func (d *driver) getNetworks() []*network {\n\td.Lock()\n\tdefer d.Unlock()\n\n\tls := make([]*network, 0, len(d.networks))\n\tfor _, nw := range d.networks {\n\t\tls = append(ls, nw)\n\t}\n\n\treturn ls\n}", "func (c *TestClient) ListSubnetworks(project, region string, opts ...ListCallOption) ([]*compute.Subnetwork, error) {\n\tif c.ListSubnetworksFn != nil {\n\t\treturn c.ListSubnetworksFn(project, region, opts...)\n\t}\n\treturn c.client.ListSubnetworks(project, region, opts...)\n}", "func (c *MockNatGatewaysClient) List(ctx context.Context, resourceGroupName string) ([]network.NatGateway, error) {\n\tvar l []network.NatGateway\n\tfor _, ngw := range c.NGWs {\n\t\tl = append(l, ngw)\n\t}\n\treturn l, nil\n}", "func (m *MockFinder) NetworkList(arg0 context.Context, arg1 string) ([]object.NetworkReference, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"NetworkList\", arg0, arg1)\n\tret0, _ := ret[0].([]object.NetworkReference)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (o *VirtualizationVmwareVirtualMachineAllOf) GetNetworks() []VirtualizationBaseNetworkRelationship {\n\tif o == nil {\n\t\tvar ret []VirtualizationBaseNetworkRelationship\n\t\treturn ret\n\t}\n\treturn o.Networks\n}", "func (m *Setup) DelNetworks(ctx context.Context) error {\n\treturn m.command(ctx, \"DEL\")\n}", "func List() ([]*netlink.Bridge, error) {\n\tlinks, err := netlink.LinkList()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn filterBridge(links), nil\n}", "func List(ctx context.Context, svc iaas.Service, networkID string, all bool, terraform bool) ([]*abstract.Subnet, fail.Error) {\n\tif !terraform {\n\t\treturn operations.ListSubnets(ctx, svc, networkID, all)\n\t}\n\n\tvar neptune []*abstract.Subnet\n\traw, err := operations.ListTerraformSubnets(ctx, svc, networkID, \"\", terraform)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, val := range raw { // FIXME: Another mapping problem\n\t\tns := abstract.NewSubnet()\n\t\tns.ID = val.Identity\n\t\tns.Name = val.Name\n\t\tneptune = append(neptune, ns)\n\t}\n\n\treturn neptune, nil\n}", "func (client MeshNetworkClient) ListPreparer(ctx context.Context) (*http.Request, error) {\n\tconst APIVersion = \"6.4-preview\"\n\tqueryParameters := map[string]interface{}{\n\t\t\"api-version\": APIVersion,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsGet(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPath(\"/Resources/Networks\"),\n\t\tautorest.WithQueryParameters(queryParameters))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "func (d *driver) getNetworks() []*bridgeNetwork {\n\td.Lock()\n\tdefer d.Unlock()\n\n\tls := make([]*bridgeNetwork, 0, len(d.networks))\n\tfor _, nw := range d.networks {\n\t\tls = append(ls, nw)\n\t}\n\treturn ls\n}", "func (a *Client) ListOpenstackNetworksNoCredentials(params *ListOpenstackNetworksNoCredentialsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListOpenstackNetworksNoCredentialsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewListOpenstackNetworksNoCredentialsParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"listOpenstackNetworksNoCredentials\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/api/v1/projects/{project_id}/dc/{dc}/clusters/{cluster_id}/providers/openstack/networks\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &ListOpenstackNetworksNoCredentialsReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*ListOpenstackNetworksNoCredentialsOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\tunexpectedSuccess := result.(*ListOpenstackNetworksNoCredentialsDefault)\n\treturn nil, runtime.NewAPIError(\"unexpected success response: content available as default response in error\", unexpectedSuccess, unexpectedSuccess.Code())\n}", "func (client MeshNetworkClient) List(ctx context.Context) (result PagedNetworkResourceDescriptionList, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/MeshNetworkClient.List\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.Response.Response != nil {\n\t\t\t\tsc = result.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\treq, err := client.ListPreparer(ctx)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"servicefabric.MeshNetworkClient\", \"List\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.ListSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"servicefabric.MeshNetworkClient\", \"List\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.ListResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"servicefabric.MeshNetworkClient\", \"List\", resp, \"Failure responding to request\")\n\t}\n\n\treturn\n}", "func (o *GetClientConfig200ResponseDenylist) HasNetworks() bool {\n\tif o != nil && o.Networks != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func NetList(ip net.IP, subnet net.IP) (IPlist []net.IP) {\n\t//ip, ipnet, err := net.ParseCIDR(cidrNet)\n\tmask := net.IPv4Mask(subnet[0], subnet[1], subnet[2], subnet[3])\n\tipnet := net.IPNet{ip, mask}\n\tfor ip := ip.Mask(mask); ipnet.Contains(ip); incIP(ip) {\n\t\tIPlist = append(IPlist, net.IP{ip[0], ip[1], ip[2], ip[3]})\n\t}\n\treturn\n}", "func (*ListNetworksRequest) Descriptor() ([]byte, []int) {\n\treturn file_packetbroker_api_iam_v1_service_proto_rawDescGZIP(), []int{1}\n}", "func (client WorkloadNetworksClient) ListGatewaysSender(req *http.Request) (*http.Response, error) {\n\treturn client.Send(req, azure.DoRetryWithRegistration(client.Client))\n}", "func (a *NetworkServerAPI) List(ctx context.Context, req *pb.ListNetworkServerRequest) (*pb.ListNetworkServerResponse, error) {\n\tif err := a.validator.Validate(ctx,\n\t\tauth.ValidateNetworkServersAccess(auth.List, req.OrganizationID),\n\t); err != nil {\n\t\treturn nil, grpc.Errorf(codes.Unauthenticated, \"authentication failed: %s\", err)\n\t}\n\n\tisAdmin, err := a.validator.GetIsAdmin(ctx)\n\tif err != nil {\n\t\treturn nil, errToRPCError(err)\n\t}\n\n\tvar count int\n\tvar nss []storage.NetworkServer\n\n\tif req.OrganizationID == 0 {\n\t\tif isAdmin {\n\t\t\tcount, err = storage.GetNetworkServerCount(config.C.PostgreSQL.DB)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errToRPCError(err)\n\t\t\t}\n\t\t\tnss, err = storage.GetNetworkServers(config.C.PostgreSQL.DB, int(req.Limit), int(req.Offset))\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errToRPCError(err)\n\t\t\t}\n\t\t}\n\t} else {\n\t\tcount, err = storage.GetNetworkServerCountForOrganizationID(config.C.PostgreSQL.DB, req.OrganizationID)\n\t\tif err != nil {\n\t\t\treturn nil, errToRPCError(err)\n\t\t}\n\t\tnss, err = storage.GetNetworkServersForOrganizationID(config.C.PostgreSQL.DB, req.OrganizationID, int(req.Limit), int(req.Offset))\n\t\tif err != nil {\n\t\t\treturn nil, errToRPCError(err)\n\t\t}\n\t}\n\n\tresp := pb.ListNetworkServerResponse{\n\t\tTotalCount: int64(count),\n\t}\n\n\tfor _, ns := range nss {\n\t\tresp.Result = append(resp.Result, &pb.GetNetworkServerResponse{\n\t\t\tId: ns.ID,\n\t\t\tCreatedAt: ns.CreatedAt.Format(time.RFC3339Nano),\n\t\t\tUpdatedAt: ns.UpdatedAt.Format(time.RFC3339Nano),\n\t\t\tName: ns.Name,\n\t\t\tServer: ns.Server,\n\t\t})\n\t}\n\n\treturn &resp, nil\n}", "func (c *FakePodNetworkings) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.PodNetworkingList, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewRootListAction(podnetworkingsResource, podnetworkingsKind, opts), &v1beta1.PodNetworkingList{})\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 := &v1beta1.PodNetworkingList{ListMeta: obj.(*v1beta1.PodNetworkingList).ListMeta}\n\tfor _, item := range obj.(*v1beta1.PodNetworkingList).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 (digestInfos DigestInfos) Networks() []string {\n\tret := []string{}\n\tfor _, digestInfo := range digestInfos {\n\t\tret = append(ret, digestInfo.Network)\n\t}\n\treturn ret\n}", "func (l *Libvirt) ConnectListNwfilters(Maxnames int32) (rNames []string, err error) {\n\tvar buf []byte\n\n\targs := ConnectListNwfiltersArgs {\n\t\tMaxnames: Maxnames,\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(179, 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// Names: []string\n\t_, err = dec.Decode(&rNames)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "func RegisteredListenNetworks() []string {\n\tnetworks := []string{}\n\tfor network := range listenFuncs {\n\t\tnetworks = append(networks, network)\n\t}\n\treturn networks\n}", "func (c *ContainerContext) Networks() string {\n\treturn strings.Join(c.c.Networks, \",\")\n}", "func (c *DockerCommand) RefreshNetworks() ([]*Network, error) {\n\tnetworks, err := c.Client.NetworkList(context.Background(), dockerTypes.NetworkListOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\townNetworks := make([]*Network, len(networks))\n\n\tfor i, network := range networks {\n\t\townNetworks[i] = &Network{\n\t\t\tName: network.Name,\n\t\t\tNetwork: network,\n\t\t\tClient: c.Client,\n\t\t\tOSCommand: c.OSCommand,\n\t\t\tLog: c.Log,\n\t\t\tDockerCommand: c,\n\t\t}\n\t}\n\n\treturn ownNetworks, nil\n}", "func (c *ManagedBlockchain) ListNetworksPagesWithContext(ctx aws.Context, input *ListNetworksInput, fn func(*ListNetworksOutput, bool) bool, opts ...request.Option) error {\n\tp := request.Pagination{\n\t\tNewRequest: func() (*request.Request, error) {\n\t\t\tvar inCpy *ListNetworksInput\n\t\t\tif input != nil {\n\t\t\t\ttmp := *input\n\t\t\t\tinCpy = &tmp\n\t\t\t}\n\t\t\treq, _ := c.ListNetworksRequest(inCpy)\n\t\t\treq.SetContext(ctx)\n\t\t\treq.ApplyOptions(opts...)\n\t\t\treturn req, nil\n\t\t},\n\t}\n\n\tfor p.Next() {\n\t\tif !fn(p.Page().(*ListNetworksOutput), !p.HasNextPage()) {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn p.Err()\n}", "func (c *sonicwallNetworkPolicies) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.SonicwallNetworkPolicyList, err error) {\n\tvar timeout time.Duration\n\tif opts.TimeoutSeconds != nil {\n\t\ttimeout = time.Duration(*opts.TimeoutSeconds) * time.Second\n\t}\n\tresult = &v1alpha1.SonicwallNetworkPolicyList{}\n\terr = c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"sonicwallnetworkpolicies\").\n\t\tVersionedParams(&opts, scheme.ParameterCodec).\n\t\tTimeout(timeout).\n\t\tDo(ctx).\n\t\tInto(result)\n\treturn\n}", "func (c *FakeNetworkNodes) List(opts v1.ListOptions) (result *v1alpha1.NetworkNodeList, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewListAction(networknodesResource, networknodesKind, c.ns, opts), &v1alpha1.NetworkNodeList{})\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.NetworkNodeList{}\n\tfor _, item := range obj.(*v1alpha1.NetworkNodeList).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 handleNetworks(ctx context.Context, sm subnet.Manager, w http.ResponseWriter, r *http.Request) {\n\tcursor := getCursor(r.URL)\n\twr, err := sm.WatchNetworks(ctx, cursor)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tfmt.Fprint(w, err)\n\t\treturn\n\t}\n\n\tswitch wr.Cursor.(type) {\n\tcase string:\n\tcase fmt.Stringer:\n\t\twr.Cursor = wr.Cursor.(fmt.Stringer).String()\n\tdefault:\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tfmt.Fprint(w, fmt.Errorf(\"internal error: watch cursor is of unknown type\"))\n\t\treturn\n\t}\n\n\tjsonResponse(w, http.StatusOK, wr)\n}", "func (client WorkloadNetworksClient) ListPortMirroring(ctx context.Context, resourceGroupName string, privateCloudName string) (result WorkloadNetworkPortMirroringListPage, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/WorkloadNetworksClient.ListPortMirroring\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.wnpml.Response.Response != nil {\n\t\t\t\tsc = result.wnpml.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tif err := validation.Validate([]validation.Validation{\n\t\t{TargetValue: client.SubscriptionID,\n\t\t\tConstraints: []validation.Constraint{{Target: \"client.SubscriptionID\", Name: validation.MinLength, Rule: 1, Chain: nil}}},\n\t\t{TargetValue: resourceGroupName,\n\t\t\tConstraints: []validation.Constraint{{Target: \"resourceGroupName\", Name: validation.MaxLength, Rule: 90, Chain: nil},\n\t\t\t\t{Target: \"resourceGroupName\", Name: validation.MinLength, Rule: 1, Chain: nil},\n\t\t\t\t{Target: \"resourceGroupName\", Name: validation.Pattern, Rule: `^[-\\w\\._\\(\\)]+$`, Chain: nil}}}}); err != nil {\n\t\treturn result, validation.NewError(\"avs.WorkloadNetworksClient\", \"ListPortMirroring\", err.Error())\n\t}\n\n\tresult.fn = client.listPortMirroringNextResults\n\treq, err := client.ListPortMirroringPreparer(ctx, resourceGroupName, privateCloudName)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"avs.WorkloadNetworksClient\", \"ListPortMirroring\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.ListPortMirroringSender(req)\n\tif err != nil {\n\t\tresult.wnpml.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"avs.WorkloadNetworksClient\", \"ListPortMirroring\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult.wnpml, err = client.ListPortMirroringResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"avs.WorkloadNetworksClient\", \"ListPortMirroring\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\tif result.wnpml.hasNextLink() && result.wnpml.IsEmpty() {\n\t\terr = result.NextWithContext(ctx)\n\t\treturn\n\t}\n\n\treturn\n}", "func (*ListNetworksRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_vpc_v1_network_service_proto_rawDescGZIP(), []int{1}\n}", "func (u *Unifi) Networks(site *Site) ([]Network, error) {\n\tvar response struct {\n\t\tData []Network\n\t\tMeta meta\n\t}\n\terr := u.parse(site, \"rest/networkconf\", nil, &response)\n\treturn response.Data, err\n}", "func (client IdentityClient) ListNetworkSources(ctx context.Context, request ListNetworkSourcesRequest) (response ListNetworkSourcesResponse, 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.listNetworkSources, 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 = ListNetworkSourcesResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId}\n\t\t\t} else {\n\t\t\t\tresponse = ListNetworkSourcesResponse{}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\tif convertedResponse, ok := ociResponse.(ListNetworkSourcesResponse); ok {\n\t\tresponse = convertedResponse\n\t} else {\n\t\terr = fmt.Errorf(\"failed to convert OCIResponse into ListNetworkSourcesResponse\")\n\t}\n\treturn\n}", "func (m *TenantMutation) SetNetworks(s []string) {\n\tm.networks = &s\n}", "func (o *VirtualizationVmwareVirtualMachineAllOf) SetNetworks(v []VirtualizationBaseNetworkRelationship) {\n\to.Networks = v\n}", "func (in *Database) GetNetworks() ([]*types.Network, error) {\n\trec := []*types.Network{}\n\ttxn := in.db.Txn(false)\n\tdefer txn.Abort()\n\tit, err := txn.Get(\"network\", \"id\")\n\tif err != nil {\n\t\treturn rec, err\n\t}\n\tfor obj := it.Next(); obj != nil; obj = it.Next() {\n\t\trec = append(rec, obj.(*types.Network))\n\t}\n\treturn rec, nil\n}", "func (*ListNetworksResponse) Descriptor() ([]byte, []int) {\n\treturn file_packetbroker_api_iam_v1_service_proto_rawDescGZIP(), []int{2}\n}", "func ListNics(bridge *netlink.Bridge, physical bool) ([]netlink.Link, error) {\n\tlinks, err := netlink.LinkList()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfiltered := links[:0]\n\n\tfor _, link := range links {\n\t\tif link.Attrs().MasterIndex != bridge.Index {\n\t\t\tcontinue\n\t\t}\n\t\tif physical && link.Type() != \"device\" {\n\t\t\tcontinue\n\t\t}\n\t\tfiltered = append(filtered, link)\n\t}\n\n\treturn filtered, nil\n}", "func (c *Client) Networks() *NetworksClient {\n\treturn &NetworksClient{c}\n}", "func (n VpcNatGateways) List(region account.Region, account account.Account, force bool) ([]cloud.Resource, error) {\n\tclient, err := vpc.NewClientWithAccessKey(string(region), account.AccessKeyID, account.AccessKeySecret)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trequest := vpc.CreateDescribeNatGatewaysRequest()\n\trequest.PageSize = \"50\"\n\tresponse, err := client.DescribeNatGateways(request)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnatGateways := make([]cloud.Resource, 0)\n\tfor _, natGatewayItem := range response.NatGateways.NatGateway {\n\t\tsnatTables, err := fetchSnatTables(client, natGatewayItem.SnatTableIds)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tnatGateways = append(natGateways, VpcNatGateway{NatGateway: natGatewayItem, SnatTables: snatTables})\n\t}\n\n\treturn natGateways, nil\n}", "func (c *ManagedBlockchain) ListNetworksWithContext(ctx aws.Context, input *ListNetworksInput, opts ...request.Option) (*ListNetworksOutput, error) {\n\treq, out := c.ListNetworksRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "func (m *UserMutation) SetNetworks(s []string) {\n\tm.networks = &s\n}", "func GetAllNetworkConfigList(cniPath *CNIPath) ([]*libcni.NetworkConfigList, error) {\n\tnetworks := make([]*libcni.NetworkConfigList, 0)\n\n\tif cniPath == nil {\n\t\treturn networks, ErrNoCNIConfig\n\t}\n\tif cniPath.Conf == \"\" {\n\t\treturn networks, ErrNoCNIConfig\n\t}\n\n\tfiles, err := libcni.ConfFiles(cniPath.Conf, []string{\".conf\", \".json\", \".conflist\"})\n\tif err != nil {\n\t\treturn nil, err\n\t} else if len(files) == 0 {\n\t\treturn nil, libcni.NoConfigsFoundError{Dir: cniPath.Conf}\n\t}\n\tsort.Strings(files)\n\n\tfor _, file := range files {\n\t\tif strings.HasSuffix(file, \".conflist\") {\n\t\t\tconf, err := libcni.ConfListFromFile(file)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"%s: %s\", file, err)\n\t\t\t}\n\t\t\tnetworks = append(networks, conf)\n\t\t} else {\n\t\t\tconf, err := libcni.ConfFromFile(file)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"%s: %s\", file, err)\n\t\t\t}\n\t\t\tconfList, err := libcni.ConfListFromConf(conf)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"%s: %s\", file, err)\n\t\t\t}\n\t\t\tnetworks = append(networks, confList)\n\t\t}\n\t}\n\n\treturn networks, nil\n}", "func (nls *NetworkListService) ListNetworkLists(opts ListNetworkListsOptions) (*[]AkamaiNetworkList, *ClientResponse, error) {\n\n\tapiURI := fmt.Sprintf(\"%s?listType=%s&extended=%t&includeDeprecated=%t&includeElements=%t\",\n\t\tapiPaths[\"network_list\"],\n\t\topts.TypeOflist,\n\t\topts.Extended,\n\t\topts.IncludeDeprecated,\n\t\topts.IncludeElements)\n\n\tvar k *AkamaiNetworkLists\n\tresp, err := nls.client.NewRequest(\"GET\", apiURI, nil, &k)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn &k.NetworkLists, resp, err\n\n}", "func (vns *VirtualNetworkService) ListAll(ctx context.Context,\n\tfilter OwnershipFilter) ([]*resources.VirtualNetwork, error) {\n\treturn vns.list(ctx, int(filter), pageOffsetDefault, pageSizeDefault)\n}", "func (o *VirtualizationVmwareVirtualMachineAllOf) GetNetworksOk() ([]VirtualizationBaseNetworkRelationship, bool) {\n\tif o == nil || o.Networks == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Networks, true\n}", "func List(ctx context.Context, filters container.FilterBuilder) ([]*types.Node, error) {\n\tres := []*types.Node{}\n\tvisit := func(ctx context.Context, cluster string, node *types.Node) {\n\t\tres = append(res, node)\n\t}\n\treturn res, list(ctx, visit, filters)\n}", "func (c *nodes) List(opts api.ListOptions) (*api.NodeList, error) {\n\tresult := &api.NodeList{}\n\terr := c.r.Get().Resource(c.resourceName()).VersionedParams(&opts, api.ParameterCodec).Do().Into(result)\n\treturn result, err\n}", "func (client IdentityClient) listNetworkSources(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodGet, \"/networkSources\", binaryReqBody, extraHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response ListNetworkSourcesResponse\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 (mr *MockFinderMockRecorder) NetworkList(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"NetworkList\", reflect.TypeOf((*MockFinder)(nil).NetworkList), arg0, arg1)\n}", "func ExtractList(r pagination.Page) ([]NetworkExtAttrs, error) {\n\tvar s struct {\n\t\tNetworks []NetworkExtAttrs `json:\"networks\" json:\"networks\"`\n\t}\n\terr := (r.(networks.NetworkPage)).ExtractInto(&s)\n\treturn s.Networks, err\n}", "func (*ListNetworksResponse) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_vpc_v1_network_service_proto_rawDescGZIP(), []int{2}\n}", "func (a *Client) ListOpenstackNetworksNoCredentialsV2(params *ListOpenstackNetworksNoCredentialsV2Params, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListOpenstackNetworksNoCredentialsV2OK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewListOpenstackNetworksNoCredentialsV2Params()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"listOpenstackNetworksNoCredentialsV2\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/api/v2/projects/{project_id}/clusters/{cluster_id}/providers/openstack/networks\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &ListOpenstackNetworksNoCredentialsV2Reader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*ListOpenstackNetworksNoCredentialsV2OK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\tunexpectedSuccess := result.(*ListOpenstackNetworksNoCredentialsV2Default)\n\treturn nil, runtime.NewAPIError(\"unexpected success response: content available as default response in error\", unexpectedSuccess, unexpectedSuccess.Code())\n}", "func (a *Client) GetPlatformNetworks(params *GetPlatformNetworksParams) (*GetPlatformNetworksOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetPlatformNetworksParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getPlatformNetworks\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/v1/platform_resources/networks\",\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: &GetPlatformNetworksReader{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.(*GetPlatformNetworksOK), nil\n\n}", "func (d *Driver) createNetworks() error {\n\tif err := d.createNetwork(\"default\", defaultNetworkTmpl); err != nil {\n\t\treturn errors.Wrap(err, \"creating default network\")\n\t}\n\tif err := d.createNetwork(d.NetworkName, privateNetworkTmpl); err != nil {\n\t\treturn errors.Wrap(err, \"creating private network\")\n\t}\n\n\treturn nil\n}", "func TestGetServerNetworks(t *testing.T) {\n\trecord(t, \"getservernetworks\", func(t *testing.T, svc *Service) {\n\t\tserverDetails, err := createServer(svc, \"TestGetServerNetworks\")\n\t\trequire.NoError(t, err)\n\n\t\tnetworking, err := svc.GetServerNetworks(&request.GetServerNetworksRequest{\n\t\t\tServerUUID: serverDetails.UUID,\n\t\t})\n\t\trequire.NoError(t, err)\n\n\t\tsdNetworking := upcloud.Networking(serverDetails.Networking)\n\t\tassert.Equal(t, &sdNetworking, networking)\n\t})\n}", "func (c *MockSubnetsClient) List(ctx context.Context, resourceGroupName, virtualNetworkName string) ([]network.Subnet, error) {\n\tvar l []network.Subnet\n\tfor _, subnet := range c.Subnets {\n\t\tl = append(l, subnet)\n\t}\n\treturn l, nil\n}", "func deleteAllNetworks() error {\n\tnetworks, err := hcsshim.HNSListNetworkRequest(\"GET\", \"\", \"\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, network := range networks {\n\t\tif network.Name != \"nat\" {\n\t\t\t_, err = network.Delete()\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 (uc *UserCreate) SetNetworks(s []string) *UserCreate {\n\tuc.networks = &s\n\treturn uc\n}", "func (uc *UserCreate) SetNetworks(s []string) *UserCreate {\n\tuc.networks = &s\n\treturn uc\n}", "func (l *Libvirt) ConnectListAllNwfilters(NeedResults int32, Flags uint32) (rFilters []Nwfilter, rRet uint32, err error) {\n\tvar buf []byte\n\n\targs := ConnectListAllNwfiltersArgs {\n\t\tNeedResults: NeedResults,\n\t\tFlags: Flags,\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(286, 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// Filters: []Nwfilter\n\t_, err = dec.Decode(&rFilters)\n\tif err != nil {\n\t\treturn\n\t}\n\t// Ret: uint32\n\t_, err = dec.Decode(&rRet)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "func (s *NodesService) List(env string, query *url.Values) (*v1.NodeList, error) {\n\tclient, err := getClient(env)\n\tif err != nil {\n\t\treturn nil, invalidEnvError(env)\n\t}\n\tresp := &v1.NodeList{}\n\tpath := \"nodes\"\n\tif query != nil {\n\t\tpath += \"?\" + query.Encode()\n\t}\n\t_, err = client.makeRequest(\"GET\", path, nil, resp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp, nil\n}", "func (o InstanceOutput) Networks() InstanceNetworkArrayOutput {\n\treturn o.ApplyT(func(v *Instance) InstanceNetworkArrayOutput { return v.Networks }).(InstanceNetworkArrayOutput)\n}", "func (l *Libvirt) NetworkListAllPorts(OptNetwork Network, NeedResults int32, Flags uint32) (rPorts []NetworkPort, rRet uint32, err error) {\n\tvar buf []byte\n\n\targs := NetworkListAllPortsArgs {\n\t\tOptNetwork: OptNetwork,\n\t\tNeedResults: NeedResults,\n\t\tFlags: Flags,\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(404, 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// Ports: []NetworkPort\n\t_, err = dec.Decode(&rPorts)\n\tif err != nil {\n\t\treturn\n\t}\n\t// Ret: uint32\n\t_, err = dec.Decode(&rRet)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "func (client WorkloadNetworksClient) ListGatewaysResponder(resp *http.Response) (result WorkloadNetworkGatewayList, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "func NewListOpenstackNetworksNoCredentialsDefault(code int) *ListOpenstackNetworksNoCredentialsDefault {\n\treturn &ListOpenstackNetworksNoCredentialsDefault{\n\t\t_statusCode: code,\n\t}\n}", "func (m *RoutingRule) GetNetworkList() *net.NetworkList {\n\tif m != nil {\n\t\treturn m.NetworkList\n\t}\n\treturn nil\n}", "func (o *VirtualizationVmwareVirtualMachineAllOf) HasNetworks() bool {\n\tif o != nil && o.Networks != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (m *TenantMutation) Networks() (r []string, exists bool) {\n\tv := m.networks\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}" ]
[ "0.7282028", "0.6882022", "0.6789322", "0.676154", "0.64454633", "0.64441615", "0.64120567", "0.6375304", "0.63628054", "0.6254051", "0.62310183", "0.62119883", "0.6144147", "0.6118513", "0.60562617", "0.5999529", "0.597844", "0.5951568", "0.5943419", "0.59412247", "0.5892497", "0.58893394", "0.58726233", "0.58426595", "0.5840915", "0.5821176", "0.57808906", "0.5773233", "0.5724375", "0.5706261", "0.5703032", "0.56909084", "0.5684141", "0.56834453", "0.5680813", "0.5652787", "0.5648072", "0.5613143", "0.5607633", "0.55996335", "0.55955005", "0.55944943", "0.55879754", "0.5574758", "0.55565053", "0.5552107", "0.5541679", "0.55387044", "0.5533194", "0.5531582", "0.55284977", "0.55244464", "0.5521683", "0.5480219", "0.54401094", "0.5433224", "0.5412907", "0.5408695", "0.5403814", "0.5402246", "0.53990835", "0.53978467", "0.5358584", "0.5355528", "0.5351958", "0.53402895", "0.53258723", "0.5310935", "0.5310552", "0.5294855", "0.5294353", "0.5288753", "0.52705705", "0.52484196", "0.52380437", "0.52336115", "0.52114785", "0.5207154", "0.52036643", "0.52009445", "0.5195881", "0.5194196", "0.5187619", "0.5183188", "0.5169623", "0.51629496", "0.51571316", "0.5155806", "0.51479864", "0.5147362", "0.5147362", "0.5134851", "0.51294214", "0.5128155", "0.512608", "0.5122377", "0.5120562", "0.5119403", "0.5118445", "0.5103911" ]
0.75115097
0
GetSubnetwork uses the override method GetSubnetworkFn or the real implementation.
func (c *TestClient) GetSubnetwork(project, region, name string) (*compute.Subnetwork, error) { if c.GetSubnetworkFn != nil { return c.GetSubnetworkFn(project, region, name) } return c.client.GetSubnetwork(project, region, name) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o RegionNetworkEndpointGroupOutput) Subnetwork() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *RegionNetworkEndpointGroup) pulumi.StringPtrOutput { return v.Subnetwork }).(pulumi.StringPtrOutput)\n}", "func (o NetworkInterfaceOutput) Subnetwork() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v NetworkInterface) *string { return v.Subnetwork }).(pulumi.StringPtrOutput)\n}", "func (o RouterInterfaceOutput) Subnetwork() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v RouterInterface) *string { return v.Subnetwork }).(pulumi.StringPtrOutput)\n}", "func (o LookupRegionNetworkEndpointGroupResultOutput) Subnetwork() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupRegionNetworkEndpointGroupResult) string { return v.Subnetwork }).(pulumi.StringOutput)\n}", "func (de *DockerEngine) getSubNet() (string, error) {\n\tde.subNetMu.Lock()\n\tdefer de.subNetMu.Unlock()\n\n\taddrs, err := net.InterfaceAddrs()\n\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"Error getting network addresses\")\n\t}\n\n\tvar nets []*net.IPNet\n\n\tfor _, addr := range addrs {\n\t\tdockerLog.Debugf(\"Inspecting interface %s\", addr.String())\n\n\t\t_, n, err := net.ParseCIDR(addr.String())\n\n\t\tif err != nil {\n\t\t\tdockerLog.Warningf(\"Error parsing address: %s\", addr.String())\n\n\t\t\tcontinue\n\t\t}\n\n\t\tnets = append(nets, n)\n\t}\n\n\tnetaddr := func() string {\n\t\ttpl := \"10.%d.%d.0/24\"\n\n\t\treturn fmt.Sprintf(tpl, de.subNetOct1, de.subNetOct2)\n\t}\n\n\t_, pnet, _ := net.ParseCIDR(netaddr())\n\n\tfor {\n\t\t// Find non-overlapping network\n\t\toverlap := false\n\n\t\tfor _, n := range nets {\n\t\t\tif lib.NetsOverlap(pnet, n) {\n\t\t\t\toverlap = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif overlap {\n\t\t\tde.subNetOct2 += 1\n\n\t\t\tif de.subNetOct2 > 255 {\n\t\t\t\tde.subNetOct1 += 1\n\t\t\t\tde.subNetOct2 = 0\n\t\t\t}\n\n\t\t\t_, pnet, _ = net.ParseCIDR(netaddr())\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn netaddr(), nil\n}", "func (o RouterInterfaceResponseOutput) Subnetwork() pulumi.StringOutput {\n\treturn o.ApplyT(func(v RouterInterfaceResponse) string { return v.Subnetwork }).(pulumi.StringOutput)\n}", "func (o NetworkInterfaceResponseOutput) Subnetwork() pulumi.StringOutput {\n\treturn o.ApplyT(func(v NetworkInterfaceResponse) string { return v.Subnetwork }).(pulumi.StringOutput)\n}", "func (o LookupWorkstationClusterResultOutput) Subnetwork() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupWorkstationClusterResult) string { return v.Subnetwork }).(pulumi.StringOutput)\n}", "func (o ClusterOutput) Subnetwork() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Cluster) pulumi.StringOutput { return v.Subnetwork }).(pulumi.StringOutput)\n}", "func (m *MachineScope) Subnet() infrav1.SubnetSpec {\n\tfor _, subnet := range m.Subnets() {\n\t\tif subnet.Name == m.AzureMachine.Spec.NetworkInterfaces[0].SubnetName {\n\t\t\treturn subnet\n\t\t}\n\t}\n\n\treturn infrav1.SubnetSpec{}\n}", "func (c *Client) getSubnet(ctx context.Context, resourceGroupName, virtualNetwork, subNetwork string) (*aznetwork.Subnet, error) {\n\tctx, cancel := context.WithTimeout(ctx, 1*time.Minute)\n\tdefer cancel()\n\n\tsubnetsClient, err := c.getSubnetsClient(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsubnet, err := subnetsClient.Get(ctx, resourceGroupName, virtualNetwork, subNetwork, \"\")\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to get subnet %s\", subNetwork)\n\t}\n\n\treturn &subnet, nil\n}", "func (c *MockAzureCloud) Subnet() azure.SubnetsClient {\n\treturn c.SubnetsClient\n}", "func GetSubnet(t *testing.T) IPNet {\n\tt.Helper()\n\n\tip := net.IP([]byte{byte(rand.Intn(255)), byte(rand.Intn(255)), byte(rand.Intn(255)), byte(rand.Intn(255))})\n\tmask := net.CIDRMask(rand.Intn(32), 32)\n\tsub := ip.Mask(mask)\n\n\treturn IPNet(net.IPNet{IP: sub, Mask: mask})\n}", "func (s *ClusterScope) Subnet(name string) infrav1.SubnetSpec {\n\tfor _, sn := range s.AzureCluster.Spec.NetworkSpec.Subnets {\n\t\tif sn.Name == name {\n\t\t\treturn sn\n\t\t}\n\t}\n\n\treturn infrav1.SubnetSpec{}\n}", "func (u *User) GetSubnet(nodeID, subnetID string) (map[string]interface{}, error) {\n\tlog.info(\"========== GET SUBNET ==========\")\n\turl := buildURL(path[\"users\"], u.UserID, path[\"nodes\"], nodeID, path[\"subnets\"], subnetID)\n\n\treturn u.do(\"GET\", url, \"\", nil)\n}", "func SubnetworkToProto(resource *compute.Subnetwork) *computepb.ComputeSubnetwork {\n\tp := &computepb.ComputeSubnetwork{}\n\tp.SetCreationTimestamp(dcl.ValueOrEmptyString(resource.CreationTimestamp))\n\tp.SetDescription(dcl.ValueOrEmptyString(resource.Description))\n\tp.SetGatewayAddress(dcl.ValueOrEmptyString(resource.GatewayAddress))\n\tp.SetIpCidrRange(dcl.ValueOrEmptyString(resource.IPCidrRange))\n\tp.SetName(dcl.ValueOrEmptyString(resource.Name))\n\tp.SetNetwork(dcl.ValueOrEmptyString(resource.Network))\n\tp.SetFingerprint(dcl.ValueOrEmptyString(resource.Fingerprint))\n\tp.SetPurpose(ComputeSubnetworkPurposeEnumToProto(resource.Purpose))\n\tp.SetRole(ComputeSubnetworkRoleEnumToProto(resource.Role))\n\tp.SetPrivateIpGoogleAccess(dcl.ValueOrEmptyBool(resource.PrivateIPGoogleAccess))\n\tp.SetRegion(dcl.ValueOrEmptyString(resource.Region))\n\tp.SetLogConfig(ComputeSubnetworkLogConfigToProto(resource.LogConfig))\n\tp.SetProject(dcl.ValueOrEmptyString(resource.Project))\n\tp.SetSelfLink(dcl.ValueOrEmptyString(resource.SelfLink))\n\tp.SetEnableFlowLogs(dcl.ValueOrEmptyBool(resource.EnableFlowLogs))\n\tsSecondaryIPRanges := make([]*computepb.ComputeSubnetworkSecondaryIPRanges, len(resource.SecondaryIPRanges))\n\tfor i, r := range resource.SecondaryIPRanges {\n\t\tsSecondaryIPRanges[i] = ComputeSubnetworkSecondaryIPRangesToProto(&r)\n\t}\n\tp.SetSecondaryIpRanges(sSecondaryIPRanges)\n\n\treturn p\n}", "func ProtoToSubnetwork(p *computepb.ComputeSubnetwork) *compute.Subnetwork {\n\tobj := &compute.Subnetwork{\n\t\tCreationTimestamp: dcl.StringOrNil(p.GetCreationTimestamp()),\n\t\tDescription: dcl.StringOrNil(p.GetDescription()),\n\t\tGatewayAddress: dcl.StringOrNil(p.GetGatewayAddress()),\n\t\tIPCidrRange: dcl.StringOrNil(p.GetIpCidrRange()),\n\t\tName: dcl.StringOrNil(p.GetName()),\n\t\tNetwork: dcl.StringOrNil(p.GetNetwork()),\n\t\tFingerprint: dcl.StringOrNil(p.GetFingerprint()),\n\t\tPurpose: ProtoToComputeSubnetworkPurposeEnum(p.GetPurpose()),\n\t\tRole: ProtoToComputeSubnetworkRoleEnum(p.GetRole()),\n\t\tPrivateIPGoogleAccess: dcl.Bool(p.GetPrivateIpGoogleAccess()),\n\t\tRegion: dcl.StringOrNil(p.GetRegion()),\n\t\tLogConfig: ProtoToComputeSubnetworkLogConfig(p.GetLogConfig()),\n\t\tProject: dcl.StringOrNil(p.GetProject()),\n\t\tSelfLink: dcl.StringOrNil(p.GetSelfLink()),\n\t\tEnableFlowLogs: dcl.Bool(p.GetEnableFlowLogs()),\n\t}\n\tfor _, r := range p.GetSecondaryIpRanges() {\n\t\tobj.SecondaryIPRanges = append(obj.SecondaryIPRanges, *ProtoToComputeSubnetworkSecondaryIPRanges(r))\n\t}\n\treturn obj\n}", "func (s *SubnetworkServer) applySubnetwork(ctx context.Context, c *compute.Client, request *computepb.ApplyComputeSubnetworkRequest) (*computepb.ComputeSubnetwork, error) {\n\tp := ProtoToSubnetwork(request.GetResource())\n\tres, err := c.ApplySubnetwork(ctx, p)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tr := SubnetworkToProto(res)\n\treturn r, nil\n}", "func (m *MockNetwork) GetSubnet(arg0 string) (*subnets.Subnet, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetSubnet\", arg0)\n\tret0, _ := ret[0].(*subnets.Subnet)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (_class PIFClass) GetNetwork(sessionID SessionRef, self PIFRef) (_retval NetworkRef, _err error) {\n\t_method := \"PIF.get_network\"\n\t_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"session_id\"), sessionID)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_selfArg, _err := convertPIFRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"self\"), self)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_retval, _err = convertNetworkRefToGo(_method + \" -> \", _result.Value)\n\treturn\n}", "func (o ServiceConnectionPolicyPscConfigOutput) Subnetworks() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v ServiceConnectionPolicyPscConfig) []string { return v.Subnetworks }).(pulumi.StringArrayOutput)\n}", "func (r Virtual_Guest_Network_Component) GetSubnets() (resp []datatypes.Network_Subnet, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Virtual_Guest_Network_Component\", \"getSubnets\", nil, &r.Options, &resp)\n\treturn\n}", "func GetSubkind(n *scpb.Node) string {\n\tif k := n.GetGenericSubkind(); k != \"\" {\n\t\treturn k\n\t}\n\treturn SubkindString(n.GetKytheSubkind())\n}", "func getSubnetPrefix(ctx context.Context, c clientset.Interface) (*net.IPNet, error) {\n\tnode, err := getReadySchedulableWorkerNode(ctx, c)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error getting a ready schedulable worker Node, err: %w\", err)\n\t}\n\tinternalIP, err := getInternalIP(node)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error getting Node internal IP, err: %w\", err)\n\t}\n\tip := netutils.ParseIPSloppy(internalIP)\n\tif ip == nil {\n\t\treturn nil, fmt.Errorf(\"invalid IP address format: %s\", internalIP)\n\t}\n\n\t// if IPv6 return a net.IPNet with IP = ip and mask /64\n\tciderMask := net.CIDRMask(64, 128)\n\t// if IPv4 return a net.IPNet with IP = ip and mask /16\n\tif netutils.IsIPv4(ip) {\n\t\tciderMask = net.CIDRMask(16, 32)\n\t}\n\treturn &net.IPNet{IP: ip.Mask(ciderMask), Mask: ciderMask}, nil\n}", "func getSubNodeIP() string {\n\tresp, err := http.Get(\"http://ifconfig.me\")\n\thandleError(err)\n\tbody, err := ioutil.ReadAll(resp.Body)\n\thandleError(err)\n\tdefer resp.Body.Close()\n\n\treturn string(body)\n}", "func (c *Client) GetNetwork(id string) (*Network, error) {\n\treq, err := http.NewRequest(\"GET\", hetznerAPIBaseURL+\"/networks/\"+id, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating request: %w\", err)\n\t}\n\treq.Header.Add(\"Authorization\", \"Bearer \"+c.hCloudToken)\n\tresp, err := c.httpClient.Do(req)\n\tif err != nil {\n\t\tvar neterr net.Error\n\t\tif errors.As(err, &neterr) && (neterr.Timeout() || neterr.Temporary()) {\n\t\t\treturn nil, &errorx.RetryableError{Message: \"timeout or temporary error in HTTP request\", Err: neterr}\n\t\t}\n\t\treturn nil, fmt.Errorf(\"error in http request: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != 200 {\n\t\treturn nil, fmt.Errorf(\"unexpected status code %d != 200\", resp.StatusCode)\n\t}\n\tvar rawNetwork struct {\n\t\tNetwork struct {\n\t\t\tIPRange string `json:\"ip_range\"`\n\t\t\tSubnets []struct {\n\t\t\t\tGateway string `json:\"gateway\"`\n\t\t\t} `json:\"subnets\"`\n\t\t} `json:\"network\"`\n\t}\n\tdecoder := json.NewDecoder(resp.Body)\n\terr = decoder.Decode(&rawNetwork)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error unmarshalling JSON: %w\", err)\n\t}\n\tif len(rawNetwork.Network.Subnets) != 1 {\n\t\treturn nil, fmt.Errorf(\"invalid number of subnets for network %s: %d != 1\", id, len(rawNetwork.Network.Subnets))\n\t}\n\tnetwork := Network{IPRange: rawNetwork.Network.IPRange, GatewayIP: rawNetwork.Network.Subnets[0].Gateway}\n\treturn &network, nil\n}", "func (c *TestClient) ListSubnetworks(project, region string, opts ...ListCallOption) ([]*compute.Subnetwork, error) {\n\tif c.ListSubnetworksFn != nil {\n\t\treturn c.ListSubnetworksFn(project, region, opts...)\n\t}\n\treturn c.client.ListSubnetworks(project, region, opts...)\n}", "func (o ServiceConnectionPolicyPscConfigPtrOutput) Subnetworks() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *ServiceConnectionPolicyPscConfig) []string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Subnetworks\n\t}).(pulumi.StringArrayOutput)\n}", "func (o NetworkAttachmentOutput) Subnetworks() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *NetworkAttachment) pulumi.StringArrayOutput { return v.Subnetworks }).(pulumi.StringArrayOutput)\n}", "func (c *Client) GetComputeSubnet(ctx context.Context, resourceGroupName, virtualNetwork, subNetwork string) (*aznetwork.Subnet, error) {\n\treturn c.getSubnet(ctx, resourceGroupName, virtualNetwork, subNetwork)\n}", "func (tc *TestClient) Subprotocol() string {\n\treturn tc.WsConnection.Subprotocol()\n}", "func (c *Conn) Subprotocol() string {\n\treturn c.subprotocol\n}", "func (d *Driver) getSubnetResourceID() string {\n\tsubsID := d.cloud.SubscriptionID\n\tif len(d.cloud.NetworkResourceSubscriptionID) > 0 {\n\t\tsubsID = d.cloud.NetworkResourceSubscriptionID\n\t}\n\n\trg := d.cloud.ResourceGroup\n\tif len(d.cloud.VnetResourceGroup) > 0 {\n\t\trg = d.cloud.VnetResourceGroup\n\t}\n\n\treturn fmt.Sprintf(subnetTemplate, subsID, rg, d.cloud.VnetName, d.cloud.SubnetName)\n}", "func (a *Client) GetForSubcategory(params *GetForSubcategoryParams, authInfo runtime.ClientAuthInfoWriter) (*GetForSubcategoryOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetForSubcategoryParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"GetForSubcategory\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/api/v1/UsageCost/resellerCustomer/{resellerCustomerId}/subscription/{subscriptionId}/category/{category}/subcategory/{subcategory}/currency/{currencyCode}\",\n\t\tProducesMediaTypes: []string{\"application/json\", \"text/json\", \"text/plain\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetForSubcategoryReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*GetForSubcategoryOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for GetForSubcategory: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func (o RouterNatOutput) Subnetworks() RouterNatSubnetworkToNatArrayOutput {\n\treturn o.ApplyT(func(v RouterNat) []RouterNatSubnetworkToNat { return v.Subnetworks }).(RouterNatSubnetworkToNatArrayOutput)\n}", "func (sqlStore *SQLStore) GetSubnet(id string) (*model.Subnet, error) {\n\tvar rawSubnet rawSubnet\n\terr := sqlStore.getBuilder(sqlStore.db, &rawSubnet, subnetSelect.Where(\"ID = ?\", id))\n\tif err == sql.ErrNoRows {\n\t\treturn nil, nil\n\t} else if err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to get subnet by id\")\n\t}\n\n\treturn rawSubnet.toSubnet()\n}", "func (client Client) Subnets() network.SubnetsClient {\n\tif client.subnets == nil {\n\t\tclnt := network.NewSubnetsClientWithBaseURI(client.baseURI, client.subscriptionID)\n\t\tclnt.Authorizer = client.Authorizer\n\t\tclnt.RequestInspector = client.RequestInspector\n\t\tclnt.ResponseInspector = client.ResponseInspector\n\t\tclient.subnets = &clnt\t\t\n\t}\t\n\treturn *client.subnets\n}", "func GetSubnetandvirtualnetwork(client Clients,\n\tctx context.Context, resourceGroup string, networkinterface string, expand string) (virtualnetworkandsubnet string, err error) {\n\tvmInterface := client.VMInterface\n\tinterfaces, err := vmInterface.Get(ctx, resourceGroup, networkinterface, expand)\n\tif err != nil {\n\t\t\treturn\n\t}\n\tinterfaceinfo := *interfaces.InterfacePropertiesFormat.IPConfigurations\n\tinterfID := *interfaceinfo[0].InterfaceIPConfigurationPropertiesFormat\n\tif interfID.Subnet != nil {\n\t\t\tID := strings.Split(*interfID.Subnet.ID, \"/\")\n\t\t\tvirtualnetworkandsubnet = ID[8] + \"/\" + ID[10]\n\t} else {\n\t\t\terr = errors.New(\"Vm has no virtual network and subnet\")\n\t}\n\treturn\n}", "func (a SubAccountClient) GetSubAccountBalance(req *rest3.RequestForSubAccountBalance) (rest3.ResponseForSubAccountBalance, error) {\n\tpanic(\"implement me\")\n}", "func (c *Client) GetControlPlaneSubnet(ctx context.Context, resourceGroupName, virtualNetwork, subNetwork string) (*aznetwork.Subnet, error) {\n\treturn c.getSubnet(ctx, resourceGroupName, virtualNetwork, subNetwork)\n}", "func (o NetworkInterfaceOutput) SubnetId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *NetworkInterface) pulumi.StringOutput { return v.SubnetId }).(pulumi.StringOutput)\n}", "func (c *TestClient) DeleteSubnetwork(project, region, name string) error {\n\tif c.DeleteSubnetworkFn != nil {\n\t\treturn c.DeleteSubnetworkFn(project, region, name)\n\t}\n\treturn c.client.DeleteSubnetwork(project, region, name)\n}", "func (c *Client) GetSubnet(subnetID string) (Subnet, error) {\n\tvar subnetData Subnet\n\treq, _ := http.NewRequest(\"GET\", c.ServerURL+\"/api/\"+c.Application+\"/subnets/\"+subnetID+\"/\", nil)\n\tbody, err := c.Do(req)\n\tif err != nil {\n\t\treturn subnetData, err\n\t}\n\terr = json.Unmarshal(body, &subnetData)\n\tif err != nil {\n\t\treturn subnetData, err\n\t}\n\tif subnetData.Code != 200 {\n\t\treturn subnetData, errors.New(subnetData.Message)\n\t}\n\treturn subnetData, nil\n}", "func (c *Compound) GetSub(s string) Modifiable {\n\tc.lock.RLock()\n\tm := c.subRenderables[s]\n\tc.lock.RUnlock()\n\treturn m\n}", "func (instance *Network) ToProtocol() (_ *protocol.Network, xerr fail.Error) {\n\tdefer fail.OnPanic(&xerr)\n\n\tif instance == nil || instance.IsNull() {\n\t\treturn nil, fail.InvalidInstanceError()\n\t}\n\n\tinstance.lock.RLock()\n\tdefer instance.lock.RUnlock()\n\n\tvar pn *protocol.Network\n\txerr = instance.Review(func(clonable data.Clonable, props *serialize.JSONProperties) fail.Error {\n\t\tan, ok := clonable.(*abstract.Network)\n\t\tif !ok {\n\t\t\treturn fail.InconsistentError(\"'*abstract.Networking' expected, '%s' provided\", reflect.TypeOf(clonable).String())\n\n\t\t}\n\n\t\tpn = &protocol.Network{\n\t\t\tId: an.ID,\n\t\t\tName: an.Name,\n\t\t\tCidr: an.CIDR,\n\t\t}\n\n\t\treturn props.Inspect(networkproperty.SubnetsV1, func(clonable data.Clonable) fail.Error {\n\t\t\tnsV1, ok := clonable.(*propertiesv1.NetworkSubnets)\n\t\t\tif !ok {\n\t\t\t\treturn fail.InconsistentError(\"'*propertiesv1.NetworkSubnets' expected, '%s' provided\", reflect.TypeOf(clonable).String())\n\t\t\t}\n\t\t\tfor k := range nsV1.ByName {\n\t\t\t\tpn.Subnets = append(pn.Subnets, k)\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t})\n\txerr = debug.InjectPlannedFail(xerr)\n\tif xerr != nil {\n\t\treturn nil, xerr\n\t}\n\n\treturn pn, nil\n}", "func (c *gceClient) getSubnetCIDR(subnetName string) (string, error) {\n\tctx, cancel := context.WithTimeout(context.Background(), defaultTimeout)\n\tdefer cancel()\n\tresp, err := c.service.Subnetworks.Get(c.projectID, c.region, subnetName).Context(ctx).Do()\n\tif err != nil {\n\t\treturn \"\", util.WrapError(err, \"Error looking up subnet %s\", subnetName)\n\t}\n\tif resp == nil {\n\t\treturn \"\", nilResponseError(\"Subnetworks.Get\")\n\t}\n\treturn resp.IpCidrRange, nil\n}", "func GetSubnet(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *SubnetState, opts ...pulumi.ResourceOption) (*Subnet, error) {\n\tvar resource Subnet\n\terr := ctx.ReadResource(\"aws:ec2/subnet:Subnet\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func Subnets(prefix cty.Value, newbits ...cty.Value) (cty.Value, error) {\n\targs := make([]cty.Value, len(newbits)+1)\n\targs[0] = prefix\n\tcopy(args[1:], newbits)\n\treturn SubnetsFunc.Call(args)\n}", "func (s *ClusterScope) Subnets() infrav1.Subnets {\n\treturn s.AzureCluster.Spec.NetworkSpec.Subnets\n}", "func (o RouterNatResponseOutput) Subnetworks() RouterNatSubnetworkToNatResponseArrayOutput {\n\treturn o.ApplyT(func(v RouterNatResponse) []RouterNatSubnetworkToNatResponse { return v.Subnetworks }).(RouterNatSubnetworkToNatResponseArrayOutput)\n}", "func (c *Switch) GetSub(s string) Modifiable {\n\tc.lock.RLock()\n\tm := c.subRenderables[s]\n\tc.lock.RUnlock()\n\treturn m\n}", "func (client WorkloadNetworksClient) GetSegment(ctx context.Context, resourceGroupName string, privateCloudName string, segmentID string) (result WorkloadNetworkSegment, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/WorkloadNetworksClient.GetSegment\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.Response.Response != nil {\n\t\t\t\tsc = result.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tif err := validation.Validate([]validation.Validation{\n\t\t{TargetValue: client.SubscriptionID,\n\t\t\tConstraints: []validation.Constraint{{Target: \"client.SubscriptionID\", Name: validation.MinLength, Rule: 1, Chain: nil}}},\n\t\t{TargetValue: resourceGroupName,\n\t\t\tConstraints: []validation.Constraint{{Target: \"resourceGroupName\", Name: validation.MaxLength, Rule: 90, Chain: nil},\n\t\t\t\t{Target: \"resourceGroupName\", Name: validation.MinLength, Rule: 1, Chain: nil},\n\t\t\t\t{Target: \"resourceGroupName\", Name: validation.Pattern, Rule: `^[-\\w\\._\\(\\)]+$`, Chain: nil}}}}); err != nil {\n\t\treturn result, validation.NewError(\"avs.WorkloadNetworksClient\", \"GetSegment\", err.Error())\n\t}\n\n\treq, err := client.GetSegmentPreparer(ctx, resourceGroupName, privateCloudName, segmentID)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"avs.WorkloadNetworksClient\", \"GetSegment\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.GetSegmentSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"avs.WorkloadNetworksClient\", \"GetSegment\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.GetSegmentResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"avs.WorkloadNetworksClient\", \"GetSegment\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\n\treturn\n}", "func (c *TestClient) GetNetwork(project, name string) (*compute.Network, error) {\n\tif c.GetNetworkFn != nil {\n\t\treturn c.GetNetworkFn(project, name)\n\t}\n\treturn c.client.GetNetwork(project, name)\n}", "func parseNamespaceSubnet(namespace *kapi.Namespace) (*net.IPNet, error) {\n\tsub, ok := namespace.Annotations[values.NamespaceSubnet]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"Error in obtaining namespace's subnet for namespace %s\", namespace.Name)\n\t}\n\n\t_, subnet, err := net.ParseCIDR(sub)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error in parsing namespace subnet - %v\", err)\n\t}\n\n\treturn subnet, nil\n}", "func (esr *etcdSubnetRegistry) getSubnets(ctx context.Context, network string) ([]Lease, uint64, error) {\n\tkey := path.Join(esr.etcdCfg.Prefix, network, \"subnets\")\n\tresp, err := esr.client().Get(ctx, key, &etcd.GetOptions{Recursive: true})\n\tif err != nil {\n\t\tif etcdErr, ok := err.(etcd.Error); ok && etcdErr.Code == etcd.ErrorCodeKeyNotFound {\n\t\t\t// key not found: treat it as empty set\n\t\t\treturn []Lease{}, etcdErr.Index, nil\n\t\t}\n\t\treturn nil, 0, err\n\t}\n\n\tleases := []Lease{}\n\tfor _, node := range resp.Node.Nodes {\n\t\tl, err := nodeToLease(node)\n\t\tif err != nil {\n\t\t\tlog.Warningf(\"Ignoring bad subnet node: %v\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\tleases = append(leases, *l)\n\t}\n\n\treturn leases, resp.Index, nil\n}", "func GetVirtualNetworkSubnet(ctx context.Context, vnetName string, subnetName string) (network.Subnet, error) {\n\tsubnetsClient := getSubnetsClient()\n\treturn subnetsClient.Get(ctx, config.GroupName(), vnetName, subnetName, \"\")\n}", "func GetVirtualNetworkSubnet(ctx context.Context, vnetName string, subnetName string) (network.Subnet, error) {\n\tsubnetsClient := getSubnetsClient()\n\treturn subnetsClient.Get(ctx, config.GroupName(), vnetName, subnetName, \"\")\n}", "func (o PacketMirroringMirroredResourceInfoResponsePtrOutput) Subnetworks() PacketMirroringMirroredResourceInfoSubnetInfoResponseArrayOutput {\n\treturn o.ApplyT(func(v *PacketMirroringMirroredResourceInfoResponse) []PacketMirroringMirroredResourceInfoSubnetInfoResponse {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Subnetworks\n\t}).(PacketMirroringMirroredResourceInfoSubnetInfoResponseArrayOutput)\n}", "func (o PacketMirroringMirroredResourceInfoPtrOutput) Subnetworks() PacketMirroringMirroredResourceInfoSubnetInfoArrayOutput {\n\treturn o.ApplyT(func(v *PacketMirroringMirroredResourceInfo) []PacketMirroringMirroredResourceInfoSubnetInfo {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Subnetworks\n\t}).(PacketMirroringMirroredResourceInfoSubnetInfoArrayOutput)\n}", "func subnet(base *net.IPNet, newBits int, num int) (*net.IPNet, error) {\n\tip := base.IP\n\tmask := base.Mask\n\n\tbaseLength, addressLength := mask.Size()\n\tnewPrefixLen := baseLength + newBits\n\n\t// check if there is sufficient address space to extend the network prefix\n\tif newPrefixLen > addressLength {\n\t\treturn nil, fmt.Errorf(\"not enought space to extend prefix of %d by %d\", baseLength, newBits)\n\t}\n\n\t// calculate the maximum network number\n\tmaxNetNum := uint64(1<<uint64(newBits)) - 1\n\tif uint64(num) > maxNetNum {\n\t\treturn nil, fmt.Errorf(\"prefix extension of %d does not accommodate a subnet numbered %d\", newBits, num)\n\t}\n\n\treturn &net.IPNet{\n\t\tIP: insertNetworkNumIntoIP(ip, num, newPrefixLen),\n\t\tMask: net.CIDRMask(newPrefixLen, addressLength),\n\t}, nil\n}", "func (o RecordGeolocationRoutingPolicyOutput) Subdivision() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v RecordGeolocationRoutingPolicy) *string { return v.Subdivision }).(pulumi.StringPtrOutput)\n}", "func (c *Client) querySubnet(subnetID string) (*vpc.Subnet, error) {\n\trequest := vpc.NewDescribeSubnetsRequest()\n\trequest.SubnetIds = []*string{\n\t\tcommon.StringPtr(subnetID),\n\t}\n\n\tblog.V(2).Infof(\"tencentcloud DescribeSubnets request %s\", request.ToJsonString())\n\n\tresponse, err := c.vpcClient.DescribeSubnets(request)\n\tif err != nil {\n\t\tblog.Errorf(\"tencentcloud DescribeSubnets by id %s failed, err %s\", subnetID, err.Error())\n\t\treturn nil, fmt.Errorf(\"tencentcloud DescribeSubnets by id %s failed, err %s\", subnetID, err.Error())\n\t}\n\n\tblog.V(2).Infof(\"tencentcloud DescribeSubnets response %s\", response.ToJsonString())\n\n\tif *response.Response.TotalCount == 0 {\n\t\tblog.Errorf(\"tencentcloud DescribeSubnets by id %s return zero result\", subnetID)\n\t\treturn nil, fmt.Errorf(\"tencentcloud DescribeSubnets by id %s return zero result\", subnetID)\n\t}\n\tif len(response.Response.SubnetSet) != 1 {\n\t\tblog.Errorf(\"tencentcloud DescribeSubnets by id %s return result more than 1\", subnetID)\n\t\treturn nil, fmt.Errorf(\"tencentcloud DescribeSubnets by id %s return result more than 1\", subnetID)\n\t}\n\treturn response.Response.SubnetSet[0], nil\n}", "func (c *Client) getSubnetsClient(ctx context.Context) (*aznetwork.SubnetsClient, error) {\n\tsubnetClient := aznetwork.NewSubnetsClient(c.ssn.Credentials.SubscriptionID)\n\tsubnetClient.Authorizer = c.ssn.Authorizer\n\treturn &subnetClient, nil\n}", "func (v *SubnetValidator) SubnetID() ids.ID {\n\treturn v.Subnet\n}", "func (o LookupVirtualNetworkResultOutput) Subnets() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v LookupVirtualNetworkResult) []string { return v.Subnets }).(pulumi.StringArrayOutput)\n}", "func (mc *MockContiv) GetPodSubnet() *net.IPNet {\n\treturn mc.podSubnet\n}", "func (m *MockClusterScoper) Subnet(arg0 string) v1beta1.SubnetSpec {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Subnet\", arg0)\n\tret0, _ := ret[0].(v1beta1.SubnetSpec)\n\treturn ret0\n}", "func (o RegistryNetworkRuleSetVirtualNetworkOutput) SubnetId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v RegistryNetworkRuleSetVirtualNetwork) string { return v.SubnetId }).(pulumi.StringOutput)\n}", "func (s Subnet) String() string {\n\treturn s.IPNet().String()\n}", "func (o GetLBFrontendIpConfigurationOutput) SubnetId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetLBFrontendIpConfiguration) string { return v.SubnetId }).(pulumi.StringOutput)\n}", "func (e *EDNS0_SUBNET) Option() uint16 { return EDNS0SUBNET }", "func (ipam *Ipam) GetSubnet(id string) (models.Subnet, error) {\n\tsession := ipam.session.Copy()\n\tdefer session.Close()\n\n\tvar subnet models.Subnet\n\n\treturn subnet, session.DB(IpamDatabase).C(IpamCollectionSubnets).Find(bson.M{\"_id\": bson.ObjectIdHex(id)}).One(&subnet)\n}", "func (c *TestClient) CreateSubnetwork(project, region string, n *compute.Subnetwork) error {\n\tif c.CreateSubnetworkFn != nil {\n\t\treturn c.CreateSubnetworkFn(project, region, n)\n\t}\n\treturn c.client.CreateSubnetwork(project, region, n)\n}", "func (o PacketMirroringMirroredResourceInfoResponseOutput) Subnetworks() PacketMirroringMirroredResourceInfoSubnetInfoResponseArrayOutput {\n\treturn o.ApplyT(func(v PacketMirroringMirroredResourceInfoResponse) []PacketMirroringMirroredResourceInfoSubnetInfoResponse {\n\t\treturn v.Subnetworks\n\t}).(PacketMirroringMirroredResourceInfoSubnetInfoResponseArrayOutput)\n}", "func (o PacketMirroringMirroredResourceInfoOutput) Subnetworks() PacketMirroringMirroredResourceInfoSubnetInfoArrayOutput {\n\treturn o.ApplyT(func(v PacketMirroringMirroredResourceInfo) []PacketMirroringMirroredResourceInfoSubnetInfo {\n\t\treturn v.Subnetworks\n\t}).(PacketMirroringMirroredResourceInfoSubnetInfoArrayOutput)\n}", "func (o AccessLevelBasicConditionOutput) IpSubnetworks() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AccessLevelBasicCondition) []string { return v.IpSubnetworks }).(pulumi.StringArrayOutput)\n}", "func (a *Azure) GetVirtualNetworkSubnet(ctx context.Context, vnetName string, subnetName string) (subnet *network.Subnet, err error) {\n\tsubnetsClient, err := a.getSubnetsClient()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tresult, err := subnetsClient.Get(ctx, a.groupName, vnetName, subnetName, \"\")\n\tsubnet = &result\n\treturn\n}", "func (c *Client) GetNetwork(id string) ([]byte, error) {\n\treturn c.doGet(fmt.Sprintf(\"/%s/%s\", master.GetNetworkRESTEndpoint, id))\n}", "func (instance *Host) GetPrivateIPOnSubnet(ctx context.Context, subnetID string) (_ string, ferr fail.Error) {\n\tdefer fail.OnPanic(&ferr)\n\n\tip := \"\"\n\tif valid.IsNil(instance) {\n\t\treturn ip, fail.InvalidInstanceError()\n\t}\n\tif subnetID = strings.TrimSpace(subnetID); subnetID == \"\" {\n\t\treturn ip, fail.InvalidParameterError(\"subnetID\", \"cannot be empty string\")\n\t}\n\n\t// instance.RLock()\n\t// defer instance.RUnlock()\n\n\txerr := instance.Inspect(ctx, func(_ data.Clonable, props *serialize.JSONProperties) fail.Error {\n\t\treturn props.Inspect(hostproperty.NetworkV2, func(clonable data.Clonable) fail.Error {\n\t\t\thostNetworkV2, ok := clonable.(*propertiesv2.HostNetworking)\n\t\t\tif !ok {\n\t\t\t\treturn fail.InconsistentError(\"'*propertiesv2.HostNetworking' expected, '%s' provided\", reflect.TypeOf(clonable).String())\n\t\t\t}\n\t\t\tif ip, ok = hostNetworkV2.IPv4Addresses[subnetID]; !ok {\n\t\t\t\treturn fail.InvalidRequestError(\"Host '%s' does not have an IP address on subnet '%s'\", instance.GetName(), subnetID)\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t})\n\treturn ip, xerr\n}", "func (d *DestinationClient) GetSubaccountDestination(name string) (Destination, error) {\n\n\tvar retval Destination\n\tvar errResponse ErrorMessage\n\n\tresponse, err := d.restyClient.R().\n\t\tSetResult(&retval).\n\t\tSetError(&errResponse).\n\t\tSetPathParams(map[string]string{\n\t\t\t\"name\": name,\n\t\t}).\n\t\tGet(\"/subaccountDestinations/{name}\")\n\n\tif err != nil {\n\t\treturn retval, err\n\t}\n\tif response.StatusCode() != 200 {\n\t\terrResponse.statusCode = response.StatusCode()\n\t\treturn retval, errResponse\n\t}\n\treturn retval, nil\n}", "func Subnets(supernet *net.IPNet, prefix int) []*net.IPNet {\n\tones, bits := supernet.Mask.Size()\n\tif ones > prefix || bits < prefix {\n\t\treturn nil\n\t}\n\n\tip := supernet.IP\n\tmask := net.CIDRMask(prefix, bits)\n\tsize, _ := uint128.Pow2(uint(bits - prefix))\n\n\tsubnets := make([]*net.IPNet, 1<<uint(prefix-ones))\n\tfor i := 0; i < len(subnets); i++ {\n\t\tif i > 0 {\n\t\t\tlast, _ := uint128.NewFromBytes(subnets[i-1].IP)\n\t\t\tbuf := last.Add(size).Bytes()\n\n\t\t\t// Uint128 always returns a 16-byte slice. We only need the last\n\t\t\t// 4 bytes for IPv4 addresses.\n\t\t\tip = buf[16-len(ip):]\n\t\t}\n\n\t\tsubnets[i] = &net.IPNet{\n\t\t\tIP: ip,\n\t\t\tMask: mask,\n\t\t}\n\t}\n\n\treturn subnets\n}", "func (o AliasIpRangeOutput) SubnetworkRangeName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v AliasIpRange) *string { return v.SubnetworkRangeName }).(pulumi.StringPtrOutput)\n}", "func (c *SubresourceClient) Get(namespace, name string) (result runtime.Object, e error) {\n\tif c.Error != \"\" {\n\t\te = fmt.Errorf(c.Error)\n\t} else {\n\t\tsub := c.Subresource\n\t\tresult = sub.(runtime.Object)\n\t}\n\treturn\n}", "func (m *MockNetworkDescriber) Subnet(arg0 string) v1beta1.SubnetSpec {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Subnet\", arg0)\n\tret0, _ := ret[0].(v1beta1.SubnetSpec)\n\treturn ret0\n}", "func getVirtualNetwork(c *wssdcloudnetwork.VirtualNetwork, group string) *network.VirtualNetwork {\n\tstringType := virtualNetworkTypeToString(c.Type)\n\tdnsservers := []string{}\n\tif c.Dns != nil {\n\t\tdnsservers = c.Dns.Servers\n\t}\n\treturn &network.VirtualNetwork{\n\t\tName: &c.Name,\n\t\tLocation: &c.LocationName,\n\t\tID: &c.Id,\n\t\tType: &stringType,\n\t\tVersion: &c.Status.Version.Number,\n\t\tVirtualNetworkPropertiesFormat: &network.VirtualNetworkPropertiesFormat{\n\t\t\tSubnets: getNetworkSubnets(c.Subnets),\n\t\t\tStatuses: status.GetStatuses(c.GetStatus()),\n\t\t\tMacPoolName: &c.MacPoolName,\n\t\t\tDhcpOptions: &network.DhcpOptions{\n\t\t\t\tDNSServers: &dnsservers,\n\t\t\t},\n\t\t},\n\t\tTags: tags.ProtoToMap(c.Tags),\n\t}\n}", "func (o ResolverEndpointIpAddressOutput) SubnetId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ResolverEndpointIpAddress) string { return v.SubnetId }).(pulumi.StringOutput)\n}", "func rcGetLocalNSub(p *TCompiler, code *TCode) (*value.Value, error) {\n\tv := p.scope.GetByIndex(code.B)\n\tv2 := value.Sub(v, value.NewIntPtr(code.C))\n\tp.regSet(code.A, v2)\n\tp.moveNext()\n\treturn v2, nil\n}", "func (o LinkServiceNatIpConfigurationOutput) SubnetId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LinkServiceNatIpConfiguration) string { return v.SubnetId }).(pulumi.StringOutput)\n}", "func (k Ktype) Subcategory() Subcategory {\n\tswitch k {\n\tcase QueryDNS, ReplyDNS:\n\t\treturn DNS\n\tdefault:\n\t\treturn None\n\t}\n}", "func (r Virtual_Guest_Network_Component) GetPrimarySubnet() (resp datatypes.Network_Subnet, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Virtual_Guest_Network_Component\", \"getPrimarySubnet\", nil, &r.Options, &resp)\n\treturn\n}", "func (o KubernetesClusterApiServerAccessProfileOutput) SubnetId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v KubernetesClusterApiServerAccessProfile) *string { return v.SubnetId }).(pulumi.StringPtrOutput)\n}", "func (subChMap *subChannelMap) get(serviceName string) (*SubChannel, bool) {\n\tsubChMap.RLock()\n\tsc, ok := subChMap.subchannels[serviceName]\n\tsubChMap.RUnlock()\n\treturn sc, ok\n}", "func (o ServiceVirtualNetworkConfigurationOutput) SubnetId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ServiceVirtualNetworkConfiguration) string { return v.SubnetId }).(pulumi.StringOutput)\n}", "func (vc *client) GetNetwork(networkPath string) (object.NetworkReference, error) {\n\tlog.Info(fmt.Sprintf(\"Getting Network `%s`\", networkPath))\n\n\tnetwork, err := vc.finder.Network(vc.context, networkPath)\n\tif err != nil {\n\t\tlog.Error(err, fmt.Sprintf(\"Error getting Network `%s`\", networkPath))\n\t\treturn nil, err\n\t}\n\n\treturn network, nil\n}", "func (o AccessLevelsAccessLevelBasicConditionOutput) IpSubnetworks() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AccessLevelsAccessLevelBasicCondition) []string { return v.IpSubnetworks }).(pulumi.StringArrayOutput)\n}", "func (sqlStore *SQLStore) getSubnets(db dbInterface, filter *model.SubnetFilter) ([]*model.Subnet, error) {\n\tbuilder := subnetSelect.\n\t\tOrderBy(\"CreateAt ASC\")\n\tbuilder = sqlStore.applySubnetsFilter(builder, filter)\n\n\tif filter.Free {\n\t\tbuilder = builder.Where(\"AccountID == '' \")\n\t}\n\n\tvar rawSubnets rawSubnets\n\terr := sqlStore.selectBuilder(db, &rawSubnets, builder)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to query for subnets\")\n\t}\n\n\treturn rawSubnets.toSubnets()\n}", "func (u *User) GetSubnets(queryParams ...string) (map[string]interface{}, error) {\n\tlog.info(\"========== GET USER SUBNETS ==========\")\n\turl := buildURL(path[\"users\"], u.UserID, path[\"subnets\"])\n\n\treturn u.do(\"GET\", url, \"\", queryParams)\n}", "func GetSubnetTemplate() (string, error) {\n\treturn internalcloudformation.GetCloudFormationTemplate(\n\t\tglobal.Config.Distribution.EKS.TemplateLocation, eksSubnetTemplateName,\n\t)\n}", "func (o LoadBalancerFrontendIpConfigurationOutput) SubnetId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v LoadBalancerFrontendIpConfiguration) *string { return v.SubnetId }).(pulumi.StringPtrOutput)\n}", "func (o ServiceAdditionalLocationVirtualNetworkConfigurationOutput) SubnetId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ServiceAdditionalLocationVirtualNetworkConfiguration) string { return v.SubnetId }).(pulumi.StringOutput)\n}" ]
[ "0.7307221", "0.72957605", "0.71788764", "0.7111489", "0.705744", "0.7046196", "0.7044198", "0.67982036", "0.6680653", "0.60726416", "0.6027882", "0.6025809", "0.5997358", "0.594999", "0.59305", "0.59234184", "0.5804294", "0.5703005", "0.5671932", "0.5669738", "0.5661527", "0.56013566", "0.5529779", "0.5509992", "0.54957587", "0.5473434", "0.5472513", "0.546236", "0.5444726", "0.5435311", "0.54296887", "0.541605", "0.5364531", "0.5360835", "0.53495765", "0.5319479", "0.531254", "0.5311644", "0.53091943", "0.5309104", "0.5302002", "0.53015375", "0.5291932", "0.5265921", "0.52591443", "0.5249685", "0.5216224", "0.520805", "0.5199828", "0.5182496", "0.51806563", "0.5177887", "0.5171367", "0.5143145", "0.51306635", "0.5126076", "0.5126076", "0.5097322", "0.50914484", "0.50820166", "0.5080485", "0.5077883", "0.50720036", "0.50629044", "0.5061787", "0.5049029", "0.5044398", "0.5030824", "0.50248075", "0.5024075", "0.502294", "0.49990913", "0.49903265", "0.49842152", "0.4975892", "0.49680257", "0.49652514", "0.49651822", "0.496003", "0.49524587", "0.49510634", "0.49454895", "0.49453872", "0.49433452", "0.49354142", "0.4935103", "0.4927155", "0.49193048", "0.49149778", "0.4914378", "0.49089703", "0.4908526", "0.49051183", "0.49038133", "0.49026296", "0.49023598", "0.48983228", "0.48940036", "0.48874584", "0.4883591" ]
0.7722926
0
AggregatedListSubnetworks uses the override method AggregatedListSubnetworksFn or the real implementation.
func (c *TestClient) AggregatedListSubnetworks(project string, opts ...ListCallOption) ([]*compute.Subnetwork, error) { if c.AggregatedListSubnetworksFn != nil { return c.AggregatedListSubnetworksFn(project, opts...) } return c.client.AggregatedListSubnetworks(project, opts...) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *TestClient) ListSubnetworks(project, region string, opts ...ListCallOption) ([]*compute.Subnetwork, error) {\n\tif c.ListSubnetworksFn != nil {\n\t\treturn c.ListSubnetworksFn(project, region, opts...)\n\t}\n\treturn c.client.ListSubnetworks(project, region, opts...)\n}", "func (o ServiceConnectionPolicyPscConfigOutput) Subnetworks() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v ServiceConnectionPolicyPscConfig) []string { return v.Subnetworks }).(pulumi.StringArrayOutput)\n}", "func (o ServiceConnectionPolicyPscConfigPtrOutput) Subnetworks() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *ServiceConnectionPolicyPscConfig) []string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Subnetworks\n\t}).(pulumi.StringArrayOutput)\n}", "func (o NetworkAttachmentOutput) Subnetworks() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *NetworkAttachment) pulumi.StringArrayOutput { return v.Subnetworks }).(pulumi.StringArrayOutput)\n}", "func (o *AggregatedDomain) Subnets(info *bambou.FetchingInfo) (SubnetsList, *bambou.Error) {\n\n\tvar list SubnetsList\n\terr := bambou.CurrentSession().FetchChildren(o, SubnetIdentity, &list, info)\n\treturn list, err\n}", "func (o AccessLevelsAccessLevelBasicConditionOutput) IpSubnetworks() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AccessLevelsAccessLevelBasicCondition) []string { return v.IpSubnetworks }).(pulumi.StringArrayOutput)\n}", "func (s *Stack) ListNetworks() ([]*abstract.Network, fail.Error) {\n\tvar networks []*abstract.Network\n\n\tcompuService := s.ComputeService\n\n\ttoken := \"\"\n\tfor paginate := true; paginate; {\n\t\tresp, err := compuService.Networks.List(s.GcpConfig.ProjectID).PageToken(token).Do()\n\t\tif err != nil {\n\t\t\treturn networks, fail.Errorf(fmt.Sprintf(\"cannot list networks ...: %s\", err), err)\n\t\t}\n\n\t\tfor _, nett := range resp.Items {\n\t\t\tnewNet := abstract.NewNetwork()\n\t\t\tnewNet.Name = nett.Name\n\t\t\tnewNet.ID = strconv.FormatUint(nett.Id, 10)\n\t\t\tnewNet.CIDR = nett.IPv4Range\n\n\t\t\tnetworks = append(networks, newNet)\n\t\t}\n\t\ttoken := resp.NextPageToken\n\t\tpaginate = token != \"\"\n\t}\n\n\ttoken = \"\"\n\tfor paginate := true; paginate; {\n\t\tresp, err := compuService.Subnetworks.List(s.GcpConfig.ProjectID, s.GcpConfig.Region).PageToken(token).Do()\n\t\tif err != nil {\n\t\t\treturn networks, fail.Errorf(fmt.Sprintf(\"cannot list subnetworks ...: %s\", err), err)\n\t\t}\n\n\t\tfor _, nett := range resp.Items {\n\t\t\tnewNet := abstract.NewNetwork()\n\t\t\tnewNet.Name = nett.Name\n\t\t\tnewNet.ID = strconv.FormatUint(nett.Id, 10)\n\t\t\tnewNet.CIDR = nett.IpCidrRange\n\n\t\t\tnetworks = append(networks, newNet)\n\t\t}\n\t\ttoken := resp.NextPageToken\n\t\tpaginate = token != \"\"\n\t}\n\n\treturn networks, nil\n}", "func (o AccessLevelBasicConditionOutput) IpSubnetworks() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AccessLevelBasicCondition) []string { return v.IpSubnetworks }).(pulumi.StringArrayOutput)\n}", "func Subnets(prefix cty.Value, newbits ...cty.Value) (cty.Value, error) {\n\targs := make([]cty.Value, len(newbits)+1)\n\targs[0] = prefix\n\tcopy(args[1:], newbits)\n\treturn SubnetsFunc.Call(args)\n}", "func (o RouterNatOutput) Subnetworks() RouterNatSubnetworkToNatArrayOutput {\n\treturn o.ApplyT(func(v RouterNat) []RouterNatSubnetworkToNat { return v.Subnetworks }).(RouterNatSubnetworkToNatArrayOutput)\n}", "func (de *DockerEngine) getSubNet() (string, error) {\n\tde.subNetMu.Lock()\n\tdefer de.subNetMu.Unlock()\n\n\taddrs, err := net.InterfaceAddrs()\n\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"Error getting network addresses\")\n\t}\n\n\tvar nets []*net.IPNet\n\n\tfor _, addr := range addrs {\n\t\tdockerLog.Debugf(\"Inspecting interface %s\", addr.String())\n\n\t\t_, n, err := net.ParseCIDR(addr.String())\n\n\t\tif err != nil {\n\t\t\tdockerLog.Warningf(\"Error parsing address: %s\", addr.String())\n\n\t\t\tcontinue\n\t\t}\n\n\t\tnets = append(nets, n)\n\t}\n\n\tnetaddr := func() string {\n\t\ttpl := \"10.%d.%d.0/24\"\n\n\t\treturn fmt.Sprintf(tpl, de.subNetOct1, de.subNetOct2)\n\t}\n\n\t_, pnet, _ := net.ParseCIDR(netaddr())\n\n\tfor {\n\t\t// Find non-overlapping network\n\t\toverlap := false\n\n\t\tfor _, n := range nets {\n\t\t\tif lib.NetsOverlap(pnet, n) {\n\t\t\t\toverlap = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif overlap {\n\t\t\tde.subNetOct2 += 1\n\n\t\t\tif de.subNetOct2 > 255 {\n\t\t\t\tde.subNetOct1 += 1\n\t\t\t\tde.subNetOct2 = 0\n\t\t\t}\n\n\t\t\t_, pnet, _ = net.ParseCIDR(netaddr())\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn netaddr(), nil\n}", "func (o RouterNatResponseOutput) Subnetworks() RouterNatSubnetworkToNatResponseArrayOutput {\n\treturn o.ApplyT(func(v RouterNatResponse) []RouterNatSubnetworkToNatResponse { return v.Subnetworks }).(RouterNatSubnetworkToNatResponseArrayOutput)\n}", "func (o LookupVirtualNetworkResultOutput) Subnets() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v LookupVirtualNetworkResult) []string { return v.Subnets }).(pulumi.StringArrayOutput)\n}", "func (a *AmazonConnectionsApiService) BrowseCloudSubnetworks(ctx _context.Context, amazonConnectionId string) ApiBrowseCloudSubnetworksRequest {\n\treturn ApiBrowseCloudSubnetworksRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tamazonConnectionId: amazonConnectionId,\n\t}\n}", "func (a *AmazonConnectionsApiService) BrowseCloudSubnetworksExecute(r ApiBrowseCloudSubnetworksRequest) (CloudSubnetworksPage, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue CloudSubnetworksPage\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"AmazonConnectionsApiService.BrowseCloudSubnetworks\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/amazonConnections/{amazonConnectionId}/cloudSubnetworks\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"amazonConnectionId\"+\"}\", _neturl.PathEscape(parameterToString(r.amazonConnectionId, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\tif r.xApiVersion == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"xApiVersion is required and must be specified\")\n\t}\n\n\tif r.cloudNetworkId != nil {\n\t\tlocalVarQueryParams.Add(\"cloudNetworkId\", parameterToString(*r.cloudNetworkId, \"\"))\n\t}\n\tif r.availabilityZone != nil {\n\t\tlocalVarQueryParams.Add(\"availabilityZone\", parameterToString(*r.availabilityZone, \"\"))\n\t}\n\tif r.offset != nil {\n\t\tlocalVarQueryParams.Add(\"Offset\", parameterToString(*r.offset, \"\"))\n\t}\n\tif r.limit != nil {\n\t\tlocalVarQueryParams.Add(\"Limit\", parameterToString(*r.limit, \"\"))\n\t}\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\", \"application/problem+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-version\"] = parameterToString(*r.xApiVersion, \"\")\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif apiKey, ok := auth[\"Bearer\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif apiKey.Prefix != \"\" {\n\t\t\t\t\tkey = apiKey.Prefix + \" \" + apiKey.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = apiKey.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"Authorization\"] = key\n\t\t\t}\n\t\t}\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 500 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "func List(ctx context.Context, svc iaas.Service, networkID string, all bool, terraform bool) ([]*abstract.Subnet, fail.Error) {\n\tif !terraform {\n\t\treturn operations.ListSubnets(ctx, svc, networkID, all)\n\t}\n\n\tvar neptune []*abstract.Subnet\n\traw, err := operations.ListTerraformSubnets(ctx, svc, networkID, \"\", terraform)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, val := range raw { // FIXME: Another mapping problem\n\t\tns := abstract.NewSubnet()\n\t\tns.ID = val.Identity\n\t\tns.Name = val.Name\n\t\tneptune = append(neptune, ns)\n\t}\n\n\treturn neptune, nil\n}", "func (a *cloudProviderAdapter) AggregatedListNetworkEndpointGroup(version meta.Version) (map[string][]*composite.NetworkEndpointGroup, error) {\n\t// TODO: filter for the region the cluster is in.\n\tall, err := composite.AggregatedListNetworkEndpointGroup(a.c, version)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tret := map[string][]*composite.NetworkEndpointGroup{}\n\tfor key, obj := range all {\n\t\t// key is scope\n\t\t// zonal key is \"zones/<zone name>\"\n\t\t// regional key is \"regions/<region name>\"\n\t\t// global key is \"global\"\n\t\t// TODO: use cloud provider meta.KeyType and scope name as key\n\t\tif key.Type() == meta.Global {\n\t\t\tklog.V(4).Infof(\"Ignoring key %v as it is global\", key)\n\t\t\tcontinue\n\t\t}\n\t\tif key.Zone == \"\" {\n\t\t\tklog.Warningf(\"Key %v does not have zone populated, ignoring\", key)\n\t\t\tcontinue\n\t\t}\n\t\tret[key.Zone] = append(ret[key.Zone], obj)\n\t}\n\treturn ret, nil\n}", "func (o LookupRegionNetworkEndpointGroupResultOutput) Subnetwork() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupRegionNetworkEndpointGroupResult) string { return v.Subnetwork }).(pulumi.StringOutput)\n}", "func (o RegionNetworkEndpointGroupOutput) Subnetwork() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *RegionNetworkEndpointGroup) pulumi.StringPtrOutput { return v.Subnetwork }).(pulumi.StringPtrOutput)\n}", "func (o PacketMirroringMirroredResourceInfoResponseOutput) Subnetworks() PacketMirroringMirroredResourceInfoSubnetInfoResponseArrayOutput {\n\treturn o.ApplyT(func(v PacketMirroringMirroredResourceInfoResponse) []PacketMirroringMirroredResourceInfoSubnetInfoResponse {\n\t\treturn v.Subnetworks\n\t}).(PacketMirroringMirroredResourceInfoSubnetInfoResponseArrayOutput)\n}", "func Subnets(supernet *net.IPNet, prefix int) []*net.IPNet {\n\tones, bits := supernet.Mask.Size()\n\tif ones > prefix || bits < prefix {\n\t\treturn nil\n\t}\n\n\tip := supernet.IP\n\tmask := net.CIDRMask(prefix, bits)\n\tsize, _ := uint128.Pow2(uint(bits - prefix))\n\n\tsubnets := make([]*net.IPNet, 1<<uint(prefix-ones))\n\tfor i := 0; i < len(subnets); i++ {\n\t\tif i > 0 {\n\t\t\tlast, _ := uint128.NewFromBytes(subnets[i-1].IP)\n\t\t\tbuf := last.Add(size).Bytes()\n\n\t\t\t// Uint128 always returns a 16-byte slice. We only need the last\n\t\t\t// 4 bytes for IPv4 addresses.\n\t\t\tip = buf[16-len(ip):]\n\t\t}\n\n\t\tsubnets[i] = &net.IPNet{\n\t\t\tIP: ip,\n\t\t\tMask: mask,\n\t\t}\n\t}\n\n\treturn subnets\n}", "func (daemon *Daemon) Subnets() ([]net.IPNet, []net.IPNet) {\n\tvar v4Subnets []net.IPNet\n\tvar v6Subnets []net.IPNet\n\n\tfor _, managedNetwork := range daemon.netController.Networks() {\n\t\tv4infos, v6infos := managedNetwork.IpamInfo()\n\t\tfor _, info := range v4infos {\n\t\t\tif info.IPAMData.Pool != nil {\n\t\t\t\tv4Subnets = append(v4Subnets, *info.IPAMData.Pool)\n\t\t\t}\n\t\t}\n\t\tfor _, info := range v6infos {\n\t\t\tif info.IPAMData.Pool != nil {\n\t\t\t\tv6Subnets = append(v6Subnets, *info.IPAMData.Pool)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn v4Subnets, v6Subnets\n}", "func (r Virtual_Guest_Network_Component) GetSubnets() (resp []datatypes.Network_Subnet, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Virtual_Guest_Network_Component\", \"getSubnets\", nil, &r.Options, &resp)\n\treturn\n}", "func (s *ClusterScope) Subnets() infrav1.Subnets {\n\treturn s.AzureCluster.Spec.NetworkSpec.Subnets\n}", "func (c *TestClient) AggregatedListDisks(project string, opts ...ListCallOption) ([]*compute.Disk, error) {\n\tif c.AggregatedListDisksFn != nil {\n\t\treturn c.AggregatedListDisksFn(project, opts...)\n\t}\n\treturn c.client.AggregatedListDisks(project, opts...)\n}", "func ExampleDelegatedSubnetServiceClient_NewListBySubscriptionPager() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclientFactory, err := armdelegatednetwork.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := clientFactory.NewDelegatedSubnetServiceClient().NewListBySubscriptionPager(nil)\n\tfor pager.More() {\n\t\tpage, err := pager.NextPage(ctx)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"failed to advance page: %v\", err)\n\t\t}\n\t\tfor _, v := range page.Value {\n\t\t\t// You could use page here. We use blank identifier for just demo purposes.\n\t\t\t_ = v\n\t\t}\n\t\t// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.\n\t\t// page.DelegatedSubnets = armdelegatednetwork.DelegatedSubnets{\n\t\t// \tValue: []*armdelegatednetwork.DelegatedSubnet{\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"delegated1\"),\n\t\t// \t\t\tType: to.Ptr(\"Microsoft.DelegatedNetwork/delegatedSubnets\"),\n\t\t// \t\t\tID: to.Ptr(\"/subscriptions/613192d7-503f-477a-9cfe-4efc3ee2bd60/resourceGroups/TestRG/providers/Microsoft.Network/virtualNetworks/testvnet/subnets/testsubnet/providers/Microsoft.DelegatedNetwork/delegatedSubnets/delegated1\"),\n\t\t// \t\t\tLocation: to.Ptr(\"West US\"),\n\t\t// \t\t\tProperties: &armdelegatednetwork.DelegatedSubnetProperties{\n\t\t// \t\t\t\tControllerDetails: &armdelegatednetwork.ControllerDetails{\n\t\t// \t\t\t\t\tID: to.Ptr(\"/subscriptions/613192d7-503f-477a-9cfe-4efc3ee2bd60/resourceGroups/TestRG/providers/Microsoft.DelegatedNetwork/controller/dnctestcontroller\"),\n\t\t// \t\t\t\t},\n\t\t// \t\t\t\tProvisioningState: to.Ptr(armdelegatednetwork.DelegatedSubnetStateSucceeded),\n\t\t// \t\t\t\tResourceGUID: to.Ptr(\"5a82cbcf-e8ea-4175-ac2b-ad36a73f9801\"),\n\t\t// \t\t\t\tSubnetDetails: &armdelegatednetwork.SubnetDetails{\n\t\t// \t\t\t\t\tID: to.Ptr(\"/subscriptions/613192d7-503f-477a-9cfe-4efc3ee2bd60/resourceGroups/TestRG/providers/Microsoft.Network/virtualNetworks/testvnet/subnets/testsubnet\"),\n\t\t// \t\t\t\t},\n\t\t// \t\t\t},\n\t\t// \t}},\n\t\t// }\n\t}\n}", "func (nimgb *NetInterfaceModeGroupBy) Aggregate(fns ...AggregateFunc) *NetInterfaceModeGroupBy {\n\tnimgb.fns = append(nimgb.fns, fns...)\n\treturn nimgb\n}", "func main() {\n opts := gophercloud.AuthOptions{\n\t\tIdentityEndpoint: \"http://10.169.41.188/identity\",\n\t\tUsername: \"admin\",\n\t\tPassword: \"password\",\n\t\tTenantID: \"01821bd38f2f474489491adb0da7efaf\",\n\t\tDomainID: \"default\",\n\t}\n\tprovider, err := openstack.AuthenticatedClient(opts)\n\tfmt.Println(err)\n\tif err != nil {\n\t\tfmt.Errorf(\"Sending get container group request failed: %v\", err)\n\t\treturn\n\t}\n client, err := openstack.NewNetworkV2(provider, gophercloud.EndpointOpts{\n\t\tRegion: \"RegionOne\",\n\t})\n\tif err != nil {\n\t\tfmt.Errorf(\"Unable to create a network client: %v\", err)\n\t}\n\tallPages, err := subnets.List(client, nil).AllPages()\n\tif err != nil {\n\t\tfmt.Errorf(\"Unable to list subnets: %v\", err)\n\t}\n\n\tallSubnets, err := subnets.ExtractSubnets(allPages)\n\tif err != nil {\n\t\tfmt.Errorf(\"Unable to extract subnets: %v\", err)\n\t}\n\n\tfor _, subnet := range allSubnets {\n\t b, _ := json.MarshalIndent(subnet, \"\", \" \")\n fmt.Printf(\"%s\", string(b))\n }\n\n}", "func (client Client) Subnets() network.SubnetsClient {\n\tif client.subnets == nil {\n\t\tclnt := network.NewSubnetsClientWithBaseURI(client.baseURI, client.subscriptionID)\n\t\tclnt.Authorizer = client.Authorizer\n\t\tclnt.RequestInspector = client.RequestInspector\n\t\tclnt.ResponseInspector = client.ResponseInspector\n\t\tclient.subnets = &clnt\t\t\n\t}\t\n\treturn *client.subnets\n}", "func (o PacketMirroringMirroredResourceInfoOutput) Subnetworks() PacketMirroringMirroredResourceInfoSubnetInfoArrayOutput {\n\treturn o.ApplyT(func(v PacketMirroringMirroredResourceInfo) []PacketMirroringMirroredResourceInfoSubnetInfo {\n\t\treturn v.Subnetworks\n\t}).(PacketMirroringMirroredResourceInfoSubnetInfoArrayOutput)\n}", "func (c *MockSubnetsClient) List(ctx context.Context, resourceGroupName, virtualNetworkName string) ([]network.Subnet, error) {\n\tvar l []network.Subnet\n\tfor _, subnet := range c.Subnets {\n\t\tl = append(l, subnet)\n\t}\n\treturn l, nil\n}", "func (o PacketMirroringMirroredResourceInfoResponsePtrOutput) Subnetworks() PacketMirroringMirroredResourceInfoSubnetInfoResponseArrayOutput {\n\treturn o.ApplyT(func(v *PacketMirroringMirroredResourceInfoResponse) []PacketMirroringMirroredResourceInfoSubnetInfoResponse {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Subnetworks\n\t}).(PacketMirroringMirroredResourceInfoSubnetInfoResponseArrayOutput)\n}", "func (o NetworkInterfaceResponseOutput) Subnetwork() pulumi.StringOutput {\n\treturn o.ApplyT(func(v NetworkInterfaceResponse) string { return v.Subnetwork }).(pulumi.StringOutput)\n}", "func (o RouterInterfaceResponseOutput) Subnetwork() pulumi.StringOutput {\n\treturn o.ApplyT(func(v RouterInterfaceResponse) string { return v.Subnetwork }).(pulumi.StringOutput)\n}", "func (s *SubnetListener) ListSecurityGroups(inctx context.Context, in *protocol.SecurityGroupSubnetBindRequest) (_ *protocol.SecurityGroupBondsResponse, err error) {\n\tdefer fail.OnExitConvertToGRPCStatus(inctx, &err)\n\tdefer fail.OnExitLogError(inctx, &err)\n\tdefer fail.OnExitWrapError(inctx, &err, \"cannot list Security Groups bound to Subnet\")\n\n\tif s == nil {\n\t\treturn nil, fail.InvalidInstanceError()\n\t}\n\tif in == nil {\n\t\treturn nil, fail.InvalidParameterError(\"in\", \"cannot be nil\")\n\t}\n\tif inctx == nil {\n\t\treturn nil, fail.InvalidParameterError(\"inctx\", \"cannot be nil\")\n\t}\n\n\tnetworkRef, _ := srvutils.GetReference(in.GetNetwork())\n\tsubnetRef, _ := srvutils.GetReference(in.GetSubnet())\n\tif subnetRef == \"\" {\n\t\treturn nil, fail.InvalidRequestError(\"neither name nor id given as reference for Subnet\")\n\t}\n\n\tjob, xerr := PrepareJob(inctx, in.GetNetwork().GetTenantId(), fmt.Sprintf(\"network/%s/subnet/%s/securitygroups/list\", networkRef, subnetRef))\n\tif xerr != nil {\n\t\treturn nil, xerr\n\t}\n\tdefer job.Close()\n\n\tstate := securitygroupstate.Enum(in.GetState())\n\n\thandler := handlers.NewSubnetHandler(job)\n\tbonds, xerr := handler.ListSecurityGroups(networkRef, subnetRef, state)\n\tif xerr != nil {\n\t\treturn nil, xerr\n\t}\n\n\tresp := converters.SecurityGroupBondsFromPropertyToProtocol(bonds, \"subnets\")\n\treturn resp, nil\n}", "func ExampleDelegatedSubnetServiceClient_NewListByResourceGroupPager() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclientFactory, err := armdelegatednetwork.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := clientFactory.NewDelegatedSubnetServiceClient().NewListByResourceGroupPager(\"testRG\", nil)\n\tfor pager.More() {\n\t\tpage, err := pager.NextPage(ctx)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"failed to advance page: %v\", err)\n\t\t}\n\t\tfor _, v := range page.Value {\n\t\t\t// You could use page here. We use blank identifier for just demo purposes.\n\t\t\t_ = v\n\t\t}\n\t\t// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.\n\t\t// page.DelegatedSubnets = armdelegatednetwork.DelegatedSubnets{\n\t\t// \tValue: []*armdelegatednetwork.DelegatedSubnet{\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"delegated1\"),\n\t\t// \t\t\tType: to.Ptr(\"Microsoft.DelegatedNetwork/delegatedSubnets\"),\n\t\t// \t\t\tID: to.Ptr(\"/subscriptions/613192d7-503f-477a-9cfe-4efc3ee2bd60/resourceGroups/TestRG/providers/Microsoft.DelegatedNetwork/delegatedSubnets/delegated1\"),\n\t\t// \t\t\tLocation: to.Ptr(\"West US\"),\n\t\t// \t\t\tProperties: &armdelegatednetwork.DelegatedSubnetProperties{\n\t\t// \t\t\t\tControllerDetails: &armdelegatednetwork.ControllerDetails{\n\t\t// \t\t\t\t\tID: to.Ptr(\"/subscriptions/613192d7-503f-477a-9cfe-4efc3ee2bd60/resourceGroups/TestRG/providers/Microsoft.DelegatedNetwork/controller/dnctestcontroller\"),\n\t\t// \t\t\t\t},\n\t\t// \t\t\t\tProvisioningState: to.Ptr(armdelegatednetwork.DelegatedSubnetStateSucceeded),\n\t\t// \t\t\t\tResourceGUID: to.Ptr(\"5a82cbcf-e8ea-4175-ac2b-ad36a73f9801\"),\n\t\t// \t\t\t\tSubnetDetails: &armdelegatednetwork.SubnetDetails{\n\t\t// \t\t\t\t\tID: to.Ptr(\"/subscriptions/613192d7-503f-477a-9cfe-4efc3ee2bd60/resourceGroups/TestRG/providers/Microsoft.Network/virtualNetworks/testvnet/subnets/testsubnet\"),\n\t\t// \t\t\t\t},\n\t\t// \t\t\t},\n\t\t// \t}},\n\t\t// }\n\t}\n}", "func (o PacketMirroringMirroredResourceInfoPtrOutput) Subnetworks() PacketMirroringMirroredResourceInfoSubnetInfoArrayOutput {\n\treturn o.ApplyT(func(v *PacketMirroringMirroredResourceInfo) []PacketMirroringMirroredResourceInfoSubnetInfo {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Subnetworks\n\t}).(PacketMirroringMirroredResourceInfoSubnetInfoArrayOutput)\n}", "func (c *TestClient) AggregatedListInstances(project string, opts ...ListCallOption) ([]*compute.Instance, error) {\n\tif c.AggregatedListInstancesFn != nil {\n\t\treturn c.AggregatedListInstancesFn(project, opts...)\n\t}\n\treturn c.client.AggregatedListInstances(project, opts...)\n}", "func (o NetworkInterfaceOutput) Subnetwork() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v NetworkInterface) *string { return v.Subnetwork }).(pulumi.StringPtrOutput)\n}", "func (subnet *VirtualNetworksSubnet) Hub() {}", "func (a SubAccountClient) GetSubAccounts(req *rest3.RequestForSubAccounts) (rest3.ResponseForSubAccounts, error) {\n\tpanic(\"implement me\")\n}", "func ListSubnets(subnetsToQuery []string, site []string) (subnets []*ToScan) {\n\treturn LoadSubnets(viper.GetString(\"scanner.subnet_source\"), subnetsToQuery, site)\n}", "func builtinNetCIDRMerge(_ BuiltinContext, operands []*ast.Term, iter func(*ast.Term) error) error {\n\tnetworks := []*net.IPNet{}\n\n\tswitch v := operands[0].Value.(type) {\n\tcase *ast.Array:\n\t\tfor i := 0; i < v.Len(); i++ {\n\t\t\tnetwork, err := generateIPNet(v.Elem(i))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tnetworks = append(networks, network)\n\t\t}\n\tcase ast.Set:\n\t\terr := v.Iter(func(x *ast.Term) error {\n\t\t\tnetwork, err := generateIPNet(x)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tnetworks = append(networks, network)\n\t\t\treturn nil\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\tdefault:\n\t\treturn errors.New(\"operand must be an array\")\n\t}\n\n\tmerged := evalNetCIDRMerge(networks)\n\n\tresult := ast.NewSet()\n\tfor _, network := range merged {\n\t\tresult.Add(ast.StringTerm(network.String()))\n\t}\n\n\treturn iter(ast.NewTerm(result))\n}", "func (o RouterInterfaceOutput) Subnetwork() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v RouterInterface) *string { return v.Subnetwork }).(pulumi.StringPtrOutput)\n}", "func DeleteVirtualNetworkSubnet() {}", "func DeleteVirtualNetworkSubnet() {}", "func (sqlStore *SQLStore) getSubnets(db dbInterface, filter *model.SubnetFilter) ([]*model.Subnet, error) {\n\tbuilder := subnetSelect.\n\t\tOrderBy(\"CreateAt ASC\")\n\tbuilder = sqlStore.applySubnetsFilter(builder, filter)\n\n\tif filter.Free {\n\t\tbuilder = builder.Where(\"AccountID == '' \")\n\t}\n\n\tvar rawSubnets rawSubnets\n\terr := sqlStore.selectBuilder(db, &rawSubnets, builder)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to query for subnets\")\n\t}\n\n\treturn rawSubnets.toSubnets()\n}", "func (s *ClusterScope) SubnetSpecs() []azure.ResourceSpecGetter {\n\tnumberOfSubnets := len(s.AzureCluster.Spec.NetworkSpec.Subnets)\n\tif s.IsAzureBastionEnabled() {\n\t\tnumberOfSubnets++\n\t}\n\n\tsubnetSpecs := make([]azure.ResourceSpecGetter, 0, numberOfSubnets)\n\n\tfor _, subnet := range s.AzureCluster.Spec.NetworkSpec.Subnets {\n\t\tsubnetSpec := &subnets.SubnetSpec{\n\t\t\tName: subnet.Name,\n\t\t\tResourceGroup: s.ResourceGroup(),\n\t\t\tSubscriptionID: s.SubscriptionID(),\n\t\t\tCIDRs: subnet.CIDRBlocks,\n\t\t\tVNetName: s.Vnet().Name,\n\t\t\tVNetResourceGroup: s.Vnet().ResourceGroup,\n\t\t\tIsVNetManaged: s.IsVnetManaged(),\n\t\t\tRouteTableName: subnet.RouteTable.Name,\n\t\t\tSecurityGroupName: subnet.SecurityGroup.Name,\n\t\t\tRole: subnet.Role,\n\t\t\tNatGatewayName: subnet.NatGateway.Name,\n\t\t\tServiceEndpoints: subnet.ServiceEndpoints,\n\t\t}\n\t\tsubnetSpecs = append(subnetSpecs, subnetSpec)\n\t}\n\n\tif s.IsAzureBastionEnabled() {\n\t\tazureBastionSubnet := s.AzureCluster.Spec.BastionSpec.AzureBastion.Subnet\n\t\tsubnetSpecs = append(subnetSpecs, &subnets.SubnetSpec{\n\t\t\tName: azureBastionSubnet.Name,\n\t\t\tResourceGroup: s.ResourceGroup(),\n\t\t\tSubscriptionID: s.SubscriptionID(),\n\t\t\tCIDRs: azureBastionSubnet.CIDRBlocks,\n\t\t\tVNetName: s.Vnet().Name,\n\t\t\tVNetResourceGroup: s.Vnet().ResourceGroup,\n\t\t\tIsVNetManaged: s.IsVnetManaged(),\n\t\t\tSecurityGroupName: azureBastionSubnet.SecurityGroup.Name,\n\t\t\tRouteTableName: azureBastionSubnet.RouteTable.Name,\n\t\t\tRole: azureBastionSubnet.Role,\n\t\t\tServiceEndpoints: azureBastionSubnet.ServiceEndpoints,\n\t\t})\n\t}\n\n\treturn subnetSpecs\n}", "func NetList(ip net.IP, subnet net.IP) (IPlist []net.IP) {\n\t//ip, ipnet, err := net.ParseCIDR(cidrNet)\n\tmask := net.IPv4Mask(subnet[0], subnet[1], subnet[2], subnet[3])\n\tipnet := net.IPNet{ip, mask}\n\tfor ip := ip.Mask(mask); ipnet.Contains(ip); incIP(ip) {\n\t\tIPlist = append(IPlist, net.IP{ip[0], ip[1], ip[2], ip[3]})\n\t}\n\treturn\n}", "func expandInstanceNetworksSlice(c *Client, f []InstanceNetworks) ([]map[string]interface{}, error) {\n\tif f == nil {\n\t\treturn nil, nil\n\t}\n\n\titems := []map[string]interface{}{}\n\tfor _, item := range f {\n\t\ti, err := expandInstanceNetworks(c, &item)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\titems = append(items, i)\n\t}\n\n\treturn items, nil\n}", "func (o ClusterOutput) Subnetwork() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Cluster) pulumi.StringOutput { return v.Subnetwork }).(pulumi.StringOutput)\n}", "func (a *Client) ListOpenstackSubnets(params *ListOpenstackSubnetsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListOpenstackSubnetsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewListOpenstackSubnetsParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"listOpenstackSubnets\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/api/v1/providers/openstack/subnets\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &ListOpenstackSubnetsReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*ListOpenstackSubnetsOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\tunexpectedSuccess := result.(*ListOpenstackSubnetsDefault)\n\treturn nil, runtime.NewAPIError(\"unexpected success response: content available as default response in error\", unexpectedSuccess, unexpectedSuccess.Code())\n}", "func (esr *etcdSubnetRegistry) getNetworks(ctx context.Context) ([]string, uint64, error) {\n\tresp, err := esr.client().Get(ctx, esr.etcdCfg.Prefix, &etcd.GetOptions{Recursive: true})\n\n\tnetworks := []string{}\n\n\tif err == nil {\n\t\tfor _, node := range resp.Node.Nodes {\n\t\t\t// Look for '/config' on the child nodes\n\t\t\tfor _, child := range node.Nodes {\n\t\t\t\tnetname, isConfig := esr.parseNetworkKey(child.Key)\n\t\t\t\tif isConfig {\n\t\t\t\t\tnetworks = append(networks, netname)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn networks, resp.Index, nil\n\t}\n\n\tif etcdErr, ok := err.(etcd.Error); ok && etcdErr.Code == etcd.ErrorCodeKeyNotFound {\n\t\t// key not found: treat it as empty set\n\t\treturn networks, etcdErr.Index, nil\n\t}\n\n\treturn nil, 0, err\n}", "func subdivide(network *net.IPNet, size int) ([]*net.IPNet, error) {\n\tsubnetSize, addrSize := network.Mask.Size()\n\tif addrSize != 32 {\n\t\treturn nil, fmt.Errorf(\"only ipv4 subnets are supported, got %s\", network)\n\t}\n\tif size < subnetSize || subnetSize > addrSize {\n\t\treturn nil, fmt.Errorf(\"subnet must be between /%d and /32\", subnetSize)\n\t}\n\tnewMask := net.CIDRMask(size, addrSize)\n\n\tvar addrCountOriginal uint32 = 1 << (uint(addrSize) - uint(subnetSize)) // addresses in the original network\n\tvar addrCountSubdivided uint32 = 1 << (uint(addrSize) - uint(size)) // addresses in the subnets\n\n\tvar result []*net.IPNet\n\tfor i := uint32(0); i < addrCountOriginal/addrCountSubdivided; i++ {\n\t\t// add i * addrCountSubdivided to the initial IP address\n\t\tnewIP := make([]byte, 4)\n\t\tbinary.BigEndian.PutUint32(newIP, binary.BigEndian.Uint32(network.IP)+i*addrCountSubdivided)\n\n\t\tresult = append(result, &net.IPNet{\n\t\t\tIP: newIP,\n\t\t\tMask: newMask,\n\t\t})\n\t}\n\treturn result, nil\n}", "func (o LookupWorkstationClusterResultOutput) Subnetwork() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupWorkstationClusterResult) string { return v.Subnetwork }).(pulumi.StringOutput)\n}", "func CollectNetworkData(context context.T) (data []model.NetworkData) {\n\tvar output, dataB []byte\n\tvar err error\n\tvar singleInterface NwInterface\n\tvar multipleInterfaces []NwInterface\n\n\tlog := context.Log()\n\n\tlog.Infof(\"Collecting all networking interfaces by executing command:\\n%v %v\", cmd, cmdArgsToGetListAllInterfaces)\n\n\tif output, err = cmdExecutor(cmd, cmdArgsToGetListAllInterfaces); err == nil {\n\t\tcmdOutput := string(output)\n\t\tlog.Debugf(\"Command output: %v\", cmdOutput)\n\n\t\t//windows command can either return a single network interface or an array of network interfaces\n\t\tif err = json.Unmarshal(output, &singleInterface); err == nil {\n\n\t\t\tdata = append(data, convertToNetworkData(singleInterface))\n\n\t\t} else if err = json.Unmarshal(output, &multipleInterfaces); err == nil {\n\n\t\t\tfor _, nwInterface := range multipleInterfaces {\n\t\t\t\tdata = append(data, convertToNetworkData(nwInterface))\n\t\t\t}\n\n\t\t} else {\n\t\t\tlog.Infof(\"Unable to get network interface info because of unexpected command output - %v\",\n\t\t\t\tcmdOutput)\n\t\t\treturn\n\t\t}\n\n\t\tdataB, _ = json.Marshal(data)\n\t\tlog.Debugf(\"Basic network interface data collected so far: %v\", jsonutil.Indent(string(dataB)))\n\n\t\t//collecting advanced network information for those interfaces\n\t\tdata = GetAdvancedNetworkData(context, data)\n\n\t} else {\n\t\tlog.Debugf(\"Failed to execute command : %v %v with error - %v\",\n\t\t\tcmd,\n\t\t\tcmdArgsToGetListAllInterfaces,\n\t\t\terr.Error())\n\t\tlog.Errorf(\"Command failed with error: %v\", string(output))\n\t\tlog.Infof(\"Unable to get network data on windows platform\")\n\t}\n\n\treturn\n}", "func (s *SubnetworkServer) ListComputeSubnetwork(ctx context.Context, request *computepb.ListComputeSubnetworkRequest) (*computepb.ListComputeSubnetworkResponse, error) {\n\tcl, err := createConfigSubnetwork(ctx, request.GetServiceAccountFile())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresources, err := cl.ListSubnetwork(ctx, request.GetProject(), request.GetRegion())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar protos []*computepb.ComputeSubnetwork\n\tfor _, r := range resources.Items {\n\t\trp := SubnetworkToProto(r)\n\t\tprotos = append(protos, rp)\n\t}\n\tp := &computepb.ListComputeSubnetworkResponse{}\n\tp.SetItems(protos)\n\treturn p, nil\n}", "func (d *driver) getNetworks() []*bridgeNetwork {\n\td.Lock()\n\tdefer d.Unlock()\n\n\tls := make([]*bridgeNetwork, 0, len(d.networks))\n\tfor _, nw := range d.networks {\n\t\tls = append(ls, nw)\n\t}\n\treturn ls\n}", "func GetAllNetworks(l DigestStore) ([]string, error) {\n\tdigestInfos, err := l.GetDigests([]string{}, clock.Now().Unix())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tnetworks := digestInfos.Networks()\n\tnetworksUniq := funk.UniqString(networks)\n\treturn networksUniq, nil\n}", "func (instance *Host) updateSubnets(ctx context.Context, req abstract.HostRequest) fail.Error {\n\t// If Host is a gateway or is single, do not add it as Host attached to the Subnet, it's considered as part of the subnet\n\tif !req.IsGateway && !req.Single {\n\t\txerr := instance.Alter(ctx, func(clonable data.Clonable, props *serialize.JSONProperties) fail.Error {\n\t\t\treturn props.Alter(hostproperty.NetworkV2, func(clonable data.Clonable) fail.Error {\n\t\t\t\thnV2, ok := clonable.(*propertiesv2.HostNetworking)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn fail.InconsistentError(\"'*propertiesv2.HostNetworking' expected, '%s' provided\", reflect.TypeOf(clonable).String())\n\t\t\t\t}\n\n\t\t\t\thostID, err := instance.GetID()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fail.ConvertError(err)\n\t\t\t\t}\n\t\t\t\thostName := instance.GetName()\n\t\t\t\tsvc := instance.Service()\n\t\t\t\tfor _, as := range req.Subnets {\n\t\t\t\t\trs, innerXErr := LoadSubnet(ctx, svc, \"\", as.ID)\n\t\t\t\t\tif innerXErr != nil {\n\t\t\t\t\t\treturn innerXErr\n\t\t\t\t\t}\n\n\t\t\t\t\tinnerXErr = rs.Alter(ctx, func(clonable data.Clonable, properties *serialize.JSONProperties) fail.Error {\n\t\t\t\t\t\treturn properties.Alter(subnetproperty.HostsV1, func(clonable data.Clonable) fail.Error {\n\t\t\t\t\t\t\tsubnetHostsV1, ok := clonable.(*propertiesv1.SubnetHosts)\n\t\t\t\t\t\t\tif !ok {\n\t\t\t\t\t\t\t\treturn fail.InconsistentError(\"'*propertiesv1.SubnetHosts' expected, '%s' provided\", reflect.TypeOf(clonable).String())\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tsubnetHostsV1.ByName[hostName] = hostID\n\t\t\t\t\t\t\tsubnetHostsV1.ByID[hostID] = hostName\n\t\t\t\t\t\t\treturn nil\n\t\t\t\t\t\t})\n\t\t\t\t\t})\n\t\t\t\t\tif innerXErr != nil {\n\t\t\t\t\t\treturn innerXErr\n\t\t\t\t\t}\n\n\t\t\t\t\thnV2.SubnetsByID[as.ID] = as.Name\n\t\t\t\t\thnV2.SubnetsByName[as.Name] = as.ID\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t})\n\t\t})\n\t\tif xerr != nil {\n\t\t\treturn xerr\n\t\t}\n\t}\n\treturn nil\n}", "func TestAccComputeSubnetworkIamPolicy(t *testing.T) {\n\tt.Parallel()\n\n\tproject := envvar.GetTestProjectFromEnv()\n\taccount := fmt.Sprintf(\"tf-test-%d\", acctest.RandInt(t))\n\trole := \"roles/compute.networkUser\"\n\tregion := envvar.GetTestRegionFromEnv()\n\tsubnetwork := fmt.Sprintf(\"tf-test-%s\", acctest.RandString(t, 10))\n\n\tacctest.VcrTest(t, resource.TestCase{\n\t\tPreCheck: func() { acctest.AccTestPreCheck(t) },\n\t\tProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),\n\t\tSteps: []resource.TestStep{\n\t\t\t{\n\t\t\t\tConfig: testAccComputeSubnetworkIamPolicy_basic(account, region, subnetwork, role),\n\t\t\t},\n\t\t\t// Test a few import formats\n\t\t\t{\n\t\t\t\tResourceName: \"google_compute_subnetwork_iam_policy.foo\",\n\t\t\t\tImportStateId: fmt.Sprintf(\"projects/%s/regions/%s/subnetworks/%s\", project, region, subnetwork),\n\t\t\t\tImportState: true,\n\t\t\t\tImportStateVerify: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tResourceName: \"google_compute_subnetwork_iam_policy.foo\",\n\t\t\t\tImportStateId: fmt.Sprintf(\"%s/%s/%s\", project, region, subnetwork),\n\t\t\t\tImportState: true,\n\t\t\t\tImportStateVerify: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tResourceName: \"google_compute_subnetwork_iam_policy.foo\",\n\t\t\t\tImportStateId: fmt.Sprintf(\"%s/%s\", region, subnetwork),\n\t\t\t\tImportState: true,\n\t\t\t\tImportStateVerify: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tResourceName: \"google_compute_subnetwork_iam_policy.foo\",\n\t\t\t\tImportStateId: subnetwork,\n\t\t\t\tImportState: true,\n\t\t\t\tImportStateVerify: true,\n\t\t\t},\n\t\t},\n\t})\n}", "func (c *MockVirtualNetworksClient) List(ctx context.Context, resourceGroupName string) ([]network.VirtualNetwork, error) {\n\tvar l []network.VirtualNetwork\n\tfor _, vnet := range c.VNets {\n\t\tl = append(l, vnet)\n\t}\n\treturn l, nil\n}", "func (sigb *SubItemGroupBy) Aggregate(fns ...AggregateFunc) *SubItemGroupBy {\n\tsigb.fns = append(sigb.fns, fns...)\n\treturn sigb\n}", "func subnetSearchInSection(d *schema.ResourceData, meta interface{}) ([]subnets.Subnet, error) {\n\tc := meta.(*ProviderPHPIPAMClient).subnetsController\n\ts := meta.(*ProviderPHPIPAMClient).sectionsController\n\tresult := make([]subnets.Subnet, 0)\n\n\tv, err := s.GetSubnetsInSection(d.Get(\"section_id\").(int))\n\tif err != nil {\n\t\treturn result, err\n\t}\n\tif len(v) == 0 {\n\t\treturn result, errors.New(\"No subnets were found in the supplied section\")\n\t}\n\tfor _, r := range v {\n\t\tswitch {\n\t\t// Double-assert that we don't have empty strings in the conditionals\n\t\t// to ensure there there is no edge cases with matching zero values.\n\t\tcase d.Get(\"description_match\").(string) != \"\":\n\t\t\t// Don't trap error here because we should have already validated the regex via the ValidateFunc.\n\t\t\tif matched, _ := regexp.MatchString(d.Get(\"description_match\").(string), r.Description); matched {\n\t\t\t\tresult = append(result, r)\n\t\t\t}\n\t\tcase d.Get(\"description\").(string) != \"\" && r.Description == d.Get(\"description\").(string):\n\t\t\tresult = append(result, r)\n\t\tcase len(d.Get(\"custom_field_filter\").(map[string]interface{})) > 0:\n\t\t\t// Skip folders for now as there is issues pulling them down in the API.\n\t\t\tif r.IsFolder {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfields, err := c.GetSubnetCustomFields(r.ID)\n\t\t\tif err != nil {\n\t\t\t\treturn result, err\n\t\t\t}\n\t\t\tsearch := d.Get(\"custom_field_filter\").(map[string]interface{})\n\t\t\tif err != nil {\n\t\t\t\treturn result, err\n\t\t\t}\n\t\t\tmatched, err := customFieldFilter(fields, search)\n\t\t\tif err != nil {\n\t\t\t\treturn result, err\n\t\t\t}\n\t\t\tif matched {\n\t\t\t\tresult = append(result, r)\n\t\t\t}\n\t\t}\n\t}\n\treturn result, nil\n}", "func Merge(ips []Subnet) []Subnet {\n\tips = DedupSorted(Sort(ips))\n\tfor newips := MergePairs(ips); len(newips) != len(ips); newips = MergePairs(ips) {\n\t\tips = newips\n\t}\n\n\treturn ips\n}", "func (ggSession *GreengrassSession) ListSub() error {\n\tif ggSession.config.SubscriptionDefinition.ID == \"\" {\n\t\tfmt.Printf(\"No initial subscription defined\\n\")\n\t\treturn nil\n\t}\n\tsubscription, err := ggSession.greengrass.GetSubscriptionDefinition(&greengrass.GetSubscriptionDefinitionInput{\n\t\tSubscriptionDefinitionId: &ggSession.config.SubscriptionDefinition.ID,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfmt.Printf(\"subscription: %v\\n\", subscription)\n\tsubscriptionVersion, err := ggSession.greengrass.GetSubscriptionDefinitionVersion(&greengrass.GetSubscriptionDefinitionVersionInput{\n\t\tSubscriptionDefinitionId: subscription.Id,\n\t\tSubscriptionDefinitionVersionId: subscription.LatestVersion,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfmt.Printf(\"subscription version: %v\\n\", subscriptionVersion)\n\n\treturn nil\n}", "func Test_subSetLoadBalancer_ProcessSubsets(t *testing.T) {\n\n\thostSet := InitExampleHosts()\n\tupdateCb := func(entry types.LBSubsetEntry) {\n\t\tentry.PrioritySubset().Update(0, SubsetLbExample.originalPrioritySet.HostSetsByPriority()[0].Hosts(), nil)\n\t}\n\n\tnewCb := func(entry types.LBSubsetEntry, predicate types.HostPredicate, kvs types.SubsetMetadata, addinghost bool) {\n\t\tif addinghost {\n\t\t\tprioritySubset := NewPrioritySubsetImpl(&SubsetLbExample, predicate)\n\t\t\tentry.SetPrioritySubset(prioritySubset)\n\t\t}\n\t}\n\n\thostadded := SubsetLbExample.originalPrioritySet.HostSetsByPriority()[0].Hosts()\n\n\ttype args struct {\n\t\thostAdded []types.Host\n\t\thostsRemoved []types.Host\n\t\tupdateCB func(types.LBSubsetEntry)\n\t\tnewCB func(types.LBSubsetEntry, types.HostPredicate, types.SubsetMetadata, bool)\n\t\tmatchCriteria []types.MetadataMatchCriterion\n\t}\n\n\ttests := []struct {\n\t\tname string\n\t\targs args\n\t\twant []types.Host\n\t}{\n\t\t{\n\t\t\tname: \"case1\",\n\t\t\targs: args{\n\t\t\t\thostAdded: hostadded,\n\t\t\t\thostsRemoved: nil,\n\t\t\t\tupdateCB: updateCb,\n\t\t\t\tnewCB: newCb,\n\t\t\t\tmatchCriteria: []types.MetadataMatchCriterion{\n\t\t\t\t\t&router.MetadataMatchCriterionImpl{\n\t\t\t\t\t\t\"stage\",\n\t\t\t\t\t\ttypes.GenerateHashedValue(\"prod\"),\n\t\t\t\t\t},\n\t\t\t\t\t&router.MetadataMatchCriterionImpl{\n\t\t\t\t\t\t\"type\",\n\t\t\t\t\t\ttypes.GenerateHashedValue(\"std\"),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\twant: []types.Host{\n\t\t\t\thostSet[0], //e1,e2,e3,e4\n\t\t\t\thostSet[1], hostSet[2], hostSet[3],\n\t\t\t},\n\t\t},\n\n\t\t{\n\t\t\tname: \"case2\",\n\t\t\targs: args{\n\t\t\t\thostAdded: hostadded,\n\t\t\t\thostsRemoved: nil,\n\t\t\t\tupdateCB: updateCb,\n\t\t\t\tnewCB: newCb,\n\t\t\t\tmatchCriteria: []types.MetadataMatchCriterion{\n\t\t\t\t\t&router.MetadataMatchCriterionImpl{\n\t\t\t\t\t\t\"stage\",\n\t\t\t\t\t\ttypes.GenerateHashedValue(\"prod\"),\n\t\t\t\t\t},\n\t\t\t\t\t&router.MetadataMatchCriterionImpl{\n\t\t\t\t\t\t\"type\",\n\t\t\t\t\t\ttypes.GenerateHashedValue(\"bigmem\"),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\twant: []types.Host{\n\t\t\t\thostSet[4], //e5,e6\n\t\t\t\thostSet[5],\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"case3\",\n\t\t\targs: args{\n\t\t\t\thostAdded: hostadded,\n\t\t\t\thostsRemoved: nil,\n\t\t\t\tupdateCB: updateCb,\n\t\t\t\tnewCB: newCb,\n\t\t\t\tmatchCriteria: []types.MetadataMatchCriterion{\n\t\t\t\t\t&router.MetadataMatchCriterionImpl{\n\t\t\t\t\t\t\"stage\",\n\t\t\t\t\t\ttypes.GenerateHashedValue(\"dev\"),\n\t\t\t\t\t},\n\t\t\t\t\t&router.MetadataMatchCriterionImpl{\n\t\t\t\t\t\t\"type\",\n\t\t\t\t\t\ttypes.GenerateHashedValue(\"std\"),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\twant: []types.Host{\n\t\t\t\thostSet[6], //e5,e6\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"case4\",\n\t\t\targs: args{\n\t\t\t\thostAdded: hostadded,\n\t\t\t\thostsRemoved: nil,\n\t\t\t\tupdateCB: updateCb,\n\t\t\t\tnewCB: newCb,\n\t\t\t\tmatchCriteria: []types.MetadataMatchCriterion{\n\t\t\t\t\t&router.MetadataMatchCriterionImpl{\n\t\t\t\t\t\t\"stage\",\n\t\t\t\t\t\ttypes.GenerateHashedValue(\"prod\"),\n\t\t\t\t\t},\n\t\t\t\t\t&router.MetadataMatchCriterionImpl{\n\t\t\t\t\t\t\"version\",\n\t\t\t\t\t\ttypes.GenerateHashedValue(\"1.0\"),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\twant: []types.Host{\n\t\t\t\thostSet[0], //e1 e2 e5\n\t\t\t\thostSet[1],\n\t\t\t\thostSet[4],\n\t\t\t},\n\t\t},\n\n\t\t{\n\t\t\tname: \"case5\",\n\t\t\targs: args{\n\t\t\t\thostAdded: hostadded,\n\t\t\t\thostsRemoved: nil,\n\t\t\t\tupdateCB: updateCb,\n\t\t\t\tnewCB: newCb,\n\t\t\t\tmatchCriteria: []types.MetadataMatchCriterion{\n\t\t\t\t\t&router.MetadataMatchCriterionImpl{\n\t\t\t\t\t\t\"stage\",\n\t\t\t\t\t\ttypes.GenerateHashedValue(\"prod\"),\n\t\t\t\t\t},\n\t\t\t\t\t&router.MetadataMatchCriterionImpl{\n\t\t\t\t\t\t\"version\",\n\t\t\t\t\t\ttypes.GenerateHashedValue(\"1.1\"),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\twant: []types.Host{\n\t\t\t\thostSet[2], //e3 e4 e6\n\t\t\t\thostSet[3],\n\t\t\t\thostSet[5],\n\t\t\t},\n\t\t},\n\n\t\t{\n\t\t\tname: \"case6\",\n\t\t\targs: args{\n\t\t\t\thostAdded: hostadded,\n\t\t\t\thostsRemoved: nil,\n\t\t\t\tupdateCB: updateCb,\n\t\t\t\tnewCB: newCb,\n\t\t\t\tmatchCriteria: []types.MetadataMatchCriterion{\n\t\t\t\t\t&router.MetadataMatchCriterionImpl{\n\t\t\t\t\t\t\"stage\",\n\t\t\t\t\t\ttypes.GenerateHashedValue(\"dev\"),\n\t\t\t\t\t},\n\t\t\t\t\t&router.MetadataMatchCriterionImpl{\n\t\t\t\t\t\t\"version\",\n\t\t\t\t\t\ttypes.GenerateHashedValue(\"1.2-pre\"),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\twant: []types.Host{\n\t\t\t\thostSet[6], //e7\n\n\t\t\t},\n\t\t},\n\n\t\t{\n\t\t\tname: \"case7\",\n\t\t\targs: args{\n\t\t\t\thostAdded: hostadded,\n\t\t\t\thostsRemoved: nil,\n\t\t\t\tupdateCB: updateCb,\n\t\t\t\tnewCB: newCb,\n\t\t\t\tmatchCriteria: []types.MetadataMatchCriterion{\n\t\t\t\t\t&router.MetadataMatchCriterionImpl{\n\t\t\t\t\t\t\"version\",\n\t\t\t\t\t\ttypes.GenerateHashedValue(\"1.0\"),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\twant: []types.Host{\n\t\t\t\thostSet[0], //e1,e2,e5\n\t\t\t\thostSet[1],\n\t\t\t\thostSet[4],\n\t\t\t},\n\t\t},\n\n\t\t{\n\t\t\tname: \"case8\",\n\t\t\targs: args{\n\t\t\t\thostAdded: hostadded,\n\t\t\t\thostsRemoved: nil,\n\t\t\t\tupdateCB: updateCb,\n\t\t\t\tnewCB: newCb,\n\t\t\t\tmatchCriteria: []types.MetadataMatchCriterion{\n\t\t\t\t\t&router.MetadataMatchCriterionImpl{\n\t\t\t\t\t\t\"version\",\n\t\t\t\t\t\ttypes.GenerateHashedValue(\"1.1\"),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\twant: []types.Host{\n\t\t\t\thostSet[2], //e3 e4 e6\n\t\t\t\thostSet[3],\n\t\t\t\thostSet[5],\n\t\t\t},\n\t\t},\n\n\t\t{\n\t\t\tname: \"case9\",\n\t\t\targs: args{\n\t\t\t\thostAdded: hostadded,\n\t\t\t\thostsRemoved: nil,\n\t\t\t\tupdateCB: updateCb,\n\t\t\t\tnewCB: newCb,\n\t\t\t\tmatchCriteria: []types.MetadataMatchCriterion{\n\t\t\t\t\t&router.MetadataMatchCriterionImpl{\n\t\t\t\t\t\t\"version\",\n\t\t\t\t\t\ttypes.GenerateHashedValue(\"1.2-pre\"),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\twant: []types.Host{\n\t\t\t\thostSet[6], //e7\n\t\t\t},\n\t\t},\n\n\t\t{\n\t\t\tname: \"testcase10\",\n\t\t\targs: args{\n\t\t\t\thostAdded: SubsetLbExample.originalPrioritySet.HostSetsByPriority()[0].Hosts(),\n\t\t\t\thostsRemoved: nil,\n\t\t\t\tupdateCB: updateCb,\n\t\t\t\tnewCB: newCb,\n\t\t\t\tmatchCriteria: []types.MetadataMatchCriterion{\n\t\t\t\t\t&router.MetadataMatchCriterionImpl{\n\t\t\t\t\t\t\"version\",\n\t\t\t\t\t\ttypes.GenerateHashedValue(\"1.0\"),\n\t\t\t\t\t},\n\t\t\t\t\t&router.MetadataMatchCriterionImpl{\n\t\t\t\t\t\t\"xlarge\",\n\t\t\t\t\t\ttypes.GenerateHashedValue(\"true\"),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\twant: []types.Host{\n\t\t\t\thostSet[0], // e1\n\t\t\t},\n\t\t},\n\t}\n\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tsslb := SubsetLbExample\n\n\t\t\tsslb.subSets = make(map[string]types.ValueSubsetMap)\n\n\t\t\tsslb.ProcessSubsets(tt.args.hostAdded, tt.args.hostsRemoved, tt.args.updateCB, tt.args.newCB)\n\n\t\t\tfor idx, host := range sslb.FindSubset(tt.args.matchCriteria).PrioritySubset().GetOrCreateHostSubset(0).Hosts() {\n\t\t\t\tif host.Hostname() != tt.want[idx].Hostname() {\n\t\t\t\t\tt.Errorf(\"subSetLoadBalancer.ChooseHost() = %v, want %v\", host.Hostname(), tt.want[idx].Hostname())\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n}", "func GetPerSubscriberDigests(network string) ([]*orc8r_protos.LeafDigest, error) {\n\t// HACK: apn resources digest is concatenated to every individual subscriber digest\n\t// so that the entire set of per-sub digests would capture changes in apn resources\n\tapnDigest, err := getApnResourcesDigest(network)\n\tif err != nil {\n\t\tglog.Errorf(\"Failed to generate digest for apn resources of network %+v: %+v\", network, err)\n\t\tapnDigest = \"\"\n\t}\n\n\tapnsByName, err := LoadApnsByName(network)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tleafDigests := []*orc8r_protos.LeafDigest{}\n\ttoken := \"\"\n\tfoundEmptyToken := false\n\tfor !foundEmptyToken {\n\t\t// The resultant subProtos lists are already ordered by subscriber id due to the nature\n\t\t// of LoadSubProtosPage\n\t\tsubProtos, nextToken, err := LoadSubProtosPage(0, token, network, apnsByName, lte_models.ApnResources{})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor _, subProto := range subProtos {\n\t\t\tdigest, err := mproto.HashDeterministic(subProto)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"Failed to generate digest for subscriber %+v of network %+v: %w\", subProto.Sid.Id, network, err)\n\t\t\t}\n\t\t\tleafDigest := &orc8r_protos.LeafDigest{\n\t\t\t\tId: lte_protos.SidString(subProto.Sid),\n\t\t\t\tDigest: &orc8r_protos.Digest{Md5Base64Digest: digest + apnDigest},\n\t\t\t}\n\t\t\tleafDigests = append(leafDigests, leafDigest)\n\t\t}\n\t\tfoundEmptyToken = nextToken == \"\"\n\t\ttoken = nextToken\n\t}\n\n\treturn leafDigests, nil\n}", "func (c *DockerCommand) RefreshNetworks() ([]*Network, error) {\n\tnetworks, err := c.Client.NetworkList(context.Background(), dockerTypes.NetworkListOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\townNetworks := make([]*Network, len(networks))\n\n\tfor i, network := range networks {\n\t\townNetworks[i] = &Network{\n\t\t\tName: network.Name,\n\t\t\tNetwork: network,\n\t\t\tClient: c.Client,\n\t\t\tOSCommand: c.OSCommand,\n\t\t\tLog: c.Log,\n\t\t\tDockerCommand: c,\n\t\t}\n\t}\n\n\treturn ownNetworks, nil\n}", "func (gr *ActivityReport) listSubsetRepositories(\n\tctx context.Context,\n\tclient *graphql.Client,\n\torganization string,\n\tcursor string) ([]string, error) {\n\n\tvar req *graphql.Request\n\tif cursor == \"\" {\n\t\treq = graphql.NewRequest(`\n query ($organization: String!, $size: Int!) {\n organization(login:$organization) {\n repositories(last:$size, affiliations:OWNER) {\n nodes {\n name\n owner {\n login\n }\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n totalCount\n }\n }\n rateLimit {\n limit\n cost\n remaining\n resetAt\n }\n }\n `)\n\t} else {\n\t\treq = graphql.NewRequest(`\n query ($organization: String!, $size: Int!, $cursor: String!) {\n organization(login:$organization) {\n repositories(first:$size, after:$cursor) {\n nodes {\n name\n }\n pageInfo {\n hasNextPage\n endCursor\n }\n totalCount\n }\n }\n rateLimit {\n limit\n cost\n remaining\n resetAt\n }\n }\n `)\n\t\treq.Var(\"cursor\", cursor)\n\t}\n\treq.Var(\"organization\", organization)\n\treq.Var(\"size\", 10)\n\n\trepositories := []string{}\n\tvar respData repositoriesResponseStruct\n\tif err := client.Run(ctx, req, &respData); err != nil {\n\t\treturn nil, err\n\t} else {\n\t\tfor _, repo := range respData.Organization.Repositories.Nodes {\n\t\t\trepositories = append(repositories, repo.Name)\n\t\t}\n\t\tgr.logf(\"Credits remaining %v\\n\", respData.RateLimit.Remaining)\n\t\treturn repositories, nil\n\t}\n}", "func (o EnvironmentNetworkConfigurationOutput) SubnetIds() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v EnvironmentNetworkConfiguration) []string { return v.SubnetIds }).(pulumi.StringArrayOutput)\n}", "func (sqlStore *SQLStore) GetSubnets(filter *model.SubnetFilter) ([]*model.Subnet, error) {\n\treturn sqlStore.getSubnets(sqlStore.db, filter)\n}", "func (m *MockClusterScoper) Subnets() v1beta1.Subnets {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Subnets\")\n\tret0, _ := ret[0].(v1beta1.Subnets)\n\treturn ret0\n}", "func (sp *Subnetworks) CalcAllIP() {\n\tfor i := 0; i < sp.NSubnets; i++ {\n\t\tsp.CalculateIPs(i)\n\t}\n}", "func GetMultiNetworks(nad []string, ns string, podName string) *corev1.Pod {\n\tpod := GetPodDefinition(ns, podName)\n\tpod.Annotations = map[string]string{\"k8s.v1.cni.cncf.io/networks\": strings.Join(nad, \",\")}\n\treturn pod\n}", "func (vns *VirtualNetworkService) List(ctx context.Context, pageOffset int, pageSize int,\n\tfilter OwnershipFilter) ([]*resources.VirtualNetwork, error) {\n\treturn vns.list(ctx, int(filter), (pageOffset-1)*pageSize, -pageSize)\n}", "func (o LookupGroupResultOutput) SubnetIds() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v LookupGroupResult) []string { return v.SubnetIds }).(pulumi.StringArrayOutput)\n}", "func (a *SubAccountApiService) ListSubAccounts(ctx context.Context, localVarOptionals *ListSubAccountsOpts) ([]SubAccount, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue []SubAccount\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/sub_accounts\"\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\tif localVarOptionals != nil && localVarOptionals.Type_.IsSet() {\n\t\tlocalVarQueryParams.Add(\"type\", parameterToString(localVarOptionals.Type_.Value(), \"\"))\n\t}\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tif ctx.Value(ContextGateAPIV4) == nil {\n\t\t// for compatibility, set configuration key and secret to context if ContextGateAPIV4 value is not present\n\t\tctx = context.WithValue(ctx, ContextGateAPIV4, GateAPIV4{\n\t\t\tKey: a.client.cfg.Key,\n\t\t\tSecret: a.client.cfg.Secret,\n\t\t})\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status + \", \" + string(localVarBody),\n\t\t}\n\t\tvar gateErr GateAPIError\n\t\tif e := a.client.decode(&gateErr, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\")); e == nil && gateErr.Label != \"\" {\n\t\t\tgateErr.APIError = newErr\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, gateErr\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "func AggregateSubsets(goroutines []*Goroutine, allStacks Callstacks) Callstacks {\n\tif allStacks == nil {\n\t\tallStacks = make(Callstacks, 0)\n\t}\n\tvar stacks []*callstack\n\tfor _, routine := range goroutines {\n\t\tstacks = append(stacks, flattenStack(routine.Stack.Calls))\n\t}\n\tfor _, newstack := range stacks {\n\t\t// Modify allstacks by adding/removing the necessary stack.\n\t\tallStacks = checkSubset(allStacks, *newstack)\n\t}\n\treturn allStacks\n}", "func (it *AllIterator) SubIterators() []graph.Iterator {\n\treturn nil\n}", "func (s Subnet) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"etag\", s.Etag)\n\tpopulate(objectMap, \"id\", s.ID)\n\tpopulate(objectMap, \"name\", s.Name)\n\tpopulate(objectMap, \"properties\", s.Properties)\n\tpopulate(objectMap, \"type\", s.Type)\n\treturn json.Marshal(objectMap)\n}", "func (clients *Clients) SubnetsClient() network.SubnetsClient {\n\n\tcreds := clients.Credential\n\n\tclient := (network.NewSubnetsClient(*&creds.ServicePrincipal.SubscriptionID))\n\tclient.Authorizer = creds.Authorizer\n\n\treturn client\n}", "func (n *NetworkListCommand) runNetworkList(args []string) error {\n\tlogrus.Debugf(\"list the networks\")\n\n\tctx := context.Background()\n\tapiClient := n.cli.Client()\n\trespNetworkResource, err := apiClient.NetworkList(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdisplay := n.cli.NewTableDisplay()\n\tdisplay.AddRow([]string{\"NETWORK ID\", \"NAME\", \"DRIVER\", \"SCOPE\"})\n\tfor _, network := range respNetworkResource {\n\t\tdisplay.AddRow([]string{\n\t\t\tnetwork.ID[:10],\n\t\t\tnetwork.Name,\n\t\t\tnetwork.Driver,\n\t\t\tnetwork.Scope,\n\t\t})\n\t}\n\n\tdisplay.Flush()\n\treturn nil\n}", "func (g *SCCGraph) Subnodes(cid int) []int {\n\treturn g.subnodes[g.subnodeIndexes[cid]:g.subnodeIndexes[cid+1]]\n}", "func privateNetworkInterfaces(all []net.Interface, fallback []string, logger log.Logger) []string {\n\tvar privInts []string\n\tfor _, i := range all {\n\t\taddrs, err := getInterfaceAddrs(&i)\n\t\tif err != nil {\n\t\t\tlevel.Warn(logger).Log(\"msg\", \"error getting addresses from network interface\", \"interface\", i.Name, \"err\", err)\n\t\t}\n\t\tfor _, a := range addrs {\n\t\t\ts := a.String()\n\t\t\tip, _, err := net.ParseCIDR(s)\n\t\t\tif err != nil {\n\t\t\t\tlevel.Warn(logger).Log(\"msg\", \"error parsing network interface IP address\", \"interface\", i.Name, \"addr\", s, \"err\", err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif ip.IsPrivate() {\n\t\t\t\tprivInts = append(privInts, i.Name)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\tif len(privInts) == 0 {\n\t\treturn fallback\n\t}\n\treturn privInts\n}", "func (client IdentityClient) ListRegionSubscriptions(ctx context.Context, request ListRegionSubscriptionsRequest) (response ListRegionSubscriptionsResponse, 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.listRegionSubscriptions, 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 = ListRegionSubscriptionsResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId}\n\t\t\t} else {\n\t\t\t\tresponse = ListRegionSubscriptionsResponse{}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\tif convertedResponse, ok := ociResponse.(ListRegionSubscriptionsResponse); ok {\n\t\tresponse = convertedResponse\n\t} else {\n\t\terr = fmt.Errorf(\"failed to convert OCIResponse into ListRegionSubscriptionsResponse\")\n\t}\n\treturn\n}", "func (c *TestClient) GetSubnetwork(project, region, name string) (*compute.Subnetwork, error) {\n\tif c.GetSubnetworkFn != nil {\n\t\treturn c.GetSubnetworkFn(project, region, name)\n\t}\n\treturn c.client.GetSubnetwork(project, region, name)\n}", "func (u *User) GetSubnets(queryParams ...string) (map[string]interface{}, error) {\n\tlog.info(\"========== GET USER SUBNETS ==========\")\n\turl := buildURL(path[\"users\"], u.UserID, path[\"subnets\"])\n\n\treturn u.do(\"GET\", url, \"\", queryParams)\n}", "func getSubscribers() (subs []common.SubscriberEntry, retErr error) {\n\n\tvar subList []common.SubscriberEntry\n\n\t// Creazione DynamoDB client\n\tsvc := dynamodb.New(common.Sess)\n\n\t// Determino l'input della query\n\tinput := &dynamodb.ScanInput{\n\t\tTableName: aws.String(subTableName),\n\t}\n\n\t// Effettuo la query\n\tresult, err := svc.Scan(input)\n\tif err != nil {\n\t\tcommon.Fatal(\"[BROKER] Errore nell'esecuzione della Query\\n\" + err.Error())\n\t\treturn nil, err\n\t}\n\n\tfor _, r := range result.Items {\n\n\t\tvar subID = common.SubscriberEntry{}\n\n\t\t// Unmarshaling del dato ottenuto\n\t\terr = dynamodbattribute.UnmarshalMap(r, &subID)\n\t\tif err != nil {\n\t\t\tcommon.Fatal(\"Errore nell'unmarshaling della entry\\n\" + err.Error())\n\t\t\treturn nil, err\n\t\t}\n\n\t\tsubList = append(subList, subID)\n\n\t}\n\n\n\treturn subList, nil\n\n}", "func flattenInstanceNetworksSlice(c *Client, i interface{}) []InstanceNetworks {\n\ta, ok := i.([]interface{})\n\tif !ok {\n\t\treturn []InstanceNetworks{}\n\t}\n\n\tif len(a) == 0 {\n\t\treturn []InstanceNetworks{}\n\t}\n\n\titems := make([]InstanceNetworks, 0, len(a))\n\tfor _, item := range a {\n\t\titems = append(items, *flattenInstanceNetworks(c, item.(map[string]interface{})))\n\t}\n\n\treturn items\n}", "func (client Client) VirtualNetworks() network.VirtualNetworksClient {\n\tif client.networks == nil {\n\t\tclnt := network.NewVirtualNetworksClientWithBaseURI(client.baseURI, client.subscriptionID)\n\t\tclnt.Authorizer = client.Authorizer\n\t\tclnt.RequestInspector = client.RequestInspector\n\t\tclnt.ResponseInspector = client.ResponseInspector\n\t\tclient.networks = &clnt\t\t\n\t}\t\n\treturn *client.networks\n}", "func (m *MockNetworkDescriber) Subnets() v1beta1.Subnets {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Subnets\")\n\tret0, _ := ret[0].(v1beta1.Subnets)\n\treturn ret0\n}", "func subnet(base *net.IPNet, newBits int, num int) (*net.IPNet, error) {\n\tip := base.IP\n\tmask := base.Mask\n\n\tbaseLength, addressLength := mask.Size()\n\tnewPrefixLen := baseLength + newBits\n\n\t// check if there is sufficient address space to extend the network prefix\n\tif newPrefixLen > addressLength {\n\t\treturn nil, fmt.Errorf(\"not enought space to extend prefix of %d by %d\", baseLength, newBits)\n\t}\n\n\t// calculate the maximum network number\n\tmaxNetNum := uint64(1<<uint64(newBits)) - 1\n\tif uint64(num) > maxNetNum {\n\t\treturn nil, fmt.Errorf(\"prefix extension of %d does not accommodate a subnet numbered %d\", newBits, num)\n\t}\n\n\treturn &net.IPNet{\n\t\tIP: insertNetworkNumIntoIP(ip, num, newPrefixLen),\n\t\tMask: net.CIDRMask(newPrefixLen, addressLength),\n\t}, nil\n}", "func (esr *etcdSubnetRegistry) getSubnets(ctx context.Context, network string) ([]Lease, uint64, error) {\n\tkey := path.Join(esr.etcdCfg.Prefix, network, \"subnets\")\n\tresp, err := esr.client().Get(ctx, key, &etcd.GetOptions{Recursive: true})\n\tif err != nil {\n\t\tif etcdErr, ok := err.(etcd.Error); ok && etcdErr.Code == etcd.ErrorCodeKeyNotFound {\n\t\t\t// key not found: treat it as empty set\n\t\t\treturn []Lease{}, etcdErr.Index, nil\n\t\t}\n\t\treturn nil, 0, err\n\t}\n\n\tleases := []Lease{}\n\tfor _, node := range resp.Node.Nodes {\n\t\tl, err := nodeToLease(node)\n\t\tif err != nil {\n\t\t\tlog.Warningf(\"Ignoring bad subnet node: %v\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\tleases = append(leases, *l)\n\t}\n\n\treturn leases, resp.Index, nil\n}", "func (c Context) SubTasks() ([]Task, error) {\n\t// TODO\n\treturn nil, nil\n}", "func (c *MockAzureCloud) Subnet() azure.SubnetsClient {\n\treturn c.SubnetsClient\n}", "func GetAllNetworkConfigList(cniPath *CNIPath) ([]*libcni.NetworkConfigList, error) {\n\tnetworks := make([]*libcni.NetworkConfigList, 0)\n\n\tif cniPath == nil {\n\t\treturn networks, ErrNoCNIConfig\n\t}\n\tif cniPath.Conf == \"\" {\n\t\treturn networks, ErrNoCNIConfig\n\t}\n\n\tfiles, err := libcni.ConfFiles(cniPath.Conf, []string{\".conf\", \".json\", \".conflist\"})\n\tif err != nil {\n\t\treturn nil, err\n\t} else if len(files) == 0 {\n\t\treturn nil, libcni.NoConfigsFoundError{Dir: cniPath.Conf}\n\t}\n\tsort.Strings(files)\n\n\tfor _, file := range files {\n\t\tif strings.HasSuffix(file, \".conflist\") {\n\t\t\tconf, err := libcni.ConfListFromFile(file)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"%s: %s\", file, err)\n\t\t\t}\n\t\t\tnetworks = append(networks, conf)\n\t\t} else {\n\t\t\tconf, err := libcni.ConfFromFile(file)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"%s: %s\", file, err)\n\t\t\t}\n\t\t\tconfList, err := libcni.ConfListFromConf(conf)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"%s: %s\", file, err)\n\t\t\t}\n\t\t\tnetworks = append(networks, confList)\n\t\t}\n\t}\n\n\treturn networks, nil\n}", "func (vns *VirtualNetworkService) ListAll(ctx context.Context,\n\tfilter OwnershipFilter) ([]*resources.VirtualNetwork, error) {\n\treturn vns.list(ctx, int(filter), pageOffsetDefault, pageSizeDefault)\n}", "func (o RouterNatResponseOutput) SourceSubnetworkIpRangesToNat() pulumi.StringOutput {\n\treturn o.ApplyT(func(v RouterNatResponse) string { return v.SourceSubnetworkIpRangesToNat }).(pulumi.StringOutput)\n}", "func SubListAll(w http.ResponseWriter, r *http.Request) {\n\n\tvar err error\n\tvar strPageSize string\n\tvar pageSize int\n\tvar res subscriptions.PaginatedSubscriptions\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\tprojectUUID := gorillaContext.Get(r, \"auth_project_uuid\").(string)\n\troles := gorillaContext.Get(r, \"auth_roles\").([]string)\n\n\turlValues := r.URL.Query()\n\tpageToken := urlValues.Get(\"pageToken\")\n\tstrPageSize = urlValues.Get(\"pageSize\")\n\n\t// if this route is used by a user who only has a consumer role\n\t// return all subscriptions that he has access to\n\tuserUUID := \"\"\n\tif !auth.IsProjectAdmin(roles) && !auth.IsServiceAdmin(roles) && auth.IsConsumer(roles) {\n\t\tuserUUID = gorillaContext.Get(r, \"auth_user_uuid\").(string)\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\tif res, err = subscriptions.Find(projectUUID, userUUID, \"\", pageToken, int32(pageSize), 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 := res.ExportJSON()\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}" ]
[ "0.64782476", "0.6115899", "0.580542", "0.5746189", "0.57186645", "0.5698452", "0.5684227", "0.563206", "0.5507851", "0.53871846", "0.5255041", "0.5250647", "0.5182846", "0.51802826", "0.5175206", "0.5107359", "0.5104922", "0.5084663", "0.50052315", "0.49917224", "0.49916133", "0.4979801", "0.49720204", "0.49614075", "0.49544594", "0.4929505", "0.48704123", "0.48559222", "0.4820524", "0.4813807", "0.48050472", "0.47893572", "0.47736916", "0.4747463", "0.47284147", "0.47014168", "0.4691222", "0.46869087", "0.46752048", "0.4653832", "0.46073225", "0.45618096", "0.45552477", "0.4550934", "0.45490888", "0.45490888", "0.4540803", "0.4506816", "0.44861612", "0.4474254", "0.4473961", "0.4473742", "0.4470617", "0.4425771", "0.4407074", "0.43941736", "0.43922055", "0.43822792", "0.43791518", "0.4376942", "0.43719158", "0.43711102", "0.43617818", "0.43606094", "0.43496332", "0.4345297", "0.43316203", "0.43115756", "0.4302917", "0.42922148", "0.42899466", "0.42873108", "0.42869294", "0.42846176", "0.42845973", "0.4281739", "0.42753643", "0.4273486", "0.42512187", "0.42452925", "0.4242478", "0.42341477", "0.4227694", "0.42268953", "0.42143682", "0.42140004", "0.4212558", "0.42033443", "0.42017567", "0.4193681", "0.41872326", "0.41865373", "0.41850394", "0.4182604", "0.41766253", "0.41668898", "0.41667175", "0.4166098", "0.41641736", "0.41636354" ]
0.7627836
0
ListSubnetworks uses the override method ListSubnetworksFn or the real implementation.
func (c *TestClient) ListSubnetworks(project, region string, opts ...ListCallOption) ([]*compute.Subnetwork, error) { if c.ListSubnetworksFn != nil { return c.ListSubnetworksFn(project, region, opts...) } return c.client.ListSubnetworks(project, region, opts...) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o ServiceConnectionPolicyPscConfigOutput) Subnetworks() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v ServiceConnectionPolicyPscConfig) []string { return v.Subnetworks }).(pulumi.StringArrayOutput)\n}", "func (s *Stack) ListNetworks() ([]*abstract.Network, fail.Error) {\n\tvar networks []*abstract.Network\n\n\tcompuService := s.ComputeService\n\n\ttoken := \"\"\n\tfor paginate := true; paginate; {\n\t\tresp, err := compuService.Networks.List(s.GcpConfig.ProjectID).PageToken(token).Do()\n\t\tif err != nil {\n\t\t\treturn networks, fail.Errorf(fmt.Sprintf(\"cannot list networks ...: %s\", err), err)\n\t\t}\n\n\t\tfor _, nett := range resp.Items {\n\t\t\tnewNet := abstract.NewNetwork()\n\t\t\tnewNet.Name = nett.Name\n\t\t\tnewNet.ID = strconv.FormatUint(nett.Id, 10)\n\t\t\tnewNet.CIDR = nett.IPv4Range\n\n\t\t\tnetworks = append(networks, newNet)\n\t\t}\n\t\ttoken := resp.NextPageToken\n\t\tpaginate = token != \"\"\n\t}\n\n\ttoken = \"\"\n\tfor paginate := true; paginate; {\n\t\tresp, err := compuService.Subnetworks.List(s.GcpConfig.ProjectID, s.GcpConfig.Region).PageToken(token).Do()\n\t\tif err != nil {\n\t\t\treturn networks, fail.Errorf(fmt.Sprintf(\"cannot list subnetworks ...: %s\", err), err)\n\t\t}\n\n\t\tfor _, nett := range resp.Items {\n\t\t\tnewNet := abstract.NewNetwork()\n\t\t\tnewNet.Name = nett.Name\n\t\t\tnewNet.ID = strconv.FormatUint(nett.Id, 10)\n\t\t\tnewNet.CIDR = nett.IpCidrRange\n\n\t\t\tnetworks = append(networks, newNet)\n\t\t}\n\t\ttoken := resp.NextPageToken\n\t\tpaginate = token != \"\"\n\t}\n\n\treturn networks, nil\n}", "func (o ServiceConnectionPolicyPscConfigPtrOutput) Subnetworks() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *ServiceConnectionPolicyPscConfig) []string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Subnetworks\n\t}).(pulumi.StringArrayOutput)\n}", "func (o NetworkAttachmentOutput) Subnetworks() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *NetworkAttachment) pulumi.StringArrayOutput { return v.Subnetworks }).(pulumi.StringArrayOutput)\n}", "func Subnets(prefix cty.Value, newbits ...cty.Value) (cty.Value, error) {\n\targs := make([]cty.Value, len(newbits)+1)\n\targs[0] = prefix\n\tcopy(args[1:], newbits)\n\treturn SubnetsFunc.Call(args)\n}", "func (c *TestClient) AggregatedListSubnetworks(project string, opts ...ListCallOption) ([]*compute.Subnetwork, error) {\n\tif c.AggregatedListSubnetworksFn != nil {\n\t\treturn c.AggregatedListSubnetworksFn(project, opts...)\n\t}\n\treturn c.client.AggregatedListSubnetworks(project, opts...)\n}", "func (o RouterNatOutput) Subnetworks() RouterNatSubnetworkToNatArrayOutput {\n\treturn o.ApplyT(func(v RouterNat) []RouterNatSubnetworkToNat { return v.Subnetworks }).(RouterNatSubnetworkToNatArrayOutput)\n}", "func List(ctx context.Context, svc iaas.Service, networkID string, all bool, terraform bool) ([]*abstract.Subnet, fail.Error) {\n\tif !terraform {\n\t\treturn operations.ListSubnets(ctx, svc, networkID, all)\n\t}\n\n\tvar neptune []*abstract.Subnet\n\traw, err := operations.ListTerraformSubnets(ctx, svc, networkID, \"\", terraform)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, val := range raw { // FIXME: Another mapping problem\n\t\tns := abstract.NewSubnet()\n\t\tns.ID = val.Identity\n\t\tns.Name = val.Name\n\t\tneptune = append(neptune, ns)\n\t}\n\n\treturn neptune, nil\n}", "func (c *MockSubnetsClient) List(ctx context.Context, resourceGroupName, virtualNetworkName string) ([]network.Subnet, error) {\n\tvar l []network.Subnet\n\tfor _, subnet := range c.Subnets {\n\t\tl = append(l, subnet)\n\t}\n\treturn l, nil\n}", "func (o *AggregatedDomain) Subnets(info *bambou.FetchingInfo) (SubnetsList, *bambou.Error) {\n\n\tvar list SubnetsList\n\terr := bambou.CurrentSession().FetchChildren(o, SubnetIdentity, &list, info)\n\treturn list, err\n}", "func (o RouterNatResponseOutput) Subnetworks() RouterNatSubnetworkToNatResponseArrayOutput {\n\treturn o.ApplyT(func(v RouterNatResponse) []RouterNatSubnetworkToNatResponse { return v.Subnetworks }).(RouterNatSubnetworkToNatResponseArrayOutput)\n}", "func (o LookupVirtualNetworkResultOutput) Subnets() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v LookupVirtualNetworkResult) []string { return v.Subnets }).(pulumi.StringArrayOutput)\n}", "func (de *DockerEngine) getSubNet() (string, error) {\n\tde.subNetMu.Lock()\n\tdefer de.subNetMu.Unlock()\n\n\taddrs, err := net.InterfaceAddrs()\n\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"Error getting network addresses\")\n\t}\n\n\tvar nets []*net.IPNet\n\n\tfor _, addr := range addrs {\n\t\tdockerLog.Debugf(\"Inspecting interface %s\", addr.String())\n\n\t\t_, n, err := net.ParseCIDR(addr.String())\n\n\t\tif err != nil {\n\t\t\tdockerLog.Warningf(\"Error parsing address: %s\", addr.String())\n\n\t\t\tcontinue\n\t\t}\n\n\t\tnets = append(nets, n)\n\t}\n\n\tnetaddr := func() string {\n\t\ttpl := \"10.%d.%d.0/24\"\n\n\t\treturn fmt.Sprintf(tpl, de.subNetOct1, de.subNetOct2)\n\t}\n\n\t_, pnet, _ := net.ParseCIDR(netaddr())\n\n\tfor {\n\t\t// Find non-overlapping network\n\t\toverlap := false\n\n\t\tfor _, n := range nets {\n\t\t\tif lib.NetsOverlap(pnet, n) {\n\t\t\t\toverlap = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif overlap {\n\t\t\tde.subNetOct2 += 1\n\n\t\t\tif de.subNetOct2 > 255 {\n\t\t\t\tde.subNetOct1 += 1\n\t\t\t\tde.subNetOct2 = 0\n\t\t\t}\n\n\t\t\t_, pnet, _ = net.ParseCIDR(netaddr())\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn netaddr(), nil\n}", "func (o AccessLevelsAccessLevelBasicConditionOutput) IpSubnetworks() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AccessLevelsAccessLevelBasicCondition) []string { return v.IpSubnetworks }).(pulumi.StringArrayOutput)\n}", "func (o AccessLevelBasicConditionOutput) IpSubnetworks() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AccessLevelBasicCondition) []string { return v.IpSubnetworks }).(pulumi.StringArrayOutput)\n}", "func (o PacketMirroringMirroredResourceInfoResponsePtrOutput) Subnetworks() PacketMirroringMirroredResourceInfoSubnetInfoResponseArrayOutput {\n\treturn o.ApplyT(func(v *PacketMirroringMirroredResourceInfoResponse) []PacketMirroringMirroredResourceInfoSubnetInfoResponse {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Subnetworks\n\t}).(PacketMirroringMirroredResourceInfoSubnetInfoResponseArrayOutput)\n}", "func (s *ClusterScope) Subnets() infrav1.Subnets {\n\treturn s.AzureCluster.Spec.NetworkSpec.Subnets\n}", "func (o PacketMirroringMirroredResourceInfoResponseOutput) Subnetworks() PacketMirroringMirroredResourceInfoSubnetInfoResponseArrayOutput {\n\treturn o.ApplyT(func(v PacketMirroringMirroredResourceInfoResponse) []PacketMirroringMirroredResourceInfoSubnetInfoResponse {\n\t\treturn v.Subnetworks\n\t}).(PacketMirroringMirroredResourceInfoSubnetInfoResponseArrayOutput)\n}", "func Subnets(supernet *net.IPNet, prefix int) []*net.IPNet {\n\tones, bits := supernet.Mask.Size()\n\tif ones > prefix || bits < prefix {\n\t\treturn nil\n\t}\n\n\tip := supernet.IP\n\tmask := net.CIDRMask(prefix, bits)\n\tsize, _ := uint128.Pow2(uint(bits - prefix))\n\n\tsubnets := make([]*net.IPNet, 1<<uint(prefix-ones))\n\tfor i := 0; i < len(subnets); i++ {\n\t\tif i > 0 {\n\t\t\tlast, _ := uint128.NewFromBytes(subnets[i-1].IP)\n\t\t\tbuf := last.Add(size).Bytes()\n\n\t\t\t// Uint128 always returns a 16-byte slice. We only need the last\n\t\t\t// 4 bytes for IPv4 addresses.\n\t\t\tip = buf[16-len(ip):]\n\t\t}\n\n\t\tsubnets[i] = &net.IPNet{\n\t\t\tIP: ip,\n\t\t\tMask: mask,\n\t\t}\n\t}\n\n\treturn subnets\n}", "func (o PacketMirroringMirroredResourceInfoPtrOutput) Subnetworks() PacketMirroringMirroredResourceInfoSubnetInfoArrayOutput {\n\treturn o.ApplyT(func(v *PacketMirroringMirroredResourceInfo) []PacketMirroringMirroredResourceInfoSubnetInfo {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Subnetworks\n\t}).(PacketMirroringMirroredResourceInfoSubnetInfoArrayOutput)\n}", "func (daemon *Daemon) Subnets() ([]net.IPNet, []net.IPNet) {\n\tvar v4Subnets []net.IPNet\n\tvar v6Subnets []net.IPNet\n\n\tfor _, managedNetwork := range daemon.netController.Networks() {\n\t\tv4infos, v6infos := managedNetwork.IpamInfo()\n\t\tfor _, info := range v4infos {\n\t\t\tif info.IPAMData.Pool != nil {\n\t\t\t\tv4Subnets = append(v4Subnets, *info.IPAMData.Pool)\n\t\t\t}\n\t\t}\n\t\tfor _, info := range v6infos {\n\t\t\tif info.IPAMData.Pool != nil {\n\t\t\t\tv6Subnets = append(v6Subnets, *info.IPAMData.Pool)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn v4Subnets, v6Subnets\n}", "func (s *SubnetworkServer) ListComputeSubnetwork(ctx context.Context, request *computepb.ListComputeSubnetworkRequest) (*computepb.ListComputeSubnetworkResponse, error) {\n\tcl, err := createConfigSubnetwork(ctx, request.GetServiceAccountFile())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresources, err := cl.ListSubnetwork(ctx, request.GetProject(), request.GetRegion())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar protos []*computepb.ComputeSubnetwork\n\tfor _, r := range resources.Items {\n\t\trp := SubnetworkToProto(r)\n\t\tprotos = append(protos, rp)\n\t}\n\tp := &computepb.ListComputeSubnetworkResponse{}\n\tp.SetItems(protos)\n\treturn p, nil\n}", "func (o PacketMirroringMirroredResourceInfoOutput) Subnetworks() PacketMirroringMirroredResourceInfoSubnetInfoArrayOutput {\n\treturn o.ApplyT(func(v PacketMirroringMirroredResourceInfo) []PacketMirroringMirroredResourceInfoSubnetInfo {\n\t\treturn v.Subnetworks\n\t}).(PacketMirroringMirroredResourceInfoSubnetInfoArrayOutput)\n}", "func (s *SubnetListener) ListSecurityGroups(inctx context.Context, in *protocol.SecurityGroupSubnetBindRequest) (_ *protocol.SecurityGroupBondsResponse, err error) {\n\tdefer fail.OnExitConvertToGRPCStatus(inctx, &err)\n\tdefer fail.OnExitLogError(inctx, &err)\n\tdefer fail.OnExitWrapError(inctx, &err, \"cannot list Security Groups bound to Subnet\")\n\n\tif s == nil {\n\t\treturn nil, fail.InvalidInstanceError()\n\t}\n\tif in == nil {\n\t\treturn nil, fail.InvalidParameterError(\"in\", \"cannot be nil\")\n\t}\n\tif inctx == nil {\n\t\treturn nil, fail.InvalidParameterError(\"inctx\", \"cannot be nil\")\n\t}\n\n\tnetworkRef, _ := srvutils.GetReference(in.GetNetwork())\n\tsubnetRef, _ := srvutils.GetReference(in.GetSubnet())\n\tif subnetRef == \"\" {\n\t\treturn nil, fail.InvalidRequestError(\"neither name nor id given as reference for Subnet\")\n\t}\n\n\tjob, xerr := PrepareJob(inctx, in.GetNetwork().GetTenantId(), fmt.Sprintf(\"network/%s/subnet/%s/securitygroups/list\", networkRef, subnetRef))\n\tif xerr != nil {\n\t\treturn nil, xerr\n\t}\n\tdefer job.Close()\n\n\tstate := securitygroupstate.Enum(in.GetState())\n\n\thandler := handlers.NewSubnetHandler(job)\n\tbonds, xerr := handler.ListSecurityGroups(networkRef, subnetRef, state)\n\tif xerr != nil {\n\t\treturn nil, xerr\n\t}\n\n\tresp := converters.SecurityGroupBondsFromPropertyToProtocol(bonds, \"subnets\")\n\treturn resp, nil\n}", "func (o NetworkInterfaceOutput) Subnetwork() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v NetworkInterface) *string { return v.Subnetwork }).(pulumi.StringPtrOutput)\n}", "func ListSubnets(subnetsToQuery []string, site []string) (subnets []*ToScan) {\n\treturn LoadSubnets(viper.GetString(\"scanner.subnet_source\"), subnetsToQuery, site)\n}", "func (client Client) Subnets() network.SubnetsClient {\n\tif client.subnets == nil {\n\t\tclnt := network.NewSubnetsClientWithBaseURI(client.baseURI, client.subscriptionID)\n\t\tclnt.Authorizer = client.Authorizer\n\t\tclnt.RequestInspector = client.RequestInspector\n\t\tclnt.ResponseInspector = client.ResponseInspector\n\t\tclient.subnets = &clnt\t\t\n\t}\t\n\treturn *client.subnets\n}", "func (o NetworkInterfaceResponseOutput) Subnetwork() pulumi.StringOutput {\n\treturn o.ApplyT(func(v NetworkInterfaceResponse) string { return v.Subnetwork }).(pulumi.StringOutput)\n}", "func (r Virtual_Guest_Network_Component) GetSubnets() (resp []datatypes.Network_Subnet, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Virtual_Guest_Network_Component\", \"getSubnets\", nil, &r.Options, &resp)\n\treturn\n}", "func (o RegionNetworkEndpointGroupOutput) Subnetwork() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *RegionNetworkEndpointGroup) pulumi.StringPtrOutput { return v.Subnetwork }).(pulumi.StringPtrOutput)\n}", "func (a *AmazonConnectionsApiService) BrowseCloudSubnetworks(ctx _context.Context, amazonConnectionId string) ApiBrowseCloudSubnetworksRequest {\n\treturn ApiBrowseCloudSubnetworksRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tamazonConnectionId: amazonConnectionId,\n\t}\n}", "func (o RouterInterfaceResponseOutput) Subnetwork() pulumi.StringOutput {\n\treturn o.ApplyT(func(v RouterInterfaceResponse) string { return v.Subnetwork }).(pulumi.StringOutput)\n}", "func (o LookupRegionNetworkEndpointGroupResultOutput) Subnetwork() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupRegionNetworkEndpointGroupResult) string { return v.Subnetwork }).(pulumi.StringOutput)\n}", "func (o RouterInterfaceOutput) Subnetwork() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v RouterInterface) *string { return v.Subnetwork }).(pulumi.StringPtrOutput)\n}", "func NetList(ip net.IP, subnet net.IP) (IPlist []net.IP) {\n\t//ip, ipnet, err := net.ParseCIDR(cidrNet)\n\tmask := net.IPv4Mask(subnet[0], subnet[1], subnet[2], subnet[3])\n\tipnet := net.IPNet{ip, mask}\n\tfor ip := ip.Mask(mask); ipnet.Contains(ip); incIP(ip) {\n\t\tIPlist = append(IPlist, net.IP{ip[0], ip[1], ip[2], ip[3]})\n\t}\n\treturn\n}", "func (c *MockVirtualNetworksClient) List(ctx context.Context, resourceGroupName string) ([]network.VirtualNetwork, error) {\n\tvar l []network.VirtualNetwork\n\tfor _, vnet := range c.VNets {\n\t\tl = append(l, vnet)\n\t}\n\treturn l, nil\n}", "func (o ClusterOutput) Subnetwork() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Cluster) pulumi.StringOutput { return v.Subnetwork }).(pulumi.StringOutput)\n}", "func ExampleDelegatedSubnetServiceClient_NewListBySubscriptionPager() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclientFactory, err := armdelegatednetwork.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := clientFactory.NewDelegatedSubnetServiceClient().NewListBySubscriptionPager(nil)\n\tfor pager.More() {\n\t\tpage, err := pager.NextPage(ctx)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"failed to advance page: %v\", err)\n\t\t}\n\t\tfor _, v := range page.Value {\n\t\t\t// You could use page here. We use blank identifier for just demo purposes.\n\t\t\t_ = v\n\t\t}\n\t\t// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.\n\t\t// page.DelegatedSubnets = armdelegatednetwork.DelegatedSubnets{\n\t\t// \tValue: []*armdelegatednetwork.DelegatedSubnet{\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"delegated1\"),\n\t\t// \t\t\tType: to.Ptr(\"Microsoft.DelegatedNetwork/delegatedSubnets\"),\n\t\t// \t\t\tID: to.Ptr(\"/subscriptions/613192d7-503f-477a-9cfe-4efc3ee2bd60/resourceGroups/TestRG/providers/Microsoft.Network/virtualNetworks/testvnet/subnets/testsubnet/providers/Microsoft.DelegatedNetwork/delegatedSubnets/delegated1\"),\n\t\t// \t\t\tLocation: to.Ptr(\"West US\"),\n\t\t// \t\t\tProperties: &armdelegatednetwork.DelegatedSubnetProperties{\n\t\t// \t\t\t\tControllerDetails: &armdelegatednetwork.ControllerDetails{\n\t\t// \t\t\t\t\tID: to.Ptr(\"/subscriptions/613192d7-503f-477a-9cfe-4efc3ee2bd60/resourceGroups/TestRG/providers/Microsoft.DelegatedNetwork/controller/dnctestcontroller\"),\n\t\t// \t\t\t\t},\n\t\t// \t\t\t\tProvisioningState: to.Ptr(armdelegatednetwork.DelegatedSubnetStateSucceeded),\n\t\t// \t\t\t\tResourceGUID: to.Ptr(\"5a82cbcf-e8ea-4175-ac2b-ad36a73f9801\"),\n\t\t// \t\t\t\tSubnetDetails: &armdelegatednetwork.SubnetDetails{\n\t\t// \t\t\t\t\tID: to.Ptr(\"/subscriptions/613192d7-503f-477a-9cfe-4efc3ee2bd60/resourceGroups/TestRG/providers/Microsoft.Network/virtualNetworks/testvnet/subnets/testsubnet\"),\n\t\t// \t\t\t\t},\n\t\t// \t\t\t},\n\t\t// \t}},\n\t\t// }\n\t}\n}", "func (n *NetworkListCommand) runNetworkList(args []string) error {\n\tlogrus.Debugf(\"list the networks\")\n\n\tctx := context.Background()\n\tapiClient := n.cli.Client()\n\trespNetworkResource, err := apiClient.NetworkList(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdisplay := n.cli.NewTableDisplay()\n\tdisplay.AddRow([]string{\"NETWORK ID\", \"NAME\", \"DRIVER\", \"SCOPE\"})\n\tfor _, network := range respNetworkResource {\n\t\tdisplay.AddRow([]string{\n\t\t\tnetwork.ID[:10],\n\t\t\tnetwork.Name,\n\t\t\tnetwork.Driver,\n\t\t\tnetwork.Scope,\n\t\t})\n\t}\n\n\tdisplay.Flush()\n\treturn nil\n}", "func (ggSession *GreengrassSession) ListSub() error {\n\tif ggSession.config.SubscriptionDefinition.ID == \"\" {\n\t\tfmt.Printf(\"No initial subscription defined\\n\")\n\t\treturn nil\n\t}\n\tsubscription, err := ggSession.greengrass.GetSubscriptionDefinition(&greengrass.GetSubscriptionDefinitionInput{\n\t\tSubscriptionDefinitionId: &ggSession.config.SubscriptionDefinition.ID,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfmt.Printf(\"subscription: %v\\n\", subscription)\n\tsubscriptionVersion, err := ggSession.greengrass.GetSubscriptionDefinitionVersion(&greengrass.GetSubscriptionDefinitionVersionInput{\n\t\tSubscriptionDefinitionId: subscription.Id,\n\t\tSubscriptionDefinitionVersionId: subscription.LatestVersion,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfmt.Printf(\"subscription version: %v\\n\", subscriptionVersion)\n\n\treturn nil\n}", "func (a *AmazonConnectionsApiService) BrowseCloudSubnetworksExecute(r ApiBrowseCloudSubnetworksRequest) (CloudSubnetworksPage, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue CloudSubnetworksPage\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"AmazonConnectionsApiService.BrowseCloudSubnetworks\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/amazonConnections/{amazonConnectionId}/cloudSubnetworks\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"amazonConnectionId\"+\"}\", _neturl.PathEscape(parameterToString(r.amazonConnectionId, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\tif r.xApiVersion == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"xApiVersion is required and must be specified\")\n\t}\n\n\tif r.cloudNetworkId != nil {\n\t\tlocalVarQueryParams.Add(\"cloudNetworkId\", parameterToString(*r.cloudNetworkId, \"\"))\n\t}\n\tif r.availabilityZone != nil {\n\t\tlocalVarQueryParams.Add(\"availabilityZone\", parameterToString(*r.availabilityZone, \"\"))\n\t}\n\tif r.offset != nil {\n\t\tlocalVarQueryParams.Add(\"Offset\", parameterToString(*r.offset, \"\"))\n\t}\n\tif r.limit != nil {\n\t\tlocalVarQueryParams.Add(\"Limit\", parameterToString(*r.limit, \"\"))\n\t}\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\", \"application/problem+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-version\"] = parameterToString(*r.xApiVersion, \"\")\n\tif r.ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {\n\t\t\tif apiKey, ok := auth[\"Bearer\"]; ok {\n\t\t\t\tvar key string\n\t\t\t\tif apiKey.Prefix != \"\" {\n\t\t\t\t\tkey = apiKey.Prefix + \" \" + apiKey.Key\n\t\t\t\t} else {\n\t\t\t\t\tkey = apiKey.Key\n\t\t\t\t}\n\t\t\t\tlocalVarHeaderParams[\"Authorization\"] = key\n\t\t\t}\n\t\t}\n\t}\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 500 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "func (o LookupWorkstationClusterResultOutput) Subnetwork() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupWorkstationClusterResult) string { return v.Subnetwork }).(pulumi.StringOutput)\n}", "func (m *MockClusterScoper) Subnets() v1beta1.Subnets {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Subnets\")\n\tret0, _ := ret[0].(v1beta1.Subnets)\n\treturn ret0\n}", "func (in Subnets) DeepCopy() Subnets {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Subnets)\n\tin.DeepCopyInto(out)\n\treturn *out\n}", "func (c *TestClient) ListNetworks(project string, opts ...ListCallOption) ([]*compute.Network, error) {\n\tif c.ListNetworksFn != nil {\n\t\treturn c.ListNetworksFn(project, opts...)\n\t}\n\treturn c.client.ListNetworks(project, opts...)\n}", "func networkListExample() string {\n\treturn `$ pouch network ls\nNETWORK ID NAME DRIVER SCOPE\n6f7aba8a58 net2 bridge\n55f134176c net3 bridge\ne495f50913 net1 bridge\n`\n}", "func (vns *VirtualNetworkService) List(ctx context.Context, pageOffset int, pageSize int,\n\tfilter OwnershipFilter) ([]*resources.VirtualNetwork, error) {\n\treturn vns.list(ctx, int(filter), (pageOffset-1)*pageSize, -pageSize)\n}", "func (f *FakeInstance) ListPrivateNetworks(_ context.Context, _ string, _ *govultr.ListOptions) ([]govultr.PrivateNetwork, *govultr.Meta, *http.Response, error) {\n\tpanic(\"implement me\")\n}", "func (s *logicalNetworkLister) List(selector labels.Selector) (ret []*v1.LogicalNetwork, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1.LogicalNetwork))\n\t})\n\treturn ret, err\n}", "func (s *ClusterScope) SubnetSpecs() []azure.ResourceSpecGetter {\n\tnumberOfSubnets := len(s.AzureCluster.Spec.NetworkSpec.Subnets)\n\tif s.IsAzureBastionEnabled() {\n\t\tnumberOfSubnets++\n\t}\n\n\tsubnetSpecs := make([]azure.ResourceSpecGetter, 0, numberOfSubnets)\n\n\tfor _, subnet := range s.AzureCluster.Spec.NetworkSpec.Subnets {\n\t\tsubnetSpec := &subnets.SubnetSpec{\n\t\t\tName: subnet.Name,\n\t\t\tResourceGroup: s.ResourceGroup(),\n\t\t\tSubscriptionID: s.SubscriptionID(),\n\t\t\tCIDRs: subnet.CIDRBlocks,\n\t\t\tVNetName: s.Vnet().Name,\n\t\t\tVNetResourceGroup: s.Vnet().ResourceGroup,\n\t\t\tIsVNetManaged: s.IsVnetManaged(),\n\t\t\tRouteTableName: subnet.RouteTable.Name,\n\t\t\tSecurityGroupName: subnet.SecurityGroup.Name,\n\t\t\tRole: subnet.Role,\n\t\t\tNatGatewayName: subnet.NatGateway.Name,\n\t\t\tServiceEndpoints: subnet.ServiceEndpoints,\n\t\t}\n\t\tsubnetSpecs = append(subnetSpecs, subnetSpec)\n\t}\n\n\tif s.IsAzureBastionEnabled() {\n\t\tazureBastionSubnet := s.AzureCluster.Spec.BastionSpec.AzureBastion.Subnet\n\t\tsubnetSpecs = append(subnetSpecs, &subnets.SubnetSpec{\n\t\t\tName: azureBastionSubnet.Name,\n\t\t\tResourceGroup: s.ResourceGroup(),\n\t\t\tSubscriptionID: s.SubscriptionID(),\n\t\t\tCIDRs: azureBastionSubnet.CIDRBlocks,\n\t\t\tVNetName: s.Vnet().Name,\n\t\t\tVNetResourceGroup: s.Vnet().ResourceGroup,\n\t\t\tIsVNetManaged: s.IsVnetManaged(),\n\t\t\tSecurityGroupName: azureBastionSubnet.SecurityGroup.Name,\n\t\t\tRouteTableName: azureBastionSubnet.RouteTable.Name,\n\t\t\tRole: azureBastionSubnet.Role,\n\t\t\tServiceEndpoints: azureBastionSubnet.ServiceEndpoints,\n\t\t})\n\t}\n\n\treturn subnetSpecs\n}", "func (a *Client) ListOpenstackSubnets(params *ListOpenstackSubnetsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListOpenstackSubnetsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewListOpenstackSubnetsParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"listOpenstackSubnets\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/api/v1/providers/openstack/subnets\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &ListOpenstackSubnetsReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*ListOpenstackSubnetsOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\tunexpectedSuccess := result.(*ListOpenstackSubnetsDefault)\n\treturn nil, runtime.NewAPIError(\"unexpected success response: content available as default response in error\", unexpectedSuccess, unexpectedSuccess.Code())\n}", "func (m *MockNetworkDescriber) Subnets() v1beta1.Subnets {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Subnets\")\n\tret0, _ := ret[0].(v1beta1.Subnets)\n\treturn ret0\n}", "func DeleteVirtualNetworkSubnet() {}", "func DeleteVirtualNetworkSubnet() {}", "func (cr *Core) SubdistrictList(cityID int) (res SubdiscrictListResponse, err error) {\n\turlPath := fmt.Sprintf(\"subdistrict?city=%v\", cityID)\n\theaders := map[string]string{\n\t\t\"key\": cr.Client.APIKey,\n\t}\n\terr = cr.CallPro(fasthttp.MethodGet, urlPath, headers, nil, &res)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn\n}", "func (s *ClusterScope) Subnet(name string) infrav1.SubnetSpec {\n\tfor _, sn := range s.AzureCluster.Spec.NetworkSpec.Subnets {\n\t\tif sn.Name == name {\n\t\t\treturn sn\n\t\t}\n\t}\n\n\treturn infrav1.SubnetSpec{}\n}", "func (vcd *TestVCD) Test_GetNetworkList(check *C) {\n\tfmt.Printf(\"Running: %s\\n\", check.TestName())\n\tnetworkName := vcd.config.VCD.Network.Net1\n\tif networkName == \"\" {\n\t\tcheck.Skip(\"no network name provided\")\n\t}\n\tnetworks, err := vcd.vdc.GetNetworkList()\n\tcheck.Assert(err, IsNil)\n\tfound := false\n\tfor _, net := range networks {\n\t\t// Check that we don't get invalid fields\n\t\tknownType := net.LinkType == 0 || net.LinkType == 1 || net.LinkType == 2\n\t\tcheck.Assert(knownType, Equals, true)\n\t\t// Check that the `ConnectTo` field is not empty\n\t\tcheck.Assert(net.ConnectedTo, Not(Equals), \"\")\n\t\tif net.Name == networkName {\n\t\t\tfound = true\n\t\t}\n\t}\n\tcheck.Assert(found, Equals, true)\n}", "func (c *MockAzureCloud) Subnet() azure.SubnetsClient {\n\treturn c.SubnetsClient\n}", "func (i *InstanceServiceHandler) ListPrivateNetworks(ctx context.Context, instanceID string, options *ListOptions) ([]PrivateNetwork, *Meta, error) {\n\turi := fmt.Sprintf(\"%s/%s/private-networks\", instancePath, instanceID)\n\treq, err := i.client.NewRequest(ctx, http.MethodGet, uri, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tnewValues, err := query.Values(options)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treq.URL.RawQuery = newValues.Encode()\n\n\tnetworks := new(privateNetworksBase)\n\tif err = i.client.DoWithContext(ctx, req, networks); err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn networks.PrivateNetworks, networks.Meta, nil\n}", "func (clients *Clients) SubnetsClient() network.SubnetsClient {\n\n\tcreds := clients.Credential\n\n\tclient := (network.NewSubnetsClient(*&creds.ServicePrincipal.SubscriptionID))\n\tclient.Authorizer = creds.Authorizer\n\n\treturn client\n}", "func (g *SCCGraph) Subnodes(cid int) []int {\n\treturn g.subnodes[g.subnodeIndexes[cid]:g.subnodeIndexes[cid+1]]\n}", "func GetSubnetIPs(subnet string) (result []net.IP) {\n\tip, ipnet, err := net.ParseCIDR(subnet)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfor ip := ip.Mask(ipnet.Mask); ipnet.Contains(ip); inc(ip) {\n\t\tresult = append(result, net.ParseIP(ip.String()))\n\t}\n\treturn\n}", "func (s logicalNetworkNamespaceLister) List(selector labels.Selector) (ret []*v1.LogicalNetwork, err error) {\n\terr = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1.LogicalNetwork))\n\t})\n\treturn ret, err\n}", "func (esr *etcdSubnetRegistry) getNetworks(ctx context.Context) ([]string, uint64, error) {\n\tresp, err := esr.client().Get(ctx, esr.etcdCfg.Prefix, &etcd.GetOptions{Recursive: true})\n\n\tnetworks := []string{}\n\n\tif err == nil {\n\t\tfor _, node := range resp.Node.Nodes {\n\t\t\t// Look for '/config' on the child nodes\n\t\t\tfor _, child := range node.Nodes {\n\t\t\t\tnetname, isConfig := esr.parseNetworkKey(child.Key)\n\t\t\t\tif isConfig {\n\t\t\t\t\tnetworks = append(networks, netname)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn networks, resp.Index, nil\n\t}\n\n\tif etcdErr, ok := err.(etcd.Error); ok && etcdErr.Code == etcd.ErrorCodeKeyNotFound {\n\t\t// key not found: treat it as empty set\n\t\treturn networks, etcdErr.Index, nil\n\t}\n\n\treturn nil, 0, err\n}", "func ExampleDelegatedSubnetServiceClient_NewListByResourceGroupPager() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclientFactory, err := armdelegatednetwork.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := clientFactory.NewDelegatedSubnetServiceClient().NewListByResourceGroupPager(\"testRG\", nil)\n\tfor pager.More() {\n\t\tpage, err := pager.NextPage(ctx)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"failed to advance page: %v\", err)\n\t\t}\n\t\tfor _, v := range page.Value {\n\t\t\t// You could use page here. We use blank identifier for just demo purposes.\n\t\t\t_ = v\n\t\t}\n\t\t// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.\n\t\t// page.DelegatedSubnets = armdelegatednetwork.DelegatedSubnets{\n\t\t// \tValue: []*armdelegatednetwork.DelegatedSubnet{\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"delegated1\"),\n\t\t// \t\t\tType: to.Ptr(\"Microsoft.DelegatedNetwork/delegatedSubnets\"),\n\t\t// \t\t\tID: to.Ptr(\"/subscriptions/613192d7-503f-477a-9cfe-4efc3ee2bd60/resourceGroups/TestRG/providers/Microsoft.DelegatedNetwork/delegatedSubnets/delegated1\"),\n\t\t// \t\t\tLocation: to.Ptr(\"West US\"),\n\t\t// \t\t\tProperties: &armdelegatednetwork.DelegatedSubnetProperties{\n\t\t// \t\t\t\tControllerDetails: &armdelegatednetwork.ControllerDetails{\n\t\t// \t\t\t\t\tID: to.Ptr(\"/subscriptions/613192d7-503f-477a-9cfe-4efc3ee2bd60/resourceGroups/TestRG/providers/Microsoft.DelegatedNetwork/controller/dnctestcontroller\"),\n\t\t// \t\t\t\t},\n\t\t// \t\t\t\tProvisioningState: to.Ptr(armdelegatednetwork.DelegatedSubnetStateSucceeded),\n\t\t// \t\t\t\tResourceGUID: to.Ptr(\"5a82cbcf-e8ea-4175-ac2b-ad36a73f9801\"),\n\t\t// \t\t\t\tSubnetDetails: &armdelegatednetwork.SubnetDetails{\n\t\t// \t\t\t\t\tID: to.Ptr(\"/subscriptions/613192d7-503f-477a-9cfe-4efc3ee2bd60/resourceGroups/TestRG/providers/Microsoft.Network/virtualNetworks/testvnet/subnets/testsubnet\"),\n\t\t// \t\t\t\t},\n\t\t// \t\t\t},\n\t\t// \t}},\n\t\t// }\n\t}\n}", "func (o EnvironmentNetworkConfigurationOutput) SubnetIds() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v EnvironmentNetworkConfiguration) []string { return v.SubnetIds }).(pulumi.StringArrayOutput)\n}", "func (client WorkloadNetworksClient) ListGateways(ctx context.Context, resourceGroupName string, privateCloudName string) (result WorkloadNetworkGatewayListPage, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/WorkloadNetworksClient.ListGateways\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.wngl.Response.Response != nil {\n\t\t\t\tsc = result.wngl.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tif err := validation.Validate([]validation.Validation{\n\t\t{TargetValue: client.SubscriptionID,\n\t\t\tConstraints: []validation.Constraint{{Target: \"client.SubscriptionID\", Name: validation.MinLength, Rule: 1, Chain: nil}}},\n\t\t{TargetValue: resourceGroupName,\n\t\t\tConstraints: []validation.Constraint{{Target: \"resourceGroupName\", Name: validation.MaxLength, Rule: 90, Chain: nil},\n\t\t\t\t{Target: \"resourceGroupName\", Name: validation.MinLength, Rule: 1, Chain: nil},\n\t\t\t\t{Target: \"resourceGroupName\", Name: validation.Pattern, Rule: `^[-\\w\\._\\(\\)]+$`, Chain: nil}}}}); err != nil {\n\t\treturn result, validation.NewError(\"avs.WorkloadNetworksClient\", \"ListGateways\", err.Error())\n\t}\n\n\tresult.fn = client.listGatewaysNextResults\n\treq, err := client.ListGatewaysPreparer(ctx, resourceGroupName, privateCloudName)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"avs.WorkloadNetworksClient\", \"ListGateways\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.ListGatewaysSender(req)\n\tif err != nil {\n\t\tresult.wngl.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"avs.WorkloadNetworksClient\", \"ListGateways\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult.wngl, err = client.ListGatewaysResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"avs.WorkloadNetworksClient\", \"ListGateways\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\tif result.wngl.hasNextLink() && result.wngl.IsEmpty() {\n\t\terr = result.NextWithContext(ctx)\n\t\treturn\n\t}\n\n\treturn\n}", "func ListNics(bridge *netlink.Bridge, physical bool) ([]netlink.Link, error) {\n\tlinks, err := netlink.LinkList()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfiltered := links[:0]\n\n\tfor _, link := range links {\n\t\tif link.Attrs().MasterIndex != bridge.Index {\n\t\t\tcontinue\n\t\t}\n\t\tif physical && link.Type() != \"device\" {\n\t\t\tcontinue\n\t\t}\n\t\tfiltered = append(filtered, link)\n\t}\n\n\treturn filtered, nil\n}", "func (r *SubaccountsService) List(profileId int64) *SubaccountsListCall {\n\tc := &SubaccountsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.profileId = profileId\n\treturn c\n}", "func (c *Client) PrivateNetworks() (string, error) {\n\treturn c.get(\"/private-networks\")\n}", "func (sqlStore *SQLStore) getSubnets(db dbInterface, filter *model.SubnetFilter) ([]*model.Subnet, error) {\n\tbuilder := subnetSelect.\n\t\tOrderBy(\"CreateAt ASC\")\n\tbuilder = sqlStore.applySubnetsFilter(builder, filter)\n\n\tif filter.Free {\n\t\tbuilder = builder.Where(\"AccountID == '' \")\n\t}\n\n\tvar rawSubnets rawSubnets\n\terr := sqlStore.selectBuilder(db, &rawSubnets, builder)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to query for subnets\")\n\t}\n\n\treturn rawSubnets.toSubnets()\n}", "func (sqlStore *SQLStore) GetSubnets(filter *model.SubnetFilter) ([]*model.Subnet, error) {\n\treturn sqlStore.getSubnets(sqlStore.db, filter)\n}", "func ListSubports(port, workDir string) ([]string, error) {\n\tlistCmd := exec.Command(\"mpbb\", \"--work-dir\", workDir, \"list-subports\", \"--archive-site=\", \"--archive-site-private=\", port)\n\tstdout, err := listCmd.StdoutPipe()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err = listCmd.Start(); err != nil {\n\t\treturn nil, err\n\t}\n\tsubports := make([]string, 0, 1)\n\tstdoutScanner := bufio.NewScanner(stdout)\n\tfor stdoutScanner.Scan() {\n\t\tline := stdoutScanner.Text()\n\t\tsubports = append(subports, line)\n\t}\n\tif err = listCmd.Wait(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn subports, nil\n}", "func (c *TestClient) GetSubnetwork(project, region, name string) (*compute.Subnetwork, error) {\n\tif c.GetSubnetworkFn != nil {\n\t\treturn c.GetSubnetworkFn(project, region, name)\n\t}\n\treturn c.client.GetSubnetwork(project, region, name)\n}", "func (a *Client) ListOpenstackSubnetsNoCredentials(params *ListOpenstackSubnetsNoCredentialsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListOpenstackSubnetsNoCredentialsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewListOpenstackSubnetsNoCredentialsParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"listOpenstackSubnetsNoCredentials\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/api/v1/projects/{project_id}/dc/{dc}/clusters/{cluster_id}/providers/openstack/subnets\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &ListOpenstackSubnetsNoCredentialsReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*ListOpenstackSubnetsNoCredentialsOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\tunexpectedSuccess := result.(*ListOpenstackSubnetsNoCredentialsDefault)\n\treturn nil, runtime.NewAPIError(\"unexpected success response: content available as default response in error\", unexpectedSuccess, unexpectedSuccess.Code())\n}", "func (vns *VirtualNetworkService) ListAll(ctx context.Context,\n\tfilter OwnershipFilter) ([]*resources.VirtualNetwork, error) {\n\treturn vns.list(ctx, int(filter), pageOffsetDefault, pageSizeDefault)\n}", "func (esr *etcdSubnetRegistry) getSubnets(ctx context.Context, network string) ([]Lease, uint64, error) {\n\tkey := path.Join(esr.etcdCfg.Prefix, network, \"subnets\")\n\tresp, err := esr.client().Get(ctx, key, &etcd.GetOptions{Recursive: true})\n\tif err != nil {\n\t\tif etcdErr, ok := err.(etcd.Error); ok && etcdErr.Code == etcd.ErrorCodeKeyNotFound {\n\t\t\t// key not found: treat it as empty set\n\t\t\treturn []Lease{}, etcdErr.Index, nil\n\t\t}\n\t\treturn nil, 0, err\n\t}\n\n\tleases := []Lease{}\n\tfor _, node := range resp.Node.Nodes {\n\t\tl, err := nodeToLease(node)\n\t\tif err != nil {\n\t\t\tlog.Warningf(\"Ignoring bad subnet node: %v\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\tleases = append(leases, *l)\n\t}\n\n\treturn leases, resp.Index, nil\n}", "func (*ListNetworkSubnetsResponse) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_vpc_v1_network_service_proto_rawDescGZIP(), []int{10}\n}", "func (s *subscriberdbServicer) ListSubscribers(ctx context.Context, req *lte_protos.ListSubscribersRequest) (*lte_protos.ListSubscribersResponse, error) {\n\tgateway := protos.GetClientGateway(ctx)\n\tif gateway == nil {\n\t\treturn nil, status.Errorf(codes.PermissionDenied, \"missing gateway identity\")\n\t}\n\tif !gateway.Registered() {\n\t\treturn nil, status.Errorf(codes.PermissionDenied, \"gateway is not registered\")\n\t}\n\tnetworkID := gateway.NetworkId\n\n\tapnsByName, apnResourcesByAPN, err := loadAPNs(gateway)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsubProtos, nextToken, err := subscriberdb.LoadSubProtosPage(req.PageSize, req.PageToken, networkID, apnsByName, apnResourcesByAPN)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tflatDigest := &lte_protos.Digest{Md5Base64Digest: \"\"}\n\tperSubDigests := []*lte_protos.SubscriberDigestWithID{}\n\t// The digests are sent back during the request for the first page of subscriber data\n\tif req.PageToken == \"\" {\n\t\tflatDigest, _ = s.getDigestInfo(&lte_protos.Digest{Md5Base64Digest: \"\"}, networkID)\n\t\tperSubDigests, err = s.perSubDigestStore.GetDigest(networkID)\n\t\tif err != nil {\n\t\t\tglog.Errorf(\"Failed to get per-sub digests from store for network %+v: %+v\", networkID, err)\n\t\t}\n\t}\n\n\tlistRes := &lte_protos.ListSubscribersResponse{\n\t\tSubscribers: subProtos,\n\t\tNextPageToken: nextToken,\n\t\tFlatDigest: flatDigest,\n\t\tPerSubDigests: perSubDigests,\n\t}\n\treturn listRes, nil\n}", "func (o TopicRuleDestinationVpcConfigurationOutput) SubnetIds() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v TopicRuleDestinationVpcConfiguration) []string { return v.SubnetIds }).(pulumi.StringArrayOutput)\n}", "func (mr *MockNetworkDescriberMockRecorder) Subnets() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Subnets\", reflect.TypeOf((*MockNetworkDescriber)(nil).Subnets))\n}", "func (a *NetworkServerAPI) List(ctx context.Context, req *pb.ListNetworkServerRequest) (*pb.ListNetworkServerResponse, error) {\n\tif err := a.validator.Validate(ctx,\n\t\tauth.ValidateNetworkServersAccess(auth.List, req.OrganizationID),\n\t); err != nil {\n\t\treturn nil, grpc.Errorf(codes.Unauthenticated, \"authentication failed: %s\", err)\n\t}\n\n\tisAdmin, err := a.validator.GetIsAdmin(ctx)\n\tif err != nil {\n\t\treturn nil, errToRPCError(err)\n\t}\n\n\tvar count int\n\tvar nss []storage.NetworkServer\n\n\tif req.OrganizationID == 0 {\n\t\tif isAdmin {\n\t\t\tcount, err = storage.GetNetworkServerCount(config.C.PostgreSQL.DB)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errToRPCError(err)\n\t\t\t}\n\t\t\tnss, err = storage.GetNetworkServers(config.C.PostgreSQL.DB, int(req.Limit), int(req.Offset))\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errToRPCError(err)\n\t\t\t}\n\t\t}\n\t} else {\n\t\tcount, err = storage.GetNetworkServerCountForOrganizationID(config.C.PostgreSQL.DB, req.OrganizationID)\n\t\tif err != nil {\n\t\t\treturn nil, errToRPCError(err)\n\t\t}\n\t\tnss, err = storage.GetNetworkServersForOrganizationID(config.C.PostgreSQL.DB, req.OrganizationID, int(req.Limit), int(req.Offset))\n\t\tif err != nil {\n\t\t\treturn nil, errToRPCError(err)\n\t\t}\n\t}\n\n\tresp := pb.ListNetworkServerResponse{\n\t\tTotalCount: int64(count),\n\t}\n\n\tfor _, ns := range nss {\n\t\tresp.Result = append(resp.Result, &pb.GetNetworkServerResponse{\n\t\t\tId: ns.ID,\n\t\t\tCreatedAt: ns.CreatedAt.Format(time.RFC3339Nano),\n\t\t\tUpdatedAt: ns.UpdatedAt.Format(time.RFC3339Nano),\n\t\t\tName: ns.Name,\n\t\t\tServer: ns.Server,\n\t\t})\n\t}\n\n\treturn &resp, nil\n}", "func (*ListNetworkSubnetsRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_vpc_v1_network_service_proto_rawDescGZIP(), []int{9}\n}", "func (a SubAccountClient) GetSubAccounts(req *rest3.RequestForSubAccounts) (rest3.ResponseForSubAccounts, error) {\n\tpanic(\"implement me\")\n}", "func (client WorkloadNetworksClient) ListSegments(ctx context.Context, resourceGroupName string, privateCloudName string) (result WorkloadNetworkSegmentsListPage, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/WorkloadNetworksClient.ListSegments\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.wnsl.Response.Response != nil {\n\t\t\t\tsc = result.wnsl.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tif err := validation.Validate([]validation.Validation{\n\t\t{TargetValue: client.SubscriptionID,\n\t\t\tConstraints: []validation.Constraint{{Target: \"client.SubscriptionID\", Name: validation.MinLength, Rule: 1, Chain: nil}}},\n\t\t{TargetValue: resourceGroupName,\n\t\t\tConstraints: []validation.Constraint{{Target: \"resourceGroupName\", Name: validation.MaxLength, Rule: 90, Chain: nil},\n\t\t\t\t{Target: \"resourceGroupName\", Name: validation.MinLength, Rule: 1, Chain: nil},\n\t\t\t\t{Target: \"resourceGroupName\", Name: validation.Pattern, Rule: `^[-\\w\\._\\(\\)]+$`, Chain: nil}}}}); err != nil {\n\t\treturn result, validation.NewError(\"avs.WorkloadNetworksClient\", \"ListSegments\", err.Error())\n\t}\n\n\tresult.fn = client.listSegmentsNextResults\n\treq, err := client.ListSegmentsPreparer(ctx, resourceGroupName, privateCloudName)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"avs.WorkloadNetworksClient\", \"ListSegments\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.ListSegmentsSender(req)\n\tif err != nil {\n\t\tresult.wnsl.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"avs.WorkloadNetworksClient\", \"ListSegments\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult.wnsl, err = client.ListSegmentsResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"avs.WorkloadNetworksClient\", \"ListSegments\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\tif result.wnsl.hasNextLink() && result.wnsl.IsEmpty() {\n\t\terr = result.NextWithContext(ctx)\n\t\treturn\n\t}\n\n\treturn\n}", "func (o OceanOutput) SubnetIds() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *Ocean) pulumi.StringArrayOutput { return v.SubnetIds }).(pulumi.StringArrayOutput)\n}", "func (u *User) GetSubnets(queryParams ...string) (map[string]interface{}, error) {\n\tlog.info(\"========== GET USER SUBNETS ==========\")\n\turl := buildURL(path[\"users\"], u.UserID, path[\"subnets\"])\n\n\treturn u.do(\"GET\", url, \"\", queryParams)\n}", "func (a *SubAccountApiService) ListSubAccounts(ctx context.Context, localVarOptionals *ListSubAccountsOpts) ([]SubAccount, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue []SubAccount\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/sub_accounts\"\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\tif localVarOptionals != nil && localVarOptionals.Type_.IsSet() {\n\t\tlocalVarQueryParams.Add(\"type\", parameterToString(localVarOptionals.Type_.Value(), \"\"))\n\t}\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tif ctx.Value(ContextGateAPIV4) == nil {\n\t\t// for compatibility, set configuration key and secret to context if ContextGateAPIV4 value is not present\n\t\tctx = context.WithValue(ctx, ContextGateAPIV4, GateAPIV4{\n\t\t\tKey: a.client.cfg.Key,\n\t\t\tSecret: a.client.cfg.Secret,\n\t\t})\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status + \", \" + string(localVarBody),\n\t\t}\n\t\tvar gateErr GateAPIError\n\t\tif e := a.client.decode(&gateErr, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\")); e == nil && gateErr.Label != \"\" {\n\t\t\tgateErr.APIError = newErr\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, gateErr\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "func (a *Client) ListOpenstackSubnetsNoCredentialsV2(params *ListOpenstackSubnetsNoCredentialsV2Params, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListOpenstackSubnetsNoCredentialsV2OK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewListOpenstackSubnetsNoCredentialsV2Params()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"listOpenstackSubnetsNoCredentialsV2\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/api/v2/projects/{project_id}/clusters/{cluster_id}/providers/openstack/subnets\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &ListOpenstackSubnetsNoCredentialsV2Reader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*ListOpenstackSubnetsNoCredentialsV2OK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\tunexpectedSuccess := result.(*ListOpenstackSubnetsNoCredentialsV2Default)\n\treturn nil, runtime.NewAPIError(\"unexpected success response: content available as default response in error\", unexpectedSuccess, unexpectedSuccess.Code())\n}", "func (mr *MockClusterScoperMockRecorder) Subnets() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Subnets\", reflect.TypeOf((*MockClusterScoper)(nil).Subnets))\n}", "func RunNamespacesList(c *CmdConfig) error {\n\tif len(c.Args) > 0 {\n\t\treturn doctl.NewTooManyArgsErr(c.NS)\n\t}\n\tlist, err := c.Serverless().ListNamespaces(context.TODO())\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn c.Display(&displayers.Namespaces{Info: list.Namespaces})\n}", "func TestGetNetworks(t *testing.T) {\n\trecord(t, \"getnetworks\", func(t *testing.T, svc *Service) {\n\t\t_, err := createServer(svc, \"TestGetNetworks\")\n\t\trequire.NoError(t, err)\n\n\t\tnetworks, err := svc.GetNetworks()\n\t\trequire.NoError(t, err)\n\n\t\tassert.NotEmpty(t, networks.Networks)\n\n\t\tassert.NotEmpty(t, networks.Networks[0].IPNetworks)\n\t\tassert.NotEmpty(t, networks.Networks[0].Name)\n\t\tassert.NotEmpty(t, networks.Networks[0].Type)\n\t\tassert.NotEmpty(t, networks.Networks[0].UUID)\n\t\tassert.NotEmpty(t, networks.Networks[0].Zone)\n\n\t\t// Find a network with a server\n\t\tvar found bool\n\t\tfor _, n := range networks.Networks {\n\t\t\tif len(n.Servers) > 0 {\n\t\t\t\tfound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tassert.True(t, found)\n\t})\n}", "func (c *SubresourceClient) List(namespace string, labels map[string]string) (result []metav1.Object, e error) {\n\tif c.Error != \"\" {\n\t\te = fmt.Errorf(c.Error)\n\t} else {\n\t\tresult = []metav1.Object{c.Subresource}\n\t}\n\treturn\n}", "func SubnetworkToProto(resource *compute.Subnetwork) *computepb.ComputeSubnetwork {\n\tp := &computepb.ComputeSubnetwork{}\n\tp.SetCreationTimestamp(dcl.ValueOrEmptyString(resource.CreationTimestamp))\n\tp.SetDescription(dcl.ValueOrEmptyString(resource.Description))\n\tp.SetGatewayAddress(dcl.ValueOrEmptyString(resource.GatewayAddress))\n\tp.SetIpCidrRange(dcl.ValueOrEmptyString(resource.IPCidrRange))\n\tp.SetName(dcl.ValueOrEmptyString(resource.Name))\n\tp.SetNetwork(dcl.ValueOrEmptyString(resource.Network))\n\tp.SetFingerprint(dcl.ValueOrEmptyString(resource.Fingerprint))\n\tp.SetPurpose(ComputeSubnetworkPurposeEnumToProto(resource.Purpose))\n\tp.SetRole(ComputeSubnetworkRoleEnumToProto(resource.Role))\n\tp.SetPrivateIpGoogleAccess(dcl.ValueOrEmptyBool(resource.PrivateIPGoogleAccess))\n\tp.SetRegion(dcl.ValueOrEmptyString(resource.Region))\n\tp.SetLogConfig(ComputeSubnetworkLogConfigToProto(resource.LogConfig))\n\tp.SetProject(dcl.ValueOrEmptyString(resource.Project))\n\tp.SetSelfLink(dcl.ValueOrEmptyString(resource.SelfLink))\n\tp.SetEnableFlowLogs(dcl.ValueOrEmptyBool(resource.EnableFlowLogs))\n\tsSecondaryIPRanges := make([]*computepb.ComputeSubnetworkSecondaryIPRanges, len(resource.SecondaryIPRanges))\n\tfor i, r := range resource.SecondaryIPRanges {\n\t\tsSecondaryIPRanges[i] = ComputeSubnetworkSecondaryIPRangesToProto(&r)\n\t}\n\tp.SetSecondaryIpRanges(sSecondaryIPRanges)\n\n\treturn p\n}", "func SubnetCount(ipStrRange string) (int, error) {\n\trangeNumber, _ := strconv.Atoi(strings.Split(ipStrRange, \"/\")[1])\n\treturn int(math.Pow(2, float64(32-rangeNumber))), nil\n}", "func (n *NetworkServiceHandler) List(ctx context.Context) ([]Network, error) {\n\turi := \"/v1/network/list\"\n\n\treq, err := n.client.NewRequest(ctx, http.MethodGet, uri, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar networkMap map[string]Network\n\terr = n.client.DoWithContext(ctx, req, &networkMap)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar networks []Network\n\tfor _, network := range networkMap {\n\t\tnetworks = append(networks, network)\n\t}\n\n\treturn networks, nil\n}", "func (o LookupGroupResultOutput) SubnetIds() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v LookupGroupResult) []string { return v.SubnetIds }).(pulumi.StringArrayOutput)\n}", "func (a *Azure) DeleteSubnetwork(ctx *lepton.Context, subnetID string) error {\n\tlogger := ctx.Logger()\n\n\tsubnetsClient, err := a.getSubnetsClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\tvnetClient, err := a.getVnetClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsubnetName := getAzureResourceNameFromID(subnetID)\n\tvnName := getAzureVirtualNetworkFromID(subnetID)\n\n\tsubnet, err := subnetsClient.Get(context.TODO(), a.groupName, vnName, subnetName, \"\")\n\tif err != nil {\n\t\tctx.Logger().Error(err)\n\t\treturn fmt.Errorf(\"failed getting subnet\")\n\t}\n\n\tvirtualNetwork, err := vnetClient.Get(context.TODO(), a.groupName, vnName, \"\")\n\tif err != nil {\n\t\tctx.Logger().Error(err)\n\t\treturn errors.New(\"failed getting virtual network\")\n\t}\n\n\tif hasAzureOpsTags(virtualNetwork.Tags) && (subnet.IPConfigurations == nil || len(*subnet.IPConfigurations) == 0) {\n\t\tlogger.Infof(\"Deleting %s...\", *subnet.ID)\n\t\tsubnetDeleteTask, err := subnetsClient.Delete(context.TODO(), a.groupName, subnetName, subnetName)\n\t\tif err != nil {\n\t\t\tlogger.Error(err)\n\t\t\treturn errors.New(\"error deleting subnet\")\n\t\t}\n\n\t\terr = subnetDeleteTask.WaitForCompletionRef(context.TODO(), subnetsClient.Client)\n\t\tif err != nil {\n\t\t\tlogger.Error(err)\n\t\t\treturn errors.New(\"error waiting for subnet deletion\")\n\t\t}\n\n\t\tlogger.Infof(\"Deleting virtualNetworks/%s\", vnName)\n\t\tvnDeleteTask, err := vnetClient.Delete(context.TODO(), a.groupName, vnName)\n\t\tif err != nil {\n\t\t\tlogger.Error(err)\n\t\t\treturn errors.New(\"error deleting virtual network\")\n\t\t}\n\n\t\terr = vnDeleteTask.WaitForCompletionRef(context.TODO(), vnetClient.Client)\n\t\tif err != nil {\n\t\t\tlogger.Error(err)\n\t\t\treturn errors.New(\"error waiting for virtual network deletion\")\n\t\t}\n\t} else {\n\t\treturn errors.New(\"other devices are connected to the same subnet\")\n\t}\n\n\treturn nil\n}", "func GetMultiNetworks(nad []string, ns string, podName string) *corev1.Pod {\n\tpod := GetPodDefinition(ns, podName)\n\tpod.Annotations = map[string]string{\"k8s.v1.cni.cncf.io/networks\": strings.Join(nad, \",\")}\n\treturn pod\n}", "func privateNetworkInterfaces(all []net.Interface, fallback []string, logger log.Logger) []string {\n\tvar privInts []string\n\tfor _, i := range all {\n\t\taddrs, err := getInterfaceAddrs(&i)\n\t\tif err != nil {\n\t\t\tlevel.Warn(logger).Log(\"msg\", \"error getting addresses from network interface\", \"interface\", i.Name, \"err\", err)\n\t\t}\n\t\tfor _, a := range addrs {\n\t\t\ts := a.String()\n\t\t\tip, _, err := net.ParseCIDR(s)\n\t\t\tif err != nil {\n\t\t\t\tlevel.Warn(logger).Log(\"msg\", \"error parsing network interface IP address\", \"interface\", i.Name, \"addr\", s, \"err\", err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif ip.IsPrivate() {\n\t\t\t\tprivInts = append(privInts, i.Name)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\tif len(privInts) == 0 {\n\t\treturn fallback\n\t}\n\treturn privInts\n}" ]
[ "0.68757665", "0.6705404", "0.66948897", "0.65395653", "0.64577276", "0.63283545", "0.6278706", "0.6174467", "0.608521", "0.6079656", "0.6071058", "0.6044306", "0.60241044", "0.5929601", "0.59114236", "0.59049356", "0.590286", "0.5894461", "0.58901423", "0.58853257", "0.5846822", "0.58299637", "0.58046585", "0.5783981", "0.5783911", "0.5780349", "0.56740385", "0.56708395", "0.5645937", "0.562791", "0.5604432", "0.5581545", "0.55780315", "0.55658895", "0.5537562", "0.5510653", "0.5448816", "0.54227513", "0.53867114", "0.53780204", "0.53725535", "0.53708756", "0.5367744", "0.5344051", "0.5309817", "0.5304427", "0.5299899", "0.5268725", "0.5259807", "0.5219165", "0.52108264", "0.52095646", "0.51716816", "0.51716816", "0.5171508", "0.50800884", "0.5075147", "0.50609237", "0.50495166", "0.5003212", "0.49973047", "0.49921122", "0.49906003", "0.49822286", "0.4980381", "0.49792048", "0.49778235", "0.4944499", "0.4938782", "0.49282098", "0.4921564", "0.49200666", "0.49056876", "0.49054325", "0.48655346", "0.48553228", "0.4840742", "0.4832964", "0.48187417", "0.4813307", "0.4812059", "0.48073274", "0.47975767", "0.4792882", "0.47921026", "0.4790498", "0.4790113", "0.4775123", "0.4771127", "0.47674593", "0.4746082", "0.4745527", "0.47392094", "0.47365552", "0.47242987", "0.47175443", "0.47094142", "0.4701612", "0.46897054", "0.46875614" ]
0.8073922
0
GetTargetInstance uses the override method GetTargetInstanceFn or the real implementation.
func (c *TestClient) GetTargetInstance(project, zone, name string) (*compute.TargetInstance, error) { if c.GetTargetInstanceFn != nil { return c.GetTargetInstanceFn(project, zone, name) } return c.client.GetTargetInstance(project, zone, name) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *Client) GetTarget(arg0 context.Context, arg1 int64) (zendesk.Target, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetTarget\", arg0, arg1)\n\tret0, _ := ret[0].(zendesk.Target)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (t *Target) GetTarget(spec *TestSpec) (*TargetDetails, error) {\n\n\tswitch t.Kind {\n\tcase nodePort, service:\n\t\thost, port, err := spec.Kub.GetServiceHostPort(helpers.DefaultNamespace, t.GetServiceName(spec))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn &TargetDetails{\n\t\t\tPort: port,\n\t\t\tIP: []byte(host),\n\t\t}, nil\n\tcase direct:\n\t\tfilter := `{.status.podIP}{\"=\"}{.spec.containers[0].ports[0].containerPort}`\n\t\tres, err := spec.Kub.Get(helpers.DefaultNamespace, fmt.Sprintf(\"pod %s\", spec.DestPod)).Filter(filter)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"cannot get pod '%s' info: %s\", spec.DestPod, err)\n\t\t}\n\t\tvals := strings.Split(res.String(), \"=\")\n\t\tport, err := strconv.Atoi(vals[1])\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"cannot get pod '%s' port: %s\", spec.DestPod, err)\n\t\t}\n\t\treturn &TargetDetails{\n\t\t\tPort: port,\n\t\t\tIP: []byte(vals[0]),\n\t\t}, nil\n\t}\n\treturn nil, fmt.Errorf(\"%s not Implemented yet\", t.Kind)\n}", "func (launcher *Launcher) GetTarget() string {\n\tlauncher.Mutex.RLock()\n\targ := launcher.target\n\tlauncher.Mutex.RUnlock()\n\treturn arg\n}", "func (w *Watcher) GetTarget(targetName string) (*Target, error) {\n\tmutableMutex.Lock()\n\tdefer mutableMutex.Unlock()\n\tif w.TargetMap == nil {\n\t\tw.TargetMap = make(map[string]*Target)\n\t}\n\ttarget, ok := w.TargetMap[targetName]\n\tif !ok {\n\t\treturn nil, errors.Errorf(\"not exist domain\")\n\t}\n\treturn target, nil\n}", "func GetTarget(domain string) (*RegistNode, error) {\n\tlock.RLock()\n\tnode, ok := registryMap[domain]\n\tlock.RUnlock()\n\n\tif ok == false {\n\t\treturn nil, ErrServiceNotFound\n\t}\n\n\treturn &node, nil\n}", "func (a *AdminApiService) GetTarget(ctx _context.Context, id string) (Target, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue Target\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/admin/target/{id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", _neturl.QueryEscape(parameterToString(id, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 500 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "func (c *TestClient) CreateTargetInstance(project, zone string, ti *compute.TargetInstance) error {\n\tif c.CreateTargetInstanceFn != nil {\n\t\treturn c.CreateTargetInstanceFn(project, zone, ti)\n\t}\n\treturn c.client.CreateTargetInstance(project, zone, ti)\n}", "func (t *TargetCollection) GetTarget(host string) Target {\n\tif host == \"\" {\n\t\treturn nil\n\t}\n\n\tt.mux.Lock()\n\tdefer t.mux.Unlock()\n\n\treturn t.entries[host]\n}", "func (m *DeviceConfigurationAssignment) GetTarget()(DeviceAndAppManagementAssignmentTargetable) {\n val, err := m.GetBackingStore().Get(\"target\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(DeviceAndAppManagementAssignmentTargetable)\n }\n return nil\n}", "func (o ObjectMetricSourcePatchOutput) Target() CrossVersionObjectReferencePatchPtrOutput {\n\treturn o.ApplyT(func(v ObjectMetricSourcePatch) *CrossVersionObjectReferencePatch { return v.Target }).(CrossVersionObjectReferencePatchPtrOutput)\n}", "func (o ObjectMetricSourceOutput) Target() CrossVersionObjectReferenceOutput {\n\treturn o.ApplyT(func(v ObjectMetricSource) CrossVersionObjectReference { return v.Target }).(CrossVersionObjectReferenceOutput)\n}", "func (c *Chrome) Target() (*Target, error) {\n\teg, ctx := errgroup.WithContext(c.ctx)\n\n\t// connect to the headless chrome\n\tdevt, tar, conn, err := dial(ctx, c.addr.String())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tt := &Target{\n\t\tchrome: c,\n\t\tdevtools: devt,\n\t\ttarget: tar,\n\t\tctx: ctx,\n\t\teg: eg,\n\t\tconn: conn,\n\t}\n\n\teg.Go(t.doClose)\n\n\treturn t, nil\n}", "func (mr *ClientMockRecorder) GetTarget(arg0, arg1 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetTarget\", reflect.TypeOf((*Client)(nil).GetTarget), arg0, arg1)\n}", "func (n *graphNodeProxyProvider) Target() GraphNodeProvider {\n\tswitch t := n.target.(type) {\n\tcase *graphNodeProxyProvider:\n\t\treturn t.Target()\n\tdefault:\n\t\treturn n.target\n\t}\n}", "func (ud *UserDetail) Target() int64 {\n\treturn ud.TargetFunc()\n}", "func (c *TestClient) DeleteTargetInstance(project, zone, name string) error {\n\tif c.DeleteTargetInstanceFn != nil {\n\t\treturn c.DeleteTargetInstanceFn(project, zone, name)\n\t}\n\treturn c.client.DeleteTargetInstance(project, zone, name)\n}", "func Target() *eacl.Target {\n\tx := eacl.NewTarget()\n\n\tx.SetRole(eacl.RoleSystem)\n\tx.SetBinaryKeys([][]byte{\n\t\t{1, 2, 3},\n\t\t{4, 5, 6},\n\t})\n\n\treturn x\n}", "func (o AiEndpointDeployedModelDedicatedResourceAutoscalingMetricSpecOutput) Target() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v AiEndpointDeployedModelDedicatedResourceAutoscalingMetricSpec) *int { return v.Target }).(pulumi.IntPtrOutput)\n}", "func (o ObjectMetricStatusPatchOutput) Target() CrossVersionObjectReferencePatchPtrOutput {\n\treturn o.ApplyT(func(v ObjectMetricStatusPatch) *CrossVersionObjectReferencePatch { return v.Target }).(CrossVersionObjectReferencePatchPtrOutput)\n}", "func (o ObjectMetricSourcePtrOutput) Target() CrossVersionObjectReferencePtrOutput {\n\treturn o.ApplyT(func(v *ObjectMetricSource) *CrossVersionObjectReference {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Target\n\t}).(CrossVersionObjectReferencePtrOutput)\n}", "func CallTarget(vm *VM, target, locals Interface, msg *Message) Interface {\n\treturn target.(*Call).Target\n}", "func (i *Instance) TargetFQDN() names.FQDN {\n\treturn i.TargetHost.Qualify(i.Domain)\n}", "func (client *Client) Target(kind string, name string) Target {\n\tclient.mutex.RLock()\n\tdefer client.mutex.RUnlock()\n\n\tfor _, target := range client.targets {\n\t\tif target.Kind() == kind && strings.EqualFold(name, target.Name()) {\n\t\t\treturn target\n\t\t}\n\t}\n\n\treturn nil\n}", "func (obj *StorageNetAppLunEventRelationship) GetActualInstance() interface{} {\n\tif obj == nil {\n\t\treturn nil\n\t}\n\tif obj.MoMoRef != nil {\n\t\treturn obj.MoMoRef\n\t}\n\n\tif obj.StorageNetAppLunEvent != nil {\n\t\treturn obj.StorageNetAppLunEvent\n\t}\n\n\t// all schemas are nil\n\treturn nil\n}", "func CustomTarget(httpClient util.HTTPClient, baseURL string, tlsOptions TLSOptions, retryInterval time.Duration) Target {\n\treturn &customTarget{\n\t\ttargetType: TargetCustom,\n\t\tbaseURL: baseURL,\n\t\thttpClient: httpClient,\n\t\ttlsOptions: tlsOptions,\n\t\tretryInterval: retryInterval,\n\t}\n}", "func (p RProc) TargetClass() RClass {\n\treturn RClass{C._MRB_PROC_TARGET_CLASS(p.p), p.mrb}\n}", "func (o ObjectMetricSourcePatchPtrOutput) Target() CrossVersionObjectReferencePatchPtrOutput {\n\treturn o.ApplyT(func(v *ObjectMetricSourcePatch) *CrossVersionObjectReferencePatch {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Target\n\t}).(CrossVersionObjectReferencePatchPtrOutput)\n}", "func (o *RequestTarget) GetTarget() *ResourceReference {\n\tif o == nil {\n\t\treturn nil\n\t}\n\n\treturn o.Target\n}", "func (s *JobLogEventData) SetTargetInstanceID(v string) *JobLogEventData {\n\ts.TargetInstanceID = &v\n\treturn s\n}", "func (m *DeviceManagementResourceAccessProfileAssignment) GetTarget()(DeviceAndAppManagementAssignmentTargetable) {\n val, err := m.GetBackingStore().Get(\"target\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(DeviceAndAppManagementAssignmentTargetable)\n }\n return nil\n}", "func (m *ThreadFiles) GetTarget() string {\n\tif m != nil {\n\t\treturn m.Target\n\t}\n\treturn \"\"\n}", "func (o ObjectMetricStatusOutput) Target() CrossVersionObjectReferenceOutput {\n\treturn o.ApplyT(func(v ObjectMetricStatus) CrossVersionObjectReference { return v.Target }).(CrossVersionObjectReferenceOutput)\n}", "func (f *Function) OffloadInstance() {\n\tlogger := log.WithFields(log.Fields{\"fID\": f.fID})\n\n\tlogger.Debug(\"Offloading instance\")\n\n\tctx, cancel := context.WithTimeout(context.Background(), time.Second*15)\n\tdefer cancel()\n\n\terr := orch.Offload(ctx, f.vmID)\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\tf.conn.Close()\n}", "func (o ObjectMetricStatusPtrOutput) Target() CrossVersionObjectReferencePtrOutput {\n\treturn o.ApplyT(func(v *ObjectMetricStatus) *CrossVersionObjectReference {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Target\n\t}).(CrossVersionObjectReferencePtrOutput)\n}", "func NewTarget(node RegistNode) error {\n\tlock.Lock()\n\tdefer lock.Unlock()\n\tif _, ok := registryMap[node.Domain]; !ok {\n\t\tif registryMap == nil {\n\t\t\tregistryMap = map[string]RegistNode{}\n\t\t}\n\n\t\tregistryMap[node.Domain] = node\n\t\treturn nil\n\t}\n\treturn ErrServiceExisted\n}", "func (ci MrbCallInfo) TargetClass() RClassPtr {\n\treturn RClassPtr{C.mrb_vm_ci_target_class(ci.p)}\n}", "func (rs *Set) GetTarget(req *http.Request) (string, error) {\n\ttarget, err := rs.router.Route(req)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif target == nil {\n\t\treturn \"\", errors.New(\"no matching loadbalancer rule\")\n\t}\n\treturn target.(string), nil\n}", "func (o ObjectMetricStatusPatchPtrOutput) Target() CrossVersionObjectReferencePatchPtrOutput {\n\treturn o.ApplyT(func(v *ObjectMetricStatusPatch) *CrossVersionObjectReferencePatch {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Target\n\t}).(CrossVersionObjectReferencePatchPtrOutput)\n}", "func (mr *MockNamespaceKeeperMockRecorder) GetTarget(path interface{}, blockNum ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{path}, blockNum...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"GetTarget\", reflect.TypeOf((*MockNamespaceKeeper)(nil).GetTarget), varargs...)\n}", "func NewTarget(typ string, g *graph.Graph, n *graph.Node, capture *types.Capture, uuids flow.UUIDs, bpf *flow.BPF, fta *flow.TableAllocator) (Target, error) {\n\tswitch typ {\n\tcase \"netflowv5\":\n\t\treturn NewNetFlowV5Target(g, n, capture, uuids)\n\tcase \"erspanv1\":\n\t\treturn NewERSpanTarget(g, n, capture)\n\tcase \"\", \"local\":\n\t\treturn NewLocalTarget(g, n, capture, uuids, fta)\n\t}\n\n\treturn nil, ErrTargetTypeUnknown\n}", "func (p *P2PResolver) Target(ctx context.Context, target rpcinfo.EndpointInfo) (description string) {\n\treturn p.network + \"@\" + p.target\n}", "func GetTarget(theMap core.Element, trans *core.Transaction) core.Element {\n\tref := theMap.GetFirstOwnedReferenceRefinedFromURI(CrlMapTargetURI, trans)\n\tif ref == nil {\n\t\treturn nil\n\t}\n\treturn ref.GetReferencedConcept(trans)\n}", "func NewTarget() Target {\n\treturn Target{Alias: \"$tag_host $tag_name\", DsType: \"influxdb\"}\n}", "func (m *AccessPackageAssignment) GetTarget()(AccessPackageSubjectable) {\n return m.target\n}", "func (obj *UpdateVerificationFlowBody) GetActualInstance() interface{} {\n\tif obj == nil {\n\t\treturn nil\n\t}\n\tif obj.UpdateVerificationFlowWithCodeMethod != nil {\n\t\treturn obj.UpdateVerificationFlowWithCodeMethod\n\t}\n\n\tif obj.UpdateVerificationFlowWithLinkMethod != nil {\n\t\treturn obj.UpdateVerificationFlowWithLinkMethod\n\t}\n\n\t// all schemas are nil\n\treturn nil\n}", "func NewTarget(path string, kvstore store.Store, log *zap.Logger) *Target {\n\t// make sure we have a trailing slash for trimming future updates\n\tif !strings.HasSuffix(path, \"/\") {\n\t\tpath = path + \"/\"\n\t}\n\n\teventTypePathWatcher := NewWatcher(path+\"eventtypes\", kvstore, log)\n\tfunctionPathWatcher := NewWatcher(path+\"functions\", kvstore, log)\n\tsubscriptionPathWatcher := NewWatcher(path+\"subscriptions\", kvstore, log)\n\tcorsPathWatcher := NewWatcher(path+\"cors\", kvstore, log)\n\n\t// serves lookups for event types\n\teventTypeCache := newEventTypeCache(log)\n\t// serves lookups for function info\n\tfunctionCache := newFunctionCache(log)\n\t// serves lookups for which functions are subscribed to an event\n\tsubscriptionCache := newSubscriptionCache(log)\n\t// serves lookups for cors configuration\n\tcorsCache := newCORSCache(log)\n\n\t// start reacting to changes\n\tshutdown := make(chan struct{})\n\teventTypePathWatcher.React(eventTypeCache, shutdown)\n\tfunctionPathWatcher.React(functionCache, shutdown)\n\tsubscriptionPathWatcher.React(subscriptionCache, shutdown)\n\tcorsPathWatcher.React(corsCache, shutdown)\n\n\treturn &Target{\n\t\tlog: log,\n\t\tshutdown: shutdown,\n\t\teventTypeCache: eventTypeCache,\n\t\tfunctionCache: functionCache,\n\t\tsubscriptionCache: subscriptionCache,\n\t\tcorsCache: corsCache,\n\t}\n}", "func (o ObjectMetricSourcePatchOutput) Target() MetricTargetPatchPtrOutput {\n\treturn o.ApplyT(func(v ObjectMetricSourcePatch) *MetricTargetPatch { return v.Target }).(MetricTargetPatchPtrOutput)\n}", "func (o RegistryTaskDockerStepOutput) Target() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v RegistryTaskDockerStep) *string { return v.Target }).(pulumi.StringPtrOutput)\n}", "func NewTarget(namespace, pod, container string) *Target {\n\treturn &Target{\n\t\tNamespace: namespace,\n\t\tPod: pod,\n\t\tContainer: container,\n\t}\n}", "func (o ExternalMetricSourcePatchOutput) Target() MetricTargetPatchPtrOutput {\n\treturn o.ApplyT(func(v ExternalMetricSourcePatch) *MetricTargetPatch { return v.Target }).(MetricTargetPatchPtrOutput)\n}", "func findTarget() *Target {\n\tfor _, t := range targets {\n\t\tif runtime.GOARCH == t.Arch && runtime.GOOS == t.OS {\n\t\t\treturn &t\n\t\t}\n\t}\n\treturn nil\n}", "func (o RegistryTaskDockerStepPtrOutput) Target() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *RegistryTaskDockerStep) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Target\n\t}).(pulumi.StringPtrOutput)\n}", "func (d *Dao) Target(c context.Context, id int64) (res *model.Target, err error) {\n\tres = &model.Target{}\n\tif err = d.db.QueryRow(c, _targetSQL, id).Scan(&res.ID, &res.SubEvent, &res.Event, &res.Product, &res.Source, &res.GroupIDs, &res.Threshold, &res.Duration, &res.State, &res.Ctime, &res.Mtime); err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\tres = nil\n\t\t\terr = nil\n\t\t\treturn\n\t\t}\n\t\tlog.Error(\"d.Target.Scan error(%+v), id(%d)\", err, id)\n\t}\n\tif res.GroupIDs != \"\" {\n\t\tvar gids []int64\n\t\tif gids, err = xstr.SplitInts(res.GroupIDs); err != nil {\n\t\t\tlog.Error(\"d.Product.SplitInts error(%+v), group ids(%s)\", err, res.GroupIDs)\n\t\t\treturn\n\t\t}\n\t\tif res.Groups, err = d.Groups(c, gids); err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}", "func (obj *Fruit) GetActualInstance() (interface{}) {\n\tif obj == nil {\n\t\treturn nil\n\t}\n\tif obj.Apple != nil {\n\t\treturn obj.Apple\n\t}\n\n\tif obj.Banana != nil {\n\t\treturn obj.Banana\n\t}\n\n\t// all schemas are nil\n\treturn nil\n}", "func (o MrScalarTaskScalingDownPolicyOutput) Target() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v MrScalarTaskScalingDownPolicy) *string { return v.Target }).(pulumi.StringPtrOutput)\n}", "func (obj *SyntheticsAssertion) GetActualInstance() interface{} {\n\tif obj.SyntheticsAssertionTarget != nil {\n\t\treturn obj.SyntheticsAssertionTarget\n\t}\n\n\tif obj.SyntheticsAssertionJSONPathTarget != nil {\n\t\treturn obj.SyntheticsAssertionJSONPathTarget\n\t}\n\n\t// all schemas are nil\n\treturn nil\n}", "func (o InstanceGroupManagerVersionOutput) TargetSize() FixedOrPercentPtrOutput {\n\treturn o.ApplyT(func(v InstanceGroupManagerVersion) *FixedOrPercent { return v.TargetSize }).(FixedOrPercentPtrOutput)\n}", "func (o ExternalMetricSourceOutput) Target() MetricTargetOutput {\n\treturn o.ApplyT(func(v ExternalMetricSource) MetricTarget { return v.Target }).(MetricTargetOutput)\n}", "func (f *SAMDGClientForwarder) Target() string {\n\treturn f.Config().TargetHost + \":\" + f.Config().TargetPort\n}", "func LookupInstance(ctx *pulumi.Context, args *LookupInstanceArgs, opts ...pulumi.InvokeOption) (*LookupInstanceResult, error) {\n\topts = internal.PkgInvokeDefaultOpts(opts)\n\tvar rv LookupInstanceResult\n\terr := ctx.Invoke(\"google-native:compute/v1:getInstance\", args, &rv, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &rv, nil\n}", "func (a *Consensus) BaseTarget(ctx context.Context) (*ConsensusBaseTarget, *Response, error) {\n\tif a.options.ApiKey == \"\" {\n\t\treturn nil, nil, NoApiKeyError\n\t}\n\n\turl, err := joinUrl(a.options.BaseUrl, \"/consensus/basetarget\")\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treq, err := http.NewRequest(\"GET\", url.String(), nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treq.Header.Set(\"X-API-Key\", a.options.ApiKey)\n\n\tout := new(ConsensusBaseTarget)\n\tresponse, err := doHttp(ctx, a.options, req, out)\n\tif err != nil {\n\t\treturn nil, response, err\n\t}\n\n\treturn out, response, nil\n}", "func (o RegionAutoscalerOutput) Target() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *RegionAutoscaler) pulumi.StringOutput { return v.Target }).(pulumi.StringOutput)\n}", "func (m *ParcelMock) DefaultTarget() (r *insolar.Reference) {\n\tcounter := atomic.AddUint64(&m.DefaultTargetPreCounter, 1)\n\tdefer atomic.AddUint64(&m.DefaultTargetCounter, 1)\n\n\tif len(m.DefaultTargetMock.expectationSeries) > 0 {\n\t\tif counter > uint64(len(m.DefaultTargetMock.expectationSeries)) {\n\t\t\tm.t.Fatalf(\"Unexpected call to ParcelMock.DefaultTarget.\")\n\t\t\treturn\n\t\t}\n\n\t\tresult := m.DefaultTargetMock.expectationSeries[counter-1].result\n\t\tif result == nil {\n\t\t\tm.t.Fatal(\"No results are set for the ParcelMock.DefaultTarget\")\n\t\t\treturn\n\t\t}\n\n\t\tr = result.r\n\n\t\treturn\n\t}\n\n\tif m.DefaultTargetMock.mainExpectation != nil {\n\n\t\tresult := m.DefaultTargetMock.mainExpectation.result\n\t\tif result == nil {\n\t\t\tm.t.Fatal(\"No results are set for the ParcelMock.DefaultTarget\")\n\t\t}\n\n\t\tr = result.r\n\n\t\treturn\n\t}\n\n\tif m.DefaultTargetFunc == nil {\n\t\tm.t.Fatalf(\"Unexpected call to ParcelMock.DefaultTarget.\")\n\t\treturn\n\t}\n\n\treturn m.DefaultTargetFunc()\n}", "func (o MrScalarCoreScalingDownPolicyOutput) Target() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v MrScalarCoreScalingDownPolicy) *string { return v.Target }).(pulumi.StringPtrOutput)\n}", "func (o ObjectMetricSourcePtrOutput) Target() MetricTargetPtrOutput {\n\treturn o.ApplyT(func(v *ObjectMetricSource) *MetricTarget {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Target\n\t}).(MetricTargetPtrOutput)\n}", "func (obj *BiosVfSelectMemoryRasConfigurationRelationship) GetActualInstance() interface{} {\n\tif obj == nil {\n\t\treturn nil\n\t}\n\tif obj.BiosVfSelectMemoryRasConfiguration != nil {\n\t\treturn obj.BiosVfSelectMemoryRasConfiguration\n\t}\n\n\tif obj.MoMoRef != nil {\n\t\treturn obj.MoMoRef\n\t}\n\n\t// all schemas are nil\n\treturn nil\n}", "func (m *AppleEnrollmentProfileAssignment) GetTarget()(DeviceAndAppManagementAssignmentTargetable) {\n val, err := m.GetBackingStore().Get(\"target\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(DeviceAndAppManagementAssignmentTargetable)\n }\n return nil\n}", "func (o ObjectMetricSourceOutput) Target() MetricTargetOutput {\n\treturn o.ApplyT(func(v ObjectMetricSource) MetricTarget { return v.Target }).(MetricTargetOutput)\n}", "func NewTarget(labels, discoveredLabels labels.Labels, params url.Values) *Target {\n\treturn &Target{\n\t\tlabels: labels,\n\t\tdiscoveredLabels: discoveredLabels,\n\t\tparams: params,\n\t\thealth: HealthUnknown,\n\t}\n}", "func (a *Agent) updateTarget() error {\n\tif a.episodes%a.UpdateTargetEpisodes == 0 {\n\t\tlog.Infof(\"updating target model - current steps %v target update %v\", a.steps, a.updateTargetSteps)\n\t\terr := a.Policy.(*model.Sequential).CloneLearnablesTo(a.TargetPolicy.(*model.Sequential))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (o PodsMetricSourcePatchOutput) Target() MetricTargetPatchPtrOutput {\n\treturn o.ApplyT(func(v PodsMetricSourcePatch) *MetricTargetPatch { return v.Target }).(MetricTargetPatchPtrOutput)\n}", "func (obj *FruitReq) GetActualInstance() (interface{}) {\n\tif obj == nil {\n\t\treturn nil\n\t}\n\tif obj.AppleReq != nil {\n\t\treturn obj.AppleReq\n\t}\n\n\tif obj.BananaReq != nil {\n\t\treturn obj.BananaReq\n\t}\n\n\t// all schemas are nil\n\treturn nil\n}", "func (client BaseClient) GetFeatureInstanceResponder(resp *http.Response) (result FeatureInstance, 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}", "func (i *Installation) GetTargetID() int64 {\n\tif i == nil || i.TargetID == nil {\n\t\treturn 0\n\t}\n\treturn *i.TargetID\n}", "func (o ExternalMetricSourcePtrOutput) Target() MetricTargetPtrOutput {\n\treturn o.ApplyT(func(v *ExternalMetricSource) *MetricTarget {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Target\n\t}).(MetricTargetPtrOutput)\n}", "func (v *Vegeta) SetTarget(url, port string) {\n\tv.Targeter = vegeta.NewStaticTargeter(vegeta.Target{\n\t\tMethod: \"GET\",\n\t\tURL: url,\n\t})\n\n\tlogrus.Infof(\"target is registered: %s\", url)\n}", "func (c *TestClient) ListTargetInstances(project, zone string, opts ...ListCallOption) ([]*compute.TargetInstance, error) {\n\tif c.ListTargetInstancesFn != nil {\n\t\treturn c.ListTargetInstancesFn(project, zone, opts...)\n\t}\n\treturn c.client.ListTargetInstances(project, zone, opts...)\n}", "func (o ResourceMetricSourcePatchOutput) Target() MetricTargetPatchPtrOutput {\n\treturn o.ApplyT(func(v ResourceMetricSourcePatch) *MetricTargetPatch { return v.Target }).(MetricTargetPatchPtrOutput)\n}", "func (o PodsMetricSourceOutput) Target() MetricTargetOutput {\n\treturn o.ApplyT(func(v PodsMetricSource) MetricTarget { return v.Target }).(MetricTargetOutput)\n}", "func LocalTarget(httpClient util.HTTPClient, tlsOptions TLSOptions, retryInterval time.Duration) Target {\n\treturn &customTarget{\n\t\ttargetType: TargetLocal,\n\t\tbaseURL: \"http://127.0.0.1\",\n\t\thttpClient: httpClient,\n\t\ttlsOptions: tlsOptions,\n\t\tretryInterval: retryInterval,\n\t}\n}", "func NewTarget(dependencyMap map[string]*Dependencies, targetArg string, extendFlag bool) (target Target, err error) {\n\n\ttarget = Target{\n\t\tinitial: []string{},\n\t\tdependencies: []string{},\n\t}\n\n\tinitialTarget := cfg.ContainersForReference(targetArg)\n\tfor _, c := range initialTarget {\n\t\tif includes(allowed, c) {\n\t\t\ttarget.initial = append(target.initial, c)\n\t\t}\n\t}\n\n\tif extendFlag {\n\t\tvar (\n\t\t\tdependenciesSet = make(map[string]struct{})\n\t\t\tcascadingSeeds = []string{}\n\t\t)\n\t\t// start from the explicitly targeted target\n\t\tfor _, name := range target.initial {\n\t\t\tdependenciesSet[name] = struct{}{}\n\t\t\tcascadingSeeds = append(cascadingSeeds, name)\n\t\t}\n\n\t\t// Cascade until the dependency map has been fully traversed\n\t\t// according to the cascading flags.\n\t\tfor len(cascadingSeeds) > 0 {\n\t\t\tnextCascadingSeeds := []string{}\n\t\t\tfor _, seed := range cascadingSeeds {\n\t\t\t\tif dependencies, ok := dependencyMap[seed]; ok {\n\t\t\t\t\t// Queue direct dependencies if we haven't already considered them\n\t\t\t\t\tfor _, name := range dependencies.All {\n\t\t\t\t\t\tif _, alreadyIncluded := dependenciesSet[name]; !alreadyIncluded {\n\t\t\t\t\t\t\tdependenciesSet[name] = struct{}{}\n\t\t\t\t\t\t\tnextCascadingSeeds = append(nextCascadingSeeds, 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\tcascadingSeeds = nextCascadingSeeds\n\t\t}\n\n\t\tfor name := range dependenciesSet {\n\t\t\tif !includes(target.initial, name) {\n\t\t\t\ttarget.dependencies = append(target.dependencies, name)\n\t\t\t}\n\t\t}\n\n\t\tsort.Strings(target.dependencies)\n\t}\n\n\treturn\n}", "func (m *MockNamespaceKeeper) GetTarget(path string, blockNum ...uint64) (string, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{path}\n\tfor _, a := range blockNum {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"GetTarget\", varargs...)\n\tret0, _ := ret[0].(string)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (o PodsMetricSourcePtrOutput) Target() MetricTargetPtrOutput {\n\treturn o.ApplyT(func(v *PodsMetricSource) *MetricTarget {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Target\n\t}).(MetricTargetPtrOutput)\n}", "func NewTarget(ctx context.Context, envAcc pkgadapter.EnvConfigAccessor, ceClient cloudevents.Client) pkgadapter.Adapter {\n\tenv := envAcc.(*envAccessor)\n\tlogger := logging.FromContext(ctx)\n\tmetrics.MustRegisterEventProcessingStatsView()\n\n\tclient, err := mongo.Connect(ctx, options.Client().ApplyURI(env.ServerURL))\n\tif err != nil {\n\t\tlogger.Panicw(\"error connecting to mongodb\", zap.Error(err))\n\t\treturn nil\n\t}\n\n\treplier, err := targetce.New(env.Component, logger.Named(\"replier\"),\n\t\ttargetce.ReplierWithStatefulHeaders(env.BridgeIdentifier),\n\t\ttargetce.ReplierWithStaticResponseType(v1alpha1.EventTypeMongoDBStaticResponse),\n\t\ttargetce.ReplierWithPayloadPolicy(targetce.PayloadPolicy(env.CloudEventPayloadPolicy)))\n\tif err != nil {\n\t\tlogger.Panicf(\"Error creating CloudEvents replier: %v\", err)\n\t}\n\n\tmt := &pkgadapter.MetricTag{\n\t\tResourceGroup: targets.MongoDBTargetResource.String(),\n\t\tNamespace: envAcc.GetNamespace(),\n\t\tName: envAcc.GetName(),\n\t}\n\n\treturn &adapter{\n\t\tmclient: client,\n\t\tdefaultDatabase: env.DefaultDatabase,\n\t\tdefaultCollection: env.DefaultCollection,\n\n\t\treplier: replier,\n\t\tceClient: ceClient,\n\t\tlogger: logger,\n\t\tsr: metrics.MustNewEventProcessingStatsReporter(mt),\n\t}\n}", "func (vm *VirtualMachine) handleInstance(quad quads.Quad) {\n\tif strings.Contains(quad.Left.ID(), \"self_\") {\n\t\tstrElements := strings.Split(quad.Left.ID(), \"_\")\n\t\tif len(strElements) < 2 {\n\t\t\tlog.Fatalf(\"Error: (handleInstance) unexpected element id structure\")\n\t\t}\n\t\tobjInstanceAddr, err := strconv.Atoi(strElements[1])\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Error: (handleInstance) couldn't cast objInstanceAddr to int\")\n\t\t}\n\t\tif objInstanceAddr == -1 {\n\t\t\treturn\n\t\t}\n\t}\n\n\tmemblock := vm.getMemBlockForAddr(quad.Left.GetAddr())\n\tvar ok bool\n\tvm.currentSelf, ok = memblock.Get(quad.Left.GetAddr()).(Memory)\n\tif !ok {\n\t\tlog.Fatalf(\n\t\t\t\"Error: (Run) quads.INSTANCE couldn't cast %v to Memory\",\n\t\t\tmemblock.Get(quad.Left.GetAddr()),\n\t\t)\n\t}\n}", "func (o ContainerResourceMetricSourcePatchOutput) Target() MetricTargetPatchPtrOutput {\n\treturn o.ApplyT(func(v ContainerResourceMetricSourcePatch) *MetricTargetPatch { return v.Target }).(MetricTargetPatchPtrOutput)\n}", "func (o ObjectMetricSourcePatchPtrOutput) Target() MetricTargetPatchPtrOutput {\n\treturn o.ApplyT(func(v *ObjectMetricSourcePatch) *MetricTargetPatch {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Target\n\t}).(MetricTargetPatchPtrOutput)\n}", "func (o *SLOOverallStatuses) GetTarget() float64 {\n\tif o == nil || o.Target == nil {\n\t\tvar ret float64\n\t\treturn ret\n\t}\n\treturn *o.Target\n}", "func (obj *ResourcepoolLeaseResponse) GetActualInstance() interface{} {\n\tif obj == nil {\n\t\treturn nil\n\t}\n\tif obj.MoAggregateTransform != nil {\n\t\treturn obj.MoAggregateTransform\n\t}\n\n\tif obj.MoDocumentCount != nil {\n\t\treturn obj.MoDocumentCount\n\t}\n\n\tif obj.MoTagSummary != nil {\n\t\treturn obj.MoTagSummary\n\t}\n\n\tif obj.ResourcepoolLeaseList != nil {\n\t\treturn obj.ResourcepoolLeaseList\n\t}\n\n\t// all schemas are nil\n\treturn nil\n}", "func (self *Tween) SetTargetA(member interface{}) {\n self.Object.Set(\"target\", member)\n}", "func (obj *HyperflexExtFcStoragePolicyRelationship) GetActualInstance() interface{} {\n\tif obj == nil {\n\t\treturn nil\n\t}\n\tif obj.HyperflexExtFcStoragePolicy != nil {\n\t\treturn obj.HyperflexExtFcStoragePolicy\n\t}\n\n\tif obj.MoMoRef != nil {\n\t\treturn obj.MoMoRef\n\t}\n\n\t// all schemas are nil\n\treturn nil\n}", "func (_this *IntersectionObserverEntry) Target() *dom.Element {\n\tvar ret *dom.Element\n\tvalue := _this.Value_JS.Get(\"target\")\n\tret = dom.ElementFromJS(value)\n\treturn ret\n}", "func (p *ProxMox) CreateInstance(ctx *lepton.Context) error {\n\n\tvar err error\n\n\tconfig := ctx.Config()\n\n\tnextid := p.getNextID()\n\n\tp.instanceName = config.RunConfig.InstanceName\n\n\tp.isoStorageName = config.TargetConfig[\"IsoStorageName\"]\n\n\tp.imageName = config.CloudConfig.ImageName\n\n\tp.arch = \"x86_64\"\n\tif config.TargetConfig[\"Arch\"] != \"\" {\n\t\tp.arch = config.TargetConfig[\"Arch\"]\n\t}\n\n\tp.machine = \"q35\"\n\tif config.TargetConfig[\"Machine\"] != \"\" {\n\t\tp.machine = config.TargetConfig[\"Machine\"]\n\t}\n\n\tp.sockets = \"1\"\n\tif config.TargetConfig[\"Sockets\"] != \"\" {\n\t\tsocketsInt, err := strconv.Atoi(config.TargetConfig[\"Sockets\"])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif socketsInt < 1 {\n\t\t\treturn errors.New(\"Bad configuration option; Sockets can only be set postitive starting from \\\"1\\\"\")\n\t\t}\n\t\tp.sockets = config.TargetConfig[\"Sockets\"]\n\t}\n\n\tp.cores = \"1\"\n\tif config.TargetConfig[\"Cores\"] != \"\" {\n\t\tcoresInt, err := strconv.Atoi(config.TargetConfig[\"Cores\"])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif coresInt < 1 {\n\t\t\treturn errors.New(\"Bad configuration option; Cores can only be set postitive starting from \\\"1\\\"\")\n\t\t}\n\t\tp.cores = config.TargetConfig[\"Cores\"]\n\t}\n\n\tp.numa = \"0\"\n\tif config.TargetConfig[\"Numa\"] != \"\" {\n\t\tif config.TargetConfig[\"Numa\"] != \"0\" && config.TargetConfig[\"Numa\"] != \"1\" {\n\t\t\treturn errors.New(\"Bad configuration option; Numa can only be set to \\\"0\\\" or \\\"1\\\"\")\n\t\t}\n\t\tp.numa = config.TargetConfig[\"Numa\"]\n\t}\n\n\t// Memory\n\n\tp.memory = \"512\"\n\tif config.TargetConfig[\"Memory\"] != \"\" {\n\t\tmemoryInt, err := lepton.RAMInBytes(config.TargetConfig[\"Memory\"])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tmemoryInt = memoryInt / 1024 / 1024\n\t\tp.memory = strconv.FormatInt(memoryInt, 10)\n\t}\n\n\t// Main storage\n\n\tp.storageName = \"local-lvm\"\n\tif config.TargetConfig[\"StorageName\"] != \"\" {\n\t\tp.storageName = config.TargetConfig[\"StorageName\"]\n\t}\n\n\t// Iso storage\n\n\tp.isoStorageName = \"local\"\n\tif config.TargetConfig[\"IsoStorageName\"] != \"\" {\n\t\tp.isoStorageName = config.TargetConfig[\"IsoStorageName\"]\n\t}\n\n\t// Bridge prefix\n\n\tp.bridgePrefix = \"vmbr\"\n\tif config.TargetConfig[\"BridgePrefix\"] != \"\" {\n\t\tp.bridgePrefix = config.TargetConfig[\"BridgePrefix\"]\n\t}\n\n\t// Onboot\n\n\tp.onboot = \"0\"\n\tif config.TargetConfig[\"Onboot\"] != \"\" {\n\t\tif config.TargetConfig[\"Onboot\"] != \"0\" && config.TargetConfig[\"Onboot\"] != \"1\" {\n\t\t\treturn errors.New(\"Bad configuration option; Onboot can only be set to \\\"0\\\" or \\\"1\\\"\")\n\t\t}\n\t\tp.onboot = config.TargetConfig[\"Onboot\"]\n\t}\n\n\t// Protection\n\n\tp.protection = \"0\"\n\tif config.TargetConfig[\"Protection\"] != \"\" {\n\t\tif config.TargetConfig[\"Protection\"] != \"0\" && config.TargetConfig[\"Protection\"] != \"1\" {\n\t\t\treturn errors.New(\"Bad configuration option; Protection can only be set to \\\"0\\\" or \\\"1\\\"\")\n\t\t}\n\t\tp.protection = config.TargetConfig[\"Protection\"]\n\t}\n\n\t// These two preventive checks here, because Proxmox will not return\n\t// an error if the storage is missing and a misconfigured instance will be created.\n\n\terr = p.CheckStorage(p.storageName, \"images\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = p.CheckStorage(p.isoStorageName, \"iso\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdata := url.Values{}\n\tdata.Set(\"vmid\", nextid)\n\tdata.Set(\"name\", p.instanceName)\n\tdata.Set(\"name\", p.imageName)\n\tdata.Set(\"machine\", p.machine)\n\tdata.Set(\"sockets\", p.sockets)\n\tdata.Set(\"cores\", p.cores)\n\tdata.Set(\"numa\", p.numa)\n\tdata.Set(\"memory\", p.memory)\n\tdata.Set(\"onboot\", p.onboot)\n\tdata.Set(\"protection\", p.protection)\n\tdata.Set(\"serial0\", \"socket\")\n\n\t// Configuring network interfaces\n\n\tnics := config.RunConfig.Nics\n\tfor i := 0; i < len(nics); i++ {\n\t\tis := strconv.Itoa(i)\n\t\tbrName := nics[i].BridgeName\n\t\tif brName == \"\" {\n\t\t\tbrName = p.bridgePrefix + is\n\t\t}\n\n\t\terr = p.CheckBridge(brName)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif nics[i].IPAddress != \"\" {\n\t\t\tcidr := \"24\"\n\n\t\t\tif nics[i].NetMask != \"\" {\n\t\t\t\tcidrInt := lepton.CCidr(nics[i].NetMask)\n\t\t\t\tcidr = strconv.FormatInt(int64(cidrInt), 10)\n\t\t\t}\n\n\t\t\tif nics[i].Gateway != \"\" {\n\t\t\t\tdata.Set(\"ipconfig\"+is, \"ip=\"+nics[i].IPAddress+\"/\"+cidr+\",\"+\"gw=\"+nics[i].Gateway)\n\t\t\t} else {\n\t\t\t\tdata.Set(\"ipconfig\"+is, \"ip=\"+nics[i].IPAddress+\"/\"+cidr)\n\t\t\t}\n\t\t} else {\n\t\t\tdata.Set(\"ipconfig\"+is, \"dhcp\")\n\t\t}\n\n\t\tdata.Set(\"net\"+is, \"model=virtio,bridge=\"+brName)\n\t}\n\tif len(nics) == 0 {\n\t\t// single dhcp nic\n\t\tdata.Set(\"net0\", \"model=virtio,bridge=vmbr0\")\n\t}\n\n\treq, err := http.NewRequest(\"POST\", p.apiURL+\"/api2/json/nodes/\"+p.nodeNAME+\"/qemu\", bytes.NewBufferString(data.Encode()))\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn err\n\t}\n\n\ttr := &http.Transport{\n\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: true},\n\t}\n\tclient := &http.Client{Transport: tr}\n\n\treq.Header.Add(\"Authorization\", \"PVEAPIToken=\"+p.tokenID+\"=\"+p.secret)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\tbody, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn err\n\t}\n\n\tdebug := false\n\tif debug {\n\t\tfmt.Println(string(body))\n\t}\n\n\terr = p.CheckResultType(body, \"createinstance\", \"file=\"+p.isoStorageName+\":iso/\"+p.imageName+\".iso\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = p.addVirtioDisk(ctx, nextid)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = p.movDisk(ctx, nextid)\n\n\treturn err\n}", "func (obj *UiNodeInputAttributesValue) GetActualInstance() interface{} {\n\tif obj == nil {\n\t\treturn nil\n\t}\n\tif obj.Bool != nil {\n\t\treturn obj.Bool\n\t}\n\n\tif obj.Float32 != nil {\n\t\treturn obj.Float32\n\t}\n\n\tif obj.String != nil {\n\t\treturn obj.String\n\t}\n\n\t// all schemas are nil\n\treturn nil\n}", "func (pa *PodAutoscaler) Target() (float64, bool) {\n\treturn pa.annotationFloat64(autoscaling.TargetAnnotation)\n}", "func (s *inMemoryStore) findTarget(ctx context.Context, m *metricData) types.Target {\n\tdt := s.DefaultTarget()\n\n\t/* If the type of the metric is NilType or the type of the default target,\n\t then this function returns the target, in the context, matched with\n\t the type of the default target.\n\n\t If there is no target found in the context matched with the type, then\n\t nil will be returned, and therefore, the target of newly added cells\n\t will be determined at the time of store.GetAll() being invoked.\n\n\t e.g.,\n\t // create different targets.\n\t target1, target2, target3 := target.Task(...), ....\n\t metric := NewInt(...)\n\n\t // Set the default target with target1.\n\t store.SetDefaultTarget(target1)\n\t // This creates a new cell with Nil target. It means that the target of\n\t // the new cell has not been determined yet. In other words,\n\t // SetDefaultTarget() doesn't always guarantee that all the new cells\n\t // created after the SetDefaultTarget() invocation will have the target.\n\t metric.Set(ctx, 42)\n\n\t // Create a target context with target2.\n\t tctx := target.Set(target2)\n\t // This creates a new cell with target2.\n\t metric.Incr(tctx, 43)\n\n\t // Set the default target with target3.\n\t SetDefaultTarget(target3)\n\n\t // This will return cells with the following elements.\n\t // - value(42), target(target3)\n\t // - value(43), target(target2)\n\t cells := store.GetAll()\n\t*/\n\tif m.TargetType == target.NilType || m.TargetType == dt.Type() {\n\t\treturn target.Get(ctx, dt.Type())\n\t}\n\n\tct := target.Get(ctx, m.TargetType)\n\tif ct != nil {\n\t\treturn ct\n\t}\n\tpanic(fmt.Sprintf(\n\t\t\"Missing target for Metric %s with TargetType %s\", m.Name, m.TargetType,\n\t))\n}", "func (agent *Agent) GetTargetDiff() float64 {\n\tagent.rwLock.RLock()\n\tdefer agent.rwLock.RUnlock()\n\treturn agent.targetDiff\n}", "func (f *Function) M__get__(instance, owner Object) (Object, error) {\n\tif instance != None {\n\t\treturn NewBoundMethod(instance, f), nil\n\t}\n\treturn f, nil\n}", "func (o ExternalMetricSourcePatchPtrOutput) Target() MetricTargetPatchPtrOutput {\n\treturn o.ApplyT(func(v *ExternalMetricSourcePatch) *MetricTargetPatch {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Target\n\t}).(MetricTargetPatchPtrOutput)\n}", "func (m *mParcelMockDefaultTarget) Set(f func() (r *insolar.Reference)) *ParcelMock {\n\tm.mainExpectation = nil\n\tm.expectationSeries = nil\n\n\tm.mock.DefaultTargetFunc = f\n\treturn m.mock\n}" ]
[ "0.58808714", "0.5825279", "0.5654581", "0.561792", "0.546661", "0.5392027", "0.5309794", "0.5285038", "0.5279521", "0.52200294", "0.51946527", "0.51843244", "0.51598144", "0.5158895", "0.5124791", "0.5091612", "0.5088242", "0.5072494", "0.50699806", "0.50631136", "0.50582945", "0.50291306", "0.50270635", "0.5002632", "0.49909055", "0.49843806", "0.49668947", "0.49621806", "0.49483678", "0.49466023", "0.49456978", "0.49347576", "0.49202353", "0.49101177", "0.4908158", "0.49015433", "0.48844168", "0.48833668", "0.4879753", "0.48635876", "0.48623595", "0.48583847", "0.48508683", "0.48377445", "0.48218665", "0.48020303", "0.47969753", "0.4788667", "0.47801483", "0.47756904", "0.47566113", "0.47433558", "0.47433266", "0.47311562", "0.47287545", "0.47268164", "0.47242752", "0.4724258", "0.4719479", "0.4718761", "0.47139737", "0.47026962", "0.47015756", "0.46983832", "0.46946153", "0.4685764", "0.4680726", "0.46806777", "0.46800783", "0.46758488", "0.46628588", "0.4651985", "0.4651352", "0.46456906", "0.46383935", "0.46247935", "0.46241596", "0.46229878", "0.46156394", "0.46035844", "0.4601266", "0.45935592", "0.4586822", "0.45832863", "0.45796683", "0.4578114", "0.45589304", "0.45588532", "0.455635", "0.45555678", "0.45538715", "0.4552879", "0.4543288", "0.4540883", "0.4538624", "0.45295706", "0.45275557", "0.45256248", "0.45226973", "0.45133412" ]
0.7121169
0
ListTargetInstances uses the override method ListTargetInstancesFn or the real implementation.
func (c *TestClient) ListTargetInstances(project, zone string, opts ...ListCallOption) ([]*compute.TargetInstance, error) { if c.ListTargetInstancesFn != nil { return c.ListTargetInstancesFn(project, zone, opts...) } return c.client.ListTargetInstances(project, zone, opts...) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *TestClient) ListInstances(project, zone string, opts ...ListCallOption) ([]*compute.Instance, error) {\n\tif c.ListInstancesFn != nil {\n\t\treturn c.ListInstancesFn(project, zone, opts...)\n\t}\n\treturn c.client.ListInstances(project, zone, opts...)\n}", "func (s *targetLister) List(selector labels.Selector) (ret []*v1alpha1.Target, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.Target))\n\t})\n\treturn ret, err\n}", "func (o *ListInstancesParams) WithTimeout(timeout time.Duration) *ListInstancesParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "func (c *Client) ListInstances(args *ListInstancesArgs) (*ListInstancesResult, error) {\n\treturn ListInstances(c, args)\n}", "func (p *ProxMox) ListInstances(ctx *lepton.Context) error {\n\n\treq, err := http.NewRequest(\"GET\", p.apiURL+\"/api2/json/nodes/\"+p.nodeNAME+\"/qemu\", nil)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn err\n\t}\n\n\ttr := &http.Transport{\n\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: true},\n\t}\n\tclient := &http.Client{Transport: tr}\n\n\treq.Header.Add(\"Authorization\", \"PVEAPIToken=\"+p.tokenID+\"=\"+p.secret)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\tbody, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn err\n\t}\n\n\tir := &InstanceResponse{}\n\tjson.Unmarshal([]byte(body), ir)\n\n\ttable := tablewriter.NewWriter(os.Stdout)\n\ttable.SetHeader([]string{\"ID\", \"Name\", \"MainIP\", \"Status\", \"ImageID\"})\n\ttable.SetHeaderColor(\n\t\ttablewriter.Colors{tablewriter.Bold, tablewriter.FgCyanColor},\n\t\ttablewriter.Colors{tablewriter.Bold, tablewriter.FgCyanColor},\n\t\ttablewriter.Colors{tablewriter.Bold, tablewriter.FgCyanColor},\n\t\ttablewriter.Colors{tablewriter.Bold, tablewriter.FgCyanColor},\n\t\ttablewriter.Colors{tablewriter.Bold, tablewriter.FgCyanColor})\n\ttable.SetRowLine(true)\n\n\tfor _, instance := range ir.Data {\n\t\tvar row []string\n\t\trow = append(row, strconv.Itoa(instance.VMID))\n\t\trow = append(row, instance.Name)\n\t\trow = append(row, \"\")\n\t\trow = append(row, instance.Status)\n\t\trow = append(row, \"\")\n\t\ttable.Append(row)\n\t}\n\n\ttable.Render()\n\n\treturn nil\n}", "func (o TargetPoolOutput) Instances() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *TargetPool) pulumi.StringArrayOutput { return v.Instances }).(pulumi.StringArrayOutput)\n}", "func (c Client) ListInstances() ([]models.Instance, error) {\n\tvar instances []models.Instance\n\tresp, err := c.get(\"/instances\")\n\tif err != nil {\n\t\treturn instances, err\n\t}\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn instances, parseError(resp.Body)\n\t}\n\n\tmaybeInstances, err := jsonapi.UnmarshalManyPayload(resp.Body, reflect.TypeOf(instances))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Convert from []interface{} to []Instance\n\tinstances = make([]models.Instance, 0)\n\tfor _, instance := range maybeInstances {\n\t\ti := instance.(*models.Instance)\n\t\tinstances = append(instances, *i)\n\t}\n\n\treturn instances, nil\n}", "func (client *serviceManagerClient) ListInstances(q *Parameters) (*types.ServiceInstances, error) {\n\tinstances := &types.ServiceInstances{}\n\terr := client.list(&instances.ServiceInstances, web.ServiceInstancesURL, q)\n\n\treturn instances, err\n}", "func (i *InstanceServiceHandler) List(ctx context.Context, options *ListOptions) ([]Instance, *Meta, error) {\n\treq, err := i.client.NewRequest(ctx, http.MethodGet, instancePath, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tnewValues, err := query.Values(options)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treq.URL.RawQuery = newValues.Encode()\n\n\tinstances := new(instancesBase)\n\tif err = i.client.DoWithContext(ctx, req, instances); err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn instances.Instances, instances.Meta, nil\n}", "func (i *IAM) ListInstances(kt *kit.Kit, resType client.TypeID, filter *types.ListInstanceFilter,\n\tpage types.Page) (*types.ListInstanceResult, error) {\n\n\tbizID, pbFilter, err := filter.GetBizIDAndPbFilter()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcountReq := &pbds.ListInstancesReq{\n\t\tBizId: bizID,\n\t\tResourceType: string(resType),\n\t\tFilter: pbFilter,\n\t\tPage: &pbbase.BasePage{Count: true},\n\t}\n\tcountResp, err := i.ds.ListInstances(kt.RpcCtx(), countReq)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq := &pbds.ListInstancesReq{\n\t\tBizId: bizID,\n\t\tResourceType: string(resType),\n\t\tFilter: pbFilter,\n\t\tPage: page.PbPage(),\n\t}\n\tresp, err := i.ds.ListInstances(kt.RpcCtx(), req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tinstances := make([]types.InstanceResource, 0)\n\tfor _, one := range resp.Details {\n\t\tinstances = append(instances, types.InstanceResource{\n\t\t\tID: types.InstanceID{\n\t\t\t\tBizID: bizID,\n\t\t\t\tInstanceID: one.Id,\n\t\t\t},\n\t\t\tDisplayName: one.Name,\n\t\t})\n\t}\n\n\tresult := &types.ListInstanceResult{\n\t\tCount: countResp.Count,\n\t\tResults: instances,\n\t}\n\treturn result, nil\n}", "func (c *FakeAWSSNSTargets) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.AWSSNSTargetList, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewListAction(awssnstargetsResource, awssnstargetsKind, c.ns, opts), &v1alpha1.AWSSNSTargetList{})\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.AWSSNSTargetList{ListMeta: obj.(*v1alpha1.AWSSNSTargetList).ListMeta}\n\tfor _, item := range obj.(*v1alpha1.AWSSNSTargetList).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 (adm Admin) ListInstances(cluster string) (string, error) {\n\t// make sure the cluster is already setup\n\tif ok, err := adm.isClusterSetup(cluster); !ok || err != nil {\n\t\treturn \"\", ErrClusterNotSetup\n\t}\n\n\tbuilder := KeyBuilder{cluster}\n\tisPath := builder.instances()\n\tinstances, err := adm.zkClient.Children(isPath)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tvar buffer bytes.Buffer\n\tbuffer.WriteString(fmt.Sprintf(\"Existing instances in cluster %s:\\n\", cluster))\n\n\tfor _, r := range instances {\n\t\tbuffer.WriteString(\" \" + r + \"\\n\")\n\t}\n\n\treturn buffer.String(), nil\n}", "func (i *Instances) List(filter string) ([]string, error) {\n\tctx, cancel := context.WithCancel(context.Background())\n\tdefer cancel()\n\tc, err := vsphereLogin(i.cfg, ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer c.Logout(ctx)\n\n\tvmList, err := getInstances(i.cfg, ctx, c, filter)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tglog.V(3).Infof(\"Found %s instances matching %s: %s\",\n\t\tlen(vmList), filter, vmList)\n\n\treturn vmList, nil\n}", "func (c *TestClient) AggregatedListInstances(project string, opts ...ListCallOption) ([]*compute.Instance, error) {\n\tif c.AggregatedListInstancesFn != nil {\n\t\treturn c.AggregatedListInstancesFn(project, opts...)\n\t}\n\treturn c.client.AggregatedListInstances(project, opts...)\n}", "func GetInstances(albc aws.ALBAPI, arn *string, instances []string) (aws.Instances, error) {\n\thealthOutput, err := albc.DescribeTargetHealth(createDescribeTargetHealthInput(arn, instances))\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttgInstances := aws.Instances{}\n\tfor _, thd := range healthOutput.TargetHealthDescriptions {\n\t\ttgInstances.AddTargetGroupInstance(thd)\n\t}\n\n\treturn tgInstances, nil\n}", "func (instanceAPIs ContainerInstanceAPIs) ListInstances(w http.ResponseWriter, r *http.Request) {\n\tquery := r.URL.Query()\n\n\tif instanceAPIs.hasUnsupportedFilters(query) {\n\t\thttp.Error(w, unsupportedFilterClientErrMsg, http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tif instanceAPIs.hasRedundantFilters(query) {\n\t\thttp.Error(w, redundantFilterClientErrMsg, http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tstatus := strings.ToLower(query.Get(instanceStatusFilter))\n\tcluster := query.Get(instanceClusterFilter)\n\n\tif status != \"\" {\n\t\tif !instanceAPIs.isValidStatus(status) {\n\t\t\thttp.Error(w, invalidStatusClientErrMsg, http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t}\n\n\tif cluster != \"\" {\n\t\tif !regex.IsClusterARN(cluster) && !regex.IsClusterName(cluster) {\n\t\t\thttp.Error(w, invalidClusterClientErrMsg, http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t}\n\n\tvar instances []storetypes.VersionedContainerInstance\n\tvar err error\n\tswitch {\n\tcase status != \"\" && cluster != \"\":\n\t\tfilters := map[string]string{instanceStatusFilter: status, instanceClusterFilter: cluster}\n\t\tinstances, err = instanceAPIs.instanceStore.FilterContainerInstances(filters)\n\tcase status != \"\":\n\t\tfilters := map[string]string{instanceStatusFilter: status}\n\t\tinstances, err = instanceAPIs.instanceStore.FilterContainerInstances(filters)\n\tcase cluster != \"\":\n\t\tfilters := map[string]string{instanceClusterFilter: cluster}\n\t\tinstances, err = instanceAPIs.instanceStore.FilterContainerInstances(filters)\n\tdefault:\n\t\tinstances, err = instanceAPIs.instanceStore.ListContainerInstances()\n\t}\n\n\tif err != nil {\n\t\thttp.Error(w, internalServerErrMsg, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.Header().Set(contentTypeKey, contentTypeJSON)\n\tw.WriteHeader(http.StatusOK)\n\n\textInstanceItems := make([]*models.ContainerInstance, len(instances))\n\tfor i := range instances {\n\t\tins, err := ToContainerInstance(instances[i])\n\t\tif err != nil {\n\t\t\thttp.Error(w, internalServerErrMsg, http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\textInstanceItems[i] = &ins\n\t}\n\n\textInstances := models.ContainerInstances{\n\t\tItems: extInstanceItems,\n\t}\n\n\terr = json.NewEncoder(w).Encode(extInstances)\n\tif err != nil {\n\t\thttp.Error(w, encodingServerErrMsg, http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "func (s *googleCloudStorageTargetLister) List(selector labels.Selector) (ret []*v1alpha1.GoogleCloudStorageTarget, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.GoogleCloudStorageTarget))\n\t})\n\treturn ret, err\n}", "func (ec2Mgr *ec2InstanceManager) ListInstances(instanceIds ...string) ([]common.Instance, error) {\n\tec2InputParameters := &ec2.DescribeInstancesInput{\n\t\tInstanceIds: aws.StringSlice(instanceIds),\n\t}\n\n\tvar instances []common.Instance\n\tec2Mgr.ec2API.DescribeInstancesPages(ec2InputParameters, func(page *ec2.DescribeInstancesOutput, lastPage bool) bool {\n\t\tfor _, reservation := range page.Reservations {\n\t\t\tfor _, instance := range reservation.Instances {\n\t\t\t\tinstances = append(instances, instance)\n\t\t\t}\n\t\t}\n\t\treturn true\n\t})\n\n\treturn instances, nil\n}", "func (c *Client) ListInstances(options *InstancesParameters) ([]Instance, *bmc.Error) {\n\tinstances := []Instance{}\n\tqueryString := url.QueryEscape(c.CompartmentID)\n\tif options != nil {\n\t\tv, _ := query.Values(*options)\n\t\tqueryString = queryString + \"&\" + v.Encode()\n\t}\n\tresp, err := c.Request(\"GET\", fmt.Sprintf(\"/instances?compartmentId=%s\", queryString), nil)\n\tif err != nil {\n\t\tlogrus.Error(err)\n\t\tbmcError := bmc.Error{Code: string(resp.StatusCode), Message: err.Error()}\n\t\treturn instances, &bmcError\n\t}\n\tlogrus.Debug(\"StatusCode: \", resp.StatusCode)\n\tif resp.StatusCode != 200 {\n\t\treturn instances, bmc.NewError(*resp)\n\t}\n\tdefer resp.Body.Close()\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tlogrus.Fatalf(\"Could not read JSON response: %s\", err)\n\t}\n\n\tif err = json.Unmarshal(body, &instances); err != nil {\n\t\tlogrus.Fatalf(\"Unmarshal impossible: %s\", err)\n\t}\n\tif options.Filter != nil {\n\t\tinstances = filterInstances(instances, *options.Filter)\n\t}\n\treturn instances, nil\n}", "func TestListInstances(t *testing.T) {\n\tinstances := []*aws.Instance{\n\t\t{\n\t\t\tHostname: \"testHostname1\",\n\t\t\tIPAddress: \"10.10.10.1\",\n\t\t\tID: \"i-xxxxxxxxxxxxxxxx1\",\n\t\t\tPrivateDNSName: \"test1.local\",\n\t\t\tName: \"testNode1\",\n\t\t\tOSName: \"Amazon Linux\",\n\t\t\tOSType: \"Linux\",\n\t\t\tOSVersion: \"2\",\n\t\t},\n\t\t{\n\t\t\tHostname: \"testHostname2\",\n\t\t\tIPAddress: \"10.10.10.2\",\n\t\t\tID: \"i-xxxxxxxxxxxxxxxx2\",\n\t\t\tPrivateDNSName: \"test2.local\",\n\t\t\tName: \"testNode2\",\n\t\t\tOSName: \"Ubuntu\",\n\t\t\tOSType: \"Linux\",\n\t\t\tOSVersion: \"18.04\",\n\t\t},\n\t}\n\tinteractive := false\n\tformat := FormatText\n\tinput := StartInput{\n\t\tOutputFormat: &format,\n\t\tInteractive: &interactive,\n\t}\n\n\tctrl := gomock.NewController(t)\n\tdefer ctrl.Finish()\n\tm := NewMockCloudInstances(ctrl) // skipcq: SCC-compile\n\n\tm.EXPECT().ListInstances().Return(instances, nil)\n\n\tassert.NoError(t, input.listInstances(m))\n\t// TODO test integractive part\n}", "func (nlbHandler *GCPNLBHandler) listTargetPools(regionID string, filter string) (*compute.TargetPoolList, error) {\n\n\t// path param\n\tprojectID := nlbHandler.Credential.ProjectID\n\n\tresp, err := nlbHandler.Client.TargetPools.List(projectID, regionID).Do()\n\tif err != nil {\n\t\treturn &compute.TargetPoolList{}, err\n\t}\n\n\tfor _, item := range resp.Items {\n\t\tcblogger.Info(item)\n\t}\n\n\treturn resp, nil\n\n}", "func (adm Admin) ListInstances(cluster string) (string, error) {\n\tconn := newConnection(adm.ZkSvr)\n\terr := conn.Connect()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer conn.Disconnect()\n\n\t// make sure the cluster is already setup\n\tif ok, err := conn.IsClusterSetup(cluster); !ok || err != nil {\n\t\treturn \"\", ErrClusterNotSetup\n\t}\n\n\tkeys := KeyBuilder{cluster}\n\tisPath := keys.instances()\n\tinstances, err := conn.Children(isPath)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tvar buffer bytes.Buffer\n\tbuffer.WriteString(fmt.Sprintf(\"Existing instances in cluster %s:\\n\", cluster))\n\n\tfor _, r := range instances {\n\t\tbuffer.WriteString(\" \" + r + \"\\n\")\n\t}\n\n\treturn buffer.String(), nil\n}", "func (o *ClusterUninstaller) listCloudControllerTargetPools(ctx context.Context, instances []cloudResource) ([]cloudResource, error) {\n\tfilter := \"name eq \\\"a[0-9a-f]{30,50}\\\"\"\n\treturn o.listTargetPoolsWithFilter(ctx, \"items(name,instances),nextPageToken\", filter, func(pool *compute.TargetPool) bool {\n\t\tif len(pool.Instances) == 0 {\n\t\t\treturn false\n\t\t}\n\t\tfor _, instanceURL := range pool.Instances {\n\t\t\tname, _ := o.getInstanceNameAndZone(instanceURL)\n\t\t\tif !o.isClusterResource(name) {\n\t\t\t\tfoundClusterResource := false\n\t\t\t\tfor _, instance := range instances {\n\t\t\t\t\tif instance.name == name {\n\t\t\t\t\t\tfoundClusterResource = true\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif !foundClusterResource {\n\t\t\t\t\to.Logger.Debugf(\"Invalid instance %s in target pool %s, target pool will not be destroyed\", name, pool.Name)\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn true\n\t})\n}", "func (s *targetLister) Targets(namespace string) TargetNamespaceLister {\n\treturn targetNamespaceLister{indexer: s.indexer, namespace: namespace}\n}", "func (c *Client) ListInstances(clusterID string) ([]CceInstance, error) {\n\tif clusterID == \"\" {\n\t\treturn nil, fmt.Errorf(\"clusterID should not be nil\")\n\t}\n\tparams := map[string]string{\n\t\t\"clusterid\": clusterID,\n\t}\n\treq, err := bce.NewRequest(\"GET\", c.GetURL(\"/v1/instance\", params), nil)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp, err := c.SendRequest(req, nil)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbodyContent, err := resp.GetBodyContent()\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar insList ListInstancesResponse\n\terr = json.Unmarshal(bodyContent, &insList)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn insList.Instances, nil\n}", "func (l *LoadBalancer) GetInstances() []string {\n\tl.hostLock.Lock()\n\tdefer l.hostLock.Unlock()\n\tretVal := make([]string, len(l.hosts))\n\tcopy(retVal, l.hosts)\n\treturn retVal\n}", "func (t *Target) List(verbose bool, nameWidth int) {\n\tif !verbose {\n\t\tif strings.HasPrefix(t.Name, \"_\") {\n\t\t\t// skip targets in non verbose mode as hidden.\n\t\t\treturn\n\t\t}\n\t\tpadWidth := nameWidth - len(t.Name)\n\t\tpaddedName := color.Yellow(t.Name)\n\t\tif padWidth > 0 {\n\t\t\tpaddedName += strings.Repeat(\" \", padWidth)\n\t\t}\n\t\tout := fmt.Sprintf(\"%s %s\\n\", paddedName, strings.TrimSpace(t.Description))\n\t\t_, err := t.W.Write([]byte(out))\n\t\tif err != nil {\n\t\t\tlog.Println(color.Red(err.Error()))\n\t\t}\n\t\treturn\n\t}\n\n\t// target name\n\tout := fmt.Sprintf(\"%s: \\n\", color.Yellow(t.Name))\n\n\t// target description\n\tif t.Description != \"\" {\n\t\tout += fmt.Sprintf(\" - description: %s\\n\", strings.TrimSpace(t.Description))\n\t}\n\n\t// target before\n\tif len(t.Before) > 0 {\n\t\tbeforeList := \" - before: \" + strings.Join(t.Before, \", \")\n\t\tout += fmt.Sprintln(beforeList)\n\t}\n\n\t// target after\n\tif len(t.After) > 0 {\n\t\tafterList := \" - after: \" + strings.Join(t.After, \", \")\n\t\tout += fmt.Sprintln(afterList)\n\t}\n\n\t// target command\n\tout += fmt.Sprintf(\" - cmd:\\n \")\n\tout += fmt.Sprintln(strings.Replace(t.Cmd, \"\\n\", \"\\n \", -1))\n\t_, err := t.W.Write([]byte(out))\n\tif err != nil {\n\t\tlog.Println(color.Red(err.Error()))\n\t}\n}", "func (client BaseClient) GetFeatureInstancesResponder(resp *http.Response) (result ListFeatureInstance, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result.Value),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "func getInstanceList(nodeNames sets.String) *compute.InstanceGroupsListInstances {\n\tinstanceNames := nodeNames.List()\n\tcomputeInstances := []*compute.InstanceWithNamedPorts{}\n\tfor _, name := range instanceNames {\n\t\tinstanceLink := getInstanceUrl(name)\n\t\tcomputeInstances = append(\n\t\t\tcomputeInstances, &compute.InstanceWithNamedPorts{\n\t\t\t\tInstance: instanceLink})\n\t}\n\treturn &compute.InstanceGroupsListInstances{\n\t\tItems: computeInstances,\n\t}\n}", "func (a Access) ListDBInstances() (*DBInstances, error) {\n\turl := fmt.Sprintf(\"%s%s/instances\", RDB_URL, a.TenantID)\n\tbody, err := a.baseRequest(url, \"GET\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdbs := &DBInstances{}\n\terr = json.Unmarshal(body, dbs)\n\treturn dbs, err\n}", "func (mr *MockResponseHandlerMockRecorder) TargetList() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"TargetList\", reflect.TypeOf((*MockResponseHandler)(nil).TargetList))\n}", "func NewListInstancesParams() *ListInstancesParams {\n\tvar ()\n\treturn &ListInstancesParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "func (p *ProxMox) GetInstances(ctx *lepton.Context) ([]lepton.CloudInstance, error) {\n\tvar cloudInstances []lepton.CloudInstance\n\treturn cloudInstances, nil\n}", "func (e EmptyTargetsNotaryRepository) ListTargets(...data.RoleName) ([]*client.TargetWithRole, error) {\n\treturn []*client.TargetWithRole{}, nil\n}", "func (r *Ratings) ListByTarget(c *gin.Context) {\n\ttid, err := getQueryParam(c, \"target\")\n\tif err != nil {\n\t\tr.viewErr.JSON(c, err)\n\t\treturn\n\t}\n\n\tratings, err := r.rs.ByTarget(tid)\n\tif err != nil {\n\t\tr.viewErr.JSON(c, err)\n\t\treturn\n\t}\n\n\tif ratings == nil {\n\t\tratings = []models.Rating{}\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"items\": ratings,\n\t})\n}", "func (s targetNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.Target, err error) {\n\terr = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.Target))\n\t})\n\treturn ret, err\n}", "func (pr *pluginRegistry) InstanceList() []*Instance {\n\tpr.mut.Lock()\n\tdefer pr.mut.Unlock()\n\n\t// this gets called in the router for every message that comes in, so it\n\t// might come to pass that this will perform poorly, but for now with a\n\t// relatively small number of instances we'll take the copy hit in exchange\n\t// for not having to think about concurrent access to the list\n\tout := make([]*Instance, len(pr.instances))\n\tcopy(out, pr.instances) // intentional shallow copy\n\treturn out\n}", "func (sd *ServerDiscovery) GetInstances() (addresses []ServerAddress) {\n\tfor _, a := range sd.list {\n\t\taddresses = append(addresses, a)\n\t}\n\treturn addresses\n}", "func (m *MockResponseHandler) TargetList() {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"TargetList\")\n}", "func (l LoadedWithNoSignersNotaryRepository) ListTargets(roles ...data.RoleName) ([]*client.TargetWithRole, error) {\n\tfilteredTargets := []*client.TargetWithRole{}\n\tfor _, tgt := range loadedTargets {\n\t\tif len(roles) == 0 || (len(roles) > 0 && roles[0] == tgt.Role.Name) {\n\t\t\tfilteredTargets = append(filteredTargets, &client.TargetWithRole{Target: tgt.Target, Role: tgt.Role.Name})\n\t\t}\n\t}\n\treturn filteredTargets, nil\n}", "func (client *Client) ListTargetsWithOptions(request *ListTargetsRequest, runtime *util.RuntimeOptions) (_result *ListTargetsResponse, _err error) {\n\t_err = util.ValidateModel(request)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_result = &ListTargetsResponse{}\n\t_body, _err := client.DoRequest(tea.String(\"listTargets\"), tea.String(\"HTTP\"), tea.String(\"POST\"), tea.String(\"/openapi/listTargets\"), nil, tea.ToMap(request), 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 (m *pcpInstanceMetric) Instances() []string { return m.indom.Instances() }", "func (w *Watcher) GetTargetNameList() ([]string) {\n\tmutableMutex.Lock()\n\tdefer mutableMutex.Unlock()\n\tif w.TargetMap == nil {\n\t\tw.TargetMap = make(map[string]*Target)\n\t}\n\ttargetNameList := make([]string, 0, len(w.TargetMap))\n\tfor tn := range w.TargetMap {\n\t\ttargetNameList = append(targetNameList, tn)\n\t}\n\treturn targetNameList\n}", "func (l LoadedNotaryRepository) ListTargets(roles ...data.RoleName) ([]*client.TargetWithRole, error) {\n\tfilteredTargets := []*client.TargetWithRole{}\n\tfor _, tgt := range loadedTargets {\n\t\tif len(roles) == 0 || (len(roles) > 0 && roles[0] == tgt.Role.Name) {\n\t\t\tfilteredTargets = append(filteredTargets, &client.TargetWithRole{Target: tgt.Target, Role: tgt.Role.Name})\n\t\t}\n\t}\n\treturn filteredTargets, nil\n}", "func NewTargetLister(indexer cache.Indexer) TargetLister {\n\treturn &targetLister{indexer: indexer}\n}", "func (m *MockDdbClient) ListWorkflowInstances(ctx context.Context, project, user string, limit int) ([]ddb.WorkflowInstance, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListWorkflowInstances\", ctx, project, user, limit)\n\tret0, _ := ret[0].([]ddb.WorkflowInstance)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (client InfraRoleInstancesClient) ListResponder(resp *http.Response) (result InfraRoleInstanceList, 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}", "func (mr *MockDdbClientMockRecorder) ListWorkflowInstances(ctx, project, user, limit interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ListWorkflowInstances\", reflect.TypeOf((*MockDdbClient)(nil).ListWorkflowInstances), ctx, project, user, limit)\n}", "func (s googleCloudStorageTargetNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.GoogleCloudStorageTarget, err error) {\n\terr = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.GoogleCloudStorageTarget))\n\t})\n\treturn ret, err\n}", "func (taker TakerSQLAdminGCP) ListSQLInstances(project *reportProject) (gcpInstances []*sqladmin.DatabaseInstance, err error) {\n\tsqlInstanceResponse, silErr := taker.sqladminService.Instances.List(project.gcpProject.ProjectId).Do()\n\tif silErr == nil {\n\t\tgcpInstances = sqlInstanceResponse.Items\n\t}\n\terr = silErr\n\treturn\n}", "func (a *HyperflexApiService) GetHyperflexTargetList(ctx context.Context) ApiGetHyperflexTargetListRequest {\n\treturn ApiGetHyperflexTargetListRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "func (c *TiFlashComponent) Instances() []Instance {\n\tins := make([]Instance, 0, len(c.Topology.TiFlashServers))\n\tfor _, s := range c.Topology.TiFlashServers {\n\t\tins = append(ins, &TiFlashInstance{BaseInstance{\n\t\t\tInstanceSpec: s,\n\t\t\tName: c.Name(),\n\t\t\tHost: s.Host,\n\t\t\tManageHost: s.ManageHost,\n\t\t\tPort: s.GetMainPort(),\n\t\t\tSSHP: s.SSHPort,\n\t\t\tSource: s.GetSource(),\n\n\t\t\tPorts: []int{\n\t\t\t\ts.TCPPort,\n\t\t\t\ts.HTTPPort,\n\t\t\t\ts.FlashServicePort,\n\t\t\t\ts.FlashProxyPort,\n\t\t\t\ts.FlashProxyStatusPort,\n\t\t\t\ts.StatusPort,\n\t\t\t},\n\t\t\tDirs: []string{\n\t\t\t\ts.DeployDir,\n\t\t\t\ts.DataDir,\n\t\t\t},\n\t\t\tStatusFn: s.Status,\n\t\t\tUptimeFn: func(_ context.Context, timeout time.Duration, tlsCfg *tls.Config) time.Duration {\n\t\t\t\treturn UptimeByHost(s.GetManageHost(), s.StatusPort, timeout, tlsCfg)\n\t\t\t},\n\t\t}, c.Topology})\n\t}\n\treturn ins\n}", "func ChangeImagesForInstances(sess *session.Session, target targets.IfTarget, machineInst instance.IfInstance, firstImage *string, secondImage *string) error {\n\n\tfmt.Println(\"starting DescribeTargets\")\n\tresult, err := target.DescribeTargets()\n\tif err != nil {\n\t\treturn err\n\t}\n\tinstances := target.TakeIds(result)\n\n\t// Loop for removing and creating instances with new image\n\tfor _, inst := range instances {\n\n\t\tinfo, err := machineInst.DescribeInstance(inst)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tpresentImage := info.Reservations[0].Instances[0].ImageId\n\n\t\t// Check if image need to be changed\n\t\tif *presentImage == *firstImage {\n\t\t\tfmt.Println(\"Starting ami change for instance: \", inst)\n\n\t\t\tfmt.Println(\"Deregistring target instance from target group\")\n\n\t\t\t// Remove instance from target group before terminating instance\n\t\t\ttarget.DeregisterTarget(inst)\n\n\t\t\t// Terminate old image instance\n\t\t\tmachineInst.TerminateInstance(inst)\n\n\t\t\t// Create new instance with new image\n\t\t\tnewMachine, err := machineInst.RunInstance(*secondImage)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// Take instance id for future usage\n\t\t\tinst = *newMachine.Instances[0].InstanceId\n\t\t\tinfo, err := machineInst.DescribeInstance(inst)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// Check state of newly create instance\n\t\t\tstate := info.Reservations[0].Instances[0].State.Name\n\n\t\t\t// Waiting loop for instance be fully available\n\t\t\tfmt.Println(\"Waiting for instance to be running\")\n\t\t\tfor *state != \"running\" {\n\n\t\t\t\tinfo, err := machineInst.DescribeInstance(inst)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tstate = info.Reservations[0].Instances[0].State.Name\n\t\t\t\tfmt.Println(*state)\n\t\t\t\ttime.Sleep(1 * time.Second)\n\t\t\t}\n\t\t\tfmt.Println(\"Registring new target instance in target group\")\n\t\t\ttarget.RegisterTarget(inst)\n\n\t\t\t// before we proceed to another instance, here we should add helth status checking\n\t\t\t// for target in target group\n\t\t\t// but i do not have full accesses to AWS and time to create fully working test environment\n\n\t\t}\n\t}\n\n\treturn nil\n}", "func NewListInstancesParamsWithTimeout(timeout time.Duration) *ListInstancesParams {\n\tvar ()\n\treturn &ListInstancesParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "func (o OfflineNotaryRepository) ListTargets(...data.RoleName) ([]*client.TargetWithRole, error) {\n\treturn nil, storage.ErrOffline{}\n}", "func (t *Target) runTargetList(targets []string) (int, string, error) {\n\tfor _, target := range targets {\n\t\tif target == t.Name {\n\t\t\tcontinue\n\t\t}\n\t\tif t, ok := t.targetConfigs.Target(target); ok {\n\t\t\tstatus, out, err := t.Run()\n\t\t\tif status != 0 || err != nil {\n\t\t\t\treturn status, out, err\n\t\t\t}\n\t\t}\n\t}\n\treturn 0, \"\", nil\n}", "func (c *MockRegistry) GetInstances(token string, url string) ([]Instance, error) {\n\treturn c.GetInstancesVal, c.GetInstancesError\n}", "func (o *ListInstancesParams) WithContext(ctx context.Context) *ListInstancesParams {\n\to.SetContext(ctx)\n\treturn o\n}", "func (client *Client) Instances() ([]Instance, error) {\n\toutput := new(bytes.Buffer)\n\n\tif err := client.director.RunAuthenticatedCommand(\n\t\toutput,\n\t\tclient.stderr,\n\t\tfalse,\n\t\t\"--deployment\",\n\t\tconcourseDeploymentName,\n\t\t\"instances\",\n\t\t\"--json\",\n\t); err != nil {\n\t\t// if there is an error, copy the stdout to the main stdout to help debugging\n\t\treturn nil, err\n\t}\n\n\tjsonOutput := struct {\n\t\tTables []struct {\n\t\t\tRows []struct {\n\t\t\t\tInstance string `json:\"instance\"`\n\t\t\t\tIPs string `json:\"ips\"`\n\t\t\t\tProcessState string `json:\"process_state\"`\n\t\t\t} `json:\"Rows\"`\n\t\t} `json:\"Tables\"`\n\t}{}\n\n\tif err := json.NewDecoder(output).Decode(&jsonOutput); err != nil {\n\t\treturn nil, err\n\t}\n\n\tinstances := []Instance{}\n\n\tfor _, table := range jsonOutput.Tables {\n\t\tfor _, row := range table.Rows {\n\t\t\tinstances = append(instances, Instance{\n\t\t\t\tName: row.Instance,\n\t\t\t\tIP: row.IPs,\n\t\t\t\tState: row.ProcessState,\n\t\t\t})\n\t\t}\n\t}\n\n\treturn instances, nil\n}", "func TestGetAllInstances(t *testing.T) {\n\tctx, cancelFunc := context.WithTimeout(context.Background(), standardTimeout)\n\tdefer cancelFunc()\n\n\tinstances, err := bat.StartRandomInstances(ctx, \"\", 3)\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to launch instance: %v\", err)\n\t}\n\n\tscheduled, err := bat.WaitForInstancesLaunch(ctx, \"\", instances, false)\n\tdefer func() {\n\t\t_, err := bat.DeleteInstances(ctx, \"\", scheduled)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Failed to delete instances: %v\", err)\n\t\t}\n\t}()\n\tif err != nil {\n\t\tt.Fatalf(\"Instance %s did not launch: %v\", instances[0], err)\n\t}\n\n\tinstanceDetails, err := bat.GetAllInstances(ctx, \"\")\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to retrieve instances: %v\", err)\n\t}\n\n\tfor _, instance := range instances {\n\t\tinstanceDetail, ok := instanceDetails[instance]\n\t\tif !ok {\n\t\t\tt.Fatalf(\"Failed to retrieve instance %s\", instance)\n\t\t}\n\n\t\t// Check some basic information\n\n\t\tif instanceDetail.FlavorID == \"\" || instanceDetail.HostID == \"\" ||\n\t\t\tinstanceDetail.TenantID == \"\" || instanceDetail.MacAddress == \"\" ||\n\t\t\tinstanceDetail.PrivateIP == \"\" {\n\t\t\tt.Fatalf(\"Instance missing information: %+v\", instanceDetail)\n\t\t}\n\t}\n}", "func (p *OnPrem) GetInstances(ctx *Context) ([]CloudInstance, error) {\n\treturn nil, errors.New(\"un-implemented\")\n}", "func (c *FakeCloudwatchEventTargets) List(opts v1.ListOptions) (result *v1alpha1.CloudwatchEventTargetList, err error) {\n\tobj, err := c.Fake.\n\t\tInvokes(testing.NewListAction(cloudwatcheventtargetsResource, cloudwatcheventtargetsKind, c.ns, opts), &v1alpha1.CloudwatchEventTargetList{})\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.CloudwatchEventTargetList{ListMeta: obj.(*v1alpha1.CloudwatchEventTargetList).ListMeta}\n\tfor _, item := range obj.(*v1alpha1.CloudwatchEventTargetList).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 (c *TiFlashComponent) Instances() []Instance {\n\tins := make([]Instance, 0, len(c.Topology.TiFlashServers))\n\tfor _, s := range c.Topology.TiFlashServers {\n\t\tins = append(ins, &TiFlashInstance{BaseInstance{\n\t\t\tInstanceSpec: s,\n\t\t\tName: c.Name(),\n\t\t\tHost: s.Host,\n\t\t\tPort: s.GetMainPort(),\n\t\t\tSSHP: s.SSHPort,\n\n\t\t\tPorts: []int{\n\t\t\t\ts.TCPPort,\n\t\t\t\ts.HTTPPort,\n\t\t\t\ts.FlashServicePort,\n\t\t\t\ts.FlashProxyPort,\n\t\t\t\ts.FlashProxyStatusPort,\n\t\t\t\ts.StatusPort,\n\t\t\t},\n\t\t\tDirs: []string{\n\t\t\t\ts.DeployDir,\n\t\t\t\ts.DataDir,\n\t\t\t},\n\t\t\tStatusFn: s.Status,\n\t\t}, c.Topology})\n\t}\n\treturn ins\n}", "func (client AccessGovernanceCPClient) listGovernanceInstances(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodGet, \"/governanceInstances\", binaryReqBody, extraHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response ListGovernanceInstancesResponse\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/access-governance-cp/20220518/GovernanceInstanceCollection/ListGovernanceInstances\"\n\t\terr = common.PostProcessServiceError(err, \"AccessGovernanceCP\", \"ListGovernanceInstances\", apiReferenceLink)\n\t\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponse(httpResponse, &response)\n\treturn response, err\n}", "func TargetsFromGroup(tg *targetgroup.Group, cfg *config.ScrapeConfig, noDefaultPort bool, targets []*Target, lb *labels.Builder) ([]*Target, []error) {\n\ttargets = targets[:0]\n\tfailures := []error{}\n\n\tfor i, tlset := range tg.Targets {\n\t\tlb.Reset(labels.EmptyLabels())\n\n\t\tfor ln, lv := range tlset {\n\t\t\tlb.Set(string(ln), string(lv))\n\t\t}\n\t\tfor ln, lv := range tg.Labels {\n\t\t\tif _, ok := tlset[ln]; !ok {\n\t\t\t\tlb.Set(string(ln), string(lv))\n\t\t\t}\n\t\t}\n\n\t\tlset, origLabels, err := PopulateLabels(lb, cfg, noDefaultPort)\n\t\tif err != nil {\n\t\t\tfailures = append(failures, errors.Wrapf(err, \"instance %d in group %s\", i, tg))\n\t\t}\n\t\tif !lset.IsEmpty() || !origLabels.IsEmpty() {\n\t\t\ttargets = append(targets, NewTarget(lset, origLabels, cfg.Params))\n\t\t}\n\t}\n\treturn targets, failures\n}", "func (p *plugin) DescribeInstances(tags map[string]string, properties bool) ([]instance.Description, error) {\n\tlog.Debug(fmt.Sprintf(\"describe-instances: %v\", tags))\n\tresults := []instance.Description{}\n\n\tgroupName := tags[group.GroupTag]\n\n\tinstances, err := findGroupInstances(p, groupName)\n\tif err != nil {\n\t\tlog.Error(\"Problems finding group instances\", \"err\", err)\n\t}\n\n\t// Iterate through group instances and find the sha from their annotation field\n\tfor _, vmInstance := range instances {\n\t\tctx, cancel := context.WithCancel(context.Background())\n\t\tdefer cancel()\n\n\t\tconfigSHA := returnDataFromVM(ctx, vmInstance, \"sha\")\n\t\tguestIP := returnDataFromVM(ctx, vmInstance, \"guestIP\")\n\n\t\t// Duplicate original tags\n\t\tvmTags := make(map[string]string)\n\t\tfor k, v := range tags {\n\t\t\tvmTags[k] = v\n\t\t}\n\n\t\tvmTags[group.ConfigSHATag] = configSHA\n\t\tvmTags[\"guestIP\"] = guestIP\n\t\tresults = append(results, instance.Description{\n\t\t\tID: instance.ID(vmInstance.Name()),\n\t\t\tLogicalID: nil,\n\t\t\tTags: vmTags,\n\t\t})\n\t}\n\tlog.Debug(\"Updating FSM\", \"Count\", len(p.fsm))\n\n\t// DIFF what the endpoint is saying as reported versus what we have in the FSM\n\tvar updatedFSM []provisioningFSM\n\tfor _, unprovisionedInstance := range p.fsm {\n\t\tvar provisioned bool\n\n\t\tfor _, provisionedInstance := range results {\n\n\t\t\tif string(provisionedInstance.ID) == unprovisionedInstance.instanceName {\n\t\t\t\tprovisioned = true\n\t\t\t\t// instance has been provisioned so break from loop\n\t\t\t\tbreak\n\t\t\t} else {\n\t\t\t\tprovisioned = false\n\t\t\t}\n\t\t}\n\t\tif provisioned == false && unprovisionedInstance.timer.After(time.Now()) && unprovisionedInstance.tags[group.GroupTag] == tags[group.GroupTag] {\n\t\t\tupdatedFSM = append(updatedFSM, unprovisionedInstance)\n\t\t}\n\t}\n\n\tp.fsm = make([]provisioningFSM, len(updatedFSM))\n\tcopy(p.fsm, updatedFSM)\n\n\tlog.Debug(\"FSM Updated\", \"Count\", len(p.fsm))\n\tfor _, unprovisionedInstances := range p.fsm {\n\t\tresults = append(results, instance.Description{\n\t\t\tID: instance.ID(unprovisionedInstances.instanceName),\n\t\t\tLogicalID: nil,\n\t\t\tTags: unprovisionedInstances.tags,\n\t\t})\n\t}\n\tif len(results) == 0 {\n\t\tlog.Info(\"No Instances found\")\n\t}\n\treturn results, nil\n}", "func (o *ListInstancesParams) WithHTTPClient(client *http.Client) *ListInstancesParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (s *Service) targets(ctx *gin.Context) *api.Result {\n\tstate := ctx.Query(\"state\")\n\tsortKeys := func(targets map[string][]*discovery.SDTargets) ([]string, int) {\n\t\tvar n int\n\t\tkeys := make([]string, 0, len(targets))\n\t\tfor k := range targets {\n\t\t\tkeys = append(keys, k)\n\t\t\tn += len(targets[k])\n\t\t}\n\t\tsort.Strings(keys)\n\t\treturn keys, n\n\t}\n\n\tflatten := func(targets map[string][]*discovery.SDTargets) []*scrape.Target {\n\t\tkeys, n := sortKeys(targets)\n\t\tres := make([]*scrape.Target, 0, n)\n\t\tfor _, k := range keys {\n\t\t\tfor _, t := range targets[k] {\n\t\t\t\tres = append(res, t.PromTarget)\n\t\t\t}\n\t\t}\n\t\treturn res\n\t}\n\n\tshowActive := state == \"\" || state == \"any\" || state == \"active\"\n\tshowDropped := state == \"\" || state == \"any\" || state == \"dropped\"\n\tres := &v1.TargetDiscovery{}\n\n\tif showActive {\n\t\tactiveTargets := s.getActiveTargets()\n\t\tactiveKeys, numTargets := sortKeys(activeTargets)\n\t\tres.ActiveTargets = make([]*v1.Target, 0, numTargets)\n\t\tstatus, err := s.getScrapeStatus(activeTargets)\n\t\tif err != nil {\n\t\t\treturn api.InternalErr(err, \"get targets runtime\")\n\t\t}\n\n\t\tfor _, key := range activeKeys {\n\t\t\tfor _, t := range activeTargets[key] {\n\t\t\t\ttar := t.PromTarget\n\t\t\t\thash := t.ShardTarget.Hash\n\t\t\t\trt := status[hash]\n\t\t\t\tif rt == nil {\n\t\t\t\t\trt = target.NewScrapeStatus(0)\n\t\t\t\t}\n\n\t\t\t\tres.ActiveTargets = append(res.ActiveTargets, &v1.Target{\n\t\t\t\t\tDiscoveredLabels: tar.DiscoveredLabels().Map(),\n\t\t\t\t\tLabels: tar.Labels().Map(),\n\t\t\t\t\tScrapePool: key,\n\t\t\t\t\tScrapeURL: tar.URL().String(),\n\t\t\t\t\tGlobalURL: tar.URL().String(),\n\t\t\t\t\tLastError: rt.LastError,\n\t\t\t\t\tLastScrape: rt.LastScrape,\n\t\t\t\t\tLastScrapeDuration: rt.LastScrapeDuration,\n\t\t\t\t\tHealth: rt.Health,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t} else {\n\t\tres.ActiveTargets = []*v1.Target{}\n\t}\n\tif showDropped {\n\t\ttDropped := flatten(s.getDropTargets())\n\t\tres.DroppedTargets = make([]*v1.DroppedTarget, 0, len(tDropped))\n\t\tfor _, t := range tDropped {\n\t\t\tres.DroppedTargets = append(res.DroppedTargets, &v1.DroppedTarget{\n\t\t\t\tDiscoveredLabels: t.DiscoveredLabels().Map(),\n\t\t\t})\n\t\t}\n\t} else {\n\t\tres.DroppedTargets = []*v1.DroppedTarget{}\n\t}\n\n\treturn api.Data(res)\n}", "func (s *Store) GetList(w http.ResponseWriter, r *http.Request, limit, offset int) (results interface{}, totalCount int, err error) {\n\tctx := r.Context()\n\tstateFilterQuery := r.URL.Query().Get(\"state\")\n\tdatasetFilterQuery := r.URL.Query().Get(\"dataset\")\n\tvar stateFilterList []string\n\tvar datasetFilterList []string\n\tlogData := log.Data{}\n\n\tif stateFilterQuery != \"\" {\n\t\tlogData[\"state_query\"] = stateFilterQuery\n\t\tstateFilterList = strings.Split(stateFilterQuery, \",\")\n\t}\n\n\tif datasetFilterQuery != \"\" {\n\t\tlogData[\"dataset_query\"] = datasetFilterQuery\n\t\tdatasetFilterList = strings.Split(datasetFilterQuery, \",\")\n\t}\n\n\tlog.Info(ctx, \"get list of instances\", logData)\n\n\tresults, totalCount, err = func() ([]*models.Instance, int, error) {\n\t\tif len(stateFilterList) > 0 {\n\t\t\tif err := models.ValidateStateFilter(stateFilterList); err != nil {\n\t\t\t\tlog.Error(ctx, \"get instances: filter state invalid\", err, logData)\n\t\t\t\treturn nil, 0, taskError{error: err, status: http.StatusBadRequest}\n\t\t\t}\n\t\t}\n\n\t\tinstancesResults, instancesTotalCount, err := s.GetInstances(ctx, stateFilterList, datasetFilterList, offset, limit)\n\t\tif err != nil {\n\t\t\tlog.Error(ctx, \"get instances: store.GetInstances returned an error\", err, logData)\n\t\t\treturn nil, 0, err\n\t\t}\n\n\t\treturn instancesResults, instancesTotalCount, nil\n\t}()\n\n\tif err != nil {\n\t\thandleInstanceErr(ctx, err, w, logData)\n\t\treturn nil, 0, err\n\t}\n\n\tlog.Info(ctx, \"get instances: request successful\", logData)\n\treturn results, totalCount, nil\n}", "func (h *httpCloud) List(filter string) ([]string, error) {\n\tvar resp []string\n\tif err := h.get(h.instancesURL+path.Join(InstancesPath, filter), &resp); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn resp, nil\n}", "func (client AccessGovernanceCPClient) ListGovernanceInstances(ctx context.Context, request ListGovernanceInstancesRequest) (response ListGovernanceInstancesResponse, err error) {\n\tvar ociResponse common.OCIResponse\n\tpolicy := common.DefaultRetryPolicy()\n\tif client.RetryPolicy() != nil {\n\t\tpolicy = *client.RetryPolicy()\n\t}\n\tif request.RetryPolicy() != nil {\n\t\tpolicy = *request.RetryPolicy()\n\t}\n\tociResponse, err = common.Retry(ctx, request, client.listGovernanceInstances, 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 = ListGovernanceInstancesResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId}\n\t\t\t} else {\n\t\t\t\tresponse = ListGovernanceInstancesResponse{}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\tif convertedResponse, ok := ociResponse.(ListGovernanceInstancesResponse); ok {\n\t\tresponse = convertedResponse\n\t} else {\n\t\terr = fmt.Errorf(\"failed to convert OCIResponse into ListGovernanceInstancesResponse\")\n\t}\n\treturn\n}", "func ExampleDevicesClient_NewListFailoverTargetPager() {\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 := armstorsimple1200series.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := clientFactory.NewDevicesClient().NewListFailoverTargetPager(\"HSDK-4XY4FI2IVG\", \"ResourceGroupForSDKTest\", \"hAzureSDKOperations\", &armstorsimple1200series.DevicesClientListFailoverTargetOptions{Expand: nil})\n\tfor pager.More() {\n\t\tpage, err := pager.NextPage(ctx)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"failed to advance page: %v\", err)\n\t\t}\n\t\tfor _, v := range page.Value {\n\t\t\t// You could use page here. We use blank identifier for just demo purposes.\n\t\t\t_ = v\n\t\t}\n\t\t// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.\n\t\t// page.DeviceList = armstorsimple1200series.DeviceList{\n\t\t// \tValue: []*armstorsimple1200series.Device{\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"HSDK-DMNJB2PET0\"),\n\t\t// \t\t\tType: to.Ptr(\"Microsoft.StorSimple/managers/devices\"),\n\t\t// \t\t\tID: to.Ptr(\"/subscriptions/9eb689cd-7243-43b4-b6f6-5c65cb296641/resourceGroups/ResourceGroupForSDKTest/providers/Microsoft.StorSimple/managers/hAzureSDKOperations/devices/HSDK-DMNJB2PET0\"),\n\t\t// \t\t\tProperties: &armstorsimple1200series.DeviceProperties{\n\t\t// \t\t\t\tType: to.Ptr(armstorsimple1200series.DeviceTypeSeries9000OnPremVirtualAppliance),\n\t\t// \t\t\t\tActivationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2018-08-11T14:42:31.0604569Z\"); return t}()),\n\t\t// \t\t\t\tAllowedDeviceOperations: []*armstorsimple1200series.DeviceOperation{\n\t\t// \t\t\t\t\tto.Ptr(armstorsimple1200series.DeviceOperationDelete),\n\t\t// \t\t\t\t\tto.Ptr(armstorsimple1200series.DeviceOperationDRTarget),\n\t\t// \t\t\t\t\tto.Ptr(armstorsimple1200series.DeviceOperationBrowsable)},\n\t\t// \t\t\t\t\tCulture: to.Ptr(\"en-US\"),\n\t\t// \t\t\t\t\tDeviceCapabilities: []*armstorsimple1200series.SupportedDeviceCapabilities{\n\t\t// \t\t\t\t\t\tto.Ptr(armstorsimple1200series.SupportedDeviceCapabilitiesFileServer)},\n\t\t// \t\t\t\t\t\tDeviceConfigurationStatus: to.Ptr(armstorsimple1200series.DeviceConfigurationStatusPending),\n\t\t// \t\t\t\t\t\tDeviceSoftwareVersion: to.Ptr(\"10.0.10296.0\"),\n\t\t// \t\t\t\t\t\tDomainName: to.Ptr(\"fareast.corp.microsoft.com\"),\n\t\t// \t\t\t\t\t\tModelDescription: to.Ptr(\"1200\"),\n\t\t// \t\t\t\t\t\tStatus: to.Ptr(armstorsimple1200series.DeviceStatusReadyToSetup),\n\t\t// \t\t\t\t\t},\n\t\t// \t\t\t\t},\n\t\t// \t\t\t\t{\n\t\t// \t\t\t\t\tName: to.Ptr(\"HSDK-YYMYCY4NK0\"),\n\t\t// \t\t\t\t\tType: to.Ptr(\"Microsoft.StorSimple/managers/devices\"),\n\t\t// \t\t\t\t\tID: to.Ptr(\"/subscriptions/9eb689cd-7243-43b4-b6f6-5c65cb296641/resourceGroups/ResourceGroupForSDKTest/providers/Microsoft.StorSimple/managers/hAzureSDKOperations/devices/HSDK-YYMYCY4NK0\"),\n\t\t// \t\t\t\t\tProperties: &armstorsimple1200series.DeviceProperties{\n\t\t// \t\t\t\t\t\tType: to.Ptr(armstorsimple1200series.DeviceTypeSeries9000OnPremVirtualAppliance),\n\t\t// \t\t\t\t\t\tActivationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"2018-08-11T15:19:40.8252542Z\"); return t}()),\n\t\t// \t\t\t\t\t\tAllowedDeviceOperations: []*armstorsimple1200series.DeviceOperation{\n\t\t// \t\t\t\t\t\t\tto.Ptr(armstorsimple1200series.DeviceOperationDelete),\n\t\t// \t\t\t\t\t\t\tto.Ptr(armstorsimple1200series.DeviceOperationDRTarget),\n\t\t// \t\t\t\t\t\t\tto.Ptr(armstorsimple1200series.DeviceOperationBrowsable)},\n\t\t// \t\t\t\t\t\t\tCulture: to.Ptr(\"en-US\"),\n\t\t// \t\t\t\t\t\t\tDeviceCapabilities: []*armstorsimple1200series.SupportedDeviceCapabilities{\n\t\t// \t\t\t\t\t\t\t\tto.Ptr(armstorsimple1200series.SupportedDeviceCapabilitiesFileServer)},\n\t\t// \t\t\t\t\t\t\t\tDeviceConfigurationStatus: to.Ptr(armstorsimple1200series.DeviceConfigurationStatusPending),\n\t\t// \t\t\t\t\t\t\t\tDeviceSoftwareVersion: to.Ptr(\"10.0.10296.0\"),\n\t\t// \t\t\t\t\t\t\t\tDomainName: to.Ptr(\"fareast.corp.microsoft.com\"),\n\t\t// \t\t\t\t\t\t\t\tModelDescription: to.Ptr(\"1200\"),\n\t\t// \t\t\t\t\t\t\t\tStatus: to.Ptr(armstorsimple1200series.DeviceStatusReadyToSetup),\n\t\t// \t\t\t\t\t\t\t},\n\t\t// \t\t\t\t\t}},\n\t\t// \t\t\t\t}\n\t}\n}", "func (f *FakeInstanceGroups) ListInstancesInInstanceGroup(name, zone string, state string) ([]*compute.InstanceWithNamedPorts, error) {\n\tig, err := f.getInstanceGroup(name, zone)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn getInstanceList(f.zonesToIGsToInstances[zone][ig]).Items, nil\n}", "func (inv *Inventory) matchInstances(patterns ...string) ([]string, error) {\n\trows := make([][]string, 0, len(inv.Instances))\n\tfor name, cfg := range inv.Instances {\n\t\trow := make([]string, 2+len(cfg.Tags))\n\t\trow[0] = name\n\t\trow[1] = cfg.System\n\t\tcopy(row[2:], cfg.Tags)\n\t\trows = append(rows, row)\n\t}\n\treturn matchPatterns(patterns, rows...)\n}", "func (cac *InstanceAdminClient) Instances(ctx context.Context) ([]*InstanceInfo, error) {\n\tctx = metadata.NewContext(ctx, cac.md)\n\treq := &btapb.ListInstancesRequest{\n\t\tParent: \"projects/\" + cac.project,\n\t}\n\tres, err := cac.iClient.ListInstances(ctx, req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar is []*InstanceInfo\n\tfor _, i := range res.Instances {\n\t\tm := instanceNameRegexp.FindStringSubmatch(i.Name)\n\t\tif m == nil {\n\t\t\treturn nil, fmt.Errorf(\"malformed instance name %q\", i.Name)\n\t\t}\n\t\tis = append(is, &InstanceInfo{\n\t\t\tName: m[2],\n\t\t\tDisplayName: i.DisplayName,\n\t\t})\n\t}\n\treturn is, nil\n}", "func (s *API) ListInstanceLogs(req *ListInstanceLogsRequest, opts ...scw.RequestOption) (*ListInstanceLogsResponse, 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\tquery := url.Values{}\n\tparameter.AddToQuery(query, \"order_by\", req.OrderBy)\n\n\tif fmt.Sprint(req.Region) == \"\" {\n\t\treturn nil, errors.New(\"field Region cannot be empty in request\")\n\t}\n\n\tif fmt.Sprint(req.InstanceID) == \"\" {\n\t\treturn nil, errors.New(\"field InstanceID cannot be empty in request\")\n\t}\n\n\tscwReq := &scw.ScalewayRequest{\n\t\tMethod: \"GET\",\n\t\tPath: \"/rdb/v1/regions/\" + fmt.Sprint(req.Region) + \"/instances/\" + fmt.Sprint(req.InstanceID) + \"/logs\",\n\t\tQuery: query,\n\t\tHeaders: http.Header{},\n\t}\n\n\tvar resp ListInstanceLogsResponse\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 runInstances(message string, fn runner) {\n logger.Log(fmt.Sprintf(\"%s %v\\n\", message, process))\n for i := 0; i < cfg.Instances; i++ {\n logger.Log(fmt.Sprintf(\"...Instance %d of %d %s\\n\", i, cfg.Instances, process))\n id, _ := pid(i)\n fn(i, id)\n }\n\n}", "func ListManagedInstances(c GCECloud, igm *compute.InstanceGroupManager) ([]*compute.ManagedInstance, error) {\n\tctx := context.Background()\n\tproject := c.Project()\n\n\tzoneName := LastComponent(igm.Zone)\n\n\t// TODO: Only select a subset of fields\n\t//\treq.Fields(\n\t//\t\tgoogleapi.Field(\"items/selfLink\"),\n\t//\t\tgoogleapi.Field(\"items/metadata/items[key='cluster-name']\"),\n\t//\t\tgoogleapi.Field(\"items/metadata/items[key='instance-template']\"),\n\t//\t)\n\n\tinstances, err := c.Compute().InstanceGroupManagers().ListManagedInstances(ctx, project, zoneName, igm.Name)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error listing ManagedInstances in %s: %v\", igm.Name, err)\n\t}\n\n\treturn instances, nil\n}", "func (s *Service) ListMasterInstances(clusterID string) ([]string, error) {\n\tinstanceNames := []string{}\n\n\tinstances, err := awsresources.FindInstances(awsresources.FindInstancesInput{\n\t\tClients: s.awsClients,\n\t\tLogger: s.logger,\n\t\tPattern: fmt.Sprintf(\"%s-master\", clusterID),\n\t})\n\tif err != nil {\n\t\treturn instanceNames, microerror.Mask(err)\n\t}\n\n\tfor _, instance := range instances {\n\t\tinstanceNames = append(instanceNames, instance.Name)\n\t}\n\n\treturn instanceNames, nil\n}", "func (s *AppsServiceOp) ListInstanceSizes(ctx context.Context) ([]*AppInstanceSize, *Response, error) {\n\tpath := fmt.Sprintf(\"%s/tiers/instance_sizes\", appsBasePath)\n\treq, err := s.client.NewRequest(ctx, http.MethodGet, path, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\troot := new(instanceSizesRoot)\n\tresp, err := s.client.Do(ctx, req, root)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\treturn root.InstanceSizes, resp, nil\n}", "func (t *Targeter) Targets() <-chan []scraper.Targeter {\n\treturn t.out\n}", "func (e *ECS) ListContainerInstances(req *ListContainerInstancesReq) (\n\t*ListContainerInstancesResp, error) {\n\tif req == nil {\n\t\treturn nil, fmt.Errorf(\"The req params cannot be nil\")\n\t}\n\n\tparams := makeParams(\"ListContainerInstances\")\n\tif req.MaxResults > 0 {\n\t\tparams[\"maxResults\"] = strconv.Itoa(int(req.MaxResults))\n\t}\n\tif req.Cluster != \"\" {\n\t\tparams[\"cluster\"] = req.Cluster\n\t}\n\tif req.NextToken != \"\" {\n\t\tparams[\"nextToken\"] = req.NextToken\n\t}\n\n\tresp := new(ListContainerInstancesResp)\n\tif err := e.query(params, resp); err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp, nil\n}", "func ManagedInstances(ctx context.Context, logger logr.Logger, cl client.Client) error {\n\tlogger.Info(\"looking for managed instances to upgrade\")\n\n\topts := []client.ListOption{\n\t\tclient.MatchingLabels(map[string]string{\n\t\t\t\"app.kubernetes.io/managed-by\": \"opentelemetry-operator\",\n\t\t}),\n\t}\n\tlist := &v1alpha1.OpenTelemetryCollectorList{}\n\tif err := cl.List(ctx, list, opts...); err != nil {\n\t\treturn fmt.Errorf(\"failed to list: %w\", err)\n\t}\n\n\tfor _, j := range list.Items {\n\t\totelcol, err := ManagedInstance(ctx, logger, cl, &j)\n\t\tif err != nil {\n\t\t\t// nothing to do at this level, just go to the next instance\n\t\t\tcontinue\n\t\t}\n\n\t\tif !reflect.DeepEqual(otelcol, j) {\n\t\t\t// the resource update overrides the status, so, keep it so that we can reset it later\n\t\t\tst := otelcol.Status\n\t\t\tif err := cl.Update(ctx, otelcol); err != nil {\n\t\t\t\tlogger.Error(err, \"failed to apply changes to instance\", \"name\", otelcol.Name, \"namespace\", otelcol.Namespace)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// the status object requires its own update\n\t\t\totelcol.Status = st\n\t\t\tif err := cl.Status().Update(ctx, otelcol); err != nil {\n\t\t\t\tlogger.Error(err, \"failed to apply changes to instance's status object\", \"name\", otelcol.Name, \"namespace\", otelcol.Namespace)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tlogger.Info(\"instance upgraded\", \"name\", otelcol.Name, \"namespace\", otelcol.Namespace, \"version\", otelcol.Status.Version)\n\t\t}\n\t}\n\n\tif len(list.Items) == 0 {\n\t\tlogger.Info(\"no instances to upgrade\")\n\t}\n\n\treturn nil\n}", "func (k *Client) ListActiveTargets(upstream string) (*TargetListResponse, error) {\n\tres, err := k.get(\"/upstreams/\"+upstream+\"/targets/active\", nil)\n\tif err != nil {\n\t\tlogrus.WithError(err).WithFields(logrus.Fields{\n\t\t\t\"upstream\": upstream,\n\t\t}).Error(\"unable to fetch upstream targets\")\n\t\treturn nil, err\n\t}\n\tbody, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\tlogrus.WithError(err).WithFields(logrus.Fields{\n\t\t\t\"upstream\": upstream,\n\t\t}).Error(\"unable to fetch upstream targets\")\n\t\treturn nil, err\n\t}\n\tdefer res.Body.Close()\n\tif res.StatusCode >= 400 {\n\t\tlogrus.WithFields(logrus.Fields{\n\t\t\t\"upstream\": upstream,\n\t\t}).Error(\"unable to fetch upstream targets\")\n\t\treturn nil, errors.New(res.Status)\n\t}\n\t// FIXME\n\t// We have to verify the result size before unmarshal\n\t// because Kong API is not consitent and return an empty\n\t// object instead of an empty array if no results.\n\tvar lightResult LightTargetListResponse\n\terr = json.Unmarshal(body, &lightResult)\n\tif err != nil {\n\t\tlogrus.WithError(err).WithFields(logrus.Fields{\n\t\t\t\"upstream\": upstream,\n\t\t}).Error(\"unable to decode response\")\n\t\treturn nil, err\n\t}\n\tvar result TargetListResponse\n\tif lightResult.Total == 0 {\n\t\tresult = TargetListResponse{\n\t\t\tTotal: 0,\n\t\t\tData: make([]TargetResponse, 0, 0),\n\t\t}\n\t} else {\n\t\terr = json.Unmarshal(body, &result)\n\t\tif err != nil {\n\t\t\tlogrus.WithError(err).WithFields(logrus.Fields{\n\t\t\t\t\"upstream\": upstream,\n\t\t\t}).Error(\"unable to decode response\")\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn &result, nil\n}", "func (p *OnPrem) GetInstanceLogs(ctx *Context, instancename string, watch bool) error {\n\treturn fmt.Errorf(\"Operation not supported\")\n}", "func (c *RPCClient) ListTargets() ([]api.Target, error) {\n\tout := &ListTargetsOut{}\n\terr := c.call(\"ListTargets\", ListTargetsIn{}, out)\n\treturn out.Targets, err\n}", "func (client *Client) ListTargets(request *ListTargetsRequest) (_result *ListTargetsResponse, _err error) {\n\truntime := &util.RuntimeOptions{}\n\t_result = &ListTargetsResponse{}\n\t_body, _err := client.ListTargetsWithOptions(request, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_result = _body\n\treturn _result, _err\n}", "func (m *MockLoadBalancerServiceIface) ListLoadBalancerRuleInstances(p *ListLoadBalancerRuleInstancesParams) (*ListLoadBalancerRuleInstancesResponse, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ListLoadBalancerRuleInstances\", p)\n\tret0, _ := ret[0].(*ListLoadBalancerRuleInstancesResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (u UninitializedNotaryRepository) ListTargets(...data.RoleName) ([]*client.TargetWithRole, error) {\n\treturn nil, client.ErrRepositoryNotExist{}\n}", "func List(client *golangsdk.ServiceClient, instanceId string, opts ListOptsBuilder) pagination.Pager {\n\turl := rootURL(client, instanceId)\n\tif opts != nil {\n\t\tquery, err := opts.ToListOptsQuery()\n\t\tif err != nil {\n\t\t\treturn pagination.Pager{Err: err}\n\t\t}\n\t\turl += query\n\t}\n\n\treturn pagination.NewPager(client, url, func(r pagination.PageResult) pagination.Page {\n\t\treturn APIPage{pagination.SinglePageBase(r)}\n\t})\n}", "func (taker *TakerGCP) ListVersionInstances(rv *reportVersion) (instances []*appengine.Instance, err error) {\n\tversionsService := appengine.NewAppsServicesVersionsService(taker.appEngine)\n\tif instancesResponse, instanceErr := versionsService.Instances.List(rv.service.application.gcpApplication.Id, rv.service.gcpService.Id, rv.gcpVersion.Id).Do(); instanceErr == nil {\n\t\tinstances = instancesResponse.Instances\n\t} else {\n\t\terr = instanceErr\n\t}\n\treturn\n}", "func (a *Client) GetInstanceList(params *GetInstanceListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetInstanceListOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetInstanceListParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"getInstanceList\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/api/namespaces/{namespace}/instances\",\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: &GetInstanceListReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t}\n\tfor _, opt := range opts {\n\t\topt(op)\n\t}\n\n\tresult, err := a.transport.Submit(op)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*GetInstanceListOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for getInstanceList: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func Logs(args ...string) {\n runInstances(\"Logs\", func(i int, id string) error {\n return run(\"logs\", id)\n })\n}", "func (p *ProxMox) PrintInstanceLogs(ctx *lepton.Context, instancename string, watch bool) error {\n\treturn errors.New(\"currently not available\")\n}", "func (c *MultiClusterController) List(clusterName string, opts ...client.ListOption) (interface{}, error) {\n\tcluster := c.GetCluster(clusterName)\n\tif cluster == nil {\n\t\treturn nil, errors.NewClusterNotFound(clusterName)\n\t}\n\tinstanceList := utilscheme.Scheme.NewObjectList(c.objectType)\n\tdelegatingClient, err := cluster.GetDelegatingClient()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = delegatingClient.List(context.TODO(), instanceList, opts...)\n\treturn instanceList, err\n}", "func (a *AdminApiService) GetAllTargets(ctx _context.Context) (Target, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue Target\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/admin/target\"\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 401 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 500 {\n\t\t\tvar v Error\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "func (p *Profile) Targets() Targets {\n\tr := make(Targets, len(p.targets), len(p.targets))\n\tfor i, t := range p.targets {\n\t\ttmp := *t\n\t\tr[i] = &tmp\n\t}\n\treturn r\n}", "func (t *Targets) GetCandidates(context context.Context, instance *iter8v1alpha2.Experiment) (err error) {\n\tif len(t.Candidates) != len(instance.Spec.Candidates) {\n\t\treturn fmt.Errorf(\"Mismatch of candidate list length, %d in targets while %d in instance\",\n\t\t\tlen(instance.Spec.Candidates), len(t.Candidates))\n\t}\n\tfor i := range t.Candidates {\n\t\tt.Candidates[i] = &appsv1.Deployment{}\n\t\terr = t.client.Get(context, types.NamespacedName{\n\t\t\tName: instance.Spec.Candidates[i],\n\t\t\tNamespace: t.namespace},\n\t\t\tt.Candidates[i])\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}", "func (a InstancePoolsAPI) List() (ipl InstancePoolList, err error) {\n\terr = a.C.Get(\"/instance-pools/list\", nil, &ipl)\n\treturn\n}", "func (m *Manager) Targets() []*Target {\n\tif m == nil {\n\t\treturn nil\n\t}\n\n\treturn m.targets\n}" ]
[ "0.6262957", "0.6098625", "0.6091809", "0.60593235", "0.595095", "0.5865187", "0.5828164", "0.57967573", "0.5709615", "0.5692791", "0.5686678", "0.56535244", "0.5632115", "0.5620803", "0.5609885", "0.5599011", "0.5565173", "0.5548276", "0.5539063", "0.55198395", "0.5518203", "0.54921365", "0.54812187", "0.54321724", "0.54289407", "0.5414248", "0.53910685", "0.5385435", "0.53846353", "0.5368576", "0.53589576", "0.53237784", "0.52979654", "0.52904445", "0.5273668", "0.5263152", "0.5222703", "0.52219033", "0.5214929", "0.5213258", "0.52028745", "0.52020466", "0.5201844", "0.5197369", "0.51951283", "0.5171297", "0.5164414", "0.51556385", "0.5150065", "0.51407623", "0.51363283", "0.5123055", "0.51107067", "0.51012933", "0.5090581", "0.5086977", "0.5078825", "0.5076458", "0.5074508", "0.5066777", "0.5061046", "0.5050536", "0.50471866", "0.5038308", "0.50345314", "0.50342125", "0.5017686", "0.50150186", "0.5014532", "0.5007847", "0.50036407", "0.49927837", "0.49676904", "0.4943041", "0.4941726", "0.49400657", "0.49252146", "0.4924335", "0.49183026", "0.4913227", "0.48913977", "0.48910996", "0.4887611", "0.48793933", "0.48790708", "0.48749235", "0.4873134", "0.48712566", "0.486669", "0.48569587", "0.48547712", "0.48515248", "0.48367643", "0.483289", "0.483202", "0.48238087", "0.48225966", "0.4812254", "0.4808461", "0.47977483" ]
0.82800937
0
GetSerialPortOutput uses the override method GetSerialPortOutputFn or the real implementation.
func (c *TestClient) GetSerialPortOutput(project, zone, name string, port, start int64) (*compute.SerialPortOutput, error) { if c.GetSerialPortOutputFn != nil { return c.GetSerialPortOutputFn(project, zone, name, port, start) } return c.client.GetSerialPortOutput(project, zone, name, port, start) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o ServiceResponseOutput) Port() pulumi.IntOutput {\n\treturn o.ApplyT(func(v ServiceResponse) int { return v.Port }).(pulumi.IntOutput)\n}", "func (o NamedPortOutput) Port() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v NamedPort) *int { return v.Port }).(pulumi.IntPtrOutput)\n}", "func (o GetServiceComponentResultOutput) Port() pulumi.IntOutput {\n\treturn o.ApplyT(func(v GetServiceComponentResult) int { return v.Port }).(pulumi.IntOutput)\n}", "func (p *Concatenator) Out() *scipipe.OutPort { return p.OutPort(\"out\") }", "func (o ListenerOutput) Port() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v Listener) *int { return v.Port }).(pulumi.IntPtrOutput)\n}", "func (i *Instance) WaitForSerialOutput(match string, port int64, interval, timeout time.Duration) error {\n\tvar start int64\n\tvar errs int\n\ttick := time.Tick(interval)\n\ttimedout := time.Tick(timeout)\n\tfor {\n\t\tselect {\n\t\tcase <-timedout:\n\t\t\treturn fmt.Errorf(\"timed out waiting for %q\", match)\n\t\tcase <-tick:\n\t\t\tresp, err := i.client.GetSerialPortOutput(i.Project, i.Zone, i.Name, port, start)\n\t\t\tif err != nil {\n\t\t\t\tstatus, sErr := i.client.InstanceStatus(i.Project, i.Zone, i.Name)\n\t\t\t\tif sErr != nil {\n\t\t\t\t\terr = fmt.Errorf(\"%v, error geting InstanceStatus: %v\", err, sErr)\n\t\t\t\t} else {\n\t\t\t\t\terr = fmt.Errorf(\"%v, InstanceStatus: %q\", err, status)\n\t\t\t\t}\n\n\t\t\t\t// Wait until machine restarts to evaluate SerialOutput.\n\t\t\t\tif status == \"TERMINATED\" || status == \"STOPPED\" || status == \"STOPPING\" {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\t// Retry up to 3 times in a row on any error if we successfully got InstanceStatus.\n\t\t\t\tif errs < 3 {\n\t\t\t\t\terrs++\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tstart = resp.Next\n\t\t\tfor _, ln := range strings.Split(resp.Contents, \"\\n\") {\n\t\t\t\tif i := strings.Index(ln, match); i != -1 {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t}\n\t\t\terrs = 0\n\t\t}\n\t}\n}", "func (o NodeOutput) Port() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Node) pulumi.StringOutput { return v.Port }).(pulumi.StringOutput)\n}", "func (g GCPClient) GetInstanceSerialOutput(instance, zone string) error {\n\tlog.Infof(\"Getting serial port output for instance %s\", instance)\n\tvar next int64\n\tfor {\n\t\tres, err := g.compute.Instances.GetSerialPortOutput(g.projectName, zone, instance).Start(next).Do()\n\t\tif err != nil {\n\t\t\tif err.(*googleapi.Error).Code == 400 {\n\t\t\t\t// Instance may not be ready yet...\n\t\t\t\ttime.Sleep(pollingInterval)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err.(*googleapi.Error).Code == 503 {\n\t\t\t\t// Timeout received when the instance has terminated\n\t\t\t\tbreak\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\t\tfmt.Printf(res.Contents)\n\t\tnext = res.Next\n\t\t// When the instance has been stopped, Start and Next will both be 0\n\t\tif res.Start > 0 && next == 0 {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}", "func (o GroupContainerReadinessProbeHttpGetOutput) Port() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v GroupContainerReadinessProbeHttpGet) *int { return v.Port }).(pulumi.IntPtrOutput)\n}", "func (o GetRecordResultOutput) Port() pulumi.IntOutput {\n\treturn o.ApplyT(func(v GetRecordResult) int { return v.Port }).(pulumi.IntOutput)\n}", "func (o GroupExposedPortOutput) Port() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v GroupExposedPort) *int { return v.Port }).(pulumi.IntPtrOutput)\n}", "func (o TargetGroupOutput) Port() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v TargetGroup) *int { return v.Port }).(pulumi.IntPtrOutput)\n}", "func SerialPortWrite(s string) {\n\tport.Write([]byte(s))\n}", "func (o InstanceOutput) Port() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Instance) pulumi.StringOutput { return v.Port }).(pulumi.StringOutput)\n}", "func (o HybridConnectionOutput) Port() pulumi.IntOutput {\n\treturn o.ApplyT(func(v *HybridConnection) pulumi.IntOutput { return v.Port }).(pulumi.IntOutput)\n}", "func (o ClusterBuildStrategySpecBuildStepsLifecyclePostStartHttpGetOutput) Port() ClusterBuildStrategySpecBuildStepsLifecyclePostStartHttpGetPortOutput {\n\treturn o.ApplyT(func(v ClusterBuildStrategySpecBuildStepsLifecyclePostStartHttpGet) ClusterBuildStrategySpecBuildStepsLifecyclePostStartHttpGetPort {\n\t\treturn v.Port\n\t}).(ClusterBuildStrategySpecBuildStepsLifecyclePostStartHttpGetPortOutput)\n}", "func (o GroupContainerPortOutput) Port() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v GroupContainerPort) *int { return v.Port }).(pulumi.IntPtrOutput)\n}", "func (o ClusterBuildStrategySpecBuildStepsLifecyclePreStopHttpGetOutput) Port() ClusterBuildStrategySpecBuildStepsLifecyclePreStopHttpGetPortOutput {\n\treturn o.ApplyT(func(v ClusterBuildStrategySpecBuildStepsLifecyclePreStopHttpGet) ClusterBuildStrategySpecBuildStepsLifecyclePreStopHttpGetPort {\n\t\treturn v.Port\n\t}).(ClusterBuildStrategySpecBuildStepsLifecyclePreStopHttpGetPortOutput)\n}", "func (o BuildStrategySpecBuildStepsLifecyclePreStopHttpGetOutput) Port() BuildStrategySpecBuildStepsLifecyclePreStopHttpGetPortOutput {\n\treturn o.ApplyT(func(v BuildStrategySpecBuildStepsLifecyclePreStopHttpGet) BuildStrategySpecBuildStepsLifecyclePreStopHttpGetPort {\n\t\treturn v.Port\n\t}).(BuildStrategySpecBuildStepsLifecyclePreStopHttpGetPortOutput)\n}", "func (o DataSourceRedshiftParametersOutput) Port() pulumi.Float64PtrOutput {\n\treturn o.ApplyT(func(v DataSourceRedshiftParameters) *float64 { return v.Port }).(pulumi.Float64PtrOutput)\n}", "func (o ClusterBuildStrategySpecBuildStepsReadinessProbeHttpGetOutput) Port() ClusterBuildStrategySpecBuildStepsReadinessProbeHttpGetPortOutput {\n\treturn o.ApplyT(func(v ClusterBuildStrategySpecBuildStepsReadinessProbeHttpGet) ClusterBuildStrategySpecBuildStepsReadinessProbeHttpGetPort {\n\t\treturn v.Port\n\t}).(ClusterBuildStrategySpecBuildStepsReadinessProbeHttpGetPortOutput)\n}", "func (o *TechsupportmanagementEndPointAllOf) GetSerial() string {\n\tif o == nil || o.Serial == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Serial\n}", "func (o ClusterInstanceOutput) Port() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *ClusterInstance) pulumi.IntPtrOutput { return v.Port }).(pulumi.IntPtrOutput)\n}", "func (o SrvRecordRecordOutput) Port() pulumi.IntOutput {\n\treturn o.ApplyT(func(v SrvRecordRecord) int { return v.Port }).(pulumi.IntOutput)\n}", "func (o GRPCHealthCheckOutput) Port() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v GRPCHealthCheck) *int { return v.Port }).(pulumi.IntPtrOutput)\n}", "func (s *PhysicalSensor) GetPort() byte {\n\treturn s.port\n}", "func (o InstanceGroupNamedPortOutput) Port() pulumi.IntOutput {\n\treturn o.ApplyT(func(v *InstanceGroupNamedPort) pulumi.IntOutput { return v.Port }).(pulumi.IntOutput)\n}", "func (o TCPHealthCheckOutput) Port() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v TCPHealthCheck) *int { return v.Port }).(pulumi.IntPtrOutput)\n}", "func serialPortEnum() (allports []string, usbports []string, notecardports []string, err error) {\n\treturn defaultSerialPortEnum()\n}", "func (o OptionGroupOptionOutput) Port() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v OptionGroupOption) *int { return v.Port }).(pulumi.IntPtrOutput)\n}", "func GetDeviceSerial(device string) (string, error) {\n\tlog.Tracef(\">>> GetDeviceSerial called for %s\", device)\n\tdefer log.Tracef(\"<<< GetDeviceSerial\")\n\trespBuf := make([]byte, respBufLen)\n\terr := ExecIoctl(Vpd80Inquiry, respBuf, device)\n\tif err != nil {\n\t\tlog.Tracef(\"unable to obtain unit serial number on device %s, err %s\", device, err.Error())\n\t\treturn \"\", err\n\t}\n\treturn string(respBuf[4:36]), nil\n}", "func (ay *ay8912) ReadPort(port uint16) (byte, bool) {\n\treturn ay.regs[ay.selectedReg], false\n}", "func (o NamedPortResponseOutput) Port() pulumi.IntOutput {\n\treturn o.ApplyT(func(v NamedPortResponse) int { return v.Port }).(pulumi.IntOutput)\n}", "func (o BuildStrategySpecBuildStepsLifecyclePostStartHttpGetOutput) Port() BuildStrategySpecBuildStepsLifecyclePostStartHttpGetPortOutput {\n\treturn o.ApplyT(func(v BuildStrategySpecBuildStepsLifecyclePostStartHttpGet) BuildStrategySpecBuildStepsLifecyclePostStartHttpGetPort {\n\t\treturn v.Port\n\t}).(BuildStrategySpecBuildStepsLifecyclePostStartHttpGetPortOutput)\n}", "func (o BuildStrategySpecBuildStepsReadinessProbeHttpGetOutput) Port() BuildStrategySpecBuildStepsReadinessProbeHttpGetPortOutput {\n\treturn o.ApplyT(func(v BuildStrategySpecBuildStepsReadinessProbeHttpGet) BuildStrategySpecBuildStepsReadinessProbeHttpGetPort {\n\t\treturn v.Port\n\t}).(BuildStrategySpecBuildStepsReadinessProbeHttpGetPortOutput)\n}", "func (o ClusterOutput) Port() pulumi.IntOutput {\n\treturn o.ApplyT(func(v *Cluster) pulumi.IntOutput { return v.Port }).(pulumi.IntOutput)\n}", "func (o ClusterBuildStrategySpecBuildStepsStartupProbeHttpGetOutput) Port() ClusterBuildStrategySpecBuildStepsStartupProbeHttpGetPortOutput {\n\treturn o.ApplyT(func(v ClusterBuildStrategySpecBuildStepsStartupProbeHttpGet) ClusterBuildStrategySpecBuildStepsStartupProbeHttpGetPort {\n\t\treturn v.Port\n\t}).(ClusterBuildStrategySpecBuildStepsStartupProbeHttpGetPortOutput)\n}", "func HandleOut(em *Emulator, a int, b int) {\n data := em.GetReg(a)\n addr := em.GetReg(b)\n \n if em.getPortAccess(addr) {\n em.StoreIOPort(addr, data)\n em.LogInstruction(\"out %s, %s -- ports[0x%02X] = 0x%02X\", RegisterNames[b],\n RegisterNames[a], addr, data)\n \n } else {\n em.LogInstruction(\"out %s, %s -- not authorised\", RegisterNames[b], RegisterNames[a])\n }\n \n em.timer += 5;\n}", "func (o BuildStrategySpecBuildStepsStartupProbeHttpGetOutput) Port() BuildStrategySpecBuildStepsStartupProbeHttpGetPortOutput {\n\treturn o.ApplyT(func(v BuildStrategySpecBuildStepsStartupProbeHttpGet) BuildStrategySpecBuildStepsStartupProbeHttpGetPort {\n\t\treturn v.Port\n\t}).(BuildStrategySpecBuildStepsStartupProbeHttpGetPortOutput)\n}", "func OutByName(portName string) (out Out, err error) {\n\tdrv := Get()\n\tif drv == nil {\n\t\treturn nil, fmt.Errorf(\"no driver registered\")\n\t}\n\treturn openOut(drv, -1, portName)\n}", "func (o ListenerPtrOutput) Port() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *Listener) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Port\n\t}).(pulumi.IntPtrOutput)\n}", "func (o ClusterBuildStrategySpecBuildStepsLifecyclePostStartTcpSocketOutput) Port() ClusterBuildStrategySpecBuildStepsLifecyclePostStartTcpSocketPortOutput {\n\treturn o.ApplyT(func(v ClusterBuildStrategySpecBuildStepsLifecyclePostStartTcpSocket) ClusterBuildStrategySpecBuildStepsLifecyclePostStartTcpSocketPort {\n\t\treturn v.Port\n\t}).(ClusterBuildStrategySpecBuildStepsLifecyclePostStartTcpSocketPortOutput)\n}", "func (i *Port) Write(buf []byte) (int, error) {\n\treturn i.out.Write(buf)\n}", "func (o ClusterBuildStrategySpecBuildStepsLifecyclePreStopTcpSocketOutput) Port() ClusterBuildStrategySpecBuildStepsLifecyclePreStopTcpSocketPortOutput {\n\treturn o.ApplyT(func(v ClusterBuildStrategySpecBuildStepsLifecyclePreStopTcpSocket) ClusterBuildStrategySpecBuildStepsLifecyclePreStopTcpSocketPort {\n\t\treturn v.Port\n\t}).(ClusterBuildStrategySpecBuildStepsLifecyclePreStopTcpSocketPortOutput)\n}", "func (o *TechsupportmanagementEndPointAllOf) GetSerialOk() (*string, bool) {\n\tif o == nil || o.Serial == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Serial, true\n}", "func (o InstanceListenerEndpointOutput) Port() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v InstanceListenerEndpoint) *int { return v.Port }).(pulumi.IntPtrOutput)\n}", "func OutByNumber(portNumber int) (out Out, err error) {\n\tdrv := Get()\n\tif drv == nil {\n\t\treturn nil, fmt.Errorf(\"no driver registered\")\n\t}\n\treturn openOut(drv, portNumber, \"\")\n}", "func (o GetSrvRecordRecordOutput) Port() pulumi.IntOutput {\n\treturn o.ApplyT(func(v GetSrvRecordRecord) int { return v.Port }).(pulumi.IntOutput)\n}", "func (o GetSrvRecordRecordOutput) Port() pulumi.IntOutput {\n\treturn o.ApplyT(func(v GetSrvRecordRecord) int { return v.Port }).(pulumi.IntOutput)\n}", "func (o *Drive) GetSerial(ctx context.Context) (serial string, err error) {\n\terr = o.object.CallWithContext(ctx, \"org.freedesktop.DBus.Properties.Get\", 0, InterfaceDrive, \"Serial\").Store(&serial)\n\treturn\n}", "func (o BuildStrategySpecBuildStepsLifecyclePostStartTcpSocketOutput) Port() BuildStrategySpecBuildStepsLifecyclePostStartTcpSocketPortOutput {\n\treturn o.ApplyT(func(v BuildStrategySpecBuildStepsLifecyclePostStartTcpSocket) BuildStrategySpecBuildStepsLifecyclePostStartTcpSocketPort {\n\t\treturn v.Port\n\t}).(BuildStrategySpecBuildStepsLifecyclePostStartTcpSocketPortOutput)\n}", "func (o BuildStrategySpecBuildStepsLifecyclePreStopTcpSocketOutput) Port() BuildStrategySpecBuildStepsLifecyclePreStopTcpSocketPortOutput {\n\treturn o.ApplyT(func(v BuildStrategySpecBuildStepsLifecyclePreStopTcpSocket) BuildStrategySpecBuildStepsLifecyclePreStopTcpSocketPort {\n\t\treturn v.Port\n\t}).(BuildStrategySpecBuildStepsLifecyclePreStopTcpSocketPortOutput)\n}", "func (o NetworkEndpointResponseOutput) Port() pulumi.IntOutput {\n\treturn o.ApplyT(func(v NetworkEndpointResponse) int { return v.Port }).(pulumi.IntOutput)\n}", "func (o InstanceMemcacheNodeOutput) Port() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v InstanceMemcacheNode) *int { return v.Port }).(pulumi.IntPtrOutput)\n}", "func (d *DefaultDriver) GetPxctlCmdOutput(n node.Node, command string) (string, error) {\n\treturn \"\", &errors.ErrNotSupported{\n\t\tType: \"Function\",\n\t\tOperation: \"GetPxctlCmdOutput()\",\n\t}\n}", "func serialOutWatcher() {\n\t// Check every 30 seconds for a serial output device.\n\tserialTicker := time.NewTicker(30 * time.Second)\n\n\tserialDev := \"/dev/serialout0\" //FIXME: This is temporary. Only one serial output device for now.\n\n\tfor {\n\t\tselect {\n\t\tcase <-serialTicker.C:\n\t\t\tif _, err := os.Stat(serialDev); !os.IsNotExist(err) { // Check if the device file exists.\n\t\t\t\tvar thisSerialConn serialConnection\n\t\t\t\t// Check if we need to start handling a new device.\n\t\t\t\tif val, ok := globalSettings.SerialOutputs[serialDev]; !ok {\n\t\t\t\t\tnewSerialOut := serialConnection{DeviceString: serialDev, Baud: 38400}\n\t\t\t\t\tlog.Printf(\"detected new serial output, setting up now: %s. Default baudrate 38400.\\n\", serialDev)\n\t\t\t\t\tif globalSettings.SerialOutputs == nil {\n\t\t\t\t\t\tglobalSettings.SerialOutputs = make(map[string]serialConnection)\n\t\t\t\t\t}\n\t\t\t\t\tglobalSettings.SerialOutputs[serialDev] = newSerialOut\n\t\t\t\t\tsaveSettings()\n\t\t\t\t\tthisSerialConn = newSerialOut\n\t\t\t\t} else {\n\t\t\t\t\tthisSerialConn = val\n\t\t\t\t}\n\t\t\t\t// Check if we need to open the connection now.\n\t\t\t\tif thisSerialConn.serialPort == nil {\n\t\t\t\t\tcfg := &serial.Config{Name: thisSerialConn.DeviceString, Baud: thisSerialConn.Baud}\n\t\t\t\t\tp, err := serial.OpenPort(cfg)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Printf(\"serialout port (%s) err: %s\\n\", thisSerialConn.DeviceString, err.Error())\n\t\t\t\t\t\tbreak // We'll attempt again in 30 seconds.\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlog.Printf(\"opened serialout: Name: %s, Baud: %d\\n\", thisSerialConn.DeviceString, thisSerialConn.Baud)\n\t\t\t\t\t}\n\t\t\t\t\t// Save the serial port connection.\n\t\t\t\t\tthisSerialConn.serialPort = p\n\t\t\t\t\tglobalSettings.SerialOutputs[serialDev] = thisSerialConn\n\t\t\t\t}\n\t\t\t}\n\n\t\tcase b := <-serialOutputChan:\n\t\t\tif val, ok := globalSettings.SerialOutputs[serialDev]; ok {\n\t\t\t\tif val.serialPort != nil {\n\t\t\t\t\t_, err := val.serialPort.Write(b)\n\t\t\t\t\tif err != nil { // Encountered an error in writing to the serial port. Close it and set Serial_out_enabled.\n\t\t\t\t\t\tlog.Printf(\"serialout (%s) port err: %s. Closing port.\\n\", val.DeviceString, err.Error())\n\t\t\t\t\t\tval.serialPort.Close()\n\t\t\t\t\t\tval.serialPort = nil\n\t\t\t\t\t\tglobalSettings.SerialOutputs[serialDev] = val\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "func (o SSLHealthCheckOutput) Port() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v SSLHealthCheck) *int { return v.Port }).(pulumi.IntPtrOutput)\n}", "func (out *TransferableOutput) Output() Transferable { return out.Out }", "func (b *BluetoothAdapter) Port() string { return b.portName }", "func (o GroupContainerLivenessProbeHttpGetOutput) Port() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v GroupContainerLivenessProbeHttpGet) *int { return v.Port }).(pulumi.IntPtrOutput)\n}", "func (o ClusterBuildStrategySpecBuildStepsLivenessProbeHttpGetOutput) Port() ClusterBuildStrategySpecBuildStepsLivenessProbeHttpGetPortOutput {\n\treturn o.ApplyT(func(v ClusterBuildStrategySpecBuildStepsLivenessProbeHttpGet) ClusterBuildStrategySpecBuildStepsLivenessProbeHttpGetPort {\n\t\treturn v.Port\n\t}).(ClusterBuildStrategySpecBuildStepsLivenessProbeHttpGetPortOutput)\n}", "func (p *CommandToParams) OutParam() *scipipe.OutParamPort { return p.OutParamPort(\"param\") }", "func (o SRVRecordRecordOutput) Port() pulumi.IntOutput {\n\treturn o.ApplyT(func(v SRVRecordRecord) int { return v.Port }).(pulumi.IntOutput)\n}", "func BindingSerialPort(port, protocol string, baudrate, slaveid, timeout int32) error {\n\tpmcli := pmnet.GetClient()\n\tpmparentctx := pmnet.GetRootContext()\n\tpmtimeout := pmnet.GetTimeout()\n\n\tif pmcli == nil {\n\t\treturn fmt.Errorf(\"port client unavailable\")\n\t}\n\n\tctx, cancel := context.WithTimeout(pmparentctx, time.Second*pmtimeout)\n\tdefer cancel()\n\n\tvar p = public.ModbusPayload{\n\t\tBaudRate: baudrate,\n\t\tSlaveid: slaveid,\n\t\tTimeout: timeout,\n\t}\n\n\tpayload, err := json.Marshal(p)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"encode payload failed\")\n\t}\n\n\t// pmcli := pb.NewPortClient(pmconn)\n\tr, err := pmcli.Binding(ctx, &pb.BindingRequest{\n\t\tPort: port,\n\t\tProtocol: protocol,\n\t\tPayload: string(payload),\n\t})\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not binding, errmsg[%v]\", err)\n\t}\n\n\tif r.Status != public.StatusOK {\n\t\treturn fmt.Errorf(\"binding failed, result[%v]\", r.Message)\n\t}\n\n\treturn nil\n}", "func (o TCPHealthCheckResponseOutput) Port() pulumi.IntOutput {\n\treturn o.ApplyT(func(v TCPHealthCheckResponse) int { return v.Port }).(pulumi.IntOutput)\n}", "func (o ClusterBuildStrategySpecBuildStepsReadinessProbeTcpSocketOutput) Port() ClusterBuildStrategySpecBuildStepsReadinessProbeTcpSocketPortOutput {\n\treturn o.ApplyT(func(v ClusterBuildStrategySpecBuildStepsReadinessProbeTcpSocket) ClusterBuildStrategySpecBuildStepsReadinessProbeTcpSocketPort {\n\t\treturn v.Port\n\t}).(ClusterBuildStrategySpecBuildStepsReadinessProbeTcpSocketPortOutput)\n}", "func (r *Cluster) Port() pulumi.IntOutput {\n\treturn (pulumi.IntOutput)(r.s.State[\"port\"])\n}", "func (o *JsonWireguardInterfaceAllOf) GetPort() string {\n\tif o == nil || o.Port == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Port\n}", "func (c parser) GetPort() string {\n\treturn \"0x0000\"\n}", "func (o ClusterBuildStrategySpecBuildStepsStartupProbeTcpSocketOutput) Port() ClusterBuildStrategySpecBuildStepsStartupProbeTcpSocketPortOutput {\n\treturn o.ApplyT(func(v ClusterBuildStrategySpecBuildStepsStartupProbeTcpSocket) ClusterBuildStrategySpecBuildStepsStartupProbeTcpSocketPort {\n\t\treturn v.Port\n\t}).(ClusterBuildStrategySpecBuildStepsStartupProbeTcpSocketPortOutput)\n}", "func (o TargetGroupPtrOutput) Port() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *TargetGroup) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Port\n\t}).(pulumi.IntPtrOutput)\n}", "func (pin Pin) Output() {\n\tgpiopinMode(pin.bcmNumber, outDirection)\n}", "func (o DnsRecordOutput) Port() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *DnsRecord) pulumi.IntPtrOutput { return v.Port }).(pulumi.IntPtrOutput)\n}", "func (o DataSourceRedshiftParametersPtrOutput) Port() pulumi.Float64PtrOutput {\n\treturn o.ApplyT(func(v *DataSourceRedshiftParameters) *float64 {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Port\n\t}).(pulumi.Float64PtrOutput)\n}", "func (o BuildStrategySpecBuildStepsLivenessProbeHttpGetOutput) Port() BuildStrategySpecBuildStepsLivenessProbeHttpGetPortOutput {\n\treturn o.ApplyT(func(v BuildStrategySpecBuildStepsLivenessProbeHttpGet) BuildStrategySpecBuildStepsLivenessProbeHttpGetPort {\n\t\treturn v.Port\n\t}).(BuildStrategySpecBuildStepsLivenessProbeHttpGetPortOutput)\n}", "func (o BuildStrategySpecBuildStepsReadinessProbeTcpSocketOutput) Port() BuildStrategySpecBuildStepsReadinessProbeTcpSocketPortOutput {\n\treturn o.ApplyT(func(v BuildStrategySpecBuildStepsReadinessProbeTcpSocket) BuildStrategySpecBuildStepsReadinessProbeTcpSocketPort {\n\t\treturn v.Port\n\t}).(BuildStrategySpecBuildStepsReadinessProbeTcpSocketPortOutput)\n}", "func (o ClusterBuildStrategySpecBuildStepsLifecyclePostStartHttpGetPtrOutput) Port() ClusterBuildStrategySpecBuildStepsLifecyclePostStartHttpGetPortPtrOutput {\n\treturn o.ApplyT(func(v *ClusterBuildStrategySpecBuildStepsLifecyclePostStartHttpGet) *ClusterBuildStrategySpecBuildStepsLifecyclePostStartHttpGetPort {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Port\n\t}).(ClusterBuildStrategySpecBuildStepsLifecyclePostStartHttpGetPortPtrOutput)\n}", "func (o AppTemplateContainerReadinessProbeOutput) Port() pulumi.IntOutput {\n\treturn o.ApplyT(func(v AppTemplateContainerReadinessProbe) int { return v.Port }).(pulumi.IntOutput)\n}", "func (out *TransferableOutput) Output() TransferableOut {\n\treturn out.Out\n}", "func GetOperationOutputForNode(ctx context.Context, deploymentID, nodeName, instanceName, interfaceName, operationName, outputName string) (string, error) {\n\tinstancesPath := path.Join(consulutil.DeploymentKVPrefix, deploymentID, \"topology/instances\", nodeName)\n\n\texist, output, err := consulutil.GetStringValue(filepath.Join(instancesPath, instanceName, \"outputs\", strings.ToLower(interfaceName), strings.ToLower(operationName), outputName))\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, consulutil.ConsulGenericErrMsg)\n\t}\n\tif exist && output != \"\" {\n\t\treturn output, nil\n\t}\n\t// Look at host node\n\tvar host string\n\thost, err = GetHostedOnNode(ctx, deploymentID, nodeName)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif host != \"\" {\n\t\t// TODO we consider that instance name is the same for the host but we should not\n\t\treturn GetOperationOutputForNode(ctx, deploymentID, host, instanceName, interfaceName, operationName, outputName)\n\t}\n\treturn \"\", nil\n}", "func (o GRPCHealthCheckResponseOutput) Port() pulumi.IntOutput {\n\treturn o.ApplyT(func(v GRPCHealthCheckResponse) int { return v.Port }).(pulumi.IntOutput)\n}", "func NewOutputter(dt, dtOut, tmax float64, nu int, outFcn OutFcnType) (o *Outputter) {\n\tif dtOut < dt {\n\t\tdtOut = dt\n\t}\n\to = new(Outputter)\n\to.Dt = dt\n\to.DtOut = dtOut\n\to.Nsteps = int(math.Ceil(tmax / o.Dt))\n\to.Tmax = float64(o.Nsteps) * o.Dt // fix tmax\n\to.Every = int(o.DtOut / o.Dt)\n\to.Nmax = int(math.Ceil(float64(o.Nsteps)/float64(o.Every))) + 1\n\to.T = make([]float64, o.Nmax)\n\to.U = Alloc(o.Nmax, nu)\n\tif outFcn != nil {\n\t\to.Fcn = outFcn\n\t\to.Fcn(o.U[o.Idx], 0)\n\t\tif o.Every > 1 {\n\t\t\to.Tidx = o.Every - 1 // use -1 here only for the first output\n\t\t}\n\t\to.Idx++\n\t}\n\treturn\n}", "func (o TCPHealthCheckPtrOutput) Port() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *TCPHealthCheck) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Port\n\t}).(pulumi.IntPtrOutput)\n}", "func SerialPorts() (allports []string, usbports []string, notecardports []string, err error) {\n\treturn serialPortEnum()\n}", "func (o ClusterBuildStrategySpecBuildStepsLifecyclePostStartTcpSocketPtrOutput) Port() ClusterBuildStrategySpecBuildStepsLifecyclePostStartTcpSocketPortPtrOutput {\n\treturn o.ApplyT(func(v *ClusterBuildStrategySpecBuildStepsLifecyclePostStartTcpSocket) *ClusterBuildStrategySpecBuildStepsLifecyclePostStartTcpSocketPort {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Port\n\t}).(ClusterBuildStrategySpecBuildStepsLifecyclePostStartTcpSocketPortPtrOutput)\n}", "func (p *MapToKeys) Out() *scipipe.OutPort { return p.OutPort(\"out\") }", "func (o HTTP2HealthCheckOutput) Port() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v HTTP2HealthCheck) *int { return v.Port }).(pulumi.IntPtrOutput)\n}", "func (o BackendAddressPoolTunnelInterfaceOutput) Port() pulumi.IntOutput {\n\treturn o.ApplyT(func(v BackendAddressPoolTunnelInterface) int { return v.Port }).(pulumi.IntOutput)\n}", "func (o BuildStrategySpecBuildStepsStartupProbeTcpSocketOutput) Port() BuildStrategySpecBuildStepsStartupProbeTcpSocketPortOutput {\n\treturn o.ApplyT(func(v BuildStrategySpecBuildStepsStartupProbeTcpSocket) BuildStrategySpecBuildStepsStartupProbeTcpSocketPort {\n\t\treturn v.Port\n\t}).(BuildStrategySpecBuildStepsStartupProbeTcpSocketPortOutput)\n}", "func (o BuildStrategySpecBuildStepsLifecyclePostStartTcpSocketPtrOutput) Port() BuildStrategySpecBuildStepsLifecyclePostStartTcpSocketPortPtrOutput {\n\treturn o.ApplyT(func(v *BuildStrategySpecBuildStepsLifecyclePostStartTcpSocket) *BuildStrategySpecBuildStepsLifecyclePostStartTcpSocketPort {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Port\n\t}).(BuildStrategySpecBuildStepsLifecyclePostStartTcpSocketPortPtrOutput)\n}", "func (o ClusterBuildStrategySpecBuildStepsLifecyclePreStopHttpGetPtrOutput) Port() ClusterBuildStrategySpecBuildStepsLifecyclePreStopHttpGetPortPtrOutput {\n\treturn o.ApplyT(func(v *ClusterBuildStrategySpecBuildStepsLifecyclePreStopHttpGet) *ClusterBuildStrategySpecBuildStepsLifecyclePreStopHttpGetPort {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Port\n\t}).(ClusterBuildStrategySpecBuildStepsLifecyclePreStopHttpGetPortPtrOutput)\n}", "func serialTraceWrite(context *Context, data []byte) {\n\tcontext.serialPort.Write(data)\n}", "func (o BuildStrategySpecBuildStepsLifecyclePreStopHttpGetPtrOutput) Port() BuildStrategySpecBuildStepsLifecyclePreStopHttpGetPortPtrOutput {\n\treturn o.ApplyT(func(v *BuildStrategySpecBuildStepsLifecyclePreStopHttpGet) *BuildStrategySpecBuildStepsLifecyclePreStopHttpGetPort {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Port\n\t}).(BuildStrategySpecBuildStepsLifecyclePreStopHttpGetPortPtrOutput)\n}", "func (o BuildStrategySpecBuildStepsLifecyclePostStartHttpGetPtrOutput) Port() BuildStrategySpecBuildStepsLifecyclePostStartHttpGetPortPtrOutput {\n\treturn o.ApplyT(func(v *BuildStrategySpecBuildStepsLifecyclePostStartHttpGet) *BuildStrategySpecBuildStepsLifecyclePostStartHttpGetPort {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Port\n\t}).(BuildStrategySpecBuildStepsLifecyclePostStartHttpGetPortPtrOutput)\n}", "func (d *portworx) GetPxctlCmdOutput(n node.Node, command string) (string, error) {\n\topts := node.ConnectionOpts{\n\t\tIgnoreError: false,\n\t\tTimeBeforeRetry: defaultRetryInterval,\n\t\tTimeout: defaultTimeout,\n\t}\n\n\treturn d.GetPxctlCmdOutputConnectionOpts(n, command, opts, true)\n}", "func (o ClusterBuildStrategySpecBuildStepsLivenessProbeTcpSocketOutput) Port() ClusterBuildStrategySpecBuildStepsLivenessProbeTcpSocketPortOutput {\n\treturn o.ApplyT(func(v ClusterBuildStrategySpecBuildStepsLivenessProbeTcpSocket) ClusterBuildStrategySpecBuildStepsLivenessProbeTcpSocketPort {\n\t\treturn v.Port\n\t}).(ClusterBuildStrategySpecBuildStepsLivenessProbeTcpSocketPortOutput)\n}", "func setDefaultConsoleSerial() (Console, Serial) {\n\t// Add mandatory console device\n\tvar serialPort uint = 0\n\tvar serialType string = \"serial\"\n\tc := Console{\n\t\tType: \"pty\",\n\t\tTarget: &ConsoleTarget{\n\t\t\tType: &serialType,\n\t\t\tPort: &serialPort,\n\t\t},\n\t}\n\n\ts := Serial{\n\t\tType: \"pty\",\n\t\tTarget: &SerialTarget{\n\t\t\tPort: &serialPort,\n\t\t},\n\t}\n\treturn c, s\n}", "func SerialDispatch() {\n\t//\tgo func() {\n\t//\t\tfor data := range serialSend {\n\t//\t\t\tactivePort.Write(data)\n\t//\t\t}\n\t//\t}()\n\n\tgo func() {\n\t\td := make([]byte, 100)\n\t\tfor {\n\t\t\tn, err := activePort.Read(d)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Error: %s\\n\", err.Error())\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif n > 0 {\n\t\t\t\tfmt.Printf(\"Received from serial %d characters: *%v* = *%s*\\n\", n, d[:n], d[:n])\n\t\t\t\tserialRecv <- d[:n]\n\t\t\t}\n\t\t\t// time.Sleep(1000 * time.Millisecond)\n\t\t}\n\t}()\n\n\tfor {\n\t\tselect {\n\n\t\tcase data, ok := <-serialRecv:\n\t\t\tif !ok {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tfmt.Printf(\"received: %s\\n\", data)\n\t\t}\n\t}\n}", "func (c *DUTControlRawUARTPortOpener) OpenPort(ctx context.Context) (serial.Port, error) {\n\tstream, err := c.Client.Console(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdata, write, err := openDUTControlConsole(stream,\n\t\t&dutcontrol.ConsoleRequest{\n\t\t\tOperation: &dutcontrol.ConsoleRequest_Open{\n\t\t\t\tOpen: &dutcontrol.ConsoleOpen{\n\t\t\t\t\tType: &dutcontrol.ConsoleOpen_RawUart{RawUart: &dutcontrol.ConsoleOpenRawUART{Uart: c.Uart, Baud: int32(c.Baud), DataLen: int32(c.DataLen)}},\n\t\t\t\t},\n\t\t\t}})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &DUTControlPort{stream, data, write, c.ReadTimeout, nil}, nil\n}", "func (b *base) GetPort() rnet.Port {\n\treturn b.port\n}" ]
[ "0.5898111", "0.57308376", "0.5629461", "0.55939573", "0.5588942", "0.5499769", "0.5443766", "0.5402271", "0.53612345", "0.5341288", "0.5336704", "0.5315254", "0.5290383", "0.5265149", "0.5259298", "0.5255912", "0.52340287", "0.52179223", "0.5215086", "0.5207342", "0.520252", "0.52013004", "0.5187313", "0.51869434", "0.5175325", "0.5163165", "0.51611185", "0.51525646", "0.51510257", "0.5146486", "0.51464087", "0.5145935", "0.5138122", "0.51378334", "0.5123969", "0.5120189", "0.51039916", "0.5021834", "0.50206643", "0.50195116", "0.501622", "0.50160724", "0.5014835", "0.50043154", "0.50003093", "0.4977098", "0.49736917", "0.4965774", "0.4965774", "0.49180514", "0.4914919", "0.4913018", "0.49059585", "0.49016857", "0.49006823", "0.48961967", "0.48792088", "0.48766813", "0.48575607", "0.48536634", "0.48309353", "0.48222443", "0.48147744", "0.4811547", "0.4805051", "0.4800442", "0.47976038", "0.47765318", "0.47671422", "0.47623125", "0.4749504", "0.47476965", "0.47460958", "0.47338644", "0.47202513", "0.4705685", "0.46994454", "0.46891248", "0.4685225", "0.46811453", "0.46602622", "0.46583393", "0.4655889", "0.46514928", "0.46489364", "0.46484575", "0.46474546", "0.46407792", "0.4630247", "0.46181083", "0.4616359", "0.46148133", "0.46026218", "0.4601035", "0.45979378", "0.45949185", "0.45938072", "0.45865494", "0.4585029", "0.45748365" ]
0.7370546
0
GetGuestAttributes uses the override method GetGuestAttributesFn or the real implementation.
func (c *TestClient) GetGuestAttributes(project, zone, name, queryPath, variableKey string) (*compute.GuestAttributes, error) { if c.GetGuestAttributesFn != nil { return c.GetGuestAttributesFn(project, zone, name, queryPath, variableKey) } return c.client.GetGuestAttributes(project, zone, name, queryPath, variableKey) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (r Virtual_Guest) GetUserData() (resp []datatypes.Virtual_Guest_Attribute, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Virtual_Guest\", \"getUserData\", nil, &r.Options, &resp)\n\treturn\n}", "func (r Virtual_ReservedCapacityGroup_Instance) GetGuest() (resp datatypes.Virtual_Guest, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Virtual_ReservedCapacityGroup_Instance\", \"getGuest\", nil, &r.Options, &resp)\n\treturn\n}", "func (n *mockAgent) getGuestDetails(*grpc.GuestDetailsRequest) (*grpc.GuestDetailsResponse, error) {\n\treturn nil, nil\n}", "func (c *DOM) GetAttributesWithParams(v *DOMGetAttributesParams) ([]string, error) {\n\tresp, err := gcdmessage.SendCustomReturn(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: \"DOM.getAttributes\", Params: v})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar chromeData struct {\n\t\tResult struct {\n\t\t\tAttributes []string\n\t\t}\n\t}\n\n\tif resp == nil {\n\t\treturn nil, &gcdmessage.ChromeEmptyResponseErr{}\n\t}\n\n\t// test if error first\n\tcerr := &gcdmessage.ChromeErrorResponse{}\n\tjson.Unmarshal(resp.Data, cerr)\n\tif cerr != nil && cerr.Error != nil {\n\t\treturn nil, &gcdmessage.ChromeRequestErr{Resp: cerr}\n\t}\n\n\tif err := json.Unmarshal(resp.Data, &chromeData); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn chromeData.Result.Attributes, nil\n}", "func (o *LDAPIdentityProvider) GetAttributes() (value *LDAPAttributes, ok bool) {\n\tok = o != nil && o.bitmap_&4 != 0\n\tif ok {\n\t\tvalue = o.attributes\n\t}\n\treturn\n}", "func (m *ProtectGroup) GetAllowGuestUsers()(*bool) {\n val, err := m.GetBackingStore().Get(\"allowGuestUsers\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*bool)\n }\n return nil\n}", "func (f *UserSettableSymlink) VirtualGetAttributes(ctx context.Context, requested AttributesMask, attributes *Attributes) {\n\tattributes.SetFileType(filesystem.FileTypeSymlink)\n\tattributes.SetPermissions(PermissionsRead | PermissionsWrite | PermissionsExecute)\n\n\tif requested&(AttributesMaskChangeID|AttributesMaskSizeBytes) != 0 {\n\t\tvar key string\n\t\tif requested&AttributesMaskSizeBytes != 0 {\n\t\t\tpublicAuthenticationMetadata, _ := auth.AuthenticationMetadataFromContext(ctx).GetPublicProto()\n\t\t\tkey = protojson.Format(publicAuthenticationMetadata)\n\t\t}\n\n\t\tf.lock.Lock()\n\t\tif requested&AttributesMaskChangeID != 0 {\n\t\t\t// Clients may use the change ID to determine\n\t\t\t// whether the target of the symbolic link\n\t\t\t// changes. Ensure no caching is performed by\n\t\t\t// incrementing the change ID when requested.\n\t\t\tattributes.SetChangeID(f.changeID)\n\t\t\tf.changeID++\n\t\t}\n\t\tif requested&AttributesMaskSizeBytes != 0 {\n\t\t\tattributes.SetSizeBytes(uint64(len(f.targets[key])))\n\t\t}\n\t\tf.lock.Unlock()\n\t}\n}", "func (r Virtual_Guest_Network_Component) GetGuest() (resp datatypes.Virtual_Guest, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Virtual_Guest_Network_Component\", \"getGuest\", nil, &r.Options, &resp)\n\treturn\n}", "func (k *KubeClient) GetVolumeAttributes(ctx context.Context, pvName string) (map[string]string, error) {\n\tpv, err := k.getPVByName(ctx, pvName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif pv.Spec.CSI == nil {\n\t\treturn nil, errors.New(\"CSI volume attribute missing from PV\")\n\t}\n\n\treturn pv.Spec.CSI.VolumeAttributes, nil\n}", "func (o *ReservationModel) GetAdditionalGuests() []GuestModel {\n\tif o == nil || o.AdditionalGuests == nil {\n\t\tvar ret []GuestModel\n\t\treturn ret\n\t}\n\treturn *o.AdditionalGuests\n}", "func (r Virtual_Guest_Block_Device_Template_Group) GetEncryptionAttributes() (resp []string, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Virtual_Guest_Block_Device_Template_Group\", \"getEncryptionAttributes\", nil, &r.Options, &resp)\n\treturn\n}", "func (d *cudaDevice) GetAttributes() (map[string]interface{}, error) {\n\treturn nil, fmt.Errorf(\"GetAttributes is not supported for CUDA devices\")\n}", "func GetGuest(c *gin.Context) *group.Guest {\n\treturn c.MustGet(\"guest\").(*group.Guest)\n}", "func (chatRoom ChatRoom) getGuests() map[string]Guest {\n return chatRoom.guests\n}", "func (c CredentialService) GetAttributes() string {\n\treturn c.Attributes\n}", "func (attestedClaim *AttestedClaim) getAttributes() ([]*Attribute, error) {\n\tbInts := attestedClaim.getRawAttributes()\n\tattributes, err := BigIntsToAttributes(bInts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsorted := sort.SliceIsSorted(attributes, func(p, q int) bool {\n\t\treturn strings.Compare(attributes[p].Name, attributes[q].Name) < 0\n\t})\n\tif !sorted {\n\t\treturn nil, errors.New(\"expected attributes inside credential to be sorted\")\n\t}\n\treturn attributes, nil\n}", "func (o AttachedDiskOutput) GuestOsFeatures() GuestOsFeatureArrayOutput {\n\treturn o.ApplyT(func(v AttachedDisk) []GuestOsFeature { return v.GuestOsFeatures }).(GuestOsFeatureArrayOutput)\n}", "func (p *NoteStoreClient) GetResourceAttributes(ctx context.Context, authenticationToken string, guid Types.Guid) (r *Types.ResourceAttributes, userException *Errors.EDAMUserException, systemException *Errors.EDAMSystemException, notFoundException *Errors.EDAMNotFoundException, err error) {\n\tif err = p.sendGetResourceAttributes(ctx, authenticationToken, guid); err != nil {\n\t\treturn\n\t}\n\treturn p.recvGetResourceAttributes(ctx)\n}", "func (c *jsiiProxy_CfnVolume) GetAtt(attributeName *string) awscdk.Reference {\n\tvar returns awscdk.Reference\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getAtt\",\n\t\t[]interface{}{attributeName},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "func GetAllGuestCondition(query map[string]string, fields string, sortby []string, order []string,\n\toffset int64, limit int64) (listGuest []Guests, msgErr string) {\n\to := orm.NewOrm()\n\tsql, sqlWhere := RebuildQueryListGuest(query, fields)\n\t// order by:\n\tsortFields, sortErr := MakeOrderForSqlQuery(sortby, order)\n\tif sortErr != nil {\n\t\treturn nil, sortErr.Error()\n\t}\n\tsqlWhereString := sqlWhere.String()\n\tif sortFields != \"\" {\n\t\tsqlWhereString += \" Order By \" + sortFields\n\t}\n\n\tif limit > 0 {\n\t\tsqlWhereString += \" LIMIT \" + fmt.Sprint(limit)\n\t}\n\n\tif offset > 0 {\n\t\tsqlWhereString += \" OFFSET \" + fmt.Sprint(offset)\n\t}\n\tsqlBaseString := sql.String()\n\tsqlBaseString = sqlBaseString + \" \" + sqlWhereString\n\t_, err := o.Raw(sqlBaseString).QueryRows(&listGuest)\n\tif err != nil {\n\t\treturn nil, \"Get list failure\"\n\t}\n\treturn listGuest, \"\"\n}", "func osdVolumeAttributes(v *api.Volume) map[string]string {\n\treturn map[string]string{\n\t\tapi.SpecParent: v.GetSource().GetParent(),\n\t\tapi.SpecSecure: fmt.Sprintf(\"%v\", v.GetSpec().GetEncrypted()),\n\t\tapi.SpecShared: fmt.Sprintf(\"%v\", v.GetSpec().GetShared()),\n\t\t\"readonly\": fmt.Sprintf(\"%v\", v.GetReadonly()),\n\t\t\"attached\": v.AttachedState.String(),\n\t\t\"state\": v.State.String(),\n\t\t\"error\": v.GetError(),\n\t}\n}", "func (m *Smart) getAttributes(acc telegraf.Accumulator, devices []string) {\n\tvar wg sync.WaitGroup\n\twg.Add(len(devices))\n\n\tfor _, device := range devices {\n\t\tgo gatherDisk(acc, m.UseSudo, m.Attributes, m.Path, m.Nocheck, device, &wg)\n\t}\n\n\twg.Wait()\n}", "func (eClass *eClassImpl) GetEAttributes() EList {\n\teClass.getInitializers().initEAttributes()\n\treturn eClass.eAttributes\n}", "func (m *ProtectGroup) GetAllowEmailFromGuestUsers()(*bool) {\n val, err := m.GetBackingStore().Get(\"allowEmailFromGuestUsers\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*bool)\n }\n return nil\n}", "func (e *Environment) Attr(environmentName, attr string) ([]Attr, error) {\n\n\targkeys := []string{\"attr\"}\n\targvalues := []interface{}{attr}\n\tbaseCommand := fmt.Sprintf(\"list environment attr %s\", environmentName)\n\n\tc, err := cmd.ArgsExpander(baseCommand, argkeys, argvalues)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tb, err := cmd.RunCommand(c)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tattrs := []Attr{}\n\terr = json.Unmarshal(b, &attrs)\n\tif err != nil {\n\t\t// it may have been just an empty output from the Frontend\n\t\tnullOutput := NullOutput{}\n\t\terr = json.Unmarshal(b, &nullOutput)\n\t\tif err != nil {\n\t\t\t// if we still can't recognize the output, return an error\n\t\t\treturn nil, err\n\t\t}\n\t\treturn attrs, err\n\t}\n\treturn attrs, err\n}", "func (a *ManagementApiService) GetAttributes(ctx _context.Context) apiGetAttributesRequest {\n\treturn apiGetAttributesRequest{\n\t\tapiService: a,\n\t\tctx: ctx,\n\t}\n}", "func GetGuest(guestUUID string) (*entities.Guest, error) {\n\tapp.InitDB()\n\tquery := `\n\t\tSELECT\n\t\t\tuuid,\n\t\t\tfirst_name,\n\t\t\tlast_name,\n\t\t\temail,\n\t\t\tparty_uuid,\n\t\t\tattending,\n\t\t\tdietary_restriction,\n\t\t\tallergy,\n\t\t\tspecial_request\n\t\tFROM guest\n\t\tWHERE uuid = ?`\n\trevel.INFO.Printf(\"Query -> %s\", query)\n\n\trow := app.DB.QueryRow(query, guestUUID)\n\tvar guest entities.Guest\n\terr := row.Scan(\n\t\t&guest.UUID,\n\t\t&guest.FirstName,\n\t\t&guest.LastName,\n\t\t&guest.Email,\n\t\t&guest.PartyUUID,\n\t\t&guest.Attending,\n\t\t&guest.DietaryRestriction,\n\t\t&guest.Allergy,\n\t\t&guest.SpecialRequest,\n\t)\n\tif err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\tm := fmt.Sprintf(\"No party uuid found for guest -> Guest: %s\", guestUUID)\n\t\t\treturn &guest, errors.New(m)\n\t\t}\n\t\tm := fmt.Sprintf(\"Database error %s -> Guest: %s\", err, guestUUID)\n\t\treturn &guest, errors.New(m)\n\t}\n\n\trevel.INFO.Printf(\"Query result -> guestUUID: %s -> %s\", *guest.UUID, guest)\n\treturn &guest, nil\n}", "func (p *NoteStoreClient) GetResourceAttributes(ctx context.Context, authenticationToken string, guid GUID) (r *ResourceAttributes, err error) {\n var _args155 NoteStoreGetResourceAttributesArgs\n _args155.AuthenticationToken = authenticationToken\n _args155.GUID = guid\n var _result156 NoteStoreGetResourceAttributesResult\n if err = p.Client_().Call(ctx, \"getResourceAttributes\", &_args155, &_result156); err != nil {\n return\n }\n switch {\n case _result156.UserException!= nil:\n return r, _result156.UserException\n case _result156.SystemException!= nil:\n return r, _result156.SystemException\n case _result156.NotFoundException!= nil:\n return r, _result156.NotFoundException\n }\n\n return _result156.GetSuccess(), nil\n}", "func (c *Client) GetGuest(id string) (*Guest, error) {\n\tvar g Guest\n\tif err := c.doRequest(\"GET\", filepath.Join(\"/guests\", id), nil, http.StatusOK, &g); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &g, nil\n}", "func (r Virtual_DedicatedHost) GetGuests() (resp []datatypes.Virtual_Guest, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Virtual_DedicatedHost\", \"getGuests\", nil, &r.Options, &resp)\n\treturn\n}", "func (obj *Edge) GetAttributes() ([]types.TGAttribute, types.TGError) {\n\treturn obj.getAttributes()\n}", "func GetVirtualGuestService(sess *session.Session) Virtual_Guest {\n\treturn Virtual_Guest{Session: sess}\n}", "func (o *UserInvitationResponseData) GetAttributes() UserInvitationDataAttributes {\n\tif o == nil || o.Attributes == nil {\n\t\tvar ret UserInvitationDataAttributes\n\t\treturn ret\n\t}\n\treturn *o.Attributes\n}", "func (o AttachedDiskInitializeParamsOutput) GuestOsFeatures() GuestOsFeatureArrayOutput {\n\treturn o.ApplyT(func(v AttachedDiskInitializeParams) []GuestOsFeature { return v.GuestOsFeatures }).(GuestOsFeatureArrayOutput)\n}", "func (r Virtual_Storage_Repository) GetGuests() (resp []datatypes.Virtual_Guest, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Virtual_Storage_Repository\", \"getGuests\", nil, &r.Options, &resp)\n\treturn\n}", "func (r Virtual_Host) GetGuests() (resp []datatypes.Virtual_Guest, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Virtual_Host\", \"getGuests\", nil, &r.Options, &resp)\n\treturn\n}", "func (o AttachedDiskResponseOutput) GuestOsFeatures() GuestOsFeatureResponseArrayOutput {\n\treturn o.ApplyT(func(v AttachedDiskResponse) []GuestOsFeatureResponse { return v.GuestOsFeatures }).(GuestOsFeatureResponseArrayOutput)\n}", "func (o *LDAPIdentityProvider) Attributes() *LDAPAttributes {\n\tif o != nil && o.bitmap_&4 != 0 {\n\t\treturn o.attributes\n\t}\n\treturn nil\n}", "func (m *Device) GetAttributes() (val map[string]interface{}, set bool) {\n\tif m.Attributes == nil {\n\t\treturn\n\t}\n\n\treturn *m.Attributes, true\n}", "func (o FioSpecVolumeVolumeSourceCsiOutput) VolumeAttributes() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v FioSpecVolumeVolumeSourceCsi) map[string]string { return v.VolumeAttributes }).(pulumi.StringMapOutput)\n}", "func (o *DriveAta) SmartGetAttributes(ctx context.Context, options map[string]dbus.Variant) (attributes []struct {\n\tV0 byte\n\tV1 string\n\tV2 uint16\n\tV3 int32\n\tV4 int32\n\tV5 int32\n\tV6 int64\n\tV7 int32\n\tV8 map[string]dbus.Variant\n}, err error) {\n\terr = o.object.CallWithContext(ctx, InterfaceDriveAta+\".SmartGetAttributes\", 0, options).Store(&attributes)\n\treturn\n}", "func (*FileSystemBase) Getattr(path string, stat *Stat_t, fh uint64) int {\n\treturn -ENOSYS\n}", "func (m *CommunicationsIdentitySet) GetGuest()(Identityable) {\n val, err := m.GetBackingStore().Get(\"guest\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(Identityable)\n }\n return nil\n}", "func (gs *GuestService) GetGuest(name string) (*datatypes.Virtual_Guest, error) {\n\tguests, err := gs.listGuest()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, guest := range guests {\n\t\t// FIXME: how to unique identify one guest\n\t\tif *guest.Hostname == name {\n\t\t\tklog.Infof(\"Found guest with ID %d for %q\", *guest.Id, name)\n\t\t\treturn &guest, nil\n\t\t}\n\t}\n\treturn nil, nil\n}", "func (m *User) GetOnPremisesExtensionAttributes()(OnPremisesExtensionAttributesable) {\n return m.onPremisesExtensionAttributes\n}", "func (b *Base) GetAttributeValue(req *GetAttributeValueReq) (*GetAttributeValueResp, error) {\n\treturn nil, ErrFunctionNotSupported\n}", "func (*entityImpl) ExtendedAttributes(p graphql.ResolveParams) (interface{}, error) {\n\tentity := p.Source.(*types.Entity)\n\treturn wrapExtendedAttributes(entity.ExtendedAttributes), nil\n}", "func (o *VirtualizationVmwareVirtualMachineAllOf) GetCustomAttributes() []string {\n\tif o == nil {\n\t\tvar ret []string\n\t\treturn ret\n\t}\n\treturn o.CustomAttributes\n}", "func (a *AliyunInstanceAttribute) fetchAttributes(targetReader TargetReader, nodeName string) {\n\ta.ShootName = GetFromTargetInfo(targetReader, \"shootTechnicalID\")\n\tvar err error\n\tif a.FlagProviderID != \"\" {\n\t\ta.InstanceID = a.FlagProviderID\n\t} else {\n\t\ta.InstanceID, err = fetchAlicloudInstanceIDByNodeName(nodeName)\n\t\tcheckError(err)\n\t}\n\n\tres, err := ExecCmdReturnOutput(\"bash\", \"-c\", \"aliyun ecs DescribeInstanceAttribute --InstanceId=\"+a.InstanceID)\n\tcheckError(err)\n\tdecodedQuery := decodeAndQueryFromJSONString(res)\n\n\ta.RegionID, err = decodedQuery.String(\"RegionId\")\n\tcheckError(err)\n\ta.ZoneID, err = decodedQuery.String(\"ZoneId\")\n\tcheckError(err)\n\ta.VpcID, err = decodedQuery.String(\"VpcAttributes\", \"VpcId\")\n\tcheckError(err)\n\ta.VSwitchID, err = decodedQuery.String(\"VpcAttributes\", \"VSwitchId\")\n\tcheckError(err)\n\ta.ImageID, err = decodedQuery.String(\"ImageId\")\n\tcheckError(err)\n\tips, err := decodedQuery.ArrayOfStrings(\"VpcAttributes\", \"PrivateIpAddress\", \"IpAddress\")\n\tcheckError(err)\n\ta.PrivateIP = ips[0]\n\ta.BastionSecurityGroupName = a.ShootName + \"-bsg\"\n\ta.BastionInstanceName = a.ShootName + \"-bastion\"\n\n\ta.InstanceChargeType = \"PostPaid\"\n\ta.InternetChargeType = \"PayByTraffic\"\n\ta.InternetMaxBandwidthIn = \"10\"\n\ta.InternetMaxBandwidthOut = \"100\"\n\ta.IoOptimized = \"optimized\"\n\ta.InstanceType = a.getMinimumInstanceSpec()\n}", "func (o IopingSpecVolumeVolumeSourceCsiOutput) VolumeAttributes() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v IopingSpecVolumeVolumeSourceCsi) map[string]string { return v.VolumeAttributes }).(pulumi.StringMapOutput)\n}", "func (r Virtual_Guest) GetAverageDailyPrivateBandwidthUsage() (resp datatypes.Float64, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Virtual_Guest\", \"getAverageDailyPrivateBandwidthUsage\", nil, &r.Options, &resp)\n\treturn\n}", "func (o *Service) GetAttributes() map[string]string {\n\tif o == nil || o.Attributes == nil {\n\t\tvar ret map[string]string\n\t\treturn ret\n\t}\n\treturn *o.Attributes\n}", "func (con *GuestHandler) GetGuestList(c echo.Context) (err error) {\n\treqID := c.Response().Header().Get(echo.HeaderXRequestID)\n\tres := getGuestListResponse{}\n\tlimit, offset, err := getLimitAndOffest(c)\n\tif err != nil {\n\t\tzap.L().Error(errInvalidRequest.Error(), zap.Error(err))\n\t\treturn c.JSON(http.StatusBadRequest, presenter.ErrResp(reqID, err))\n\t}\n\t// Query database\n\tdata, err := con.dbSvc.ListRSVPGuests(c.Request().Context(), limit, offset)\n\tif err != nil {\n\t\t// Error while querying database\n\t\treturn c.JSON(http.StatusInternalServerError, presenter.ErrResp(reqID, err))\n\t}\n\t// Map response fields\n\tvar guests []*presenter.Guest\n\tfor _, d := range data {\n\t\tguests = append(guests, &presenter.Guest{\n\t\t\tID: d.ID,\n\t\t\tName: d.Name,\n\t\t\tTableID: d.TableID,\n\t\t\tAccompanyingGuests: d.TotalGuests,\n\t\t})\n\t}\n\tres.Guests = guests\n\t// Return ok\n\treturn c.JSON(http.StatusOK, res)\n}", "func (o *Giveaway) GetAttributes() map[string]interface{} {\n\tif o == nil || o.Attributes == nil {\n\t\tvar ret map[string]interface{}\n\t\treturn ret\n\t}\n\treturn *o.Attributes\n}", "func (o *CatalogProductAttributeManagementV1GetAttributesGetParams) WithHTTPClient(client *http.Client) *CatalogProductAttributeManagementV1GetAttributesGetParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "func (o AttachedDiskInitializeParamsResponseOutput) GuestOsFeatures() GuestOsFeatureResponseArrayOutput {\n\treturn o.ApplyT(func(v AttachedDiskInitializeParamsResponse) []GuestOsFeatureResponse { return v.GuestOsFeatures }).(GuestOsFeatureResponseArrayOutput)\n}", "func (a *AzureInfoer) GetAttributeValues(attribute string) (productinfo.AttrValues, error) {\n\n\tlog.Debugf(\"getting %s values\", attribute)\n\n\tvalues := make(productinfo.AttrValues, 0)\n\tvalueSet := make(map[productinfo.AttrValue]interface{})\n\n\tregions, err := a.GetRegions()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor region := range regions {\n\t\tvmSizes, err := a.vmSizesClient.List(context.TODO(), region)\n\t\tif err != nil {\n\t\t\tlog.WithError(err).Warnf(\"[Azure] couldn't get VM sizes in region %s\", region)\n\t\t\tcontinue\n\t\t}\n\t\tfor _, v := range *vmSizes.Value {\n\t\t\tswitch attribute {\n\t\t\tcase productinfo.Cpu:\n\t\t\t\tvalueSet[productinfo.AttrValue{\n\t\t\t\t\tValue: float64(*v.NumberOfCores),\n\t\t\t\t\tStrValue: fmt.Sprintf(\"%v\", *v.NumberOfCores),\n\t\t\t\t}] = \"\"\n\t\t\tcase productinfo.Memory:\n\t\t\t\tvalueSet[productinfo.AttrValue{\n\t\t\t\t\tValue: float64(*v.MemoryInMB) / 1024,\n\t\t\t\t\tStrValue: fmt.Sprintf(\"%v\", *v.MemoryInMB),\n\t\t\t\t}] = \"\"\n\t\t\t}\n\t\t}\n\t}\n\n\tfor attr := range valueSet {\n\t\tvalues = append(values, attr)\n\t}\n\n\tlog.Debugf(\"found %s values: %v\", attribute, values)\n\treturn values, nil\n}", "func GetGuestList(resp http.ResponseWriter, req *http.Request, db *sql.DB) {\n\tvar limit, offset int\n\n\t// Get the request parameters\n\tparams := req.URL.Query()\n\tlimitVal := params.Get(\"limit\")\n\toffsetVal := params.Get(\"offset\")\n\n\t// Check if limit and offset are in the request\n\tif limitVal != \"\" {\n\t\tlimit, _ = strconv.Atoi(limitVal)\n\t} else {\n\t\tlimit = model.LIMIT\n\t}\n\tif offsetVal != \"\" {\n\t\toffset, _ = strconv.Atoi(offsetVal)\n\t} else {\n\t\toffset = model.OFFSET\n\t}\n\n\t// Retrieve all guests\n\tguestList, err := databse.GetAllGuests(db, limit, offset)\n\tif err != nil {\n\t\tencodeResponse(resp, map[string]string{\"error\": err.Error()}, http.StatusInternalServerError)\n\t\treturn\n\t}\n\t// Encode the response\n\tencodeResponse(resp, map[string][]model.GuestsList{\"guests\": guestList}, http.StatusOK)\n}", "func (attestedClaim *AttestedClaim) getRawAttributes() []*big.Int {\n\treturn attestedClaim.Credential.Attributes[1:]\n}", "func (s *Scheduler) GetHostAttributes(para *typesplugin.HostPluginParameter) (map[string]*typesplugin.HostAttributes, error) {\n\tif s.pluginManager == nil {\n\t\treturn nil, fmt.Errorf(\"pluginManager is nil\")\n\t}\n\n\treturn s.pluginManager.GetHostAttributes(para)\n}", "func (a *Client) GetAttributes(params *GetAttributesParams) (*GetAttributesOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetAttributesParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"get_attributes\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/api/rest/v1/attributes\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &GetAttributesReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*GetAttributesOK)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\t// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue\n\tmsg := fmt.Sprintf(\"unexpected success response for get_attributes: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "func GetVirtualization(rw http.ResponseWriter) error {\n\tsystem, role, err := host.Virtualization()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tv := struct {\n\t\tSystem string\n\t\tRole string\n\t}{\n\t\tsystem,\n\t\trole,\n\t}\n\n\treturn share.JSONResponse(v, rw)\n}", "func (o FioSpecVolumeVolumeSourceCsiPtrOutput) VolumeAttributes() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v *FioSpecVolumeVolumeSourceCsi) map[string]string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.VolumeAttributes\n\t}).(pulumi.StringMapOutput)\n}", "func (m *IdentityUserFlowAttributeAssignment) GetUserAttributeValues()([]UserAttributeValuesItemable) {\n return m.userAttributeValues\n}", "func (o SavedAttachedDiskResponseOutput) GuestOsFeatures() GuestOsFeatureResponseArrayOutput {\n\treturn o.ApplyT(func(v SavedAttachedDiskResponse) []GuestOsFeatureResponse { return v.GuestOsFeatures }).(GuestOsFeatureResponseArrayOutput)\n}", "func (o AttachedDiskInitializeParamsPtrOutput) GuestOsFeatures() GuestOsFeatureArrayOutput {\n\treturn o.ApplyT(func(v *AttachedDiskInitializeParams) []GuestOsFeature {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.GuestOsFeatures\n\t}).(GuestOsFeatureArrayOutput)\n}", "func GetAttributesForFunction(fn *fv1.Function) []attribute.KeyValue {\n\tif fn == nil {\n\t\treturn []attribute.KeyValue{}\n\t}\n\tattrs := []attribute.KeyValue{\n\t\t{Key: \"function-name\", Value: attribute.StringValue(fn.Name)},\n\t\t{Key: \"function-namespace\", Value: attribute.StringValue(fn.Namespace)},\n\t}\n\tif fn.Spec.Environment.Name != \"\" {\n\t\tattrs = append(attrs,\n\t\t\tattribute.KeyValue{Key: \"environment-name\", Value: attribute.StringValue(fn.Spec.Environment.Name)},\n\t\t\tattribute.KeyValue{Key: \"environment-namespace\", Value: attribute.StringValue(fn.Spec.Environment.Namespace)})\n\t}\n\treturn attrs\n}", "func (m *SearchAttributesManager) GetSearchAttributes(\n\tindexName string,\n\tforceRefreshCache bool,\n) (map[string]enumspb.IndexedValueType, error) {\n\n\tnow := m.timeSource.Now()\n\tsaCache := m.cache.Load().(searchAttributesCache)\n\n\tif m.needRefreshCache(saCache, forceRefreshCache, now) {\n\t\tm.cacheUpdateMutex.Lock()\n\t\tsaCache = m.cache.Load().(searchAttributesCache)\n\t\tif m.needRefreshCache(saCache, forceRefreshCache, now) {\n\t\t\tvar err error\n\t\t\tsaCache, err = m.refreshCache(saCache, now)\n\t\t\tif err != nil {\n\t\t\t\tm.cacheUpdateMutex.Unlock()\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tm.cacheUpdateMutex.Unlock()\n\t}\n\n\tvar searchAttributes map[string]enumspb.IndexedValueType\n\tif indexSearchAttributes, ok := saCache.searchAttributes[indexName]; ok {\n\t\tsearchAttributes = indexSearchAttributes.GetSearchAttributes()\n\t}\n\tif searchAttributes == nil {\n\t\treturn map[string]enumspb.IndexedValueType{}, nil\n\t}\n\treturn searchAttributes, nil\n}", "func (h *Handler) getDeveloperAttributes(c *gin.Context) handlerResponse {\n\n\tdeveloper, err := h.service.Developer.Get(c.Param(developerParameter))\n\tif err != nil {\n\t\treturn handleError(err)\n\t}\n\treturn handleOKAttributes(developer.Attributes)\n}", "func (o IopingSpecVolumeVolumeSourceCsiPtrOutput) VolumeAttributes() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v *IopingSpecVolumeVolumeSourceCsi) map[string]string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.VolumeAttributes\n\t}).(pulumi.StringMapOutput)\n}", "func (k2h *K2hash) GetAttrs(k string) ([]Attr, error) {\n\t// 1. retrieve an attribute using k2h_get_attrs\n\t// bool k2h_get_attrs(k2h_h handle, const unsigned char* pkey, size_t keylength, PK2HATTRPCK* ppattrspck, int* pattrspckcnt)\n\tcKey := C.CBytes([]byte(k))\n\tdefer C.free(unsafe.Pointer(cKey))\n\tvar attrpack C.PK2HATTRPCK\n\tvar attrpackCnt C.int\n\tok := C.k2h_get_attrs(\n\t\tk2h.handle,\n\t\t(*C.uchar)(cKey),\n\t\tC.size_t(len([]byte(k))+1), // plus one for a null termination\n\t\t&attrpack,\n\t\t&attrpackCnt,\n\t)\n\tdefer C.k2h_free_attrpack(attrpack, attrpackCnt) // free the memory for the keypack for myself(GC doesn't know the area)\n\n\tif ok == false {\n\t\tfmt.Println(\"C.k2h_get_attrs returns false\")\n\t\treturn []Attr{}, fmt.Errorf(\"C.k2h_get_attrs() = %v\", ok)\n\t} else if attrpackCnt == 0 {\n\t\tfmt.Printf(\"attrpackLen is zero\")\n\t\treturn []Attr{}, nil\n\t} else {\n\t\tfmt.Printf(\"attrpackLen is %v\\n\", attrpackCnt)\n\t}\n\t// 2. copy an attribute data to a slice\n\tvar CAttrs C.PK2HATTRPCK = attrpack\n\tcount := (int)(attrpackCnt)\n\tslice := (*[1 << 28]C.K2HATTRPCK)(unsafe.Pointer(CAttrs))[:count:count]\n\tfmt.Printf(\"slice size is %v\\n\", len(slice))\n\t//\n\tattrs := make([]Attr, count) // copy\n\tfor i, data := range slice {\n\t\t// copy the data with len-1 length, which exclude a null termination.\n\t\tattrkey := C.GoBytes(unsafe.Pointer(data.pkey), (C.int)(data.keylength-1))\n\t\tfmt.Printf(\"i %v data %T pkey %v length %v attrkey %v\\n\", i, data, data.pkey, data.keylength, string(attrkey))\n\t\tattrval := C.GoBytes(unsafe.Pointer(data.pval), (C.int)(data.vallength-1))\n\t\tfmt.Printf(\"i %v data %T pval %v length %v attrval %v\\n\", i, data, data.pval, data.vallength, string(attrval))\n\t\t// cast bytes to a string\n\t\tattrs[i].key = string(attrkey)\n\t\tattrs[i].val = string(attrval)\n\t}\n\treturn attrs, nil\n}", "func (*CloudSnapshotAccount) AttributeSpecifications() map[string]elemental.AttributeSpecification {\n\n\treturn CloudSnapshotAccountAttributesMap\n}", "func (o *SubscriptionAttributesServiceNowAttributesResponse) GetProperties() map[string]interface{} {\n\treturn o.additionalProperties\n}", "func SysProcAttrWithCred(uid uint32, gid uint32) *syscall.SysProcAttr {\n\treturn &syscall.SysProcAttr{\n\t\tCredential: &syscall.Credential{\n\t\t\tUid: uid,\n\t\t\tGid: gid},\n\t}\n}", "func (o *VolumeModifyIterAsyncRequestAttributes) VolumeAttributes() VolumeAttributesType {\n\tvar r VolumeAttributesType\n\tif o.VolumeAttributesPtr == nil {\n\t\treturn r\n\t}\n\tr = *o.VolumeAttributesPtr\n\treturn r\n}", "func (m *IdentityUserFlowAttributeAssignment) GetUserAttribute()(IdentityUserFlowAttributeable) {\n return m.userAttribute\n}", "func Getxattr(path string, attr string, dest []byte) (sz int, err error) {\n\tvar _p0 *byte\n\t_p0, err = syscall.BytePtrFromString(path)\n\tif err != nil {\n\t\treturn\n\t}\n\tvar _p1 *byte\n\t_p1, err = syscall.BytePtrFromString(attr)\n\tif err != nil {\n\t\treturn\n\t}\n\tvar _p2 unsafe.Pointer\n\tif len(dest) > 0 {\n\t\t_p2 = unsafe.Pointer(&dest[0])\n\t} else {\n\t\tvar _zero uintptr\n\t\t_p2 = unsafe.Pointer(&_zero)\n\t}\n\tr0, _, e1 := syscall.Syscall6(syscall.SYS_GETXATTR, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(_p1)), uintptr(_p2), uintptr(len(dest)), 0, 0)\n\tsz = int(r0)\n\tif e1 != 0 {\n\t\terr = e1\n\t}\n\treturn\n}", "func (fsys *FS) Getattr(path string, stat *fuse.Stat_t, fh uint64) (errc int) {\n\tdefer fs.Trace(path, \"fh=0x%X\", fh)(\"errc=%v\", &errc)\n\tnode, errc := fsys.getNode(path, fh)\n\tif errc == 0 {\n\t\terrc = fsys.stat(node, stat)\n\t}\n\treturn\n}", "func (w *wrapper) Getattr(path string, stat *fuse.Stat_t, fd uint64) int {\n\tfi, err := w.underlying.Stat(path)\n\tif err != nil {\n\t\treturn convertError(err)\n\t}\n\tfileInfoToStat(fi, stat)\n\treturn 0\n}", "func (r Virtual_Guest) GetPrivateNetworkOnlyFlag() (resp bool, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Virtual_Guest\", \"getPrivateNetworkOnlyFlag\", nil, &r.Options, &resp)\n\treturn\n}", "func (f *fs) GetAttr(name string, context *fuse.Context) (*fuse.Attr, fuse.Status) {\n\tlog.Printf(\"GetAttr '%s'\\n\", name)\n\tvar attr *fuse.Attr\n\tswitch {\n\tcase name == \"\": // Base directory\n\t\tm, err := f.client.Sys().ListMounts()\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\tattr = f.directoryAttr(1, 0755)\n\t\t}\n\t\tattr = f.directoryAttr(len(m), 0755)\n\tcase name == \"secret\":\n\t\tattr = f.directoryAttr(1, 0755)\n\tcase name == \"sys\":\n\t\tattr = f.directoryAttr(1, 0755)\n\tcase strings.HasPrefix(name, \"secret/\"):\n\t\ts, err := f.client.Logical().Read(name)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn nil, fuse.ENOENT\n\t\t}\n\n\t\tif s == nil || s.Data == nil {\n\t\t\tattr = f.directoryAttr(1, 0755)\n\t\t} else {\n\t\t\tattr = f.secretAttr(s.Data[\"value\"].(string) + \"\\n\")\n\t\t}\n\t}\n\n\tif attr != nil {\n\t\treturn attr, fuse.OK\n\t}\n\treturn nil, fuse.ENOENT\n}", "func (c *jsiiProxy_CfnEnvironment) GetAtt(attributeName *string) awscdk.Reference {\n\tvar returns awscdk.Reference\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getAtt\",\n\t\t[]interface{}{attributeName},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "func (program Program) GetActiveAttributes() int32 {\n\tvar params int32\n\tgl.GetProgramiv(uint32(program), gl.ACTIVE_ATTRIBUTES, &params)\n\treturn params\n}", "func (c *IloClient) GetSysAttrDell() (SysAttributesData, error) {\n\n\turl := c.Hostname + \"/redfish/v1/Managers/System.Embedded.1/Attributes\"\n\n\tresp, _, _, err := queryData(c, \"GET\", url, nil)\n\tif err != nil {\n\t\treturn SysAttributesData{}, err\n\t}\n\n\tvar x SysAttrDell\n\n\tjson.Unmarshal(resp, &x)\n\n\treturn x.Attributes, nil\n\n}", "func (c *jsiiProxy_CfnInstance) GetAtt(attributeName *string) awscdk.Reference {\n\tvar returns awscdk.Reference\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getAtt\",\n\t\t[]interface{}{attributeName},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "func GetVolumeProperties(volumeName, hostName string) (string, error) {\n\tlog.Printf(\"Getting size, disk-format and attached-to-vm for volume [%s] from vm [%s] using docker cli \\n\", volumeName, hostName)\n\tcmd := dockercli.InspectVolume + volumeName + \" --format ' {{index .Status.capacity.size}} {{index .Status.diskformat}} {{index .Status \\\"attached to VM\\\"}}' | sed -e 's/<no value>/detached/' \"\n\treturn ssh.InvokeCommand(hostName, cmd)\n}", "func GetVolumeProperties(volumeName, hostName string) (string, error) {\n\tlog.Printf(\"Getting size, disk-format and attached-to-vm for volume [%s] from vm [%s] using docker cli \\n\", volumeName, hostName)\n\tcmd := dockercli.InspectVolume + volumeName + \" --format ' {{index .Status.capacity.size}} {{index .Status.diskformat}} {{index .Status \\\"attached to VM\\\"}}' | sed -e 's/<no value>/detached/' \"\n\treturn ssh.InvokeCommand(hostName, cmd)\n}", "func GuestGet(endpoint string, guestid string) (int, []byte) {\n\n\tbuffer := getEndpointwithGuests(endpoint)\n\tbuffer.WriteString(\"/\")\n\tbuffer.WriteString(guestid)\n\n\tstatus, data := hq.Get(buffer.String())\n\n\treturn status, data\n}", "func (c *jsiiProxy_CfnUserProfile) GetAtt(attributeName *string) awscdk.Reference {\n\tvar returns awscdk.Reference\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getAtt\",\n\t\t[]interface{}{attributeName},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "func GetPixelFormatAttribivARB(hdc unsafe.Pointer, iPixelFormat unsafe.Pointer, iLayerPlane unsafe.Pointer, nAttributes unsafe.Pointer, piAttributes unsafe.Pointer, piValues unsafe.Pointer) unsafe.Pointer {\n\tret, _, _ := syscall.Syscall6(gpGetPixelFormatAttribivARB, 6, uintptr(hdc), uintptr(iPixelFormat), uintptr(iLayerPlane), uintptr(nAttributes), uintptr(piAttributes), uintptr(piValues))\n\treturn (unsafe.Pointer)(ret)\n}", "func (c *DOM) GetAttributes(nodeId int) ([]string, error) {\n\tvar v DOMGetAttributesParams\n\tv.NodeId = nodeId\n\treturn c.GetAttributesWithParams(&v)\n}", "func (o *VirtualizationVmwareVirtualMachineAllOf) GetGuestState() string {\n\tif o == nil || o.GuestState == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.GuestState\n}", "func (c *CryptohomeBinary) InstallAttributesGet(ctx context.Context, attributeName string) (string, error) {\n\tout, err := c.call(ctx, \"--action=install_attributes_get\", \"--name=\"+attributeName)\n\treturn string(out), err\n}", "func (o *VolumeModifyIterAsyncRequestQuery) VolumeAttributes() VolumeAttributesType {\n\tvar r VolumeAttributesType\n\tif o.VolumeAttributesPtr == nil {\n\t\treturn r\n\t}\n\tr = *o.VolumeAttributesPtr\n\treturn r\n}", "func (n *Node) Getxattr(ctx context.Context, attr string, dest []byte) (uint32, syscall.Errno) {\n\trn := n.rootNode()\n\t// If we are not mounted with -suid, reading the capability xattr does not\n\t// make a lot of sense, so reject the request and gain a massive speedup.\n\t// See https://github.com/rfjakob/gocryptfs/issues/515 .\n\tif !rn.args.Suid && attr == xattrCapability {\n\t\t// Returning EOPNOTSUPP is what we did till\n\t\t// ca9e912a28b901387e1dbb85f6c531119f2d5ef2 \"fusefrontend: drop xattr user namespace restriction\"\n\t\t// and it did not cause trouble. Seems cleaner than saying ENODATA.\n\t\treturn 0, syscall.EOPNOTSUPP\n\t}\n\tvar data []byte\n\t// ACLs are passed through without encryption\n\tif isAcl(attr) {\n\t\tvar errno syscall.Errno\n\t\tdata, errno = n.getXAttr(attr)\n\t\tif errno != 0 {\n\t\t\treturn minus1, errno\n\t\t}\n\t} else {\n\t\t// encrypted user xattr\n\t\tcAttr, err := rn.encryptXattrName(attr)\n\t\tif err != nil {\n\t\t\treturn minus1, syscall.EIO\n\t\t}\n\t\tcData, errno := n.getXAttr(cAttr)\n\t\tif errno != 0 {\n\t\t\treturn 0, errno\n\t\t}\n\t\tdata, err = rn.decryptXattrValue(cData)\n\t\tif err != nil {\n\t\t\ttlog.Warn.Printf(\"GetXAttr: %v\", err)\n\t\t\treturn minus1, syscall.EIO\n\t\t}\n\t}\n\t// Caller passes size zero to find out how large their buffer should be\n\tif len(dest) == 0 {\n\t\treturn uint32(len(data)), 0\n\t}\n\tif len(dest) < len(data) {\n\t\treturn minus1, syscall.ERANGE\n\t}\n\tl := copy(dest, data)\n\treturn uint32(l), 0\n}", "func (o *VolumeAttributesType) VolumeTransitionAttributes() VolumeTransitionAttributesType {\n\tr := *o.VolumeTransitionAttributesPtr\n\treturn r\n}", "func (client *XenClient) VMGuestMetricsGetDisks(self string) (result map[string]string, err error) {\n\tobj, err := client.APICall(\"VM_guest_metrics.get_disks\", self)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tinterim := reflect.ValueOf(obj)\n\tresult = map[string]string{}\n\tfor _, key := range interim.MapKeys() {\n\t\tobj := interim.MapIndex(key)\n\t\tresult[key.String()] = obj.String()\n\t}\n\n\treturn\n}", "func availableGuestProtection() (guestProtection, error) {\n\tfacilities, err := CPUFacilities(procCPUInfo)\n\tif err != nil {\n\t\treturn noneProtection, err\n\t}\n\tif !facilities[seCPUFacilityBit] {\n\t\treturn noneProtection, fmt.Errorf(\"This CPU does not support Secure Execution\")\n\t}\n\n\tseCmdlinePresent, err := CheckCmdline(procKernelCmdline, seCmdlineParam, seCmdlineValues)\n\tif err != nil {\n\t\treturn noneProtection, err\n\t}\n\tif !seCmdlinePresent {\n\t\treturn noneProtection, fmt.Errorf(\"Protected Virtualization is not enabled on kernel command line! \"+\n\t\t\t\"Need %s=%s (or %s) to enable Secure Execution\",\n\t\t\tseCmdlineParam, seCmdlineValues[0], strings.Join(seCmdlineValues[1:], \", \"))\n\t}\n\n\treturn seProtection, nil\n}", "func (c *VirtLauncherClient) GetGuestInfo() (*v1.VirtualMachineInstanceGuestAgentInfo, error) {\n\tguestInfo := &v1.VirtualMachineInstanceGuestAgentInfo{}\n\n\trequest := &cmdv1.EmptyRequest{}\n\tctx, cancel := context.WithTimeout(context.Background(), shortTimeout)\n\tdefer cancel()\n\n\tgaRespose, err := c.v1client.GetGuestInfo(ctx, request)\n\tvar response *cmdv1.Response\n\tif gaRespose != nil {\n\t\tresponse = gaRespose.Response\n\t}\n\n\tif err = handleError(err, \"GetGuestInfo\", response); err != nil {\n\t\treturn guestInfo, err\n\t}\n\n\tif gaRespose.GuestInfoResponse != \"\" {\n\t\tif err := json.Unmarshal([]byte(gaRespose.GetGuestInfoResponse()), guestInfo); err != nil {\n\t\t\tlog.Log.Reason(err).Error(\"error unmarshalling guest agent response\")\n\t\t\treturn guestInfo, err\n\t\t}\n\t}\n\treturn guestInfo, nil\n}", "func (r Virtual_Host) GetLiveGuestList() (resp []datatypes.Virtual_Guest, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Virtual_Host\", \"getLiveGuestList\", nil, &r.Options, &resp)\n\treturn\n}" ]
[ "0.5825773", "0.5525496", "0.5217566", "0.519415", "0.5171167", "0.51603085", "0.51563776", "0.51337117", "0.50909925", "0.5071326", "0.5064929", "0.5057275", "0.50521857", "0.5051249", "0.5030649", "0.49819735", "0.49364066", "0.49264994", "0.4912982", "0.48820153", "0.48671857", "0.48405114", "0.48388267", "0.48363033", "0.48307788", "0.48010507", "0.4767255", "0.47526717", "0.4729341", "0.47284663", "0.4727061", "0.47228846", "0.47171482", "0.4713835", "0.47124168", "0.47101477", "0.47097987", "0.47033623", "0.46970293", "0.4680429", "0.4673028", "0.4658513", "0.4654487", "0.464777", "0.46471938", "0.46390793", "0.4629302", "0.4624778", "0.46233714", "0.461938", "0.46190986", "0.46142152", "0.46129394", "0.4606672", "0.46019658", "0.4596139", "0.45931333", "0.4585043", "0.45767242", "0.45667508", "0.45620564", "0.4561835", "0.45469788", "0.45460758", "0.45415258", "0.4505537", "0.4502228", "0.45009446", "0.44988307", "0.4492964", "0.44908994", "0.4482314", "0.44801897", "0.44715422", "0.44698852", "0.44689712", "0.44643044", "0.4461283", "0.44601977", "0.4452192", "0.44518343", "0.4445391", "0.44439983", "0.44410563", "0.4436268", "0.4435711", "0.4435711", "0.44244543", "0.4413346", "0.4403158", "0.43987003", "0.43948832", "0.43858454", "0.43858144", "0.4384591", "0.43674773", "0.4360945", "0.4355824", "0.4355183", "0.4352311" ]
0.7931164
0
InstanceStatus uses the override method InstanceStatusFn or the real implementation.
func (c *TestClient) InstanceStatus(project, zone, name string) (string, error) { if c.InstanceStatusFn != nil { return c.InstanceStatusFn(project, zone, name) } return c.client.InstanceStatus(project, zone, name) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (staticMgr *staticManager) GetInstanceStatus(ctx context.Context, host *host.Host) (CloudStatus, error) {\n\treturn StatusRunning, nil\n}", "func (o MachineInstanceTypeOutput) Status() MachineInstanceStatusPtrOutput {\n\treturn o.ApplyT(func(v MachineInstanceType) *MachineInstanceStatus { return v.Status }).(MachineInstanceStatusPtrOutput)\n}", "func (awsI *Ec2Instance) Status() error {\n\t_, err := getInstanceValues(awsI)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tawsI.Ctx.ConsoleLog(1, \"Stardog: %s\\n\", fmt.Sprintf(\"http://%s:5821\", awsI.StardogContact))\n\tawsI.Ctx.ConsoleLog(1, \"SSH: %s\\n\", awsI.BastionContact)\n\treturn nil\n}", "func toInstanceStatus(status string) *cloudprovider.InstanceStatus {\n\tstate := &cloudprovider.InstanceStatus{}\n\n\tswitch status {\n\tcase \"INSTALLING\", \"REDEPLOYING\":\n\t\tstate.State = cloudprovider.InstanceCreating\n\tcase \"DELETING\":\n\t\tstate.State = cloudprovider.InstanceDeleting\n\tcase \"READY\":\n\t\tstate.State = cloudprovider.InstanceRunning\n\tdefault:\n\t\tstate.ErrorInfo = &cloudprovider.InstanceErrorInfo{\n\t\t\tErrorClass: cloudprovider.OtherErrorClass,\n\t\t\tErrorCode: status,\n\t\t\tErrorMessage: \"error\",\n\t\t}\n\t}\n\n\treturn state\n}", "func (o InstanceOutput) Status() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Instance) pulumi.StringOutput { return v.Status }).(pulumi.StringOutput)\n}", "func (o InstanceOutput) Status() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Instance) pulumi.StringOutput { return v.Status }).(pulumi.StringOutput)\n}", "func (i *Instance) UpdateInstanceStatus(planStatus *PlanStatus, updatedTimestamp *metav1.Time) {\n\tfor k, v := range i.Status.PlanStatus {\n\t\tif v.Name == planStatus.Name {\n\t\t\tplanStatus.LastUpdatedTimestamp = updatedTimestamp\n\t\t\ti.Status.PlanStatus[k] = *planStatus\n\t\t\ti.Spec.PlanExecution.Status = planStatus.Status\n\t\t}\n\t}\n}", "func SendInstanceStatus(status string) error {\n\t// use for debug enviromnent\n\tif metavars.ServerID == \"\" {\n\t\tlog.Warnf(\"Skiped sending status to API(serverid is empty): %s\", status)\n\t\treturn nil\n\t}\n\n\tvalues := url.Values{}\n\tvalues.Set(\"instance_id\", metavars.ServerID)\n\tvalues.Set(\"stack_id\", c.getConfig().StackID)\n\tvalues.Set(\"status\", status)\n\n\terr := Post(RoutesV2.InstanceStatus, values, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (inf *meshInformer) OnPartOfServiceInstanceStatus(serviceName, instanceID string, gjsonPath GJSONPath, fn ServiceInstanceStatusFunc) error {\n\tstoreKey := layout.ServiceInstanceStatusKey(serviceName, instanceID)\n\tsyncerKey := fmt.Sprintf(\"service-instance-status-%s-%s-%s\", serviceName, instanceID, gjsonPath)\n\n\tspecFunc := func(event Event, value string) bool {\n\t\tinstanceStatus := &spec.ServiceInstanceStatus{}\n\t\tif event.EventType != EventDelete {\n\t\t\tif err := yaml.Unmarshal([]byte(value), instanceStatus); err != nil {\n\t\t\t\tlogger.Errorf(\"BUG: unmarshal %s to yaml failed: %v\", value, err)\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn fn(event, instanceStatus)\n\t}\n\n\treturn inf.onSpecPart(storeKey, syncerKey, gjsonPath, specFunc)\n}", "func (px *Paxos) Status(seq int) (Fate, interface{}) {\n\t// Your code here.\n\tif seq < px.min {\n\t\treturn Forgotten, nil\n\t}\n\n\tinstance, ok := px.getInstance(seq)\n\tif !ok {\n\t\treturn Unknown, nil\n\t}\n\treturn instance.status, instance.aValue\n}", "func (instances *instances) UpdateInstanceStatus(ctx context.Context) error {\n\trunningdeployments, err := instances.Deployments.GetWithStatus(runningStatus, 100)\n\n\tlog.WithFields(log.Fields{\n\t\t\"count\": len(runningdeployments),\n\t}).Info(\"Looking up deployments\")\n\n\tif len(runningdeployments) == 0 {\n\t\treturn nil\n\t}\n\n\tvar possibleEC2Instances []models.Deployment\n\tfor _, running := range runningdeployments {\n\t\tid := running.InstanceID\n\t\tif id == \"\" {\n\t\t\tcontinue // No instance associated with this.\n\t\t}\n\t\tpossibleEC2Instances = append(possibleEC2Instances, running)\n\t}\n\n\t// get the status of the associated EC2 instances\n\tstatuses, err := instances.Deploy.DescribeInstanceStatus(ctx, possibleEC2Instances)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tterminating := 0\n\n\t// for each deployment, if instance is terminated, send event\n\tfor _, deployment := range runningdeployments {\n\t\tstatus, found := statuses[deployment.InstanceID]\n\t\tdepStatus := deployment.Status()\n\n\t\t// if it's not found, it was terminated a long time ago, otherwise update\n\t\tif !found || status == ec2.InstanceStateNameTerminated {\n\t\t\tevent := models.DeploymentEvent{\n\t\t\t\tTimestamp: time.Now(),\n\t\t\t\tStatus: models.StatusTerminated,\n\t\t\t\tMessage: \"Instance has terminated\",\n\t\t\t\tCode: 0,\n\t\t\t}\n\n\t\t\terr = instances.AddDeploymentEvent(ctx, deployment, event)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tterminating++\n\t\t} else if status != ec2.InstanceStateNameShuttingDown && inSlice(incompleteStatuses, depStatus) {\n\t\t\t// otherwise, if an instance isn't shutting down, something went wrong.\n\t\t\t// let's ask it to shut down in order to reconcile\n\t\t\terr = instances.Deploy.StopDeployment(ctx, deployment)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tlog.WithFields(log.Fields{\n\t\t\"count\": terminating,\n\t}).Info(\"Terminated deployments\")\n\n\treturn nil\n}", "func (px *Paxos) Status(seq int) (bool, interface{}) {\n\t// Your code here.\n\tcurMin := px.Min()\n\tpx.mu.Lock()\n\tdefer px.mu.Unlock()\n\n\ttargetIns := px.instances[seq]\n\tif seq < curMin || targetIns == nil {\n\t\treturn false, nil\n\t} else {\n\t\t//debug\n\t\t// fmt.Printf(\"Status: isDecided=%t, va=%v, me=%d, seq %d\\n\", targetIns.isDecided, targetIns.vDecided, px.me, seq)\n\t\treturn targetIns.isDecided, targetIns.vDecided\n\t}\n}", "func lookupAppInstanceStatus(ctx *zedmanagerContext, key string) *types.AppInstanceStatus {\n\n\tpub := ctx.pubAppInstanceStatus\n\tst, _ := pub.Get(key)\n\tif st == nil {\n\t\tlog.Tracef(\"lookupAppInstanceStatus(%s) not found\", key)\n\t\treturn nil\n\t}\n\tstatus := st.(types.AppInstanceStatus)\n\treturn &status\n}", "func handleAppInstanceStatusModify(ctxArg interface{}, key string,\n\tstatusArg interface{}, oldStatusArg interface{}) {\n\tctx := ctxArg.(*zedmanagerContext)\n\tpublishAppInstanceSummary(ctx)\n}", "func (px *Paxos) Status(seq int) (bool, interface{}) {\n\t//DPrintf(\"Status(%d)\\n\", seq)\n\n\tif pi, ok := px.instances[seq]; ok {\n\t\treturn pi.Decided, pi.V_a\n\t}\n\n\t// instace for the seq no does not exist yet\n\tif seq > px.nseq {\n\t\tpx.nseq = seq\n\t}\n\n\treturn false, -1\n}", "func Status(args ...string) {\n runInstances(\"Status\", func(i int, id string) error {\n on := running()\n logger.Log(fmt.Sprintf(\"Container ID: %s\\n\", id))\n logger.Log(fmt.Sprintf(\" Running: %s\\n\", strconv.FormatBool(on)))\n\n if on {\n net := networkSettings(i)\n logger.Log(fmt.Sprintf(\" IP: %s\\n\", net.Ip))\n logger.Log(fmt.Sprintf(\" Public Port: %s\\n\", net.Public.tcp))\n logger.Log(fmt.Sprintf(\"Private Port: %s\\n\", net.Private.tcp))\n }\n\n return nil\n })\n}", "func (e EurekaConnection) UpdateInstanceStatus(ins *Instance, status StatusType) error {\n\tslug := fmt.Sprintf(\"%s/%s/%s/status\", EurekaURLSlugs[\"Apps\"], ins.App, ins.Id())\n\treqURL := e.generateURL(slug)\n\n\tparams := map[string]string{\"value\": string(status)}\n\n\tlog.Debugf(\"Updating instance status url=%s value=%s\", reqURL, status)\n\tbody, rcode, err := putKV(reqURL, params)\n\tif err != nil {\n\t\tlog.Error(\"Could not complete update, error: \", err.Error())\n\t\treturn err\n\t}\n\tif rcode < 200 || rcode >= 300 {\n\t\tlog.Warningf(\"HTTP returned %d updating status Instance=%s App=%s Body=\\\"%s\\\"\", rcode,\n\t\t\tins.Id(), ins.App, string(body))\n\t\treturn &unsuccessfulHTTPResponse{rcode, \"possible failure updating instance status\"}\n\t}\n\treturn nil\n}", "func (r *CustomDomainReconciler) statusUpdate(reqLogger logr.Logger, instance *customdomainv1alpha1.CustomDomain) error {\n\terr := r.Client.Status().Update(context.TODO(), instance)\n\tif err != nil {\n\t\treqLogger.Error(err, fmt.Sprintf(\"Status update for %s failed\", instance.Name))\n\t}\n\t//reqLogger.Info(fmt.Sprintf(\"Status updated for %s\", instance.Name))\n\treturn err\n}", "func (o ReservedInstanceOutput) Status() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *ReservedInstance) pulumi.StringOutput { return v.Status }).(pulumi.StringOutput)\n}", "func handleAppInstanceStatusCreate(ctxArg interface{}, key string,\n\tstatusArg interface{}) {\n\tctx := ctxArg.(*zedmanagerContext)\n\tpublishAppInstanceSummary(ctx)\n}", "func (px *Paxos) Status(seq int) (bool, interface{}) {\n // Your code here.\n px.mu.Lock()\n defer px.mu.Unlock()\n instance, ok := px.instances[seq]\n if !ok {\n return false, nil\n }\n\n return instance.decidedValue != nil, instance.decidedValue\n}", "func (c *Client) GetSpannerInstanceStatus(ctx context.Context, instanceID string) (*SpannerInstanceStatus, error) {\n\tnow := time.Now()\n\tstartTime := now.UTC().Add(c.syncPeriod)\n\tendTime := now.UTC()\n\n\tfilter := fmt.Sprintf(`\n\t\tmetric.type = \"spanner.googleapis.com/instance/cpu/utilization_by_priority\" AND\n\t\tmetric.label.priority = \"high\" AND\n\t\tmetric.label.database = \"%s\"\n`, instanceID)\n\n\treq := &monitoringpb.ListTimeSeriesRequest{\n\t\tName: fmt.Sprintf(\"projects/%s\", c.projectID),\n\t\t// TODO: Fix metrics type and enable to specify with argument.\n\t\tFilter: filter,\n\t\tInterval: &monitoringpb.TimeInterval{\n\t\t\tStartTime: &timestamp.Timestamp{\n\t\t\t\tSeconds: startTime.Unix(),\n\t\t\t},\n\t\t\tEndTime: &timestamp.Timestamp{\n\t\t\t\tSeconds: endTime.Unix(),\n\t\t\t},\n\t\t},\n\t\tView: monitoringpb.ListTimeSeriesRequest_FULL,\n\t}\n\n\tit := c.monitoringMetricClient.ListTimeSeries(ctx, req)\n\tfor {\n\t\tresp, err := it.Next()\n\t\tif err == iterator.Done {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn &SpannerInstanceStatus{\n\t\t\tName: resp.GetMetric().Labels[\"database\"],\n\t\t\tSpannerInstanceStatus: spannerhorizontalautoscalerv1alpha1.SpannerInstanceStatus{\n\t\t\t\tCPUUtilization: pointer.Int32(int32(resp.GetPoints()[0].GetValue().GetDoubleValue())),\n\t\t\t},\n\t\t}, nil\n\t}\n\n\treturn nil, errors.New(\"no such spanner instance metrics\")\n}", "func (px *Paxos) Status(seq int) (bool, interface{}) {\n\tstatus := false\n\tvar value interface{} = nil\n\tpx.mu.Lock()\n\tif px.instances[seq] != nil {\n\t\tstatus = px.instances[seq].decided\n\t\tvalue = px.instances[seq].v_a\n\t}\n\tpx.mu.Unlock()\n\treturn status, value\n}", "func (f *RemoteRuntime) Status(ctx context.Context, req *kubeapi.StatusRequest) (*kubeapi.StatusResponse, error) {\n\tresp, err := f.RuntimeService.Status(ctx, false)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn resp, nil\n}", "func (o LookupInstanceResultOutput) Status() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupInstanceResult) string { return v.Status }).(pulumi.StringOutput)\n}", "func (o LookupInstanceResultOutput) Status() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupInstanceResult) string { return v.Status }).(pulumi.StringOutput)\n}", "func StatusInstanceIAMInstanceProfile(ctx context.Context, conn *ec2.EC2, id string) retry.StateRefreshFunc {\n\treturn func() (interface{}, string, error) {\n\t\tinstance, err := FindInstanceByID(ctx, conn, id)\n\n\t\tif tfresource.NotFound(err) {\n\t\t\treturn nil, \"\", nil\n\t\t}\n\n\t\tif err != nil {\n\t\t\treturn nil, \"\", err\n\t\t}\n\n\t\tif instance.IamInstanceProfile == nil || instance.IamInstanceProfile.Arn == nil {\n\t\t\treturn instance, \"\", nil\n\t\t}\n\n\t\tname, err := InstanceProfileARNToName(aws.StringValue(instance.IamInstanceProfile.Arn))\n\n\t\tif err != nil {\n\t\t\treturn instance, \"\", err\n\t\t}\n\n\t\treturn instance, name, nil\n\t}\n}", "func (px *Paxos) Status(seq int) (Fate, interface{}) {\n \n if seq < px.Min() {\n return Forgotten, nil\n }\n\n instance := px.getInstance(seq)\n return instance.Fate, instance.Va\n}", "func (r *runtime) Status() *Status {\n\thealth := r.getError().Error()\n\n\treturn &Status{\n\t\tHealth: health,\n\t\tState: r.getState(),\n\t\tError: r.getError().Error(),\n\t\tStatus: r.httpStat.Status(),\n\t\tTopN: r.topN.Status(),\n\t}\n}", "func (inf *meshInformer) OnServiceInstanceStatuses(serviceName string, fn ServiceInstanceStatusesFunc) error {\n\tstoreKey := layout.ServiceInstanceStatusPrefix(serviceName)\n\tsyncerKey := fmt.Sprintf(\"prefix-service-instance-status-%s\", serviceName)\n\treturn inf.onServiceInstanceStatuses(storeKey, syncerKey, fn)\n}", "func (dateService) Status(ctx context.Context) (string, error) {\n\treturn \"ok\", nil\n}", "func (p *Init) Status(ctx context.Context) (string, error) {\n\tp.mu.Lock()\n\tdefer p.mu.Unlock()\n\n\treturn p.initState.State(ctx)\n}", "func (f *FaasController) Status() *supervisor.Status {\n\treturn &supervisor.Status{}\n}", "func (px *Paxos) Status(seq int) (Fate, interface{}) {\n\t// Your code here.\n\tpx.RLock()\n\tdefer px.RUnlock()\n\tif seq < px.minSeq {\n\t\treturn Forgotten, nil\n\t}\n\tsi := px.seqInstanceBySeq(seq)\n\treturn si.Status(), si.Value()\n}", "func (o InstanceAttachmentOutput) Status() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *InstanceAttachment) pulumi.StringOutput { return v.Status }).(pulumi.StringOutput)\n}", "func instanceHealthStateFunc(asgName string, instanceID string) func() string {\n\treturn func() string {\n\t\toutput, err := asgClient.DescribeAutoScalingGroups(&autoscaling.DescribeAutoScalingGroupsInput{\n\t\t\tAutoScalingGroupNames: []*string{&asgName},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn \"describe-error\"\n\t\t}\n\t\tif len(output.AutoScalingGroups) != 1 {\n\t\t\treturn \"unknown-asg\"\n\t\t}\n\t\tfor _, inst := range output.AutoScalingGroups[0].Instances {\n\t\t\tif *inst.InstanceID == instanceID {\n\t\t\t\treturn *inst.HealthStatus\n\t\t\t}\n\t\t}\n\t\treturn \"unknown-instance\"\n\t}\n}", "func (i *DeleteOrUpdateInvTask) StatusUpdate(_ *taskrunner.TaskContext, _ object.ObjMetadata) {}", "func InstanceViewStatus_STATUSGenerator() gopter.Gen {\n\tif instanceViewStatus_STATUSGenerator != nil {\n\t\treturn instanceViewStatus_STATUSGenerator\n\t}\n\n\tgenerators := make(map[string]gopter.Gen)\n\tAddIndependentPropertyGeneratorsForInstanceViewStatus_STATUS(generators)\n\tinstanceViewStatus_STATUSGenerator = gen.Struct(reflect.TypeOf(InstanceViewStatus_STATUS{}), generators)\n\n\treturn instanceViewStatus_STATUSGenerator\n}", "func (px *Paxos) Status(seq int) (Fate, interface{}) {\n\t// Your code here.\n\t// check if seq number is less than min, return forgotten if it is\n\t// check map for struct for given seq, if agreed value is nil, return pending with agreed value\n\t// otherwise return decided and agreed value for seq\n\n\tmin := px.Min()\n\tpx.mu.Lock()\n\tdefer px.mu.Unlock()\n\tif seq < min {\n\t\treturn Forgotten, nil\n\t} else if px.instances[seq] != nil {\n\t\tif px.instances[seq].decided {\n\t\t\treturn Decided, px.instances[seq].va\n\t\t}\n\t}\n\treturn Pending, nil\n}", "func (s *Service) Status(ctx context.Context) *sdk.MonitoringStatus {\n\treturn s.NewMonitoringStatus()\n}", "func (s *InstanceSummary) SetInstanceStatus(v string) *InstanceSummary {\n\ts.InstanceStatus = &v\n\treturn s\n}", "func (status *AppStatus) PropagateInstanceStatus(is InstanceStatus) {\n\tstatus.Instances = is\n}", "func (self *client) GetStatus() {\n\n}", "func (_SmartTgStats *SmartTgStatsCaller) Status(opts *bind.CallOpts) (bool, error) {\n\tvar (\n\t\tret0 = new(bool)\n\t)\n\tout := ret0\n\terr := _SmartTgStats.contract.Call(opts, out, \"status\")\n\treturn *ret0, err\n}", "func (c *ClusterStateImpl) instanceUpdateInProgress(asgName, instanceId string) bool {\n\treturn c.getInstanceState(asgName, instanceId) == updateInProgress\n}", "func (o MachineInstanceStatusConditionsOutput) Status() pulumi.StringOutput {\n\treturn o.ApplyT(func(v MachineInstanceStatusConditions) string { return v.Status }).(pulumi.StringOutput)\n}", "func Status() error {\n\treturn err\n}", "func (s *Instance) SetInstanceStatus(v string) *Instance {\n\ts.InstanceStatus = &v\n\treturn s\n}", "func GetSnapshotInstanceStatusFile(snapshotID string) string {\n\treturn filepath.Join(GetSnapshotDir(snapshotID), SnapshotInstanceStatusFilename)\n}", "func handleAppInstanceStatusDelete(ctxArg interface{}, key string,\n\tstatusArg interface{}) {\n\tctx := ctxArg.(*zedmanagerContext)\n\tpublishAppInstanceSummary(ctx)\n}", "func (r *remoteRuntimeService) Status(ctx context.Context, verbose bool) (*runtimeapi.StatusResponse, error) {\n\tklog.V(10).InfoS(\"[RemoteRuntimeService] Status\", \"timeout\", r.timeout)\n\tctx, cancel := context.WithTimeout(ctx, r.timeout)\n\tdefer cancel()\n\n\treturn r.statusV1(ctx, verbose)\n}", "func (c *ConsulServiceRegistry) Status() *supervisor.Status {\n\ts := &Status{}\n\n\t_, err := c.getClient()\n\tif err != nil {\n\t\ts.Health = err.Error()\n\t} else {\n\t\ts.Health = \"ready\"\n\t}\n\n\tc.statusMutex.Lock()\n\tserversNum := c.serversNum\n\tc.statusMutex.Unlock()\n\n\ts.ServersNum = serversNum\n\n\treturn &supervisor.Status{\n\t\tObjectStatus: s,\n\t}\n}", "func (h BaseHandler) Status(ctx *fasthttp.RequestCtx, status int) error {\n\treturn Status(ctx, status)\n}", "func (px *Paxos) Status(seq int) (Fate, interface{}) {\n\t// Your code here.\n\tif seq < px.Min() {\n\t\treturn Forgotten, nil\n\t}\n\n\tnode, ok := px.prepareStatus.Find(seq)\n\tif ok && node.State.Done {\n\t\treturn Decided, node.State.VA\n\t}\n\treturn Pending, nil\n}", "func (o *ListInstancesParams) WithStatus(status *string) *ListInstancesParams {\n\to.SetStatus(status)\n\treturn o\n}", "func (c *Client) Status(ctx context.Context) error {\n\treturn c.PingContext(ctx)\n}", "func (o LookupInstanceResultOutput) ResourceStatus() ResourceStatusResponseOutput {\n\treturn o.ApplyT(func(v LookupInstanceResult) ResourceStatusResponse { return v.ResourceStatus }).(ResourceStatusResponseOutput)\n}", "func cmdStatus() {\n\tstate := status(B2D.VM)\n\tfmt.Printf(\"%s is %s.\\n\", B2D.VM, state)\n\tif state != vmRunning {\n\t\tos.Exit(1)\n\t}\n}", "func (k *KubernetesScheduler) StatusUpdate(driver mesos.SchedulerDriver, taskStatus *mesos.TaskStatus) {\n\tlog.Infof(\"Received status update %v\\n\", taskStatus)\n\n\tk.Lock()\n\tdefer k.Unlock()\n\n\tswitch taskStatus.GetState() {\n\tcase mesos.TaskState_TASK_STAGING:\n\t\tk.handleTaskStaging(taskStatus)\n\tcase mesos.TaskState_TASK_STARTING:\n\t\tk.handleTaskStarting(taskStatus)\n\tcase mesos.TaskState_TASK_RUNNING:\n\t\tk.handleTaskRunning(taskStatus)\n\tcase mesos.TaskState_TASK_FINISHED:\n\t\tk.handleTaskFinished(taskStatus)\n\tcase mesos.TaskState_TASK_FAILED:\n\t\tk.handleTaskFailed(taskStatus)\n\tcase mesos.TaskState_TASK_KILLED:\n\t\tk.handleTaskKilled(taskStatus)\n\tcase mesos.TaskState_TASK_LOST:\n\t\tk.handleTaskLost(taskStatus)\n\t}\n}", "func (in *FusionAppInstanceStatus) DeepCopy() *FusionAppInstanceStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(FusionAppInstanceStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (li *LinkInst) Status() model.LinkStatus {\n\treturn li.status\n}", "func (bc *ReconcileJenkinsInstance) updateJenkinsInstanceStatus(instanceName types.NamespacedName) error {\n\n\tsetupSecret, err := bc.getSetupSecret(instanceName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tadminSecret, err := bc.getAdminSecret(instanceName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tservice, err := bc.getService(instanceName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tapiToken := string(setupSecret.Data[\"apiToken\"][:])\n\tapiTokenUuid := string(setupSecret.Data[\"apiTokenUuid\"][:])\n\tvalid, err := util.JenkinsApiTokenValid(service, adminSecret, setupSecret, JenkinsMasterPort)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !valid {\n\t\terr = util.RevokeJenkinsApiToken(service, adminSecret, setupSecret, JenkinsMasterPort)\n\t\tif err != nil {\n\t\t\tglog.Warningf(\"Error revoking jenkins api token: %v\", err)\n\t\t}\n\t\tapiToken, apiTokenUuid, err = util.GetJenkinsApiToken(service, adminSecret, JenkinsMasterPort)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif (string(setupSecret.Data[\"apiToken\"][:]) != apiToken) ||\n\t\t(string(setupSecret.Data[\"apiTokenUuid\"][:]) != apiTokenUuid) {\n\t\tsetupSecretCopy := setupSecret.DeepCopy()\n\t\tsetupSecretCopy.Data[\"apiToken\"] = []byte(apiToken)\n\t\tsetupSecretCopy.Data[\"apiTokenUuid\"] = []byte(apiTokenUuid)\n\t\terr = bc.Client.Update(context.TODO(), setupSecretCopy)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tjenkinsInstance, err := bc.getJenkinsInstance(instanceName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdoUpdate := (jenkinsInstance.Status.Phase != JenkinsInstancePhaseReady) ||\n\t\t(jenkinsInstance.Status.SetupSecret != setupSecret.GetName())\n\n\tif doUpdate {\n\t\tjenkinsInstanceCopy := jenkinsInstance.DeepCopy()\n\t\tjenkinsInstanceCopy.Status.Phase = JenkinsInstancePhaseReady\n\t\tjenkinsInstanceCopy.Status.SetupSecret = setupSecret.GetName()\n\n\t\terr = bc.Client.Update(context.TODO(), jenkinsInstanceCopy)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (h HealthController) Status(c *gin.Context) {\n\tc.String(http.StatusOK, \"Working!\")\n}", "func (tv *TimedValue) Status() TimedValueStatus {\n\treturn tv.StatusAt(time.Now())\n}", "func (cbo *CBO) statusProgressing() error {\n desiredVersions := os.Getenv(\"OPERATOR_VERSION\")\n\n\t// TODO Making an assumption here that the Cluster Operator already exists\n\t// Check to see if we need to check if the ClusterOperator already exists\n\t// and create one if it doesn't\n currentVersions, err := cbo.getCurrentVersions()\n\n if err != nil {\n glog.Errorf(\"Error getting operator current versions: %v\", err)\n return err\n }\n var isProgressing osconfigv1.ConditionStatus\n\t\n co, err := cbo.getOrCreateClusterOperator()\n if err != nil {\n \tglog.Errorf(\"Failed to get or create Cluster Operator: %v\", err)\n \treturn err\n }\n\n var message string\n if !reflect.DeepEqual(desiredVersions, currentVersions) {\n glog.V(2).Info(\"Syncing status: progressing\")\n\t\t// TODO Use K8s event recorder to report this state\n isProgressing = osconfigv1.ConditionTrue\n } else {\n glog.V(2).Info(\"Syncing status: re-syncing\")\n\t\t// TODO Use K8s event recorder to report this state\n isProgressing = osconfigv1.ConditionFalse\n }\n\n conds := []osconfigv1.ClusterOperatorStatusCondition{\n newClusterOperatorStatusCondition(osconfigv1.OperatorProgressing, isProgressing, string(ReasonSyncing), message),\n operatorUpgradeable,\n }\n\n return cbo.updateStatus(co, conds)\n\treturn nil\n}", "func (client *ClientRPCMethods) Status(in *string, response *ServerStatus) (err error) {\n\t*response = *client.client.callback.Status()\n\treturn nil\n}", "func (p *Plugin) Status(ctx context.Context, in *plugin.StatusRequest) (*plugin.StatusResponse, error) {\n\terr := p.Service.Status(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &plugin.StatusResponse{}, nil\n}", "func GetStatus(cfg *Config) Status {\n\tnow := time.Now().Unix()\n\n\ts := Status{\n\t\tPID: os.Getpid(),\n\t\tService: \"list-service\",\n\t}\n\n\ts.Status = \"ok\"\n\ts.Version = Version()\n\ts.CPUs = runtime.NumCPU()\n\ts.GoVers = runtime.Version()\n\ts.TimeStamp = now\n\ts.UpTime = now - InstanceStartTime\n\ts.LogLevel = log.GetLevel()\n\n\tif host, err := os.Hostname(); err == nil {\n\t\ts.Hostname = host\n\t}\n\n\treturn s\n}", "func (o InstanceFromTemplateOutput) CurrentStatus() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *InstanceFromTemplate) pulumi.StringOutput { return v.CurrentStatus }).(pulumi.StringOutput)\n}", "func (o AccessReviewInstanceResponseOutput) Status() pulumi.StringOutput {\n\treturn o.ApplyT(func(v AccessReviewInstanceResponse) string { return v.Status }).(pulumi.StringOutput)\n}", "func (at *Attacker) Status(uuid string) (string, error) {\n\tat.lock.RLock()\n\tdefer at.lock.RUnlock()\n\tentry, ok := at.scheduler[uuid]\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"attack reference %s not found\", uuid)\n\t}\n\treturn entry.Status(), nil\n}", "func Status(status string) error {\n\treturn SdNotify(\"STATUS=\" + status)\n}", "func (i instanceHandler) statusHandler(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tid := vars[\"instID\"]\n\n\tresp, err := i.client.Status(id, true)\n\tif err != nil {\n\t\tlog.Error(\"Error getting Status\", log.Fields{\n\t\t\t\"error\": err,\n\t\t\t\"id\": id,\n\t\t})\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\terr = json.NewEncoder(w).Encode(resp)\n\tif err != nil {\n\t\tlog.Error(\"Error Marshaling Response\", log.Fields{\n\t\t\t\"error\": err,\n\t\t\t\"response\": resp,\n\t\t})\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n}", "func (ds *dockerService) Status(_ context.Context, r *runtimeapi.StatusRequest) (*runtimeapi.StatusResponse, error) {\n\truntimeReady := &runtimeapi.RuntimeCondition{\n\t\tType: runtimeapi.RuntimeReady,\n\t\tStatus: true,\n\t}\n\tnetworkReady := &runtimeapi.RuntimeCondition{\n\t\tType: runtimeapi.NetworkReady,\n\t\tStatus: true,\n\t}\n\tconditions := []*runtimeapi.RuntimeCondition{runtimeReady, networkReady}\n\tif _, err := ds.client.Version(); err != nil {\n\t\truntimeReady.Status = false\n\t\truntimeReady.Reason = \"DockerDaemonNotReady\"\n\t\truntimeReady.Message = fmt.Sprintf(\"docker: failed to get docker version: %v\", err)\n\t}\n\n\tstatus := &runtimeapi.RuntimeStatus{Conditions: conditions}\n\treturn &runtimeapi.StatusResponse{Status: status}, nil\n}", "func (o BucketIntelligentTieringConfigurationOutput) Status() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *BucketIntelligentTieringConfiguration) pulumi.StringPtrOutput { return v.Status }).(pulumi.StringPtrOutput)\n}", "func Status(code int) types.Status {\n\treturn types.NewStatus(code)\n}", "func (h *Handler) UpdateStatus(w http.ResponseWriter, r *http.Request) {\n\n\tcmd := sigstat.Command{\n\t\tStatus: \"running\",\n\t}\n\n\th.client.CommandService().UpdateStatus(cmd)\n}", "func InstanceStatus_Values() []string {\n\treturn []string{\n\t\tInstanceStatusCreationInProgress,\n\t\tInstanceStatusActive,\n\t\tInstanceStatusCreationFailed,\n\t}\n}", "func (px *Paxos) Status(seq int) (bool, interface{}) {\n\t// Your code here.\n\treturn px.Lslots[seq].Decided, px.Lslots[seq].V\n}", "func (p *Proxy) Status() {\n\tfmt.Println(p.path, \"\\n\", p.running)\n}", "func (instance *BetterezInstance) CheckInstanceHealth() (bool, error) {\n\tif instance == nil || instance.PrivateIPAddress == \"\" {\n\t\treturn true, nil\n\t}\n\thttpClient := http.Client{\n\t\tTimeout: ConnectionTimeout,\n\t\tCheckRedirect: func(req *http.Request, via []*http.Request) error {\n\t\t\treturn http.ErrUseLastResponse\n\t\t},\n\t}\n\tresp, err := httpClient.Get(instance.GetHealthCheckString())\n\tinstance.StatusCheck = time.Now()\n\tif err != nil {\n\t\tinstance.ServiceStatus = \"offline\"\n\t\tinstance.ServiceStatusErrorCode = fmt.Sprintf(\"%v\", err)\n\t\t//log.Printf(\"Error %v healthcheck instance %s\", err, instance.InstanceID)\n\t\treturn false, err\n\t}\n\tdefer resp.Body.Close()\n\t//log.Print(\"checking \", instance.Repository, \"...\")\n\tif resp.StatusCode > 0 && resp.StatusCode < 400 {\n\t\tinstance.ServiceStatus = \"online\"\n\t\tinstance.ServiceStatusErrorCode = \"\"\n\t\treturn true, nil\n\t}\n\treturn false, nil\n}", "func (in *InstanceStatus) DeepCopy() *InstanceStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(InstanceStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *InstanceStatus) DeepCopy() *InstanceStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(InstanceStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (in *InstanceStatus) DeepCopy() *InstanceStatus {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(InstanceStatus)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "func (twrkr *twerk) status() Status {\n\tlive := twrkr.liveWorkersNum.Get()\n\tworking := twrkr.currentlyWorkingNum.Get()\n\tinQueue := len(twrkr.jobListener)\n\n\treturn Status{\n\t\tlive: live,\n\t\tworking: working,\n\t\tjobsInQueue: inQueue,\n\t}\n}", "func (s *svc) Status() router.Status {\n\ts.Lock()\n\tdefer s.Unlock()\n\n\t// check if its stopped\n\tselect {\n\tcase <-s.exit:\n\t\treturn router.Status{\n\t\t\tCode: router.Stopped,\n\t\t\tError: nil,\n\t\t}\n\tdefault:\n\t\t// don't block\n\t}\n\n\t// check the remote router\n\trsp, err := s.router.Status(context.Background(), &pb.Request{}, s.callOpts...)\n\tif err != nil {\n\t\treturn router.Status{\n\t\t\tCode: router.Error,\n\t\t\tError: err,\n\t\t}\n\t}\n\n\tcode := router.Running\n\tvar serr error\n\n\tswitch rsp.Status.Code {\n\tcase \"running\":\n\t\tcode = router.Running\n\tcase \"advertising\":\n\t\tcode = router.Advertising\n\tcase \"stopped\":\n\t\tcode = router.Stopped\n\tcase \"error\":\n\t\tcode = router.Error\n\t}\n\n\tif len(rsp.Status.Error) > 0 {\n\t\tserr = errors.New(rsp.Status.Error)\n\t}\n\n\treturn router.Status{\n\t\tCode: code,\n\t\tError: serr,\n\t}\n}", "func (m *kubeGenericRuntimeManager) Status(ctx context.Context) (*kubecontainer.RuntimeStatus, error) {\n\tresp, err := m.runtimeService.Status(ctx, false)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif resp.GetStatus() == nil {\n\t\treturn nil, errors.New(\"runtime status is nil\")\n\t}\n\treturn toKubeRuntimeStatus(resp.GetStatus()), nil\n}", "func (sg StatusGroup) Status(w http.ResponseWriter, r *http.Request) error {\n\tctx := r.Context()\n\n\thost, err := os.Hostname()\n\tif err != nil {\n\t\thost = \"unavailable\"\n\t}\n\n\tinfo := struct {\n\t\tStatus string `json:\"status\"`\n\t\tHost string `json:\"host\"`\n\t}{\n\t\tStatus: \"up\",\n\t\tHost: host,\n\t}\n\n\treturn respond(ctx, w, info, http.StatusOK)\n}", "func (throttler *Throttler) Status() *ThrottlerStatus {\n\treturn &ThrottlerStatus{\n\t\tKeyspace: throttler.keyspace,\n\t\tShard: throttler.shard,\n\n\t\tIsLeader: throttler.isLeader.Load(),\n\t\tIsOpen: throttler.isOpen.Load(),\n\t\tIsEnabled: throttler.isEnabled.Load(),\n\t\tIsDormant: throttler.isDormant(),\n\n\t\tQuery: throttler.GetMetricsQuery(),\n\t\tThreshold: throttler.GetMetricsThreshold(),\n\n\t\tAggregatedMetrics: throttler.aggregatedMetricsSnapshot(),\n\t\tMetricsHealth: throttler.metricsHealthSnapshot(),\n\t}\n}", "func (a *Api) Status(w http.ResponseWriter, r *http.Request) error {\n\treturn nil\n}", "func GetEC2InstanceStatus(experimentsDetails *experimentTypes.ExperimentDetails) (string, error) {\n\n\tvar err error\n\t// Load session from shared config\n\tsess := session.Must(session.NewSessionWithOptions(session.Options{\n\t\tSharedConfigState: session.SharedConfigEnable,\n\t\tConfig: aws.Config{Region: aws.String(experimentsDetails.Region)},\n\t}))\n\n\tif experimentsDetails.Ec2InstanceID == \"\" {\n\t\tlog.Infof(\"[PreChaos]: Instance id is not provided, selecting a random instance from %v region\", experimentsDetails.Region)\n\t\texperimentsDetails.Ec2InstanceID, err = GetRandomInstance(experimentsDetails.Region, sess)\n\t\tif err != nil {\n\t\t\treturn \"\", errors.Errorf(\"fail to select a random running instance from %v region, err: %v\", experimentsDetails.Region, err)\n\t\t}\n\t}\n\n\t// Create new EC2 client\n\tec2Svc := ec2.New(sess)\n\n\t// Call to get detailed information on each instance\n\tresult, err := ec2Svc.DescribeInstances(nil)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tfor _, reservationDetails := range result.Reservations {\n\n\t\tfor _, instanceDetails := range reservationDetails.Instances {\n\n\t\t\tif *instanceDetails.InstanceId == experimentsDetails.Ec2InstanceID {\n\t\t\t\treturn *instanceDetails.State.Name, nil\n\t\t\t}\n\t\t}\n\t}\n\treturn \"\", errors.Errorf(\"failed to get the status of ec2 instance with instanceID %v\", experimentsDetails.Ec2InstanceID)\n\n}", "func (p *Pool) Status() string {\n\tswitch {\n\tcase p.status == NotStarted:\n\t\treturn \"not started\"\n\tcase p.status == Started:\n\t\treturn \"started\"\n\tcase p.status == Stopped:\n\t\treturn \"stopped\"\n\t}\n\n\treturn \"unknown\"\n}", "func (s *HostListener) Status(ctx context.Context, in *protocol.Reference) (ht *protocol.HostStatus, err error) {\n\tdefer fail.OnExitConvertToGRPCStatus(&err)\n\tdefer fail.OnExitWrapError(&err, \"cannot get host status\")\n\tdefer fail.OnPanic(&err)\n\n\tif s == nil {\n\t\treturn nil, fail.InvalidInstanceError()\n\t}\n\tif in == nil {\n\t\treturn nil, fail.InvalidParameterError(\"in\", \"cannot be nil\")\n\t}\n\tif ctx == nil {\n\t\treturn nil, fail.InvalidParameterError(\"ctx\", \"cannot be nil\")\n\t}\n\n\tif ok, err := govalidator.ValidateStruct(in); err == nil && !ok {\n\t\tlogrus.Warnf(\"Structure validation failure: %v\", in) // FIXME: Generate json tags in protobuf\n\t}\n\n\tref, refLabel := srvutils.GetReference(in)\n\tif ref == \"\" {\n\t\treturn nil, fail.InvalidRequestError(\"neither name nor id given as reference\").ToGRPCStatus()\n\t}\n\n\tjob, err := PrepareJob(ctx, in.GetTenantId(), fmt.Sprintf(\"/host/%s/state\", ref))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer job.Close()\n\n\ttracer := debug.NewTracer(job.Task(), tracing.ShouldTrace(\"listeners.host\"), \"(%s)\", refLabel).WithStopwatch().Entering()\n\tdefer tracer.Exiting()\n\tdefer fail.OnExitLogError(&err, tracer.TraceMessage())\n\n\thostInstance, xerr := hostfactory.Load(job.Service(), ref)\n\tif xerr != nil {\n\t\tswitch xerr.(type) {\n\t\tcase *fail.ErrNotFound:\n\t\t\treturn nil, abstract.ResourceNotFoundError(\"host\", ref)\n\t\tdefault:\n\t\t\treturn nil, xerr\n\t\t}\n\t}\n\n\tdefer hostInstance.Released()\n\n\t// Gather host state from Cloud Provider\n\tstate, xerr := hostInstance.ForceGetState(ctx)\n\tif xerr != nil {\n\t\treturn nil, xerr\n\t}\n\n\treturn converters.HostStatusFromAbstractToProtocol(hostInstance.GetName(), state), nil\n}", "func Status() *models.Status {\n\tif dockerClient == nil {\n\t\treturn &models.Status{State: models.StatusStateDisabled}\n\t}\n\n\tif _, err := dockerClient.Info(ctx.Background()); err != nil {\n\t\treturn &models.Status{State: models.StatusStateFailure, Msg: err.Error()}\n\t}\n\n\treturn &models.Status{State: models.StatusStateOk, Msg: \"\"}\n}", "func (b *baseSysInit) Status(svcName string) (Status, error) {\n\tb.StatusCmd.AppendArgs(sysInitCmdArgs(b.sysInitType, svcName, \"status\")...)\n\tstatus, err := b.StatusCmd.RunCombined()\n\tif err != nil {\n\t\treturn Unknown, err\n\t}\n\tswitch {\n\tcase strings.Contains(status, svcStatusOut[\"running\"][b.sysInitType]):\n\t\treturn Running, nil\n\tcase strings.Contains(status, svcStatusOut[\"stopped\"][b.sysInitType]):\n\t\treturn Stopped, nil\n\t}\n\treturn Unknown, fmt.Errorf(\"Unable to determine %s status\", svcName)\n}", "func (r *Random) GetStatus() interface{} {\n\treturn SourceStatusRunning\n}", "func (h HealthController) Status(c *gin.Context) {\n\tc.JSON(200, gin.H{\n\t\t\"status\": \"ok\",\n\t})\n}", "func ParseStatusInstanceResponse(instanceStatusses []k8splugin.InstanceStatus) []con.PodInfoToAAI {\n\n\tvar infoToAAI []con.PodInfoToAAI\n\n\tfor _, instanceStatus := range instanceStatusses {\n\n\t\tvar podInfo con.PodInfoToAAI\n\n\t\tsa := reflect.ValueOf(&instanceStatus).Elem()\n\t\ttypeOf := sa.Type()\n\t\tfor i := 0; i < sa.NumField(); i++ {\n\t\t\tf := sa.Field(i)\n\t\t\tif typeOf.Field(i).Name == \"Request\" {\n\t\t\t\trequest := f.Interface()\n\t\t\t\tif ireq, ok := request.(k8splugin.InstanceRequest); ok {\n\t\t\t\t\tpodInfo.VserverName2 = ireq.ProfileName\n\t\t\t\t\tpodInfo.CloudRegion = ireq.CloudRegion\n\n\t\t\t\t\tfor key, value := range ireq.Labels {\n\t\t\t\t\t\tif key == \"generic-vnf-id\" {\n\n\t\t\t\t\t\t\tpodInfo.VnfId = value\n\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif key == \"vfmodule-id\" {\n\n\t\t\t\t\t\t\tpodInfo.VfmId = value\n\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\t\t\t\t\t//fmt.Printf(\"it's not a InstanceRequest \\n\")\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif typeOf.Field(i).Name == \"PodStatuses\" {\n\t\t\t\tready := f.Interface()\n\t\t\t\tif pss, ok := ready.([]con.PodStatus); ok {\n\t\t\t\t\tfor _, ps := range pss {\n\t\t\t\t\t\tpodInfo.VserverName = ps.Name\n\t\t\t\t\t\tpodInfo.ProvStatus = ps.Namespace\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\t\t\t\t\t//fmt.Printf(\"it's not a InstanceRequest \\n\")\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tinfoToAAI = append(infoToAAI, podInfo)\n\n\t}\n\n\treturn infoToAAI\n\n}", "func (px *Paxos) Status(seq int) (Fate, interface{}) {\n\n\tif seq < px.Min() {\n\t\treturn Forgotten, nil\n\t}\n\n\tpx.mu.Lock()\n\tdefer px.mu.Unlock()\n\n\tif val, ok := px.decidedVals[seq]; ok {\n\t\treturn Decided, val\n\t}\n\treturn Pending, nil\n}", "func Status(status int) {\n\tif r, ok := responseDefinition(); ok {\n\t\tr.Status = status\n\t}\n}" ]
[ "0.71679103", "0.66620487", "0.6622782", "0.6563443", "0.6485507", "0.6485507", "0.6467081", "0.63853097", "0.63632923", "0.6339722", "0.6325793", "0.6323192", "0.6275274", "0.6264935", "0.6239968", "0.62362355", "0.6228433", "0.6226664", "0.6222361", "0.6132486", "0.6130724", "0.6084447", "0.60747564", "0.6055337", "0.60215384", "0.60215384", "0.5987736", "0.59508306", "0.5948641", "0.592216", "0.5919403", "0.58954674", "0.58722186", "0.58607006", "0.58517665", "0.5833479", "0.5827839", "0.5802044", "0.5800082", "0.57937634", "0.57741857", "0.5765668", "0.5708159", "0.5698256", "0.5698058", "0.56930065", "0.56782156", "0.56769925", "0.56765366", "0.5658336", "0.5648103", "0.56342876", "0.561912", "0.56185925", "0.56185275", "0.5614001", "0.5611058", "0.56107026", "0.5607631", "0.5598036", "0.5594723", "0.5584768", "0.5583435", "0.55770785", "0.5572295", "0.55641985", "0.55381674", "0.5531929", "0.5511906", "0.5507066", "0.5504587", "0.5496388", "0.5495382", "0.54936796", "0.5490605", "0.54869324", "0.5481836", "0.54766953", "0.54615617", "0.5452144", "0.5451397", "0.5447719", "0.5447719", "0.5447719", "0.5444275", "0.5444231", "0.5442093", "0.5439933", "0.54392415", "0.54338413", "0.54319286", "0.54242057", "0.5422468", "0.5413765", "0.5408346", "0.5400276", "0.5396029", "0.5388929", "0.53867877", "0.5381933" ]
0.76074505
0
InstanceStopped uses the override method InstanceStoppedFn or the real implementation.
func (c *TestClient) InstanceStopped(project, zone, name string) (bool, error) { if c.InstanceStoppedFn != nil { return c.InstanceStoppedFn(project, zone, name) } return c.client.InstanceStopped(project, zone, name) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (p *OnPrem) StopInstance(ctx *Context, instancename string) error {\n\treturn fmt.Errorf(\"Operation not supported\")\n}", "func (p *OnPrem) StopInstance(ctx *Context, instancename string) error {\n\treturn fmt.Errorf(\"Operation not supported\")\n}", "func (c ContainerLifecycleHooks) Stopped(ctx context.Context) func(container Container) error {\n\treturn containerHookFn(ctx, c.PostStops)\n}", "func (c *Client) StopInstance(id string) error {\n\n\tactionRequest := core.InstanceActionRequest{}\n\tactionRequest.Action = core.InstanceActionActionStop\n\tactionRequest.InstanceId = &id\n\n\tstopResp, err := c.computeClient.InstanceAction(context.Background(), actionRequest)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// wait until lifecycle status is Stopped\n\tpollUntilStopped := func(r common.OCIOperationResponse) bool {\n\t\tif converted, ok := r.Response.(core.GetInstanceResponse); ok {\n\t\t\treturn converted.LifecycleState != core.InstanceLifecycleStateStopped\n\t\t}\n\t\treturn true\n\t}\n\n\tpollingGetRequest := core.GetInstanceRequest{\n\t\tInstanceId: stopResp.Instance.Id,\n\t\tRequestMetadata: helpers.GetRequestMetadataWithCustomizedRetryPolicy(pollUntilStopped),\n\t}\n\n\t_, err = c.computeClient.GetInstance(context.Background(), pollingGetRequest)\n\n\treturn err\n}", "func (p *ProxMox) StopInstance(ctx *lepton.Context, instanceID string) error {\n\n\treq, err := http.NewRequest(\"POST\", p.apiURL+\"/api2/json/nodes/\"+p.nodeNAME+\"/qemu/\"+instanceID+\"/status/stop\", nil)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn err\n\t}\n\n\ttr := &http.Transport{\n\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: true},\n\t}\n\tclient := &http.Client{Transport: tr}\n\n\treq.Header.Add(\"Authorization\", \"PVEAPIToken=\"+p.tokenID+\"=\"+p.secret)\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\t_, err = io.ReadAll(resp.Body)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func Stop() {\n\tinstance.stop()\n}", "func (s *Server) OnStop() {}", "func (c ContainerLifecycleHooks) Stopping(ctx context.Context) func(container Container) error {\n\treturn containerHookFn(ctx, c.PreStops)\n}", "func StopInstance(computeService *compute.Service) (*compute.Operation, error) {\n\treturn computeService.Instances.Stop(ProjectID, Zone, InstanceName).Do()\n}", "func (c *DockerContainer) stoppedHook(ctx context.Context) error {\n\tfor _, lifecycleHooks := range c.lifecycleHooks {\n\t\terr := containerHookFn(ctx, lifecycleHooks.PostStops)(c)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (p *plugin) Destroy(instance instance.ID, context instance.Context) error {\n\tlog.Info(fmt.Sprintf(\"Currently running %s on instance: %v\", context, instance))\n\t// Spawn a goroutine to delete in the background\n\tgo func() {\n\t\t// TODO: Checks need adding to examine the instance that are quick enough not to trip timeout\n\t\tvar err error\n\t\tif ignoreVMs == true {\n\t\t\terr = ignoreVM(p, string(instance))\n\t\t} else {\n\t\t\terr = deleteVM(p, string(instance))\n\t\t}\n\t\tif err != nil {\n\t\t\tlog.Error(\"Destroying Instance failed\", \"err\", err)\n\t\t}\n\t}()\n\n\t// TODO: Ideally the goroutine should return the error otherwise this function can never fail for InfraKit\n\treturn nil\n}", "func (c *TestClient) StopInstance(project, zone, name string) error {\n\tif c.StopInstanceFn != nil {\n\t\treturn c.StopInstanceFn(project, zone, name)\n\t}\n\treturn c.client.StopInstance(project, zone, name)\n}", "func stopInstance(cs *compute.Service, w http.ResponseWriter) {\n\toperation, err := StopInstance(cs)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tlog.Fatal(err)\n\t}\n\tw.WriteHeader(http.StatusOK)\n\tdata, _ := operation.MarshalJSON()\n\tw.Write(data)\n}", "func (l *Lifecycle) Stop(ctx context.Context) error {\n\tl.mu.Lock()\n\tl.stopRecords = make(HookRecords, 0, l.numStarted)\n\tl.mu.Unlock()\n\n\t// Run backward from last successful OnStart.\n\tvar errs []error\n\tfor ; l.numStarted > 0; l.numStarted-- {\n\t\thook := l.hooks[l.numStarted-1]\n\t\tif hook.OnStop == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tl.mu.Lock()\n\t\tl.runningHook = hook\n\t\tl.mu.Unlock()\n\n\t\truntime, err := l.runStopHook(ctx, hook)\n\t\tif err != nil {\n\t\t\t// For best-effort cleanup, keep going after errors.\n\t\t\terrs = append(errs, err)\n\t\t}\n\n\t\tl.mu.Lock()\n\t\tl.stopRecords = append(l.stopRecords, HookRecord{\n\t\t\tCallerFrame: hook.callerFrame,\n\t\t\tFunc: hook.OnStop,\n\t\t\tRuntime: runtime,\n\t\t})\n\t\tl.mu.Unlock()\n\t}\n\n\treturn multierr.Combine(errs...)\n}", "func (m serviceMetrics) ServiceStopped() {\n\tlabels := m.labels()\n\tlabels[\"activity\"] = ActivityStopped\n\tm.activities.With(labels).Inc()\n}", "func (f StopListenerAdapter) OnStopped() {\n\tif f != nil {\n\t\tf()\n\t}\n}", "func (instance *Host) Stop(ctx context.Context) (ferr fail.Error) {\n\tdefer fail.OnPanic(&ferr)\n\n\tif valid.IsNil(instance) {\n\t\treturn fail.InvalidInstanceError()\n\t}\n\tif ctx == nil {\n\t\treturn fail.InvalidParameterCannotBeNilError(\"ctx\")\n\t}\n\n\thostName := instance.GetName()\n\thostID, err := instance.GetID()\n\tif err != nil {\n\t\treturn fail.ConvertError(err)\n\t}\n\n\tsvc := instance.Service()\n\n\ttimings, xerr := instance.Service().Timings()\n\tif xerr != nil {\n\t\treturn xerr\n\t}\n\n\txerr = instance.Sync(ctx)\n\tif xerr != nil {\n\t\tlogrus.WithContext(ctx).Debugf(\"failure trying to sync: %v\", xerr)\n\t}\n\n\txerr = svc.StopHost(ctx, hostID, false)\n\txerr = debug.InjectPlannedFail(xerr)\n\tif xerr != nil {\n\t\treturn xerr\n\t}\n\n\txerr = retry.WhileUnsuccessful(\n\t\tfunc() error {\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn retry.StopRetryError(ctx.Err())\n\t\t\tdefault:\n\t\t\t}\n\n\t\t\ths, err := instance.ForceGetState(ctx)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif hs != hoststate.Stopped {\n\t\t\t\treturn fail.NewError(\"%s not stopped yet: %s\", hostName, hs.String())\n\t\t\t}\n\n\t\t\treturn nil\n\t\t},\n\t\ttimings.NormalDelay(),\n\t\ttimings.ExecutionTimeout(),\n\t)\n\txerr = debug.InjectPlannedFail(xerr)\n\tif xerr != nil {\n\t\tswitch xerr.(type) {\n\t\tcase *fail.ErrAborted:\n\t\t\tif cerr := fail.ConvertError(fail.Cause(xerr)); cerr != nil {\n\t\t\t\treturn cerr\n\t\t\t}\n\t\t\treturn xerr\n\t\tcase *retry.ErrTimeout:\n\t\t\treturn fail.Wrap(xerr, \"timeout waiting Host '%s' to be stopped\", hostName)\n\t\tdefault:\n\t\t\treturn xerr\n\t\t}\n\t}\n\n\t// Now unsafeReload\n\txerr = instance.unsafeReload(ctx)\n\txerr = debug.InjectPlannedFail(xerr)\n\tif xerr != nil {\n\t\treturn xerr\n\t}\n\n\treturn nil\n}", "func chainStopped(service moleculer.Service, mixin *moleculer.Mixin) moleculer.Service {\n\tif mixin.Stopped != nil {\n\t\tsvcHook := service.Stopped\n\t\tservice.Stopped = func(ctx moleculer.BrokerContext, svc moleculer.Service) {\n\t\t\tif svcHook != nil {\n\t\t\t\tsvcHook(ctx, svc)\n\t\t\t}\n\t\t\tmixin.Stopped(ctx, svc)\n\t\t}\n\t}\n\treturn service\n}", "func (rcsw *RemoteClusterServiceWatcher) Stop(cleanupState bool) {\n\trcsw.probeEventsSink.send(&ClusterNotRegistered{\n\t\tclusterName: rcsw.clusterName,\n\t})\n\tclose(rcsw.stopper)\n\tif cleanupState {\n\t\trcsw.eventsQueue.Add(&ClusterUnregistered{})\n\t}\n\trcsw.eventsQueue.ShutDown()\n}", "func (dao *blockDAO) Stop(ctx context.Context) error { return dao.lifecycle.OnStop(ctx) }", "func (c *DockerContainer) stoppingHook(ctx context.Context) error {\n\tfor _, lifecycleHooks := range c.lifecycleHooks {\n\t\terr := containerHookFn(ctx, lifecycleHooks.PreStops)(c)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (inst *Instance) Stop(signal os.Signal) error {\n\tautoRestartHandle := inst.autoRestartHandle\n\n\t// send stop signal\n\tautoRestartHandle.mask()\n\treturn inst.stop(signal)\n}", "func (c *Client) StopInstance(instanceId string, forceStop bool) error {\n\targs := &StopInstanceArgs{\n\t\tForceStop: forceStop,\n\t}\n\n\tjsonBytes, jsonErr := json.Marshal(args)\n\tif jsonErr != nil {\n\t\treturn jsonErr\n\t}\n\tbody, err := bce.NewBodyFromBytes(jsonBytes)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn StopInstance(c, instanceId, body)\n}", "func (s LifecyclerRPC) AfterInstance(state *isclib.Instance) error {\n\tvar resp struct{}\n\terr := s.client.Call(\"Plugin.AfterInstance\", state, &resp)\n\treturn err\n}", "func (l *LifeCycle) Stop() {\n\tl.stopLock.Lock()\n\tl.stopped = true\n\tl.stopLock.Unlock()\n}", "func (s *status) stopping() error { return s.set(\"stopping\", \"STOPPING=1\") }", "func (s LifecyclerRPC) AfterStop(instance *ISCInstance) error {\n\tvar resp struct{}\n\terr := s.client.Call(\"Plugin.AfterStop\", instance, &resp)\n\treturn err\n}", "func (s *LifecyclerRPCServer) AfterStop(instance *ISCInstance, resp *struct{}) (err error) {\n\terr = s.Plugin.AfterStop(instance)\n\treturn err\n}", "func (s *LifecyclerRPCServer) AfterInstance(state *isclib.Instance, resp *struct{}) (err error) {\n\treturn s.Plugin.AfterInstance(state)\n}", "func (b *NoopLifecycle) Stop(t testing.TB) error {\n\treturn nil\n}", "func (s *GRPCServer) OnStop() { s.server.Stop() }", "func (s *BaseDMLListener) ExitFieldInstance(ctx *FieldInstanceContext) {}", "func (this *AVTransport) Stop(instanceId uint32) error {\n\ttype Response struct {\n\t\tXMLName xml.Name\n\t\tErrorResponse\n\t}\n\targs := []Arg{\n\t\t{\"InstanceID\", instanceId},\n\t}\n\tresponse := this.Svc.Call(\"Stop\", args)\n\tdoc := Response{}\n\txml.Unmarshal([]byte(response), &doc)\n\treturn doc.Error()\n}", "func (e *Engine) Stop() {\n\te.running = false\n}", "func (vm *vmQemu) deviceStop(deviceName string, rawConfig deviceConfig.Device) error {\n\td, _, err := vm.deviceLoad(deviceName, rawConfig)\n\n\t// If deviceLoad fails with unsupported device type then return.\n\tif err == device.ErrUnsupportedDevType {\n\t\treturn err\n\t}\n\n\t// If deviceLoad fails for any other reason then just log the error and proceed, as in the\n\t// scenario that a new version of LXD has additional validation restrictions than older\n\t// versions we still need to allow previously valid devices to be stopped.\n\tif err != nil {\n\t\t// If there is no device returned, then we cannot proceed, so return as error.\n\t\tif d == nil {\n\t\t\treturn fmt.Errorf(\"Device stop validation failed for '%s': %v\", deviceName, err)\n\n\t\t}\n\n\t\tlogger.Errorf(\"Device stop validation failed for '%s': %v\", deviceName, err)\n\t}\n\n\tcanHotPlug, _ := d.CanHotPlug()\n\n\t// An empty netns path means we haven't been called from the LXC stop hook, so are running.\n\tif vm.IsRunning() && !canHotPlug {\n\t\treturn fmt.Errorf(\"Device cannot be stopped when instance is running\")\n\t}\n\n\trunConf, err := d.Stop()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif runConf != nil {\n\t\t// Run post stop hooks irrespective of run state of instance.\n\t\terr = vm.runHooks(runConf.PostHooks)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (ms *MarvinServer) Stop() {\n\n}", "func (c *EC2) WaitUntilInstanceStopped(input *DescribeInstancesInput) error {\n\treturn c.WaitUntilInstanceStoppedWithContext(aws.BackgroundContext(), input)\n}", "func (vm *VirtualMachine) Stop(client SkytapClient) (*VirtualMachine, error) {\n\tlog.WithFields(log.Fields{\"vmId\": vm.Id}).Info(\"Stopping VM\")\n\n /*\n\t Need to check current machine state as transitioning from suspended to stopped is not valid.\n\t*/\n\tcheckVm, err := GetVirtualMachine(client, vm.Id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif checkVm.Runstate == RunStatePause {\n\t\treturn nil, fmt.Errorf(\"Unable to stop a suspended VM.\")\n\t}\n\n\t/*\n There are cases where the call will succeed but the VM cannot be transitioned\n\t to stopped. Generally this is a case where the VM was started and immediately\n\t stopped. In this case the VMware tools didn't have an opportunity to full load.\n\t The VMware tools are required to send a graceful shutdown to the VM.\n\t*/\n\tnewVm, err := vm.ChangeRunstate(client, RunStateStop, RunStateStop, RunStateStart)\n\tif err != nil {\n\t\treturn newVm, err\n\t}\n if newVm.Error != false {\n\t return nil, fmt.Errorf(\"Error stopping VM %s, error: %+v\", vm.Id, newVm.Error)\n }\n\treturn newVm, err\n\n}", "func (p *Provider) CheckStopped() {\n\tp.t.Helper()\n\n\tif !p.stopped {\n\t\tp.t.Fatal(\"provider is not stopped\")\n\t}\n}", "func (app *frame) Stop() {\n\tapp.isStopped = true\n}", "func (s *StepTeardownInstance) Run(state multistep.StateBag) multistep.StepAction {\n\tconfig := state.Get(\"config\").(*Config)\n\tdriver := state.Get(\"driver\").(Driver)\n\tui := state.Get(\"ui\").(packer.Ui)\n\n\tname := config.InstanceName\n\tif name == \"\" {\n\t\treturn multistep.ActionHalt\n\t}\n\n\tui.Say(\"Deleting instance...\")\n\tinstanceLog, _ := driver.GetSerialPortOutput(config.Zone, name)\n\tstate.Put(\"instance_log\", instanceLog)\n\terrCh, err := driver.DeleteInstance(config.Zone, name)\n\tif err == nil {\n\t\tselect {\n\t\tcase err = <-errCh:\n\t\tcase <-time.After(config.stateTimeout):\n\t\t\terr = errors.New(\"time out while waiting for instance to delete\")\n\t\t}\n\t}\n\n\tif err != nil {\n\t\tui.Error(fmt.Sprintf(\n\t\t\t\"Error deleting instance. Please delete it manually.\\n\\n\"+\n\t\t\t\t\"Name: %s\\n\"+\n\t\t\t\t\"Error: %s\", name, err))\n\t\treturn multistep.ActionHalt\n\t}\n\tui.Message(\"Instance has been deleted!\")\n\tstate.Put(\"instance_name\", \"\")\n\n\treturn multistep.ActionContinue\n}", "func (m *MockHealthReporter) Stopped(msg string) {\n\tm.Lock()\n\tdefer m.Unlock()\n\tif m.notify == nil {\n\t\treturn\n\t}\n\tm.notify <- Update{Event: \"Stopped\"}\n}", "func (m *DomainMonitor) Stop() {\n\tm.mutex.Lock()\n\tif m.instance != nil {\n\t\tm.instance.Close() // TODO: Decide whether blocking here is acceptable\n\t\tm.instance = nil\n\t}\n\tm.mutex.Unlock()\n}", "func (f *Function) RemoveInstance(isSync bool) (string, error) {\n\tf.Lock()\n\tdefer f.Unlock()\n\n\tlogger := log.WithFields(log.Fields{\"fID\": f.fID, \"isSync\": isSync})\n\n\tlogger.Debug(\"Removing instance\")\n\n\tvar (\n\t\tr string\n\t\terr error\n\t)\n\n\tf.OnceAddInstance = new(sync.Once)\n\n\tif orch.GetSnapshotsEnabled() {\n\t\tf.OffloadInstance()\n\t\tr = \"Successfully offloaded instance \" + f.vmID\n\t} else {\n\t\tif isSync {\n\t\t\terr = orch.StopSingleVM(context.Background(), f.vmID)\n\t\t} else {\n\t\t\tf.RemoveInstanceAsync()\n\t\t\tr = \"Successfully removed (async) instance \" + f.vmID\n\t\t}\n\t}\n\n\treturn r, err\n}", "func (c ContainerLifecycleHooks) Terminated(ctx context.Context) func(container Container) error {\n\treturn containerHookFn(ctx, c.PostTerminates)\n}", "func (t *TimerSnapshot) Stop() {}", "func (vm *VirtualMachine) Stop(args *DomainXML, reply *bool) error {\n\t// Passing the true parameter to ensure the stop vm task is added to waitgroup as this action needs to be completed\n\t// even if there is pending signal termination on rpc\n\t_, err := proc.AddTask(true)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"rpc/server:Stop() Could not add task for vm stop\")\n\t}\n\tdefer proc.TaskDone()\n\n\tlog.Trace(\"rpc/server:Stop() Entering\")\n\tdefer log.Trace(\"rpc/server:Stop() Leaving\")\n\n\twlaMtx.Lock()\n\tdefer wlaMtx.Unlock()\n\n\tif err = validation.ValidateXMLString(args.XML); err != nil {\n\t\tsecLog.Errorf(\"rpc:server() Stop: %s, Invalid domain XML format\", message.InvalidInputBadParam)\n\t\treturn nil\n\t}\n\n\t// pass in vm.Watcher to get the instance to the File System Watcher\n\t*reply = wlavm.Stop(args.XML, vm.Watcher)\n\treturn nil\n}", "func (app *App) Stop() {}", "func (f *RemoteRuntime) Stop() {\n\tf.server.Stop()\n}", "func (app *application) Stop() error {\n\tapp.isStarted = true\n\treturn nil\n}", "func (_m *HostMemoryManager) Stop() {\n\t_m.Called()\n}", "func (vmr *Receiver) Shutdown(context.Context) error {\n\tvmr.mu.Lock()\n\tdefer vmr.mu.Unlock()\n\n\tvar err = componenterror.ErrAlreadyStopped\n\tvmr.stopOnce.Do(func() {\n\t\tvmr.vmc.StopCollection()\n\t\terr = nil\n\t})\n\treturn err\n}", "func (w *UnbondingWatcher) Stop() {\n\tclose(w.quit)\n}", "func (machine *Machine) RunInstanceIfNotAlreadyThere(instance *structures.Instance) {\n\n\t// Check if the instance is already in the local memory\n\t_, exists := machine.Instances.Load(instance.ID)\n\tif exists {\n\t\treturn\n\t}\n\n\t// Wrap the instance in a \"local instance\" that has an abort channel\n\ttask := machine.Tasks[instance.TaskName]\n\tlocalInstance := NewLocalInstance(instance, task)\n\tmachine.Instances.Store(instance.ID, localInstance)\n\n\t// At the end of the run\n\tdefer func() {\n\n\t\t// Recover if it dies\n\t\tr := recover()\n\t\tif r != nil {\n\t\t\tmachine.logger.ForceLog(\"Instance %s died with error %v\",\n\t\t\t\tinstance.ID,\n\t\t\t\tr,\n\t\t\t)\n\t\t}\n\n\t\t// , close the channel and delete the instance it from the local store\n\t\tclose(localInstance.AbortChannel)\n\t\tmachine.Instances.Delete(instance.ID)\n\t\tmachine.logger.Log(\"Done with instance %s\", instance.ID)\n\t}()\n\n\t// Create a timer to trigger the instance at the right time\n\twait := instance.ExecutionTime.Sub(time.Now())\n\ttimer := time.NewTimer(wait)\n\n\t// Execute or Abort the instance\n\tselect {\n\n\t// Execute the instance\n\tcase <-timer.C:\n\n\t\t// Run the task\n\t\tmachine.logger.Log(\"Running instance %s\", instance.ID)\n\t\tresponse, err := task.Run(instance.Parameters)\n\n\t\t// If there is an error on run\n\t\tif err != nil {\n\n\t\t\t// Log the error\n\t\t\tmachine.logger.Log(\"Error on running instance %s - Got %s\", instance.ID, err)\n\n\t\t\t// Run OnFail callback for this task\n\t\t\terr = task.OnFail(err)\n\t\t\tif err != nil {\n\t\t\t\tmachine.logger.Log(\"Error on failing %s - Got %s\", instance.ID, err)\n\t\t\t}\n\n\t\t\t// Save the failed instance in the database\n\t\t\terr = machine.Database.MarkAsFailed(instance.ID)\n\t\t\tif err != nil {\n\t\t\t\tmachine.logger.Log(\"Error on saving failed to db %s\", err)\n\t\t\t}\n\n\t\t\t// Exit the function\n\t\t\treturn\n\n\t\t}\n\n\t\t// No error on run, this instance has successfully completed\n\n\t\t// Run OnSuccess callback\n\t\terr = task.OnSuccess(response)\n\t\tif err != nil {\n\t\t\tmachine.logger.Log(\"Error on success %s - Got %s\", instance.ID, err)\n\t\t}\n\n\t\t// Save the success in the database\n\t\terr = machine.Database.MarkAsSuccessful(instance.ID)\n\t\tif err != nil {\n\t\t\tmachine.logger.Log(\"Error on saving success to db %s\", err)\n\t\t}\n\n\t\t// Abort this instance\n\t\t// This can only happen if the \"AbortInstance\" API has been called\n\t\t// This just prevents the instance from running locally\n\t\t// It is removed from the database by the \"AbortInstance\" function\n\tcase <-localInstance.AbortChannel:\n\t\tmachine.logger.Log(\"Aborting instance %s at %s | Task %s scheduled for %s with parameters %s\",\n\t\t\tinstance.ID,\n\t\t\ttime.Now().String(),\n\t\t\ttask.GetName(),\n\t\t\tinstance.ExecutionTime.String(),\n\t\t\tstring(instance.Parameters),\n\t\t)\n\n\t}\n\n}", "func (cm *ClusterMember) Stop() error {\n\tif !cm.started {\n\t\treturn ErrClusterNotJoined\n\t}\n\n\tcm.started = false\n\treturn nil\n}", "func (bas *BaseService) OnStop() error {\n\treturn nil\n}", "func (_SweetToken *SweetTokenCaller) Stopped(opts *bind.CallOpts) (bool, error) {\n\tvar (\n\t\tret0 = new(bool)\n\t)\n\tout := ret0\n\terr := _SweetToken.contract.Call(opts, out, \"stopped\")\n\treturn *ret0, err\n}", "func (br *Broker) IsStopped() bool {\n\tif br.metaWatcher == nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (c *MockAzureCloud) DetachInstance(i *cloudinstances.CloudInstance) error {\n\treturn errors.New(\"DetachInstance not implemented on azureCloud\")\n}", "func (e *Engine) Stop() {\n\tif atomic.CompareAndSwapInt32(&e.stopping, 0, 1) {\n\t\te.wg.Wait()\n\t\te.running = 0\n\t\te.stopping = 0\n\t}\n}", "func (a *App) Stop() error {\n\tif a.opts.registrar != nil && a.instance != nil {\n\t\tctx, cancel := context.WithTimeout(a.opts.ctx, a.opts.registrarTimeout)\n\t\tdefer cancel()\n\t\tif err := a.opts.registrar.Deregister(ctx, a.instance); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif a.cancel != nil {\n\t\ta.cancel()\n\t}\n\treturn nil\n}", "func (m *Manager) Stop(ctx context.Context, uuid string) error {\n\t// Find the workflow, mark it as stopped.\n\tm.mu.Lock()\n\trw, ok := m.workflows[uuid]\n\tif !ok {\n\t\tm.mu.Unlock()\n\t\treturn fmt.Errorf(\"no running workflow with uuid %v\", uuid)\n\t}\n\trw.stopped = true\n\tm.mu.Unlock()\n\n\t// Cancel the running guy, and waits for it.\n\trw.cancel()\n\tselect {\n\tcase <-rw.done:\n\t\tbreak\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\t}\n\treturn nil\n}", "func (f *Function) OffloadInstance() {\n\tlogger := log.WithFields(log.Fields{\"fID\": f.fID})\n\n\tlogger.Debug(\"Offloading instance\")\n\n\tctx, cancel := context.WithTimeout(context.Background(), time.Second*15)\n\tdefer cancel()\n\n\terr := orch.Offload(ctx, f.vmID)\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\tf.conn.Close()\n}", "func (p *NacosRegisterPlugin) Stop() error {\r\n\t_, ip, port, _ := util.ParseRpcxAddress(p.ServiceAddress)\r\n\r\n\tfor _, name := range p.Services {\r\n\t\tinst := vo.DeregisterInstanceParam{\r\n\t\t\tIp: ip,\r\n\t\t\tEphemeral: true,\r\n\t\t\tPort: uint64(port),\r\n\t\t\tServiceName: name,\r\n\t\t\tCluster: p.Cluster,\r\n\t\t\tGroupName: p.Group,\r\n\t\t}\r\n\t\t_, err := p.namingClient.DeregisterInstance(inst)\r\n\t\tif err != nil {\r\n\t\t\tlog.Errorf(\"faield to deregister %s: %v\", name, err)\r\n\t\t}\r\n\t}\r\n\r\n\treturn nil\r\n}", "func (s *Service) ServiceStopped() {\n\ts.lk.Lock()\n\tdefer s.lk.Unlock()\n\n\tif s.state == Idle || s.state == Stopped {\n\t\treturn\n\t}\n\ts.state = Stopped\n\n\tclose(s.done)\n\tlog.Debugln(s.name, \"- Service has stopped\")\n}", "func (s *BasevhdlListener) ExitInstantiated_unit(ctx *Instantiated_unitContext) {}", "func (app *frame) IsStopped() bool {\n\treturn app.isStopped\n}", "func (fd *failureDetector) Stop() {\n\tfd.stop <- struct{}{}\n}", "func (o *os) NativeVideoStop() {\n\to.ensureSingleton()\n\t//log.Println(\"Calling _OS.NativeVideoStop()\")\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\", \"native_video_stop\")\n\n\t// Call the parent method.\n\t// void\n\tretPtr := gdnative.NewEmptyVoid()\n\tgdnative.MethodBindPtrCall(methodBind, o.GetBaseObject(), ptrArguments, retPtr)\n\n}", "func (s *Stopper) SetStopped() {\n\tif s != nil {\n\t\ts.wg.Done()\n\t}\n}", "func notifyStopping() {\n}", "func (e StaticFeeEstimator) Stop() error {\n\treturn nil\n}", "func (s *Scavenger) Stop() {\n\tif !atomic.CompareAndSwapInt32(&s.status, common.DaemonStatusStarted, common.DaemonStatusStopped) {\n\t\treturn\n\t}\n\ts.scope.IncCounter(metrics.StoppedCount)\n\ts.logger.Info(\"Tasklist scavenger stopping\")\n\tclose(s.stopC)\n\ts.executor.Stop()\n\ts.stopWG.Wait()\n\ts.logger.Info(\"Tasklist scavenger stopped\")\n}", "func (inst *Instance) Exit() {\n\tinst.Engine.Lock()\n\n\tfor i, v := range inst.Engine.CurrentInstances {\n\t\tif v == inst {\n\t\t\tinst.Engine.CurrentInstances = append(inst.Engine.CurrentInstances[:i], inst.Engine.CurrentInstances[i+1:]...)\n\t\t}\n\t}\n\n\tinst.Engine.Unlock()\n\n\tinst.App.Exit(inst)\n}", "func isServiceInstanceFailed(instance *v1beta1.ServiceInstance) bool {\n\treturn isServiceInstanceConditionTrue(instance, v1beta1.ServiceInstanceConditionFailed)\n}", "func (m *Machine) Stop(ctx context.Context) (err error) {\n\tif err := m.UpdateState(\"Machine is stopping\", machinestate.Stopping); err != nil {\n\t\treturn err\n\t}\n\n\tif err := m.StopMachine(ctx); err != nil {\n\t\t// update the state to intial state if something goes wrong, we are going\n\t\t// to change latestate to a more safe state if we passed a certain step\n\t\t// below\n\t\tm.UpdateState(\"Machine is marked as \"+m.State().String(), m.State())\n\t\treturn err\n\t}\n\n\treturn m.markAsStopped()\n}", "func (app *App) Stop(ctx context.Context) error {\n\treturn withTimeout(ctx, app.lifecycle.Stop)\n}", "func (c *Processor) Stop() (err error) {\n\tc.runState = RunStateStopped\n\treturn\n}", "func (m *Instance) UnmarshalJSON(b []byte) error {\n\treturn InstanceJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)\n}", "func Stop() {\n\tstopRunning <- true\n\n}", "func (inf *meshInformer) OnPartOfServiceInstanceStatus(serviceName, instanceID string, gjsonPath GJSONPath, fn ServiceInstanceStatusFunc) error {\n\tstoreKey := layout.ServiceInstanceStatusKey(serviceName, instanceID)\n\tsyncerKey := fmt.Sprintf(\"service-instance-status-%s-%s-%s\", serviceName, instanceID, gjsonPath)\n\n\tspecFunc := func(event Event, value string) bool {\n\t\tinstanceStatus := &spec.ServiceInstanceStatus{}\n\t\tif event.EventType != EventDelete {\n\t\t\tif err := yaml.Unmarshal([]byte(value), instanceStatus); err != nil {\n\t\t\t\tlogger.Errorf(\"BUG: unmarshal %s to yaml failed: %v\", value, err)\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn fn(event, instanceStatus)\n\t}\n\n\treturn inf.onSpecPart(storeKey, syncerKey, gjsonPath, specFunc)\n}", "func (el *Launcher) Stop() error {\n\tlogrus.Debugf(\"engine launcher %v: prepare to stop engine %v\",\n\t\tel.LauncherName, el.currentEngine.EngineName)\n\n\tif _, err := el.currentEngine.Stop(); err != nil {\n\t\treturn err\n\t}\n\tel.lock.Lock()\n\tif !el.isStopping {\n\t\tclose(el.doneCh)\n\t}\n\tel.isStopping = true\n\tel.lock.Unlock()\n\n\tel.updateCh <- el\n\n\tlogrus.Debugf(\"engine launcher %v: succeed to stop engine %v at %v\",\n\t\tel.LauncherName, el.currentEngine.EngineName, el.currentEngine.GetListen())\n\treturn nil\n\n}", "func (_m *MockHistoryEngine) Stop() {\n\t_m.Called()\n}", "func TerminateInstance() {\n\tlog.Println(\"Starting to run terminate instance process\")\n\t// Get instance id and region from metadata\n\tinstanceId, instanceRegion := getInstanceID()\n\tlog.Printf(\"Working on %v in %v region\", instanceId, instanceRegion)\n\n\t// Init aws session\n\tawsSession,_ := initSession(instanceRegion)\n\tlog.Println(\"Initialized aws session\")\n\n\t// Init Aws auto scaling session\n\tinitAutoScalingAwsSession(awsSession)\n\tlog.Println(\"Initialized auto scaling session\")\n\n\t// Get auto scaling group name\n\tinstanceAutoScaleGroupName := getAutoScalingName(instanceId)\n\tlog.Printf(\"Instance %v auto scaling group name is: %v\", instanceId, instanceAutoScaleGroupName)\n\n\t// Set instance scale in policy to false\n\tsuccess := setScaleInProtectionToInstance(instanceAutoScaleGroupName, instanceId)\n\n\t// Terminate ec2 instance after setting scale in policy to false\n\tif success{\n\t\tterminateInstance(instanceId)\n\t}\n}", "func (il *InstanceLogger) Stop() {\n\t// Closes the client and flushes the buffer to Stackdriver\n\tif il.client != nil {\n\t\til.client.Close()\n\t\til.client = nil\n\t} else if il.cancelFunc != nil {\n\t\til.cancelFunc()\n\t\til.cancelFunc = nil\n\t}\n}", "func (s *WorkflowServer) Stop() {\n\n\tgo func() {\n\n\t\tlog.Printf(\"stopping workflow server\")\n\t\ts.cleanup()\n\t\ts.LifeLine <- true\n\n\t}()\n}", "func (ms *MachinePlugin) ShutDownMachine(ctx context.Context, req *cmi.ShutDownMachineRequest) (*cmi.ShutDownMachineResponse, error) {\n\t// Log messages to track start of request\n\tglog.V(2).Infof(\"ShutDown machine request has been recieved for %q\", req.MachineName)\n\tdefer glog.V(2).Infof(\"Machine shutdown request has been processed successfully for %q\", req.MachineName)\n\n\tproviderSpec, secrets, err := decodeProviderSpecAndSecret(req.ProviderSpec, req.Secrets, false)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tinstances, err := ms.getInstancesFromMachineName(req.MachineName, providerSpec, secrets)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsvc, err := ms.createSVC(secrets, providerSpec.Region)\n\tif err != nil {\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\n\tfor _, instance := range instances {\n\t\tinput := &ec2.StopInstancesInput{\n\t\t\tInstanceIds: []*string{\n\t\t\t\taws.String(*instance.InstanceId),\n\t\t\t},\n\t\t\tDryRun: aws.Bool(true),\n\t\t}\n\t\t_, err = svc.StopInstances(input)\n\t\tawsErr, ok := err.(awserr.Error)\n\t\tif ok && awsErr.Code() == \"DryRunOperation\" {\n\t\t\tinput.DryRun = aws.Bool(false)\n\t\t\t_, err := svc.StopInstances(input)\n\t\t\tif err != nil {\n\t\t\t\tglog.V(2).Infof(\"VM %q for Machine %q couldn't be stopped: %s\",\n\t\t\t\t\t*instance.InstanceId,\n\t\t\t\t\treq.MachineName,\n\t\t\t\t\terr.Error(),\n\t\t\t\t)\n\t\t\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t\t\t}\n\n\t\t\tglog.V(2).Infof(\"VM %q for Machine %q was shutdown\", *instance.InstanceId, req.MachineName)\n\n\t\t} else if ok &&\n\t\t\t(awsErr.Code() == ec2.UnsuccessfulInstanceCreditSpecificationErrorCodeInvalidInstanceIdMalformed ||\n\t\t\t\tawsErr.Code() == ec2.UnsuccessfulInstanceCreditSpecificationErrorCodeInvalidInstanceIdNotFound) {\n\n\t\t\tglog.V(2).Infof(\"VM %q for Machine %q does not exist\", *instance.InstanceId, req.MachineName)\n\t\t\treturn &cmi.ShutDownMachineResponse{}, nil\n\t\t}\n\t}\n\n\treturn &cmi.ShutDownMachineResponse{}, nil\n}", "func (_m *TimeTicker) Stop() {\n\t_m.Called()\n}", "func (d *handler) Stop() error {\n\td.deregisterAll()\n\td.interestedEvents = nil\n\treturn nil\n}", "func NewInstanceStoppedWaiter(client DescribeInstancesAPIClient, optFns ...func(*InstanceStoppedWaiterOptions)) *InstanceStoppedWaiter {\n\toptions := InstanceStoppedWaiterOptions{}\n\toptions.MinDelay = 15 * time.Second\n\toptions.MaxDelay = 120 * time.Second\n\toptions.Retryable = instanceStoppedStateRetryable\n\n\tfor _, fn := range optFns {\n\t\tfn(&options)\n\t}\n\treturn &InstanceStoppedWaiter{\n\t\tclient: client,\n\t\toptions: options,\n\t}\n}", "func (p *DockerPod) runningFailedStop(err error) {\n\tlogs.Infof(\"DockerPod in running failed stop, runningContainers: %d\\n\", len(p.runningContainer))\n\tfor name := range p.runningContainer {\n\t\tlogs.Infof(\"DockerPod stop container %s in runningFailedStop\\n\", name)\n\t\t//todo(developerJim): check container real status\n\t\ttask, ok := p.conTasks[name]\n\t\tif !ok {\n\t\t\tlogs.Errorf(\"DockerPod lost previous running container %s info\\n\", name)\n\t\t\tcontinue\n\t\t}\n\t\tif task.HealthCheck != nil {\n\t\t\ttask.HealthCheck.Stop()\n\t\t}\n\t\tp.conClient.StopContainer(name, task.KillPolicy)\n\t\t/*if task.AutoRemove {\n\t\t\tp.conClient.RemoveContainer(name, true)\n\t\t}*/\n\t\ttask.RuntimeConf.Status = container.ContainerStatus_EXITED\n\t\ttask.RuntimeConf.Message = fmt.Sprintf(\"container exit because other container exited in pod\")\n\n\t\tdelete(p.runningContainer, name)\n\t}\n\n\tp.status = container.PodStatus_FAILED\n\tp.message = err.Error()\n\tlogs.Infoln(\"DockerPod runningFailed stop end.\")\n}", "func (taskService TaskService) StopTaskInstanceExecutions(w http.ResponseWriter, r *http.Request) {\n\tvar payload struct {\n\t\tInstanceIDs []gocql.UUID `json:\"instanceIDs\"`\n\t}\n\n\tif err := validator.ExtractStructFromRequest(r, &payload); err != nil {\n\t\tlogger.Log.ErrfCtx(r.Context(), errorcode.ErrorCantDecodeInputData, \"TaskService.StopTaskInstanceExecutions: error while unmarshaling request body. Err=%v\", err)\n\t\tcommon.SendBadRequest(w, r, errorcode.ErrorCantDecodeInputData)\n\t\treturn\n\t}\n\n\tctx := r.Context()\n\ttaskInstances, err := taskService.taskInstancePersistence.GetByIDs(ctx, payload.InstanceIDs...)\n\tif err != nil {\n\t\tlogger.Log.ErrfCtx(r.Context(), errorcode.ErrorCantGetTaskInstances, \"TaskService.StopTaskInstanceExecutions: can't get a Task Instances by TaskInstanceIDs %v. Err=%v\", payload.InstanceIDs, err)\n\t\tcommon.SendInternalServerError(w, r, errorcode.ErrorCantGetTaskInstances)\n\t\treturn\n\t}\n\n\tif len(taskInstances) == 0 {\n\t\tlogger.Log.ErrfCtx(r.Context(), errorcode.ErrorCantGetTaskInstances, \"TaskService.StopTaskInstanceExecutions: error can't get Task Instances by id. Err=%v\", err)\n\t\tcommon.SendBadRequest(w, r, errorcode.ErrorCantGetTaskInstances)\n\t\treturn\n\t}\n\n\tfor i := range taskInstances {\n\t\t// isStopped describes if future execution was stopped at least on one device\n\t\tisStopped := false\n\t\tfor deviceID := range taskInstances[i].Statuses {\n\t\t\tif taskInstances[i].Statuses[deviceID] == statuses.TaskInstancePending {\n\t\t\t\ttaskInstances[i].Statuses[deviceID] = statuses.TaskInstanceStopped\n\t\t\t\tisStopped = true\n\t\t\t}\n\t\t}\n\n\t\tif isStopped {\n\t\t\ttaskInstances[i].OverallStatus = statuses.TaskInstanceStopped\n\t\t}\n\t}\n\n\tfor _, instance := range taskInstances {\n\t\tif err = taskService.taskInstancePersistence.Insert(ctx, instance); err != nil {\n\t\t\tlogger.Log.ErrfCtx(r.Context(), errorcode.ErrorCantUpdateTaskInstances, \"TaskService.StopTaskInstanceExecutions: error while updating Task Instance (ID: %v). Err=%v\", instance.ID, err)\n\t\t\tcommon.SendInternalServerError(w, r, errorcode.ErrorCantUpdateTaskInstances)\n\t\t\treturn\n\t\t}\n\t}\n\n\tlogger.Log.InfofCtx(r.Context(), \"TaskService.StopTaskInstanceExecutions: Tasks' executions are successfully stopped\")\n\tcommon.RenderJSON(w, struct {\n\t\tStatus string\n\t}{Status: \"Complete\"})\n}", "func ContextStopped() context.Context {\n\treturn defaultDaemon.ContextStopped()\n}", "func (client *Client) StopInstancesWithCallback(request *StopInstancesRequest, callback func(response *StopInstancesResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *StopInstancesResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.StopInstances(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "func (p *OnPrem) DeleteInstance(ctx *Context, instancename string) error {\n\treturn fmt.Errorf(\"Operation not supported\")\n}", "func (e *exec) stop(ctx context.Context) {\n\t// Lock the mutex to prevent race conditions with Start\n\te.execMutex.Lock()\n\tdefer e.execMutex.Unlock()\n\n\t// Do the shutdown sequence once until the startup sequence resets\n\te.stopOnce.Do(func() {\n\t\tdefer func() {\n\t\t\t// reset startOnce so the startup sequence can happen again\n\t\t\te.startOnce = sync.Once{}\n\t\t}()\n\t\te.stopFn(ctx)\n\t})\n}", "func (tr *TaskRunner) stop() error {\n\tif tr.logger.IsTrace() {\n\t\tstart := time.Now()\n\t\ttr.logger.Trace(\"running stop hooks\", \"start\", start)\n\t\tdefer func() {\n\t\t\tend := time.Now()\n\t\t\ttr.logger.Trace(\"finished stop hooks\", \"end\", end, \"duration\", end.Sub(start))\n\t\t}()\n\t}\n\n\tvar merr multierror.Error\n\tfor _, hook := range tr.runnerHooks {\n\t\tpost, ok := hook.(interfaces.TaskStopHook)\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 stop hook\", \"name\", name, \"start\", start)\n\t\t}\n\n\t\treq := interfaces.TaskStopRequest{}\n\n\t\torigHookState := tr.hookState(name)\n\t\tif origHookState != nil {\n\t\t\t// Give the hook data provided by prestart\n\t\t\treq.ExistingState = origHookState.Data\n\t\t}\n\n\t\tvar resp interfaces.TaskStopResponse\n\t\tif err := post.Stop(tr.killCtx, &req, &resp); err != nil {\n\t\t\ttr.emitHookError(err, name)\n\t\t\tmerr.Errors = append(merr.Errors, fmt.Errorf(\"stop hook %q failed: %v\", name, err))\n\t\t}\n\n\t\t// Stop hooks cannot alter state and must be idempotent, so\n\t\t// unlike prestart there's no state to persist here.\n\n\t\tif tr.logger.IsTrace() {\n\t\t\tend := time.Now()\n\t\t\ttr.logger.Trace(\"finished stop hook\", \"name\", name, \"end\", end, \"duration\", end.Sub(start))\n\t\t}\n\t}\n\n\treturn merr.ErrorOrNil()\n}", "func (s *Streamer) Stop() error {\n\ts.mu.Lock()\n\tif s.state != stateRunning {\n\t\ts.mu.Unlock()\n\t\treturn ErrNotRunning\n\t}\n\ts.state = stateStopping\n\ts.mu.Unlock()\n\n\ts.fsNotify.Close() // trigger stop chain: fsNotify -> (sendChangeEvents,logNotifyErrors) -> eventsRouter\n\ts.threads.Wait()\n\n\ts.mu.Lock()\n\ts.state = stateStopped\n\ts.mu.Unlock()\n\n\treturn nil\n}", "func (p *Provider) Stop() {\n\tp.stopped = true\n}", "func (service *Service) Stop(context moleculer.BrokerContext) {\n\tif service.stopped != nil {\n\t\tgo service.stopped(context, (*service.schema))\n\t}\n}" ]
[ "0.63991815", "0.63991815", "0.61882704", "0.5981448", "0.5817392", "0.5699502", "0.5610346", "0.5609128", "0.55795753", "0.55674636", "0.5560997", "0.55073065", "0.5502065", "0.5478028", "0.5436529", "0.5361597", "0.5348923", "0.5348379", "0.53252935", "0.5321985", "0.52924645", "0.52821016", "0.5280577", "0.52765805", "0.5268968", "0.52515864", "0.5244048", "0.5237746", "0.5210221", "0.5208099", "0.51546204", "0.5153301", "0.5145359", "0.5139677", "0.51289207", "0.51106375", "0.5110549", "0.5094029", "0.50905097", "0.5085182", "0.5081728", "0.5069615", "0.50672615", "0.5065744", "0.5057493", "0.5048365", "0.5041682", "0.50393575", "0.5038631", "0.5038522", "0.50315475", "0.50239474", "0.50233567", "0.5013135", "0.50114805", "0.49957237", "0.49750248", "0.49728933", "0.49715516", "0.49703458", "0.49646035", "0.496272", "0.49538955", "0.4944448", "0.493404", "0.49332196", "0.4928013", "0.4921545", "0.49189427", "0.49160138", "0.4909926", "0.488629", "0.48847827", "0.48821482", "0.48802426", "0.48749956", "0.4874897", "0.4872643", "0.48724824", "0.48676875", "0.48662287", "0.48661336", "0.48612586", "0.48599148", "0.48581836", "0.4855556", "0.48500133", "0.48494887", "0.4845682", "0.4844958", "0.4836398", "0.4834366", "0.48337042", "0.48336357", "0.48323905", "0.48321873", "0.48321137", "0.48288488", "0.48248714", "0.48098335" ]
0.72205466
0
ResizeDisk uses the override method ResizeDiskFn or the real implementation.
func (c *TestClient) ResizeDisk(project, zone, disk string, drr *compute.DisksResizeRequest) error { if c.ResizeDiskFn != nil { return c.ResizeDiskFn(project, zone, disk, drr) } return c.client.ResizeDisk(project, zone, disk, drr) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (s *Module) DiskResize(name string, size gridtypes.Unit) (disk pkg.VDisk, err error) {\n\tpath, err := s.findDisk(name)\n\tif err != nil {\n\t\treturn disk, errors.Wrapf(os.ErrNotExist, \"disk with id '%s' does not exists\", name)\n\t}\n\n\tfile, err := os.OpenFile(path, os.O_RDWR, 0666)\n\tif err != nil {\n\t\treturn pkg.VDisk{}, err\n\t}\n\n\tdefer file.Close()\n\n\tif err = syscall.Fallocate(int(file.Fd()), 0, 0, int64(size)); err != nil {\n\t\treturn disk, errors.Wrap(err, \"failed to truncate disk to size\")\n\t}\n\n\treturn pkg.VDisk{Path: path, Size: int64(size)}, nil\n}", "func (o *Partition) Resize(ctx context.Context, size uint64, options map[string]dbus.Variant) (err error) {\n\terr = o.object.CallWithContext(ctx, InterfacePartition+\".Resize\", 0, size, options).Store()\n\treturn\n}", "func (o *Filesystem) Resize(ctx context.Context, size uint64, options map[string]dbus.Variant) (err error) {\n\terr = o.object.CallWithContext(ctx, InterfaceFilesystem+\".Resize\", 0, size, options).Store()\n\treturn\n}", "func PartitionResize(diskNum, partNum, size int) error {\n\tcmd := fmt.Sprintf(\"Resize-Partition -DiskNumber %d -PartitionNumber %d -Size %d\", diskNum, partNum, size)\n\t_, err := fnPSCmd(cmd, []string{}, nil)\n\treturn err\n}", "func (handler *volumeHandlerFile) maybeResizeDisk(ctx context.Context, diskfile string, maxsizebytes uint64) error {\n\tif maxsizebytes == 0 {\n\t\treturn nil\n\t}\n\thandler.log.Functionf(\"maybeResizeDisk(%s) current to %d\",\n\t\tdiskfile, maxsizebytes)\n\tsize, resize, err := diskmetrics.CheckResizeDisk(handler.log, diskfile, maxsizebytes)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"maybeResizeDisk checkResizeDisk error: %s\", err)\n\t}\n\tif resize {\n\t\thandler.log.Functionf(\"maybeResizeDisk(%s) resize to %d\",\n\t\t\tdiskfile, size)\n\t\treturn diskmetrics.ResizeImg(ctx, handler.log, diskfile, size)\n\t}\n\treturn nil\n}", "func (b *BoundAccount) Resize(ctx context.Context, oldSz, newSz int64) error {\n\tdelta := newSz - oldSz\n\tswitch {\n\tcase delta > 0:\n\t\treturn b.Grow(ctx, delta)\n\tcase delta < 0:\n\t\tb.Shrink(ctx, -delta)\n\t}\n\treturn nil\n}", "func (r *csiResizer) Resize(pv *v1.PersistentVolume, requestSize resource.Quantity) (resource.Quantity, bool, error) {\n\toldSize := pv.Spec.Capacity[v1.ResourceStorage]\n\n\tvar volumeID string\n\tvar source *v1.CSIPersistentVolumeSource\n\tvar pvSpec v1.PersistentVolumeSpec\n\tvar migrated bool\n\tif pv.Spec.CSI != nil {\n\t\t// handle CSI volume\n\t\tsource = pv.Spec.CSI\n\t\tvolumeID = source.VolumeHandle\n\t\tpvSpec = pv.Spec\n\t} else {\n\t\ttranslator := csitrans.New()\n\t\tif translator.IsMigratedCSIDriverByName(r.name) {\n\t\t\t// handle migrated in-tree volume\n\t\t\tcsiPV, err := translator.TranslateInTreePVToCSI(pv)\n\t\t\tif err != nil {\n\t\t\t\treturn oldSize, false, fmt.Errorf(\"failed to translate persistent volume: %v\", err)\n\t\t\t}\n\t\t\tmigrated = true\n\t\t\tsource = csiPV.Spec.CSI\n\t\t\tpvSpec = csiPV.Spec\n\t\t\tvolumeID = source.VolumeHandle\n\t\t} else {\n\t\t\t// non-migrated in-tree volume\n\t\t\treturn oldSize, false, fmt.Errorf(\"volume %v is not migrated to CSI\", pv.Name)\n\t\t}\n\t}\n\n\tif len(volumeID) == 0 {\n\t\treturn oldSize, false, errors.New(\"empty volume handle\")\n\t}\n\n\tvar secrets map[string]string\n\tsecreRef := source.ControllerExpandSecretRef\n\tif secreRef != nil {\n\t\tvar err error\n\t\tsecrets, err = getCredentials(r.k8sClient, secreRef)\n\t\tif err != nil {\n\t\t\treturn oldSize, false, err\n\t\t}\n\t}\n\n\tcapability, err := r.getVolumeCapabilities(pvSpec)\n\tif err != nil {\n\t\treturn oldSize, false, fmt.Errorf(\"failed to get capabilities of volume %s with %v\", pv.Name, err)\n\t}\n\n\tctx, cancel := timeoutCtx(r.timeout)\n\tresizeCtx := context.WithValue(ctx, connection.AdditionalInfoKey, connection.AdditionalInfo{Migrated: strconv.FormatBool(migrated)})\n\n\tdefer cancel()\n\tnewSizeBytes, nodeResizeRequired, err := r.client.Expand(resizeCtx, volumeID, requestSize.Value(), secrets, capability)\n\tif err != nil {\n\t\treturn oldSize, nodeResizeRequired, err\n\t}\n\n\treturn *resource.NewQuantity(newSizeBytes, resource.BinarySI), nodeResizeRequired, err\n}", "func (fs *FS) ResizeFS(\n\tctx context.Context,\n\tvolumePath, devicePath, ppathDevice,\n\tmpathDevice, fsType string) error {\n\treturn fs.resizeFS(ctx, volumePath, devicePath, ppathDevice, mpathDevice, fsType)\n}", "func (resizer *DeploymentConfigResizer) Resize(namespace, name string, newSize uint, preconditions *kubectl.ResizePrecondition, retry, waitForReplicas *kubectl.RetryParams) error {\n\tif preconditions == nil {\n\t\tpreconditions = &kubectl.ResizePrecondition{-1, \"\"}\n\t}\n\tif retry == nil {\n\t\t// Make it try only once, immediately\n\t\tretry = &kubectl.RetryParams{Interval: time.Millisecond, Timeout: time.Millisecond}\n\t}\n\tcond := kubectl.ResizeCondition(resizer, preconditions, namespace, name, newSize)\n\tif err := wait.Poll(retry.Interval, retry.Timeout, cond); err != nil {\n\t\treturn err\n\t}\n\tif waitForReplicas != nil {\n\t\trc := &kapi.ReplicationController{ObjectMeta: kapi.ObjectMeta{Namespace: namespace, Name: rcName}}\n\t\treturn wait.Poll(waitForReplicas.Interval, waitForReplicas.Timeout,\n\t\t\tresizer.c.ControllerHasDesiredReplicas(rc))\n\t}\n\treturn nil\n}", "func (a ClustersAPI) Resize(clusterID string, clusterSize models.ClusterSize) error {\n\tdata := struct {\n\t\tClusterID string `json:\"cluster_id,omitempty\" url:\"cluster_id,omitempty\"`\n\t\tmodels.ClusterSize\n\t}{\n\t\tclusterID,\n\t\tclusterSize,\n\t}\n\t_, err := a.Client.performQuery(http.MethodPost, \"/clusters/resize\", data, nil)\n\treturn err\n}", "func (c *BlockVolumeClient) Resize(params *BlockVolumeParams) (*BlockVolumeResize, error) {\n\tvar result BlockVolumeResize\n\terr := c.Backend.CallIntoInterface(\"v1/Storage/Block/Volume/resize\", params, &result)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &result, nil\n}", "func (m *AwsVolume) resize() error {\n\tLog.Infof(\"Resizing EBS volume %s\", m.name())\n\tsnapshot, err := m.createSnapshot()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := m.Delete(); err != nil {\n\t\treturn err\n\t}\n\tif err := m.createAwsVolume(snapshot.SnapshotId); err != nil {\n\t\treturn err\n\t}\n\tif err := m.deleteSnapshot(snapshot); err != nil {\n\t\tLog.Errorf(\"Error deleting snapshot %s: %s\", *snapshot.SnapshotId, err.Error())\n\t}\n\treturn nil\n}", "func Resize(image string, size resource.Quantity, preallocate bool) error {\n\treturn qemuIterface.Resize(image, size, preallocate)\n}", "func (r *ImageRef) Resize(scale float64, kernel Kernel) error {\n\treturn r.ResizeWithVScale(scale, -1, kernel)\n}", "func (p *Installer) SetDiskSize(ctx context.Context, minDiskSize uint64, IsSoftMinimum bool) (uint64, error) {\n\twindow := uig.FindWithTimeout(installWindowFindParams, uiTimeout)\n\tradioGroup := window.FindWithTimeout(ui.FindParams{Role: ui.RoleTypeRadioGroup}, uiTimeout)\n\tslider := window.FindWithTimeout(ui.FindParams{Role: ui.RoleTypeSlider}, uiTimeout)\n\n\t// Check whether the virtual keyboard is shown.\n\tvirtualkb, err := vkb.IsShown(ctx, p.tconn)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"failed to check whether virtual keyboard is shown\")\n\t} else if virtualkb {\n\t\t// Hide virtual keyboard.\n\t\tif err := vkb.HideVirtualKeyboard(ctx, p.tconn); err != nil {\n\t\t\treturn 0, errors.Wrap(err, \"failed to hide virtual keyboard\")\n\t\t}\n\t}\n\n\tif err := uig.Do(ctx, p.tconn, uig.Steps(\n\t\tradioGroup.FindWithTimeout(ui.FindParams{Role: ui.RoleTypeStaticText, Name: \"Custom\"}, uiTimeout).LeftClick(),\n\t\tslider.FocusAndWait(uiTimeout),\n\t)); err != nil {\n\t\treturn 0, errors.Wrap(err, \"error in SetDiskSize()\")\n\t}\n\n\t// Use keyboard to manipulate the slider rather than writing\n\t// custom mouse code to click on exact locations on the slider.\n\tkb, err := input.Keyboard(ctx)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"error in SetDiskSize: error opening keyboard\")\n\t}\n\tdefer kb.Close()\n\n\tdefaultSize, err := settings.GetDiskSize(ctx, p.tconn, slider)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"failed to get the initial disk size\")\n\t}\n\tif defaultSize == minDiskSize {\n\t\treturn minDiskSize, nil\n\t}\n\tif defaultSize > minDiskSize {\n\t\t// To make sure that the final disk size is equal or larger than the minDiskSize,\n\t\t// move the slider to the left of minDiskSize first.\n\t\tminimumSize, err := settings.ChangeDiskSize(ctx, p.tconn, kb, slider, false, minDiskSize)\n\t\tif err != nil {\n\t\t\treturn 0, errors.Wrap(err, \"failed to move the disk slider to the left\")\n\t\t}\n\t\tif minimumSize == minDiskSize {\n\t\t\treturn minDiskSize, nil\n\t\t}\n\t\tif minimumSize > minDiskSize {\n\t\t\ttesting.ContextLogf(ctx,\n\t\t\t\t\"The target disk size %v is smaller than the minimum disk size, using the minimum disk size %v\",\n\t\t\t\tminDiskSize, minimumSize)\n\t\t\treturn minimumSize, nil\n\t\t}\n\t}\n\n\tsize, err := settings.ChangeDiskSize(ctx, p.tconn, kb, slider, true, minDiskSize)\n\tif size < minDiskSize {\n\t\tif IsSoftMinimum {\n\t\t\ttesting.ContextLogf(ctx, \"The maximum disk size %v < the target disk size %v, using the maximum disk size %v\", size, minDiskSize, size)\n\t\t\treturn size, nil\n\t\t}\n\t\treturn 0, errors.Errorf(\"could not set disk size to larger than %v\", size)\n\t}\n\treturn size, nil\n}", "func (o *Encrypted) Resize(ctx context.Context, size uint64, options map[string]dbus.Variant) (err error) {\n\terr = o.object.CallWithContext(ctx, InterfaceEncrypted+\".Resize\", 0, size, options).Store()\n\treturn\n}", "func ResizeQcow2(path string, size uint64) error {\n\tdev := \"/dev/nbd0\"\n\tcmd := exec.Command(\"qemu-img\", \"resize\", path, strconv.FormatUint(size, 10))\n\n\tout, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"qemu-img: %s\", utils.OneLine(out))\n\t}\n\n\terr = NBDConnectQcow2(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer NBDDisconnectQcow2()\n\n\terr = ResizeLastPartition(dev)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func ResizeLastPartition(dev string) error {\n\tparts, err := ListPartitions(dev)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"resize %s: %s\", dev, err)\n\t}\n\n\tif len(parts) < 2 {\n\t\treturn fmt.Errorf(\"resize %s: not enough partitions\", dev)\n\t}\n\n\tnum := len(parts) - 2\n\n\tfreeSpace := parts[num+1]\n\tmainPart := parts[num]\n\n\tif freeSpace.Filesystem != \"free\" {\n\t\treturn fmt.Errorf(\"resize %s part %d: no free space available\", dev, num)\n\t}\n\n\tif !strings.HasPrefix(mainPart.Filesystem, \"ext\") {\n\t\treturn fmt.Errorf(\"resize %s part %d: unsupported filesystem type\", dev, num)\n\t}\n\n\tcmd := exec.Command(\"parted\", dev, \"unit\", \"B\", \"resizepart\", strconv.Itoa(mainPart.Number), strconv.FormatUint(freeSpace.End, 10))\n\tout, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"resize %s part %d: %s\", dev, num, utils.OneLine(out))\n\t}\n\n\tcmd = exec.Command(\"e2fsck\", \"-f\", \"-y\", fmt.Sprintf(\"%sp%d\", dev, num))\n\tcmd.Run()\n\n\tcmd = exec.Command(\"resize2fs\", fmt.Sprintf(\"%sp%d\", dev, num))\n\n\tout, err = cmd.CombinedOutput()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"resize %s part %d: %s\", dev, num, utils.OneLine(out))\n\t}\n\n\treturn nil\n}", "func (fs *FS) ResizeMultipath(ctx context.Context, deviceName string) error {\n\treturn fs.resizeMultipath(ctx, deviceName)\n}", "func (c *EBSVolumeResizer) ResizeVolume(volumeID string, newSize int64) error {\n\t/* first check if the volume is already of a requested size */\n\tvolumeOutput, err := c.connection.DescribeVolumes(&ec2.DescribeVolumesInput{VolumeIds: []*string{&volumeID}})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not get information about the volume: %v\", err)\n\t}\n\tvol := volumeOutput.Volumes[0]\n\tif *vol.VolumeId != volumeID {\n\t\treturn fmt.Errorf(\"describe volume %q returned information about a non-matching volume %q\", volumeID, *vol.VolumeId)\n\t}\n\tif *vol.Size == newSize {\n\t\t// nothing to do\n\t\treturn nil\n\t}\n\tinput := ec2.ModifyVolumeInput{Size: &newSize, VolumeId: &volumeID}\n\toutput, err := c.connection.ModifyVolume(&input)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not modify persistent volume: %v\", err)\n\t}\n\n\tstate := *output.VolumeModification.ModificationState\n\tif state == constants.EBSVolumeStateFailed {\n\t\treturn fmt.Errorf(\"could not modify persistent volume %q: modification state failed\", volumeID)\n\t}\n\tif state == \"\" {\n\t\treturn fmt.Errorf(\"received empty modification status\")\n\t}\n\tif state == constants.EBSVolumeStateOptimizing || state == constants.EBSVolumeStateCompleted {\n\t\treturn nil\n\t}\n\t// wait until the volume reaches the \"optimizing\" or \"completed\" state\n\tin := ec2.DescribeVolumesModificationsInput{VolumeIds: []*string{&volumeID}}\n\treturn retryutil.Retry(constants.EBSVolumeResizeWaitInterval, constants.EBSVolumeResizeWaitTimeout,\n\t\tfunc() (bool, error) {\n\t\t\tout, err := c.connection.DescribeVolumesModifications(&in)\n\t\t\tif err != nil {\n\t\t\t\treturn false, fmt.Errorf(\"could not describe volume modification: %v\", err)\n\t\t\t}\n\t\t\tif len(out.VolumesModifications) != 1 {\n\t\t\t\treturn false, fmt.Errorf(\"describe volume modification didn't return one record for volume %q\", volumeID)\n\t\t\t}\n\t\t\tif *out.VolumesModifications[0].VolumeId != volumeID {\n\t\t\t\treturn false, fmt.Errorf(\"non-matching volume id when describing modifications: %q is different from %q\",\n\t\t\t\t\t*out.VolumesModifications[0].VolumeId, volumeID)\n\t\t\t}\n\t\t\treturn *out.VolumesModifications[0].ModificationState != constants.EBSVolumeStateModifying, nil\n\t\t})\n}", "func (r *EBSVolumeResizer) ResizeVolume(volumeID string, newSize int64) error {\n\t/* first check if the volume is already of a requested size */\n\tvolumeOutput, err := r.connection.DescribeVolumes(&ec2.DescribeVolumesInput{VolumeIds: []*string{&volumeID}})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not get information about the volume: %v\", err)\n\t}\n\tvol := volumeOutput.Volumes[0]\n\tif *vol.VolumeId != volumeID {\n\t\treturn fmt.Errorf(\"describe volume %q returned information about a non-matching volume %q\", volumeID, *vol.VolumeId)\n\t}\n\tif *vol.Size == newSize {\n\t\t// nothing to do\n\t\treturn nil\n\t}\n\tinput := ec2.ModifyVolumeInput{Size: &newSize, VolumeId: &volumeID}\n\toutput, err := r.connection.ModifyVolume(&input)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not modify persistent volume: %v\", err)\n\t}\n\n\tstate := *output.VolumeModification.ModificationState\n\tif state == constants.EBSVolumeStateFailed {\n\t\treturn fmt.Errorf(\"could not modify persistent volume %q: modification state failed\", volumeID)\n\t}\n\tif state == \"\" {\n\t\treturn fmt.Errorf(\"received empty modification status\")\n\t}\n\tif state == constants.EBSVolumeStateOptimizing || state == constants.EBSVolumeStateCompleted {\n\t\treturn nil\n\t}\n\t// wait until the volume reaches the \"optimizing\" or \"completed\" state\n\tin := ec2.DescribeVolumesModificationsInput{VolumeIds: []*string{&volumeID}}\n\treturn retryutil.Retry(constants.EBSVolumeResizeWaitInterval, constants.EBSVolumeResizeWaitTimeout,\n\t\tfunc() (bool, error) {\n\t\t\tout, err := r.connection.DescribeVolumesModifications(&in)\n\t\t\tif err != nil {\n\t\t\t\treturn false, fmt.Errorf(\"could not describe volume modification: %v\", err)\n\t\t\t}\n\t\t\tif len(out.VolumesModifications) != 1 {\n\t\t\t\treturn false, fmt.Errorf(\"describe volume modification didn't return one record for volume %q\", volumeID)\n\t\t\t}\n\t\t\tif *out.VolumesModifications[0].VolumeId != volumeID {\n\t\t\t\treturn false, fmt.Errorf(\"non-matching volume id when describing modifications: %q is different from %q\",\n\t\t\t\t\t*out.VolumesModifications[0].VolumeId, volumeID)\n\t\t\t}\n\t\t\treturn *out.VolumesModifications[0].ModificationState != constants.EBSVolumeStateModifying, nil\n\t\t})\n}", "func (util *multiPathUtil) ResizeMultiPathDev(dm string) error {\n\t//first do a reconfigure\n\tif _, err := utils.Execute(\"multipathd\", \"reconfigure\"); err != nil {\n\t\treturn err\n\t}\n\n\t//do a wait so that resize will not report timeout\n\ttime.Sleep(time.Duration(util.resizeDelay) * time.Second)\n\n\t//then do a resize operation\n\tif _, err := utils.Execute(\"multipathd\", \"resize\", \"map\", dm); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (s *Module) DiskCreate(name string, size gridtypes.Unit) (disk pkg.VDisk, err error) {\n\tpath, err := s.findDisk(name)\n\tif err == nil {\n\t\treturn disk, errors.Wrapf(os.ErrExist, \"disk with id '%s' already exists\", name)\n\t}\n\n\tbase, err := s.diskFindCandidate(size)\n\tif err != nil {\n\t\treturn disk, errors.Wrapf(err, \"failed to find a candidate to host vdisk of size '%d'\", size)\n\t}\n\n\tpath, err = s.safePath(base, name)\n\tif err != nil {\n\t\treturn disk, err\n\t}\n\n\tdefer func() {\n\t\t// clean up disk file if error\n\t\tif err != nil {\n\t\t\tos.RemoveAll(path)\n\t\t}\n\t}()\n\n\tdefer syscall.Sync()\n\n\tvar file *os.File\n\tfile, err = os.Create(path)\n\tif err != nil {\n\t\treturn disk, err\n\t}\n\n\tdefer file.Close()\n\tif err = chattr.SetAttr(file, chattr.FS_NOCOW_FL); err != nil {\n\t\treturn disk, err\n\t}\n\n\tif err = syscall.Fallocate(int(file.Fd()), 0, 0, int64(size)); err != nil {\n\t\treturn disk, errors.Wrap(err, \"failed to truncate disk to size\")\n\t}\n\n\treturn pkg.VDisk{Path: path, Size: int64(size)}, nil\n}", "func (pb PageBlobURL) Resize(ctx context.Context, size int64, ac BlobAccessConditions, cpk ClientProvidedKeyOptions) (*PageBlobResizeResponse, error) {\n\tifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag := ac.ModifiedAccessConditions.pointers()\n\treturn pb.pbClient.Resize(ctx, size, nil, ac.LeaseAccessConditions.pointers(),\n\t\tcpk.EncryptionKey, cpk.EncryptionKeySha256, cpk.EncryptionAlgorithm, // CPK\n\t\tcpk.EncryptionScope, // CPK-N\n\t\tifModifiedSince, ifUnmodifiedSince, ifMatchETag, ifNoneMatchETag, nil, nil)\n}", "func Resize(client *gophercloud.ServiceClient, id string, opts ResizeOptsBuilder) (r ActionResult) {\n\tb, err := opts.ToServerResizeMap()\n\tif err != nil {\n\t\tr.Err = err\n\t\treturn\n\t}\n\tresp, err := client.Post(actionURL(client, id), b, nil, nil)\n\t_, r.Header, r.Err = gophercloud.ParseResponse(resp, err)\n\treturn\n}", "func (c *Client) Resize(width, height int) error {\n\twidth = 1000000 // TODO: Remove this dirty workaround for text overflow once ssh/terminal is fixed\n\terr := c.Term.SetSize(width, height)\n\tif err != nil {\n\t\tlog.Printf(\"Resize failed: %dx%d\", width, height)\n\t\treturn err\n\t}\n\tc.termWidth, c.termHeight = width, height\n\treturn nil\n}", "func (image *Image) Resize(dimensions *Dimensions, dest string) {\n\tfmt.Println(\"[Resize] \", image.Filename, dimensions)\n\n\tcmd := exec.Command(\"convert\", image.Filename, \"-auto-orient\", \"-resize\", dimensions.String+\">\", \"-quality\", \"80\", \"-strip\", \"-depth\", \"8\", dest)\n\tfmt.Println(\"[Resize] execute:\", cmd.Args)\n\tout, err := cmd.CombinedOutput()\n\n\tif err != nil {\n\t\tfmt.Println(\"[Resize] error: \", string(out[:]), err)\n\t}\n}", "func (r *ProjectsLocationsVolumesService) Resize(volume string, resizevolumerequest *ResizeVolumeRequest) *ProjectsLocationsVolumesResizeCall {\n\tc := &ProjectsLocationsVolumesResizeCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.volume = volume\n\tc.resizevolumerequest = resizevolumerequest\n\treturn c\n}", "func Resize(ctx context.Context, client *v1.ServiceClient, clusterID, nodegroupID string, opts *ResizeOpts) (*v1.ResponseResult, error) {\n\tresizeNodegroupOpts := struct {\n\t\tNodegroup *ResizeOpts `json:\"nodegroup\"`\n\t}{\n\t\tNodegroup: opts,\n\t}\n\trequestBody, err := json.Marshal(resizeNodegroupOpts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\turl := strings.Join([]string{client.Endpoint, v1.ResourceURLCluster, clusterID, v1.ResourceURLNodegroup, nodegroupID, v1.ResourceURLResize}, \"/\")\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 (s *Module) DiskWrite(name string, image string) error {\n\tpath, err := s.findDisk(name)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"couldn't find disk with id: %s\", name)\n\t}\n\n\tif !s.isEmptyDisk(path) {\n\t\tlog.Debug().Str(\"disk\", path).Msg(\"disk already has a filesystem. no write\")\n\t\treturn nil\n\t}\n\n\tsource, err := os.Open(image)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to open image\")\n\t}\n\tdefer source.Close()\n\tfile, err := os.OpenFile(path, os.O_WRONLY, 0644)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer file.Close()\n\timgStat, err := source.Stat()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to stat image\")\n\t}\n\tfileStat, err := file.Stat()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to state disk\")\n\t}\n\n\tif imgStat.Size() > fileStat.Size() {\n\t\treturn fmt.Errorf(\"image size is bigger than disk\")\n\t}\n\n\t_, err = io.Copy(file, source)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to write disk image\")\n\t}\n\n\treturn nil\n}", "func (resizer *DeploymentConfigResizer) ResizeSimple(namespace, name string, preconditions *kubectl.ResizePrecondition, newSize uint) (string, error) {\n\tconst resized = \"resized\"\n\tcontroller, err := resizer.c.GetReplicationController(namespace, name)\n\tif err != nil {\n\t\treturn \"\", kubectl.ControllerResizeError{kubectl.ControllerResizeGetFailure, \"Unknown\", err}\n\t}\n\tif preconditions != nil {\n\t\tif err := preconditions.Validate(controller); err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t}\n\tcontroller.Spec.Replicas = int(newSize)\n\t// TODO: do retry on 409 errors here?\n\tif _, err := resizer.c.UpdateReplicationController(namespace, controller); err != nil {\n\t\treturn \"\", kubectl.ControllerResizeError{kubectl.ControllerResizeUpdateFailure, controller.ResourceVersion, err}\n\t}\n\t// TODO: do a better job of printing objects here.\n\treturn resized, nil\n}", "func ResizeVolume(vol *apis.ZFSVolume, newSize int64) error {\n\n\tvol.Spec.Capacity = strconv.FormatInt(int64(newSize), 10)\n\n\t_, err := volbuilder.NewKubeclient().WithNamespace(OpenEBSNamespace).Update(vol)\n\treturn err\n}", "func (c *UHostClient) NewResizeAttachedDiskRequest() *ResizeAttachedDiskRequest {\n\treq := &ResizeAttachedDiskRequest{}\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 (m *MockService) ResizeStorageFilesystem(ctx context.Context, r *request.ResizeStorageFilesystemRequest) (*upcloud.ResizeStorageFilesystemBackup, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ResizeStorageFilesystem\", ctx, r)\n\tret0, _ := ret[0].(*upcloud.ResizeStorageFilesystemBackup)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (tt *TtTable) Resize(sizeInMByte int) {\n\tif sizeInMByte > MaxSizeInMB {\n\t\ttt.log.Error(out.Sprintf(\"Requested size for TT of %d MB reduced to max of %d MB\", sizeInMByte, MaxSizeInMB))\n\t\tsizeInMByte = MaxSizeInMB\n\t}\n\n\t// calculate the maximum power of 2 of entries fitting into the given size in MB\n\ttt.sizeInByte = uint64(sizeInMByte) * MB\n\ttt.maxNumberOfEntries = 1 << uint64(math.Floor(math.Log2(float64(tt.sizeInByte/TtEntrySize))))\n\ttt.hashKeyMask = tt.maxNumberOfEntries - 1 // --> 0x0001111....111\n\n\t// if TT is resized to 0 we cant have any entries.\n\tif tt.sizeInByte == 0 {\n\t\ttt.maxNumberOfEntries = 0\n\t}\n\n\t// calculate the real memory usage\n\ttt.sizeInByte = tt.maxNumberOfEntries * TtEntrySize\n\n\t// Create new slice/array - garbage collections takes care of cleanup\n\ttt.data = make([]TtEntry, tt.maxNumberOfEntries, tt.maxNumberOfEntries)\n\n\ttt.log.Info(out.Sprintf(\"TT Size %d MByte, Capacity %d entries (size=%dByte) (Requested were %d MBytes)\",\n\t\ttt.sizeInByte/MB, tt.maxNumberOfEntries, unsafe.Sizeof(TtEntry{}), sizeInMByte))\n\ttt.log.Debug(util.MemStat())\n}", "func (r *Disk) ApplyTo(m *model.Disk) {\n\tm.Name = r.Name\n\tm.Description = r.Description\n\tm.Shared = r.bool(r.Sharable)\n\tm.Profile = r.Profile.ID\n\tm.Status = r.Status\n\tm.ActualSize = r.int64(r.ActualSize)\n\tm.Backup = r.Backup\n\tm.StorageType = r.StorageType\n\tm.ProvisionedSize = r.int64(r.ProvisionedSize)\n\tr.setStorageDomain(m)\n}", "func (contour DrawContour) resizeByFactor(factor int) {\n\tcontour.factor = factor\n}", "func (e *Engine) ExecResize(_ context.Context, _ string, _, _ uint) (err error) {\n\terr = types.ErrEngineNotImplemented\n\treturn\n}", "func (c *Cmd) Resize(width int, height int) error {\n\twindow := struct {\n\t\trow uint16\n\t\tcol uint16\n\t\tx uint16\n\t\ty uint16\n\t}{\n\t\tuint16(height),\n\t\tuint16(width),\n\t\t0,\n\t\t0,\n\t}\n\t_, _, errno := syscall.Syscall(\n\t\tsyscall.SYS_IOCTL,\n\t\tc.pty.Fd(),\n\t\tsyscall.TIOCSWINSZ,\n\t\tuintptr(unsafe.Pointer(&window)),\n\t)\n\tif errno != 0 {\n\t\treturn errno\n\t}\n\treturn nil\n}", "func (s stage) partitionDisk(dev types.Disk, devAlias string) error {\n\tif cutil.IsTrue(dev.WipeTable) {\n\t\top := sgdisk.Begin(s.Logger, devAlias)\n\t\ts.Logger.Info(\"wiping partition table requested on %q\", devAlias)\n\t\top.WipeTable(true)\n\t\tif err := op.Commit(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Ensure all partitions with number 0 are last\n\tsort.Stable(PartitionList(dev.Partitions))\n\n\top := sgdisk.Begin(s.Logger, devAlias)\n\n\tdiskInfo, err := s.getPartitionMap(devAlias)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// get a list of parititions that have size and start 0 replaced with the real sizes\n\t// that would be used if all specified partitions were to be created anew.\n\t// Also calculate sectors for all of the start/size values.\n\tresolvedPartitions, err := s.getRealStartAndSize(dev, devAlias, diskInfo)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, part := range resolvedPartitions {\n\t\tshouldExist := partitionShouldExist(part)\n\t\tinfo, exists := diskInfo.GetPartition(part.Number)\n\t\tvar matchErr error\n\t\tif exists {\n\t\t\tmatchErr = partitionMatches(info, part)\n\t\t}\n\t\tmatches := exists && matchErr == nil\n\t\twipeEntry := cutil.IsTrue(part.WipePartitionEntry)\n\n\t\t// This is a translation of the matrix in the operator notes.\n\t\tswitch {\n\t\tcase !exists && !shouldExist:\n\t\t\ts.Logger.Info(\"partition %d specified as nonexistant and no partition was found. Success.\", part.Number)\n\t\tcase !exists && shouldExist:\n\t\t\top.CreatePartition(part)\n\t\tcase exists && !shouldExist && !wipeEntry:\n\t\t\treturn fmt.Errorf(\"partition %d exists but is specified as nonexistant and wipePartitionEntry is false\", part.Number)\n\t\tcase exists && !shouldExist && wipeEntry:\n\t\t\top.DeletePartition(part.Number)\n\t\tcase exists && shouldExist && matches:\n\t\t\ts.Logger.Info(\"partition %d found with correct specifications\", part.Number)\n\t\tcase exists && shouldExist && !wipeEntry && !matches:\n\t\t\tif partitionMatchesResize(info, part) {\n\t\t\t\ts.Logger.Info(\"resizing partition %d\", part.Number)\n\t\t\t\top.DeletePartition(part.Number)\n\t\t\t\tpart.Number = info.Number\n\t\t\t\tpart.GUID = &info.GUID\n\t\t\t\tpart.TypeGUID = &info.TypeGUID\n\t\t\t\tpart.Label = &info.Label\n\t\t\t\tpart.StartSector = &info.StartSector\n\t\t\t\top.CreatePartition(part)\n\t\t\t} else {\n\t\t\t\treturn fmt.Errorf(\"Partition %d didn't match: %v\", part.Number, matchErr)\n\t\t\t}\n\t\tcase exists && shouldExist && wipeEntry && !matches:\n\t\t\ts.Logger.Info(\"partition %d did not meet specifications, wiping partition entry and recreating\", part.Number)\n\t\t\top.DeletePartition(part.Number)\n\t\t\top.CreatePartition(part)\n\t\tdefault:\n\t\t\t// unfortunatey, golang doesn't check that all cases are handled exhaustively\n\t\t\treturn fmt.Errorf(\"Unreachable code reached when processing partition %d. golang--\", part.Number)\n\t\t}\n\t}\n\n\tif err := op.Commit(); err != nil {\n\t\treturn fmt.Errorf(\"commit failure: %v\", err)\n\t}\n\treturn nil\n}", "func (c *Compute) Disk(name string) (string, error) {\n\tdisk, err := c.Disks.Get(c.Project, c.Zone, name).Do()\n\tif err == nil {\n\t\tlog.Printf(\"found existing root disk: %q\", disk.SelfLink)\n\t\treturn disk.SelfLink, nil\n\t}\n\tlog.Printf(\"not found, creating new root disk: %q\", name)\n\top, err := c.Disks.Insert(c.Project, c.Zone, &compute.Disk{\n\t\tName: name,\n\t}).SourceImage(*image).Do()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"disk insert api call failed: %v\", err)\n\t}\n\tif err := c.wait(op); err != nil {\n\t\treturn \"\", fmt.Errorf(\"disk insert operation failed: %v\", err)\n\t}\n\tlog.Printf(\"root disk created: %q\", op.TargetLink)\n\treturn op.TargetLink, nil\n}", "func resize(p interface{}) (gravity.TestFunc, error) {\n\tparam := p.(resizeParam)\n\n\treturn func(g *gravity.TestContext, cfg gravity.ProvisionerConfig) {\n\t\tcluster, err := g.Provision(cfg.WithOS(param.OSFlavor).\n\t\t\tWithStorageDriver(param.DockerStorageDriver).\n\t\t\tWithNodes(param.ToNodes))\n\t\tg.OK(\"provision nodes\", err)\n\t\tdefer func() {\n\t\t\tg.Maybe(\"destroy\", cluster.Destroy())\n\t\t}()\n\n\t\tg.OK(\"download installer\", g.SetInstaller(cluster.Nodes, cfg.InstallerURL, \"install\"))\n\t\tg.OK(fmt.Sprintf(\"install on %d node\", param.NodeCount),\n\t\t\tg.OfflineInstall(cluster.Nodes[0:param.NodeCount], param.InstallParam))\n\t\tg.OK(\"status\", g.Status(cluster.Nodes[0:param.NodeCount]))\n\t\tg.OK(\"time sync\", g.CheckTimeSync(cluster.Nodes))\n\t\tg.OK(fmt.Sprintf(\"expand to %d nodes\", param.ToNodes),\n\t\t\tg.Expand(cluster.Nodes[0:param.NodeCount], cluster.Nodes[param.NodeCount:param.ToNodes],\n\t\t\t\tparam.InstallParam))\n\t\tg.OK(\"status\", g.Status(cluster.Nodes[0:param.ToNodes]))\n\t}, nil\n}", "func (self *Rectangle) Resize(width int, height int) *Rectangle{\n return &Rectangle{self.Object.Call(\"resize\", width, height)}\n}", "func (w *DiskImage) Truncate(size int64) error {\n\treturn nil\n}", "func (f FileURL) Resize(ctx context.Context, length int64) (*FileSetHTTPHeadersResponse, error) {\n\treturn f.fileClient.SetHTTPHeaders(ctx, \"preserve\", \"preserve\", \"preserve\", nil,\n\t\t&length, nil, nil, nil, nil,\n\t\tnil, nil, &defaultPreserveString, nil)\n}", "func (p *OnPrem) ResizeImage(ctx *Context, imagename string, hbytes string) error {\n\topshome := GetOpsHome()\n\timgpath := path.Join(opshome, \"images\", imagename)\n\n\tbytes, err := parseBytes(hbytes)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn os.Truncate(imgpath, bytes)\n}", "func resize(w io.Writer, r io.Reader, size []int) error {\n\timg, mimetype, err := image.Decode(r)\n\tif size == nil || err != nil {\n\t\tio.Copy(w, r)\n\t\treturn nil\n\t}\n\n\tib := img.Bounds()\n\n\tsize = fitToActualSize(&img, size)\n\tx := size[0]\n\ty := size[1]\n\n\t// set optimal thumbnail size\n\twrat := float64(x) / float64(ib.Dx())\n\thrat := float64(y) / float64(ib.Dy())\n\tif wrat <= hrat {\n\t\ty = int(wrat * float64(ib.Dy()))\n\t} else {\n\t\tx = int(hrat * float64(ib.Dx()))\n\t}\n\n\tdst := image.NewRGBA(image.Rect(0, 0, x, y))\n\tgraphics.Thumbnail(dst, img)\n\n\treturn writeByMimetype(w, dst, mimetype)\n}", "func (client Client) ChangeSizePreparer(ctx context.Context, nasVolumeInstanceNo string, volumeSize string) (*http.Request, error) {\n\tqueryParameters := map[string]interface{}{\n\t\t\"nasVolumeInstanceNo\": autorest.Encode(\"query\", nasVolumeInstanceNo),\n\t\t\"responseFormatType\": autorest.Encode(\"query\", \"json\"),\n\t\t\"volumeSize\": autorest.Encode(\"query\", volumeSize),\n\t}\n\n\tqueryParameters[\"regionCode\"] = autorest.Encode(\"query\", \"FKR\")\n\n\ttimestamp := strconv.FormatInt(time.Now().UnixNano()/int64(time.Millisecond), 10)\n\tsec := security.NewSignature(client.Secretkey, crypto.SHA256)\n\tsignature, err := sec.Signature(\"POST\", common.GetPath(DefaultBaseURI, \"/changeNasVolumeSize\")+\"?\"+common.GetQuery(queryParameters), client.AccessKey, timestamp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsPost(),\n\t\tautorest.WithBaseURL(client.BaseURI),\n\t\tautorest.WithPath(\"/changeNasVolumeSize\"),\n\t\tautorest.WithQueryParameters(queryParameters),\n\t\tautorest.WithHeader(\"x-ncp-apigw-timestamp\", timestamp),\n\t\tautorest.WithHeader(\"x-ncp-iam-access-key\", client.AccessKey),\n\t\tautorest.WithHeader(\"x-ncp-apigw-signature-v2\", signature))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "func (gdt *Array) Resize(size Int) {\n\targ0 := gdt.getBase()\n\targ1 := size.getBase()\n\n\tC.go_godot_array_resize(GDNative.api, arg0, arg1)\n}", "func (*FileSystemBase) Truncate(path string, size int64, fh uint64) int {\n\treturn -ENOSYS\n}", "func (contour DrawContour) ResizeByFactor(factor int) {\n\tcontour.Factor = factor\n}", "func (g *grid) Resize(width, height int, removedFn func(x, y int, o interface{})) {\n\tLogger.Printf(\"%g.Resize(%d,%d)\\n\", width, height)\n\tg.Lock()\n\tdefer g.Unlock()\n\n\told := g.data\n\tg.data = make([]*locator, width*height)\n\tg.width = width\n\tg.height = height\n\n\tfor _, l := range old {\n\t\tif l != nil {\n\t\t\tif l.x >= width || l.y >= height {\n\t\t\t\tif removedFn != nil {\n\t\t\t\t\tremovedFn(l.x, l.y, l.v)\n\t\t\t\t}\n\t\t\t\tg.RecordRemove(l.x, l.y, l.v)\n\t\t\t} else {\n\t\t\t\tg.data[g.offset(l.x, l.y)] = l\n\t\t\t}\n\t\t}\n\t}\n}", "func (p *process) Resize(_ context.Context, width, height uint32) error {\n\tp.mu.Lock()\n\thcsProcess := p.hcsProcess\n\tp.mu.Unlock()\n\tif hcsProcess == nil {\n\t\treturn errors.WithStack(errdefs.NotFound(errors.New(\"process not found\")))\n\t}\n\n\tp.ctr.client.logger.WithFields(log.Fields{\n\t\t\"container\": p.ctr.id,\n\t\t\"process\": p.id,\n\t\t\"height\": height,\n\t\t\"width\": width,\n\t\t\"pid\": hcsProcess.Pid(),\n\t}).Debug(\"resizing\")\n\treturn hcsProcess.ResizeConsole(uint16(width), uint16(height))\n}", "func (p *Init) Resize(ws console.WinSize) error {\n\tp.mu.Lock()\n\tdefer p.mu.Unlock()\n\n\tif p.console == nil {\n\t\treturn nil\n\t}\n\treturn p.console.Resize(ws)\n}", "func (c *Config) Resize(h, w int) error {\n\tselect {\n\tcase <-c.waitStart:\n\tcase <-time.After(time.Second):\n\t\treturn derr.ErrorCodeExecResize.WithArgs(c.ID)\n\t}\n\treturn c.ProcessConfig.Terminal.Resize(h, w)\n}", "func (cache *Cache) Resize(capacity int) {\n\tcache.mu.Lock()\n\tdefer cache.mu.Unlock()\n\n\tcache.resize(capacity)\n}", "func partitionMatchesResize(existing util.PartitionInfo, spec sgdisk.Partition) bool {\n\treturn cutil.IsTrue(spec.Resize) && partitionMatchesCommon(existing, spec) == nil\n}", "func (j *AuroraJob) Disk(disk int64) Job {\n\t*j.resources[DISK].DiskMb = disk\n\treturn j\n}", "func (handler *volumeHandlerFile) expandableDisk() bool {\n\tif handler.status.ContentFormat == zconfig.Format_ISO {\n\t\treturn false\n\t}\n\treturn true\n}", "func (cq *cQT) resize(sz uint32) {\n\tb := make([]T, 0, sz)\n\tsi, ei := cq.s&cq.m, cq.e&cq.m\n\tif si < ei {\n\t\tb = append(b, cq.b[si:ei]...)\n\t} else {\n\t\tb = append(b, cq.b[si:]...)\n\t\tb = append(b, cq.b[:ei]...)\n\t}\n\tcq.b = b[:sz]\n\tcq.s, cq.e = 0, cq.e-cq.s\n\tcq.sz = sz\n\tcq.m = sz - 1\n}", "func (b *Element) Resize(sz fyne.Size) {\n\tif b.size == sz {\n\t\treturn\n\t}\n\n\tb.parseDims(sz)\n\n\tif b.Name == \"inputElement\" || b.Name == \"inputView\" {\n\t\tfmt.Println(\"--Resize:\", b.Name, sz, b.parsedDims.minW)\n\t}\n\n\tb.size = sz\n\tb.claimed = b.minSize\n\tst := b.Style\n\tdims := &b.parsedDims\n\tif st.Position == PositionAbsolute {\n\t\tb.claimed = sz\n\t} else if st.Display == DisplayBlock {\n\t\t// block Element is greedy in x.\n\t\tb.claimed.Width = sz.Width\n\t\tif dims.width != 0 {\n\t\t\tb.claimed.Width = dims.width\n\t\t} else if b.claimed.Width < dims.minW {\n\t\t\tb.claimed.Width = dims.minW\n\t\t} else if dims.maxW != 0 && b.claimed.Width > dims.maxW {\n\t\t\tb.claimed.Width = dims.maxW\n\t\t}\n\t}\n\tif st.ExpandVertically {\n\t\tb.claimed.Height = sz.Height\n\t}\n\n\tif b.Name == \"inputElement\" {\n\t\tfmt.Println(\"--claimed:\", b.claimed)\n\t}\n\n\tif b.Name == \"inputElement\" || b.Name == \"inputView\" {\n\t\tfmt.Println(\"--claimed:\", b.Name, b.claimed)\n\t}\n\n\t// // Give the kids a chance to be greedy too.\n\tfor _, o := range b.kids {\n\t\tif isNativeInline(o) || isAbsolutelyPositioned(o) {\n\t\t\tcontinue\n\t\t}\n\t\tif b.Name == \"homeBox\" || b.Name == \"appRow\" {\n\t\t\tfmt.Printf(\"-- %s resizing child %T \\n\", b.Name, o)\n\t\t}\n\t\to.Resize(b.claimed)\n\t}\n\t// Recalculate our own MinSize.\n\tb.Refresh()\n\tif b.cachedRenderer != nil {\n\t\tb.cachedRenderer.Layout(b.claimed)\n\t}\n}", "func WriteImageToDisk(outDir, fileName string) func(model.Image, bool, int) error {\n\treturn func(img model.Image, singleImgPerPage bool, maxPageDigits int) error {\n\t\tif img.Reader == nil {\n\t\t\treturn nil\n\t\t}\n\t\ts := \"%s_%\" + fmt.Sprintf(\"0%dd\", maxPageDigits)\n\t\tqual := img.Name\n\t\tif img.Thumb {\n\t\t\tqual = \"thumb\"\n\t\t}\n\t\tf := fmt.Sprintf(s+\"_%s.%s\", fileName, img.PageNr, qual, img.FileType)\n\t\t// if singleImgPerPage {\n\t\t// \tif img.thumb {\n\t\t// \t\ts += \"_\" + qual\n\t\t// \t}\n\t\t// \tf = fmt.Sprintf(s+\".%s\", fileName, img.pageNr, img.FileType)\n\t\t// }\n\t\toutFile := filepath.Join(outDir, f)\n\t\tlog.CLI.Printf(\"writing %s\\n\", outFile)\n\t\treturn WriteReader(outFile, img)\n\t}\n}", "func (c *UPHostClient) NewResizePHostAttachedDiskRequest() *ResizePHostAttachedDiskRequest {\n\treq := &ResizePHostAttachedDiskRequest{}\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 (b *Buffer) Resize(w, h int) (*Buffer, error) {\n\treturn nil, errors.New(\"Not implemented\")\n}", "func (h *MaxHeap) resize(newCapacity int) error {\n\tif newCapacity <= h.capacity {\n\t\treturn errors.Errorf(\"New capacity %d is not larger than current capacity %d\", newCapacity, h.capacity)\n\t}\n\tnewData := make([]string, newCapacity, newCapacity)\n\tfor i := 0; i < len(h.data); i++ {\n\t\tnewData[i] = h.data[i]\n\t}\n\th.capacity = newCapacity\n\th.data = newData\n\treturn nil\n}", "func makeDiskImage(dest string, size uint, initialBytes []byte) error {\n\t// Create the dest dir.\n\tif err := os.MkdirAll(filepath.Dir(dest), 0755); err != nil {\n\t\treturn err\n\t}\n\t// Fill in the magic string so boot2docker VM will detect this and format\n\t// the disk upon first boot.\n\traw := bytes.NewReader(initialBytes)\n\treturn MakeDiskImage(dest, size, raw)\n}", "func resize(imagePath string, w, h int) error {\n\ti, e := imgio.Open(imagePath)\n\tif e != nil {\n\t\treturn e\n\t}\n\tresized := transform.Resize(i, w, h, transform.Linear)\n\te = imgio.Save(imagePath, resized, imgio.JPEGEncoder(100))\n\treturn e\n}", "func Resize(imageBytes []byte, width, height int, maxBytes int) ([]byte, string, error) {\n\treturn process(imageBytes, maxBytes, func(image image.Image) image.Image {\n\t\treturn imaging.Resize(image, width, height, imaging.MitchellNetravali)\n\t})\n}", "func (c *LRU) Resize(size int) (evicted int) {\n\tdiff := c.Len() - size\n\tif diff < 0 {\n\t\tdiff = 0\n\t}\n\tfor i := 0; i < diff; i++ {\n\t\tc.removeOldest()\n\t}\n\tc.size = size\n\treturn diff\n}", "func (d *Deck) Resize(x int) {\n\td.numCards = x\n\td.Shuffle()\n}", "func (client StorageGatewayClient) ReclaimFileSystem(ctx context.Context, request ReclaimFileSystemRequest) (response ReclaimFileSystemResponse, 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.reclaimFileSystem, 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 = ReclaimFileSystemResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId}\n\t\t\t} else {\n\t\t\t\tresponse = ReclaimFileSystemResponse{}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\tif convertedResponse, ok := ociResponse.(ReclaimFileSystemResponse); ok {\n\t\tresponse = convertedResponse\n\t} else {\n\t\terr = fmt.Errorf(\"failed to convert OCIResponse into ReclaimFileSystemResponse\")\n\t}\n\treturn\n}", "func ResizeImage(name, size, dstDir string) error {\n\tp, _ := filepath.Abs(filepath.Join(dstDir, name+\".qcow2\"))\n\tc := [][]string{{\"qemu-img\", \"resize\", p, size}}\n\terr := Execs(c)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func resize(reader io.Reader, limit int) io.Reader {\n\tif reader == nil {\n\t\tlog.Print(\"[WARN] avatar resize(): reader is nil\")\n\t\treturn nil\n\t}\n\tif limit <= 0 {\n\t\tlog.Print(\"[DEBUG] avatar resize(): limit should be greater than 0\")\n\t\treturn reader\n\t}\n\n\tvar teeBuf bytes.Buffer\n\ttee := io.TeeReader(reader, &teeBuf)\n\tsrc, _, err := image.Decode(tee)\n\tif err != nil {\n\t\tlog.Printf(\"[WARN] avatar resize(): can't decode avatar image, %s\", err)\n\t\treturn &teeBuf\n\t}\n\n\tbounds := src.Bounds()\n\tw, h := bounds.Dx(), bounds.Dy()\n\tif w <= limit && h <= limit || w <= 0 || h <= 0 {\n\t\tlog.Print(\"[DEBUG] resizing image is smaller that the limit or has 0 size\")\n\t\treturn &teeBuf\n\t}\n\tnewW, newH := w*limit/h, limit\n\tif w > h {\n\t\tnewW, newH = limit, h*limit/w\n\t}\n\tm := image.NewRGBA(image.Rect(0, 0, newW, newH))\n\t// Slower than `draw.ApproxBiLinear.Scale()` but better quality.\n\tdraw.BiLinear.Scale(m, m.Bounds(), src, src.Bounds(), draw.Src, nil)\n\n\tvar out bytes.Buffer\n\tif err = png.Encode(&out, m); err != nil {\n\t\tlog.Printf(\"[WARN] avatar resize(): can't encode resized avatar to PNG, %s\", err)\n\t\treturn &teeBuf\n\t}\n\treturn &out\n}", "func (b *BoundAccount) ResizeTo(ctx context.Context, newSz int64) error {\n\tif newSz == b.used {\n\t\t// Performance optimization to avoid an unnecessary dispatch.\n\t\treturn nil\n\t}\n\treturn b.Resize(ctx, b.used, newSz)\n}", "func (l *Libvirt) StorageVolResize(Vol StorageVol, Capacity uint64, Flags StorageVolResizeFlags) (err error) {\n\tvar buf []byte\n\n\targs := StorageVolResizeArgs {\n\t\tVol: Vol,\n\t\tCapacity: Capacity,\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(260, constants.Program, buf, nil, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "func Resize(d Ploop, size uint64, offline bool) error {\n\tvar p C.struct_ploop_resize_param\n\n\tp.size = convertSize(size)\n\tp.offline_resize = bool2cint(offline)\n\n\tret := C.ploop_resize_image(d.d, &p)\n\treturn mkerr(ret)\n}", "func (d *Disk) Kill() error {\n\treturn nil\n\n}", "func (c *RingBuffer) resize(minSize int) (int, error) {\n\t// first figure out how big it should be\n\tquarters := 8\n\tif len(c.buf) > 8192 {\n\t\tquarters = 5\n\t}\n\tnewSize := len(c.buf) * quarters / 4\n\tif minSize > newSize {\n\t\tnewSize = minSize\n\t}\n\tnewbuf := make([]byte, newSize)\n\t_, err := c.peek(newbuf)\n\tif err != nil {\n\t\t// we didn't change anything\n\t\treturn len(c.buf), err\n\t}\n\t// we now have a new, bigger buffer with all the contents in it\n\tc.buf = newbuf\n\tc.index = 0\n\treturn len(c.buf), nil\n}", "func (c *MockAzureCloud) Disk() azure.DisksClient {\n\treturn c.DisksClient\n}", "func (o KafkaMirrorMakerOutput) DiskSpaceStep() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *KafkaMirrorMaker) pulumi.StringOutput { return v.DiskSpaceStep }).(pulumi.StringOutput)\n}", "func Resize(client *golangsdk.ServiceClient, opts ResizeOptsBuilder, serverId string) (r JobResult) {\n\treqBody, err := opts.ToServerResizeMap()\n\tif err != nil {\n\t\tr.Err = err\n\t\treturn\n\t}\n\n\t_, r.Err = client.Post(resizeURL(client, serverId), reqBody, &r.Body, &golangsdk.RequestOpts{OkCodes: []int{200}})\n\treturn\n}", "func (r Virtual_Guest) ConfigureMetadataDisk() (resp datatypes.Provisioning_Version1_Transaction, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Virtual_Guest\", \"configureMetadataDisk\", nil, &r.Options, &resp)\n\treturn\n}", "func (s *StdConsole) Resize(h, w int) error {\n\t// we do not need to resize a non tty\n\treturn nil\n}", "func (m *MockImage) Resize(source []byte, width, height int) ([]byte, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Resize\", source, width, height)\n\tret0, _ := ret[0].([]byte)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func DiskFactory() worker.Worker {\n\treturn &Disk{}\n}", "func expandPVCSize(origPVC *v1.PersistentVolumeClaim, size resource.Quantity,\n\tc clientset.Interface) (*v1.PersistentVolumeClaim, error) {\n\tctx, cancel := context.WithCancel(context.Background())\n\tdefer cancel()\n\tpvcName := origPVC.Name\n\tupdatedPVC := origPVC.DeepCopy()\n\n\twaitErr := wait.PollImmediate(resizePollInterval, 30*time.Second, func() (bool, error) {\n\t\tvar err error\n\t\tupdatedPVC, err = c.CoreV1().PersistentVolumeClaims(origPVC.Namespace).Get(ctx, pvcName, metav1.GetOptions{})\n\t\tif err != nil {\n\t\t\treturn false, fmt.Errorf(\"error fetching pvc %q for resizing with %v\", pvcName, err)\n\t\t}\n\n\t\tupdatedPVC.Spec.Resources.Requests[v1.ResourceStorage] = size\n\t\tupdatedPVC, err = c.CoreV1().PersistentVolumeClaims(origPVC.Namespace).Update(\n\t\t\tctx, updatedPVC, metav1.UpdateOptions{})\n\t\tif err == nil {\n\t\t\treturn true, nil\n\t\t}\n\t\tframework.Logf(\"Error updating pvc %s with %v\", pvcName, err)\n\t\treturn false, nil\n\t})\n\treturn updatedPVC, waitErr\n}", "func NewCmdDiskExpand() *cobra.Command {\n\tvar udiskIDs *[]string\n\treq := base.BizClient.NewResizeUDiskRequest()\n\tcmd := &cobra.Command{\n\t\tUse: \"expand\",\n\t\tShort: \"Expand udisk size\",\n\t\tLong: \"Expand udisk size\",\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\tif *req.Size > 8000 || *req.Size < 1 {\n\t\t\t\tbase.Cxt.Println(\"size-gb should be between 1 and 8000\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tfor _, id := range *udiskIDs {\n\t\t\t\tid = base.PickResourceID(id)\n\t\t\t\treq.UDiskId = &id\n\t\t\t\t_, err := base.BizClient.ResizeUDisk(req)\n\t\t\t\tif err != nil {\n\t\t\t\t\tbase.HandleError(err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tbase.Cxt.Printf(\"udisk:[%s] expanded to %d GB\\n\", *req.UDiskId, *req.Size)\n\t\t\t}\n\t\t},\n\t}\n\tflags := cmd.Flags()\n\tflags.SortFlags = false\n\tudiskIDs = flags.StringSlice(\"udisk-id\", nil, \"Required. Resource ID of the udisks to expand\")\n\treq.Size = flags.Int(\"size-gb\", 0, \"Required. Size of the udisk after expanded. Unit: GB. Range [1,8000]\")\n\treq.ProjectId = flags.String(\"project-id\", base.ConfigInstance.ProjectID, \"Optional. Assign project-id\")\n\treq.Region = flags.String(\"region\", base.ConfigInstance.Region, \"Optional. Assign region\")\n\treq.Zone = flags.String(\"zone\", base.ConfigInstance.Zone, \"Optional. Assign availability zone\")\n\treq.CouponId = flags.String(\"coupon-id\", \"\", \"Optional. Coupon ID, The Coupon can deduct part of the payment,see https://accountv2.ucloud.cn\")\n\n\tflags.SetFlagValuesFunc(\"udisk-id\", func() []string {\n\t\treturn getDiskList([]string{status.DISK_AVAILABLE}, *req.ProjectId, *req.Region, *req.Zone)\n\t})\n\n\tcmd.MarkFlagRequired(\"udisk-id\")\n\tcmd.MarkFlagRequired(\"size-gb\")\n\n\treturn cmd\n}", "func (a *DefaultApiService) VmResizePut(ctx _context.Context, vmResize VmResize) (*_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPut\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/vm.resize\"\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = &vmResize\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\treturn localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarHTTPResponse, nil\n}", "func (d *Domain) BlockResize(disk string, size uint64, flags libvirt.DomainBlockResizeFlags) error {\n\treq := libvirt.RemoteDomainBlockResizeReq{\n\t\tDomain: d.RemoteDomain,\n\t\tSize: size,\n\t\tFlags: uint32(flags)}\n\n\tbuf, err := encode(&req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresp, err := d.l.send(libvirt.RemoteProcDomainBlockResize, 0, libvirt.MessageTypeCall, libvirt.RemoteProgram, libvirt.MessageStatusOK, &buf)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tr := <-resp\n\tif r.Header.Status != libvirt.MessageStatusOK {\n\t\treturn decodeError(r.Payload)\n\t}\n\n\treturn nil\n}", "func (t *Table) onResize(evname string, ev interface{}) {\r\n\r\n\tt.recalc()\r\n\tt.recalcStatus()\r\n}", "func (v *View) Resize(w, h int) {\n\t// Always include 1 line for the command line at the bottom\n\th--\n\tv.width = int(float32(w) * float32(v.widthPercent) / 100)\n\t// We subtract 1 for the statusline\n\tv.height = int(float32(h)*float32(v.heightPercent)/100) - 1\n}", "func (term *Terminal) Resize(width uint16, height uint16) error {\n\tterm.mutex.Lock()\n\tdefer term.mutex.Unlock()\n\tterm.logger.Debug(\"Resizing terminal\", zap.Uint16(\"width\", width), zap.Uint16(\"height\", height))\n\ttermSize := pty.Winsize{Y: height, X: width} // X is width, Y is height\n\terr := pty.Setsize(term.tty, &termSize)\n\treturn err\n}", "func (d *btrfs) Update(changedConfig map[string]string) error {\n\t// We only care about btrfs.mount_options.\n\tval, ok := changedConfig[\"btrfs.mount_options\"]\n\tif ok {\n\t\t// Custom mount options don't work inside containers\n\t\tif d.state.OS.RunningInUserNS {\n\t\t\treturn nil\n\t\t}\n\n\t\t// Trigger a re-mount.\n\t\td.config[\"btrfs.mount_options\"] = val\n\t\tmntFlags, mntOptions := filesystem.ResolveMountOptions(strings.Split(d.getMountOptions(), \",\"))\n\t\tmntFlags |= unix.MS_REMOUNT\n\n\t\terr := TryMount(\"\", GetPoolMountPath(d.name), \"none\", mntFlags, mntOptions)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tsize, ok := changedConfig[\"size\"]\n\tif ok {\n\t\t// Figure out loop path\n\t\tloopPath := loopFilePath(d.name)\n\n\t\tif d.config[\"source\"] != loopPath {\n\t\t\treturn fmt.Errorf(\"Cannot resize non-loopback pools\")\n\t\t}\n\n\t\t// Resize loop file\n\t\tf, err := os.OpenFile(loopPath, os.O_RDWR, 0600)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tdefer func() { _ = f.Close() }()\n\n\t\tsizeBytes, _ := units.ParseByteSizeString(size)\n\n\t\terr = f.Truncate(sizeBytes)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tloopDevPath, err := loopDeviceSetup(loopPath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tdefer func() { _ = loopDeviceAutoDetach(loopDevPath) }()\n\n\t\terr = loopDeviceSetCapacity(loopDevPath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t_, err = shared.RunCommand(\"btrfs\", \"filesystem\", \"resize\", \"max\", GetPoolMountPath(d.name))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (conn *Conn) SendShellResize(to string, toIdx uint32, id string, rows, cols uint32) {\n\tvar msg network.Msg\n\tmsg.To = to\n\tmsg.ToIdx = toIdx\n\tmsg.XType = network.Msg_shell_resize\n\tmsg.LinkId = id\n\tmsg.Payload = &network.Msg_Sresize{\n\t\tSresize: &network.ShellResize{\n\t\t\tRows: rows,\n\t\t\tCols: cols,\n\t\t},\n\t}\n\tselect {\n\tcase conn.write <- &msg:\n\tcase <-time.After(conn.parent.cfg.WriteTimeout):\n\t}\n}", "func DiskSizeBytes(disk string) uint64 {\n\tmsg := `\nThe DiskSizeBytes() function has been DEPRECATED and will be\nremoved in the 1.0 release of ghw. Please use the Disk.SizeBytes attribute.\n`\n\twarn(msg)\n\tctx := contextFromEnv()\n\treturn ctx.diskSizeBytes(disk)\n}", "func (c *Cluster) resizeVolumes() error {\n\tif c.VolumeResizer == nil {\n\t\treturn fmt.Errorf(\"no volume resizer set for EBS volume handling\")\n\t}\n\n\tc.setProcessName(\"resizing EBS volumes\")\n\n\tnewQuantity, err := resource.ParseQuantity(c.Spec.Volume.Size)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not parse volume size: %v\", err)\n\t}\n\n\tnewSize := quantityToGigabyte(newQuantity)\n\tresizer := c.VolumeResizer\n\tvar totalIncompatible int\n\n\tpvs, err := c.listPersistentVolumes()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not list persistent volumes: %v\", err)\n\t}\n\n\tfor _, pv := range pvs {\n\t\tvolumeSize := quantityToGigabyte(pv.Spec.Capacity[v1.ResourceStorage])\n\t\tif volumeSize >= newSize {\n\t\t\tif volumeSize > newSize {\n\t\t\t\tc.logger.Warningf(\"cannot shrink persistent volume\")\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tcompatible := false\n\n\t\tif !resizer.VolumeBelongsToProvider(pv) {\n\t\t\tcontinue\n\t\t}\n\t\tcompatible = true\n\t\tif !resizer.IsConnectedToProvider() {\n\t\t\terr := resizer.ConnectToProvider()\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"could not connect to the volume provider: %v\", err)\n\t\t\t}\n\t\t\tdefer func() {\n\t\t\t\tif err := resizer.DisconnectFromProvider(); err != nil {\n\t\t\t\t\tc.logger.Errorf(\"%v\", err)\n\t\t\t\t}\n\t\t\t}()\n\t\t}\n\t\tawsVolumeID, err := resizer.GetProviderVolumeID(pv)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tc.logger.Debugf(\"updating persistent volume %q to %d\", pv.Name, newSize)\n\t\tif err := resizer.ResizeVolume(awsVolumeID, newSize); err != nil {\n\t\t\treturn fmt.Errorf(\"could not resize EBS volume %q: %v\", awsVolumeID, err)\n\t\t}\n\t\tc.logger.Debugf(\"resizing the filesystem on the volume %q\", pv.Name)\n\t\tpodName := getPodNameFromPersistentVolume(pv)\n\t\tif err := c.resizePostgresFilesystem(podName, []filesystems.FilesystemResizer{&filesystems.Ext234Resize{}}); err != nil {\n\t\t\treturn fmt.Errorf(\"could not resize the filesystem on pod %q: %v\", podName, err)\n\t\t}\n\t\tc.logger.Debugf(\"filesystem resize successful on volume %q\", pv.Name)\n\t\tpv.Spec.Capacity[v1.ResourceStorage] = newQuantity\n\t\tc.logger.Debugf(\"updating persistent volume definition for volume %q\", pv.Name)\n\t\tif _, err := c.KubeClient.PersistentVolumes().Update(context.TODO(), pv, metav1.UpdateOptions{}); err != nil {\n\t\t\treturn fmt.Errorf(\"could not update persistent volume: %q\", err)\n\t\t}\n\t\tc.logger.Debugf(\"successfully updated persistent volume %q\", pv.Name)\n\n\t\tif !compatible {\n\t\t\tc.logger.Warningf(\"volume %q is incompatible with all available resizing providers, consider switching storage_resize_mode to pvc or off\", pv.Name)\n\t\t\ttotalIncompatible++\n\t\t}\n\t}\n\tif totalIncompatible > 0 {\n\t\treturn fmt.Errorf(\"could not resize EBS volumes: some persistent volumes are not compatible with existing resizing providers\")\n\t}\n\treturn nil\n}", "func (d *DefaultDriver) ResizeStoragePoolByPercentage(string, api.SdkStoragePool_ResizeOperationType, uint64) error {\n\treturn &errors.ErrNotSupported{\n\t\tType: \"Function\",\n\t\tOperation: \"ResizeStoragePoolByPercentage()\",\n\t}\n}", "func (w *Window) Resize(width, height float64) {\n\tif err := driver.macRPC.Call(\"windows.Resize\", nil, struct {\n\t\tID string\n\t\tWidth float64\n\t\tHeight float64\n\t}{\n\t\tID: w.ID().String(),\n\t\tWidth: width,\n\t\tHeight: height,\n\t}); err != nil {\n\t\tpanic(err)\n\t}\n}", "func DiskQuota(path string, size ...string) string {\n\tparent := id(path)\n\texec.Command(\"btrfs\", \"qgroup\", \"create\", \"1/\"+parent, config.Agent.LxcPrefix+path).Run()\n\texec.Command(\"btrfs\", \"qgroup\", \"assign\", \"0/\"+id(path+\"/opt\"), \"1/\"+parent, config.Agent.LxcPrefix+path).Run()\n\texec.Command(\"btrfs\", \"qgroup\", \"assign\", \"0/\"+id(path+\"/var\"), \"1/\"+parent, config.Agent.LxcPrefix+path).Run()\n\texec.Command(\"btrfs\", \"qgroup\", \"assign\", \"0/\"+id(path+\"/home\"), \"1/\"+parent, config.Agent.LxcPrefix+path).Run()\n\texec.Command(\"btrfs\", \"qgroup\", \"assign\", \"0/\"+id(path+\"/rootfs\"), \"1/\"+parent, config.Agent.LxcPrefix+path).Run()\n\n\tif len(size) > 0 && len(size[0]) > 0 {\n\t\tout, err := exec.Command(\"btrfs\", \"qgroup\", \"limit\", size[0]+\"G\", \"1/\"+parent, config.Agent.LxcPrefix+path).CombinedOutput()\n\t\tlog.Check(log.ErrorLevel, \"Limiting BTRFS group 1/\"+parent+\" \"+string(out), err)\n\t\texec.Command(\"btrfs\", \"quota\", \"rescan\", \"-w\", config.Agent.LxcPrefix).Run()\n\t}\n\treturn Stat(path, \"quota\", false)\n}", "func increaseSizeOfPvcAttachedToPod(f *framework.Framework, client clientset.Interface,\n\tnamespace string, pvclaim *v1.PersistentVolumeClaim, pod *v1.Pod) {\n\tvar originalSizeInMb int64\n\tvar err error\n\t//Fetch original FileSystemSize if not raw block volume\n\tif *pvclaim.Spec.VolumeMode != v1.PersistentVolumeBlock {\n\t\tginkgo.By(\"Verify filesystem size for mount point /mnt/volume1 before expansion\")\n\t\toriginalSizeInMb, err = getFSSizeMb(f, pod)\n\t\tgomega.Expect(err).NotTo(gomega.HaveOccurred())\n\t}\n\n\t//resize PVC\n\t// Modify PVC spec to trigger volume expansion\n\tginkgo.By(\"Expanding current pvc\")\n\tcurrentPvcSize := pvclaim.Spec.Resources.Requests[v1.ResourceStorage]\n\tnewSize := currentPvcSize.DeepCopy()\n\tnewSize.Add(resource.MustParse(\"1Gi\"))\n\tframework.Logf(\"currentPvcSize %v, newSize %v\", currentPvcSize, newSize)\n\tpvclaim, err = expandPVCSize(pvclaim, newSize, client)\n\tgomega.Expect(err).NotTo(gomega.HaveOccurred())\n\tgomega.Expect(pvclaim).NotTo(gomega.BeNil())\n\n\tginkgo.By(\"Waiting for file system resize to finish\")\n\tpvclaim, err = waitForFSResize(pvclaim, client)\n\tgomega.Expect(err).NotTo(gomega.HaveOccurred())\n\n\tpvcConditions := pvclaim.Status.Conditions\n\texpectEqual(len(pvcConditions), 0, \"pvc should not have conditions\")\n\n\tif *pvclaim.Spec.VolumeMode != v1.PersistentVolumeBlock {\n\t\tvar fsSize int64\n\t\tginkgo.By(\"Verify filesystem size for mount point /mnt/volume1\")\n\t\tfsSize, err = getFSSizeMb(f, pod)\n\t\tgomega.Expect(err).NotTo(gomega.HaveOccurred())\n\t\tframework.Logf(\"File system size after expansion : %v\", fsSize)\n\t\t// Filesystem size may be smaller than the size of the block volume\n\t\t// so here we are checking if the new filesystem size is greater than\n\t\t// the original volume size as the filesystem is formatted for the\n\t\t// first time\n\t\tgomega.Expect(fsSize).Should(gomega.BeNumerically(\">\", originalSizeInMb),\n\t\t\tfmt.Sprintf(\"error updating filesystem size for %q. Resulting filesystem size is %d\", pvclaim.Name, fsSize))\n\t\tginkgo.By(\"File system resize finished successfully\")\n\t} else {\n\t\tginkgo.By(\"Volume resize finished successfully\")\n\t}\n}" ]
[ "0.7150063", "0.67661744", "0.6761175", "0.60479075", "0.59045976", "0.58169425", "0.570538", "0.57024753", "0.5672936", "0.5662231", "0.5631896", "0.55701244", "0.5516482", "0.5512031", "0.55026007", "0.5487062", "0.5382163", "0.5324337", "0.52943546", "0.5258423", "0.52548575", "0.5231428", "0.5223179", "0.52112514", "0.5189862", "0.51767385", "0.5176214", "0.517103", "0.5142285", "0.51094365", "0.5106348", "0.50924695", "0.5076221", "0.50593084", "0.5043361", "0.5040973", "0.5026073", "0.50011605", "0.49957824", "0.49750176", "0.49300537", "0.49288622", "0.49192086", "0.4906833", "0.49043736", "0.48817915", "0.48752028", "0.4863885", "0.48608178", "0.48422757", "0.4813699", "0.48074874", "0.47980386", "0.4790212", "0.47847298", "0.4774068", "0.47718397", "0.47524887", "0.47268456", "0.47249198", "0.4721906", "0.4719646", "0.47137022", "0.470543", "0.4702523", "0.4676501", "0.46605313", "0.46573102", "0.46562764", "0.46551624", "0.46454906", "0.46390775", "0.46278682", "0.46145546", "0.4609279", "0.46017888", "0.4586152", "0.45833033", "0.45746472", "0.4568292", "0.45671403", "0.45617658", "0.4558624", "0.4549765", "0.45450383", "0.4543292", "0.45419204", "0.45378774", "0.45351323", "0.45331886", "0.45292437", "0.45154166", "0.45149934", "0.4513335", "0.45109487", "0.4504338", "0.44988656", "0.44987565", "0.44946593", "0.448865" ]
0.7106013
1
SetInstanceMetadata uses the override method SetInstancemetadataFn or the real implementation.
func (c *TestClient) SetInstanceMetadata(project, zone, name string, md *compute.Metadata) error { if c.SetInstanceMetadataFn != nil { return c.SetInstanceMetadataFn(project, zone, name, md) } return c.client.SetInstanceMetadata(project, zone, name, md) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *TestClient) SetCommonInstanceMetadata(project string, md *compute.Metadata) error {\n\tif c.SetCommonInstanceMetadataFn != nil {\n\t\treturn c.SetCommonInstanceMetadataFn(project, md)\n\t}\n\treturn c.client.SetCommonInstanceMetadata(project, md)\n}", "func (m *Machine) SetMetadata(ctx context.Context, metadata interface{}) error {\n\tif _, err := m.client.PutMmds(ctx, metadata); err != nil {\n\t\tm.logger.Errorf(\"Setting metadata: %s\", err)\n\t\treturn err\n\t}\n\n\tm.logger.Printf(\"SetMetadata successful\")\n\treturn nil\n}", "func SetMetadata(ctx context.Context, md metadata.Metadata) {\n\tif tr, ok := FromClientContext(ctx); ok {\n\t\ttr.WithMetadata(md)\n\t}\n}", "func (r *AWSAutoScalingPlansScalingPlan_ScalingInstruction) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "func (r *AWSAppStreamStack) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "func (r *AWSEC2SecurityGroup_Egress) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "func (r *AWSApiGatewayUsagePlan_ApiStage) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "func (r *AWSAmplifyDomain_SubDomainSetting) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "func (r *AWSRoute53RecordSetGroup_RecordSet) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "func (nc *NodeCreate) SetMetadata(s string) *NodeCreate {\n\tnc.mutation.SetMetadata(s)\n\treturn nc\n}", "func (w *Base) SetMetadata(metadata *BaseMetadata) {\n\tw.metadata = metadata\n}", "func (gsc *GameServerCreate) SetMetadata(m *Metadata) *GameServerCreate {\n\treturn gsc.SetMetadataID(m.ID)\n}", "func (n *Node) SetMetadata(key string, val string) (err error) {\n\tnodePath := n.InternalPath()\n\tif err := xattr.Set(nodePath, key, []byte(val)); err != nil {\n\t\treturn errors.Wrap(err, \"decomposedfs: could not set parentid attribute\")\n\t}\n\treturn nil\n}", "func (a *DefaultClient) SetMetadata(file vfs.File, metadata map[string]string) error {\n\tURL, err := url.Parse(file.Location().(*Location).ContainerURL())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcontainerURL := azblob.NewContainerURL(*URL, a.pipeline)\n\tblobURL := containerURL.NewBlockBlobURL(utils.RemoveLeadingSlash(file.Path()))\n\t_, err = blobURL.SetMetadata(context.Background(), metadata, azblob.BlobAccessConditions{}, azblob.ClientProvidedKeyOptions{})\n\treturn err\n}", "func (r *Alarm_MetricDataQuery) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "func (v *Values) SetMetadata(stepName string, value interface{}) {\n\tv.setStepData(stepName, MetadataKey, value)\n}", "func (c *jsiiProxy_CfnInstance) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "func (r *AWSCloudWatchAlarm_MetricDataQuery) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "func (m *pcpInstanceMetric) setInstance(val interface{}, instance string) error {\n\tif !m.t.IsCompatible(val) {\n\t\treturn errors.New(\"the value is incompatible with this metrics MetricType\")\n\t}\n\n\tif !m.indom.HasInstance(instance) {\n\t\treturn errors.Errorf(\"%v is not an instance of this metric\", instance)\n\t}\n\n\tval = m.t.resolve(val)\n\n\tif m.vals[instance].val != val {\n\t\tif m.vals[instance].update != nil {\n\t\t\terr := m.vals[instance].update(val)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tm.vals[instance].val = val\n\t}\n\n\treturn nil\n}", "func (gsu *GameServerUpdate) SetMetadata(m *Metadata) *GameServerUpdate {\n\treturn gsu.SetMetadataID(m.ID)\n}", "func (b *RaftBalloon) SetMetadata(nodeInvolved string, md map[string]string) error {\n\tcmd := b.fsm.setMetadata(nodeInvolved, md)\n\t_, err := b.WaitForLeader(5 * time.Second)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresp, err := b.raftApply(commands.MetadataSetCommandType, cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn resp.(*fsmGenericResponse).error\n}", "func (o *SchemaDefinitionRestDto) SetMetadata(v map[string]string) {\n\to.Metadata = &v\n}", "func (node *Node) SetMetadata(key, value string) {\n\tstr := strings.Join([]string{key, value}, \"=\")\n\tif node.Meta == nil || len(node.Meta) == 0 {\n\t\tnode.Meta = []byte(str)\n\t} else {\n\t\tnode.Meta = append(node.Meta, append([]byte(\",\"), []byte(str)...)...)\n\t}\n}", "func (e *Entity) SetMetadata(k, v string) {\n\tif v == \"\" {\n\t\tdelete(e.metadata, k)\n\t} else {\n\t\te.metadata[k] = v\n\t}\n}", "func (_options *ReplaceIntegrationOptions) SetMetadata(metadata *IntegrationMetadata) *ReplaceIntegrationOptions {\n\t_options.Metadata = metadata\n\treturn _options\n}", "func (c *Client) setMetadata(metadata bmc.Metadata) {\n\t// a mutex is created with the NewClient func, in the case\n\t// where a user doesn't call NewClient we handle by checking if\n\t// the mutex is nil\n\tif c.mdLock != nil {\n\t\tc.mdLock.Lock()\n\t\tdefer c.mdLock.Unlock()\n\t}\n\tc.metadata = &metadata\n}", "func (m *PCPInstanceMetric) SetInstance(val interface{}, instance string) error {\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\n\treturn m.setInstance(val, instance)\n}", "func (c *ContainerClient) SetMetadata(ctx context.Context, o *ContainerSetMetadataOptions) (ContainerSetMetadataResponse, error) {\n\tmetadataOptions, lac, mac := o.format()\n\tresp, err := c.client.SetMetadata(ctx, metadataOptions, lac, mac)\n\n\treturn toContainerSetMetadataResponse(resp), handleError(err)\n}", "func (o *Job) SetMetadata(v map[string]string) {\n\to.Metadata = &v\n}", "func (wrc *WorkspaceRoleCreate) SetMetadata(m map[string]interface{}) *WorkspaceRoleCreate {\n\twrc.mutation.SetMetadata(m)\n\treturn wrc\n}", "func (s *Segment) SetMetadata(spyName string, sampleRate uint32, units, aggregationType string) {\n\ts.spyName = spyName\n\ts.sampleRate = sampleRate\n\ts.units = units\n\ts.aggregationType = aggregationType\n}", "func (vc *VehicleCreate) SetMetadata(m *Metadata) *VehicleCreate {\n\treturn vc.SetMetadataID(m.ID)\n}", "func (p *ProvisionTokenV2) SetMetadata(meta Metadata) {\n\tp.Metadata = meta\n}", "func (gsuo *GameServerUpdateOne) SetMetadata(m *Metadata) *GameServerUpdateOne {\n\treturn gsuo.SetMetadataID(m.ID)\n}", "func (vrsConnection *VRSConnection) SetEntityMetadata(uuid string, metadata map[entity.MetadataKey]string) error {\n\trow := make(map[string]interface{})\n\trow[ovsdb.NuageVMTableColumnMetadata] = metadata\n\n\tcondition := []string{ovsdb.NuageVMTableColumnVMUUID, \"==\", uuid}\n\n\tif err := vrsConnection.vmTable.UpdateRow(vrsConnection.ovsdbClient, row, condition); err != nil {\n\t\treturn fmt.Errorf(\"Unable to update the metadata %s %v %v\", uuid, metadata, err)\n\t}\n\n\treturn nil\n}", "func (r *AWSMediaLiveChannel_InputAttachment) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "func SetActivationMetadata(key string, value string) int {\n\tcKey := goToCString(key)\n\tcValue := goToCString(value)\n\tstatus := C.SetActivationMetadata(cKey, cValue)\n\tfreeCString(cKey)\n\tfreeCString(cValue)\n\treturn int(status)\n}", "func (r *AWSCloudFrontDistribution_Origin) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "func (f FileURL) SetMetadata(ctx context.Context, metadata Metadata) (*FileSetMetadataResponse, error) {\n\treturn f.fileClient.SetMetadata(ctx, nil, metadata)\n}", "func (m *CallTranscript) SetMetadataContent(value []byte)() {\n err := m.GetBackingStore().Set(\"metadataContent\", value)\n if err != nil {\n panic(err)\n }\n}", "func SetMetaData(f *gofpdf.Fpdf, author, title string) {\n\tf.SetTitle(title, true)\n\tf.SetAuthor(author, true)\n\tf.SetCreator(author, true)\n\tf.SetCreationDate(time.Now())\n}", "func (r Virtual_Guest) SetUserMetadata(metadata []string) (resp bool, err error) {\n\tparams := []interface{}{\n\t\tmetadata,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Virtual_Guest\", \"setUserMetadata\", params, &r.Options, &resp)\n\treturn\n}", "func (o *PostDockerRegistriesSearchListParams) SetMetadata(metadata *models.DockerRegistryImageSearch) {\n\to.Metadata = metadata\n}", "func (o *Transfer) SetMetadata(v map[string]string) {\n\to.Metadata = v\n}", "func (m *kubePackage) setMetadata(tCtx *addon.SkyCtx, name, namespace string, obj runtime.Object) error {\n\ta := meta.NewAccessor()\n\n\tobjName, err := a.Name(obj)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif objName != \"\" && objName != name {\n\t\treturn fmt.Errorf(\"name=`%s' argument does not match object's .metadata.name=`%s'\", name, objName)\n\t}\n\tif err := a.SetName(obj, name); err != nil {\n\t\treturn err\n\t}\n\n\tif namespace != \"\" { // namespace is optional argument.\n\t\tobjNs, err := a.Namespace(obj)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif objNs != \"\" && objNs != namespace {\n\t\t\treturn fmt.Errorf(\"namespace=`%s' argument does not match object's .metadata.namespace=`%s'\", namespace, objNs)\n\t\t}\n\n\t\tif err := a.SetNamespace(obj, namespace); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tls, err := a.Labels(obj)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif ls == nil {\n\t\tls = map[string]string{}\n\t}\n\n\tls[\"heritage\"] = \"isopod\"\n\tif tCtx.Attrs.Has(\"addon_version\") {\n\t\tversion, err := json.Marshal(tCtx.Attrs[\"addon_version\"])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(version) >= 2 && version[0] == '\"' && version[len(version)-1] == '\"' {\n\t\t\tls[\"addon_version\"] = string(version[1 : len(version)-1])\n\t\t}\n\t}\n\tif err := a.SetLabels(obj, ls); err != nil {\n\t\treturn err\n\t}\n\n\tas, err := a.Annotations(obj)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif as == nil {\n\t\tas = map[string]string{}\n\t}\n\n\tbs, err := json.Marshal(tCtx.Attrs)\n\tif err != nil {\n\t\treturn err\n\t}\n\tas[ctxAnnotationKey] = string(bs)\n\treturn a.SetAnnotations(obj, as)\n}", "func (m *RetentionLabelSettings) SetIsMetadataUpdateAllowed(value *bool)() {\n err := m.GetBackingStore().Set(\"isMetadataUpdateAllowed\", value)\n if err != nil {\n panic(err)\n }\n}", "func SetMetadata(mp3Location string, metadata *Metadata) {\n\ttag, err := id3v2.Open(mp3Location, id3v2.Options{Parse: true})\n\n\tif err != nil {\n\t\tlog.Fatal(\"Error while initializing a tag: \", err)\n\t}\n\n\ttag.SetTitle(metadata.Title)\n\ttag.SetArtist(metadata.Artist)\n\ttag.SetAlbum(metadata.Album)\n\n\tif err = tag.Save(); err != nil {\n\t\tlog.Fatal(\"Error while saving a tag: \", err)\n\t}\n}", "func (f *cFactory) setInstWritable(inst orc.Instance) error {\n\tif inst.ReadOnly == true {\n\t\tglog.V(2).Infof(\"set instance %s writable\", inst.Key.Hostname)\n\t\treturn f.orcClient.SetHostWritable(inst.Key)\n\t}\n\treturn nil\n}", "func (p *EtcdV3Register) SetMetadata(metadata string) (err error) {\n\tp.metadataRWMutex.Lock()\n\tp.metadata, err = url.ParseQuery(metadata)\n\tp.metadataRWMutex.Unlock()\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar errs []error\n\tp.metadataRWMutex.RLock()\n\tdefer p.metadataRWMutex.RUnlock()\n\tvar (\n\t\tresp *clientv3.GetResponse\n\t\tv url.Values\n\t)\n\tfor _, nodePath := range p.services {\n\t\tif p.DialEtcdTimeout > 0 {\n\t\t\tctx, _ := context.WithTimeout(context.Background(), p.DialEtcdTimeout)\n\t\t\tresp, err = p.KeysAPI.Get(ctx, nodePath)\n\t\t} else {\n\t\t\tresp, err = p.KeysAPI.Get(context.TODO(), nodePath)\n\t\t}\n\t\tif err == nil {\n\t\t\tif len(resp.Kvs) == 0 {\n\t\t\t\tv = url.Values{}\n\t\t\t} else if v, err = url.ParseQuery(string(resp.Kvs[0].Value)); err == nil {\n\t\t\t\t// reset metadata\n\t\t\t\tp.metadataRWMutex.RLock()\n\t\t\t\tfor k := range p.metadata {\n\t\t\t\t\tv.Set(k, p.metadata.Get(k))\n\t\t\t\t}\n\t\t\t\tp.metadataRWMutex.RUnlock()\n\t\t\t\tif p.ttlOp != nil {\n\t\t\t\t\tif err = p.Put(nodePath, v.Encode(), p.ttlOp); err != nil {\n\t\t\t\t\t\tif strings.Contains(err.Error(), \"requested lease not found\") {\n\t\t\t\t\t\t\tif err = p.setGrantKeepAlive(); err != nil {\n\t\t\t\t\t\t\t\tfaygo.Errorf(\"%s\", err.Error())\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\terr = p.Put(nodePath, v.Encode(), p.ttlOp)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tfaygo.Errorf(\"%s\", err.Error())\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif err = p.Put(nodePath, v.Encode()); err != nil {\n\t\t\t\t\t\tfaygo.Errorf(\"%s\", err.Error())\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\terrs = append(errs, err)\n\t\t\t}\n\t\t} else {\n\t\t\terrs = append(errs, err)\n\t\t}\n\t}\n\treturn faygo.Errors(errs)\n}", "func (s *GetWorkflowOutput) SetMetadata(v map[string]*string) *GetWorkflowOutput {\n\ts.Metadata = v\n\treturn s\n}", "func (o *PostDockerRegistriesUUIDSearchListParams) SetMetadata(metadata *models.DockerRegistryImageSearch) {\n\to.Metadata = metadata\n}", "func (p *Collection) SetMetadata(k, v string) (changed bool, err error) {\n\tif _, ok := deprecatedMetadataKeys[k]; ok {\n\t\terr = apperror.New(\n\t\t\t\"DEPRECATED\",\n\t\t\tfmt.Sprintf(\"metadata key `%s` is deprecated, please update client\", k),\n\t\t\tfmt.Sprintf(\"元数据 `%s` 已废弃, 请更新客户端\", k),\n\t\t)\n\t\treturn\n\t}\n\tif len(k) > 1<<10 {\n\t\terr = fmt.Errorf(\"key length excess limit (1 KiB): %s\", k)\n\t\treturn\n\t}\n\tif len(v) > 1<<20 {\n\t\terr = fmt.Errorf(\"value length excess limit (1 MiB): %s\", v)\n\t\treturn\n\t}\n\tif v == \"\" {\n\t\tif _, ok := p.metadata[k]; !ok {\n\t\t\treturn\n\t\t}\n\t\tdelete(p.metadata, k)\n\t\tif len(p.metadata) == 0 {\n\t\t\tp.metadata = nil\n\t\t}\n\t\tchanged = true\n\t\treturn\n\t}\n\tif p.metadata == nil {\n\t\tp.metadata = make(map[string]string)\n\t}\n\tif p.metadata[k] == v {\n\t\treturn\n\t}\n\tp.metadata[k] = v\n\tchanged = true\n\treturn\n}", "func (s *WorkflowListItem) SetMetadata(v map[string]*string) *WorkflowListItem {\n\ts.Metadata = v\n\treturn s\n}", "func (client Client) SetMetaData(ctx context.Context, accountName, containerName string, metaData map[string]string) (autorest.Response, error) {\n\treturn client.SetMetaDataWithLeaseID(ctx, accountName, containerName, \"\", metaData)\n}", "func (gsc *GameServerCreate) SetMetadataID(id int) *GameServerCreate {\n\tgsc.mutation.SetMetadataID(id)\n\treturn gsc\n}", "func (l *Libvirt) DomainSetMetadata(Dom Domain, Type int32, Metadata OptString, Key OptString, Uri OptString, Flags DomainModificationImpact) (err error) {\n\tvar buf []byte\n\n\targs := DomainSetMetadataArgs {\n\t\tDom: Dom,\n\t\tType: Type,\n\t\tMetadata: Metadata,\n\t\tKey: Key,\n\t\tUri: Uri,\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(264, constants.Program, buf, nil, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "func (*XMLDocument) SetOnloadedmetadata(onloadedmetadata func(window.Event)) {\n\tmacro.Rewrite(\"$_.onloadedmetadata = $1\", onloadedmetadata)\n}", "func (item *DBItem) SetMetadataFromFile() error {\n\titem.Load()\n\tfname := item.Fname()\n\tif fname == \"\" {\n\t\treturn fmt.Errorf(\"could not set metadata from file in dataset not supporting filename\")\n\t}\n\tspec := item.DataSpec()\n\tspec_, ok := spec.(skyhook.MetadataFromFileDataSpec)\n\tif !ok {\n\t\treturn fmt.Errorf(\"MetadataFromFile not supported for type %s\", item.Dataset.DataType)\n\t}\n\tformat, metadata, err := spec_.GetMetadataFromFile(fname)\n\tif err != nil {\n\t\treturn err\n\t}\n\titem.SetMetadata(format, metadata)\n\treturn nil\n}", "func (s *ConfigureAgentInput) SetMetadata(v map[string]*string) *ConfigureAgentInput {\n\ts.Metadata = v\n\treturn s\n}", "func setMetadataVisitor(releaseName, releaseNamespace string, force bool) resource.VisitorFunc {\n\treturn func(info *resource.Info, err error) error {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif !force {\n\t\t\tif err := checkOwnership(info.Object, releaseName, releaseNamespace); err != nil {\n\t\t\t\treturn fmt.Errorf(\"%s cannot be owned: %s\", resourceString(info), err)\n\t\t\t}\n\t\t}\n\n\t\tif err := mergeLabels(info.Object, map[string]string{\n\t\t\tappManagedByLabel: appManagedByHelm,\n\t\t}); err != nil {\n\t\t\treturn fmt.Errorf(\n\t\t\t\t\"%s labels could not be updated: %s\",\n\t\t\t\tresourceString(info), err,\n\t\t\t)\n\t\t}\n\n\t\tif err := mergeAnnotations(info.Object, map[string]string{\n\t\t\thelmReleaseNameAnnotation: releaseName,\n\t\t\thelmReleaseNamespaceAnnotation: releaseNamespace,\n\t\t}); err != nil {\n\t\t\treturn fmt.Errorf(\n\t\t\t\t\"%s annotations could not be updated: %s\",\n\t\t\t\tresourceString(info), err,\n\t\t\t)\n\t\t}\n\n\t\treturn nil\n\t}\n}", "func (o *IamServiceProviderAllOf) SetMetadata(v string) {\n\to.Metadata = &v\n}", "func (m *Machine) UpdateMetadata(ctx context.Context, metadata interface{}) error {\n\tif _, err := m.client.PatchMmds(ctx, metadata); err != nil {\n\t\tm.logger.Errorf(\"Updating metadata: %s\", err)\n\t\treturn err\n\t}\n\n\tm.logger.Printf(\"UpdateMetadata successful\")\n\treturn nil\n}", "func (r *AWSMediaStoreContainer_CorsRule) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "func (c *jsiiProxy_CfnMember) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "func (m *Monocular) UpdateMetadata(info *interfaces.Info, userGUID string, echoContext echo.Context) {\n}", "func (c *jsiiProxy_CfnIPSet) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "func (computeService Service) SetServerMetadata(serverID string, metadata map[string]string) (map[string]string, error) {\n\tinput := serverMetadataContainer{Metadata: metadata}\n\toutput := serverMetadataContainer{}\n\treqURL, err := computeService.buildRequestURL(\"/servers/\", serverID, \"/metadata\")\n\tif err != nil {\n\t\treturn make(map[string]string, 0), err\n\t}\n\n\terr = misc.PostJSON(reqURL, computeService.authenticator, input, &output)\n\tif err != nil {\n\t\treturn make(map[string]string, 0), err\n\t}\n\n\treturn output.Metadata, nil\n}", "func (t *Commit) SetMetadata(v string) {\n\tt.Metadata = &v\n}", "func (m *Application) SetSamlMetadataUrl(value *string)() {\n m.samlMetadataUrl = value\n}", "func (mr *MockCacheMockRecorder) SetMetadata(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SetMetadata\", reflect.TypeOf((*MockCache)(nil).SetMetadata), arg0)\n}", "func (gsu *GameServerUpdate) SetMetadataID(id int) *GameServerUpdate {\n\tgsu.mutation.SetMetadataID(id)\n\treturn gsu\n}", "func ShardDatasetMetadata(value string) ShardDatasetAttr {\n\treturn func(m optionalAttr) {\n\t\tm[\"metadata\"] = value\n\t}\n}", "func (b *Block) SetMetadata(data nbt.Compound) {\n\tmetadata := make(nbt.Compound, 0)\n\tfor i := 0; i < len(data); i++ {\n\t\tname := data[i].Name()\n\t\tif name == \"x\" || name == \"y\" || name == \"z\" {\n\t\t\tcontinue\n\t\t} else if data[i].TagID() == nbt.TagEnd {\n\t\t\tbreak\n\t\t}\n\t\tmetadata = append(metadata, data[i].Copy())\n\t}\n\tif len(metadata) > 0 {\n\t\tb.metadata = metadata\n\t} else {\n\t\tb.metadata = nil\n\t}\n}", "func (s *Evaluation) SetMetadata(v *EvaluationMetadata) *Evaluation {\n\ts.Metadata = v\n\treturn s\n}", "func WithMetadata(value bool) Option {\n\treturn func(opts *options) error {\n\t\topts.withMetadata = value\n\t\t// No error\n\t\treturn nil\n\t}\n}", "func (m *MockCache) SetMetadata(arg0 lifecycle.CacheMetadata) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SetMetadata\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "func (o InstanceOutput) Metadata() pulumi.MapOutput {\n\treturn o.ApplyT(func(v *Instance) pulumi.MapOutput { return v.Metadata }).(pulumi.MapOutput)\n}", "func (c *jsiiProxy_CfnWorkflow) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "func setTaskMeta(db *leveldb.DB, task *pb.V1SubTaskMeta) error {\n\tif db == nil {\n\t\treturn terror.ErrWorkerLogInvalidHandler.Generate()\n\t}\n\n\terr := verifyTaskMeta(task)\n\tif err != nil {\n\t\treturn terror.Annotatef(err, \"verify task meta %+v\", task)\n\t}\n\n\ttaskBytes, err := task.Marshal()\n\tif err != nil {\n\t\treturn terror.ErrWorkerLogMarshalTask.Delegate(err, task)\n\t}\n\n\terr = db.Put(encodeTaskMetaKey(task.Name), taskBytes, nil)\n\tif err != nil {\n\t\treturn terror.ErrWorkerLogSaveTaskMeta.Delegate(err, task.Name)\n\t}\n\n\treturn nil\n}", "func (m *MockRunOptions) SetCacheSeriesMetadata(value bool) RunOptions {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SetCacheSeriesMetadata\", value)\n\tret0, _ := ret[0].(RunOptions)\n\treturn ret0\n}", "func setConsensusMetadata(ctx sdk.Context, clientStore sdk.KVStore, height exported.Height) {\n\tsetConsensusMetadataWithValues(clientStore, height, clienttypes.GetSelfHeight(ctx), uint64(ctx.BlockTime().UnixNano()))\n}", "func (o *SSHAuthorizationPolicy) SetMetadata(metadata []string) {\n\n\to.Metadata = metadata\n}", "func (gsuo *GameServerUpdateOne) SetMetadataID(id int) *GameServerUpdateOne {\n\tgsuo.mutation.SetMetadataID(id)\n\treturn gsuo\n}", "func (c *jsiiProxy_CfnMLTransform) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "func (m *Mutator) Set(ctx context.Context, config ispec.ImageConfig, meta Meta, annotations map[string]string, history *ispec.History) error {\n\tif err := m.cache(ctx); err != nil {\n\t\treturn errors.Wrap(err, \"getting cache failed\")\n\t}\n\n\t// Ensure the mediatype is correct.\n\tm.manifest.MediaType = ispec.MediaTypeImageManifest\n\n\t// Set annotations.\n\tm.manifest.Annotations = annotations\n\n\t// Set configuration.\n\tm.config.Config = config\n\n\t// Set metadata.\n\tm.config.Created = timePtr(meta.Created)\n\tm.config.Author = meta.Author\n\tm.config.Architecture = meta.Architecture\n\tm.config.OS = meta.OS\n\n\t// Append history.\n\tif history != nil {\n\t\thistory.EmptyLayer = true\n\t\tm.config.History = append(m.config.History, *history)\n\t}\n\treturn nil\n}", "func (vc *VehicleCreate) SetMetadataID(id int) *VehicleCreate {\n\tvc.mutation.SetMetadataID(id)\n\treturn vc\n}", "func (gexf *GexfDoc) SetMeta(t time.Time, creator, keywords, description string) {\r\n\tgexf.Meta = &MetaDoc{\r\n\t\tLastModifiedDate: t,\r\n\t\tCreator: creator,\r\n\t\tKeywords: keywords,\r\n\t\tDescription: description,\r\n\t}\r\n}", "func (s *PipelineExecutionStep) SetMetadata(v *PipelineExecutionStepMetadata) *PipelineExecutionStep {\n\ts.Metadata = v\n\treturn s\n}", "func (inst *DeprecatedCreateMasterEdition) SetMetadataAccount(metadata ag_solanago.PublicKey) *DeprecatedCreateMasterEdition {\n\tinst.AccountMetaSlice[7] = ag_solanago.Meta(metadata)\n\treturn inst\n}", "func (m *MemoryStorage) SetMeta(checkID string, meta interface{}) error {\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\n\tjob, ok := m.checks[checkID]\n\tif !ok {\n\t\treturn errors.New(\"error setting metadata for unexisting job\")\n\t}\n\n\tjob.Meta = meta\n\tm.checks[job.CheckID] = job\n\n\treturn nil\n}", "func (c *jsiiProxy_CfnModuleVersion) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "func (computeService Service) SetServerMetadataItem(serverID string, metaItemName string, value string) (map[string]string, error) {\n\tinput := serverMetaItemContainer{Meta: make(map[string]string)}\n\tinput.Meta[metaItemName] = value\n\toutput := serverMetaItemContainer{}\n\treqURL, err := computeService.buildRequestURL(\"/servers/\", serverID, \"/metadata/\", metaItemName)\n\tif err != nil {\n\t\treturn make(map[string]string, 0), err\n\t}\n\n\terr = misc.PutJSON(reqURL, computeService.authenticator, input, &output)\n\tif err != nil {\n\t\treturn make(map[string]string, 0), err\n\t}\n\n\treturn output.Meta, nil\n}", "func (o *V1VolumeClaim) SetMetadata(v V1Metadata) {\n\to.Metadata = &v\n}", "func UseMetadata(b bool) Option {\n\treturn func(opt *options) {\n\t\topt.enableMetadata = b\n\t}\n}", "func (s *metadataSupplier) Set(key string, value string) {\n\ts.metadata.Set(key, value)\n}", "func (c *jsiiProxy_CfnDeploymentStrategy) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "func makeInstanceMetadataHandler(im InstanceMetadata) func(http.ResponseWriter, *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tinstance := r.RemoteAddr // TODO(borenet): This is not correct.\n\n\t\tkey := chi.URLParam(r, \"key\")\n\t\tif key == \"\" {\n\t\t\thttputils.ReportError(w, nil, \"Metadata key is required.\", http.StatusInternalServerError)\n\t\t}\n\n\t\tsklog.Infof(\"Instance metadata: %s\", key)\n\t\tval, err := im.Get(instance, key)\n\t\tif err != nil {\n\t\t\thttp.NotFound(w, r)\n\t\t\treturn\n\t\t}\n\t\tif _, err := w.Write([]byte(val)); err != nil {\n\t\t\thttputils.ReportError(w, nil, \"Failed to write response.\", http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t}\n}", "func (c *jsiiProxy_CfnDeployment) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "func (c *jsiiProxy_CfnThreatIntelSet) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "func PutMetadataPrivision(uid, metadataserviceID int64, metadataserviceName string) (interface{}, error) {\n\tdb, err := pqx.Open()\n\tif err != nil {\n\t\treturn nil, errors.NewEvent(eventcode.EventNetworkCriticalUnableConDB, err)\n\t}\n\t\n\tq := sqlUpdateMetadataMethod\n\tp := []interface{}{uid, metadataserviceID, metadataserviceName}\n\n\tstmt, err := db.Prepare(q)\n\tif err != nil {\n\t\treturn nil, pqx.GetRESTError(err)\n\t}\n\tres, err := stmt.Exec(p...)\n\tif err != nil {\n\t\treturn nil, pqx.GetRESTError(err)\n\t}\n\t_, err = res.RowsAffected()\n\n\tif err != nil {\n\t\treturn nil, pqx.GetRESTError(err)\n\t}\n\n\treturn metadataserviceName, nil\n}" ]
[ "0.66372395", "0.65157425", "0.63484323", "0.63141876", "0.6305884", "0.6118977", "0.608049", "0.6030323", "0.6016902", "0.5991996", "0.5918976", "0.5897769", "0.58829534", "0.5828516", "0.5827746", "0.5818471", "0.5782862", "0.5773176", "0.5764131", "0.5755304", "0.5744528", "0.57344353", "0.57268834", "0.57173526", "0.5712318", "0.5708476", "0.5682935", "0.564273", "0.5640132", "0.5639342", "0.56122714", "0.561118", "0.55905783", "0.55743855", "0.55421597", "0.5537004", "0.5496356", "0.5471417", "0.54672456", "0.54521066", "0.5410794", "0.54067564", "0.54006684", "0.53872377", "0.536036", "0.53602195", "0.5349286", "0.5347216", "0.5345419", "0.5330602", "0.53261185", "0.53077775", "0.5297841", "0.5296902", "0.5280625", "0.5273532", "0.5258709", "0.5247937", "0.5243667", "0.5242011", "0.5218274", "0.52090096", "0.51926017", "0.51726943", "0.5170989", "0.51573455", "0.5156119", "0.5143384", "0.51149124", "0.51119375", "0.5110264", "0.5098283", "0.50953466", "0.50947654", "0.50927186", "0.50856936", "0.5084378", "0.5075922", "0.50753325", "0.50700223", "0.50651777", "0.5061718", "0.5059973", "0.50457096", "0.50350904", "0.5010562", "0.50088173", "0.50085086", "0.5006685", "0.5005588", "0.50007814", "0.49965328", "0.49938974", "0.49761152", "0.49688768", "0.49675375", "0.49583584", "0.49536684", "0.49521905", "0.49511272" ]
0.751981
0
SetCommonInstanceMetadata uses the override method SetCommonInstanceMetadataFn or the real implementation.
func (c *TestClient) SetCommonInstanceMetadata(project string, md *compute.Metadata) error { if c.SetCommonInstanceMetadataFn != nil { return c.SetCommonInstanceMetadataFn(project, md) } return c.client.SetCommonInstanceMetadata(project, md) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (oie *ObjectInfoExtension) NewCommonMetadata() Metadata {\n\tmd := Metadata{}\n\tfor k, v := range oie.ObjectInfo.Metadata {\n\t\tif len(k) > s3MetadataPrefixLen {\n\t\t\tif prefix := k[0:s3MetadataPrefixLen]; strings.EqualFold(prefix, s3MetadataPrefix) {\n\t\t\t\tvalue := v[0]\n\t\t\t\tmd[k[s3MetadataPrefixLen:]] = &value\n\t\t\t}\n\t\t}\n\t}\n\treturn md\n}", "func (c *TestClient) SetInstanceMetadata(project, zone, name string, md *compute.Metadata) error {\n\tif c.SetInstanceMetadataFn != nil {\n\t\treturn c.SetInstanceMetadataFn(project, zone, name, md)\n\t}\n\treturn c.client.SetInstanceMetadata(project, zone, name, md)\n}", "func SetMetadata(ctx context.Context, md metadata.Metadata) {\n\tif tr, ok := FromClientContext(ctx); ok {\n\t\ttr.WithMetadata(md)\n\t}\n}", "func (m *Machine) SetMetadata(ctx context.Context, metadata interface{}) error {\n\tif _, err := m.client.PutMmds(ctx, metadata); err != nil {\n\t\tm.logger.Errorf(\"Setting metadata: %s\", err)\n\t\treturn err\n\t}\n\n\tm.logger.Printf(\"SetMetadata successful\")\n\treturn nil\n}", "func (r *AWSAmplifyDomain_SubDomainSetting) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "func (a *DefaultClient) SetMetadata(file vfs.File, metadata map[string]string) error {\n\tURL, err := url.Parse(file.Location().(*Location).ContainerURL())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcontainerURL := azblob.NewContainerURL(*URL, a.pipeline)\n\tblobURL := containerURL.NewBlockBlobURL(utils.RemoveLeadingSlash(file.Path()))\n\t_, err = blobURL.SetMetadata(context.Background(), metadata, azblob.BlobAccessConditions{}, azblob.ClientProvidedKeyOptions{})\n\treturn err\n}", "func (r *AWSMediaStoreContainer_CorsRule) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "func (r *AWSEC2SecurityGroup_Egress) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "func setConsensusMetadata(ctx sdk.Context, clientStore sdk.KVStore, height exported.Height) {\n\tsetConsensusMetadataWithValues(clientStore, height, clienttypes.GetSelfHeight(ctx), uint64(ctx.BlockTime().UnixNano()))\n}", "func (r *Alarm_MetricDataQuery) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "func (r *AWSAppStreamStack) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "func (n *Node) SetMetadata(key string, val string) (err error) {\n\tnodePath := n.InternalPath()\n\tif err := xattr.Set(nodePath, key, []byte(val)); err != nil {\n\t\treturn errors.Wrap(err, \"decomposedfs: could not set parentid attribute\")\n\t}\n\treturn nil\n}", "func (node *Node) SetMetadata(key, value string) {\n\tstr := strings.Join([]string{key, value}, \"=\")\n\tif node.Meta == nil || len(node.Meta) == 0 {\n\t\tnode.Meta = []byte(str)\n\t} else {\n\t\tnode.Meta = append(node.Meta, append([]byte(\",\"), []byte(str)...)...)\n\t}\n}", "func (r *AWSCloudWatchAlarm_MetricDataQuery) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "func (c *jsiiProxy_CfnInstance) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "func (c *Client) setMetadata(metadata bmc.Metadata) {\n\t// a mutex is created with the NewClient func, in the case\n\t// where a user doesn't call NewClient we handle by checking if\n\t// the mutex is nil\n\tif c.mdLock != nil {\n\t\tc.mdLock.Lock()\n\t\tdefer c.mdLock.Unlock()\n\t}\n\tc.metadata = &metadata\n}", "func (vrsConnection *VRSConnection) SetEntityMetadata(uuid string, metadata map[entity.MetadataKey]string) error {\n\trow := make(map[string]interface{})\n\trow[ovsdb.NuageVMTableColumnMetadata] = metadata\n\n\tcondition := []string{ovsdb.NuageVMTableColumnVMUUID, \"==\", uuid}\n\n\tif err := vrsConnection.vmTable.UpdateRow(vrsConnection.ovsdbClient, row, condition); err != nil {\n\t\treturn fmt.Errorf(\"Unable to update the metadata %s %v %v\", uuid, metadata, err)\n\t}\n\n\treturn nil\n}", "func (e *Entity) SetMetadata(k, v string) {\n\tif v == \"\" {\n\t\tdelete(e.metadata, k)\n\t} else {\n\t\te.metadata[k] = v\n\t}\n}", "func (gsc *GameServerCreate) SetMetadata(m *Metadata) *GameServerCreate {\n\treturn gsc.SetMetadataID(m.ID)\n}", "func (r *AWSRoute53RecordSetGroup_RecordSet) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "func (r *AWSCloudFrontDistribution_Origin) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "func (w *Base) SetMetadata(metadata *BaseMetadata) {\n\tw.metadata = metadata\n}", "func setConsensusMetadataWithValues(\n\tclientStore sdk.KVStore, height,\n\tprocessedHeight exported.Height,\n\tprocessedTime uint64,\n) {\n\tSetProcessedTime(clientStore, height, processedTime)\n\tSetProcessedHeight(clientStore, height, processedHeight)\n\tSetIterationKey(clientStore, height)\n}", "func (nc *NodeCreate) SetMetadata(s string) *NodeCreate {\n\tnc.mutation.SetMetadata(s)\n\treturn nc\n}", "func (c *ProjectsSetCommonInstanceMetadataCall) Do(call *v1.ProjectsSetCommonInstanceMetadataCall, opts ...googleapi.CallOption) (*v1.Operation, error) {\n\treturn call.Do(opts...)\n}", "func (gsuo *GameServerUpdateOne) SetMetadata(m *Metadata) *GameServerUpdateOne {\n\treturn gsuo.SetMetadataID(m.ID)\n}", "func (o *SchemaDefinitionRestDto) SetMetadata(v map[string]string) {\n\to.Metadata = &v\n}", "func (c *jsiiProxy_CfnMaster) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "func (gsu *GameServerUpdate) SetMetadata(m *Metadata) *GameServerUpdate {\n\treturn gsu.SetMetadataID(m.ID)\n}", "func (o *IamServiceProviderAllOf) SetMetadata(v string) {\n\to.Metadata = &v\n}", "func (r *AWSAutoScalingPlansScalingPlan_ScalingInstruction) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "func (_options *ReplaceIntegrationOptions) SetMetadata(metadata *IntegrationMetadata) *ReplaceIntegrationOptions {\n\t_options.Metadata = metadata\n\treturn _options\n}", "func (c *ContainerClient) SetMetadata(ctx context.Context, o *ContainerSetMetadataOptions) (ContainerSetMetadataResponse, error) {\n\tmetadataOptions, lac, mac := o.format()\n\tresp, err := c.client.SetMetadata(ctx, metadataOptions, lac, mac)\n\n\treturn toContainerSetMetadataResponse(resp), handleError(err)\n}", "func (p *ProvisionTokenV2) SetMetadata(meta Metadata) {\n\tp.Metadata = meta\n}", "func (computeService Service) SetServerMetadata(serverID string, metadata map[string]string) (map[string]string, error) {\n\tinput := serverMetadataContainer{Metadata: metadata}\n\toutput := serverMetadataContainer{}\n\treqURL, err := computeService.buildRequestURL(\"/servers/\", serverID, \"/metadata\")\n\tif err != nil {\n\t\treturn make(map[string]string, 0), err\n\t}\n\n\terr = misc.PostJSON(reqURL, computeService.authenticator, input, &output)\n\tif err != nil {\n\t\treturn make(map[string]string, 0), err\n\t}\n\n\treturn output.Metadata, nil\n}", "func (o *Job) SetMetadata(v map[string]string) {\n\to.Metadata = &v\n}", "func (m *Monocular) UpdateMetadata(info *interfaces.Info, userGUID string, echoContext echo.Context) {\n}", "func (c *jsiiProxy_CfnMember) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "func ShardDatasetMetadata(value string) ShardDatasetAttr {\n\treturn func(m optionalAttr) {\n\t\tm[\"metadata\"] = value\n\t}\n}", "func RegisterDatasetV2Metadata(value string) RegisterDatasetV2Attr {\n\treturn func(m optionalAttr) {\n\t\tm[\"metadata\"] = value\n\t}\n}", "func (c *jsiiProxy_CfnIPSet) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "func (vc *VehicleCreate) SetMetadata(m *Metadata) *VehicleCreate {\n\treturn vc.SetMetadataID(m.ID)\n}", "func (c *jsiiProxy_CfnThreatIntelSet) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "func SetCommonTaskArgs(ctx context.Context, args *clients.SwarmingCreateTaskArgs) *clients.SwarmingCreateTaskArgs {\n\tcfg := config.Get(ctx)\n\targs.User = taskUser\n\targs.ServiceAccount = cfg.Tasker.AdminTaskServiceAccount\n\targs.Pool = cfg.Swarming.BotPool\n\treturn args\n}", "func (m *Machine) UpdateMetadata(ctx context.Context, metadata interface{}) error {\n\tif _, err := m.client.PatchMmds(ctx, metadata); err != nil {\n\t\tm.logger.Errorf(\"Updating metadata: %s\", err)\n\t\treturn err\n\t}\n\n\tm.logger.Printf(\"UpdateMetadata successful\")\n\treturn nil\n}", "func (v *DCHttpClient) SetCommonHeaders(headers map[string]string) {\n\tfor key, val := range headers {\n\t\tv.CHeader[key] = val\n\t}\n}", "func (v *DCHttpClient) SetCommonHeader(key string, value string) {\n\tv.CHeader[key] = value\n}", "func RandomDatasetV2Metadata(value string) RandomDatasetV2Attr {\n\treturn func(m optionalAttr) {\n\t\tm[\"metadata\"] = value\n\t}\n}", "func (c *jsiiProxy_CfnConfig) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "func (c *jsiiProxy_CfnMacro) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "func UnMarshalToCommonMetadata(metadataString string) (Metadata, error) {\n\tvar result Metadata\n\tif metadataString != \"\" {\n\t\terr := json.Unmarshal([]byte(metadataString), &result)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn result, nil\n}", "func (p *Collection) SetMetadata(k, v string) (changed bool, err error) {\n\tif _, ok := deprecatedMetadataKeys[k]; ok {\n\t\terr = apperror.New(\n\t\t\t\"DEPRECATED\",\n\t\t\tfmt.Sprintf(\"metadata key `%s` is deprecated, please update client\", k),\n\t\t\tfmt.Sprintf(\"元数据 `%s` 已废弃, 请更新客户端\", k),\n\t\t)\n\t\treturn\n\t}\n\tif len(k) > 1<<10 {\n\t\terr = fmt.Errorf(\"key length excess limit (1 KiB): %s\", k)\n\t\treturn\n\t}\n\tif len(v) > 1<<20 {\n\t\terr = fmt.Errorf(\"value length excess limit (1 MiB): %s\", v)\n\t\treturn\n\t}\n\tif v == \"\" {\n\t\tif _, ok := p.metadata[k]; !ok {\n\t\t\treturn\n\t\t}\n\t\tdelete(p.metadata, k)\n\t\tif len(p.metadata) == 0 {\n\t\t\tp.metadata = nil\n\t\t}\n\t\tchanged = true\n\t\treturn\n\t}\n\tif p.metadata == nil {\n\t\tp.metadata = make(map[string]string)\n\t}\n\tif p.metadata[k] == v {\n\t\treturn\n\t}\n\tp.metadata[k] = v\n\tchanged = true\n\treturn\n}", "func (r *AWSApiGatewayUsagePlan_ApiStage) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "func (client Client) SetMetaData(ctx context.Context, accountName, containerName string, metaData map[string]string) (autorest.Response, error) {\n\treturn client.SetMetaDataWithLeaseID(ctx, accountName, containerName, \"\", metaData)\n}", "func (c *jsiiProxy_CfnClassifier) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "func (c *CommonOpts) SetCommon(opts CommonOpts) {\n\tc.Version = opts.Version\n}", "func (m *kubePackage) setMetadata(tCtx *addon.SkyCtx, name, namespace string, obj runtime.Object) error {\n\ta := meta.NewAccessor()\n\n\tobjName, err := a.Name(obj)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif objName != \"\" && objName != name {\n\t\treturn fmt.Errorf(\"name=`%s' argument does not match object's .metadata.name=`%s'\", name, objName)\n\t}\n\tif err := a.SetName(obj, name); err != nil {\n\t\treturn err\n\t}\n\n\tif namespace != \"\" { // namespace is optional argument.\n\t\tobjNs, err := a.Namespace(obj)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif objNs != \"\" && objNs != namespace {\n\t\t\treturn fmt.Errorf(\"namespace=`%s' argument does not match object's .metadata.namespace=`%s'\", namespace, objNs)\n\t\t}\n\n\t\tif err := a.SetNamespace(obj, namespace); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tls, err := a.Labels(obj)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif ls == nil {\n\t\tls = map[string]string{}\n\t}\n\n\tls[\"heritage\"] = \"isopod\"\n\tif tCtx.Attrs.Has(\"addon_version\") {\n\t\tversion, err := json.Marshal(tCtx.Attrs[\"addon_version\"])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(version) >= 2 && version[0] == '\"' && version[len(version)-1] == '\"' {\n\t\t\tls[\"addon_version\"] = string(version[1 : len(version)-1])\n\t\t}\n\t}\n\tif err := a.SetLabels(obj, ls); err != nil {\n\t\treturn err\n\t}\n\n\tas, err := a.Annotations(obj)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif as == nil {\n\t\tas = map[string]string{}\n\t}\n\n\tbs, err := json.Marshal(tCtx.Attrs)\n\tif err != nil {\n\t\treturn err\n\t}\n\tas[ctxAnnotationKey] = string(bs)\n\treturn a.SetAnnotations(obj, as)\n}", "func (s *ConfigureAgentInput) SetMetadata(v map[string]*string) *ConfigureAgentInput {\n\ts.Metadata = v\n\treturn s\n}", "func (m *MockProcessOptions) SetCacheSeriesMetadata(value bool) ProcessOptions {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SetCacheSeriesMetadata\", value)\n\tret0, _ := ret[0].(ProcessOptions)\n\treturn ret0\n}", "func (s *GetWorkflowOutput) SetMetadata(v map[string]*string) *GetWorkflowOutput {\n\ts.Metadata = v\n\treturn s\n}", "func (*XMLDocument) SetOnloadedmetadata(onloadedmetadata func(window.Event)) {\n\tmacro.Rewrite(\"$_.onloadedmetadata = $1\", onloadedmetadata)\n}", "func NewMetadata(\n\tlogger log.Logger,\n\tenableGlobalDomain dynamicconfig.BoolPropertyFn,\n\tfailoverVersionIncrement int64,\n\tmasterClusterName string,\n\tcurrentClusterName string,\n\tclusterInfo map[string]config.ClusterInformation,\n\treplicationConsumer *config.ReplicationConsumerConfig,\n) Metadata {\n\n\tif len(clusterInfo) == 0 {\n\t\tpanic(\"Empty cluster information\")\n\t} else if len(masterClusterName) == 0 {\n\t\tpanic(\"Master cluster name is empty\")\n\t} else if len(currentClusterName) == 0 {\n\t\tpanic(\"Current cluster name is empty\")\n\t} else if failoverVersionIncrement == 0 {\n\t\tpanic(\"Version increment is 0\")\n\t}\n\n\tversionToClusterName := make(map[int64]string)\n\tfor clusterName, info := range clusterInfo {\n\t\tif failoverVersionIncrement <= info.InitialFailoverVersion || info.InitialFailoverVersion < 0 {\n\t\t\tpanic(fmt.Sprintf(\n\t\t\t\t\"Version increment %v is smaller than initial version: %v.\",\n\t\t\t\tfailoverVersionIncrement,\n\t\t\t\tinfo.InitialFailoverVersion,\n\t\t\t))\n\t\t}\n\t\tif len(clusterName) == 0 {\n\t\t\tpanic(\"Cluster name in all cluster names is empty\")\n\t\t}\n\t\tversionToClusterName[info.InitialFailoverVersion] = clusterName\n\n\t\tif info.Enabled && (len(info.RPCName) == 0 || len(info.RPCAddress) == 0) {\n\t\t\tpanic(fmt.Sprintf(\"Cluster %v: rpc name / address is empty\", clusterName))\n\t\t}\n\t}\n\n\tif _, ok := clusterInfo[currentClusterName]; !ok {\n\t\tpanic(\"Current cluster is not specified in cluster info\")\n\t}\n\tif _, ok := clusterInfo[masterClusterName]; !ok {\n\t\tpanic(\"Master cluster is not specified in cluster info\")\n\t}\n\tif len(versionToClusterName) != len(clusterInfo) {\n\t\tpanic(\"Cluster info initial versions have duplicates\")\n\t}\n\n\treturn &metadataImpl{\n\t\tlogger: logger,\n\t\tenableGlobalDomain: enableGlobalDomain,\n\t\treplicationConsumer: replicationConsumer,\n\t\tfailoverVersionIncrement: failoverVersionIncrement,\n\t\tmasterClusterName: masterClusterName,\n\t\tcurrentClusterName: currentClusterName,\n\t\tclusterInfo: clusterInfo,\n\t\tversionToClusterName: versionToClusterName,\n\t}\n}", "func SetMetaData(f *gofpdf.Fpdf, author, title string) {\n\tf.SetTitle(title, true)\n\tf.SetAuthor(author, true)\n\tf.SetCreator(author, true)\n\tf.SetCreationDate(time.Now())\n}", "func (c *jsiiProxy_CfnModuleVersion) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "func (b *RaftBalloon) SetMetadata(nodeInvolved string, md map[string]string) error {\n\tcmd := b.fsm.setMetadata(nodeInvolved, md)\n\t_, err := b.WaitForLeader(5 * time.Second)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresp, err := b.raftApply(commands.MetadataSetCommandType, cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn resp.(*fsmGenericResponse).error\n}", "func (c *jsiiProxy_CfnWorkflow) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "func (s *WorkflowListItem) SetMetadata(v map[string]*string) *WorkflowListItem {\n\ts.Metadata = v\n\treturn s\n}", "func (v *Values) SetMetadata(stepName string, value interface{}) {\n\tv.setStepData(stepName, MetadataKey, value)\n}", "func (computeService Service) SetServerMetadataItem(serverID string, metaItemName string, value string) (map[string]string, error) {\n\tinput := serverMetaItemContainer{Meta: make(map[string]string)}\n\tinput.Meta[metaItemName] = value\n\toutput := serverMetaItemContainer{}\n\treqURL, err := computeService.buildRequestURL(\"/servers/\", serverID, \"/metadata/\", metaItemName)\n\tif err != nil {\n\t\treturn make(map[string]string, 0), err\n\t}\n\n\terr = misc.PutJSON(reqURL, computeService.authenticator, input, &output)\n\tif err != nil {\n\t\treturn make(map[string]string, 0), err\n\t}\n\n\treturn output.Meta, nil\n}", "func (wrc *WorkspaceRoleCreate) SetMetadata(m map[string]interface{}) *WorkspaceRoleCreate {\n\twrc.mutation.SetMetadata(m)\n\treturn wrc\n}", "func (m *MockRunOptions) SetCacheSeriesMetadata(value bool) RunOptions {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SetCacheSeriesMetadata\", value)\n\tret0, _ := ret[0].(RunOptions)\n\treturn ret0\n}", "func (c *jsiiProxy_CfnInstance) GetMetadata(key *string) interface{} {\n\tvar returns interface{}\n\n\t_jsii_.Invoke(\n\t\tc,\n\t\t\"getMetadata\",\n\t\t[]interface{}{key},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "func (c *jsiiProxy_CfnMLTransform) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "func (bucket Bucket) SetObjectMeta(objectKey string, options ...Option) error {\n\toptions = append(options, MetadataDirective(MetaReplace))\n\t_, err := bucket.CopyObject(objectKey, objectKey, options...)\n\treturn err\n}", "func (l *Libvirt) DomainSetMetadata(Dom Domain, Type int32, Metadata OptString, Key OptString, Uri OptString, Flags DomainModificationImpact) (err error) {\n\tvar buf []byte\n\n\targs := DomainSetMetadataArgs {\n\t\tDom: Dom,\n\t\tType: Type,\n\t\tMetadata: Metadata,\n\t\tKey: Key,\n\t\tUri: Uri,\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(264, constants.Program, buf, nil, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "func (o *Transfer) SetMetadata(v map[string]string) {\n\to.Metadata = v\n}", "func (c *jsiiProxy_CfnHostedConfigurationVersion) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "func (s *Segment) SetMetadata(spyName string, sampleRate uint32, units, aggregationType string) {\n\ts.spyName = spyName\n\ts.sampleRate = sampleRate\n\ts.units = units\n\ts.aggregationType = aggregationType\n}", "func (c *jsiiProxy_CfnStudio) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "func BatchDatasetV2Metadata(value string) BatchDatasetV2Attr {\n\treturn func(m optionalAttr) {\n\t\tm[\"metadata\"] = value\n\t}\n}", "func (item *DBItem) SetMetadataFromFile() error {\n\titem.Load()\n\tfname := item.Fname()\n\tif fname == \"\" {\n\t\treturn fmt.Errorf(\"could not set metadata from file in dataset not supporting filename\")\n\t}\n\tspec := item.DataSpec()\n\tspec_, ok := spec.(skyhook.MetadataFromFileDataSpec)\n\tif !ok {\n\t\treturn fmt.Errorf(\"MetadataFromFile not supported for type %s\", item.Dataset.DataType)\n\t}\n\tformat, metadata, err := spec_.GetMetadataFromFile(fname)\n\tif err != nil {\n\t\treturn err\n\t}\n\titem.SetMetadata(format, metadata)\n\treturn nil\n}", "func (c *jsiiProxy_CfnPartition) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "func (c *jsiiProxy_CfnModuleDefaultVersion) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "func (o *check) SetMetadataClient(metadataClient voucher.MetadataClient) {\n\to.metadataClient = metadataClient\n}", "func (c *jsiiProxy_CfnReplicationConfiguration) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "func (r *UserPoolRiskConfigurationAttachment_NotifyConfigurationType) SetCoreMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "func RegisterDatasetMetadata(value string) RegisterDatasetAttr {\n\treturn func(m optionalAttr) {\n\t\tm[\"metadata\"] = value\n\t}\n}", "func NewMetadata(\n\tctx context.Context,\n\thostProject,\n\tbigQueryDataset,\n\tschemaPath,\n\tremoteMixerDomain string,\n\tfoldRemoteRootSvg bool,\n\tsqlitePath string,\n) (*resource.Metadata, error) {\n\t_, filename, _, _ := runtime.Caller(0)\n\tsubTypeMap, err := solver.GetSubTypeMap(\n\t\tpath.Join(path.Dir(filename), \"../translator/table_types.json\"))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmappings := []*types.Mapping{}\n\tif schemaPath != \"\" && bigQueryDataset != \"\" {\n\t\tfiles, err := os.ReadDir(schemaPath)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor _, f := range files {\n\t\t\tif strings.HasSuffix(f.Name(), \".mcf\") {\n\t\t\t\tmappingStr, err := os.ReadFile(filepath.Join(schemaPath, f.Name()))\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmapping, err := mcf.ParseMapping(string(mappingStr), bigQueryDataset)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tmappings = append(mappings, mapping...)\n\t\t\t}\n\t\t}\n\t}\n\toutArcInfo := map[string]map[string][]*types.OutArcInfo{}\n\tinArcInfo := map[string][]*types.InArcInfo{}\n\n\tvar apiKey string\n\tif remoteMixerDomain != \"\" {\n\t\tapiKey, err = util.ReadLatestSecret(ctx, hostProject, util.MixerAPIKeyID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn &resource.Metadata{\n\t\t\tMappings: mappings,\n\t\t\tOutArcInfo: outArcInfo,\n\t\t\tInArcInfo: inArcInfo,\n\t\t\tSubTypeMap: subTypeMap,\n\t\t\tHostProject: hostProject,\n\t\t\tBigQueryDataset: bigQueryDataset,\n\t\t\tRemoteMixerDomain: remoteMixerDomain,\n\t\t\tRemoteMixerAPIKey: apiKey,\n\t\t\tFoldRemoteRootSvg: foldRemoteRootSvg,\n\t\t\tSQLitePath: sqlitePath,\n\t\t},\n\t\tnil\n}", "func (c *jsiiProxy_CfnPreset) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "func (c *jsiiProxy_CfnApplication) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "func (c *jsiiProxy_CfnApplication) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "func (c *jsiiProxy_CfnDeploymentConfig) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "func newMetricsMetadata(cluster *string, containerInstance *string) *ecstcs.MetricsMetadata {\n\treturn &ecstcs.MetricsMetadata{\n\t\tCluster: cluster,\n\t\tContainerInstance: containerInstance,\n\t}\n}", "func (c *jsiiProxy_CfnPublicRepository) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "func (c *jsiiProxy_CfnCrawler) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "func (r *AWSMediaLiveChannel_InputAttachment) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "func RandomDatasetMetadata(value string) RandomDatasetAttr {\n\treturn func(m optionalAttr) {\n\t\tm[\"metadata\"] = value\n\t}\n}", "func (o *SparseSSHAuthorizationPolicy) SetMetadata(metadata []string) {\n\n\to.Metadata = &metadata\n}", "func (c *jsiiProxy_CfnSchemaVersionMetadata) AddMetadata(key *string, value interface{}) {\n\t_jsii_.InvokeVoid(\n\t\tc,\n\t\t\"addMetadata\",\n\t\t[]interface{}{key, value},\n\t)\n}", "func NewMetadataClient(commandConfig *config.CommandConfig) Client {\n\tclient := ssm.New(commandConfig.Session)\n\tclient.Handlers.Build.PushBackNamed(clients.CustomUserAgentHandler())\n\treturn &metadataClient{\n\t\tclient: client,\n\t\tregion: aws.StringValue(commandConfig.Session.Config.Region),\n\t}\n}" ]
[ "0.61377525", "0.5963537", "0.5773658", "0.5675997", "0.5568595", "0.5467864", "0.5464806", "0.5443044", "0.5435471", "0.54151773", "0.5406739", "0.5397971", "0.5352868", "0.534336", "0.5339864", "0.532089", "0.52824086", "0.5259694", "0.5240586", "0.5212333", "0.520911", "0.52077603", "0.51985717", "0.51843363", "0.5172427", "0.5105918", "0.5098131", "0.50935185", "0.509068", "0.5055839", "0.50528866", "0.50395", "0.5024573", "0.502229", "0.4989591", "0.4984109", "0.4955232", "0.49430865", "0.49223116", "0.4921492", "0.49185768", "0.48833206", "0.48821706", "0.48807618", "0.48735482", "0.48598224", "0.48578596", "0.48511332", "0.48502222", "0.48495904", "0.4847785", "0.484454", "0.48387668", "0.48378146", "0.48344615", "0.48331416", "0.48290902", "0.4823338", "0.48224232", "0.48213997", "0.48146805", "0.48052487", "0.48037633", "0.47984278", "0.4798199", "0.47963405", "0.47871402", "0.477844", "0.4766454", "0.47517797", "0.47493693", "0.4744136", "0.47440013", "0.47438282", "0.4741358", "0.47362992", "0.47324184", "0.47316986", "0.47314644", "0.47230867", "0.47175726", "0.4702049", "0.4699729", "0.46996135", "0.46887156", "0.4682182", "0.4679442", "0.46783942", "0.46767977", "0.46745712", "0.46745712", "0.46680114", "0.46632984", "0.46609557", "0.46495423", "0.46490917", "0.46455416", "0.464469", "0.46442777", "0.46366858" ]
0.8284329
0
zoneOperationsWait uses the override method zoneOperationsWaitFn or the real implementation.
func (c *TestClient) zoneOperationsWait(project, zone, name string) error { if c.zoneOperationsWaitFn != nil { return c.zoneOperationsWaitFn(project, zone, name) } return c.client.zoneOperationsWait(project, zone, name) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *TestClient) regionOperationsWait(project, region, name string) error {\n\tif c.regionOperationsWaitFn != nil {\n\t\treturn c.regionOperationsWaitFn(project, region, name)\n\t}\n\treturn c.client.regionOperationsWait(project, region, name)\n}", "func (c *TestClient) globalOperationsWait(project, name string) error {\n\tif c.globalOperationsWaitFn != nil {\n\t\treturn c.globalOperationsWaitFn(project, name)\n\t}\n\treturn c.client.globalOperationsWait(project, name)\n}", "func (c *Compute) wait(operation *compute.Operation) error {\n\tfor {\n\t\top, err := c.ZoneOperations.Get(c.Project, c.Zone, operation.Name).Do()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to get operation: %v\", operation.Name, err)\n\t\t}\n\t\tlog.Printf(\"operation %q status: %s\", operation.Name, op.Status)\n\t\tif op.Status == \"DONE\" {\n\t\t\tif op.Error != nil {\n\t\t\t\treturn fmt.Errorf(\"operation error: %v\", *op.Error.Errors[0])\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\ttime.Sleep(1 * time.Second)\n\t}\n\treturn nil\n}", "func (cl *Client) waitForOperation(ctx context.Context, operation *compute.Operation) error {\n\tfor { // ZoneOperations should fail once the ctx.Deadline() is passed\n\t\tres, err := cl.computeService.ZoneOperations().Get(cl.projectID, cl.attrs[AttrZone].Value, operation.Name).Context(ctx).Do()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif res.Status == \"DONE\" {\n\t\t\tif res.Error != nil {\n\t\t\t\treturn fmt.Errorf(\"operation failure: code: %d, message: %s\", res.HttpErrorStatusCode, res.HttpErrorMessage)\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t\ttime.Sleep(time.Second)\n\t}\n}", "func OperationWait(w tpgresource.Waiter, activity string, timeout time.Duration, pollInterval time.Duration) error {\n\treturn tpgresource.OperationWait(w, activity, timeout, pollInterval)\n}", "func (gc *GCloudContainer) waitForOperation(operation *container.Operation) (err error) {\n\tstart := time.Now()\n\ttimeout := operationWaitTimeoutSecond * time.Second\n\n\tfor {\n\t\tapiName := fmt.Sprintf(\"projects/%v/locations/%v/operations/%v\", gc.Client.Project, gc.Client.Location, operation.Name)\n\n\t\tlog.Debug().Msgf(\"Waiting for operation %v\", apiName)\n\n\t\tif op, err := gc.Service.Projects.Locations.Operations.Get(apiName).Do(); err == nil {\n\t\t\tlog.Debug().Msgf(\"Operation %v status: %s\", apiName, op.Status)\n\n\t\t\tif op.Status == \"DONE\" {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t} else {\n\t\t\tlog.Error().Err(err).Msgf(\"Error while getting operation %v on %s: %v\", apiName, operation.TargetLink, err)\n\t\t}\n\n\t\tif time.Since(start) > timeout {\n\t\t\terr = fmt.Errorf(\"Timeout while waiting for operation %v on %s to complete\", apiName, operation.TargetLink)\n\t\t\treturn\n\t\t}\n\n\t\tsleepTime := ApplyJitter(operationPollIntervalSecond)\n\t\tlog.Info().Msgf(\"Sleeping for %v seconds...\", sleepTime)\n\t\ttime.Sleep(time.Duration(sleepTime) * time.Second)\n\t}\n\n\treturn\n}", "func wait() {\n\twaitImpl()\n}", "func (p *PoolManager) vmWaitingCleanupLook() {\n\tlogger := log.WithName(\"vmWaitingCleanupLook\")\n\tc := time.Tick(3 * time.Second)\n\tlogger.Info(\"starting cleanup loop for waiting mac addresses\")\n\tfor _ = range c {\n\t\tp.poolMutex.Lock()\n\n\t\tconfigMap, err := p.kubeClient.CoreV1().ConfigMaps(p.managerNamespace).Get(context.TODO(), names.WAITING_VMS_CONFIGMAP, metav1.GetOptions{})\n\t\tif err != nil {\n\t\t\tlogger.Error(err, \"failed to get config map\", \"configMapName\", names.WAITING_VMS_CONFIGMAP)\n\t\t\tp.poolMutex.Unlock()\n\t\t\tcontinue\n\t\t}\n\n\t\tconfigMapUpdateNeeded := false\n\t\tif configMap.Data == nil {\n\t\t\tlogger.V(1).Info(\"the configMap is empty\", \"configMapName\", names.WAITING_VMS_CONFIGMAP, \"macPoolMap\", p.macPoolMap)\n\t\t\tp.poolMutex.Unlock()\n\t\t\tcontinue\n\t\t}\n\n\t\tfor macAddress, allocationTime := range configMap.Data {\n\t\t\tt, err := time.Parse(time.RFC3339, allocationTime)\n\t\t\tif err != nil {\n\t\t\t\t// TODO: remove the mac from the wait map??\n\t\t\t\tlogger.Error(err, \"failed to parse allocation time\")\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tlogger.Info(\"data:\", \"configMapName\", names.WAITING_VMS_CONFIGMAP, \"configMap.Data\", configMap.Data, \"macPoolMap\", p.macPoolMap)\n\n\t\t\tif time.Now().After(t.Add(time.Duration(p.waitTime) * time.Second)) {\n\t\t\t\tconfigMapUpdateNeeded = true\n\t\t\t\tdelete(configMap.Data, macAddress)\n\t\t\t\tmacAddress = strings.Replace(macAddress, \"-\", \":\", 5)\n\t\t\t\tdelete(p.macPoolMap, macAddress)\n\t\t\t\tlogger.Info(\"released mac address in waiting loop\", \"macAddress\", macAddress)\n\t\t\t}\n\t\t}\n\n\t\tif configMapUpdateNeeded {\n\t\t\t_, err = p.kubeClient.CoreV1().ConfigMaps(p.managerNamespace).Update(context.TODO(), configMap, metav1.UpdateOptions{})\n\t\t}\n\n\t\tif err == nil {\n\t\t\tlogger.Info(\"the configMap successfully updated\", \"configMapName\", names.WAITING_VMS_CONFIGMAP, \"macPoolMap\", p.macPoolMap)\n\t\t} else {\n\t\t\tlogger.Info(\"the configMap failed to update\", \"configMapName\", names.WAITING_VMS_CONFIGMAP, \"macPoolMap\", p.macPoolMap)\n\t\t}\n\n\t\tp.poolMutex.Unlock()\n\t}\n}", "func (c controller) waitingForClusterOperators(ctx context.Context) error {\n\t// In case cvo changes it message we will update timer but we want to have maximum timeout\n\t// for this context with timeout is used\n\tc.log.Info(\"Waiting for cluster operators\")\n\tctxWithTimeout, cancel := context.WithTimeout(ctx, CVOMaxTimeout)\n\tdefer cancel()\n\n\tisClusterVersionAvailable := func(timer *time.Timer) bool {\n\t\tclusterOperatorHandler := NewClusterOperatorHandler(c.kc, consoleOperatorName, c.log)\n\t\tclusterVersionHandler := NewClusterVersionHandler(c.log, c.kc, timer)\n\t\tisConsoleEnabled, err := c.kc.IsClusterCapabilityEnabled(consoleCapabilityName)\n\t\tif err != nil {\n\t\t\tc.log.WithError(err).Error(\"Failed to check if console is enabled\")\n\t\t\treturn false\n\t\t}\n\t\tvar result bool\n\t\tif isConsoleEnabled {\n\t\t\tc.log.Info(\"Console is enabled, will wait for the console operator to be available\")\n\t\t\tresult = c.isOperatorAvailable(clusterOperatorHandler)\n\t\t} else {\n\t\t\tc.log.Info(\"Console is disabled, will not wait for the console operator to be available\")\n\t\t\tresult = true\n\t\t}\n\t\tif c.WaitForClusterVersion {\n\t\t\tresult = c.isOperatorAvailable(clusterVersionHandler) && result\n\t\t}\n\t\treturn result\n\t}\n\treturn utils.WaitForPredicateWithTimer(ctxWithTimeout, LongWaitTimeout, GeneralProgressUpdateInt, isClusterVersionAvailable)\n}", "func (k *kubectlContext) Wait(args ...string) error {\n\tout, err := k.do(append([]string{\"wait\"}, args...)...)\n\tk.t.Log(string(out))\n\treturn err\n}", "func (asiaD asiaDeprecatedTimeZones) Kuwait() string { return \"Asia/Riyadh\" }", "func KubeWaitOp(apiserver *cke.Node) cke.Operator {\n\treturn &kubeWaitOp{apiserver: apiserver}\n}", "func (t *ElapsedTimeout) Wait(context.Context) error { return nil }", "func (v DiffChangeView) WaitOp() ctlcap.ClusterChangeWaitOp { return ctlcap.ClusterChangeWaitOpNoop }", "func (container *container) WaitTimeout(timeout time.Duration) error {\r\n\tcontainer.waitOnce.Do(func() {\r\n\t\tcontainer.waitCh = make(chan struct{})\r\n\t\tgo func() {\r\n\t\t\tcontainer.waitErr = container.Wait()\r\n\t\t\tclose(container.waitCh)\r\n\t\t}()\r\n\t})\r\n\tt := time.NewTimer(timeout)\r\n\tdefer t.Stop()\r\n\tselect {\r\n\tcase <-t.C:\r\n\t\treturn &ContainerError{Container: container, Err: ErrTimeout, Operation: \"hcsshim::ComputeSystem::Wait\"}\r\n\tcase <-container.waitCh:\r\n\t\treturn container.waitErr\r\n\t}\r\n}", "func (op *delayedRouteOperation) wait() error {\n\treturn <-op.result\n}", "func PVCWait(ctx context.Context, t *testing.T, profile string, ns string, name string, timeout time.Duration) error {\n\tt.Helper()\n\n\tt.Logf(\"(dbg) %s: waiting %s for pvc %q in namespace %q ...\", t.Name(), timeout, name, ns)\n\n\tf := func(ctx context.Context) (bool, error) {\n\t\tret, err := Run(t, exec.CommandContext(ctx, \"kubectl\", \"--context\", profile, \"get\", \"pvc\", name, \"-o\", \"jsonpath={.status.phase}\", \"-n\", ns))\n\t\tif err != nil {\n\t\t\tt.Logf(\"%s: WARNING: PVC get for %q %q returned: %v\", t.Name(), ns, name, err)\n\t\t\treturn false, nil\n\t\t}\n\n\t\tpvc := strings.TrimSpace(ret.Stdout.String())\n\t\tif pvc == string(core.ClaimBound) {\n\t\t\treturn true, nil\n\t\t} else if pvc == string(core.ClaimLost) {\n\t\t\treturn true, fmt.Errorf(\"PVC %q is LOST\", name)\n\t\t}\n\t\treturn false, nil\n\t}\n\n\treturn wait.PollUntilContextTimeout(ctx, 1*time.Second, timeout, true, f)\n}", "func TestExecuteRunnerStatusNoNet(t *testing.T) {\n\tbuf := setLogBuffer()\n\tdefer func() {\n\t\tif t.Failed() {\n\t\t\tt.Log(buf.String())\n\t\t}\n\t}()\n\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\tdefer cancel()\n\n\tvar zoo myCall\n\n\tpool, err := NewSystemTestNodePoolNoNet()\n\tif err != nil {\n\t\tt.Fatalf(\"Creating Node Pool failed %v\", err)\n\t}\n\n\trunners, err := pool.Runners(context.Background(), &zoo)\n\tif err != nil {\n\t\tt.Fatalf(\"Getting Runners from Pool failed %v\", err)\n\t}\n\tif len(runners) == 0 {\n\t\tt.Fatalf(\"Getting Runners from Pool failed no-runners\")\n\t}\n\n\tfor _, dest := range runners {\n\t\tstatus, err := dest.Status(ctx)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"Runners Status failed for %v err=%v\", dest.Address(), err)\n\t\t}\n\t\tif status == nil || status.StatusFailed {\n\t\t\tt.Fatalf(\"Runners Status not OK for %v %v\", dest.Address(), status)\n\t\t}\n\t\tif !status.IsNetworkDisabled {\n\t\t\tt.Fatalf(\"Runners Status should have NO network enabled %v %v\", dest.Address(), status)\n\t\t}\n\t\tt.Logf(\"Runner %v got Status=%+v\", dest.Address(), status)\n\t}\n\n\tf, err := os.Create(StatusBarrierFile)\n\tif err != nil {\n\t\tt.Fatalf(\"create file=%v failed err=%v\", StatusBarrierFile, err)\n\t}\n\tf.Close()\n\n\t// Let status hc caches expire.\n\tselect {\n\tcase <-time.After(time.Duration(2 * time.Second)):\n\tcase <-ctx.Done():\n\t\tt.Fatal(\"Timeout\")\n\t}\n\n\tfor _, dest := range runners {\n\t\tstatus, err := dest.Status(ctx)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"Runners Status failed for %v err=%v\", dest.Address(), err)\n\t\t}\n\t\tif status == nil || status.StatusFailed {\n\t\t\tt.Fatalf(\"Runners Status not OK for %v %v\", dest.Address(), status)\n\t\t}\n\t\tif status.IsNetworkDisabled {\n\t\t\tt.Fatalf(\"Runners Status should have network enabled %v %v\", dest.Address(), status)\n\t\t}\n\t\tt.Logf(\"Runner %v got Status=%+v\", dest.Address(), status)\n\t}\n\n}", "func (c *Compute) waitGlobal(operation *compute.Operation) error {\n\tfor {\n\t\top, err := c.GlobalOperations.Get(c.Project, operation.Name).Do()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to get operation: %v\", operation.Name, err)\n\t\t}\n\t\tlog.Printf(\"operation %q status: %s\", operation.Name, op.Status)\n\t\tif op.Status == \"DONE\" {\n\t\t\tif op.Error != nil {\n\t\t\t\treturn fmt.Errorf(\"operation error: %v\", *op.Error.Errors[0])\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\ttime.Sleep(1 * time.Second)\n\t}\n\treturn nil\n}", "func (b *basebackup) Wait() {\n\tb.wg.Wait()\n}", "func LookupWaitCondition(ctx *pulumi.Context, args *LookupWaitConditionArgs, opts ...pulumi.InvokeOption) (*LookupWaitConditionResult, error) {\n\topts = internal.PkgInvokeDefaultOpts(opts)\n\tvar rv LookupWaitConditionResult\n\terr := ctx.Invoke(\"aws-native:cloudformation:getWaitCondition\", args, &rv, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &rv, nil\n}", "func WaitForConditionFunc(mcpName string, conditionType machineconfigv1.MachineConfigPoolConditionType, conditionStatus corev1.ConditionStatus, mcpCondGetter func(mcpName string, conditionType machineconfigv1.MachineConfigPoolConditionType) corev1.ConditionStatus) {\n\n\tvar cnfNodes []corev1.Node\n\trunningOnSingleNode, err := cluster.IsSingleNode()\n\tExpectWithOffset(1, err).ToNot(HaveOccurred())\n\t// checking in eventually as in case of single node cluster the only node may\n\t// be rebooting\n\tEventuallyWithOffset(1, func() error {\n\t\tmcp, err := GetByName(mcpName)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"Failed getting MCP by name\")\n\t\t}\n\n\t\tnodeLabels := mcp.Spec.NodeSelector.MatchLabels\n\t\tkey, _ := components.GetFirstKeyAndValue(nodeLabels)\n\t\treq, err := labels.NewRequirement(key, selection.Exists, []string{})\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"Failed creating node selector\")\n\t\t}\n\n\t\tselector := labels.NewSelector()\n\t\tselector = selector.Add(*req)\n\t\tcnfNodes, err = nodes.GetBySelector(selector)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"Failed getting nodes by selector\")\n\t\t}\n\n\t\ttestlog.Infof(\"MCP %q is targeting %v node(s): %s\", mcp.Name, len(cnfNodes), strings.Join(nodeNames(cnfNodes), \",\"))\n\t\treturn nil\n\t}, cluster.ComputeTestTimeout(10*time.Minute, runningOnSingleNode), 5*time.Second).ShouldNot(HaveOccurred(), \"Failed to find CNF nodes by MCP %q\", mcpName)\n\n\t// timeout should be based on the number of worker-cnf nodes\n\ttimeout := time.Duration(len(cnfNodes)*mcpUpdateTimeoutPerNode) * time.Minute\n\tif len(cnfNodes) == 0 {\n\t\ttimeout = 2 * time.Minute\n\t}\n\n\tEventuallyWithOffset(1, func() corev1.ConditionStatus {\n\t\treturn mcpCondGetter(mcpName, conditionType)\n\t}, cluster.ComputeTestTimeout(timeout, runningOnSingleNode), 30*time.Second).Should(Equal(conditionStatus), \"Failed to find condition status by MCP %q\", mcpName)\n}", "func NewCfnWaitCondition_Override(c CfnWaitCondition, scope constructs.Construct, id *string, props *CfnWaitConditionProps) {\n\t_init_.Initialize()\n\n\t_jsii_.Create(\n\t\t\"aws-cdk-lib.aws_cloudformation.CfnWaitCondition\",\n\t\t[]interface{}{scope, id, props},\n\t\tc,\n\t)\n}", "func (s *BasePlSqlParserListener) ExitWait_nowait_part(ctx *Wait_nowait_partContext) {}", "func waitReady(project, name, region string) error {\n\twait := time.Minute * 4\n\tdeadline := time.Now().Add(wait)\n\tfor time.Now().Before(deadline) {\n\t\tsvc, err := getService(project, name, region)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to query Service for readiness: %w\", err)\n\t\t}\n\n\t\tfor _, cond := range svc.Status.Conditions {\n\t\t\tif cond.Type == \"Ready\" {\n\t\t\t\tif cond.Status == \"True\" {\n\t\t\t\t\treturn nil\n\t\t\t\t} else if cond.Status == \"False\" {\n\t\t\t\t\treturn fmt.Errorf(\"reason=%s message=%s\", cond.Reason, cond.Message)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\ttime.Sleep(time.Second * 2)\n\t}\n\treturn fmt.Errorf(\"the service did not become ready in %s, check Cloud Console for logs to see why it failed\", wait)\n}", "func (asiaT asiaTimeZones) Kuwait() string {return \"Asia/Kuwait\" }", "func (o *operation) waitExecution(bq *InMemoryBuildQueue, out remoteexecution.Execution_ExecuteServer) error {\n\tctx := out.Context()\n\n\t// Bookkeeping for determining whether operations are abandoned\n\t// by clients. Operations should be removed if there are no\n\t// clients calling Execute() or WaitExecution() for a certain\n\t// amount of time.\n\tif o.cleanupKey.isActive() {\n\t\tbq.cleanupQueue.remove(o.cleanupKey)\n\t}\n\to.waiters++\n\tdefer func() {\n\t\tif o.waiters == 0 {\n\t\t\tpanic(\"Invalid waiters count on operation\")\n\t\t}\n\t\to.waiters--\n\t\to.maybeStartCleanup(bq)\n\t}()\n\n\tt := o.task\n\tfor {\n\t\t// Construct the longrunning.Operation that needs to be\n\t\t// sent back to the client.\n\t\tmetadata, err := anypb.New(&remoteexecution.ExecuteOperationMetadata{\n\t\t\tStage: t.getStage(),\n\t\t\tActionDigest: t.desiredState.ActionDigest,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn util.StatusWrap(err, \"Failed to marshal execute operation metadata\")\n\t\t}\n\t\toperation := &longrunning.Operation{\n\t\t\tName: o.name,\n\t\t\tMetadata: metadata,\n\t\t}\n\t\tif t.executeResponse != nil {\n\t\t\toperation.Done = true\n\t\t\tresponse, err := anypb.New(t.executeResponse)\n\t\t\tif err != nil {\n\t\t\t\treturn util.StatusWrap(err, \"Failed to marshal execute response\")\n\t\t\t}\n\t\t\toperation.Result = &longrunning.Operation_Response{Response: response}\n\t\t}\n\t\tstageChangeWakeup := t.stageChangeWakeup\n\t\tbq.leave()\n\n\t\t// Send the longrunning.Operation back to the client.\n\t\tif err := out.Send(operation); operation.Done || err != nil {\n\t\t\tbq.enter(bq.clock.Now())\n\t\t\treturn err\n\t\t}\n\n\t\t// Suspend until the client closes the connection, the\n\t\t// action completes or a certain amount of time has\n\t\t// passed without any updates.\n\t\ttimer, timerChannel := bq.clock.NewTimer(bq.configuration.ExecutionUpdateInterval)\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\ttimer.Stop()\n\t\t\tbq.enter(bq.clock.Now())\n\t\t\treturn util.StatusFromContext(ctx)\n\t\tcase <-stageChangeWakeup:\n\t\t\ttimer.Stop()\n\t\t\tbq.enter(bq.clock.Now())\n\t\tcase t := <-timerChannel:\n\t\t\tbq.enter(t)\n\t\t}\n\t}\n}", "func (async *async) waitOrTimeout(duration time.Duration) error {\n\ttimer := time.NewTimer(duration)\n\tdefer timer.Stop()\n\tselect {\n\tcase <-timer.C:\n\t\treturn errors.New(\"operation cancelled\")\n\tcase <-async.done:\n\t\treturn nil\n\t}\n}", "func (c *ConsensusState) wakeUpWaitCompleteOp() {\n\tfor _, op := range c.waitCompleteOp {\n\t\top.result = c.GetOrderedBGStateResponse()\n\t\top.wait <- true\n\t}\n\t// clean up waiting list\n\tc.waitCompleteOp = make([]*WaitCycleComplete, 0)\n}", "func (p *Provider) wait() {\n\t// Compute the backoff time\n\tbackoff := p.backoffDuration()\n\n\t// Setup a wait timer\n\tvar wait <-chan time.Time\n\tif backoff > 0 {\n\t\tjitter := time.Duration(rand.Uint32()) % backoff\n\t\twait = time.After(backoff + jitter)\n\t}\n\n\t// Wait until timer or shutdown\n\tselect {\n\tcase <-wait:\n\tcase <-p.shutdownCh:\n\t}\n}", "func wait(c client.Client, watchNamespace, condType string, expectedStatus meta.ConditionStatus) error {\n\terr := kubeWait.Poll(retry.Interval, retry.ResourceChangeTimeout, func() (bool, error) {\n\t\topCond, err := get(c, watchNamespace)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\treturn Validate(opCond.Status.Conditions, condType, expectedStatus), nil\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to verify condition type %s has status %s: %w\", condType, expectedStatus, err)\n\t}\n\treturn nil\n}", "func TestWait_timeout(t *testing.T) {\n\tdefer check(t)\n\tcontent := \"hello world!\"\n\treq := &showcasepb.WaitRequest{\n\t\tEnd: &showcasepb.WaitRequest_Ttl{\n\t\t\tTtl: &durationpb.Duration{Seconds: 1},\n\t\t},\n\t\tResponse: &showcasepb.WaitRequest_Success{\n\t\t\tSuccess: &showcasepb.WaitResponse{Content: content},\n\t\t},\n\t}\n\tctx, cancel := context.WithTimeout(context.Background(), 100*time.Millisecond)\n\tdefer cancel()\n\n\top, err := echo.Wait(ctx, req)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tresp, err := op.Wait(ctx)\n\tif err == nil {\n\t\tt.Errorf(\"Wait() = %+v, want error\", resp)\n\t}\n}", "func TestWaitUntilAllNodesReady(t *testing.T) {\n\tt.Parallel()\n\n\toptions := NewKubectlOptions(\"\", \"\", \"default\")\n\n\tWaitUntilAllNodesReady(t, options, 12, 5*time.Second)\n\n\tnodes := GetNodes(t, options)\n\tnodeNames := map[string]bool{}\n\tfor _, node := range nodes {\n\t\tnodeNames[node.Name] = true\n\t}\n\n\treadyNodes := GetReadyNodes(t, options)\n\treadyNodeNames := map[string]bool{}\n\tfor _, node := range readyNodes {\n\t\treadyNodeNames[node.Name] = true\n\t}\n\n\tassert.Equal(t, nodeNames, readyNodeNames)\n}", "func WaitForFuncOnWatermarkPodAutoscaler(t *testing.T, client framework.FrameworkClient, namespace, name string, f func(dd *datadoghqv1alpha1.WatermarkPodAutoscaler) (bool, error), retryInterval, timeout time.Duration) error {\n\treturn wait.Poll(retryInterval, timeout, func() (bool, error) {\n\t\tobjKey := dynclient.ObjectKey{\n\t\t\tNamespace: namespace,\n\t\t\tName: name,\n\t\t}\n\t\tWatermarkPodAutoscaler := &datadoghqv1alpha1.WatermarkPodAutoscaler{}\n\t\terr := client.Get(context.TODO(), objKey, WatermarkPodAutoscaler)\n\t\tif err != nil {\n\t\t\tif apierrors.IsNotFound(err) {\n\t\t\t\tt.Logf(\"Waiting for availability of %s WatermarkPodAutoscaler\\n\", name)\n\t\t\t\treturn false, nil\n\t\t\t}\n\t\t\treturn false, err\n\t\t}\n\n\t\tok, err := f(WatermarkPodAutoscaler)\n\t\tt.Logf(\"Waiting for condition function to be true ok for %s WatermarkPodAutoscaler (%t/%v)\\n\", name, ok, err)\n\t\treturn ok, err\n\t})\n}", "func (t *SyncTransport) Wait() {}", "func (fn *FolderNode) waitAvailable() bool {\n\tselect {\n\tcase <-fn.stop:\n\t\treturn false\n\tdefault:\n\t\tselect {\n\t\tcase <-fn.ava:\n\t\t\treturn true\n\t\tcase <-fn.stop:\n\t\t\treturn false\n\t\t}\n\t}\n}", "func waitCheck(c *Coordinator, taskType int, taskNum int) {\n\ttime.Sleep(10 * time.Second)\n\n\tif taskType == 0 {\n\t\tc.mapLock.Lock()\n\t\tif !c.mapTasks[taskNum].done {\n\t\t\tdefer fmt.Printf(\"Worker %v took too long to respond for map task %v\\n\",\n\t\t\t\tc.mapTasks[taskNum].worker, taskNum)\n\t\t\tc.mapTasks[taskNum].worker = -1\n\t\t\tc.availableMapTasks[taskNum] = taskNum\n\t\t}\n\t\tc.mapLock.Unlock()\n\t} else {\n\t\tc.reduceLock.Lock()\n\t\tif !c.reduceTasks[taskNum].done {\n\t\t\tdefer fmt.Printf(\"Worker %v took too long to respond for reduce task %v\\n\",\n\t\t\t\tc.reduceTasks[taskNum].worker, taskNum)\n\t\t\tc.reduceTasks[taskNum].worker = -1\n\t\t\tc.availableReduceTasks[taskNum] = taskNum\n\t\t}\n\t\tc.reduceLock.Unlock()\n\t}\n}", "func (b *CrossplaneBroker) LastOperation(ctx context.Context, instanceID string, details domain.PollDetails) (domain.LastOperation, error) {\n\tlogger := requestScopedLogger(ctx, b.logger).WithData(lager.Data{\"instance-id\": instanceID})\n\tlogger.Info(\"last-operation\", lager.Data{\"operation-data\": details.OperationData, \"plan-id\": details.PlanID, \"service-id\": details.ServiceID})\n\n\tinstance, err := b.c.GetInstance(ctx, instanceID)\n\tif err != nil {\n\t\tif errors.Is(err, crossplane.ErrInstanceNotFound) {\n\t\t\terr = apiresponses.ErrInstanceDoesNotExist\n\t\t}\n\t\treturn domain.LastOperation{}, crossplane.ConvertError(ctx, err)\n\t}\n\n\tcondition := instance.GetCondition(v1alpha1.TypeReady)\n\top := domain.LastOperation{\n\t\tDescription: \"Unknown\",\n\t\tState: domain.InProgress,\n\t}\n\tif desc := string(condition.Reason); len(desc) > 0 {\n\t\top.Description = desc\n\t}\n\n\tswitch condition.Reason {\n\tcase v1alpha1.ReasonAvailable:\n\t\top.State = domain.Succeeded\n\t\tsb, err := crossplane.ServiceBinderFactory(b.c, instance, logger)\n\t\tif err != nil {\n\t\t\treturn domain.LastOperation{}, crossplane.ConvertError(ctx, err)\n\t\t}\n\t\tif err := sb.FinishProvision(ctx); err != nil {\n\t\t\treturn domain.LastOperation{}, crossplane.ConvertError(ctx, err)\n\t\t}\n\t\tlogger.WithData(lager.Data{\"reason\": condition.Reason, \"message\": condition.Message}).Info(\"provision-succeeded\")\n\tcase v1alpha1.ReasonCreating:\n\t\top.State = domain.InProgress\n\t\tlogger.WithData(lager.Data{\"reason\": condition.Reason, \"message\": condition.Message}).Info(\"provision-in-progress\")\n\tcase v1alpha1.ReasonUnavailable, v1alpha1.ReasonDeleting:\n\t\top.State = domain.Failed\n\t\tlogger.WithData(lager.Data{\"reason\": condition.Reason, \"message\": condition.Message}).Info(\"provision-failed\")\n\t}\n\treturn op, nil\n}", "func testDependentServiceChanges(t *testing.T) {\n\ttc, err := NewTestContext()\n\trequire.NoError(t, err)\n\terr = tc.waitForConfiguredWindowsNodes(gc.numberOfMachineNodes, false, false)\n\trequire.NoError(t, err, \"timed out waiting for Windows Machine nodes\")\n\terr = tc.waitForConfiguredWindowsNodes(gc.numberOfBYOHNodes, false, true)\n\trequire.NoError(t, err, \"timed out waiting for BYOH Windows nodes\")\n\tnodes := append(gc.machineNodes, gc.byohNodes...)\n\n\tqueryCommand := \"Get-WmiObject win32_service | Where-Object {$_.Name -eq \\\\\\\"hybrid-overlay-node\\\\\\\"} \" +\n\t\t\"|select -ExpandProperty PathName\"\n\tfor _, node := range nodes {\n\t\tt.Run(node.GetName(), func(t *testing.T) {\n\t\t\t// Get initial configuration of hybrid-overlay-node, this service is used as kube-proxy is dependent on it\n\t\t\taddr, err := controllers.GetAddress(node.Status.Addresses)\n\t\t\trequire.NoError(t, err, \"error getting node address\")\n\t\t\tout, err := tc.runPowerShellSSHJob(\"hybrid-overlay-query\", queryCommand, addr)\n\t\t\trequire.NoError(t, err, \"error querying hybrid-overlay service\")\n\t\t\t// The binPath/pathName will be the final line of the pod logs\n\t\t\toriginalPath := finalLine(out)\n\n\t\t\t// Change hybrid-overlay-node configuration\n\t\t\tnewPath, err := changeHybridOverlayCommandVerbosity(originalPath)\n\t\t\trequire.NoError(t, err, \"error constructing new hybrid-overlay command\")\n\t\t\tchangeCommand := fmt.Sprintf(\"sc.exe config hybrid-overlay-node binPath=\\\\\\\"%s\\\\\\\"\", newPath)\n\t\t\tout, err = tc.runPowerShellSSHJob(\"hybrid-overlay-change\", changeCommand, addr)\n\t\t\trequire.NoError(t, err, \"error changing hybrid-overlay command\")\n\n\t\t\t// Wait until hybrid-overlay-node is returned to correct config\n\t\t\terr = wait.Poll(retry.Interval, retry.Timeout, func() (bool, error) {\n\t\t\t\tout, err = tc.runPowerShellSSHJob(\"hybrid-overlay-query2\", queryCommand, addr)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn false, nil\n\t\t\t\t}\n\t\t\t\tcurrentPath := finalLine(out)\n\t\t\t\tif currentPath != originalPath {\n\t\t\t\t\tlog.Printf(\"waiting for hybrid-overlay service config to be reconciled, current value: %s\",\n\t\t\t\t\t\tcurrentPath)\n\t\t\t\t\treturn false, nil\n\t\t\t\t}\n\t\t\t\treturn true, nil\n\t\t\t})\n\t\t\trequire.NoError(t, err)\n\t\t})\n\t}\n}", "func (a API) GetBlockTemplateWait(cmd *btcjson.GetBlockTemplateCmd) (out *string, e error) {\n\tRPCHandlers[\"getblocktemplate\"].Call <-API{a.Ch, cmd, nil}\n\tselect {\n\tcase <-time.After(time.Second*5):\n\t\tbreak\n\tcase o := <-a.Ch.(chan GetBlockTemplateRes):\n\t\tout, e = o.Res, o.Err\n\t}\n\treturn\n}", "func (ft *FutureTask) Wait(timeout time.Duration) (res *[]byte, err error) {\n\tselect {\n\tcase res = <-ft.out:\n\tcase <-time.After(timeout):\n\t\terr = fmt.Errorf(\"task(%+v) timeout\", ft)\n\t}\n\treturn\n}", "func (w *worker) waitExcludeHost(host *chop.ChiHost) bool {\n\t// Check CHI settings\n\tswitch {\n\tcase host.GetCHI().IsReconcilingPolicyWait():\n\t\treturn true\n\tcase host.GetCHI().IsReconcilingPolicyNoWait():\n\t\treturn false\n\t}\n\n\t// Fallback to operator's settings\n\treturn w.c.chop.Config().ReconcileWaitExclude\n}", "func runLocalStorageIsolationEvictionTest(f *framework.Framework, testCondition string, podTestSpecs []podEvictSpec, evictionTestTimeout time.Duration,\n\thasPressureCondition func(*framework.Framework, string) (bool, error)) {\n\n\tContext(fmt.Sprintf(\"EmptyDirEviction when we run containers that should cause %s\", testCondition), func() {\n\n\t\tBeforeEach(func() {\n\t\t\tBy(\"seting up pods to be used by tests\")\n\n\t\t\tfor _, spec := range podTestSpecs {\n\t\t\t\tBy(fmt.Sprintf(\"creating pod with container: %s\", spec.pod.Name))\n\t\t\t\tf.PodClient().CreateSync(&spec.pod)\n\t\t\t}\n\t\t})\n\n\t\tIt(fmt.Sprintf(\"Test should eventually see %s, and then evict the correct pods\", testCondition), func() {\n\t\t\tevictNum := 0\n\t\t\tevictMap := make(map[string]string)\n\t\t\tEventually(func() error {\n\t\t\t\t// Gather current information\n\t\t\t\tupdatedPodList, err := f.ClientSet.Core().Pods(f.Namespace.Name).List(metav1.ListOptions{})\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"failed to get the list of pod: %v\", err)\n\t\t\t\t}\n\t\t\t\tupdatedPods := updatedPodList.Items\n\n\t\t\t\tfor _, p := range updatedPods {\n\t\t\t\t\tframework.Logf(\"fetching pod %s; phase= %v\", p.Name, p.Status.Phase)\n\t\t\t\t\tfor _, testPod := range podTestSpecs {\n\t\t\t\t\t\tif p.Name == testPod.pod.Name {\n\t\t\t\t\t\t\tif !testPod.evicted {\n\t\t\t\t\t\t\t\tExpect(p.Status.Phase).NotTo(Equal(v1.PodFailed),\n\t\t\t\t\t\t\t\t\tfmt.Sprintf(\"%s pod failed (and shouldn't have failed)\", p.Name))\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tif _, ok := evictMap[p.Name]; !ok && p.Status.Phase == v1.PodFailed {\n\t\t\t\t\t\t\t\t\tevictNum++\n\t\t\t\t\t\t\t\t\tevictMap[p.Name] = p.Name\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\n\t\t\t\t}\n\t\t\t\tif evictNum == totalEvict {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\treturn fmt.Errorf(\"pods that caused %s have not been evicted\", testCondition)\n\t\t\t}, evictionTestTimeout, evictionPollInterval).Should(BeNil())\n\n\t\t\tBy(\"making sure we can start a new pod after the test\")\n\t\t\tpodName := \"test-admit-pod\"\n\t\t\tf.PodClient().CreateSync(&v1.Pod{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: podName,\n\t\t\t\t},\n\t\t\t\tSpec: v1.PodSpec{\n\t\t\t\t\tRestartPolicy: v1.RestartPolicyNever,\n\t\t\t\t\tContainers: []v1.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tImage: framework.GetPauseImageNameForHostArch(),\n\t\t\t\t\t\t\tName: podName,\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\tAfterEach(func() {\n\t\t\tBy(\"deleting pods\")\n\t\t\tfor _, spec := range podTestSpecs {\n\t\t\t\tBy(fmt.Sprintf(\"deleting pod: %s\", spec.pod.Name))\n\t\t\t\tf.PodClient().DeleteSync(spec.pod.Name, &metav1.DeleteOptions{}, framework.DefaultPodDeletionTimeout)\n\t\t\t}\n\n\t\t\tif CurrentGinkgoTestDescription().Failed {\n\t\t\t\tif framework.TestContext.DumpLogsOnFailure {\n\t\t\t\t\tlogPodEvents(f)\n\t\t\t\t\tlogNodeEvents(f)\n\t\t\t\t}\n\t\t\t\tBy(\"sleeping to allow for cleanup of test\")\n\t\t\t\ttime.Sleep(postTestConditionMonitoringPeriod)\n\t\t\t}\n\t\t})\n\t})\n}", "func (o *Operation) Wait(timeout time.Duration) (bool, error) {\n\t// check current state\n\tif o.status.IsFinal() {\n\t\treturn true, nil\n\t}\n\n\t// wait indefinitely\n\tif timeout == -1 {\n\t\tselect {\n\t\tcase <-o.chanDone:\n\t\t\treturn true, nil\n\t\t}\n\t}\n\n\t// Wait until timeout\n\tif timeout > 0 {\n\t\ttimer := time.NewTimer(timeout)\n\t\tselect {\n\t\tcase <-o.chanDone:\n\t\t\treturn true, nil\n\t\tcase <-timer.C:\n\t\t\treturn false, errors.Errorf(\"timeout\")\n\t\t}\n\t}\n\treturn false, nil\n}", "func (c *gcsCore) WaitContainer(id string) (func() prot.NotificationType, error) {\n\tc.containerCacheMutex.Lock()\n\tentry := c.getContainer(id)\n\tif entry == nil {\n\t\tc.containerCacheMutex.Unlock()\n\t\treturn nil, gcserr.NewHresultError(gcserr.HrVmcomputeSystemNotFound)\n\t}\n\tc.containerCacheMutex.Unlock()\n\n\tf := func() prot.NotificationType {\n\t\tlogrus.Debugf(\"gcscore::WaitContainer waiting on init process waitgroup\")\n\t\tentry.initProcess.writersWg.Wait()\n\t\tlogrus.Debugf(\"gcscore::WaitContainer init process waitgroup count has dropped to zero\")\n\t\t// v1 only supported unexpected exit\n\t\treturn prot.NtUnexpectedExit\n\t}\n\n\treturn f, nil\n}", "func waitForObjectDeletion(info *resource.Info, timeout time.Duration) error {\n\tcopied := *info\n\tinfo = &copied\n\t// TODO: refactor Reaper so that we can pass the \"wait\" option into it, and then check for UID change.\n\treturn wait.PollImmediate(objectDeletionWaitInterval, timeout, func() (bool, error) {\n\t\tswitch err := info.Get(); {\n\t\tcase err == nil:\n\t\t\treturn false, nil\n\t\tcase errors.IsNotFound(err):\n\t\t\treturn true, nil\n\t\tdefault:\n\t\t\treturn false, err\n\t\t}\n\t})\n}", "func (c *ConsensusState) wakeUpJustWaitCompleteOp() {\n\tfor _, op := range c.justWaitCompleteOp {\n\t\top.wait <- true\n\t}\n\t// clean up waiting list\n\tc.justWaitCompleteOp = make([]*JustWaitCycleComplete, 0)\n}", "func (brazi brazilDeprecatedTimeZones) West() string { return \"America/Manaus\" }", "func (h *DefaultHelper) ContainerWait(ctx context.Context, container string, timeout time.Duration) (int, error) {\n\tctx, cancel := context.WithTimeout(ctx, timeout)\n\tdefer cancel()\n\n\tret := make(chan waitReturn)\n\tgo func() {\n\t\ti, err := h.client.ContainerWait(ctx, container)\n\t\tret <- waitReturn{i, err}\n\t}()\n\n\tselect {\n\tcase r := <-ret:\n\t\treturn r.statusCode, r.err\n\tcase <-ctx.Done():\n\t\treturn -1, fmt.Errorf(\"Container %s didn't stop in the specified time : %v\", container, timeout)\n\t}\n}", "func (_m *BandwidthThrottlerSvc) Wait() {\n\t_m.Called()\n}", "func (b *Bucket) OperationTimeout() time.Duration {\n\treturn b.opTimeout\n}", "func pollConfigz(timeout time.Duration, pollInterval time.Duration, nodeName string) *http.Response {\n\t// start local proxy, so we can send graceful deletion over query string, rather than body parameter\n\tginkgo.By(\"Opening proxy to cluster\")\n\tcmd := framework.KubectlCmd(\"proxy\", \"-p\", \"0\")\n\tstdout, stderr, err := framework.StartCmdAndStreamOutput(cmd)\n\tframework.ExpectNoError(err)\n\tdefer stdout.Close()\n\tdefer stderr.Close()\n\tdefer framework.TryKill(cmd)\n\tbuf := make([]byte, 128)\n\tvar n int\n\tn, err = stdout.Read(buf)\n\tframework.ExpectNoError(err)\n\toutput := string(buf[:n])\n\tproxyRegexp := regexp.MustCompile(\"Starting to serve on 127.0.0.1:([0-9]+)\")\n\tmatch := proxyRegexp.FindStringSubmatch(output)\n\tgomega.Expect(len(match)).To(gomega.Equal(2))\n\tport, err := strconv.Atoi(match[1])\n\tframework.ExpectNoError(err)\n\tginkgo.By(\"http requesting node kubelet /configz\")\n\tendpoint := fmt.Sprintf(\"http://127.0.0.1:%d/api/v1/nodes/%s/proxy/configz\", port, nodeName)\n\ttr := &http.Transport{\n\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: true},\n\t}\n\tclient := &http.Client{Transport: tr}\n\treq, err := http.NewRequest(\"GET\", endpoint, nil)\n\tframework.ExpectNoError(err)\n\treq.Header.Add(\"Accept\", \"application/json\")\n\n\tvar resp *http.Response\n\tgomega.Eventually(func() bool {\n\t\tresp, err = client.Do(req)\n\t\tif err != nil {\n\t\t\tframework.Logf(\"Failed to get /configz, retrying. Error: %v\", err)\n\t\t\treturn false\n\t\t}\n\t\tif resp.StatusCode != 200 {\n\t\t\tframework.Logf(\"/configz response status not 200, retrying. Response was: %+v\", resp)\n\t\t\treturn false\n\t\t}\n\n\t\treturn true\n\t}, timeout, pollInterval).Should(gomega.Equal(true))\n\treturn resp\n}", "func (r SortedRunner) Wait() error {\n\treturn nil\n}", "func assertCleanup(ns string, selectors ...string) {\n\tvar e error\n\tverifyCleanupFunc := func() (bool, error) {\n\t\te = nil\n\t\tfor _, selector := range selectors {\n\t\t\tresources := e2ekubectl.RunKubectlOrDie(ns, \"get\", \"rc,svc\", \"-l\", selector, \"--no-headers\")\n\t\t\tif resources != \"\" {\n\t\t\t\te = fmt.Errorf(\"Resources left running after stop:\\n%s\", resources)\n\t\t\t\treturn false, nil\n\t\t\t}\n\t\t\tpods := e2ekubectl.RunKubectlOrDie(ns, \"get\", \"pods\", \"-l\", selector, \"-o\", \"go-template={{ range .items }}{{ if not .metadata.deletionTimestamp }}{{ .metadata.name }}{{ \\\"\\\\n\\\" }}{{ end }}{{ end }}\")\n\t\t\tif pods != \"\" {\n\t\t\t\te = fmt.Errorf(\"Pods left unterminated after stop:\\n%s\", pods)\n\t\t\t\treturn false, nil\n\t\t\t}\n\t\t}\n\t\treturn true, nil\n\t}\n\terr := wait.PollImmediate(500*time.Millisecond, 1*time.Minute, verifyCleanupFunc)\n\tif err != nil {\n\t\tframework.Failf(e.Error())\n\t}\n}", "func WaitUntilComplete(objects []model.K8sMeta, wp WatchProvider, opts WaitOptions) (finalErr error) {\n\topts.setupDefaults()\n\n\tvar watchObjects []model.K8sMeta // the subset of objects we will actually watch\n\tvar trackers []*statusTracker // the list of trackers that we will run\n\n\t// extract objects to wait for\n\tfor _, obj := range objects {\n\t\tfn := statusMapper(obj)\n\t\tif fn != nil {\n\t\t\twatchObjects = append(watchObjects, obj)\n\t\t\ttrackers = append(trackers, &statusTracker{obj: obj, fn: fn, wp: wp, listener: opts.Listener})\n\t\t}\n\t}\n\t// notify listeners\n\topts.Listener.OnInit(watchObjects)\n\tdefer func() {\n\t\topts.Listener.OnEnd(finalErr)\n\t}()\n\n\tif len(trackers) == 0 {\n\t\treturn nil\n\t}\n\tvar wg sync.WaitGroup\n\tvar counter errCounter\n\n\twg.Add(len(trackers))\n\tfor _, so := range trackers {\n\t\tgo func(s *statusTracker) {\n\t\t\tdefer wg.Done()\n\t\t\tcounter.add(s.wait())\n\t\t}(so)\n\t}\n\n\tdone := make(chan struct{})\n\tgo func() {\n\t\twg.Wait()\n\t\tclose(done)\n\t}()\n\n\ttimeout := make(chan struct{})\n\tgo func() {\n\t\ttime.Sleep(opts.Timeout)\n\t\tclose(timeout)\n\t}()\n\n\tselect {\n\tcase <-done:\n\t\treturn counter.toSummaryError()\n\tcase <-timeout:\n\t\treturn fmt.Errorf(\"wait timed out after %v\", opts.Timeout)\n\t}\n}", "func (l PrivateZonesClientCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateZonesClientCreateOrUpdateResponse, error) {\n\trespType := PrivateZonesClientCreateOrUpdateResponse{}\n\tresp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateZone)\n\tif err != nil {\n\t\treturn respType, err\n\t}\n\trespType.RawResponse = resp\n\treturn respType, nil\n}", "func (f *fakeProgressbar) Wait() {}", "func (f *FakeCmdRunner) Wait() error {\n\treturn f.Err\n}", "func waitForApiServerToBeUp(svcMasterIp string, sshClientConfig *ssh.ClientConfig,\n\ttimeout time.Duration) error {\n\tkubeConfigPath := GetAndExpectStringEnvVar(gcKubeConfigPath)\n\twaitErr := wait.PollImmediate(poll, timeout, func() (bool, error) {\n\t\tcmd := fmt.Sprintf(\"kubectl get ns,sc --kubeconfig %s\",\n\t\t\tkubeConfigPath)\n\t\tframework.Logf(\"Invoking command '%v' on host %v\", cmd,\n\t\t\tsvcMasterIp)\n\t\tcmdResult, err := sshExec(sshClientConfig, svcMasterIp,\n\t\t\tcmd)\n\t\tframework.Logf(\"result %v\", cmdResult)\n\t\tif err != nil {\n\t\t\treturn false, nil\n\t\t}\n\t\tif err == nil {\n\t\t\tframework.Logf(\"Apiserver is fully up\")\n\t\t\treturn true, nil\n\t\t}\n\t\treturn false, nil\n\t})\n\treturn waitErr\n}", "func (o StorageNodeStatusGeographyOutput) Zone() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v StorageNodeStatusGeography) *string { return v.Zone }).(pulumi.StringPtrOutput)\n}", "func (w *LimitedConcurrencySingleFlight) Wait() {\n\tw.inflightCalls.Wait()\n}", "func (bq *InMemoryBuildQueue) WaitExecution(in *remoteexecution.WaitExecutionRequest, out remoteexecution.Execution_WaitExecutionServer) error {\n\tbq.enter(bq.clock.Now())\n\tfor {\n\t\to, ok := bq.operationsNameMap[in.Name]\n\t\tif !ok {\n\t\t\tbq.leave()\n\t\t\treturn status.Errorf(codes.NotFound, \"Operation with name %#v not found\", in.Name)\n\t\t}\n\t\tinstanceName := o.task.actionDigest.GetInstanceName()\n\n\t\t// Ensure that the caller is permitted to access this operation.\n\t\t// This must be done without holding any locks, as the authorizer\n\t\t// may block.\n\t\tbq.leave()\n\t\tif err := auth.AuthorizeSingleInstanceName(out.Context(), bq.executeAuthorizer, instanceName); err != nil {\n\t\t\treturn util.StatusWrap(err, \"Authorization\")\n\t\t}\n\n\t\tbq.enter(bq.clock.Now())\n\t\tif bq.operationsNameMap[in.Name] == o {\n\t\t\tdefer bq.leave()\n\t\t\treturn o.waitExecution(bq, out)\n\t\t}\n\t}\n}", "func (conn *basicConn) waitActiveOp() {\n\tconn.activeOpsMut.Lock()\n\tfor conn.activeOps != 0 {\n\t\tconn.activeOpsCond.Wait()\n\t}\n}", "func (f WaiterFunc) Wait(ctx context.Context) error {\n\treturn f(ctx)\n}", "func WaitForFuncOnFakeAppScaling(t *testing.T, client framework.FrameworkClient, namespace, name, fakeAppName string, f func(dd *datadoghqv1alpha1.WatermarkPodAutoscaler, fakeApp *v1.Deployment) (bool, error), retryInterval, timeout time.Duration) error {\n\treturn wait.Poll(retryInterval, timeout, func() (bool, error) {\n\t\tobjKey := dynclient.ObjectKey{\n\t\t\tNamespace: namespace,\n\t\t\tName: name,\n\t\t}\n\t\twatermarkPodAutoscaler := &datadoghqv1alpha1.WatermarkPodAutoscaler{}\n\t\terr := client.Get(context.TODO(), objKey, watermarkPodAutoscaler)\n\t\tif err != nil {\n\t\t\tif apierrors.IsNotFound(err) {\n\t\t\t\tt.Logf(\"Waiting for availability of %s WatermarkPodAutoscaler\\n\", name)\n\t\t\t\treturn false, nil\n\t\t\t}\n\t\t\treturn false, err\n\t\t}\n\n\t\tobjKey = dynclient.ObjectKey{\n\t\t\tNamespace: namespace,\n\t\t\tName: fakeAppName,\n\t\t}\n\t\tfakeApp := &v1.Deployment{}\n\t\terr = client.Get(context.TODO(), objKey, fakeApp)\n\t\tif err != nil {\n\t\t\tif apierrors.IsNotFound(err) {\n\t\t\t\tt.Logf(\"Waiting for availability of %s FakeAppDeployment\\n\", name)\n\t\t\t\treturn false, nil\n\t\t\t}\n\t\t\treturn false, err\n\t\t}\n\n\t\tok, err := f(watermarkPodAutoscaler, fakeApp)\n\t\tt.Logf(\"Waiting for condition function to be true ok for %s WatermarkPodAutoscaler (%t/%v)\\n\", name, ok, err)\n\t\tt.Logf(\"Waiting for condition function to be true ok for %s FakeAppDeployment (%t/%v)\\n\", fakeAppName, ok, err)\n\t\treturn ok, err\n\t})\n}", "func ReserveForWaitServiceIdle(ctx context.Context) (context.Context, context.CancelFunc) {\n\treturn ctxutil.Shorten(ctx, waitServiceIdleTime)\n}", "func (resp *ActionVpsConfigCreateResponse) WatchOperation(timeout float64, updateIn float64, callback OperationProgressCallback) (*ActionActionStatePollResponse, error) {\n\treq := resp.Action.Client.ActionState.Poll.Prepare()\n\treq.SetPathParamInt(\"action_state_id\", resp.Response.Meta.ActionStateId)\n\n\tinput := req.NewInput()\n\tinput.SetTimeout(timeout)\n\tinput.SetUpdateIn(updateIn)\n\n\tpollResp, err := req.Call()\n\n\tif err != nil {\n\t\treturn pollResp, err\n\t} else if pollResp.Output.Finished {\n\t\treturn pollResp, nil\n\t}\n\n\tif callback(pollResp.Output) == StopWatching {\n\t\treturn pollResp, nil\n\t}\n\n\tfor {\n\t\treq = resp.Action.Client.ActionState.Poll.Prepare()\n\t\treq.SetPathParamInt(\"action_state_id\", resp.Response.Meta.ActionStateId)\n\t\treq.SetInput(&ActionActionStatePollInput{\n\t\t\tTimeout: timeout,\n\t\t\tUpdateIn: updateIn,\n\t\t\tStatus: pollResp.Output.Status,\n\t\t\tCurrent: pollResp.Output.Current,\n\t\t\tTotal: pollResp.Output.Total,\n\t\t})\n\t\tpollResp, err = req.Call()\n\n\t\tif err != nil {\n\t\t\treturn pollResp, err\n\t\t} else if pollResp.Output.Finished {\n\t\t\treturn pollResp, nil\n\t\t}\n\n\t\tif callback(pollResp.Output) == StopWatching {\n\t\t\treturn pollResp, nil\n\t\t}\n\t}\n}", "func waitTransProcessed(gid string) {\n\tdtmimp.Logf(\"waiting for gid %s\", gid)\n\tselect {\n\tcase id := <-dtmsvr.TransProcessedTestChan:\n\t\tfor id != gid {\n\t\t\tdtmimp.LogRedf(\"-------id %s not match gid %s\", id, gid)\n\t\t\tid = <-dtmsvr.TransProcessedTestChan\n\t\t}\n\t\tdtmimp.Logf(\"finish for gid %s\", gid)\n\tcase <-time.After(time.Duration(time.Second * 3)):\n\t\tdtmimp.LogFatalf(\"Wait Trans timeout\")\n\t}\n}", "func (a *ApplyImpl) Wait() bool {\n\treturn a.ApplyOptions.Wait\n}", "func (op *ProvisionCloudIdentityOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*channelpb.Customer, error) {\n\topts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)\n\tvar resp channelpb.Customer\n\tif err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resp, nil\n}", "func GxWait(children ...Element) *CompoundElement { return newCE(\"gx:Wait\", children) }", "func (ow *ordered[T, U]) Wait() []U {\n\tow.wg.Wait()\n\treturn ow.results\n}", "func (m *HostNetworkMock) Wait(timeout time.Duration) {\n\tm.MinimockWait(timeout)\n}", "func WaitUntil(c *check.C, f CheckFunc) {\n\tc.Log(\"wait start\")\n\tfor i := 0; i < waitMaxRetry; i++ {\n\t\tif f(c) {\n\t\t\treturn\n\t\t}\n\t\ttime.Sleep(waitRetrySleep)\n\t}\n\tc.Fatal(\"wait timeout\")\n}", "func PodWait(ctx context.Context, t *testing.T, profile string, ns string, selector string, timeout time.Duration) ([]string, error) {\n\tt.Helper()\n\tclient, err := kapi.Client(profile)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// For example: kubernetes.io/minikube-addons=gvisor\n\tlistOpts := meta.ListOptions{LabelSelector: selector}\n\tminUptime := 5 * time.Second\n\tpodStart := time.Time{}\n\tfoundNames := map[string]bool{}\n\tlastMsg := \"\"\n\n\tstart := time.Now()\n\tt.Logf(\"(dbg) %s: waiting %s for pods matching %q in namespace %q ...\", t.Name(), timeout, selector, ns)\n\tf := func(ctx context.Context) (bool, error) {\n\t\tpods, err := client.CoreV1().Pods(ns).List(ctx, listOpts)\n\t\tif err != nil {\n\t\t\tt.Logf(\"%s: WARNING: pod list for %q %q returned: %v\", t.Name(), ns, selector, err)\n\t\t\t// Don't return the error upwards so that this is retried, in case the apiserver is rescheduled\n\t\t\tpodStart = time.Time{}\n\t\t\treturn false, nil\n\t\t}\n\t\tif len(pods.Items) == 0 {\n\t\t\tpodStart = time.Time{}\n\t\t\treturn false, nil\n\t\t}\n\n\t\tfor _, pod := range pods.Items {\n\t\t\tfoundNames[pod.ObjectMeta.Name] = true\n\t\t\tmsg := podStatusMsg(pod)\n\t\t\t// Prevent spamming logs with identical messages\n\t\t\tif msg != lastMsg {\n\t\t\t\tt.Log(msg)\n\t\t\t\tlastMsg = msg\n\t\t\t}\n\t\t\t// Successful termination of a short-lived process, will not be restarted\n\t\t\tif pod.Status.Phase == core.PodSucceeded {\n\t\t\t\treturn true, nil\n\t\t\t}\n\t\t\t// Long-running process state\n\t\t\tif pod.Status.Phase != core.PodRunning {\n\t\t\t\tif !podStart.IsZero() {\n\t\t\t\t\tt.Logf(\"%s: WARNING: %s was running %s ago - may be unstable\", t.Name(), selector, time.Since(podStart))\n\t\t\t\t}\n\t\t\t\tpodStart = time.Time{}\n\t\t\t\treturn false, nil\n\t\t\t}\n\n\t\t\tif podStart.IsZero() {\n\t\t\t\tpodStart = time.Now()\n\t\t\t}\n\n\t\t\tif time.Since(podStart) > minUptime {\n\t\t\t\treturn true, nil\n\t\t\t}\n\t\t}\n\t\treturn false, nil\n\t}\n\n\terr = wait.PollUntilContextTimeout(ctx, 1*time.Second, timeout, true, f)\n\tnames := []string{}\n\tfor n := range foundNames {\n\t\tnames = append(names, n)\n\t}\n\n\tif err == nil {\n\t\tt.Logf(\"(dbg) %s: %s healthy within %s\", t.Name(), selector, time.Since(start))\n\t\treturn names, nil\n\t}\n\n\tt.Logf(\"***** %s: pod %q failed to start within %s: %v ****\", t.Name(), selector, timeout, err)\n\tshowPodLogs(ctx, t, profile, ns, names)\n\treturn names, fmt.Errorf(\"%s: %v\", fmt.Sprintf(\"%s within %s\", selector, timeout), err)\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 (cw *ClientWatcher) WaitUntilNotFound(ctx context.Context, obj runtime.Object, options ...ClientWatcherOption) error {\n\tcfg := &clientWatcherOption{\n\t\ttimeout: defaultTimeout,\n\t}\n\tfor _, f := range options {\n\t\tif err := f(cfg); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif cfg.timeout > time.Duration(0) {\n\t\tvar cancel func()\n\t\tctx, cancel = context.WithTimeout(ctx, cfg.timeout)\n\t\tdefer cancel()\n\t}\n\n\t// things get a bit tricky with not found watches\n\t// clientwatch.UntilWithSync seems useful since it has cache pre-conditions which I can check whether\n\t// the objects existed in initial list operation. But there are few other issues with it:\n\t// * it doesn't call condition function with DELETED event types for some reason (nor does it get it from watch interface to my current debugging knowledge)\n\t// * it doesn't properly update the cache store since the event objects are types to *unstructured.Unstructured instead of GVK schema type\n\tlw, err := cw.objListWatch(obj)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"getting objListWatch: %w\", err)\n\t}\n\tlist, err := lw.List(metav1.ListOptions{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tinitialItems, err := meta.ExtractList(list)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(initialItems) == 0 {\n\t\treturn nil\n\t}\n\n\tmetaObj, err := meta.ListAccessor(list)\n\tif err != nil {\n\t\treturn err\n\t}\n\tcurrResourceVersion := metaObj.GetResourceVersion()\n\t_, err = clientwatch.Until(ctx, currResourceVersion, lw, func(event watch.Event) (b bool, err error) {\n\t\treturn event.Type == watch.Deleted, nil\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"%s (after: %v): %w\", MustLogLine(obj, cw.scheme), cfg.timeout, err)\n\t}\n\treturn nil\n}", "func (t *simpleToken) WaitTimeout(_ time.Duration) bool {\n\treturn true\n}", "func wait(ctx context.Context, c TimedActuator,\n\tresChan chan error, cancel context.CancelFunc) error {\n\tif timeout := c.GetTimeout(); timeout != nil {\n\t\treturn waitWithTimeout(ctx, resChan, *timeout, cancel)\n\t}\n\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn nil\n\t\tcase err := <-resChan:\n\t\t\tif err != nil {\n\t\t\t\tcancel()\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n}", "func (container *container) Wait() error {\r\n\terr := container.system.Wait()\r\n\tif err == nil {\r\n\t\terr = container.system.ExitError()\r\n\t}\r\n\treturn convertSystemError(err, container)\r\n}", "func DeleteAllowTigeraTierAndExpectWait(ctx context.Context, c client.Client, r reconcile.Reconciler, mockStatus *status.MockStatus) {\n\terr := c.Delete(ctx, &v3.Tier{ObjectMeta: metav1.ObjectMeta{Name: \"allow-tigera\"}})\n\tExpect(err).ShouldNot(HaveOccurred())\n\tmockStatus.On(\"SetDegraded\", operator.ResourceNotReady, \"Waiting for allow-tigera tier to be created\", \"tiers.projectcalico.org \\\"allow-tigera\\\" not found\", mock.Anything).Return()\n\n\t_, err = r.Reconcile(ctx, reconcile.Request{})\n\tExpect(err).ShouldNot(HaveOccurred())\n\tmockStatus.AssertExpectations(GinkgoT())\n}", "func (c *ClientManager) WaitInstanceUntilReady(id int, until time.Time) error {\n\tfor {\n\t\tvirtualGuest, found, err := c.GetInstance(id, \"id, lastOperatingSystemReload[id,modifyDate], activeTransaction[id,transactionStatus.name], provisionDate, powerState.keyName\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif !found {\n\t\t\treturn bosherr.WrapErrorf(err, \"SoftLayer virtual guest '%d' does not exist\", id)\n\t\t}\n\n\t\tlastReload := virtualGuest.LastOperatingSystemReload\n\t\tactiveTxn := virtualGuest.ActiveTransaction\n\t\tprovisionDate := virtualGuest.ProvisionDate\n\n\t\t// if lastReload != nil && lastReload.ModifyDate != nil {\n\t\t// \tfmt.Println(\"lastReload: \", (*lastReload.ModifyDate).Format(time.RFC3339))\n\t\t// }\n\t\t// if activeTxn != nil && activeTxn.TransactionStatus != nil && activeTxn.TransactionStatus.Name != nil {\n\t\t// \tfmt.Println(\"activeTxn: \", *activeTxn.TransactionStatus.Name)\n\t\t// }\n\t\t// if provisionDate != nil {\n\t\t// \tfmt.Println(\"provisionDate: \", (*provisionDate).Format(time.RFC3339))\n\t\t// }\n\n\t\treloading := activeTxn != nil && lastReload != nil && *activeTxn.Id == *lastReload.Id\n\t\tif provisionDate != nil && !reloading {\n\t\t\t// fmt.Println(\"power state:\", *virtualGuest.PowerState.KeyName)\n\t\t\tif *virtualGuest.PowerState.KeyName == \"RUNNING\" {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\n\t\tnow := time.Now()\n\t\tif now.After(until) {\n\t\t\treturn bosherr.Errorf(\"Power on virtual guest with id %d Time Out!\", *virtualGuest.Id)\n\t\t}\n\n\t\tmin := math.Min(float64(10.0), float64(until.Sub(now)))\n\t\ttime.Sleep(time.Duration(min) * time.Second)\n\t}\n}", "func (p *Provider) opsCheckpoint(ops uint64) {\n\tp.mutex.Lock()\n\tdefer p.mutex.Unlock()\n\n\tif p.ops.Value()-p.last.ops < ops {\n\t\t// Another goroutine beat us to the checkpoint\n\t\treturn\n\t}\n\n\tp.checkpoint()\n}", "func interpretWaitFlag(cmd cobra.Command) map[string]bool {\n\tif !cmd.Flags().Changed(waitComponents) {\n\t\tklog.Infof(\"Wait components to verify : %+v\", kverify.DefaultComponents)\n\t\treturn kverify.DefaultComponents\n\t}\n\n\twaitFlags, err := cmd.Flags().GetStringSlice(waitComponents)\n\tif err != nil {\n\t\tklog.Warningf(\"Failed to read --wait from flags: %v.\\n Moving on will use the default wait components: %+v\", err, kverify.DefaultComponents)\n\t\treturn kverify.DefaultComponents\n\t}\n\n\tif len(waitFlags) == 1 {\n\t\t// respecting legacy flag before minikube 1.9.0, wait flag was boolean\n\t\tif waitFlags[0] == \"false\" || waitFlags[0] == \"none\" {\n\t\t\tklog.Infof(\"Waiting for no components: %+v\", kverify.NoComponents)\n\t\t\treturn kverify.NoComponents\n\t\t}\n\t\t// respecting legacy flag before minikube 1.9.0, wait flag was boolean\n\t\tif waitFlags[0] == \"true\" || waitFlags[0] == \"all\" {\n\t\t\tklog.Infof(\"Waiting for all components: %+v\", kverify.AllComponents)\n\t\t\treturn kverify.AllComponents\n\t\t}\n\t}\n\n\twaitComponents := kverify.NoComponents\n\tfor _, wc := range waitFlags {\n\t\tseen := false\n\t\tfor _, valid := range kverify.AllComponentsList {\n\t\t\tif wc == valid {\n\t\t\t\twaitComponents[wc] = true\n\t\t\t\tseen = true\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tif !seen {\n\t\t\tklog.Warningf(\"The value %q is invalid for --wait flag. valid options are %q\", wc, strings.Join(kverify.AllComponentsList, \",\"))\n\t\t}\n\t}\n\tklog.Infof(\"Waiting for components: %+v\", waitComponents)\n\treturn waitComponents\n}", "func (austr australiaDeprecatedTimeZones) West() string { return \"Australia/Perth\" }", "func wait(stop chan bool, timeout time.Duration, workers int) {\n\ttime.Sleep(timeout)\n\tclose(stop)\n}", "func (m *RecentIndexStorageMock) Wait(timeout time.Duration) {\n\tm.MinimockWait(timeout)\n}", "func (op *EncryptVolumesOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*netapppb.KmsConfig, error) {\n\topts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)\n\tvar resp netapppb.KmsConfig\n\tif err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resp, nil\n}", "func TestTimeouts(t *testing.T) {\n\tt.Parallel()\n\tvar testCases = []struct {\n\t\tdesc string\n\t\tcallTimeout time.Duration\n\t\tpluginDelay time.Duration\n\t\tkubeAPIServerDelay time.Duration\n\t\twantErr string\n\t}{\n\t\t{\n\t\t\tdesc: \"timeout zero - expect failure when call from kube-apiserver arrives before plugin starts\",\n\t\t\tcallTimeout: 0 * time.Second,\n\t\t\tpluginDelay: 3 * time.Second,\n\t\t\twantErr: \"rpc error: code = DeadlineExceeded desc = context deadline exceeded\",\n\t\t},\n\t\t{\n\t\t\tdesc: \"timeout zero but kms-plugin already up - still failure - zero timeout is an invalid value\",\n\t\t\tcallTimeout: 0 * time.Second,\n\t\t\tpluginDelay: 0 * time.Second,\n\t\t\tkubeAPIServerDelay: 2 * time.Second,\n\t\t\twantErr: \"rpc error: code = DeadlineExceeded desc = context deadline exceeded\",\n\t\t},\n\t\t{\n\t\t\tdesc: \"timeout greater than kms-plugin delay - expect success\",\n\t\t\tcallTimeout: 6 * time.Second,\n\t\t\tpluginDelay: 3 * time.Second,\n\t\t},\n\t\t{\n\t\t\tdesc: \"timeout less than kms-plugin delay - expect failure\",\n\t\t\tcallTimeout: 3 * time.Second,\n\t\t\tpluginDelay: 6 * time.Second,\n\t\t\twantErr: \"rpc error: code = DeadlineExceeded desc = context deadline exceeded\",\n\t\t},\n\t}\n\n\tfor _, tt := range testCases {\n\t\ttt := tt\n\t\tt.Run(tt.desc, func(t *testing.T) {\n\t\t\tt.Parallel()\n\t\t\tvar (\n\t\t\t\tservice Service\n\t\t\t\terr error\n\t\t\t\tdata = []byte(\"test data\")\n\t\t\t\tkubeAPIServerWG sync.WaitGroup\n\t\t\t\tkmsPluginWG sync.WaitGroup\n\t\t\t\ttestCompletedWG sync.WaitGroup\n\t\t\t\tsocketName = newEndpoint()\n\t\t\t)\n\n\t\t\ttestCompletedWG.Add(1)\n\t\t\tdefer testCompletedWG.Done()\n\n\t\t\tctx := testContext(t)\n\n\t\t\tkubeAPIServerWG.Add(1)\n\t\t\tgo func() {\n\t\t\t\t// Simulating late start of kube-apiserver - plugin is up before kube-apiserver, if requested by the testcase.\n\t\t\t\ttime.Sleep(tt.kubeAPIServerDelay)\n\n\t\t\t\tservice, err = NewGRPCService(ctx, socketName.endpoint, tt.callTimeout)\n\t\t\t\tif err != nil {\n\t\t\t\t\tt.Errorf(\"failed to create envelope service, error: %v\", err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tdefer destroyService(service)\n\t\t\t\tkubeAPIServerWG.Done()\n\t\t\t\t// Keeping kube-apiserver up to process requests.\n\t\t\t\ttestCompletedWG.Wait()\n\t\t\t}()\n\n\t\t\tkmsPluginWG.Add(1)\n\t\t\tgo func() {\n\t\t\t\t// Simulating delayed start of kms-plugin, kube-apiserver is up before the plugin, if requested by the testcase.\n\t\t\t\ttime.Sleep(tt.pluginDelay)\n\n\t\t\t\t_ = mock.NewBase64Plugin(t, socketName.path)\n\n\t\t\t\tkmsPluginWG.Done()\n\t\t\t\t// Keeping plugin up to process requests.\n\t\t\t\ttestCompletedWG.Wait()\n\t\t\t}()\n\n\t\t\tkubeAPIServerWG.Wait()\n\t\t\tif t.Failed() {\n\t\t\t\treturn\n\t\t\t}\n\t\t\t_, err = service.Encrypt(data)\n\n\t\t\tif err == nil && tt.wantErr != \"\" {\n\t\t\t\tt.Fatalf(\"got nil, want %s\", tt.wantErr)\n\t\t\t}\n\n\t\t\tif err != nil && tt.wantErr == \"\" {\n\t\t\t\tt.Fatalf(\"got %q, want nil\", err.Error())\n\t\t\t}\n\n\t\t\t// Collecting kms-plugin - allowing plugin to clean-up.\n\t\t\tkmsPluginWG.Wait()\n\t\t})\n\t}\n}", "func waitForPods(cs *framework.ClientSet, expectedTotal, min, max int32) error {\n\terr := wait.PollImmediate(1*time.Second, 5*time.Minute, func() (bool, error) {\n\t\td, err := cs.AppsV1Interface.Deployments(\"openshift-machine-config-operator\").Get(context.TODO(), \"etcd-quorum-guard\", metav1.GetOptions{})\n\t\tif err != nil {\n\t\t\t// By this point the deployment should exist.\n\t\t\tfmt.Printf(\" error waiting for etcd-quorum-guard deployment to exist: %v\\n\", err)\n\t\t\treturn true, err\n\t\t}\n\t\tif d.Status.Replicas < 1 {\n\t\t\tfmt.Println(\"operator deployment has no replicas\")\n\t\t\treturn false, nil\n\t\t}\n\t\tif d.Status.Replicas == expectedTotal &&\n\t\t\td.Status.AvailableReplicas >= min &&\n\t\t\td.Status.AvailableReplicas <= max {\n\t\t\tfmt.Printf(\" Deployment is ready! %d %d\\n\", d.Status.Replicas, d.Status.AvailableReplicas)\n\t\t\treturn true, nil\n\t\t}\n\t\treturn false, nil\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor pod, info := range pods {\n\t\tif info.status == \"Running\" {\n\t\t\tnode := info.node\n\t\t\tif node == \"\" {\n\t\t\t\treturn fmt.Errorf(\"Pod %s not associated with a node\", pod)\n\t\t\t}\n\t\t\tif _, ok := nodes[node]; !ok {\n\t\t\t\treturn fmt.Errorf(\"pod %s running on %s, not a master\", pod, node)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func (tb *Testbed) Wait(timeout time.Duration) error {\n\tdefer tb.cancel()\n\tnow := time.Now()\n\tselect {\n\tcase <-tb.donec:\n\t\treturn nil\n\tcase to := <-time.After(timeout):\n\t\twaited := to.Sub(now)\n\t\treturn errors.New(\"timeout after \" + waited.String())\n\t}\n}", "func (s *DockerSuite) TestWaitNonBlockedExitZero(c *check.C) {\n\tout, _ := dockerCmd(c, \"run\", \"-d\", \"busybox\", \"sh\", \"-c\", \"true\")\n\tcontainerID := strings.TrimSpace(out)\n\n\terr := waitInspect(containerID, \"{{.State.Running}}\", \"false\", 30*time.Second)\n\tc.Assert(err, checker.IsNil) //Container should have stopped by now\n\n\tout, _ = dockerCmd(c, \"wait\", containerID)\n\tc.Assert(strings.TrimSpace(out), checker.Equals, \"0\", check.Commentf(\"failed to set up container, %v\", out))\n\n}", "func zoneBasePath(service *compute.Service, project, zone string) string {\n\treturn fmt.Sprintf(\"%s%s/zones/%s/\", service.BasePath, project, zone)\n}", "func TestWorkerAccountStatus(t *testing.T) {\n\tif testing.Short() {\n\t\tt.SkipNow()\n\t}\n\tt.Parallel()\n\n\twt, err := newWorkerTesterCustomDependency(t.Name(), &dependencies.DependencyDisableCriticalOnMaxBalance{}, modules.ProdDependencies)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer func() {\n\t\terr := wt.Close()\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}()\n\tw := wt.worker\n\n\t// allow the worker some time to fetch a PT and fund its EA\n\tif err := build.Retry(100, 100*time.Millisecond, func() error {\n\t\tif w.staticAccount.managedMinExpectedBalance().IsZero() {\n\t\t\treturn errors.New(\"account not funded yet\")\n\t\t}\n\t\treturn nil\n\t}); err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// fetch the worker's account status and verify its output\n\ta := w.staticAccount\n\tstatus := a.managedStatus()\n\tif !(!status.AvailableBalance.IsZero() &&\n\t\tstatus.AvailableBalance.Equals(w.staticBalanceTarget) &&\n\t\tstatus.RecentErr == \"\" &&\n\t\tstatus.RecentErrTime == time.Time{}) {\n\t\tt.Fatal(\"Unexpected account status\", ToJSON(status))\n\t}\n\n\t// ensure the worker is not on maintenance cooldown\n\tif w.managedOnMaintenanceCooldown() {\n\t\tt.Fatal(\"Unexpected maintenance cooldown\")\n\t}\n\n\t// nullify the account balance to ensure refilling triggers a max balance\n\t// exceeded on the host causing the worker's account to cool down\n\ta.mu.Lock()\n\ta.balance = types.ZeroCurrency\n\ta.mu.Unlock()\n\tw.managedRefillAccount()\n\n\t// fetch the worker's account status and verify the error is being set\n\tstatus = a.managedStatus()\n\tif !(status.AvailableBalance.IsZero() &&\n\t\tstatus.AvailableBalance.IsZero() &&\n\t\tstatus.RecentErr != \"\" &&\n\t\tstatus.RecentErrTime != time.Time{}) {\n\t\tt.Fatal(\"Unexpected account status\", ToJSON(status))\n\t}\n\n\t// ensure the worker's RHP3 system is on cooldown\n\tif !w.managedOnMaintenanceCooldown() {\n\t\tt.Fatal(\"Expected RHP3 to have been put on cooldown\")\n\t}\n}", "func (m *CryptographyServiceMock) Wait(timeout time.Duration) {\n\tm.MinimockWait(timeout)\n}", "func testTimeoutReplacement(ctx context.Context, t *testing.T, w *Wallet) {\n\ttimeChan1 := make(chan time.Time)\n\ttimeChan2 := make(chan time.Time)\n\terr := w.Unlock(ctx, testPrivPass, timeChan1)\n\tif err != nil {\n\t\tt.Fatal(\"failed to unlock wallet\")\n\t}\n\terr = w.Unlock(ctx, testPrivPass, timeChan2)\n\tif err != nil {\n\t\tt.Fatal(\"failed to unlock wallet\")\n\t}\n\ttimeChan2 <- time.Time{}\n\ttime.Sleep(100 * time.Millisecond) // Allow time for lock in background\n\tif !w.Locked() {\n\t\tt.Fatal(\"wallet did not lock using replacement timeout\")\n\t}\n\tselect {\n\tcase timeChan1 <- time.Time{}:\n\tdefault:\n\t\tt.Fatal(\"previous timeout was not read in background\")\n\t}\n}", "func (d *dockerWaiter) wait(ctx context.Context, containerID string, stopFn func()) error {\n\tstatusCh, errCh := d.client.ContainerWait(ctx, containerID, container.WaitConditionNotRunning)\n\n\tif stopFn != nil {\n\t\tstopFn()\n\t}\n\n\tfor {\n\t\tselect {\n\t\tcase <-time.After(time.Second):\n\t\t\tif stopFn != nil {\n\t\t\t\tstopFn()\n\t\t\t}\n\n\t\tcase err := <-errCh:\n\t\t\treturn err\n\n\t\tcase status := <-statusCh:\n\t\t\tif status.StatusCode != 0 {\n\t\t\t\treturn &common.BuildError{\n\t\t\t\t\tInner: fmt.Errorf(\"exit code %d\", status.StatusCode),\n\t\t\t\t\tExitCode: int(status.StatusCode),\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn nil\n\t\t}\n\t}\n}", "func pollConfigz(ctx context.Context, timeout time.Duration, pollInterval time.Duration, nodeName, namespace string, useProxy bool, standaloneMode bool) []byte {\n\tendpoint := \"\"\n\tif useProxy {\n\t\t// start local proxy, so we can send graceful deletion over query string, rather than body parameter\n\t\tframework.Logf(\"Opening proxy to cluster\")\n\t\ttk := e2ekubectl.NewTestKubeconfig(framework.TestContext.CertDir, framework.TestContext.Host, framework.TestContext.KubeConfig, framework.TestContext.KubeContext, framework.TestContext.KubectlPath, namespace)\n\t\tcmd := tk.KubectlCmd(\"proxy\", \"-p\", \"0\")\n\t\tstdout, stderr, err := framework.StartCmdAndStreamOutput(cmd)\n\t\tframework.ExpectNoError(err)\n\t\tdefer stdout.Close()\n\t\tdefer stderr.Close()\n\t\tdefer framework.TryKill(cmd)\n\n\t\tbuf := make([]byte, 128)\n\t\tvar n int\n\t\tn, err = stdout.Read(buf)\n\t\tframework.ExpectNoError(err)\n\t\toutput := string(buf[:n])\n\t\tproxyRegexp := regexp.MustCompile(\"Starting to serve on 127.0.0.1:([0-9]+)\")\n\t\tmatch := proxyRegexp.FindStringSubmatch(output)\n\t\tframework.ExpectEqual(len(match), 2)\n\t\tport, err := strconv.Atoi(match[1])\n\t\tframework.ExpectNoError(err)\n\t\tframework.Logf(\"http requesting node kubelet /configz\")\n\t\tendpoint = fmt.Sprintf(\"http://127.0.0.1:%d/api/v1/nodes/%s/proxy/configz\", port, nodeName)\n\t} else if !standaloneMode {\n\t\tendpoint = fmt.Sprintf(\"%s/api/v1/nodes/%s/proxy/configz\", framework.TestContext.Host, framework.TestContext.NodeName)\n\t} else {\n\t\tendpoint = fmt.Sprintf(\"https://127.0.0.1:%d/configz\", ports.KubeletPort)\n\t}\n\ttr := &http.Transport{\n\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: true},\n\t}\n\tclient := &http.Client{Transport: tr}\n\treq, err := http.NewRequest(\"GET\", endpoint, nil)\n\tframework.ExpectNoError(err)\n\tif !useProxy {\n\t\treq.Header.Set(\"Authorization\", fmt.Sprintf(\"Bearer %s\", framework.TestContext.BearerToken))\n\t}\n\treq.Header.Add(\"Accept\", \"application/json\")\n\n\tvar respBody []byte\n\terr = wait.PollImmediateWithContext(ctx, pollInterval, timeout, func(ctx context.Context) (bool, error) {\n\t\tresp, err := client.Do(req)\n\t\tif err != nil {\n\t\t\tframework.Logf(\"Failed to get /configz, retrying. Error: %v\", err)\n\t\t\treturn false, nil\n\t\t}\n\t\tdefer resp.Body.Close()\n\n\t\tif resp.StatusCode != 200 {\n\t\t\tframework.Logf(\"/configz response status not 200, retrying. Response was: %+v\", resp)\n\t\t\treturn false, nil\n\t\t}\n\n\t\trespBody, err = io.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\tframework.Logf(\"failed to read body from /configz response, retrying. Error: %v\", err)\n\t\t\treturn false, nil\n\t\t}\n\n\t\treturn true, nil\n\t})\n\tframework.ExpectNoError(err, \"Failed to get successful response from /configz\")\n\n\treturn respBody\n}", "func (m *ActiveNodeMock) Wait(timeout time.Duration) {\n\tm.MinimockWait(timeout)\n}", "func (europ europeTimeZones) Zagreb() string {return \"Europe/Zagreb\" }" ]
[ "0.61849713", "0.5962959", "0.5956221", "0.5825834", "0.5183424", "0.47526863", "0.47372845", "0.46635365", "0.46484426", "0.4646019", "0.4643461", "0.4638454", "0.46319026", "0.45912045", "0.45716035", "0.45711818", "0.4547406", "0.45373157", "0.45099208", "0.44967362", "0.4446453", "0.44182634", "0.4404961", "0.43700182", "0.4369177", "0.4342772", "0.43247303", "0.4315039", "0.43091285", "0.43024936", "0.42920455", "0.4287334", "0.42842433", "0.42775264", "0.4274538", "0.42701602", "0.42685756", "0.42674643", "0.4260697", "0.42519093", "0.4249696", "0.4246373", "0.42318818", "0.42276213", "0.42256913", "0.42209956", "0.4219406", "0.42152044", "0.42027426", "0.41947043", "0.41932338", "0.41905475", "0.41646016", "0.41630232", "0.41547394", "0.41495258", "0.41459095", "0.41450858", "0.41383928", "0.41333872", "0.41318393", "0.41297975", "0.41277045", "0.41244206", "0.4119508", "0.4112096", "0.4107506", "0.4104094", "0.41001984", "0.4097057", "0.40927202", "0.40909734", "0.40866253", "0.40790442", "0.40747103", "0.4072919", "0.40728065", "0.40571183", "0.40532938", "0.4051993", "0.40508193", "0.40481234", "0.40417984", "0.4038756", "0.4037743", "0.40376404", "0.4032911", "0.4031932", "0.40308478", "0.4027079", "0.4022764", "0.40211087", "0.4020449", "0.40194145", "0.4016513", "0.40145844", "0.40067255", "0.4006011", "0.40039304", "0.40005523" ]
0.78013915
0
regionOperationsWait uses the override method regionOperationsWaitFn or the real implementation.
func (c *TestClient) regionOperationsWait(project, region, name string) error { if c.regionOperationsWaitFn != nil { return c.regionOperationsWaitFn(project, region, name) } return c.client.regionOperationsWait(project, region, name) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *TestClient) globalOperationsWait(project, name string) error {\n\tif c.globalOperationsWaitFn != nil {\n\t\treturn c.globalOperationsWaitFn(project, name)\n\t}\n\treturn c.client.globalOperationsWait(project, name)\n}", "func OperationWait(w tpgresource.Waiter, activity string, timeout time.Duration, pollInterval time.Duration) error {\n\treturn tpgresource.OperationWait(w, activity, timeout, pollInterval)\n}", "func (c *TestClient) zoneOperationsWait(project, zone, name string) error {\n\tif c.zoneOperationsWaitFn != nil {\n\t\treturn c.zoneOperationsWaitFn(project, zone, name)\n\t}\n\treturn c.client.zoneOperationsWait(project, zone, name)\n}", "func (c *Compute) wait(operation *compute.Operation) error {\n\tfor {\n\t\top, err := c.ZoneOperations.Get(c.Project, c.Zone, operation.Name).Do()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to get operation: %v\", operation.Name, err)\n\t\t}\n\t\tlog.Printf(\"operation %q status: %s\", operation.Name, op.Status)\n\t\tif op.Status == \"DONE\" {\n\t\t\tif op.Error != nil {\n\t\t\t\treturn fmt.Errorf(\"operation error: %v\", *op.Error.Errors[0])\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\ttime.Sleep(1 * time.Second)\n\t}\n\treturn nil\n}", "func wait() {\n\twaitImpl()\n}", "func (c *Compute) waitGlobal(operation *compute.Operation) error {\n\tfor {\n\t\top, err := c.GlobalOperations.Get(c.Project, operation.Name).Do()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to get operation: %v\", operation.Name, err)\n\t\t}\n\t\tlog.Printf(\"operation %q status: %s\", operation.Name, op.Status)\n\t\tif op.Status == \"DONE\" {\n\t\t\tif op.Error != nil {\n\t\t\t\treturn fmt.Errorf(\"operation error: %v\", *op.Error.Errors[0])\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\ttime.Sleep(1 * time.Second)\n\t}\n\treturn nil\n}", "func (cl *Client) waitForOperation(ctx context.Context, operation *compute.Operation) error {\n\tfor { // ZoneOperations should fail once the ctx.Deadline() is passed\n\t\tres, err := cl.computeService.ZoneOperations().Get(cl.projectID, cl.attrs[AttrZone].Value, operation.Name).Context(ctx).Do()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif res.Status == \"DONE\" {\n\t\t\tif res.Error != nil {\n\t\t\t\treturn fmt.Errorf(\"operation failure: code: %d, message: %s\", res.HttpErrorStatusCode, res.HttpErrorMessage)\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t\ttime.Sleep(time.Second)\n\t}\n}", "func (k *kubectlContext) Wait(args ...string) error {\n\tout, err := k.do(append([]string{\"wait\"}, args...)...)\n\tk.t.Log(string(out))\n\treturn err\n}", "func (gc *GCloudContainer) waitForOperation(operation *container.Operation) (err error) {\n\tstart := time.Now()\n\ttimeout := operationWaitTimeoutSecond * time.Second\n\n\tfor {\n\t\tapiName := fmt.Sprintf(\"projects/%v/locations/%v/operations/%v\", gc.Client.Project, gc.Client.Location, operation.Name)\n\n\t\tlog.Debug().Msgf(\"Waiting for operation %v\", apiName)\n\n\t\tif op, err := gc.Service.Projects.Locations.Operations.Get(apiName).Do(); err == nil {\n\t\t\tlog.Debug().Msgf(\"Operation %v status: %s\", apiName, op.Status)\n\n\t\t\tif op.Status == \"DONE\" {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t} else {\n\t\t\tlog.Error().Err(err).Msgf(\"Error while getting operation %v on %s: %v\", apiName, operation.TargetLink, err)\n\t\t}\n\n\t\tif time.Since(start) > timeout {\n\t\t\terr = fmt.Errorf(\"Timeout while waiting for operation %v on %s to complete\", apiName, operation.TargetLink)\n\t\t\treturn\n\t\t}\n\n\t\tsleepTime := ApplyJitter(operationPollIntervalSecond)\n\t\tlog.Info().Msgf(\"Sleeping for %v seconds...\", sleepTime)\n\t\ttime.Sleep(time.Duration(sleepTime) * time.Second)\n\t}\n\n\treturn\n}", "func (c *tensorboardRESTClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {\n\tbaseUrl, err := url.Parse(c.endpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbaseUrl.Path += fmt.Sprintf(\"/ui/%v:wait\", req.GetName())\n\n\tparams := url.Values{}\n\tif req.GetTimeout() != nil {\n\t\ttimeout, err := protojson.Marshal(req.GetTimeout())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tparams.Add(\"timeout\", string(timeout[1:len(timeout)-1]))\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\topts = append((*c.CallOptions).WaitOperation[0:len((*c.CallOptions).WaitOperation):len((*c.CallOptions).WaitOperation)], opts...)\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(\"POST\", 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\treturn resp, nil\n}", "func (v DiffChangeView) WaitOp() ctlcap.ClusterChangeWaitOp { return ctlcap.ClusterChangeWaitOpNoop }", "func (c *jobsRESTClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {\n\tm := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}\n\tjsonReq, err := m.Marshal(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbaseUrl, err := url.Parse(c.endpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbaseUrl.Path += fmt.Sprintf(\"/v2/%v:wait\", req.GetName())\n\n\tparams := url.Values{}\n\tparams.Add(\"$alt\", \"json;enum-encoding=int\")\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\topts = append((*c.CallOptions).WaitOperation[0:len((*c.CallOptions).WaitOperation):len((*c.CallOptions).WaitOperation)], opts...)\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(\"POST\", baseUrl.String(), bytes.NewReader(jsonReq))\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\treturn resp, nil\n}", "func (m *MockSerializer) Wait() interface{} {\n\targs := m.MethodCalled(\"Wait\")\n\n\treturn args.Get(0)\n}", "func waitReady(project, name, region string) error {\n\twait := time.Minute * 4\n\tdeadline := time.Now().Add(wait)\n\tfor time.Now().Before(deadline) {\n\t\tsvc, err := getService(project, name, region)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to query Service for readiness: %w\", err)\n\t\t}\n\n\t\tfor _, cond := range svc.Status.Conditions {\n\t\t\tif cond.Type == \"Ready\" {\n\t\t\t\tif cond.Status == \"True\" {\n\t\t\t\t\treturn nil\n\t\t\t\t} else if cond.Status == \"False\" {\n\t\t\t\t\treturn fmt.Errorf(\"reason=%s message=%s\", cond.Reason, cond.Message)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\ttime.Sleep(time.Second * 2)\n\t}\n\treturn fmt.Errorf(\"the service did not become ready in %s, check Cloud Console for logs to see why it failed\", wait)\n}", "func NewCfnWaitCondition_Override(c CfnWaitCondition, scope constructs.Construct, id *string, props *CfnWaitConditionProps) {\n\t_init_.Initialize()\n\n\t_jsii_.Create(\n\t\t\"aws-cdk-lib.aws_cloudformation.CfnWaitCondition\",\n\t\t[]interface{}{scope, id, props},\n\t\tc,\n\t)\n}", "func (o *Operation) Wait(timeout time.Duration) (bool, error) {\n\t// check current state\n\tif o.status.IsFinal() {\n\t\treturn true, nil\n\t}\n\n\t// wait indefinitely\n\tif timeout == -1 {\n\t\tselect {\n\t\tcase <-o.chanDone:\n\t\t\treturn true, nil\n\t\t}\n\t}\n\n\t// Wait until timeout\n\tif timeout > 0 {\n\t\ttimer := time.NewTimer(timeout)\n\t\tselect {\n\t\tcase <-o.chanDone:\n\t\t\treturn true, nil\n\t\tcase <-timer.C:\n\t\t\treturn false, errors.Errorf(\"timeout\")\n\t\t}\n\t}\n\treturn false, nil\n}", "func KubeWaitOp(apiserver *cke.Node) cke.Operator {\n\treturn &kubeWaitOp{apiserver: apiserver}\n}", "func (t *ElapsedTimeout) Wait(context.Context) error { return nil }", "func (_m *BandwidthThrottlerSvc) Wait() {\n\t_m.Called()\n}", "func (f WaiterFunc) Wait(ctx context.Context) error {\n\treturn f(ctx)\n}", "func (t *SyncTransport) Wait() {}", "func (op *delayedRouteOperation) wait() error {\n\treturn <-op.result\n}", "func (p *googleCloudProvider) waitForResourceOpCompletion(\n\turn resource.URN,\n\toperation resources.CloudAPIOperation,\n\tresp map[string]interface{},\n\tinputState resource.PropertyMap,\n) (map[string]interface{}, error) {\n\tretryPolicy := backoff.Backoff{\n\t\tMin: 1 * time.Second,\n\t\tMax: 15 * time.Second,\n\t\tFactor: 1.5,\n\t\tJitter: true,\n\t}\n\tvar pollingStrategy = resources.DefaultPoll\n\tif operation.Polling != nil {\n\t\tpollingStrategy = operation.Polling.Strategy\n\t}\n\tfor {\n\t\tvar pollURI string\n\n\t\tlogging.V(9).Infof(\"waiting for completion: polling strategy: %q: %+v\", pollingStrategy, resp)\n\t\tdetails, ok := resp[\"detail\"]\n\t\tif !ok {\n\t\t\tdetails, ok = resp[\"details\"]\n\t\t}\n\t\tif ok {\n\t\t\t_ = p.host.LogStatus(context.Background(), diag.Info, urn, fmt.Sprintf(\"%v\", details))\n\t\t}\n\n\t\t// if the resource has a custom polling strategy, use that.\n\t\tswitch pollingStrategy {\n\t\tcase resources.KNativeStatusPoll:\n\t\t\tlogging.V(9).Info(\"Getting self link URL\")\n\t\t\tsl, err := getKNativeSelfLinkURL(resp)\n\t\t\tif err != nil {\n\t\t\t\treturn resp, err\n\t\t\t}\n\t\t\tlogging.V(9).Infof(\"selfLink: %q from response: %+v\", sl, resp)\n\t\t\tpollURI = sl\n\t\t\tcompleted, err := knativeStatusCheck(resp)\n\t\t\tif err != nil {\n\t\t\t\treturn resp, err\n\t\t\t}\n\t\t\tif completed {\n\t\t\t\treturn resp, nil\n\t\t\t}\n\t\tdefault:\n\t\t\t// Otherwise there are three styles of operations: one returns a 'done' boolean flag,\n\t\t\t// another one returns status='DONE' and the last one adds the above fields nested under\n\t\t\t// a nested field (rare).\n\t\t\top := resp\n\t\t\tif operation.Operations != nil && operation.Operations.EmbeddedOperationField != \"\" {\n\t\t\t\tif nestedOp, ok := resp[operation.Operations.EmbeddedOperationField].(map[string]interface{}); ok {\n\t\t\t\t\top = nestedOp\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tdone, hasDone := op[\"done\"].(bool)\n\t\t\tstatus, hasStatus := op[\"status\"].(string)\n\t\t\tif completed := (hasDone && done) || (hasStatus && strings.ToLower(status) == \"done\"); completed {\n\t\t\t\t// Extract an error message from the response, if any.\n\t\t\t\tvar err error\n\t\t\t\tif failure, has := resp[\"error\"]; has {\n\t\t\t\t\terr = errors.Errorf(\"operation errored with %+v\", failure)\n\t\t\t\t} else if statusMessage, has := resp[\"statusMessage\"]; has {\n\t\t\t\t\terr = errors.Errorf(\"operation failed with %q\", statusMessage)\n\t\t\t\t}\n\t\t\t\t// Extract the resource response, if any.\n\t\t\t\t// A partial error could happen, so both response and error could be available.\n\t\t\t\tif response, has := op[\"response\"].(map[string]interface{}); has {\n\t\t\t\t\treturn response, err\n\t\t\t\t}\n\n\t\t\t\t// We don't need the most up-to-date state on deletions so use the response.\n\t\t\t\tif operationType, has := op[\"operationType\"].(string); has &&\n\t\t\t\t\tstrings.Contains(strings.ToLower(operationType), \"delete\") {\n\t\t\t\t\treturn resp, err\n\t\t\t\t}\n\n\t\t\t\t// Try to retrieve the targetLink first. If not try to retrieve using the selfLink.\n\t\t\t\ttargetLink, hasTargetLink := getTargetLink(op)\n\t\t\t\tif !hasTargetLink {\n\t\t\t\t\ttargetLink, hasTargetLink = getSelfLink(op)\n\t\t\t\t}\n\n\t\t\t\tcontinuePollingForRestingState := false\n\t\t\t\tif hasTargetLink {\n\t\t\t\t\t// Try reading resource state.\n\t\t\t\t\tstate, getErr := p.client.RequestWithTimeout(\"GET\", targetLink, \"\", nil, 0)\n\t\t\t\t\tif getErr != nil {\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t// Return the original creation error if resource read failed.\n\t\t\t\t\t\t\treturn resp, err\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn resp, getErr\n\t\t\t\t\t}\n\t\t\t\t\tif pollingStrategy == resources.NodepoolAwaitRestingStatePoll {\n\t\t\t\t\t\tnpStatus, hasStatus := state[\"status\"].(string)\n\t\t\t\t\t\tif hasStatus && npStatus == \"RUNNING\" || npStatus == \"RUNNING_WITH_ERROR\" || npStatus == \"ERROR\" {\n\t\t\t\t\t\t\treturn state, err\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontinuePollingForRestingState = true\n\t\t\t\t\t} else if pollingStrategy == resources.ClusterAwaitRestingStatePoll {\n\t\t\t\t\t\tcStatus, hasStatus := state[\"status\"].(string)\n\t\t\t\t\t\tif hasStatus && cStatus == \"RUNNING\" || cStatus == \"DEGRADED\" || cStatus == \"ERROR\" {\n\t\t\t\t\t\t\treturn state, err\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontinuePollingForRestingState = true\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// A partial error could happen, so both response and error could be available.\n\t\t\t\t\t\treturn state, err\n\t\t\t\t\t}\n\t\t\t\t\tpollURI = targetLink\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn resp, err\n\t\t\t\t}\n\t\t\t\t// At this point, we assume either a complete failure or a clean response.\n\t\t\t\tif !continuePollingForRestingState {\n\t\t\t\t\treturn resp, nil\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tselfLink, has := getSelfLink(op)\n\t\t\tif has && hasStatus {\n\t\t\t\tpollURI = selfLink\n\t\t\t} else if operation.Operations != nil && operation.Operations.Template != \"\" {\n\t\t\t\tvar existing map[string]interface{}\n\t\t\t\tif inputState != nil {\n\t\t\t\t\texisting = inputState.Mappable()\n\t\t\t\t}\n\t\t\t\tvar err error\n\t\t\t\tpollURI, err = operation.Operations.URI(resp, existing)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn resp, err\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tlogging.V(9).Infof(\"waiting for completion: operation: %#v resp: %#v, pollURI: %q\", operation, resp,\n\t\t\t\t\tpollURI)\n\t\t\t}\n\t\t}\n\n\t\tif pollURI == \"\" {\n\t\t\t// No poll URI - assume the existing response is sufficient.\n\t\t\treturn resp, nil\n\t\t}\n\n\t\ttime.Sleep(retryPolicy.Duration())\n\n\t\tlogging.V(9).Infof(\"Polling URL: %q\", pollURI)\n\t\tpoll, err := p.client.RequestWithTimeout(\"GET\", pollURI, \"\", nil, 0)\n\t\tif err != nil {\n\t\t\treturn resp, errors.Wrapf(err, \"polling operation status\")\n\t\t}\n\n\t\tresp = poll\n\t}\n}", "func (o *OperationLimiter) Wait(r *request.Request) error {\n\treturn o.getLimiter().Wait(r.Context())\n}", "func (op *EncryptVolumesOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*netapppb.KmsConfig, error) {\n\topts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)\n\tvar resp netapppb.KmsConfig\n\tif err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resp, nil\n}", "func (p *googleCloudProvider) waitForResourceOpCompletion(baseUrl string, resp map[string]interface{}) (map[string]interface{}, error) {\n\tretryPolicy := backoff.Backoff{\n\t\tMin: 1 * time.Second,\n\t\tMax: 15 * time.Second,\n\t\tFactor: 1.5,\n\t\tJitter: true,\n\t}\n\tfor {\n\t\tlogging.V(9).Infof(\"waiting for completion: %+v\", resp)\n\n\t\t// There are two styles of operations: one returns a 'done' boolean flag, another one returns status='DONE'.\n\t\tdone, hasDone := resp[\"done\"].(bool)\n\t\tstatus, hasStatus := resp[\"status\"].(string)\n\t\tif completed := (hasDone && done) || (hasStatus && status == \"DONE\"); completed {\n\t\t\t// Extract an error message from the response, if any.\n\t\t\tvar err error\n\t\t\tif failure, has := resp[\"error\"]; has {\n\t\t\t\terr = errors.Errorf(\"operation errored with %+v\", failure)\n\t\t\t} else if statusMessage, has := resp[\"statusMessage\"]; has {\n\t\t\t\terr = errors.Errorf(\"operation failed with %q\", statusMessage)\n\t\t\t}\n\t\t\t// Extract the resource response, if any.\n\t\t\t// A partial error could happen, so both response and error could be available.\n\t\t\tif response, has := resp[\"response\"].(map[string]interface{}); has {\n\t\t\t\treturn response, err\n\t\t\t}\n\t\t\tif operationType, has := resp[\"operationType\"].(string); has && strings.Contains(strings.ToLower(operationType), \"delete\") {\n\t\t\t\treturn resp, err\n\t\t\t}\n\t\t\t// Check if there's a target link.\n\t\t\tif targetLink, has := resp[\"targetLink\"].(string); has {\n\t\t\t\t// Try reading resource state.\n\t\t\t\tstate, getErr := p.client.RequestWithTimeout(\"GET\", targetLink, nil, 0)\n\t\t\t\tif getErr != nil {\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t// Return the original creation error if resource read failed.\n\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t}\n\t\t\t\t\treturn nil, getErr\n\t\t\t\t}\n\t\t\t\t// A partial error could happen, so both response and error could be available.\n\t\t\t\treturn state, err\n\t\t\t}\n\t\t\t// At this point, we assume either a complete failure or a clean response.\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn resp, nil\n\t\t}\n\n\t\tvar pollUri string\n\t\tif selfLink, has := resp[\"selfLink\"].(string); has && hasStatus {\n\t\t\tpollUri = selfLink\n\t\t} else {\n\t\t\tif name, has := resp[\"name\"].(string); has && strings.HasPrefix(name, \"operations/\") {\n\t\t\t\tpollUri = fmt.Sprintf(\"%s/v1/%s\", baseUrl, name)\n\t\t\t}\n\t\t}\n\n\t\tif pollUri == \"\" {\n\t\t\treturn resp, nil\n\t\t}\n\n\t\ttime.Sleep(retryPolicy.Duration())\n\n\t\top, err := p.client.RequestWithTimeout(\"GET\", pollUri, nil, 0)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"polling operation status\")\n\t\t}\n\n\t\tresp = op\n\t}\n}", "func (op *DeleteSnapshotOperation) Wait(ctx context.Context, opts ...gax.CallOption) error {\n\topts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)\n\treturn op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...)\n}", "func (op *ProvisionCloudIdentityOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*channelpb.Customer, error) {\n\topts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)\n\tvar resp channelpb.Customer\n\tif err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resp, nil\n}", "func (m *RecentIndexStorageMock) Wait(timeout time.Duration) {\n\tm.MinimockWait(timeout)\n}", "func (resp *ActionVpsConfigCreateResponse) WaitForOperation(timeout float64) (*ActionActionStatePollResponse, error) {\n\treq := resp.Action.Client.ActionState.Poll.Prepare()\n\treq.SetPathParamInt(\"action_state_id\", resp.Response.Meta.ActionStateId)\n\n\tinput := req.NewInput()\n\tinput.SetTimeout(timeout)\n\n\treturn req.Call()\n}", "func (ret *OpRet) Wait() error {\n\tif ret.delayed == nil {\n\t\treturn nil\n\t}\n\n\t<-ret.delayed\n\treturn ret.error\n}", "func (b *basebackup) Wait() {\n\tb.wg.Wait()\n}", "func (f *fakeProgressbar) Wait() {}", "func (m *DeviceOperationCompletionWatcher) Wait(ctx context.Context) (DeviceOperationCompleted, error) {\n\tvar ret DeviceOperationCompleted\n\tselect {\n\tcase s := <-m.Signals:\n\t\tif err := dbus.Store(s.Body, &ret.Status, &ret.Device); err != nil {\n\t\t\treturn ret, errors.Wrap(err, \"failed to store DeviceOperationCompleted data\")\n\t\t}\n\t\treturn ret, nil\n\tcase <-ctx.Done():\n\t\treturn ret, errors.Wrap(ctx.Err(), \"didn't get DeviceOperationCompleted signal\")\n\t}\n}", "func (op *DeleteVolumeOperation) Wait(ctx context.Context, opts ...gax.CallOption) error {\n\topts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)\n\treturn op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...)\n}", "func (op *DeleteReplicationOperation) Wait(ctx context.Context, opts ...gax.CallOption) error {\n\topts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)\n\treturn op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...)\n}", "func lroWait(ctx context.Context, client longrunning.OperationsClient, name string, opts ...grpc.CallOption) (*longrunning.Operation, error) {\n\t// Exponential backoff is used for retryable gRPC errors. In future, we\n\t// may want to make these parameters configurable.\n\tconst initialBackoffMillis = 1000\n\tconst maxAttempts = 4\n\tattempt := 0\n\n\t// WaitOperation() can return before the provided timeout even though the\n\t// underlying operation is in progress. It may also fail for retryable\n\t// reasons. Thus, we must loop until timeout ourselves.\n\tfor {\n\t\t// WaitOperation respects timeout in the RPC Context as well as through\n\t\t// an explicit field in WaitOperationRequest. We depend on Context\n\t\t// cancellation for timeouts (like everywhere else in this codebase).\n\t\t// On timeout, WaitOperation() will return an appropriate error\n\t\t// response.\n\t\top, err := client.WaitOperation(ctx, &longrunning.WaitOperationRequest{\n\t\t\tName: name,\n\t\t}, opts...)\n\t\tswitch status.Code(err) {\n\t\tcase codes.OK:\n\t\t\tattempt = 0\n\t\tcase codes.Unavailable, codes.ResourceExhausted:\n\t\t\t// Retryable error; retry with exponential backoff.\n\t\t\tif attempt >= maxAttempts {\n\t\t\t\treturn op, err\n\t\t\t}\n\t\t\tdelay := rand.Int63n(initialBackoffMillis * (1 << attempt))\n\t\t\ttesting.Sleep(ctx, time.Duration(delay)*time.Millisecond) // The sleep method was changed.\n\t\t\tattempt++\n\t\tdefault:\n\t\t\t// Non-retryable error\n\t\t\treturn op, err\n\t\t}\n\t\tif op.Done {\n\t\t\treturn op, nil\n\t\t}\n\t}\n}", "func (op *TransferEntitlementsToGoogleOperation) Wait(ctx context.Context, opts ...gax.CallOption) error {\n\topts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)\n\treturn op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...)\n}", "func (a API) GetBlockTemplateWait(cmd *btcjson.GetBlockTemplateCmd) (out *string, e error) {\n\tRPCHandlers[\"getblocktemplate\"].Call <-API{a.Ch, cmd, nil}\n\tselect {\n\tcase <-time.After(time.Second*5):\n\t\tbreak\n\tcase o := <-a.Ch.(chan GetBlockTemplateRes):\n\t\tout, e = o.Res, o.Err\n\t}\n\treturn\n}", "func (op *RevertVolumeOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*netapppb.Volume, error) {\n\topts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)\n\tvar resp netapppb.Volume\n\tif err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resp, nil\n}", "func (_m *MockWaiter) Wait() {\n\t_m.Called()\n}", "func (op *CreateVolumeOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*netapppb.Volume, error) {\n\topts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)\n\tvar resp netapppb.Volume\n\tif err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resp, nil\n}", "func waitForValiPvcToBeBound(ctx context.Context, k8sClient client.Client, namespace string, valiPvc *corev1.PersistentVolumeClaim, log logr.Logger) error {\n\t// ensure that the context has a deadline\n\tctx, cancel := context.WithDeadline(ctx, time.Now().Add(1*time.Minute))\n\tdefer cancel()\n\tdeadline, _ := ctx.Deadline()\n\tif err := wait.PollUntilWithContext(ctx, 1*time.Second, func(context.Context) (done bool, err error) {\n\t\tif err := k8sClient.Get(ctx, client.ObjectKeyFromObject(valiPvc), valiPvc); err != nil {\n\t\t\tif apierrors.IsNotFound(err) {\n\t\t\t\tlog.Info(\"Loki2vali: Vali PVC is not yet created\", \"lokiNamespace\", namespace, \"lokiError\", err)\n\t\t\t\treturn false, nil\n\t\t\t}\n\t\t\tlog.Info(\"Loki2vali: waitForValiPvcToBeBound failed\", \"lokiNamespace\", namespace, \"lokiError\", err)\n\t\t\treturn true, err\n\t\t}\n\t\tif valiPvc.Status.Phase == corev1.ClaimBound {\n\t\t\tlog.Info(\"Loki2vali: PVC is bound\", \"lokiNamespace\", namespace)\n\t\t\treturn true, nil\n\t\t} else if valiPvc.Status.Phase == corev1.ClaimLost {\n\t\t\terr := fmt.Errorf(\"Loki2vali: %v: Vali PVC is in Lost state, triggering recovery\", namespace)\n\t\t\tlog.Info(\"Loki2vali:\", \"lokiError\", err)\n\t\t\treturn true, err\n\t\t}\n\t\tlog.Info(\"Loki2vali: Wait for the Vali PVC to be bound\", \"lokiNamespace\", namespace, \"timeLeft\", time.Until(deadline))\n\t\treturn false, nil\n\t}); err != nil && err == wait.ErrWaitTimeout {\n\t\terr := fmt.Errorf(\"Loki2vali: %v: Timeout while waiting for the vali PVC to be bound\", namespace)\n\t\tlog.Info(\"Loki2vali:\", \"lokiError\", err)\n\t\treturn err\n\t} else {\n\t\treturn err\n\t}\n}", "func VertexAIOperationWaitTime(config *transport_tpg.Config, op map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error {\n\treturn vertexai.VertexAIOperationWaitTime(config, op, project, activity, userAgent, timeout)\n}", "func getWaiter(dryRun bool, client clientset.Interface, timeout time.Duration) apiclient.Waiter {\n\tif dryRun {\n\t\treturn dryrunutil.NewWaiter()\n\t}\n\treturn apiclient.NewKubeWaiter(client, timeout, os.Stdout)\n}", "func (op *CreateSnapshotOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*netapppb.Snapshot, error) {\n\topts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)\n\tvar resp netapppb.Snapshot\n\tif err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resp, nil\n}", "func (i *InvokeMotorStop) Wait() error {\n\treturn i.Result(nil)\n}", "func (op *BatchEnableServicesOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*serviceusagepb.BatchEnableServicesResponse, error) {\n\topts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)\n\tvar resp serviceusagepb.BatchEnableServicesResponse\n\tif err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resp, nil\n}", "func waitOp(pbmClient *pbm.PBM, lock *pbm.LockHeader, waitFor time.Duration) error {\n\t// just to be sure the check hasn't started before the lock were created\n\ttime.Sleep(1 * time.Second)\n\tfmt.Print(\".\")\n\n\ttmr := time.NewTimer(waitFor)\n\tdefer tmr.Stop()\n\ttkr := time.NewTicker(1 * time.Second)\n\tdefer tkr.Stop()\n\tfor {\n\t\tselect {\n\t\tcase <-tmr.C:\n\t\t\treturn errTout\n\t\tcase <-tkr.C:\n\t\t\tfmt.Print(\".\")\n\t\t\tlock, err := pbmClient.GetLockData(lock)\n\t\t\tif err != nil {\n\t\t\t\t// No lock, so operation has finished\n\t\t\t\tif errors.Is(err, mongo.ErrNoDocuments) {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\treturn errors.Wrap(err, \"get lock data\")\n\t\t\t}\n\t\t\tclusterTime, err := pbmClient.ClusterTime()\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"read cluster time\")\n\t\t\t}\n\t\t\tif lock.Heartbeat.T+pbm.StaleFrameSec < clusterTime.T {\n\t\t\t\treturn errors.Errorf(\"operation stale, last beat ts: %d\", lock.Heartbeat.T)\n\t\t\t}\n\t\t}\n\t}\n}", "func (m *IndexBucketModifierMock) Wait(timeout time.Duration) {\n\tm.MinimockWait(timeout)\n}", "func (m *HeavySyncMock) Wait(timeout time.Duration) {\n\tm.MinimockWait(timeout)\n}", "func (c *ConsensusState) wakeUpWaitCompleteOp() {\n\tfor _, op := range c.waitCompleteOp {\n\t\top.result = c.GetOrderedBGStateResponse()\n\t\top.wait <- true\n\t}\n\t// clean up waiting list\n\tc.waitCompleteOp = make([]*WaitCycleComplete, 0)\n}", "func (op *CreateReplicationOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*netapppb.Replication, error) {\n\topts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)\n\tvar resp netapppb.Replication\n\tif err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resp, nil\n}", "func retryDescribeRegions() (*ec2.DescribeRegionsOutput, error) {\n\tfor i := 0; i < len(OptInNotRequiredRegions); i++ {\n\t\tregion := OptInNotRequiredRegions[rand.Intn(len(OptInNotRequiredRegions))]\n\t\tsvc := ec2.New(newSession(region))\n\t\tregions, err := svc.DescribeRegions(&ec2.DescribeRegionsInput{})\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\treturn regions, nil\n\t}\n\treturn nil, errors.WithStackTrace(fmt.Errorf(\"could not find any enabled regions\"))\n}", "func WaitForConditionFunc(mcpName string, conditionType machineconfigv1.MachineConfigPoolConditionType, conditionStatus corev1.ConditionStatus, mcpCondGetter func(mcpName string, conditionType machineconfigv1.MachineConfigPoolConditionType) corev1.ConditionStatus) {\n\n\tvar cnfNodes []corev1.Node\n\trunningOnSingleNode, err := cluster.IsSingleNode()\n\tExpectWithOffset(1, err).ToNot(HaveOccurred())\n\t// checking in eventually as in case of single node cluster the only node may\n\t// be rebooting\n\tEventuallyWithOffset(1, func() error {\n\t\tmcp, err := GetByName(mcpName)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"Failed getting MCP by name\")\n\t\t}\n\n\t\tnodeLabels := mcp.Spec.NodeSelector.MatchLabels\n\t\tkey, _ := components.GetFirstKeyAndValue(nodeLabels)\n\t\treq, err := labels.NewRequirement(key, selection.Exists, []string{})\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"Failed creating node selector\")\n\t\t}\n\n\t\tselector := labels.NewSelector()\n\t\tselector = selector.Add(*req)\n\t\tcnfNodes, err = nodes.GetBySelector(selector)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"Failed getting nodes by selector\")\n\t\t}\n\n\t\ttestlog.Infof(\"MCP %q is targeting %v node(s): %s\", mcp.Name, len(cnfNodes), strings.Join(nodeNames(cnfNodes), \",\"))\n\t\treturn nil\n\t}, cluster.ComputeTestTimeout(10*time.Minute, runningOnSingleNode), 5*time.Second).ShouldNot(HaveOccurred(), \"Failed to find CNF nodes by MCP %q\", mcpName)\n\n\t// timeout should be based on the number of worker-cnf nodes\n\ttimeout := time.Duration(len(cnfNodes)*mcpUpdateTimeoutPerNode) * time.Minute\n\tif len(cnfNodes) == 0 {\n\t\ttimeout = 2 * time.Minute\n\t}\n\n\tEventuallyWithOffset(1, func() corev1.ConditionStatus {\n\t\treturn mcpCondGetter(mcpName, conditionType)\n\t}, cluster.ComputeTestTimeout(timeout, runningOnSingleNode), 30*time.Second).Should(Equal(conditionStatus), \"Failed to find condition status by MCP %q\", mcpName)\n}", "func (e *engine) Wait(context.Context, *Spec, *Step) (*State, error) {\n\treturn nil, nil // no-op for bash implementation\n}", "func (s *InvokeSync) Wait(ctx context.Context) error {\n\tif !s.wait.Wait(ctx) {\n\t\treturn task.StopReason(ctx)\n\t}\n\treturn s.err\n}", "func (c *apiConsumers) Wait() {\n\tc.wait()\n}", "func (ow *ordered[T, U]) Wait() []U {\n\tow.wg.Wait()\n\treturn ow.results\n}", "func wait(ctx context.Context, c TimedActuator,\n\tresChan chan error, cancel context.CancelFunc) error {\n\tif timeout := c.GetTimeout(); timeout != nil {\n\t\treturn waitWithTimeout(ctx, resChan, *timeout, cancel)\n\t}\n\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn nil\n\t\tcase err := <-resChan:\n\t\t\tif err != nil {\n\t\t\t\tcancel()\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n}", "func (op *StopReplicationOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*netapppb.Replication, error) {\n\topts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)\n\tvar resp netapppb.Replication\n\tif err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resp, nil\n}", "func (e *endpoint) Wait() {\n\te.completed.Wait()\n}", "func (c *TensorboardClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {\n\treturn c.internalClient.WaitOperation(ctx, req, opts...)\n}", "func Wait() {\n\tselect {}\n}", "func (i *InvokeMotorStart) Wait() error {\n\treturn i.Result(nil)\n}", "func (op *DeleteTensorboardOperation) Wait(ctx context.Context, opts ...gax.CallOption) error {\n\topts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)\n\treturn op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...)\n}", "func CfnWaitCondition_IsCfnResource(construct constructs.IConstruct) *bool {\n\t_init_.Initialize()\n\n\tvar returns *bool\n\n\t_jsii_.StaticInvoke(\n\t\t\"aws-cdk-lib.aws_cloudformation.CfnWaitCondition\",\n\t\t\"isCfnResource\",\n\t\t[]interface{}{construct},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "func (o *operation) waitExecution(bq *InMemoryBuildQueue, out remoteexecution.Execution_ExecuteServer) error {\n\tctx := out.Context()\n\n\t// Bookkeeping for determining whether operations are abandoned\n\t// by clients. Operations should be removed if there are no\n\t// clients calling Execute() or WaitExecution() for a certain\n\t// amount of time.\n\tif o.cleanupKey.isActive() {\n\t\tbq.cleanupQueue.remove(o.cleanupKey)\n\t}\n\to.waiters++\n\tdefer func() {\n\t\tif o.waiters == 0 {\n\t\t\tpanic(\"Invalid waiters count on operation\")\n\t\t}\n\t\to.waiters--\n\t\to.maybeStartCleanup(bq)\n\t}()\n\n\tt := o.task\n\tfor {\n\t\t// Construct the longrunning.Operation that needs to be\n\t\t// sent back to the client.\n\t\tmetadata, err := anypb.New(&remoteexecution.ExecuteOperationMetadata{\n\t\t\tStage: t.getStage(),\n\t\t\tActionDigest: t.desiredState.ActionDigest,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn util.StatusWrap(err, \"Failed to marshal execute operation metadata\")\n\t\t}\n\t\toperation := &longrunning.Operation{\n\t\t\tName: o.name,\n\t\t\tMetadata: metadata,\n\t\t}\n\t\tif t.executeResponse != nil {\n\t\t\toperation.Done = true\n\t\t\tresponse, err := anypb.New(t.executeResponse)\n\t\t\tif err != nil {\n\t\t\t\treturn util.StatusWrap(err, \"Failed to marshal execute response\")\n\t\t\t}\n\t\t\toperation.Result = &longrunning.Operation_Response{Response: response}\n\t\t}\n\t\tstageChangeWakeup := t.stageChangeWakeup\n\t\tbq.leave()\n\n\t\t// Send the longrunning.Operation back to the client.\n\t\tif err := out.Send(operation); operation.Done || err != nil {\n\t\t\tbq.enter(bq.clock.Now())\n\t\t\treturn err\n\t\t}\n\n\t\t// Suspend until the client closes the connection, the\n\t\t// action completes or a certain amount of time has\n\t\t// passed without any updates.\n\t\ttimer, timerChannel := bq.clock.NewTimer(bq.configuration.ExecutionUpdateInterval)\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\ttimer.Stop()\n\t\t\tbq.enter(bq.clock.Now())\n\t\t\treturn util.StatusFromContext(ctx)\n\t\tcase <-stageChangeWakeup:\n\t\t\ttimer.Stop()\n\t\t\tbq.enter(bq.clock.Now())\n\t\tcase t := <-timerChannel:\n\t\t\tbq.enter(t)\n\t\t}\n\t}\n}", "func wait(c client.Client, watchNamespace, condType string, expectedStatus meta.ConditionStatus) error {\n\terr := kubeWait.Poll(retry.Interval, retry.ResourceChangeTimeout, func() (bool, error) {\n\t\topCond, err := get(c, watchNamespace)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\treturn Validate(opCond.Status.Conditions, condType, expectedStatus), nil\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to verify condition type %s has status %s: %w\", condType, expectedStatus, err)\n\t}\n\treturn nil\n}", "func (f *FakeCmdRunner) Wait() error {\n\treturn f.Err\n}", "func NewCfnWaitConditionHandle_Override(c CfnWaitConditionHandle, scope constructs.Construct, id *string) {\n\t_init_.Initialize()\n\n\t_jsii_.Create(\n\t\t\"aws-cdk-lib.aws_cloudformation.CfnWaitConditionHandle\",\n\t\t[]interface{}{scope, id},\n\t\tc,\n\t)\n}", "func (op *DeleteTensorboardRunOperation) Wait(ctx context.Context, opts ...gax.CallOption) error {\n\topts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)\n\treturn op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...)\n}", "func (c *Client) Wait(cluster, service, arn string) error {\n\tt := time.NewTicker(c.pollInterval)\n\tfor {\n\t\tselect {\n\t\tcase <-t.C:\n\t\t\ts, err := c.GetDeployment(cluster, service, arn)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tc.logger.Printf(\"[info] --> desired: %d, pending: %d, running: %d\", *s.DesiredCount, *s.PendingCount, *s.RunningCount)\n\t\t\tif *s.RunningCount == *s.DesiredCount {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}\n}", "func WaitForFuncOnFakeAppScaling(t *testing.T, client framework.FrameworkClient, namespace, name, fakeAppName string, f func(dd *datadoghqv1alpha1.WatermarkPodAutoscaler, fakeApp *v1.Deployment) (bool, error), retryInterval, timeout time.Duration) error {\n\treturn wait.Poll(retryInterval, timeout, func() (bool, error) {\n\t\tobjKey := dynclient.ObjectKey{\n\t\t\tNamespace: namespace,\n\t\t\tName: name,\n\t\t}\n\t\twatermarkPodAutoscaler := &datadoghqv1alpha1.WatermarkPodAutoscaler{}\n\t\terr := client.Get(context.TODO(), objKey, watermarkPodAutoscaler)\n\t\tif err != nil {\n\t\t\tif apierrors.IsNotFound(err) {\n\t\t\t\tt.Logf(\"Waiting for availability of %s WatermarkPodAutoscaler\\n\", name)\n\t\t\t\treturn false, nil\n\t\t\t}\n\t\t\treturn false, err\n\t\t}\n\n\t\tobjKey = dynclient.ObjectKey{\n\t\t\tNamespace: namespace,\n\t\t\tName: fakeAppName,\n\t\t}\n\t\tfakeApp := &v1.Deployment{}\n\t\terr = client.Get(context.TODO(), objKey, fakeApp)\n\t\tif err != nil {\n\t\t\tif apierrors.IsNotFound(err) {\n\t\t\t\tt.Logf(\"Waiting for availability of %s FakeAppDeployment\\n\", name)\n\t\t\t\treturn false, nil\n\t\t\t}\n\t\t\treturn false, err\n\t\t}\n\n\t\tok, err := f(watermarkPodAutoscaler, fakeApp)\n\t\tt.Logf(\"Waiting for condition function to be true ok for %s WatermarkPodAutoscaler (%t/%v)\\n\", name, ok, err)\n\t\tt.Logf(\"Waiting for condition function to be true ok for %s FakeAppDeployment (%t/%v)\\n\", fakeAppName, ok, err)\n\t\treturn ok, err\n\t})\n}", "func (c *gcsCore) WaitContainer(id string) (func() prot.NotificationType, error) {\n\tc.containerCacheMutex.Lock()\n\tentry := c.getContainer(id)\n\tif entry == nil {\n\t\tc.containerCacheMutex.Unlock()\n\t\treturn nil, gcserr.NewHresultError(gcserr.HrVmcomputeSystemNotFound)\n\t}\n\tc.containerCacheMutex.Unlock()\n\n\tf := func() prot.NotificationType {\n\t\tlogrus.Debugf(\"gcscore::WaitContainer waiting on init process waitgroup\")\n\t\tentry.initProcess.writersWg.Wait()\n\t\tlogrus.Debugf(\"gcscore::WaitContainer init process waitgroup count has dropped to zero\")\n\t\t// v1 only supported unexpected exit\n\t\treturn prot.NtUnexpectedExit\n\t}\n\n\treturn f, nil\n}", "func (w *LimitedConcurrencySingleFlight) Wait() {\n\tw.inflightCalls.Wait()\n}", "func (m *MockOperation) Wait() error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Wait\")\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "func (w *CommandExecutedWaiter) Wait(ctx context.Context, params *GetCommandInvocationInput, maxWaitDur time.Duration, optFns ...func(*CommandExecutedWaiterOptions)) error {\n\t_, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...)\n\treturn err\n}", "func waitForAwsResource(name, event string, c *client.Client) error {\n\ttick := time.Tick(time.Second * 2)\n\ttimeout := time.After(time.Minute * 5)\n\tfmt.Printf(\"Waiting for %s \", name)\n\tfailedEv := event + \"_FAILED\"\n\tcompletedEv := event + \"_COMPLETE\"\nLoop:\n\tfor {\n\t\tselect {\n\t\tcase <-tick:\n\t\t\trs, err := c.GetResource(name)\n\t\t\tif err != nil {\n\t\t\t\tif event == \"DELETE\" {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tfmt.Print(\".\")\n\t\t\tif rs.Status == failedEv {\n\t\t\t\treturn fmt.Errorf(\"%s failed because of \\\"%s\\\"\", event, rs.StatusReason)\n\t\t\t}\n\t\t\tif rs.Status == completedEv {\n\t\t\t\tbreak Loop\n\t\t\t}\n\t\tcase <-timeout:\n\t\t\tfmt.Print(\"timeout (5 minutes). Skipping\")\n\t\t\tbreak Loop\n\t\t}\n\t}\n\n\treturn nil\n}", "func TestDroppingPrimaryRegionAsyncJobFailure(t *testing.T) {\n\tdefer leaktest.AfterTest(t)()\n\tdefer log.Scope(t).Close(t)\n\n\t// Decrease the adopt loop interval so that retries happen quickly.\n\tdefer sqltestutils.SetTestJobsAdoptInterval()()\n\n\t// Protects expectedCleanupRuns\n\tvar mu syncutil.Mutex\n\t// We need to cleanup 2 times, once for the multi-region type descriptor and\n\t// once for the array alias of the multi-region type descriptor.\n\thaveWePerformedFirstRoundOfCleanup := false\n\tcleanupFinished := make(chan struct{})\n\tknobs := base.TestingKnobs{\n\t\tSQLTypeSchemaChanger: &sql.TypeSchemaChangerTestingKnobs{\n\t\t\tRunBeforeExec: func() error {\n\t\t\t\treturn errors.New(\"yikes\")\n\t\t\t},\n\t\t\tRunAfterOnFailOrCancel: func() error {\n\t\t\t\tmu.Lock()\n\t\t\t\tdefer mu.Unlock()\n\t\t\t\tif haveWePerformedFirstRoundOfCleanup {\n\t\t\t\t\tclose(cleanupFinished)\n\t\t\t\t}\n\t\t\t\thaveWePerformedFirstRoundOfCleanup = true\n\t\t\t\treturn nil\n\t\t\t},\n\t\t},\n\t}\n\n\t_, sqlDB, cleanup := multiregionccltestutils.TestingCreateMultiRegionCluster(\n\t\tt, 1 /* numServers */, knobs, nil, /* baseDir */\n\t)\n\tdefer cleanup()\n\n\t// Setup the test.\n\t_, err := sqlDB.Exec(`\nCREATE DATABASE db WITH PRIMARY REGION \"us-east1\";\nCREATE TABLE db.t(k INT) LOCALITY REGIONAL BY TABLE IN PRIMARY REGION;\n`)\n\trequire.NoError(t, err)\n\n\t_, err = sqlDB.Exec(`ALTER DATABASE db DROP REGION \"us-east1\"`)\n\ttestutils.IsError(err, \"yikes\")\n\n\t<-cleanupFinished\n\n\trows := sqlDB.QueryRow(`SELECT count(*) FROM system.namespace WHERE name = 'crdb_internal_region'`)\n\tvar count int\n\terr = rows.Scan(&count)\n\trequire.NoError(t, err)\n\tif count != 0 {\n\t\tt.Fatal(\"expected crdb_internal_region not to be present in system.namespace\")\n\t}\n\n\t_, err = sqlDB.Exec(`ALTER DATABASE db PRIMARY REGION \"us-east1\"`)\n\trequire.NoError(t, err)\n\n\trows = sqlDB.QueryRow(`SELECT count(*) FROM system.namespace WHERE name = 'crdb_internal_region'`)\n\terr = rows.Scan(&count)\n\trequire.NoError(t, err)\n\tif count != 1 {\n\t\tt.Fatal(\"expected crdb_internal_region to be present in system.namespace\")\n\t}\n}", "func (r SortedRunner) Wait() error {\n\treturn nil\n}", "func (op *DeleteStoragePoolOperation) Wait(ctx context.Context, opts ...gax.CallOption) error {\n\topts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)\n\treturn op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...)\n}", "func (c *ClientManager) WaitInstanceUntilReady(id int, until time.Time) error {\n\tfor {\n\t\tvirtualGuest, found, err := c.GetInstance(id, \"id, lastOperatingSystemReload[id,modifyDate], activeTransaction[id,transactionStatus.name], provisionDate, powerState.keyName\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif !found {\n\t\t\treturn bosherr.WrapErrorf(err, \"SoftLayer virtual guest '%d' does not exist\", id)\n\t\t}\n\n\t\tlastReload := virtualGuest.LastOperatingSystemReload\n\t\tactiveTxn := virtualGuest.ActiveTransaction\n\t\tprovisionDate := virtualGuest.ProvisionDate\n\n\t\t// if lastReload != nil && lastReload.ModifyDate != nil {\n\t\t// \tfmt.Println(\"lastReload: \", (*lastReload.ModifyDate).Format(time.RFC3339))\n\t\t// }\n\t\t// if activeTxn != nil && activeTxn.TransactionStatus != nil && activeTxn.TransactionStatus.Name != nil {\n\t\t// \tfmt.Println(\"activeTxn: \", *activeTxn.TransactionStatus.Name)\n\t\t// }\n\t\t// if provisionDate != nil {\n\t\t// \tfmt.Println(\"provisionDate: \", (*provisionDate).Format(time.RFC3339))\n\t\t// }\n\n\t\treloading := activeTxn != nil && lastReload != nil && *activeTxn.Id == *lastReload.Id\n\t\tif provisionDate != nil && !reloading {\n\t\t\t// fmt.Println(\"power state:\", *virtualGuest.PowerState.KeyName)\n\t\t\tif *virtualGuest.PowerState.KeyName == \"RUNNING\" {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\n\t\tnow := time.Now()\n\t\tif now.After(until) {\n\t\t\treturn bosherr.Errorf(\"Power on virtual guest with id %d Time Out!\", *virtualGuest.Id)\n\t\t}\n\n\t\tmin := math.Min(float64(10.0), float64(until.Sub(now)))\n\t\ttime.Sleep(time.Duration(min) * time.Second)\n\t}\n}", "func (i *InvokeMotorBrake) Wait() error {\n\treturn i.Result(nil)\n}", "func TestWaitUntilAllNodesReady(t *testing.T) {\n\tt.Parallel()\n\n\toptions := NewKubectlOptions(\"\", \"\", \"default\")\n\n\tWaitUntilAllNodesReady(t, options, 12, 5*time.Second)\n\n\tnodes := GetNodes(t, options)\n\tnodeNames := map[string]bool{}\n\tfor _, node := range nodes {\n\t\tnodeNames[node.Name] = true\n\t}\n\n\treadyNodes := GetReadyNodes(t, options)\n\treadyNodeNames := map[string]bool{}\n\tfor _, node := range readyNodes {\n\t\treadyNodeNames[node.Name] = true\n\t}\n\n\tassert.Equal(t, nodeNames, readyNodeNames)\n}", "func (ft *FutureTask) Wait(timeout time.Duration) (res *[]byte, err error) {\n\tselect {\n\tcase res = <-ft.out:\n\tcase <-time.After(timeout):\n\t\terr = fmt.Errorf(\"task(%+v) timeout\", ft)\n\t}\n\treturn\n}", "func (w *InstanceExistsWaiter) Wait(ctx context.Context, params *DescribeInstancesInput, maxWaitDur time.Duration, optFns ...func(*InstanceExistsWaiterOptions)) error {\n\t_, err := w.WaitForOutput(ctx, params, maxWaitDur, optFns...)\n\treturn err\n}", "func (g *FuncGroup) Wait() { (*sync.WaitGroup)(unsafe.Pointer(g)).Wait() }", "func (a *ApplyImpl) Wait() bool {\n\treturn a.ApplyOptions.Wait\n}", "func (op *CancelEntitlementOperation) Wait(ctx context.Context, opts ...gax.CallOption) error {\n\topts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)\n\treturn op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...)\n}", "func (s *progressBar) Wait() {\n\ts.container.Wait()\n}", "func WaitForFuncOnWatermarkPodAutoscaler(t *testing.T, client framework.FrameworkClient, namespace, name string, f func(dd *datadoghqv1alpha1.WatermarkPodAutoscaler) (bool, error), retryInterval, timeout time.Duration) error {\n\treturn wait.Poll(retryInterval, timeout, func() (bool, error) {\n\t\tobjKey := dynclient.ObjectKey{\n\t\t\tNamespace: namespace,\n\t\t\tName: name,\n\t\t}\n\t\tWatermarkPodAutoscaler := &datadoghqv1alpha1.WatermarkPodAutoscaler{}\n\t\terr := client.Get(context.TODO(), objKey, WatermarkPodAutoscaler)\n\t\tif err != nil {\n\t\t\tif apierrors.IsNotFound(err) {\n\t\t\t\tt.Logf(\"Waiting for availability of %s WatermarkPodAutoscaler\\n\", name)\n\t\t\t\treturn false, nil\n\t\t\t}\n\t\t\treturn false, err\n\t\t}\n\n\t\tok, err := f(WatermarkPodAutoscaler)\n\t\tt.Logf(\"Waiting for condition function to be true ok for %s WatermarkPodAutoscaler (%t/%v)\\n\", name, ok, err)\n\t\treturn ok, err\n\t})\n}", "func LookupWaitCondition(ctx *pulumi.Context, args *LookupWaitConditionArgs, opts ...pulumi.InvokeOption) (*LookupWaitConditionResult, error) {\n\topts = internal.PkgInvokeDefaultOpts(opts)\n\tvar rv LookupWaitConditionResult\n\terr := ctx.Invoke(\"aws-native:cloudformation:getWaitCondition\", args, &rv, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &rv, nil\n}", "func (m *IndexCollectionAccessorMock) Wait(timeout time.Duration) {\n\tm.MinimockWait(timeout)\n}", "func (e *Executor) Wait() { <-e.exit }", "func resourceComputeRegionPerInstanceConfigPollRead(d *schema.ResourceData, meta interface{}) transport_tpg.PollReadFunc {\n\treturn func() (map[string]interface{}, error) {\n\t\tconfig := meta.(*transport_tpg.Config)\n\t\tuserAgent, err := tpgresource.GenerateUserAgentString(d, config.UserAgent)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\turl, err := tpgresource.ReplaceVars(d, config, \"{{ComputeBasePath}}projects/{{project}}/regions/{{region}}/instanceGroupManagers/{{region_instance_group_manager}}/listPerInstanceConfigs\")\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tproject, err := tpgresource.GetProject(d, config)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tres, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{\n\t\t\tConfig: config,\n\t\t\tMethod: \"POST\",\n\t\t\tProject: project,\n\t\t\tRawURL: url,\n\t\t\tUserAgent: userAgent,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn res, err\n\t\t}\n\t\tres, err = flattenNestedComputeRegionPerInstanceConfig(d, meta, res)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// Returns nil res if nested object is not found\n\t\treturn res, nil\n\t}\n}", "func (resp *ActionVpsFeatureUpdateAllResponse) WaitForOperation(timeout float64) (*ActionActionStatePollResponse, error) {\n\treq := resp.Action.Client.ActionState.Poll.Prepare()\n\treq.SetPathParamInt(\"action_state_id\", resp.Response.Meta.ActionStateId)\n\n\tinput := req.NewInput()\n\tinput.SetTimeout(timeout)\n\n\treturn req.Call()\n}", "func (p *ResourcePool) getWait() (resource ResourceWrapper, err error) {\n\n\tstart := time.Now()\n\ttimeout := time.After(p.TimeoutTime)\n\n\tfor {\n\t\tr, e := p.getAvailable(timeout)\n\n\t\t//if the test failed try again\n\t\tif e == ResourceTestError {\n\t\t\ttime.Sleep(time.Microsecond)\n\t\t\tcontinue\n\t\t}\n\n\t\t//if we are at our max open try again after a short sleep\n\t\tif e == ResourceExhaustedError {\n\t\t\ttime.Sleep(time.Microsecond)\n\t\t\tcontinue\n\t\t}\n\n\t\t//if we failed to create a new resource, try agaig after a short sleep\n\t\tif e == ResourceCreationError {\n\t\t\ttime.Sleep(time.Microsecond)\n\t\t\tcontinue\n\t\t}\n\n\t\tp.Report()\n\t\tp.ReportWait(time.Now().Sub(start))\n\t\treturn r, e\n\t}\n\n}", "func GxWait(children ...Element) *CompoundElement { return newCE(\"gx:Wait\", children) }", "func (b *Bucket) OperationTimeout() time.Duration {\n\treturn b.opTimeout\n}" ]
[ "0.6485794", "0.6148028", "0.59410524", "0.5720895", "0.5208424", "0.5060738", "0.5050245", "0.5047461", "0.5016972", "0.49274492", "0.48836273", "0.4837021", "0.48343638", "0.476476", "0.47518867", "0.47411084", "0.47172353", "0.46930048", "0.46831748", "0.46505287", "0.46442783", "0.46424323", "0.46356368", "0.46269777", "0.46196604", "0.4617425", "0.460664", "0.4600955", "0.45944652", "0.45842266", "0.45792785", "0.45738348", "0.45620197", "0.45479244", "0.45407733", "0.45101005", "0.45087782", "0.45063087", "0.4498804", "0.44920218", "0.44908762", "0.4488635", "0.44857606", "0.44770053", "0.446582", "0.44627312", "0.44623873", "0.44481328", "0.44463992", "0.4445032", "0.44417706", "0.44408223", "0.44395787", "0.4439057", "0.44299954", "0.44258812", "0.44247755", "0.44168973", "0.44132692", "0.44120866", "0.44084203", "0.44011715", "0.4398844", "0.43946514", "0.43941915", "0.43918294", "0.4385692", "0.43845895", "0.4380871", "0.43798944", "0.4376538", "0.43721384", "0.43718603", "0.43712693", "0.43703815", "0.43696064", "0.43646652", "0.43602237", "0.43601027", "0.43490216", "0.43484196", "0.43328565", "0.43268982", "0.43244788", "0.43232602", "0.43226182", "0.43209982", "0.43179524", "0.43150914", "0.43066493", "0.43035612", "0.43024653", "0.43013045", "0.4296883", "0.42893618", "0.42751774", "0.4270877", "0.42693016", "0.42664322", "0.42594522" ]
0.7632201
0
globalOperationsWait uses the override method globalOperationsWaitFn or the real implementation.
func (c *TestClient) globalOperationsWait(project, name string) error { if c.globalOperationsWaitFn != nil { return c.globalOperationsWaitFn(project, name) } return c.client.globalOperationsWait(project, name) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *Compute) waitGlobal(operation *compute.Operation) error {\n\tfor {\n\t\top, err := c.GlobalOperations.Get(c.Project, operation.Name).Do()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to get operation: %v\", operation.Name, err)\n\t\t}\n\t\tlog.Printf(\"operation %q status: %s\", operation.Name, op.Status)\n\t\tif op.Status == \"DONE\" {\n\t\t\tif op.Error != nil {\n\t\t\t\treturn fmt.Errorf(\"operation error: %v\", *op.Error.Errors[0])\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\ttime.Sleep(1 * time.Second)\n\t}\n\treturn nil\n}", "func OperationWait(w tpgresource.Waiter, activity string, timeout time.Duration, pollInterval time.Duration) error {\n\treturn tpgresource.OperationWait(w, activity, timeout, pollInterval)\n}", "func (c *TestClient) regionOperationsWait(project, region, name string) error {\n\tif c.regionOperationsWaitFn != nil {\n\t\treturn c.regionOperationsWaitFn(project, region, name)\n\t}\n\treturn c.client.regionOperationsWait(project, region, name)\n}", "func (c *Compute) wait(operation *compute.Operation) error {\n\tfor {\n\t\top, err := c.ZoneOperations.Get(c.Project, c.Zone, operation.Name).Do()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to get operation: %v\", operation.Name, err)\n\t\t}\n\t\tlog.Printf(\"operation %q status: %s\", operation.Name, op.Status)\n\t\tif op.Status == \"DONE\" {\n\t\t\tif op.Error != nil {\n\t\t\t\treturn fmt.Errorf(\"operation error: %v\", *op.Error.Errors[0])\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\ttime.Sleep(1 * time.Second)\n\t}\n\treturn nil\n}", "func (c *TestClient) zoneOperationsWait(project, zone, name string) error {\n\tif c.zoneOperationsWaitFn != nil {\n\t\treturn c.zoneOperationsWaitFn(project, zone, name)\n\t}\n\treturn c.client.zoneOperationsWait(project, zone, name)\n}", "func (conn *basicConn) waitActiveOp() {\n\tconn.activeOpsMut.Lock()\n\tfor conn.activeOps != 0 {\n\t\tconn.activeOpsCond.Wait()\n\t}\n}", "func (c controller) waitingForClusterOperators(ctx context.Context) error {\n\t// In case cvo changes it message we will update timer but we want to have maximum timeout\n\t// for this context with timeout is used\n\tc.log.Info(\"Waiting for cluster operators\")\n\tctxWithTimeout, cancel := context.WithTimeout(ctx, CVOMaxTimeout)\n\tdefer cancel()\n\n\tisClusterVersionAvailable := func(timer *time.Timer) bool {\n\t\tclusterOperatorHandler := NewClusterOperatorHandler(c.kc, consoleOperatorName, c.log)\n\t\tclusterVersionHandler := NewClusterVersionHandler(c.log, c.kc, timer)\n\t\tisConsoleEnabled, err := c.kc.IsClusterCapabilityEnabled(consoleCapabilityName)\n\t\tif err != nil {\n\t\t\tc.log.WithError(err).Error(\"Failed to check if console is enabled\")\n\t\t\treturn false\n\t\t}\n\t\tvar result bool\n\t\tif isConsoleEnabled {\n\t\t\tc.log.Info(\"Console is enabled, will wait for the console operator to be available\")\n\t\t\tresult = c.isOperatorAvailable(clusterOperatorHandler)\n\t\t} else {\n\t\t\tc.log.Info(\"Console is disabled, will not wait for the console operator to be available\")\n\t\t\tresult = true\n\t\t}\n\t\tif c.WaitForClusterVersion {\n\t\t\tresult = c.isOperatorAvailable(clusterVersionHandler) && result\n\t\t}\n\t\treturn result\n\t}\n\treturn utils.WaitForPredicateWithTimer(ctxWithTimeout, LongWaitTimeout, GeneralProgressUpdateInt, isClusterVersionAvailable)\n}", "func (gc *GCloudContainer) waitForOperation(operation *container.Operation) (err error) {\n\tstart := time.Now()\n\ttimeout := operationWaitTimeoutSecond * time.Second\n\n\tfor {\n\t\tapiName := fmt.Sprintf(\"projects/%v/locations/%v/operations/%v\", gc.Client.Project, gc.Client.Location, operation.Name)\n\n\t\tlog.Debug().Msgf(\"Waiting for operation %v\", apiName)\n\n\t\tif op, err := gc.Service.Projects.Locations.Operations.Get(apiName).Do(); err == nil {\n\t\t\tlog.Debug().Msgf(\"Operation %v status: %s\", apiName, op.Status)\n\n\t\t\tif op.Status == \"DONE\" {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t} else {\n\t\t\tlog.Error().Err(err).Msgf(\"Error while getting operation %v on %s: %v\", apiName, operation.TargetLink, err)\n\t\t}\n\n\t\tif time.Since(start) > timeout {\n\t\t\terr = fmt.Errorf(\"Timeout while waiting for operation %v on %s to complete\", apiName, operation.TargetLink)\n\t\t\treturn\n\t\t}\n\n\t\tsleepTime := ApplyJitter(operationPollIntervalSecond)\n\t\tlog.Info().Msgf(\"Sleeping for %v seconds...\", sleepTime)\n\t\ttime.Sleep(time.Duration(sleepTime) * time.Second)\n\t}\n\n\treturn\n}", "func KubeWaitOp(apiserver *cke.Node) cke.Operator {\n\treturn &kubeWaitOp{apiserver: apiserver}\n}", "func wait() {\n\twaitImpl()\n}", "func (c *context) WgWait() {\n\tc.waitGroup.Wait()\n}", "func (p *googleCloudProvider) waitForResourceOpCompletion(\n\turn resource.URN,\n\toperation resources.CloudAPIOperation,\n\tresp map[string]interface{},\n\tinputState resource.PropertyMap,\n) (map[string]interface{}, error) {\n\tretryPolicy := backoff.Backoff{\n\t\tMin: 1 * time.Second,\n\t\tMax: 15 * time.Second,\n\t\tFactor: 1.5,\n\t\tJitter: true,\n\t}\n\tvar pollingStrategy = resources.DefaultPoll\n\tif operation.Polling != nil {\n\t\tpollingStrategy = operation.Polling.Strategy\n\t}\n\tfor {\n\t\tvar pollURI string\n\n\t\tlogging.V(9).Infof(\"waiting for completion: polling strategy: %q: %+v\", pollingStrategy, resp)\n\t\tdetails, ok := resp[\"detail\"]\n\t\tif !ok {\n\t\t\tdetails, ok = resp[\"details\"]\n\t\t}\n\t\tif ok {\n\t\t\t_ = p.host.LogStatus(context.Background(), diag.Info, urn, fmt.Sprintf(\"%v\", details))\n\t\t}\n\n\t\t// if the resource has a custom polling strategy, use that.\n\t\tswitch pollingStrategy {\n\t\tcase resources.KNativeStatusPoll:\n\t\t\tlogging.V(9).Info(\"Getting self link URL\")\n\t\t\tsl, err := getKNativeSelfLinkURL(resp)\n\t\t\tif err != nil {\n\t\t\t\treturn resp, err\n\t\t\t}\n\t\t\tlogging.V(9).Infof(\"selfLink: %q from response: %+v\", sl, resp)\n\t\t\tpollURI = sl\n\t\t\tcompleted, err := knativeStatusCheck(resp)\n\t\t\tif err != nil {\n\t\t\t\treturn resp, err\n\t\t\t}\n\t\t\tif completed {\n\t\t\t\treturn resp, nil\n\t\t\t}\n\t\tdefault:\n\t\t\t// Otherwise there are three styles of operations: one returns a 'done' boolean flag,\n\t\t\t// another one returns status='DONE' and the last one adds the above fields nested under\n\t\t\t// a nested field (rare).\n\t\t\top := resp\n\t\t\tif operation.Operations != nil && operation.Operations.EmbeddedOperationField != \"\" {\n\t\t\t\tif nestedOp, ok := resp[operation.Operations.EmbeddedOperationField].(map[string]interface{}); ok {\n\t\t\t\t\top = nestedOp\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tdone, hasDone := op[\"done\"].(bool)\n\t\t\tstatus, hasStatus := op[\"status\"].(string)\n\t\t\tif completed := (hasDone && done) || (hasStatus && strings.ToLower(status) == \"done\"); completed {\n\t\t\t\t// Extract an error message from the response, if any.\n\t\t\t\tvar err error\n\t\t\t\tif failure, has := resp[\"error\"]; has {\n\t\t\t\t\terr = errors.Errorf(\"operation errored with %+v\", failure)\n\t\t\t\t} else if statusMessage, has := resp[\"statusMessage\"]; has {\n\t\t\t\t\terr = errors.Errorf(\"operation failed with %q\", statusMessage)\n\t\t\t\t}\n\t\t\t\t// Extract the resource response, if any.\n\t\t\t\t// A partial error could happen, so both response and error could be available.\n\t\t\t\tif response, has := op[\"response\"].(map[string]interface{}); has {\n\t\t\t\t\treturn response, err\n\t\t\t\t}\n\n\t\t\t\t// We don't need the most up-to-date state on deletions so use the response.\n\t\t\t\tif operationType, has := op[\"operationType\"].(string); has &&\n\t\t\t\t\tstrings.Contains(strings.ToLower(operationType), \"delete\") {\n\t\t\t\t\treturn resp, err\n\t\t\t\t}\n\n\t\t\t\t// Try to retrieve the targetLink first. If not try to retrieve using the selfLink.\n\t\t\t\ttargetLink, hasTargetLink := getTargetLink(op)\n\t\t\t\tif !hasTargetLink {\n\t\t\t\t\ttargetLink, hasTargetLink = getSelfLink(op)\n\t\t\t\t}\n\n\t\t\t\tcontinuePollingForRestingState := false\n\t\t\t\tif hasTargetLink {\n\t\t\t\t\t// Try reading resource state.\n\t\t\t\t\tstate, getErr := p.client.RequestWithTimeout(\"GET\", targetLink, \"\", nil, 0)\n\t\t\t\t\tif getErr != nil {\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t// Return the original creation error if resource read failed.\n\t\t\t\t\t\t\treturn resp, err\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn resp, getErr\n\t\t\t\t\t}\n\t\t\t\t\tif pollingStrategy == resources.NodepoolAwaitRestingStatePoll {\n\t\t\t\t\t\tnpStatus, hasStatus := state[\"status\"].(string)\n\t\t\t\t\t\tif hasStatus && npStatus == \"RUNNING\" || npStatus == \"RUNNING_WITH_ERROR\" || npStatus == \"ERROR\" {\n\t\t\t\t\t\t\treturn state, err\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontinuePollingForRestingState = true\n\t\t\t\t\t} else if pollingStrategy == resources.ClusterAwaitRestingStatePoll {\n\t\t\t\t\t\tcStatus, hasStatus := state[\"status\"].(string)\n\t\t\t\t\t\tif hasStatus && cStatus == \"RUNNING\" || cStatus == \"DEGRADED\" || cStatus == \"ERROR\" {\n\t\t\t\t\t\t\treturn state, err\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontinuePollingForRestingState = true\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// A partial error could happen, so both response and error could be available.\n\t\t\t\t\t\treturn state, err\n\t\t\t\t\t}\n\t\t\t\t\tpollURI = targetLink\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn resp, err\n\t\t\t\t}\n\t\t\t\t// At this point, we assume either a complete failure or a clean response.\n\t\t\t\tif !continuePollingForRestingState {\n\t\t\t\t\treturn resp, nil\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tselfLink, has := getSelfLink(op)\n\t\t\tif has && hasStatus {\n\t\t\t\tpollURI = selfLink\n\t\t\t} else if operation.Operations != nil && operation.Operations.Template != \"\" {\n\t\t\t\tvar existing map[string]interface{}\n\t\t\t\tif inputState != nil {\n\t\t\t\t\texisting = inputState.Mappable()\n\t\t\t\t}\n\t\t\t\tvar err error\n\t\t\t\tpollURI, err = operation.Operations.URI(resp, existing)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn resp, err\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tlogging.V(9).Infof(\"waiting for completion: operation: %#v resp: %#v, pollURI: %q\", operation, resp,\n\t\t\t\t\tpollURI)\n\t\t\t}\n\t\t}\n\n\t\tif pollURI == \"\" {\n\t\t\t// No poll URI - assume the existing response is sufficient.\n\t\t\treturn resp, nil\n\t\t}\n\n\t\ttime.Sleep(retryPolicy.Duration())\n\n\t\tlogging.V(9).Infof(\"Polling URL: %q\", pollURI)\n\t\tpoll, err := p.client.RequestWithTimeout(\"GET\", pollURI, \"\", nil, 0)\n\t\tif err != nil {\n\t\t\treturn resp, errors.Wrapf(err, \"polling operation status\")\n\t\t}\n\n\t\tresp = poll\n\t}\n}", "func (v DiffChangeView) WaitOp() ctlcap.ClusterChangeWaitOp { return ctlcap.ClusterChangeWaitOpNoop }", "func (c *tensorboardRESTClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {\n\tbaseUrl, err := url.Parse(c.endpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbaseUrl.Path += fmt.Sprintf(\"/ui/%v:wait\", req.GetName())\n\n\tparams := url.Values{}\n\tif req.GetTimeout() != nil {\n\t\ttimeout, err := protojson.Marshal(req.GetTimeout())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tparams.Add(\"timeout\", string(timeout[1:len(timeout)-1]))\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\topts = append((*c.CallOptions).WaitOperation[0:len((*c.CallOptions).WaitOperation):len((*c.CallOptions).WaitOperation)], opts...)\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(\"POST\", 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\treturn resp, nil\n}", "func (g *FuncGroup) Wait() { (*sync.WaitGroup)(unsafe.Pointer(g)).Wait() }", "func TestWaitUntilAllNodesReady(t *testing.T) {\n\tt.Parallel()\n\n\toptions := NewKubectlOptions(\"\", \"\", \"default\")\n\n\tWaitUntilAllNodesReady(t, options, 12, 5*time.Second)\n\n\tnodes := GetNodes(t, options)\n\tnodeNames := map[string]bool{}\n\tfor _, node := range nodes {\n\t\tnodeNames[node.Name] = true\n\t}\n\n\treadyNodes := GetReadyNodes(t, options)\n\treadyNodeNames := map[string]bool{}\n\tfor _, node := range readyNodes {\n\t\treadyNodeNames[node.Name] = true\n\t}\n\n\tassert.Equal(t, nodeNames, readyNodeNames)\n}", "func (o *Operation) Wait(timeout time.Duration) (bool, error) {\n\t// check current state\n\tif o.status.IsFinal() {\n\t\treturn true, nil\n\t}\n\n\t// wait indefinitely\n\tif timeout == -1 {\n\t\tselect {\n\t\tcase <-o.chanDone:\n\t\t\treturn true, nil\n\t\t}\n\t}\n\n\t// Wait until timeout\n\tif timeout > 0 {\n\t\ttimer := time.NewTimer(timeout)\n\t\tselect {\n\t\tcase <-o.chanDone:\n\t\t\treturn true, nil\n\t\tcase <-timer.C:\n\t\t\treturn false, errors.Errorf(\"timeout\")\n\t\t}\n\t}\n\treturn false, nil\n}", "func (o *OperationLimiter) Wait(r *request.Request) error {\n\treturn o.getLimiter().Wait(r.Context())\n}", "func (cl *Client) waitForOperation(ctx context.Context, operation *compute.Operation) error {\n\tfor { // ZoneOperations should fail once the ctx.Deadline() is passed\n\t\tres, err := cl.computeService.ZoneOperations().Get(cl.projectID, cl.attrs[AttrZone].Value, operation.Name).Context(ctx).Do()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif res.Status == \"DONE\" {\n\t\t\tif res.Error != nil {\n\t\t\t\treturn fmt.Errorf(\"operation failure: code: %d, message: %s\", res.HttpErrorStatusCode, res.HttpErrorMessage)\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t\ttime.Sleep(time.Second)\n\t}\n}", "func (p *googleCloudProvider) waitForResourceOpCompletion(baseUrl string, resp map[string]interface{}) (map[string]interface{}, error) {\n\tretryPolicy := backoff.Backoff{\n\t\tMin: 1 * time.Second,\n\t\tMax: 15 * time.Second,\n\t\tFactor: 1.5,\n\t\tJitter: true,\n\t}\n\tfor {\n\t\tlogging.V(9).Infof(\"waiting for completion: %+v\", resp)\n\n\t\t// There are two styles of operations: one returns a 'done' boolean flag, another one returns status='DONE'.\n\t\tdone, hasDone := resp[\"done\"].(bool)\n\t\tstatus, hasStatus := resp[\"status\"].(string)\n\t\tif completed := (hasDone && done) || (hasStatus && status == \"DONE\"); completed {\n\t\t\t// Extract an error message from the response, if any.\n\t\t\tvar err error\n\t\t\tif failure, has := resp[\"error\"]; has {\n\t\t\t\terr = errors.Errorf(\"operation errored with %+v\", failure)\n\t\t\t} else if statusMessage, has := resp[\"statusMessage\"]; has {\n\t\t\t\terr = errors.Errorf(\"operation failed with %q\", statusMessage)\n\t\t\t}\n\t\t\t// Extract the resource response, if any.\n\t\t\t// A partial error could happen, so both response and error could be available.\n\t\t\tif response, has := resp[\"response\"].(map[string]interface{}); has {\n\t\t\t\treturn response, err\n\t\t\t}\n\t\t\tif operationType, has := resp[\"operationType\"].(string); has && strings.Contains(strings.ToLower(operationType), \"delete\") {\n\t\t\t\treturn resp, err\n\t\t\t}\n\t\t\t// Check if there's a target link.\n\t\t\tif targetLink, has := resp[\"targetLink\"].(string); has {\n\t\t\t\t// Try reading resource state.\n\t\t\t\tstate, getErr := p.client.RequestWithTimeout(\"GET\", targetLink, nil, 0)\n\t\t\t\tif getErr != nil {\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t// Return the original creation error if resource read failed.\n\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t}\n\t\t\t\t\treturn nil, getErr\n\t\t\t\t}\n\t\t\t\t// A partial error could happen, so both response and error could be available.\n\t\t\t\treturn state, err\n\t\t\t}\n\t\t\t// At this point, we assume either a complete failure or a clean response.\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn resp, nil\n\t\t}\n\n\t\tvar pollUri string\n\t\tif selfLink, has := resp[\"selfLink\"].(string); has && hasStatus {\n\t\t\tpollUri = selfLink\n\t\t} else {\n\t\t\tif name, has := resp[\"name\"].(string); has && strings.HasPrefix(name, \"operations/\") {\n\t\t\t\tpollUri = fmt.Sprintf(\"%s/v1/%s\", baseUrl, name)\n\t\t\t}\n\t\t}\n\n\t\tif pollUri == \"\" {\n\t\t\treturn resp, nil\n\t\t}\n\n\t\ttime.Sleep(retryPolicy.Duration())\n\n\t\top, err := p.client.RequestWithTimeout(\"GET\", pollUri, nil, 0)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"polling operation status\")\n\t\t}\n\n\t\tresp = op\n\t}\n}", "func wait(c client.Client, watchNamespace, condType string, expectedStatus meta.ConditionStatus) error {\n\terr := kubeWait.Poll(retry.Interval, retry.ResourceChangeTimeout, func() (bool, error) {\n\t\topCond, err := get(c, watchNamespace)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\treturn Validate(opCond.Status.Conditions, condType, expectedStatus), nil\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to verify condition type %s has status %s: %w\", condType, expectedStatus, err)\n\t}\n\treturn nil\n}", "func lroWait(ctx context.Context, client longrunning.OperationsClient, name string, opts ...grpc.CallOption) (*longrunning.Operation, error) {\n\t// Exponential backoff is used for retryable gRPC errors. In future, we\n\t// may want to make these parameters configurable.\n\tconst initialBackoffMillis = 1000\n\tconst maxAttempts = 4\n\tattempt := 0\n\n\t// WaitOperation() can return before the provided timeout even though the\n\t// underlying operation is in progress. It may also fail for retryable\n\t// reasons. Thus, we must loop until timeout ourselves.\n\tfor {\n\t\t// WaitOperation respects timeout in the RPC Context as well as through\n\t\t// an explicit field in WaitOperationRequest. We depend on Context\n\t\t// cancellation for timeouts (like everywhere else in this codebase).\n\t\t// On timeout, WaitOperation() will return an appropriate error\n\t\t// response.\n\t\top, err := client.WaitOperation(ctx, &longrunning.WaitOperationRequest{\n\t\t\tName: name,\n\t\t}, opts...)\n\t\tswitch status.Code(err) {\n\t\tcase codes.OK:\n\t\t\tattempt = 0\n\t\tcase codes.Unavailable, codes.ResourceExhausted:\n\t\t\t// Retryable error; retry with exponential backoff.\n\t\t\tif attempt >= maxAttempts {\n\t\t\t\treturn op, err\n\t\t\t}\n\t\t\tdelay := rand.Int63n(initialBackoffMillis * (1 << attempt))\n\t\t\ttesting.Sleep(ctx, time.Duration(delay)*time.Millisecond) // The sleep method was changed.\n\t\t\tattempt++\n\t\tdefault:\n\t\t\t// Non-retryable error\n\t\t\treturn op, err\n\t\t}\n\t\tif op.Done {\n\t\t\treturn op, nil\n\t\t}\n\t}\n}", "func (f *fakeProgressbar) Wait() {}", "func (_m *BandwidthThrottlerSvc) Wait() {\n\t_m.Called()\n}", "func (c *jobsRESTClient) WaitOperation(ctx context.Context, req *longrunningpb.WaitOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) {\n\tm := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}\n\tjsonReq, err := m.Marshal(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbaseUrl, err := url.Parse(c.endpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbaseUrl.Path += fmt.Sprintf(\"/v2/%v:wait\", req.GetName())\n\n\tparams := url.Values{}\n\tparams.Add(\"$alt\", \"json;enum-encoding=int\")\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\topts = append((*c.CallOptions).WaitOperation[0:len((*c.CallOptions).WaitOperation):len((*c.CallOptions).WaitOperation)], opts...)\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(\"POST\", baseUrl.String(), bytes.NewReader(jsonReq))\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\treturn resp, nil\n}", "func (t *ElapsedTimeout) Wait(context.Context) error { return nil }", "func (ret *OpRet) Wait() error {\n\tif ret.delayed == nil {\n\t\treturn nil\n\t}\n\n\t<-ret.delayed\n\treturn ret.error\n}", "func (k *kubectlContext) Wait(args ...string) error {\n\tout, err := k.do(append([]string{\"wait\"}, args...)...)\n\tk.t.Log(string(out))\n\treturn err\n}", "func (m *minion) waitPending(ctx context.Context) error {\n\t// We need to check for ctx.Done() here before getting into\n\t// the cond loop, because otherwise we might never be woken\n\t// up again\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn nil\n\tdefault:\n\t}\n\n\tm.cond.L.Lock()\n\tdefer m.cond.L.Unlock()\n\n\tfor {\n\t\tif m.pendingAvailable(0) {\n\t\t\tbreak\n\t\t}\n\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn nil\n\t\tdefault:\n\t\t}\n\n\t\tm.cond.Wait()\n\t}\n\treturn nil\n}", "func (p *ResourcePool) getWait() (resource ResourceWrapper, err error) {\n\n\tstart := time.Now()\n\ttimeout := time.After(p.TimeoutTime)\n\n\tfor {\n\t\tr, e := p.getAvailable(timeout)\n\n\t\t//if the test failed try again\n\t\tif e == ResourceTestError {\n\t\t\ttime.Sleep(time.Microsecond)\n\t\t\tcontinue\n\t\t}\n\n\t\t//if we are at our max open try again after a short sleep\n\t\tif e == ResourceExhaustedError {\n\t\t\ttime.Sleep(time.Microsecond)\n\t\t\tcontinue\n\t\t}\n\n\t\t//if we failed to create a new resource, try agaig after a short sleep\n\t\tif e == ResourceCreationError {\n\t\t\ttime.Sleep(time.Microsecond)\n\t\t\tcontinue\n\t\t}\n\n\t\tp.Report()\n\t\tp.ReportWait(time.Now().Sub(start))\n\t\treturn r, e\n\t}\n\n}", "func (c *apiConsumers) Wait() {\n\tc.wait()\n}", "func (resp *ActionVpsFeatureUpdateAllResponse) WaitForOperation(timeout float64) (*ActionActionStatePollResponse, error) {\n\treq := resp.Action.Client.ActionState.Poll.Prepare()\n\treq.SetPathParamInt(\"action_state_id\", resp.Response.Meta.ActionStateId)\n\n\tinput := req.NewInput()\n\tinput.SetTimeout(timeout)\n\n\treturn req.Call()\n}", "func WaitForConditionFunc(mcpName string, conditionType machineconfigv1.MachineConfigPoolConditionType, conditionStatus corev1.ConditionStatus, mcpCondGetter func(mcpName string, conditionType machineconfigv1.MachineConfigPoolConditionType) corev1.ConditionStatus) {\n\n\tvar cnfNodes []corev1.Node\n\trunningOnSingleNode, err := cluster.IsSingleNode()\n\tExpectWithOffset(1, err).ToNot(HaveOccurred())\n\t// checking in eventually as in case of single node cluster the only node may\n\t// be rebooting\n\tEventuallyWithOffset(1, func() error {\n\t\tmcp, err := GetByName(mcpName)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"Failed getting MCP by name\")\n\t\t}\n\n\t\tnodeLabels := mcp.Spec.NodeSelector.MatchLabels\n\t\tkey, _ := components.GetFirstKeyAndValue(nodeLabels)\n\t\treq, err := labels.NewRequirement(key, selection.Exists, []string{})\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"Failed creating node selector\")\n\t\t}\n\n\t\tselector := labels.NewSelector()\n\t\tselector = selector.Add(*req)\n\t\tcnfNodes, err = nodes.GetBySelector(selector)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"Failed getting nodes by selector\")\n\t\t}\n\n\t\ttestlog.Infof(\"MCP %q is targeting %v node(s): %s\", mcp.Name, len(cnfNodes), strings.Join(nodeNames(cnfNodes), \",\"))\n\t\treturn nil\n\t}, cluster.ComputeTestTimeout(10*time.Minute, runningOnSingleNode), 5*time.Second).ShouldNot(HaveOccurred(), \"Failed to find CNF nodes by MCP %q\", mcpName)\n\n\t// timeout should be based on the number of worker-cnf nodes\n\ttimeout := time.Duration(len(cnfNodes)*mcpUpdateTimeoutPerNode) * time.Minute\n\tif len(cnfNodes) == 0 {\n\t\ttimeout = 2 * time.Minute\n\t}\n\n\tEventuallyWithOffset(1, func() corev1.ConditionStatus {\n\t\treturn mcpCondGetter(mcpName, conditionType)\n\t}, cluster.ComputeTestTimeout(timeout, runningOnSingleNode), 30*time.Second).Should(Equal(conditionStatus), \"Failed to find condition status by MCP %q\", mcpName)\n}", "func waitOp(pbmClient *pbm.PBM, lock *pbm.LockHeader, waitFor time.Duration) error {\n\t// just to be sure the check hasn't started before the lock were created\n\ttime.Sleep(1 * time.Second)\n\tfmt.Print(\".\")\n\n\ttmr := time.NewTimer(waitFor)\n\tdefer tmr.Stop()\n\ttkr := time.NewTicker(1 * time.Second)\n\tdefer tkr.Stop()\n\tfor {\n\t\tselect {\n\t\tcase <-tmr.C:\n\t\t\treturn errTout\n\t\tcase <-tkr.C:\n\t\t\tfmt.Print(\".\")\n\t\t\tlock, err := pbmClient.GetLockData(lock)\n\t\t\tif err != nil {\n\t\t\t\t// No lock, so operation has finished\n\t\t\t\tif errors.Is(err, mongo.ErrNoDocuments) {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\treturn errors.Wrap(err, \"get lock data\")\n\t\t\t}\n\t\t\tclusterTime, err := pbmClient.ClusterTime()\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"read cluster time\")\n\t\t\t}\n\t\t\tif lock.Heartbeat.T+pbm.StaleFrameSec < clusterTime.T {\n\t\t\t\treturn errors.Errorf(\"operation stale, last beat ts: %d\", lock.Heartbeat.T)\n\t\t\t}\n\t\t}\n\t}\n}", "func MWAIT() { ctx.MWAIT() }", "func (f WaiterFunc) Wait(ctx context.Context) error {\n\treturn f(ctx)\n}", "func GxWait(children ...Element) *CompoundElement { return newCE(\"gx:Wait\", children) }", "func (e *PythonOp) waitOnRequest(requestID int, x interface{}) error {\n\tfor e.pendingRequests[requestID] == nil && e.err == nil {\n\t\te.cond.Wait()\n\t}\n\tif e.err != nil {\n\t\treturn e.err\n\t}\n\tif x != nil {\n\t\terr := json.Unmarshal([]byte(*e.pendingRequests[requestID]), x)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (t *SyncTransport) Wait() {}", "func (resp *ActionVpsConfigCreateResponse) WaitForOperation(timeout float64) (*ActionActionStatePollResponse, error) {\n\treq := resp.Action.Client.ActionState.Poll.Prepare()\n\treq.SetPathParamInt(\"action_state_id\", resp.Response.Meta.ActionStateId)\n\n\tinput := req.NewInput()\n\tinput.SetTimeout(timeout)\n\n\treturn req.Call()\n}", "func (op *delayedRouteOperation) wait() error {\n\treturn <-op.result\n}", "func (ow *ordered[T, U]) Wait() []U {\n\tow.wg.Wait()\n\treturn ow.results\n}", "func (_PermInterface *PermInterfaceCallerSession) GetPendingOp(_orgId string) (string, string, common.Address, *big.Int, error) {\n\treturn _PermInterface.Contract.GetPendingOp(&_PermInterface.CallOpts, _orgId)\n}", "func (resp *ActionVpsFeatureUpdateAllResponse) WatchOperation(timeout float64, updateIn float64, callback OperationProgressCallback) (*ActionActionStatePollResponse, error) {\n\treq := resp.Action.Client.ActionState.Poll.Prepare()\n\treq.SetPathParamInt(\"action_state_id\", resp.Response.Meta.ActionStateId)\n\n\tinput := req.NewInput()\n\tinput.SetTimeout(timeout)\n\tinput.SetUpdateIn(updateIn)\n\n\tpollResp, err := req.Call()\n\n\tif err != nil {\n\t\treturn pollResp, err\n\t} else if pollResp.Output.Finished {\n\t\treturn pollResp, nil\n\t}\n\n\tif callback(pollResp.Output) == StopWatching {\n\t\treturn pollResp, nil\n\t}\n\n\tfor {\n\t\treq = resp.Action.Client.ActionState.Poll.Prepare()\n\t\treq.SetPathParamInt(\"action_state_id\", resp.Response.Meta.ActionStateId)\n\t\treq.SetInput(&ActionActionStatePollInput{\n\t\t\tTimeout: timeout,\n\t\t\tUpdateIn: updateIn,\n\t\t\tStatus: pollResp.Output.Status,\n\t\t\tCurrent: pollResp.Output.Current,\n\t\t\tTotal: pollResp.Output.Total,\n\t\t})\n\t\tpollResp, err = req.Call()\n\n\t\tif err != nil {\n\t\t\treturn pollResp, err\n\t\t} else if pollResp.Output.Finished {\n\t\t\treturn pollResp, nil\n\t\t}\n\n\t\tif callback(pollResp.Output) == StopWatching {\n\t\t\treturn pollResp, nil\n\t\t}\n\t}\n}", "func wait(ctx context.Context, c TimedActuator,\n\tresChan chan error, cancel context.CancelFunc) error {\n\tif timeout := c.GetTimeout(); timeout != nil {\n\t\treturn waitWithTimeout(ctx, resChan, *timeout, cancel)\n\t}\n\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn nil\n\t\tcase err := <-resChan:\n\t\t\tif err != nil {\n\t\t\t\tcancel()\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n}", "func (g *grid) Wait() {\n\tif g.cond != nil {\n\t\tg.cond.L.Lock()\n\t\tg.cond.Wait()\n\t\tg.cond.L.Unlock()\n\t}\n}", "func ReserveForWaitServiceIdle(ctx context.Context) (context.Context, context.CancelFunc) {\n\treturn ctxutil.Shorten(ctx, waitServiceIdleTime)\n}", "func Wait() {\n\tdefaultManager.Wait()\n}", "func (op *AddonOperator) HandleGlobalHookEnableKubernetesBindings(t sh_task.Task, labels map[string]string) (res queue.TaskResult) {\n\tdefer trace.StartRegion(context.Background(), \"DiscoverHelmReleases\").End()\n\n\tlogEntry := log.WithFields(utils.LabelsToLogFields(labels))\n\tlogEntry.Debugf(\"Global hook enable kubernetes bindings\")\n\n\thm := task.HookMetadataAccessor(t)\n\tglobalHook := op.ModuleManager.GetGlobalHook(hm.HookName)\n\n\tmainSyncTasks := make([]sh_task.Task, 0)\n\tparallelSyncTasks := make([]sh_task.Task, 0)\n\tparallelSyncTasksToWait := make([]sh_task.Task, 0)\n\tqueuedAt := time.Now()\n\n\tnewLogLabels := utils.MergeLabels(t.GetLogLabels())\n\tdelete(newLogLabels, \"task.id\")\n\n\terr := op.ModuleManager.HandleGlobalEnableKubernetesBindings(hm.HookName, func(hook *module_manager.GlobalHook, info controller.BindingExecutionInfo) {\n\t\ttaskLogLabels := utils.MergeLabels(t.GetLogLabels(), map[string]string{\n\t\t\t\"binding\": string(htypes.OnKubernetesEvent) + \"Synchronization\",\n\t\t\t\"hook\": hook.GetName(),\n\t\t\t\"hook.type\": \"global\",\n\t\t\t\"queue\": info.QueueName,\n\t\t})\n\t\tif len(info.BindingContext) > 0 {\n\t\t\ttaskLogLabels[\"binding.name\"] = info.BindingContext[0].Binding\n\t\t}\n\t\tdelete(taskLogLabels, \"task.id\")\n\n\t\tkubernetesBindingID := uuid.NewV4().String()\n\t\tnewTask := sh_task.NewTask(task.GlobalHookRun).\n\t\t\tWithLogLabels(taskLogLabels).\n\t\t\tWithQueueName(info.QueueName).\n\t\t\tWithMetadata(task.HookMetadata{\n\t\t\t\tEventDescription: hm.EventDescription,\n\t\t\t\tHookName: hook.GetName(),\n\t\t\t\tBindingType: htypes.OnKubernetesEvent,\n\t\t\t\tBindingContext: info.BindingContext,\n\t\t\t\tAllowFailure: info.AllowFailure,\n\t\t\t\tReloadAllOnValuesChanges: false, // Ignore global values changes in global Synchronization tasks.\n\t\t\t\tKubernetesBindingId: kubernetesBindingID,\n\t\t\t\tWaitForSynchronization: info.KubernetesBinding.WaitForSynchronization,\n\t\t\t\tMonitorIDs: []string{info.KubernetesBinding.Monitor.Metadata.MonitorId},\n\t\t\t\tExecuteOnSynchronization: info.KubernetesBinding.ExecuteHookOnSynchronization,\n\t\t\t})\n\t\tnewTask.WithQueuedAt(queuedAt)\n\n\t\tif info.QueueName == t.GetQueueName() {\n\t\t\t// Ignore \"waitForSynchronization: false\" for hooks in the main queue.\n\t\t\t// There is no way to not wait for these hooks.\n\t\t\tmainSyncTasks = append(mainSyncTasks, newTask)\n\t\t} else {\n\t\t\t// Do not wait for parallel hooks on \"waitForSynchronization: false\".\n\t\t\tif info.KubernetesBinding.WaitForSynchronization {\n\t\t\t\tparallelSyncTasksToWait = append(parallelSyncTasksToWait, newTask)\n\t\t\t} else {\n\t\t\t\tparallelSyncTasks = append(parallelSyncTasks, newTask)\n\t\t\t}\n\t\t}\n\t})\n\tif err != nil {\n\t\thookLabel := path.Base(globalHook.Path)\n\t\t// TODO use separate metric, as in shell-operator?\n\t\top.MetricStorage.CounterAdd(\"{PREFIX}global_hook_errors_total\", 1.0, map[string]string{\n\t\t\t\"hook\": hookLabel,\n\t\t\t\"binding\": \"GlobalEnableKubernetesBindings\",\n\t\t\t\"queue\": t.GetQueueName(),\n\t\t\t\"activation\": \"OperatorStartup\",\n\t\t})\n\t\tlogEntry.Errorf(\"Global hook enable kubernetes bindings failed, requeue task to retry after delay. Failed count is %d. Error: %s\", t.GetFailureCount()+1, err)\n\t\tt.UpdateFailureMessage(err.Error())\n\t\tt.WithQueuedAt(queuedAt)\n\t\tres.Status = queue.Fail\n\t\treturn\n\t}\n\t// Substitute current task with Synchronization tasks for the main queue.\n\t// Other Synchronization tasks are queued into specified queues.\n\t// Informers can be started now — their events will be added to the queue tail.\n\tlogEntry.Debugf(\"Global hook enable kubernetes bindings success\")\n\n\t// \"Wait\" tasks are queued first\n\tfor _, tsk := range parallelSyncTasksToWait {\n\t\tq := op.TaskQueues.GetByName(tsk.GetQueueName())\n\t\tif q == nil {\n\t\t\tlog.Errorf(\"Queue %s is not created while run GlobalHookEnableKubernetesBindings task!\", tsk.GetQueueName())\n\t\t} else {\n\t\t\t// Skip state creation if WaitForSynchronization is disabled.\n\t\t\tthm := task.HookMetadataAccessor(tsk)\n\t\t\tq.AddLast(tsk)\n\t\t\top.ModuleManager.GlobalSynchronizationState().QueuedForBinding(thm)\n\t\t}\n\t}\n\top.logTaskAdd(logEntry, \"append\", parallelSyncTasksToWait...)\n\n\tfor _, tsk := range parallelSyncTasks {\n\t\tq := op.TaskQueues.GetByName(tsk.GetQueueName())\n\t\tif q == nil {\n\t\t\tlog.Errorf(\"Queue %s is not created while run GlobalHookEnableKubernetesBindings task!\", tsk.GetQueueName())\n\t\t} else {\n\t\t\tq.AddLast(tsk)\n\t\t}\n\t}\n\top.logTaskAdd(logEntry, \"append\", parallelSyncTasks...)\n\n\t// Note: No need to add \"main\" Synchronization tasks to the GlobalSynchronizationState.\n\tres.HeadTasks = mainSyncTasks\n\top.logTaskAdd(logEntry, \"head\", mainSyncTasks...)\n\n\tres.Status = queue.Success\n\n\treturn\n}", "func (w *LimitedConcurrencySingleFlight) Wait() {\n\tw.inflightCalls.Wait()\n}", "func (p *WorkerPool[T, R]) Wait() {\n\tp.wg.Wait()\n}", "func (_PermInterface *PermInterfaceSession) GetPendingOp(_orgId string) (string, string, common.Address, *big.Int, error) {\n\treturn _PermInterface.Contract.GetPendingOp(&_PermInterface.CallOpts, _orgId)\n}", "func (cli *CLI) SystemWaitReady() {\n\tintervalSec := time.Duration(3)\n\tutil.Panic(wait.PollImmediateInfinite(intervalSec*time.Second, func() (bool, error) {\n\t\tsys := &nbv1.NooBaa{}\n\t\terr := cli.Client.Get(cli.Ctx, client.ObjectKey{Namespace: cli.Namespace, Name: cli.SystemName}, sys)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\tif sys.Status.Phase == nbv1.SystemPhaseReady {\n\t\t\tcli.Log.Printf(\"✅ System Phase is \\\"%s\\\".\\n\", sys.Status.Phase)\n\t\t\treturn true, nil\n\t\t}\n\t\tif sys.Status.Phase == nbv1.SystemPhaseRejected {\n\t\t\treturn false, fmt.Errorf(\"❌ System Phase is \\\"%s\\\". describe noobaa for more information\", sys.Status.Phase)\n\t\t}\n\t\tcli.Log.Printf(\"⏳ System Phase is \\\"%s\\\". Waiting for it to be ready ...\\n\", sys.Status.Phase)\n\t\treturn false, nil\n\t}))\n}", "func (m *HeavySyncMock) Wait(timeout time.Duration) {\n\tm.MinimockWait(timeout)\n}", "func (e *engine) Wait(context.Context, *Spec, *Step) (*State, error) {\n\treturn nil, nil // no-op for bash implementation\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 (k *k8sService) waitForAPIServerOrCancel() {\n\tii := 0\n\tticker := time.NewTicker(waitTime)\n\tdefer ticker.Stop()\n\tvar err error\n\tfor {\n\t\tselect {\n\t\tcase <-k.ctx.Done():\n\t\t\tk.Done()\n\t\t\tlog.Infof(\"k8sService waitForAPIServerOrCancel canceled\")\n\t\t\treturn\n\t\tcase <-ticker.C:\n\t\t\tif _, err = k.client.ExtensionsV1beta1().DaemonSets(defaultNS).List(metav1.ListOptions{}); err == nil {\n\t\t\t\terr := programClusterConfig(k.client)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Errorf(\"Error programming Kubernetes cluster-level config: %v\", err)\n\t\t\t\t}\n\t\t\t\tgo k.runUntilCancel()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tii++\n\t\t\tif ii%10 == 0 {\n\t\t\t\tlog.Errorf(\"Waiting for K8s apiserver to come up for %v seconds. been observing(%s)\", ii, err)\n\t\t\t}\n\t\t}\n\t}\n}", "func (o *operation) waitExecution(bq *InMemoryBuildQueue, out remoteexecution.Execution_ExecuteServer) error {\n\tctx := out.Context()\n\n\t// Bookkeeping for determining whether operations are abandoned\n\t// by clients. Operations should be removed if there are no\n\t// clients calling Execute() or WaitExecution() for a certain\n\t// amount of time.\n\tif o.cleanupKey.isActive() {\n\t\tbq.cleanupQueue.remove(o.cleanupKey)\n\t}\n\to.waiters++\n\tdefer func() {\n\t\tif o.waiters == 0 {\n\t\t\tpanic(\"Invalid waiters count on operation\")\n\t\t}\n\t\to.waiters--\n\t\to.maybeStartCleanup(bq)\n\t}()\n\n\tt := o.task\n\tfor {\n\t\t// Construct the longrunning.Operation that needs to be\n\t\t// sent back to the client.\n\t\tmetadata, err := anypb.New(&remoteexecution.ExecuteOperationMetadata{\n\t\t\tStage: t.getStage(),\n\t\t\tActionDigest: t.desiredState.ActionDigest,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn util.StatusWrap(err, \"Failed to marshal execute operation metadata\")\n\t\t}\n\t\toperation := &longrunning.Operation{\n\t\t\tName: o.name,\n\t\t\tMetadata: metadata,\n\t\t}\n\t\tif t.executeResponse != nil {\n\t\t\toperation.Done = true\n\t\t\tresponse, err := anypb.New(t.executeResponse)\n\t\t\tif err != nil {\n\t\t\t\treturn util.StatusWrap(err, \"Failed to marshal execute response\")\n\t\t\t}\n\t\t\toperation.Result = &longrunning.Operation_Response{Response: response}\n\t\t}\n\t\tstageChangeWakeup := t.stageChangeWakeup\n\t\tbq.leave()\n\n\t\t// Send the longrunning.Operation back to the client.\n\t\tif err := out.Send(operation); operation.Done || err != nil {\n\t\t\tbq.enter(bq.clock.Now())\n\t\t\treturn err\n\t\t}\n\n\t\t// Suspend until the client closes the connection, the\n\t\t// action completes or a certain amount of time has\n\t\t// passed without any updates.\n\t\ttimer, timerChannel := bq.clock.NewTimer(bq.configuration.ExecutionUpdateInterval)\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\ttimer.Stop()\n\t\t\tbq.enter(bq.clock.Now())\n\t\t\treturn util.StatusFromContext(ctx)\n\t\tcase <-stageChangeWakeup:\n\t\t\ttimer.Stop()\n\t\t\tbq.enter(bq.clock.Now())\n\t\tcase t := <-timerChannel:\n\t\t\tbq.enter(t)\n\t\t}\n\t}\n}", "func (fn *FolderNode) waitAvailable() bool {\n\tselect {\n\tcase <-fn.stop:\n\t\treturn false\n\tdefault:\n\t\tselect {\n\t\tcase <-fn.ava:\n\t\t\treturn true\n\t\tcase <-fn.stop:\n\t\t\treturn false\n\t\t}\n\t}\n}", "func (container *container) WaitTimeout(timeout time.Duration) error {\r\n\tcontainer.waitOnce.Do(func() {\r\n\t\tcontainer.waitCh = make(chan struct{})\r\n\t\tgo func() {\r\n\t\t\tcontainer.waitErr = container.Wait()\r\n\t\t\tclose(container.waitCh)\r\n\t\t}()\r\n\t})\r\n\tt := time.NewTimer(timeout)\r\n\tdefer t.Stop()\r\n\tselect {\r\n\tcase <-t.C:\r\n\t\treturn &ContainerError{Container: container, Err: ErrTimeout, Operation: \"hcsshim::ComputeSystem::Wait\"}\r\n\tcase <-container.waitCh:\r\n\t\treturn container.waitErr\r\n\t}\r\n}", "func (op *TransferEntitlementsToGoogleOperation) Wait(ctx context.Context, opts ...gax.CallOption) error {\n\topts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...)\n\treturn op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...)\n}", "func WaitUntil(c *check.C, f CheckFunc) {\n\tc.Log(\"wait start\")\n\tfor i := 0; i < waitMaxRetry; i++ {\n\t\tif f(c) {\n\t\t\treturn\n\t\t}\n\t\ttime.Sleep(waitRetrySleep)\n\t}\n\tc.Fatal(\"wait timeout\")\n}", "func Poll(\n\tctx context.Context,\n\tstopc chan struct{},\n\tlg *zap.Logger,\n\teksAPI eksiface.EKSAPI,\n\tclusterName string,\n\tmngName string,\n\tdesiredNodeGroupStatus string,\n\tinitialWait time.Duration,\n\twait time.Duration,\n) <-chan ManagedNodeGroupStatus {\n\tlg.Info(\"polling mng\",\n\t\tzap.String(\"cluster-name\", clusterName),\n\t\tzap.String(\"mng-name\", mngName),\n\t\tzap.String(\"desired-status\", desiredNodeGroupStatus),\n\t)\n\n\tnow := time.Now()\n\n\tch := make(chan ManagedNodeGroupStatus, 10)\n\tgo func() {\n\t\t// very first poll should be no-wait\n\t\t// in case stack has already reached desired status\n\t\t// wait from second interation\n\t\twaitDur := time.Duration(0)\n\n\t\tfirst := true\n\t\tfor ctx.Err() == nil {\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\tlg.Warn(\"wait aborted\", zap.Error(ctx.Err()))\n\t\t\t\tch <- ManagedNodeGroupStatus{NodeGroupName: mngName, NodeGroup: nil, Error: ctx.Err()}\n\t\t\t\tclose(ch)\n\t\t\t\treturn\n\n\t\t\tcase <-stopc:\n\t\t\t\tlg.Warn(\"wait stopped\", zap.Error(ctx.Err()))\n\t\t\t\tch <- ManagedNodeGroupStatus{NodeGroupName: mngName, NodeGroup: nil, Error: errors.New(\"wait stopped\")}\n\t\t\t\tclose(ch)\n\t\t\t\treturn\n\n\t\t\tcase <-time.After(waitDur):\n\t\t\t\t// very first poll should be no-wait\n\t\t\t\t// in case stack has already reached desired status\n\t\t\t\t// wait from second interation\n\t\t\t\tif waitDur == time.Duration(0) {\n\t\t\t\t\twaitDur = wait\n\t\t\t\t}\n\t\t\t}\n\n\t\t\toutput, err := eksAPI.DescribeNodegroup(&aws_eks.DescribeNodegroupInput{\n\t\t\t\tClusterName: aws.String(clusterName),\n\t\t\t\tNodegroupName: aws.String(mngName),\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\tif IsDeleted(err) {\n\t\t\t\t\tif desiredNodeGroupStatus == ManagedNodeGroupStatusDELETEDORNOTEXIST {\n\t\t\t\t\t\tlg.Info(\"managed node group is already deleted as desired; exiting\", zap.Error(err))\n\t\t\t\t\t\tch <- ManagedNodeGroupStatus{NodeGroupName: mngName, NodeGroup: nil, Error: nil}\n\t\t\t\t\t\tclose(ch)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tlg.Warn(\"managed node group does not exist\", zap.Error(err))\n\t\t\t\t\tch <- ManagedNodeGroupStatus{NodeGroupName: mngName, NodeGroup: nil, Error: err}\n\t\t\t\t\tclose(ch)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tlg.Warn(\"describe managed node group failed; retrying\", zap.Error(err))\n\t\t\t\tch <- ManagedNodeGroupStatus{NodeGroupName: mngName, NodeGroup: nil, Error: err}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif output.Nodegroup == nil {\n\t\t\t\tlg.Warn(\"expected non-nil managed node group; retrying\")\n\t\t\t\tch <- ManagedNodeGroupStatus{NodeGroupName: mngName, NodeGroup: nil, Error: fmt.Errorf(\"unexpected empty response %+v\", output.GoString())}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tnodeGroup := output.Nodegroup\n\t\t\tcurrentStatus := aws.StringValue(nodeGroup.Status)\n\t\t\tlg.Info(\"poll\",\n\t\t\t\tzap.String(\"cluster-name\", clusterName),\n\t\t\t\tzap.String(\"mng-name\", mngName),\n\t\t\t\tzap.String(\"status\", currentStatus),\n\t\t\t\tzap.String(\"started\", humanize.RelTime(now, time.Now(), \"ago\", \"from now\")),\n\t\t\t)\n\t\t\tswitch currentStatus {\n\t\t\tcase desiredNodeGroupStatus:\n\t\t\t\tch <- ManagedNodeGroupStatus{NodeGroupName: mngName, NodeGroup: nodeGroup, Error: nil}\n\t\t\t\tlg.Info(\"desired managed node group status; done\", zap.String(\"status\", currentStatus))\n\t\t\t\tclose(ch)\n\t\t\t\treturn\n\t\t\tcase aws_eks.NodegroupStatusCreateFailed,\n\t\t\t\taws_eks.NodegroupStatusDeleteFailed,\n\t\t\t\taws_eks.NodegroupStatusDegraded:\n\t\t\t\tch <- ManagedNodeGroupStatus{NodeGroupName: mngName, NodeGroup: nodeGroup, Error: fmt.Errorf(\"unexpected mng status %q\", currentStatus)}\n\t\t\t\tclose(ch)\n\t\t\t\treturn\n\t\t\tdefault:\n\t\t\t\tch <- ManagedNodeGroupStatus{NodeGroupName: mngName, NodeGroup: nodeGroup, Error: nil}\n\t\t\t}\n\n\t\t\tif first {\n\t\t\t\tlg.Info(\"sleeping\", zap.Duration(\"initial-wait\", initialWait))\n\t\t\t\tselect {\n\t\t\t\tcase <-ctx.Done():\n\t\t\t\t\tlg.Warn(\"wait aborted\", zap.Error(ctx.Err()))\n\t\t\t\t\tch <- ManagedNodeGroupStatus{NodeGroupName: mngName, NodeGroup: nil, Error: ctx.Err()}\n\t\t\t\t\tclose(ch)\n\t\t\t\t\treturn\n\t\t\t\tcase <-stopc:\n\t\t\t\t\tlg.Warn(\"wait stopped\", zap.Error(ctx.Err()))\n\t\t\t\t\tch <- ManagedNodeGroupStatus{NodeGroupName: mngName, NodeGroup: nil, Error: errors.New(\"wait stopped\")}\n\t\t\t\t\tclose(ch)\n\t\t\t\t\treturn\n\t\t\t\tcase <-time.After(initialWait):\n\t\t\t\t}\n\t\t\t\tfirst = false\n\t\t\t}\n\t\t}\n\n\t\tlg.Warn(\"wait aborted\", zap.Error(ctx.Err()))\n\t\tch <- ManagedNodeGroupStatus{NodeGroupName: mngName, NodeGroup: nil, Error: ctx.Err()}\n\t\tclose(ch)\n\t\treturn\n\t}()\n\treturn ch\n}", "func (p *GoshPool) StopWait() {\n\tp.stop(true)\n}", "func (a API) GetCurrentNetWait(cmd *None) (out *string, e error) {\n\tRPCHandlers[\"getcurrentnet\"].Call <-API{a.Ch, cmd, nil}\n\tselect {\n\tcase <-time.After(time.Second*5):\n\t\tbreak\n\tcase o := <-a.Ch.(chan GetCurrentNetRes):\n\t\tout, e = o.Res, o.Err\n\t}\n\treturn\n}", "func (d *InMemoryTaskDB) Wait() {\n\td.modClientsWg.Wait()\n}", "func (c *ConsensusState) wakeUpWaitCompleteOp() {\n\tfor _, op := range c.waitCompleteOp {\n\t\top.result = c.GetOrderedBGStateResponse()\n\t\top.wait <- true\n\t}\n\t// clean up waiting list\n\tc.waitCompleteOp = make([]*WaitCycleComplete, 0)\n}", "func (m *RecentIndexStorageMock) Wait(timeout time.Duration) {\n\tm.MinimockWait(timeout)\n}", "func (p *Provider) wait() {\n\t// Compute the backoff time\n\tbackoff := p.backoffDuration()\n\n\t// Setup a wait timer\n\tvar wait <-chan time.Time\n\tif backoff > 0 {\n\t\tjitter := time.Duration(rand.Uint32()) % backoff\n\t\twait = time.After(backoff + jitter)\n\t}\n\n\t// Wait until timer or shutdown\n\tselect {\n\tcase <-wait:\n\tcase <-p.shutdownCh:\n\t}\n}", "func TestExecuteRunnerStatusNoNet(t *testing.T) {\n\tbuf := setLogBuffer()\n\tdefer func() {\n\t\tif t.Failed() {\n\t\t\tt.Log(buf.String())\n\t\t}\n\t}()\n\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\tdefer cancel()\n\n\tvar zoo myCall\n\n\tpool, err := NewSystemTestNodePoolNoNet()\n\tif err != nil {\n\t\tt.Fatalf(\"Creating Node Pool failed %v\", err)\n\t}\n\n\trunners, err := pool.Runners(context.Background(), &zoo)\n\tif err != nil {\n\t\tt.Fatalf(\"Getting Runners from Pool failed %v\", err)\n\t}\n\tif len(runners) == 0 {\n\t\tt.Fatalf(\"Getting Runners from Pool failed no-runners\")\n\t}\n\n\tfor _, dest := range runners {\n\t\tstatus, err := dest.Status(ctx)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"Runners Status failed for %v err=%v\", dest.Address(), err)\n\t\t}\n\t\tif status == nil || status.StatusFailed {\n\t\t\tt.Fatalf(\"Runners Status not OK for %v %v\", dest.Address(), status)\n\t\t}\n\t\tif !status.IsNetworkDisabled {\n\t\t\tt.Fatalf(\"Runners Status should have NO network enabled %v %v\", dest.Address(), status)\n\t\t}\n\t\tt.Logf(\"Runner %v got Status=%+v\", dest.Address(), status)\n\t}\n\n\tf, err := os.Create(StatusBarrierFile)\n\tif err != nil {\n\t\tt.Fatalf(\"create file=%v failed err=%v\", StatusBarrierFile, err)\n\t}\n\tf.Close()\n\n\t// Let status hc caches expire.\n\tselect {\n\tcase <-time.After(time.Duration(2 * time.Second)):\n\tcase <-ctx.Done():\n\t\tt.Fatal(\"Timeout\")\n\t}\n\n\tfor _, dest := range runners {\n\t\tstatus, err := dest.Status(ctx)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"Runners Status failed for %v err=%v\", dest.Address(), err)\n\t\t}\n\t\tif status == nil || status.StatusFailed {\n\t\t\tt.Fatalf(\"Runners Status not OK for %v %v\", dest.Address(), status)\n\t\t}\n\t\tif status.IsNetworkDisabled {\n\t\t\tt.Fatalf(\"Runners Status should have network enabled %v %v\", dest.Address(), status)\n\t\t}\n\t\tt.Logf(\"Runner %v got Status=%+v\", dest.Address(), status)\n\t}\n\n}", "func (g *Group) Wait() error", "func (b *basebackup) Wait() {\n\tb.wg.Wait()\n}", "func (aio *AsyncIO) waitAll() {\n\taio.trigger <- struct{}{}\n\t<-aio.trigger\n}", "func (s *pauseSuite) BenchmarkWaitNoOp(c *C) {\n\tp := common.NewPauser()\n\tctx := context.Background()\n\tfor i := 0; i < c.N; i++ {\n\t\t_ = p.Wait(ctx)\n\t}\n}", "func (_m *MockWaiter) Wait() {\n\t_m.Called()\n}", "func (s policyTestStep) waitChecks(t *testing.T, contextMap map[string]string) {\n\tif base.ShouldPolicyWaitOnGet() {\n\t\terr := waitAllGetChecks(s.getChecks, contextMap)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"GET check wait failed: %v\", err)\n\t\t}\n\t} else {\n\t\tif len(s.getChecks) > 0 {\n\t\t\tlog.Printf(\"Running single GET checks, as configured on the environment\")\n\t\t\tfor _, check := range s.getChecks {\n\t\t\t\tok, err := check.check(contextMap)\n\t\t\t\tif err != nil {\n\t\t\t\t\terrMsg := fmt.Sprintf(\"GET check %v failed: %v\", check, err)\n\t\t\t\t\tlog.Print(errMsg)\n\t\t\t\t\tt.Errorf(errMsg)\n\t\t\t\t}\n\t\t\t\tif !ok {\n\t\t\t\t\terrMsg := fmt.Sprintf(\"GET check %v returned incorrect response\", check)\n\t\t\t\t\tlog.Print(errMsg)\n\t\t\t\t\tt.Errorf(errMsg)\n\t\t\t\t}\n\t\t\t}\n\t\t\tlog.Printf(\"All tests pass\")\n\t\t}\n\t}\n}", "func VertexAIOperationWaitTime(config *transport_tpg.Config, op map[string]interface{}, project, activity, userAgent string, timeout time.Duration) error {\n\treturn vertexai.VertexAIOperationWaitTime(config, op, project, activity, userAgent, timeout)\n}", "func waitReady(project, name, region string) error {\n\twait := time.Minute * 4\n\tdeadline := time.Now().Add(wait)\n\tfor time.Now().Before(deadline) {\n\t\tsvc, err := getService(project, name, region)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to query Service for readiness: %w\", err)\n\t\t}\n\n\t\tfor _, cond := range svc.Status.Conditions {\n\t\t\tif cond.Type == \"Ready\" {\n\t\t\t\tif cond.Status == \"True\" {\n\t\t\t\t\treturn nil\n\t\t\t\t} else if cond.Status == \"False\" {\n\t\t\t\t\treturn fmt.Errorf(\"reason=%s message=%s\", cond.Reason, cond.Message)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\ttime.Sleep(time.Second * 2)\n\t}\n\treturn fmt.Errorf(\"the service did not become ready in %s, check Cloud Console for logs to see why it failed\", wait)\n}", "func (c *workflowsServiceV2BetaRESTClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator {\n\tit := &OperationIterator{}\n\treq = proto.Clone(req).(*longrunningpb.ListOperationsRequest)\n\tunm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}\n\tit.InternalFetch = func(pageSize int, pageToken string) ([]*longrunningpb.Operation, string, error) {\n\t\tresp := &longrunningpb.ListOperationsResponse{}\n\t\tif pageToken != \"\" {\n\t\t\treq.PageToken = pageToken\n\t\t}\n\t\tif pageSize > math.MaxInt32 {\n\t\t\treq.PageSize = math.MaxInt32\n\t\t} else if pageSize != 0 {\n\t\t\treq.PageSize = int32(pageSize)\n\t\t}\n\t\tbaseUrl, err := url.Parse(c.endpoint)\n\t\tif err != nil {\n\t\t\treturn nil, \"\", err\n\t\t}\n\t\tbaseUrl.Path += fmt.Sprintf(\"/v2beta/%v/operations\", req.GetName())\n\n\t\tparams := url.Values{}\n\t\tparams.Add(\"$alt\", \"json;enum-encoding=int\")\n\t\tif req.GetFilter() != \"\" {\n\t\t\tparams.Add(\"filter\", fmt.Sprintf(\"%v\", req.GetFilter()))\n\t\t}\n\t\tif req.GetPageSize() != 0 {\n\t\t\tparams.Add(\"pageSize\", fmt.Sprintf(\"%v\", req.GetPageSize()))\n\t\t}\n\t\tif req.GetPageToken() != \"\" {\n\t\t\tparams.Add(\"pageToken\", fmt.Sprintf(\"%v\", req.GetPageToken()))\n\t\t}\n\n\t\tbaseUrl.RawQuery = params.Encode()\n\n\t\t// Build HTTP headers from client and context metadata.\n\t\thds := append(c.xGoogHeaders, \"Content-Type\", \"application/json\")\n\t\theaders := gax.BuildHeaders(ctx, hds...)\n\t\te := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {\n\t\t\tif settings.Path != \"\" {\n\t\t\t\tbaseUrl.Path = settings.Path\n\t\t\t}\n\t\t\thttpReq, err := http.NewRequest(\"GET\", baseUrl.String(), nil)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\thttpReq.Header = headers\n\n\t\t\thttpRsp, err := c.httpClient.Do(httpReq)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tdefer httpRsp.Body.Close()\n\n\t\t\tif err = googleapi.CheckResponse(httpRsp); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tbuf, err := io.ReadAll(httpRsp.Body)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif err := unm.Unmarshal(buf, resp); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\treturn nil\n\t\t}, opts...)\n\t\tif e != nil {\n\t\t\treturn nil, \"\", e\n\t\t}\n\t\tit.Response = resp\n\t\treturn resp.GetOperations(), resp.GetNextPageToken(), nil\n\t}\n\n\tfetch := func(pageSize int, pageToken string) (string, error) {\n\t\titems, nextPageToken, err := it.InternalFetch(pageSize, pageToken)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tit.items = append(it.items, items...)\n\t\treturn nextPageToken, nil\n\t}\n\n\tit.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)\n\tit.pageInfo.MaxSize = int(req.GetPageSize())\n\tit.pageInfo.Token = req.GetPageToken()\n\n\treturn it\n}", "func (w *Window) refreshWait() {\n\tC.glfwSwapBuffers(w.glfwWin)\n}", "func Wait() {\n\twg.Wait()\n}", "func TestWait_timeout(t *testing.T) {\n\tdefer check(t)\n\tcontent := \"hello world!\"\n\treq := &showcasepb.WaitRequest{\n\t\tEnd: &showcasepb.WaitRequest_Ttl{\n\t\t\tTtl: &durationpb.Duration{Seconds: 1},\n\t\t},\n\t\tResponse: &showcasepb.WaitRequest_Success{\n\t\t\tSuccess: &showcasepb.WaitResponse{Content: content},\n\t\t},\n\t}\n\tctx, cancel := context.WithTimeout(context.Background(), 100*time.Millisecond)\n\tdefer cancel()\n\n\top, err := echo.Wait(ctx, req)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tresp, err := op.Wait(ctx)\n\tif err == nil {\n\t\tt.Errorf(\"Wait() = %+v, want error\", resp)\n\t}\n}", "func (resp *ActionVpsConfigCreateResponse) WatchOperation(timeout float64, updateIn float64, callback OperationProgressCallback) (*ActionActionStatePollResponse, error) {\n\treq := resp.Action.Client.ActionState.Poll.Prepare()\n\treq.SetPathParamInt(\"action_state_id\", resp.Response.Meta.ActionStateId)\n\n\tinput := req.NewInput()\n\tinput.SetTimeout(timeout)\n\tinput.SetUpdateIn(updateIn)\n\n\tpollResp, err := req.Call()\n\n\tif err != nil {\n\t\treturn pollResp, err\n\t} else if pollResp.Output.Finished {\n\t\treturn pollResp, nil\n\t}\n\n\tif callback(pollResp.Output) == StopWatching {\n\t\treturn pollResp, nil\n\t}\n\n\tfor {\n\t\treq = resp.Action.Client.ActionState.Poll.Prepare()\n\t\treq.SetPathParamInt(\"action_state_id\", resp.Response.Meta.ActionStateId)\n\t\treq.SetInput(&ActionActionStatePollInput{\n\t\t\tTimeout: timeout,\n\t\t\tUpdateIn: updateIn,\n\t\t\tStatus: pollResp.Output.Status,\n\t\t\tCurrent: pollResp.Output.Current,\n\t\t\tTotal: pollResp.Output.Total,\n\t\t})\n\t\tpollResp, err = req.Call()\n\n\t\tif err != nil {\n\t\t\treturn pollResp, err\n\t\t} else if pollResp.Output.Finished {\n\t\t\treturn pollResp, nil\n\t\t}\n\n\t\tif callback(pollResp.Output) == StopWatching {\n\t\t\treturn pollResp, nil\n\t\t}\n\t}\n}", "func (s *BasePlSqlParserListener) ExitWait_nowait_part(ctx *Wait_nowait_partContext) {}", "func (r *Release) getWait() []string {\n\tres := []string{}\n\tif r.Wait.Value {\n\t\tres = append(res, \"--wait\")\n\t}\n\treturn res\n}", "func (ep *defaultEventProcessor) waitUntilInactive() {\n\tm := syncEventsMessage{replyCh: make(chan struct{})}\n\tep.inputCh <- m\n\t<-m.replyCh // Now we know that all events prior to this call have been processed\n}", "func (c *ConsensusState) wakeUpJustWaitCompleteOp() {\n\tfor _, op := range c.justWaitCompleteOp {\n\t\top.wait <- true\n\t}\n\t// clean up waiting list\n\tc.justWaitCompleteOp = make([]*JustWaitCycleComplete, 0)\n}", "func (_PermInterface *PermInterfaceCaller) GetPendingOp(opts *bind.CallOpts, _orgId string) (string, string, common.Address, *big.Int, error) {\n\tvar out []interface{}\n\terr := _PermInterface.contract.Call(opts, &out, \"getPendingOp\", _orgId)\n\n\tif err != nil {\n\t\treturn *new(string), *new(string), *new(common.Address), *new(*big.Int), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(string)).(*string)\n\tout1 := *abi.ConvertType(out[1], new(string)).(*string)\n\tout2 := *abi.ConvertType(out[2], new(common.Address)).(*common.Address)\n\tout3 := *abi.ConvertType(out[3], new(*big.Int)).(**big.Int)\n\n\treturn out0, out1, out2, out3, err\n\n}", "func (b *Bucket) OperationTimeout() time.Duration {\n\treturn b.opTimeout\n}", "func (c *Client) Wait(cluster, service, arn string) error {\n\tt := time.NewTicker(c.pollInterval)\n\tfor {\n\t\tselect {\n\t\tcase <-t.C:\n\t\t\ts, err := c.GetDeployment(cluster, service, arn)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tc.logger.Printf(\"[info] --> desired: %d, pending: %d, running: %d\", *s.DesiredCount, *s.PendingCount, *s.RunningCount)\n\t\t\tif *s.RunningCount == *s.DesiredCount {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}\n}", "func Run(task Task, waiter *Waiter) { global.Run(task, waiter) }", "func (r *volumeReactor) waitForIdle() {\n\tr.ctrl.runningOperations.WaitForCompletion()\n\t// Check every 10ms if the controller does something and stop if it's\n\t// idle.\n\toldChanges := -1\n\tfor {\n\t\ttime.Sleep(10 * time.Millisecond)\n\t\tchanges := r.getChangeCount()\n\t\tif changes == oldChanges {\n\t\t\t// No changes for last 10ms -> controller must be idle.\n\t\t\tbreak\n\t\t}\n\t\toldChanges = changes\n\t}\n}", "func (e *WindowsEvent) Wait() {\n\te.WaitTimeout(-1)\n}", "func WaitRingTokensStability(ctx context.Context, r *Ring, op Operation, minStability, maxWaiting time.Duration) error {\n\treturn waitStability(ctx, r, op, minStability, maxWaiting, HasReplicationSetChangedWithoutState)\n}", "func TestGetWorkloads(t *testing.T) {\n\tctx, cancelFunc := context.WithTimeout(context.Background(), standardTimeout)\n\t_, err := bat.GetAllWorkloads(ctx, \"\")\n\tcancelFunc()\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to retrieve workload list : %v\", err)\n\t}\n}", "func (resp *ActionExportCreateResponse) WaitForOperation(timeout float64) (*ActionActionStatePollResponse, error) {\n\treq := resp.Action.Client.ActionState.Poll.Prepare()\n\treq.SetPathParamInt(\"action_state_id\", resp.Response.Meta.ActionStateId)\n\n\tinput := req.NewInput()\n\tinput.SetTimeout(timeout)\n\n\treturn req.Call()\n}", "func (r *volumeReactor) waitForIdle() {\n\tr.ctrl.runningOperations.WaitForCompletion()\n\t// Check every 10ms if the controller does something and stop if it's\n\t// idle.\n\toldChanges := -1\n\tfor {\n\t\ttime.Sleep(10 * time.Millisecond)\n\t\tchanges := r.GetChangeCount()\n\t\tif changes == oldChanges {\n\t\t\t// No changes for last 10ms -> controller must be idle.\n\t\t\tbreak\n\t\t}\n\t\toldChanges = changes\n\t}\n}", "func (s *Service) Wait(timeout time.Duration) (int, error) {\n\turl := s.BaseURL\n\tswitch s.Name {\n\tcase DeployService:\n\t\turl += \"/status.html\" // because /ApplicationStatus is not publicly reachable in Vespa Cloud\n\tcase QueryService, DocumentService:\n\t\turl += \"/ApplicationStatus\"\n\tdefault:\n\t\treturn 0, fmt.Errorf(\"invalid service: %s\", s.Name)\n\t}\n\treturn waitForOK(s, url, timeout)\n}", "func (f *Framework) WaitUntilServiceGone(namespace, name string, timeout time.Duration) error {\n\treturn wait.Poll(time.Second, timeout, func() (bool, error) {\n\t\t_, err := f.KubeClient.CoreV1().Services(namespace).Get(name, metav1.GetOptions{})\n\n\t\tif err != nil {\n\t\t\tif apierrors.IsNotFound(err) {\n\t\t\t\treturn true, nil\n\t\t\t}\n\n\t\t\treturn false, err\n\t\t}\n\n\t\treturn false, nil\n\t})\n}", "func waitTransProcessed(gid string) {\n\tdtmimp.Logf(\"waiting for gid %s\", gid)\n\tselect {\n\tcase id := <-dtmsvr.TransProcessedTestChan:\n\t\tfor id != gid {\n\t\t\tdtmimp.LogRedf(\"-------id %s not match gid %s\", id, gid)\n\t\t\tid = <-dtmsvr.TransProcessedTestChan\n\t\t}\n\t\tdtmimp.Logf(\"finish for gid %s\", gid)\n\tcase <-time.After(time.Duration(time.Second * 3)):\n\t\tdtmimp.LogFatalf(\"Wait Trans timeout\")\n\t}\n}" ]
[ "0.7088703", "0.61550313", "0.5950437", "0.56013626", "0.5530641", "0.53668785", "0.5330715", "0.5317254", "0.5178776", "0.5104112", "0.50031525", "0.49744076", "0.49220267", "0.49099502", "0.49009457", "0.48762017", "0.48237374", "0.48180032", "0.481341", "0.48063043", "0.47941595", "0.47931924", "0.4761938", "0.47379562", "0.47351885", "0.473205", "0.47306696", "0.47234547", "0.46864176", "0.4677497", "0.46738836", "0.46626312", "0.46576157", "0.4656634", "0.46480006", "0.46444046", "0.46051386", "0.4604082", "0.46002656", "0.4584919", "0.45771065", "0.45711625", "0.4561499", "0.4559393", "0.45376766", "0.4511474", "0.45106536", "0.45056108", "0.45012057", "0.44973278", "0.44970155", "0.44879982", "0.4478697", "0.44632697", "0.44586933", "0.44561684", "0.445524", "0.44415644", "0.4440561", "0.44390923", "0.44218424", "0.4408543", "0.4401328", "0.44010848", "0.43963394", "0.43953243", "0.43951398", "0.4389816", "0.43850893", "0.43773597", "0.43768525", "0.43754148", "0.43732536", "0.43728298", "0.43656853", "0.43643066", "0.43632063", "0.43572995", "0.4350967", "0.4342859", "0.434169", "0.43414286", "0.43376362", "0.43362585", "0.43346506", "0.43327", "0.43319374", "0.43314353", "0.43301907", "0.43291757", "0.43286443", "0.4326045", "0.43212697", "0.43138304", "0.43126282", "0.43117663", "0.4311485", "0.4309028", "0.43077993", "0.4305207" ]
0.8097276
0
ListMachineImages uses the override method ListMachineImagesFn or the real implementation.
func (c *TestClient) ListMachineImages(project string, opts ...ListCallOption) ([]*compute.MachineImage, error) { if c.ListMachineImagesFn != nil { return c.ListMachineImagesFn(project, opts...) } return c.client.ListMachineImages(project, opts...) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (az *AzureClient) ListVirtualMachineImages(ctx context.Context, location, publisherName, offer, skus string) (compute.ListVirtualMachineImageResource, error) {\n\t// random value\n\ttop := int32(10)\n\tlist, err := az.virtualMachineImagesClient.List(ctx, location, publisherName, offer, skus, \"\", &top, \"\")\n\tif err != nil {\n\t\treturn compute.ListVirtualMachineImageResource{}, fmt.Errorf(\"failed to list virtual machine images, %s\", err)\n\t}\n\tr := compute.ListVirtualMachineImageResource{}\n\tif err = DeepCopy(&r, list); err != nil {\n\t\treturn r, fmt.Errorf(\"failed to deep copy virtual machine images, %s\", err)\n\t}\n\treturn r, err\n}", "func (c *ComputeClient) MachineImages() *MachineImagesClient {\n\treturn &MachineImagesClient{\n\t\tResourceClient: ResourceClient{\n\t\t\tComputeClient: c,\n\t\t\tResourceDescription: \"MachineImage\",\n\t\t\tContainerPath: \"/machineimage/\",\n\t\t\tResourceRootPath: \"/machineimage\",\n\t\t}}\n}", "func (s stack) ListImages(ctx context.Context, _ bool) (out []*abstract.Image, ferr fail.Error) {\n\tif valid.IsNil(s) {\n\t\treturn nil, fail.InvalidInstanceError()\n\t}\n\n\t// FIXME: It has to be remade from scratch...\n\n\tvar images []*abstract.Image\n\t// FIXME: Don't even add CentOS, our image selection algorithm is not able to select the right one, it has to be remade from scratch because it assumes that the the length of the full ID of an images is the same for all images, which is false for Azure; as a consequence, looking for \"ubuntu\" will return maybe a Centos, maybe something else...\n\t/*\n\t\timages = append(images, &abstract.Image{\n\t\t\tID: strings.Join([]string{\"OpenLogic\", \"CentOS\", \"8_5-gen2\"}, \":\"),\n\t\t\tName: strings.Join([]string{\"OpenLogic\", \"CentOS\", \"8_5-gen2\"}, \":\"),\n\t\t\tURL: \"\",\n\t\t\tDescription: \"\",\n\t\t\tStorageType: \"\",\n\t\t\tDiskSize: 0,\n\t\t\tPublisher: \"cognosys\",\n\t\t\tOffer: \"centos-8-latest\",\n\t\t\tSku: \"centos-8-latest\",\n\t\t})\n\t*/\n\timages = append(images, &abstract.Image{\n\t\tID: strings.Join([]string{\"Canonical\", \"UbuntuServer\", \"18.04-LTS\"}, \":\"),\n\t\tName: strings.Join([]string{\"Canonical\", \"UbuntuServer\", \"18.04-LTS\"}, \":\"),\n\t\tURL: \"\",\n\t\tDescription: \"\",\n\t\tStorageType: \"\",\n\t\tDiskSize: 30,\n\t\tPublisher: \"Canonical\",\n\t\tOffer: \"UbuntuServer\",\n\t\tSku: \"18.04-LTS\",\n\t})\n\timages = append(images, &abstract.Image{\n\t\tID: strings.Join([]string{\"Canonical\", \"0001-com-ubuntu-minimal-focal\", \"minimal-20_04-lts\"}, \":\"),\n\t\tName: strings.Join([]string{\"Canonical\", \"0001-com-ubuntu-minimal-focal\", \"minimal-20_04-lts\"}, \":\"),\n\t\tURL: \"\",\n\t\tDescription: \"\",\n\t\tStorageType: \"\",\n\t\tDiskSize: 30,\n\t\tPublisher: \"Canonical\",\n\t\tOffer: \"0001-com-ubuntu-minimal-focal\",\n\t\tSku: \"minimal-20_04-lts\",\n\t})\n\timages = append(images, &abstract.Image{\n\t\tID: strings.Join([]string{\"Canonical\", \"0001-com-ubuntu-server-jammy\", \"22_04-lts-gen2\"}, \":\"),\n\t\tName: strings.Join([]string{\"Canonical\", \"0001-com-ubuntu-server-jammy\", \"22_04-lts-gen2\"}, \":\"),\n\t\tURL: \"\",\n\t\tDescription: \"\",\n\t\tStorageType: \"\",\n\t\tDiskSize: 30,\n\t\tPublisher: \"Canonical\",\n\t\tOffer: \"0001-com-ubuntu-server-jammy\",\n\t\tSku: \"22_04-lts-gen2\",\n\t})\n\n\treturn images, nil\n}", "func (s *API) ListImages(req *ListImagesRequest, opts ...scw.RequestOption) (*ListImagesResponse, 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\tdefaultPageSize, exist := s.client.GetDefaultPageSize()\n\tif (req.PageSize == nil || *req.PageSize == 0) && exist {\n\t\treq.PageSize = &defaultPageSize\n\t}\n\n\tquery := url.Values{}\n\tparameter.AddToQuery(query, \"page\", req.Page)\n\tparameter.AddToQuery(query, \"page_size\", req.PageSize)\n\tparameter.AddToQuery(query, \"order_by\", req.OrderBy)\n\tparameter.AddToQuery(query, \"namespace_id\", req.NamespaceID)\n\tparameter.AddToQuery(query, \"name\", req.Name)\n\tparameter.AddToQuery(query, \"organization_id\", req.OrganizationID)\n\tparameter.AddToQuery(query, \"project_id\", req.ProjectID)\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: \"GET\",\n\t\tPath: \"/registry/v1/regions/\" + fmt.Sprint(req.Region) + \"/images\",\n\t\tQuery: query,\n\t\tHeaders: http.Header{},\n\t}\n\n\tvar resp ListImagesResponse\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 (i *LibpodAPI) ListImages(call ioprojectatomicpodman.VarlinkCall) error {\n\truntime, err := libpodruntime.GetRuntime(i.Cli)\n\tif err != nil {\n\t\treturn call.ReplyRuntimeError(err.Error())\n\t}\n\timages, err := runtime.ImageRuntime().GetImages()\n\tif err != nil {\n\t\treturn call.ReplyErrorOccurred(fmt.Sprintf(\"unable to get list of images %q\", err))\n\t}\n\tvar imageList []ioprojectatomicpodman.ImageInList\n\tfor _, image := range images {\n\t\t//size, _:= image.Size(getContext())\n\t\tlabels, _ := image.Labels(getContext())\n\t\tcontainers, _ := image.Containers()\n\n\t\ti := ioprojectatomicpodman.ImageInList{\n\t\t\tId: image.ID(),\n\t\t\tParentId: image.Parent,\n\t\t\tRepoTags: image.Names(),\n\t\t\tRepoDigests: image.RepoDigests(),\n\t\t\tCreated: image.Created().String(),\n\t\t\t//Size: size,\n\t\t\tVirtualSize: image.VirtualSize,\n\t\t\tContainers: int64(len(containers)),\n\t\t\tLabels: labels,\n\t\t}\n\t\timageList = append(imageList, i)\n\t}\n\treturn call.ReplyListImages(imageList)\n}", "func ListImages(rs io.ReadSeeker, selectedPages []string, conf *model.Configuration) ([]string, error) {\n\tif rs == nil {\n\t\treturn nil, errors.New(\"pdfcpu: ListImages: Please provide rs\")\n\t}\n\tif conf == nil {\n\t\tconf = model.NewDefaultConfiguration()\n\t\tconf.Cmd = model.LISTIMAGES\n\t}\n\tctx, _, _, _, err := readValidateAndOptimize(rs, conf, time.Now())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err := ctx.EnsurePageCount(); err != nil {\n\t\treturn nil, err\n\t}\n\tpages, err := PagesForPageSelection(ctx.PageCount, selectedPages, true)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn pdfcpu.ListImages(ctx, pages)\n}", "func (c *TestClient) ListImages(project string, opts ...ListCallOption) ([]*compute.Image, error) {\n\tif c.ListImagesFn != nil {\n\t\treturn c.ListImagesFn(project, opts...)\n\t}\n\treturn c.client.ListImages(project, opts...)\n}", "func (c *ECRClientImpl) ListImages(repositoryName *string, registryID *string) ([]*ecr.ImageDetail, error) {\n\timages := []*ecr.ImageDetail{}\n\n\tif repositoryName == nil {\n\t\treturn images, nil\n\t}\n\n\t// If the user has specified a registryID (account ID), then use it here. If not\n\t// then don't set it so that the default will be assumed.\n\tinput := &ecr.DescribeImagesInput{}\n\tif registryID == nil {\n\t\tinput = &ecr.DescribeImagesInput{\n\t\t\tRepositoryName: repositoryName,\n\t\t}\n\t} else {\n\t\tinput = &ecr.DescribeImagesInput{\n\t\t\tRepositoryName: repositoryName,\n\t\t\tRegistryId: registryID,\n\t\t}\n\t}\n\n\tcallback := func(page *ecr.DescribeImagesOutput, lastPage bool) bool {\n\t\timages = append(images, page.ImageDetails...)\n\t\treturn !lastPage\n\t}\n\n\terr := c.ECRClient.DescribeImagesPages(input, callback)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn images, nil\n}", "func (s *VarlinkInterface) ListImages(ctx context.Context, c VarlinkCall) error {\n\treturn c.ReplyMethodNotImplemented(ctx, \"io.podman.ListImages\")\n}", "func (jb *JobBoard) ListImages(ctx context.Context) ([]JobBoardImage, error) {\n\treq, err := jb.newRequest(\"GET\", \"/images?infra=jupiterbrain\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp, err := jb.client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar imageList imageListPayload\n\tif err = json.Unmarshal(body, &imageList); err != nil {\n\t\treturn nil, err\n\t}\n\n\timages := make([]JobBoardImage, len(imageList.Data))\n\tfor i, payload := range imageList.Data {\n\t\timages[i] = JobBoardImage{\n\t\t\tID: payload.ID,\n\t\t\tTag: payload.Tags[\"osx_image\"],\n\t\t\tName: payload.Name,\n\t\t}\n\t}\n\n\treturn images, nil\n}", "func (c *criContainerdService) ListImages(ctx context.Context, r *runtime.ListImagesRequest) (*runtime.ListImagesResponse, error) {\n\timageMetadataA, err := c.imageMetadataStore.List()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to list image metadata from store %v\", err)\n\t}\n\t// TODO(mikebrow): Get the id->tags, and id->digest mapping from our checkpoint;\n\t// Get other information from containerd image/content store\n\n\tvar images []*runtime.Image\n\tfor _, image := range imageMetadataA { // TODO(mikebrow): write a ImageMetadata to runtime.Image converter\n\t\tri := &runtime.Image{\n\t\t\tId: image.ID,\n\t\t\tRepoTags: image.RepoTags,\n\t\t\tRepoDigests: image.RepoDigests,\n\t\t\tSize_: image.Size,\n\t\t\t// TODO(mikebrow): Uid and Username?\n\t\t}\n\t\timages = append(images, ri)\n\t}\n\n\treturn &runtime.ListImagesResponse{Images: images}, nil\n}", "func (cli *DockerCli) ListImages(context context.Context) ([]types.ImageSummary, error) {\n\n\timages, err := cli.client.ImageList(context, types.ImageListOptions{})\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\treturn images, nil\n}", "func listMatchboxImagesHandler(w http.ResponseWriter, req *http.Request, _ *Context) error {\n\tendpoint := req.URL.Query().Get(\"endpoint\")\n\tif endpoint == \"\" {\n\t\treturn newBadRequestError(\"No endpoint provided\")\n\t}\n\n\timages, err := containerlinux.ListMatchboxImages(endpoint, *containerLinuxMinVersion, containerLinuxListTimeout)\n\tif err != nil {\n\t\treturn newInternalServerError(\"Failed to query available images: %s\", err)\n\t}\n\n\ttype Image struct {\n\t\tVersion string `json:\"version\"`\n\t}\n\tresponse := struct {\n\t\tCoreOS []Image `json:\"coreos\"`\n\t}{}\n\tfor _, image := range images {\n\t\tresponse.CoreOS = append(response.CoreOS, Image{Version: image.String()})\n\t}\n\n\treturn writeJSONResponse(w, req, http.StatusOK, response)\n}", "func (ms *MachinePlugin) ListMachines(ctx context.Context, req *cmi.ListMachinesRequest) (*cmi.ListMachinesResponse, error) {\n\t// Log messages to track start and end of request\n\tglog.V(2).Infof(\"List machines request has been recieved for %q\", req.ProviderSpec)\n\n\tproviderSpec, secrets, err := decodeProviderSpecAndSecret(req.ProviderSpec, req.Secrets, true)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclusterName := \"\"\n\tnodeRole := \"\"\n\n\tfor key := range providerSpec.Tags {\n\t\tif strings.Contains(key, \"kubernetes.io/cluster/\") {\n\t\t\tclusterName = key\n\t\t} else if strings.Contains(key, \"kubernetes.io/role/\") {\n\t\t\tnodeRole = key\n\t\t}\n\t}\n\n\tsvc, err := ms.createSVC(secrets, providerSpec.Region)\n\tif err != nil {\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\n\tinput := ec2.DescribeInstancesInput{\n\t\tFilters: []*ec2.Filter{\n\t\t\t&ec2.Filter{\n\t\t\t\tName: aws.String(\"tag-key\"),\n\t\t\t\tValues: []*string{\n\t\t\t\t\t&clusterName,\n\t\t\t\t},\n\t\t\t},\n\t\t\t&ec2.Filter{\n\t\t\t\tName: aws.String(\"tag-key\"),\n\t\t\t\tValues: []*string{\n\t\t\t\t\t&nodeRole,\n\t\t\t\t},\n\t\t\t},\n\t\t\t&ec2.Filter{\n\t\t\t\tName: aws.String(\"instance-state-name\"),\n\t\t\t\tValues: []*string{\n\t\t\t\t\taws.String(\"pending\"),\n\t\t\t\t\taws.String(\"running\"),\n\t\t\t\t\taws.String(\"stopping\"),\n\t\t\t\t\taws.String(\"stopped\"),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\trunResult, err := svc.DescribeInstances(&input)\n\tif err != nil {\n\t\tglog.Errorf(\"AWS plugin is returning error while describe instances request is sent: %s\", err)\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\n\tlistOfVMs := make(map[string]string)\n\tfor _, reservation := range runResult.Reservations {\n\t\tfor _, instance := range reservation.Instances {\n\n\t\t\tmachineName := \"\"\n\t\t\tfor _, tag := range instance.Tags {\n\t\t\t\tif *tag.Key == \"Name\" {\n\t\t\t\t\tmachineName = *tag.Value\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tlistOfVMs[encodeProviderID(providerSpec.Region, *instance.InstanceId)] = machineName\n\t\t}\n\t}\n\n\tglog.V(2).Infof(\"List machines request has been processed successfully\")\n\t// Core logic ends here.\n\tResp := &cmi.ListMachinesResponse{\n\t\tMachineList: listOfVMs,\n\t}\n\treturn Resp, nil\n}", "func (this *DoClient) ListImages() (interface{}, error) {\n\treturn this.client.ListImages()\n}", "func (c Client) ListImages() ([]models.Image, error) {\n\tvar images []models.Image\n\tresp, err := c.get(\"/images\")\n\tif err != nil {\n\t\treturn images, err\n\t}\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn images, parseError(resp.Body)\n\t}\n\n\tmaybeImages, err := jsonapi.UnmarshalManyPayload(resp.Body, reflect.TypeOf(images))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Convert from []interface{} to []Image\n\timages = make([]models.Image, 0)\n\tfor _, image := range maybeImages {\n\t\ti := image.(*models.Image)\n\t\timages = append(images, *i)\n\t}\n\n\treturn images, nil\n}", "func ListImages(client *httputil.ClientConn) ([]string, error) {\n\tbody, err := utils.Do(client, \"GET\", \"/1.0/images\", nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to list images: %v\", err)\n\t}\n\tvar res utils.ListContainerResponse\n\tif err := json.Unmarshal(body, &res); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to unmarshal ListImages: %v\", err)\n\t}\n\treturn res.Metadata, nil\n}", "func ImageList() error {\n\timagesDir, err := getImagesDir()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdir, err := os.Open(imagesDir)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer dir.Close()\n\n\tnames, err := dir.Readdirnames(0)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, name := range names {\n\t\tif strings.HasSuffix(name, \".qcow2\") {\n\t\t\tfmt.Println(strings.TrimSuffix(name, \".qcow2\"))\n\t\t}\n\t}\n\n\treturn nil\n}", "func (client *Client) ListImages(all bool) ([]model.Image, error) {\n\timages, err := client.feclt.ListImages(true)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif all {\n\t\treturn images, nil\n\t}\n\n\timageFilter := imgfilters.NewFilter(isLatestImage).And(imgfilters.NewFilter(isWindowsImage).Not()).And(imgfilters.NewFilter(isSpecializedImage).Not())\n\treturn imgfilters.FilterImages(images, imageFilter), nil\n}", "func (s *FileStore) ListImages(filter string) ([]*Image, error) {\n\ts.Lock()\n\tdefer s.Unlock()\n\treturn s.listImagesUnlocked(filter)\n}", "func (d *Docker) ListImages() []types.ImageSummary {\n\timages, err := d.client.ImageList(context.Background(), types.ImageListOptions{All: true})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfor _, image := range images {\n\t\tfmt.Printf(\"Containers: %d, Created: %d, ID: %s, ParentID: %s, Size: %d, RepoTags: %s\\n\", image.Containers, image.Created, image.ID[:10], image.ParentID, image.Size, image.RepoTags)\n\t}\n\treturn images\n}", "func (o *ClusterUninstaller) listImages() (cloudResources, error) {\n\to.Logger.Debugf(\"Listing images\")\n\n\tif o.imageClient == nil {\n\t\to.Logger.Infof(\"Skipping deleting images because no service instance was found\")\n\t\tresult := []cloudResource{}\n\t\treturn cloudResources{}.insert(result...), nil\n\t}\n\n\tctx, cancel := o.contextWithTimeout()\n\tdefer cancel()\n\n\tselect {\n\tcase <-ctx.Done():\n\t\to.Logger.Debugf(\"listImages: case <-ctx.Done()\")\n\t\treturn nil, o.Context.Err() // we're cancelled, abort\n\tdefault:\n\t}\n\n\timages, err := o.imageClient.GetAll()\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"failed to list images\")\n\t}\n\n\tvar foundOne = false\n\n\tresult := []cloudResource{}\n\tfor _, image := range images.Images {\n\t\tif strings.Contains(*image.Name, o.InfraID) {\n\t\t\tfoundOne = true\n\t\t\to.Logger.Debugf(\"listImages: FOUND: %s, %s, %s\", *image.ImageID, *image.Name, *image.State)\n\t\t\tresult = append(result, cloudResource{\n\t\t\t\tkey: *image.ImageID,\n\t\t\t\tname: *image.Name,\n\t\t\t\tstatus: *image.State,\n\t\t\t\ttypeName: imageTypeName,\n\t\t\t\tid: *image.ImageID,\n\t\t\t})\n\t\t}\n\t}\n\tif !foundOne {\n\t\to.Logger.Debugf(\"listImages: NO matching image against: %s\", o.InfraID)\n\t\tfor _, image := range images.Images {\n\t\t\to.Logger.Debugf(\"listImages: image: %s\", *image.Name)\n\t\t}\n\t}\n\n\treturn cloudResources{}.insert(result...), nil\n}", "func ListContainerImages(settings *playfab.Settings, postData *ListContainerImagesRequestModel, entityToken string) (*ListContainerImagesResponseModel, error) {\n if entityToken == \"\" {\n return nil, playfab.NewCustomError(\"entityToken should not be an empty string\", playfab.ErrorGeneric)\n }\n b, errMarshal := json.Marshal(postData)\n if errMarshal != nil {\n return nil, playfab.NewCustomError(errMarshal.Error(), playfab.ErrorMarshal)\n }\n\n sourceMap, err := playfab.Request(settings, b, \"/MultiplayerServer/ListContainerImages\", \"X-EntityToken\", entityToken)\n if err != nil {\n return nil, err\n }\n \n result := &ListContainerImagesResponseModel{}\n\n config := mapstructure.DecoderConfig{\n DecodeHook: playfab.StringToDateTimeHook,\n Result: result,\n }\n \n decoder, errDecoding := mapstructure.NewDecoder(&config)\n if errDecoding != nil {\n return nil, playfab.NewCustomError(errDecoding.Error(), playfab.ErrorDecoding)\n }\n \n errDecoding = decoder.Decode(sourceMap)\n if errDecoding != nil {\n return nil, playfab.NewCustomError(errDecoding.Error(), playfab.ErrorDecoding)\n }\n\n return result, nil\n}", "func (i *ImagesModel) ListImages(filters map[string]string) ([]*images.SoftwareImage, error) {\n\n\timageList, err := i.imagesStorage.FindAll()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Searching for image metadata\")\n\t}\n\n\tif imageList == nil {\n\t\treturn make([]*images.SoftwareImage, 0), nil\n\t}\n\n\treturn imageList, nil\n}", "func (v *IBM) ListImages(ctx *lepton.Context) error {\n\timages, err := v.GetImages(ctx)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\ttable := tablewriter.NewWriter(os.Stdout)\n\ttable.SetHeader([]string{\"ID\", \"Name\", \"Date created\", \"Size\", \"Status\"})\n\ttable.SetHeaderColor(\n\t\ttablewriter.Colors{tablewriter.Bold, tablewriter.FgCyanColor},\n\t\ttablewriter.Colors{tablewriter.Bold, tablewriter.FgCyanColor},\n\t\ttablewriter.Colors{tablewriter.Bold, tablewriter.FgCyanColor},\n\t\ttablewriter.Colors{tablewriter.Bold, tablewriter.FgCyanColor},\n\t\ttablewriter.Colors{tablewriter.Bold, tablewriter.FgCyanColor})\n\ttable.SetRowLine(true)\n\n\tfor _, image := range images {\n\t\tvar row []string\n\t\trow = append(row, image.ID)\n\t\trow = append(row, image.Name)\n\t\trow = append(row, \"\")\n\t\trow = append(row, humanize.Bytes(uint64(image.Size)))\n\t\trow = append(row, image.Status)\n\t\ttable.Append(row)\n\t}\n\n\ttable.Render()\n\n\treturn nil\n}", "func (a *ImagesApiService) ListImages(ctx context.Context) ApiListImagesRequest {\n\treturn ApiListImagesRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "func (r *Registry) ListImages(\n\trepoName string,\n\trepo repository.Repository,\n\tdoAuth *oauth2.Config, // only required if using DOCR\n) ([]*Image, error) {\n\t// switch on the auth mechanism to get a token\n\tif r.AWSIntegrationID != 0 {\n\t\treturn r.listECRImages(repoName, repo)\n\t}\n\n\tif r.GCPIntegrationID != 0 {\n\t\treturn r.listGCRImages(repoName, repo)\n\t}\n\n\tif r.DOIntegrationID != 0 {\n\t\treturn r.listDOCRImages(repoName, repo, doAuth)\n\t}\n\n\tif r.BasicIntegrationID != 0 {\n\t\treturn r.listPrivateRegistryImages(repoName, repo)\n\t}\n\n\treturn nil, fmt.Errorf(\"error listing images\")\n}", "func (client *Client) ListVirtualImages(req *Request) (*Response, error) {\n\treturn client.Execute(&Request{\n\t\tMethod: \"GET\",\n\t\tPath: VirtualImagesPath,\n\t\tQueryParams: req.QueryParams,\n\t\tResult: &ListVirtualImagesResult{},\n\t})\n}", "func ListImages() Collection {\n\tpath := image_col_path()\n\treturn is_list(path)\n}", "func (m *Manager) ListImages() map[string]*schema.ImageManifest {\n\tm.imagesLock.RLock()\n\tdefer m.imagesLock.RUnlock()\n\treturn m.images\n}", "func (f *FakeImagesClient) List(ctx context.Context, listOpts *images.ListRequest, opts ...grpc.CallOption) (*images.ListResponse, error) {\n\tf.Lock()\n\tdefer f.Unlock()\n\tf.appendCalled(\"list\", listOpts)\n\tif err := f.getError(\"list\"); err != nil {\n\t\treturn nil, err\n\t}\n\tresp := &images.ListResponse{}\n\tfor _, image := range f.ImageList {\n\t\tresp.Images = append(resp.Images, image)\n\t}\n\treturn resp, nil\n}", "func (m *VirtualEndpoint) GetDeviceImages()([]CloudPcDeviceImageable) {\n val, err := m.GetBackingStore().Get(\"deviceImages\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]CloudPcDeviceImageable)\n }\n return nil\n}", "func ListBaseImages() []string {\n\td, _ := os.Open(C.ImageDir)\n\tfiles, _ := d.Readdir(0)\n\n\tnames := []string{}\n\tfor _, f := range files {\n\t\tnames = append(names, f.Name())\n\t}\n\n\treturn names\n}", "func imageListWrapper(\n\tc *client.Client,\n\tctx context.Context,\n\toptions types.ImageListOptions,\n) ([]types.ImageSummary, error) {\n\tif c != nil {\n\t\treturn c.ImageList(ctx, options)\n\t}\n\tfc := FakeDockerClient{}\n\treturn fc.ImageList(ctx, options)\n}", "func (client WorkloadNetworksClient) ListVirtualMachinesResponder(resp *http.Response) (result WorkloadNetworkVirtualMachinesList, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "func (r *Resolver) ImageFindList() runtime.ImageFindListResolver { return &imageFindListResolver{r} }", "func StorageImagesListSpinRegistryPath() string {\n\treturn \"/storage/images/list\"\n}", "func (client WorkloadNetworksClient) ListVirtualMachines(ctx context.Context, resourceGroupName string, privateCloudName string) (result WorkloadNetworkVirtualMachinesListPage, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/WorkloadNetworksClient.ListVirtualMachines\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.wnvml.Response.Response != nil {\n\t\t\t\tsc = result.wnvml.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tif err := validation.Validate([]validation.Validation{\n\t\t{TargetValue: client.SubscriptionID,\n\t\t\tConstraints: []validation.Constraint{{Target: \"client.SubscriptionID\", Name: validation.MinLength, Rule: 1, Chain: nil}}},\n\t\t{TargetValue: resourceGroupName,\n\t\t\tConstraints: []validation.Constraint{{Target: \"resourceGroupName\", Name: validation.MaxLength, Rule: 90, Chain: nil},\n\t\t\t\t{Target: \"resourceGroupName\", Name: validation.MinLength, Rule: 1, Chain: nil},\n\t\t\t\t{Target: \"resourceGroupName\", Name: validation.Pattern, Rule: `^[-\\w\\._\\(\\)]+$`, Chain: nil}}}}); err != nil {\n\t\treturn result, validation.NewError(\"avs.WorkloadNetworksClient\", \"ListVirtualMachines\", err.Error())\n\t}\n\n\tresult.fn = client.listVirtualMachinesNextResults\n\treq, err := client.ListVirtualMachinesPreparer(ctx, resourceGroupName, privateCloudName)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"avs.WorkloadNetworksClient\", \"ListVirtualMachines\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.ListVirtualMachinesSender(req)\n\tif err != nil {\n\t\tresult.wnvml.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"avs.WorkloadNetworksClient\", \"ListVirtualMachines\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult.wnvml, err = client.ListVirtualMachinesResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"avs.WorkloadNetworksClient\", \"ListVirtualMachines\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\tif result.wnvml.hasNextLink() && result.wnvml.IsEmpty() {\n\t\terr = result.NextWithContext(ctx)\n\t\treturn\n\t}\n\n\treturn\n}", "func (addon Addon) Images(clusterVersion *version.Version, imageTag string) []string {\n\timages := []string{}\n\tfor _, cb := range addon.getImageCallbacks {\n\t\timage := cb(clusterVersion, imageTag)\n\t\tif image != \"\" {\n\t\t\timages = append(images, image)\n\t\t}\n\t}\n\treturn images\n}", "func GetImageLists(c echo.Context) error {\n\treturn c.JSON(http.StatusOK, model.GetFilePaths())\n}", "func (c *Client) ListImage(args *ListImageArgs) (*ListImageResult, error) {\n\treturn ListImage(c, args)\n}", "func RunImagesListApplication(ns string, config doit.Config, out io.Writer, args []string) error {\n\tclient := config.GetGodoClient()\n\treturn listImages(ns, config, out, client.Images.ListApplication)\n}", "func (es *etcdStore) List(imageType string) ([]*Image, error) {\n\tvar images []*Image\n\n\t// Look up the prefix to get a list of imageIDs\n\tresp, err := es.client.Get(es.prefix, false, false)\n\tif err != nil {\n\t\tlog.WithFields(etcdLogFields).WithFields(log.Fields{\n\t\t\t\"error\": err,\n\t\t\t\"key\": es.prefix,\n\t\t}).Error(\"failed to look up images dir\")\n\t\treturn nil, err\n\t}\n\n\t// Look up metadata for each imageID and filter by type\n\tfor _, node := range resp.Node.Nodes {\n\t\timageID := path.Base(node.Key)\n\t\timage, err := es.GetByID(imageID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif imageType == \"\" || imageType == image.Type {\n\t\t\timages = append(images, image)\n\t\t}\n\t}\n\n\treturn images, nil\n}", "func (d *Docker) Images(opt types.ImageListOptions) ([]types.ImageSummary, error) {\n\treturn d.ImageList(context.TODO(), opt)\n}", "func (s *Session) ListVirtualMachineImagesFromCL(ctx context.Context, clUUID string,\n\tcurrentCLImages map[string]v1alpha1.VirtualMachineImage) ([]*v1alpha1.VirtualMachineImage, error) {\n\n\tlog.V(4).Info(\"Listing VirtualMachineImages from ContentLibrary\", \"contentLibraryUUID\", clUUID)\n\n\titems, err := s.contentLibProvider.GetLibraryItems(ctx, clUUID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar images []*v1alpha1.VirtualMachineImage\n\tfor i := range items {\n\t\tvar ovfEnvelope *ovf.Envelope\n\t\titem := items[i]\n\n\t\tif curImage, ok := currentCLImages[item.Name]; ok {\n\t\t\t// If there is already an VMImage for this item, and it is the same - as determined by _just_ the\n\t\t\t// annotation - reuse the existing VMImage. This is to avoid repeated CL fetch tasks that would\n\t\t\t// otherwise be created, spamming the UI. It would be nice if CL provided an external API that\n\t\t\t// allowed us to silently fetch the OVF.\n\t\t\tannotations := curImage.GetAnnotations()\n\t\t\tif ver := annotations[VMImageCLVersionAnnotation]; ver == libItemVersionAnnotation(&item) {\n\t\t\t\timages = append(images, &curImage)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tswitch item.Type {\n\t\tcase library.ItemTypeOVF:\n\t\t\tif ovfEnvelope, err = s.contentLibProvider.RetrieveOvfEnvelopeFromLibraryItem(ctx, &item); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\tcase library.ItemTypeVMTX:\n\t\t\t// Do not try to populate VMTX types, but resVm.GetOvfProperties() should return an\n\t\t\t// OvfEnvelope.\n\t\tdefault:\n\t\t\t// Not a supported type. Keep this in sync with cloneVMFromContentLibrary().\n\t\t\tcontinue\n\t\t}\n\n\t\timages = append(images, LibItemToVirtualMachineImage(&item, ovfEnvelope))\n\t}\n\n\treturn images, nil\n}", "func ListImages(ctx *model.Context, selectedPages types.IntSet) ([]string, error) {\n\n\tmm, maxLen, err := Images(ctx, selectedPages)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tss, j, size, err := listImages(ctx, mm, maxLen)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn append([]string{fmt.Sprintf(\"%d images available(%s)\", j, types.ByteSize(size))}, ss...), nil\n}", "func (client *Client) ListImages(all bool) ([]model.Image, error) {\n\treturn client.osclt.ListImages(all)\n}", "func GetAllImages(cfg *v1.ClusterConfiguration, kubeadmCfg *kubeadmapi.ClusterConfiguration, operatorVersion string) []string {\n\timgs := images.GetControlPlaneImages(kubeadmCfg)\n\t//for _, component := range []string{\n\t//constants.OnecloudOperator,\n\t//} {\n\t//imgs = append(imgs, GetOnecloudImage(component, cfg, kubeadmCfg))\n\t//}\n\trepoPrefix := kubeadmCfg.ImageRepository\n\tfor img, version := range map[string]string{\n\t\tconstants.CalicoKubeControllers: constants.DefaultCalicoVersion,\n\t\tconstants.CalicoNode: constants.DefaultCalicoVersion,\n\t\tconstants.CalicoCNI: constants.DefaultCalicoVersion,\n\t\tconstants.RancherLocalPathProvisioner: constants.DefaultLocalProvisionerVersion,\n\t\tconstants.IngressControllerTraefik: constants.DefaultTraefikVersion,\n\t\tconstants.OnecloudOperator: operatorVersion,\n\t} {\n\t\timgs = append(imgs, GetGenericImage(repoPrefix, img, version))\n\t}\n\treturn imgs\n}", "func (client ArtifactsClient) listContainerImages(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodGet, \"/container/images\", binaryReqBody, extraHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response ListContainerImagesResponse\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/registry/20160918/ContainerImageSummary/ListContainerImages\"\n\t\terr = common.PostProcessServiceError(err, \"Artifacts\", \"ListContainerImages\", apiReferenceLink)\n\t\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponse(httpResponse, &response)\n\treturn response, err\n}", "func (client ArtifactsClient) ListContainerImages(ctx context.Context, request ListContainerImagesRequest) (response ListContainerImagesResponse, 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.listContainerImages, 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 = ListContainerImagesResponse{RawResponse: httpResponse, OpcRequestId: &opcRequestId}\n\t\t\t} else {\n\t\t\t\tresponse = ListContainerImagesResponse{}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\tif convertedResponse, ok := ociResponse.(ListContainerImagesResponse); ok {\n\t\tresponse = convertedResponse\n\t} else {\n\t\terr = fmt.Errorf(\"failed to convert OCIResponse into ListContainerImagesResponse\")\n\t}\n\treturn\n}", "func (t *TaskRPC) ListMachineSched(data shared.MachineRPCData, tasks *[]shared.SchedTask) error {\n\tstart := time.Now()\n\n\tconn := Connections.Get(data.Channel)\n\n\t// Read the sites that this user has access to\n\terr := DB.SQL(`select * from sched_task where machine_id=$1 order by id`, data.ID).QueryStructs(tasks)\n\n\tif err != nil {\n\t\tlog.Println(err.Error())\n\t}\n\n\t// Get the latest thumbnails for this task, if present\n\tfor i, v := range *tasks {\n\n\t\tphotos := []shared.Photo{}\n\t\tDB.SQL(`select id,thumb \n\t\t\tfrom photo \n\t\t\twhere (entity='sched' and entity_id=$1) \n\t\t\torder by type, id desc`, v.ID).\n\t\t\tQueryStructs(&photos)\n\t\t(*tasks)[i].Photos = photos\n\t}\n\n\tlogger(start, \"Task.ListMachineSched\",\n\t\tfmt.Sprintf(\"Machine %d\", data.ID),\n\t\tfmt.Sprintf(\"%d tasks\", len(*tasks)),\n\t\tdata.Channel, conn.UserID, \"machine\", 0, false)\n\n\treturn nil\n}", "func (_m *MockECRAPI) ListImages(_param0 *ecr.ListImagesInput) (*ecr.ListImagesOutput, error) {\n\tret := _m.ctrl.Call(_m, \"ListImages\", _param0)\n\tret0, _ := ret[0].(*ecr.ListImagesOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (client *Client) ListDevicesImages(request *ListDevicesImagesRequest) (response *ListDevicesImagesResponse, err error) {\n\tresponse = CreateListDevicesImagesResponse()\n\terr = client.DoAction(request, response)\n\treturn\n}", "func (v *IBM) GetImages(ctx *lepton.Context) ([]lepton.CloudImage, error) {\n\tclient := &http.Client{}\n\n\tc := ctx.Config()\n\tzone := c.CloudConfig.Zone\n\n\tregion := extractRegionFromZone(zone)\n\n\turi := \"https://\" + region + \".iaas.cloud.ibm.com/v1/images?version=2023-02-28&generation=2&visibility=private\"\n\n\treq, err := http.NewRequest(\"GET\", uri, nil)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"Authorization\", \"Bearer \"+v.iam)\n\n\tres, err := client.Do(req)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\tdefer res.Body.Close()\n\n\tbody, err := io.ReadAll(res.Body)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\tilr := &ImageListResponse{}\n\terr = json.Unmarshal(body, &ilr)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\tvar images []lepton.CloudImage\n\n\tfor _, img := range ilr.Images {\n\t\timages = append(images, lepton.CloudImage{\n\t\t\tID: img.ID,\n\t\t\tName: img.Name,\n\t\t\tStatus: img.Status,\n\t\t\tPath: \"\",\n\t\t})\n\t}\n\n\treturn images, nil\n\n}", "func listImages(w http.ResponseWriter, r *http.Request, parms martini.Params) {\r\n\t//\tval, err := redis_client.Get(\"hotimage\")\r\n\t//\tif err != nil {\r\n\t//\t\tlogger.Error(err)\r\n\t//\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\r\n\t//\t}\r\n\t//\tvar list HotImages\r\n\t//\tif err = json.Unmarshal(val, &list); err != nil {\r\n\t//\t\tlogger.Error(err)\r\n\t//\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\r\n\t//\t}\r\n\t//\tvar images []CRImage\r\n\t//\tif len(list.List) > 50 {\r\n\t//\t\timages = list.List[0:50]\r\n\t//\t} else {\r\n\t//\t\timages = list.List[0:]\r\n\t//\t}\r\n\t//\tif err := json.NewEncoder(w).Encode(images); err != nil {\r\n\t//\t\tlogger.Error(err)\r\n\t//\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\r\n\t//\t}\r\n\tqs := r.URL.Query()\r\n\tkey := qs.Get(\"key\")\r\n\tpage, err := strconv.Atoi(qs.Get(\"page\"))\r\n\tif err != nil {\r\n\t\tpage = 1\r\n\t}\r\n\tif page <= 0 {\r\n\t\tpage = 1\r\n\t}\r\n\tnum, err := strconv.Atoi(qs.Get(\"num\"))\r\n\tif err != nil {\r\n\t\tnum = 8\r\n\t}\r\n\tif num == 0 {\r\n\t\tnum = 8\r\n\t}\r\n\tstart := (page - 1) * num\r\n\tend := start + num\r\n\tvar list ImageList\r\n\tvar result HotImages\r\n\tif key == \"\" {\r\n\t\tresult.Num = num\r\n\t\tresult.Page = page\r\n\t\tconn := pool.Get()\r\n\t\tdefer conn.Close()\r\n\t\tval, err := conn.Do(\"GET\", \"hotimage\")\r\n\t\tlog.Println(val)\r\n\t\tlog.Println(err)\r\n\t\tif val == nil {\r\n\t\t\t// logger.Error(err)\r\n\t\t\t// http.Error(w, err.Error(), http.StatusInternalServerError)\r\n\t\t\t// return\r\n\t\t\tlist.List = HotTimerList()\r\n\t\t} else {\r\n\t\t\ttmp, _ := val.([]byte)\r\n\t\t\tif err = json.Unmarshal(tmp, &list); err != nil {\r\n\t\t\t\tlogger.Error(err)\r\n\t\t\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\t\t}\r\n\t\t// convert interface to []byte\r\n\r\n\t\tif end > 50 {\r\n\t\t\tresult.List = list.List[start:50]\r\n\t\t} else if end > len(list.List) {\r\n\t\t\tresult.List = list.List[start:]\r\n\t\t} else {\r\n\t\t\tresult.List = list.List[start:end]\r\n\t\t}\r\n\t\tif len(list.List) > 50 {\r\n\t\t\tresult.Total = 50\r\n\t\t} else {\r\n\t\t\tresult.Total = int64(len(list.List))\r\n\t\t}\r\n\t} else {\r\n\t\tresult = QuerybyName(key, page, num)\r\n\t}\r\n\tif err := json.NewEncoder(w).Encode(result); err != nil {\r\n\t\tlogger.Error(err)\r\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\r\n\t}\r\n}", "func (cli *Client) ImageList(ctx context.Context, options types.ImageListOptions) ([]types.Image, error) {\n\tvar images []types.Image\n\tquery := url.Values{}\n\n\tif options.Filters.Len() > 0 {\n\t\tfilterJSON, err := filters.ToParam(options.Filters)\n\t\tif err != nil {\n\t\t\treturn images, err\n\t\t}\n\t\tquery.Set(\"filters\", filterJSON)\n\t}\n\tif options.MatchName != \"\" {\n\t\t// FIXME rename this parameter, to not be confused with the filters flag\n\t\tquery.Set(\"filter\", options.MatchName)\n\t}\n\tif options.All {\n\t\tquery.Set(\"all\", \"1\")\n\t}\n\n\tserverResp, err := cli.get(ctx, \"/images/json\", query, nil)\n\tif err != nil {\n\t\treturn images, err\n\t}\n\n\terr = json.NewDecoder(serverResp.body).Decode(&images)\n\tensureReaderClosed(serverResp)\n\treturn images, err\n}", "func (c *ComicFile) ListImages() ([]string, error) {\n\tvar filenames []string\n\terr := c.archiver.Walk(c.filepath, func(f archiver.File) error {\n\t\tif isImageFile(f) {\n\t\t\tfilenames = append(filenames, f.Name())\n\t\t}\n\t\treturn nil\n\t})\n\n\tsort.Sort(utils.Natural(filenames))\n\n\treturn filenames, err\n}", "func (p *AWS) ListImages(ctx *lepton.Context) error {\n\tcimages, err := p.GetImages(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttable := tablewriter.NewWriter(os.Stdout)\n\ttable.SetHeader([]string{\"Name\", \"Id\", \"Status\", \"Created\"})\n\ttable.SetHeaderColor(\n\t\ttablewriter.Colors{tablewriter.Bold, tablewriter.FgCyanColor},\n\t\ttablewriter.Colors{tablewriter.Bold, tablewriter.FgCyanColor},\n\t\ttablewriter.Colors{tablewriter.Bold, tablewriter.FgCyanColor},\n\t\ttablewriter.Colors{tablewriter.Bold, tablewriter.FgCyanColor})\n\ttable.SetRowLine(true)\n\n\tfor _, image := range cimages {\n\t\tvar row []string\n\n\t\trow = append(row, image.Name)\n\t\trow = append(row, image.ID)\n\t\trow = append(row, image.Status)\n\t\trow = append(row, lepton.Time2Human(image.Created))\n\n\t\ttable.Append(row)\n\t}\n\n\ttable.Render()\n\n\treturn nil\n}", "func (c *ImageController) List(ctx *app.ListImageContext) error {\n\t// ImageController_List: start_implement\n\n\t// Put your logic here\n\n\t// ImageController_List: end_implement\n\tres := app.ImageCollection{}\n\treturn ctx.OK(res)\n}", "func getImages(hostBase string, organization string, application string) (*http.Response, []*server.Image, error) {\n\n\turl := getImagesURL(hostBase, organization, application)\n\n\tkiln.LogInfo.Printf(\"Invoking get at URL %s\", url)\n\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\treq.Header.Add(\"Accept\", \"application/json\")\n\treq.Header.Set(\"Authorization\", fmt.Sprintf(\"Bearer %s\", \"e30K.e30K.e30K\"))\n\tclient := &http.Client{}\n\tresponse, err := client.Do(req)\n\n\timages := []*server.Image{}\n\n\tbytes, err := ioutil.ReadAll(response.Body)\n\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tbody := string(bytes)\n\n\tkiln.LogInfo.Printf(\"Response is %s\", body)\n\n\tjson.Unmarshal(bytes, &images)\n\n\treturn response, images, err\n\n}", "func ImageList(images ...imageapi.Image) imageapi.ImageList {\n\treturn imageapi.ImageList{\n\t\tItems: images,\n\t}\n}", "func List(ctx context.Context, dbConn *db.DB, queryParams url.Values) ([]Image, error) {\n\tsqlQuery := \"SELECT * from images\"\n\tif len(queryParams) > 0 {\n\t\twhere, err := dbConn.BuildWhere(queryParams)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"List\")\n\t\t}\n\t\tsqlQuery += where\n\t}\n\n\timages := make([]Image, 0)\n\trows, err := dbConn.PSQLQuerier(ctx, sqlQuery)\n\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"List\")\n\t}\n\tfor rows.Next() {\n\t\tdata := Image{}\n\t\terr := rows.StructScan(&data)\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\timages = append(images, data)\n\t}\n\treturn images, nil\n}", "func (dm *DockerMachine) Machines() ([]Machine, error) {\n\tfilter := `{\"Name\":\"{{.Name}}\",\"State\":\"{{.State}}\",\"URL\":\"{{.URL}}\"}`\n\tbytes, err := dm.RawCommandResult(\"ls\", \"-f\", filter)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar machines []Machine\n\tfor _, s := range strings.Split(string(bytes), \"\\n\") {\n\t\ts = strings.TrimSpace(s)\n\t\tif s == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tvar machine Machine\n\t\tif err = json.Unmarshal([]byte(s), &machine); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error while parsing \\\"%s\\\": %v\", s, err)\n\t\t}\n\t\tmachines = append(machines, machine)\n\t}\n\treturn machines, nil\n}", "func (qs *QueryServer) ListContainerImages() (cImages []types.ContainerImage, fnerr error) {\n\tdata, err := qs.List([]byte(ContainerImagePrefix))\n\tif err != nil {\n\t\tfnerr = err\n\t}\n\n\tfor _, rawbytes := range data {\n\t\tci := types.ContainerImage{}\n\t\tif err := json.Unmarshal(rawbytes, &ci); err != nil {\n\t\t\tbase.Errorf(err.Error())\n\t\t}\n\t\tcImages = append(cImages, ci)\n\t}\n\n\treturn\n}", "func getImages(app App) []docker.APIImages {\n\tpDebug(\"Getting images %s\", app.Image)\n\timgs, _ := client.ListImages(docker.ListImagesOptions{All: false, Filter: app.Image})\n\treturn imgs\n}", "func MachineListCommand(c *cli.Context, log logging.Logger, _ string) (int, error) {\n\topts := &machine.ListOptions{\n\t\tLog: log.New(\"machine:list\"),\n\t}\n\n\tinfos, err := machine.List(opts)\n\tif err != nil {\n\t\treturn 1, err\n\t}\n\n\ttabFormatter(os.Stdout, infos)\n\treturn 0, nil\n}", "func (d *Daemon) ListImages(ctx context.Context, spec update.ResourceSpec) ([]v6.ImageStatus, error) {\n\treturn d.ListImagesWithOptions(ctx, v10.ListImagesOptions{Spec: spec})\n}", "func (lc *imgListCfg) displayImagesOnRegistry(ims []utils.Repositories) {\n\n\t// get \"username/\"\n\tu := lc.pf.username + \"/\"\n\n\tfor _, r := range ims {\n\t\tfor _, i := range r.ImgNames {\n\n\t\t\t// display image excluding top of \"username/\"\n\t\t\tp := strings.Index(i, u)\n\t\t\tif p == -1 { // not display image whose top is not \"username/\"\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfmt.Println(i[len(u):])\n\t\t}\n\t}\n}", "func (c *TestClient) ListMachineTypes(project, zone string, opts ...ListCallOption) ([]*compute.MachineType, error) {\n\tif c.ListMachineTypesFn != nil {\n\t\treturn c.ListMachineTypesFn(project, zone, opts...)\n\t}\n\treturn c.client.ListMachineTypes(project, zone, opts...)\n}", "func ListImage(cli bce.Client, queryArgs *ListImageArgs) (*ListImageResult, error) {\n\t// Build the request\n\treq := &bce.BceRequest{}\n\treq.SetUri(getImageUri())\n\treq.SetMethod(http.GET)\n\n\tif queryArgs != nil {\n\t\tif len(queryArgs.Marker) != 0 {\n\t\t\treq.SetParam(\"marker\", queryArgs.Marker)\n\t\t}\n\t\tif queryArgs.MaxKeys != 0 {\n\t\t\treq.SetParam(\"maxKeys\", strconv.Itoa(queryArgs.MaxKeys))\n\t\t}\n\t\tif len(queryArgs.ImageName) != 0 {\n\t\t\tif len(queryArgs.ImageType) != 0 && strings.EqualFold(\"custom\", queryArgs.ImageType) {\n\t\t\t\treq.SetParam(\"imageName\", queryArgs.ImageName)\n\t\t\t} else {\n\t\t\t\treturn nil, errors.New(\"only the custom image type could filter by name\")\n\t\t\t}\n\t\t}\n\t\tif len(queryArgs.ImageType) != 0 {\n\t\t\treq.SetParam(\"imageType\", queryArgs.ImageType)\n\t\t}\n\t}\n\n\tif queryArgs == nil || queryArgs.MaxKeys == 0 {\n\t\treq.SetParam(\"maxKeys\", \"1000\")\n\t}\n\n\t// Send request and get response\n\tresp := &bce.BceResponse{}\n\tif err := cli.SendRequest(req, resp); err != nil {\n\t\treturn nil, err\n\t}\n\tif resp.IsFail() {\n\t\treturn nil, resp.ServiceError()\n\t}\n\n\tjsonBody := &ListImageResult{}\n\tif err := resp.ParseJsonBody(jsonBody); err != nil {\n\t\treturn nil, err\n\t}\n\treturn jsonBody, nil\n}", "func getImages() ([]types.ImageSummary, error) {\n\timages, err := client.ImageList(context.Background(), types.ImageListOptions{})\n\tif err != nil {\n\t\treturn []types.ImageSummary{}, err\n\t}\n\treturn images, nil\n}", "func (c *Client) ImageList(imgID *int, pendingOnly *bool) ([]Image, error) {\n\targs := make(map[string]interface{})\n\targs[\"ImageID\"] = imgID\n\n\t// special handle weird bool arg for this method\n\tif pendingOnly != nil {\n\t\tif *pendingOnly == true {\n\t\t\targs[\"pendingOnly\"] = 1\n\t\t} else {\n\t\t\targs[\"pendingOnly\"] = 0\n\t\t}\n\t}\n\n\tdata, err := c.apiCall(\"image.list\", args)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar imgs []Image\n\terr = unmarshalMultiMap(data, &imgs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn imgs, nil\n}", "func (a *Client) ListBootImage(params *ListBootImageParams) (*ListBootImageOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewListBootImageParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"listBootImage\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/Systems/{identifier}/Actions/CIMC.BootImage\",\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: &ListBootImageReader{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.(*ListBootImageOK), nil\n\n}", "func (s *ImagesByRepositoryRegistryStorage) List(selector labels.Selector) (interface{}, error) {\n\treturn nil, errors.New(\"not supported\")\n}", "func (c *containerdCAS) ListImages() ([]string, error) {\n\timageObjectList, err := ctrdClient.ImageService().List(ctrdCtx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"ListImages: Exception while getting image list. %s\", err.Error())\n\t}\n\timageNameList := make([]string, 0)\n\tfor _, image := range imageObjectList {\n\t\timageNameList = append(imageNameList, image.Name)\n\t}\n\treturn imageNameList, nil\n}", "func (_mr *MockECRAPIMockRecorder) ListImages(arg0 interface{}) *gomock.Call {\n\treturn _mr.mock.ctrl.RecordCall(_mr.mock, \"ListImages\", arg0)\n}", "func (handler *DockerImageHandler) availableImages() ([]string, error) {\n\tsession, err := handler.createSshSession()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer session.Close()\n\n\tcmd := \"docker images --format '{{.Repository}}:{{.Tag}}'\"\n\tvar buffer bytes.Buffer\n\tsession.Stdout = &buffer\n\terr = session.Run(cmd)\n\tif err != nil {\n\t\treturn nil, errors.New(fmt.Sprintf(\"Error running command '%s': %v\", cmd, err))\n\t}\n\n\tavailableImages := strings.Split(buffer.String(), \"\\n\")\n\treturn availableImages, nil\n}", "func (s *engineImageLister) List(selector labels.Selector) (ret []*v1beta1.EngineImage, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1beta1.EngineImage))\n\t})\n\treturn ret, err\n}", "func GetKustomizeImageList(images NamedImages) []kustomizetypes.Image {\n\tkImages := []kustomizetypes.Image{}\n\n\tfor iname, image := range images {\n\t\tif image == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tname, tag, digest := Split(image)\n\t\tki := kustomizetypes.Image{\n\t\t\tName: iname,\n\t\t\tNewName: name,\n\t\t\tNewTag: tag,\n\t\t\tDigest: digest,\n\t\t}\n\t\tkImages = append(kImages, ki)\n\t}\n\n\treturn kImages\n}", "func (imageService Service) Images() (image []Response, err error) {\n\treturn imageService.QueryImages(nil)\n}", "func (imageService Service) Images() (image []Response, err error) {\n\treturn imageService.QueryImages(nil)\n}", "func List(_ machine.ListOptions) ([]*machine.ListResponse, error) {\n\treturn GetVMInfos()\n}", "func (r *LocalRuntime) GetImages() ([]*ContainerImage, error) {\n\tvar containerImages []*ContainerImage\n\timages, err := r.Runtime.ImageRuntime().GetImages()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, i := range images {\n\t\tcontainerImages = append(containerImages, &ContainerImage{i})\n\t}\n\treturn containerImages, nil\n\n}", "func List(ctx context.Context, options *ListOptions) ([]*entities.ImageSummary, error) {\n\tif options == nil {\n\t\toptions = new(ListOptions)\n\t}\n\tvar imageSummary []*entities.ImageSummary\n\tconn, err := bindings.GetClient(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tparams, err := options.ToParams()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresponse, err := conn.DoRequest(ctx, nil, http.MethodGet, \"/images/json\", params, nil)\n\tif err != nil {\n\t\treturn imageSummary, err\n\t}\n\tdefer response.Body.Close()\n\n\treturn imageSummary, response.Process(&imageSummary)\n}", "func (d *DigitalOcean) Images(myImages bool) (Images, error) {\n\tv := url.Values{}\n\n\tif myImages {\n\t\tv.Set(\"filter\", \"my_images\")\n\t}\n\n\tresp, err := digitalocean.NewRequest(*d.Client, \"images\", v)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar result digitalocean.ImagesResp\n\tif err := mapstructure.Decode(resp, &result); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn result.Images, nil\n}", "func (r *CCMRequest) ListImageInfo() (*pb.ListImageInfoResponse, error) {\r\n if r.InData == \"\" {\r\n return nil, errors.New(\"input data required\")\r\n }\r\n\r\n var item pb.ImageAllQryRequest\r\n err := gc.ConvertToMessage(r.InType, r.InData, &item)\r\n if err != nil {\r\n return nil, err\r\n }\r\n\r\n ctx, cancel := context.WithTimeout(context.Background(), r.Timeout)\r\n defer cancel()\r\n\r\n return r.Client.ListImage(ctx, &item)\r\n}", "func listMyImages(w http.ResponseWriter, r *http.Request, parms martini.Params) {\r\n\tuid, _ := strconv.ParseInt(parms[\"id\"], 10, 64)\r\n\tvar i CRImage\r\n\tlogger.Println(uid)\r\n\timage := i.QuerybyUser(uid)\r\n\tlogger.Println(image)\r\n\tif err := json.NewEncoder(w).Encode(image); err != nil {\r\n\t\tlogger.Error(err)\r\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\r\n\t}\r\n}", "func RunImagesListUser(ns string, config doit.Config, out io.Writer, args []string) error {\n\tclient := config.GetGodoClient()\n\treturn listImages(ns, config, out, client.Images.ListUser)\n}", "func (db *ImageDB) ImageList(uploaderID primitive.ObjectID) ([]bson.M, error) {\n\tvar data []bson.M\n\tmatchStage := bson.D{{\"$match\", bson.D{{\"metadata.uploader\", uploaderID}}}}\n\tprojectStage := bson.D{{\"$project\", bson.D{{\"id\", \"$_id\"}, {\"_id\", 0}, {\"uploadDate\", \"$uploadDate\"}}}}\n\n\tcursor, err := db.collection.Aggregate(timeoutContext(),\n\t\tmongo.Pipeline{matchStage, projectStage})\n\tif err != nil {\n\t\treturn data, err\n\t}\n\terr = cursor.All(timeoutContext(), &data)\n\tif err != nil {\n\t\treturn data, err\n\t}\n\n\treturn data, nil\n}", "func (c *ImageRegistryCollection) List() (*ImageRegistryList, error) {\n\tlist := new(ImageRegistryList)\n\terr := c.core.db.list(c, list)\n\treturn list, err\n}", "func (a *TorrentImages) Images() []Image {\n\treturn a.images\n}", "func (rc *rawConn) ListMachineTypes(projectID, zone string) (*compute.MachineTypeList, error) { \n op := rc.MachineTypes.List(projectID, zone) <==============\n machines, err := op.Do() <==============\n if err != nil {\n return nil, errors.Annotatef(err, \"listing machine types for project %q and zone %q\", projectID, zone)\n }\n return machines, nil\n}", "func (o ApplicationSpecSourceKustomizeOutput) Images() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v ApplicationSpecSourceKustomize) []string { return v.Images }).(pulumi.StringArrayOutput)\n}", "func (gce *Connection) ListMachineTypes(zone string) ([]MachineType, error) {\n machines, err := gce.raw.ListMachineTypes(gce.projectID, zone) <========================\n if err != nil {\n return nil, errors.Trace(err)\n }\n res := make([]MachineType, len(machines.Items))\n for i, machine := range machines.Items {\n deprecated := false\n if machine.Deprecated != nil {\n deprecated = machine.Deprecated.State != \"\"\n }\n res[i] = MachineType{\n CreationTimestamp: machine.CreationTimestamp,\n Deprecated: deprecated,\n Description: machine.Description,\n GuestCpus: machine.GuestCpus,\n Id: machine.Id,\n ImageSpaceGb: machine.ImageSpaceGb,\n Kind: machine.Kind,\n MaximumPersistentDisks: machine.MaximumPersistentDisks,\n MaximumPersistentDisksSizeGb: machine.MaximumPersistentDisksSizeGb,\n MemoryMb: machine.MemoryMb,\n Name: machine.Name,\n }\n }\n return res, nil\n}", "func (az *AzureClient) ListVirtualMachines(ctx context.Context, resourceGroup string) (armhelpers.VirtualMachineListResultPage, error) {\n\tpage, err := az.virtualMachinesClient.List(ctx, resourceGroup)\n\tc := VirtualMachineListResultPageClient{\n\t\tvmlrp: page,\n\t\terr: err,\n\t}\n\treturn &c, err\n}", "func (o ApplicationSpecSourceKustomizePtrOutput) Images() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *ApplicationSpecSourceKustomize) []string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Images\n\t}).(pulumi.StringArrayOutput)\n}", "func (i *ImagesClient) List(planID int) ([]Images, *Response, error) {\n\t//root := new(teamRoot)\n\n\tplanIDString := strconv.Itoa(planID)\n\n\tplansPath := strings.Join([]string{baseImagePath, planIDString, endImagePath}, \"/\")\n\n\tvar trans []Images\n\n\tresp, err := i.client.MakeRequest(\"GET\", plansPath, nil, &trans)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Error: %v\", err)\n\t}\n\n\treturn trans, resp, err\n}", "func getImages(t *testing.T) []string {\n\tvar (\n\t\timages = map[string]string{\n\t\t\t\"helloworld\": \"ghcr.io/ease-lab/helloworld:var_workload\",\n\t\t\t\"chameleon\": \"ghcr.io/ease-lab/chameleon:var_workload\",\n\t\t\t\"pyaes\": \"ghcr.io/ease-lab/pyaes:var_workload\",\n\t\t\t\"image_rotate\": \"ghcr.io/ease-lab/image_rotate:var_workload\",\n\t\t\t\"json_serdes\": \"ghcr.io/ease-lab/json_serdes:var_workload\",\n\t\t\t\"lr_serving\": \"ghcr.io/ease-lab/lr_serving:var_workload\",\n\t\t\t\"cnn_serving\": \"ghcr.io/ease-lab/cnn_serving:var_workload\",\n\t\t\t\"rnn_serving\": \"ghcr.io/ease-lab/rnn_serving:var_workload\",\n\t\t}\n\t\tfuncs = strings.Split(*funcNames, \",\")\n\t\tresult []string\n\t)\n\n\tfor _, funcName := range funcs {\n\t\timageName, isPresent := images[funcName]\n\t\trequire.True(t, isPresent, \"Function %s is not supported\", funcName)\n\t\tresult = append(result, imageName)\n\t}\n\n\treturn result\n}", "func (c *Client) GetImages() ([]*types.ImageInfo, error) {\n\tctx, cancel := getContextWithTimeout(hyperContextTimeout)\n\tdefer cancel()\n\n\treq := types.ImageListRequest{}\n\timageList, err := c.client.ImageList(ctx, &req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn imageList.ImageList, nil\n}", "func (m *VirtualEndpoint) SetDeviceImages(value []CloudPcDeviceImageable)() {\n err := m.GetBackingStore().Set(\"deviceImages\", value)\n if err != nil {\n panic(err)\n }\n}" ]
[ "0.70809364", "0.66474295", "0.65642136", "0.6548682", "0.63510364", "0.633697", "0.6303774", "0.62981117", "0.62465405", "0.62222695", "0.6201505", "0.62002414", "0.619519", "0.61688447", "0.6160467", "0.6004743", "0.59967077", "0.5980087", "0.5979915", "0.59797573", "0.59726167", "0.5952696", "0.59399605", "0.59341806", "0.5913355", "0.59018046", "0.58883494", "0.5885527", "0.5874138", "0.5871238", "0.58423007", "0.58395094", "0.5835433", "0.5820709", "0.58169883", "0.58128214", "0.5769247", "0.57626027", "0.5744636", "0.5744404", "0.5724543", "0.5718803", "0.5697165", "0.5686477", "0.567359", "0.5671246", "0.5656314", "0.5653847", "0.56518775", "0.5645361", "0.5641974", "0.5635674", "0.5633857", "0.56324685", "0.5630306", "0.5620797", "0.5606018", "0.5605939", "0.5558026", "0.5557332", "0.555611", "0.5546917", "0.5525382", "0.5522985", "0.552294", "0.5522615", "0.55202746", "0.5505554", "0.5504975", "0.55035186", "0.5492348", "0.54900193", "0.5479488", "0.5479129", "0.5468848", "0.5460172", "0.5459873", "0.54302216", "0.5414888", "0.5411043", "0.5411043", "0.5399769", "0.53963876", "0.53795123", "0.53783405", "0.53775656", "0.5370814", "0.5348764", "0.53478366", "0.5335023", "0.53291386", "0.53076136", "0.53074074", "0.5300601", "0.5283395", "0.52806807", "0.52798223", "0.5275124", "0.5268191", "0.52650523" ]
0.835723
0
DeleteMachineImage uses the override method DeleteMachineImageFn or the real implementation.
func (c *TestClient) DeleteMachineImage(project, name string) error { if c.DeleteMachineImageFn != nil { return c.DeleteMachineImageFn(project, name) } return c.client.DeleteMachineImage(project, name) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *MachineImagesClient) DeleteMachineImage(deleteInput *DeleteMachineImageInput) error {\n\treturn c.deleteResource(deleteInput.Name)\n}", "func (ms *MachinePlugin) DeleteMachine(ctx context.Context, req *cmi.DeleteMachineRequest) (*cmi.DeleteMachineResponse, error) {\n\t// Log messages to track delete request\n\tglog.V(2).Infof(\"Machine deletion request has been recieved for %q\", req.MachineName)\n\tdefer glog.V(2).Infof(\"Machine deletion request has been processed for %q\", req.MachineName)\n\n\tproviderSpec, secrets, err := decodeProviderSpecAndSecret(req.ProviderSpec, req.Secrets, false)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tinstances, err := ms.getInstancesFromMachineName(req.MachineName, providerSpec, secrets)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsvc, err := ms.createSVC(secrets, providerSpec.Region)\n\tif err != nil {\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\n\tfor _, instance := range instances {\n\t\tinput := &ec2.TerminateInstancesInput{\n\t\t\tInstanceIds: []*string{\n\t\t\t\taws.String(*instance.InstanceId),\n\t\t\t},\n\t\t\tDryRun: aws.Bool(false),\n\t\t}\n\t\t_, err = svc.TerminateInstances(input)\n\t\tif err != nil {\n\t\t\tglog.V(2).Infof(\"VM %q for Machine %q couldn't be terminated: %s\",\n\t\t\t\t*instance.InstanceId,\n\t\t\t\treq.MachineName,\n\t\t\t\terr.Error(),\n\t\t\t)\n\t\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t\t}\n\n\t\tglog.V(2).Infof(\"VM %q for Machine %q was terminated succesfully\", *instance.InstanceId, req.MachineName)\n\t}\n\n\treturn &cmi.DeleteMachineResponse{}, nil\n}", "func qemuImgDelete(sysOS *sys.OS, imgPath string) error {\n\treturn deleteProfile(sysOS, qemuImgProfileName(imgPath), qemuImgProfileFilename(imgPath))\n}", "func (s *Reconciler) Delete(ctx context.Context) error {\n\tvmSpec := &virtualmachines.Spec{\n\t\tName: s.scope.Machine.Name,\n\t}\n\n\t// Getting a vm object does not work here so let's assume\n\t// an instance is really being deleted\n\tif s.scope.Machine.Annotations == nil {\n\t\ts.scope.Machine.Annotations = make(map[string]string)\n\t}\n\ts.scope.Machine.Annotations[MachineInstanceStateAnnotationName] = string(machinev1.VMStateDeleting)\n\tvmStateDeleting := machinev1.VMStateDeleting\n\ts.scope.MachineStatus.VMState = &vmStateDeleting\n\n\terr := s.virtualMachinesSvc.Delete(ctx, vmSpec)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to delete machine: %w\", err)\n\t}\n\n\tosDiskSpec := &disks.Spec{\n\t\tName: azure.GenerateOSDiskName(s.scope.Machine.Name),\n\t}\n\terr = s.disksSvc.Delete(ctx, osDiskSpec)\n\tif err != nil {\n\t\tmetrics.RegisterFailedInstanceDelete(&metrics.MachineLabels{\n\t\t\tName: s.scope.Machine.Name,\n\t\t\tNamespace: s.scope.Machine.Namespace,\n\t\t\tReason: err.Error(),\n\t\t})\n\t\treturn fmt.Errorf(\"failed to delete OS disk: %w\", err)\n\t}\n\n\tif s.scope.MachineConfig.Vnet == \"\" {\n\t\treturn fmt.Errorf(\"MachineConfig vnet is missing on machine %s\", s.scope.Machine.Name)\n\t}\n\n\tnetworkInterfaceSpec := &networkinterfaces.Spec{\n\t\tName: azure.GenerateNetworkInterfaceName(s.scope.Machine.Name),\n\t\tVnetName: s.scope.MachineConfig.Vnet,\n\t}\n\n\terr = s.networkInterfacesSvc.Delete(ctx, networkInterfaceSpec)\n\tif err != nil {\n\t\tmetrics.RegisterFailedInstanceDelete(&metrics.MachineLabels{\n\t\t\tName: s.scope.Machine.Name,\n\t\t\tNamespace: s.scope.Machine.Namespace,\n\t\t\tReason: err.Error(),\n\t\t})\n\t\treturn fmt.Errorf(\"Unable to delete network interface: %w\", err)\n\t}\n\n\tif s.scope.MachineConfig.PublicIP {\n\t\tpublicIPName, err := azure.GenerateMachinePublicIPName(s.scope.MachineConfig.Name, s.scope.Machine.Name)\n\t\tif err != nil {\n\t\t\t// Only when the generated name is longer than allowed by the Azure portal\n\t\t\t// That can happen only when\n\t\t\t// - machine name is changed (can't happen without creating a new CR)\n\t\t\t// - cluster name is changed (could happen but then we will get different name anyway)\n\t\t\t// - machine CR was created with too long public ip name (in which case no instance was created)\n\t\t\tklog.Info(\"Generated public IP name was too long, skipping deletion of the resource\")\n\t\t\treturn nil\n\t\t}\n\n\t\terr = s.publicIPSvc.Delete(ctx, &publicips.Spec{\n\t\t\tName: publicIPName,\n\t\t})\n\t\tif err != nil {\n\t\t\tmetrics.RegisterFailedInstanceDelete(&metrics.MachineLabels{\n\t\t\t\tName: s.scope.Machine.Name,\n\t\t\t\tNamespace: s.scope.Machine.Namespace,\n\t\t\t\tReason: err.Error(),\n\t\t\t})\n\t\t\treturn fmt.Errorf(\"unable to delete Public IP: %w\", err)\n\t\t}\n\t}\n\n\t// Delete the availability set with the given name if no virtual machines are attached to it.\n\tif err := s.availabilitySetsSvc.Delete(ctx, &availabilitysets.Spec{\n\t\tName: s.getAvailibilitySetName(),\n\t}); err != nil {\n\t\treturn fmt.Errorf(\"failed to delete availability set: %w\", err)\n\t}\n\n\treturn nil\n}", "func (r *Reconciler) deleteMachine(\n\tctx context.Context,\n\tlog *zap.SugaredLogger,\n\tprov cloudprovidertypes.Provider,\n\tproviderName providerconfigtypes.CloudProvider,\n\tmachine *clusterv1alpha1.Machine,\n\tskipEviction bool,\n) (*reconcile.Result, error) {\n\tvar (\n\t\tshouldEvict bool\n\t\terr error\n\t)\n\n\tif !skipEviction {\n\t\tshouldEvict, err = r.shouldEvict(ctx, log, machine)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tshouldCleanUpVolumes, err := r.shouldCleanupVolumes(ctx, log, machine, providerName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar evictedSomething, deletedSomething bool\n\tvar volumesFree = true\n\tif shouldEvict {\n\t\tevictedSomething, err = eviction.New(machine.Status.NodeRef.Name, r.client, r.kubeClient).Run(ctx, log)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to evict node %s: %w\", machine.Status.NodeRef.Name, err)\n\t\t}\n\t}\n\tif shouldCleanUpVolumes {\n\t\tdeletedSomething, volumesFree, err = poddeletion.New(machine.Status.NodeRef.Name, r.client, r.kubeClient).Run(ctx, log)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to delete pods bound to volumes running on node %s: %w\", machine.Status.NodeRef.Name, err)\n\t\t}\n\t}\n\n\tif evictedSomething || deletedSomething || !volumesFree {\n\t\treturn &reconcile.Result{RequeueAfter: 10 * time.Second}, nil\n\t}\n\n\tif result, err := r.deleteCloudProviderInstance(ctx, log, prov, machine); result != nil || err != nil {\n\t\treturn result, err\n\t}\n\n\t// Delete the node object only after the instance is gone, `deleteCloudProviderInstance`\n\t// returns with a nil-error after it triggers the instance deletion but it is async for\n\t// some providers hence the instance deletion may not been executed yet\n\t// `FinalizerDeleteInstance` stays until the instance is really gone thought, so we check\n\t// for that here\n\tif sets.NewString(machine.Finalizers...).Has(FinalizerDeleteInstance) {\n\t\treturn nil, nil\n\t}\n\n\tnodes, err := r.retrieveNodesRelatedToMachine(ctx, log, machine)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := r.deleteNodeForMachine(ctx, log, nodes, machine); err != nil {\n\t\treturn nil, err\n\t}\n\n\tr.metrics.Deprovisioning.Observe(time.Until(machine.DeletionTimestamp.Time).Abs().Seconds())\n\n\treturn nil, nil\n}", "func (s *azureMachineService) Delete() error {\n\tvmSpec := &virtualmachines.Spec{\n\t\tName: s.machineScope.Name(),\n\t}\n\n\terr := s.virtualMachinesSvc.Delete(s.clusterScope.Context, vmSpec)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to delete machine\")\n\t}\n\n\tnetworkInterfaceSpec := &networkinterfaces.Spec{\n\t\tName: azure.GenerateNICName(s.machineScope.Name()),\n\t\tVnetName: azure.GenerateVnetName(s.clusterScope.Name()),\n\t}\n\n\terr = s.networkInterfacesSvc.Delete(s.clusterScope.Context, networkInterfaceSpec)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"Unable to delete network interface\")\n\t}\n\n\tpublicIPSpec := &publicips.Spec{\n\t\tName: azure.GenerateNICName(s.machineScope.Name()) + \"-public-ip\",\n\t}\n\n\terr = s.publicIPSvc.Delete(s.clusterScope.Context, publicIPSpec)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"unable to delete publicIP\")\n\t}\n\n\tOSDiskSpec := &disks.Spec{\n\t\tName: azure.GenerateOSDiskName(s.machineScope.Name()),\n\t}\n\terr = s.disksSvc.Delete(s.clusterScope.Context, OSDiskSpec)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"Failed to delete OS disk of machine %s\", s.machineScope.Name())\n\t}\n\n\treturn nil\n}", "func (a *ExistingInfraMachineReconciler) delete(ctx context.Context, c *existinginfrav1.ExistingInfraCluster, machine *clusterv1.Machine, eim *existinginfrav1.ExistingInfraMachine) error {\n\tcontextLog := log.WithFields(log.Fields{\"machine\": machine.Name, \"cluster\": c.Name})\n\tcontextLog.Info(\"deleting machine...\")\n\taddr := a.getMachineAddress(eim)\n\tnode, err := a.findNodeByPrivateAddress(ctx, addr)\n\tif err != nil {\n\t\treturn gerrors.Wrapf(err, \"failed to find node by address: %s\", addr)\n\t}\n\t// Check if there's an adequate number of masters\n\tisMaster := isMaster(node)\n\tmasters, err := a.getMasterNodes(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif isMaster && len(masters) == 1 {\n\t\treturn errors.New(\"there should be at least one master\")\n\t}\n\tif err := drain.Drain(node, a.clientSet, drain.Params{\n\t\tForce: true,\n\t\tDeleteEmptyDirData: true,\n\t\tIgnoreAllDaemonSets: true,\n\t}); err != nil {\n\t\treturn err\n\t}\n\n\t//After deleting the k8s resource we need to reset the node so it can be readded later with a clean state.\n\t//best effort attempt to clean up the machine after deleting it.\n\ta.resetMachine(ctx, c, machine, eim)\n\n\tif err := a.Client.Delete(ctx, node); err != nil {\n\t\treturn err\n\t}\n\ta.recordEvent(machine, corev1.EventTypeNormal, \"Delete\", \"deleted machine %s\", machine.Name)\n\treturn nil\n}", "func (m *Machine) Delete() error {\n\tnamespacedName := types.NamespacedName{Namespace: m.namespace, Name: m.machineContext.KubevirtMachine.Name}\n\tvm := &kubevirtv1.VirtualMachine{}\n\tif err := m.client.Get(m.machineContext.Context, namespacedName, vm); err != nil {\n\t\tif apierrors.IsNotFound(err) {\n\t\t\tm.machineContext.Logger.Info(\"VM does not exist, nothing to do.\")\n\t\t\treturn nil\n\t\t}\n\t\treturn errors.Wrapf(err, \"failed to retrieve VM to delete\")\n\t}\n\n\tif err := m.client.Delete(gocontext.Background(), vm); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to delete VM\")\n\t}\n\n\treturn nil\n}", "func (a *Actuator) Delete(ctx context.Context, machine *machinev1.Machine) error {\n\tklog.Infof(\"%s actuator deleting machine from namespace %s\", machine.Name, machine.Namespace)\n\n\tscope, err := newMachineScope(machineScopeParams{\n\t\tContext: ctx,\n\t\tclient: a.client,\n\t\tmachine: machine,\n\t\talibabacloudClientBuilder: a.alibabacloudClientBuilder,\n\t\tconfigManagedClient: a.configManagedClient,\n\t})\n\n\tif err != nil {\n\t\treturn a.handleMachineError(machine, machineapierrors.DeleteMachine(\"failed to create machine %q scope: %v\", machine.Name, err), deleteEventAction)\n\t}\n\n\tif err = a.reconcilerBuilder(scope).Delete(context.Background()); err != nil {\n\t\tif err := scope.patchMachine(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn a.handleMachineError(machine, machineapierrors.InvalidMachineConfiguration(\"failed to reconcile machine %q: %v\", machine.Name, err), deleteEventAction)\n\t}\n\n\ta.eventRecorder.Eventf(machine, corev1.EventTypeNormal, \"Deleted\", \"Deleted machine %q\", machine.Name)\n\treturn scope.patchMachine()\n}", "func (a *Actuator) Delete(c *clusterv1.Cluster, m *clusterv1.Machine) error {\n\tglog.Infof(\"Deleting machine %s for cluster %s.\", m.Name, c.Name)\n\n\tif a.machineSetupConfigGetter == nil {\n\t\treturn a.handleMachineError(m, apierrors.InvalidMachineConfiguration(\"valid machineSetupConfigGetter is required\"), deleteEventAction)\n\t}\n\n\t// First get provider config\n\tmachineConfig, err := a.machineProviderConfig(m.Spec.ProviderConfig)\n\tif err != nil {\n\t\treturn a.handleMachineError(m, apierrors.InvalidMachineConfiguration(\"Cannot unmarshal machine's providerConfig field: %v\", err), deleteEventAction)\n\t}\n\n\t// Now validate\n\tif err := a.validateMachine(m, machineConfig); err != nil {\n\t\treturn a.handleMachineError(m, err, deleteEventAction)\n\t}\n\n\t// Check if the machine exists (here we mean it is not bootstrapping.)\n\texists, err := a.Exists(c, m)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !exists {\n\t\tglog.Infof(\"Machine %s for cluster %s does not exists (maybe it is still bootstrapping), skipping.\", m.Name, c.Name)\n\t\treturn nil\n\t}\n\n\t// The exists case here.\n\tglog.Infof(\"Machine %s for cluster %s exists.\", m.Name, c.Name)\n\n\tconfigParams := &MachineParams{\n\t\tRoles: machineConfig.Roles,\n\t\tVersions: m.Spec.Versions,\n\t}\n\n\tmetadata, err := a.getMetadata(c, m, configParams, machineConfig.SSHConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tglog.Infof(\"Metadata retrieved: machine %s for cluster %s\", m.Name, c.Name)\n\n\tprivateKey, passPhrase, err := a.getPrivateKey(c, m.Namespace, machineConfig.SSHConfig.SecretName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tglog.Infof(\"Running shutdown script: machine %s for cluster %s...\", m.Name, c.Name)\n\n\tsshClient := ssh.NewSSHProviderClient(privateKey, passPhrase, machineConfig.SSHConfig)\n\n\tif err = sshClient.WriteFile(metadata.ShutdownScript, \"/var/tmp/shutdownscript.sh\"); err != nil {\n\t\tglog.Errorf(\"Error copying shutdown script: %v\", err)\n\t\treturn err\n\t}\n\n\tif err = sshClient.ProcessCMD(\"chmod +x /var/tmp/shutdownscript.sh && bash /var/tmp/shutdownscript.sh\"); err != nil {\n\t\tglog.Errorf(\"running shutdown script error: %v\", err)\n\t\treturn err\n\t}\n\n\ta.eventRecorder.Eventf(m, corev1.EventTypeNormal, \"Deleted\", \"Deleted Machine %v\", m.Name)\n\treturn nil\n}", "func (util *AzUtil) DeleteVirtualMachine(rg string, name string) error {\n\tctx, cancel := getContextWithCancel()\n\tdefer cancel()\n\n\tvm, rerr := util.manager.azClient.virtualMachinesClient.Get(ctx, rg, name, \"\")\n\tif rerr != nil {\n\t\tif exists, _ := checkResourceExistsFromRetryError(rerr); !exists {\n\t\t\tklog.V(2).Infof(\"VirtualMachine %s/%s has already been removed\", rg, name)\n\t\t\treturn nil\n\t\t}\n\n\t\tklog.Errorf(\"failed to get VM: %s/%s: %s\", rg, name, rerr.Error())\n\t\treturn rerr.Error()\n\t}\n\n\tvhd := vm.VirtualMachineProperties.StorageProfile.OsDisk.Vhd\n\tmanagedDisk := vm.VirtualMachineProperties.StorageProfile.OsDisk.ManagedDisk\n\tif vhd == nil && managedDisk == nil {\n\t\tklog.Errorf(\"failed to get a valid os disk URI for VM: %s/%s\", rg, name)\n\t\treturn fmt.Errorf(\"os disk does not have a VHD URI\")\n\t}\n\n\tosDiskName := vm.VirtualMachineProperties.StorageProfile.OsDisk.Name\n\tvar nicName string\n\tvar err error\n\tnicID := (*vm.VirtualMachineProperties.NetworkProfile.NetworkInterfaces)[0].ID\n\tif nicID == nil {\n\t\tklog.Warningf(\"NIC ID is not set for VM (%s/%s)\", rg, name)\n\t} else {\n\t\tnicName, err = resourceName(*nicID)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tklog.Infof(\"found nic name for VM (%s/%s): %s\", rg, name, nicName)\n\t}\n\n\tklog.Infof(\"deleting VM: %s/%s\", rg, name)\n\tdeleteCtx, deleteCancel := getContextWithCancel()\n\tdefer deleteCancel()\n\n\tklog.Infof(\"waiting for VirtualMachine deletion: %s/%s\", rg, name)\n\trerr = util.manager.azClient.virtualMachinesClient.Delete(deleteCtx, rg, name)\n\t_, realErr := checkResourceExistsFromRetryError(rerr)\n\tif realErr != nil {\n\t\treturn realErr\n\t}\n\tklog.V(2).Infof(\"VirtualMachine %s/%s removed\", rg, name)\n\n\tif len(nicName) > 0 {\n\t\tklog.Infof(\"deleting nic: %s/%s\", rg, nicName)\n\t\tinterfaceCtx, interfaceCancel := getContextWithCancel()\n\t\tdefer interfaceCancel()\n\t\tklog.Infof(\"waiting for nic deletion: %s/%s\", rg, nicName)\n\t\tnicErr := util.manager.azClient.interfacesClient.Delete(interfaceCtx, rg, nicName)\n\t\t_, realErr := checkResourceExistsFromRetryError(nicErr)\n\t\tif realErr != nil {\n\t\t\treturn realErr\n\t\t}\n\t\tklog.V(2).Infof(\"interface %s/%s removed\", rg, nicName)\n\t}\n\n\tif vhd != nil {\n\t\taccountName, vhdContainer, vhdBlob, err := splitBlobURI(*vhd.URI)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tklog.Infof(\"found os disk storage reference: %s %s %s\", accountName, vhdContainer, vhdBlob)\n\n\t\tklog.Infof(\"deleting blob: %s/%s\", vhdContainer, vhdBlob)\n\t\tif err = util.DeleteBlob(accountName, vhdContainer, vhdBlob); err != nil {\n\t\t\t_, realErr := checkResourceExistsFromError(err)\n\t\t\tif realErr != nil {\n\t\t\t\treturn realErr\n\t\t\t}\n\t\t\tklog.V(2).Infof(\"Blob %s/%s removed\", rg, vhdBlob)\n\t\t}\n\t} else if managedDisk != nil {\n\t\tif osDiskName == nil {\n\t\t\tklog.Warningf(\"osDisk is not set for VM %s/%s\", rg, name)\n\t\t} else {\n\t\t\tklog.Infof(\"deleting managed disk: %s/%s\", rg, *osDiskName)\n\t\t\tdisksCtx, disksCancel := getContextWithCancel()\n\t\t\tdefer disksCancel()\n\t\t\tdiskErr := util.manager.azClient.disksClient.Delete(disksCtx, util.manager.config.SubscriptionID, rg, *osDiskName)\n\t\t\t_, realErr := checkResourceExistsFromRetryError(diskErr)\n\t\t\tif realErr != nil {\n\t\t\t\treturn realErr\n\t\t\t}\n\t\t\tklog.V(2).Infof(\"disk %s/%s removed\", rg, *osDiskName)\n\t\t}\n\t}\n\n\treturn nil\n}", "func (s *LocalTests) deleteMachine(c *gc.C, machineId string) {\n\terr := s.testClient.StopMachine(machineId)\n\tc.Assert(err, gc.IsNil)\n\n\t// wait for machine to be stopped\n\tfor !s.pollMachineState(c, machineId, \"stopped\") {\n\t\ttime.Sleep(1 * time.Second)\n\t}\n\n\terr = s.testClient.DeleteMachine(machineId)\n\tc.Assert(err, gc.IsNil)\n}", "func getMachineDeleteAnnotationKey() string {\n\tkey := fmt.Sprintf(\"%s/delete-machine\", getCAPIGroup())\n\treturn key\n}", "func deleteImage(t *testing.T, projectID string, imageName string) {\n\t// Load the Image ID saved by the earlier build_image stage\n\timage := gcp.FetchImage(t, projectID, imageName)\n\timage.DeleteImage(t)\n}", "func (ref ostreeReference) DeleteImage(ctx context.Context, sys *types.SystemContext) error {\n\treturn errors.New(\"Deleting images not implemented for ostree: images\")\n}", "func (m *Machine) Delete() error {\n\tfmt.Printf(\"Delete %s: %s\\n\", m.Name, m.State)\n\treturn nil\n}", "func (az *AzureClient) DeleteVirtualMachine(ctx context.Context, resourceGroup, name string) error {\n\tfuture, err := az.virtualMachinesClient.Delete(ctx, resourceGroup, name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err = future.WaitForCompletionRef(ctx, az.virtualMachinesClient.Client); err != nil {\n\t\treturn err\n\t}\n\n\t_, err = future.Result(az.virtualMachinesClient)\n\treturn err\n}", "func DeleteImageService(imageid string) bool {\n\tsuccess := domain.UserDeleteItem(imageid)\n\treturn success\n}", "func DeleteImageE(t *testing.T, projectID string, imageID string) error {\n\tlogger.Logf(t, \"Destroying Image %s\", imageID)\n\n\tctx := context.Background()\n\n\tservice, err := NewComputeServiceE(t)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := service.Images.Delete(projectID, imageID).Context(ctx).Do(); err != nil {\n\t\treturn fmt.Errorf(\"Images.Delete(%s) got error: %v\", imageID, err)\n\t}\n\n\treturn err\n}", "func DeleteMachineForName(envContainer app.EnvContainer, name string) (bool, error) {\n\tfilePath, err := GetFilePath(envContainer)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn deleteMachineForFilePath(name, filePath)\n}", "func (v *IBM) DeleteImage(ctx *lepton.Context, snapshotID string) error {\n\treturn nil\n}", "func ExampleMachineExtensionsClient_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 := armconnectedvmware.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.NewMachineExtensionsClient().BeginDelete(ctx, \"myResourceGroup\", \"myMachine\", \"MMA\", 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 ExampleMachineExtensionsClient_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 := armhybridcompute.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.NewMachineExtensionsClient().BeginDelete(ctx, \"myResourceGroup\", \"myMachine\", \"MMA\", 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 CtrDeleteImage(reference string) error {\n\tif err := verifyCtr(); err != nil {\n\t\treturn fmt.Errorf(\"CtrDeleteImage: exception while verifying ctrd client: %s\", err.Error())\n\t}\n\treturn CtrdClient.ImageService().Delete(ctrdCtx, reference)\n}", "func deleteImageResource(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {\n\t// Warning or errors can be collected in a slice type\n\tvar diags diag.Diagnostics\n\tclient := (meta.(Client)).Client\n\tname := rdEntryStr(d, \"name\")\n\tid := rdEntryStr(d, \"id\")\n\terrMsgPrefix := getErrMsgPrefix(\"Image\", name, id, \"Delete\")\n\tcfg, err := getImage(client, name, id)\n\tif err != nil {\n\t\treturn diag.Errorf(\"%s Failed to get Image. err: %s\", errMsgPrefix, err.Error())\n\t}\n\tif cfg == nil {\n\t\tlog.Printf(\"%s Unexpected Error. nil config\", errMsgPrefix)\n\t\treturn diags\n\t}\n\tclient.XRequestIdPrefix = \"TF-image-delete\"\n\turlExtension := getImageUrl(name, id, \"delete\")\n\trspData := &swagger_models.ZsrvResponse{}\n\t_, err = client.SendReq(\"DELETE\", urlExtension, nil, rspData)\n\tif err != nil {\n\t\treturn diag.Errorf(\"%s. Request Failed. err: %s\", errMsgPrefix, err.Error())\n\t}\n\tlog.Printf(\"[INFO] Image %s(id:%s) Delete Successful.\", name, cfg.ID)\n\treturn diags\n}", "func (c *TestClient) GetMachineImage(project, name string) (*compute.MachineImage, error) {\n\tif c.GetMachineImageFn != nil {\n\t\treturn c.GetMachineImageFn(project, name)\n\t}\n\treturn c.client.GetMachineImage(project, name)\n}", "func (c *PostgresSQL) DeleteVirtualMachine(userID string, VirtualMachineID string) error {\n\t_, err := c.db.NamedExec(\n\t\t`UPDATE virtual_machines SET deleted_at = now()\n\t\tWHERE id = :id AND user_id = :user_id`, map[string]interface{}{\n\t\t\t\"id\": VirtualMachineID,\n\t\t\t\"user_id\": userID,\n\t\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (c *TestClient) DeleteImage(project, name string) error {\n\tif c.DeleteImageFn != nil {\n\t\treturn c.DeleteImageFn(project, name)\n\t}\n\treturn c.client.DeleteImage(project, name)\n}", "func (m *Machine) Delete() {\n\tm.Lock()\n\tdefer m.Unlock()\n\n\tm.manager.Delete()\n\n\tif m.backoffTimer != nil {\n\t\tm.backoffTimer.Stop()\n\t}\n\n\tif m.cancel != nil {\n\t\tm.Infof(\"runner\", \"Stopping\")\n\t\tm.cancel()\n\t}\n\n\tm.startTime = time.Time{}\n}", "func (i *PowerVSImageScope) DeleteImage() error {\n\tif err := i.IBMPowerVSClient.DeleteImage(i.IBMPowerVSImage.Status.ImageID); err != nil {\n\t\trecord.Warnf(i.IBMPowerVSImage, \"FailedDeleteImage\", \"Failed image deletion - %v\", err)\n\t\treturn err\n\t}\n\trecord.Eventf(i.IBMPowerVSImage, \"SuccessfulDeleteImage\", \"Deleted Image %q\", i.IBMPowerVSImage.Status.ImageID)\n\treturn nil\n}", "func (d *driverMock) DeleteImage(ctx context.Context, id string) error {\n\tif d.DeleteImageErr != nil {\n\t\treturn d.DeleteImageErr\n\t}\n\n\td.DeleteImageID = id\n\n\treturn nil\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 deleteImage(c *cli.Context) error {\n\terr := checkArgCount(c, 1)\n\tif err != nil {\n\t\treturn err\n\t}\n\tid := c.Args().First()\n\n\tif confirmed(c) {\n\t\tclient.Photonclient, err = client.GetClient(c)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tdeleteTask, err := client.Photonclient.Images.Delete(id)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t_, err = waitOnTaskOperation(deleteTask.ID, c)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tfmt.Println(\"OK, canceled\")\n\t}\n\n\treturn nil\n}", "func (c CRImage) DeleteImg() {\n\t_, err := dbmap.Delete(&c)\n\tif err != nil {\n\t\tlog.Println(\"Delete failed\", err)\n\t\treturn\n\t}\n\tcf := new(CRFork)\n\terr = dbmap.SelectOne(&cf, \"select fork_id from cr_fork where user_id = ? and image_id = ?\", c.UserId, c.ImageId)\n\tif err != nil {\n\t\treturn\n\t}\n\t_, err = dbmap.Delete(&cf)\n\tif err != nil {\n\t\tlog.Println(\"Delete failed\", err)\n\t\treturn\n\t}\n}", "func StorageImagesDeleteSpinRegistryPath() string {\n\treturn \"/storage/images/delete\"\n}", "func (client ListManagementImageClient) DeleteImageResponder(resp *http.Response) (result String, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tclient.ByInspecting(),\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result.Value),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "func (cce *CCEClient) Delete(ctx context.Context, cluster *clusterv1.Cluster, machine *clusterv1.Machine) error {\n\tglog.V(4).Info(\"Delete node: %s\", machine.Name)\n\tkubeclient, err := cce.getKubeClient(cluster)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := kubeclient.CoreV1().Nodes().Delete(machine.Name, &metav1.DeleteOptions{}); err != nil {\n\t\tif !apierrors.IsNotFound(err) {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tglog.V(4).Infof(\"Release machine: %s\", machine.Name)\n\tinstance, err := cce.instanceIfExists(cluster, machine)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif instance == nil || len(instance.CreationTime) == 0 {\n\t\tglog.Infof(\"Skipped delete a VM that already does not exist\")\n\t\treturn nil\n\t}\n\tif err := cce.computeService.Bcc().DeleteInstance(instance.InstanceID, nil); err != nil {\n\t\tglog.Errorf(\"delete instance %s err: %+v\", instance.InstanceID, err)\n\t\treturn err\n\t}\n\ttime.Sleep(3 * time.Second)\n\treturn nil\n}", "func (s *Server) DeleteImage(w http.ResponseWriter, r *http.Request, params httprouter.Params) {\n\tUUID := params.ByName(\"UUID\")\n\tdeleteKey := params.ByName(\"key\")\n\timage, err := s.imageDao.Load(UUID)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\treturn\n\t}\n\tif image.Delete != deleteKey {\n\t\tw.WriteHeader(http.StatusForbidden)\n\t\treturn\n\t}\n\terr = s.imageDao.Delete(image)\n\tif err != nil {\n\t\ts.logger.Println(err)\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\treturn\n\t}\n\terr = s.fs.Delete(image)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\treturn\n\t}\n\n}", "func (v *ImageClient) Delete(imageName string) error {\n\n\t//Construct the composite key to select the entry\n\tkey := ImageKey{\n\t\t// Owner:\townerName,\n\t\t// ClusterName:\tclusterName,\n\t\tImageName: imageName,\n\t}\n\terr := v.util.DBDelete(v.storeName, key, v.tagMeta)\n\n\t//Delete image from FS\n\tfilePath, _, err := v.GetDirPath(imageName)\n\tif err != nil {\n\t\treturn pkgerrors.Wrap(err, \"Get file path\")\n\t}\n\terr = os.Remove(filePath)\n if err != nil {\n return pkgerrors.Wrap(err, \"Delete image file\")\n }\n\n\treturn nil\n}", "func (m *Manager) DeleteImage(hash string) error {\n\tif hash == \"\" {\n\t\treturn nil\n\t}\n\tm.imagesLock.Lock()\n\tdelete(m.images, hash)\n\tm.imagesLock.Unlock()\n\treturn os.RemoveAll(filepath.Join(m.Options.Directory, hash))\n}", "func (v VirtualMachine) Delete() error {\n\ttctx, tcancel := context.WithTimeout(context.Background(), time.Minute*5)\n\tdefer tcancel()\n\n\tpowerState, err := v.vm.PowerState(context.Background())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Getting power state: %s\", powerState)\n\t}\n\n\tif powerState == \"poweredOn\" || powerState == \"suspended\" {\n\t\tpowerOff, err := v.vm.PowerOff(context.Background())\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Shutting down virtual machine: %s\", err)\n\t\t}\n\n\t\terr = powerOff.Wait(tctx)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Waiting for machine to shut down: %s\", err)\n\t\t}\n\t}\n\n\tdestroy, err := v.vm.Destroy(context.Background())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Destroying virtual machine: %s\", err)\n\t}\n\n\terr = destroy.Wait(tctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Waiting for machine to destroy: %s\", err)\n\t}\n\n\treturn nil\n}", "func DeleteMachineHealthCheck(healthcheckName string) error {\n\tc, err := LoadClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tkey := types.NamespacedName{\n\t\tName: healthcheckName,\n\t\tNamespace: NamespaceOpenShiftMachineAPI,\n\t}\n\thealthcheck := &mrv1.MachineHealthCheck{}\n\tif err := c.Get(context.TODO(), key, healthcheck); err != nil {\n\t\treturn err\n\t}\n\treturn c.Delete(context.TODO(), healthcheck)\n}", "func (i *ImagesModel) DeleteImage(imageID string) error {\n\tfound, err := i.GetImage(imageID)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Getting image metadata\")\n\t}\n\n\tif found == nil {\n\t\treturn controller.ErrImageMetaNotFound\n\t}\n\n\tinUse, err := i.deployments.ImageUsedInActiveDeployment(imageID)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Checking if image is used in active deployment\")\n\t}\n\n\t// Image is in use, not allowed to delete\n\tif inUse {\n\t\treturn controller.ErrModelImageInActiveDeployment\n\t}\n\n\t// Delete image file (call to external service)\n\t// Noop for not existing file\n\tif err := i.fileStorage.Delete(imageID); err != nil {\n\t\treturn errors.Wrap(err, \"Deleting image file\")\n\t}\n\n\t// Delete metadata\n\tif err := i.imagesStorage.Delete(imageID); err != nil {\n\t\treturn errors.Wrap(err, \"Deleting image metadata\")\n\t}\n\n\treturn nil\n}", "func (h *Handler) DeleteImage(w http.ResponseWriter, r *http.Request) {\n\timageName := r.URL.Query().Get(\"name\")\n\timagePool := r.URL.Query().Get(\"pool\")\n\n\tdeleteImageReq := model.BlockImage{\n\t\tName: imageName,\n\t\tPoolName: imagePool,\n\t}\n\n\tif deleteImageReq.Name == \"\" || deleteImageReq.PoolName == \"\" {\n\t\tlogger.Errorf(\"image missing required fields: %+v\", deleteImageReq)\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\terr := ceph.DeleteImage(h.context, h.config.clusterInfo.Name, deleteImageReq.Name, deleteImageReq.PoolName)\n\tif err != nil {\n\t\tlogger.Errorf(\"failed to delete image %+v: %+v\", deleteImageReq, err)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.Write([]byte(fmt.Sprintf(\"succeeded deleting image %s\", deleteImageReq.Name)))\n}", "func (r *azureManagedMachinePoolReconciler) Delete(ctx context.Context, scope *scope.ManagedControlPlaneScope) error {\n\tagentPoolSpec := &agentpools.Spec{\n\t\tName: scope.InfraMachinePool.Name,\n\t\tResourceGroup: scope.ControlPlane.Spec.ResourceGroup,\n\t\tCluster: scope.ControlPlane.Name,\n\t\tSKU: scope.InfraMachinePool.Spec.SKU,\n\t}\n\n\tif err := r.agentPoolsSvc.Delete(ctx, agentPoolSpec); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to delete machine pool %s\", scope.InfraMachinePool.Name)\n\t}\n\n\treturn nil\n}", "func DeleteMachine(w http.ResponseWriter, r *http.Request) {\n id := chi.URLParam(r, \"id\")\n log.Printf(\"Uninstall Machine: id:%s %s\\n\", id, r.Body)\n respondwithJSON(w, http.StatusOK, map[string]string{\"message\": \"update successfully\"})\n\n}", "func (c *TestClient) CreateMachineImage(project string, mi *compute.MachineImage) error {\n\tif c.CreateMachineImageFn != nil {\n\t\treturn c.CreateMachineImageFn(project, mi)\n\t}\n\treturn c.client.CreateMachineImage(project, mi)\n}", "func (o *ClusterUninstaller) destroyImages() error {\n\tfirstPassList, err := o.listImages()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(firstPassList.list()) == 0 {\n\t\treturn nil\n\t}\n\n\titems := o.insertPendingItems(imageTypeName, firstPassList.list())\n\tfor _, item := range items {\n\t\to.Logger.Debugf(\"destroyImages: firstPassList: %v / %v\", item.name, item.id)\n\t}\n\n\tctx, cancel := o.contextWithTimeout()\n\tdefer cancel()\n\n\tfor _, item := range items {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\to.Logger.Debugf(\"destroyImages: case <-ctx.Done()\")\n\t\t\treturn o.Context.Err() // we're cancelled, abort\n\t\tdefault:\n\t\t}\n\n\t\tbackoff := wait.Backoff{\n\t\t\tDuration: 15 * time.Second,\n\t\t\tFactor: 1.1,\n\t\t\tCap: leftInContext(ctx),\n\t\t\tSteps: math.MaxInt32}\n\t\terr = wait.ExponentialBackoffWithContext(ctx, backoff, func(context.Context) (bool, error) {\n\t\t\terr2 := o.deleteImage(item)\n\t\t\tif err2 == nil {\n\t\t\t\treturn true, err2\n\t\t\t}\n\t\t\to.errorTracker.suppressWarning(item.key, err2, o.Logger)\n\t\t\treturn false, err2\n\t\t})\n\t\tif err != nil {\n\t\t\to.Logger.Fatal(\"destroyImages: ExponentialBackoffWithContext (destroy) returns \", err)\n\t\t}\n\t}\n\n\tif items = o.getPendingItems(imageTypeName); len(items) > 0 {\n\t\tfor _, item := range items {\n\t\t\to.Logger.Debugf(\"destroyImages: found %s in pending items\", item.name)\n\t\t}\n\t\treturn errors.Errorf(\"destroyImages: %d undeleted items pending\", len(items))\n\t}\n\n\tbackoff := wait.Backoff{\n\t\tDuration: 15 * time.Second,\n\t\tFactor: 1.1,\n\t\tCap: leftInContext(ctx),\n\t\tSteps: math.MaxInt32}\n\terr = wait.ExponentialBackoffWithContext(ctx, backoff, func(context.Context) (bool, error) {\n\t\tsecondPassList, err2 := o.listImages()\n\t\tif err2 != nil {\n\t\t\treturn false, err2\n\t\t}\n\t\tif len(secondPassList) == 0 {\n\t\t\t// We finally don't see any remaining instances!\n\t\t\treturn true, nil\n\t\t}\n\t\tfor _, item := range secondPassList {\n\t\t\to.Logger.Debugf(\"destroyImages: found %s in second pass\", item.name)\n\t\t}\n\t\treturn false, nil\n\t})\n\tif err != nil {\n\t\to.Logger.Fatal(\"destroyImages: ExponentialBackoffWithContext (list) returns \", err)\n\t}\n\n\treturn nil\n}", "func (es *etcdStore) Delete(imageID string) error {\n\tkey := path.Join(es.prefix, imageID)\n\tif _, err := es.client.Delete(key, true); err != nil {\n\t\tetcdErr := err.(*etcd.EtcdError)\n\t\tif etcdErr.ErrorCode != etcderr.EcodeKeyNotFound {\n\t\t\tlog.WithFields(etcdLogFields).WithFields(log.Fields{\n\t\t\t\t\"error\": err,\n\t\t\t\t\"key\": key,\n\t\t\t}).Error(\"failed to delete image\")\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (g Goba) DeleteImage(typ DatabaseType, name string) error {\n\tfor _, handler := range g.handlers {\n\t\tif handler.Type() == typ {\n\t\t\treturn handler.DeleteImage(name)\n\t\t}\n\t}\n\treturn ErrNoSuchHandler\n}", "func DeleteImage(cli bce.Client, imageId string) error {\n\t// Build the request\n\treq := &bce.BceRequest{}\n\treq.SetUri(getImageUriWithId(imageId))\n\treq.SetMethod(http.DELETE)\n\n\t// Send request and get response\n\tresp := &bce.BceResponse{}\n\tif err := cli.SendRequest(req, resp); err != nil {\n\t\treturn err\n\t}\n\tif resp.IsFail() {\n\t\treturn resp.ServiceError()\n\t}\n\n\tdefer func() { resp.Body().Close() }()\n\treturn nil\n}", "func DeleteImage(t *testing.T, projectID string, imageID string) {\n\terr := DeleteImageE(t, projectID, imageID)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n}", "func cmdDelete() {\n\tswitch state := status(B2D.VM); state {\n\tcase vmUnregistered:\n\t\tlog.Printf(\"%s is not registered.\", B2D.VM)\n\n\tcase vmPoweroff, vmAborted:\n\t\tif err := vbm(\"unregistervm\", \"--delete\", B2D.VM); err != nil {\n\t\t\tlog.Fatalf(\"failed to delete vm: %s\", err)\n\t\t}\n\tdefault:\n\t\tlog.Fatalf(\"%s needs to be stopped to delete it.\", B2D.VM)\n\t}\n}", "func (client ArtifactsClient) deleteContainerImage(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodDelete, \"/container/images/{imageId}\", binaryReqBody, extraHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response DeleteContainerImageResponse\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/registry/20160918/ContainerImage/DeleteContainerImage\"\n\t\terr = common.PostProcessServiceError(err, \"Artifacts\", \"DeleteContainerImage\", apiReferenceLink)\n\t\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponse(httpResponse, &response)\n\treturn response, err\n}", "func (cmd *imagesCmd) RunCleanupImages(f factory.Factory, cobraCmd *cobra.Command, args []string) error {\n\t// Set config root\n\tlog := f.GetLog()\n\tconfigLoader := f.NewConfigLoader(cmd.ToConfigOptions(), log)\n\tkubeConfigLoader := f.NewKubeConfigLoader()\n\tconfigExists, err := configLoader.SetDevSpaceRoot()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !configExists {\n\t\treturn errors.New(message.ConfigNotFound)\n\t}\n\n\t// Get active context\n\tkubeContext, err := kubeConfigLoader.GetCurrentContext()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif cmd.KubeContext != \"\" {\n\t\tkubeContext = cmd.KubeContext\n\t}\n\n\t// Create docker client\n\tclient, err := docker.NewClientWithMinikube(kubeContext, true, log)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Load config\n\tconfig, err := configLoader.Load()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif config.Images == nil || len(config.Images) == 0 {\n\t\tlog.Done(\"No images found in config to delete\")\n\t\treturn nil\n\t}\n\n\t_, err = client.Ping(context.Background())\n\tif err != nil {\n\t\treturn errors.Errorf(\"Docker seems to be not running: %v\", err)\n\t}\n\n\tdefer log.StopWait()\n\n\t// Delete all images\n\tfor _, imageConfig := range config.Images {\n\t\tlog.StartWait(\"Deleting local image \" + imageConfig.Image)\n\n\t\tresponse, err := client.DeleteImageByName(imageConfig.Image, log)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, t := range response {\n\t\t\tif t.Deleted != \"\" {\n\t\t\t\tlog.Donef(\"Deleted %s\", t.Deleted)\n\t\t\t} else if t.Untagged != \"\" {\n\t\t\t\tlog.Donef(\"Untagged %s\", t.Untagged)\n\t\t\t}\n\t\t}\n\t}\n\n\tlog.StartWait(\"Deleting local dangling images\")\n\n\t// Cleanup dangling images aswell\n\tfor {\n\t\tresponse, err := client.DeleteImageByFilter(filters.NewArgs(filters.Arg(\"dangling\", \"true\")), log)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, t := range response {\n\t\t\tif t.Deleted != \"\" {\n\t\t\t\tlog.Donef(\"Deleted %s\", t.Deleted)\n\t\t\t} else if t.Untagged != \"\" {\n\t\t\t\tlog.Donef(\"Untagged %s\", t.Untagged)\n\t\t\t}\n\t\t}\n\n\t\tif len(response) == 0 {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tlog.StopWait()\n\tlog.Donef(\"Successfully cleaned up images\")\n\treturn nil\n}", "func (m *Machine) StopMachine(ctx context.Context) (err error) {\n\terr = m.Session.AWSClient.Stop(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tm.push(\"Initializing domain instance\", 65, machinestate.Stopping)\n\tif err := m.Session.DNSClient.Validate(m.Domain, m.Username); err != nil {\n\t\treturn err\n\t}\n\n\tm.push(\"Changing domain to sleeping mode\", 85, machinestate.Stopping)\n\tif err := m.Session.DNSClient.Delete(m.Domain); err != nil {\n\t\tm.Log.Warning(\"couldn't delete domain %s\", err)\n\t}\n\n\t// also get all domain aliases that belongs to this machine and unset\n\tdomains, err := m.Session.DNSStorage.GetByMachine(m.ObjectId.Hex())\n\tif err != nil {\n\t\tm.Log.Error(\"fetching domains for unseting err: %s\", err)\n\t}\n\n\tfor _, domain := range domains {\n\t\tif err := m.Session.DNSClient.Delete(domain.Name); err != nil {\n\t\t\tm.Log.Warning(\"couldn't delete domain %s\", err)\n\t\t}\n\t}\n\n\t// try to release EIP if the user's plan is a free one\n\tif plan, ok := plans.Plans[m.Payment.Plan]; ok && plan == plans.Free {\n\t\tm.releaseEIP()\n\t}\n\n\treturn nil\n}", "func delImage(w http.ResponseWriter, req *http.Request) {\n\n\t// Manage Cors\n\tsetCors(&w)\n\tif req.Method == \"OPTIONS\" {\n\t\treturn\n\t}\n\n\t// Authenticate user\n\tclaims, err := authRequest(req)\n\tif err != nil {\n\t\tlogger.Error(\"Unauthorized request to upload sending 401: %v\", err)\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\tw.Write([]byte(\"401 - Unauthorized request, ensure you sign in and obtain the jwt auth token\"))\n\t\treturn\n\t}\n\n\tvars := mux.Vars(req)\n\t// validate url parameters and retrieve imageMeta\n\timageMeta, err := validateVars(vars)\n\tif err != nil {\n\t\tlogger.Error(\"Failed to validate vars sending 400: %v\", err)\n\t\tif strings.Contains(err.Error(), \"404 - Not found\") {\n\t\t\tw.WriteHeader(http.StatusNotFound)\n\t\t\tw.Write([]byte(\"404 - Not found, no image with that information available\"))\n\t\t\treturn\n\t\t}\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tw.Write([]byte(\"400 - Bad request unable to parse url parameters\"))\n\t\treturn\n\t}\n\n\t// Ensure there is no uid miss match\n\tuidVal, err := strconv.Atoi(vars[\"uid\"])\n\tif uidVal != int(imageMeta.Uid) {\n\t\tlogger.Error(\"uid miss match when attempting to delete image sending 400\")\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tw.Write([]byte(\"400 - Uid mismatch ensure you are using the correct image reference\"))\n\t\treturn\n\t}\n\n\t// Ensure user has access permissions\n\tif claims.Uid != int(imageMeta.Uid) {\n\t\tlogger.Error(\"unauthorized user attempting to delete image\")\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\tw.Write([]byte(\"401 - Unauthorized, you do not have permissions to modify this image\"))\n\t\treturn\n\t}\n\n\t// Delete meta from database\n\terr = DeleteImageData(imageMeta)\n\tif err != nil {\n\t\tlogger.Error(\"failed to delete image from database sending 500: %v\", err)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tw.Write([]byte(\"500 - Unable to delete image from database, try again later\"))\n\t\treturn\n\t}\n\n\t// Delete file from storage\n\tfileRef := fmt.Sprintf(\"./%s/%s/%s\", IMAGE_DIR, vars[\"uid\"], vars[\"fileId\"])\n\terr = os.Remove(fileRef)\n\t// Orphaned file is ok to leave as database entry is already deleted\n\t// Automated data integrity checks or manual removal is recommended\n\t// This will look like a successfull deletion from the users perspective\n\tif err != nil {\n\t\tlogger.Error(\"failed to delete image data, clean orphaned files via automated data integrity check: %v\", err)\n\t} else {\n\t\tlogger.Info(\"Successfully deleted image: %v\", imageMeta.Id)\n\t}\n\n\treturn\n}", "func testWindowsNodeDeletion(t *testing.T) {\n\ttestCtx, err := NewTestContext()\n\trequire.NoError(t, err)\n\n\t// set expected node count to zero, since all Windows Nodes should be deleted in the test\n\texpectedNodeCount := int32(0)\n\t// Get all the Machines created by the e2e tests\n\t// For platform=none, the resulting slice is empty\n\te2eMachineSets, err := testCtx.client.Machine.MachineSets(clusterinfo.MachineAPINamespace).List(context.TODO(),\n\t\tmeta.ListOptions{LabelSelector: clusterinfo.MachineE2ELabel + \"=true\"})\n\trequire.NoError(t, err, \"error listing MachineSets\")\n\tvar windowsMachineSetWithLabel *mapi.MachineSet\n\tfor _, machineSet := range e2eMachineSets.Items {\n\t\tif machineSet.Spec.Selector.MatchLabels[clusterinfo.MachineOSIDLabel] == \"Windows\" {\n\t\t\twindowsMachineSetWithLabel = &machineSet\n\t\t\tbreak\n\t\t}\n\t}\n\t// skip the scale down step if there is no MachineSet with Windows label\n\tif windowsMachineSetWithLabel != nil {\n\t\t// Scale the Windows MachineSet to 0\n\t\twindowsMachineSetWithLabel.Spec.Replicas = &expectedNodeCount\n\t\t_, err = testCtx.client.Machine.MachineSets(clusterinfo.MachineAPINamespace).Update(context.TODO(),\n\t\t\twindowsMachineSetWithLabel, meta.UpdateOptions{})\n\t\trequire.NoError(t, err, \"error updating Windows MachineSet\")\n\n\t\t// we are waiting 10 minutes for all windows machines to get deleted.\n\t\terr = testCtx.waitForWindowsNodes(expectedNodeCount, true, false, false)\n\t\trequire.NoError(t, err, \"Windows node deletion failed\")\n\t}\n\tt.Run(\"BYOH node removal\", testCtx.testBYOHRemoval)\n\n\t// Cleanup all the MachineSets created by us.\n\tfor _, machineSet := range e2eMachineSets.Items {\n\t\tassert.NoError(t, testCtx.deleteMachineSet(&machineSet), \"error deleting MachineSet\")\n\t}\n\t// Phase is ignored during deletion, in this case we are just waiting for Machines to be deleted.\n\t_, err = testCtx.waitForWindowsMachines(int(expectedNodeCount), \"\", true)\n\trequire.NoError(t, err, \"Machine controller Windows machine deletion failed\")\n\n\t// TODO: Currently on vSphere it is impossible to delete a Machine after its node has been deleted.\n\t// This special casing should be removed as part of https://issues.redhat.com/browse/WINC-635\n\tif testCtx.GetType() != config.VSpherePlatformType {\n\t\t_, err = testCtx.waitForWindowsMachines(int(expectedNodeCount), \"\", false)\n\t\trequire.NoError(t, err, \"ConfigMap controller Windows machine deletion failed\")\n\t}\n\n\t// Test if prometheus configuration is updated to have no node entries in the endpoints object\n\tt.Run(\"Prometheus configuration\", testPrometheus)\n\n\t// Cleanup windows-instances ConfigMap\n\ttestCtx.deleteWindowsInstanceConfigMap()\n\n\t// Cleanup secrets created by us.\n\terr = testCtx.client.K8s.CoreV1().Secrets(\"openshift-machine-api\").Delete(context.TODO(), \"windows-user-data\", meta.DeleteOptions{})\n\trequire.NoError(t, err, \"could not delete userData secret\")\n\n\terr = testCtx.client.K8s.CoreV1().Secrets(\"openshift-windows-machine-config-operator\").Delete(context.TODO(), secrets.PrivateKeySecret, meta.DeleteOptions{})\n\trequire.NoError(t, err, \"could not delete privateKey secret\")\n\n\t// Cleanup wmco-test namespace created by us.\n\terr = testCtx.deleteNamespace(testCtx.workloadNamespace)\n\trequire.NoError(t, err, \"could not delete test namespace\")\n}", "func DeleteVirtualMachine(client SkytapClient, vmId string) error {\n\tlog.WithFields(log.Fields{\"vmId\": vmId}).Info(\"Deleting VM\")\n\n\tdeleteVm := func(s *sling.Sling) *sling.Sling { return s.Delete(vmIdPath(vmId)) }\n\t_, err := RunSkytapRequest(client, false, nil, deleteVm)\n\treturn err\n}", "func (c *ImageController) Delete(ctx *app.DeleteImageContext) error {\n\t// ImageController_Delete: start_implement\n\n\t// Put your logic here\n\n\t// ImageController_Delete: end_implement\n\treturn nil\n}", "func (m Config) DelImage(name string, isForce bool) {\n\t//check exists image\n\tif _, ok := m.Images[name]; ok {\n\t\t//insert image\n\t\tdelete(m.Images, name)\n\t} else {\n\t\tfmt.Println(\"Image not found.:\", name)\n\t\texit(1)\n\t\treturn\n\t}\n\treturn\n}", "func (ms *MachinePlugin) ShutDownMachine(ctx context.Context, req *cmi.ShutDownMachineRequest) (*cmi.ShutDownMachineResponse, error) {\n\t// Log messages to track start of request\n\tglog.V(2).Infof(\"ShutDown machine request has been recieved for %q\", req.MachineName)\n\tdefer glog.V(2).Infof(\"Machine shutdown request has been processed successfully for %q\", req.MachineName)\n\n\tproviderSpec, secrets, err := decodeProviderSpecAndSecret(req.ProviderSpec, req.Secrets, false)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tinstances, err := ms.getInstancesFromMachineName(req.MachineName, providerSpec, secrets)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsvc, err := ms.createSVC(secrets, providerSpec.Region)\n\tif err != nil {\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\n\tfor _, instance := range instances {\n\t\tinput := &ec2.StopInstancesInput{\n\t\t\tInstanceIds: []*string{\n\t\t\t\taws.String(*instance.InstanceId),\n\t\t\t},\n\t\t\tDryRun: aws.Bool(true),\n\t\t}\n\t\t_, err = svc.StopInstances(input)\n\t\tawsErr, ok := err.(awserr.Error)\n\t\tif ok && awsErr.Code() == \"DryRunOperation\" {\n\t\t\tinput.DryRun = aws.Bool(false)\n\t\t\t_, err := svc.StopInstances(input)\n\t\t\tif err != nil {\n\t\t\t\tglog.V(2).Infof(\"VM %q for Machine %q couldn't be stopped: %s\",\n\t\t\t\t\t*instance.InstanceId,\n\t\t\t\t\treq.MachineName,\n\t\t\t\t\terr.Error(),\n\t\t\t\t)\n\t\t\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t\t\t}\n\n\t\t\tglog.V(2).Infof(\"VM %q for Machine %q was shutdown\", *instance.InstanceId, req.MachineName)\n\n\t\t} else if ok &&\n\t\t\t(awsErr.Code() == ec2.UnsuccessfulInstanceCreditSpecificationErrorCodeInvalidInstanceIdMalformed ||\n\t\t\t\tawsErr.Code() == ec2.UnsuccessfulInstanceCreditSpecificationErrorCodeInvalidInstanceIdNotFound) {\n\n\t\t\tglog.V(2).Infof(\"VM %q for Machine %q does not exist\", *instance.InstanceId, req.MachineName)\n\t\t\treturn &cmi.ShutDownMachineResponse{}, nil\n\t\t}\n\t}\n\n\treturn &cmi.ShutDownMachineResponse{}, nil\n}", "func (c *ComputeClient) MachineImages() *MachineImagesClient {\n\treturn &MachineImagesClient{\n\t\tResourceClient: ResourceClient{\n\t\t\tComputeClient: c,\n\t\t\tResourceDescription: \"MachineImage\",\n\t\t\tContainerPath: \"/machineimage/\",\n\t\t\tResourceRootPath: \"/machineimage\",\n\t\t}}\n}", "func DeleteImage(t *testing.T, client *gophercloud.ServiceClient, image *images.Image) {\n\terr := images.Delete(client, image.ID).ExtractErr()\n\tif err != nil {\n\t\tt.Fatalf(\"Unable to delete image %s: %v\", image.ID, err)\n\t}\n\n\tt.Logf(\"Deleted image: %s\", image.ID)\n}", "func (client *Client) DeleteDynamicImage(request *DeleteDynamicImageRequest) (_result *DeleteDynamicImageResponse, _err error) {\n\truntime := &util.RuntimeOptions{}\n\t_result = &DeleteDynamicImageResponse{}\n\t_body, _err := client.DeleteDynamicImageWithOptions(request, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_result = _body\n\treturn _result, _err\n}", "func DeleteImage(c *fiber.Ctx) {\n\tShopID := c.Params(\"shop_id\")\n\n\tvar DeleteImage DataDeleteImage\n\n\tif errorParse := c.BodyParser(&DeleteImage); errorParse != nil {\n\t\tfmt.Println(\"Error parsing data\", errorParse)\n\t\tc.JSON(ErrorResponse{MESSAGE: \"Error al parsear información\"})\n\t\tc.Status(400)\n\t\treturn\n\t}\n\n\t_, ErrorDelete := sq.Delete(\"images_shop\").\n\t\tWhere(\"url_image = ? AND shop_id = ?\", DeleteImage.URLImage, ShopID).\n\t\tRunWith(database).\n\t\tExec()\n\n\tif ErrorDelete != nil {\n\t\tfmt.Println(\"Error to delete image\", ErrorDelete)\n\t\tc.JSON(ErrorResponse{MESSAGE: \"Error to delete image\"})\n\t\tc.Status(400)\n\t}\n\n\tc.JSON(SuccessResponse{MESSAGE: \"Imagen eliminada\"})\n}", "func (s *API) DeleteImage(req *DeleteImageRequest, opts ...scw.RequestOption) (*Image, 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 fmt.Sprint(req.Region) == \"\" {\n\t\treturn nil, errors.New(\"field Region cannot be empty in request\")\n\t}\n\n\tif fmt.Sprint(req.ImageID) == \"\" {\n\t\treturn nil, errors.New(\"field ImageID cannot be empty in request\")\n\t}\n\n\tscwReq := &scw.ScalewayRequest{\n\t\tMethod: \"DELETE\",\n\t\tPath: \"/registry/v1/regions/\" + fmt.Sprint(req.Region) + \"/images/\" + fmt.Sprint(req.ImageID) + \"\",\n\t\tHeaders: http.Header{},\n\t}\n\n\tvar resp Image\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 (a *DefaultApiService) DeleteVM(ctx _context.Context) (*_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPut\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/vm.delete\"\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\treturn localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarHTTPResponse, nil\n}", "func DeleteImage(c * gin.Context){\n\tdb := database.DBConn()\n\tid:= c.Param(\"id\")\n\t_, err := db.Query(\"Delete FROM images WHERE id = \" + id)\n\tif err != nil{\n\t\tc.JSON(500, gin.H{\n\t\t\t\"messages\" : \"Story not found\",\n\t\t});\n\t\tpanic(\"error delte clothes\")\n\t}\n\tc.JSON(200, gin.H{\n\t\t\"messages\": \"deleted\",\n\t})\n\tdefer db.Close()\n}", "func (f *FakeImagesClient) Delete(ctx context.Context, deleteOpts *images.DeleteRequest, opts ...grpc.CallOption) (*googleprotobuf.Empty, error) {\n\tf.Lock()\n\tdefer f.Unlock()\n\tf.appendCalled(\"delete\", deleteOpts)\n\tif err := f.getError(\"delete\"); err != nil {\n\t\treturn nil, err\n\t}\n\t_, ok := f.ImageList[deleteOpts.Name]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"image does not exist\")\n\t}\n\tdelete(f.ImageList, deleteOpts.Name)\n\treturn &googleprotobuf.Empty{}, nil\n}", "func (s *azureMachinePoolService) Delete(ctx context.Context) error {\n\tif err := s.virtualMachinesScaleSetSvc.Delete(ctx); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to delete scale set\")\n\t}\n\treturn nil\n}", "func (c *client) Delete(ctx context.Context, group, name string) error {\n\tvm, err := c.Get(ctx, group, name)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(*vm) == 0 {\n\t\treturn fmt.Errorf(\"Virtual Machine [%s] not found\", name)\n\t}\n\n\trequest, err := c.getVirtualMachineRequest(wssdcloudproto.Operation_DELETE, group, name, &(*vm)[0])\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = c.VirtualMachineAgentClient.Invoke(ctx, request)\n\n\treturn err\n}", "func (t *keepalivedService) ResetMachine(node service.Node, client util.SSHClient, sctx *service.ServiceContext, deps service.ServiceDependencies, flags service.ServiceFlags) error {\n\tlog := deps.Logger.With().Str(\"host\", node.Name).Logger()\n\n\t// Setup controlplane on this host?\n\tif !node.IsControlPlane || flags.ControlPlane.APIServerVirtualIP == \"\" {\n\t\tlog.Info().Msg(\"No keepalived on this machine\")\n\t\treturn nil\n\t}\n\n\t// Remove config & check-script file\n\tif err := client.RemoveFile(log, confPath); err != nil {\n\t\treturn maskAny(err)\n\t}\n\tif err := client.RemoveFile(log, apiServerCheckScriptPath); err != nil {\n\t\treturn maskAny(err)\n\t}\n\n\t// Restart keepalived\n\tif _, err := client.Run(log, \"sudo systemctl restart \"+serviceName, \"\", true); err != nil {\n\t\tlog.Warn().Err(err).Msg(\"Failed to restart keepalived server\")\n\t}\n\n\treturn nil\n}", "func (client *Client) DeleteVirtualImage(id int64, req *Request) (*Response, error) {\n\treturn client.Execute(&Request{\n\t\tMethod: \"DELETE\",\n\t\tPath: fmt.Sprintf(\"%s/%d\", VirtualImagesPath, id),\n\t\tQueryParams: req.QueryParams,\n\t\tBody: req.Body,\n\t\tResult: &DeleteVirtualImageResult{},\n\t})\n}", "func (client WorkloadNetworksClient) DeleteVMGroupResponder(resp *http.Response) (result autorest.Response, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),\n\t\tautorest.ByClosing())\n\tresult.Response = resp\n\treturn\n}", "func (client ListManagementImageClient) DeleteImage(ctx context.Context, listID string, imageID string) (result String, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ListManagementImageClient.DeleteImage\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.Response.Response != nil {\n\t\t\t\tsc = result.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\treq, err := client.DeleteImagePreparer(ctx, listID, imageID)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"contentmoderator.ListManagementImageClient\", \"DeleteImage\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.DeleteImageSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"contentmoderator.ListManagementImageClient\", \"DeleteImage\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.DeleteImageResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"contentmoderator.ListManagementImageClient\", \"DeleteImage\", resp, \"Failure responding to request\")\n\t}\n\n\treturn\n}", "func (c *PostImageClient) Delete() *PostImageDelete {\n\tmutation := newPostImageMutation(c.config, OpDelete)\n\treturn &PostImageDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func VMDeleteSpinRegistryPath(id uint64) string {\n\treturn fmt.Sprintf(\"/vm/delete/%v\", id)\n}", "func (c *Client) ImageDelete(imgID int) error {\n\targs := make(map[string]interface{})\n\targs[\"ImageID\"] = imgID\n\n\t_, err := c.apiCall(\"image.delete\", args)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (jb *JobBoard) DeleteImage(ctx context.Context, image string) error {\n\tv := url.Values{}\n\tv.Set(\"infra\", \"jupiterbrain\")\n\tv.Set(\"name\", image)\n\n\tu := \"/images?\" + v.Encode()\n\treq, err := jb.newRequest(\"DELETE\", u, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = jb.client.Do(req)\n\treturn err\n}", "func DeleteImage(imageid string) Resp {\n\tpath := image_path(imageid)\n\treturn is_delete(path)\n}", "func (m *VirtualMachinesClientMock) Delete(ctx context.Context, resourceGroupName string, VMName string) *retry.Error {\n\targs := m.Called(resourceGroupName, VMName)\n\tif args.Error(1) != nil {\n\t\treturn &retry.Error{RawError: args.Error(1)}\n\t}\n\treturn nil\n}", "func (p *Platform) DeleteFunction(deleteOptions *platform.DeleteOptions) error {\n\tgetContainerOptions := &dockerclient.GetContainerOptions{\n\t\tLabels: map[string]string{\n\t\t\t\"nuclio-platform\": \"local\",\n\t\t\t\"nuclio-namespace\": deleteOptions.Common.Namespace,\n\t\t\t\"nuclio-function-name\": deleteOptions.Common.Identifier,\n\t\t},\n\t}\n\n\tcontainersInfo, err := p.dockerClient.GetContainers(getContainerOptions)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Failed to get containers\")\n\t}\n\n\tif len(containersInfo) == 0 {\n\t\treturn nil\n\t}\n\n\t// iterate over contains and delete them. It's possible that under some weird circumstances\n\t// there are a few instances of this function in the namespace\n\tfor _, containerInfo := range containersInfo {\n\t\tif err := p.dockerClient.RemoveContainer(containerInfo.ID); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tp.Logger.InfoWith(\"Function deleted\", \"name\", deleteOptions.Common.Identifier)\n\n\treturn nil\n}", "func (c *UnsavedPostImageClient) Delete() *UnsavedPostImageDelete {\n\tmutation := newUnsavedPostImageMutation(c.config, OpDelete)\n\treturn &UnsavedPostImageDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "func (c *UploadController) Delete() {\n\timg := struct {\n\t\tFileName string `json:\"fileName\"`\n\t}{}\n\terr := json.Unmarshal(c.Ctx.Input.RequestBody, &img)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\t// remove thumbnail\n\terr = os.Remove(thumbnailsFolder + img.FileName)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\t// remove main image\n\terr = os.Remove(imagesFolder + img.FileName)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\tc.Data[\"json\"] = img\n\tc.ServeJSON()\n}", "func (client ListManagementImageClient) DeleteImageSender(req *http.Request) (*http.Response, error) {\n\treturn autorest.SendWithSender(client, req,\n\t\tautorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n}", "func (c *MachineImagesClient) GetMachineImage(getInput *GetMachineImageInput) (*MachineImage, error) {\n\tgetInput.Name = c.getQualifiedName(getInput.Name)\n\n\tvar machineImage MachineImage\n\tif err := c.getResource(getInput.Name, &machineImage); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c.success(&machineImage)\n}", "func (r Virtual_Guest) DetachDiskImage(imageId *int) (resp datatypes.Provisioning_Version1_Transaction, err error) {\n\tparams := []interface{}{\n\t\timageId,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Virtual_Guest\", \"detachDiskImage\", params, &r.Options, &resp)\n\treturn\n}", "func (client ArtifactsClient) deleteContainerImageSignature(ctx context.Context, request common.OCIRequest, binaryReqBody *common.OCIReadSeekCloser, extraHeaders map[string]string) (common.OCIResponse, error) {\n\n\thttpRequest, err := request.HTTPRequest(http.MethodDelete, \"/container/imageSignatures/{imageSignatureId}\", binaryReqBody, extraHeaders)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response DeleteContainerImageSignatureResponse\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/registry/20160918/ContainerImageSignature/DeleteContainerImageSignature\"\n\t\terr = common.PostProcessServiceError(err, \"Artifacts\", \"DeleteContainerImageSignature\", apiReferenceLink)\n\t\treturn response, err\n\t}\n\n\terr = common.UnmarshalResponse(httpResponse, &response)\n\treturn response, err\n}", "func (c *Client) DeleteImage(lib, source string) (*api.BaseResponse, error) {\n\treturn api.DeleteImage(c, lib, source)\n}", "func (m *DeleteImageTagModel) Delete() (err error) {\n\n\t// check model validity\n\tif !m.IsValid() {\n\t\treturn errors.New(\"DeleteImageTagModel is not valid\")\n\t}\n\n\t// Get Database handle\n\tdbase, err := db.GetDb()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tps1, err := dbase.Prepare(`DELETE tm FROM tagmap AS tm\n INNER JOIN tags ON tm.tag_id = tags.tag_id\n WHERE image_id = ? AND tm.tag_id = ? AND ib_id = ?`)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer ps1.Close()\n\n\t_, err = ps1.Exec(m.Image, m.Tag, m.Ib)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n\n}", "func (s *DataStore) DeleteEngineImage(name string) error {\n\tpropagation := metav1.DeletePropagationForeground\n\treturn s.lhClient.LonghornV1beta2().EngineImages(s.namespace).Delete(context.TODO(), name, metav1.DeleteOptions{PropagationPolicy: &propagation})\n}", "func Delete() {\n\n\t// dwn-delete:\n\n\t// @echo Deleting dep ...\n\t// @echo\n\t// @echo DEP_DOWNLOAD_DIR: \t$(DEP_DOWNLOAD_DIR)\n\t// @echo DEP_INSTALL_PREFIX: \t$(DEP_INSTALL_PREFIX)\n\t// @echo\n\t// @echo DWN_FILENAME: \t\t$(DWN_FILENAME)\n\t// @echo DWN_BIN_NAME: \t\t$(DWN_BIN_NAME)\n\t// @echo\n\t// @echo DWN_FILENAME_CALC: \t$(DWN_FILENAME_CALC)\n\t// @echo DWN_FILENAME_BASE: \t$(DWN_FILENAME_BASE)\n\t// @echo DWN_FILENAME_EXT:\t \t$(DWN_FILENAME_EXT)\n\t// @echo\n\n\t// # deletes the tar and binary\n\t// if [[ $(GOOS) = darwin || $(GOOS) = linux ]]; then \\\n\t// \trm -rf $(DEP_DOWNLOAD_DIR)/$(DWN_FILENAME); \\\n\t// \trm -rf $(DEP_DOWNLOAD_DIR)/$(DWN_BIN_NAME); \\\n\t// fi\n\n\t// if [[ $(GOOS) = windows ]]; then \\\n\t// \trm -rf $(DEP_DOWNLOAD_DIR)/$(DWN_FILENAME); \\\n\t// \trm -rf $(DEP_DOWNLOAD_DIR)/$(DWN_BIN_NAME); \\\n\t// fi\n\n\t// # delete the binary from the install location\n\t// if [[ $(GOOS) = darwin || $(GOOS) = linux ]]; then \\\n\t// \tsudo rm -rf $(DEP_INSTALL_PREFIX)/$(DWN_BIN_NAME); \\\n\t// fi\n\n\t// if [[ $(GOOS) = windows ]]; then \\\n\t// \trm -rf $(DEP_INSTALL_PREFIX)/$(DWN_BIN_NAME); \\\n\t// fi\n\n}", "func DecodeVMDeleteResponse(decoder func(*http.Response) goahttp.Decoder, restoreBody bool) func(*http.Response) (interface{}, error) {\n\treturn func(resp *http.Response) (interface{}, error) {\n\t\tif restoreBody {\n\t\t\tb, err := ioutil.ReadAll(resp.Body)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tresp.Body = ioutil.NopCloser(bytes.NewBuffer(b))\n\t\t\tdefer func() {\n\t\t\t\tresp.Body = ioutil.NopCloser(bytes.NewBuffer(b))\n\t\t\t}()\n\t\t} else {\n\t\t\tdefer resp.Body.Close()\n\t\t}\n\t\tswitch resp.StatusCode {\n\t\tcase http.StatusOK:\n\t\t\treturn nil, nil\n\t\tdefault:\n\t\t\tbody, _ := ioutil.ReadAll(resp.Body)\n\t\t\treturn nil, goahttp.ErrInvalidResponse(\"spin-registry\", \"vm_delete\", resp.StatusCode, string(body))\n\t\t}\n\t}\n}", "func (g GCPClient) DeleteImage(name string) error {\n\tvar notFound bool\n\top, err := g.compute.Images.Delete(g.projectName, name).Do()\n\tif err != nil {\n\t\tif _, ok := err.(*googleapi.Error); !ok {\n\t\t\treturn err\n\t\t}\n\t\tif err.(*googleapi.Error).Code != 404 {\n\t\t\treturn err\n\t\t}\n\t\tnotFound = true\n\t}\n\tif !notFound {\n\t\tlog.Infof(\"Deleting existing image...\")\n\t\tif err := g.pollOperationStatus(op.Name); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlog.Infof(\"Image %s deleted\", name)\n\t}\n\treturn nil\n}", "func (c *TestClient) ListMachineImages(project string, opts ...ListCallOption) ([]*compute.MachineImage, error) {\n\tif c.ListMachineImagesFn != nil {\n\t\treturn c.ListMachineImagesFn(project, opts...)\n\t}\n\treturn c.client.ListMachineImages(project, opts...)\n}", "func (c *GalleryImageClient) Delete(ctx context.Context, location, name string) error {\n\treturn c.internal.Delete(ctx, location, name)\n}", "func (c *Conn) KillMachine(name, who string, sig syscall.Signal) error {\n\treturn c.object.Call(dbusInterface+\".KillMachine\", 0, name, who, sig).Err\n}", "func (m *CompaniesItemSalesCreditMemosItemCustomerPicturePictureItemRequestBuilder) Delete(ctx context.Context, requestConfiguration *CompaniesItemSalesCreditMemosItemCustomerPicturePictureItemRequestBuilderDeleteRequestConfiguration)(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 qemuImgUnload(sysOS *sys.OS, imgPath string) error {\n\terr := unloadProfile(sysOS, qemuImgProfileName(imgPath), qemuImgProfileFilename(imgPath))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}" ]
[ "0.70523554", "0.6776729", "0.64364916", "0.6213027", "0.61917424", "0.60748553", "0.60086954", "0.59045047", "0.5903068", "0.58793104", "0.58473885", "0.582463", "0.5785359", "0.57149637", "0.5670167", "0.56551117", "0.56359154", "0.5565121", "0.55566543", "0.5478534", "0.54710615", "0.5459197", "0.54558593", "0.54395163", "0.5437412", "0.54351354", "0.542534", "0.54240626", "0.5422281", "0.5411284", "0.5390638", "0.53748775", "0.5370745", "0.5360081", "0.5357172", "0.5345068", "0.53425395", "0.5303934", "0.5300087", "0.5291034", "0.5273905", "0.5234482", "0.5206165", "0.52000517", "0.5184782", "0.51832336", "0.5179023", "0.51674646", "0.5158197", "0.5153793", "0.51526856", "0.51449394", "0.51404494", "0.51373476", "0.51370615", "0.5124267", "0.5103091", "0.5095312", "0.50854665", "0.508048", "0.5074765", "0.5072639", "0.5065325", "0.50273925", "0.5026726", "0.50080764", "0.49893075", "0.49804622", "0.49735773", "0.4965866", "0.49652225", "0.49634466", "0.49627143", "0.4962664", "0.4957093", "0.49453", "0.49372002", "0.49345392", "0.49199516", "0.49171042", "0.4916585", "0.49008435", "0.48999524", "0.48940527", "0.48916847", "0.48809388", "0.4867591", "0.48649594", "0.48648328", "0.48606792", "0.4859158", "0.4847715", "0.48475555", "0.48472086", "0.4845912", "0.48355567", "0.48133814", "0.48129517", "0.4807198", "0.48070344" ]
0.7990831
0
CreateMachineImage uses the override method CreateMachineImageFn or the real implementation.
func (c *TestClient) CreateMachineImage(project string, mi *compute.MachineImage) error { if c.CreateMachineImageFn != nil { return c.CreateMachineImageFn(project, mi) } return c.client.CreateMachineImage(project, mi) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *MachineImagesClient) CreateMachineImage(createInput *CreateMachineImageInput) (*MachineImage, error) {\n\tvar machineImage MachineImage\n\n\t// If `sizes` is not set then is mst be defaulted to {\"total\": 0}\n\tif createInput.Sizes == nil {\n\t\tcreateInput.Sizes = map[string]interface{}{\"total\": 0}\n\t}\n\n\t// `no_upload` must always be true\n\tcreateInput.NoUpload = true\n\n\tcreateInput.Name = c.getQualifiedName(createInput.Name)\n\tif err := c.createResource(createInput, &machineImage); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c.success(&machineImage)\n}", "func (ms *MachinePlugin) CreateMachine(ctx context.Context, req *cmi.CreateMachineRequest) (*cmi.CreateMachineResponse, error) {\n\t// Log messages to track request\n\tglog.V(2).Infof(\"Machine creation request has been recieved for %q\", req.MachineName)\n\n\tproviderSpec, secrets, err := decodeProviderSpecAndSecret(req.ProviderSpec, req.Secrets, true)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsvc, err := ms.createSVC(secrets, providerSpec.Region)\n\tif err != nil {\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\n\tUserDataEnc := base64.StdEncoding.EncodeToString([]byte(secrets.UserData))\n\n\tvar imageIds []*string\n\timageID := aws.String(providerSpec.AMI)\n\timageIds = append(imageIds, imageID)\n\n\tdescribeImagesRequest := ec2.DescribeImagesInput{\n\t\tImageIds: imageIds,\n\t}\n\toutput, err := svc.DescribeImages(&describeImagesRequest)\n\tif err != nil {\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\n\tvar blkDeviceMappings []*ec2.BlockDeviceMapping\n\tdeviceName := output.Images[0].RootDeviceName\n\tvolumeSize := providerSpec.BlockDevices[0].Ebs.VolumeSize\n\tvolumeType := providerSpec.BlockDevices[0].Ebs.VolumeType\n\tblkDeviceMapping := ec2.BlockDeviceMapping{\n\t\tDeviceName: deviceName,\n\t\tEbs: &ec2.EbsBlockDevice{\n\t\t\tVolumeSize: &volumeSize,\n\t\t\tVolumeType: &volumeType,\n\t\t},\n\t}\n\tif volumeType == \"io1\" {\n\t\tblkDeviceMapping.Ebs.Iops = &providerSpec.BlockDevices[0].Ebs.Iops\n\t}\n\tblkDeviceMappings = append(blkDeviceMappings, &blkDeviceMapping)\n\n\t// Add tags to the created machine\n\ttagList := []*ec2.Tag{}\n\tfor idx, element := range providerSpec.Tags {\n\t\tif idx == \"Name\" {\n\t\t\t// Name tag cannot be set, as its used to identify backing machine object\n\t\t\tglog.Warning(\"Name tag cannot be set on AWS instance, as its used to identify backing machine object\")\n\t\t\tcontinue\n\t\t}\n\t\tnewTag := ec2.Tag{\n\t\t\tKey: aws.String(idx),\n\t\t\tValue: aws.String(element),\n\t\t}\n\t\ttagList = append(tagList, &newTag)\n\t}\n\tnameTag := ec2.Tag{\n\t\tKey: aws.String(\"Name\"),\n\t\tValue: aws.String(req.MachineName),\n\t}\n\ttagList = append(tagList, &nameTag)\n\n\ttagInstance := &ec2.TagSpecification{\n\t\tResourceType: aws.String(\"instance\"),\n\t\tTags: tagList,\n\t}\n\n\t// Specify the details of the machine that you want to create.\n\tinputConfig := ec2.RunInstancesInput{\n\t\t// An Amazon Linux AMI ID for t2.micro machines in the us-west-2 region\n\t\tImageId: aws.String(providerSpec.AMI),\n\t\tInstanceType: aws.String(providerSpec.MachineType),\n\t\tMinCount: aws.Int64(1),\n\t\tMaxCount: aws.Int64(1),\n\t\tUserData: &UserDataEnc,\n\t\tKeyName: aws.String(providerSpec.KeyName),\n\t\tSubnetId: aws.String(providerSpec.NetworkInterfaces[0].SubnetID),\n\t\tIamInstanceProfile: &ec2.IamInstanceProfileSpecification{\n\t\t\tName: &(providerSpec.IAM.Name),\n\t\t},\n\t\tSecurityGroupIds: []*string{aws.String(providerSpec.NetworkInterfaces[0].SecurityGroupIDs[0])},\n\t\tBlockDeviceMappings: blkDeviceMappings,\n\t\tTagSpecifications: []*ec2.TagSpecification{tagInstance},\n\t}\n\n\trunResult, err := svc.RunInstances(&inputConfig)\n\tif err != nil {\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\n\tresponse := &cmi.CreateMachineResponse{\n\t\tProviderID: encodeProviderID(providerSpec.Region, *runResult.Instances[0].InstanceId),\n\t\tNodeName: *runResult.Instances[0].PrivateDnsName,\n\t\tLastKnownState: []byte(\"Created\" + *runResult.Instances[0].InstanceId),\n\t}\n\n\tglog.V(2).Infof(\"VM with Provider-ID: %q created for Machine: %q\", response.ProviderID, req.MachineName)\n\treturn response, nil\n}", "func (c *TestClient) GetMachineImage(project, name string) (*compute.MachineImage, error) {\n\tif c.GetMachineImageFn != nil {\n\t\treturn c.GetMachineImageFn(project, name)\n\t}\n\treturn c.client.GetMachineImage(project, name)\n}", "func (s *Reconciler) CreateMachine(ctx context.Context) error {\n\t// TODO: update once machine controllers have a way to indicate a machine has been provisoned. https://github.com/kubernetes-sigs/cluster-api/issues/253\n\t// Seeing a node cannot be purely relied upon because the provisioned control plane will not be registering with\n\t// the stack that provisions it.\n\tif s.scope.Machine.Annotations == nil {\n\t\ts.scope.Machine.Annotations = map[string]string{}\n\t}\n\n\tnicName := azure.GenerateNetworkInterfaceName(s.scope.Machine.Name)\n\tif err := s.createNetworkInterface(ctx, nicName); err != nil {\n\t\treturn fmt.Errorf(\"failed to create nic %s for machine %s: %w\", nicName, s.scope.Machine.Name, err)\n\t}\n\n\t// Availability set will be created only if no zones were found for a machine or\n\t// if availability set name was not specified in provider spec\n\tasName, err := s.getOrCreateAvailabilitySet()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create availability set %s for machine %s: %w\", asName, s.scope.Machine.Name, err)\n\t}\n\n\tif err := s.createVirtualMachine(ctx, nicName, asName); err != nil {\n\t\treturn fmt.Errorf(\"failed to create vm %s: %w\", s.scope.Machine.Name, err)\n\t}\n\n\treturn nil\n}", "func getVMImage(scope *scope.MachineScope) (infrav1.Image, error) {\n\t// Use custom Marketplace image, Image ID or a Shared Image Gallery image if provided\n\tif scope.AzureMachine.Spec.Image != nil {\n\t\treturn *scope.AzureMachine.Spec.Image, nil\n\t}\n\treturn azure.GetDefaultUbuntuImage(to.String(scope.Machine.Spec.Version))\n}", "func (a *Actuator) Create(ctx context.Context, machine *machinev1.Machine) error {\n\tklog.Infof(\"%s: Creating machine\", machine.Name)\n\tscope, err := newMachineScope(machineScopeParams{\n\t\tContext: ctx,\n\t\tcoreClient: a.coreClient,\n\t\tmachine: machine,\n\t\tcomputeClientBuilder: a.computeClientBuilder,\n\t})\n\tif err != nil {\n\t\tfmtErr := fmt.Errorf(scopeFailFmt, machine.GetName(), err)\n\t\treturn a.handleMachineError(machine, fmtErr, createEventAction)\n\t}\n\tif err := newReconciler(scope).create(); err != nil {\n\t\t// Update machine and machine status in case it was modified\n\t\tscope.Close()\n\t\tfmtErr := fmt.Errorf(reconcilerFailFmt, machine.GetName(), createEventAction, err)\n\t\treturn a.handleMachineError(machine, fmtErr, createEventAction)\n\t}\n\ta.eventRecorder.Eventf(machine, corev1.EventTypeNormal, createEventAction, \"Created Machine %v\", machine.Name)\n\treturn scope.Close()\n}", "func (m *MachineScope) GetVMImage(ctx context.Context) (*infrav1.Image, error) {\n\tctx, log, done := tele.StartSpanWithLogger(ctx, \"scope.MachineScope.GetVMImage\")\n\tdefer done()\n\n\t// Use custom Marketplace image, Image ID or a Shared Image Gallery image if provided\n\tif m.AzureMachine.Spec.Image != nil {\n\t\treturn m.AzureMachine.Spec.Image, nil\n\t}\n\n\tsvc := virtualmachineimages.New(m)\n\n\tif m.AzureMachine.Spec.OSDisk.OSType == azure.WindowsOS {\n\t\truntime := m.AzureMachine.Annotations[\"runtime\"]\n\t\twindowsServerVersion := m.AzureMachine.Annotations[\"windowsServerVersion\"]\n\t\tlog.Info(\"No image specified for machine, using default Windows Image\", \"machine\", m.AzureMachine.GetName(), \"runtime\", runtime, \"windowsServerVersion\", windowsServerVersion)\n\t\treturn svc.GetDefaultWindowsImage(ctx, m.Location(), ptr.Deref(m.Machine.Spec.Version, \"\"), runtime, windowsServerVersion)\n\t}\n\n\tlog.Info(\"No image specified for machine, using default Linux Image\", \"machine\", m.AzureMachine.GetName())\n\treturn svc.GetDefaultUbuntuImage(ctx, m.Location(), ptr.Deref(m.Machine.Spec.Version, \"\"))\n}", "func (d *Docker) CreateImage(parentRef string) {}", "func (s *Reconciler) Create(ctx context.Context) error {\n\tif err := s.CreateMachine(ctx); err != nil {\n\t\ts.scope.MachineStatus.Conditions = setMachineProviderCondition(s.scope.MachineStatus.Conditions, machinev1.AzureMachineProviderCondition{\n\t\t\tType: machinev1.MachineCreated,\n\t\t\tStatus: apicorev1.ConditionTrue,\n\t\t\tReason: machineCreationFailedReason,\n\t\t\tMessage: err.Error(),\n\t\t})\n\t\treturn err\n\t}\n\treturn nil\n}", "func (s *azureMachineService) Create() (*infrav1.VM, error) {\n\tnicName := azure.GenerateNICName(s.machineScope.Name())\n\tnicErr := s.reconcileNetworkInterface(nicName)\n\tif nicErr != nil {\n\t\treturn nil, errors.Wrapf(nicErr, \"failed to create nic %s for machine %s\", nicName, s.machineScope.Name())\n\t}\n\n\tvm, vmErr := s.createVirtualMachine(nicName)\n\tif vmErr != nil {\n\t\treturn nil, errors.Wrapf(vmErr, \"failed to create vm %s \", s.machineScope.Name())\n\t}\n\n\treturn vm, nil\n}", "func (cce *CCEClient) Create(ctx context.Context, cluster *clusterv1.Cluster, machine *clusterv1.Machine) error {\n\tglog.V(4).Infof(\"Create machine: %+v\", machine.Name)\n\tinstance, err := cce.instanceIfExists(cluster, machine)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif instance != nil {\n\t\tglog.Infof(\"Skipped creating a VM that already exists, instanceID %s\", instance.InstanceID)\n\t}\n\n\tmachineCfg, err := machineProviderFromProviderConfig(machine.Spec.ProviderSpec)\n\tif err != nil {\n\t\tglog.Errorf(\"parse machine config err: %s\", err.Error())\n\t\treturn err\n\t}\n\tglog.V(4).Infof(\"machine config: %+v\", machineCfg)\n\n\tbccArgs := &bcc.CreateInstanceArgs{\n\t\tName: machine.Name,\n\t\tImageID: machineCfg.ImageID, // ubuntu-16.04-amd64\n\t\tBilling: billing.Billing{\n\t\t\tPaymentTiming: \"Postpaid\",\n\t\t},\n\t\tCPUCount: machineCfg.CPUCount,\n\t\tMemoryCapacityInGB: machineCfg.MemoryCapacityInGB,\n\t\tAdminPass: machineCfg.AdminPass,\n\t\tPurchaseCount: 1,\n\t\tInstanceType: \"N3\", // Normal 3\n\t\tNetworkCapacityInMbps: 1, //EIP bandwidth\n\t}\n\n\t// TODO support different regions\n\tinstanceIDs, err := cce.computeService.Bcc().CreateInstances(bccArgs, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(instanceIDs) != 1 {\n\t\treturn fmt.Errorf(\"CreateVMError\")\n\t}\n\n\tglog.Infof(\"Created a new VM, instanceID %s\", instanceIDs[0])\n\tif machine.ObjectMeta.Annotations == nil {\n\t\tmachine.ObjectMeta.Annotations = map[string]string{}\n\t}\n\tif cluster.ObjectMeta.Annotations == nil {\n\t\tcluster.ObjectMeta.Annotations = map[string]string{}\n\t}\n\tmachine.ObjectMeta.Annotations[TagInstanceID] = instanceIDs[0]\n\tmachine.ObjectMeta.Annotations[TagInstanceStatus] = \"Created\"\n\tmachine.ObjectMeta.Annotations[TagInstanceAdminPass] = machineCfg.AdminPass\n\tmachine.ObjectMeta.Annotations[TagKubeletVersion] = machine.Spec.Versions.Kubelet\n\n\ttoken, err := cce.getKubeadmToken()\n\tif err != nil {\n\t\tglog.Errorf(\"getKubeadmToken err: %+v\", err)\n\t\treturn err\n\t}\n\n\tif machineCfg.Role == \"master\" {\n\t\tcluster.ObjectMeta.Annotations[TagMasterInstanceID] = instanceIDs[0]\n\t\tcluster.ObjectMeta.Annotations[TagClusterToken] = token\n\t\tmachine.ObjectMeta.Annotations[TagInstanceRole] = \"master\"\n\t} else {\n\t\tmachine.ObjectMeta.Annotations[TagInstanceRole] = \"node\"\n\t}\n\n\tglog.V(4).Infof(\"new machine: %+v, annotation %+v\", machine.Name, machine.Annotations)\n\tcce.client.Update(context.Background(), cluster)\n\tcce.client.Update(context.Background(), machine)\n\n\t// TODO rewrite\n\tgo cce.postCreate(ctx, cluster, machine)\n\treturn nil\n}", "func (c *MachineImagesClient) GetMachineImage(getInput *GetMachineImageInput) (*MachineImage, error) {\n\tgetInput.Name = c.getQualifiedName(getInput.Name)\n\n\tvar machineImage MachineImage\n\tif err := c.getResource(getInput.Name, &machineImage); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c.success(&machineImage)\n}", "func (s *LocalTests) createMachine(c *gc.C) *cloudapi.Machine {\n\tmachine, err := s.testClient.CreateMachine(cloudapi.CreateMachineOpts{Package: localPackageName, Image: localImageID})\n\tc.Assert(err, gc.IsNil)\n\tc.Assert(machine, gc.NotNil)\n\n\t// wait for machine to be provisioned\n\tfor !s.pollMachineState(c, machine.Id, \"running\") {\n\t\ttime.Sleep(1 * time.Second)\n\t}\n\n\treturn machine\n}", "func NewMachine(ctx context.Context, cfg Config, opts ...Opt) (*Machine, error) {\n\tm := &Machine{\n\t\texitCh: make(chan struct{}),\n\t}\n\n\tif cfg.VMID == \"\" {\n\t\trandomID, err := uuid.NewV4()\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"failed to create random ID for VMID\")\n\t\t}\n\t\tcfg.VMID = randomID.String()\n\t}\n\n\tm.Handlers = defaultHandlers\n\n\tif cfg.JailerCfg != nil {\n\t\tm.Handlers.Validation = m.Handlers.Validation.Append(JailerConfigValidationHandler)\n\t\tif err := jail(ctx, m, &cfg); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\tm.Handlers.Validation = m.Handlers.Validation.Append(ConfigValidationHandler)\n\t\tm.cmd = configureBuilder(defaultFirecrackerVMMCommandBuilder, cfg).Build(ctx)\n\t}\n\n\tfor _, opt := range opts {\n\t\topt(m)\n\t}\n\n\tif m.logger == nil {\n\t\tlogger := log.New()\n\n\t\tm.logger = log.NewEntry(logger)\n\t}\n\n\tif m.client == nil {\n\t\tm.client = NewClient(cfg.SocketPath, m.logger, false)\n\t}\n\n\tif cfg.ForwardSignals == nil {\n\t\tcfg.ForwardSignals = []os.Signal{\n\t\t\tos.Interrupt,\n\t\t\tsyscall.SIGQUIT,\n\t\t\tsyscall.SIGTERM,\n\t\t\tsyscall.SIGHUP,\n\t\t\tsyscall.SIGABRT,\n\t\t}\n\t}\n\n\tm.machineConfig = cfg.MachineCfg\n\tm.Cfg = cfg\n\n\tif cfg.NetNS == \"\" && cfg.NetworkInterfaces.cniInterface() != nil {\n\t\tm.Cfg.NetNS = m.defaultNetNSPath()\n\t}\n\n\tm.logger.Debug(\"Called NewMachine()\")\n\treturn m, nil\n}", "func (m *Machine) Create(ctx gocontext.Context) error {\n\tm.machineContext.Logger.Info(fmt.Sprintf(\"Creating VM with role '%s'...\", nodeRole(m.machineContext)))\n\n\tvirtualMachine := newVirtualMachineFromKubevirtMachine(m.machineContext, m.namespace)\n\n\tmutateFn := func() (err error) {\n\t\tif virtualMachine.Labels == nil {\n\t\t\tvirtualMachine.Labels = map[string]string{}\n\t\t}\n\t\tif virtualMachine.Spec.Template.ObjectMeta.Labels == nil {\n\t\t\tvirtualMachine.Spec.Template.ObjectMeta.Labels = map[string]string{}\n\t\t}\n\t\tvirtualMachine.Labels[clusterv1.ClusterLabelName] = m.machineContext.Cluster.Name\n\n\t\tvirtualMachine.Labels[infrav1.KubevirtMachineNameLabel] = m.machineContext.KubevirtMachine.Name\n\t\tvirtualMachine.Labels[infrav1.KubevirtMachineNamespaceLabel] = m.machineContext.KubevirtMachine.Namespace\n\n\t\tvirtualMachine.Spec.Template.ObjectMeta.Labels[infrav1.KubevirtMachineNameLabel] = m.machineContext.KubevirtMachine.Name\n\t\tvirtualMachine.Spec.Template.ObjectMeta.Labels[infrav1.KubevirtMachineNamespaceLabel] = m.machineContext.KubevirtMachine.Namespace\n\t\treturn nil\n\t}\n\tif _, err := controllerutil.CreateOrUpdate(ctx, m.client, virtualMachine, mutateFn); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func NewMachine(node node.Inf, resource resource.Inf, logger *log.Logger) Inf {\n\treturn &machine{node: node, resource: resource, logger: logger}\n}", "func (company *Company) CreateMachine(name string, machineType byte) *Machine {\n\tif isValid := IsValidMachineType(machineType); !isValid {\n\t\tpanic(errors.New(\"machine is being created with invalid type \" + string(machineType)).Error())\n\t}\n\n\tmachine := &Machine{\n\t\tkey: keyConfiguration.NewKey(),\n\t\tname: name,\n\t\tmachineType: machineType,\n\t\tcompany: company,\n\t\ttasks: nil,\n\t\tfirstTask: nil,\n\t\tlastTask: nil,\n\t}\n\n\t// Add it to company unsorted\n\tcompany.machines = append(company.machines, machine)\n\n\treturn machine\n}", "func (c *ComputeClient) MachineImages() *MachineImagesClient {\n\treturn &MachineImagesClient{\n\t\tResourceClient: ResourceClient{\n\t\t\tComputeClient: c,\n\t\t\tResourceDescription: \"MachineImage\",\n\t\t\tContainerPath: \"/machineimage/\",\n\t\t\tResourceRootPath: \"/machineimage\",\n\t\t}}\n}", "func NewMachine(opts machine.InitOptions) (machine.VM, error) {\n\tvmConfigDir, err := machine.GetConfDir(vmtype)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvm := new(MachineVM)\n\tif len(opts.Name) > 0 {\n\t\tvm.Name = opts.Name\n\t}\n\tignitionFile := filepath.Join(vmConfigDir, vm.Name+\".ign\")\n\tvm.IgnitionFilePath = ignitionFile\n\n\t// An image was specified\n\tif len(opts.ImagePath) > 0 {\n\t\tvm.ImagePath = opts.ImagePath\n\t}\n\n\t// Assign remote user name. if not provided, use default\n\tvm.RemoteUsername = opts.Username\n\tif len(vm.RemoteUsername) < 1 {\n\t\tvm.RemoteUsername = defaultRemoteUser\n\t}\n\n\t// Add a random port for ssh\n\tport, err := utils.GetRandomPort()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvm.Port = port\n\n\tvm.CPUs = opts.CPUS\n\tvm.Memory = opts.Memory\n\n\t// Look up the executable\n\texecPath, err := exec.LookPath(QemuCommand)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcmd := append([]string{execPath})\n\t// Add memory\n\tcmd = append(cmd, []string{\"-m\", strconv.Itoa(int(vm.Memory))}...)\n\t// Add cpus\n\tcmd = append(cmd, []string{\"-smp\", strconv.Itoa(int(vm.CPUs))}...)\n\t// Add ignition file\n\tcmd = append(cmd, []string{\"-fw_cfg\", \"name=opt/com.coreos/config,file=\" + vm.IgnitionFilePath}...)\n\t// Add qmp socket\n\tmonitor, err := NewQMPMonitor(\"unix\", vm.Name, defaultQMPTimeout)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvm.QMPMonitor = monitor\n\tcmd = append(cmd, []string{\"-qmp\", monitor.Network + \":/\" + monitor.Address + \",server=on,wait=off\"}...)\n\n\t// Add network\n\t// Right now the mac address is hardcoded so that the host networking gives it a specific IP address. This is\n\t// why we can only run one vm at a time right now\n\tcmd = append(cmd, []string{\"-netdev\", \"socket,id=vlan,fd=3\", \"-device\", \"virtio-net-pci,netdev=vlan,mac=5a:94:ef:e4:0c:ee\"}...)\n\tsocketPath, err := getRuntimeDir()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvirtualSocketPath := filepath.Join(socketPath, \"podman\", vm.Name+\"_ready.sock\")\n\t// Add serial port for readiness\n\tcmd = append(cmd, []string{\n\t\t\"-device\", \"virtio-serial\",\n\t\t\"-chardev\", \"socket,path=\" + virtualSocketPath + \",server=on,wait=off,id=\" + vm.Name + \"_ready\",\n\t\t\"-device\", \"virtserialport,chardev=\" + vm.Name + \"_ready\" + \",name=org.fedoraproject.port.0\"}...)\n\tvm.CmdLine = cmd\n\treturn vm, nil\n}", "func (spec *MachineSpec) BuildMachine(createUser bool) error {\n\t// If MachineID is not nil, ensure it exists and reuse it if it does.\n\tif spec.HasMachine() {\n\t\tm, err := modelhelper.GetMachine(spec.Machine.ObjectId.Hex())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tspec.Machine = *m\n\t\treturn nil\n\t}\n\n\t// If no existing group is provided, create or use 'hackathon' one,\n\t// which will make VMs invisible to users until they're assigned\n\t// to proper group before the hackathon.\n\tif !spec.HasGroup() {\n\t\tgroup, err := modelhelper.GetGroup(\"koding\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tspec.Machine.Groups = []models.MachineGroup{{Id: group.Id}}\n\t}\n\n\t// If no existing user is provided, create one.\n\tif !spec.HasUser() {\n\t\t// Try to lookup user by username first.\n\t\tuser, err := modelhelper.GetUser(spec.Username())\n\t\tif err != nil {\n\t\t\tif !createUser {\n\t\t\t\treturn fmt.Errorf(\"user %q does not exist\", spec.Username())\n\t\t\t}\n\n\t\t\tspec.User.ObjectId = bson.NewObjectId()\n\t\t\tif spec.User.RegisteredAt.IsZero() {\n\t\t\t\tspec.User.RegisteredAt = time.Now()\n\t\t\t}\n\n\t\t\tif spec.User.LastLoginDate.IsZero() {\n\t\t\t\tspec.User.LastLoginDate = spec.User.RegisteredAt\n\t\t\t}\n\n\t\t\tif err = modelhelper.CreateUser(&spec.User); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t_, err = modelhelper.UpdateGroupAddMembers(spec.Machine.Groups[0].Id, 1)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tuser = &spec.User\n\t\t}\n\n\t\tspec.User.ObjectId = user.ObjectId\n\t\tspec.User.Name = spec.Username()\n\t}\n\n\t// Ensure the user is assigned to the machine.\n\tif len(spec.Machine.Users) == 0 {\n\t\tspec.Machine.Users = []models.MachineUser{{\n\t\t\tSudo: true,\n\t\t\tOwner: true,\n\t\t}}\n\t}\n\tif spec.Machine.Users[0].Id == \"\" {\n\t\tspec.Machine.Users[0].Id = spec.User.ObjectId\n\t}\n\tif spec.Machine.Users[0].Username == \"\" {\n\t\tspec.Machine.Users[0].Username = spec.User.Name\n\t}\n\n\t// Lookup username for existing user.\n\tif spec.Machine.Users[0].Username == \"\" {\n\t\tuser, err := modelhelper.GetUserById(spec.Machine.Users[0].Id.Hex())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tspec.Machine.Users[0].Username = user.Name\n\t}\n\n\t// Lookup group and init Uid.\n\tgroup, err := modelhelper.GetGroupById(spec.Machine.Groups[0].Id.Hex())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tspec.Machine.Uid = fmt.Sprintf(\"u%c%c%c\",\n\t\tspec.Machine.Users[0].Username[0],\n\t\tgroup.Slug[0],\n\t\tspec.Machine.Provider[0],\n\t)\n\n\tm, err := modelhelper.GetMachineBySlug(spec.Machine.Users[0].Id, spec.Machine.Slug)\n\tif err == mgo.ErrNotFound {\n\t\treturn nil\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tswitch m.State() {\n\tcase machinestate.Building, machinestate.Starting:\n\t\treturn ErrAlreadyBuilding\n\tcase machinestate.Running:\n\t\treturn ErrAlreadyRunning\n\tcase machinestate.NotInitialized:\n\t\tspec.Machine.ObjectId = m.ObjectId\n\t\treturn ErrRebuild\n\tdefault:\n\t\treturn fmt.Errorf(\"machine state is %q; needs to be deleted and build \"+\n\t\t\t\"again (jMachine.ObjectId = %q)\", m.State(), m.ObjectId.Hex())\n\t}\n}", "func (a *Actuator) Create(ctx context.Context, machine *machinev1.Machine) error {\n\tklog.Infof(\"%s actuator creating machine to namespace %s\", machine.Name, machine.Namespace)\n\n\tscope, err := newMachineScope(machineScopeParams{\n\t\tContext: ctx,\n\t\tclient: a.client,\n\t\tmachine: machine,\n\t\talibabacloudClientBuilder: a.alibabacloudClientBuilder,\n\t\tconfigManagedClient: a.configManagedClient,\n\t})\n\n\tif err != nil {\n\t\treturn a.handleMachineError(machine, machineapierrors.InvalidMachineConfiguration(\"failed to create machine %q scope: %v\", machine.Name, err), createEventAction)\n\t}\n\n\tif err = a.reconcilerBuilder(scope).Create(context.Background()); err != nil {\n\t\tif err := scope.patchMachine(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn a.handleMachineError(machine, machineapierrors.InvalidMachineConfiguration(\"failed to reconcile machine %q: %v\", machine.Name, err), createEventAction)\n\t}\n\ta.eventRecorder.Eventf(machine, corev1.EventTypeNormal, createEventAction, \"Created Machine %v\", machine.GetName())\n\treturn scope.patchMachine()\n}", "func NewMachineExtension(ctx *pulumi.Context,\n\tname string, args *MachineExtensionArgs, opts ...pulumi.ResourceOption) (*MachineExtension, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.Name == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'Name'\")\n\t}\n\tif args.ResourceGroupName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ResourceGroupName'\")\n\t}\n\taliases := pulumi.Aliases([]pulumi.Alias{\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:hybridcompute:MachineExtension\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:hybridcompute/v20190802preview:MachineExtension\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:hybridcompute/v20190802preview:MachineExtension\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:hybridcompute/v20191212:MachineExtension\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:hybridcompute/v20191212:MachineExtension\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:hybridcompute/v20200730preview:MachineExtension\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:hybridcompute/v20200730preview:MachineExtension\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:hybridcompute/v20200802:MachineExtension\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:hybridcompute/v20200802:MachineExtension\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:hybridcompute/v20200815preview:MachineExtension\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:hybridcompute/v20200815preview:MachineExtension\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:hybridcompute/v20210128preview:MachineExtension\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:hybridcompute/v20210128preview:MachineExtension\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:hybridcompute/v20210325preview:MachineExtension\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:hybridcompute/v20210325preview:MachineExtension\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:hybridcompute/v20210422preview:MachineExtension\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:hybridcompute/v20210422preview:MachineExtension\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:hybridcompute/v20210517preview:MachineExtension\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:hybridcompute/v20210517preview:MachineExtension\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:hybridcompute/v20210520:MachineExtension\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:hybridcompute/v20210520:MachineExtension\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:hybridcompute/v20210610preview:MachineExtension\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:hybridcompute/v20210610preview:MachineExtension\"),\n\t\t},\n\t})\n\topts = append(opts, aliases)\n\tvar resource MachineExtension\n\terr := ctx.RegisterResource(\"azure-native:hybridcompute:MachineExtension\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (p *provider) Create(machine *v1alpha1.Machine, providerData *cloudprovidertypes.ProviderData, userdata string) (instance.Instance, error) {\n\tconfig, _, err := p.getConfig(machine.Spec.ProviderSpec)\n\tif err != nil {\n\t\treturn nil, newError(common.InvalidConfigurationMachineError, \"failed to parse MachineSpec: %v\", err)\n\t}\n\n\tapiClient := getClient(config.Token)\n\tctx, cancel := context.WithTimeout(context.Background(), anxtypes.CreateRequestTimeout)\n\tdefer cancel()\n\n\tstatus, err := getStatus(machine.Status.ProviderStatus)\n\tif err != nil {\n\t\treturn nil, newError(common.InvalidConfigurationMachineError, \"failed to get machine status: %v\", err)\n\t}\n\n\tif status.ProvisioningID == \"\" {\n\t\tips, err := apiClient.VSphere().Provisioning().IPs().GetFree(ctx, config.LocationID, config.VlanID)\n\t\tif err != nil {\n\t\t\treturn nil, newError(common.InvalidConfigurationMachineError, \"failed to get ip pool: %v\", err)\n\t\t}\n\t\tif len(ips) < 1 {\n\t\t\treturn nil, newError(common.InsufficientResourcesMachineError, \"no ip address is available for this machine\")\n\t\t}\n\n\t\tipID := ips[0].Identifier\n\t\tnetworkInterfaces := []anxvm.Network{{\n\t\t\tNICType: anxtypes.VmxNet3NIC,\n\t\t\tIPs: []string{ipID},\n\t\t\tVLAN: config.VlanID,\n\t\t}}\n\n\t\tvm := apiClient.VSphere().Provisioning().VM().NewDefinition(\n\t\t\tconfig.LocationID,\n\t\t\t\"templates\",\n\t\t\tconfig.TemplateID,\n\t\t\tmachine.ObjectMeta.Name,\n\t\t\tconfig.CPUs,\n\t\t\tconfig.Memory,\n\t\t\tconfig.DiskSize,\n\t\t\tnetworkInterfaces,\n\t\t)\n\n\t\tvm.Script = base64.StdEncoding.EncodeToString(\n\t\t\t[]byte(fmt.Sprintf(\"anexia: true\\n\\n%s\", userdata)),\n\t\t)\n\n\t\tsshKey, err := ssh.NewKey()\n\t\tif err != nil {\n\t\t\treturn nil, newError(common.CreateMachineError, \"failed to generate ssh key: %v\", err)\n\t\t}\n\t\tvm.SSH = sshKey.PublicKey\n\n\t\tprovisionResponse, err := apiClient.VSphere().Provisioning().VM().Provision(ctx, vm)\n\t\tif err != nil {\n\t\t\treturn nil, newError(common.CreateMachineError, \"instance provisioning failed: %v\", err)\n\t\t}\n\n\t\tstatus.ProvisioningID = provisionResponse.Identifier\n\t\tstatus.IPAllocationID = ipID\n\t\tif err := updateStatus(machine, status, providerData.Update); err != nil {\n\t\t\treturn nil, newError(common.UpdateMachineError, \"machine status update failed: %v\", err)\n\t\t}\n\t}\n\n\tinstanceID, err := apiClient.VSphere().Provisioning().Progress().AwaitCompletion(ctx, status.ProvisioningID)\n\tif err != nil {\n\t\treturn nil, newError(common.CreateMachineError, \"instance provisioning failed: %v\", err)\n\t}\n\n\tstatus.InstanceID = instanceID\n\tif err := updateStatus(machine, status, providerData.Update); err != nil {\n\t\treturn nil, newError(common.UpdateMachineError, \"machine status update failed: %v\", err)\n\t}\n\n\treturn p.Get(machine, providerData)\n}", "func Create(name string, spec *config.Machine, pubKeyPath string) (id string, err error) {\n\trunArgs := []string{\n\t\t\"run\",\n\t\tspec.Image,\n\t\tfmt.Sprintf(\"--name=%s\", name),\n\t\tfmt.Sprintf(\"--cpus=%d\", spec.IgniteConfig().CPUs),\n\t\tfmt.Sprintf(\"--memory=%s\", spec.IgniteConfig().Memory),\n\t\tfmt.Sprintf(\"--size=%s\", spec.IgniteConfig().DiskSize),\n\t\tfmt.Sprintf(\"--kernel-image=%s\", spec.IgniteConfig().Kernel),\n\t\tfmt.Sprintf(\"--ssh=%s\", pubKeyPath),\n\t}\n\n\tif copyFiles := spec.IgniteConfig().CopyFiles; copyFiles != nil {\n\t\trunArgs = append(runArgs, setupCopyFiles(copyFiles)...)\n\t}\n\n\tfor _, mapping := range spec.PortMappings {\n\t\tif mapping.HostPort == 0 {\n\t\t\t// If not defined, set the host port to a random free ephemeral port\n\t\t\tvar err error\n\t\t\tif mapping.HostPort, err = freePort(); err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t} else {\n\t\t\t// If defined, apply an offset so all VMs won't use the same port\n\t\t\tmapping.HostPort += portOffset\n\t\t}\n\n\t\trunArgs = append(runArgs, fmt.Sprintf(\"--ports=%d:%d\", int(mapping.HostPort), mapping.ContainerPort))\n\t}\n\n\t// Increment portOffset per-machine\n\tportOffset++\n\n\t_, err = exec.ExecuteCommand(execName, runArgs...)\n\treturn \"\", err\n}", "func MakeImage(svc ec2iface.EC2API, description, instanceID, name *string) (*ec2.CreateImageOutput, error) {\n // snippet-start:[ec2.go.create_image.call]\n opts := &ec2.CreateImageInput{\n Description: description,\n InstanceId: instanceID,\n Name: name,\n BlockDeviceMappings: []*ec2.BlockDeviceMapping{\n {\n DeviceName: aws.String(\"/dev/sda1\"),\n NoDevice: aws.String(\"\"),\n },\n {\n DeviceName: aws.String(\"/dev/sdb\"),\n NoDevice: aws.String(\"\"),\n },\n {\n DeviceName: aws.String(\"/dev/sdc\"),\n NoDevice: aws.String(\"\"),\n },\n },\n }\n resp, err := svc.CreateImage(opts)\n // snippet-end:[ec2.go.create_image.call]\n if err != nil {\n return nil, err\n }\n\n return resp, nil\n}", "func resourceMachineCreate(d *schema.ResourceData, meta interface{}) error {\n\tc, err := NewClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer c.Close()\n\n\tqueryString, ok := d.Get(\"queryString\").(string)\n\tif !ok {\n\t\treturn errors.New(\"invalid request: queryString filed is missing\")\n\t}\n\n\tcreateReq, err := newCreateReq(d)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tc.Log.Debug(`Calling \"vagrant.create\" on %q with %+v`, queryString, createReq)\n\n\t// the \"vagrant.create\" method returns the same paramaters back. However if\n\t// we previously passed empty options, such as hostname, it returns the\n\t// final response.\n\tresp, err := c.Vagrant.Create(queryString, createReq)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = c.Vagrant.Up(queryString, resp.FilePath)\n\tif err != nil {\n\t\t// ensure the machine is deleted on failure\n\t\tc.Vagrant.Destroy(queryString, resp.FilePath)\n\t\treturn fmt.Errorf(\"vagrant provisioning has failed: \" + err.Error())\n\t}\n\n\td.SetId(queryString)\n\td.Set(\"filePath\", resp.FilePath)\n\td.Set(\"klientHostURL\", resp.HostURL)\n\td.Set(\"hostname\", resp.Hostname)\n\td.Set(\"box\", resp.Box)\n\td.Set(\"cpus\", resp.Cpus)\n\td.Set(\"memory\", resp.Memory)\n\n\treturn nil\n}", "func Create(name string, spec *config.Machine, pubKeyPath string) (id string, err error) {\n\n\trunArgs := []string{\n\t\t\"run\",\n\t\tspec.Image,\n\t\tfmt.Sprintf(\"--name=%s\", name),\n\t\tfmt.Sprintf(\"--cpus=%d\", spec.IgniteConfig().CPUs),\n\t\tfmt.Sprintf(\"--memory=%s\", spec.IgniteConfig().Memory),\n\t\tfmt.Sprintf(\"--size=%s\", spec.IgniteConfig().Disk),\n\t\tfmt.Sprintf(\"--kernel-image=%s\", spec.IgniteConfig().Kernel),\n\t\tfmt.Sprintf(\"--ssh=%s\", pubKeyPath),\n\t}\n\n\tcopyFiles := spec.IgniteConfig().CopyFiles\n\tif copyFiles == nil {\n\t\tcopyFiles = make(map[string]string)\n\t}\n\tfor _, v := range setupCopyFiles(copyFiles) {\n\t\trunArgs = append(runArgs, v)\n\t}\n\n\tfor _, mapping := range spec.PortMappings {\n\t\tif mapping.HostPort == 0 {\n\t\t\t// If not defined, set the host port to a random free ephemeral port\n\t\t\tvar err error\n\t\t\tif mapping.HostPort, err = freePort(); err != nil {\n\t\t\t\treturn \"\", err\n\t\t\t}\n\t\t} else {\n\t\t\t// If defined, apply an offset so all VMs won't use the same port\n\t\t\tmapping.HostPort += portOffset\n\t\t\tportOffset++\n\t\t}\n\n\t\trunArgs = append(runArgs, fmt.Sprintf(\"--ports=%d:%d\", int(mapping.HostPort), mapping.ContainerPort))\n\t}\n\n\t_, err = exec.ExecuteCommand(execName, runArgs...)\n\treturn \"\", err\n}", "func (a *Actuator) Create(c *clusterv1.Cluster, m *clusterv1.Machine) error {\n\tglog.Infof(\"Creating machine %s for cluster %s.\", m.Name, c.Name)\n\tif a.machineSetupConfigGetter == nil {\n\t\treturn a.handleMachineError(m, apierrors.InvalidMachineConfiguration(\"valid machineSetupConfigGetter is required\"), createEventAction)\n\t}\n\n\t// First get provider config\n\tmachineConfig, err := a.machineProviderConfig(m.Spec.ProviderConfig)\n\tif err != nil {\n\t\treturn a.handleMachineError(m, apierrors.InvalidMachineConfiguration(\"Cannot unmarshal machine's providerConfig field: %v\", err), createEventAction)\n\t}\n\n\t// Now validate\n\tif err := a.validateMachine(m, machineConfig); err != nil {\n\t\treturn a.handleMachineError(m, err, createEventAction)\n\t}\n\n\t// check if the machine exists (here we mean we haven't provisioned it yet.)\n\texists, err := a.Exists(c, m)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif exists {\n\t\tglog.Infof(\"Machine %s for cluster %s exists, skipping.\", m.Name, c.Name)\n\t\treturn nil\n\t}\n\n\t// The doesn't exist case here.\n\tglog.Infof(\"Machine %s for cluster %s doesn't exist.\", m.Name, c.Name)\n\n\tconfigParams := &MachineParams{\n\t\tRoles: machineConfig.Roles,\n\t\tVersions: m.Spec.Versions,\n\t}\n\n\tmetadata, err := a.getMetadata(c, m, configParams, machineConfig.SSHConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tglog.Infof(\"Metadata retrieved: machine %s for cluster %s\", m.Name, c.Name)\n\n\t// Here we deploy and run the scripts to the node.\n\tprivateKey, passPhrase, err := a.getPrivateKey(c, m.Namespace, machineConfig.SSHConfig.SecretName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tglog.Infof(\"Running startup script: machine %s for cluster %s...\", m.Name, c.Name)\n\n\tsshClient := ssh.NewSSHProviderClient(privateKey, passPhrase, machineConfig.SSHConfig)\n\n\tif err = sshClient.WriteFile(metadata.StartupScript, \"/var/tmp/startupscript.sh\"); err != nil {\n\t\tglog.Errorf(\"Error copying startup script: %v\", err)\n\t\treturn err\n\t}\n\n\tif err = sshClient.ProcessCMD(\"chmod +x /var/tmp/startupscript.sh && bash /var/tmp/startupscript.sh\"); err != nil {\n\t\tglog.Errorf(\"running startup script error: %v\", err)\n\t\treturn err\n\t}\n\n\tglog.Infof(\"Annotating machine %s for cluster %s.\", m.Name, c.Name)\n\n\t// TODO find a way to do this in the cluster controller\n\tif util.IsMaster(m) {\n\t\terr = a.updateClusterObjectEndpoint(c, m)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// create kubeconfig secret\n\t\terr = a.createKubeconfigSecret(c, m, sshClient)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\ta.eventRecorder.Eventf(m, corev1.EventTypeNormal, \"Created\", \"Created Machine %v\", m.Name)\n\treturn a.updateAnnotations(c, m)\n}", "func (v *IBM) CreateImage(ctx *lepton.Context, imagePath string) error {\n\t// also worth gzipping\n\n\ticow := imagePath + \".qcow2\"\n\n\targs := []string{\n\t\t\"convert\", \"-f\", \"raw\", \"-O\", \"qcow2\", imagePath, icow,\n\t}\n\n\tcmd := exec.Command(\"qemu-img\", args...)\n\tout, err := cmd.Output()\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tfmt.Println(out)\n\t}\n\n\tstore := &Objects{\n\t\ttoken: v.iam,\n\t}\n\n\tv.Storage = store\n\terr = v.Storage.CopyToBucket(ctx.Config(), icow)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\timgName := ctx.Config().CloudConfig.ImageName\n\n\tv.createImage(ctx, icow, imgName)\n\treturn nil\n}", "func NewImage(repoName string, dockerClient client.CommonAPIClient, ops ...ImageOption) (*Image, error) {\n\timageOpts := &options{}\n\tfor _, op := range ops {\n\t\tif err := op(imageOpts); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tplatform, err := defaultPlatform(dockerClient)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif (imageOpts.platform != imgutil.Platform{}) {\n\t\tif err := validatePlatformOption(platform, imageOpts.platform); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tplatform = imageOpts.platform\n\t}\n\n\tinspect := defaultInspect(platform)\n\n\timage := &Image{\n\t\tdocker: dockerClient,\n\t\trepoName: repoName,\n\t\tinspect: inspect,\n\t\tlayerPaths: make([]string, len(inspect.RootFS.Layers)),\n\t\tdownloadBaseOnce: &sync.Once{},\n\t}\n\n\tif imageOpts.prevImageRepoName != \"\" {\n\t\tif err := processPreviousImageOption(image, imageOpts.prevImageRepoName, platform, dockerClient); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif imageOpts.baseImageRepoName != \"\" {\n\t\tif err := processBaseImageOption(image, imageOpts.baseImageRepoName, platform, dockerClient); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif image.inspect.Os == \"windows\" {\n\t\tif err := prepareNewWindowsImage(image); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn image, nil\n}", "func createTestMachine(rtnd *pb.ResourceTopologyNodeDescriptor, machineName string) *pb.ResourceDescriptor {\n\tutility.SeedRNGWithString(machineName)\n\trID := utility.GenerateResourceID()\n\trd := rtnd.ResourceDesc\n\trd.Uuid = strconv.FormatUint(uint64(rID), 10)\n\trd.Type = pb.ResourceDescriptor_RESOURCE_MACHINE\n\treturn rd\n}", "func (img *CreateImageInput) CreateImage() (CreateImageResponse, error) {\n\n\tif status := support.DoesCloudSupports(strings.ToLower(img.Cloud.Name)); status != true {\n\t\treturn CreateImageResponse{}, fmt.Errorf(common.DefaultCloudResponse + \"CreateImage\")\n\t}\n\n\tswitch strings.ToLower(img.Cloud.Name) {\n\tcase \"aws\":\n\n\t\tcreds, crderr := common.GetCredentials(&common.GetCredentialsInput{Profile: img.Cloud.Profile, Cloud: img.Cloud.Name})\n\t\tif crderr != nil {\n\t\t\treturn CreateImageResponse{}, crderr\n\t\t}\n\t\t// I will establish session so that we can carry out the process in cloud\n\t\tsession_input := awssess.CreateSessionInput{Region: img.Cloud.Region, KeyId: creds.KeyId, AcessKey: creds.SecretAccess}\n\t\tsess := session_input.CreateAwsSession()\n\n\t\t//authorizing to request further\n\t\tauthinpt := auth.EstablishConnectionInput{Region: img.Cloud.Region, Resource: \"ec2\", Session: sess}\n\n\t\tresponse_image := make([]image.ImageResponse, 0)\n\n\t\tfor _, id := range img.InstanceIds {\n\t\t\timgcreate := new(image.ImageCreateInput)\n\t\t\timgcreate.InstanceId = id\n\t\t\timgcreate.GetRaw = img.Cloud.GetRaw\n\t\t\tresponse, imgerr := imgcreate.CreateImage(authinpt)\n\t\t\tif imgerr != nil {\n\t\t\t\treturn CreateImageResponse{}, imgerr\n\t\t\t}\n\t\t\tresponse_image = append(response_image, response)\n\t\t}\n\t\treturn CreateImageResponse{AwsResponse: response_image}, nil\n\n\tcase \"azure\":\n\t\treturn CreateImageResponse{}, fmt.Errorf(common.DefaultAzResponse)\n\tcase \"gcp\":\n\t\treturn CreateImageResponse{}, fmt.Errorf(common.DefaultGcpResponse)\n\tcase \"openstack\":\n\t\treturn CreateImageResponse{}, fmt.Errorf(common.DefaultOpResponse)\n\tdefault:\n\t\tlog.Info(\"\")\n\t\tlog.Error(common.DefaultCloudResponse + \"CreateImage\")\n\t\tlog.Info(\"\")\n\t\treturn CreateImageResponse{}, fmt.Errorf(common.DefaultCloudResponse + \"CreateImage\")\n\t}\n}", "func newMachine(s SSHInfo) *Machine {\n\tm := Machine{\n\t\tConnectionErrors: make([]string, 0),\n\t\tStreamData: make([]Stream, 0),\n\t\tSSHInfo: s,\n\t}\n\tif m.Extras == nil {\n\t\tm.Extras = make(map[string]interface{}, 0)\n\t}\n\treturn &m\n}", "func NewMachine(ctx *context.MachineContext, client client.Client, namespace string, sshKeys *ssh.ClusterNodeSshKeys) (*Machine, error) {\n\tmachine := &Machine{\n\t\tclient: client,\n\t\tnamespace: namespace,\n\t\tmachineContext: ctx,\n\t\tvmiInstance: nil,\n\t\tvmInstance: nil,\n\t\tsshKeys: sshKeys,\n\t\tgetCommandExecutor: ssh.NewVMCommandExecutor,\n\t}\n\n\tnamespacedName := types.NamespacedName{Namespace: namespace, Name: ctx.KubevirtMachine.Name}\n\tvm := &kubevirtv1.VirtualMachine{}\n\tvmi := &kubevirtv1.VirtualMachineInstance{}\n\n\t// Get the active running VMI if it exists\n\terr := client.Get(ctx.Context, namespacedName, vmi)\n\tif err != nil {\n\t\tif !apierrors.IsNotFound(err) {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\tmachine.vmiInstance = vmi\n\t}\n\n\t// Get the top level VM object if it exists\n\terr = client.Get(ctx.Context, namespacedName, vm)\n\tif err != nil {\n\t\tif !apierrors.IsNotFound(err) {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\tmachine.vmInstance = vm\n\t}\n\n\treturn machine, nil\n}", "func (p *OnPrem) CreateImage(ctx *Context) error {\n\treturn fmt.Errorf(\"Operation not supported\")\n}", "func (f *TestFramework) createMachineSet() error {\n\tcloudProvider, err := providers.NewCloudProvider(sshKey)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error instantiating cloud provider %v\", err)\n\t}\n\tmachineSet, err := cloudProvider.GenerateMachineSet(true, 1)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error generating Windows MachineSet: %v\", err)\n\t}\n\tlog.Print(\"Creating Machine Sets\")\n\t_, err = f.machineClient.MachineSets(\"openshift-machine-api\").Create(context.TODO(), machineSet, metav1.CreateOptions{})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error creating MachineSet %v\", err)\n\t}\n\tf.machineSet = machineSet\n\tlog.Printf(\"Created Machine Set %v\", machineSet.Name)\n\treturn nil\n}", "func makeDiskImage(dest string, size uint, initialBytes []byte) error {\n\t// Create the dest dir.\n\tif err := os.MkdirAll(filepath.Dir(dest), 0755); err != nil {\n\t\treturn err\n\t}\n\t// Fill in the magic string so boot2docker VM will detect this and format\n\t// the disk upon first boot.\n\traw := bytes.NewReader(initialBytes)\n\treturn MakeDiskImage(dest, size, raw)\n}", "func newImage(ctx context.Context, sys *types.SystemContext, s storageReference) (types.ImageCloser, error) {\n\tsrc, err := newImageSource(s)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\timg, err := image.FromSource(ctx, sys, src)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsize, err := src.getSize()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &storageImageCloser{ImageCloser: img, size: size}, nil\n}", "func NewImage(repoName string, keychain authn.Keychain, ops ...ImageOption) (*Image, error) {\n\timageOpts := &options{}\n\tfor _, op := range ops {\n\t\tif err := op(imageOpts); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tplatform := defaultPlatform()\n\tif (imageOpts.platform != imgutil.Platform{}) {\n\t\tplatform = imageOpts.platform\n\t}\n\n\timage, err := emptyImage(platform)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tri := &Image{\n\t\tkeychain: keychain,\n\t\trepoName: repoName,\n\t\timage: image,\n\t}\n\n\tif imageOpts.prevImageRepoName != \"\" {\n\t\tif err := processPreviousImageOption(ri, imageOpts.prevImageRepoName, platform); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif imageOpts.baseImageRepoName != \"\" {\n\t\tif err := processBaseImageOption(ri, imageOpts.baseImageRepoName, platform); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\timgOS, err := ri.OS()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif imgOS == \"windows\" {\n\t\tif err := prepareNewWindowsImage(ri); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn ri, nil\n}", "func (d ImagefsDriver) Create(r *volume.CreateRequest) error {\n\tfmt.Printf(\"-> Create %+v\\n\", r)\n\tsource, ok := r.Options[\"source\"]\n\tif !ok {\n\t\treturn fmt.Errorf(\"no source volume specified\")\n\t}\n\n\t// pull the image\n\t/*readCloser, err := d.cli.ImagePull(context.Background(), source, types.ImagePullOptions{\n\t\t// HACK assume the registry ignores the auth header\n\t\tRegistryAuth: \"null\",\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unexpected error: %s\", err)\n\t}\n\tscanner := bufio.NewScanner(readCloser)\n\tfor scanner.Scan() {\n\t}*/\n\n\tcontainerConfig := &container.Config{\n\t\tImage: source,\n\t\tEntrypoint: []string{\"/runtime/loop\"},\n\t\tLabels: map[string]string{\n\t\t\t\"com.docker.imagefs.version\": version,\n\t\t},\n\t\tNetworkDisabled: true,\n\t}\n\n\tif target, ok := r.Options[\"target\"]; ok {\n\t\tcontainerConfig.Labels[\"com.docker.imagefs.target\"] = target\n\t}\n\t// TODO handle error\n\thostConfig := &container.HostConfig{\n\t\tBinds: []string{\"/tmp/runtime:/runtime\"},\n\t\t//AutoRemove: true,\n\t}\n\n\tvar platform *specs.Platform\n\tif platformStr, ok := r.Options[\"platform\"]; ok {\n\t\tif versions.GreaterThanOrEqualTo(d.cli.ClientVersion(), \"1.41\") {\n\t\t\tp, err := platforms.Parse(platformStr)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"error parsing specified platform\")\n\t\t\t}\n\t\t\tplatform = &p\n\t\t}\n\t}\n\n\tnetworkConfig := &network.NetworkingConfig{}\n\tcont, err := d.cli.ContainerCreate(\n\t\tcontext.Background(),\n\t\tcontainerConfig,\n\t\thostConfig,\n\t\tnetworkConfig,\n\t\tplatform,\n\t\t// TODO(rabrams) namespace\n\t\tr.Name,\n\t)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unexpected error: %s\", err)\n\t}\n\tfmt.Printf(\"Temp container ID: %s\", cont.ID)\n\td.cli.ContainerStart(\n\t\tcontext.Background(),\n\t\tcont.ID,\n\t\ttypes.ContainerStartOptions{},\n\t)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unexpected error: %s\", err)\n\t}\n\treturn nil\n}", "func newImage(uid int64, imgname string, tag int, des string) CRImage {\n\treturn CRImage{\n\t\tUserId: uid,\n\t\tImageName: imgname,\n\t\tTag: tag,\n\t\tStar: 0,\n\t\tFork: 0,\n\t\tComm: 0,\n\t\tStatus: 0,\n\t\tDescrip: des,\n\t\tDate: time.Now().Format(\"2006-01-02\"),\n\t}\n}", "func (v *MachineVM) Init(opts machine.InitOptions) error {\n\tvar (\n\t\tkey string\n\t)\n\tsshDir := filepath.Join(homedir.Get(), \".ssh\")\n\t// GetConfDir creates the directory so no need to check for\n\t// its existence\n\tvmConfigDir, err := machine.GetConfDir(vmtype)\n\tif err != nil {\n\t\treturn err\n\t}\n\tjsonFile := filepath.Join(vmConfigDir, v.Name) + \".json\"\n\tv.IdentityPath = filepath.Join(sshDir, v.Name)\n\n\tswitch opts.ImagePath {\n\tcase \"testing\", \"stable\", \"\":\n\t\t// Get image as usual\n\t\tdd, err := machine.NewFcosDownloader(vmtype, v.Name, opts.ImagePath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tv.ImagePath = dd.Get().LocalUncompressedFile\n\t\tif err := dd.DownloadImage(); err != nil {\n\t\t\treturn err\n\t\t}\n\tdefault:\n\t\t// The user has provided an alternate image which can be a file path\n\t\t// or URL.\n\t\tg, err := machine.NewGenericDownloader(vmtype, v.Name, opts.ImagePath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tv.ImagePath = g.Get().LocalUncompressedFile\n\t\tif err := g.DownloadImage(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t// Add arch specific options including image location\n\tv.CmdLine = append(v.CmdLine, v.addArchOptions()...)\n\n\t// Add location of bootable image\n\tv.CmdLine = append(v.CmdLine, \"-drive\", \"if=virtio,file=\"+v.ImagePath)\n\t// This kind of stinks but no other way around this r/n\n\tif len(opts.IgnitionPath) < 1 {\n\t\turi := machine.SSHRemoteConnection.MakeSSHURL(\"localhost\", \"/run/user/1000/podman/podman.sock\", strconv.Itoa(v.Port), v.RemoteUsername)\n\t\tif err := machine.AddConnection(&uri, v.Name, filepath.Join(sshDir, v.Name), opts.IsDefault); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\turiRoot := machine.SSHRemoteConnection.MakeSSHURL(\"localhost\", \"/run/podman/podman.sock\", strconv.Itoa(v.Port), \"root\")\n\t\tif err := machine.AddConnection(&uriRoot, v.Name+\"-root\", filepath.Join(sshDir, v.Name), opts.IsDefault); err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tfmt.Println(\"An ignition path was provided. No SSH connection was added to Podman\")\n\t}\n\t// Write the JSON file\n\tb, err := json.MarshalIndent(v, \"\", \" \")\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := ioutil.WriteFile(jsonFile, b, 0644); err != nil {\n\t\treturn err\n\t}\n\n\t// User has provided ignition file so keygen\n\t// will be skipped.\n\tif len(opts.IgnitionPath) < 1 {\n\t\tkey, err = machine.CreateSSHKeys(v.IdentityPath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t// Run arch specific things that need to be done\n\tif err := v.prepare(); err != nil {\n\t\treturn err\n\t}\n\n\toriginalDiskSize, err := getDiskSize(v.ImagePath)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Resize the disk image to input disk size\n\t// only if the virtualdisk size is less than\n\t// the given disk size\n\tif opts.DiskSize<<(10*3) > originalDiskSize {\n\t\tresize := exec.Command(\"qemu-img\", []string{\"resize\", v.ImagePath, strconv.Itoa(int(opts.DiskSize)) + \"G\"}...)\n\t\tresize.Stdout = os.Stdout\n\t\tresize.Stderr = os.Stderr\n\t\tif err := resize.Run(); err != nil {\n\t\t\treturn errors.Errorf(\"error resizing image: %q\", err)\n\t\t}\n\t}\n\t// If the user provides an ignition file, we need to\n\t// copy it into the conf dir\n\tif len(opts.IgnitionPath) > 0 {\n\t\tinputIgnition, err := ioutil.ReadFile(opts.IgnitionPath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn ioutil.WriteFile(v.IgnitionFilePath, inputIgnition, 0644)\n\t}\n\t// Write the ignition file\n\tign := machine.DynamicIgnition{\n\t\tName: opts.Username,\n\t\tKey: key,\n\t\tVMName: v.Name,\n\t\tWritePath: v.IgnitionFilePath,\n\t}\n\treturn machine.NewIgnitionFile(ign)\n}", "func generateDeployment(image string) clusterv1.MachineDeployment {\n\tmachineLabels := map[string]string{\"name\": image}\n\treturn clusterv1.MachineDeployment{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: image,\n\t\t\tAnnotations: make(map[string]string),\n\t\t},\n\t\tSpec: clusterv1.MachineDeploymentSpec{\n\t\t\tReplicas: pointer.Int32(3),\n\t\t\tSelector: metav1.LabelSelector{MatchLabels: machineLabels},\n\t\t\tTemplate: clusterv1.MachineTemplateSpec{\n\t\t\t\tObjectMeta: clusterv1.ObjectMeta{\n\t\t\t\t\tLabels: machineLabels,\n\t\t\t\t},\n\t\t\t\tSpec: clusterv1.MachineSpec{\n\t\t\t\t\tNodeDrainTimeout: &metav1.Duration{Duration: 10 * time.Second},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "func (g GCPClient) CreateInstance(name, image, zone, machineType string, disks Disks, data *string, nested, vtpm, replace bool) error {\n\tif replace {\n\t\tif err := g.DeleteInstance(name, zone, true); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tlog.Infof(\"Creating instance %s from image %s (type: %s in %s)\", name, image, machineType, zone)\n\n\tenabled := new(string)\n\t*enabled = \"1\"\n\n\tk, err := ssh.NewPublicKey(g.privKey.Public())\n\tif err != nil {\n\t\treturn err\n\t}\n\tsshKey := new(string)\n\t*sshKey = fmt.Sprintf(\"moby:%s moby\", string(ssh.MarshalAuthorizedKey(k)))\n\n\t// check provided image to be compatible with provided options\n\top, err := g.compute.Images.Get(g.projectName, image).Do()\n\tif err != nil {\n\t\treturn err\n\t}\n\tuefiCompatible := false\n\tfor _, feature := range op.GuestOsFeatures {\n\t\tif feature != nil && feature.Type == uefiCompatibleFeature {\n\t\t\tuefiCompatible = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif vtpm && !uefiCompatible {\n\t\treturn fmt.Errorf(\"cannot use vTPM without UEFI_COMPATIBLE image\")\n\t}\n\t// we should check for nested\n\tvmxLicense := false\n\tfor _, license := range op.Licenses {\n\t\t// we omit hostname and version when define license\n\t\tif strings.HasSuffix(license, vmxImageLicence) {\n\t\t\tvmxLicense = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif nested && !vmxLicense {\n\t\treturn fmt.Errorf(\"cannot use nested virtualization without enable-vmx image\")\n\t}\n\n\tinstanceDisks := []*compute.AttachedDisk{\n\t\t{\n\t\t\tAutoDelete: true,\n\t\t\tBoot: true,\n\t\t\tInitializeParams: &compute.AttachedDiskInitializeParams{\n\t\t\t\tSourceImage: fmt.Sprintf(\"global/images/%s\", image),\n\t\t\t},\n\t\t},\n\t}\n\n\tfor i, disk := range disks {\n\t\tvar diskName string\n\t\tif disk.Path != \"\" {\n\t\t\tdiskName = disk.Path\n\t\t} else {\n\t\t\tdiskName = fmt.Sprintf(\"%s-disk-%d\", name, i)\n\t\t}\n\t\tvar diskSizeGb int64\n\t\tif disk.Size == 0 {\n\t\t\tdiskSizeGb = int64(1)\n\t\t} else {\n\t\t\tdiskSizeGb = int64(convertMBtoGB(disk.Size))\n\t\t}\n\t\tdiskObj := &compute.Disk{Name: diskName, SizeGb: diskSizeGb}\n\t\tif vtpm {\n\t\t\tdiskObj.GuestOsFeatures = []*compute.GuestOsFeature{\n\t\t\t\t{Type: uefiCompatibleFeature},\n\t\t\t}\n\t\t}\n\t\tdiskOp, err := g.compute.Disks.Insert(g.projectName, zone, diskObj).Do()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := g.pollZoneOperationStatus(diskOp.Name, zone); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tinstanceDisks = append(instanceDisks, &compute.AttachedDisk{\n\t\t\tAutoDelete: true,\n\t\t\tBoot: false,\n\t\t\tSource: fmt.Sprintf(\"zones/%s/disks/%s\", zone, diskName),\n\t\t})\n\t}\n\n\tinstanceObj := &compute.Instance{\n\t\tMachineType: fmt.Sprintf(\"zones/%s/machineTypes/%s\", zone, machineType),\n\t\tName: name,\n\t\tDisks: instanceDisks,\n\t\tNetworkInterfaces: []*compute.NetworkInterface{\n\t\t\t{\n\t\t\t\tNetwork: \"global/networks/default\",\n\t\t\t\tAccessConfigs: []*compute.AccessConfig{\n\t\t\t\t\t{\n\t\t\t\t\t\tType: \"ONE_TO_ONE_NAT\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tMetadata: &compute.Metadata{\n\t\t\tItems: []*compute.MetadataItems{\n\t\t\t\t{\n\t\t\t\t\tKey: \"serial-port-enable\",\n\t\t\t\t\tValue: enabled,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tKey: \"ssh-keys\",\n\t\t\t\t\tValue: sshKey,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tKey: \"user-data\",\n\t\t\t\t\tValue: data,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tif nested {\n\t\tinstanceObj.MinCpuPlatform = \"Intel Haswell\"\n\t}\n\tif vtpm {\n\t\tinstanceObj.ShieldedInstanceConfig = &compute.ShieldedInstanceConfig{EnableVtpm: true}\n\t}\n\n\t// Don't wait for operation to complete!\n\t// A headstart is needed as by the time we've polled for this event to be\n\t// completed, the instance may have already terminated\n\t_, err = g.compute.Instances.Insert(g.projectName, zone, instanceObj).Do()\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Infof(\"Instance created\")\n\treturn nil\n}", "func NewVirtualMachine(ctx *pulumi.Context,\n\tname string, args *VirtualMachineArgs, opts ...pulumi.ResourceOption) (*VirtualMachine, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.LabName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'LabName'\")\n\t}\n\tif args.ResourceGroupName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ResourceGroupName'\")\n\t}\n\tif args.AllowClaim == nil {\n\t\targs.AllowClaim = pulumi.BoolPtr(false)\n\t}\n\tif args.DisallowPublicIpAddress == nil {\n\t\targs.DisallowPublicIpAddress = pulumi.BoolPtr(false)\n\t}\n\tif args.OwnerObjectId == nil {\n\t\targs.OwnerObjectId = pulumi.StringPtr(\"dynamicValue\")\n\t}\n\tif args.StorageType == nil {\n\t\targs.StorageType = pulumi.StringPtr(\"labStorageType\")\n\t}\n\taliases := pulumi.Aliases([]pulumi.Alias{\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:devtestlab/v20180915:VirtualMachine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:devtestlab:VirtualMachine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:devtestlab:VirtualMachine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:devtestlab/v20150521preview:VirtualMachine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:devtestlab/v20150521preview:VirtualMachine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:devtestlab/v20160515:VirtualMachine\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:devtestlab/v20160515:VirtualMachine\"),\n\t\t},\n\t})\n\topts = append(opts, aliases)\n\tvar resource VirtualMachine\n\terr := ctx.RegisterResource(\"azure-native:devtestlab/v20180915:VirtualMachine\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func NewMachine(host, port, name string) *Machine {\n\tif name == \"\" {\n\t\tname = fmt.Sprintf(\"%s:%s\", host, port)\n\t}\n\treturn &Machine{host: host, port: port, name: name}\n}", "func newMachineScope(params machineScopeParams) (*machineScope, error) {\n\tif params.Context == nil {\n\t\tparams.Context = context.Background()\n\t}\n\n\tproviderSpec, err := v1beta1.ProviderSpecFromRawExtension(params.machine.Spec.ProviderSpec.Value)\n\tif err != nil {\n\t\treturn nil, machineapierros.InvalidMachineConfiguration(\"failed to get machine config: %v\", err)\n\t}\n\n\tproviderStatus, err := v1beta1.ProviderStatusFromRawExtension(params.machine.Status.ProviderStatus)\n\tif err != nil {\n\t\treturn nil, machineapierros.InvalidMachineConfiguration(\"failed to get machine provider status: %v\", err.Error())\n\t}\n\n\tserviceAccountJSON, err := util.GetCredentialsSecret(params.coreClient, params.machine.GetNamespace(), *providerSpec)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tprojectID := providerSpec.ProjectID\n\tif len(projectID) == 0 {\n\t\tprojectID, err = util.GetProjectIDFromJSONKey([]byte(serviceAccountJSON))\n\t\tif err != nil {\n\t\t\treturn nil, machineapierros.InvalidMachineConfiguration(\"error getting project from JSON key: %v\", err)\n\t\t}\n\t}\n\n\tcomputeService, err := params.computeClientBuilder(serviceAccountJSON)\n\tif err != nil {\n\t\treturn nil, machineapierros.InvalidMachineConfiguration(\"error creating compute service: %v\", err)\n\t}\n\treturn &machineScope{\n\t\tContext: params.Context,\n\t\tcoreClient: params.coreClient,\n\t\tprojectID: projectID,\n\t\t// https://github.com/kubernetes/kubernetes/blob/8765fa2e48974e005ad16e65cb5c3acf5acff17b/staging/src/k8s.io/legacy-cloud-providers/gce/gce_util.go#L204\n\t\tproviderID: fmt.Sprintf(\"gce://%s/%s/%s\", projectID, providerSpec.Zone, params.machine.Name),\n\t\tcomputeService: computeService,\n\t\t// Deep copy the machine since it is changed outside\n\t\t// of the machine scope by consumers of the machine\n\t\t// scope (e.g. reconciler).\n\t\tmachine: params.machine.DeepCopy(),\n\t\tproviderSpec: providerSpec,\n\t\tproviderStatus: providerStatus,\n\t\t// Once set, they can not be changed. Otherwise, status change computation\n\t\t// might be invalid and result in skipping the status update.\n\t\torigMachine: params.machine.DeepCopy(),\n\t\torigProviderStatus: providerStatus.DeepCopy(),\n\t\tmachineToBePatched: controllerclient.MergeFrom(params.machine.DeepCopy()),\n\t}, nil\n}", "func NewImage(conf *Config) (*Image, error) {\n\ttr := &http.Transport{\n\t\tTLSClientConfig: &tls.Config{InsecureSkipVerify: conf.InsecureTLS},\n\t\tProxy: http.ProxyFromEnvironment,\n\t}\n\tclient := http.Client{\n\t\tTransport: tr,\n\t\tTimeout: conf.Timeout,\n\t}\n\tregistry := dockerHub\n\ttag := \"latest\"\n\ttoken := \"\"\n\tos := \"linux\"\n\tarch := \"amd64\"\n\tvar nameParts, tagParts []string\n\tvar name, port string\n\tstate := stateInitial\n\tstart := 0\n\tfor i, c := range conf.ImageName {\n\t\tif c == ':' || c == '/' || c == '@' || i == len(conf.ImageName)-1 {\n\t\t\tif i == len(conf.ImageName)-1 {\n\t\t\t\t// ignore a separator, include the last symbol\n\t\t\t\ti += 1\n\t\t\t}\n\t\t\tpart := conf.ImageName[start:i]\n\t\t\tstart = i + 1\n\t\t\tswitch state {\n\t\t\tcase stateInitial:\n\t\t\t\tif part == \"localhost\" || strings.Contains(part, \".\") {\n\t\t\t\t\t// it's registry, let's check what's next =port of image name\n\t\t\t\t\tregistry = part\n\t\t\t\t\tif c == ':' {\n\t\t\t\t\t\tstate = statePort\n\t\t\t\t\t} else {\n\t\t\t\t\t\tstate = stateName\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// it's an image name, if separator is /\n\t\t\t\t\t// next part is also part of the name\n\t\t\t\t\t// othrewise it's an offcial image\n\t\t\t\t\tif c == '/' {\n\t\t\t\t\t\t// we got just a part of name, till next time\n\t\t\t\t\t\tstart = 0\n\t\t\t\t\t\tstate = stateName\n\t\t\t\t\t} else {\n\t\t\t\t\t\tstate = stateTag\n\t\t\t\t\t\tname = fmt.Sprintf(\"library/%s\", part)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tcase stateTag:\n\t\t\t\ttag = \"\"\n\t\t\t\ttagParts = append(tagParts, part)\n\t\t\tcase statePort:\n\t\t\t\tstate = stateName\n\t\t\t\tport = part\n\t\t\tcase stateName:\n\t\t\t\tif c == ':' || c == '@' {\n\t\t\t\t\tstate = stateTag\n\t\t\t\t}\n\t\t\t\tnameParts = append(nameParts, part)\n\t\t\t}\n\t\t}\n\t}\n\n\tif port != \"\" {\n\t\tregistry = fmt.Sprintf(\"%s:%s\", registry, port)\n\t}\n\tif name == \"\" {\n\t\tname = strings.Join(nameParts, \"/\")\n\t}\n\tif tag == \"\" {\n\t\ttag = strings.Join(tagParts, \":\")\n\t}\n\tif conf.InsecureRegistry {\n\t\tregistry = fmt.Sprintf(\"http://%s/v2\", registry)\n\t} else {\n\t\tregistry = fmt.Sprintf(\"https://%s/v2\", registry)\n\t}\n\tif conf.Token != \"\" {\n\t\ttoken = \"Basic \" + conf.Token\n\t}\n\tif conf.PlatformOS != \"\" {\n\t\tos = conf.PlatformOS\n\t}\n\tif conf.PlatformArch != \"\" {\n\t\tarch = conf.PlatformArch\n\t}\n\n\treturn &Image{\n\t\tRegistry: registry,\n\t\tName: name,\n\t\tTag: tag,\n\t\tuser: conf.User,\n\t\tpassword: conf.Password,\n\t\tToken: token,\n\t\tclient: client,\n\t\tos: os,\n\t\tarch: arch,\n\t}, nil\n}", "func (m *Manager) CreateVM(name string, image string, size string, region string, sshKey core.SSHKey) (core.VMInfo, error) {\n\tvar vmInfo core.VMInfo\n\n\t// generate a strong root password. we will through this away\n\t// TODO: should really disable password login for root\n\t// TODO: should check if it is actually enabled\n\trootPassword, err := password.Generate(64, 10, 10, false, false)\n\tif err != nil {\n\t\treturn vmInfo, err\n\t}\n\n\tcreateOptions := linodego.InstanceCreateOptions{\n\t\tRegion: region,\n\t\tType: size,\n\t\tLabel: name,\n\t\tImage: image,\n\t\tRootPass: rootPassword,\n\t}\n\n\tcreateOptions.AuthorizedKeys = append(createOptions.AuthorizedKeys, sshKey.GetPublicKey())\n\tcreateOptions.Tags = append(createOptions.Tags, \"eezhee\")\n\tnewInstance, err := m.api.CreateInstance(context.Background(), createOptions)\n\tif err != nil {\n\t\treturn vmInfo, err\n\t}\n\n\t// see if vm ready\n\tstatus := newInstance.Status\n\tfor status != linodego.InstanceRunning {\n\t\t// wait a bit\n\t\ttime.Sleep(2 * time.Second)\n\n\t\tinstanceInfo, err := m.api.GetInstance(context.Background(), newInstance.ID)\n\t\tif err != nil {\n\t\t\treturn vmInfo, err\n\t\t}\n\n\t\tstatus = instanceInfo.Status\n\n\t}\n\n\t// TODO - instanceInfo has the latest info - new Instance is stale\n\tvmInfo, _ = convertVMInfoToGenericFormat(*newInstance)\n\n\treturn vmInfo, nil\n}", "func (i *ImageService) CreateLayer(container *container.Container, initFunc layer.MountInit) (layer.RWLayer, error) {\n\treturn nil, errdefs.NotImplemented(errdefs.NotImplemented(errors.New(\"not implemented\")))\n}", "func GenerateImageTag(defaultImage string, imageRegistries []string, registryConfig metabuilderapi.RegistryConfiguration) string {\n\tif len(imageRegistries) > 0 {\n\t\timageName, err := GetImageName(defaultImage)\n\t\tif err != nil {\n\t\t\treturn defaultImage\n\t\t}\n\t\tdefaultImage = getFullContainerNameFromImageRegistryConf(imageName, imageRegistries, defaultImage)\n\t}\n\n\tif len(registryConfig.Registry) > 0 {\n\t\treturn getRegistryConfiguration(defaultImage, registryConfig)\n\t}\n\treturn defaultImage\n}", "func New(ctx context.Context, local bool, instanceConfig config.InstanceConfig, startTime time.Time, version string, startSwarming bool) (*Machine, error) {\n\tstore, err := store.New(ctx, false, instanceConfig)\n\tif err != nil {\n\t\treturn nil, skerr.Wrapf(err, \"Failed to build store instance.\")\n\t}\n\tsink, err := sink.New(ctx, local, instanceConfig)\n\tif err != nil {\n\t\treturn nil, skerr.Wrapf(err, \"Failed to build sink instance.\")\n\t}\n\n\tkubernetesImage := os.Getenv(swarming.KubernetesImageEnvVar)\n\thostname, err := os.Hostname()\n\tif err != nil {\n\t\treturn nil, skerr.Wrapf(err, \"Could not determine hostname.\")\n\t}\n\tmachineID := os.Getenv(swarming.SwarmingBotIDEnvVar)\n\tif machineID == \"\" {\n\t\t// Fall back to hostname so we can track machines that\n\t\t// test_machine_monitor is running on that don't also run Swarming.\n\t\tmachineID = hostname\n\t}\n\n\treturn &Machine{\n\t\tdimensions: machine.SwarmingDimensions{},\n\t\tstore: store,\n\t\tsink: sink,\n\t\tadb: adb.New(),\n\t\tMachineID: machineID,\n\t\tHostname: hostname,\n\t\tKubernetesImage: kubernetesImage,\n\t\tVersion: version,\n\t\tstartTime: startTime,\n\t\tstartSwarming: startSwarming,\n\t\tinterrogateTimer: metrics2.GetFloat64SummaryMetric(\"bot_config_machine_interrogate_timer\", map[string]string{\"machine\": machineID}),\n\t\tinterrogateAndSendFailures: metrics2.GetCounter(\"bot_config_machine_interrogate_and_send_errors\", map[string]string{\"machine\": machineID}),\n\t\tstoreWatchArrivalCounter: metrics2.GetCounter(\"bot_config_machine_store_watch_arrival\", map[string]string{\"machine\": machineID}),\n\t}, nil\n}", "func MachinePoolSpec(ctx context.Context, inputGetter func() MachinePoolSpecInput) {\n\tinput := inputGetter()\n\tExpect(input.E2EConfig).ToNot(BeNil(), \"Invalid argument. input.E2EConfig can't be nil\")\n\tExpect(input.ConfigClusterFn).ToNot(BeNil(), \"Invalid argument. input.ConfigClusterFn can't be nil\")\n\tExpect(input.BootstrapClusterProxy).ToNot(BeNil(), \"Invalid argument. input.BootstrapClusterProxy can't be nil\")\n\tExpect(input.AWSSession).ToNot(BeNil(), \"Invalid argument. input.AWSSession can't be nil\")\n\tExpect(input.Namespace).NotTo(BeNil(), \"Invalid argument. input.Namespace can't be nil\")\n\tExpect(input.ClusterName).ShouldNot(BeEmpty(), \"Invalid argument. input.ClusterName can't be empty\")\n\tExpect(input.Flavor).ShouldNot(BeEmpty(), \"Invalid argument. input.Flavor can't be empty\")\n\n\tginkgo.By(fmt.Sprintf(\"getting cluster with name %s\", input.ClusterName))\n\tcluster := framework.GetClusterByName(ctx, framework.GetClusterByNameInput{\n\t\tGetter: input.BootstrapClusterProxy.GetClient(),\n\t\tNamespace: input.Namespace.Name,\n\t\tName: input.ClusterName,\n\t})\n\tExpect(cluster).NotTo(BeNil(), \"couldn't find CAPI cluster\")\n\n\tginkgo.By(fmt.Sprintf(\"creating an applying the %s template\", input.Flavor))\n\tconfigCluster := input.ConfigClusterFn(input.ClusterName, input.Namespace.Name)\n\tconfigCluster.Flavor = input.Flavor\n\tconfigCluster.WorkerMachineCount = pointer.Int64(1)\n\tworkloadClusterTemplate := shared.GetTemplate(ctx, configCluster)\n\tif input.UsesLaunchTemplate {\n\t\tuserDataTemplate := `#!/bin/bash\n/etc/eks/bootstrap.sh %s \\\n --container-runtime containerd\n`\n\t\teksClusterName := getEKSClusterName(input.Namespace.Name, input.ClusterName)\n\t\tuserData := fmt.Sprintf(userDataTemplate, eksClusterName)\n\t\tuserDataEncoded := base64.StdEncoding.EncodeToString([]byte(userData))\n\t\tworkloadClusterTemplate = []byte(strings.ReplaceAll(string(workloadClusterTemplate), \"USER_DATA\", userDataEncoded))\n\t}\n\tginkgo.By(string(workloadClusterTemplate))\n\tginkgo.By(fmt.Sprintf(\"Applying the %s cluster template yaml to the cluster\", configCluster.Flavor))\n\terr := input.BootstrapClusterProxy.Apply(ctx, workloadClusterTemplate)\n\tExpect(err).ShouldNot(HaveOccurred())\n\n\tginkgo.By(\"Waiting for the machine pool to be running\")\n\tmp := framework.DiscoveryAndWaitForMachinePools(ctx, framework.DiscoveryAndWaitForMachinePoolsInput{\n\t\tLister: input.BootstrapClusterProxy.GetClient(),\n\t\tGetter: input.BootstrapClusterProxy.GetClient(),\n\t\tCluster: cluster,\n\t}, input.E2EConfig.GetIntervals(\"\", \"wait-worker-nodes\")...)\n\tExpect(len(mp)).To(Equal(1))\n\n\tginkgo.By(\"Check the status of the node group\")\n\teksClusterName := getEKSClusterName(input.Namespace.Name, input.ClusterName)\n\tif input.ManagedMachinePool {\n\t\tvar nodeGroupName string\n\t\tif input.UsesLaunchTemplate {\n\t\t\tnodeGroupName = getEKSNodegroupWithLaunchTemplateName(input.Namespace.Name, input.ClusterName)\n\t\t} else {\n\t\t\tnodeGroupName = getEKSNodegroupName(input.Namespace.Name, input.ClusterName)\n\t\t}\n\t\tverifyManagedNodeGroup(eksClusterName, nodeGroupName, true, input.AWSSession)\n\t} else {\n\t\tasgName := getASGName(input.ClusterName)\n\t\tverifyASG(eksClusterName, asgName, true, input.AWSSession)\n\t}\n\n\tif input.IncludeScaling { // TODO (richardcase): should this be a separate spec?\n\t\tginkgo.By(\"Scaling the machine pool up\")\n\t\tframework.ScaleMachinePoolAndWait(ctx, framework.ScaleMachinePoolAndWaitInput{\n\t\t\tClusterProxy: input.BootstrapClusterProxy,\n\t\t\tCluster: cluster,\n\t\t\tReplicas: 2,\n\t\t\tMachinePools: mp,\n\t\t\tWaitForMachinePoolToScale: input.E2EConfig.GetIntervals(\"\", \"wait-worker-nodes\"),\n\t\t})\n\n\t\tginkgo.By(\"Scaling the machine pool down\")\n\t\tframework.ScaleMachinePoolAndWait(ctx, framework.ScaleMachinePoolAndWaitInput{\n\t\t\tClusterProxy: input.BootstrapClusterProxy,\n\t\t\tCluster: cluster,\n\t\t\tReplicas: 1,\n\t\t\tMachinePools: mp,\n\t\t\tWaitForMachinePoolToScale: input.E2EConfig.GetIntervals(\"\", \"wait-worker-nodes\"),\n\t\t})\n\t}\n\n\tif input.Cleanup {\n\t\tdeleteMachinePool(ctx, deleteMachinePoolInput{\n\t\t\tDeleter: input.BootstrapClusterProxy.GetClient(),\n\t\t\tMachinePool: mp[0],\n\t\t})\n\n\t\twaitForMachinePoolDeleted(ctx, waitForMachinePoolDeletedInput{\n\t\t\tGetter: input.BootstrapClusterProxy.GetClient(),\n\t\t\tMachinePool: mp[0],\n\t\t}, input.E2EConfig.GetIntervals(\"\", \"wait-delete-machine-pool\")...)\n\t}\n}", "func (c *TestClient) DeleteMachineImage(project, name string) error {\n\tif c.DeleteMachineImageFn != nil {\n\t\treturn c.DeleteMachineImageFn(project, name)\n\t}\n\treturn c.client.DeleteMachineImage(project, name)\n}", "func NewMachine(\n\tname string,\n\tlogin string,\n\tpassword string,\n) Machine {\n\treturn newMachine(name, login, password)\n}", "func (client *Client) CreateVirtualImage(req *Request) (*Response, error) {\n\treturn client.Execute(&Request{\n\t\tMethod: \"POST\",\n\t\tPath: VirtualImagesPath,\n\t\tQueryParams: req.QueryParams,\n\t\tBody: req.Body,\n\t\tResult: &CreateVirtualImageResult{},\n\t})\n}", "func GetMachine() (*Machine, error) {\n\t// dockerClient, err := client.NewClient(\"unix:///var/run/docker.sock\", \"1.13.1\", &http.Client{}, make(map[string]string))\n\tdockerClient, err := client.NewEnvClient()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error creating Docker API Client :\\n%s\", err)\n\t}\n\tnewMachine := &Machine{dockerClient}\n\n\treturn newMachine, nil\n}", "func (o ClusterBuildStrategySpecBuildStepsOutput) Image() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ClusterBuildStrategySpecBuildSteps) *string { return v.Image }).(pulumi.StringPtrOutput)\n}", "func NewMachine(startingState State, transitions Transitions) Machine {\n\treturn Machine{\n\t\tcurrentState: startingState,\n\t\ttransitions: transitions,\n\t}\n}", "func (c *TestClient) CreateImage(project string, i *compute.Image) error {\n\tif c.CreateImageFn != nil {\n\t\treturn c.CreateImageFn(project, i)\n\t}\n\treturn c.client.CreateImage(project, i)\n}", "func (g GCPClient) CreateImage(name, storageURL, family string, nested, uefi, replace bool) error {\n\tif replace {\n\t\tif err := g.DeleteImage(name); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tlog.Infof(\"Creating image: %s\", name)\n\timgObj := &compute.Image{\n\t\tRawDisk: &compute.ImageRawDisk{\n\t\t\tSource: storageURL,\n\t\t},\n\t\tName: name,\n\t}\n\n\tif family != \"\" {\n\t\timgObj.Family = family\n\t}\n\n\tif nested {\n\t\timgObj.Licenses = []string{vmxImageLicence}\n\t}\n\n\tif uefi {\n\t\timgObj.GuestOsFeatures = []*compute.GuestOsFeature{\n\t\t\t{Type: uefiCompatibleFeature},\n\t\t}\n\t}\n\n\top, err := g.compute.Images.Insert(g.projectName, imgObj).Do()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := g.pollOperationStatus(op.Name); err != nil {\n\t\treturn err\n\t}\n\tlog.Infof(\"Image %s created\", name)\n\treturn nil\n}", "func CreateImage(source string, b []byte) *Image {\n\tcam := System.GetCamera(source)\n\tif cam.Dewarp {\n\t\tb = dewarpFisheye(b)\n\t}\n\n\t// image's stable ID is its hash\n\tpotato := sha256.New()\n\tpotato.Write(b)\n\thandle := hex.EncodeToString(potato.Sum(nil)[:32])\n\n\t// verify that the file doesn't somehow already exist\n\tdiskPath := Repository.dataPath(source, fmt.Sprintf(\"%s.%s\", handle, \"jpg\"))\n\tfi, err := os.Stat(diskPath)\n\tif err != nil {\n\t\tif !os.IsNotExist(err) {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\tif fi != nil {\n\t\tlog.Error(\"Image.CreateImage\", \"file hash collision?! '%s'\", handle)\n\t} else {\n\t\t// write the actual file contents under its computed name\n\t\tif err := ioutil.WriteFile(diskPath, b, 0660); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\n\tstat, err := os.Stat(diskPath)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn &Image{\n\t\tHandle: handle,\n\t\tSource: source,\n\t\tTimestamp: stat.ModTime(),\n\t\tHasVideo: false,\n\t}\n}", "func newAzureMachineService(machineScope *scope.MachineScope, clusterScope *scope.ClusterScope) *azureMachineService {\n\treturn &azureMachineService{\n\t\tmachineScope: machineScope,\n\t\tclusterScope: clusterScope,\n\t\tavailabilityZonesSvc: availabilityzones.NewService(clusterScope),\n\t\tnetworkInterfacesSvc: networkinterfaces.NewService(clusterScope),\n\t\tpublicIPSvc: publicips.NewService(clusterScope),\n\t\tvirtualMachinesSvc: virtualmachines.NewService(clusterScope, machineScope),\n\t\tvirtualMachinesExtSvc: virtualmachineextensions.NewService(clusterScope),\n\t\tdisksSvc: disks.NewService(clusterScope),\n\t}\n}", "func NewNodeMachine(role, ip string) Node {\n\tswitch role {\n\tcase \"nn\":\n\t\treturn &NameNode{\n\t\t\trole: \"NameNode\",\n\t\t\tip: ip,\n\t\t}\n\tcase \"dn\":\n\t\treturn &DataNode{\n\t\t\trole: \"DataNode\",\n\t\t\tip: ip,\n\t\t}\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"not support role: %v\", role))\n\t}\n}", "func makeDiskImage(dest string, size int) error {\n\tlog.Printf(\"Creating %d MB hard disk image...\", size)\n\tcmd := exec.Command(B2D.Vbm, \"convertfromraw\", \"stdin\", dest, fmt.Sprintf(\"%d\", size*1024*1024), \"--format\", \"VMDK\")\n\tcmd.Stdout = os.Stdout\n\tcmd.Stderr = os.Stderr\n\tw, err := cmd.StdinPipe()\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Write the magic string so the VM auto-formats the disk upon first boot.\n\tif _, err := w.Write([]byte(\"boot2docker, please format-me\")); err != nil {\n\t\treturn err\n\t}\n\tif err := w.Close(); err != nil {\n\t\treturn err\n\t}\n\n\treturn cmd.Run()\n}", "func NewMachine(g *gorgonia.ExprGraph) *Machine {\n\tif g == nil {\n\t\treturn nil\n\t}\n\tnodesIte := g.Nodes()\n\tnodes := make([]*node, 0, nodesIte.Len())\n\tfor nodesIte.Next() {\n\t\tn := nodesIte.Node().(*gorgonia.Node)\n\t\tvar nn *node\n\t\ttopNode := g.To(n.ID()).Len() == 0\n\t\top := n.Op()\n\t\tswitch {\n\t\tcase op == nil:\n\t\t\tnn = newInput(n)\n\t\tcase op.Arity() == 0:\n\t\t\tnn = newInput(n)\n\t\tdefault:\n\t\t\tnn = newOp(n, !topNode)\n\t\t}\n\t\tnodes = append(nodes, nn)\n\t}\n\tm := &Machine{\n\t\tnodes: nodes,\n\t}\n\tm.pubsub = createNetwork(nodes, g)\n\treturn m\n}", "func (d *Driver) Create() error {\n\tb2dutils := mcnutils.NewB2dUtils(d.StorePath)\n\tif err := b2dutils.CopyIsoToMachineDir(d.Boot2DockerURL, d.MachineName); err != nil {\n\t\treturn err\n\t}\n\n\tlog.Infof(\"Generating SSH Keypair...\")\n\tif err := ssh.GenerateSSHKey(d.GetSSHKeyPath()); err != nil {\n\t\treturn err\n\t}\n\n\t// Create context\n\tctx, cancel := context.WithCancel(context.Background())\n\tdefer cancel()\n\n\tc, err := d.vsphereLogin(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer c.Logout(ctx)\n\n\t// Create a new finder\n\tf := find.NewFinder(c.Client, true)\n\n\tdc, err := f.DatacenterOrDefault(ctx, d.Datacenter)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tf.SetDatacenter(dc)\n\n\tdss, err := f.DatastoreOrDefault(ctx, d.Datastore)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tnetworks := make(map[string]object.NetworkReference)\n\tfor _, netName := range d.Networks {\n\t\tnet, err := f.NetworkOrDefault(ctx, netName)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tnetworks[netName] = net\n\t}\n\n\tvar hs *object.HostSystem\n\tif d.HostSystem != \"\" {\n\t\tvar err error\n\t\ths, err = f.HostSystemOrDefault(ctx, d.HostSystem)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tvar rp *object.ResourcePool\n\tif d.Pool != \"\" {\n\t\t// Find specified Resource Pool\n\t\trp, err = f.ResourcePool(ctx, d.Pool)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t} else if d.HostSystem != \"\" {\n\t\t// Pick default Resource Pool for Host System\n\t\trp, err = hs.ResourcePool(ctx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\t// Pick the default Resource Pool for the Datacenter.\n\t\trp, err = f.DefaultResourcePool(ctx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tspec := types.VirtualMachineConfigSpec{\n\t\tName: d.MachineName,\n\t\tGuestId: \"otherLinux64Guest\",\n\t\tFiles: &types.VirtualMachineFileInfo{VmPathName: fmt.Sprintf(\"[%s]\", dss.Name())},\n\t\tNumCPUs: int32(d.CPU),\n\t\tMemoryMB: int64(d.Memory),\n\t}\n\n\tscsi, err := object.SCSIControllerTypes().CreateSCSIController(\"pvscsi\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tspec.DeviceChange = append(spec.DeviceChange, &types.VirtualDeviceConfigSpec{\n\t\tOperation: types.VirtualDeviceConfigSpecOperationAdd,\n\t\tDevice: scsi,\n\t})\n\n\tlog.Infof(\"Creating VM...\")\n\tfolders, err := dc.Folders(ctx)\n\ttask, err := folders.VmFolder.CreateVM(ctx, spec, rp, hs)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tinfo, err := task.WaitForResult(ctx, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlog.Infof(\"Uploading Boot2docker ISO ...\")\n\tdsurl, err := dss.URL(ctx, dc, fmt.Sprintf(\"%s/%s\", d.MachineName, isoFilename))\n\tif err != nil {\n\t\treturn err\n\t}\n\tp := soap.DefaultUpload\n\tif err = c.Client.UploadFile(d.ISO, dsurl, &p); err != nil {\n\t\treturn err\n\t}\n\n\t// Retrieve the new VM\n\tvm := object.NewVirtualMachine(c.Client, info.Result.(types.ManagedObjectReference))\n\n\tdevices, err := vm.Device(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar add []types.BaseVirtualDevice\n\n\tcontroller, err := devices.FindDiskController(\"scsi\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdisk := devices.CreateDisk(controller, dss.Reference(),\n\t\tdss.Path(fmt.Sprintf(\"%s/%s.vmdk\", d.MachineName, d.MachineName)))\n\n\t// Convert MB to KB\n\tdisk.CapacityInKB = int64(d.DiskSize) * 1024\n\n\tadd = append(add, disk)\n\tide, err := devices.FindIDEController(\"\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcdrom, err := devices.CreateCdrom(ide)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tadd = append(add, devices.InsertIso(cdrom, dss.Path(fmt.Sprintf(\"%s/%s\", d.MachineName, isoFilename))))\n\n\tfor _, netName := range d.Networks {\n\t\tbacking, err := networks[netName].EthernetCardBackingInfo(ctx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tnetdev, err := object.EthernetCardTypes().CreateEthernetCard(\"vmxnet3\", backing)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tlog.Infof(\"adding network: %s\", netName)\n\t\tadd = append(add, netdev)\n\t}\n\n\tlog.Infof(\"Reconfiguring VM\")\n\tif vm.AddDevice(ctx, add...); err != nil {\n\t\treturn err\n\t}\n\n\t// Adding some guestinfo data\n\tvar opts []types.BaseOptionValue\n\tfor _, param := range d.CfgParams {\n\t\tv := strings.SplitN(param, \"=\", 2)\n\t\tkey := v[0]\n\t\tvalue := \"\"\n\t\tif len(v) > 1 {\n\t\t\tvalue = v[1]\n\t\t}\n\t\tfmt.Printf(\"Setting %s to %s\\n\", key, value)\n\t\topts = append(opts, &types.OptionValue{\n\t\t\tKey: key,\n\t\t\tValue: value,\n\t\t})\n\t}\n\tif d.CloudInit != \"\" {\n\t\tif _, err := url.ParseRequestURI(d.CloudInit); err == nil {\n\t\t\tlog.Infof(\"setting guestinfo.cloud-init.data.url to %s\\n\", d.CloudInit)\n\t\t\topts = append(opts, &types.OptionValue{\n\t\t\t\tKey: \"guestinfo.cloud-init.config.url\",\n\t\t\t\tValue: d.CloudInit,\n\t\t\t})\n\t\t} else {\n\t\t\tif _, err := os.Stat(d.CloudInit); err == nil {\n\t\t\t\tif value, err := ioutil.ReadFile(d.CloudInit); err == nil {\n\t\t\t\t\tlog.Infof(\"setting guestinfo.cloud-init.data to encoded content of %s\\n\", d.CloudInit)\n\t\t\t\t\tencoded := base64.StdEncoding.EncodeToString(value)\n\t\t\t\t\topts = append(opts, &types.OptionValue{\n\t\t\t\t\t\tKey: \"guestinfo.cloud-init.config.data\",\n\t\t\t\t\t\tValue: encoded,\n\t\t\t\t\t})\n\t\t\t\t\topts = append(opts, &types.OptionValue{\n\t\t\t\t\t\tKey: \"guestinfo.cloud-init.data.encoding\",\n\t\t\t\t\t\tValue: \"base64\",\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\ttask, err = vm.Reconfigure(ctx, types.VirtualMachineConfigSpec{\n\t\tExtraConfig: opts,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\ttask.Wait(ctx)\n\n\tif err := d.Start(); err != nil {\n\t\treturn err\n\t}\n\n\tlog.Infof(\"Provisioning certs and ssh keys...\")\n\t// Generate a tar keys bundle\n\tif err := d.generateKeyBundle(); err != nil {\n\t\treturn err\n\t}\n\n\topman := guest.NewOperationsManager(c.Client, vm.Reference())\n\n\tfileman, err := opman.FileManager(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsrc := d.ResolveStorePath(\"userdata.tar\")\n\ts, err := os.Stat(src)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tauth := AuthFlag{}\n\tflag := FileAttrFlag{}\n\tauth.auth.Username = B2DUser\n\tauth.auth.Password = B2DPass\n\tflag.SetPerms(0, 0, 660)\n\turl, err := fileman.InitiateFileTransferToGuest(ctx, auth.Auth(), \"/home/docker/userdata.tar\", flag.Attr(), s.Size(), true)\n\tif err != nil {\n\t\treturn err\n\t}\n\tu, err := c.Client.ParseURL(url)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err = c.Client.UploadFile(src, u, nil); err != nil {\n\t\treturn err\n\t}\n\n\tprocman, err := opman.ProcessManager(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// first, untar - only boot2docker has /var/lib/boot2docker\n\t// TODO: don't hard-code to docker & staff - they are also just b2d\n\tvar env []string\n\tguestspec := types.GuestProgramSpec{\n\t\tProgramPath: \"/usr/bin/sudo\",\n\t\tArguments: \"/usr/bin/sudo /bin/sh -c \\\"tar xvf /home/docker/userdata.tar -C /home/docker > /var/log/userdata.log 2>&1 && chown -R docker:staff /home/docker\\\"\",\n\t\tWorkingDirectory: \"\",\n\t\tEnvVariables: env,\n\t}\n\n\t_, err = procman.StartProgram(ctx, auth.Auth(), &guestspec)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// now move to /var/lib/boot2docker if its there\n\tguestspec = types.GuestProgramSpec{\n\t\tProgramPath: \"/usr/bin/sudo\",\n\t\tArguments: \"/bin/mv /home/docker/userdata.tar /var/lib/boot2docker/userdata.tar\",\n\t\tWorkingDirectory: \"\",\n\t\tEnvVariables: env,\n\t}\n\n\t_, err = procman.StartProgram(ctx, auth.Auth(), &guestspec)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func NewImage(name, kernel, initrd, rootfs string) *Image {\n\treturn &Image{\n\t\tName: name,\n\t\tkernel: kernel,\n\t\tinitrd: initrd,\n\t\trootfs: rootfs,\n\t}\n}", "func (ref openshiftReference) NewImage(certPath string, tlsVerify bool) (types.Image, error) {\n\treturn nil, errors.New(\"Full Image support not implemented for atomic: image names\")\n}", "func (t *keepalivedService) InitMachine(node service.Node, client util.SSHClient, sctx *service.ServiceContext, deps service.ServiceDependencies, flags service.ServiceFlags) error {\n\tlog := deps.Logger.With().Str(\"host\", node.Name).Logger()\n\n\t// Setup controlplane on this host?\n\tif !node.IsControlPlane || flags.ControlPlane.APIServerVirtualIP == \"\" {\n\t\tlog.Info().Msg(\"No keepalived on this machine\")\n\t\treturn nil\n\t}\n\n\tcfg, err := t.createConfig(node, client, sctx, deps, flags)\n\tif err != nil {\n\t\treturn maskAny(err)\n\t}\n\n\t// Create & Upload keepalived.conf\n\tlog.Info().Msgf(\"Uploading %s Config\", t.Name())\n\tif err := createConfigFile(client, deps, cfg); err != nil {\n\t\treturn maskAny(err)\n\t}\n\tif err := createAPIServerCheck(client, deps, cfg); err != nil {\n\t\treturn maskAny(err)\n\t}\n\n\t// Restart keepalived\n\tif _, err := client.Run(log, \"sudo systemctl restart \"+serviceName, \"\", true); err != nil {\n\t\tlog.Warn().Err(err).Msg(\"Failed to restart keepalived server\")\n\t}\n\n\treturn nil\n}", "func create(vm *api.VM) error {\n\tlog.Infof(\"Creating VM %q with name %q...\", vm.GetUID(), vm.GetName())\n\tif err := ensureOCIImages(vm); err != nil {\n\t\treturn err\n\t}\n\tvmCreated.Inc()\n\t// Allocate and populate the overlay file\n\treturn dmlegacy.AllocateAndPopulateOverlay(vm)\n}", "func (c *PostgresSQL) CreateVirtualMachine(userID string, VirtualMachine model.VirtualMachine) (model.VirtualMachine, error) {\n\tid := uuid.New().String()\n\n\t_, err := c.db.NamedExec(\n\t\t`INSERT INTO virtual_machines (id, user_id, name, cpus, quantity, created_at, updated_at)\n\t\tVALUES (:id, :user_id, :name, :cpus, :quantity, now(), now())`, map[string]interface{}{\n\t\t\t\"id\": id,\n\t\t\t\"user_id\": userID,\n\t\t\t\"name\": VirtualMachine.Name,\n\t\t\t\"cpus\": VirtualMachine.Cpus,\n\t\t\t\"quantity\": VirtualMachine.Quantity,\n\t\t})\n\tif err != nil {\n\t\treturn VirtualMachine, err\n\t}\n\n\tVirtualMachine.ID = id\n\n\treturn VirtualMachine, nil\n}", "func CreateMachineHealthCheck(name string, labels map[string]string) error {\n\tc, err := LoadClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmhc := &mrv1.MachineHealthCheck{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t\tNamespace: NamespaceOpenShiftMachineAPI,\n\t\t},\n\t\tSpec: mrv1.MachineHealthCheckSpec{\n\t\t\tSelector: metav1.LabelSelector{\n\t\t\t\tMatchLabels: labels,\n\t\t\t},\n\t\t},\n\t}\n\treturn c.Create(context.TODO(), mhc)\n}", "func (r *Reconciler) create() error {\n\tif err := validateMachine(*r.machine); err != nil {\n\t\treturn fmt.Errorf(\"%v: failed validating machine provider spec: %w\", r.machine.GetName(), err)\n\t}\n\n\tif ipam.HasStaticIPConfiguration(r.providerSpec) {\n\t\tif !r.staticIPFeatureGateEnabled {\n\t\t\treturn fmt.Errorf(\"%v: static IP/IPAM configuration is only available with the VSphereStaticIPs feature gate\", r.machine.GetName())\n\t\t}\n\n\t\toutstandingClaims, err := ipam.HasOutstandingIPAddressClaims(\n\t\t\tr.Context,\n\t\t\tr.client,\n\t\t\tr.machine,\n\t\t\tr.providerSpec.Network.Devices,\n\t\t)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcondition := metav1.Condition{\n\t\t\tType: string(machinev1.IPAddressClaimedCondition),\n\t\t\tReason: machinev1.WaitingForIPAddressReason,\n\t\t\tMessage: \"All IP address claims are bound\",\n\t\t\tStatus: metav1.ConditionFalse,\n\t\t}\n\t\tif outstandingClaims > 0 {\n\t\t\tcondition.Message = fmt.Sprintf(\"Waiting on %d IP address claims to be bound\", outstandingClaims)\n\t\t\tcondition.Status = metav1.ConditionTrue\n\t\t\tklog.Infof(\"Waiting for IPAddressClaims associated with machine %s to be bound\", r.machine.Name)\n\t\t}\n\t\tif err := setProviderStatus(\"\", condition, r.machineScope, nil); err != nil {\n\t\t\treturn fmt.Errorf(\"could not set provider status: %w\", err)\n\t\t}\n\t}\n\n\t// We only clone the VM template if we have no taskRef.\n\tif r.providerStatus.TaskRef == \"\" {\n\t\tif !r.machineScope.session.IsVC() {\n\t\t\treturn fmt.Errorf(\"%v: not connected to a vCenter\", r.machine.GetName())\n\t\t}\n\t\tklog.Infof(\"%v: cloning\", r.machine.GetName())\n\t\ttask, err := clone(r.machineScope)\n\t\tif err != nil {\n\t\t\tmetrics.RegisterFailedInstanceCreate(&metrics.MachineLabels{\n\t\t\t\tName: r.machine.Name,\n\t\t\t\tNamespace: r.machine.Namespace,\n\t\t\t\tReason: \"Clone task finished with error\",\n\t\t\t})\n\t\t\tconditionFailed := conditionFailed()\n\t\t\tconditionFailed.Message = err.Error()\n\t\t\tstatusError := setProviderStatus(task, conditionFailed, r.machineScope, nil)\n\t\t\tif statusError != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to set provider status: %w\", err)\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\t\treturn setProviderStatus(task, conditionSuccess(), r.machineScope, nil)\n\t}\n\n\tmoTask, err := r.session.GetTask(r.Context, r.providerStatus.TaskRef)\n\tif err != nil {\n\t\tmetrics.RegisterFailedInstanceCreate(&metrics.MachineLabels{\n\t\t\tName: r.machine.Name,\n\t\t\tNamespace: r.machine.Namespace,\n\t\t\tReason: \"GetTask finished with error\",\n\t\t})\n\t\treturn err\n\t}\n\n\tif moTask == nil {\n\t\t// Possible eventual consistency problem from vsphere\n\t\t// TODO: change error message here to indicate this might be expected.\n\t\treturn fmt.Errorf(\"unexpected moTask nil\")\n\t}\n\n\tif taskIsFinished, err := taskIsFinished(moTask); err != nil {\n\t\tif taskIsFinished {\n\t\t\tmetrics.RegisterFailedInstanceCreate(&metrics.MachineLabels{\n\t\t\t\tName: r.machine.Name,\n\t\t\t\tNamespace: r.machine.Namespace,\n\t\t\t\tReason: \"Task finished with error\",\n\t\t\t})\n\t\t\tconditionFailed := conditionFailed()\n\t\t\tconditionFailed.Message = err.Error()\n\t\t\tstatusError := setProviderStatus(moTask.Reference().Value, conditionFailed, r.machineScope, nil)\n\t\t\tif statusError != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to set provider status: %w\", statusError)\n\t\t\t}\n\t\t\treturn machinecontroller.CreateMachine(err.Error())\n\t\t} else {\n\t\t\treturn fmt.Errorf(\"failed to check task status: %w\", err)\n\t\t}\n\t} else if !taskIsFinished {\n\t\treturn fmt.Errorf(\"%v task %v has not finished\", moTask.Info.DescriptionId, moTask.Reference().Value)\n\t}\n\n\t// if clone task finished successfully, power on the vm\n\tif moTask.Info.DescriptionId == cloneVmTaskDescriptionId {\n\t\tklog.Infof(\"Powering on cloned machine: %v\", r.machine.Name)\n\t\ttask, err := powerOn(r.machineScope)\n\t\tif err != nil {\n\t\t\tmetrics.RegisterFailedInstanceCreate(&metrics.MachineLabels{\n\t\t\t\tName: r.machine.Name,\n\t\t\t\tNamespace: r.machine.Namespace,\n\t\t\t\tReason: \"PowerOn task finished with error\",\n\t\t\t})\n\t\t\tconditionFailed := conditionFailed()\n\t\t\tconditionFailed.Message = err.Error()\n\t\t\tstatusError := setProviderStatus(task, conditionFailed, r.machineScope, nil)\n\t\t\tif statusError != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to set provider status: %w\", err)\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\t\treturn setProviderStatus(task, conditionSuccess(), r.machineScope, nil)\n\t}\n\n\t// If taskIsFinished then next reconcile should result in update.\n\treturn nil\n}", "func MachineCRDCreator() reconciling.NamedCustomResourceDefinitionCreatorGetter {\n\treturn func() (string, reconciling.CustomResourceDefinitionCreator) {\n\t\treturn resources.MachineCRDName, func(crd *apiextensionsv1beta1.CustomResourceDefinition) (*apiextensionsv1beta1.CustomResourceDefinition, error) {\n\t\t\tcrd.Spec.Group = clusterAPIGroup\n\t\t\tcrd.Spec.Version = clusterAPIVersion\n\t\t\tcrd.Spec.Scope = apiextensionsv1beta1.NamespaceScoped\n\t\t\tcrd.Spec.Names.Kind = \"Machine\"\n\t\t\tcrd.Spec.Names.ListKind = \"MachineList\"\n\t\t\tcrd.Spec.Names.Plural = \"machines\"\n\t\t\tcrd.Spec.Names.Singular = \"machine\"\n\t\t\tcrd.Spec.Names.ShortNames = []string{\"ma\"}\n\t\t\tcrd.Spec.AdditionalPrinterColumns = []apiextensionsv1beta1.CustomResourceColumnDefinition{\n\t\t\t\t{\n\t\t\t\t\tName: \"Age\",\n\t\t\t\t\tType: \"date\",\n\t\t\t\t\tJSONPath: \".metadata.creationTimestamp\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tName: \"Deleted\",\n\t\t\t\t\tType: \"date\",\n\t\t\t\t\tJSONPath: \".metadata.deletionTimestamp\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tName: \"MachineSet\",\n\t\t\t\t\tType: \"string\",\n\t\t\t\t\tJSONPath: \".metadata.ownerReferences[0].name\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tName: \"Address\",\n\t\t\t\t\tType: \"string\",\n\t\t\t\t\tJSONPath: \".status.addresses[0].address\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tName: \"Node\",\n\t\t\t\t\tType: \"string\",\n\t\t\t\t\tJSONPath: \".status.nodeRef.name\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tName: \"Provider\",\n\t\t\t\t\tType: \"string\",\n\t\t\t\t\tJSONPath: \".spec.providerSpec.value.cloudProvider\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tName: \"OS\",\n\t\t\t\t\tType: \"string\",\n\t\t\t\t\tJSONPath: \".spec.providerSpec.value.operatingSystem\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tName: \"Version\",\n\t\t\t\t\tType: \"string\",\n\t\t\t\t\tJSONPath: \".spec.versions.kubelet\",\n\t\t\t\t},\n\t\t\t}\n\n\t\t\treturn crd, nil\n\t\t}\n\t}\n\n}", "func CreateComputeInstance(metadataitems []*api.MetadataItems, client daisyCompute.Client, machineType, image, name, projectID, zone, serviceAccountEmail string, serviceAccountScopes []string) (*compute.Instance, error) {\n\tpool <- struct{}{}\n\tdefer func() {\n\t\t<-pool\n\t}()\n\tvar items []*api.MetadataItems\n\n\t// enable debug logging and guest-attributes for all test instances\n\titems = append(items, compute.BuildInstanceMetadataItem(\"enable-os-config-debug\", \"true\"))\n\titems = append(items, compute.BuildInstanceMetadataItem(\"enable-guest-attributes\", \"true\"))\n\tif config.AgentSvcEndpoint() != \"\" {\n\t\titems = append(items, compute.BuildInstanceMetadataItem(\"os-config-endpoint\", config.AgentSvcEndpoint()))\n\t}\n\n\tfor _, item := range metadataitems {\n\t\titems = append(items, item)\n\t}\n\n\ti := &api.Instance{\n\t\tName: name,\n\t\tMachineType: fmt.Sprintf(\"projects/%s/zones/%s/machineTypes/%s\", projectID, zone, machineType),\n\t\tNetworkInterfaces: []*api.NetworkInterface{\n\t\t\t{\n\t\t\t\tSubnetwork: fmt.Sprintf(\"projects/%s/regions/%s/subnetworks/default\", projectID, zone[:len(zone)-2]),\n\t\t\t\tAccessConfigs: []*api.AccessConfig{\n\t\t\t\t\t{\n\t\t\t\t\t\tType: \"ONE_TO_ONE_NAT\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tMetadata: &api.Metadata{\n\t\t\tItems: items,\n\t\t},\n\t\tDisks: []*api.AttachedDisk{\n\t\t\t{\n\t\t\t\tAutoDelete: true,\n\t\t\t\tBoot: true,\n\t\t\t\tInitializeParams: &api.AttachedDiskInitializeParams{\n\t\t\t\t\tSourceImage: image,\n\t\t\t\t\tDiskType: fmt.Sprintf(\"projects/%s/zones/%s/diskTypes/pd-balanced\", projectID, zone),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tServiceAccounts: []*api.ServiceAccount{\n\t\t\t{\n\t\t\t\tEmail: serviceAccountEmail,\n\t\t\t\tScopes: serviceAccountScopes,\n\t\t\t},\n\t\t},\n\t\tLabels: map[string]string{\"name\": name},\n\t}\n\n\tinst, err := compute.CreateInstance(client, projectID, zone, i)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn inst, nil\n}", "func createTestMachine() EnigmaMachine {\n\tr1 := TestRotor()\n\tr2 := TestRotor()\n\tr3 := TestRotor()\n\n\tvar rotors RotorSet\n\n\trotors.left = &r1\n\trotors.middle = &r2\n\trotors.right = &r3\n\n\tstraightThroughPlugBoard := Plugboard{map[string]string{}}\n\tem, err := CreateEnigmaMachine(rotors, \"AAA\", straightThroughPlugBoard, GenerateReflectorA(), GenerateMilitaryInputRotor())\n\n\tif err != nil {\n\t\tlog.Fatal(\"There was an issue creating the machine: \" + err.Error())\n\t}\n\n\treturn em\n}", "func (d *driverMock) CreateImage(ctx context.Context, id string) (core.Image, error) {\n\tif d.CreateImageErr != nil {\n\t\treturn core.Image{}, d.CreateImageErr\n\t}\n\td.CreateImageID = id\n\treturn core.Image{Id: &id}, nil\n}", "func NewMachine(w io.Writer) *Machine {\n\treturn &Machine{\n\t\tstack: &Stack{},\n\t\tdict: map[string]Operation{\n\t\t\t// Arithmetic:\n\t\t\t\"+\": add,\n\t\t\t\"-\": subtract,\n\t\t\t\"*\": multiply,\n\t\t\t\"/\": divide,\n\t\t\t// Stack manipulations:\n\t\t\t\"dup\": duplicate,\n\t\t\t\"drop\": drop,\n\t\t\t\"swap\": swap,\n\t\t\t\"over\": over,\n\t\t\t// Output:\n\t\t\t\".\": print(w),\n\t\t\t\".s\": printStack(w),\n\t\t\t\"emit\": emit(w),\n\t\t},\n\t}\n}", "func FindMachineImage(machineImages []api.MachineImage, name, version string) (*api.MachineImage, error) {\n\tfor _, machineImage := range machineImages {\n\t\tif machineImage.Name == name && machineImage.Version == version {\n\t\t\treturn &machineImage, nil\n\t\t}\n\t}\n\treturn nil, fmt.Errorf(\"no machine image with name %q, version %q found\", name, version)\n}", "func createMilitaryMachine() EnigmaMachine {\n\tr1 := GenerateRotorI()\n\tr2 := GenerateRotorII()\n\tr3 := GenerateRotorIII()\n\n\tvar rotors RotorSet\n\n\trotors.left = &r1\n\trotors.middle = &r2\n\trotors.right = &r3\n\n\tstraightThroughPlugBoard := Plugboard{map[string]string{}}\n\n\tem, err := CreateEnigmaMachine(rotors, \"AAA\", straightThroughPlugBoard, GenerateReflectorB(), GenerateMilitaryInputRotor())\n\n\tif err != nil {\n\t\tlog.Fatal(\"There was an issue creating the machine: \" + err.Error())\n\t}\n\treturn em\n}", "func (p *AWS) CreateImage(ctx *lepton.Context, imagePath string) error {\n\timageName := ctx.Config().CloudConfig.ImageName\n\n\ti, _ := p.findImageByName(imageName)\n\tif i != nil {\n\t\treturn fmt.Errorf(\"failed creating image: image with name %s already exists\", imageName)\n\t}\n\n\tc := ctx.Config()\n\n\tkey := c.CloudConfig.ImageName\n\n\tbar := progressbar.New(100)\n\n\tgo func() {\n\t\tfor {\n\t\t\ttime.Sleep(2 * time.Second)\n\n\t\t\tbar.Add64(1)\n\t\t\tbar.RenderBlank()\n\n\t\t\tif bar.State().CurrentPercent == 99 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}()\n\n\tctx.Logger().Info(\"Creating snapshot\")\n\tsnapshotID, err := p.createSnapshot(imagePath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tbar.Set(100)\n\tbar.Finish()\n\tfmt.Println()\n\n\t// tag the volume\n\ttags, _ := buildAwsTags(c.CloudConfig.Tags, key)\n\n\tctx.Logger().Info(\"Tagging snapshot\")\n\t_, err = p.ec2.CreateTags(&ec2.CreateTagsInput{\n\t\tResources: aws.StringSlice([]string{snapshotID}),\n\t\tTags: tags,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tt := time.Now().UnixNano()\n\ts := strconv.FormatInt(t, 10)\n\n\tamiName := key + s\n\n\t// register ami\n\tenaSupport := GetEnaSupportForFlavor(c.CloudConfig.Flavor)\n\n\trinput := &ec2.RegisterImageInput{\n\t\tName: aws.String(amiName),\n\t\tArchitecture: aws.String(\"x86_64\"),\n\t\tBlockDeviceMappings: []*ec2.BlockDeviceMapping{\n\t\t\t{\n\t\t\t\tDeviceName: aws.String(\"/dev/sda1\"),\n\t\t\t\tEbs: &ec2.EbsBlockDevice{\n\t\t\t\t\tDeleteOnTermination: aws.Bool(false),\n\t\t\t\t\tSnapshotId: aws.String(snapshotID),\n\t\t\t\t\tVolumeType: aws.String(\"gp2\"),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tDescription: aws.String(fmt.Sprintf(\"nanos image %s\", key)),\n\t\tRootDeviceName: aws.String(\"/dev/sda1\"),\n\t\tVirtualizationType: aws.String(\"hvm\"),\n\t\tEnaSupport: aws.Bool(enaSupport),\n\t}\n\n\tctx.Logger().Info(\"Registering image\")\n\tresreg, err := p.ec2.RegisterImage(rinput)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Add name tag to the created ami\n\tctx.Logger().Info(\"Tagging image\")\n\t_, err = p.ec2.CreateTags(&ec2.CreateTagsInput{\n\t\tResources: []*string{resreg.ImageId},\n\t\tTags: tags,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (r *VmwareMapper) MapVM(targetVmName *string, vmSpec *kubevirtv1.VirtualMachine) (*kubevirtv1.VirtualMachine, error) {\n\tif vmSpec.Spec.Template == nil {\n\t\tvmSpec.Spec.Template = &kubevirtv1.VirtualMachineInstanceTemplateSpec{}\n\t}\n\t// Map annotations\n\tvmSpec.ObjectMeta.Annotations = r.mapAnnotations()\n\t// Map labels like vm tags\n\tvmSpec.ObjectMeta.Labels = r.mapLabels(vmSpec.ObjectMeta.Labels)\n\t// Set Namespace\n\tvmSpec.ObjectMeta.Namespace = r.namespace\n\n\t// Map name\n\tif targetVmName == nil {\n\t\tvmSpec.ObjectMeta.GenerateName = vmNamePrefix\n\t} else {\n\t\tvmSpec.ObjectMeta.Name = *targetVmName\n\t}\n\n\tif vmSpec.Spec.Template == nil {\n\t\tvmSpec.Spec.Template = &kubevirtv1.VirtualMachineInstanceTemplateSpec{}\n\t}\n\n\ttrue_ := true\n\tfalse_ := false\n\tvmSpec.Spec.Running = &false_\n\n\t// Map hostname\n\thostname, _ := utils.NormalizeName(r.vmProperties.Guest.HostName)\n\t// if this is a FQDN, split off the first subdomain and use it as the hostname.\n\tnameParts := strings.Split(hostname, \".\")\n\tvmSpec.Spec.Template.Spec.Hostname = nameParts[0]\n\n\tvmSpec.Spec.Template.Spec.Domain.Machine = kubevirtv1.Machine{Type: q35}\n\tvmSpec.Spec.Template.Spec.Domain.CPU = r.mapCPUTopology()\n\tvmSpec.Spec.Template.Spec.Domain.Firmware = r.mapFirmware()\n\tvmSpec.Spec.Template.Spec.Domain.Features = r.mapFeatures()\n\treservations, err := r.mapResourceReservations()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvmSpec.Spec.Template.Spec.Domain.Resources = reservations\n\n\t// Map clock\n\tvmSpec.Spec.Template.Spec.Domain.Clock = r.mapClock(r.hostProperties)\n\n\t// remove any default networks/interfaces from the template\n\tvmSpec.Spec.Template.Spec.Networks = []kubevirtv1.Network{}\n\tvmSpec.Spec.Template.Spec.Domain.Devices.Interfaces = []kubevirtv1.Interface{}\n\n\tif r.mappings != nil && r.mappings.NetworkMappings != nil {\n\t\t// Map networks\n\t\tvmSpec.Spec.Template.Spec.Networks, err = r.mapNetworks()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tnetworkToType := r.mapNetworksToTypes(vmSpec.Spec.Template.Spec.Networks)\n\t\tvmSpec.Spec.Template.Spec.Domain.Devices.Interfaces, err = r.mapNetworkInterfaces(networkToType)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// if there are no interfaces defined, force NetworkInterfaceMultiQueue to false\n\t// https://github.com/kubevirt/common-templates/issues/186\n\tif len(vmSpec.Spec.Template.Spec.Domain.Devices.Interfaces) > 0 {\n\t\tvmSpec.Spec.Template.Spec.Domain.Devices.NetworkInterfaceMultiQueue = &true_\n\t} else {\n\t\tvmSpec.Spec.Template.Spec.Domain.Devices.NetworkInterfaceMultiQueue = &false_\n\t}\n\n\tos, _ := r.osFinder.FindOperatingSystem(r.vmProperties)\n\tvmSpec.Spec.Template.Spec.Domain.Devices.Inputs = r.mapInputDevice(os)\n\tvmSpec.Spec.Template.Spec.Domain.Devices.Disks = []kubevirtv1.Disk{}\n\treturn vmSpec, nil\n}", "func (i *LibpodAPI) CreateImage(call ioprojectatomicpodman.VarlinkCall) error {\n\treturn call.ReplyMethodNotImplemented(\"CreateImage\")\n}", "func (client *AWSClient) CreateImage(ctx context.Context, instanceID, name, now string) (string, error) {\n\tresult, err := client.svcEC2.CreateImageWithContext(ctx, &ec2.CreateImageInput{\n\t\tInstanceId: aws.String(instanceID),\n\t\tDescription: aws.String(\"create by go-create-image-backup\"),\n\t\tName: aws.String(fmt.Sprintf(\"%s-%s\", name, now)),\n\t\tNoReboot: aws.Bool(true),\n\t})\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\timageID := *result.ImageId\n\n\tif err := client.svcEC2.WaitUntilImageAvailableWithContext(\n\t\tctx,\n\t\t&ec2.DescribeImagesInput{\n\t\t\tImageIds: []*string{aws.String(imageID)},\n\t\t},\n\t\t[]request.WaiterOption{request.WithWaiterMaxAttempts(120)}...,\n\t); err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn imageID, nil\n}", "func (p *PodmanTestIntegration) BuildImage(dockerfile, imageName string, layers string) {\n\t// TODO\n}", "func (r *LocalRuntime) New(ctx context.Context, name, signaturePolicyPath, authfile string, writer io.Writer, dockeroptions *image.DockerRegistryOptions, signingoptions image.SigningOptions, forcePull bool, label *string) (*ContainerImage, error) {\n\timg, err := r.Runtime.ImageRuntime().New(ctx, name, signaturePolicyPath, authfile, writer, dockeroptions, signingoptions, forcePull, label)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &ContainerImage{img}, nil\n}", "func (o BuildStrategySpecBuildStepsOutput) Image() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v BuildStrategySpecBuildSteps) *string { return v.Image }).(pulumi.StringPtrOutput)\n}", "func createImageResource(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {\n\t// Warning or errors can be collected in a slice type\n\tvar diags diag.Diagnostics\n\n\tclient := (meta.(Client)).Client\n\tname := rdEntryStr(d, \"name\")\n\tid := rdEntryStr(d, \"id\")\n\terrMsgPrefix := fmt.Sprintf(\"[ERROR] Image %s (id: %s) Create Failed.\",\n\t\tname, id)\n\tif client == nil {\n\t\treturn diag.Errorf(\"%s nil Client\", errMsgPrefix)\n\t}\n\tcfg := &swagger_models.ImageConfig{\n\t\tName: &name,\n\t}\n\terr := updateImageCfgFromResourceData(cfg, d)\n\tif err != nil {\n\t\treturn diag.Errorf(\"%s %s\", errMsgPrefix, err.Error())\n\t}\n\tlog.Printf(\"[INFO] Creating Image: %s\", name)\n\tclient.XRequestIdPrefix = \"TF-image-create\"\n\trspData := &swagger_models.ZsrvResponse{}\n\t_, err = client.SendReq(\"POST\", imageUrlExtension, cfg, rspData)\n\tif err != nil {\n\t\treturn diag.Errorf(\"%s Err: %s\", errMsgPrefix, err.Error())\n\t}\n\tlog.Printf(\"Image %s (ID: %s) Successfully created\\n\",\n\t\trspData.ObjectName, rspData.ObjectID)\n\td.SetId(rspData.ObjectID)\n\treturn diags\n}", "func (o BuildSpecRuntimeBaseOutput) Image() pulumi.StringOutput {\n\treturn o.ApplyT(func(v BuildSpecRuntimeBase) string { return v.Image }).(pulumi.StringOutput)\n}", "func Machine(id ID) []byte {\n\treturn dgen.Machine(id)\n}", "func ApplyMachineResources(ctx context.Context, c client.Client) error {\n\tfns := make([]flow.TaskFn, 0, len(machineCRDs))\n\n\tfor _, crd := range machineCRDs {\n\t\tobj := &apiextensionsv1beta1.CustomResourceDefinition{\n\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\tName: crd.Name,\n\t\t\t},\n\t\t}\n\t\tspec := crd.Spec.DeepCopy()\n\n\t\tfns = append(fns, func(ctx context.Context) error {\n\t\t\t_, err := controllerutil.CreateOrUpdate(ctx, c, obj, func() error {\n\t\t\t\tobj.Labels = utils.MergeStringMaps(obj.Labels, deletionProtectionLabels)\n\t\t\t\tobj.Spec = *spec\n\t\t\t\treturn nil\n\t\t\t})\n\t\t\treturn err\n\t\t})\n\t}\n\n\treturn flow.Parallel(fns...)(ctx)\n}", "func ImageReplacement(t *testing.T) {\n\tctx := test.NewTestCtx(t)\n\tdefer ctx.Cleanup()\n\n\terr := deployOperator(t, ctx)\n\thelpers.AssertNoError(t, err)\n\n\tt.Run(\"create-cr\", testsuites.ValidateManualInstall)\n}", "func (dm *DockerMachine) Machine(name string) (Machine, error) {\n\tmachines, err := dm.Machines()\n\tif err != nil {\n\t\treturn Machine{}, err\n\t}\n\tfor _, machine := range machines {\n\t\tif machine.Name == name {\n\t\t\treturn machine, nil\n\t\t}\n\t}\n\treturn Machine{}, fmt.Errorf(\"machine %s not found\", name)\n}", "func NewMachine(catalogue *ItemCatalogue, engine *CashEngine, logger *log.Logger) *Machine {\n\titemStock := make(map[int]int)\n\tfor _, i := range catalogue.Items {\n\t\titemStock[i.selector] = 0\n\t}\n\n\treturn &Machine{\n\t\tcashEngine: engine,\n\t\titemCatalogue: catalogue,\n\t\titemStock: itemStock,\n\t\tlogger: logger,\n\t}\n\n}", "func NewImage(ctx *pulumi.Context,\n\tname string, args *ImageArgs, opts ...pulumi.ResourceOption) (*Image, error) {\n\tif args == nil {\n\t\targs = &ImageArgs{}\n\t}\n\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource Image\n\terr := ctx.RegisterResource(\"alicloud:ecs/image:Image\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func CreateImageVector() imagevector.ImageVector {\n\timageVectorPath := filepath.Join(\"..\", \"..\", \"..\", \"..\", common.ChartPath, \"images.yaml\")\n\timageVector, err := imagevector.ReadGlobalImageVectorWithEnvOverride(imageVectorPath)\n\tExpect(err).To(BeNil())\n\treturn imageVector\n}", "func (c *TestClient) ListMachineImages(project string, opts ...ListCallOption) ([]*compute.MachineImage, error) {\n\tif c.ListMachineImagesFn != nil {\n\t\treturn c.ListMachineImagesFn(project, opts...)\n\t}\n\treturn c.client.ListMachineImages(project, opts...)\n}", "func (machine *Machine) Create(e *expect.GExpect, root *Root, server *Server) error {\n\ttasks := []*Task{\n\t\t{\n\t\t\tInputs: []string{\n\t\t\t\t`cd('/')`,\n\t\t\t\t`pwd()`,\n\t\t\t},\n\t\t\tExpecteds: []string{\n\t\t\t\t`edit:/`,\n\t\t\t},\n\t\t\tTimeout: root.Internal.Timeout,\n\t\t},\n\t\t{\n\t\t\tInputs: []string{\n\t\t\t\tfmt.Sprintf(`\nif '%s' == 'UnixMachine':\n\tcmo.createUnixMachine('%s')\n\tprint 'XxXsuccessXxX'\nelif '%[1]s' == 'Machine':\n\tcmo.createUnixMachine('%[2]s')\n\tprint 'XxXsuccessXxX'\nelse:\n\tprint 'XxXfailedXxX'\n`, machine.Type, machine.Name),\n\t\t\t},\n\t\t\tExpecteds: []string{\n\t\t\t\t`XxXsuccessXxX`,\n\t\t\t\t`weblogic.descriptor.BeanAlreadyExistsException: Bean already exists`,\n\t\t\t},\n\t\t\tTimeout: root.Internal.Timeout,\n\t\t},\n\t\t{\n\t\t\tInputs: []string{\n\t\t\t\tfmt.Sprintf(`cd('/Machines/%s/NodeManager/%[1]s')`, machine.Name),\n\t\t\t\t`pwd()`,\n\t\t\t},\n\t\t\tExpecteds: []string{\n\t\t\t\tfmt.Sprintf(`'edit:/Machines/%s/NodeManager/%[1]s'`, machine.Name),\n\t\t\t},\n\t\t\tTimeout: root.Internal.Timeout,\n\t\t},\n\t\t{\n\t\t\tRequireds: []string{``},\n\t\t\tInputs: []string{\n\t\t\t\tfmt.Sprintf(`cmo.setListenAddress('%s')`, machine.Host),\n\t\t\t\t`cmo.getListenAddress()`,\n\t\t\t},\n\t\t\tExpecteds: []string{\n\t\t\t\tfmt.Sprintf(`'%s'`, machine.Host),\n\t\t\t},\n\t\t\tTimeout: root.Internal.Timeout,\n\t\t},\n\t\t{\n\t\t\tRequireds: []string{``},\n\t\t\tInputs: []string{\n\t\t\t\tfmt.Sprintf(`cmo.setListenPort(%s)`, machine.Port),\n\t\t\t\t`cmo.getListenPort()`,\n\t\t\t},\n\t\t\tExpecteds: []string{\n\t\t\t\tfmt.Sprintf(`%s`, machine.Port),\n\t\t\t},\n\t\t\tTimeout: root.Internal.Timeout,\n\t\t},\n\t\t{\n\t\t\tRequireds: []string{``},\n\t\t\tInputs: []string{\n\t\t\t\tfmt.Sprintf(`cmo.setNMType('%s')`, machine.Protocol),\n\t\t\t\t`cmo.getNMType()`,\n\t\t\t},\n\t\t\tExpecteds: []string{\n\t\t\t\tfmt.Sprintf(\"'%s'\", machine.Protocol),\n\t\t\t},\n\t\t\tTimeout: root.Internal.Timeout,\n\t\t},\n\t\t{\n\t\t\tRequireds: []string{``},\n\t\t\tInputs: []string{\n\t\t\t\tfmt.Sprintf(`cd('/Servers/%s')`, server.Name),\n\t\t\t\t`pwd()`,\n\t\t\t},\n\t\t\tExpecteds: []string{\n\t\t\t\tfmt.Sprintf(`'edit:/Servers/%s'`, server.Name),\n\t\t\t},\n\t\t\tTimeout: root.Internal.Timeout,\n\t\t},\n\t\t{\n\t\t\tRequireds: []string{``},\n\t\t\tInputs: []string{\n\t\t\t\tfmt.Sprintf(`cmo.setMachine(getMBean('/Machines/%s'))`, machine.Name),\n\t\t\t\t`cmo.getMachine()`,\n\t\t\t},\n\t\t\tExpecteds: []string{\n\t\t\t\tfmt.Sprintf(`\\[MBeanServerInvocationHandler\\]com.bea:Name=%s,Type=%s`, machine.Name, machine.Type),\n\t\t\t},\n\t\t\tTimeout: root.Internal.Timeout,\n\t\t},\n\t}\n\tfor _, task := range tasks {\n\t\tif err := RunTask(task, \"Machine-Create\", e); err != nil {\n\t\t\tserver.ReturnStatus = ret.Failed\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (i *ImagesModel) CreateImage(\n\tmetaConstructor *images.SoftwareImageMetaConstructor,\n\timageReader io.Reader) (string, error) {\n\tif metaConstructor == nil {\n\t\treturn \"\", controller.ErrModelMissingInputMetadata\n\t}\n\tif imageReader == nil {\n\t\treturn \"\", controller.ErrModelMissingInputArtifact\n\t}\n\tartifactID, err := i.handleArtifact(metaConstructor, imageReader)\n\t// try to remove artifact file from file storage on error\n\tif err != nil {\n\t\tif cleanupErr := i.fileStorage.Delete(artifactID); cleanupErr != nil {\n\t\t\treturn \"\", errors.Wrap(err, cleanupErr.Error())\n\t\t}\n\t}\n\treturn artifactID, err\n}" ]
[ "0.7077332", "0.69597876", "0.62634194", "0.62383765", "0.58425856", "0.5813222", "0.58083135", "0.57980585", "0.5794766", "0.5777256", "0.57566607", "0.5753086", "0.57310593", "0.57159626", "0.57104063", "0.56898654", "0.5687492", "0.56817067", "0.567739", "0.567237", "0.56686884", "0.56567085", "0.563458", "0.5573807", "0.5567359", "0.5559394", "0.55229586", "0.55160487", "0.5463128", "0.54456246", "0.5372759", "0.53461707", "0.5340691", "0.53106505", "0.53027046", "0.5301254", "0.5261127", "0.52454805", "0.5234228", "0.5231918", "0.52261585", "0.52048624", "0.518304", "0.5181446", "0.5170515", "0.5158833", "0.51508594", "0.5132652", "0.51291114", "0.5119158", "0.5084349", "0.50694263", "0.50495934", "0.5044235", "0.5042479", "0.5021721", "0.50116795", "0.49991187", "0.49973583", "0.49911124", "0.49855667", "0.4981653", "0.49776742", "0.49672619", "0.4964701", "0.4961794", "0.49605322", "0.495997", "0.49586493", "0.4939544", "0.4936075", "0.49276572", "0.4919113", "0.49085617", "0.49008304", "0.48922378", "0.48897892", "0.48798987", "0.4871682", "0.4870193", "0.4869029", "0.48605353", "0.48516113", "0.48495537", "0.48456916", "0.48386046", "0.4837762", "0.48291585", "0.4827672", "0.4817701", "0.48164707", "0.4814804", "0.4802932", "0.47918648", "0.47894526", "0.47877693", "0.4781193", "0.47797316", "0.4773828", "0.47707987" ]
0.7464174
0
GetMachineImage uses the override method GetMachineImageFn or the real implementation.
func (c *TestClient) GetMachineImage(project, name string) (*compute.MachineImage, error) { if c.GetMachineImageFn != nil { return c.GetMachineImageFn(project, name) } return c.client.GetMachineImage(project, name) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *MachineImagesClient) GetMachineImage(getInput *GetMachineImageInput) (*MachineImage, error) {\n\tgetInput.Name = c.getQualifiedName(getInput.Name)\n\n\tvar machineImage MachineImage\n\tif err := c.getResource(getInput.Name, &machineImage); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c.success(&machineImage)\n}", "func getVMImage(scope *scope.MachineScope) (infrav1.Image, error) {\n\t// Use custom Marketplace image, Image ID or a Shared Image Gallery image if provided\n\tif scope.AzureMachine.Spec.Image != nil {\n\t\treturn *scope.AzureMachine.Spec.Image, nil\n\t}\n\treturn azure.GetDefaultUbuntuImage(to.String(scope.Machine.Spec.Version))\n}", "func (m *MachineScope) GetVMImage(ctx context.Context) (*infrav1.Image, error) {\n\tctx, log, done := tele.StartSpanWithLogger(ctx, \"scope.MachineScope.GetVMImage\")\n\tdefer done()\n\n\t// Use custom Marketplace image, Image ID or a Shared Image Gallery image if provided\n\tif m.AzureMachine.Spec.Image != nil {\n\t\treturn m.AzureMachine.Spec.Image, nil\n\t}\n\n\tsvc := virtualmachineimages.New(m)\n\n\tif m.AzureMachine.Spec.OSDisk.OSType == azure.WindowsOS {\n\t\truntime := m.AzureMachine.Annotations[\"runtime\"]\n\t\twindowsServerVersion := m.AzureMachine.Annotations[\"windowsServerVersion\"]\n\t\tlog.Info(\"No image specified for machine, using default Windows Image\", \"machine\", m.AzureMachine.GetName(), \"runtime\", runtime, \"windowsServerVersion\", windowsServerVersion)\n\t\treturn svc.GetDefaultWindowsImage(ctx, m.Location(), ptr.Deref(m.Machine.Spec.Version, \"\"), runtime, windowsServerVersion)\n\t}\n\n\tlog.Info(\"No image specified for machine, using default Linux Image\", \"machine\", m.AzureMachine.GetName())\n\treturn svc.GetDefaultUbuntuImage(ctx, m.Location(), ptr.Deref(m.Machine.Spec.Version, \"\"))\n}", "func (c *ComputeClient) MachineImages() *MachineImagesClient {\n\treturn &MachineImagesClient{\n\t\tResourceClient: ResourceClient{\n\t\t\tComputeClient: c,\n\t\t\tResourceDescription: \"MachineImage\",\n\t\t\tContainerPath: \"/machineimage/\",\n\t\t\tResourceRootPath: \"/machineimage\",\n\t\t}}\n}", "func GetMachine() (*Machine, error) {\n\t// dockerClient, err := client.NewClient(\"unix:///var/run/docker.sock\", \"1.13.1\", &http.Client{}, make(map[string]string))\n\tdockerClient, err := client.NewEnvClient()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error creating Docker API Client :\\n%s\", err)\n\t}\n\tnewMachine := &Machine{dockerClient}\n\n\treturn newMachine, nil\n}", "func FindMachineImage(machineImages []api.MachineImage, name, version string) (*api.MachineImage, error) {\n\tfor _, machineImage := range machineImages {\n\t\tif machineImage.Name == name && machineImage.Version == version {\n\t\t\treturn &machineImage, nil\n\t\t}\n\t}\n\treturn nil, fmt.Errorf(\"no machine image with name %q, version %q found\", name, version)\n}", "func (c *TestClient) CreateMachineImage(project string, mi *compute.MachineImage) error {\n\tif c.CreateMachineImageFn != nil {\n\t\treturn c.CreateMachineImageFn(project, mi)\n\t}\n\treturn c.client.CreateMachineImage(project, mi)\n}", "func (r Virtual_Guest) GetCpuMetricImage(snapshotRange *string, dateSpecified *datatypes.Time) (resp datatypes.Container_Bandwidth_GraphOutputs, err error) {\n\tparams := []interface{}{\n\t\tsnapshotRange,\n\t\tdateSpecified,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Virtual_Guest\", \"getCpuMetricImage\", params, &r.Options, &resp)\n\treturn\n}", "func GetImage(imageSpec *commonv1.AgentImageConfig, registry *string) string {\n\tif defaulting.IsImageNameContainsTag(imageSpec.Name) {\n\t\treturn imageSpec.Name\n\t}\n\n\timg := defaulting.NewImage(imageSpec.Name, imageSpec.Tag, imageSpec.JMXEnabled)\n\n\tif registry != nil && *registry != \"\" {\n\t\tdefaulting.WithRegistry(defaulting.ContainerRegistry(*registry))(img)\n\t}\n\n\treturn img.String()\n}", "func (c *TestClient) ListMachineImages(project string, opts ...ListCallOption) ([]*compute.MachineImage, error) {\n\tif c.ListMachineImagesFn != nil {\n\t\treturn c.ListMachineImagesFn(project, opts...)\n\t}\n\treturn c.client.ListMachineImages(project, opts...)\n}", "func getImage(windowsServerVersion windows.ServerVersion) string {\n\tswitch windowsServerVersion {\n\tcase windows.Server2019:\n\t\treturn \"projects/windows-cloud/global/images/family/windows-2019-core\"\n\tcase windows.Server2022:\n\tdefault:\n\t}\n\t// use the latest image from the `windows-2022-core` family in the `windows-cloud` project\n\treturn \"projects/windows-cloud/global/images/family/windows-2022-core\"\n}", "func (ms *MachinePlugin) CreateMachine(ctx context.Context, req *cmi.CreateMachineRequest) (*cmi.CreateMachineResponse, error) {\n\t// Log messages to track request\n\tglog.V(2).Infof(\"Machine creation request has been recieved for %q\", req.MachineName)\n\n\tproviderSpec, secrets, err := decodeProviderSpecAndSecret(req.ProviderSpec, req.Secrets, true)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsvc, err := ms.createSVC(secrets, providerSpec.Region)\n\tif err != nil {\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\n\tUserDataEnc := base64.StdEncoding.EncodeToString([]byte(secrets.UserData))\n\n\tvar imageIds []*string\n\timageID := aws.String(providerSpec.AMI)\n\timageIds = append(imageIds, imageID)\n\n\tdescribeImagesRequest := ec2.DescribeImagesInput{\n\t\tImageIds: imageIds,\n\t}\n\toutput, err := svc.DescribeImages(&describeImagesRequest)\n\tif err != nil {\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\n\tvar blkDeviceMappings []*ec2.BlockDeviceMapping\n\tdeviceName := output.Images[0].RootDeviceName\n\tvolumeSize := providerSpec.BlockDevices[0].Ebs.VolumeSize\n\tvolumeType := providerSpec.BlockDevices[0].Ebs.VolumeType\n\tblkDeviceMapping := ec2.BlockDeviceMapping{\n\t\tDeviceName: deviceName,\n\t\tEbs: &ec2.EbsBlockDevice{\n\t\t\tVolumeSize: &volumeSize,\n\t\t\tVolumeType: &volumeType,\n\t\t},\n\t}\n\tif volumeType == \"io1\" {\n\t\tblkDeviceMapping.Ebs.Iops = &providerSpec.BlockDevices[0].Ebs.Iops\n\t}\n\tblkDeviceMappings = append(blkDeviceMappings, &blkDeviceMapping)\n\n\t// Add tags to the created machine\n\ttagList := []*ec2.Tag{}\n\tfor idx, element := range providerSpec.Tags {\n\t\tif idx == \"Name\" {\n\t\t\t// Name tag cannot be set, as its used to identify backing machine object\n\t\t\tglog.Warning(\"Name tag cannot be set on AWS instance, as its used to identify backing machine object\")\n\t\t\tcontinue\n\t\t}\n\t\tnewTag := ec2.Tag{\n\t\t\tKey: aws.String(idx),\n\t\t\tValue: aws.String(element),\n\t\t}\n\t\ttagList = append(tagList, &newTag)\n\t}\n\tnameTag := ec2.Tag{\n\t\tKey: aws.String(\"Name\"),\n\t\tValue: aws.String(req.MachineName),\n\t}\n\ttagList = append(tagList, &nameTag)\n\n\ttagInstance := &ec2.TagSpecification{\n\t\tResourceType: aws.String(\"instance\"),\n\t\tTags: tagList,\n\t}\n\n\t// Specify the details of the machine that you want to create.\n\tinputConfig := ec2.RunInstancesInput{\n\t\t// An Amazon Linux AMI ID for t2.micro machines in the us-west-2 region\n\t\tImageId: aws.String(providerSpec.AMI),\n\t\tInstanceType: aws.String(providerSpec.MachineType),\n\t\tMinCount: aws.Int64(1),\n\t\tMaxCount: aws.Int64(1),\n\t\tUserData: &UserDataEnc,\n\t\tKeyName: aws.String(providerSpec.KeyName),\n\t\tSubnetId: aws.String(providerSpec.NetworkInterfaces[0].SubnetID),\n\t\tIamInstanceProfile: &ec2.IamInstanceProfileSpecification{\n\t\t\tName: &(providerSpec.IAM.Name),\n\t\t},\n\t\tSecurityGroupIds: []*string{aws.String(providerSpec.NetworkInterfaces[0].SecurityGroupIDs[0])},\n\t\tBlockDeviceMappings: blkDeviceMappings,\n\t\tTagSpecifications: []*ec2.TagSpecification{tagInstance},\n\t}\n\n\trunResult, err := svc.RunInstances(&inputConfig)\n\tif err != nil {\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\n\tresponse := &cmi.CreateMachineResponse{\n\t\tProviderID: encodeProviderID(providerSpec.Region, *runResult.Instances[0].InstanceId),\n\t\tNodeName: *runResult.Instances[0].PrivateDnsName,\n\t\tLastKnownState: []byte(\"Created\" + *runResult.Instances[0].InstanceId),\n\t}\n\n\tglog.V(2).Infof(\"VM with Provider-ID: %q created for Machine: %q\", response.ProviderID, req.MachineName)\n\treturn response, nil\n}", "func GetMachine(c *gin.Context) {\n\n\tsn := c.Param(\"sn\")\n\tdata, err := service.GetMachine(sn)\n\tif err != nil {\n\t\tapi.Error(c, http.StatusInternalServerError, \"server error\")\n\t\treturn\n\t}\n\tif data.SerialNumber == \"\" { //没找到\n\t\tapi.Fail(c, \"machine not found\")\n\t\treturn\n\t}\n\tapi.Success(c, data, \"\")\n}", "func (s *SpecGenerator) GetImage() (*libimage.Image, string) {\n\treturn s.image, s.resolvedImageName\n}", "func (az *AzureClient) GetVirtualMachineImage(ctx context.Context, location, publisherName, offer, skus, version string) (compute.VirtualMachineImage, error) {\n\timage, err := az.virtualMachineImagesClient.Get(ctx, location, publisherName, offer, skus, version)\n\tif err != nil {\n\t\treturn compute.VirtualMachineImage{}, fmt.Errorf(\"failed to get virtual machine image, %s\", err)\n\t}\n\tr := compute.VirtualMachineImage{}\n\tif err = DeepCopy(&r, image); err != nil {\n\t\treturn r, fmt.Errorf(\"failed to deep copy virtual machine image, %s\", err)\n\t}\n\treturn r, err\n}", "func (c *MachineImagesClient) CreateMachineImage(createInput *CreateMachineImageInput) (*MachineImage, error) {\n\tvar machineImage MachineImage\n\n\t// If `sizes` is not set then is mst be defaulted to {\"total\": 0}\n\tif createInput.Sizes == nil {\n\t\tcreateInput.Sizes = map[string]interface{}{\"total\": 0}\n\t}\n\n\t// `no_upload` must always be true\n\tcreateInput.NoUpload = true\n\n\tcreateInput.Name = c.getQualifiedName(createInput.Name)\n\tif err := c.createResource(createInput, &machineImage); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c.success(&machineImage)\n}", "func (i *Idb) GetMachine(fqdn string) (*machine.Machine, error) {\n\tfqdn = url.QueryEscape(fqdn)\n\tu := i.joinBaseURL(\"machines\")\n\n\tquery := url.Values{}\n\tquery.Add(\"fqdn\",fqdn)\n\tu.RawQuery = query.Encode()\n\n\trequest, err := http.NewRequest(\"GET\", u.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse, err := i.request(request)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar newMachine machine.Machine\n\tnewMachine.Fqdn = fqdn\n\n\tif response.StatusCode != http.StatusOK {\n\t\treturn nil, newErrStatus(response.StatusCode, http.StatusOK, &newMachine)\n\t}\n\n\terr = i.decodeResponse(&newMachine, response)\n\n\treturn &newMachine, err\n}", "func GetImage(runtime connector.ModuleRuntime, kubeConf *common.KubeConf, name string) Image {\n\tvar image Image\n\tpauseTag, corednsTag := \"3.2\", \"1.6.9\"\n\n\tif versionutil.MustParseSemantic(kubeConf.Cluster.Kubernetes.Version).LessThan(versionutil.MustParseSemantic(\"v1.21.0\")) {\n\t\tpauseTag = \"3.2\"\n\t\tcorednsTag = \"1.6.9\"\n\t}\n\tif versionutil.MustParseSemantic(kubeConf.Cluster.Kubernetes.Version).AtLeast(versionutil.MustParseSemantic(\"v1.21.0\")) ||\n\t\t(kubeConf.Cluster.Kubernetes.ContainerManager != \"\" && kubeConf.Cluster.Kubernetes.ContainerManager != \"docker\") {\n\t\tpauseTag = \"3.4.1\"\n\t\tcorednsTag = \"1.8.0\"\n\t}\n\tif versionutil.MustParseSemantic(kubeConf.Cluster.Kubernetes.Version).AtLeast(versionutil.MustParseSemantic(\"v1.22.0\")) {\n\t\tpauseTag = \"3.5\"\n\t\tcorednsTag = \"1.8.0\"\n\t}\n\tif versionutil.MustParseSemantic(kubeConf.Cluster.Kubernetes.Version).AtLeast(versionutil.MustParseSemantic(\"v1.23.0\")) {\n\t\tpauseTag = \"3.6\"\n\t\tcorednsTag = \"1.8.6\"\n\t}\n\tif versionutil.MustParseSemantic(kubeConf.Cluster.Kubernetes.Version).AtLeast(versionutil.MustParseSemantic(\"v1.24.0\")) {\n\t\tpauseTag = \"3.7\"\n\t\tcorednsTag = \"1.8.6\"\n\t}\n\tif versionutil.MustParseSemantic(kubeConf.Cluster.Kubernetes.Version).AtLeast(versionutil.MustParseSemantic(\"v1.25.0\")) {\n\t\tpauseTag = \"3.8\"\n\t\tcorednsTag = \"1.9.3\"\n\t}\n\n\tlogger.Log.Debugf(\"pauseTag: %s, corednsTag: %s\", pauseTag, corednsTag)\n\n\tImageList := map[string]Image{\n\t\t\"pause\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: kubekeyv1alpha2.DefaultKubeImageNamespace, Repo: \"pause\", Tag: pauseTag, Group: kubekeyv1alpha2.K8s, Enable: true},\n\t\t\"etcd\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: kubekeyv1alpha2.DefaultKubeImageNamespace, Repo: \"etcd\", Tag: kubekeyv1alpha2.DefaultEtcdVersion, Group: kubekeyv1alpha2.Master, Enable: strings.EqualFold(kubeConf.Cluster.Etcd.Type, kubekeyv1alpha2.Kubeadm)},\n\t\t\"kube-apiserver\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: kubekeyv1alpha2.DefaultKubeImageNamespace, Repo: \"kube-apiserver\", Tag: kubeConf.Cluster.Kubernetes.Version, Group: kubekeyv1alpha2.Master, Enable: true},\n\t\t\"kube-controller-manager\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: kubekeyv1alpha2.DefaultKubeImageNamespace, Repo: \"kube-controller-manager\", Tag: kubeConf.Cluster.Kubernetes.Version, Group: kubekeyv1alpha2.Master, Enable: true},\n\t\t\"kube-scheduler\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: kubekeyv1alpha2.DefaultKubeImageNamespace, Repo: \"kube-scheduler\", Tag: kubeConf.Cluster.Kubernetes.Version, Group: kubekeyv1alpha2.Master, Enable: true},\n\t\t\"kube-proxy\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: kubekeyv1alpha2.DefaultKubeImageNamespace, Repo: \"kube-proxy\", Tag: kubeConf.Cluster.Kubernetes.Version, Group: kubekeyv1alpha2.K8s, Enable: !kubeConf.Cluster.Kubernetes.DisableKubeProxy},\n\n\t\t// network\n\t\t\"coredns\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: \"coredns\", Repo: \"coredns\", Tag: corednsTag, Group: kubekeyv1alpha2.K8s, Enable: true},\n\t\t\"k8s-dns-node-cache\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: kubekeyv1alpha2.DefaultKubeImageNamespace, Repo: \"k8s-dns-node-cache\", Tag: \"1.15.12\", Group: kubekeyv1alpha2.K8s, Enable: kubeConf.Cluster.Kubernetes.EnableNodelocaldns()},\n\t\t\"calico-kube-controllers\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: \"calico\", Repo: \"kube-controllers\", Tag: kubekeyv1alpha2.DefaultCalicoVersion, Group: kubekeyv1alpha2.K8s, Enable: strings.EqualFold(kubeConf.Cluster.Network.Plugin, \"calico\")},\n\t\t\"calico-cni\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: \"calico\", Repo: \"cni\", Tag: kubekeyv1alpha2.DefaultCalicoVersion, Group: kubekeyv1alpha2.K8s, Enable: strings.EqualFold(kubeConf.Cluster.Network.Plugin, \"calico\")},\n\t\t\"calico-node\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: \"calico\", Repo: \"node\", Tag: kubekeyv1alpha2.DefaultCalicoVersion, Group: kubekeyv1alpha2.K8s, Enable: strings.EqualFold(kubeConf.Cluster.Network.Plugin, \"calico\")},\n\t\t\"calico-flexvol\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: \"calico\", Repo: \"pod2daemon-flexvol\", Tag: kubekeyv1alpha2.DefaultCalicoVersion, Group: kubekeyv1alpha2.K8s, Enable: strings.EqualFold(kubeConf.Cluster.Network.Plugin, \"calico\")},\n\t\t\"calico-typha\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: \"calico\", Repo: \"typha\", Tag: kubekeyv1alpha2.DefaultCalicoVersion, Group: kubekeyv1alpha2.K8s, Enable: strings.EqualFold(kubeConf.Cluster.Network.Plugin, \"calico\") && len(runtime.GetHostsByRole(common.K8s)) > 50},\n\t\t\"flannel\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: \"flannel\", Repo: \"flannel\", Tag: kubekeyv1alpha2.DefaultFlannelVersion, Group: kubekeyv1alpha2.K8s, Enable: strings.EqualFold(kubeConf.Cluster.Network.Plugin, \"flannel\")},\n\t\t\"flannel-cni-plugin\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: \"flannel\", Repo: \"flannel-cni-plugin\", Tag: kubekeyv1alpha2.DefaultFlannelCniPluginVersion, Group: kubekeyv1alpha2.K8s, Enable: strings.EqualFold(kubeConf.Cluster.Network.Plugin, \"flannel\")},\n\t\t\"cilium\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: \"cilium\", Repo: \"cilium\", Tag: kubekeyv1alpha2.DefaultCiliumVersion, Group: kubekeyv1alpha2.K8s, Enable: strings.EqualFold(kubeConf.Cluster.Network.Plugin, \"cilium\")},\n\t\t\"cilium-operator-generic\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: \"cilium\", Repo: \"operator-generic\", Tag: kubekeyv1alpha2.DefaultCiliumVersion, Group: kubekeyv1alpha2.K8s, Enable: strings.EqualFold(kubeConf.Cluster.Network.Plugin, \"cilium\")},\n\t\t\"kubeovn\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: \"kubeovn\", Repo: \"kube-ovn\", Tag: kubekeyv1alpha2.DefaultKubeovnVersion, Group: kubekeyv1alpha2.K8s, Enable: strings.EqualFold(kubeConf.Cluster.Network.Plugin, \"kubeovn\")},\n\t\t\"multus\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: kubekeyv1alpha2.DefaultKubeImageNamespace, Repo: \"multus-cni\", Tag: kubekeyv1alpha2.DefalutMultusVersion, Group: kubekeyv1alpha2.K8s, Enable: strings.Contains(kubeConf.Cluster.Network.Plugin, \"multus\")},\n\t\t// storage\n\t\t\"provisioner-localpv\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: \"openebs\", Repo: \"provisioner-localpv\", Tag: \"3.3.0\", Group: kubekeyv1alpha2.Worker, Enable: false},\n\t\t\"linux-utils\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: \"openebs\", Repo: \"linux-utils\", Tag: \"3.3.0\", Group: kubekeyv1alpha2.Worker, Enable: false},\n\t\t// load balancer\n\t\t\"haproxy\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: \"library\", Repo: \"haproxy\", Tag: \"2.3\", Group: kubekeyv1alpha2.Worker, Enable: kubeConf.Cluster.ControlPlaneEndpoint.IsInternalLBEnabled()},\n\t\t\"kubevip\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: \"plndr\", Repo: \"kube-vip\", Tag: \"v0.5.0\", Group: kubekeyv1alpha2.Master, Enable: kubeConf.Cluster.ControlPlaneEndpoint.IsInternalLBEnabledVip()},\n\t\t// kata-deploy\n\t\t\"kata-deploy\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: kubekeyv1alpha2.DefaultKubeImageNamespace, Repo: \"kata-deploy\", Tag: \"stable\", Group: kubekeyv1alpha2.Worker, Enable: kubeConf.Cluster.Kubernetes.EnableKataDeploy()},\n\t\t// node-feature-discovery\n\t\t\"node-feature-discovery\": {RepoAddr: kubeConf.Cluster.Registry.PrivateRegistry, Namespace: kubekeyv1alpha2.DefaultKubeImageNamespace, Repo: \"node-feature-discovery\", Tag: \"v0.10.0\", Group: kubekeyv1alpha2.K8s, Enable: kubeConf.Cluster.Kubernetes.EnableNodeFeatureDiscovery()},\n\t}\n\n\timage = ImageList[name]\n\tif kubeConf.Cluster.Registry.NamespaceOverride != \"\" {\n\t\timage.NamespaceOverride = kubeConf.Cluster.Registry.NamespaceOverride\n\t}\n\treturn image\n}", "func (b *ecrBase) getImage(ctx context.Context) (*ecr.Image, error) {\n\treturn b.runGetImage(ctx, ecr.BatchGetImageInput{\n\t\tImageIds: []*ecr.ImageIdentifier{b.ecrSpec.ImageID()},\n\t\tAcceptedMediaTypes: aws.StringSlice(supportedImageMediaTypes),\n\t})\n}", "func (r Virtual_Guest) GetMemoryMetricImage(snapshotRange *string, dateSpecified *datatypes.Time) (resp datatypes.Container_Bandwidth_GraphOutputs, err error) {\n\tparams := []interface{}{\n\t\tsnapshotRange,\n\t\tdateSpecified,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Virtual_Guest\", \"getMemoryMetricImage\", params, &r.Options, &resp)\n\treturn\n}", "func (c *Conn) GetMachine(name string) (dbus.ObjectPath, error) {\n\treturn c.getPath(\"GetMachine\", name)\n}", "func (dm *DockerMachine) Machine(name string) (Machine, error) {\n\tmachines, err := dm.Machines()\n\tif err != nil {\n\t\treturn Machine{}, err\n\t}\n\tfor _, machine := range machines {\n\t\tif machine.Name == name {\n\t\t\treturn machine, nil\n\t\t}\n\t}\n\treturn Machine{}, fmt.Errorf(\"machine %s not found\", name)\n}", "func (wmid *WzMachineIDUtil) GetMachineId() string {\n\treturn _MachineIDUtil.machineid\n}", "func (d *Driver) GetMachineName() string {\n\treturn d.MachineName\n}", "func (this *Task) image(zkc zk.ZK) (string, string, string, error) {\n\tif this.ImagePath == \"\" {\n\n\t\tdefaultReleaseWatchPath, _, err := RegistryKeyValue(KReleaseWatch, map[string]interface{}{\n\t\t\t\"Domain\": this.domain,\n\t\t\t\"Service\": this.service,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn \"\", \"\", \"\", err\n\t\t}\n\n\t\treleaseNode, err := zkc.Get(defaultReleaseWatchPath)\n\t\tif err != nil {\n\t\t\treturn \"\", \"\", \"\", err\n\t\t}\n\n\t\tthis.ImagePath = releaseNode.GetValueString()\n\t\tglog.Infoln(\"ImagePath defaults to\", this.ImagePath, \"for job\", *this)\n\t}\n\n\tglog.Infoln(\"Container image from image path\", this.ImagePath)\n\tdocker_info, err := zkc.Get(this.ImagePath)\n\tif err != nil {\n\t\treturn \"\", \"\", \"\", err\n\t}\n\timage := docker_info.GetValueString()\n\tversion := image[strings.LastIndex(image, \":\")+1:]\n\treturn fmt.Sprintf(\"/%s/%s/%s\", this.domain, this.service, version), version, image, nil\n}", "func (o SysbenchSpecOutput) Image() SysbenchSpecImageOutput {\n\treturn o.ApplyT(func(v SysbenchSpec) SysbenchSpecImage { return v.Image }).(SysbenchSpecImageOutput)\n}", "func (c *TestClient) GetImage(project, name string) (*compute.Image, error) {\n\tif c.GetImageFn != nil {\n\t\treturn c.GetImageFn(project, name)\n\t}\n\treturn c.client.GetImage(project, name)\n}", "func (h *Handler) GetMachineWithTags(c echo.Context) (err error) {\n\treturn nil\n}", "func GetVirtualDiskImageService(sess *session.Session) Virtual_Disk_Image {\n\treturn Virtual_Disk_Image{Session: sess}\n}", "func determineImageID(shoot *gardencorev1beta1.Shoot, providerConfig *awsv1alpha1.CloudProfileConfig) (string, error) {\n\tfor _, image := range providerConfig.MachineImages {\n\t\tfor _, version := range image.Versions {\n\t\t\tfor _, region := range version.Regions {\n\t\t\t\tif region.Name == shoot.Spec.Region {\n\t\t\t\t\treturn region.AMI, nil\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn \"\", fmt.Errorf(\"found no suitable AMI for machines in region %q\", shoot.Spec.Region)\n}", "func GetImg(fileName string) (*image.Image, error) {\n localFile := fmt.Sprintf(\"/data/edgebox/local/%s\", fileName)\n existingImageFile, err := os.Open(localFile)\n if err == nil {\n defer existingImageFile.Close()\n imageData, _, err := image.Decode(existingImageFile)\n if err != nil {\n return nil, err\n }\n return &imageData, nil\n }\n\n remoteFile := fmt.Sprintf(\"/data/edgebox/remote/%s\", fileName)\n existingImageFile, err = os.Open(remoteFile)\n if err == nil {\n defer existingImageFile.Close()\n imageData, _, err := image.Decode(existingImageFile)\n if err != nil {\n return nil, err\n }\n return &imageData, nil\n }\n return nil, err\n}", "func (c baseClient) getEngineImage(engine containerd.Container) (string, error) {\n\tctx := namespaces.WithNamespace(context.Background(), engineNamespace)\n\timage, err := engine.Image(ctx)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn image.Name(), nil\n}", "func (o BuildSpecRuntimeBaseOutput) Image() pulumi.StringOutput {\n\treturn o.ApplyT(func(v BuildSpecRuntimeBase) string { return v.Image }).(pulumi.StringOutput)\n}", "func GetMachineExtension(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *MachineExtensionState, opts ...pulumi.ResourceOption) (*MachineExtension, error) {\n\tvar resource MachineExtension\n\terr := ctx.ReadResource(\"azure-native:hybridcompute:MachineExtension\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (s *API) GetImage(req *GetImageRequest, opts ...scw.RequestOption) (*Image, 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 fmt.Sprint(req.Region) == \"\" {\n\t\treturn nil, errors.New(\"field Region cannot be empty in request\")\n\t}\n\n\tif fmt.Sprint(req.ImageID) == \"\" {\n\t\treturn nil, errors.New(\"field ImageID cannot be empty in request\")\n\t}\n\n\tscwReq := &scw.ScalewayRequest{\n\t\tMethod: \"GET\",\n\t\tPath: \"/registry/v1/regions/\" + fmt.Sprint(req.Region) + \"/images/\" + fmt.Sprint(req.ImageID) + \"\",\n\t\tHeaders: http.Header{},\n\t}\n\n\tvar resp Image\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 GetMachineForName(envContainer app.EnvContainer, name string) (_ Machine, retErr error) {\n\tfilePath, err := GetFilePath(envContainer)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn GetMachineForNameAndFilePath(name, filePath)\n}", "func (d *Data) GetImage(v dvid.VersionID, vox *Labels, supervoxels bool, scale uint8, roiname dvid.InstanceName) (*dvid.Image, error) {\n\tr, err := imageblk.GetROI(v, roiname, vox)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err := d.GetLabels(v, supervoxels, scale, vox, r); err != nil {\n\t\treturn nil, err\n\t}\n\treturn vox.GetImage2d()\n}", "func (reg *registry) GetImage(img Repository, tag string) (_ flux.Image, err error) {\n\trem, err := reg.newRemote(img)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn rem.Manifest(img, tag)\n}", "func Machine(id ID) []byte {\n\treturn dgen.Machine(id)\n}", "func (o BuildSpecRuntimeBasePtrOutput) Image() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *BuildSpecRuntimeBase) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Image\n\t}).(pulumi.StringPtrOutput)\n}", "func (d *Descriptor) Image() (v1.Image, error) {\n\tswitch d.MediaType {\n\tcase types.DockerManifestSchema1, types.DockerManifestSchema1Signed:\n\t\t// We don't care to support schema 1 images:\n\t\t// https://github.com/google/go-containerregistry/issues/377\n\t\treturn nil, newErrSchema1(d.MediaType)\n\tcase types.OCIImageIndex, types.DockerManifestList:\n\t\t// We want an image but the registry has an index, resolve it to an image.\n\t\treturn d.remoteIndex().imageByPlatform(d.platform)\n\tcase types.OCIManifestSchema1, types.DockerManifestSchema2:\n\t\t// These are expected. Enumerated here to allow a default case.\n\tdefault:\n\t\t// We could just return an error here, but some registries (e.g. static\n\t\t// registries) don't set the Content-Type headers correctly, so instead...\n\t\tlogs.Warn.Printf(\"Unexpected media type for Image(): %s\", d.MediaType)\n\t}\n\n\t// Wrap the v1.Layers returned by this v1.Image in a hint for downstream\n\t// remote.Write calls to facilitate cross-repo \"mounting\".\n\timgCore, err := partial.CompressedToImage(d.remoteImage())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &mountableImage{\n\t\tImage: imgCore,\n\t\tReference: d.ref,\n\t}, nil\n}", "func (r Virtual_Guest) GetMemoryMetricImageByDate(startDateTime *datatypes.Time, endDateTime *datatypes.Time) (resp datatypes.Container_Bandwidth_GraphOutputs, err error) {\n\tparams := []interface{}{\n\t\tstartDateTime,\n\t\tendDateTime,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Virtual_Guest\", \"getMemoryMetricImageByDate\", params, &r.Options, &resp)\n\treturn\n}", "func (o FioSpecVolumeVolumeSourceRbdOutput) Image() pulumi.StringOutput {\n\treturn o.ApplyT(func(v FioSpecVolumeVolumeSourceRbd) string { return v.Image }).(pulumi.StringOutput)\n}", "func FindImageFromCloudProfile(cloudProfileConfig *api.CloudProfileConfig, imageName, imageVersion, regionName string) (*api.MachineImage, error) {\n\tif cloudProfileConfig != nil {\n\t\tfor _, machineImage := range cloudProfileConfig.MachineImages {\n\t\t\tif machineImage.Name != imageName {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor _, version := range machineImage.Versions {\n\t\t\t\tif imageVersion != version.Version {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tfor _, region := range version.Regions {\n\t\t\t\t\tif regionName == region.Name {\n\t\t\t\t\t\treturn &api.MachineImage{\n\t\t\t\t\t\t\tName: imageName,\n\t\t\t\t\t\t\tVersion: imageVersion,\n\t\t\t\t\t\t\tID: region.ID,\n\t\t\t\t\t\t}, nil\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif version.Image != \"\" {\n\t\t\t\t\treturn &api.MachineImage{\n\t\t\t\t\t\tName: imageName,\n\t\t\t\t\t\tVersion: imageVersion,\n\t\t\t\t\t\tImage: version.Image,\n\t\t\t\t\t}, nil\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil, fmt.Errorf(\"could not find an image for name %q in version %q for region %q\", imageName, imageVersion, regionName)\n}", "func NewMachine(opts machine.InitOptions) (machine.VM, error) {\n\tvmConfigDir, err := machine.GetConfDir(vmtype)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvm := new(MachineVM)\n\tif len(opts.Name) > 0 {\n\t\tvm.Name = opts.Name\n\t}\n\tignitionFile := filepath.Join(vmConfigDir, vm.Name+\".ign\")\n\tvm.IgnitionFilePath = ignitionFile\n\n\t// An image was specified\n\tif len(opts.ImagePath) > 0 {\n\t\tvm.ImagePath = opts.ImagePath\n\t}\n\n\t// Assign remote user name. if not provided, use default\n\tvm.RemoteUsername = opts.Username\n\tif len(vm.RemoteUsername) < 1 {\n\t\tvm.RemoteUsername = defaultRemoteUser\n\t}\n\n\t// Add a random port for ssh\n\tport, err := utils.GetRandomPort()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvm.Port = port\n\n\tvm.CPUs = opts.CPUS\n\tvm.Memory = opts.Memory\n\n\t// Look up the executable\n\texecPath, err := exec.LookPath(QemuCommand)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcmd := append([]string{execPath})\n\t// Add memory\n\tcmd = append(cmd, []string{\"-m\", strconv.Itoa(int(vm.Memory))}...)\n\t// Add cpus\n\tcmd = append(cmd, []string{\"-smp\", strconv.Itoa(int(vm.CPUs))}...)\n\t// Add ignition file\n\tcmd = append(cmd, []string{\"-fw_cfg\", \"name=opt/com.coreos/config,file=\" + vm.IgnitionFilePath}...)\n\t// Add qmp socket\n\tmonitor, err := NewQMPMonitor(\"unix\", vm.Name, defaultQMPTimeout)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvm.QMPMonitor = monitor\n\tcmd = append(cmd, []string{\"-qmp\", monitor.Network + \":/\" + monitor.Address + \",server=on,wait=off\"}...)\n\n\t// Add network\n\t// Right now the mac address is hardcoded so that the host networking gives it a specific IP address. This is\n\t// why we can only run one vm at a time right now\n\tcmd = append(cmd, []string{\"-netdev\", \"socket,id=vlan,fd=3\", \"-device\", \"virtio-net-pci,netdev=vlan,mac=5a:94:ef:e4:0c:ee\"}...)\n\tsocketPath, err := getRuntimeDir()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvirtualSocketPath := filepath.Join(socketPath, \"podman\", vm.Name+\"_ready.sock\")\n\t// Add serial port for readiness\n\tcmd = append(cmd, []string{\n\t\t\"-device\", \"virtio-serial\",\n\t\t\"-chardev\", \"socket,path=\" + virtualSocketPath + \",server=on,wait=off,id=\" + vm.Name + \"_ready\",\n\t\t\"-device\", \"virtserialport,chardev=\" + vm.Name + \"_ready\" + \",name=org.fedoraproject.port.0\"}...)\n\tvm.CmdLine = cmd\n\treturn vm, nil\n}", "func GetMachineID() (m MachineID, err error) {\n\t// First grab all the interfaces\n\tifaces, err := net.Interfaces()\n\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif len(ifaces) == 0 {\n\t\terr = fmt.Errorf(\"No network interfaces found!\")\n\t\treturn\n\t}\n\n\t// Build up list of all mac addresses\n\tmacs := make([]string, 0, len(ifaces))\n\n\tfor _, iface := range ifaces {\n\t\tstr := iface.HardwareAddr.String()\n\t\tif len(str) > 0 {\n\t\t\tmacs = append(macs, str)\n\t\t}\n\t}\n\n\t// Sort then and pick the first one\n\tsort.Strings(macs)\n\n\tm = MachineID(macs[0])\n\n\treturn\n}", "func (t *ThirdPartyServiceParse) GetImage() Image {\n\treturn Image{}\n}", "func (factory *Factory) GetOperatorImage() string {\n\treturn prependRegistry(factory.options.registry, factory.options.operatorImage)\n}", "func (status UnitStatus) MachineIP() string {\n\treturn GetMachineIP(status.Machine)\n}", "func GetRuntimeImage() (image string) {\n\tif GetRuntimeType() == jindofsxEngine {\n\t\timage = defaultJindofsxRuntimeImage\n\t} else if GetRuntimeType() == jindoEngine {\n\t\timage = defaultJindofsRuntimeImage\n\t} else if GetRuntimeType() == jindocacheEngine {\n\t\timage = defaultJindoCacheRuntimeImage\n\t}\n\treturn\n}", "func (o ClusterBuildStrategySpecBuildStepsOutput) Image() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ClusterBuildStrategySpecBuildSteps) *string { return v.Image }).(pulumi.StringPtrOutput)\n}", "func getMachineAnnotationKey() string {\n\tkey := fmt.Sprintf(\"%s/machine\", getCAPIGroup())\n\treturn key\n}", "func LookupImage(ctx *pulumi.Context, args *LookupImageArgs, opts ...pulumi.InvokeOption) (*LookupImageResult, error) {\n\topts = internal.PkgInvokeDefaultOpts(opts)\n\tvar rv LookupImageResult\n\terr := ctx.Invoke(\"google-native:compute/alpha:getImage\", args, &rv, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &rv, nil\n}", "func (o BuildStrategySpecBuildStepsOutput) Image() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v BuildStrategySpecBuildSteps) *string { return v.Image }).(pulumi.StringPtrOutput)\n}", "func getBaseImage(slm *sunlightmap, variant string, filename string) (retimg image.Image) {\n\tcolor := dayFallbackColor\n\tif variant == \"night\" {\n\t\tcolor = nightFallbackColor\n\t}\n\tmyFile, err := os.Open(filename)\n\tif err != nil {\n\t\t//panic(err)\n\t\tretimg = makeEmptyColoredImage(slm.Width, slm.Height, color)\n\t} else {\n\t\tdefer myFile.Close()\n\t\tretimg, _, err = image.Decode(myFile)\n\t\tif err != nil {\n\t\t\tretimg = makeEmptyColoredImage(slm.Width, slm.Height, color)\n\t\t}\n\t}\n\treturn\n}", "func (o IopingSpecVolumeVolumeSourceRbdOutput) Image() pulumi.StringOutput {\n\treturn o.ApplyT(func(v IopingSpecVolumeVolumeSourceRbd) string { return v.Image }).(pulumi.StringOutput)\n}", "func GetImage(hub *registry.Registry, repo string, tag string) (*Image, error) {\n\t// Default maniftest will be a v2\n\tdigest, err := hub.ManifestDigestV2(repo, tag)\n\tif err != nil {\n\t\tlog.Debug(fmt.Sprintf(\"Error getting v2 content digest: %s\", err))\n\t\t// Attempt to obtain v1 if v2 is unavailable\n\t\tdigest, err = hub.ManifestDigest(repo, tag)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Unable to obtain either v1 or v2 digest: %s\", err)\n\t\t}\n\t}\n\n\t// Both V1 and V2 manifests contain useful data we want to store\n\tvar layers []string\n\tvar manifestV2Map map[string]interface{}\n\tmanifest, err := hub.ManifestV2(repo, tag)\n\tif err != nil {\n\t\tlog.Debug(fmt.Sprintf(\"Error getting v2 manifest: %s for Image %s/%s:%s\", err, hub.URL, repo, tag))\n\t} else {\n\t\tmanifestV2Map = structs.Map(manifest.Manifest)\n\n\t\t// Will use v2 manifest to build layers if its availble.\n\t\t// V1 and V2 layer order is reversed.\n\t\tfor i := len(manifest.Layers) - 1; i >= 0; i-- {\n\t\t\tif string(manifest.Layers[i].Digest) != emptyLayer {\n\t\t\t\tlayers = append(layers, string(manifest.Layers[i].Digest))\n\t\t\t}\n\t\t}\n\t}\n\n\tvar manifestV1Map map[string]interface{}\n\tmanifestV1, err := hub.Manifest(repo, tag)\n\tif err != nil {\n\t\tlog.Debug(fmt.Sprintf(\"Error getting v1 manifest: %s for Image %s/%s:%s\", err, hub.URL, repo, tag))\n\t} else {\n\t\tmanifestV1Map = structs.Map(manifestV1.Manifest)\n\n\t\t// If layers from V1 aren't available attempt to use the V1.\n\t\t// V1 and V2 layer order is reversed.\n\t\tif len(layers) == 0 {\n\t\t\tfor i := 0; i <= len(manifestV1.FSLayers)-1; i++ {\n\t\t\t\tif string(manifestV1.FSLayers[i].BlobSum) != emptyLayer {\n\t\t\t\t\tlayers = append(layers, string(manifestV1.FSLayers[i].BlobSum))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif err != nil && manifest == nil && manifestV1 == nil {\n\t\treturn nil, fmt.Errorf(\"Docker V1 or V2 could be obtained: %s\", err)\n\t}\n\n\tif len(layers) == 0 {\n\t\treturn nil, fmt.Errorf(\"Image manifest contaied no layers: %s/%s:%s\", hub.URL, repo, tag)\n\t}\n\n\timage := &Image{\n\t\tRegistry: hub.URL,\n\t\tRepo: repo,\n\t\tTag: tag,\n\t\tDigest: string(digest),\n\t\tManifestV1: manifestV1Map,\n\t\tManifestV2: manifestV2Map,\n\t\tLayers: layers,\n\t}\n\treturn image, nil\n}", "func (o StorageClusterSpecUserInterfaceOutput) Image() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v StorageClusterSpecUserInterface) *string { return v.Image }).(pulumi.StringPtrOutput)\n}", "func (f *Client) GetMachineConfiguration(opts ...GetMachineConfigurationOpt) (*ops.GetMachineConfigurationOK, error) {\n\tp := ops.NewGetMachineConfigurationParams()\n\tp.SetTimeout(time.Duration(f.firecrackerRequestTimeout) * time.Millisecond)\n\tfor _, opt := range opts {\n\t\topt(p)\n\t}\n\n\treturn f.client.Operations.GetMachineConfiguration(p)\n}", "func (i *imageHandler) resolveImage() (string, error) {\n\tif i.client.IsOpenshift() {\n\t\tis := &imgv1.ImageStream{ObjectMeta: v1.ObjectMeta{Name: i.imageStream.Name, Namespace: i.imageStream.Namespace}}\n\t\tif exists, err := kubernetes.ResourceC(i.client).Fetch(is); err != nil {\n\t\t\treturn \"\", err\n\t\t} else if !exists {\n\t\t\treturn \"\", nil\n\t\t}\n\t\t// the image is on an ImageStreamTag object\n\t\tfor _, tag := range is.Spec.Tags {\n\t\t\tif tag.From != nil && tag.From.Name == i.resolveRegistryImage() {\n\t\t\t\tist, err := openshift.ImageStreamC(i.client).FetchTag(\n\t\t\t\t\ttypes.NamespacedName{\n\t\t\t\t\t\tName: i.defaultImageName,\n\t\t\t\t\t\tNamespace: i.imageStream.Namespace,\n\t\t\t\t\t}, i.resolveTag())\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn \"\", err\n\t\t\t\t} else if ist == nil {\n\t\t\t\t\treturn \"\", nil\n\t\t\t\t}\n\t\t\t\treturn ist.Image.DockerImageReference, nil\n\t\t\t}\n\t\t}\n\t\treturn \"\", nil\n\t}\n\n\treturn i.resolveRegistryImage(), nil\n}", "func (o SysbenchSpecPtrOutput) Image() SysbenchSpecImagePtrOutput {\n\treturn o.ApplyT(func(v *SysbenchSpec) *SysbenchSpecImage {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Image\n\t}).(SysbenchSpecImagePtrOutput)\n}", "func (p *Planner) getInstallerImage(controlPlane *rkev1.RKEControlPlane) string {\n\truntime := capr.GetRuntime(controlPlane.Spec.KubernetesVersion)\n\tinstallerImage := p.retrievalFunctions.SystemAgentImage() + runtime + \":\" + strings.ReplaceAll(controlPlane.Spec.KubernetesVersion, \"+\", \"-\")\n\treturn p.retrievalFunctions.ImageResolver(installerImage, controlPlane)\n}", "func (o EnvironmentVmImageOutput) ImageFamily() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v EnvironmentVmImage) *string { return v.ImageFamily }).(pulumi.StringPtrOutput)\n}", "func (o InstanceOutput) VmImage() VmImageResponseOutput {\n\treturn o.ApplyT(func(v *Instance) VmImageResponseOutput { return v.VmImage }).(VmImageResponseOutput)\n}", "func getMachineGUID() (string, error) {\n\tconst key = registry.LOCAL_MACHINE\n\tconst path = `SOFTWARE\\Microsoft\\Cryptography`\n\tconst name = \"MachineGuid\"\n\n\tk, err := registry.OpenKey(key, path, registry.READ|registry.WOW64_64KEY)\n\tif err != nil {\n\t\treturn \"\", errors.Wrapf(err, `failed to open HKLM\\%v`, path)\n\t}\n\n\tguid, _, err := k.GetStringValue(name)\n\tif err != nil {\n\t\treturn \"\", errors.Wrapf(err, `failed to get value of HKLM\\%v\\%v`, path, name)\n\t}\n\n\treturn guid, nil\n}", "func (mConfig *MonitoringConfig) GetImage() string {\n\tif mConfig.JmxImage != \"\" {\n\t\treturn mConfig.JmxImage\n\t}\n\treturn \"banzaicloud/jmx-javaagent:0.12.0\"\n}", "func (mConfig *MonitoringConfig) GetImage() string {\n\tif mConfig.JmxImage != \"\" {\n\t\treturn mConfig.JmxImage\n\t}\n\treturn \"banzaicloud/jmx-javaagent:0.12.0\"\n}", "func (u *Uname) Machine() string {\n\treturn charsToString(u.ub.Machine[:])\n}", "func NewMachine(node node.Inf, resource resource.Inf, logger *log.Logger) Inf {\n\treturn &machine{node: node, resource: resource, logger: logger}\n}", "func getImageFromFileSystem(imageFile string) (image.Image, error) {\n\tvar imageData image.Image\n\tfileData, err := getFileDataFromFileSystem(imageFile)\n\tif err != nil {\n\t\terr = errors.New(fmt.Sprintf(\"Could not get image data from '%s': %s\", imageFile, err.Error()))\n\t\treturn nil, err\n\t}\n\tif strings.HasSuffix(strings.ToLower(imageFile), \".jpg\") || strings.HasSuffix(strings.ToLower(imageFile), \".jpeg\"){\n\t\timageData, err = jpeg.Decode(bytes.NewReader(fileData))\n\t}\n\tif strings.HasSuffix(strings.ToLower(imageFile), \".png\") {\n\t\timageData, err = png.Decode(bytes.NewReader(fileData))\n\t}\n\tif err != nil {\n\t\terr = errors.New(fmt.Sprintf(\"Could not decode the image '%s': %s\", imageFile, err.Error()))\n\t\treturn nil, err\n\t}\n\treturn imageData, err\n}", "func GetE2EImage(image ImageID) string {\n\treturn fmt.Sprintf(\"%s/%s:%s\", imageConfigs[image].registry, imageConfigs[image].name, imageConfigs[image].version)\n}", "func getImage() string {\n\tif config.ImageBuild == \"\" && config.ImageBuildFolder == \"\" {\n\t\treturn config.GetImageName()\n\t}\n\n\tif config.ImageBuildFolder == \"\" {\n\t\tconfig.ImageBuildFolder = \".\"\n\t}\n\n\tvar dockerFile string\n\tif config.ImageBuild != \"\" {\n\t\tout := Must(ioutil.TempFile(config.ImageBuildFolder, \"DockerFile\")).(*os.File)\n\t\tMust(fmt.Fprintf(out, \"FROM %s \\n%s\", config.GetImageName(), config.ImageBuild))\n\t\tMust(out.Close())\n\t\tdefer os.Remove(out.Name())\n\t\tdockerFile = out.Name()\n\t}\n\n\targs := []string{\"build\", config.ImageBuildFolder, \"--quiet\", \"--force-rm\"}\n\tif refresh {\n\t\targs = append(args, \"--pull\")\n\t}\n\tif dockerFile != \"\" {\n\t\targs = append(args, \"--file\")\n\t\targs = append(args, dockerFile)\n\t}\n\tbuildCmd := exec.Command(\"docker\", args...)\n\n\tif debug {\n\t\tprintfDebug(os.Stderr, \"%s\\n\", strings.Join(buildCmd.Args, \" \"))\n\t}\n\tbuildCmd.Stderr = os.Stderr\n\tbuildCmd.Dir = config.ImageBuildFolder\n\n\treturn strings.TrimSpace(string(Must(buildCmd.Output()).([]byte)))\n}", "func (o IopingSpecOutput) Image() IopingSpecImageOutput {\n\treturn o.ApplyT(func(v IopingSpec) IopingSpecImage { return v.Image }).(IopingSpecImageOutput)\n}", "func (ms *MachinePlugin) GetMachineStatus(ctx context.Context, req *cmi.GetMachineStatusRequest) (*cmi.GetMachineStatusResponse, error) {\n\t// Log messages to track start and end of request\n\tglog.V(2).Infof(\"Get request has been recieved for %q\", req.MachineName)\n\n\tproviderSpec, secrets, err := decodeProviderSpecAndSecret(req.ProviderSpec, req.Secrets, false)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tinstances, err := ms.getInstancesFromMachineName(req.MachineName, providerSpec, secrets)\n\tif err != nil {\n\t\treturn nil, err\n\t} else if len(instances) > 1 {\n\t\tinstanceIDs := []string{}\n\t\tfor _, instance := range instances {\n\t\t\tinstanceIDs = append(instanceIDs, *instance.InstanceId)\n\t\t}\n\n\t\terrMessage := fmt.Sprintf(\"AWS plugin is returning multiple VM instances backing this machine object. IDs for all backing VMs - %v \", instanceIDs)\n\t\treturn nil, status.Error(codes.OutOfRange, errMessage)\n\t}\n\n\trequiredInstance := instances[0]\n\n\tresponse := &cmi.GetMachineStatusResponse{\n\t\tNodeName: *requiredInstance.PrivateDnsName,\n\t\tProviderID: encodeProviderID(providerSpec.Region, *requiredInstance.InstanceId),\n\t}\n\n\tglog.V(2).Infof(\"Machine get request has been processed successfully for %q\", req.MachineName)\n\treturn response, nil\n}", "func (i *Config) GetE2EImage() string {\n\treturn fmt.Sprintf(\"%s/%s:%s\", i.registry, i.name, i.version)\n}", "func MachineCRDCreator() reconciling.NamedCustomResourceDefinitionCreatorGetter {\n\treturn func() (string, reconciling.CustomResourceDefinitionCreator) {\n\t\treturn resources.MachineCRDName, func(crd *apiextensionsv1beta1.CustomResourceDefinition) (*apiextensionsv1beta1.CustomResourceDefinition, error) {\n\t\t\tcrd.Spec.Group = clusterAPIGroup\n\t\t\tcrd.Spec.Version = clusterAPIVersion\n\t\t\tcrd.Spec.Scope = apiextensionsv1beta1.NamespaceScoped\n\t\t\tcrd.Spec.Names.Kind = \"Machine\"\n\t\t\tcrd.Spec.Names.ListKind = \"MachineList\"\n\t\t\tcrd.Spec.Names.Plural = \"machines\"\n\t\t\tcrd.Spec.Names.Singular = \"machine\"\n\t\t\tcrd.Spec.Names.ShortNames = []string{\"ma\"}\n\t\t\tcrd.Spec.AdditionalPrinterColumns = []apiextensionsv1beta1.CustomResourceColumnDefinition{\n\t\t\t\t{\n\t\t\t\t\tName: \"Age\",\n\t\t\t\t\tType: \"date\",\n\t\t\t\t\tJSONPath: \".metadata.creationTimestamp\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tName: \"Deleted\",\n\t\t\t\t\tType: \"date\",\n\t\t\t\t\tJSONPath: \".metadata.deletionTimestamp\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tName: \"MachineSet\",\n\t\t\t\t\tType: \"string\",\n\t\t\t\t\tJSONPath: \".metadata.ownerReferences[0].name\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tName: \"Address\",\n\t\t\t\t\tType: \"string\",\n\t\t\t\t\tJSONPath: \".status.addresses[0].address\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tName: \"Node\",\n\t\t\t\t\tType: \"string\",\n\t\t\t\t\tJSONPath: \".status.nodeRef.name\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tName: \"Provider\",\n\t\t\t\t\tType: \"string\",\n\t\t\t\t\tJSONPath: \".spec.providerSpec.value.cloudProvider\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tName: \"OS\",\n\t\t\t\t\tType: \"string\",\n\t\t\t\t\tJSONPath: \".spec.providerSpec.value.operatingSystem\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tName: \"Version\",\n\t\t\t\t\tType: \"string\",\n\t\t\t\t\tJSONPath: \".spec.versions.kubelet\",\n\t\t\t\t},\n\t\t\t}\n\n\t\t\treturn crd, nil\n\t\t}\n\t}\n\n}", "func (m Model) GetImage() image.Image {\n\treturn m.Image\n}", "func (i *imageHandler) resolveRegistryImage() string {\n\tdomain := i.image.Domain\n\tif len(domain) == 0 {\n\t\tdomain = defaultImageDomain\n\t}\n\tns := i.image.Namespace\n\tif len(ns) == 0 {\n\t\tns = defaultImageNamespace\n\t}\n\treturn fmt.Sprintf(\"%s/%s/%s\", domain, ns, i.resolveImageNameTag())\n}", "func (o FioSpecOutput) Image() FioSpecImageOutput {\n\treturn o.ApplyT(func(v FioSpec) FioSpecImage { return v.Image }).(FioSpecImageOutput)\n}", "func (r Virtual_Disk_Image) GetSourceDiskImage() (resp datatypes.Virtual_Disk_Image, err error) {\n\terr = r.Session.DoRequest(\"SoftLayer_Virtual_Disk_Image\", \"getSourceDiskImage\", nil, &r.Options, &resp)\n\treturn\n}", "func (o FioSpecVolumeVolumeSourceRbdPtrOutput) Image() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *FioSpecVolumeVolumeSourceRbd) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Image\n\t}).(pulumi.StringPtrOutput)\n}", "func (b *ecrBase) runGetImage(ctx context.Context, batchGetImageInput ecr.BatchGetImageInput) (*ecr.Image, error) {\n\t// Allow only a single image to be fetched at a time.\n\tif len(batchGetImageInput.ImageIds) != 1 {\n\t\treturn nil, errGetImageUnhandled\n\t}\n\n\tbatchGetImageInput.RegistryId = aws.String(b.ecrSpec.Registry())\n\tbatchGetImageInput.RepositoryName = aws.String(b.ecrSpec.Repository)\n\n\tlog.G(ctx).WithField(\"batchGetImageInput\", batchGetImageInput).Trace(\"ecr.base.image: requesting images\")\n\n\tbatchGetImageOutput, err := b.client.BatchGetImageWithContext(ctx, &batchGetImageInput)\n\tif err != nil {\n\t\tlog.G(ctx).WithError(err).Error(\"ecr.base.image: failed to get image\")\n\t\treturn nil, err\n\t}\n\tlog.G(ctx).WithField(\"batchGetImageOutput\", batchGetImageOutput).Trace(\"ecr.base.image: api response\")\n\n\t// Summarize image request failures for handled errors. Only the first\n\t// failure is checked as only a single ImageIdentifier is allowed to be\n\t// queried for.\n\tif len(batchGetImageOutput.Failures) > 0 {\n\t\tfailure := batchGetImageOutput.Failures[0]\n\t\tswitch aws.StringValue(failure.FailureCode) {\n\t\t// Requested image with a corresponding tag and digest does not exist.\n\t\t// This failure will generally occur when pushing an updated (or new)\n\t\t// image with a tag.\n\t\tcase ecr.ImageFailureCodeImageTagDoesNotMatchDigest:\n\t\t\tlog.G(ctx).WithField(\"failure\", failure).Debug(\"ecr.base.image: no matching image with specified digest\")\n\t\t\treturn nil, errImageNotFound\n\t\t// Requested image doesn't resolve to a known image. A new image will\n\t\t// result in an ImageNotFound error when checked before push.\n\t\tcase ecr.ImageFailureCodeImageNotFound:\n\t\t\tlog.G(ctx).WithField(\"failure\", failure).Debug(\"ecr.base.image: no image found\")\n\t\t\treturn nil, errImageNotFound\n\t\t// Requested image identifiers are invalid.\n\t\tcase ecr.ImageFailureCodeInvalidImageDigest, ecr.ImageFailureCodeInvalidImageTag:\n\t\t\tlog.G(ctx).WithField(\"failure\", failure).Error(\"ecr.base.image: invalid image identifier\")\n\t\t\treturn nil, reference.ErrInvalid\n\t\t// Unhandled failure reported for image request made.\n\t\tdefault:\n\t\t\tlog.G(ctx).WithField(\"failure\", failure).Warn(\"ecr.base.image: unhandled image request failure\")\n\t\t\treturn nil, errGetImageUnhandled\n\t\t}\n\t}\n\n\treturn batchGetImageOutput.Images[0], nil\n}", "func (wzid WzMachineIDUtilConsumer) GetMachineIdUtil() *WzMachineIDUtil {\n\tif _MachineIDUtil == nil {\n\t\tpanic(\"MachineID utility was not properly initialised yet\")\n\t}\n\n\treturn _MachineIDUtil\n}", "func (o BuildRunStatusBuildSpecRuntimeBaseOutput) Image() pulumi.StringOutput {\n\treturn o.ApplyT(func(v BuildRunStatusBuildSpecRuntimeBase) string { return v.Image }).(pulumi.StringOutput)\n}", "func (a *Actuator) getNodeForMachine(c *clusterv1.Cluster, m *clusterv1.Machine) (string, string, error) {\n\tmasterSSHClient, err := a.getMasterSSHClient(c, m)\n\tif err != nil {\n\t\tglog.Error(\"Error getting master sshClient\")\n\t\treturn \"\", \"\", err\n\t}\n\tnodeCmd := getNodeCmd + \" | grep \" + m.Namespace + \"/\" + m.Name\n\tglog.Infof(\"nodeCmd = %s\", nodeCmd)\n\toutput, err := masterSSHClient.ProcessCMDWithOutput(nodeCmd)\n\tif err != nil {\n\t\tglog.Errorf(\"Error getting node: cmd = %s, error = %s\", nodeCmd, err)\n\t\treturn \"\", \"\", err\n\t}\n\tstrs := strings.Split(string(output), \":\")\n\tif len(strs) < 2 {\n\t\treturn \"\", \"\", errors.New(\"Error getting node name for machine\")\n\t}\n\tnode := strs[0]\n\tversion := a.semanticVersion(strs[1])\n\treturn node, version, nil\n}", "func NewMachine(ctx context.Context, cfg Config, opts ...Opt) (*Machine, error) {\n\tm := &Machine{\n\t\texitCh: make(chan struct{}),\n\t}\n\n\tif cfg.VMID == \"\" {\n\t\trandomID, err := uuid.NewV4()\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"failed to create random ID for VMID\")\n\t\t}\n\t\tcfg.VMID = randomID.String()\n\t}\n\n\tm.Handlers = defaultHandlers\n\n\tif cfg.JailerCfg != nil {\n\t\tm.Handlers.Validation = m.Handlers.Validation.Append(JailerConfigValidationHandler)\n\t\tif err := jail(ctx, m, &cfg); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\tm.Handlers.Validation = m.Handlers.Validation.Append(ConfigValidationHandler)\n\t\tm.cmd = configureBuilder(defaultFirecrackerVMMCommandBuilder, cfg).Build(ctx)\n\t}\n\n\tfor _, opt := range opts {\n\t\topt(m)\n\t}\n\n\tif m.logger == nil {\n\t\tlogger := log.New()\n\n\t\tm.logger = log.NewEntry(logger)\n\t}\n\n\tif m.client == nil {\n\t\tm.client = NewClient(cfg.SocketPath, m.logger, false)\n\t}\n\n\tif cfg.ForwardSignals == nil {\n\t\tcfg.ForwardSignals = []os.Signal{\n\t\t\tos.Interrupt,\n\t\t\tsyscall.SIGQUIT,\n\t\t\tsyscall.SIGTERM,\n\t\t\tsyscall.SIGHUP,\n\t\t\tsyscall.SIGABRT,\n\t\t}\n\t}\n\n\tm.machineConfig = cfg.MachineCfg\n\tm.Cfg = cfg\n\n\tif cfg.NetNS == \"\" && cfg.NetworkInterfaces.cniInterface() != nil {\n\t\tm.Cfg.NetNS = m.defaultNetNSPath()\n\t}\n\n\tm.logger.Debug(\"Called NewMachine()\")\n\treturn m, nil\n}", "func (o IopingSpecVolumeVolumeSourceRbdPtrOutput) Image() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *IopingSpecVolumeVolumeSourceRbd) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Image\n\t}).(pulumi.StringPtrOutput)\n}", "func (o *ContainerSpec) GetImage() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Image\n}", "func (d Docker) LookupImage(name string) (*image.Image, error) {\n\treturn d.Daemon.GetImage(name)\n}", "func (o StorageClusterSpecUserInterfacePtrOutput) Image() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *StorageClusterSpecUserInterface) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Image\n\t}).(pulumi.StringPtrOutput)\n}", "func (r Virtual_Guest) GetCpuMetricImageByDate(startDateTime *datatypes.Time, endDateTime *datatypes.Time, cpuIndexes []int) (resp datatypes.Container_Bandwidth_GraphOutputs, err error) {\n\tparams := []interface{}{\n\t\tstartDateTime,\n\t\tendDateTime,\n\t\tcpuIndexes,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Virtual_Guest\", \"getCpuMetricImageByDate\", params, &r.Options, &resp)\n\treturn\n}", "func (c *auditLog) getImage() string {\n\treturn c.Spec.PodSpec.BusyboxImage\n}", "func (o BuildRunStatusBuildSpecRuntimeBasePtrOutput) Image() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *BuildRunStatusBuildSpecRuntimeBase) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Image\n\t}).(pulumi.StringPtrOutput)\n}", "func (o StorageClusterSpecStorkOutput) Image() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v StorageClusterSpecStork) *string { return v.Image }).(pulumi.StringPtrOutput)\n}", "func (r *release) GetBaseIso(log logrus.FieldLogger, releaseImage string, pullSecret string, mirrorConfig []mirror.RegistriesConfig, architecture string) (string, error) {\n\n\t// Get the machine-os-images pullspec from the release and use that to get the CoreOS ISO\n\timage, err := r.getImageFromRelease(log, machineOsImageName, releaseImage, pullSecret, len(mirrorConfig) > 0)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tcacheDir, err := GetCacheDir(imageDataType)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tfilename := fmt.Sprintf(coreOsFileName, architecture)\n\t// Check if file is already cached\n\tfilePath, err := GetFileFromCache(path.Base(filename), cacheDir)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif filePath != \"\" {\n\t\t// Found cached file\n\t\treturn filePath, nil\n\t}\n\n\tpath, err := r.extractFileFromImage(log, image, filename, cacheDir, pullSecret, mirrorConfig)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn path, err\n}", "func NewMachine(ctx *context.MachineContext, client client.Client, namespace string, sshKeys *ssh.ClusterNodeSshKeys) (*Machine, error) {\n\tmachine := &Machine{\n\t\tclient: client,\n\t\tnamespace: namespace,\n\t\tmachineContext: ctx,\n\t\tvmiInstance: nil,\n\t\tvmInstance: nil,\n\t\tsshKeys: sshKeys,\n\t\tgetCommandExecutor: ssh.NewVMCommandExecutor,\n\t}\n\n\tnamespacedName := types.NamespacedName{Namespace: namespace, Name: ctx.KubevirtMachine.Name}\n\tvm := &kubevirtv1.VirtualMachine{}\n\tvmi := &kubevirtv1.VirtualMachineInstance{}\n\n\t// Get the active running VMI if it exists\n\terr := client.Get(ctx.Context, namespacedName, vmi)\n\tif err != nil {\n\t\tif !apierrors.IsNotFound(err) {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\tmachine.vmiInstance = vmi\n\t}\n\n\t// Get the top level VM object if it exists\n\terr = client.Get(ctx.Context, namespacedName, vm)\n\tif err != nil {\n\t\tif !apierrors.IsNotFound(err) {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\tmachine.vmInstance = vm\n\t}\n\n\treturn machine, nil\n}", "func (o InstanceVmImageOutput) ImageFamily() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v InstanceVmImage) *string { return v.ImageFamily }).(pulumi.StringPtrOutput)\n}", "func (c *TestClient) GetMachineType(project, zone, machineType string) (*compute.MachineType, error) {\n\tif c.GetMachineTypeFn != nil {\n\t\treturn c.GetMachineTypeFn(project, zone, machineType)\n\t}\n\treturn c.client.GetMachineType(project, zone, machineType)\n}", "func (client WorkloadNetworksClient) GetVirtualMachine(ctx context.Context, resourceGroupName string, privateCloudName string, virtualMachineID string) (result WorkloadNetworkVirtualMachine, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/WorkloadNetworksClient.GetVirtualMachine\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.Response.Response != nil {\n\t\t\t\tsc = result.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tif err := validation.Validate([]validation.Validation{\n\t\t{TargetValue: client.SubscriptionID,\n\t\t\tConstraints: []validation.Constraint{{Target: \"client.SubscriptionID\", Name: validation.MinLength, Rule: 1, Chain: nil}}},\n\t\t{TargetValue: resourceGroupName,\n\t\t\tConstraints: []validation.Constraint{{Target: \"resourceGroupName\", Name: validation.MaxLength, Rule: 90, Chain: nil},\n\t\t\t\t{Target: \"resourceGroupName\", Name: validation.MinLength, Rule: 1, Chain: nil},\n\t\t\t\t{Target: \"resourceGroupName\", Name: validation.Pattern, Rule: `^[-\\w\\._\\(\\)]+$`, Chain: nil}}}}); err != nil {\n\t\treturn result, validation.NewError(\"avs.WorkloadNetworksClient\", \"GetVirtualMachine\", err.Error())\n\t}\n\n\treq, err := client.GetVirtualMachinePreparer(ctx, resourceGroupName, privateCloudName, virtualMachineID)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"avs.WorkloadNetworksClient\", \"GetVirtualMachine\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.GetVirtualMachineSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"avs.WorkloadNetworksClient\", \"GetVirtualMachine\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.GetVirtualMachineResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"avs.WorkloadNetworksClient\", \"GetVirtualMachine\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\n\treturn\n}", "func getMachineID() string {\n\tmachineIDOnce.Do(func() {\n\t\tid, err := machineid.ProtectedID(\"dolt\")\n\n\t\tif err == nil {\n\t\t\tmachineID = id\n\t\t}\n\t})\n\n\treturn machineID\n}" ]
[ "0.7500192", "0.71932083", "0.7138342", "0.64311785", "0.6118197", "0.5794965", "0.5723471", "0.5722323", "0.5709312", "0.57045215", "0.56465566", "0.5639119", "0.55901855", "0.5558532", "0.5558008", "0.55341154", "0.5526549", "0.54999954", "0.54988873", "0.5473281", "0.54436976", "0.54371846", "0.5435572", "0.5422934", "0.5374604", "0.53711927", "0.5355123", "0.5351273", "0.5346636", "0.5342394", "0.5340742", "0.5340629", "0.5308357", "0.53074247", "0.53014964", "0.53013206", "0.529594", "0.5294708", "0.52943575", "0.52874005", "0.52787566", "0.5267053", "0.5261154", "0.52503866", "0.52483225", "0.52460986", "0.5243166", "0.524179", "0.5240728", "0.52406174", "0.5238755", "0.5229902", "0.5227852", "0.52221304", "0.5212354", "0.52039945", "0.5200404", "0.51963365", "0.5180629", "0.516435", "0.51494056", "0.5149215", "0.5148675", "0.51409376", "0.514032", "0.5133479", "0.5133479", "0.51234806", "0.5116557", "0.50982934", "0.509018", "0.5081323", "0.50674295", "0.50671667", "0.5063877", "0.5062933", "0.5054355", "0.5054193", "0.5049491", "0.504515", "0.50303996", "0.5026658", "0.50075793", "0.5006801", "0.50055254", "0.500496", "0.5003635", "0.5003152", "0.5000935", "0.49970257", "0.4991309", "0.49904215", "0.4981844", "0.497686", "0.49673393", "0.49657872", "0.4963707", "0.49597558", "0.49590936", "0.49463236" ]
0.79030395
0
CreateInstanceBeta uses the override method CreateInstanceBetaFn or the real implementation.
func (c *TestClient) CreateInstanceBeta(project, zone string, i *computeBeta.Instance) error { if c.CreateInstanceBetaFn != nil { return c.CreateInstanceBetaFn(project, zone, i) } return c.client.CreateInstanceBeta(project, zone, i) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (bil *baseInstanceList) newBetaGetHook() func(ctx context.Context, key *meta.Key, m *cloud.MockBetaInstances) (bool, *beta.Instance, error) {\n\treturn func(ctx context.Context, key *meta.Key, m *cloud.MockBetaInstances) (bool, *beta.Instance, error) {\n\t\tm.Lock.Lock()\n\t\tdefer m.Lock.Unlock()\n\n\t\tif _, found := m.Objects[*key]; !found {\n\t\t\tm.Objects[*key] = &cloud.MockInstancesObj{Obj: bil.getOrCreateBaseInstance(key).toBeta()}\n\t\t}\n\t\treturn false, nil, nil\n\t}\n}", "func (t *T) Beta(name string, f interface{}) bool {\n\tt.Helper()\n\treturn t.invokeFeature(feature.Beta, name, f)\n}", "func NewBetaProposer(alpha, beta float64) *BetaProposer {\n\tp, _ := prob.NewBeta(alpha, beta)\n\treturn &BetaProposer{p}\n}", "func (t TestDescription) Beta() TestDescription {\n\treturn t.newLabel(\"BETA\")\n}", "func (bi *baseInstance) toBeta() *beta.Instance {\n\tinst := &beta.Instance{Name: bi.name, Zone: bi.zone, NetworkInterfaces: []*beta.NetworkInterface{{}}}\n\tif bi.aliasRange != \"\" {\n\t\tinst.NetworkInterfaces[0].AliasIpRanges = []*beta.AliasIpRange{\n\t\t\t{IpCidrRange: bi.aliasRange, SubnetworkRangeName: util.TestSecondaryRangeName},\n\t\t}\n\t}\n\treturn inst\n}", "func NewBetaTestersCreateInstanceRequest(server string, body BetaTestersCreateInstanceJSONRequestBody) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewBetaTestersCreateInstanceRequestWithBody(server, \"application/json\", bodyReader)\n}", "func (c *TestClient) CreateInstanceAlpha(project, zone string, i *computeAlpha.Instance) error {\n\tif c.CreateInstanceBetaFn != nil {\n\t\treturn c.CreateInstanceAlphaFn(project, zone, i)\n\t}\n\treturn c.client.CreateInstanceAlpha(project, zone, i)\n}", "func NewBetaDist(alpha, beta float64) *Beta {\n\tdist := &Beta{\n\t\tAlpha: alpha,\n\t\tBeta: beta,\n\t\tspace: UnitIntervalSpace,\n\t}\n\tdist.DefContinuousDistSampleN.dist = dist\n\tdist.DefContinuousDistProb.dist = dist\n\tdist.DefContinuousDistLgProb.dist = dist\n\treturn dist\n}", "func NewBetaGroupsCreateInstanceRequest(server string, body BetaGroupsCreateInstanceJSONRequestBody) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewBetaGroupsCreateInstanceRequestWithBody(server, \"application/json\", bodyReader)\n}", "func NewBetaAppLocalizationsCreateInstanceRequest(server string, body BetaAppLocalizationsCreateInstanceJSONRequestBody) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewBetaAppLocalizationsCreateInstanceRequestWithBody(server, \"application/json\", bodyReader)\n}", "func NewCreateInstance(name string, plan string, team string) *CreateInstance {\n\tthis := CreateInstance{}\n\tthis.Name = name\n\tthis.Plan = plan\n\tthis.Team = team\n\treturn &this\n}", "func (s *InstanceTemplateServer) ApplyComputeBetaInstanceTemplate(ctx context.Context, request *betapb.ApplyComputeBetaInstanceTemplateRequest) (*betapb.ComputeBetaInstanceTemplate, error) {\n\tcl, err := createConfigInstanceTemplate(ctx, request.ServiceAccountFile)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn s.applyInstanceTemplate(ctx, cl, request)\n}", "func (c *ClientWithResponses) BetaTestersCreateInstanceWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*BetaTestersCreateInstanceResponse, error) {\n\trsp, err := c.BetaTestersCreateInstanceWithBody(ctx, contentType, body, reqEditors...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ParseBetaTestersCreateInstanceResponse(rsp)\n}", "func (tbl DbCompoundTable) CreateAlphaBetaIndex(ifNotExist bool) error {\n\tine := tbl.ternary(ifNotExist && tbl.Dialect() != schema.Mysql, \"IF NOT EXISTS \", \"\")\n\n\t// Mysql does not support 'if not exists' on indexes\n\t// Workaround: use DropIndex first and ignore an error returned if the index didn't exist.\n\n\tif ifNotExist && tbl.Dialect() == schema.Mysql {\n\t\t// low-level no-logging Exec\n\t\ttbl.Execer().ExecContext(tbl.ctx, tbl.dropDbAlphaBetaIndexSql(false))\n\t\tine = \"\"\n\t}\n\n\t_, err := tbl.Exec(nil, tbl.createDbAlphaBetaIndexSql(ine))\n\treturn err\n}", "func NewBetaAppReviewSubmissionsCreateInstanceRequest(server string, body BetaAppReviewSubmissionsCreateInstanceJSONRequestBody) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewBetaAppReviewSubmissionsCreateInstanceRequestWithBody(server, \"application/json\", bodyReader)\n}", "func Beta(a, b float64) float64 {\n\tla, sgnla := math.Lgamma(a)\n\tlb, sgnlb := math.Lgamma(b)\n\tlc, sgnlc := math.Lgamma(a + b)\n\treturn float64(sgnla*sgnlb*sgnlc) * math.Exp(la+lb-lc)\n}", "func NewBetaTestersCreateInstanceRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {\n\tvar err error\n\n\tserverURL, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\toperationPath := fmt.Sprintf(\"/v1/betaTesters\")\n\tif operationPath[0] == '/' {\n\t\toperationPath = \".\" + operationPath\n\t}\n\n\tqueryURL, err := serverURL.Parse(operationPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"POST\", queryURL.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", contentType)\n\n\treturn req, nil\n}", "func NewBetaGroupsCreateInstanceRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {\n\tvar err error\n\n\tserverURL, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\toperationPath := fmt.Sprintf(\"/v1/betaGroups\")\n\tif operationPath[0] == '/' {\n\t\toperationPath = \".\" + operationPath\n\t}\n\n\tqueryURL, err := serverURL.Parse(operationPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"POST\", queryURL.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", contentType)\n\n\treturn req, nil\n}", "func NewBetaTesterInvitationsCreateInstanceRequest(server string, body BetaTesterInvitationsCreateInstanceJSONRequestBody) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewBetaTesterInvitationsCreateInstanceRequestWithBody(server, \"application/json\", bodyReader)\n}", "func ParseBetaTestersCreateInstanceResponse(rsp *http.Response) (*BetaTestersCreateInstanceResponse, error) {\n\tbodyBytes, err := ioutil.ReadAll(rsp.Body)\n\tdefer func() { _ = rsp.Body.Close() }()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse := &BetaTestersCreateInstanceResponse{\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 == 201:\n\t\tvar dest BetaTesterResponse\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON201 = &dest\n\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 400:\n\t\tvar dest ErrorResponse\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON400 = &dest\n\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 403:\n\t\tvar dest ErrorResponse\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON403 = &dest\n\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 409:\n\t\tvar dest ErrorResponse\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON409 = &dest\n\n\t}\n\n\treturn response, nil\n}", "func (o *InlineObject885) SetBeta(v AnyOfobject) {\n\to.Beta = &v\n}", "func (c *ClientWithResponses) BetaGroupsCreateInstanceWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*BetaGroupsCreateInstanceResponse, error) {\n\trsp, err := c.BetaGroupsCreateInstanceWithBody(ctx, contentType, body, reqEditors...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ParseBetaGroupsCreateInstanceResponse(rsp)\n}", "func NewBetaBuildLocalizationsCreateInstanceRequest(server string, body BetaBuildLocalizationsCreateInstanceJSONRequestBody) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewBetaBuildLocalizationsCreateInstanceRequestWithBody(server, \"application/json\", bodyReader)\n}", "func getBeta(fAlpha, fBeta float64) float64 {\n\tvar fA, fB float64\n\tif fAlpha > fBeta {\n\t\tfA = fAlpha\n\t\tfB = fBeta\n\t} else {\n\t\tfA = fBeta\n\t\tfB = fAlpha\n\t}\n\tconst maxGammaArgument = 171.624376956302\n\tif fA+fB < maxGammaArgument {\n\t\treturn math.Gamma(fA) / math.Gamma(fA+fB) * math.Gamma(fB)\n\t}\n\tfg := 6.024680040776729583740234375\n\tfgm := fg - 0.5\n\tfLanczos := getLanczosSum(fA)\n\tfLanczos /= getLanczosSum(fA + fB)\n\tfLanczos *= getLanczosSum(fB)\n\tfABgm := fA + fB + fgm\n\tfLanczos *= math.Sqrt((fABgm / (fA + fgm)) / (fB + fgm))\n\tfTempA := fB / (fA + fgm)\n\tfTempB := fA / (fB + fgm)\n\tfResult := math.Exp(-fA*math.Log1p(fTempA) - fB*math.Log1p(fTempB) - fgm)\n\tfResult *= fLanczos\n\treturn fResult\n}", "func (c *ClientWithResponses) BetaAppReviewSubmissionsCreateInstanceWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*BetaAppReviewSubmissionsCreateInstanceResponse, error) {\n\trsp, err := c.BetaAppReviewSubmissionsCreateInstanceWithBody(ctx, contentType, body, reqEditors...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ParseBetaAppReviewSubmissionsCreateInstanceResponse(rsp)\n}", "func NewBetaAppLocalizationsCreateInstanceRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {\n\tvar err error\n\n\tserverURL, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\toperationPath := fmt.Sprintf(\"/v1/betaAppLocalizations\")\n\tif operationPath[0] == '/' {\n\t\toperationPath = \".\" + operationPath\n\t}\n\n\tqueryURL, err := serverURL.Parse(operationPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"POST\", queryURL.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", contentType)\n\n\treturn req, nil\n}", "func (client BaseClient) CreateFeatureInstance(ctx context.Context, body *FeatureInstanceInputs) (result FeatureInstance, err error) {\n\tif err := validation.Validate([]validation.Validation{\n\t\t{TargetValue: body,\n\t\t\tConstraints: []validation.Constraint{{Target: \"body\", Name: validation.Null, Rule: false,\n\t\t\t\tChain: []validation.Constraint{{Target: \"body.FeatureName\", Name: validation.Null, Rule: true,\n\t\t\t\t\tChain: []validation.Constraint{{Target: \"body.FeatureName\", Name: validation.Pattern, Rule: `^[a-z0-9-]+$`, Chain: nil}}},\n\t\t\t\t\t{Target: \"body.FeatureVersion\", Name: validation.Null, Rule: true,\n\t\t\t\t\t\tChain: []validation.Constraint{{Target: \"body.FeatureVersion\", Name: validation.Pattern, Rule: `^v?((\\d+)\\.(\\d+)\\.(\\d+))(?:-([\\dA-Za-z\\-]+(?:\\.[\\dA-Za-z\\-]+)*))?(?:\\+([\\dA-Za-z\\-]+(?:\\.[\\dA-Za-z\\-]+)*))?$`, Chain: nil}}},\n\t\t\t\t\t{Target: \"body.InstanceName\", Name: validation.Null, Rule: true,\n\t\t\t\t\t\tChain: []validation.Constraint{{Target: \"body.InstanceName\", Name: validation.Pattern, Rule: `^[a-z0-9-]+$`, Chain: nil}}},\n\t\t\t\t}}}}}); err != nil {\n\t\treturn result, validation.NewError(\"beacon.BaseClient\", \"CreateFeatureInstance\", err.Error())\n\t}\n\n\treq, err := client.CreateFeatureInstancePreparer(ctx, body)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"beacon.BaseClient\", \"CreateFeatureInstance\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.CreateFeatureInstanceSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"beacon.BaseClient\", \"CreateFeatureInstance\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.CreateFeatureInstanceResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"beacon.BaseClient\", \"CreateFeatureInstance\", resp, \"Failure responding to request\")\n\t}\n\n\treturn\n}", "func NewTabularBBO(stateDim int, numActions int, gamma float64, N int) Agent {\n\tbbo := TabularBBO{}\n\n\tbbo.ep = NewEpisodeTracker(N)\n\tbbo.numStates = stateDim\n\n\tbbo.newTheta = make([][]float64, bbo.numStates)\n\tbbo.curTheta = make([][]float64, bbo.numStates)\n\n\tinitialValue := 10.0\n\tbbo.newTheta = mathlib.Matrix(bbo.numStates, bbo.numActions, initialValue)\n\tbbo.curTheta = mathlib.Matrix(bbo.numStates, bbo.numActions, initialValue)\n\n\treturn &bbo\n}", "func NewFactory() receiver.Factory {\n\treturn receiver.NewFactory(\n\t\ttypeStr,\n\t\tcreateDefaultConfig,\n\t\treceiver.WithTraces(createTraces, component.StabilityLevelStable),\n\t\treceiver.WithMetrics(createMetrics, component.StabilityLevelStable),\n\t\treceiver.WithLogs(createLog, component.StabilityLevelBeta))\n}", "func (bbo *TabularBBO) NewEpisode() {}", "func (c *ClientWithResponses) BetaAppLocalizationsCreateInstanceWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*BetaAppLocalizationsCreateInstanceResponse, error) {\n\trsp, err := c.BetaAppLocalizationsCreateInstanceWithBody(ctx, contentType, body, reqEditors...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ParseBetaAppLocalizationsCreateInstanceResponse(rsp)\n}", "func (c *ClientWithResponses) BetaTesterInvitationsCreateInstanceWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*BetaTesterInvitationsCreateInstanceResponse, error) {\n\trsp, err := c.BetaTesterInvitationsCreateInstanceWithBody(ctx, contentType, body, reqEditors...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ParseBetaTesterInvitationsCreateInstanceResponse(rsp)\n}", "func NewBetaGroupsGetInstanceRequest(server string, id string, params *BetaGroupsGetInstanceParams) (*http.Request, error) {\n\tvar err error\n\n\tvar pathParam0 string\n\n\tpathParam0, err = runtime.StyleParamWithLocation(\"simple\", false, \"id\", runtime.ParamLocationPath, id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tserverURL, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\toperationPath := fmt.Sprintf(\"/v1/betaGroups/%s\", pathParam0)\n\tif operationPath[0] == '/' {\n\t\toperationPath = \".\" + operationPath\n\t}\n\n\tqueryURL, err := serverURL.Parse(operationPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryValues := queryURL.Query()\n\n\tif params.FieldsBetaGroups != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"fields[betaGroups]\", runtime.ParamLocationQuery, *params.FieldsBetaGroups); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.Include != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"include\", runtime.ParamLocationQuery, *params.Include); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.FieldsBetaTesters != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"fields[betaTesters]\", runtime.ParamLocationQuery, *params.FieldsBetaTesters); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.FieldsApps != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"fields[apps]\", runtime.ParamLocationQuery, *params.FieldsApps); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.FieldsBuilds != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"fields[builds]\", runtime.ParamLocationQuery, *params.FieldsBuilds); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.LimitBetaTesters != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", true, \"limit[betaTesters]\", runtime.ParamLocationQuery, *params.LimitBetaTesters); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.LimitBuilds != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", true, \"limit[builds]\", runtime.ParamLocationQuery, *params.LimitBuilds); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tqueryURL.RawQuery = queryValues.Encode()\n\n\treq, err := http.NewRequest(\"GET\", queryURL.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn req, nil\n}", "func (c *ClientWithResponses) BuildBetaNotificationsCreateInstanceWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*BuildBetaNotificationsCreateInstanceResponse, error) {\n\trsp, err := c.BuildBetaNotificationsCreateInstanceWithBody(ctx, contentType, body, reqEditors...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ParseBuildBetaNotificationsCreateInstanceResponse(rsp)\n}", "func newDeployment(t *testing.T, procUpdates func(ProcessUpdate), kubeClient kubernetes.Interface) *Deployment {\n\tcompList, err := config.NewComponentList(\"../test/data/componentlist.yaml\")\n\tassert.NoError(t, err)\n\tconfig := &config.Config{\n\t\tCancelTimeout: cancelTimeout,\n\t\tQuitTimeout: quitTimeout,\n\t\tBackoffInitialIntervalSeconds: 1,\n\t\tBackoffMaxElapsedTimeSeconds: 1,\n\t\tLog: logger.NewLogger(true),\n\t\tComponentList: compList,\n\t}\n\tcore := newCore(config, &overrides.Builder{}, kubeClient, procUpdates)\n\treturn &Deployment{core}\n}", "func getBetaDist(fXin, fAlpha, fBeta float64) float64 {\n\tif fXin <= 0 {\n\t\treturn 0\n\t}\n\tif fXin >= 1 {\n\t\treturn 1\n\t}\n\tif fBeta == 1 {\n\t\treturn math.Pow(fXin, fAlpha)\n\t}\n\tif fAlpha == 1 {\n\t\treturn -math.Expm1(fBeta * math.Log1p(-fXin))\n\t}\n\tvar fResult float64\n\tfY, flnY := (0.5-fXin)+0.5, math.Log1p(-fXin)\n\tfX, flnX := fXin, math.Log(fXin)\n\tfA, fB := fAlpha, fBeta\n\tbReflect := fXin > fAlpha/(fAlpha+fBeta)\n\tif bReflect {\n\t\tfA = fBeta\n\t\tfB = fAlpha\n\t\tfX = fY\n\t\tfY = fXin\n\t\tflnX = flnY\n\t\tflnY = math.Log(fXin)\n\t}\n\tfResult = getBetaHelperContFrac(fX, fA, fB) / fA\n\tfP, fQ := fA/(fA+fB), fB/(fA+fB)\n\tvar fTemp float64\n\tif fA > 1 && fB > 1 && fP < 0.97 && fQ < 0.97 {\n\t\tfTemp = getBetaDistPDF(fX, fA, fB) * fX * fY\n\t} else {\n\t\tfTemp = math.Exp(fA*flnX + fB*flnY - getLogBeta(fA, fB))\n\t}\n\tfResult *= fTemp\n\tif bReflect {\n\t\tfResult = 0.5 - fResult + 0.5\n\t}\n\treturn fResult\n}", "func ParseBetaAppReviewSubmissionsCreateInstanceResponse(rsp *http.Response) (*BetaAppReviewSubmissionsCreateInstanceResponse, error) {\n\tbodyBytes, err := ioutil.ReadAll(rsp.Body)\n\tdefer func() { _ = rsp.Body.Close() }()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse := &BetaAppReviewSubmissionsCreateInstanceResponse{\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 == 201:\n\t\tvar dest BetaAppReviewSubmissionResponse\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON201 = &dest\n\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 400:\n\t\tvar dest ErrorResponse\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON400 = &dest\n\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 403:\n\t\tvar dest ErrorResponse\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON403 = &dest\n\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 409:\n\t\tvar dest ErrorResponse\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON409 = &dest\n\n\t}\n\n\treturn response, nil\n}", "func NewBetaBuildLocalizationsCreateInstanceRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {\n\tvar err error\n\n\tserverURL, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\toperationPath := fmt.Sprintf(\"/v1/betaBuildLocalizations\")\n\tif operationPath[0] == '/' {\n\t\toperationPath = \".\" + operationPath\n\t}\n\n\tqueryURL, err := serverURL.Parse(operationPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"POST\", queryURL.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", contentType)\n\n\treturn req, nil\n}", "func TestGetInstance(t *testing.T) {\n\tctx, cancelFunc := context.WithTimeout(context.Background(), standardTimeout)\n\tdefer cancelFunc()\n\n\tinstances, err := bat.StartRandomInstances(ctx, \"\", 1)\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to launch instance: %v\", err)\n\t}\n\n\t_, err = bat.RetrieveInstanceStatus(ctx, \"\", instances[0])\n\tif err != nil {\n\t\tt.Errorf(\"Failed to retrieve instance status: %v\", err)\n\t}\n\n\tscheduled, err := bat.WaitForInstancesLaunch(ctx, \"\", instances, false)\n\tif err != nil {\n\t\tt.Errorf(\"Instance %s did not launch: %v\", instances[0], err)\n\t}\n\n\t_, err = bat.DeleteInstances(ctx, \"\", scheduled)\n\tif err != nil {\n\t\tt.Errorf(\"Failed to delete instance %s: %v\", instances[0], err)\n\t}\n}", "func (px *Paxos) CreateInstance(seq int) {\n\n\t//create instance and update max if necessary\n\n\tpx.instances[seq] = &Instance{-1, -1, nil, false}\n\tif seq > px.maxSeq {\n\t\tpx.maxSeq = seq\n\t}\n}", "func ParseBetaGroupsCreateInstanceResponse(rsp *http.Response) (*BetaGroupsCreateInstanceResponse, error) {\n\tbodyBytes, err := ioutil.ReadAll(rsp.Body)\n\tdefer func() { _ = rsp.Body.Close() }()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse := &BetaGroupsCreateInstanceResponse{\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 == 201:\n\t\tvar dest BetaGroupResponse\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON201 = &dest\n\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 400:\n\t\tvar dest ErrorResponse\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON400 = &dest\n\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 403:\n\t\tvar dest ErrorResponse\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON403 = &dest\n\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 409:\n\t\tvar dest ErrorResponse\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON409 = &dest\n\n\t}\n\n\treturn response, nil\n}", "func (c *ClientWithResponses) BetaBuildLocalizationsCreateInstanceWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*BetaBuildLocalizationsCreateInstanceResponse, error) {\n\trsp, err := c.BetaBuildLocalizationsCreateInstanceWithBody(ctx, contentType, body, reqEditors...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ParseBetaBuildLocalizationsCreateInstanceResponse(rsp)\n}", "func ParseBetaTesterInvitationsCreateInstanceResponse(rsp *http.Response) (*BetaTesterInvitationsCreateInstanceResponse, error) {\n\tbodyBytes, err := ioutil.ReadAll(rsp.Body)\n\tdefer func() { _ = rsp.Body.Close() }()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse := &BetaTesterInvitationsCreateInstanceResponse{\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 == 201:\n\t\tvar dest BetaTesterInvitationResponse\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON201 = &dest\n\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 400:\n\t\tvar dest ErrorResponse\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON400 = &dest\n\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 403:\n\t\tvar dest ErrorResponse\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON403 = &dest\n\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 409:\n\t\tvar dest ErrorResponse\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON409 = &dest\n\n\t}\n\n\treturn response, nil\n}", "func (b *BetaDistribution) GetBeta() float64 {\n\treturn b.beta\n}", "func expectedNewInstance(jobID, datasetID string) *dataset.NewInstance {\n\tnewInstance := &dataset.NewInstance{\n\t\tLinks: &dataset.Links{\n\t\t\tDataset: dataset.Link{\n\t\t\t\tURL: \"http://localhost:22000/datasets/\" + datasetID,\n\t\t\t\tID: datasetID,\n\t\t\t},\n\t\t\tJob: dataset.Link{\n\t\t\t\tURL: \"http://import-api/jobs/\" + jobID,\n\t\t\t\tID: jobID,\n\t\t\t},\n\t\t},\n\t\tDimensions: []dataset.CodeList{},\n\t\tImportTasks: &dataset.InstanceImportTasks{\n\t\t\tImportObservations: &dataset.ImportObservationsTask{\n\t\t\t\tState: dataset.StateCreated.String(),\n\t\t\t},\n\t\t\tBuildHierarchyTasks: []*dataset.BuildHierarchyTask{},\n\t\t\tBuildSearchIndexTasks: []*dataset.BuildSearchIndexTask{},\n\t\t},\n\t\tType: \"cantabular_blob\",\n\t}\n\tif datasetID == \"dataset1\" {\n\t\tnewInstance.Dimensions = []dataset.CodeList{{ID: \"codelist11\"}, {ID: \"codelist12\"}}\n\t\tnewInstance.LowestGeography = \"lowest_geo\"\n\t} else if datasetID == \"dataset2\" {\n\t\tnewInstance.Dimensions = []dataset.CodeList{{ID: \"codelist21\"}, {ID: \"codelist22\"}, {ID: \"codelist23\"}}\n\t}\n\treturn newInstance\n}", "func (s *InstanceTemplateServer) DeleteComputeBetaInstanceTemplate(ctx context.Context, request *betapb.DeleteComputeBetaInstanceTemplateRequest) (*emptypb.Empty, error) {\n\n\tcl, err := createConfigInstanceTemplate(ctx, request.ServiceAccountFile)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &emptypb.Empty{}, cl.DeleteInstanceTemplate(ctx, ProtoToInstanceTemplate(request.GetResource()))\n\n}", "func (h *HealthCheck) createInstance() error {\n\tif h.frameworkError != nil {\n\t\treturn h.frameworkError\n\t}\n\tglog.V(4).Info(\"Creating a ServiceInstance\")\n\tinstance := &v1beta1.ServiceInstance{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: h.instanceName,\n\t\t\tNamespace: h.namespace.Name,\n\t\t},\n\t\tSpec: v1beta1.ServiceInstanceSpec{\n\t\t\tPlanReference: v1beta1.PlanReference{\n\t\t\t\tClusterServiceClassExternalName: h.serviceclassName,\n\t\t\t\tClusterServicePlanExternalName: \"default\",\n\t\t\t},\n\t\t},\n\t}\n\toperationStartTime := time.Now()\n\tvar err error\n\tinstance, err = h.serviceCatalogClientSet.ServicecatalogV1beta1().ServiceInstances(h.namespace.Name).Create(instance)\n\tif err != nil {\n\t\treturn h.setError(\"error creating instance: %v\", err.Error())\n\t}\n\n\tif instance == nil {\n\t\treturn h.setError(\"error creating instance - instance is null\")\n\t}\n\n\tglog.V(4).Info(\"Waiting for ServiceInstance to be ready\")\n\terr = util.WaitForInstanceCondition(h.serviceCatalogClientSet.ServicecatalogV1beta1(),\n\t\th.namespace.Name,\n\t\th.instanceName,\n\t\tv1beta1.ServiceInstanceCondition{\n\t\t\tType: v1beta1.ServiceInstanceConditionReady,\n\t\t\tStatus: v1beta1.ConditionTrue,\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn h.setError(\"instance not ready: %v\", err.Error())\n\t}\n\tReportOperationCompleted(\"create_instance\", operationStartTime)\n\n\tglog.V(4).Info(\"Verifing references are resolved\")\n\tsc, err := h.serviceCatalogClientSet.ServicecatalogV1beta1().ServiceInstances(h.namespace.Name).Get(h.instanceName, metav1.GetOptions{})\n\tif err != nil {\n\t\treturn h.setError(\"error getting instance: %v\", err.Error())\n\t}\n\n\tif sc.Spec.ClusterServiceClassRef == nil {\n\t\treturn h.setError(\"ClusterServiceClassRef should not be null\")\n\t}\n\tif sc.Spec.ClusterServicePlanRef == nil {\n\t\treturn h.setError(\"ClusterServicePlanRef should not be null\")\n\t}\n\n\tif strings.Compare(sc.Spec.ClusterServiceClassRef.Name, h.serviceclassID) != 0 {\n\t\treturn h.setError(\"ClusterServiceClassRef.Name error: %v != %v\", sc.Spec.ClusterServiceClassRef.Name, h.serviceclassID)\n\t}\n\tif strings.Compare(sc.Spec.ClusterServicePlanRef.Name, h.serviceplanID) != 0 {\n\t\treturn h.setError(\"sc.Spec.ClusterServicePlanRef.Name error: %v != %v\", sc.Spec.ClusterServicePlanRef.Name, h.serviceplanID)\n\t}\n\treturn nil\n}", "func NewBuildBetaNotificationsCreateInstanceRequest(server string, body BuildBetaNotificationsCreateInstanceJSONRequestBody) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewBuildBetaNotificationsCreateInstanceRequestWithBody(server, \"application/json\", bodyReader)\n}", "func Instance(name string) *Baa {\n\tif name == \"\" {\n\t\tname = defaultAppName\n\t}\n\tif appInstances[name] == nil {\n\t\tappInstances[name] = New()\n\t\tappInstances[name].name = name\n\t}\n\treturn appInstances[name]\n}", "func NewBetaAppReviewSubmissionsCreateInstanceRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {\n\tvar err error\n\n\tserverURL, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\toperationPath := fmt.Sprintf(\"/v1/betaAppReviewSubmissions\")\n\tif operationPath[0] == '/' {\n\t\toperationPath = \".\" + operationPath\n\t}\n\n\tqueryURL, err := serverURL.Parse(operationPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"POST\", queryURL.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", contentType)\n\n\treturn req, nil\n}", "func ParseBetaAppLocalizationsCreateInstanceResponse(rsp *http.Response) (*BetaAppLocalizationsCreateInstanceResponse, error) {\n\tbodyBytes, err := ioutil.ReadAll(rsp.Body)\n\tdefer func() { _ = rsp.Body.Close() }()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse := &BetaAppLocalizationsCreateInstanceResponse{\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 == 201:\n\t\tvar dest BetaAppLocalizationResponse\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON201 = &dest\n\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 400:\n\t\tvar dest ErrorResponse\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON400 = &dest\n\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 403:\n\t\tvar dest ErrorResponse\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON403 = &dest\n\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 409:\n\t\tvar dest ErrorResponse\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON409 = &dest\n\n\t}\n\n\treturn response, nil\n}", "func (s *InstanceTemplateServer) ListComputeBetaInstanceTemplate(ctx context.Context, request *betapb.ListComputeBetaInstanceTemplateRequest) (*betapb.ListComputeBetaInstanceTemplateResponse, error) {\n\tcl, err := createConfigInstanceTemplate(ctx, request.ServiceAccountFile)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresources, err := cl.ListInstanceTemplate(ctx, request.Project)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar protos []*betapb.ComputeBetaInstanceTemplate\n\tfor _, r := range resources.Items {\n\t\trp := InstanceTemplateToProto(r)\n\t\tprotos = append(protos, rp)\n\t}\n\treturn &betapb.ListComputeBetaInstanceTemplateResponse{Items: protos}, nil\n}", "func ProtoToInstanceTemplate(p *betapb.ComputeBetaInstanceTemplate) *beta.InstanceTemplate {\n\tobj := &beta.InstanceTemplate{\n\t\tCreationTimestamp: dcl.StringOrNil(p.GetCreationTimestamp()),\n\t\tDescription: dcl.StringOrNil(p.Description),\n\t\tId: dcl.Int64OrNil(p.Id),\n\t\tSelfLink: dcl.StringOrNil(p.SelfLink),\n\t\tName: dcl.StringOrNil(p.Name),\n\t\tProperties: ProtoToComputeBetaInstanceTemplateProperties(p.GetProperties()),\n\t\tProject: dcl.StringOrNil(p.Project),\n\t}\n\treturn obj\n}", "func BetaDiff(matches []Match, beta float64) []float64 {\n\tvar diffs []float64\n\tplayers := make(map[string]*glicko2.Player)\n\tparams := glicko2.Parameters{\n\t\tInitialDeviation: 27,\n\t\tInitialVolatility: .06,\n\t}\n\tfor _, match := range matches {\n\t\t// Add players as we discover them.\n\t\tp1, ok := players[match.P1name]\n\t\tif !ok {\n\t\t\tparams.InitialRating = match.P1skill\n\t\t\tplayers[match.P1name] = glicko2.NewPlayer(params)\n\t\t\tp1 = players[match.P1name]\n\t\t}\n\t\tp2, ok := players[match.P2name]\n\t\tif !ok {\n\t\t\tparams.InitialRating = match.P2skill\n\t\t\tplayers[match.P2name] = glicko2.NewPlayer(params)\n\t\t\tp2 = players[match.P2name]\n\t\t}\n\n\t\texpected := Pwin(p1, p2, beta)\n\t\tactual := float64(\n\t\t\tfloat64(match.P1got) / float64(match.P1got+match.P2got))\n\t\tdiff := math.Abs(expected - actual)\n\t\tdiffs = append(diffs, diff)\n\t}\n\n\treturn diffs\n}", "func newInstance(moduleName, name string, priv interface{}) (*BaseInstance, error) {\n\tfactory, found := instanceFactories[moduleName]\n\tif !found {\n\t\treturn nil, fmt.Errorf(\"Module '%s' doesn't exist.\\n\", moduleName)\n\t}\n\n\trp, ok := ringParams[moduleName]\n\tif !ok {\n\t\trp = defaultRingParam\n\t}\n\n\tbi := &BaseInstance{name: name}\n\n\tringName := fmt.Sprintf(\"input-%s\", name)\n\tbi.input = dpdk.RingCreate(ringName, rp.Count, rp.SocketId, dpdk.RING_F_SC_DEQ)\n\tif bi.input == nil {\n\t\treturn nil, fmt.Errorf(\"Input ring creation faild for %s.\\n\", name)\n\t}\n\n\tif rp.SecondaryInput {\n\t\tringName := fmt.Sprintf(\"input2-%s\", name)\n\t\tbi.input2 = dpdk.RingCreate(ringName, rp.Count, rp.SocketId, dpdk.RING_F_SC_DEQ)\n\t\tif bi.input2 == nil {\n\t\t\treturn nil, fmt.Errorf(\"Second input ring creation failed for %s\", name)\n\t\t}\n\t}\n\n\tbi.rules = newRules()\n\n\tinstance, err := factory(bi, priv)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Creating module '%s' with name '%s' failed: %v\\n\", moduleName, name, err)\n\t}\n\tbi.instance = instance\n\n\treturn bi, nil\n}", "func (f *FakeInstance) Create(_ context.Context, _ *govultr.InstanceCreateReq) (*govultr.Instance, *http.Response, error) {\n\tpanic(\"implement me\")\n}", "func (a *AssembliesApiService) CreateInstance(ctx _context.Context, did string, wid string, eid string, btAssemblyInstanceDefinitionParams BtAssemblyInstanceDefinitionParams) ([]BtOccurrence74, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue []BtOccurrence74\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/api/assemblies/d/{did}/w/{wid}/e/{eid}/instances\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"did\"+\"}\", _neturl.QueryEscape(parameterToString(did, \"\")) , -1)\n\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"wid\"+\"}\", _neturl.QueryEscape(parameterToString(wid, \"\")) , -1)\n\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"eid\"+\"}\", _neturl.QueryEscape(parameterToString(eid, \"\")) , -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json;charset=UTF-8; qs=0.09\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/vnd.onshape.v1+json;charset=UTF-8;qs=0.1\", \"application/json;charset=UTF-8; qs=0.09\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = &btAssemblyInstanceDefinitionParams\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 200 {\n\t\t\tvar v []BtOccurrence74\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "func ProtoToComputeBetaInstanceTemplateProperties(p *betapb.ComputeBetaInstanceTemplateProperties) *beta.InstanceTemplateProperties {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &beta.InstanceTemplateProperties{\n\t\tCanIPForward: dcl.Bool(p.CanIpForward),\n\t\tDescription: dcl.StringOrNil(p.Description),\n\t\tMachineType: dcl.StringOrNil(p.MachineType),\n\t\tMinCpuPlatform: dcl.StringOrNil(p.MinCpuPlatform),\n\t\tReservationAffinity: ProtoToComputeBetaInstanceTemplatePropertiesReservationAffinity(p.GetReservationAffinity()),\n\t\tShieldedInstanceConfig: ProtoToComputeBetaInstanceTemplatePropertiesShieldedInstanceConfig(p.GetShieldedInstanceConfig()),\n\t\tScheduling: ProtoToComputeBetaInstanceTemplatePropertiesScheduling(p.GetScheduling()),\n\t}\n\tfor _, r := range p.GetDisks() {\n\t\tobj.Disks = append(obj.Disks, *ProtoToComputeBetaInstanceTemplatePropertiesDisks(r))\n\t}\n\tfor _, r := range p.GetGuestAccelerators() {\n\t\tobj.GuestAccelerators = append(obj.GuestAccelerators, *ProtoToComputeBetaInstanceTemplatePropertiesGuestAccelerators(r))\n\t}\n\tfor _, r := range p.GetNetworkInterfaces() {\n\t\tobj.NetworkInterfaces = append(obj.NetworkInterfaces, *ProtoToComputeBetaInstanceTemplatePropertiesNetworkInterfaces(r))\n\t}\n\tfor _, r := range p.GetServiceAccounts() {\n\t\tobj.ServiceAccounts = append(obj.ServiceAccounts, *ProtoToComputeBetaInstanceTemplatePropertiesServiceAccounts(r))\n\t}\n\tfor _, r := range p.GetTags() {\n\t\tobj.Tags = append(obj.Tags, r)\n\t}\n\treturn obj\n}", "func getLogBeta(fAlpha, fBeta float64) float64 {\n\tvar fA, fB float64\n\tif fAlpha > fBeta {\n\t\tfA, fB = fAlpha, fBeta\n\t} else {\n\t\tfA, fB = fBeta, fAlpha\n\t}\n\tfg := 6.024680040776729583740234375\n\tfgm := fg - 0.5\n\tfLanczos := getLanczosSum(fA)\n\tfLanczos /= getLanczosSum(fA + fB)\n\tfLanczos *= getLanczosSum(fB)\n\tfLogLanczos := math.Log(fLanczos)\n\tfABgm := fA + fB + fgm\n\tfLogLanczos += 0.5 * (math.Log(fABgm) - math.Log(fA+fgm) - math.Log(fB+fgm))\n\tfTempA := fB / (fA + fgm)\n\tfTempB := fA / (fB + fgm)\n\tfResult := -fA*math.Log1p(fTempA) - fB*math.Log1p(fTempB) - fgm\n\tfResult += fLogLanczos\n\treturn fResult\n}", "func LRNGradBeta(value float32) LRNGradAttr {\n\treturn func(m optionalAttr) {\n\t\tm[\"beta\"] = value\n\t}\n}", "func (m *MockFilterClient) CreateBlueprint(ctx context.Context, userAuthToken, serviceAuthToken, downloadServiceToken, collectionID, datasetID, edition, version string, names []string) (string, string, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"CreateBlueprint\", ctx, userAuthToken, serviceAuthToken, downloadServiceToken, collectionID, datasetID, edition, version, names)\n\tret0, _ := ret[0].(string)\n\tret1, _ := ret[1].(string)\n\tret2, _ := ret[2].(error)\n\treturn ret0, ret1, ret2\n}", "func NewBetaTesterInvitationsCreateInstanceRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) {\n\tvar err error\n\n\tserverURL, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\toperationPath := fmt.Sprintf(\"/v1/betaTesterInvitations\")\n\tif operationPath[0] == '/' {\n\t\toperationPath = \".\" + operationPath\n\t}\n\n\tqueryURL, err := serverURL.Parse(operationPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq, err := http.NewRequest(\"POST\", queryURL.String(), body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", contentType)\n\n\treturn req, nil\n}", "func CreateTestInstance(t *testing.T, uuid dvid.UUID, typename, name string, config dvid.Config) {\n\tconfig.Set(\"typename\", typename)\n\tconfig.Set(\"dataname\", name)\n\tjsonData, err := config.MarshalJSON()\n\tif err != nil {\n\t\tt.Fatalf(\"Unable to make JSON for instance creation: %v\\n\", config)\n\t}\n\tapiStr := fmt.Sprintf(\"%srepo/%s/instance\", WebAPIPath, uuid)\n\tTestHTTP(t, \"POST\", apiStr, bytes.NewBuffer(jsonData))\n}", "func ParseBetaBuildLocalizationsCreateInstanceResponse(rsp *http.Response) (*BetaBuildLocalizationsCreateInstanceResponse, error) {\n\tbodyBytes, err := ioutil.ReadAll(rsp.Body)\n\tdefer func() { _ = rsp.Body.Close() }()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresponse := &BetaBuildLocalizationsCreateInstanceResponse{\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 == 201:\n\t\tvar dest BetaBuildLocalizationResponse\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON201 = &dest\n\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 400:\n\t\tvar dest ErrorResponse\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON400 = &dest\n\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 403:\n\t\tvar dest ErrorResponse\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON403 = &dest\n\n\tcase strings.Contains(rsp.Header.Get(\"Content-Type\"), \"json\") && rsp.StatusCode == 409:\n\t\tvar dest ErrorResponse\n\t\tif err := json.Unmarshal(bodyBytes, &dest); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresponse.JSON409 = &dest\n\n\t}\n\n\treturn response, nil\n}", "func Beta(x, y float64) float64 {\n\tswitch {\n\tcase math.IsNaN(x) || math.IsNaN(y) || math.IsInf(x, -1) || math.IsInf(y, -1):\n\t\treturn math.NaN()\n\tcase math.IsInf(x, 1):\n\t\tif y <= 0 && y == math.Trunc(y) {\n\t\t\treturn float64(GammaSign(y)) * x\n\t\t}\n\t\treturn 0\n\tcase math.IsInf(y, 1):\n\t\tif x <= 0 && x == math.Trunc(x) {\n\t\t\treturn float64(GammaSign(x)) * y\n\t\t}\n\t\treturn 0\n\t}\n\treturn GammaRatio([]float64{x, y}, []float64{x + y})\n}", "func BetaAPIHandler(enableBetaRestriction bool, h http.Handler) http.Handler {\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tif enableBetaRestriction && !isInternalTraffic(r) && !isBetaDomain(r) {\n\t\t\tlog.Warn(r.Context(), \"beta endpoint requested via a non beta domain, returning 404\",\n\t\t\t\tlog.Data{\"url\": r.URL.String()})\n\t\t\tw.WriteHeader(http.StatusNotFound)\n\t\t\treturn\n\t\t}\n\n\t\th.ServeHTTP(w, r)\n\t})\n}", "func (client BaseClient) CreateFeatureInstanceResponder(resp *http.Response) (result FeatureInstance, 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}", "func CreateBlueprint(rootElement string) *Blueprint {\n\tdoc := etree.NewDocument()\n\tdoc.CreateElement(rootElement)\n\n\treturn &Blueprint{XMLData: doc}\n}", "func CreateServiceInstance(sess *session.Session, instanceName, serviceName, servicePlan, resourceGrp, region string) (string, error) {\n\tcatalogClient, err := catalog.New(sess)\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tresCatalogAPI := catalogClient.ResourceCatalog()\n\n\tservice, err := resCatalogAPI.FindByName(serviceName, true)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tservicePlanID, err := resCatalogAPI.GetServicePlanID(service[0], servicePlan)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif servicePlanID == \"\" {\n\t\t_, err := resCatalogAPI.GetServicePlan(servicePlan)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tservicePlanID = servicePlan\n\t}\n\tdeployments, err := resCatalogAPI.ListDeployments(servicePlanID)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif len(deployments) == 0 {\n\t\tklog.Infof(\"No deployment found for service plan : %s\", servicePlan)\n\t\treturn \"\", err\n\t}\n\n\tsupportedDeployments := []models.ServiceDeployment{}\n\tsupportedLocations := make(map[string]bool)\n\tfor _, d := range deployments {\n\t\tif d.Metadata.RCCompatible {\n\t\t\tdeploymentLocation := d.Metadata.Deployment.Location\n\t\t\tsupportedLocations[deploymentLocation] = true\n\t\t\tif deploymentLocation == region {\n\t\t\t\tsupportedDeployments = append(supportedDeployments, d)\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(supportedDeployments) == 0 {\n\t\tlocationList := make([]string, 0, len(supportedLocations))\n\t\tfor l := range supportedLocations {\n\t\t\tlocationList = append(locationList, l)\n\t\t}\n\t\treturn \"\", fmt.Errorf(\"No deployment found for service plan %s at location %s.\\nValid location(s) are: %q.\\nUse service instance example if the service is a Cloud Foundry service.\",\n\t\t\tservicePlan, region, locationList)\n\t}\n\n\tmanagementClient, err := management.New(sess)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tvar resourceGroup models.ResourceGroup\n\tresGrpAPI := managementClient.ResourceGroup()\n\n\tif resourceGrp == \"\" {\n\t\tresourceGroupQuery := management.ResourceGroupQuery{\n\t\t\tDefault: true,\n\t\t}\n\n\t\tgrpList, err := resGrpAPI.List(&resourceGroupQuery)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tresourceGroup = grpList[0]\n\n\t} else {\n\t\tgrp, err := resGrpAPI.FindByName(nil, resourceGrp)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tresourceGroup = grp[0]\n\t}\n\tklog.Infof(\"Resource group: %s and ID: %s\", resourceGroup.Name, resourceGroup.ID)\n\n\tcontrollerClient, err := controller.New(sess)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tresServiceInstanceAPI := controllerClient.ResourceServiceInstance()\n\n\tvar serviceInstancePayload = controller.CreateServiceInstanceRequest{\n\t\tName: instanceName,\n\t\tServicePlanID: servicePlanID,\n\t\tResourceGroupID: resourceGroup.ID,\n\t\tTargetCrn: supportedDeployments[0].CatalogCRN,\n\t}\n\n\tserviceInstance, err := resServiceInstanceAPI.CreateInstance(serviceInstancePayload)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tklog.Infof(\"Resource service Instance Details :%v\\n\", serviceInstance)\n\n\treturn serviceInstance.Crn.ServiceInstance, nil\n}", "func New(sess *session.Session) ELBv2 {\n\treturn &_elbv2{\n\t\tsvc: elbv2.New(sess),\n\t}\n}", "func newProtonInstance(proton core.Protoner) reflect.Value {\n\tbaseValue := reflect.ValueOf(proton)\n\n\t// try to create new value of proton\n\tmethod := baseValue.MethodByName(\"New\")\n\tif method.IsValid() {\n\t\treturns := method.Call(emptyParameters)\n\t\tif len(returns) <= 0 {\n\t\t\tpanic(fmt.Sprintf(\"Method New must has at least 1 returns. now %d\", len(returns)))\n\t\t}\n\t\treturn returns[0]\n\t} else {\n\t\t// return reflect.New(reflect.TypeOf(proton).Elem())\n\t\treturn newInstance(reflect.TypeOf(proton))\n\t}\n}", "func ProtoToComputeBetaInstanceTemplatePropertiesGuestAccelerators(p *betapb.ComputeBetaInstanceTemplatePropertiesGuestAccelerators) *beta.InstanceTemplatePropertiesGuestAccelerators {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &beta.InstanceTemplatePropertiesGuestAccelerators{\n\t\tAcceleratorCount: dcl.Int64OrNil(p.AcceleratorCount),\n\t\tAcceleratorType: dcl.StringOrNil(p.AcceleratorType),\n\t}\n\treturn obj\n}", "func NewBetaTestersGetInstanceRequest(server string, id string, params *BetaTestersGetInstanceParams) (*http.Request, error) {\n\tvar err error\n\n\tvar pathParam0 string\n\n\tpathParam0, err = runtime.StyleParamWithLocation(\"simple\", false, \"id\", runtime.ParamLocationPath, id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tserverURL, err := url.Parse(server)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\toperationPath := fmt.Sprintf(\"/v1/betaTesters/%s\", pathParam0)\n\tif operationPath[0] == '/' {\n\t\toperationPath = \".\" + operationPath\n\t}\n\n\tqueryURL, err := serverURL.Parse(operationPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tqueryValues := queryURL.Query()\n\n\tif params.FieldsBetaTesters != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"fields[betaTesters]\", runtime.ParamLocationQuery, *params.FieldsBetaTesters); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.Include != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"include\", runtime.ParamLocationQuery, *params.Include); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.FieldsApps != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"fields[apps]\", runtime.ParamLocationQuery, *params.FieldsApps); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.FieldsBuilds != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"fields[builds]\", runtime.ParamLocationQuery, *params.FieldsBuilds); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.FieldsBetaGroups != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", false, \"fields[betaGroups]\", runtime.ParamLocationQuery, *params.FieldsBetaGroups); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.LimitApps != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", true, \"limit[apps]\", runtime.ParamLocationQuery, *params.LimitApps); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.LimitBetaGroups != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", true, \"limit[betaGroups]\", runtime.ParamLocationQuery, *params.LimitBetaGroups); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif params.LimitBuilds != nil {\n\n\t\tif queryFrag, err := runtime.StyleParamWithLocation(\"form\", true, \"limit[builds]\", runtime.ParamLocationQuery, *params.LimitBuilds); err != nil {\n\t\t\treturn nil, err\n\t\t} else if parsed, err := url.ParseQuery(queryFrag); err != nil {\n\t\t\treturn nil, err\n\t\t} else {\n\t\t\tfor k, v := range parsed {\n\t\t\t\tfor _, v2 := range v {\n\t\t\t\t\tqueryValues.Add(k, v2)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\tqueryURL.RawQuery = queryValues.Encode()\n\n\treq, err := http.NewRequest(\"GET\", queryURL.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn req, nil\n}", "func (vp *scalewayProvider) CreateInstance(log *logging.Logger, options providers.CreateInstanceOptions, dnsProvider providers.DnsProvider) (providers.ClusterInstance, error) {\n\t// Create server\n\tid, err := vp.createServer(options)\n\tif err != nil {\n\t\treturn providers.ClusterInstance{}, maskAny(err)\n\t}\n\n\t// Wait for the server to be active\n\tserver, err := vp.waitUntilServerActive(id, false)\n\tif err != nil {\n\t\treturn providers.ClusterInstance{}, maskAny(err)\n\t}\n\n\tif options.RoleLoadBalancer {\n\t\tpublicIpv4 := server.PublicAddress.IP\n\t\tpublicIpv6 := \"\"\n\t\tif err := providers.RegisterInstance(vp.Logger, dnsProvider, options, server.Name, options.RoleLoadBalancer, publicIpv4, publicIpv6); err != nil {\n\t\t\treturn providers.ClusterInstance{}, maskAny(err)\n\t\t}\n\t}\n\n\tvp.Logger.Infof(\"Server '%s' is ready\", server.Name)\n\n\treturn vp.clusterInstance(server, false), nil\n}", "func ComputeBetaInstanceTemplatePropertiesToProto(o *beta.InstanceTemplateProperties) *betapb.ComputeBetaInstanceTemplateProperties {\n\tif o == nil {\n\t\treturn nil\n\t}\n\tp := &betapb.ComputeBetaInstanceTemplateProperties{\n\t\tCanIpForward: dcl.ValueOrEmptyBool(o.CanIPForward),\n\t\tDescription: dcl.ValueOrEmptyString(o.Description),\n\t\tMachineType: dcl.ValueOrEmptyString(o.MachineType),\n\t\tMinCpuPlatform: dcl.ValueOrEmptyString(o.MinCpuPlatform),\n\t\tReservationAffinity: ComputeBetaInstanceTemplatePropertiesReservationAffinityToProto(o.ReservationAffinity),\n\t\tShieldedInstanceConfig: ComputeBetaInstanceTemplatePropertiesShieldedInstanceConfigToProto(o.ShieldedInstanceConfig),\n\t\tScheduling: ComputeBetaInstanceTemplatePropertiesSchedulingToProto(o.Scheduling),\n\t}\n\tfor _, r := range o.Disks {\n\t\tp.Disks = append(p.Disks, ComputeBetaInstanceTemplatePropertiesDisksToProto(&r))\n\t}\n\tp.Labels = make(map[string]string)\n\tfor k, r := range o.Labels {\n\t\tp.Labels[k] = r\n\t}\n\tp.Metadata = make(map[string]string)\n\tfor k, r := range o.Metadata {\n\t\tp.Metadata[k] = r\n\t}\n\tfor _, r := range o.GuestAccelerators {\n\t\tp.GuestAccelerators = append(p.GuestAccelerators, ComputeBetaInstanceTemplatePropertiesGuestAcceleratorsToProto(&r))\n\t}\n\tfor _, r := range o.NetworkInterfaces {\n\t\tp.NetworkInterfaces = append(p.NetworkInterfaces, ComputeBetaInstanceTemplatePropertiesNetworkInterfacesToProto(&r))\n\t}\n\tfor _, r := range o.ServiceAccounts {\n\t\tp.ServiceAccounts = append(p.ServiceAccounts, ComputeBetaInstanceTemplatePropertiesServiceAccountsToProto(&r))\n\t}\n\tfor _, r := range o.Tags {\n\t\tp.Tags = append(p.Tags, r)\n\t}\n\treturn p\n}", "func NewWorkflowsServiceV2BetaClient(ctx context.Context, opts ...option.ClientOption) (*WorkflowsServiceV2BetaClient, error) {\n\tclientOpts := defaultWorkflowsServiceV2BetaGRPCClientOptions()\n\tif newWorkflowsServiceV2BetaClientHook != nil {\n\t\thookOpts, err := newWorkflowsServiceV2BetaClientHook(ctx, clientHookParams{})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tclientOpts = append(clientOpts, hookOpts...)\n\t}\n\n\tconnPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient := WorkflowsServiceV2BetaClient{CallOptions: defaultWorkflowsServiceV2BetaCallOptions()}\n\n\tc := &workflowsServiceV2BetaGRPCClient{\n\t\tconnPool: connPool,\n\t\tworkflowsServiceV2BetaClient: lifesciencespb.NewWorkflowsServiceV2BetaClient(connPool),\n\t\tCallOptions: &client.CallOptions,\n\t\toperationsClient: longrunningpb.NewOperationsClient(connPool),\n\t\tlocationsClient: locationpb.NewLocationsClient(connPool),\n\t}\n\tc.setGoogleClientInfo()\n\n\tclient.internalClient = c\n\n\tclient.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool))\n\tif err != nil {\n\t\t// This error \"should not happen\", since we are just reusing old connection pool\n\t\t// and never actually need to dial.\n\t\t// If this does happen, we could leak connp. However, we cannot close conn:\n\t\t// If the user invoked the constructor with option.WithGRPCConn,\n\t\t// we would close a connection that's still in use.\n\t\t// TODO: investigate error conditions.\n\t\treturn nil, err\n\t}\n\tc.LROClient = &client.LROClient\n\treturn &client, nil\n}", "func testInstance() Instance {\n\treturn Instance{\n\t\tCreated: true,\n\t\tImageID: \"ami-7172b611\",\n\t\tInstanceID: \"i-1234567890abcdef0\",\n\t\tInstanceType: \"t2.nano\",\n\t\tSubnetID: \"subnet-1234567890abcdef0\",\n\t\tKeyPairName: \"bastion-test\",\n\t\tSecurityGroupID: \"sg-1234567890abcdef0\",\n\t\tPublicIPAddress: \"8.8.8.8\",\n\t\tPrivateIPAddress: \"10.0.0.1\",\n\t\tSSHUser: \"ec2-user\",\n\t}\n}", "func NewBleveBackend() BackendFactory {\n\treturn newBleveBackend\n}", "func TestServiceRegistryExternalTrafficHealthCheckNodePortAllocationBeta(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.AnnotationValueExternalTrafficLocal,\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 needed, returned health check not needed instead\")\n\t}\n\tport := service.GetServiceHealthCheckNodePort(created_service)\n\tif port == 0 {\n\t\tt.Errorf(\"Failed to allocate health check node port and set the HealthCheckNodePort\")\n\t}\n\n}", "func NewCreateInstanceWithDefaults() *CreateInstance {\n\tthis := CreateInstance{}\n\treturn &this\n}", "func NewNLB(ns string, mcisName string, groupId string, config string) *NLB {\n\tnlb := &NLB{\n\t\tNLBBase: NLBBase{\n\t\t\tModel: Model{Name: groupId, Namespace: ns},\n\t\t\tConfig: config,\n\t\t\tType: \"PUBLIC\",\n\t\t\tScope: \"REGION\", Listener: NLBProtocolBase{Protocol: \"TCP\", Port: \"6443\"},\n\t\t\tTargetGroup: TargetGroup{NLBProtocolBase: NLBProtocolBase{Protocol: \"TCP\", Port: \"6443\"}, MCIS: mcisName, VmGroupId: groupId},\n\t\t},\n\t\tHealthChecker: HealthCheck{\n\t\t\tNLBProtocolBase: NLBProtocolBase{Protocol: \"TCP\", Port: \"22\"},\n\t\t\tInterval: \"default\", Threshold: \"default\", Timeout: \"default\",\n\t\t},\n\t}\n\tif strings.Contains(config, string(app.CSP_NCPVPC)) || strings.Contains(config, string(app.CSP_AZURE)) {\n\t\tnlb.HealthChecker.Timeout = \"-1\"\n\t}\n\tif strings.Contains(nlb.NLBBase.Config, string(app.CSP_GCP)) {\n\t\tnlb.HealthChecker.NLBProtocolBase.Protocol = \"HTTP\"\n\t\tnlb.HealthChecker.NLBProtocolBase.Port = \"80\"\n\t}\n\n\treturn nlb\n}", "func New(behavior Func) structmap.Behavior {\n\treturn behavior\n}", "func (p *OnPrem) CreateInstance(ctx *Context) error {\n\tc := ctx.config\n\n\thypervisor := HypervisorInstance()\n\tif hypervisor == nil {\n\t\tfmt.Println(\"No hypervisor found on $PATH\")\n\t\tfmt.Println(\"Please install OPS using curl https://ops.city/get.sh -sSfL | sh\")\n\t\tos.Exit(1)\n\t}\n\n\tinstancename := c.CloudConfig.ImageName\n\n\tfmt.Printf(\"booting %s ...\\n\", instancename)\n\n\topshome := GetOpsHome()\n\timgpath := path.Join(opshome, \"images\", instancename)\n\n\tc.RunConfig.BaseName = instancename\n\tc.RunConfig.Imagename = imgpath\n\tc.RunConfig.OnPrem = true\n\n\thypervisor.Start(&c.RunConfig)\n\n\treturn nil\n}", "func TestServiceRegistryExternalTrafficHealthCheckNodePortNegativeBeta(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.AnnotationValueExternalTrafficLocal,\n\t\t\t\tapi.BetaAnnotationHealthCheckNodePort: \"-1\",\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\treturn\n\t}\n\tt.Errorf(\"Unexpected creation of service with invalid HealthCheckNodePort specified\")\n}", "func TestNewInstance(t *testing.T) {\n\tif _, err := NewInstance(nil); err == nil {\n\t\tt.Error(\"NewInstance: expected error with nil database handle\")\n\t}\n\n\tRunWithDB(func(db *sql.DB) {\n\t\tif _, err := NewInstance(db); err != nil {\n\t\t\tt.Fatal(\"NewInstance: got error:\\n\", err)\n\t\t}\n\t})\n}", "func CheckPaymentToBeta() {\n\tbrokerTxs, _ := models.GetTransactionsBySessionTypesAndPaymentStatuses([]int{},\n\t\t[]models.PaymentStatus{models.BrokerTxBetaPaymentPending})\n\n\tfor _, brokerTx := range brokerTxs {\n\t\tbalance := EthWrapper.CheckPRLBalance(eth_gateway.StringToAddress(brokerTx.ETHAddrBeta))\n\t\texpectedBalance := new(big.Int).Quo(brokerTx.GetTotalCostInWei(), big.NewInt(int64(2)))\n\t\tif balance.Int64() > 0 && balance.Int64() >= expectedBalance.Int64() {\n\t\t\tpreviousBetaPaymentStatus := brokerTx.PaymentStatus\n\t\t\tbrokerTx.PaymentStatus = models.BrokerTxBetaPaymentConfirmed\n\t\t\terr := models.DB.Save(&brokerTx)\n\t\t\tif err != nil {\n\t\t\t\toyster_utils.LogIfError(err, nil)\n\t\t\t\tbrokerTx.PaymentStatus = previousBetaPaymentStatus\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif brokerTx.Type == models.SessionTypeBeta {\n\t\t\t\tReportGoodAlphaToDRS(brokerTx)\n\t\t\t}\n\t\t\toyster_utils.LogToSegment(\"check_beta_payments: CheckPaymentToBeta - beta_confirmed\",\n\t\t\t\tanalytics.NewProperties().\n\t\t\t\t\tSet(\"beta_address\", brokerTx.ETHAddrBeta).\n\t\t\t\t\tSet(\"alpha_address\", brokerTx.ETHAddrAlpha))\n\t\t}\n\t}\n}", "func (s *stepCreateInstance) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {\n\tclient := state.Get(\"client\").(*civogo.Client)\n\tui := state.Get(\"ui\").(packer.Ui)\n\tc := state.Get(\"config\").(*Config)\n\tsshKeyID := state.Get(\"ssh_key_id\").(string)\n\n\t// Create the instance based on configuration\n\tui.Say(\"Creating instance...\")\n\n\ttemplate, err := client.FindTemplate(c.Template)\n\tif err != nil {\n\t\tui.Error(err.Error())\n\t}\n\n\tnetwork, _ := client.GetDefaultNetwork()\n\n\tInstanceConfig := &civogo.InstanceConfig{\n\t\tHostname: c.InstanceName,\n\t\tPublicIPRequired: c.PublicNetworking,\n\t\tRegion: c.Region,\n\t\tNetworkID: network.ID,\n\t\tInitialUser: c.Comm.SSHUsername,\n\t\tSize: c.Size,\n\t\tTemplateID: template.ID,\n\t\tSSHKeyID: sshKeyID,\n\t}\n\n\tlog.Printf(\"[DEBUG] Instance create paramaters: %+v\", InstanceConfig)\n\n\tinstance, err := client.CreateInstance(InstanceConfig)\n\tif err != nil {\n\t\terr := fmt.Errorf(\"Error creating instance: %s\", err)\n\t\tstate.Put(\"error\", err)\n\t\tui.Error(err.Error())\n\t\treturn multistep.ActionHalt\n\t}\n\n\t// We use this in cleanup\n\ts.instanceID = instance.ID\n\n\t// Store the instance id for later\n\tstate.Put(\"instance_id\", instance.ID)\n\n\treturn multistep.ActionContinue\n}", "func TestBetaToAlphaConversion(t *testing.T) {\n\ttests := []struct {\n\t\tname string\n\t\tinput *v1beta1.ArgoCD\n\t\texpectedOutput *ArgoCD\n\t}{\n\t\t{\n\t\t\tname: \"ArgoCD Example - Empty\",\n\t\t\tinput: makeTestArgoCDBeta(func(cr *v1beta1.ArgoCD) {}),\n\t\t\texpectedOutput: makeTestArgoCDAlpha(func(cr *ArgoCD) {}),\n\t\t},\n\t\t{\n\t\t\tname: \"ArgoCD Example - Image + ExtraConfig\",\n\t\t\tinput: makeTestArgoCDBeta(func(cr *v1beta1.ArgoCD) {\n\t\t\t\tcr.Spec.Image = \"test-image\"\n\t\t\t\tcr.Spec.ExtraConfig = map[string]string{\n\t\t\t\t\t\"ping\": \"pong\",\n\t\t\t\t}\n\t\t\t}),\n\t\t\texpectedOutput: makeTestArgoCDAlpha(func(cr *ArgoCD) {\n\t\t\t\tcr.Spec.Image = \"test-image\"\n\t\t\t\tcr.Spec.ExtraConfig = map[string]string{\n\t\t\t\t\t\"ping\": \"pong\",\n\t\t\t\t}\n\t\t\t}),\n\t\t},\n\t\t{\n\t\t\tname: \"ArgoCD Example - Dex + RBAC\",\n\t\t\tinput: makeTestArgoCDBeta(func(cr *v1beta1.ArgoCD) {\n\t\t\t\tcr.Spec.SSO = &v1beta1.ArgoCDSSOSpec{\n\t\t\t\t\tProvider: v1beta1.SSOProviderTypeDex,\n\t\t\t\t\tDex: &v1beta1.ArgoCDDexSpec{\n\t\t\t\t\t\tOpenShiftOAuth: true,\n\t\t\t\t\t},\n\t\t\t\t}\n\n\t\t\t\tdefaultPolicy := \"role:readonly\"\n\t\t\t\tpolicy := \"g, system:cluster-admins, role:admin\"\n\t\t\t\tscope := \"[groups]\"\n\t\t\t\tcr.Spec.RBAC = v1beta1.ArgoCDRBACSpec{\n\t\t\t\t\tDefaultPolicy: &defaultPolicy,\n\t\t\t\t\tPolicy: &policy,\n\t\t\t\t\tScopes: &scope,\n\t\t\t\t}\n\n\t\t\t\tcr.Spec.Server = v1beta1.ArgoCDServerSpec{\n\t\t\t\t\tRoute: v1beta1.ArgoCDRouteSpec{\n\t\t\t\t\t\tEnabled: true,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t}),\n\t\t\texpectedOutput: makeTestArgoCDAlpha(func(cr *ArgoCD) {\n\t\t\t\tcr.Spec.SSO = &ArgoCDSSOSpec{\n\t\t\t\t\tProvider: SSOProviderTypeDex,\n\t\t\t\t\tDex: &ArgoCDDexSpec{\n\t\t\t\t\t\tOpenShiftOAuth: true,\n\t\t\t\t\t},\n\t\t\t\t}\n\n\t\t\t\tdefaultPolicy := \"role:readonly\"\n\t\t\t\tpolicy := \"g, system:cluster-admins, role:admin\"\n\t\t\t\tscope := \"[groups]\"\n\t\t\t\tcr.Spec.RBAC = ArgoCDRBACSpec{\n\t\t\t\t\tDefaultPolicy: &defaultPolicy,\n\t\t\t\t\tPolicy: &policy,\n\t\t\t\t\tScopes: &scope,\n\t\t\t\t}\n\n\t\t\t\tcr.Spec.Server = ArgoCDServerSpec{\n\t\t\t\t\tRoute: ArgoCDRouteSpec{\n\t\t\t\t\t\tEnabled: true,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t}),\n\t\t},\n\t}\n\tfor _, test := range tests {\n\t\tt.Run(test.name, func(t *testing.T) {\n\n\t\t\t// Add input v1beta1 object in Hub\n\t\t\tvar hub conversion.Hub = test.input\n\n\t\t\tresult := &ArgoCD{}\n\t\t\t// Call ConvertFrom function to convert v1beta1 version to v1alpha\n\t\t\tresult.ConvertFrom(hub)\n\n\t\t\t// Compare converted object with expected.\n\t\t\tassert.Equal(t, test.expectedOutput, result)\n\t\t})\n\t}\n}", "func CheckBetaPayments(thresholdDuration time.Duration, PrometheusWrapper services.PrometheusService) {\n\tstart := PrometheusWrapper.TimeNow()\n\tdefer PrometheusWrapper.HistogramSeconds(PrometheusWrapper.HistogramCheckBetaPayments, start)\n\n\tCheckPaymentToBeta()\n\n\tHandleErrorTransactionsIfAlpha()\n\n\tHandleTimedOutTransactionsIfAlpha(thresholdDuration)\n\t/* make beta wait 3x as long as alpha so alpha has some chances to retry */\n\tHandleTimedOutBetaPaymentIfBeta(thresholdDuration * time.Duration(3))\n\n\tPurgeCompletedTransactions()\n}", "func NewCfnInstance_Override(c CfnInstance, scope awscdk.Construct, id *string, props *CfnInstanceProps) {\n\t_init_.Initialize()\n\n\t_jsii_.Create(\n\t\t\"monocdk.aws_opsworks.CfnInstance\",\n\t\t[]interface{}{scope, id, props},\n\t\tc,\n\t)\n}", "func ExampleRDS_CreateBlueGreenDeployment_shared00() {\n\tsvc := rds.New(session.New())\n\tinput := &rds.CreateBlueGreenDeploymentInput{\n\t\tBlueGreenDeploymentName: aws.String(\"bgd-test-instance\"),\n\t\tSource: aws.String(\"arn:aws:rds:us-east-1:123456789012:db:my-db-instance\"),\n\t\tTargetDBParameterGroupName: aws.String(\"mysql-80-group\"),\n\t\tTargetEngineVersion: aws.String(\"8.0\"),\n\t}\n\n\tresult, err := svc.CreateBlueGreenDeployment(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.ErrCodeDBInstanceNotFoundFault:\n\t\t\t\tfmt.Println(rds.ErrCodeDBInstanceNotFoundFault, aerr.Error())\n\t\t\tcase rds.ErrCodeDBClusterNotFoundFault:\n\t\t\t\tfmt.Println(rds.ErrCodeDBClusterNotFoundFault, aerr.Error())\n\t\t\tcase rds.ErrCodeSourceDatabaseNotSupportedFault:\n\t\t\t\tfmt.Println(rds.ErrCodeSourceDatabaseNotSupportedFault, aerr.Error())\n\t\t\tcase rds.ErrCodeSourceClusterNotSupportedFault:\n\t\t\t\tfmt.Println(rds.ErrCodeSourceClusterNotSupportedFault, aerr.Error())\n\t\t\tcase rds.ErrCodeBlueGreenDeploymentAlreadyExistsFault:\n\t\t\t\tfmt.Println(rds.ErrCodeBlueGreenDeploymentAlreadyExistsFault, aerr.Error())\n\t\t\tcase rds.ErrCodeDBParameterGroupNotFoundFault:\n\t\t\t\tfmt.Println(rds.ErrCodeDBParameterGroupNotFoundFault, aerr.Error())\n\t\t\tcase rds.ErrCodeDBClusterParameterGroupNotFoundFault:\n\t\t\t\tfmt.Println(rds.ErrCodeDBClusterParameterGroupNotFoundFault, aerr.Error())\n\t\t\tcase rds.ErrCodeInstanceQuotaExceededFault:\n\t\t\t\tfmt.Println(rds.ErrCodeInstanceQuotaExceededFault, aerr.Error())\n\t\t\tcase rds.ErrCodeDBClusterQuotaExceededFault:\n\t\t\t\tfmt.Println(rds.ErrCodeDBClusterQuotaExceededFault, aerr.Error())\n\t\t\tcase rds.ErrCodeInvalidDBInstanceStateFault:\n\t\t\t\tfmt.Println(rds.ErrCodeInvalidDBInstanceStateFault, 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 CreateBuiltinAssign() *functions.BuiltinFunction {\n\treturn functions.NewBuiltinFunction(Assign, 2, false)\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 (o *InlineObject885) GetBeta() AnyOfobject {\n\tif o == nil || o.Beta == nil {\n\t\tvar ret AnyOfobject\n\t\treturn ret\n\t}\n\treturn *o.Beta\n}", "func (a *Agent) spawnInstance(ctx context.Context, c instance.Config) {\n\tinst, err := a.instanceFactory(a.cfg.Global, c, a.cfg.WALDir, a.logger)\n\tif err != nil {\n\t\tlevel.Error(a.logger).Log(\"msg\", \"failed to create instance\", \"err\", err)\n\t\treturn\n\t}\n\n\tfor {\n\t\terr = inst.Run(ctx)\n\t\tif err != nil && err != context.Canceled {\n\t\t\tinstanceAbnormalExits.WithLabelValues(c.Name).Inc()\n\t\t\tlevel.Error(a.logger).Log(\"msg\", \"instance stopped abnormally, restarting after backoff period\", \"err\", err, \"backoff\", a.cfg.InstanceRestartBackoff, \"instance\", c.Name)\n\t\t\ttime.Sleep(a.cfg.InstanceRestartBackoff)\n\t\t} else {\n\t\t\tlevel.Info(a.logger).Log(\"msg\", \"stopped instance\", \"instance\", c.Name)\n\t\t\tbreak\n\t\t}\n\t}\n}", "func ProtoToComputeBetaInstanceTemplatePropertiesShieldedInstanceConfig(p *betapb.ComputeBetaInstanceTemplatePropertiesShieldedInstanceConfig) *beta.InstanceTemplatePropertiesShieldedInstanceConfig {\n\tif p == nil {\n\t\treturn nil\n\t}\n\tobj := &beta.InstanceTemplatePropertiesShieldedInstanceConfig{\n\t\tEnableSecureBoot: dcl.Bool(p.EnableSecureBoot),\n\t\tEnableVtpm: dcl.Bool(p.EnableVtpm),\n\t\tEnableIntegrityMonitoring: dcl.Bool(p.EnableIntegrityMonitoring),\n\t}\n\treturn obj\n}", "func NewInstance(ctx *pulumi.Context,\n\tname string, args *InstanceArgs, opts ...pulumi.ResourceOption) (*Instance, error) {\n\tif args == nil || args.AvailabilityZone == nil {\n\t\treturn nil, errors.New(\"missing required argument 'AvailabilityZone'\")\n\t}\n\tif args == nil || args.BlueprintId == nil {\n\t\treturn nil, errors.New(\"missing required argument 'BlueprintId'\")\n\t}\n\tif args == nil || args.BundleId == nil {\n\t\treturn nil, errors.New(\"missing required argument 'BundleId'\")\n\t}\n\tif args == nil {\n\t\targs = &InstanceArgs{}\n\t}\n\tvar resource Instance\n\terr := ctx.RegisterResource(\"aws:lightsail/instance:Instance\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func newInstance(moduleName, name string, priv interface{}) (*BaseInstance, error) {\n\tm, found := modules[moduleName]\n\tif !found {\n\t\treturn nil, fmt.Errorf(\"No such module: %s\", moduleName)\n\t}\n\n\tif _, exists := m.instance[name]; exists {\n\t\treturn nil, fmt.Errorf(\"%s already exists in %s\", name, moduleName)\n\t}\n\n\tbi := &BaseInstance{name: name, module: m, subinstance: false}\n\n\tringName := fmt.Sprintf(\"input-%s\", name)\n\tbi.input = dpdk.RingCreate(ringName, m.ringParam.Count, m.ringParam.SocketId, dpdk.RING_F_SC_DEQ)\n\tif bi.input == nil {\n\t\treturn nil, fmt.Errorf(\"Input ring creation faild for %s.\\n\", name)\n\t}\n\n\tif m.ringParam.SecondaryInput {\n\t\tringName := fmt.Sprintf(\"input2-%s\", name)\n\t\tbi.input2 = dpdk.RingCreate(ringName, m.ringParam.Count, m.ringParam.SocketId, dpdk.RING_F_SC_DEQ)\n\t\tif bi.input2 == nil {\n\t\t\treturn nil, fmt.Errorf(\"Second input ring creation failed for %s\", name)\n\t\t}\n\t}\n\n\tbi.rules = newRules()\n\n\tif m.moduleType == TypeInterface || m.moduleType == TypeRIF {\n\t\tbi.counter = NewCounter()\n\t}\n\n\tinstance, err := m.factory(bi, priv)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Creating module '%s' with name '%s' failed: %v\\n\", moduleName, name, err)\n\t}\n\tbi.instance = instance\n\n\t// Set rule observer, if the module complies to RulesNotify.\n\tif rn, ok := instance.(RulesNotify); ok {\n\t\tbi.rules.setRulesNotify(rn)\n\t}\n\n\tm.instance[name] = bi\n\n\treturn bi, nil\n}", "func TestServiceRegistryExternalTrafficHealthCheckNodePortUserAllocationBeta(t *testing.T) {\n\trandomNodePort := generateRandomNodePort()\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.AnnotationValueExternalTrafficLocal,\n\t\t\t\tapi.BetaAnnotationHealthCheckNodePort: fmt.Sprintf(\"%v\", randomNodePort),\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.Fatalf(\"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 needed, returned health check not needed instead\")\n\t}\n\tport := service.GetServiceHealthCheckNodePort(created_service)\n\tif port == 0 {\n\t\tt.Errorf(\"Failed to allocate health check node port and set the HealthCheckNodePort\")\n\t}\n\tif port != randomNodePort {\n\t\tt.Errorf(\"Failed to allocate requested nodePort expected %d, got %d\", randomNodePort, port)\n\t}\n}", "func HandleTimedOutBetaPaymentIfBeta(thresholdDuration time.Duration) {\n\tthresholdTime := time.Now().Add(thresholdDuration)\n\tbrokerTxs, _ := models.GetTransactionsBySessionTypesPaymentStatusesAndTime([]int{models.SessionTypeBeta},\n\t\t[]models.PaymentStatus{models.BrokerTxBetaPaymentPending}, thresholdTime)\n\n\tfor _, brokerTx := range brokerTxs {\n\t\tReportBadAlphaToDRS(brokerTx)\n\t}\n}" ]
[ "0.6149344", "0.5985301", "0.59573394", "0.5785842", "0.5724574", "0.5653272", "0.5649381", "0.5632884", "0.5616224", "0.5358661", "0.53289026", "0.52633566", "0.52085924", "0.5206424", "0.51143473", "0.5080502", "0.5034272", "0.5008726", "0.4984484", "0.49833027", "0.49509183", "0.49439824", "0.4930785", "0.49218675", "0.49215028", "0.4921408", "0.48683167", "0.4804021", "0.47846246", "0.47638938", "0.47476268", "0.4730938", "0.47257045", "0.47161925", "0.47076407", "0.46917662", "0.46844858", "0.46818691", "0.46761814", "0.46422437", "0.46401754", "0.46319613", "0.4622453", "0.46187624", "0.4612814", "0.46047807", "0.4603208", "0.46003014", "0.45771405", "0.45707604", "0.4563237", "0.45373052", "0.4523872", "0.45156533", "0.45123333", "0.45021173", "0.44999567", "0.4472637", "0.44670033", "0.44626454", "0.4438055", "0.44319603", "0.44169638", "0.4395839", "0.43892902", "0.43879804", "0.43874857", "0.43811458", "0.43781134", "0.43755358", "0.43751165", "0.43706873", "0.43699884", "0.43665242", "0.4360869", "0.4359088", "0.4352676", "0.43512955", "0.43487713", "0.43370733", "0.43336275", "0.4330038", "0.43274906", "0.4326764", "0.43161577", "0.43135366", "0.43122366", "0.43092316", "0.43078664", "0.43070024", "0.4304864", "0.43032348", "0.43011802", "0.42985657", "0.4293552", "0.42915317", "0.42823035", "0.42713213", "0.4240923", "0.42407843" ]
0.746705
0
CreateInstanceAlpha uses the override method CreateInstanceAlphaFn or the real implementation.
func (c *TestClient) CreateInstanceAlpha(project, zone string, i *computeAlpha.Instance) error { if c.CreateInstanceBetaFn != nil { return c.CreateInstanceAlphaFn(project, zone, i) } return c.client.CreateInstanceAlpha(project, zone, i) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewAlpha(r Rectangle) *Alpha {\n\treturn &Alpha{\n\t\tPix: make([]uint8, pixelBufferLength(1, r, \"Alpha\")),\n\t\tStride: 1 * r.Dx(),\n\t\tRect: r,\n\t}\n}", "func AlphaFunc(xfunc uint32, ref float32) {\n\tsyscall.Syscall(gpAlphaFunc, 2, uintptr(xfunc), uintptr(math.Float32bits(ref)), 0)\n}", "func (c *TestClient) CreateInstanceBeta(project, zone string, i *computeBeta.Instance) error {\n\tif c.CreateInstanceBetaFn != nil {\n\t\treturn c.CreateInstanceBetaFn(project, zone, i)\n\t}\n\treturn c.client.CreateInstanceBeta(project, zone, i)\n}", "func (t *T) Alpha(name string, f interface{}) bool {\n\tt.Helper()\n\treturn t.invokeFeature(feature.Alpha, name, f)\n}", "func AlphaFunc(xfunc uint32, ref float32) {\n\tC.glowAlphaFunc(gpAlphaFunc, (C.GLenum)(xfunc), (C.GLfloat)(ref))\n}", "func AlphaFunc(xfunc uint32, ref float32) {\n C.glowAlphaFunc(gpAlphaFunc, (C.GLenum)(xfunc), (C.GLfloat)(ref))\n}", "func (tbl DbCompoundTable) CreateAlphaBetaIndex(ifNotExist bool) error {\n\tine := tbl.ternary(ifNotExist && tbl.Dialect() != schema.Mysql, \"IF NOT EXISTS \", \"\")\n\n\t// Mysql does not support 'if not exists' on indexes\n\t// Workaround: use DropIndex first and ignore an error returned if the index didn't exist.\n\n\tif ifNotExist && tbl.Dialect() == schema.Mysql {\n\t\t// low-level no-logging Exec\n\t\ttbl.Execer().ExecContext(tbl.ctx, tbl.dropDbAlphaBetaIndexSql(false))\n\t\tine = \"\"\n\t}\n\n\t_, err := tbl.Exec(nil, tbl.createDbAlphaBetaIndexSql(ine))\n\treturn err\n}", "func TestBetaToAlphaConversion(t *testing.T) {\n\ttests := []struct {\n\t\tname string\n\t\tinput *v1beta1.ArgoCD\n\t\texpectedOutput *ArgoCD\n\t}{\n\t\t{\n\t\t\tname: \"ArgoCD Example - Empty\",\n\t\t\tinput: makeTestArgoCDBeta(func(cr *v1beta1.ArgoCD) {}),\n\t\t\texpectedOutput: makeTestArgoCDAlpha(func(cr *ArgoCD) {}),\n\t\t},\n\t\t{\n\t\t\tname: \"ArgoCD Example - Image + ExtraConfig\",\n\t\t\tinput: makeTestArgoCDBeta(func(cr *v1beta1.ArgoCD) {\n\t\t\t\tcr.Spec.Image = \"test-image\"\n\t\t\t\tcr.Spec.ExtraConfig = map[string]string{\n\t\t\t\t\t\"ping\": \"pong\",\n\t\t\t\t}\n\t\t\t}),\n\t\t\texpectedOutput: makeTestArgoCDAlpha(func(cr *ArgoCD) {\n\t\t\t\tcr.Spec.Image = \"test-image\"\n\t\t\t\tcr.Spec.ExtraConfig = map[string]string{\n\t\t\t\t\t\"ping\": \"pong\",\n\t\t\t\t}\n\t\t\t}),\n\t\t},\n\t\t{\n\t\t\tname: \"ArgoCD Example - Dex + RBAC\",\n\t\t\tinput: makeTestArgoCDBeta(func(cr *v1beta1.ArgoCD) {\n\t\t\t\tcr.Spec.SSO = &v1beta1.ArgoCDSSOSpec{\n\t\t\t\t\tProvider: v1beta1.SSOProviderTypeDex,\n\t\t\t\t\tDex: &v1beta1.ArgoCDDexSpec{\n\t\t\t\t\t\tOpenShiftOAuth: true,\n\t\t\t\t\t},\n\t\t\t\t}\n\n\t\t\t\tdefaultPolicy := \"role:readonly\"\n\t\t\t\tpolicy := \"g, system:cluster-admins, role:admin\"\n\t\t\t\tscope := \"[groups]\"\n\t\t\t\tcr.Spec.RBAC = v1beta1.ArgoCDRBACSpec{\n\t\t\t\t\tDefaultPolicy: &defaultPolicy,\n\t\t\t\t\tPolicy: &policy,\n\t\t\t\t\tScopes: &scope,\n\t\t\t\t}\n\n\t\t\t\tcr.Spec.Server = v1beta1.ArgoCDServerSpec{\n\t\t\t\t\tRoute: v1beta1.ArgoCDRouteSpec{\n\t\t\t\t\t\tEnabled: true,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t}),\n\t\t\texpectedOutput: makeTestArgoCDAlpha(func(cr *ArgoCD) {\n\t\t\t\tcr.Spec.SSO = &ArgoCDSSOSpec{\n\t\t\t\t\tProvider: SSOProviderTypeDex,\n\t\t\t\t\tDex: &ArgoCDDexSpec{\n\t\t\t\t\t\tOpenShiftOAuth: true,\n\t\t\t\t\t},\n\t\t\t\t}\n\n\t\t\t\tdefaultPolicy := \"role:readonly\"\n\t\t\t\tpolicy := \"g, system:cluster-admins, role:admin\"\n\t\t\t\tscope := \"[groups]\"\n\t\t\t\tcr.Spec.RBAC = ArgoCDRBACSpec{\n\t\t\t\t\tDefaultPolicy: &defaultPolicy,\n\t\t\t\t\tPolicy: &policy,\n\t\t\t\t\tScopes: &scope,\n\t\t\t\t}\n\n\t\t\t\tcr.Spec.Server = ArgoCDServerSpec{\n\t\t\t\t\tRoute: ArgoCDRouteSpec{\n\t\t\t\t\t\tEnabled: true,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t}),\n\t\t},\n\t}\n\tfor _, test := range tests {\n\t\tt.Run(test.name, func(t *testing.T) {\n\n\t\t\t// Add input v1beta1 object in Hub\n\t\t\tvar hub conversion.Hub = test.input\n\n\t\t\tresult := &ArgoCD{}\n\t\t\t// Call ConvertFrom function to convert v1beta1 version to v1alpha\n\t\t\tresult.ConvertFrom(hub)\n\n\t\t\t// Compare converted object with expected.\n\t\t\tassert.Equal(t, test.expectedOutput, result)\n\t\t})\n\t}\n}", "func (px *Paxos) CreateInstance(seq int) {\n\n\t//create instance and update max if necessary\n\n\tpx.instances[seq] = &Instance{-1, -1, nil, false}\n\tif seq > px.maxSeq {\n\t\tpx.maxSeq = seq\n\t}\n}", "func ALPHA() operators.Operator {\n\treturn operators.Alts(\n\t\t\"ALPHA\",\n\t\toperators.Range(\"%x41-5A\", []byte{65}, []byte{90}),\n\t\toperators.Range(\"%x61-7A\", []byte{97}, []byte{122}),\n\t)\n}", "func newIngress(hostRules map[string]utils.FakeIngressRuleValueMap) *extensions.Ingress {\n\tret := &extensions.Ingress{\n\t\tTypeMeta: meta_v1.TypeMeta{\n\t\t\tKind: \"Ingress\",\n\t\t\tAPIVersion: \"extensions/v1beta1\",\n\t\t},\n\t\tObjectMeta: meta_v1.ObjectMeta{\n\t\t\tName: fmt.Sprintf(\"%v\", uuid.NewUUID()),\n\t\t\tNamespace: \"default\",\n\t\t},\n\t\tSpec: extensions.IngressSpec{\n\t\t\tBackend: &extensions.IngressBackend{\n\t\t\t\tServiceName: defaultBackendName(testClusterName),\n\t\t\t\tServicePort: testBackendPort,\n\t\t\t},\n\t\t\tRules: toIngressRules(hostRules),\n\t\t},\n\t\tStatus: extensions.IngressStatus{\n\t\t\tLoadBalancer: api_v1.LoadBalancerStatus{\n\t\t\t\tIngress: []api_v1.LoadBalancerIngress{\n\t\t\t\t\t{IP: testIPManager.ip()},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\tret.SelfLink = fmt.Sprintf(\"%s/%s\", ret.Namespace, ret.Name)\n\treturn ret\n}", "func Alpha(length int) string {\n\treturn Generate(\"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\", length)\n}", "func NewAlphabet(ctx *pulumi.Context,\n\tname string, args *AlphabetArgs, opts ...pulumi.ResourceOption) (*Alphabet, 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 Alphabet\n\terr := ctx.RegisterResource(\"vault:transform/alphabet:Alphabet\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func Test_GetOrCreateAccessKey_Create(t *testing.T) {\n\tctrl := gomock.NewController(t)\n\tdefer ctrl.Finish()\n\n\takService := getMockTokenServiceServer(ctrl)\n\tc := New(db, bdl, akService, &fakeClusterServiceServer{}, nil, &mock.MockPipelineServiceServer{})\n\n\tmonkey.PatchInstanceMethod(reflect.TypeOf(c), \"CheckCluster\", func(_ *Clusters, _ context.Context, _ string) error {\n\t\treturn nil\n\t})\n\n\tdefer monkey.UnpatchAll()\n\n\takResp, err := c.GetOrCreateAccessKey(context.Background(), fakeCluster)\n\tassert.NoError(t, err)\n\tassert.Equal(t, akResp, fakeAkItem)\n}", "func (r *ImageRef) AddAlpha() error {\n\tif vipsHasAlpha(r.image) {\n\t\treturn nil\n\t}\n\n\tout, err := vipsAddAlpha(r.image)\n\tif err != nil {\n\t\treturn err\n\t}\n\tr.setImage(out)\n\treturn nil\n}", "func (n *Node) Alpha(alpha float64) *Node {\n\treturn n.setAttr(\"alpha\", fmt.Sprintf(\"%.0f\", 65535.0*alpha))\n}", "func (s *Surface) Alpha() float64 {\n\treturn s.Ctx.Get(\"globalAlpha\").Float()\n}", "func NewAlphanumeric(val string) *Alphanumeric {\n\treturn &Alphanumeric{Value: val}\n}", "func CreateApplication() *Alpha {\n app := &Alpha{}\n app.Request = &Request{}\n app.Response = &Response{}\n app.init()\n return app\n}", "func doCreate(constructor func() base.IGameObject2D, isActive *bool) base.IGameObject2D {\r\n\tobj := constructor()\r\n\tobj.Obj().SetIGameObject2D(obj)\r\n\tapp.registerChannel <- resourceAccessRequest{\r\n\t\tpayload: obj,\r\n\t\tisActive: isActive,\r\n\t}\r\n\treturn obj\r\n}", "func LRNAlpha(value float32) LRNAttr {\n\treturn func(m optionalAttr) {\n\t\tm[\"alpha\"] = value\n\t}\n}", "func NewBetaGroupsCreateInstanceRequest(server string, body BetaGroupsCreateInstanceJSONRequestBody) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewBetaGroupsCreateInstanceRequestWithBody(server, \"application/json\", bodyReader)\n}", "func NewCreateACLAccepted() *CreateACLAccepted {\n\n\treturn &CreateACLAccepted{}\n}", "func NewAlpha16(r Rectangle) *Alpha16 {\n\treturn &Alpha16{\n\t\tPix: make([]uint8, pixelBufferLength(2, r, \"Alpha16\")),\n\t\tStride: 2 * r.Dx(),\n\t\tRect: r,\n\t}\n}", "func (a *Auth) NewActivationKey() {\n\ta.ActivationKey = []byte(uuid.New())\n\ta.ActivationExpires = time.Now().AddDate(0, 0, 7).Round(1 * time.Second).UTC()\n}", "func (pw *PixelWand) GetAlpha() float64 {\n\tret := float64(C.PixelGetAlpha(pw.pw))\n\truntime.KeepAlive(pw)\n\treturn ret\n}", "func Alpha(prefix string, length int) string {\n\treturn Runes(prefix, length, AlphaRunes)\n}", "func (b *Bitmap) AlphaImage() (*image.Alpha, error) {\n\tif b.handle.num_grays == 256 {\n\t\tsize := int(b.handle.rows * b.handle.width)\n\t\theader := reflect.SliceHeader{\n\t\t\tData: uintptr(unsafe.Pointer(b.handle.buffer)),\n\t\t\tLen: size,\n\t\t\tCap: size,\n\t\t}\n\t\treturn &image.Alpha{\n\t\t\tPix: *(*[]byte)(unsafe.Pointer(&header)),\n\t\t\tStride: int(b.handle.width),\n\t\t\tRect: image.Rect(0, 0, int(b.handle.width), int(b.handle.rows)),\n\t\t}, nil\n\t}\n\treturn nil, ErrUnsupportedPixelMode\n}", "func NewApi(apiKey string) *AlphaVantageApi {\n\treturn &AlphaVantageApi{apiKey: apiKey}\n}", "func (c *Client) CreateInstance(args *CreateInstanceArgs) (*CreateInstanceResult, error) {\n\tif len(args.AdminPass) > 0 {\n\t\tcryptedPass, err := Aes128EncryptUseSecreteKey(c.Config.Credentials.SecretAccessKey, args.AdminPass)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\targs.AdminPass = cryptedPass\n\t}\n\n\tif args.RootDiskSizeInGb <= 0 {\n\t\targs.RootDiskSizeInGb = 20\n\t}\n\n\tif args.PurchaseCount < 1 {\n\t\targs.PurchaseCount = 1\n\t}\n\n\tjsonBytes, jsonErr := json.Marshal(args)\n\tif jsonErr != nil {\n\t\treturn nil, jsonErr\n\t}\n\tbody, err := bce.NewBodyFromBytes(jsonBytes)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn CreateInstance(c, args, body)\n}", "func NewBetaAppLocalizationsCreateInstanceRequest(server string, body BetaAppLocalizationsCreateInstanceJSONRequestBody) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewBetaAppLocalizationsCreateInstanceRequestWithBody(server, \"application/json\", bodyReader)\n}", "func NewBetaTestersCreateInstanceRequest(server string, body BetaTestersCreateInstanceJSONRequestBody) (*http.Request, error) {\n\tvar bodyReader io.Reader\n\tbuf, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbodyReader = bytes.NewReader(buf)\n\treturn NewBetaTestersCreateInstanceRequestWithBody(server, \"application/json\", bodyReader)\n}", "func NewAbc(alphabet string, seed uint64) (Abc, error) {\n\trunes := []rune(alphabet)\n\tif len(runes) != len(DefaultABC) {\n\t\treturn Abc{}, fmt.Errorf(\"alphabet must contain %v unique characters\", len(DefaultABC))\n\t}\n\tif nonUnique(runes) {\n\t\treturn Abc{}, errors.New(\"alphabet must contain unique characters only\")\n\t}\n\tabc := Abc{alphabet: nil}\n\tabc.shuffle(alphabet, seed)\n\treturn abc, nil\n}", "func NewCreateInstance(name string, plan string, team string) *CreateInstance {\n\tthis := CreateInstance{}\n\tthis.Name = name\n\tthis.Plan = plan\n\tthis.Team = team\n\treturn &this\n}", "func NewCreateInstanceWithDefaults() *CreateInstance {\n\tthis := CreateInstance{}\n\treturn &this\n}", "func (p *OnPrem) CreateInstance(ctx *Context) error {\n\tc := ctx.config\n\n\thypervisor := HypervisorInstance()\n\tif hypervisor == nil {\n\t\tfmt.Println(\"No hypervisor found on $PATH\")\n\t\tfmt.Println(\"Please install OPS using curl https://ops.city/get.sh -sSfL | sh\")\n\t\tos.Exit(1)\n\t}\n\n\tinstancename := c.CloudConfig.ImageName\n\n\tfmt.Printf(\"booting %s ...\\n\", instancename)\n\n\topshome := GetOpsHome()\n\timgpath := path.Join(opshome, \"images\", instancename)\n\n\tc.RunConfig.BaseName = instancename\n\tc.RunConfig.Imagename = imgpath\n\tc.RunConfig.OnPrem = true\n\n\thypervisor.Start(&c.RunConfig)\n\n\treturn nil\n}", "func (a *ACMEInstance) CreateInstance(challenge, dir, domains, domainIPs, dnsManager string, revoke bool, serverK server.KeyInstance, clientK client.KeyInstanceCert) {\n\n\tif ok := supportedChallenges[challenge]; !ok {\n\t\tfmt.Fprintln(os.Stderr, \"unsupported challengeType: \", challenge)\n\t\tos.Exit(2)\n\t}\n\ta.challengeType = challenge\n\ta.dirURL = dir\n\ta.domainList = strings.Split(domains, \";\")\n\n\tipList := strings.Split(domainIPs, \";\")\n\tipDom := make(map[string]string)\n\tfor n, domain := range a.domainList {\n\t\tipDom[domain] = ipList[n]\n\t}\n\ta.ipForDomain = ipDom\n\n\tif dnsManager == \"azuredns\" {\n\t\ta.dnsManager = dnsmanager.AZUREDNSCredentials{Login: \"dummyuser\",\n\t\t\tPassword: \"1234\",\n\t\t\tSubscriptionID: \"9fa587f1-4961-48a6-b6f6-ec69c6d724f1\",\n\t\t\tResourceGroups: \"fileTransfer\",\n\t\t\tAuthorization: \"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Imh1Tjk1SXZQZmVocTM0R3pCRFoxR1hHaXJuTSIsImtpZCI6Imh1Tjk1SXZQZmVocTM0R3pCRFoxR1hHaXJuTSJ9.eyJhdWQiOiJodHRwczovL21hbmFnZW1lbnQuY29yZS53aW5kb3dzLm5ldC8iLCJpc3MiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC9mMDhhODUxZS1hYzVjLTQ5NGItODk0MS00N2U2YTI2NTc4MWQvIiwiaWF0IjoxNTk3MDY5Njc5LCJuYmYiOjE1OTcwNjk2NzksImV4cCI6MTU5NzA3MzU3OSwiYWNyIjoiMSIsImFpbyI6IkFTUUEyLzhRQUFBQWJPNHQrWW5pYVp2NEUzRG4rYUdGOGxVc25RZzhJQ1VHNS9yZitLMEFrcWM9IiwiYW1yIjpbInB3ZCJdLCJhcHBpZCI6IjdmNTlhNzczLTJlYWYtNDI5Yy1hMDU5LTUwZmM1YmIyOGI0NCIsImFwcGlkYWNyIjoiMiIsImZhbWlseV9uYW1lIjoiTWVpZXIiLCJnaXZlbl9uYW1lIjoiRmlsaXAiLCJncm91cHMiOlsiNzA5YzZmM2YtNTEwYy00NTgwLTlkMGYtYzQ1OWJiMTcyMDE3Il0sImlwYWRkciI6IjUxLjE1NC41My4xNjUiLCJuYW1lIjoiRmlsaXAgTWVpZXIiLCJvaWQiOiJmMGNhMzk3Ni1lNjBlLTQzZDItYTM0ZS0wMDZhZGRlNDVhYmIiLCJwdWlkIjoiMTAwMzIwMDA2QjI2MUZDNyIsInJoIjoiMC5BVHdBSG9XSzhGeXNTMG1KUVVmbW9tVjRIWE9uV1gtdkxweENvRmxRX0Z1eWkwUThBTTQuIiwic2NwIjoidXNlcl9pbXBlcnNvbmF0aW9uIiwic3ViIjoiMzlKdHpVVUFCOFNYNWRWRVBOYWJsZzFiUkp5MkhGdW43TEZDRktxamRlVSIsInRpZCI6ImYwOGE4NTFlLWFjNWMtNDk0Yi04OTQxLTQ3ZTZhMjY1NzgxZCIsInVuaXF1ZV9uYW1lIjoiZmlsaXAubWVpZXJAOGRheXNhd2Vlay5jYyIsInVwbiI6ImZpbGlwLm1laWVyQDhkYXlzYXdlZWsuY2MiLCJ1dGkiOiJ1aXBUU3VVTmhrYXdqckpyNzRSSkFBIiwidmVyIjoiMS4wIiwid2lkcyI6WyI2MmU5MDM5NC02OWY1LTQyMzctOTE5MC0wMTIxNzcxNDVlMTAiXSwieG1zX3RjZHQiOjE1NjgxODgyNzZ9.nzU-Yj1uwpqPqcUJVE7iKunPtTCwFbQ4_pE-EiAiVGWpzi6A2e1t9YAW6s2BqnHVltNDO2xBJRZgyjSuetCekuX_nxvwZIU4hDppl5lrt6O85-PtQrYR34DOa05O2fg7a53lhP_b5uSy3XexZpqwNvpbC0dqAictuv59kN6rlZQyUoP_J70jVx-WhXwGQNpgn9uDs11SDgxioKIgrDh0rA1q0kJxJ-4pLbO6l2B2KfL0lrkSJinKFPslwhRhKTHFhqVbdSkiFV7gyK-Kc13iGzXUiB2aHu3M6B-Yy5fmRoF4SMFqFJelLvlctDPUiLK8b9_qQpX60aYIEnbur4amtg\",\n\t\t}\n\t}\n\n\ta.revokeCert = revoke\n\n\ta.challengeStatusMap = make(map[string]ChallengeStatus)\n\ta.challangeCreated = make(map[string]bool)\n\n\ta.serverKey = serverK //used to communicate with ACME server\n\ta.clientKey = clientK\n\n}", "func New(name string) (*Service, error) {\n\tname = ValidFunction(name)\n\tif name != \"\" {\n\t\treturn &Service{\n\t\t\tname: name,\n\t\t}, nil\n\t}\n\treturn nil, fmt.Errorf(\"invalid activation function: %v. Activation Functions should be amongst: %v\", name, activationFunctions)\n}", "func (g *PublicGenerator) Generate(idx uint32) *AcctPublicKey {\n\tk := g.hashGenerate(idx)\n\tx2, y2 := curve.ScalarBaseMult(k.Bytes())\n\n\tx, y := curve.Add(g.X, g.Y, x2, y2)\n\t//cp := curve.CompressPoint(x, y)\n\tkey := &ecdsa.PublicKey{\n\t\tCurve: curve,\n\t\tX: x,\n\t\tY: y,\n\t}\n\treturn (*AcctPublicKey)(key)\n}", "func (o *InlineObject885) SetAlpha(v AnyOfobject) {\n\to.Alpha = &v\n}", "func (r *ImageRef) HasAlpha() bool {\n\treturn vipsHasAlpha(r.image)\n}", "func New(host, key string) *AlphaSOCClient {\n\treturn &AlphaSOCClient{\n\t\tclient: &http.Client{},\n\t\thost: strings.TrimSuffix(host, \"/\"),\n\t\tversion: DefaultVersion,\n\t\tkey: key,\n\t}\n}", "func (self *TraitPixbuf) AddAlpha(substitute_color bool, r uint8, g uint8, b uint8) (return__ *Pixbuf) {\n\t__cgo__substitute_color := C.gboolean(0)\n\tif substitute_color {\n\t\t__cgo__substitute_color = C.gboolean(1)\n\t}\n\tvar __cgo__return__ *C.GdkPixbuf\n\t__cgo__return__ = C.gdk_pixbuf_add_alpha(self.CPointer, __cgo__substitute_color, C.guchar(r), C.guchar(g), C.guchar(b))\n\tif __cgo__return__ != nil {\n\t\treturn__ = NewPixbufFromCPointer(unsafe.Pointer(reflect.ValueOf(__cgo__return__).Pointer()))\n\t}\n\treturn\n}", "func NewTransparent(r, g, b, a byte) Color {\n\treturn Color{r, g, b, a}\n}", "func New(period time.Duration) *ExponentialMovingAverage {\n\treturn &ExponentialMovingAverage{\n\t\tmu: sync.Mutex{},\n\t\tt: time.Now(),\n\t\tperiod: period.Seconds(),\n\t}\n}", "func (client BaseClient) CreateFeatureInstance(ctx context.Context, body *FeatureInstanceInputs) (result FeatureInstance, err error) {\n\tif err := validation.Validate([]validation.Validation{\n\t\t{TargetValue: body,\n\t\t\tConstraints: []validation.Constraint{{Target: \"body\", Name: validation.Null, Rule: false,\n\t\t\t\tChain: []validation.Constraint{{Target: \"body.FeatureName\", Name: validation.Null, Rule: true,\n\t\t\t\t\tChain: []validation.Constraint{{Target: \"body.FeatureName\", Name: validation.Pattern, Rule: `^[a-z0-9-]+$`, Chain: nil}}},\n\t\t\t\t\t{Target: \"body.FeatureVersion\", Name: validation.Null, Rule: true,\n\t\t\t\t\t\tChain: []validation.Constraint{{Target: \"body.FeatureVersion\", Name: validation.Pattern, Rule: `^v?((\\d+)\\.(\\d+)\\.(\\d+))(?:-([\\dA-Za-z\\-]+(?:\\.[\\dA-Za-z\\-]+)*))?(?:\\+([\\dA-Za-z\\-]+(?:\\.[\\dA-Za-z\\-]+)*))?$`, Chain: nil}}},\n\t\t\t\t\t{Target: \"body.InstanceName\", Name: validation.Null, Rule: true,\n\t\t\t\t\t\tChain: []validation.Constraint{{Target: \"body.InstanceName\", Name: validation.Pattern, Rule: `^[a-z0-9-]+$`, Chain: nil}}},\n\t\t\t\t}}}}}); err != nil {\n\t\treturn result, validation.NewError(\"beacon.BaseClient\", \"CreateFeatureInstance\", err.Error())\n\t}\n\n\treq, err := client.CreateFeatureInstancePreparer(ctx, body)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"beacon.BaseClient\", \"CreateFeatureInstance\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.CreateFeatureInstanceSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"beacon.BaseClient\", \"CreateFeatureInstance\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.CreateFeatureInstanceResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"beacon.BaseClient\", \"CreateFeatureInstance\", resp, \"Failure responding to request\")\n\t}\n\n\treturn\n}", "func NewTweenI(args ...interface{}) *Tween {\n return &Tween{js.Global.Get(\"Phaser\").Get(\"Tween\").New(args)}\n}", "func NewDemoInstance() interface{} {\n\treturn new(DemoInstance)\n}", "func InitWithProcAddrFunc(getProcAddr func(name string) unsafe.Pointer) error {\n\tgpAccum = (C.GPACCUM)(getProcAddr(\"glAccum\"))\n\tif gpAccum == nil {\n\t\treturn errors.New(\"glAccum\")\n\t}\n\tgpAccumxOES = (C.GPACCUMXOES)(getProcAddr(\"glAccumxOES\"))\n\tgpAcquireKeyedMutexWin32EXT = (C.GPACQUIREKEYEDMUTEXWIN32EXT)(getProcAddr(\"glAcquireKeyedMutexWin32EXT\"))\n\tgpActiveProgramEXT = (C.GPACTIVEPROGRAMEXT)(getProcAddr(\"glActiveProgramEXT\"))\n\tgpActiveShaderProgram = (C.GPACTIVESHADERPROGRAM)(getProcAddr(\"glActiveShaderProgram\"))\n\tif gpActiveShaderProgram == nil {\n\t\treturn errors.New(\"glActiveShaderProgram\")\n\t}\n\tgpActiveShaderProgramEXT = (C.GPACTIVESHADERPROGRAMEXT)(getProcAddr(\"glActiveShaderProgramEXT\"))\n\tgpActiveStencilFaceEXT = (C.GPACTIVESTENCILFACEEXT)(getProcAddr(\"glActiveStencilFaceEXT\"))\n\tgpActiveTexture = (C.GPACTIVETEXTURE)(getProcAddr(\"glActiveTexture\"))\n\tif gpActiveTexture == nil {\n\t\treturn errors.New(\"glActiveTexture\")\n\t}\n\tgpActiveTextureARB = (C.GPACTIVETEXTUREARB)(getProcAddr(\"glActiveTextureARB\"))\n\tgpActiveVaryingNV = (C.GPACTIVEVARYINGNV)(getProcAddr(\"glActiveVaryingNV\"))\n\tgpAlphaFragmentOp1ATI = (C.GPALPHAFRAGMENTOP1ATI)(getProcAddr(\"glAlphaFragmentOp1ATI\"))\n\tgpAlphaFragmentOp2ATI = (C.GPALPHAFRAGMENTOP2ATI)(getProcAddr(\"glAlphaFragmentOp2ATI\"))\n\tgpAlphaFragmentOp3ATI = (C.GPALPHAFRAGMENTOP3ATI)(getProcAddr(\"glAlphaFragmentOp3ATI\"))\n\tgpAlphaFunc = (C.GPALPHAFUNC)(getProcAddr(\"glAlphaFunc\"))\n\tif gpAlphaFunc == nil {\n\t\treturn errors.New(\"glAlphaFunc\")\n\t}\n\tgpAlphaFuncxOES = (C.GPALPHAFUNCXOES)(getProcAddr(\"glAlphaFuncxOES\"))\n\tgpAlphaToCoverageDitherControlNV = (C.GPALPHATOCOVERAGEDITHERCONTROLNV)(getProcAddr(\"glAlphaToCoverageDitherControlNV\"))\n\tgpApplyFramebufferAttachmentCMAAINTEL = (C.GPAPPLYFRAMEBUFFERATTACHMENTCMAAINTEL)(getProcAddr(\"glApplyFramebufferAttachmentCMAAINTEL\"))\n\tgpApplyTextureEXT = (C.GPAPPLYTEXTUREEXT)(getProcAddr(\"glApplyTextureEXT\"))\n\tgpAreProgramsResidentNV = (C.GPAREPROGRAMSRESIDENTNV)(getProcAddr(\"glAreProgramsResidentNV\"))\n\tgpAreTexturesResident = (C.GPARETEXTURESRESIDENT)(getProcAddr(\"glAreTexturesResident\"))\n\tif gpAreTexturesResident == nil {\n\t\treturn errors.New(\"glAreTexturesResident\")\n\t}\n\tgpAreTexturesResidentEXT = (C.GPARETEXTURESRESIDENTEXT)(getProcAddr(\"glAreTexturesResidentEXT\"))\n\tgpArrayElement = (C.GPARRAYELEMENT)(getProcAddr(\"glArrayElement\"))\n\tif gpArrayElement == nil {\n\t\treturn errors.New(\"glArrayElement\")\n\t}\n\tgpArrayElementEXT = (C.GPARRAYELEMENTEXT)(getProcAddr(\"glArrayElementEXT\"))\n\tgpArrayObjectATI = (C.GPARRAYOBJECTATI)(getProcAddr(\"glArrayObjectATI\"))\n\tgpAsyncCopyBufferSubDataNVX = (C.GPASYNCCOPYBUFFERSUBDATANVX)(getProcAddr(\"glAsyncCopyBufferSubDataNVX\"))\n\tgpAsyncCopyImageSubDataNVX = (C.GPASYNCCOPYIMAGESUBDATANVX)(getProcAddr(\"glAsyncCopyImageSubDataNVX\"))\n\tgpAsyncMarkerSGIX = (C.GPASYNCMARKERSGIX)(getProcAddr(\"glAsyncMarkerSGIX\"))\n\tgpAttachObjectARB = (C.GPATTACHOBJECTARB)(getProcAddr(\"glAttachObjectARB\"))\n\tgpAttachShader = (C.GPATTACHSHADER)(getProcAddr(\"glAttachShader\"))\n\tif gpAttachShader == nil {\n\t\treturn errors.New(\"glAttachShader\")\n\t}\n\tgpBegin = (C.GPBEGIN)(getProcAddr(\"glBegin\"))\n\tif gpBegin == nil {\n\t\treturn errors.New(\"glBegin\")\n\t}\n\tgpBeginConditionalRender = (C.GPBEGINCONDITIONALRENDER)(getProcAddr(\"glBeginConditionalRender\"))\n\tif gpBeginConditionalRender == nil {\n\t\treturn errors.New(\"glBeginConditionalRender\")\n\t}\n\tgpBeginConditionalRenderNV = (C.GPBEGINCONDITIONALRENDERNV)(getProcAddr(\"glBeginConditionalRenderNV\"))\n\tgpBeginConditionalRenderNVX = (C.GPBEGINCONDITIONALRENDERNVX)(getProcAddr(\"glBeginConditionalRenderNVX\"))\n\tgpBeginFragmentShaderATI = (C.GPBEGINFRAGMENTSHADERATI)(getProcAddr(\"glBeginFragmentShaderATI\"))\n\tgpBeginOcclusionQueryNV = (C.GPBEGINOCCLUSIONQUERYNV)(getProcAddr(\"glBeginOcclusionQueryNV\"))\n\tgpBeginPerfMonitorAMD = (C.GPBEGINPERFMONITORAMD)(getProcAddr(\"glBeginPerfMonitorAMD\"))\n\tgpBeginPerfQueryINTEL = (C.GPBEGINPERFQUERYINTEL)(getProcAddr(\"glBeginPerfQueryINTEL\"))\n\tgpBeginQuery = (C.GPBEGINQUERY)(getProcAddr(\"glBeginQuery\"))\n\tif gpBeginQuery == nil {\n\t\treturn errors.New(\"glBeginQuery\")\n\t}\n\tgpBeginQueryARB = (C.GPBEGINQUERYARB)(getProcAddr(\"glBeginQueryARB\"))\n\tgpBeginQueryIndexed = (C.GPBEGINQUERYINDEXED)(getProcAddr(\"glBeginQueryIndexed\"))\n\tif gpBeginQueryIndexed == nil {\n\t\treturn errors.New(\"glBeginQueryIndexed\")\n\t}\n\tgpBeginTransformFeedback = (C.GPBEGINTRANSFORMFEEDBACK)(getProcAddr(\"glBeginTransformFeedback\"))\n\tif gpBeginTransformFeedback == nil {\n\t\treturn errors.New(\"glBeginTransformFeedback\")\n\t}\n\tgpBeginTransformFeedbackEXT = (C.GPBEGINTRANSFORMFEEDBACKEXT)(getProcAddr(\"glBeginTransformFeedbackEXT\"))\n\tgpBeginTransformFeedbackNV = (C.GPBEGINTRANSFORMFEEDBACKNV)(getProcAddr(\"glBeginTransformFeedbackNV\"))\n\tgpBeginVertexShaderEXT = (C.GPBEGINVERTEXSHADEREXT)(getProcAddr(\"glBeginVertexShaderEXT\"))\n\tgpBeginVideoCaptureNV = (C.GPBEGINVIDEOCAPTURENV)(getProcAddr(\"glBeginVideoCaptureNV\"))\n\tgpBindAttribLocation = (C.GPBINDATTRIBLOCATION)(getProcAddr(\"glBindAttribLocation\"))\n\tif gpBindAttribLocation == nil {\n\t\treturn errors.New(\"glBindAttribLocation\")\n\t}\n\tgpBindAttribLocationARB = (C.GPBINDATTRIBLOCATIONARB)(getProcAddr(\"glBindAttribLocationARB\"))\n\tgpBindBuffer = (C.GPBINDBUFFER)(getProcAddr(\"glBindBuffer\"))\n\tif gpBindBuffer == nil {\n\t\treturn errors.New(\"glBindBuffer\")\n\t}\n\tgpBindBufferARB = (C.GPBINDBUFFERARB)(getProcAddr(\"glBindBufferARB\"))\n\tgpBindBufferBase = (C.GPBINDBUFFERBASE)(getProcAddr(\"glBindBufferBase\"))\n\tif gpBindBufferBase == nil {\n\t\treturn errors.New(\"glBindBufferBase\")\n\t}\n\tgpBindBufferBaseEXT = (C.GPBINDBUFFERBASEEXT)(getProcAddr(\"glBindBufferBaseEXT\"))\n\tgpBindBufferBaseNV = (C.GPBINDBUFFERBASENV)(getProcAddr(\"glBindBufferBaseNV\"))\n\tgpBindBufferOffsetEXT = (C.GPBINDBUFFEROFFSETEXT)(getProcAddr(\"glBindBufferOffsetEXT\"))\n\tgpBindBufferOffsetNV = (C.GPBINDBUFFEROFFSETNV)(getProcAddr(\"glBindBufferOffsetNV\"))\n\tgpBindBufferRange = (C.GPBINDBUFFERRANGE)(getProcAddr(\"glBindBufferRange\"))\n\tif gpBindBufferRange == nil {\n\t\treturn errors.New(\"glBindBufferRange\")\n\t}\n\tgpBindBufferRangeEXT = (C.GPBINDBUFFERRANGEEXT)(getProcAddr(\"glBindBufferRangeEXT\"))\n\tgpBindBufferRangeNV = (C.GPBINDBUFFERRANGENV)(getProcAddr(\"glBindBufferRangeNV\"))\n\tgpBindBuffersBase = (C.GPBINDBUFFERSBASE)(getProcAddr(\"glBindBuffersBase\"))\n\tif gpBindBuffersBase == nil {\n\t\treturn errors.New(\"glBindBuffersBase\")\n\t}\n\tgpBindBuffersRange = (C.GPBINDBUFFERSRANGE)(getProcAddr(\"glBindBuffersRange\"))\n\tif gpBindBuffersRange == nil {\n\t\treturn errors.New(\"glBindBuffersRange\")\n\t}\n\tgpBindFragDataLocation = (C.GPBINDFRAGDATALOCATION)(getProcAddr(\"glBindFragDataLocation\"))\n\tif gpBindFragDataLocation == nil {\n\t\treturn errors.New(\"glBindFragDataLocation\")\n\t}\n\tgpBindFragDataLocationEXT = (C.GPBINDFRAGDATALOCATIONEXT)(getProcAddr(\"glBindFragDataLocationEXT\"))\n\tgpBindFragDataLocationIndexed = (C.GPBINDFRAGDATALOCATIONINDEXED)(getProcAddr(\"glBindFragDataLocationIndexed\"))\n\tif gpBindFragDataLocationIndexed == nil {\n\t\treturn errors.New(\"glBindFragDataLocationIndexed\")\n\t}\n\tgpBindFragmentShaderATI = (C.GPBINDFRAGMENTSHADERATI)(getProcAddr(\"glBindFragmentShaderATI\"))\n\tgpBindFramebuffer = (C.GPBINDFRAMEBUFFER)(getProcAddr(\"glBindFramebuffer\"))\n\tif gpBindFramebuffer == nil {\n\t\treturn errors.New(\"glBindFramebuffer\")\n\t}\n\tgpBindFramebufferEXT = (C.GPBINDFRAMEBUFFEREXT)(getProcAddr(\"glBindFramebufferEXT\"))\n\tgpBindImageTexture = (C.GPBINDIMAGETEXTURE)(getProcAddr(\"glBindImageTexture\"))\n\tif gpBindImageTexture == nil {\n\t\treturn errors.New(\"glBindImageTexture\")\n\t}\n\tgpBindImageTextureEXT = (C.GPBINDIMAGETEXTUREEXT)(getProcAddr(\"glBindImageTextureEXT\"))\n\tgpBindImageTextures = (C.GPBINDIMAGETEXTURES)(getProcAddr(\"glBindImageTextures\"))\n\tif gpBindImageTextures == nil {\n\t\treturn errors.New(\"glBindImageTextures\")\n\t}\n\tgpBindLightParameterEXT = (C.GPBINDLIGHTPARAMETEREXT)(getProcAddr(\"glBindLightParameterEXT\"))\n\tgpBindMaterialParameterEXT = (C.GPBINDMATERIALPARAMETEREXT)(getProcAddr(\"glBindMaterialParameterEXT\"))\n\tgpBindMultiTextureEXT = (C.GPBINDMULTITEXTUREEXT)(getProcAddr(\"glBindMultiTextureEXT\"))\n\tgpBindParameterEXT = (C.GPBINDPARAMETEREXT)(getProcAddr(\"glBindParameterEXT\"))\n\tgpBindProgramARB = (C.GPBINDPROGRAMARB)(getProcAddr(\"glBindProgramARB\"))\n\tgpBindProgramNV = (C.GPBINDPROGRAMNV)(getProcAddr(\"glBindProgramNV\"))\n\tgpBindProgramPipeline = (C.GPBINDPROGRAMPIPELINE)(getProcAddr(\"glBindProgramPipeline\"))\n\tif gpBindProgramPipeline == nil {\n\t\treturn errors.New(\"glBindProgramPipeline\")\n\t}\n\tgpBindProgramPipelineEXT = (C.GPBINDPROGRAMPIPELINEEXT)(getProcAddr(\"glBindProgramPipelineEXT\"))\n\tgpBindRenderbuffer = (C.GPBINDRENDERBUFFER)(getProcAddr(\"glBindRenderbuffer\"))\n\tif gpBindRenderbuffer == nil {\n\t\treturn errors.New(\"glBindRenderbuffer\")\n\t}\n\tgpBindRenderbufferEXT = (C.GPBINDRENDERBUFFEREXT)(getProcAddr(\"glBindRenderbufferEXT\"))\n\tgpBindSampler = (C.GPBINDSAMPLER)(getProcAddr(\"glBindSampler\"))\n\tif gpBindSampler == nil {\n\t\treturn errors.New(\"glBindSampler\")\n\t}\n\tgpBindSamplers = (C.GPBINDSAMPLERS)(getProcAddr(\"glBindSamplers\"))\n\tif gpBindSamplers == nil {\n\t\treturn errors.New(\"glBindSamplers\")\n\t}\n\tgpBindShadingRateImageNV = (C.GPBINDSHADINGRATEIMAGENV)(getProcAddr(\"glBindShadingRateImageNV\"))\n\tgpBindTexGenParameterEXT = (C.GPBINDTEXGENPARAMETEREXT)(getProcAddr(\"glBindTexGenParameterEXT\"))\n\tgpBindTexture = (C.GPBINDTEXTURE)(getProcAddr(\"glBindTexture\"))\n\tif gpBindTexture == nil {\n\t\treturn errors.New(\"glBindTexture\")\n\t}\n\tgpBindTextureEXT = (C.GPBINDTEXTUREEXT)(getProcAddr(\"glBindTextureEXT\"))\n\tgpBindTextureUnit = (C.GPBINDTEXTUREUNIT)(getProcAddr(\"glBindTextureUnit\"))\n\tgpBindTextureUnitParameterEXT = (C.GPBINDTEXTUREUNITPARAMETEREXT)(getProcAddr(\"glBindTextureUnitParameterEXT\"))\n\tgpBindTextures = (C.GPBINDTEXTURES)(getProcAddr(\"glBindTextures\"))\n\tif gpBindTextures == nil {\n\t\treturn errors.New(\"glBindTextures\")\n\t}\n\tgpBindTransformFeedback = (C.GPBINDTRANSFORMFEEDBACK)(getProcAddr(\"glBindTransformFeedback\"))\n\tif gpBindTransformFeedback == nil {\n\t\treturn errors.New(\"glBindTransformFeedback\")\n\t}\n\tgpBindTransformFeedbackNV = (C.GPBINDTRANSFORMFEEDBACKNV)(getProcAddr(\"glBindTransformFeedbackNV\"))\n\tgpBindVertexArray = (C.GPBINDVERTEXARRAY)(getProcAddr(\"glBindVertexArray\"))\n\tif gpBindVertexArray == nil {\n\t\treturn errors.New(\"glBindVertexArray\")\n\t}\n\tgpBindVertexArrayAPPLE = (C.GPBINDVERTEXARRAYAPPLE)(getProcAddr(\"glBindVertexArrayAPPLE\"))\n\tgpBindVertexBuffer = (C.GPBINDVERTEXBUFFER)(getProcAddr(\"glBindVertexBuffer\"))\n\tif gpBindVertexBuffer == nil {\n\t\treturn errors.New(\"glBindVertexBuffer\")\n\t}\n\tgpBindVertexBuffers = (C.GPBINDVERTEXBUFFERS)(getProcAddr(\"glBindVertexBuffers\"))\n\tif gpBindVertexBuffers == nil {\n\t\treturn errors.New(\"glBindVertexBuffers\")\n\t}\n\tgpBindVertexShaderEXT = (C.GPBINDVERTEXSHADEREXT)(getProcAddr(\"glBindVertexShaderEXT\"))\n\tgpBindVideoCaptureStreamBufferNV = (C.GPBINDVIDEOCAPTURESTREAMBUFFERNV)(getProcAddr(\"glBindVideoCaptureStreamBufferNV\"))\n\tgpBindVideoCaptureStreamTextureNV = (C.GPBINDVIDEOCAPTURESTREAMTEXTURENV)(getProcAddr(\"glBindVideoCaptureStreamTextureNV\"))\n\tgpBinormal3bEXT = (C.GPBINORMAL3BEXT)(getProcAddr(\"glBinormal3bEXT\"))\n\tgpBinormal3bvEXT = (C.GPBINORMAL3BVEXT)(getProcAddr(\"glBinormal3bvEXT\"))\n\tgpBinormal3dEXT = (C.GPBINORMAL3DEXT)(getProcAddr(\"glBinormal3dEXT\"))\n\tgpBinormal3dvEXT = (C.GPBINORMAL3DVEXT)(getProcAddr(\"glBinormal3dvEXT\"))\n\tgpBinormal3fEXT = (C.GPBINORMAL3FEXT)(getProcAddr(\"glBinormal3fEXT\"))\n\tgpBinormal3fvEXT = (C.GPBINORMAL3FVEXT)(getProcAddr(\"glBinormal3fvEXT\"))\n\tgpBinormal3iEXT = (C.GPBINORMAL3IEXT)(getProcAddr(\"glBinormal3iEXT\"))\n\tgpBinormal3ivEXT = (C.GPBINORMAL3IVEXT)(getProcAddr(\"glBinormal3ivEXT\"))\n\tgpBinormal3sEXT = (C.GPBINORMAL3SEXT)(getProcAddr(\"glBinormal3sEXT\"))\n\tgpBinormal3svEXT = (C.GPBINORMAL3SVEXT)(getProcAddr(\"glBinormal3svEXT\"))\n\tgpBinormalPointerEXT = (C.GPBINORMALPOINTEREXT)(getProcAddr(\"glBinormalPointerEXT\"))\n\tgpBitmap = (C.GPBITMAP)(getProcAddr(\"glBitmap\"))\n\tif gpBitmap == nil {\n\t\treturn errors.New(\"glBitmap\")\n\t}\n\tgpBitmapxOES = (C.GPBITMAPXOES)(getProcAddr(\"glBitmapxOES\"))\n\tgpBlendBarrierKHR = (C.GPBLENDBARRIERKHR)(getProcAddr(\"glBlendBarrierKHR\"))\n\tgpBlendBarrierNV = (C.GPBLENDBARRIERNV)(getProcAddr(\"glBlendBarrierNV\"))\n\tgpBlendColor = (C.GPBLENDCOLOR)(getProcAddr(\"glBlendColor\"))\n\tif gpBlendColor == nil {\n\t\treturn errors.New(\"glBlendColor\")\n\t}\n\tgpBlendColorEXT = (C.GPBLENDCOLOREXT)(getProcAddr(\"glBlendColorEXT\"))\n\tgpBlendColorxOES = (C.GPBLENDCOLORXOES)(getProcAddr(\"glBlendColorxOES\"))\n\tgpBlendEquation = (C.GPBLENDEQUATION)(getProcAddr(\"glBlendEquation\"))\n\tif gpBlendEquation == nil {\n\t\treturn errors.New(\"glBlendEquation\")\n\t}\n\tgpBlendEquationEXT = (C.GPBLENDEQUATIONEXT)(getProcAddr(\"glBlendEquationEXT\"))\n\tgpBlendEquationIndexedAMD = (C.GPBLENDEQUATIONINDEXEDAMD)(getProcAddr(\"glBlendEquationIndexedAMD\"))\n\tgpBlendEquationSeparate = (C.GPBLENDEQUATIONSEPARATE)(getProcAddr(\"glBlendEquationSeparate\"))\n\tif gpBlendEquationSeparate == nil {\n\t\treturn errors.New(\"glBlendEquationSeparate\")\n\t}\n\tgpBlendEquationSeparateEXT = (C.GPBLENDEQUATIONSEPARATEEXT)(getProcAddr(\"glBlendEquationSeparateEXT\"))\n\tgpBlendEquationSeparateIndexedAMD = (C.GPBLENDEQUATIONSEPARATEINDEXEDAMD)(getProcAddr(\"glBlendEquationSeparateIndexedAMD\"))\n\tgpBlendEquationSeparatei = (C.GPBLENDEQUATIONSEPARATEI)(getProcAddr(\"glBlendEquationSeparatei\"))\n\tif gpBlendEquationSeparatei == nil {\n\t\treturn errors.New(\"glBlendEquationSeparatei\")\n\t}\n\tgpBlendEquationSeparateiARB = (C.GPBLENDEQUATIONSEPARATEIARB)(getProcAddr(\"glBlendEquationSeparateiARB\"))\n\tgpBlendEquationi = (C.GPBLENDEQUATIONI)(getProcAddr(\"glBlendEquationi\"))\n\tif gpBlendEquationi == nil {\n\t\treturn errors.New(\"glBlendEquationi\")\n\t}\n\tgpBlendEquationiARB = (C.GPBLENDEQUATIONIARB)(getProcAddr(\"glBlendEquationiARB\"))\n\tgpBlendFunc = (C.GPBLENDFUNC)(getProcAddr(\"glBlendFunc\"))\n\tif gpBlendFunc == nil {\n\t\treturn errors.New(\"glBlendFunc\")\n\t}\n\tgpBlendFuncIndexedAMD = (C.GPBLENDFUNCINDEXEDAMD)(getProcAddr(\"glBlendFuncIndexedAMD\"))\n\tgpBlendFuncSeparate = (C.GPBLENDFUNCSEPARATE)(getProcAddr(\"glBlendFuncSeparate\"))\n\tif gpBlendFuncSeparate == nil {\n\t\treturn errors.New(\"glBlendFuncSeparate\")\n\t}\n\tgpBlendFuncSeparateEXT = (C.GPBLENDFUNCSEPARATEEXT)(getProcAddr(\"glBlendFuncSeparateEXT\"))\n\tgpBlendFuncSeparateINGR = (C.GPBLENDFUNCSEPARATEINGR)(getProcAddr(\"glBlendFuncSeparateINGR\"))\n\tgpBlendFuncSeparateIndexedAMD = (C.GPBLENDFUNCSEPARATEINDEXEDAMD)(getProcAddr(\"glBlendFuncSeparateIndexedAMD\"))\n\tgpBlendFuncSeparatei = (C.GPBLENDFUNCSEPARATEI)(getProcAddr(\"glBlendFuncSeparatei\"))\n\tif gpBlendFuncSeparatei == nil {\n\t\treturn errors.New(\"glBlendFuncSeparatei\")\n\t}\n\tgpBlendFuncSeparateiARB = (C.GPBLENDFUNCSEPARATEIARB)(getProcAddr(\"glBlendFuncSeparateiARB\"))\n\tgpBlendFunci = (C.GPBLENDFUNCI)(getProcAddr(\"glBlendFunci\"))\n\tif gpBlendFunci == nil {\n\t\treturn errors.New(\"glBlendFunci\")\n\t}\n\tgpBlendFunciARB = (C.GPBLENDFUNCIARB)(getProcAddr(\"glBlendFunciARB\"))\n\tgpBlendParameteriNV = (C.GPBLENDPARAMETERINV)(getProcAddr(\"glBlendParameteriNV\"))\n\tgpBlitFramebuffer = (C.GPBLITFRAMEBUFFER)(getProcAddr(\"glBlitFramebuffer\"))\n\tif gpBlitFramebuffer == nil {\n\t\treturn errors.New(\"glBlitFramebuffer\")\n\t}\n\tgpBlitFramebufferEXT = (C.GPBLITFRAMEBUFFEREXT)(getProcAddr(\"glBlitFramebufferEXT\"))\n\tgpBlitNamedFramebuffer = (C.GPBLITNAMEDFRAMEBUFFER)(getProcAddr(\"glBlitNamedFramebuffer\"))\n\tgpBufferAddressRangeNV = (C.GPBUFFERADDRESSRANGENV)(getProcAddr(\"glBufferAddressRangeNV\"))\n\tgpBufferAttachMemoryNV = (C.GPBUFFERATTACHMEMORYNV)(getProcAddr(\"glBufferAttachMemoryNV\"))\n\tgpBufferData = (C.GPBUFFERDATA)(getProcAddr(\"glBufferData\"))\n\tif gpBufferData == nil {\n\t\treturn errors.New(\"glBufferData\")\n\t}\n\tgpBufferDataARB = (C.GPBUFFERDATAARB)(getProcAddr(\"glBufferDataARB\"))\n\tgpBufferPageCommitmentARB = (C.GPBUFFERPAGECOMMITMENTARB)(getProcAddr(\"glBufferPageCommitmentARB\"))\n\tgpBufferPageCommitmentMemNV = (C.GPBUFFERPAGECOMMITMENTMEMNV)(getProcAddr(\"glBufferPageCommitmentMemNV\"))\n\tgpBufferParameteriAPPLE = (C.GPBUFFERPARAMETERIAPPLE)(getProcAddr(\"glBufferParameteriAPPLE\"))\n\tgpBufferStorage = (C.GPBUFFERSTORAGE)(getProcAddr(\"glBufferStorage\"))\n\tif gpBufferStorage == nil {\n\t\treturn errors.New(\"glBufferStorage\")\n\t}\n\tgpBufferStorageExternalEXT = (C.GPBUFFERSTORAGEEXTERNALEXT)(getProcAddr(\"glBufferStorageExternalEXT\"))\n\tgpBufferStorageMemEXT = (C.GPBUFFERSTORAGEMEMEXT)(getProcAddr(\"glBufferStorageMemEXT\"))\n\tgpBufferSubData = (C.GPBUFFERSUBDATA)(getProcAddr(\"glBufferSubData\"))\n\tif gpBufferSubData == nil {\n\t\treturn errors.New(\"glBufferSubData\")\n\t}\n\tgpBufferSubDataARB = (C.GPBUFFERSUBDATAARB)(getProcAddr(\"glBufferSubDataARB\"))\n\tgpCallCommandListNV = (C.GPCALLCOMMANDLISTNV)(getProcAddr(\"glCallCommandListNV\"))\n\tgpCallList = (C.GPCALLLIST)(getProcAddr(\"glCallList\"))\n\tif gpCallList == nil {\n\t\treturn errors.New(\"glCallList\")\n\t}\n\tgpCallLists = (C.GPCALLLISTS)(getProcAddr(\"glCallLists\"))\n\tif gpCallLists == nil {\n\t\treturn errors.New(\"glCallLists\")\n\t}\n\tgpCheckFramebufferStatus = (C.GPCHECKFRAMEBUFFERSTATUS)(getProcAddr(\"glCheckFramebufferStatus\"))\n\tif gpCheckFramebufferStatus == nil {\n\t\treturn errors.New(\"glCheckFramebufferStatus\")\n\t}\n\tgpCheckFramebufferStatusEXT = (C.GPCHECKFRAMEBUFFERSTATUSEXT)(getProcAddr(\"glCheckFramebufferStatusEXT\"))\n\tgpCheckNamedFramebufferStatus = (C.GPCHECKNAMEDFRAMEBUFFERSTATUS)(getProcAddr(\"glCheckNamedFramebufferStatus\"))\n\tgpCheckNamedFramebufferStatusEXT = (C.GPCHECKNAMEDFRAMEBUFFERSTATUSEXT)(getProcAddr(\"glCheckNamedFramebufferStatusEXT\"))\n\tgpClampColor = (C.GPCLAMPCOLOR)(getProcAddr(\"glClampColor\"))\n\tif gpClampColor == nil {\n\t\treturn errors.New(\"glClampColor\")\n\t}\n\tgpClampColorARB = (C.GPCLAMPCOLORARB)(getProcAddr(\"glClampColorARB\"))\n\tgpClear = (C.GPCLEAR)(getProcAddr(\"glClear\"))\n\tif gpClear == nil {\n\t\treturn errors.New(\"glClear\")\n\t}\n\tgpClearAccum = (C.GPCLEARACCUM)(getProcAddr(\"glClearAccum\"))\n\tif gpClearAccum == nil {\n\t\treturn errors.New(\"glClearAccum\")\n\t}\n\tgpClearAccumxOES = (C.GPCLEARACCUMXOES)(getProcAddr(\"glClearAccumxOES\"))\n\tgpClearBufferData = (C.GPCLEARBUFFERDATA)(getProcAddr(\"glClearBufferData\"))\n\tif gpClearBufferData == nil {\n\t\treturn errors.New(\"glClearBufferData\")\n\t}\n\tgpClearBufferSubData = (C.GPCLEARBUFFERSUBDATA)(getProcAddr(\"glClearBufferSubData\"))\n\tif gpClearBufferSubData == nil {\n\t\treturn errors.New(\"glClearBufferSubData\")\n\t}\n\tgpClearBufferfi = (C.GPCLEARBUFFERFI)(getProcAddr(\"glClearBufferfi\"))\n\tif gpClearBufferfi == nil {\n\t\treturn errors.New(\"glClearBufferfi\")\n\t}\n\tgpClearBufferfv = (C.GPCLEARBUFFERFV)(getProcAddr(\"glClearBufferfv\"))\n\tif gpClearBufferfv == nil {\n\t\treturn errors.New(\"glClearBufferfv\")\n\t}\n\tgpClearBufferiv = (C.GPCLEARBUFFERIV)(getProcAddr(\"glClearBufferiv\"))\n\tif gpClearBufferiv == nil {\n\t\treturn errors.New(\"glClearBufferiv\")\n\t}\n\tgpClearBufferuiv = (C.GPCLEARBUFFERUIV)(getProcAddr(\"glClearBufferuiv\"))\n\tif gpClearBufferuiv == nil {\n\t\treturn errors.New(\"glClearBufferuiv\")\n\t}\n\tgpClearColor = (C.GPCLEARCOLOR)(getProcAddr(\"glClearColor\"))\n\tif gpClearColor == nil {\n\t\treturn errors.New(\"glClearColor\")\n\t}\n\tgpClearColorIiEXT = (C.GPCLEARCOLORIIEXT)(getProcAddr(\"glClearColorIiEXT\"))\n\tgpClearColorIuiEXT = (C.GPCLEARCOLORIUIEXT)(getProcAddr(\"glClearColorIuiEXT\"))\n\tgpClearColorxOES = (C.GPCLEARCOLORXOES)(getProcAddr(\"glClearColorxOES\"))\n\tgpClearDepth = (C.GPCLEARDEPTH)(getProcAddr(\"glClearDepth\"))\n\tif gpClearDepth == nil {\n\t\treturn errors.New(\"glClearDepth\")\n\t}\n\tgpClearDepthdNV = (C.GPCLEARDEPTHDNV)(getProcAddr(\"glClearDepthdNV\"))\n\tgpClearDepthf = (C.GPCLEARDEPTHF)(getProcAddr(\"glClearDepthf\"))\n\tif gpClearDepthf == nil {\n\t\treturn errors.New(\"glClearDepthf\")\n\t}\n\tgpClearDepthfOES = (C.GPCLEARDEPTHFOES)(getProcAddr(\"glClearDepthfOES\"))\n\tgpClearDepthxOES = (C.GPCLEARDEPTHXOES)(getProcAddr(\"glClearDepthxOES\"))\n\tgpClearIndex = (C.GPCLEARINDEX)(getProcAddr(\"glClearIndex\"))\n\tif gpClearIndex == nil {\n\t\treturn errors.New(\"glClearIndex\")\n\t}\n\tgpClearNamedBufferData = (C.GPCLEARNAMEDBUFFERDATA)(getProcAddr(\"glClearNamedBufferData\"))\n\tgpClearNamedBufferDataEXT = (C.GPCLEARNAMEDBUFFERDATAEXT)(getProcAddr(\"glClearNamedBufferDataEXT\"))\n\tgpClearNamedBufferSubData = (C.GPCLEARNAMEDBUFFERSUBDATA)(getProcAddr(\"glClearNamedBufferSubData\"))\n\tgpClearNamedBufferSubDataEXT = (C.GPCLEARNAMEDBUFFERSUBDATAEXT)(getProcAddr(\"glClearNamedBufferSubDataEXT\"))\n\tgpClearNamedFramebufferfi = (C.GPCLEARNAMEDFRAMEBUFFERFI)(getProcAddr(\"glClearNamedFramebufferfi\"))\n\tgpClearNamedFramebufferfv = (C.GPCLEARNAMEDFRAMEBUFFERFV)(getProcAddr(\"glClearNamedFramebufferfv\"))\n\tgpClearNamedFramebufferiv = (C.GPCLEARNAMEDFRAMEBUFFERIV)(getProcAddr(\"glClearNamedFramebufferiv\"))\n\tgpClearNamedFramebufferuiv = (C.GPCLEARNAMEDFRAMEBUFFERUIV)(getProcAddr(\"glClearNamedFramebufferuiv\"))\n\tgpClearStencil = (C.GPCLEARSTENCIL)(getProcAddr(\"glClearStencil\"))\n\tif gpClearStencil == nil {\n\t\treturn errors.New(\"glClearStencil\")\n\t}\n\tgpClearTexImage = (C.GPCLEARTEXIMAGE)(getProcAddr(\"glClearTexImage\"))\n\tif gpClearTexImage == nil {\n\t\treturn errors.New(\"glClearTexImage\")\n\t}\n\tgpClearTexSubImage = (C.GPCLEARTEXSUBIMAGE)(getProcAddr(\"glClearTexSubImage\"))\n\tif gpClearTexSubImage == nil {\n\t\treturn errors.New(\"glClearTexSubImage\")\n\t}\n\tgpClientActiveTexture = (C.GPCLIENTACTIVETEXTURE)(getProcAddr(\"glClientActiveTexture\"))\n\tif gpClientActiveTexture == nil {\n\t\treturn errors.New(\"glClientActiveTexture\")\n\t}\n\tgpClientActiveTextureARB = (C.GPCLIENTACTIVETEXTUREARB)(getProcAddr(\"glClientActiveTextureARB\"))\n\tgpClientActiveVertexStreamATI = (C.GPCLIENTACTIVEVERTEXSTREAMATI)(getProcAddr(\"glClientActiveVertexStreamATI\"))\n\tgpClientAttribDefaultEXT = (C.GPCLIENTATTRIBDEFAULTEXT)(getProcAddr(\"glClientAttribDefaultEXT\"))\n\tgpClientWaitSemaphoreui64NVX = (C.GPCLIENTWAITSEMAPHOREUI64NVX)(getProcAddr(\"glClientWaitSemaphoreui64NVX\"))\n\tgpClientWaitSync = (C.GPCLIENTWAITSYNC)(getProcAddr(\"glClientWaitSync\"))\n\tif gpClientWaitSync == nil {\n\t\treturn errors.New(\"glClientWaitSync\")\n\t}\n\tgpClipControl = (C.GPCLIPCONTROL)(getProcAddr(\"glClipControl\"))\n\tgpClipPlane = (C.GPCLIPPLANE)(getProcAddr(\"glClipPlane\"))\n\tif gpClipPlane == nil {\n\t\treturn errors.New(\"glClipPlane\")\n\t}\n\tgpClipPlanefOES = (C.GPCLIPPLANEFOES)(getProcAddr(\"glClipPlanefOES\"))\n\tgpClipPlanexOES = (C.GPCLIPPLANEXOES)(getProcAddr(\"glClipPlanexOES\"))\n\tgpColor3b = (C.GPCOLOR3B)(getProcAddr(\"glColor3b\"))\n\tif gpColor3b == nil {\n\t\treturn errors.New(\"glColor3b\")\n\t}\n\tgpColor3bv = (C.GPCOLOR3BV)(getProcAddr(\"glColor3bv\"))\n\tif gpColor3bv == nil {\n\t\treturn errors.New(\"glColor3bv\")\n\t}\n\tgpColor3d = (C.GPCOLOR3D)(getProcAddr(\"glColor3d\"))\n\tif gpColor3d == nil {\n\t\treturn errors.New(\"glColor3d\")\n\t}\n\tgpColor3dv = (C.GPCOLOR3DV)(getProcAddr(\"glColor3dv\"))\n\tif gpColor3dv == nil {\n\t\treturn errors.New(\"glColor3dv\")\n\t}\n\tgpColor3f = (C.GPCOLOR3F)(getProcAddr(\"glColor3f\"))\n\tif gpColor3f == nil {\n\t\treturn errors.New(\"glColor3f\")\n\t}\n\tgpColor3fVertex3fSUN = (C.GPCOLOR3FVERTEX3FSUN)(getProcAddr(\"glColor3fVertex3fSUN\"))\n\tgpColor3fVertex3fvSUN = (C.GPCOLOR3FVERTEX3FVSUN)(getProcAddr(\"glColor3fVertex3fvSUN\"))\n\tgpColor3fv = (C.GPCOLOR3FV)(getProcAddr(\"glColor3fv\"))\n\tif gpColor3fv == nil {\n\t\treturn errors.New(\"glColor3fv\")\n\t}\n\tgpColor3hNV = (C.GPCOLOR3HNV)(getProcAddr(\"glColor3hNV\"))\n\tgpColor3hvNV = (C.GPCOLOR3HVNV)(getProcAddr(\"glColor3hvNV\"))\n\tgpColor3i = (C.GPCOLOR3I)(getProcAddr(\"glColor3i\"))\n\tif gpColor3i == nil {\n\t\treturn errors.New(\"glColor3i\")\n\t}\n\tgpColor3iv = (C.GPCOLOR3IV)(getProcAddr(\"glColor3iv\"))\n\tif gpColor3iv == nil {\n\t\treturn errors.New(\"glColor3iv\")\n\t}\n\tgpColor3s = (C.GPCOLOR3S)(getProcAddr(\"glColor3s\"))\n\tif gpColor3s == nil {\n\t\treturn errors.New(\"glColor3s\")\n\t}\n\tgpColor3sv = (C.GPCOLOR3SV)(getProcAddr(\"glColor3sv\"))\n\tif gpColor3sv == nil {\n\t\treturn errors.New(\"glColor3sv\")\n\t}\n\tgpColor3ub = (C.GPCOLOR3UB)(getProcAddr(\"glColor3ub\"))\n\tif gpColor3ub == nil {\n\t\treturn errors.New(\"glColor3ub\")\n\t}\n\tgpColor3ubv = (C.GPCOLOR3UBV)(getProcAddr(\"glColor3ubv\"))\n\tif gpColor3ubv == nil {\n\t\treturn errors.New(\"glColor3ubv\")\n\t}\n\tgpColor3ui = (C.GPCOLOR3UI)(getProcAddr(\"glColor3ui\"))\n\tif gpColor3ui == nil {\n\t\treturn errors.New(\"glColor3ui\")\n\t}\n\tgpColor3uiv = (C.GPCOLOR3UIV)(getProcAddr(\"glColor3uiv\"))\n\tif gpColor3uiv == nil {\n\t\treturn errors.New(\"glColor3uiv\")\n\t}\n\tgpColor3us = (C.GPCOLOR3US)(getProcAddr(\"glColor3us\"))\n\tif gpColor3us == nil {\n\t\treturn errors.New(\"glColor3us\")\n\t}\n\tgpColor3usv = (C.GPCOLOR3USV)(getProcAddr(\"glColor3usv\"))\n\tif gpColor3usv == nil {\n\t\treturn errors.New(\"glColor3usv\")\n\t}\n\tgpColor3xOES = (C.GPCOLOR3XOES)(getProcAddr(\"glColor3xOES\"))\n\tgpColor3xvOES = (C.GPCOLOR3XVOES)(getProcAddr(\"glColor3xvOES\"))\n\tgpColor4b = (C.GPCOLOR4B)(getProcAddr(\"glColor4b\"))\n\tif gpColor4b == nil {\n\t\treturn errors.New(\"glColor4b\")\n\t}\n\tgpColor4bv = (C.GPCOLOR4BV)(getProcAddr(\"glColor4bv\"))\n\tif gpColor4bv == nil {\n\t\treturn errors.New(\"glColor4bv\")\n\t}\n\tgpColor4d = (C.GPCOLOR4D)(getProcAddr(\"glColor4d\"))\n\tif gpColor4d == nil {\n\t\treturn errors.New(\"glColor4d\")\n\t}\n\tgpColor4dv = (C.GPCOLOR4DV)(getProcAddr(\"glColor4dv\"))\n\tif gpColor4dv == nil {\n\t\treturn errors.New(\"glColor4dv\")\n\t}\n\tgpColor4f = (C.GPCOLOR4F)(getProcAddr(\"glColor4f\"))\n\tif gpColor4f == nil {\n\t\treturn errors.New(\"glColor4f\")\n\t}\n\tgpColor4fNormal3fVertex3fSUN = (C.GPCOLOR4FNORMAL3FVERTEX3FSUN)(getProcAddr(\"glColor4fNormal3fVertex3fSUN\"))\n\tgpColor4fNormal3fVertex3fvSUN = (C.GPCOLOR4FNORMAL3FVERTEX3FVSUN)(getProcAddr(\"glColor4fNormal3fVertex3fvSUN\"))\n\tgpColor4fv = (C.GPCOLOR4FV)(getProcAddr(\"glColor4fv\"))\n\tif gpColor4fv == nil {\n\t\treturn errors.New(\"glColor4fv\")\n\t}\n\tgpColor4hNV = (C.GPCOLOR4HNV)(getProcAddr(\"glColor4hNV\"))\n\tgpColor4hvNV = (C.GPCOLOR4HVNV)(getProcAddr(\"glColor4hvNV\"))\n\tgpColor4i = (C.GPCOLOR4I)(getProcAddr(\"glColor4i\"))\n\tif gpColor4i == nil {\n\t\treturn errors.New(\"glColor4i\")\n\t}\n\tgpColor4iv = (C.GPCOLOR4IV)(getProcAddr(\"glColor4iv\"))\n\tif gpColor4iv == nil {\n\t\treturn errors.New(\"glColor4iv\")\n\t}\n\tgpColor4s = (C.GPCOLOR4S)(getProcAddr(\"glColor4s\"))\n\tif gpColor4s == nil {\n\t\treturn errors.New(\"glColor4s\")\n\t}\n\tgpColor4sv = (C.GPCOLOR4SV)(getProcAddr(\"glColor4sv\"))\n\tif gpColor4sv == nil {\n\t\treturn errors.New(\"glColor4sv\")\n\t}\n\tgpColor4ub = (C.GPCOLOR4UB)(getProcAddr(\"glColor4ub\"))\n\tif gpColor4ub == nil {\n\t\treturn errors.New(\"glColor4ub\")\n\t}\n\tgpColor4ubVertex2fSUN = (C.GPCOLOR4UBVERTEX2FSUN)(getProcAddr(\"glColor4ubVertex2fSUN\"))\n\tgpColor4ubVertex2fvSUN = (C.GPCOLOR4UBVERTEX2FVSUN)(getProcAddr(\"glColor4ubVertex2fvSUN\"))\n\tgpColor4ubVertex3fSUN = (C.GPCOLOR4UBVERTEX3FSUN)(getProcAddr(\"glColor4ubVertex3fSUN\"))\n\tgpColor4ubVertex3fvSUN = (C.GPCOLOR4UBVERTEX3FVSUN)(getProcAddr(\"glColor4ubVertex3fvSUN\"))\n\tgpColor4ubv = (C.GPCOLOR4UBV)(getProcAddr(\"glColor4ubv\"))\n\tif gpColor4ubv == nil {\n\t\treturn errors.New(\"glColor4ubv\")\n\t}\n\tgpColor4ui = (C.GPCOLOR4UI)(getProcAddr(\"glColor4ui\"))\n\tif gpColor4ui == nil {\n\t\treturn errors.New(\"glColor4ui\")\n\t}\n\tgpColor4uiv = (C.GPCOLOR4UIV)(getProcAddr(\"glColor4uiv\"))\n\tif gpColor4uiv == nil {\n\t\treturn errors.New(\"glColor4uiv\")\n\t}\n\tgpColor4us = (C.GPCOLOR4US)(getProcAddr(\"glColor4us\"))\n\tif gpColor4us == nil {\n\t\treturn errors.New(\"glColor4us\")\n\t}\n\tgpColor4usv = (C.GPCOLOR4USV)(getProcAddr(\"glColor4usv\"))\n\tif gpColor4usv == nil {\n\t\treturn errors.New(\"glColor4usv\")\n\t}\n\tgpColor4xOES = (C.GPCOLOR4XOES)(getProcAddr(\"glColor4xOES\"))\n\tgpColor4xvOES = (C.GPCOLOR4XVOES)(getProcAddr(\"glColor4xvOES\"))\n\tgpColorFormatNV = (C.GPCOLORFORMATNV)(getProcAddr(\"glColorFormatNV\"))\n\tgpColorFragmentOp1ATI = (C.GPCOLORFRAGMENTOP1ATI)(getProcAddr(\"glColorFragmentOp1ATI\"))\n\tgpColorFragmentOp2ATI = (C.GPCOLORFRAGMENTOP2ATI)(getProcAddr(\"glColorFragmentOp2ATI\"))\n\tgpColorFragmentOp3ATI = (C.GPCOLORFRAGMENTOP3ATI)(getProcAddr(\"glColorFragmentOp3ATI\"))\n\tgpColorMask = (C.GPCOLORMASK)(getProcAddr(\"glColorMask\"))\n\tif gpColorMask == nil {\n\t\treturn errors.New(\"glColorMask\")\n\t}\n\tgpColorMaskIndexedEXT = (C.GPCOLORMASKINDEXEDEXT)(getProcAddr(\"glColorMaskIndexedEXT\"))\n\tgpColorMaski = (C.GPCOLORMASKI)(getProcAddr(\"glColorMaski\"))\n\tif gpColorMaski == nil {\n\t\treturn errors.New(\"glColorMaski\")\n\t}\n\tgpColorMaterial = (C.GPCOLORMATERIAL)(getProcAddr(\"glColorMaterial\"))\n\tif gpColorMaterial == nil {\n\t\treturn errors.New(\"glColorMaterial\")\n\t}\n\tgpColorP3ui = (C.GPCOLORP3UI)(getProcAddr(\"glColorP3ui\"))\n\tif gpColorP3ui == nil {\n\t\treturn errors.New(\"glColorP3ui\")\n\t}\n\tgpColorP3uiv = (C.GPCOLORP3UIV)(getProcAddr(\"glColorP3uiv\"))\n\tif gpColorP3uiv == nil {\n\t\treturn errors.New(\"glColorP3uiv\")\n\t}\n\tgpColorP4ui = (C.GPCOLORP4UI)(getProcAddr(\"glColorP4ui\"))\n\tif gpColorP4ui == nil {\n\t\treturn errors.New(\"glColorP4ui\")\n\t}\n\tgpColorP4uiv = (C.GPCOLORP4UIV)(getProcAddr(\"glColorP4uiv\"))\n\tif gpColorP4uiv == nil {\n\t\treturn errors.New(\"glColorP4uiv\")\n\t}\n\tgpColorPointer = (C.GPCOLORPOINTER)(getProcAddr(\"glColorPointer\"))\n\tif gpColorPointer == nil {\n\t\treturn errors.New(\"glColorPointer\")\n\t}\n\tgpColorPointerEXT = (C.GPCOLORPOINTEREXT)(getProcAddr(\"glColorPointerEXT\"))\n\tgpColorPointerListIBM = (C.GPCOLORPOINTERLISTIBM)(getProcAddr(\"glColorPointerListIBM\"))\n\tgpColorPointervINTEL = (C.GPCOLORPOINTERVINTEL)(getProcAddr(\"glColorPointervINTEL\"))\n\tgpColorSubTable = (C.GPCOLORSUBTABLE)(getProcAddr(\"glColorSubTable\"))\n\tgpColorSubTableEXT = (C.GPCOLORSUBTABLEEXT)(getProcAddr(\"glColorSubTableEXT\"))\n\tgpColorTable = (C.GPCOLORTABLE)(getProcAddr(\"glColorTable\"))\n\tgpColorTableEXT = (C.GPCOLORTABLEEXT)(getProcAddr(\"glColorTableEXT\"))\n\tgpColorTableParameterfv = (C.GPCOLORTABLEPARAMETERFV)(getProcAddr(\"glColorTableParameterfv\"))\n\tgpColorTableParameterfvSGI = (C.GPCOLORTABLEPARAMETERFVSGI)(getProcAddr(\"glColorTableParameterfvSGI\"))\n\tgpColorTableParameteriv = (C.GPCOLORTABLEPARAMETERIV)(getProcAddr(\"glColorTableParameteriv\"))\n\tgpColorTableParameterivSGI = (C.GPCOLORTABLEPARAMETERIVSGI)(getProcAddr(\"glColorTableParameterivSGI\"))\n\tgpColorTableSGI = (C.GPCOLORTABLESGI)(getProcAddr(\"glColorTableSGI\"))\n\tgpCombinerInputNV = (C.GPCOMBINERINPUTNV)(getProcAddr(\"glCombinerInputNV\"))\n\tgpCombinerOutputNV = (C.GPCOMBINEROUTPUTNV)(getProcAddr(\"glCombinerOutputNV\"))\n\tgpCombinerParameterfNV = (C.GPCOMBINERPARAMETERFNV)(getProcAddr(\"glCombinerParameterfNV\"))\n\tgpCombinerParameterfvNV = (C.GPCOMBINERPARAMETERFVNV)(getProcAddr(\"glCombinerParameterfvNV\"))\n\tgpCombinerParameteriNV = (C.GPCOMBINERPARAMETERINV)(getProcAddr(\"glCombinerParameteriNV\"))\n\tgpCombinerParameterivNV = (C.GPCOMBINERPARAMETERIVNV)(getProcAddr(\"glCombinerParameterivNV\"))\n\tgpCombinerStageParameterfvNV = (C.GPCOMBINERSTAGEPARAMETERFVNV)(getProcAddr(\"glCombinerStageParameterfvNV\"))\n\tgpCommandListSegmentsNV = (C.GPCOMMANDLISTSEGMENTSNV)(getProcAddr(\"glCommandListSegmentsNV\"))\n\tgpCompileCommandListNV = (C.GPCOMPILECOMMANDLISTNV)(getProcAddr(\"glCompileCommandListNV\"))\n\tgpCompileShader = (C.GPCOMPILESHADER)(getProcAddr(\"glCompileShader\"))\n\tif gpCompileShader == nil {\n\t\treturn errors.New(\"glCompileShader\")\n\t}\n\tgpCompileShaderARB = (C.GPCOMPILESHADERARB)(getProcAddr(\"glCompileShaderARB\"))\n\tgpCompileShaderIncludeARB = (C.GPCOMPILESHADERINCLUDEARB)(getProcAddr(\"glCompileShaderIncludeARB\"))\n\tgpCompressedMultiTexImage1DEXT = (C.GPCOMPRESSEDMULTITEXIMAGE1DEXT)(getProcAddr(\"glCompressedMultiTexImage1DEXT\"))\n\tgpCompressedMultiTexImage2DEXT = (C.GPCOMPRESSEDMULTITEXIMAGE2DEXT)(getProcAddr(\"glCompressedMultiTexImage2DEXT\"))\n\tgpCompressedMultiTexImage3DEXT = (C.GPCOMPRESSEDMULTITEXIMAGE3DEXT)(getProcAddr(\"glCompressedMultiTexImage3DEXT\"))\n\tgpCompressedMultiTexSubImage1DEXT = (C.GPCOMPRESSEDMULTITEXSUBIMAGE1DEXT)(getProcAddr(\"glCompressedMultiTexSubImage1DEXT\"))\n\tgpCompressedMultiTexSubImage2DEXT = (C.GPCOMPRESSEDMULTITEXSUBIMAGE2DEXT)(getProcAddr(\"glCompressedMultiTexSubImage2DEXT\"))\n\tgpCompressedMultiTexSubImage3DEXT = (C.GPCOMPRESSEDMULTITEXSUBIMAGE3DEXT)(getProcAddr(\"glCompressedMultiTexSubImage3DEXT\"))\n\tgpCompressedTexImage1D = (C.GPCOMPRESSEDTEXIMAGE1D)(getProcAddr(\"glCompressedTexImage1D\"))\n\tif gpCompressedTexImage1D == nil {\n\t\treturn errors.New(\"glCompressedTexImage1D\")\n\t}\n\tgpCompressedTexImage1DARB = (C.GPCOMPRESSEDTEXIMAGE1DARB)(getProcAddr(\"glCompressedTexImage1DARB\"))\n\tgpCompressedTexImage2D = (C.GPCOMPRESSEDTEXIMAGE2D)(getProcAddr(\"glCompressedTexImage2D\"))\n\tif gpCompressedTexImage2D == nil {\n\t\treturn errors.New(\"glCompressedTexImage2D\")\n\t}\n\tgpCompressedTexImage2DARB = (C.GPCOMPRESSEDTEXIMAGE2DARB)(getProcAddr(\"glCompressedTexImage2DARB\"))\n\tgpCompressedTexImage3D = (C.GPCOMPRESSEDTEXIMAGE3D)(getProcAddr(\"glCompressedTexImage3D\"))\n\tif gpCompressedTexImage3D == nil {\n\t\treturn errors.New(\"glCompressedTexImage3D\")\n\t}\n\tgpCompressedTexImage3DARB = (C.GPCOMPRESSEDTEXIMAGE3DARB)(getProcAddr(\"glCompressedTexImage3DARB\"))\n\tgpCompressedTexSubImage1D = (C.GPCOMPRESSEDTEXSUBIMAGE1D)(getProcAddr(\"glCompressedTexSubImage1D\"))\n\tif gpCompressedTexSubImage1D == nil {\n\t\treturn errors.New(\"glCompressedTexSubImage1D\")\n\t}\n\tgpCompressedTexSubImage1DARB = (C.GPCOMPRESSEDTEXSUBIMAGE1DARB)(getProcAddr(\"glCompressedTexSubImage1DARB\"))\n\tgpCompressedTexSubImage2D = (C.GPCOMPRESSEDTEXSUBIMAGE2D)(getProcAddr(\"glCompressedTexSubImage2D\"))\n\tif gpCompressedTexSubImage2D == nil {\n\t\treturn errors.New(\"glCompressedTexSubImage2D\")\n\t}\n\tgpCompressedTexSubImage2DARB = (C.GPCOMPRESSEDTEXSUBIMAGE2DARB)(getProcAddr(\"glCompressedTexSubImage2DARB\"))\n\tgpCompressedTexSubImage3D = (C.GPCOMPRESSEDTEXSUBIMAGE3D)(getProcAddr(\"glCompressedTexSubImage3D\"))\n\tif gpCompressedTexSubImage3D == nil {\n\t\treturn errors.New(\"glCompressedTexSubImage3D\")\n\t}\n\tgpCompressedTexSubImage3DARB = (C.GPCOMPRESSEDTEXSUBIMAGE3DARB)(getProcAddr(\"glCompressedTexSubImage3DARB\"))\n\tgpCompressedTextureImage1DEXT = (C.GPCOMPRESSEDTEXTUREIMAGE1DEXT)(getProcAddr(\"glCompressedTextureImage1DEXT\"))\n\tgpCompressedTextureImage2DEXT = (C.GPCOMPRESSEDTEXTUREIMAGE2DEXT)(getProcAddr(\"glCompressedTextureImage2DEXT\"))\n\tgpCompressedTextureImage3DEXT = (C.GPCOMPRESSEDTEXTUREIMAGE3DEXT)(getProcAddr(\"glCompressedTextureImage3DEXT\"))\n\tgpCompressedTextureSubImage1D = (C.GPCOMPRESSEDTEXTURESUBIMAGE1D)(getProcAddr(\"glCompressedTextureSubImage1D\"))\n\tgpCompressedTextureSubImage1DEXT = (C.GPCOMPRESSEDTEXTURESUBIMAGE1DEXT)(getProcAddr(\"glCompressedTextureSubImage1DEXT\"))\n\tgpCompressedTextureSubImage2D = (C.GPCOMPRESSEDTEXTURESUBIMAGE2D)(getProcAddr(\"glCompressedTextureSubImage2D\"))\n\tgpCompressedTextureSubImage2DEXT = (C.GPCOMPRESSEDTEXTURESUBIMAGE2DEXT)(getProcAddr(\"glCompressedTextureSubImage2DEXT\"))\n\tgpCompressedTextureSubImage3D = (C.GPCOMPRESSEDTEXTURESUBIMAGE3D)(getProcAddr(\"glCompressedTextureSubImage3D\"))\n\tgpCompressedTextureSubImage3DEXT = (C.GPCOMPRESSEDTEXTURESUBIMAGE3DEXT)(getProcAddr(\"glCompressedTextureSubImage3DEXT\"))\n\tgpConservativeRasterParameterfNV = (C.GPCONSERVATIVERASTERPARAMETERFNV)(getProcAddr(\"glConservativeRasterParameterfNV\"))\n\tgpConservativeRasterParameteriNV = (C.GPCONSERVATIVERASTERPARAMETERINV)(getProcAddr(\"glConservativeRasterParameteriNV\"))\n\tgpConvolutionFilter1D = (C.GPCONVOLUTIONFILTER1D)(getProcAddr(\"glConvolutionFilter1D\"))\n\tgpConvolutionFilter1DEXT = (C.GPCONVOLUTIONFILTER1DEXT)(getProcAddr(\"glConvolutionFilter1DEXT\"))\n\tgpConvolutionFilter2D = (C.GPCONVOLUTIONFILTER2D)(getProcAddr(\"glConvolutionFilter2D\"))\n\tgpConvolutionFilter2DEXT = (C.GPCONVOLUTIONFILTER2DEXT)(getProcAddr(\"glConvolutionFilter2DEXT\"))\n\tgpConvolutionParameterf = (C.GPCONVOLUTIONPARAMETERF)(getProcAddr(\"glConvolutionParameterf\"))\n\tgpConvolutionParameterfEXT = (C.GPCONVOLUTIONPARAMETERFEXT)(getProcAddr(\"glConvolutionParameterfEXT\"))\n\tgpConvolutionParameterfv = (C.GPCONVOLUTIONPARAMETERFV)(getProcAddr(\"glConvolutionParameterfv\"))\n\tgpConvolutionParameterfvEXT = (C.GPCONVOLUTIONPARAMETERFVEXT)(getProcAddr(\"glConvolutionParameterfvEXT\"))\n\tgpConvolutionParameteri = (C.GPCONVOLUTIONPARAMETERI)(getProcAddr(\"glConvolutionParameteri\"))\n\tgpConvolutionParameteriEXT = (C.GPCONVOLUTIONPARAMETERIEXT)(getProcAddr(\"glConvolutionParameteriEXT\"))\n\tgpConvolutionParameteriv = (C.GPCONVOLUTIONPARAMETERIV)(getProcAddr(\"glConvolutionParameteriv\"))\n\tgpConvolutionParameterivEXT = (C.GPCONVOLUTIONPARAMETERIVEXT)(getProcAddr(\"glConvolutionParameterivEXT\"))\n\tgpConvolutionParameterxOES = (C.GPCONVOLUTIONPARAMETERXOES)(getProcAddr(\"glConvolutionParameterxOES\"))\n\tgpConvolutionParameterxvOES = (C.GPCONVOLUTIONPARAMETERXVOES)(getProcAddr(\"glConvolutionParameterxvOES\"))\n\tgpCopyBufferSubData = (C.GPCOPYBUFFERSUBDATA)(getProcAddr(\"glCopyBufferSubData\"))\n\tif gpCopyBufferSubData == nil {\n\t\treturn errors.New(\"glCopyBufferSubData\")\n\t}\n\tgpCopyColorSubTable = (C.GPCOPYCOLORSUBTABLE)(getProcAddr(\"glCopyColorSubTable\"))\n\tgpCopyColorSubTableEXT = (C.GPCOPYCOLORSUBTABLEEXT)(getProcAddr(\"glCopyColorSubTableEXT\"))\n\tgpCopyColorTable = (C.GPCOPYCOLORTABLE)(getProcAddr(\"glCopyColorTable\"))\n\tgpCopyColorTableSGI = (C.GPCOPYCOLORTABLESGI)(getProcAddr(\"glCopyColorTableSGI\"))\n\tgpCopyConvolutionFilter1D = (C.GPCOPYCONVOLUTIONFILTER1D)(getProcAddr(\"glCopyConvolutionFilter1D\"))\n\tgpCopyConvolutionFilter1DEXT = (C.GPCOPYCONVOLUTIONFILTER1DEXT)(getProcAddr(\"glCopyConvolutionFilter1DEXT\"))\n\tgpCopyConvolutionFilter2D = (C.GPCOPYCONVOLUTIONFILTER2D)(getProcAddr(\"glCopyConvolutionFilter2D\"))\n\tgpCopyConvolutionFilter2DEXT = (C.GPCOPYCONVOLUTIONFILTER2DEXT)(getProcAddr(\"glCopyConvolutionFilter2DEXT\"))\n\tgpCopyImageSubData = (C.GPCOPYIMAGESUBDATA)(getProcAddr(\"glCopyImageSubData\"))\n\tif gpCopyImageSubData == nil {\n\t\treturn errors.New(\"glCopyImageSubData\")\n\t}\n\tgpCopyImageSubDataNV = (C.GPCOPYIMAGESUBDATANV)(getProcAddr(\"glCopyImageSubDataNV\"))\n\tgpCopyMultiTexImage1DEXT = (C.GPCOPYMULTITEXIMAGE1DEXT)(getProcAddr(\"glCopyMultiTexImage1DEXT\"))\n\tgpCopyMultiTexImage2DEXT = (C.GPCOPYMULTITEXIMAGE2DEXT)(getProcAddr(\"glCopyMultiTexImage2DEXT\"))\n\tgpCopyMultiTexSubImage1DEXT = (C.GPCOPYMULTITEXSUBIMAGE1DEXT)(getProcAddr(\"glCopyMultiTexSubImage1DEXT\"))\n\tgpCopyMultiTexSubImage2DEXT = (C.GPCOPYMULTITEXSUBIMAGE2DEXT)(getProcAddr(\"glCopyMultiTexSubImage2DEXT\"))\n\tgpCopyMultiTexSubImage3DEXT = (C.GPCOPYMULTITEXSUBIMAGE3DEXT)(getProcAddr(\"glCopyMultiTexSubImage3DEXT\"))\n\tgpCopyNamedBufferSubData = (C.GPCOPYNAMEDBUFFERSUBDATA)(getProcAddr(\"glCopyNamedBufferSubData\"))\n\tgpCopyPathNV = (C.GPCOPYPATHNV)(getProcAddr(\"glCopyPathNV\"))\n\tgpCopyPixels = (C.GPCOPYPIXELS)(getProcAddr(\"glCopyPixels\"))\n\tif gpCopyPixels == nil {\n\t\treturn errors.New(\"glCopyPixels\")\n\t}\n\tgpCopyTexImage1D = (C.GPCOPYTEXIMAGE1D)(getProcAddr(\"glCopyTexImage1D\"))\n\tif gpCopyTexImage1D == nil {\n\t\treturn errors.New(\"glCopyTexImage1D\")\n\t}\n\tgpCopyTexImage1DEXT = (C.GPCOPYTEXIMAGE1DEXT)(getProcAddr(\"glCopyTexImage1DEXT\"))\n\tgpCopyTexImage2D = (C.GPCOPYTEXIMAGE2D)(getProcAddr(\"glCopyTexImage2D\"))\n\tif gpCopyTexImage2D == nil {\n\t\treturn errors.New(\"glCopyTexImage2D\")\n\t}\n\tgpCopyTexImage2DEXT = (C.GPCOPYTEXIMAGE2DEXT)(getProcAddr(\"glCopyTexImage2DEXT\"))\n\tgpCopyTexSubImage1D = (C.GPCOPYTEXSUBIMAGE1D)(getProcAddr(\"glCopyTexSubImage1D\"))\n\tif gpCopyTexSubImage1D == nil {\n\t\treturn errors.New(\"glCopyTexSubImage1D\")\n\t}\n\tgpCopyTexSubImage1DEXT = (C.GPCOPYTEXSUBIMAGE1DEXT)(getProcAddr(\"glCopyTexSubImage1DEXT\"))\n\tgpCopyTexSubImage2D = (C.GPCOPYTEXSUBIMAGE2D)(getProcAddr(\"glCopyTexSubImage2D\"))\n\tif gpCopyTexSubImage2D == nil {\n\t\treturn errors.New(\"glCopyTexSubImage2D\")\n\t}\n\tgpCopyTexSubImage2DEXT = (C.GPCOPYTEXSUBIMAGE2DEXT)(getProcAddr(\"glCopyTexSubImage2DEXT\"))\n\tgpCopyTexSubImage3D = (C.GPCOPYTEXSUBIMAGE3D)(getProcAddr(\"glCopyTexSubImage3D\"))\n\tif gpCopyTexSubImage3D == nil {\n\t\treturn errors.New(\"glCopyTexSubImage3D\")\n\t}\n\tgpCopyTexSubImage3DEXT = (C.GPCOPYTEXSUBIMAGE3DEXT)(getProcAddr(\"glCopyTexSubImage3DEXT\"))\n\tgpCopyTextureImage1DEXT = (C.GPCOPYTEXTUREIMAGE1DEXT)(getProcAddr(\"glCopyTextureImage1DEXT\"))\n\tgpCopyTextureImage2DEXT = (C.GPCOPYTEXTUREIMAGE2DEXT)(getProcAddr(\"glCopyTextureImage2DEXT\"))\n\tgpCopyTextureSubImage1D = (C.GPCOPYTEXTURESUBIMAGE1D)(getProcAddr(\"glCopyTextureSubImage1D\"))\n\tgpCopyTextureSubImage1DEXT = (C.GPCOPYTEXTURESUBIMAGE1DEXT)(getProcAddr(\"glCopyTextureSubImage1DEXT\"))\n\tgpCopyTextureSubImage2D = (C.GPCOPYTEXTURESUBIMAGE2D)(getProcAddr(\"glCopyTextureSubImage2D\"))\n\tgpCopyTextureSubImage2DEXT = (C.GPCOPYTEXTURESUBIMAGE2DEXT)(getProcAddr(\"glCopyTextureSubImage2DEXT\"))\n\tgpCopyTextureSubImage3D = (C.GPCOPYTEXTURESUBIMAGE3D)(getProcAddr(\"glCopyTextureSubImage3D\"))\n\tgpCopyTextureSubImage3DEXT = (C.GPCOPYTEXTURESUBIMAGE3DEXT)(getProcAddr(\"glCopyTextureSubImage3DEXT\"))\n\tgpCoverFillPathInstancedNV = (C.GPCOVERFILLPATHINSTANCEDNV)(getProcAddr(\"glCoverFillPathInstancedNV\"))\n\tgpCoverFillPathNV = (C.GPCOVERFILLPATHNV)(getProcAddr(\"glCoverFillPathNV\"))\n\tgpCoverStrokePathInstancedNV = (C.GPCOVERSTROKEPATHINSTANCEDNV)(getProcAddr(\"glCoverStrokePathInstancedNV\"))\n\tgpCoverStrokePathNV = (C.GPCOVERSTROKEPATHNV)(getProcAddr(\"glCoverStrokePathNV\"))\n\tgpCoverageModulationNV = (C.GPCOVERAGEMODULATIONNV)(getProcAddr(\"glCoverageModulationNV\"))\n\tgpCoverageModulationTableNV = (C.GPCOVERAGEMODULATIONTABLENV)(getProcAddr(\"glCoverageModulationTableNV\"))\n\tgpCreateBuffers = (C.GPCREATEBUFFERS)(getProcAddr(\"glCreateBuffers\"))\n\tgpCreateCommandListsNV = (C.GPCREATECOMMANDLISTSNV)(getProcAddr(\"glCreateCommandListsNV\"))\n\tgpCreateFramebuffers = (C.GPCREATEFRAMEBUFFERS)(getProcAddr(\"glCreateFramebuffers\"))\n\tgpCreateMemoryObjectsEXT = (C.GPCREATEMEMORYOBJECTSEXT)(getProcAddr(\"glCreateMemoryObjectsEXT\"))\n\tgpCreatePerfQueryINTEL = (C.GPCREATEPERFQUERYINTEL)(getProcAddr(\"glCreatePerfQueryINTEL\"))\n\tgpCreateProgram = (C.GPCREATEPROGRAM)(getProcAddr(\"glCreateProgram\"))\n\tif gpCreateProgram == nil {\n\t\treturn errors.New(\"glCreateProgram\")\n\t}\n\tgpCreateProgramObjectARB = (C.GPCREATEPROGRAMOBJECTARB)(getProcAddr(\"glCreateProgramObjectARB\"))\n\tgpCreateProgramPipelines = (C.GPCREATEPROGRAMPIPELINES)(getProcAddr(\"glCreateProgramPipelines\"))\n\tgpCreateProgressFenceNVX = (C.GPCREATEPROGRESSFENCENVX)(getProcAddr(\"glCreateProgressFenceNVX\"))\n\tgpCreateQueries = (C.GPCREATEQUERIES)(getProcAddr(\"glCreateQueries\"))\n\tgpCreateRenderbuffers = (C.GPCREATERENDERBUFFERS)(getProcAddr(\"glCreateRenderbuffers\"))\n\tgpCreateSamplers = (C.GPCREATESAMPLERS)(getProcAddr(\"glCreateSamplers\"))\n\tgpCreateSemaphoresNV = (C.GPCREATESEMAPHORESNV)(getProcAddr(\"glCreateSemaphoresNV\"))\n\tgpCreateShader = (C.GPCREATESHADER)(getProcAddr(\"glCreateShader\"))\n\tif gpCreateShader == nil {\n\t\treturn errors.New(\"glCreateShader\")\n\t}\n\tgpCreateShaderObjectARB = (C.GPCREATESHADEROBJECTARB)(getProcAddr(\"glCreateShaderObjectARB\"))\n\tgpCreateShaderProgramEXT = (C.GPCREATESHADERPROGRAMEXT)(getProcAddr(\"glCreateShaderProgramEXT\"))\n\tgpCreateShaderProgramv = (C.GPCREATESHADERPROGRAMV)(getProcAddr(\"glCreateShaderProgramv\"))\n\tif gpCreateShaderProgramv == nil {\n\t\treturn errors.New(\"glCreateShaderProgramv\")\n\t}\n\tgpCreateShaderProgramvEXT = (C.GPCREATESHADERPROGRAMVEXT)(getProcAddr(\"glCreateShaderProgramvEXT\"))\n\tgpCreateStatesNV = (C.GPCREATESTATESNV)(getProcAddr(\"glCreateStatesNV\"))\n\tgpCreateSyncFromCLeventARB = (C.GPCREATESYNCFROMCLEVENTARB)(getProcAddr(\"glCreateSyncFromCLeventARB\"))\n\tgpCreateTextures = (C.GPCREATETEXTURES)(getProcAddr(\"glCreateTextures\"))\n\tgpCreateTransformFeedbacks = (C.GPCREATETRANSFORMFEEDBACKS)(getProcAddr(\"glCreateTransformFeedbacks\"))\n\tgpCreateVertexArrays = (C.GPCREATEVERTEXARRAYS)(getProcAddr(\"glCreateVertexArrays\"))\n\tgpCullFace = (C.GPCULLFACE)(getProcAddr(\"glCullFace\"))\n\tif gpCullFace == nil {\n\t\treturn errors.New(\"glCullFace\")\n\t}\n\tgpCullParameterdvEXT = (C.GPCULLPARAMETERDVEXT)(getProcAddr(\"glCullParameterdvEXT\"))\n\tgpCullParameterfvEXT = (C.GPCULLPARAMETERFVEXT)(getProcAddr(\"glCullParameterfvEXT\"))\n\tgpCurrentPaletteMatrixARB = (C.GPCURRENTPALETTEMATRIXARB)(getProcAddr(\"glCurrentPaletteMatrixARB\"))\n\tgpDebugMessageCallback = (C.GPDEBUGMESSAGECALLBACK)(getProcAddr(\"glDebugMessageCallback\"))\n\tif gpDebugMessageCallback == nil {\n\t\treturn errors.New(\"glDebugMessageCallback\")\n\t}\n\tgpDebugMessageCallbackAMD = (C.GPDEBUGMESSAGECALLBACKAMD)(getProcAddr(\"glDebugMessageCallbackAMD\"))\n\tgpDebugMessageCallbackARB = (C.GPDEBUGMESSAGECALLBACKARB)(getProcAddr(\"glDebugMessageCallbackARB\"))\n\tgpDebugMessageCallbackKHR = (C.GPDEBUGMESSAGECALLBACKKHR)(getProcAddr(\"glDebugMessageCallbackKHR\"))\n\tgpDebugMessageControl = (C.GPDEBUGMESSAGECONTROL)(getProcAddr(\"glDebugMessageControl\"))\n\tif gpDebugMessageControl == nil {\n\t\treturn errors.New(\"glDebugMessageControl\")\n\t}\n\tgpDebugMessageControlARB = (C.GPDEBUGMESSAGECONTROLARB)(getProcAddr(\"glDebugMessageControlARB\"))\n\tgpDebugMessageControlKHR = (C.GPDEBUGMESSAGECONTROLKHR)(getProcAddr(\"glDebugMessageControlKHR\"))\n\tgpDebugMessageEnableAMD = (C.GPDEBUGMESSAGEENABLEAMD)(getProcAddr(\"glDebugMessageEnableAMD\"))\n\tgpDebugMessageInsert = (C.GPDEBUGMESSAGEINSERT)(getProcAddr(\"glDebugMessageInsert\"))\n\tif gpDebugMessageInsert == nil {\n\t\treturn errors.New(\"glDebugMessageInsert\")\n\t}\n\tgpDebugMessageInsertAMD = (C.GPDEBUGMESSAGEINSERTAMD)(getProcAddr(\"glDebugMessageInsertAMD\"))\n\tgpDebugMessageInsertARB = (C.GPDEBUGMESSAGEINSERTARB)(getProcAddr(\"glDebugMessageInsertARB\"))\n\tgpDebugMessageInsertKHR = (C.GPDEBUGMESSAGEINSERTKHR)(getProcAddr(\"glDebugMessageInsertKHR\"))\n\tgpDeformSGIX = (C.GPDEFORMSGIX)(getProcAddr(\"glDeformSGIX\"))\n\tgpDeformationMap3dSGIX = (C.GPDEFORMATIONMAP3DSGIX)(getProcAddr(\"glDeformationMap3dSGIX\"))\n\tgpDeformationMap3fSGIX = (C.GPDEFORMATIONMAP3FSGIX)(getProcAddr(\"glDeformationMap3fSGIX\"))\n\tgpDeleteAsyncMarkersSGIX = (C.GPDELETEASYNCMARKERSSGIX)(getProcAddr(\"glDeleteAsyncMarkersSGIX\"))\n\tgpDeleteBuffers = (C.GPDELETEBUFFERS)(getProcAddr(\"glDeleteBuffers\"))\n\tif gpDeleteBuffers == nil {\n\t\treturn errors.New(\"glDeleteBuffers\")\n\t}\n\tgpDeleteBuffersARB = (C.GPDELETEBUFFERSARB)(getProcAddr(\"glDeleteBuffersARB\"))\n\tgpDeleteCommandListsNV = (C.GPDELETECOMMANDLISTSNV)(getProcAddr(\"glDeleteCommandListsNV\"))\n\tgpDeleteFencesAPPLE = (C.GPDELETEFENCESAPPLE)(getProcAddr(\"glDeleteFencesAPPLE\"))\n\tgpDeleteFencesNV = (C.GPDELETEFENCESNV)(getProcAddr(\"glDeleteFencesNV\"))\n\tgpDeleteFragmentShaderATI = (C.GPDELETEFRAGMENTSHADERATI)(getProcAddr(\"glDeleteFragmentShaderATI\"))\n\tgpDeleteFramebuffers = (C.GPDELETEFRAMEBUFFERS)(getProcAddr(\"glDeleteFramebuffers\"))\n\tif gpDeleteFramebuffers == nil {\n\t\treturn errors.New(\"glDeleteFramebuffers\")\n\t}\n\tgpDeleteFramebuffersEXT = (C.GPDELETEFRAMEBUFFERSEXT)(getProcAddr(\"glDeleteFramebuffersEXT\"))\n\tgpDeleteLists = (C.GPDELETELISTS)(getProcAddr(\"glDeleteLists\"))\n\tif gpDeleteLists == nil {\n\t\treturn errors.New(\"glDeleteLists\")\n\t}\n\tgpDeleteMemoryObjectsEXT = (C.GPDELETEMEMORYOBJECTSEXT)(getProcAddr(\"glDeleteMemoryObjectsEXT\"))\n\tgpDeleteNamedStringARB = (C.GPDELETENAMEDSTRINGARB)(getProcAddr(\"glDeleteNamedStringARB\"))\n\tgpDeleteNamesAMD = (C.GPDELETENAMESAMD)(getProcAddr(\"glDeleteNamesAMD\"))\n\tgpDeleteObjectARB = (C.GPDELETEOBJECTARB)(getProcAddr(\"glDeleteObjectARB\"))\n\tgpDeleteOcclusionQueriesNV = (C.GPDELETEOCCLUSIONQUERIESNV)(getProcAddr(\"glDeleteOcclusionQueriesNV\"))\n\tgpDeletePathsNV = (C.GPDELETEPATHSNV)(getProcAddr(\"glDeletePathsNV\"))\n\tgpDeletePerfMonitorsAMD = (C.GPDELETEPERFMONITORSAMD)(getProcAddr(\"glDeletePerfMonitorsAMD\"))\n\tgpDeletePerfQueryINTEL = (C.GPDELETEPERFQUERYINTEL)(getProcAddr(\"glDeletePerfQueryINTEL\"))\n\tgpDeleteProgram = (C.GPDELETEPROGRAM)(getProcAddr(\"glDeleteProgram\"))\n\tif gpDeleteProgram == nil {\n\t\treturn errors.New(\"glDeleteProgram\")\n\t}\n\tgpDeleteProgramPipelines = (C.GPDELETEPROGRAMPIPELINES)(getProcAddr(\"glDeleteProgramPipelines\"))\n\tif gpDeleteProgramPipelines == nil {\n\t\treturn errors.New(\"glDeleteProgramPipelines\")\n\t}\n\tgpDeleteProgramPipelinesEXT = (C.GPDELETEPROGRAMPIPELINESEXT)(getProcAddr(\"glDeleteProgramPipelinesEXT\"))\n\tgpDeleteProgramsARB = (C.GPDELETEPROGRAMSARB)(getProcAddr(\"glDeleteProgramsARB\"))\n\tgpDeleteProgramsNV = (C.GPDELETEPROGRAMSNV)(getProcAddr(\"glDeleteProgramsNV\"))\n\tgpDeleteQueries = (C.GPDELETEQUERIES)(getProcAddr(\"glDeleteQueries\"))\n\tif gpDeleteQueries == nil {\n\t\treturn errors.New(\"glDeleteQueries\")\n\t}\n\tgpDeleteQueriesARB = (C.GPDELETEQUERIESARB)(getProcAddr(\"glDeleteQueriesARB\"))\n\tgpDeleteQueryResourceTagNV = (C.GPDELETEQUERYRESOURCETAGNV)(getProcAddr(\"glDeleteQueryResourceTagNV\"))\n\tgpDeleteRenderbuffers = (C.GPDELETERENDERBUFFERS)(getProcAddr(\"glDeleteRenderbuffers\"))\n\tif gpDeleteRenderbuffers == nil {\n\t\treturn errors.New(\"glDeleteRenderbuffers\")\n\t}\n\tgpDeleteRenderbuffersEXT = (C.GPDELETERENDERBUFFERSEXT)(getProcAddr(\"glDeleteRenderbuffersEXT\"))\n\tgpDeleteSamplers = (C.GPDELETESAMPLERS)(getProcAddr(\"glDeleteSamplers\"))\n\tif gpDeleteSamplers == nil {\n\t\treturn errors.New(\"glDeleteSamplers\")\n\t}\n\tgpDeleteSemaphoresEXT = (C.GPDELETESEMAPHORESEXT)(getProcAddr(\"glDeleteSemaphoresEXT\"))\n\tgpDeleteShader = (C.GPDELETESHADER)(getProcAddr(\"glDeleteShader\"))\n\tif gpDeleteShader == nil {\n\t\treturn errors.New(\"glDeleteShader\")\n\t}\n\tgpDeleteStatesNV = (C.GPDELETESTATESNV)(getProcAddr(\"glDeleteStatesNV\"))\n\tgpDeleteSync = (C.GPDELETESYNC)(getProcAddr(\"glDeleteSync\"))\n\tif gpDeleteSync == nil {\n\t\treturn errors.New(\"glDeleteSync\")\n\t}\n\tgpDeleteTextures = (C.GPDELETETEXTURES)(getProcAddr(\"glDeleteTextures\"))\n\tif gpDeleteTextures == nil {\n\t\treturn errors.New(\"glDeleteTextures\")\n\t}\n\tgpDeleteTexturesEXT = (C.GPDELETETEXTURESEXT)(getProcAddr(\"glDeleteTexturesEXT\"))\n\tgpDeleteTransformFeedbacks = (C.GPDELETETRANSFORMFEEDBACKS)(getProcAddr(\"glDeleteTransformFeedbacks\"))\n\tif gpDeleteTransformFeedbacks == nil {\n\t\treturn errors.New(\"glDeleteTransformFeedbacks\")\n\t}\n\tgpDeleteTransformFeedbacksNV = (C.GPDELETETRANSFORMFEEDBACKSNV)(getProcAddr(\"glDeleteTransformFeedbacksNV\"))\n\tgpDeleteVertexArrays = (C.GPDELETEVERTEXARRAYS)(getProcAddr(\"glDeleteVertexArrays\"))\n\tif gpDeleteVertexArrays == nil {\n\t\treturn errors.New(\"glDeleteVertexArrays\")\n\t}\n\tgpDeleteVertexArraysAPPLE = (C.GPDELETEVERTEXARRAYSAPPLE)(getProcAddr(\"glDeleteVertexArraysAPPLE\"))\n\tgpDeleteVertexShaderEXT = (C.GPDELETEVERTEXSHADEREXT)(getProcAddr(\"glDeleteVertexShaderEXT\"))\n\tgpDepthBoundsEXT = (C.GPDEPTHBOUNDSEXT)(getProcAddr(\"glDepthBoundsEXT\"))\n\tgpDepthBoundsdNV = (C.GPDEPTHBOUNDSDNV)(getProcAddr(\"glDepthBoundsdNV\"))\n\tgpDepthFunc = (C.GPDEPTHFUNC)(getProcAddr(\"glDepthFunc\"))\n\tif gpDepthFunc == nil {\n\t\treturn errors.New(\"glDepthFunc\")\n\t}\n\tgpDepthMask = (C.GPDEPTHMASK)(getProcAddr(\"glDepthMask\"))\n\tif gpDepthMask == nil {\n\t\treturn errors.New(\"glDepthMask\")\n\t}\n\tgpDepthRange = (C.GPDEPTHRANGE)(getProcAddr(\"glDepthRange\"))\n\tif gpDepthRange == nil {\n\t\treturn errors.New(\"glDepthRange\")\n\t}\n\tgpDepthRangeArraydvNV = (C.GPDEPTHRANGEARRAYDVNV)(getProcAddr(\"glDepthRangeArraydvNV\"))\n\tgpDepthRangeArrayv = (C.GPDEPTHRANGEARRAYV)(getProcAddr(\"glDepthRangeArrayv\"))\n\tif gpDepthRangeArrayv == nil {\n\t\treturn errors.New(\"glDepthRangeArrayv\")\n\t}\n\tgpDepthRangeIndexed = (C.GPDEPTHRANGEINDEXED)(getProcAddr(\"glDepthRangeIndexed\"))\n\tif gpDepthRangeIndexed == nil {\n\t\treturn errors.New(\"glDepthRangeIndexed\")\n\t}\n\tgpDepthRangeIndexeddNV = (C.GPDEPTHRANGEINDEXEDDNV)(getProcAddr(\"glDepthRangeIndexeddNV\"))\n\tgpDepthRangedNV = (C.GPDEPTHRANGEDNV)(getProcAddr(\"glDepthRangedNV\"))\n\tgpDepthRangef = (C.GPDEPTHRANGEF)(getProcAddr(\"glDepthRangef\"))\n\tif gpDepthRangef == nil {\n\t\treturn errors.New(\"glDepthRangef\")\n\t}\n\tgpDepthRangefOES = (C.GPDEPTHRANGEFOES)(getProcAddr(\"glDepthRangefOES\"))\n\tgpDepthRangexOES = (C.GPDEPTHRANGEXOES)(getProcAddr(\"glDepthRangexOES\"))\n\tgpDetachObjectARB = (C.GPDETACHOBJECTARB)(getProcAddr(\"glDetachObjectARB\"))\n\tgpDetachShader = (C.GPDETACHSHADER)(getProcAddr(\"glDetachShader\"))\n\tif gpDetachShader == nil {\n\t\treturn errors.New(\"glDetachShader\")\n\t}\n\tgpDetailTexFuncSGIS = (C.GPDETAILTEXFUNCSGIS)(getProcAddr(\"glDetailTexFuncSGIS\"))\n\tgpDisable = (C.GPDISABLE)(getProcAddr(\"glDisable\"))\n\tif gpDisable == nil {\n\t\treturn errors.New(\"glDisable\")\n\t}\n\tgpDisableClientState = (C.GPDISABLECLIENTSTATE)(getProcAddr(\"glDisableClientState\"))\n\tif gpDisableClientState == nil {\n\t\treturn errors.New(\"glDisableClientState\")\n\t}\n\tgpDisableClientStateIndexedEXT = (C.GPDISABLECLIENTSTATEINDEXEDEXT)(getProcAddr(\"glDisableClientStateIndexedEXT\"))\n\tgpDisableClientStateiEXT = (C.GPDISABLECLIENTSTATEIEXT)(getProcAddr(\"glDisableClientStateiEXT\"))\n\tgpDisableIndexedEXT = (C.GPDISABLEINDEXEDEXT)(getProcAddr(\"glDisableIndexedEXT\"))\n\tgpDisableVariantClientStateEXT = (C.GPDISABLEVARIANTCLIENTSTATEEXT)(getProcAddr(\"glDisableVariantClientStateEXT\"))\n\tgpDisableVertexArrayAttrib = (C.GPDISABLEVERTEXARRAYATTRIB)(getProcAddr(\"glDisableVertexArrayAttrib\"))\n\tgpDisableVertexArrayAttribEXT = (C.GPDISABLEVERTEXARRAYATTRIBEXT)(getProcAddr(\"glDisableVertexArrayAttribEXT\"))\n\tgpDisableVertexArrayEXT = (C.GPDISABLEVERTEXARRAYEXT)(getProcAddr(\"glDisableVertexArrayEXT\"))\n\tgpDisableVertexAttribAPPLE = (C.GPDISABLEVERTEXATTRIBAPPLE)(getProcAddr(\"glDisableVertexAttribAPPLE\"))\n\tgpDisableVertexAttribArray = (C.GPDISABLEVERTEXATTRIBARRAY)(getProcAddr(\"glDisableVertexAttribArray\"))\n\tif gpDisableVertexAttribArray == nil {\n\t\treturn errors.New(\"glDisableVertexAttribArray\")\n\t}\n\tgpDisableVertexAttribArrayARB = (C.GPDISABLEVERTEXATTRIBARRAYARB)(getProcAddr(\"glDisableVertexAttribArrayARB\"))\n\tgpDisablei = (C.GPDISABLEI)(getProcAddr(\"glDisablei\"))\n\tif gpDisablei == nil {\n\t\treturn errors.New(\"glDisablei\")\n\t}\n\tgpDispatchCompute = (C.GPDISPATCHCOMPUTE)(getProcAddr(\"glDispatchCompute\"))\n\tif gpDispatchCompute == nil {\n\t\treturn errors.New(\"glDispatchCompute\")\n\t}\n\tgpDispatchComputeGroupSizeARB = (C.GPDISPATCHCOMPUTEGROUPSIZEARB)(getProcAddr(\"glDispatchComputeGroupSizeARB\"))\n\tgpDispatchComputeIndirect = (C.GPDISPATCHCOMPUTEINDIRECT)(getProcAddr(\"glDispatchComputeIndirect\"))\n\tif gpDispatchComputeIndirect == nil {\n\t\treturn errors.New(\"glDispatchComputeIndirect\")\n\t}\n\tgpDrawArrays = (C.GPDRAWARRAYS)(getProcAddr(\"glDrawArrays\"))\n\tif gpDrawArrays == nil {\n\t\treturn errors.New(\"glDrawArrays\")\n\t}\n\tgpDrawArraysEXT = (C.GPDRAWARRAYSEXT)(getProcAddr(\"glDrawArraysEXT\"))\n\tgpDrawArraysIndirect = (C.GPDRAWARRAYSINDIRECT)(getProcAddr(\"glDrawArraysIndirect\"))\n\tif gpDrawArraysIndirect == nil {\n\t\treturn errors.New(\"glDrawArraysIndirect\")\n\t}\n\tgpDrawArraysInstanced = (C.GPDRAWARRAYSINSTANCED)(getProcAddr(\"glDrawArraysInstanced\"))\n\tif gpDrawArraysInstanced == nil {\n\t\treturn errors.New(\"glDrawArraysInstanced\")\n\t}\n\tgpDrawArraysInstancedARB = (C.GPDRAWARRAYSINSTANCEDARB)(getProcAddr(\"glDrawArraysInstancedARB\"))\n\tgpDrawArraysInstancedBaseInstance = (C.GPDRAWARRAYSINSTANCEDBASEINSTANCE)(getProcAddr(\"glDrawArraysInstancedBaseInstance\"))\n\tif gpDrawArraysInstancedBaseInstance == nil {\n\t\treturn errors.New(\"glDrawArraysInstancedBaseInstance\")\n\t}\n\tgpDrawArraysInstancedEXT = (C.GPDRAWARRAYSINSTANCEDEXT)(getProcAddr(\"glDrawArraysInstancedEXT\"))\n\tgpDrawBuffer = (C.GPDRAWBUFFER)(getProcAddr(\"glDrawBuffer\"))\n\tif gpDrawBuffer == nil {\n\t\treturn errors.New(\"glDrawBuffer\")\n\t}\n\tgpDrawBuffers = (C.GPDRAWBUFFERS)(getProcAddr(\"glDrawBuffers\"))\n\tif gpDrawBuffers == nil {\n\t\treturn errors.New(\"glDrawBuffers\")\n\t}\n\tgpDrawBuffersARB = (C.GPDRAWBUFFERSARB)(getProcAddr(\"glDrawBuffersARB\"))\n\tgpDrawBuffersATI = (C.GPDRAWBUFFERSATI)(getProcAddr(\"glDrawBuffersATI\"))\n\tgpDrawCommandsAddressNV = (C.GPDRAWCOMMANDSADDRESSNV)(getProcAddr(\"glDrawCommandsAddressNV\"))\n\tgpDrawCommandsNV = (C.GPDRAWCOMMANDSNV)(getProcAddr(\"glDrawCommandsNV\"))\n\tgpDrawCommandsStatesAddressNV = (C.GPDRAWCOMMANDSSTATESADDRESSNV)(getProcAddr(\"glDrawCommandsStatesAddressNV\"))\n\tgpDrawCommandsStatesNV = (C.GPDRAWCOMMANDSSTATESNV)(getProcAddr(\"glDrawCommandsStatesNV\"))\n\tgpDrawElementArrayAPPLE = (C.GPDRAWELEMENTARRAYAPPLE)(getProcAddr(\"glDrawElementArrayAPPLE\"))\n\tgpDrawElementArrayATI = (C.GPDRAWELEMENTARRAYATI)(getProcAddr(\"glDrawElementArrayATI\"))\n\tgpDrawElements = (C.GPDRAWELEMENTS)(getProcAddr(\"glDrawElements\"))\n\tif gpDrawElements == nil {\n\t\treturn errors.New(\"glDrawElements\")\n\t}\n\tgpDrawElementsBaseVertex = (C.GPDRAWELEMENTSBASEVERTEX)(getProcAddr(\"glDrawElementsBaseVertex\"))\n\tif gpDrawElementsBaseVertex == nil {\n\t\treturn errors.New(\"glDrawElementsBaseVertex\")\n\t}\n\tgpDrawElementsIndirect = (C.GPDRAWELEMENTSINDIRECT)(getProcAddr(\"glDrawElementsIndirect\"))\n\tif gpDrawElementsIndirect == nil {\n\t\treturn errors.New(\"glDrawElementsIndirect\")\n\t}\n\tgpDrawElementsInstanced = (C.GPDRAWELEMENTSINSTANCED)(getProcAddr(\"glDrawElementsInstanced\"))\n\tif gpDrawElementsInstanced == nil {\n\t\treturn errors.New(\"glDrawElementsInstanced\")\n\t}\n\tgpDrawElementsInstancedARB = (C.GPDRAWELEMENTSINSTANCEDARB)(getProcAddr(\"glDrawElementsInstancedARB\"))\n\tgpDrawElementsInstancedBaseInstance = (C.GPDRAWELEMENTSINSTANCEDBASEINSTANCE)(getProcAddr(\"glDrawElementsInstancedBaseInstance\"))\n\tif gpDrawElementsInstancedBaseInstance == nil {\n\t\treturn errors.New(\"glDrawElementsInstancedBaseInstance\")\n\t}\n\tgpDrawElementsInstancedBaseVertex = (C.GPDRAWELEMENTSINSTANCEDBASEVERTEX)(getProcAddr(\"glDrawElementsInstancedBaseVertex\"))\n\tif gpDrawElementsInstancedBaseVertex == nil {\n\t\treturn errors.New(\"glDrawElementsInstancedBaseVertex\")\n\t}\n\tgpDrawElementsInstancedBaseVertexBaseInstance = (C.GPDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCE)(getProcAddr(\"glDrawElementsInstancedBaseVertexBaseInstance\"))\n\tif gpDrawElementsInstancedBaseVertexBaseInstance == nil {\n\t\treturn errors.New(\"glDrawElementsInstancedBaseVertexBaseInstance\")\n\t}\n\tgpDrawElementsInstancedEXT = (C.GPDRAWELEMENTSINSTANCEDEXT)(getProcAddr(\"glDrawElementsInstancedEXT\"))\n\tgpDrawMeshArraysSUN = (C.GPDRAWMESHARRAYSSUN)(getProcAddr(\"glDrawMeshArraysSUN\"))\n\tgpDrawMeshTasksIndirectNV = (C.GPDRAWMESHTASKSINDIRECTNV)(getProcAddr(\"glDrawMeshTasksIndirectNV\"))\n\tgpDrawMeshTasksNV = (C.GPDRAWMESHTASKSNV)(getProcAddr(\"glDrawMeshTasksNV\"))\n\tgpDrawPixels = (C.GPDRAWPIXELS)(getProcAddr(\"glDrawPixels\"))\n\tif gpDrawPixels == nil {\n\t\treturn errors.New(\"glDrawPixels\")\n\t}\n\tgpDrawRangeElementArrayAPPLE = (C.GPDRAWRANGEELEMENTARRAYAPPLE)(getProcAddr(\"glDrawRangeElementArrayAPPLE\"))\n\tgpDrawRangeElementArrayATI = (C.GPDRAWRANGEELEMENTARRAYATI)(getProcAddr(\"glDrawRangeElementArrayATI\"))\n\tgpDrawRangeElements = (C.GPDRAWRANGEELEMENTS)(getProcAddr(\"glDrawRangeElements\"))\n\tif gpDrawRangeElements == nil {\n\t\treturn errors.New(\"glDrawRangeElements\")\n\t}\n\tgpDrawRangeElementsBaseVertex = (C.GPDRAWRANGEELEMENTSBASEVERTEX)(getProcAddr(\"glDrawRangeElementsBaseVertex\"))\n\tif gpDrawRangeElementsBaseVertex == nil {\n\t\treturn errors.New(\"glDrawRangeElementsBaseVertex\")\n\t}\n\tgpDrawRangeElementsEXT = (C.GPDRAWRANGEELEMENTSEXT)(getProcAddr(\"glDrawRangeElementsEXT\"))\n\tgpDrawTextureNV = (C.GPDRAWTEXTURENV)(getProcAddr(\"glDrawTextureNV\"))\n\tgpDrawTransformFeedback = (C.GPDRAWTRANSFORMFEEDBACK)(getProcAddr(\"glDrawTransformFeedback\"))\n\tif gpDrawTransformFeedback == nil {\n\t\treturn errors.New(\"glDrawTransformFeedback\")\n\t}\n\tgpDrawTransformFeedbackInstanced = (C.GPDRAWTRANSFORMFEEDBACKINSTANCED)(getProcAddr(\"glDrawTransformFeedbackInstanced\"))\n\tif gpDrawTransformFeedbackInstanced == nil {\n\t\treturn errors.New(\"glDrawTransformFeedbackInstanced\")\n\t}\n\tgpDrawTransformFeedbackNV = (C.GPDRAWTRANSFORMFEEDBACKNV)(getProcAddr(\"glDrawTransformFeedbackNV\"))\n\tgpDrawTransformFeedbackStream = (C.GPDRAWTRANSFORMFEEDBACKSTREAM)(getProcAddr(\"glDrawTransformFeedbackStream\"))\n\tif gpDrawTransformFeedbackStream == nil {\n\t\treturn errors.New(\"glDrawTransformFeedbackStream\")\n\t}\n\tgpDrawTransformFeedbackStreamInstanced = (C.GPDRAWTRANSFORMFEEDBACKSTREAMINSTANCED)(getProcAddr(\"glDrawTransformFeedbackStreamInstanced\"))\n\tif gpDrawTransformFeedbackStreamInstanced == nil {\n\t\treturn errors.New(\"glDrawTransformFeedbackStreamInstanced\")\n\t}\n\tgpDrawVkImageNV = (C.GPDRAWVKIMAGENV)(getProcAddr(\"glDrawVkImageNV\"))\n\tgpEGLImageTargetTexStorageEXT = (C.GPEGLIMAGETARGETTEXSTORAGEEXT)(getProcAddr(\"glEGLImageTargetTexStorageEXT\"))\n\tgpEGLImageTargetTextureStorageEXT = (C.GPEGLIMAGETARGETTEXTURESTORAGEEXT)(getProcAddr(\"glEGLImageTargetTextureStorageEXT\"))\n\tgpEdgeFlag = (C.GPEDGEFLAG)(getProcAddr(\"glEdgeFlag\"))\n\tif gpEdgeFlag == nil {\n\t\treturn errors.New(\"glEdgeFlag\")\n\t}\n\tgpEdgeFlagFormatNV = (C.GPEDGEFLAGFORMATNV)(getProcAddr(\"glEdgeFlagFormatNV\"))\n\tgpEdgeFlagPointer = (C.GPEDGEFLAGPOINTER)(getProcAddr(\"glEdgeFlagPointer\"))\n\tif gpEdgeFlagPointer == nil {\n\t\treturn errors.New(\"glEdgeFlagPointer\")\n\t}\n\tgpEdgeFlagPointerEXT = (C.GPEDGEFLAGPOINTEREXT)(getProcAddr(\"glEdgeFlagPointerEXT\"))\n\tgpEdgeFlagPointerListIBM = (C.GPEDGEFLAGPOINTERLISTIBM)(getProcAddr(\"glEdgeFlagPointerListIBM\"))\n\tgpEdgeFlagv = (C.GPEDGEFLAGV)(getProcAddr(\"glEdgeFlagv\"))\n\tif gpEdgeFlagv == nil {\n\t\treturn errors.New(\"glEdgeFlagv\")\n\t}\n\tgpElementPointerAPPLE = (C.GPELEMENTPOINTERAPPLE)(getProcAddr(\"glElementPointerAPPLE\"))\n\tgpElementPointerATI = (C.GPELEMENTPOINTERATI)(getProcAddr(\"glElementPointerATI\"))\n\tgpEnable = (C.GPENABLE)(getProcAddr(\"glEnable\"))\n\tif gpEnable == nil {\n\t\treturn errors.New(\"glEnable\")\n\t}\n\tgpEnableClientState = (C.GPENABLECLIENTSTATE)(getProcAddr(\"glEnableClientState\"))\n\tif gpEnableClientState == nil {\n\t\treturn errors.New(\"glEnableClientState\")\n\t}\n\tgpEnableClientStateIndexedEXT = (C.GPENABLECLIENTSTATEINDEXEDEXT)(getProcAddr(\"glEnableClientStateIndexedEXT\"))\n\tgpEnableClientStateiEXT = (C.GPENABLECLIENTSTATEIEXT)(getProcAddr(\"glEnableClientStateiEXT\"))\n\tgpEnableIndexedEXT = (C.GPENABLEINDEXEDEXT)(getProcAddr(\"glEnableIndexedEXT\"))\n\tgpEnableVariantClientStateEXT = (C.GPENABLEVARIANTCLIENTSTATEEXT)(getProcAddr(\"glEnableVariantClientStateEXT\"))\n\tgpEnableVertexArrayAttrib = (C.GPENABLEVERTEXARRAYATTRIB)(getProcAddr(\"glEnableVertexArrayAttrib\"))\n\tgpEnableVertexArrayAttribEXT = (C.GPENABLEVERTEXARRAYATTRIBEXT)(getProcAddr(\"glEnableVertexArrayAttribEXT\"))\n\tgpEnableVertexArrayEXT = (C.GPENABLEVERTEXARRAYEXT)(getProcAddr(\"glEnableVertexArrayEXT\"))\n\tgpEnableVertexAttribAPPLE = (C.GPENABLEVERTEXATTRIBAPPLE)(getProcAddr(\"glEnableVertexAttribAPPLE\"))\n\tgpEnableVertexAttribArray = (C.GPENABLEVERTEXATTRIBARRAY)(getProcAddr(\"glEnableVertexAttribArray\"))\n\tif gpEnableVertexAttribArray == nil {\n\t\treturn errors.New(\"glEnableVertexAttribArray\")\n\t}\n\tgpEnableVertexAttribArrayARB = (C.GPENABLEVERTEXATTRIBARRAYARB)(getProcAddr(\"glEnableVertexAttribArrayARB\"))\n\tgpEnablei = (C.GPENABLEI)(getProcAddr(\"glEnablei\"))\n\tif gpEnablei == nil {\n\t\treturn errors.New(\"glEnablei\")\n\t}\n\tgpEnd = (C.GPEND)(getProcAddr(\"glEnd\"))\n\tif gpEnd == nil {\n\t\treturn errors.New(\"glEnd\")\n\t}\n\tgpEndConditionalRender = (C.GPENDCONDITIONALRENDER)(getProcAddr(\"glEndConditionalRender\"))\n\tif gpEndConditionalRender == nil {\n\t\treturn errors.New(\"glEndConditionalRender\")\n\t}\n\tgpEndConditionalRenderNV = (C.GPENDCONDITIONALRENDERNV)(getProcAddr(\"glEndConditionalRenderNV\"))\n\tgpEndConditionalRenderNVX = (C.GPENDCONDITIONALRENDERNVX)(getProcAddr(\"glEndConditionalRenderNVX\"))\n\tgpEndFragmentShaderATI = (C.GPENDFRAGMENTSHADERATI)(getProcAddr(\"glEndFragmentShaderATI\"))\n\tgpEndList = (C.GPENDLIST)(getProcAddr(\"glEndList\"))\n\tif gpEndList == nil {\n\t\treturn errors.New(\"glEndList\")\n\t}\n\tgpEndOcclusionQueryNV = (C.GPENDOCCLUSIONQUERYNV)(getProcAddr(\"glEndOcclusionQueryNV\"))\n\tgpEndPerfMonitorAMD = (C.GPENDPERFMONITORAMD)(getProcAddr(\"glEndPerfMonitorAMD\"))\n\tgpEndPerfQueryINTEL = (C.GPENDPERFQUERYINTEL)(getProcAddr(\"glEndPerfQueryINTEL\"))\n\tgpEndQuery = (C.GPENDQUERY)(getProcAddr(\"glEndQuery\"))\n\tif gpEndQuery == nil {\n\t\treturn errors.New(\"glEndQuery\")\n\t}\n\tgpEndQueryARB = (C.GPENDQUERYARB)(getProcAddr(\"glEndQueryARB\"))\n\tgpEndQueryIndexed = (C.GPENDQUERYINDEXED)(getProcAddr(\"glEndQueryIndexed\"))\n\tif gpEndQueryIndexed == nil {\n\t\treturn errors.New(\"glEndQueryIndexed\")\n\t}\n\tgpEndTransformFeedback = (C.GPENDTRANSFORMFEEDBACK)(getProcAddr(\"glEndTransformFeedback\"))\n\tif gpEndTransformFeedback == nil {\n\t\treturn errors.New(\"glEndTransformFeedback\")\n\t}\n\tgpEndTransformFeedbackEXT = (C.GPENDTRANSFORMFEEDBACKEXT)(getProcAddr(\"glEndTransformFeedbackEXT\"))\n\tgpEndTransformFeedbackNV = (C.GPENDTRANSFORMFEEDBACKNV)(getProcAddr(\"glEndTransformFeedbackNV\"))\n\tgpEndVertexShaderEXT = (C.GPENDVERTEXSHADEREXT)(getProcAddr(\"glEndVertexShaderEXT\"))\n\tgpEndVideoCaptureNV = (C.GPENDVIDEOCAPTURENV)(getProcAddr(\"glEndVideoCaptureNV\"))\n\tgpEvalCoord1d = (C.GPEVALCOORD1D)(getProcAddr(\"glEvalCoord1d\"))\n\tif gpEvalCoord1d == nil {\n\t\treturn errors.New(\"glEvalCoord1d\")\n\t}\n\tgpEvalCoord1dv = (C.GPEVALCOORD1DV)(getProcAddr(\"glEvalCoord1dv\"))\n\tif gpEvalCoord1dv == nil {\n\t\treturn errors.New(\"glEvalCoord1dv\")\n\t}\n\tgpEvalCoord1f = (C.GPEVALCOORD1F)(getProcAddr(\"glEvalCoord1f\"))\n\tif gpEvalCoord1f == nil {\n\t\treturn errors.New(\"glEvalCoord1f\")\n\t}\n\tgpEvalCoord1fv = (C.GPEVALCOORD1FV)(getProcAddr(\"glEvalCoord1fv\"))\n\tif gpEvalCoord1fv == nil {\n\t\treturn errors.New(\"glEvalCoord1fv\")\n\t}\n\tgpEvalCoord1xOES = (C.GPEVALCOORD1XOES)(getProcAddr(\"glEvalCoord1xOES\"))\n\tgpEvalCoord1xvOES = (C.GPEVALCOORD1XVOES)(getProcAddr(\"glEvalCoord1xvOES\"))\n\tgpEvalCoord2d = (C.GPEVALCOORD2D)(getProcAddr(\"glEvalCoord2d\"))\n\tif gpEvalCoord2d == nil {\n\t\treturn errors.New(\"glEvalCoord2d\")\n\t}\n\tgpEvalCoord2dv = (C.GPEVALCOORD2DV)(getProcAddr(\"glEvalCoord2dv\"))\n\tif gpEvalCoord2dv == nil {\n\t\treturn errors.New(\"glEvalCoord2dv\")\n\t}\n\tgpEvalCoord2f = (C.GPEVALCOORD2F)(getProcAddr(\"glEvalCoord2f\"))\n\tif gpEvalCoord2f == nil {\n\t\treturn errors.New(\"glEvalCoord2f\")\n\t}\n\tgpEvalCoord2fv = (C.GPEVALCOORD2FV)(getProcAddr(\"glEvalCoord2fv\"))\n\tif gpEvalCoord2fv == nil {\n\t\treturn errors.New(\"glEvalCoord2fv\")\n\t}\n\tgpEvalCoord2xOES = (C.GPEVALCOORD2XOES)(getProcAddr(\"glEvalCoord2xOES\"))\n\tgpEvalCoord2xvOES = (C.GPEVALCOORD2XVOES)(getProcAddr(\"glEvalCoord2xvOES\"))\n\tgpEvalMapsNV = (C.GPEVALMAPSNV)(getProcAddr(\"glEvalMapsNV\"))\n\tgpEvalMesh1 = (C.GPEVALMESH1)(getProcAddr(\"glEvalMesh1\"))\n\tif gpEvalMesh1 == nil {\n\t\treturn errors.New(\"glEvalMesh1\")\n\t}\n\tgpEvalMesh2 = (C.GPEVALMESH2)(getProcAddr(\"glEvalMesh2\"))\n\tif gpEvalMesh2 == nil {\n\t\treturn errors.New(\"glEvalMesh2\")\n\t}\n\tgpEvalPoint1 = (C.GPEVALPOINT1)(getProcAddr(\"glEvalPoint1\"))\n\tif gpEvalPoint1 == nil {\n\t\treturn errors.New(\"glEvalPoint1\")\n\t}\n\tgpEvalPoint2 = (C.GPEVALPOINT2)(getProcAddr(\"glEvalPoint2\"))\n\tif gpEvalPoint2 == nil {\n\t\treturn errors.New(\"glEvalPoint2\")\n\t}\n\tgpEvaluateDepthValuesARB = (C.GPEVALUATEDEPTHVALUESARB)(getProcAddr(\"glEvaluateDepthValuesARB\"))\n\tgpExecuteProgramNV = (C.GPEXECUTEPROGRAMNV)(getProcAddr(\"glExecuteProgramNV\"))\n\tgpExtractComponentEXT = (C.GPEXTRACTCOMPONENTEXT)(getProcAddr(\"glExtractComponentEXT\"))\n\tgpFeedbackBuffer = (C.GPFEEDBACKBUFFER)(getProcAddr(\"glFeedbackBuffer\"))\n\tif gpFeedbackBuffer == nil {\n\t\treturn errors.New(\"glFeedbackBuffer\")\n\t}\n\tgpFeedbackBufferxOES = (C.GPFEEDBACKBUFFERXOES)(getProcAddr(\"glFeedbackBufferxOES\"))\n\tgpFenceSync = (C.GPFENCESYNC)(getProcAddr(\"glFenceSync\"))\n\tif gpFenceSync == nil {\n\t\treturn errors.New(\"glFenceSync\")\n\t}\n\tgpFinalCombinerInputNV = (C.GPFINALCOMBINERINPUTNV)(getProcAddr(\"glFinalCombinerInputNV\"))\n\tgpFinish = (C.GPFINISH)(getProcAddr(\"glFinish\"))\n\tif gpFinish == nil {\n\t\treturn errors.New(\"glFinish\")\n\t}\n\tgpFinishAsyncSGIX = (C.GPFINISHASYNCSGIX)(getProcAddr(\"glFinishAsyncSGIX\"))\n\tgpFinishFenceAPPLE = (C.GPFINISHFENCEAPPLE)(getProcAddr(\"glFinishFenceAPPLE\"))\n\tgpFinishFenceNV = (C.GPFINISHFENCENV)(getProcAddr(\"glFinishFenceNV\"))\n\tgpFinishObjectAPPLE = (C.GPFINISHOBJECTAPPLE)(getProcAddr(\"glFinishObjectAPPLE\"))\n\tgpFinishTextureSUNX = (C.GPFINISHTEXTURESUNX)(getProcAddr(\"glFinishTextureSUNX\"))\n\tgpFlush = (C.GPFLUSH)(getProcAddr(\"glFlush\"))\n\tif gpFlush == nil {\n\t\treturn errors.New(\"glFlush\")\n\t}\n\tgpFlushMappedBufferRange = (C.GPFLUSHMAPPEDBUFFERRANGE)(getProcAddr(\"glFlushMappedBufferRange\"))\n\tif gpFlushMappedBufferRange == nil {\n\t\treturn errors.New(\"glFlushMappedBufferRange\")\n\t}\n\tgpFlushMappedBufferRangeAPPLE = (C.GPFLUSHMAPPEDBUFFERRANGEAPPLE)(getProcAddr(\"glFlushMappedBufferRangeAPPLE\"))\n\tgpFlushMappedNamedBufferRange = (C.GPFLUSHMAPPEDNAMEDBUFFERRANGE)(getProcAddr(\"glFlushMappedNamedBufferRange\"))\n\tgpFlushMappedNamedBufferRangeEXT = (C.GPFLUSHMAPPEDNAMEDBUFFERRANGEEXT)(getProcAddr(\"glFlushMappedNamedBufferRangeEXT\"))\n\tgpFlushPixelDataRangeNV = (C.GPFLUSHPIXELDATARANGENV)(getProcAddr(\"glFlushPixelDataRangeNV\"))\n\tgpFlushRasterSGIX = (C.GPFLUSHRASTERSGIX)(getProcAddr(\"glFlushRasterSGIX\"))\n\tgpFlushStaticDataIBM = (C.GPFLUSHSTATICDATAIBM)(getProcAddr(\"glFlushStaticDataIBM\"))\n\tgpFlushVertexArrayRangeAPPLE = (C.GPFLUSHVERTEXARRAYRANGEAPPLE)(getProcAddr(\"glFlushVertexArrayRangeAPPLE\"))\n\tgpFlushVertexArrayRangeNV = (C.GPFLUSHVERTEXARRAYRANGENV)(getProcAddr(\"glFlushVertexArrayRangeNV\"))\n\tgpFogCoordFormatNV = (C.GPFOGCOORDFORMATNV)(getProcAddr(\"glFogCoordFormatNV\"))\n\tgpFogCoordPointer = (C.GPFOGCOORDPOINTER)(getProcAddr(\"glFogCoordPointer\"))\n\tif gpFogCoordPointer == nil {\n\t\treturn errors.New(\"glFogCoordPointer\")\n\t}\n\tgpFogCoordPointerEXT = (C.GPFOGCOORDPOINTEREXT)(getProcAddr(\"glFogCoordPointerEXT\"))\n\tgpFogCoordPointerListIBM = (C.GPFOGCOORDPOINTERLISTIBM)(getProcAddr(\"glFogCoordPointerListIBM\"))\n\tgpFogCoordd = (C.GPFOGCOORDD)(getProcAddr(\"glFogCoordd\"))\n\tif gpFogCoordd == nil {\n\t\treturn errors.New(\"glFogCoordd\")\n\t}\n\tgpFogCoorddEXT = (C.GPFOGCOORDDEXT)(getProcAddr(\"glFogCoorddEXT\"))\n\tgpFogCoorddv = (C.GPFOGCOORDDV)(getProcAddr(\"glFogCoorddv\"))\n\tif gpFogCoorddv == nil {\n\t\treturn errors.New(\"glFogCoorddv\")\n\t}\n\tgpFogCoorddvEXT = (C.GPFOGCOORDDVEXT)(getProcAddr(\"glFogCoorddvEXT\"))\n\tgpFogCoordf = (C.GPFOGCOORDF)(getProcAddr(\"glFogCoordf\"))\n\tif gpFogCoordf == nil {\n\t\treturn errors.New(\"glFogCoordf\")\n\t}\n\tgpFogCoordfEXT = (C.GPFOGCOORDFEXT)(getProcAddr(\"glFogCoordfEXT\"))\n\tgpFogCoordfv = (C.GPFOGCOORDFV)(getProcAddr(\"glFogCoordfv\"))\n\tif gpFogCoordfv == nil {\n\t\treturn errors.New(\"glFogCoordfv\")\n\t}\n\tgpFogCoordfvEXT = (C.GPFOGCOORDFVEXT)(getProcAddr(\"glFogCoordfvEXT\"))\n\tgpFogCoordhNV = (C.GPFOGCOORDHNV)(getProcAddr(\"glFogCoordhNV\"))\n\tgpFogCoordhvNV = (C.GPFOGCOORDHVNV)(getProcAddr(\"glFogCoordhvNV\"))\n\tgpFogFuncSGIS = (C.GPFOGFUNCSGIS)(getProcAddr(\"glFogFuncSGIS\"))\n\tgpFogf = (C.GPFOGF)(getProcAddr(\"glFogf\"))\n\tif gpFogf == nil {\n\t\treturn errors.New(\"glFogf\")\n\t}\n\tgpFogfv = (C.GPFOGFV)(getProcAddr(\"glFogfv\"))\n\tif gpFogfv == nil {\n\t\treturn errors.New(\"glFogfv\")\n\t}\n\tgpFogi = (C.GPFOGI)(getProcAddr(\"glFogi\"))\n\tif gpFogi == nil {\n\t\treturn errors.New(\"glFogi\")\n\t}\n\tgpFogiv = (C.GPFOGIV)(getProcAddr(\"glFogiv\"))\n\tif gpFogiv == nil {\n\t\treturn errors.New(\"glFogiv\")\n\t}\n\tgpFogxOES = (C.GPFOGXOES)(getProcAddr(\"glFogxOES\"))\n\tgpFogxvOES = (C.GPFOGXVOES)(getProcAddr(\"glFogxvOES\"))\n\tgpFragmentColorMaterialSGIX = (C.GPFRAGMENTCOLORMATERIALSGIX)(getProcAddr(\"glFragmentColorMaterialSGIX\"))\n\tgpFragmentCoverageColorNV = (C.GPFRAGMENTCOVERAGECOLORNV)(getProcAddr(\"glFragmentCoverageColorNV\"))\n\tgpFragmentLightModelfSGIX = (C.GPFRAGMENTLIGHTMODELFSGIX)(getProcAddr(\"glFragmentLightModelfSGIX\"))\n\tgpFragmentLightModelfvSGIX = (C.GPFRAGMENTLIGHTMODELFVSGIX)(getProcAddr(\"glFragmentLightModelfvSGIX\"))\n\tgpFragmentLightModeliSGIX = (C.GPFRAGMENTLIGHTMODELISGIX)(getProcAddr(\"glFragmentLightModeliSGIX\"))\n\tgpFragmentLightModelivSGIX = (C.GPFRAGMENTLIGHTMODELIVSGIX)(getProcAddr(\"glFragmentLightModelivSGIX\"))\n\tgpFragmentLightfSGIX = (C.GPFRAGMENTLIGHTFSGIX)(getProcAddr(\"glFragmentLightfSGIX\"))\n\tgpFragmentLightfvSGIX = (C.GPFRAGMENTLIGHTFVSGIX)(getProcAddr(\"glFragmentLightfvSGIX\"))\n\tgpFragmentLightiSGIX = (C.GPFRAGMENTLIGHTISGIX)(getProcAddr(\"glFragmentLightiSGIX\"))\n\tgpFragmentLightivSGIX = (C.GPFRAGMENTLIGHTIVSGIX)(getProcAddr(\"glFragmentLightivSGIX\"))\n\tgpFragmentMaterialfSGIX = (C.GPFRAGMENTMATERIALFSGIX)(getProcAddr(\"glFragmentMaterialfSGIX\"))\n\tgpFragmentMaterialfvSGIX = (C.GPFRAGMENTMATERIALFVSGIX)(getProcAddr(\"glFragmentMaterialfvSGIX\"))\n\tgpFragmentMaterialiSGIX = (C.GPFRAGMENTMATERIALISGIX)(getProcAddr(\"glFragmentMaterialiSGIX\"))\n\tgpFragmentMaterialivSGIX = (C.GPFRAGMENTMATERIALIVSGIX)(getProcAddr(\"glFragmentMaterialivSGIX\"))\n\tgpFrameTerminatorGREMEDY = (C.GPFRAMETERMINATORGREMEDY)(getProcAddr(\"glFrameTerminatorGREMEDY\"))\n\tgpFrameZoomSGIX = (C.GPFRAMEZOOMSGIX)(getProcAddr(\"glFrameZoomSGIX\"))\n\tgpFramebufferDrawBufferEXT = (C.GPFRAMEBUFFERDRAWBUFFEREXT)(getProcAddr(\"glFramebufferDrawBufferEXT\"))\n\tgpFramebufferDrawBuffersEXT = (C.GPFRAMEBUFFERDRAWBUFFERSEXT)(getProcAddr(\"glFramebufferDrawBuffersEXT\"))\n\tgpFramebufferFetchBarrierEXT = (C.GPFRAMEBUFFERFETCHBARRIEREXT)(getProcAddr(\"glFramebufferFetchBarrierEXT\"))\n\tgpFramebufferParameteri = (C.GPFRAMEBUFFERPARAMETERI)(getProcAddr(\"glFramebufferParameteri\"))\n\tif gpFramebufferParameteri == nil {\n\t\treturn errors.New(\"glFramebufferParameteri\")\n\t}\n\tgpFramebufferParameteriMESA = (C.GPFRAMEBUFFERPARAMETERIMESA)(getProcAddr(\"glFramebufferParameteriMESA\"))\n\tgpFramebufferReadBufferEXT = (C.GPFRAMEBUFFERREADBUFFEREXT)(getProcAddr(\"glFramebufferReadBufferEXT\"))\n\tgpFramebufferRenderbuffer = (C.GPFRAMEBUFFERRENDERBUFFER)(getProcAddr(\"glFramebufferRenderbuffer\"))\n\tif gpFramebufferRenderbuffer == nil {\n\t\treturn errors.New(\"glFramebufferRenderbuffer\")\n\t}\n\tgpFramebufferRenderbufferEXT = (C.GPFRAMEBUFFERRENDERBUFFEREXT)(getProcAddr(\"glFramebufferRenderbufferEXT\"))\n\tgpFramebufferSampleLocationsfvARB = (C.GPFRAMEBUFFERSAMPLELOCATIONSFVARB)(getProcAddr(\"glFramebufferSampleLocationsfvARB\"))\n\tgpFramebufferSampleLocationsfvNV = (C.GPFRAMEBUFFERSAMPLELOCATIONSFVNV)(getProcAddr(\"glFramebufferSampleLocationsfvNV\"))\n\tgpFramebufferSamplePositionsfvAMD = (C.GPFRAMEBUFFERSAMPLEPOSITIONSFVAMD)(getProcAddr(\"glFramebufferSamplePositionsfvAMD\"))\n\tgpFramebufferTexture = (C.GPFRAMEBUFFERTEXTURE)(getProcAddr(\"glFramebufferTexture\"))\n\tif gpFramebufferTexture == nil {\n\t\treturn errors.New(\"glFramebufferTexture\")\n\t}\n\tgpFramebufferTexture1D = (C.GPFRAMEBUFFERTEXTURE1D)(getProcAddr(\"glFramebufferTexture1D\"))\n\tif gpFramebufferTexture1D == nil {\n\t\treturn errors.New(\"glFramebufferTexture1D\")\n\t}\n\tgpFramebufferTexture1DEXT = (C.GPFRAMEBUFFERTEXTURE1DEXT)(getProcAddr(\"glFramebufferTexture1DEXT\"))\n\tgpFramebufferTexture2D = (C.GPFRAMEBUFFERTEXTURE2D)(getProcAddr(\"glFramebufferTexture2D\"))\n\tif gpFramebufferTexture2D == nil {\n\t\treturn errors.New(\"glFramebufferTexture2D\")\n\t}\n\tgpFramebufferTexture2DEXT = (C.GPFRAMEBUFFERTEXTURE2DEXT)(getProcAddr(\"glFramebufferTexture2DEXT\"))\n\tgpFramebufferTexture3D = (C.GPFRAMEBUFFERTEXTURE3D)(getProcAddr(\"glFramebufferTexture3D\"))\n\tif gpFramebufferTexture3D == nil {\n\t\treturn errors.New(\"glFramebufferTexture3D\")\n\t}\n\tgpFramebufferTexture3DEXT = (C.GPFRAMEBUFFERTEXTURE3DEXT)(getProcAddr(\"glFramebufferTexture3DEXT\"))\n\tgpFramebufferTextureARB = (C.GPFRAMEBUFFERTEXTUREARB)(getProcAddr(\"glFramebufferTextureARB\"))\n\tgpFramebufferTextureEXT = (C.GPFRAMEBUFFERTEXTUREEXT)(getProcAddr(\"glFramebufferTextureEXT\"))\n\tgpFramebufferTextureFaceARB = (C.GPFRAMEBUFFERTEXTUREFACEARB)(getProcAddr(\"glFramebufferTextureFaceARB\"))\n\tgpFramebufferTextureFaceEXT = (C.GPFRAMEBUFFERTEXTUREFACEEXT)(getProcAddr(\"glFramebufferTextureFaceEXT\"))\n\tgpFramebufferTextureLayer = (C.GPFRAMEBUFFERTEXTURELAYER)(getProcAddr(\"glFramebufferTextureLayer\"))\n\tif gpFramebufferTextureLayer == nil {\n\t\treturn errors.New(\"glFramebufferTextureLayer\")\n\t}\n\tgpFramebufferTextureLayerARB = (C.GPFRAMEBUFFERTEXTURELAYERARB)(getProcAddr(\"glFramebufferTextureLayerARB\"))\n\tgpFramebufferTextureLayerEXT = (C.GPFRAMEBUFFERTEXTURELAYEREXT)(getProcAddr(\"glFramebufferTextureLayerEXT\"))\n\tgpFramebufferTextureMultiviewOVR = (C.GPFRAMEBUFFERTEXTUREMULTIVIEWOVR)(getProcAddr(\"glFramebufferTextureMultiviewOVR\"))\n\tgpFreeObjectBufferATI = (C.GPFREEOBJECTBUFFERATI)(getProcAddr(\"glFreeObjectBufferATI\"))\n\tgpFrontFace = (C.GPFRONTFACE)(getProcAddr(\"glFrontFace\"))\n\tif gpFrontFace == nil {\n\t\treturn errors.New(\"glFrontFace\")\n\t}\n\tgpFrustum = (C.GPFRUSTUM)(getProcAddr(\"glFrustum\"))\n\tif gpFrustum == nil {\n\t\treturn errors.New(\"glFrustum\")\n\t}\n\tgpFrustumfOES = (C.GPFRUSTUMFOES)(getProcAddr(\"glFrustumfOES\"))\n\tgpFrustumxOES = (C.GPFRUSTUMXOES)(getProcAddr(\"glFrustumxOES\"))\n\tgpGenAsyncMarkersSGIX = (C.GPGENASYNCMARKERSSGIX)(getProcAddr(\"glGenAsyncMarkersSGIX\"))\n\tgpGenBuffers = (C.GPGENBUFFERS)(getProcAddr(\"glGenBuffers\"))\n\tif gpGenBuffers == nil {\n\t\treturn errors.New(\"glGenBuffers\")\n\t}\n\tgpGenBuffersARB = (C.GPGENBUFFERSARB)(getProcAddr(\"glGenBuffersARB\"))\n\tgpGenFencesAPPLE = (C.GPGENFENCESAPPLE)(getProcAddr(\"glGenFencesAPPLE\"))\n\tgpGenFencesNV = (C.GPGENFENCESNV)(getProcAddr(\"glGenFencesNV\"))\n\tgpGenFragmentShadersATI = (C.GPGENFRAGMENTSHADERSATI)(getProcAddr(\"glGenFragmentShadersATI\"))\n\tgpGenFramebuffers = (C.GPGENFRAMEBUFFERS)(getProcAddr(\"glGenFramebuffers\"))\n\tif gpGenFramebuffers == nil {\n\t\treturn errors.New(\"glGenFramebuffers\")\n\t}\n\tgpGenFramebuffersEXT = (C.GPGENFRAMEBUFFERSEXT)(getProcAddr(\"glGenFramebuffersEXT\"))\n\tgpGenLists = (C.GPGENLISTS)(getProcAddr(\"glGenLists\"))\n\tif gpGenLists == nil {\n\t\treturn errors.New(\"glGenLists\")\n\t}\n\tgpGenNamesAMD = (C.GPGENNAMESAMD)(getProcAddr(\"glGenNamesAMD\"))\n\tgpGenOcclusionQueriesNV = (C.GPGENOCCLUSIONQUERIESNV)(getProcAddr(\"glGenOcclusionQueriesNV\"))\n\tgpGenPathsNV = (C.GPGENPATHSNV)(getProcAddr(\"glGenPathsNV\"))\n\tgpGenPerfMonitorsAMD = (C.GPGENPERFMONITORSAMD)(getProcAddr(\"glGenPerfMonitorsAMD\"))\n\tgpGenProgramPipelines = (C.GPGENPROGRAMPIPELINES)(getProcAddr(\"glGenProgramPipelines\"))\n\tif gpGenProgramPipelines == nil {\n\t\treturn errors.New(\"glGenProgramPipelines\")\n\t}\n\tgpGenProgramPipelinesEXT = (C.GPGENPROGRAMPIPELINESEXT)(getProcAddr(\"glGenProgramPipelinesEXT\"))\n\tgpGenProgramsARB = (C.GPGENPROGRAMSARB)(getProcAddr(\"glGenProgramsARB\"))\n\tgpGenProgramsNV = (C.GPGENPROGRAMSNV)(getProcAddr(\"glGenProgramsNV\"))\n\tgpGenQueries = (C.GPGENQUERIES)(getProcAddr(\"glGenQueries\"))\n\tif gpGenQueries == nil {\n\t\treturn errors.New(\"glGenQueries\")\n\t}\n\tgpGenQueriesARB = (C.GPGENQUERIESARB)(getProcAddr(\"glGenQueriesARB\"))\n\tgpGenQueryResourceTagNV = (C.GPGENQUERYRESOURCETAGNV)(getProcAddr(\"glGenQueryResourceTagNV\"))\n\tgpGenRenderbuffers = (C.GPGENRENDERBUFFERS)(getProcAddr(\"glGenRenderbuffers\"))\n\tif gpGenRenderbuffers == nil {\n\t\treturn errors.New(\"glGenRenderbuffers\")\n\t}\n\tgpGenRenderbuffersEXT = (C.GPGENRENDERBUFFERSEXT)(getProcAddr(\"glGenRenderbuffersEXT\"))\n\tgpGenSamplers = (C.GPGENSAMPLERS)(getProcAddr(\"glGenSamplers\"))\n\tif gpGenSamplers == nil {\n\t\treturn errors.New(\"glGenSamplers\")\n\t}\n\tgpGenSemaphoresEXT = (C.GPGENSEMAPHORESEXT)(getProcAddr(\"glGenSemaphoresEXT\"))\n\tgpGenSymbolsEXT = (C.GPGENSYMBOLSEXT)(getProcAddr(\"glGenSymbolsEXT\"))\n\tgpGenTextures = (C.GPGENTEXTURES)(getProcAddr(\"glGenTextures\"))\n\tif gpGenTextures == nil {\n\t\treturn errors.New(\"glGenTextures\")\n\t}\n\tgpGenTexturesEXT = (C.GPGENTEXTURESEXT)(getProcAddr(\"glGenTexturesEXT\"))\n\tgpGenTransformFeedbacks = (C.GPGENTRANSFORMFEEDBACKS)(getProcAddr(\"glGenTransformFeedbacks\"))\n\tif gpGenTransformFeedbacks == nil {\n\t\treturn errors.New(\"glGenTransformFeedbacks\")\n\t}\n\tgpGenTransformFeedbacksNV = (C.GPGENTRANSFORMFEEDBACKSNV)(getProcAddr(\"glGenTransformFeedbacksNV\"))\n\tgpGenVertexArrays = (C.GPGENVERTEXARRAYS)(getProcAddr(\"glGenVertexArrays\"))\n\tif gpGenVertexArrays == nil {\n\t\treturn errors.New(\"glGenVertexArrays\")\n\t}\n\tgpGenVertexArraysAPPLE = (C.GPGENVERTEXARRAYSAPPLE)(getProcAddr(\"glGenVertexArraysAPPLE\"))\n\tgpGenVertexShadersEXT = (C.GPGENVERTEXSHADERSEXT)(getProcAddr(\"glGenVertexShadersEXT\"))\n\tgpGenerateMipmap = (C.GPGENERATEMIPMAP)(getProcAddr(\"glGenerateMipmap\"))\n\tif gpGenerateMipmap == nil {\n\t\treturn errors.New(\"glGenerateMipmap\")\n\t}\n\tgpGenerateMipmapEXT = (C.GPGENERATEMIPMAPEXT)(getProcAddr(\"glGenerateMipmapEXT\"))\n\tgpGenerateMultiTexMipmapEXT = (C.GPGENERATEMULTITEXMIPMAPEXT)(getProcAddr(\"glGenerateMultiTexMipmapEXT\"))\n\tgpGenerateTextureMipmap = (C.GPGENERATETEXTUREMIPMAP)(getProcAddr(\"glGenerateTextureMipmap\"))\n\tgpGenerateTextureMipmapEXT = (C.GPGENERATETEXTUREMIPMAPEXT)(getProcAddr(\"glGenerateTextureMipmapEXT\"))\n\tgpGetActiveAtomicCounterBufferiv = (C.GPGETACTIVEATOMICCOUNTERBUFFERIV)(getProcAddr(\"glGetActiveAtomicCounterBufferiv\"))\n\tif gpGetActiveAtomicCounterBufferiv == nil {\n\t\treturn errors.New(\"glGetActiveAtomicCounterBufferiv\")\n\t}\n\tgpGetActiveAttrib = (C.GPGETACTIVEATTRIB)(getProcAddr(\"glGetActiveAttrib\"))\n\tif gpGetActiveAttrib == nil {\n\t\treturn errors.New(\"glGetActiveAttrib\")\n\t}\n\tgpGetActiveAttribARB = (C.GPGETACTIVEATTRIBARB)(getProcAddr(\"glGetActiveAttribARB\"))\n\tgpGetActiveSubroutineName = (C.GPGETACTIVESUBROUTINENAME)(getProcAddr(\"glGetActiveSubroutineName\"))\n\tif gpGetActiveSubroutineName == nil {\n\t\treturn errors.New(\"glGetActiveSubroutineName\")\n\t}\n\tgpGetActiveSubroutineUniformName = (C.GPGETACTIVESUBROUTINEUNIFORMNAME)(getProcAddr(\"glGetActiveSubroutineUniformName\"))\n\tif gpGetActiveSubroutineUniformName == nil {\n\t\treturn errors.New(\"glGetActiveSubroutineUniformName\")\n\t}\n\tgpGetActiveSubroutineUniformiv = (C.GPGETACTIVESUBROUTINEUNIFORMIV)(getProcAddr(\"glGetActiveSubroutineUniformiv\"))\n\tif gpGetActiveSubroutineUniformiv == nil {\n\t\treturn errors.New(\"glGetActiveSubroutineUniformiv\")\n\t}\n\tgpGetActiveUniform = (C.GPGETACTIVEUNIFORM)(getProcAddr(\"glGetActiveUniform\"))\n\tif gpGetActiveUniform == nil {\n\t\treturn errors.New(\"glGetActiveUniform\")\n\t}\n\tgpGetActiveUniformARB = (C.GPGETACTIVEUNIFORMARB)(getProcAddr(\"glGetActiveUniformARB\"))\n\tgpGetActiveUniformBlockName = (C.GPGETACTIVEUNIFORMBLOCKNAME)(getProcAddr(\"glGetActiveUniformBlockName\"))\n\tif gpGetActiveUniformBlockName == nil {\n\t\treturn errors.New(\"glGetActiveUniformBlockName\")\n\t}\n\tgpGetActiveUniformBlockiv = (C.GPGETACTIVEUNIFORMBLOCKIV)(getProcAddr(\"glGetActiveUniformBlockiv\"))\n\tif gpGetActiveUniformBlockiv == nil {\n\t\treturn errors.New(\"glGetActiveUniformBlockiv\")\n\t}\n\tgpGetActiveUniformName = (C.GPGETACTIVEUNIFORMNAME)(getProcAddr(\"glGetActiveUniformName\"))\n\tif gpGetActiveUniformName == nil {\n\t\treturn errors.New(\"glGetActiveUniformName\")\n\t}\n\tgpGetActiveUniformsiv = (C.GPGETACTIVEUNIFORMSIV)(getProcAddr(\"glGetActiveUniformsiv\"))\n\tif gpGetActiveUniformsiv == nil {\n\t\treturn errors.New(\"glGetActiveUniformsiv\")\n\t}\n\tgpGetActiveVaryingNV = (C.GPGETACTIVEVARYINGNV)(getProcAddr(\"glGetActiveVaryingNV\"))\n\tgpGetArrayObjectfvATI = (C.GPGETARRAYOBJECTFVATI)(getProcAddr(\"glGetArrayObjectfvATI\"))\n\tgpGetArrayObjectivATI = (C.GPGETARRAYOBJECTIVATI)(getProcAddr(\"glGetArrayObjectivATI\"))\n\tgpGetAttachedObjectsARB = (C.GPGETATTACHEDOBJECTSARB)(getProcAddr(\"glGetAttachedObjectsARB\"))\n\tgpGetAttachedShaders = (C.GPGETATTACHEDSHADERS)(getProcAddr(\"glGetAttachedShaders\"))\n\tif gpGetAttachedShaders == nil {\n\t\treturn errors.New(\"glGetAttachedShaders\")\n\t}\n\tgpGetAttribLocation = (C.GPGETATTRIBLOCATION)(getProcAddr(\"glGetAttribLocation\"))\n\tif gpGetAttribLocation == nil {\n\t\treturn errors.New(\"glGetAttribLocation\")\n\t}\n\tgpGetAttribLocationARB = (C.GPGETATTRIBLOCATIONARB)(getProcAddr(\"glGetAttribLocationARB\"))\n\tgpGetBooleanIndexedvEXT = (C.GPGETBOOLEANINDEXEDVEXT)(getProcAddr(\"glGetBooleanIndexedvEXT\"))\n\tgpGetBooleani_v = (C.GPGETBOOLEANI_V)(getProcAddr(\"glGetBooleani_v\"))\n\tif gpGetBooleani_v == nil {\n\t\treturn errors.New(\"glGetBooleani_v\")\n\t}\n\tgpGetBooleanv = (C.GPGETBOOLEANV)(getProcAddr(\"glGetBooleanv\"))\n\tif gpGetBooleanv == nil {\n\t\treturn errors.New(\"glGetBooleanv\")\n\t}\n\tgpGetBufferParameteri64v = (C.GPGETBUFFERPARAMETERI64V)(getProcAddr(\"glGetBufferParameteri64v\"))\n\tif gpGetBufferParameteri64v == nil {\n\t\treturn errors.New(\"glGetBufferParameteri64v\")\n\t}\n\tgpGetBufferParameteriv = (C.GPGETBUFFERPARAMETERIV)(getProcAddr(\"glGetBufferParameteriv\"))\n\tif gpGetBufferParameteriv == nil {\n\t\treturn errors.New(\"glGetBufferParameteriv\")\n\t}\n\tgpGetBufferParameterivARB = (C.GPGETBUFFERPARAMETERIVARB)(getProcAddr(\"glGetBufferParameterivARB\"))\n\tgpGetBufferParameterui64vNV = (C.GPGETBUFFERPARAMETERUI64VNV)(getProcAddr(\"glGetBufferParameterui64vNV\"))\n\tgpGetBufferPointerv = (C.GPGETBUFFERPOINTERV)(getProcAddr(\"glGetBufferPointerv\"))\n\tif gpGetBufferPointerv == nil {\n\t\treturn errors.New(\"glGetBufferPointerv\")\n\t}\n\tgpGetBufferPointervARB = (C.GPGETBUFFERPOINTERVARB)(getProcAddr(\"glGetBufferPointervARB\"))\n\tgpGetBufferSubData = (C.GPGETBUFFERSUBDATA)(getProcAddr(\"glGetBufferSubData\"))\n\tif gpGetBufferSubData == nil {\n\t\treturn errors.New(\"glGetBufferSubData\")\n\t}\n\tgpGetBufferSubDataARB = (C.GPGETBUFFERSUBDATAARB)(getProcAddr(\"glGetBufferSubDataARB\"))\n\tgpGetClipPlane = (C.GPGETCLIPPLANE)(getProcAddr(\"glGetClipPlane\"))\n\tif gpGetClipPlane == nil {\n\t\treturn errors.New(\"glGetClipPlane\")\n\t}\n\tgpGetClipPlanefOES = (C.GPGETCLIPPLANEFOES)(getProcAddr(\"glGetClipPlanefOES\"))\n\tgpGetClipPlanexOES = (C.GPGETCLIPPLANEXOES)(getProcAddr(\"glGetClipPlanexOES\"))\n\tgpGetColorTable = (C.GPGETCOLORTABLE)(getProcAddr(\"glGetColorTable\"))\n\tgpGetColorTableEXT = (C.GPGETCOLORTABLEEXT)(getProcAddr(\"glGetColorTableEXT\"))\n\tgpGetColorTableParameterfv = (C.GPGETCOLORTABLEPARAMETERFV)(getProcAddr(\"glGetColorTableParameterfv\"))\n\tgpGetColorTableParameterfvEXT = (C.GPGETCOLORTABLEPARAMETERFVEXT)(getProcAddr(\"glGetColorTableParameterfvEXT\"))\n\tgpGetColorTableParameterfvSGI = (C.GPGETCOLORTABLEPARAMETERFVSGI)(getProcAddr(\"glGetColorTableParameterfvSGI\"))\n\tgpGetColorTableParameteriv = (C.GPGETCOLORTABLEPARAMETERIV)(getProcAddr(\"glGetColorTableParameteriv\"))\n\tgpGetColorTableParameterivEXT = (C.GPGETCOLORTABLEPARAMETERIVEXT)(getProcAddr(\"glGetColorTableParameterivEXT\"))\n\tgpGetColorTableParameterivSGI = (C.GPGETCOLORTABLEPARAMETERIVSGI)(getProcAddr(\"glGetColorTableParameterivSGI\"))\n\tgpGetColorTableSGI = (C.GPGETCOLORTABLESGI)(getProcAddr(\"glGetColorTableSGI\"))\n\tgpGetCombinerInputParameterfvNV = (C.GPGETCOMBINERINPUTPARAMETERFVNV)(getProcAddr(\"glGetCombinerInputParameterfvNV\"))\n\tgpGetCombinerInputParameterivNV = (C.GPGETCOMBINERINPUTPARAMETERIVNV)(getProcAddr(\"glGetCombinerInputParameterivNV\"))\n\tgpGetCombinerOutputParameterfvNV = (C.GPGETCOMBINEROUTPUTPARAMETERFVNV)(getProcAddr(\"glGetCombinerOutputParameterfvNV\"))\n\tgpGetCombinerOutputParameterivNV = (C.GPGETCOMBINEROUTPUTPARAMETERIVNV)(getProcAddr(\"glGetCombinerOutputParameterivNV\"))\n\tgpGetCombinerStageParameterfvNV = (C.GPGETCOMBINERSTAGEPARAMETERFVNV)(getProcAddr(\"glGetCombinerStageParameterfvNV\"))\n\tgpGetCommandHeaderNV = (C.GPGETCOMMANDHEADERNV)(getProcAddr(\"glGetCommandHeaderNV\"))\n\tgpGetCompressedMultiTexImageEXT = (C.GPGETCOMPRESSEDMULTITEXIMAGEEXT)(getProcAddr(\"glGetCompressedMultiTexImageEXT\"))\n\tgpGetCompressedTexImage = (C.GPGETCOMPRESSEDTEXIMAGE)(getProcAddr(\"glGetCompressedTexImage\"))\n\tif gpGetCompressedTexImage == nil {\n\t\treturn errors.New(\"glGetCompressedTexImage\")\n\t}\n\tgpGetCompressedTexImageARB = (C.GPGETCOMPRESSEDTEXIMAGEARB)(getProcAddr(\"glGetCompressedTexImageARB\"))\n\tgpGetCompressedTextureImage = (C.GPGETCOMPRESSEDTEXTUREIMAGE)(getProcAddr(\"glGetCompressedTextureImage\"))\n\tgpGetCompressedTextureImageEXT = (C.GPGETCOMPRESSEDTEXTUREIMAGEEXT)(getProcAddr(\"glGetCompressedTextureImageEXT\"))\n\tgpGetCompressedTextureSubImage = (C.GPGETCOMPRESSEDTEXTURESUBIMAGE)(getProcAddr(\"glGetCompressedTextureSubImage\"))\n\tgpGetConvolutionFilter = (C.GPGETCONVOLUTIONFILTER)(getProcAddr(\"glGetConvolutionFilter\"))\n\tgpGetConvolutionFilterEXT = (C.GPGETCONVOLUTIONFILTEREXT)(getProcAddr(\"glGetConvolutionFilterEXT\"))\n\tgpGetConvolutionParameterfv = (C.GPGETCONVOLUTIONPARAMETERFV)(getProcAddr(\"glGetConvolutionParameterfv\"))\n\tgpGetConvolutionParameterfvEXT = (C.GPGETCONVOLUTIONPARAMETERFVEXT)(getProcAddr(\"glGetConvolutionParameterfvEXT\"))\n\tgpGetConvolutionParameteriv = (C.GPGETCONVOLUTIONPARAMETERIV)(getProcAddr(\"glGetConvolutionParameteriv\"))\n\tgpGetConvolutionParameterivEXT = (C.GPGETCONVOLUTIONPARAMETERIVEXT)(getProcAddr(\"glGetConvolutionParameterivEXT\"))\n\tgpGetConvolutionParameterxvOES = (C.GPGETCONVOLUTIONPARAMETERXVOES)(getProcAddr(\"glGetConvolutionParameterxvOES\"))\n\tgpGetCoverageModulationTableNV = (C.GPGETCOVERAGEMODULATIONTABLENV)(getProcAddr(\"glGetCoverageModulationTableNV\"))\n\tgpGetDebugMessageLog = (C.GPGETDEBUGMESSAGELOG)(getProcAddr(\"glGetDebugMessageLog\"))\n\tif gpGetDebugMessageLog == nil {\n\t\treturn errors.New(\"glGetDebugMessageLog\")\n\t}\n\tgpGetDebugMessageLogAMD = (C.GPGETDEBUGMESSAGELOGAMD)(getProcAddr(\"glGetDebugMessageLogAMD\"))\n\tgpGetDebugMessageLogARB = (C.GPGETDEBUGMESSAGELOGARB)(getProcAddr(\"glGetDebugMessageLogARB\"))\n\tgpGetDebugMessageLogKHR = (C.GPGETDEBUGMESSAGELOGKHR)(getProcAddr(\"glGetDebugMessageLogKHR\"))\n\tgpGetDetailTexFuncSGIS = (C.GPGETDETAILTEXFUNCSGIS)(getProcAddr(\"glGetDetailTexFuncSGIS\"))\n\tgpGetDoubleIndexedvEXT = (C.GPGETDOUBLEINDEXEDVEXT)(getProcAddr(\"glGetDoubleIndexedvEXT\"))\n\tgpGetDoublei_v = (C.GPGETDOUBLEI_V)(getProcAddr(\"glGetDoublei_v\"))\n\tif gpGetDoublei_v == nil {\n\t\treturn errors.New(\"glGetDoublei_v\")\n\t}\n\tgpGetDoublei_vEXT = (C.GPGETDOUBLEI_VEXT)(getProcAddr(\"glGetDoublei_vEXT\"))\n\tgpGetDoublev = (C.GPGETDOUBLEV)(getProcAddr(\"glGetDoublev\"))\n\tif gpGetDoublev == nil {\n\t\treturn errors.New(\"glGetDoublev\")\n\t}\n\tgpGetError = (C.GPGETERROR)(getProcAddr(\"glGetError\"))\n\tif gpGetError == nil {\n\t\treturn errors.New(\"glGetError\")\n\t}\n\tgpGetFenceivNV = (C.GPGETFENCEIVNV)(getProcAddr(\"glGetFenceivNV\"))\n\tgpGetFinalCombinerInputParameterfvNV = (C.GPGETFINALCOMBINERINPUTPARAMETERFVNV)(getProcAddr(\"glGetFinalCombinerInputParameterfvNV\"))\n\tgpGetFinalCombinerInputParameterivNV = (C.GPGETFINALCOMBINERINPUTPARAMETERIVNV)(getProcAddr(\"glGetFinalCombinerInputParameterivNV\"))\n\tgpGetFirstPerfQueryIdINTEL = (C.GPGETFIRSTPERFQUERYIDINTEL)(getProcAddr(\"glGetFirstPerfQueryIdINTEL\"))\n\tgpGetFixedvOES = (C.GPGETFIXEDVOES)(getProcAddr(\"glGetFixedvOES\"))\n\tgpGetFloatIndexedvEXT = (C.GPGETFLOATINDEXEDVEXT)(getProcAddr(\"glGetFloatIndexedvEXT\"))\n\tgpGetFloati_v = (C.GPGETFLOATI_V)(getProcAddr(\"glGetFloati_v\"))\n\tif gpGetFloati_v == nil {\n\t\treturn errors.New(\"glGetFloati_v\")\n\t}\n\tgpGetFloati_vEXT = (C.GPGETFLOATI_VEXT)(getProcAddr(\"glGetFloati_vEXT\"))\n\tgpGetFloatv = (C.GPGETFLOATV)(getProcAddr(\"glGetFloatv\"))\n\tif gpGetFloatv == nil {\n\t\treturn errors.New(\"glGetFloatv\")\n\t}\n\tgpGetFogFuncSGIS = (C.GPGETFOGFUNCSGIS)(getProcAddr(\"glGetFogFuncSGIS\"))\n\tgpGetFragDataIndex = (C.GPGETFRAGDATAINDEX)(getProcAddr(\"glGetFragDataIndex\"))\n\tif gpGetFragDataIndex == nil {\n\t\treturn errors.New(\"glGetFragDataIndex\")\n\t}\n\tgpGetFragDataLocation = (C.GPGETFRAGDATALOCATION)(getProcAddr(\"glGetFragDataLocation\"))\n\tif gpGetFragDataLocation == nil {\n\t\treturn errors.New(\"glGetFragDataLocation\")\n\t}\n\tgpGetFragDataLocationEXT = (C.GPGETFRAGDATALOCATIONEXT)(getProcAddr(\"glGetFragDataLocationEXT\"))\n\tgpGetFragmentLightfvSGIX = (C.GPGETFRAGMENTLIGHTFVSGIX)(getProcAddr(\"glGetFragmentLightfvSGIX\"))\n\tgpGetFragmentLightivSGIX = (C.GPGETFRAGMENTLIGHTIVSGIX)(getProcAddr(\"glGetFragmentLightivSGIX\"))\n\tgpGetFragmentMaterialfvSGIX = (C.GPGETFRAGMENTMATERIALFVSGIX)(getProcAddr(\"glGetFragmentMaterialfvSGIX\"))\n\tgpGetFragmentMaterialivSGIX = (C.GPGETFRAGMENTMATERIALIVSGIX)(getProcAddr(\"glGetFragmentMaterialivSGIX\"))\n\tgpGetFramebufferAttachmentParameteriv = (C.GPGETFRAMEBUFFERATTACHMENTPARAMETERIV)(getProcAddr(\"glGetFramebufferAttachmentParameteriv\"))\n\tif gpGetFramebufferAttachmentParameteriv == nil {\n\t\treturn errors.New(\"glGetFramebufferAttachmentParameteriv\")\n\t}\n\tgpGetFramebufferAttachmentParameterivEXT = (C.GPGETFRAMEBUFFERATTACHMENTPARAMETERIVEXT)(getProcAddr(\"glGetFramebufferAttachmentParameterivEXT\"))\n\tgpGetFramebufferParameterfvAMD = (C.GPGETFRAMEBUFFERPARAMETERFVAMD)(getProcAddr(\"glGetFramebufferParameterfvAMD\"))\n\tgpGetFramebufferParameteriv = (C.GPGETFRAMEBUFFERPARAMETERIV)(getProcAddr(\"glGetFramebufferParameteriv\"))\n\tif gpGetFramebufferParameteriv == nil {\n\t\treturn errors.New(\"glGetFramebufferParameteriv\")\n\t}\n\tgpGetFramebufferParameterivEXT = (C.GPGETFRAMEBUFFERPARAMETERIVEXT)(getProcAddr(\"glGetFramebufferParameterivEXT\"))\n\tgpGetFramebufferParameterivMESA = (C.GPGETFRAMEBUFFERPARAMETERIVMESA)(getProcAddr(\"glGetFramebufferParameterivMESA\"))\n\tgpGetGraphicsResetStatus = (C.GPGETGRAPHICSRESETSTATUS)(getProcAddr(\"glGetGraphicsResetStatus\"))\n\tgpGetGraphicsResetStatusARB = (C.GPGETGRAPHICSRESETSTATUSARB)(getProcAddr(\"glGetGraphicsResetStatusARB\"))\n\tgpGetGraphicsResetStatusKHR = (C.GPGETGRAPHICSRESETSTATUSKHR)(getProcAddr(\"glGetGraphicsResetStatusKHR\"))\n\tgpGetHandleARB = (C.GPGETHANDLEARB)(getProcAddr(\"glGetHandleARB\"))\n\tgpGetHistogram = (C.GPGETHISTOGRAM)(getProcAddr(\"glGetHistogram\"))\n\tgpGetHistogramEXT = (C.GPGETHISTOGRAMEXT)(getProcAddr(\"glGetHistogramEXT\"))\n\tgpGetHistogramParameterfv = (C.GPGETHISTOGRAMPARAMETERFV)(getProcAddr(\"glGetHistogramParameterfv\"))\n\tgpGetHistogramParameterfvEXT = (C.GPGETHISTOGRAMPARAMETERFVEXT)(getProcAddr(\"glGetHistogramParameterfvEXT\"))\n\tgpGetHistogramParameteriv = (C.GPGETHISTOGRAMPARAMETERIV)(getProcAddr(\"glGetHistogramParameteriv\"))\n\tgpGetHistogramParameterivEXT = (C.GPGETHISTOGRAMPARAMETERIVEXT)(getProcAddr(\"glGetHistogramParameterivEXT\"))\n\tgpGetHistogramParameterxvOES = (C.GPGETHISTOGRAMPARAMETERXVOES)(getProcAddr(\"glGetHistogramParameterxvOES\"))\n\tgpGetImageHandleARB = (C.GPGETIMAGEHANDLEARB)(getProcAddr(\"glGetImageHandleARB\"))\n\tgpGetImageHandleNV = (C.GPGETIMAGEHANDLENV)(getProcAddr(\"glGetImageHandleNV\"))\n\tgpGetImageTransformParameterfvHP = (C.GPGETIMAGETRANSFORMPARAMETERFVHP)(getProcAddr(\"glGetImageTransformParameterfvHP\"))\n\tgpGetImageTransformParameterivHP = (C.GPGETIMAGETRANSFORMPARAMETERIVHP)(getProcAddr(\"glGetImageTransformParameterivHP\"))\n\tgpGetInfoLogARB = (C.GPGETINFOLOGARB)(getProcAddr(\"glGetInfoLogARB\"))\n\tgpGetInstrumentsSGIX = (C.GPGETINSTRUMENTSSGIX)(getProcAddr(\"glGetInstrumentsSGIX\"))\n\tgpGetInteger64i_v = (C.GPGETINTEGER64I_V)(getProcAddr(\"glGetInteger64i_v\"))\n\tif gpGetInteger64i_v == nil {\n\t\treturn errors.New(\"glGetInteger64i_v\")\n\t}\n\tgpGetInteger64v = (C.GPGETINTEGER64V)(getProcAddr(\"glGetInteger64v\"))\n\tif gpGetInteger64v == nil {\n\t\treturn errors.New(\"glGetInteger64v\")\n\t}\n\tgpGetIntegerIndexedvEXT = (C.GPGETINTEGERINDEXEDVEXT)(getProcAddr(\"glGetIntegerIndexedvEXT\"))\n\tgpGetIntegeri_v = (C.GPGETINTEGERI_V)(getProcAddr(\"glGetIntegeri_v\"))\n\tif gpGetIntegeri_v == nil {\n\t\treturn errors.New(\"glGetIntegeri_v\")\n\t}\n\tgpGetIntegerui64i_vNV = (C.GPGETINTEGERUI64I_VNV)(getProcAddr(\"glGetIntegerui64i_vNV\"))\n\tgpGetIntegerui64vNV = (C.GPGETINTEGERUI64VNV)(getProcAddr(\"glGetIntegerui64vNV\"))\n\tgpGetIntegerv = (C.GPGETINTEGERV)(getProcAddr(\"glGetIntegerv\"))\n\tif gpGetIntegerv == nil {\n\t\treturn errors.New(\"glGetIntegerv\")\n\t}\n\tgpGetInternalformatSampleivNV = (C.GPGETINTERNALFORMATSAMPLEIVNV)(getProcAddr(\"glGetInternalformatSampleivNV\"))\n\tgpGetInternalformati64v = (C.GPGETINTERNALFORMATI64V)(getProcAddr(\"glGetInternalformati64v\"))\n\tif gpGetInternalformati64v == nil {\n\t\treturn errors.New(\"glGetInternalformati64v\")\n\t}\n\tgpGetInternalformativ = (C.GPGETINTERNALFORMATIV)(getProcAddr(\"glGetInternalformativ\"))\n\tif gpGetInternalformativ == nil {\n\t\treturn errors.New(\"glGetInternalformativ\")\n\t}\n\tgpGetInvariantBooleanvEXT = (C.GPGETINVARIANTBOOLEANVEXT)(getProcAddr(\"glGetInvariantBooleanvEXT\"))\n\tgpGetInvariantFloatvEXT = (C.GPGETINVARIANTFLOATVEXT)(getProcAddr(\"glGetInvariantFloatvEXT\"))\n\tgpGetInvariantIntegervEXT = (C.GPGETINVARIANTINTEGERVEXT)(getProcAddr(\"glGetInvariantIntegervEXT\"))\n\tgpGetLightfv = (C.GPGETLIGHTFV)(getProcAddr(\"glGetLightfv\"))\n\tif gpGetLightfv == nil {\n\t\treturn errors.New(\"glGetLightfv\")\n\t}\n\tgpGetLightiv = (C.GPGETLIGHTIV)(getProcAddr(\"glGetLightiv\"))\n\tif gpGetLightiv == nil {\n\t\treturn errors.New(\"glGetLightiv\")\n\t}\n\tgpGetLightxOES = (C.GPGETLIGHTXOES)(getProcAddr(\"glGetLightxOES\"))\n\tgpGetLightxvOES = (C.GPGETLIGHTXVOES)(getProcAddr(\"glGetLightxvOES\"))\n\tgpGetListParameterfvSGIX = (C.GPGETLISTPARAMETERFVSGIX)(getProcAddr(\"glGetListParameterfvSGIX\"))\n\tgpGetListParameterivSGIX = (C.GPGETLISTPARAMETERIVSGIX)(getProcAddr(\"glGetListParameterivSGIX\"))\n\tgpGetLocalConstantBooleanvEXT = (C.GPGETLOCALCONSTANTBOOLEANVEXT)(getProcAddr(\"glGetLocalConstantBooleanvEXT\"))\n\tgpGetLocalConstantFloatvEXT = (C.GPGETLOCALCONSTANTFLOATVEXT)(getProcAddr(\"glGetLocalConstantFloatvEXT\"))\n\tgpGetLocalConstantIntegervEXT = (C.GPGETLOCALCONSTANTINTEGERVEXT)(getProcAddr(\"glGetLocalConstantIntegervEXT\"))\n\tgpGetMapAttribParameterfvNV = (C.GPGETMAPATTRIBPARAMETERFVNV)(getProcAddr(\"glGetMapAttribParameterfvNV\"))\n\tgpGetMapAttribParameterivNV = (C.GPGETMAPATTRIBPARAMETERIVNV)(getProcAddr(\"glGetMapAttribParameterivNV\"))\n\tgpGetMapControlPointsNV = (C.GPGETMAPCONTROLPOINTSNV)(getProcAddr(\"glGetMapControlPointsNV\"))\n\tgpGetMapParameterfvNV = (C.GPGETMAPPARAMETERFVNV)(getProcAddr(\"glGetMapParameterfvNV\"))\n\tgpGetMapParameterivNV = (C.GPGETMAPPARAMETERIVNV)(getProcAddr(\"glGetMapParameterivNV\"))\n\tgpGetMapdv = (C.GPGETMAPDV)(getProcAddr(\"glGetMapdv\"))\n\tif gpGetMapdv == nil {\n\t\treturn errors.New(\"glGetMapdv\")\n\t}\n\tgpGetMapfv = (C.GPGETMAPFV)(getProcAddr(\"glGetMapfv\"))\n\tif gpGetMapfv == nil {\n\t\treturn errors.New(\"glGetMapfv\")\n\t}\n\tgpGetMapiv = (C.GPGETMAPIV)(getProcAddr(\"glGetMapiv\"))\n\tif gpGetMapiv == nil {\n\t\treturn errors.New(\"glGetMapiv\")\n\t}\n\tgpGetMapxvOES = (C.GPGETMAPXVOES)(getProcAddr(\"glGetMapxvOES\"))\n\tgpGetMaterialfv = (C.GPGETMATERIALFV)(getProcAddr(\"glGetMaterialfv\"))\n\tif gpGetMaterialfv == nil {\n\t\treturn errors.New(\"glGetMaterialfv\")\n\t}\n\tgpGetMaterialiv = (C.GPGETMATERIALIV)(getProcAddr(\"glGetMaterialiv\"))\n\tif gpGetMaterialiv == nil {\n\t\treturn errors.New(\"glGetMaterialiv\")\n\t}\n\tgpGetMaterialxOES = (C.GPGETMATERIALXOES)(getProcAddr(\"glGetMaterialxOES\"))\n\tgpGetMaterialxvOES = (C.GPGETMATERIALXVOES)(getProcAddr(\"glGetMaterialxvOES\"))\n\tgpGetMemoryObjectDetachedResourcesuivNV = (C.GPGETMEMORYOBJECTDETACHEDRESOURCESUIVNV)(getProcAddr(\"glGetMemoryObjectDetachedResourcesuivNV\"))\n\tgpGetMemoryObjectParameterivEXT = (C.GPGETMEMORYOBJECTPARAMETERIVEXT)(getProcAddr(\"glGetMemoryObjectParameterivEXT\"))\n\tgpGetMinmax = (C.GPGETMINMAX)(getProcAddr(\"glGetMinmax\"))\n\tgpGetMinmaxEXT = (C.GPGETMINMAXEXT)(getProcAddr(\"glGetMinmaxEXT\"))\n\tgpGetMinmaxParameterfv = (C.GPGETMINMAXPARAMETERFV)(getProcAddr(\"glGetMinmaxParameterfv\"))\n\tgpGetMinmaxParameterfvEXT = (C.GPGETMINMAXPARAMETERFVEXT)(getProcAddr(\"glGetMinmaxParameterfvEXT\"))\n\tgpGetMinmaxParameteriv = (C.GPGETMINMAXPARAMETERIV)(getProcAddr(\"glGetMinmaxParameteriv\"))\n\tgpGetMinmaxParameterivEXT = (C.GPGETMINMAXPARAMETERIVEXT)(getProcAddr(\"glGetMinmaxParameterivEXT\"))\n\tgpGetMultiTexEnvfvEXT = (C.GPGETMULTITEXENVFVEXT)(getProcAddr(\"glGetMultiTexEnvfvEXT\"))\n\tgpGetMultiTexEnvivEXT = (C.GPGETMULTITEXENVIVEXT)(getProcAddr(\"glGetMultiTexEnvivEXT\"))\n\tgpGetMultiTexGendvEXT = (C.GPGETMULTITEXGENDVEXT)(getProcAddr(\"glGetMultiTexGendvEXT\"))\n\tgpGetMultiTexGenfvEXT = (C.GPGETMULTITEXGENFVEXT)(getProcAddr(\"glGetMultiTexGenfvEXT\"))\n\tgpGetMultiTexGenivEXT = (C.GPGETMULTITEXGENIVEXT)(getProcAddr(\"glGetMultiTexGenivEXT\"))\n\tgpGetMultiTexImageEXT = (C.GPGETMULTITEXIMAGEEXT)(getProcAddr(\"glGetMultiTexImageEXT\"))\n\tgpGetMultiTexLevelParameterfvEXT = (C.GPGETMULTITEXLEVELPARAMETERFVEXT)(getProcAddr(\"glGetMultiTexLevelParameterfvEXT\"))\n\tgpGetMultiTexLevelParameterivEXT = (C.GPGETMULTITEXLEVELPARAMETERIVEXT)(getProcAddr(\"glGetMultiTexLevelParameterivEXT\"))\n\tgpGetMultiTexParameterIivEXT = (C.GPGETMULTITEXPARAMETERIIVEXT)(getProcAddr(\"glGetMultiTexParameterIivEXT\"))\n\tgpGetMultiTexParameterIuivEXT = (C.GPGETMULTITEXPARAMETERIUIVEXT)(getProcAddr(\"glGetMultiTexParameterIuivEXT\"))\n\tgpGetMultiTexParameterfvEXT = (C.GPGETMULTITEXPARAMETERFVEXT)(getProcAddr(\"glGetMultiTexParameterfvEXT\"))\n\tgpGetMultiTexParameterivEXT = (C.GPGETMULTITEXPARAMETERIVEXT)(getProcAddr(\"glGetMultiTexParameterivEXT\"))\n\tgpGetMultisamplefv = (C.GPGETMULTISAMPLEFV)(getProcAddr(\"glGetMultisamplefv\"))\n\tif gpGetMultisamplefv == nil {\n\t\treturn errors.New(\"glGetMultisamplefv\")\n\t}\n\tgpGetMultisamplefvNV = (C.GPGETMULTISAMPLEFVNV)(getProcAddr(\"glGetMultisamplefvNV\"))\n\tgpGetNamedBufferParameteri64v = (C.GPGETNAMEDBUFFERPARAMETERI64V)(getProcAddr(\"glGetNamedBufferParameteri64v\"))\n\tgpGetNamedBufferParameteriv = (C.GPGETNAMEDBUFFERPARAMETERIV)(getProcAddr(\"glGetNamedBufferParameteriv\"))\n\tgpGetNamedBufferParameterivEXT = (C.GPGETNAMEDBUFFERPARAMETERIVEXT)(getProcAddr(\"glGetNamedBufferParameterivEXT\"))\n\tgpGetNamedBufferParameterui64vNV = (C.GPGETNAMEDBUFFERPARAMETERUI64VNV)(getProcAddr(\"glGetNamedBufferParameterui64vNV\"))\n\tgpGetNamedBufferPointerv = (C.GPGETNAMEDBUFFERPOINTERV)(getProcAddr(\"glGetNamedBufferPointerv\"))\n\tgpGetNamedBufferPointervEXT = (C.GPGETNAMEDBUFFERPOINTERVEXT)(getProcAddr(\"glGetNamedBufferPointervEXT\"))\n\tgpGetNamedBufferSubData = (C.GPGETNAMEDBUFFERSUBDATA)(getProcAddr(\"glGetNamedBufferSubData\"))\n\tgpGetNamedBufferSubDataEXT = (C.GPGETNAMEDBUFFERSUBDATAEXT)(getProcAddr(\"glGetNamedBufferSubDataEXT\"))\n\tgpGetNamedFramebufferAttachmentParameteriv = (C.GPGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIV)(getProcAddr(\"glGetNamedFramebufferAttachmentParameteriv\"))\n\tgpGetNamedFramebufferAttachmentParameterivEXT = (C.GPGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVEXT)(getProcAddr(\"glGetNamedFramebufferAttachmentParameterivEXT\"))\n\tgpGetNamedFramebufferParameterfvAMD = (C.GPGETNAMEDFRAMEBUFFERPARAMETERFVAMD)(getProcAddr(\"glGetNamedFramebufferParameterfvAMD\"))\n\tgpGetNamedFramebufferParameteriv = (C.GPGETNAMEDFRAMEBUFFERPARAMETERIV)(getProcAddr(\"glGetNamedFramebufferParameteriv\"))\n\tgpGetNamedFramebufferParameterivEXT = (C.GPGETNAMEDFRAMEBUFFERPARAMETERIVEXT)(getProcAddr(\"glGetNamedFramebufferParameterivEXT\"))\n\tgpGetNamedProgramLocalParameterIivEXT = (C.GPGETNAMEDPROGRAMLOCALPARAMETERIIVEXT)(getProcAddr(\"glGetNamedProgramLocalParameterIivEXT\"))\n\tgpGetNamedProgramLocalParameterIuivEXT = (C.GPGETNAMEDPROGRAMLOCALPARAMETERIUIVEXT)(getProcAddr(\"glGetNamedProgramLocalParameterIuivEXT\"))\n\tgpGetNamedProgramLocalParameterdvEXT = (C.GPGETNAMEDPROGRAMLOCALPARAMETERDVEXT)(getProcAddr(\"glGetNamedProgramLocalParameterdvEXT\"))\n\tgpGetNamedProgramLocalParameterfvEXT = (C.GPGETNAMEDPROGRAMLOCALPARAMETERFVEXT)(getProcAddr(\"glGetNamedProgramLocalParameterfvEXT\"))\n\tgpGetNamedProgramStringEXT = (C.GPGETNAMEDPROGRAMSTRINGEXT)(getProcAddr(\"glGetNamedProgramStringEXT\"))\n\tgpGetNamedProgramivEXT = (C.GPGETNAMEDPROGRAMIVEXT)(getProcAddr(\"glGetNamedProgramivEXT\"))\n\tgpGetNamedRenderbufferParameteriv = (C.GPGETNAMEDRENDERBUFFERPARAMETERIV)(getProcAddr(\"glGetNamedRenderbufferParameteriv\"))\n\tgpGetNamedRenderbufferParameterivEXT = (C.GPGETNAMEDRENDERBUFFERPARAMETERIVEXT)(getProcAddr(\"glGetNamedRenderbufferParameterivEXT\"))\n\tgpGetNamedStringARB = (C.GPGETNAMEDSTRINGARB)(getProcAddr(\"glGetNamedStringARB\"))\n\tgpGetNamedStringivARB = (C.GPGETNAMEDSTRINGIVARB)(getProcAddr(\"glGetNamedStringivARB\"))\n\tgpGetNextPerfQueryIdINTEL = (C.GPGETNEXTPERFQUERYIDINTEL)(getProcAddr(\"glGetNextPerfQueryIdINTEL\"))\n\tgpGetObjectBufferfvATI = (C.GPGETOBJECTBUFFERFVATI)(getProcAddr(\"glGetObjectBufferfvATI\"))\n\tgpGetObjectBufferivATI = (C.GPGETOBJECTBUFFERIVATI)(getProcAddr(\"glGetObjectBufferivATI\"))\n\tgpGetObjectLabel = (C.GPGETOBJECTLABEL)(getProcAddr(\"glGetObjectLabel\"))\n\tif gpGetObjectLabel == nil {\n\t\treturn errors.New(\"glGetObjectLabel\")\n\t}\n\tgpGetObjectLabelEXT = (C.GPGETOBJECTLABELEXT)(getProcAddr(\"glGetObjectLabelEXT\"))\n\tgpGetObjectLabelKHR = (C.GPGETOBJECTLABELKHR)(getProcAddr(\"glGetObjectLabelKHR\"))\n\tgpGetObjectParameterfvARB = (C.GPGETOBJECTPARAMETERFVARB)(getProcAddr(\"glGetObjectParameterfvARB\"))\n\tgpGetObjectParameterivAPPLE = (C.GPGETOBJECTPARAMETERIVAPPLE)(getProcAddr(\"glGetObjectParameterivAPPLE\"))\n\tgpGetObjectParameterivARB = (C.GPGETOBJECTPARAMETERIVARB)(getProcAddr(\"glGetObjectParameterivARB\"))\n\tgpGetObjectPtrLabel = (C.GPGETOBJECTPTRLABEL)(getProcAddr(\"glGetObjectPtrLabel\"))\n\tif gpGetObjectPtrLabel == nil {\n\t\treturn errors.New(\"glGetObjectPtrLabel\")\n\t}\n\tgpGetObjectPtrLabelKHR = (C.GPGETOBJECTPTRLABELKHR)(getProcAddr(\"glGetObjectPtrLabelKHR\"))\n\tgpGetOcclusionQueryivNV = (C.GPGETOCCLUSIONQUERYIVNV)(getProcAddr(\"glGetOcclusionQueryivNV\"))\n\tgpGetOcclusionQueryuivNV = (C.GPGETOCCLUSIONQUERYUIVNV)(getProcAddr(\"glGetOcclusionQueryuivNV\"))\n\tgpGetPathColorGenfvNV = (C.GPGETPATHCOLORGENFVNV)(getProcAddr(\"glGetPathColorGenfvNV\"))\n\tgpGetPathColorGenivNV = (C.GPGETPATHCOLORGENIVNV)(getProcAddr(\"glGetPathColorGenivNV\"))\n\tgpGetPathCommandsNV = (C.GPGETPATHCOMMANDSNV)(getProcAddr(\"glGetPathCommandsNV\"))\n\tgpGetPathCoordsNV = (C.GPGETPATHCOORDSNV)(getProcAddr(\"glGetPathCoordsNV\"))\n\tgpGetPathDashArrayNV = (C.GPGETPATHDASHARRAYNV)(getProcAddr(\"glGetPathDashArrayNV\"))\n\tgpGetPathLengthNV = (C.GPGETPATHLENGTHNV)(getProcAddr(\"glGetPathLengthNV\"))\n\tgpGetPathMetricRangeNV = (C.GPGETPATHMETRICRANGENV)(getProcAddr(\"glGetPathMetricRangeNV\"))\n\tgpGetPathMetricsNV = (C.GPGETPATHMETRICSNV)(getProcAddr(\"glGetPathMetricsNV\"))\n\tgpGetPathParameterfvNV = (C.GPGETPATHPARAMETERFVNV)(getProcAddr(\"glGetPathParameterfvNV\"))\n\tgpGetPathParameterivNV = (C.GPGETPATHPARAMETERIVNV)(getProcAddr(\"glGetPathParameterivNV\"))\n\tgpGetPathSpacingNV = (C.GPGETPATHSPACINGNV)(getProcAddr(\"glGetPathSpacingNV\"))\n\tgpGetPathTexGenfvNV = (C.GPGETPATHTEXGENFVNV)(getProcAddr(\"glGetPathTexGenfvNV\"))\n\tgpGetPathTexGenivNV = (C.GPGETPATHTEXGENIVNV)(getProcAddr(\"glGetPathTexGenivNV\"))\n\tgpGetPerfCounterInfoINTEL = (C.GPGETPERFCOUNTERINFOINTEL)(getProcAddr(\"glGetPerfCounterInfoINTEL\"))\n\tgpGetPerfMonitorCounterDataAMD = (C.GPGETPERFMONITORCOUNTERDATAAMD)(getProcAddr(\"glGetPerfMonitorCounterDataAMD\"))\n\tgpGetPerfMonitorCounterInfoAMD = (C.GPGETPERFMONITORCOUNTERINFOAMD)(getProcAddr(\"glGetPerfMonitorCounterInfoAMD\"))\n\tgpGetPerfMonitorCounterStringAMD = (C.GPGETPERFMONITORCOUNTERSTRINGAMD)(getProcAddr(\"glGetPerfMonitorCounterStringAMD\"))\n\tgpGetPerfMonitorCountersAMD = (C.GPGETPERFMONITORCOUNTERSAMD)(getProcAddr(\"glGetPerfMonitorCountersAMD\"))\n\tgpGetPerfMonitorGroupStringAMD = (C.GPGETPERFMONITORGROUPSTRINGAMD)(getProcAddr(\"glGetPerfMonitorGroupStringAMD\"))\n\tgpGetPerfMonitorGroupsAMD = (C.GPGETPERFMONITORGROUPSAMD)(getProcAddr(\"glGetPerfMonitorGroupsAMD\"))\n\tgpGetPerfQueryDataINTEL = (C.GPGETPERFQUERYDATAINTEL)(getProcAddr(\"glGetPerfQueryDataINTEL\"))\n\tgpGetPerfQueryIdByNameINTEL = (C.GPGETPERFQUERYIDBYNAMEINTEL)(getProcAddr(\"glGetPerfQueryIdByNameINTEL\"))\n\tgpGetPerfQueryInfoINTEL = (C.GPGETPERFQUERYINFOINTEL)(getProcAddr(\"glGetPerfQueryInfoINTEL\"))\n\tgpGetPixelMapfv = (C.GPGETPIXELMAPFV)(getProcAddr(\"glGetPixelMapfv\"))\n\tif gpGetPixelMapfv == nil {\n\t\treturn errors.New(\"glGetPixelMapfv\")\n\t}\n\tgpGetPixelMapuiv = (C.GPGETPIXELMAPUIV)(getProcAddr(\"glGetPixelMapuiv\"))\n\tif gpGetPixelMapuiv == nil {\n\t\treturn errors.New(\"glGetPixelMapuiv\")\n\t}\n\tgpGetPixelMapusv = (C.GPGETPIXELMAPUSV)(getProcAddr(\"glGetPixelMapusv\"))\n\tif gpGetPixelMapusv == nil {\n\t\treturn errors.New(\"glGetPixelMapusv\")\n\t}\n\tgpGetPixelMapxv = (C.GPGETPIXELMAPXV)(getProcAddr(\"glGetPixelMapxv\"))\n\tgpGetPixelTexGenParameterfvSGIS = (C.GPGETPIXELTEXGENPARAMETERFVSGIS)(getProcAddr(\"glGetPixelTexGenParameterfvSGIS\"))\n\tgpGetPixelTexGenParameterivSGIS = (C.GPGETPIXELTEXGENPARAMETERIVSGIS)(getProcAddr(\"glGetPixelTexGenParameterivSGIS\"))\n\tgpGetPixelTransformParameterfvEXT = (C.GPGETPIXELTRANSFORMPARAMETERFVEXT)(getProcAddr(\"glGetPixelTransformParameterfvEXT\"))\n\tgpGetPixelTransformParameterivEXT = (C.GPGETPIXELTRANSFORMPARAMETERIVEXT)(getProcAddr(\"glGetPixelTransformParameterivEXT\"))\n\tgpGetPointerIndexedvEXT = (C.GPGETPOINTERINDEXEDVEXT)(getProcAddr(\"glGetPointerIndexedvEXT\"))\n\tgpGetPointeri_vEXT = (C.GPGETPOINTERI_VEXT)(getProcAddr(\"glGetPointeri_vEXT\"))\n\tgpGetPointerv = (C.GPGETPOINTERV)(getProcAddr(\"glGetPointerv\"))\n\tif gpGetPointerv == nil {\n\t\treturn errors.New(\"glGetPointerv\")\n\t}\n\tgpGetPointervEXT = (C.GPGETPOINTERVEXT)(getProcAddr(\"glGetPointervEXT\"))\n\tgpGetPointervKHR = (C.GPGETPOINTERVKHR)(getProcAddr(\"glGetPointervKHR\"))\n\tgpGetPolygonStipple = (C.GPGETPOLYGONSTIPPLE)(getProcAddr(\"glGetPolygonStipple\"))\n\tif gpGetPolygonStipple == nil {\n\t\treturn errors.New(\"glGetPolygonStipple\")\n\t}\n\tgpGetProgramBinary = (C.GPGETPROGRAMBINARY)(getProcAddr(\"glGetProgramBinary\"))\n\tif gpGetProgramBinary == nil {\n\t\treturn errors.New(\"glGetProgramBinary\")\n\t}\n\tgpGetProgramEnvParameterIivNV = (C.GPGETPROGRAMENVPARAMETERIIVNV)(getProcAddr(\"glGetProgramEnvParameterIivNV\"))\n\tgpGetProgramEnvParameterIuivNV = (C.GPGETPROGRAMENVPARAMETERIUIVNV)(getProcAddr(\"glGetProgramEnvParameterIuivNV\"))\n\tgpGetProgramEnvParameterdvARB = (C.GPGETPROGRAMENVPARAMETERDVARB)(getProcAddr(\"glGetProgramEnvParameterdvARB\"))\n\tgpGetProgramEnvParameterfvARB = (C.GPGETPROGRAMENVPARAMETERFVARB)(getProcAddr(\"glGetProgramEnvParameterfvARB\"))\n\tgpGetProgramInfoLog = (C.GPGETPROGRAMINFOLOG)(getProcAddr(\"glGetProgramInfoLog\"))\n\tif gpGetProgramInfoLog == nil {\n\t\treturn errors.New(\"glGetProgramInfoLog\")\n\t}\n\tgpGetProgramInterfaceiv = (C.GPGETPROGRAMINTERFACEIV)(getProcAddr(\"glGetProgramInterfaceiv\"))\n\tif gpGetProgramInterfaceiv == nil {\n\t\treturn errors.New(\"glGetProgramInterfaceiv\")\n\t}\n\tgpGetProgramLocalParameterIivNV = (C.GPGETPROGRAMLOCALPARAMETERIIVNV)(getProcAddr(\"glGetProgramLocalParameterIivNV\"))\n\tgpGetProgramLocalParameterIuivNV = (C.GPGETPROGRAMLOCALPARAMETERIUIVNV)(getProcAddr(\"glGetProgramLocalParameterIuivNV\"))\n\tgpGetProgramLocalParameterdvARB = (C.GPGETPROGRAMLOCALPARAMETERDVARB)(getProcAddr(\"glGetProgramLocalParameterdvARB\"))\n\tgpGetProgramLocalParameterfvARB = (C.GPGETPROGRAMLOCALPARAMETERFVARB)(getProcAddr(\"glGetProgramLocalParameterfvARB\"))\n\tgpGetProgramNamedParameterdvNV = (C.GPGETPROGRAMNAMEDPARAMETERDVNV)(getProcAddr(\"glGetProgramNamedParameterdvNV\"))\n\tgpGetProgramNamedParameterfvNV = (C.GPGETPROGRAMNAMEDPARAMETERFVNV)(getProcAddr(\"glGetProgramNamedParameterfvNV\"))\n\tgpGetProgramParameterdvNV = (C.GPGETPROGRAMPARAMETERDVNV)(getProcAddr(\"glGetProgramParameterdvNV\"))\n\tgpGetProgramParameterfvNV = (C.GPGETPROGRAMPARAMETERFVNV)(getProcAddr(\"glGetProgramParameterfvNV\"))\n\tgpGetProgramPipelineInfoLog = (C.GPGETPROGRAMPIPELINEINFOLOG)(getProcAddr(\"glGetProgramPipelineInfoLog\"))\n\tif gpGetProgramPipelineInfoLog == nil {\n\t\treturn errors.New(\"glGetProgramPipelineInfoLog\")\n\t}\n\tgpGetProgramPipelineInfoLogEXT = (C.GPGETPROGRAMPIPELINEINFOLOGEXT)(getProcAddr(\"glGetProgramPipelineInfoLogEXT\"))\n\tgpGetProgramPipelineiv = (C.GPGETPROGRAMPIPELINEIV)(getProcAddr(\"glGetProgramPipelineiv\"))\n\tif gpGetProgramPipelineiv == nil {\n\t\treturn errors.New(\"glGetProgramPipelineiv\")\n\t}\n\tgpGetProgramPipelineivEXT = (C.GPGETPROGRAMPIPELINEIVEXT)(getProcAddr(\"glGetProgramPipelineivEXT\"))\n\tgpGetProgramResourceIndex = (C.GPGETPROGRAMRESOURCEINDEX)(getProcAddr(\"glGetProgramResourceIndex\"))\n\tif gpGetProgramResourceIndex == nil {\n\t\treturn errors.New(\"glGetProgramResourceIndex\")\n\t}\n\tgpGetProgramResourceLocation = (C.GPGETPROGRAMRESOURCELOCATION)(getProcAddr(\"glGetProgramResourceLocation\"))\n\tif gpGetProgramResourceLocation == nil {\n\t\treturn errors.New(\"glGetProgramResourceLocation\")\n\t}\n\tgpGetProgramResourceLocationIndex = (C.GPGETPROGRAMRESOURCELOCATIONINDEX)(getProcAddr(\"glGetProgramResourceLocationIndex\"))\n\tif gpGetProgramResourceLocationIndex == nil {\n\t\treturn errors.New(\"glGetProgramResourceLocationIndex\")\n\t}\n\tgpGetProgramResourceName = (C.GPGETPROGRAMRESOURCENAME)(getProcAddr(\"glGetProgramResourceName\"))\n\tif gpGetProgramResourceName == nil {\n\t\treturn errors.New(\"glGetProgramResourceName\")\n\t}\n\tgpGetProgramResourcefvNV = (C.GPGETPROGRAMRESOURCEFVNV)(getProcAddr(\"glGetProgramResourcefvNV\"))\n\tgpGetProgramResourceiv = (C.GPGETPROGRAMRESOURCEIV)(getProcAddr(\"glGetProgramResourceiv\"))\n\tif gpGetProgramResourceiv == nil {\n\t\treturn errors.New(\"glGetProgramResourceiv\")\n\t}\n\tgpGetProgramStageiv = (C.GPGETPROGRAMSTAGEIV)(getProcAddr(\"glGetProgramStageiv\"))\n\tif gpGetProgramStageiv == nil {\n\t\treturn errors.New(\"glGetProgramStageiv\")\n\t}\n\tgpGetProgramStringARB = (C.GPGETPROGRAMSTRINGARB)(getProcAddr(\"glGetProgramStringARB\"))\n\tgpGetProgramStringNV = (C.GPGETPROGRAMSTRINGNV)(getProcAddr(\"glGetProgramStringNV\"))\n\tgpGetProgramSubroutineParameteruivNV = (C.GPGETPROGRAMSUBROUTINEPARAMETERUIVNV)(getProcAddr(\"glGetProgramSubroutineParameteruivNV\"))\n\tgpGetProgramiv = (C.GPGETPROGRAMIV)(getProcAddr(\"glGetProgramiv\"))\n\tif gpGetProgramiv == nil {\n\t\treturn errors.New(\"glGetProgramiv\")\n\t}\n\tgpGetProgramivARB = (C.GPGETPROGRAMIVARB)(getProcAddr(\"glGetProgramivARB\"))\n\tgpGetProgramivNV = (C.GPGETPROGRAMIVNV)(getProcAddr(\"glGetProgramivNV\"))\n\tgpGetQueryBufferObjecti64v = (C.GPGETQUERYBUFFEROBJECTI64V)(getProcAddr(\"glGetQueryBufferObjecti64v\"))\n\tgpGetQueryBufferObjectiv = (C.GPGETQUERYBUFFEROBJECTIV)(getProcAddr(\"glGetQueryBufferObjectiv\"))\n\tgpGetQueryBufferObjectui64v = (C.GPGETQUERYBUFFEROBJECTUI64V)(getProcAddr(\"glGetQueryBufferObjectui64v\"))\n\tgpGetQueryBufferObjectuiv = (C.GPGETQUERYBUFFEROBJECTUIV)(getProcAddr(\"glGetQueryBufferObjectuiv\"))\n\tgpGetQueryIndexediv = (C.GPGETQUERYINDEXEDIV)(getProcAddr(\"glGetQueryIndexediv\"))\n\tif gpGetQueryIndexediv == nil {\n\t\treturn errors.New(\"glGetQueryIndexediv\")\n\t}\n\tgpGetQueryObjecti64v = (C.GPGETQUERYOBJECTI64V)(getProcAddr(\"glGetQueryObjecti64v\"))\n\tif gpGetQueryObjecti64v == nil {\n\t\treturn errors.New(\"glGetQueryObjecti64v\")\n\t}\n\tgpGetQueryObjecti64vEXT = (C.GPGETQUERYOBJECTI64VEXT)(getProcAddr(\"glGetQueryObjecti64vEXT\"))\n\tgpGetQueryObjectiv = (C.GPGETQUERYOBJECTIV)(getProcAddr(\"glGetQueryObjectiv\"))\n\tif gpGetQueryObjectiv == nil {\n\t\treturn errors.New(\"glGetQueryObjectiv\")\n\t}\n\tgpGetQueryObjectivARB = (C.GPGETQUERYOBJECTIVARB)(getProcAddr(\"glGetQueryObjectivARB\"))\n\tgpGetQueryObjectui64v = (C.GPGETQUERYOBJECTUI64V)(getProcAddr(\"glGetQueryObjectui64v\"))\n\tif gpGetQueryObjectui64v == nil {\n\t\treturn errors.New(\"glGetQueryObjectui64v\")\n\t}\n\tgpGetQueryObjectui64vEXT = (C.GPGETQUERYOBJECTUI64VEXT)(getProcAddr(\"glGetQueryObjectui64vEXT\"))\n\tgpGetQueryObjectuiv = (C.GPGETQUERYOBJECTUIV)(getProcAddr(\"glGetQueryObjectuiv\"))\n\tif gpGetQueryObjectuiv == nil {\n\t\treturn errors.New(\"glGetQueryObjectuiv\")\n\t}\n\tgpGetQueryObjectuivARB = (C.GPGETQUERYOBJECTUIVARB)(getProcAddr(\"glGetQueryObjectuivARB\"))\n\tgpGetQueryiv = (C.GPGETQUERYIV)(getProcAddr(\"glGetQueryiv\"))\n\tif gpGetQueryiv == nil {\n\t\treturn errors.New(\"glGetQueryiv\")\n\t}\n\tgpGetQueryivARB = (C.GPGETQUERYIVARB)(getProcAddr(\"glGetQueryivARB\"))\n\tgpGetRenderbufferParameteriv = (C.GPGETRENDERBUFFERPARAMETERIV)(getProcAddr(\"glGetRenderbufferParameteriv\"))\n\tif gpGetRenderbufferParameteriv == nil {\n\t\treturn errors.New(\"glGetRenderbufferParameteriv\")\n\t}\n\tgpGetRenderbufferParameterivEXT = (C.GPGETRENDERBUFFERPARAMETERIVEXT)(getProcAddr(\"glGetRenderbufferParameterivEXT\"))\n\tgpGetSamplerParameterIiv = (C.GPGETSAMPLERPARAMETERIIV)(getProcAddr(\"glGetSamplerParameterIiv\"))\n\tif gpGetSamplerParameterIiv == nil {\n\t\treturn errors.New(\"glGetSamplerParameterIiv\")\n\t}\n\tgpGetSamplerParameterIuiv = (C.GPGETSAMPLERPARAMETERIUIV)(getProcAddr(\"glGetSamplerParameterIuiv\"))\n\tif gpGetSamplerParameterIuiv == nil {\n\t\treturn errors.New(\"glGetSamplerParameterIuiv\")\n\t}\n\tgpGetSamplerParameterfv = (C.GPGETSAMPLERPARAMETERFV)(getProcAddr(\"glGetSamplerParameterfv\"))\n\tif gpGetSamplerParameterfv == nil {\n\t\treturn errors.New(\"glGetSamplerParameterfv\")\n\t}\n\tgpGetSamplerParameteriv = (C.GPGETSAMPLERPARAMETERIV)(getProcAddr(\"glGetSamplerParameteriv\"))\n\tif gpGetSamplerParameteriv == nil {\n\t\treturn errors.New(\"glGetSamplerParameteriv\")\n\t}\n\tgpGetSemaphoreParameterivNV = (C.GPGETSEMAPHOREPARAMETERIVNV)(getProcAddr(\"glGetSemaphoreParameterivNV\"))\n\tgpGetSemaphoreParameterui64vEXT = (C.GPGETSEMAPHOREPARAMETERUI64VEXT)(getProcAddr(\"glGetSemaphoreParameterui64vEXT\"))\n\tgpGetSeparableFilter = (C.GPGETSEPARABLEFILTER)(getProcAddr(\"glGetSeparableFilter\"))\n\tgpGetSeparableFilterEXT = (C.GPGETSEPARABLEFILTEREXT)(getProcAddr(\"glGetSeparableFilterEXT\"))\n\tgpGetShaderInfoLog = (C.GPGETSHADERINFOLOG)(getProcAddr(\"glGetShaderInfoLog\"))\n\tif gpGetShaderInfoLog == nil {\n\t\treturn errors.New(\"glGetShaderInfoLog\")\n\t}\n\tgpGetShaderPrecisionFormat = (C.GPGETSHADERPRECISIONFORMAT)(getProcAddr(\"glGetShaderPrecisionFormat\"))\n\tif gpGetShaderPrecisionFormat == nil {\n\t\treturn errors.New(\"glGetShaderPrecisionFormat\")\n\t}\n\tgpGetShaderSource = (C.GPGETSHADERSOURCE)(getProcAddr(\"glGetShaderSource\"))\n\tif gpGetShaderSource == nil {\n\t\treturn errors.New(\"glGetShaderSource\")\n\t}\n\tgpGetShaderSourceARB = (C.GPGETSHADERSOURCEARB)(getProcAddr(\"glGetShaderSourceARB\"))\n\tgpGetShaderiv = (C.GPGETSHADERIV)(getProcAddr(\"glGetShaderiv\"))\n\tif gpGetShaderiv == nil {\n\t\treturn errors.New(\"glGetShaderiv\")\n\t}\n\tgpGetShadingRateImagePaletteNV = (C.GPGETSHADINGRATEIMAGEPALETTENV)(getProcAddr(\"glGetShadingRateImagePaletteNV\"))\n\tgpGetShadingRateSampleLocationivNV = (C.GPGETSHADINGRATESAMPLELOCATIONIVNV)(getProcAddr(\"glGetShadingRateSampleLocationivNV\"))\n\tgpGetSharpenTexFuncSGIS = (C.GPGETSHARPENTEXFUNCSGIS)(getProcAddr(\"glGetSharpenTexFuncSGIS\"))\n\tgpGetStageIndexNV = (C.GPGETSTAGEINDEXNV)(getProcAddr(\"glGetStageIndexNV\"))\n\tgpGetString = (C.GPGETSTRING)(getProcAddr(\"glGetString\"))\n\tif gpGetString == nil {\n\t\treturn errors.New(\"glGetString\")\n\t}\n\tgpGetStringi = (C.GPGETSTRINGI)(getProcAddr(\"glGetStringi\"))\n\tif gpGetStringi == nil {\n\t\treturn errors.New(\"glGetStringi\")\n\t}\n\tgpGetSubroutineIndex = (C.GPGETSUBROUTINEINDEX)(getProcAddr(\"glGetSubroutineIndex\"))\n\tif gpGetSubroutineIndex == nil {\n\t\treturn errors.New(\"glGetSubroutineIndex\")\n\t}\n\tgpGetSubroutineUniformLocation = (C.GPGETSUBROUTINEUNIFORMLOCATION)(getProcAddr(\"glGetSubroutineUniformLocation\"))\n\tif gpGetSubroutineUniformLocation == nil {\n\t\treturn errors.New(\"glGetSubroutineUniformLocation\")\n\t}\n\tgpGetSynciv = (C.GPGETSYNCIV)(getProcAddr(\"glGetSynciv\"))\n\tif gpGetSynciv == nil {\n\t\treturn errors.New(\"glGetSynciv\")\n\t}\n\tgpGetTexBumpParameterfvATI = (C.GPGETTEXBUMPPARAMETERFVATI)(getProcAddr(\"glGetTexBumpParameterfvATI\"))\n\tgpGetTexBumpParameterivATI = (C.GPGETTEXBUMPPARAMETERIVATI)(getProcAddr(\"glGetTexBumpParameterivATI\"))\n\tgpGetTexEnvfv = (C.GPGETTEXENVFV)(getProcAddr(\"glGetTexEnvfv\"))\n\tif gpGetTexEnvfv == nil {\n\t\treturn errors.New(\"glGetTexEnvfv\")\n\t}\n\tgpGetTexEnviv = (C.GPGETTEXENVIV)(getProcAddr(\"glGetTexEnviv\"))\n\tif gpGetTexEnviv == nil {\n\t\treturn errors.New(\"glGetTexEnviv\")\n\t}\n\tgpGetTexEnvxvOES = (C.GPGETTEXENVXVOES)(getProcAddr(\"glGetTexEnvxvOES\"))\n\tgpGetTexFilterFuncSGIS = (C.GPGETTEXFILTERFUNCSGIS)(getProcAddr(\"glGetTexFilterFuncSGIS\"))\n\tgpGetTexGendv = (C.GPGETTEXGENDV)(getProcAddr(\"glGetTexGendv\"))\n\tif gpGetTexGendv == nil {\n\t\treturn errors.New(\"glGetTexGendv\")\n\t}\n\tgpGetTexGenfv = (C.GPGETTEXGENFV)(getProcAddr(\"glGetTexGenfv\"))\n\tif gpGetTexGenfv == nil {\n\t\treturn errors.New(\"glGetTexGenfv\")\n\t}\n\tgpGetTexGeniv = (C.GPGETTEXGENIV)(getProcAddr(\"glGetTexGeniv\"))\n\tif gpGetTexGeniv == nil {\n\t\treturn errors.New(\"glGetTexGeniv\")\n\t}\n\tgpGetTexGenxvOES = (C.GPGETTEXGENXVOES)(getProcAddr(\"glGetTexGenxvOES\"))\n\tgpGetTexImage = (C.GPGETTEXIMAGE)(getProcAddr(\"glGetTexImage\"))\n\tif gpGetTexImage == nil {\n\t\treturn errors.New(\"glGetTexImage\")\n\t}\n\tgpGetTexLevelParameterfv = (C.GPGETTEXLEVELPARAMETERFV)(getProcAddr(\"glGetTexLevelParameterfv\"))\n\tif gpGetTexLevelParameterfv == nil {\n\t\treturn errors.New(\"glGetTexLevelParameterfv\")\n\t}\n\tgpGetTexLevelParameteriv = (C.GPGETTEXLEVELPARAMETERIV)(getProcAddr(\"glGetTexLevelParameteriv\"))\n\tif gpGetTexLevelParameteriv == nil {\n\t\treturn errors.New(\"glGetTexLevelParameteriv\")\n\t}\n\tgpGetTexLevelParameterxvOES = (C.GPGETTEXLEVELPARAMETERXVOES)(getProcAddr(\"glGetTexLevelParameterxvOES\"))\n\tgpGetTexParameterIiv = (C.GPGETTEXPARAMETERIIV)(getProcAddr(\"glGetTexParameterIiv\"))\n\tif gpGetTexParameterIiv == nil {\n\t\treturn errors.New(\"glGetTexParameterIiv\")\n\t}\n\tgpGetTexParameterIivEXT = (C.GPGETTEXPARAMETERIIVEXT)(getProcAddr(\"glGetTexParameterIivEXT\"))\n\tgpGetTexParameterIuiv = (C.GPGETTEXPARAMETERIUIV)(getProcAddr(\"glGetTexParameterIuiv\"))\n\tif gpGetTexParameterIuiv == nil {\n\t\treturn errors.New(\"glGetTexParameterIuiv\")\n\t}\n\tgpGetTexParameterIuivEXT = (C.GPGETTEXPARAMETERIUIVEXT)(getProcAddr(\"glGetTexParameterIuivEXT\"))\n\tgpGetTexParameterPointervAPPLE = (C.GPGETTEXPARAMETERPOINTERVAPPLE)(getProcAddr(\"glGetTexParameterPointervAPPLE\"))\n\tgpGetTexParameterfv = (C.GPGETTEXPARAMETERFV)(getProcAddr(\"glGetTexParameterfv\"))\n\tif gpGetTexParameterfv == nil {\n\t\treturn errors.New(\"glGetTexParameterfv\")\n\t}\n\tgpGetTexParameteriv = (C.GPGETTEXPARAMETERIV)(getProcAddr(\"glGetTexParameteriv\"))\n\tif gpGetTexParameteriv == nil {\n\t\treturn errors.New(\"glGetTexParameteriv\")\n\t}\n\tgpGetTexParameterxvOES = (C.GPGETTEXPARAMETERXVOES)(getProcAddr(\"glGetTexParameterxvOES\"))\n\tgpGetTextureHandleARB = (C.GPGETTEXTUREHANDLEARB)(getProcAddr(\"glGetTextureHandleARB\"))\n\tgpGetTextureHandleNV = (C.GPGETTEXTUREHANDLENV)(getProcAddr(\"glGetTextureHandleNV\"))\n\tgpGetTextureImage = (C.GPGETTEXTUREIMAGE)(getProcAddr(\"glGetTextureImage\"))\n\tgpGetTextureImageEXT = (C.GPGETTEXTUREIMAGEEXT)(getProcAddr(\"glGetTextureImageEXT\"))\n\tgpGetTextureLevelParameterfv = (C.GPGETTEXTURELEVELPARAMETERFV)(getProcAddr(\"glGetTextureLevelParameterfv\"))\n\tgpGetTextureLevelParameterfvEXT = (C.GPGETTEXTURELEVELPARAMETERFVEXT)(getProcAddr(\"glGetTextureLevelParameterfvEXT\"))\n\tgpGetTextureLevelParameteriv = (C.GPGETTEXTURELEVELPARAMETERIV)(getProcAddr(\"glGetTextureLevelParameteriv\"))\n\tgpGetTextureLevelParameterivEXT = (C.GPGETTEXTURELEVELPARAMETERIVEXT)(getProcAddr(\"glGetTextureLevelParameterivEXT\"))\n\tgpGetTextureParameterIiv = (C.GPGETTEXTUREPARAMETERIIV)(getProcAddr(\"glGetTextureParameterIiv\"))\n\tgpGetTextureParameterIivEXT = (C.GPGETTEXTUREPARAMETERIIVEXT)(getProcAddr(\"glGetTextureParameterIivEXT\"))\n\tgpGetTextureParameterIuiv = (C.GPGETTEXTUREPARAMETERIUIV)(getProcAddr(\"glGetTextureParameterIuiv\"))\n\tgpGetTextureParameterIuivEXT = (C.GPGETTEXTUREPARAMETERIUIVEXT)(getProcAddr(\"glGetTextureParameterIuivEXT\"))\n\tgpGetTextureParameterfv = (C.GPGETTEXTUREPARAMETERFV)(getProcAddr(\"glGetTextureParameterfv\"))\n\tgpGetTextureParameterfvEXT = (C.GPGETTEXTUREPARAMETERFVEXT)(getProcAddr(\"glGetTextureParameterfvEXT\"))\n\tgpGetTextureParameteriv = (C.GPGETTEXTUREPARAMETERIV)(getProcAddr(\"glGetTextureParameteriv\"))\n\tgpGetTextureParameterivEXT = (C.GPGETTEXTUREPARAMETERIVEXT)(getProcAddr(\"glGetTextureParameterivEXT\"))\n\tgpGetTextureSamplerHandleARB = (C.GPGETTEXTURESAMPLERHANDLEARB)(getProcAddr(\"glGetTextureSamplerHandleARB\"))\n\tgpGetTextureSamplerHandleNV = (C.GPGETTEXTURESAMPLERHANDLENV)(getProcAddr(\"glGetTextureSamplerHandleNV\"))\n\tgpGetTextureSubImage = (C.GPGETTEXTURESUBIMAGE)(getProcAddr(\"glGetTextureSubImage\"))\n\tgpGetTrackMatrixivNV = (C.GPGETTRACKMATRIXIVNV)(getProcAddr(\"glGetTrackMatrixivNV\"))\n\tgpGetTransformFeedbackVarying = (C.GPGETTRANSFORMFEEDBACKVARYING)(getProcAddr(\"glGetTransformFeedbackVarying\"))\n\tif gpGetTransformFeedbackVarying == nil {\n\t\treturn errors.New(\"glGetTransformFeedbackVarying\")\n\t}\n\tgpGetTransformFeedbackVaryingEXT = (C.GPGETTRANSFORMFEEDBACKVARYINGEXT)(getProcAddr(\"glGetTransformFeedbackVaryingEXT\"))\n\tgpGetTransformFeedbackVaryingNV = (C.GPGETTRANSFORMFEEDBACKVARYINGNV)(getProcAddr(\"glGetTransformFeedbackVaryingNV\"))\n\tgpGetTransformFeedbacki64_v = (C.GPGETTRANSFORMFEEDBACKI64_V)(getProcAddr(\"glGetTransformFeedbacki64_v\"))\n\tgpGetTransformFeedbacki_v = (C.GPGETTRANSFORMFEEDBACKI_V)(getProcAddr(\"glGetTransformFeedbacki_v\"))\n\tgpGetTransformFeedbackiv = (C.GPGETTRANSFORMFEEDBACKIV)(getProcAddr(\"glGetTransformFeedbackiv\"))\n\tgpGetUniformBlockIndex = (C.GPGETUNIFORMBLOCKINDEX)(getProcAddr(\"glGetUniformBlockIndex\"))\n\tif gpGetUniformBlockIndex == nil {\n\t\treturn errors.New(\"glGetUniformBlockIndex\")\n\t}\n\tgpGetUniformBufferSizeEXT = (C.GPGETUNIFORMBUFFERSIZEEXT)(getProcAddr(\"glGetUniformBufferSizeEXT\"))\n\tgpGetUniformIndices = (C.GPGETUNIFORMINDICES)(getProcAddr(\"glGetUniformIndices\"))\n\tif gpGetUniformIndices == nil {\n\t\treturn errors.New(\"glGetUniformIndices\")\n\t}\n\tgpGetUniformLocation = (C.GPGETUNIFORMLOCATION)(getProcAddr(\"glGetUniformLocation\"))\n\tif gpGetUniformLocation == nil {\n\t\treturn errors.New(\"glGetUniformLocation\")\n\t}\n\tgpGetUniformLocationARB = (C.GPGETUNIFORMLOCATIONARB)(getProcAddr(\"glGetUniformLocationARB\"))\n\tgpGetUniformOffsetEXT = (C.GPGETUNIFORMOFFSETEXT)(getProcAddr(\"glGetUniformOffsetEXT\"))\n\tgpGetUniformSubroutineuiv = (C.GPGETUNIFORMSUBROUTINEUIV)(getProcAddr(\"glGetUniformSubroutineuiv\"))\n\tif gpGetUniformSubroutineuiv == nil {\n\t\treturn errors.New(\"glGetUniformSubroutineuiv\")\n\t}\n\tgpGetUniformdv = (C.GPGETUNIFORMDV)(getProcAddr(\"glGetUniformdv\"))\n\tif gpGetUniformdv == nil {\n\t\treturn errors.New(\"glGetUniformdv\")\n\t}\n\tgpGetUniformfv = (C.GPGETUNIFORMFV)(getProcAddr(\"glGetUniformfv\"))\n\tif gpGetUniformfv == nil {\n\t\treturn errors.New(\"glGetUniformfv\")\n\t}\n\tgpGetUniformfvARB = (C.GPGETUNIFORMFVARB)(getProcAddr(\"glGetUniformfvARB\"))\n\tgpGetUniformi64vARB = (C.GPGETUNIFORMI64VARB)(getProcAddr(\"glGetUniformi64vARB\"))\n\tgpGetUniformi64vNV = (C.GPGETUNIFORMI64VNV)(getProcAddr(\"glGetUniformi64vNV\"))\n\tgpGetUniformiv = (C.GPGETUNIFORMIV)(getProcAddr(\"glGetUniformiv\"))\n\tif gpGetUniformiv == nil {\n\t\treturn errors.New(\"glGetUniformiv\")\n\t}\n\tgpGetUniformivARB = (C.GPGETUNIFORMIVARB)(getProcAddr(\"glGetUniformivARB\"))\n\tgpGetUniformui64vARB = (C.GPGETUNIFORMUI64VARB)(getProcAddr(\"glGetUniformui64vARB\"))\n\tgpGetUniformui64vNV = (C.GPGETUNIFORMUI64VNV)(getProcAddr(\"glGetUniformui64vNV\"))\n\tgpGetUniformuiv = (C.GPGETUNIFORMUIV)(getProcAddr(\"glGetUniformuiv\"))\n\tif gpGetUniformuiv == nil {\n\t\treturn errors.New(\"glGetUniformuiv\")\n\t}\n\tgpGetUniformuivEXT = (C.GPGETUNIFORMUIVEXT)(getProcAddr(\"glGetUniformuivEXT\"))\n\tgpGetUnsignedBytei_vEXT = (C.GPGETUNSIGNEDBYTEI_VEXT)(getProcAddr(\"glGetUnsignedBytei_vEXT\"))\n\tgpGetUnsignedBytevEXT = (C.GPGETUNSIGNEDBYTEVEXT)(getProcAddr(\"glGetUnsignedBytevEXT\"))\n\tgpGetVariantArrayObjectfvATI = (C.GPGETVARIANTARRAYOBJECTFVATI)(getProcAddr(\"glGetVariantArrayObjectfvATI\"))\n\tgpGetVariantArrayObjectivATI = (C.GPGETVARIANTARRAYOBJECTIVATI)(getProcAddr(\"glGetVariantArrayObjectivATI\"))\n\tgpGetVariantBooleanvEXT = (C.GPGETVARIANTBOOLEANVEXT)(getProcAddr(\"glGetVariantBooleanvEXT\"))\n\tgpGetVariantFloatvEXT = (C.GPGETVARIANTFLOATVEXT)(getProcAddr(\"glGetVariantFloatvEXT\"))\n\tgpGetVariantIntegervEXT = (C.GPGETVARIANTINTEGERVEXT)(getProcAddr(\"glGetVariantIntegervEXT\"))\n\tgpGetVariantPointervEXT = (C.GPGETVARIANTPOINTERVEXT)(getProcAddr(\"glGetVariantPointervEXT\"))\n\tgpGetVaryingLocationNV = (C.GPGETVARYINGLOCATIONNV)(getProcAddr(\"glGetVaryingLocationNV\"))\n\tgpGetVertexArrayIndexed64iv = (C.GPGETVERTEXARRAYINDEXED64IV)(getProcAddr(\"glGetVertexArrayIndexed64iv\"))\n\tgpGetVertexArrayIndexediv = (C.GPGETVERTEXARRAYINDEXEDIV)(getProcAddr(\"glGetVertexArrayIndexediv\"))\n\tgpGetVertexArrayIntegeri_vEXT = (C.GPGETVERTEXARRAYINTEGERI_VEXT)(getProcAddr(\"glGetVertexArrayIntegeri_vEXT\"))\n\tgpGetVertexArrayIntegervEXT = (C.GPGETVERTEXARRAYINTEGERVEXT)(getProcAddr(\"glGetVertexArrayIntegervEXT\"))\n\tgpGetVertexArrayPointeri_vEXT = (C.GPGETVERTEXARRAYPOINTERI_VEXT)(getProcAddr(\"glGetVertexArrayPointeri_vEXT\"))\n\tgpGetVertexArrayPointervEXT = (C.GPGETVERTEXARRAYPOINTERVEXT)(getProcAddr(\"glGetVertexArrayPointervEXT\"))\n\tgpGetVertexArrayiv = (C.GPGETVERTEXARRAYIV)(getProcAddr(\"glGetVertexArrayiv\"))\n\tgpGetVertexAttribArrayObjectfvATI = (C.GPGETVERTEXATTRIBARRAYOBJECTFVATI)(getProcAddr(\"glGetVertexAttribArrayObjectfvATI\"))\n\tgpGetVertexAttribArrayObjectivATI = (C.GPGETVERTEXATTRIBARRAYOBJECTIVATI)(getProcAddr(\"glGetVertexAttribArrayObjectivATI\"))\n\tgpGetVertexAttribIiv = (C.GPGETVERTEXATTRIBIIV)(getProcAddr(\"glGetVertexAttribIiv\"))\n\tif gpGetVertexAttribIiv == nil {\n\t\treturn errors.New(\"glGetVertexAttribIiv\")\n\t}\n\tgpGetVertexAttribIivEXT = (C.GPGETVERTEXATTRIBIIVEXT)(getProcAddr(\"glGetVertexAttribIivEXT\"))\n\tgpGetVertexAttribIuiv = (C.GPGETVERTEXATTRIBIUIV)(getProcAddr(\"glGetVertexAttribIuiv\"))\n\tif gpGetVertexAttribIuiv == nil {\n\t\treturn errors.New(\"glGetVertexAttribIuiv\")\n\t}\n\tgpGetVertexAttribIuivEXT = (C.GPGETVERTEXATTRIBIUIVEXT)(getProcAddr(\"glGetVertexAttribIuivEXT\"))\n\tgpGetVertexAttribLdv = (C.GPGETVERTEXATTRIBLDV)(getProcAddr(\"glGetVertexAttribLdv\"))\n\tif gpGetVertexAttribLdv == nil {\n\t\treturn errors.New(\"glGetVertexAttribLdv\")\n\t}\n\tgpGetVertexAttribLdvEXT = (C.GPGETVERTEXATTRIBLDVEXT)(getProcAddr(\"glGetVertexAttribLdvEXT\"))\n\tgpGetVertexAttribLi64vNV = (C.GPGETVERTEXATTRIBLI64VNV)(getProcAddr(\"glGetVertexAttribLi64vNV\"))\n\tgpGetVertexAttribLui64vARB = (C.GPGETVERTEXATTRIBLUI64VARB)(getProcAddr(\"glGetVertexAttribLui64vARB\"))\n\tgpGetVertexAttribLui64vNV = (C.GPGETVERTEXATTRIBLUI64VNV)(getProcAddr(\"glGetVertexAttribLui64vNV\"))\n\tgpGetVertexAttribPointerv = (C.GPGETVERTEXATTRIBPOINTERV)(getProcAddr(\"glGetVertexAttribPointerv\"))\n\tif gpGetVertexAttribPointerv == nil {\n\t\treturn errors.New(\"glGetVertexAttribPointerv\")\n\t}\n\tgpGetVertexAttribPointervARB = (C.GPGETVERTEXATTRIBPOINTERVARB)(getProcAddr(\"glGetVertexAttribPointervARB\"))\n\tgpGetVertexAttribPointervNV = (C.GPGETVERTEXATTRIBPOINTERVNV)(getProcAddr(\"glGetVertexAttribPointervNV\"))\n\tgpGetVertexAttribdv = (C.GPGETVERTEXATTRIBDV)(getProcAddr(\"glGetVertexAttribdv\"))\n\tif gpGetVertexAttribdv == nil {\n\t\treturn errors.New(\"glGetVertexAttribdv\")\n\t}\n\tgpGetVertexAttribdvARB = (C.GPGETVERTEXATTRIBDVARB)(getProcAddr(\"glGetVertexAttribdvARB\"))\n\tgpGetVertexAttribdvNV = (C.GPGETVERTEXATTRIBDVNV)(getProcAddr(\"glGetVertexAttribdvNV\"))\n\tgpGetVertexAttribfv = (C.GPGETVERTEXATTRIBFV)(getProcAddr(\"glGetVertexAttribfv\"))\n\tif gpGetVertexAttribfv == nil {\n\t\treturn errors.New(\"glGetVertexAttribfv\")\n\t}\n\tgpGetVertexAttribfvARB = (C.GPGETVERTEXATTRIBFVARB)(getProcAddr(\"glGetVertexAttribfvARB\"))\n\tgpGetVertexAttribfvNV = (C.GPGETVERTEXATTRIBFVNV)(getProcAddr(\"glGetVertexAttribfvNV\"))\n\tgpGetVertexAttribiv = (C.GPGETVERTEXATTRIBIV)(getProcAddr(\"glGetVertexAttribiv\"))\n\tif gpGetVertexAttribiv == nil {\n\t\treturn errors.New(\"glGetVertexAttribiv\")\n\t}\n\tgpGetVertexAttribivARB = (C.GPGETVERTEXATTRIBIVARB)(getProcAddr(\"glGetVertexAttribivARB\"))\n\tgpGetVertexAttribivNV = (C.GPGETVERTEXATTRIBIVNV)(getProcAddr(\"glGetVertexAttribivNV\"))\n\tgpGetVideoCaptureStreamdvNV = (C.GPGETVIDEOCAPTURESTREAMDVNV)(getProcAddr(\"glGetVideoCaptureStreamdvNV\"))\n\tgpGetVideoCaptureStreamfvNV = (C.GPGETVIDEOCAPTURESTREAMFVNV)(getProcAddr(\"glGetVideoCaptureStreamfvNV\"))\n\tgpGetVideoCaptureStreamivNV = (C.GPGETVIDEOCAPTURESTREAMIVNV)(getProcAddr(\"glGetVideoCaptureStreamivNV\"))\n\tgpGetVideoCaptureivNV = (C.GPGETVIDEOCAPTUREIVNV)(getProcAddr(\"glGetVideoCaptureivNV\"))\n\tgpGetVideoi64vNV = (C.GPGETVIDEOI64VNV)(getProcAddr(\"glGetVideoi64vNV\"))\n\tgpGetVideoivNV = (C.GPGETVIDEOIVNV)(getProcAddr(\"glGetVideoivNV\"))\n\tgpGetVideoui64vNV = (C.GPGETVIDEOUI64VNV)(getProcAddr(\"glGetVideoui64vNV\"))\n\tgpGetVideouivNV = (C.GPGETVIDEOUIVNV)(getProcAddr(\"glGetVideouivNV\"))\n\tgpGetVkProcAddrNV = (C.GPGETVKPROCADDRNV)(getProcAddr(\"glGetVkProcAddrNV\"))\n\tgpGetnColorTableARB = (C.GPGETNCOLORTABLEARB)(getProcAddr(\"glGetnColorTableARB\"))\n\tgpGetnCompressedTexImageARB = (C.GPGETNCOMPRESSEDTEXIMAGEARB)(getProcAddr(\"glGetnCompressedTexImageARB\"))\n\tgpGetnConvolutionFilterARB = (C.GPGETNCONVOLUTIONFILTERARB)(getProcAddr(\"glGetnConvolutionFilterARB\"))\n\tgpGetnHistogramARB = (C.GPGETNHISTOGRAMARB)(getProcAddr(\"glGetnHistogramARB\"))\n\tgpGetnMapdvARB = (C.GPGETNMAPDVARB)(getProcAddr(\"glGetnMapdvARB\"))\n\tgpGetnMapfvARB = (C.GPGETNMAPFVARB)(getProcAddr(\"glGetnMapfvARB\"))\n\tgpGetnMapivARB = (C.GPGETNMAPIVARB)(getProcAddr(\"glGetnMapivARB\"))\n\tgpGetnMinmaxARB = (C.GPGETNMINMAXARB)(getProcAddr(\"glGetnMinmaxARB\"))\n\tgpGetnPixelMapfvARB = (C.GPGETNPIXELMAPFVARB)(getProcAddr(\"glGetnPixelMapfvARB\"))\n\tgpGetnPixelMapuivARB = (C.GPGETNPIXELMAPUIVARB)(getProcAddr(\"glGetnPixelMapuivARB\"))\n\tgpGetnPixelMapusvARB = (C.GPGETNPIXELMAPUSVARB)(getProcAddr(\"glGetnPixelMapusvARB\"))\n\tgpGetnPolygonStippleARB = (C.GPGETNPOLYGONSTIPPLEARB)(getProcAddr(\"glGetnPolygonStippleARB\"))\n\tgpGetnSeparableFilterARB = (C.GPGETNSEPARABLEFILTERARB)(getProcAddr(\"glGetnSeparableFilterARB\"))\n\tgpGetnTexImageARB = (C.GPGETNTEXIMAGEARB)(getProcAddr(\"glGetnTexImageARB\"))\n\tgpGetnUniformdvARB = (C.GPGETNUNIFORMDVARB)(getProcAddr(\"glGetnUniformdvARB\"))\n\tgpGetnUniformfv = (C.GPGETNUNIFORMFV)(getProcAddr(\"glGetnUniformfv\"))\n\tgpGetnUniformfvARB = (C.GPGETNUNIFORMFVARB)(getProcAddr(\"glGetnUniformfvARB\"))\n\tgpGetnUniformfvKHR = (C.GPGETNUNIFORMFVKHR)(getProcAddr(\"glGetnUniformfvKHR\"))\n\tgpGetnUniformi64vARB = (C.GPGETNUNIFORMI64VARB)(getProcAddr(\"glGetnUniformi64vARB\"))\n\tgpGetnUniformiv = (C.GPGETNUNIFORMIV)(getProcAddr(\"glGetnUniformiv\"))\n\tgpGetnUniformivARB = (C.GPGETNUNIFORMIVARB)(getProcAddr(\"glGetnUniformivARB\"))\n\tgpGetnUniformivKHR = (C.GPGETNUNIFORMIVKHR)(getProcAddr(\"glGetnUniformivKHR\"))\n\tgpGetnUniformui64vARB = (C.GPGETNUNIFORMUI64VARB)(getProcAddr(\"glGetnUniformui64vARB\"))\n\tgpGetnUniformuiv = (C.GPGETNUNIFORMUIV)(getProcAddr(\"glGetnUniformuiv\"))\n\tgpGetnUniformuivARB = (C.GPGETNUNIFORMUIVARB)(getProcAddr(\"glGetnUniformuivARB\"))\n\tgpGetnUniformuivKHR = (C.GPGETNUNIFORMUIVKHR)(getProcAddr(\"glGetnUniformuivKHR\"))\n\tgpGlobalAlphaFactorbSUN = (C.GPGLOBALALPHAFACTORBSUN)(getProcAddr(\"glGlobalAlphaFactorbSUN\"))\n\tgpGlobalAlphaFactordSUN = (C.GPGLOBALALPHAFACTORDSUN)(getProcAddr(\"glGlobalAlphaFactordSUN\"))\n\tgpGlobalAlphaFactorfSUN = (C.GPGLOBALALPHAFACTORFSUN)(getProcAddr(\"glGlobalAlphaFactorfSUN\"))\n\tgpGlobalAlphaFactoriSUN = (C.GPGLOBALALPHAFACTORISUN)(getProcAddr(\"glGlobalAlphaFactoriSUN\"))\n\tgpGlobalAlphaFactorsSUN = (C.GPGLOBALALPHAFACTORSSUN)(getProcAddr(\"glGlobalAlphaFactorsSUN\"))\n\tgpGlobalAlphaFactorubSUN = (C.GPGLOBALALPHAFACTORUBSUN)(getProcAddr(\"glGlobalAlphaFactorubSUN\"))\n\tgpGlobalAlphaFactoruiSUN = (C.GPGLOBALALPHAFACTORUISUN)(getProcAddr(\"glGlobalAlphaFactoruiSUN\"))\n\tgpGlobalAlphaFactorusSUN = (C.GPGLOBALALPHAFACTORUSSUN)(getProcAddr(\"glGlobalAlphaFactorusSUN\"))\n\tgpHint = (C.GPHINT)(getProcAddr(\"glHint\"))\n\tif gpHint == nil {\n\t\treturn errors.New(\"glHint\")\n\t}\n\tgpHintPGI = (C.GPHINTPGI)(getProcAddr(\"glHintPGI\"))\n\tgpHistogram = (C.GPHISTOGRAM)(getProcAddr(\"glHistogram\"))\n\tgpHistogramEXT = (C.GPHISTOGRAMEXT)(getProcAddr(\"glHistogramEXT\"))\n\tgpIglooInterfaceSGIX = (C.GPIGLOOINTERFACESGIX)(getProcAddr(\"glIglooInterfaceSGIX\"))\n\tgpImageTransformParameterfHP = (C.GPIMAGETRANSFORMPARAMETERFHP)(getProcAddr(\"glImageTransformParameterfHP\"))\n\tgpImageTransformParameterfvHP = (C.GPIMAGETRANSFORMPARAMETERFVHP)(getProcAddr(\"glImageTransformParameterfvHP\"))\n\tgpImageTransformParameteriHP = (C.GPIMAGETRANSFORMPARAMETERIHP)(getProcAddr(\"glImageTransformParameteriHP\"))\n\tgpImageTransformParameterivHP = (C.GPIMAGETRANSFORMPARAMETERIVHP)(getProcAddr(\"glImageTransformParameterivHP\"))\n\tgpImportMemoryFdEXT = (C.GPIMPORTMEMORYFDEXT)(getProcAddr(\"glImportMemoryFdEXT\"))\n\tgpImportMemoryWin32HandleEXT = (C.GPIMPORTMEMORYWIN32HANDLEEXT)(getProcAddr(\"glImportMemoryWin32HandleEXT\"))\n\tgpImportMemoryWin32NameEXT = (C.GPIMPORTMEMORYWIN32NAMEEXT)(getProcAddr(\"glImportMemoryWin32NameEXT\"))\n\tgpImportSemaphoreFdEXT = (C.GPIMPORTSEMAPHOREFDEXT)(getProcAddr(\"glImportSemaphoreFdEXT\"))\n\tgpImportSemaphoreWin32HandleEXT = (C.GPIMPORTSEMAPHOREWIN32HANDLEEXT)(getProcAddr(\"glImportSemaphoreWin32HandleEXT\"))\n\tgpImportSemaphoreWin32NameEXT = (C.GPIMPORTSEMAPHOREWIN32NAMEEXT)(getProcAddr(\"glImportSemaphoreWin32NameEXT\"))\n\tgpImportSyncEXT = (C.GPIMPORTSYNCEXT)(getProcAddr(\"glImportSyncEXT\"))\n\tgpIndexFormatNV = (C.GPINDEXFORMATNV)(getProcAddr(\"glIndexFormatNV\"))\n\tgpIndexFuncEXT = (C.GPINDEXFUNCEXT)(getProcAddr(\"glIndexFuncEXT\"))\n\tgpIndexMask = (C.GPINDEXMASK)(getProcAddr(\"glIndexMask\"))\n\tif gpIndexMask == nil {\n\t\treturn errors.New(\"glIndexMask\")\n\t}\n\tgpIndexMaterialEXT = (C.GPINDEXMATERIALEXT)(getProcAddr(\"glIndexMaterialEXT\"))\n\tgpIndexPointer = (C.GPINDEXPOINTER)(getProcAddr(\"glIndexPointer\"))\n\tif gpIndexPointer == nil {\n\t\treturn errors.New(\"glIndexPointer\")\n\t}\n\tgpIndexPointerEXT = (C.GPINDEXPOINTEREXT)(getProcAddr(\"glIndexPointerEXT\"))\n\tgpIndexPointerListIBM = (C.GPINDEXPOINTERLISTIBM)(getProcAddr(\"glIndexPointerListIBM\"))\n\tgpIndexd = (C.GPINDEXD)(getProcAddr(\"glIndexd\"))\n\tif gpIndexd == nil {\n\t\treturn errors.New(\"glIndexd\")\n\t}\n\tgpIndexdv = (C.GPINDEXDV)(getProcAddr(\"glIndexdv\"))\n\tif gpIndexdv == nil {\n\t\treturn errors.New(\"glIndexdv\")\n\t}\n\tgpIndexf = (C.GPINDEXF)(getProcAddr(\"glIndexf\"))\n\tif gpIndexf == nil {\n\t\treturn errors.New(\"glIndexf\")\n\t}\n\tgpIndexfv = (C.GPINDEXFV)(getProcAddr(\"glIndexfv\"))\n\tif gpIndexfv == nil {\n\t\treturn errors.New(\"glIndexfv\")\n\t}\n\tgpIndexi = (C.GPINDEXI)(getProcAddr(\"glIndexi\"))\n\tif gpIndexi == nil {\n\t\treturn errors.New(\"glIndexi\")\n\t}\n\tgpIndexiv = (C.GPINDEXIV)(getProcAddr(\"glIndexiv\"))\n\tif gpIndexiv == nil {\n\t\treturn errors.New(\"glIndexiv\")\n\t}\n\tgpIndexs = (C.GPINDEXS)(getProcAddr(\"glIndexs\"))\n\tif gpIndexs == nil {\n\t\treturn errors.New(\"glIndexs\")\n\t}\n\tgpIndexsv = (C.GPINDEXSV)(getProcAddr(\"glIndexsv\"))\n\tif gpIndexsv == nil {\n\t\treturn errors.New(\"glIndexsv\")\n\t}\n\tgpIndexub = (C.GPINDEXUB)(getProcAddr(\"glIndexub\"))\n\tif gpIndexub == nil {\n\t\treturn errors.New(\"glIndexub\")\n\t}\n\tgpIndexubv = (C.GPINDEXUBV)(getProcAddr(\"glIndexubv\"))\n\tif gpIndexubv == nil {\n\t\treturn errors.New(\"glIndexubv\")\n\t}\n\tgpIndexxOES = (C.GPINDEXXOES)(getProcAddr(\"glIndexxOES\"))\n\tgpIndexxvOES = (C.GPINDEXXVOES)(getProcAddr(\"glIndexxvOES\"))\n\tgpInitNames = (C.GPINITNAMES)(getProcAddr(\"glInitNames\"))\n\tif gpInitNames == nil {\n\t\treturn errors.New(\"glInitNames\")\n\t}\n\tgpInsertComponentEXT = (C.GPINSERTCOMPONENTEXT)(getProcAddr(\"glInsertComponentEXT\"))\n\tgpInsertEventMarkerEXT = (C.GPINSERTEVENTMARKEREXT)(getProcAddr(\"glInsertEventMarkerEXT\"))\n\tgpInstrumentsBufferSGIX = (C.GPINSTRUMENTSBUFFERSGIX)(getProcAddr(\"glInstrumentsBufferSGIX\"))\n\tgpInterleavedArrays = (C.GPINTERLEAVEDARRAYS)(getProcAddr(\"glInterleavedArrays\"))\n\tif gpInterleavedArrays == nil {\n\t\treturn errors.New(\"glInterleavedArrays\")\n\t}\n\tgpInterpolatePathsNV = (C.GPINTERPOLATEPATHSNV)(getProcAddr(\"glInterpolatePathsNV\"))\n\tgpInvalidateBufferData = (C.GPINVALIDATEBUFFERDATA)(getProcAddr(\"glInvalidateBufferData\"))\n\tif gpInvalidateBufferData == nil {\n\t\treturn errors.New(\"glInvalidateBufferData\")\n\t}\n\tgpInvalidateBufferSubData = (C.GPINVALIDATEBUFFERSUBDATA)(getProcAddr(\"glInvalidateBufferSubData\"))\n\tif gpInvalidateBufferSubData == nil {\n\t\treturn errors.New(\"glInvalidateBufferSubData\")\n\t}\n\tgpInvalidateFramebuffer = (C.GPINVALIDATEFRAMEBUFFER)(getProcAddr(\"glInvalidateFramebuffer\"))\n\tif gpInvalidateFramebuffer == nil {\n\t\treturn errors.New(\"glInvalidateFramebuffer\")\n\t}\n\tgpInvalidateNamedFramebufferData = (C.GPINVALIDATENAMEDFRAMEBUFFERDATA)(getProcAddr(\"glInvalidateNamedFramebufferData\"))\n\tgpInvalidateNamedFramebufferSubData = (C.GPINVALIDATENAMEDFRAMEBUFFERSUBDATA)(getProcAddr(\"glInvalidateNamedFramebufferSubData\"))\n\tgpInvalidateSubFramebuffer = (C.GPINVALIDATESUBFRAMEBUFFER)(getProcAddr(\"glInvalidateSubFramebuffer\"))\n\tif gpInvalidateSubFramebuffer == nil {\n\t\treturn errors.New(\"glInvalidateSubFramebuffer\")\n\t}\n\tgpInvalidateTexImage = (C.GPINVALIDATETEXIMAGE)(getProcAddr(\"glInvalidateTexImage\"))\n\tif gpInvalidateTexImage == nil {\n\t\treturn errors.New(\"glInvalidateTexImage\")\n\t}\n\tgpInvalidateTexSubImage = (C.GPINVALIDATETEXSUBIMAGE)(getProcAddr(\"glInvalidateTexSubImage\"))\n\tif gpInvalidateTexSubImage == nil {\n\t\treturn errors.New(\"glInvalidateTexSubImage\")\n\t}\n\tgpIsAsyncMarkerSGIX = (C.GPISASYNCMARKERSGIX)(getProcAddr(\"glIsAsyncMarkerSGIX\"))\n\tgpIsBuffer = (C.GPISBUFFER)(getProcAddr(\"glIsBuffer\"))\n\tif gpIsBuffer == nil {\n\t\treturn errors.New(\"glIsBuffer\")\n\t}\n\tgpIsBufferARB = (C.GPISBUFFERARB)(getProcAddr(\"glIsBufferARB\"))\n\tgpIsBufferResidentNV = (C.GPISBUFFERRESIDENTNV)(getProcAddr(\"glIsBufferResidentNV\"))\n\tgpIsCommandListNV = (C.GPISCOMMANDLISTNV)(getProcAddr(\"glIsCommandListNV\"))\n\tgpIsEnabled = (C.GPISENABLED)(getProcAddr(\"glIsEnabled\"))\n\tif gpIsEnabled == nil {\n\t\treturn errors.New(\"glIsEnabled\")\n\t}\n\tgpIsEnabledIndexedEXT = (C.GPISENABLEDINDEXEDEXT)(getProcAddr(\"glIsEnabledIndexedEXT\"))\n\tgpIsEnabledi = (C.GPISENABLEDI)(getProcAddr(\"glIsEnabledi\"))\n\tif gpIsEnabledi == nil {\n\t\treturn errors.New(\"glIsEnabledi\")\n\t}\n\tgpIsFenceAPPLE = (C.GPISFENCEAPPLE)(getProcAddr(\"glIsFenceAPPLE\"))\n\tgpIsFenceNV = (C.GPISFENCENV)(getProcAddr(\"glIsFenceNV\"))\n\tgpIsFramebuffer = (C.GPISFRAMEBUFFER)(getProcAddr(\"glIsFramebuffer\"))\n\tif gpIsFramebuffer == nil {\n\t\treturn errors.New(\"glIsFramebuffer\")\n\t}\n\tgpIsFramebufferEXT = (C.GPISFRAMEBUFFEREXT)(getProcAddr(\"glIsFramebufferEXT\"))\n\tgpIsImageHandleResidentARB = (C.GPISIMAGEHANDLERESIDENTARB)(getProcAddr(\"glIsImageHandleResidentARB\"))\n\tgpIsImageHandleResidentNV = (C.GPISIMAGEHANDLERESIDENTNV)(getProcAddr(\"glIsImageHandleResidentNV\"))\n\tgpIsList = (C.GPISLIST)(getProcAddr(\"glIsList\"))\n\tif gpIsList == nil {\n\t\treturn errors.New(\"glIsList\")\n\t}\n\tgpIsMemoryObjectEXT = (C.GPISMEMORYOBJECTEXT)(getProcAddr(\"glIsMemoryObjectEXT\"))\n\tgpIsNameAMD = (C.GPISNAMEAMD)(getProcAddr(\"glIsNameAMD\"))\n\tgpIsNamedBufferResidentNV = (C.GPISNAMEDBUFFERRESIDENTNV)(getProcAddr(\"glIsNamedBufferResidentNV\"))\n\tgpIsNamedStringARB = (C.GPISNAMEDSTRINGARB)(getProcAddr(\"glIsNamedStringARB\"))\n\tgpIsObjectBufferATI = (C.GPISOBJECTBUFFERATI)(getProcAddr(\"glIsObjectBufferATI\"))\n\tgpIsOcclusionQueryNV = (C.GPISOCCLUSIONQUERYNV)(getProcAddr(\"glIsOcclusionQueryNV\"))\n\tgpIsPathNV = (C.GPISPATHNV)(getProcAddr(\"glIsPathNV\"))\n\tgpIsPointInFillPathNV = (C.GPISPOINTINFILLPATHNV)(getProcAddr(\"glIsPointInFillPathNV\"))\n\tgpIsPointInStrokePathNV = (C.GPISPOINTINSTROKEPATHNV)(getProcAddr(\"glIsPointInStrokePathNV\"))\n\tgpIsProgram = (C.GPISPROGRAM)(getProcAddr(\"glIsProgram\"))\n\tif gpIsProgram == nil {\n\t\treturn errors.New(\"glIsProgram\")\n\t}\n\tgpIsProgramARB = (C.GPISPROGRAMARB)(getProcAddr(\"glIsProgramARB\"))\n\tgpIsProgramNV = (C.GPISPROGRAMNV)(getProcAddr(\"glIsProgramNV\"))\n\tgpIsProgramPipeline = (C.GPISPROGRAMPIPELINE)(getProcAddr(\"glIsProgramPipeline\"))\n\tif gpIsProgramPipeline == nil {\n\t\treturn errors.New(\"glIsProgramPipeline\")\n\t}\n\tgpIsProgramPipelineEXT = (C.GPISPROGRAMPIPELINEEXT)(getProcAddr(\"glIsProgramPipelineEXT\"))\n\tgpIsQuery = (C.GPISQUERY)(getProcAddr(\"glIsQuery\"))\n\tif gpIsQuery == nil {\n\t\treturn errors.New(\"glIsQuery\")\n\t}\n\tgpIsQueryARB = (C.GPISQUERYARB)(getProcAddr(\"glIsQueryARB\"))\n\tgpIsRenderbuffer = (C.GPISRENDERBUFFER)(getProcAddr(\"glIsRenderbuffer\"))\n\tif gpIsRenderbuffer == nil {\n\t\treturn errors.New(\"glIsRenderbuffer\")\n\t}\n\tgpIsRenderbufferEXT = (C.GPISRENDERBUFFEREXT)(getProcAddr(\"glIsRenderbufferEXT\"))\n\tgpIsSampler = (C.GPISSAMPLER)(getProcAddr(\"glIsSampler\"))\n\tif gpIsSampler == nil {\n\t\treturn errors.New(\"glIsSampler\")\n\t}\n\tgpIsSemaphoreEXT = (C.GPISSEMAPHOREEXT)(getProcAddr(\"glIsSemaphoreEXT\"))\n\tgpIsShader = (C.GPISSHADER)(getProcAddr(\"glIsShader\"))\n\tif gpIsShader == nil {\n\t\treturn errors.New(\"glIsShader\")\n\t}\n\tgpIsStateNV = (C.GPISSTATENV)(getProcAddr(\"glIsStateNV\"))\n\tgpIsSync = (C.GPISSYNC)(getProcAddr(\"glIsSync\"))\n\tif gpIsSync == nil {\n\t\treturn errors.New(\"glIsSync\")\n\t}\n\tgpIsTexture = (C.GPISTEXTURE)(getProcAddr(\"glIsTexture\"))\n\tif gpIsTexture == nil {\n\t\treturn errors.New(\"glIsTexture\")\n\t}\n\tgpIsTextureEXT = (C.GPISTEXTUREEXT)(getProcAddr(\"glIsTextureEXT\"))\n\tgpIsTextureHandleResidentARB = (C.GPISTEXTUREHANDLERESIDENTARB)(getProcAddr(\"glIsTextureHandleResidentARB\"))\n\tgpIsTextureHandleResidentNV = (C.GPISTEXTUREHANDLERESIDENTNV)(getProcAddr(\"glIsTextureHandleResidentNV\"))\n\tgpIsTransformFeedback = (C.GPISTRANSFORMFEEDBACK)(getProcAddr(\"glIsTransformFeedback\"))\n\tif gpIsTransformFeedback == nil {\n\t\treturn errors.New(\"glIsTransformFeedback\")\n\t}\n\tgpIsTransformFeedbackNV = (C.GPISTRANSFORMFEEDBACKNV)(getProcAddr(\"glIsTransformFeedbackNV\"))\n\tgpIsVariantEnabledEXT = (C.GPISVARIANTENABLEDEXT)(getProcAddr(\"glIsVariantEnabledEXT\"))\n\tgpIsVertexArray = (C.GPISVERTEXARRAY)(getProcAddr(\"glIsVertexArray\"))\n\tif gpIsVertexArray == nil {\n\t\treturn errors.New(\"glIsVertexArray\")\n\t}\n\tgpIsVertexArrayAPPLE = (C.GPISVERTEXARRAYAPPLE)(getProcAddr(\"glIsVertexArrayAPPLE\"))\n\tgpIsVertexAttribEnabledAPPLE = (C.GPISVERTEXATTRIBENABLEDAPPLE)(getProcAddr(\"glIsVertexAttribEnabledAPPLE\"))\n\tgpLGPUCopyImageSubDataNVX = (C.GPLGPUCOPYIMAGESUBDATANVX)(getProcAddr(\"glLGPUCopyImageSubDataNVX\"))\n\tgpLGPUInterlockNVX = (C.GPLGPUINTERLOCKNVX)(getProcAddr(\"glLGPUInterlockNVX\"))\n\tgpLGPUNamedBufferSubDataNVX = (C.GPLGPUNAMEDBUFFERSUBDATANVX)(getProcAddr(\"glLGPUNamedBufferSubDataNVX\"))\n\tgpLabelObjectEXT = (C.GPLABELOBJECTEXT)(getProcAddr(\"glLabelObjectEXT\"))\n\tgpLightEnviSGIX = (C.GPLIGHTENVISGIX)(getProcAddr(\"glLightEnviSGIX\"))\n\tgpLightModelf = (C.GPLIGHTMODELF)(getProcAddr(\"glLightModelf\"))\n\tif gpLightModelf == nil {\n\t\treturn errors.New(\"glLightModelf\")\n\t}\n\tgpLightModelfv = (C.GPLIGHTMODELFV)(getProcAddr(\"glLightModelfv\"))\n\tif gpLightModelfv == nil {\n\t\treturn errors.New(\"glLightModelfv\")\n\t}\n\tgpLightModeli = (C.GPLIGHTMODELI)(getProcAddr(\"glLightModeli\"))\n\tif gpLightModeli == nil {\n\t\treturn errors.New(\"glLightModeli\")\n\t}\n\tgpLightModeliv = (C.GPLIGHTMODELIV)(getProcAddr(\"glLightModeliv\"))\n\tif gpLightModeliv == nil {\n\t\treturn errors.New(\"glLightModeliv\")\n\t}\n\tgpLightModelxOES = (C.GPLIGHTMODELXOES)(getProcAddr(\"glLightModelxOES\"))\n\tgpLightModelxvOES = (C.GPLIGHTMODELXVOES)(getProcAddr(\"glLightModelxvOES\"))\n\tgpLightf = (C.GPLIGHTF)(getProcAddr(\"glLightf\"))\n\tif gpLightf == nil {\n\t\treturn errors.New(\"glLightf\")\n\t}\n\tgpLightfv = (C.GPLIGHTFV)(getProcAddr(\"glLightfv\"))\n\tif gpLightfv == nil {\n\t\treturn errors.New(\"glLightfv\")\n\t}\n\tgpLighti = (C.GPLIGHTI)(getProcAddr(\"glLighti\"))\n\tif gpLighti == nil {\n\t\treturn errors.New(\"glLighti\")\n\t}\n\tgpLightiv = (C.GPLIGHTIV)(getProcAddr(\"glLightiv\"))\n\tif gpLightiv == nil {\n\t\treturn errors.New(\"glLightiv\")\n\t}\n\tgpLightxOES = (C.GPLIGHTXOES)(getProcAddr(\"glLightxOES\"))\n\tgpLightxvOES = (C.GPLIGHTXVOES)(getProcAddr(\"glLightxvOES\"))\n\tgpLineStipple = (C.GPLINESTIPPLE)(getProcAddr(\"glLineStipple\"))\n\tif gpLineStipple == nil {\n\t\treturn errors.New(\"glLineStipple\")\n\t}\n\tgpLineWidth = (C.GPLINEWIDTH)(getProcAddr(\"glLineWidth\"))\n\tif gpLineWidth == nil {\n\t\treturn errors.New(\"glLineWidth\")\n\t}\n\tgpLineWidthxOES = (C.GPLINEWIDTHXOES)(getProcAddr(\"glLineWidthxOES\"))\n\tgpLinkProgram = (C.GPLINKPROGRAM)(getProcAddr(\"glLinkProgram\"))\n\tif gpLinkProgram == nil {\n\t\treturn errors.New(\"glLinkProgram\")\n\t}\n\tgpLinkProgramARB = (C.GPLINKPROGRAMARB)(getProcAddr(\"glLinkProgramARB\"))\n\tgpListBase = (C.GPLISTBASE)(getProcAddr(\"glListBase\"))\n\tif gpListBase == nil {\n\t\treturn errors.New(\"glListBase\")\n\t}\n\tgpListDrawCommandsStatesClientNV = (C.GPLISTDRAWCOMMANDSSTATESCLIENTNV)(getProcAddr(\"glListDrawCommandsStatesClientNV\"))\n\tgpListParameterfSGIX = (C.GPLISTPARAMETERFSGIX)(getProcAddr(\"glListParameterfSGIX\"))\n\tgpListParameterfvSGIX = (C.GPLISTPARAMETERFVSGIX)(getProcAddr(\"glListParameterfvSGIX\"))\n\tgpListParameteriSGIX = (C.GPLISTPARAMETERISGIX)(getProcAddr(\"glListParameteriSGIX\"))\n\tgpListParameterivSGIX = (C.GPLISTPARAMETERIVSGIX)(getProcAddr(\"glListParameterivSGIX\"))\n\tgpLoadIdentity = (C.GPLOADIDENTITY)(getProcAddr(\"glLoadIdentity\"))\n\tif gpLoadIdentity == nil {\n\t\treturn errors.New(\"glLoadIdentity\")\n\t}\n\tgpLoadIdentityDeformationMapSGIX = (C.GPLOADIDENTITYDEFORMATIONMAPSGIX)(getProcAddr(\"glLoadIdentityDeformationMapSGIX\"))\n\tgpLoadMatrixd = (C.GPLOADMATRIXD)(getProcAddr(\"glLoadMatrixd\"))\n\tif gpLoadMatrixd == nil {\n\t\treturn errors.New(\"glLoadMatrixd\")\n\t}\n\tgpLoadMatrixf = (C.GPLOADMATRIXF)(getProcAddr(\"glLoadMatrixf\"))\n\tif gpLoadMatrixf == nil {\n\t\treturn errors.New(\"glLoadMatrixf\")\n\t}\n\tgpLoadMatrixxOES = (C.GPLOADMATRIXXOES)(getProcAddr(\"glLoadMatrixxOES\"))\n\tgpLoadName = (C.GPLOADNAME)(getProcAddr(\"glLoadName\"))\n\tif gpLoadName == nil {\n\t\treturn errors.New(\"glLoadName\")\n\t}\n\tgpLoadProgramNV = (C.GPLOADPROGRAMNV)(getProcAddr(\"glLoadProgramNV\"))\n\tgpLoadTransposeMatrixd = (C.GPLOADTRANSPOSEMATRIXD)(getProcAddr(\"glLoadTransposeMatrixd\"))\n\tif gpLoadTransposeMatrixd == nil {\n\t\treturn errors.New(\"glLoadTransposeMatrixd\")\n\t}\n\tgpLoadTransposeMatrixdARB = (C.GPLOADTRANSPOSEMATRIXDARB)(getProcAddr(\"glLoadTransposeMatrixdARB\"))\n\tgpLoadTransposeMatrixf = (C.GPLOADTRANSPOSEMATRIXF)(getProcAddr(\"glLoadTransposeMatrixf\"))\n\tif gpLoadTransposeMatrixf == nil {\n\t\treturn errors.New(\"glLoadTransposeMatrixf\")\n\t}\n\tgpLoadTransposeMatrixfARB = (C.GPLOADTRANSPOSEMATRIXFARB)(getProcAddr(\"glLoadTransposeMatrixfARB\"))\n\tgpLoadTransposeMatrixxOES = (C.GPLOADTRANSPOSEMATRIXXOES)(getProcAddr(\"glLoadTransposeMatrixxOES\"))\n\tgpLockArraysEXT = (C.GPLOCKARRAYSEXT)(getProcAddr(\"glLockArraysEXT\"))\n\tgpLogicOp = (C.GPLOGICOP)(getProcAddr(\"glLogicOp\"))\n\tif gpLogicOp == nil {\n\t\treturn errors.New(\"glLogicOp\")\n\t}\n\tgpMakeBufferNonResidentNV = (C.GPMAKEBUFFERNONRESIDENTNV)(getProcAddr(\"glMakeBufferNonResidentNV\"))\n\tgpMakeBufferResidentNV = (C.GPMAKEBUFFERRESIDENTNV)(getProcAddr(\"glMakeBufferResidentNV\"))\n\tgpMakeImageHandleNonResidentARB = (C.GPMAKEIMAGEHANDLENONRESIDENTARB)(getProcAddr(\"glMakeImageHandleNonResidentARB\"))\n\tgpMakeImageHandleNonResidentNV = (C.GPMAKEIMAGEHANDLENONRESIDENTNV)(getProcAddr(\"glMakeImageHandleNonResidentNV\"))\n\tgpMakeImageHandleResidentARB = (C.GPMAKEIMAGEHANDLERESIDENTARB)(getProcAddr(\"glMakeImageHandleResidentARB\"))\n\tgpMakeImageHandleResidentNV = (C.GPMAKEIMAGEHANDLERESIDENTNV)(getProcAddr(\"glMakeImageHandleResidentNV\"))\n\tgpMakeNamedBufferNonResidentNV = (C.GPMAKENAMEDBUFFERNONRESIDENTNV)(getProcAddr(\"glMakeNamedBufferNonResidentNV\"))\n\tgpMakeNamedBufferResidentNV = (C.GPMAKENAMEDBUFFERRESIDENTNV)(getProcAddr(\"glMakeNamedBufferResidentNV\"))\n\tgpMakeTextureHandleNonResidentARB = (C.GPMAKETEXTUREHANDLENONRESIDENTARB)(getProcAddr(\"glMakeTextureHandleNonResidentARB\"))\n\tgpMakeTextureHandleNonResidentNV = (C.GPMAKETEXTUREHANDLENONRESIDENTNV)(getProcAddr(\"glMakeTextureHandleNonResidentNV\"))\n\tgpMakeTextureHandleResidentARB = (C.GPMAKETEXTUREHANDLERESIDENTARB)(getProcAddr(\"glMakeTextureHandleResidentARB\"))\n\tgpMakeTextureHandleResidentNV = (C.GPMAKETEXTUREHANDLERESIDENTNV)(getProcAddr(\"glMakeTextureHandleResidentNV\"))\n\tgpMap1d = (C.GPMAP1D)(getProcAddr(\"glMap1d\"))\n\tif gpMap1d == nil {\n\t\treturn errors.New(\"glMap1d\")\n\t}\n\tgpMap1f = (C.GPMAP1F)(getProcAddr(\"glMap1f\"))\n\tif gpMap1f == nil {\n\t\treturn errors.New(\"glMap1f\")\n\t}\n\tgpMap1xOES = (C.GPMAP1XOES)(getProcAddr(\"glMap1xOES\"))\n\tgpMap2d = (C.GPMAP2D)(getProcAddr(\"glMap2d\"))\n\tif gpMap2d == nil {\n\t\treturn errors.New(\"glMap2d\")\n\t}\n\tgpMap2f = (C.GPMAP2F)(getProcAddr(\"glMap2f\"))\n\tif gpMap2f == nil {\n\t\treturn errors.New(\"glMap2f\")\n\t}\n\tgpMap2xOES = (C.GPMAP2XOES)(getProcAddr(\"glMap2xOES\"))\n\tgpMapBuffer = (C.GPMAPBUFFER)(getProcAddr(\"glMapBuffer\"))\n\tif gpMapBuffer == nil {\n\t\treturn errors.New(\"glMapBuffer\")\n\t}\n\tgpMapBufferARB = (C.GPMAPBUFFERARB)(getProcAddr(\"glMapBufferARB\"))\n\tgpMapBufferRange = (C.GPMAPBUFFERRANGE)(getProcAddr(\"glMapBufferRange\"))\n\tif gpMapBufferRange == nil {\n\t\treturn errors.New(\"glMapBufferRange\")\n\t}\n\tgpMapControlPointsNV = (C.GPMAPCONTROLPOINTSNV)(getProcAddr(\"glMapControlPointsNV\"))\n\tgpMapGrid1d = (C.GPMAPGRID1D)(getProcAddr(\"glMapGrid1d\"))\n\tif gpMapGrid1d == nil {\n\t\treturn errors.New(\"glMapGrid1d\")\n\t}\n\tgpMapGrid1f = (C.GPMAPGRID1F)(getProcAddr(\"glMapGrid1f\"))\n\tif gpMapGrid1f == nil {\n\t\treturn errors.New(\"glMapGrid1f\")\n\t}\n\tgpMapGrid1xOES = (C.GPMAPGRID1XOES)(getProcAddr(\"glMapGrid1xOES\"))\n\tgpMapGrid2d = (C.GPMAPGRID2D)(getProcAddr(\"glMapGrid2d\"))\n\tif gpMapGrid2d == nil {\n\t\treturn errors.New(\"glMapGrid2d\")\n\t}\n\tgpMapGrid2f = (C.GPMAPGRID2F)(getProcAddr(\"glMapGrid2f\"))\n\tif gpMapGrid2f == nil {\n\t\treturn errors.New(\"glMapGrid2f\")\n\t}\n\tgpMapGrid2xOES = (C.GPMAPGRID2XOES)(getProcAddr(\"glMapGrid2xOES\"))\n\tgpMapNamedBuffer = (C.GPMAPNAMEDBUFFER)(getProcAddr(\"glMapNamedBuffer\"))\n\tgpMapNamedBufferEXT = (C.GPMAPNAMEDBUFFEREXT)(getProcAddr(\"glMapNamedBufferEXT\"))\n\tgpMapNamedBufferRange = (C.GPMAPNAMEDBUFFERRANGE)(getProcAddr(\"glMapNamedBufferRange\"))\n\tgpMapNamedBufferRangeEXT = (C.GPMAPNAMEDBUFFERRANGEEXT)(getProcAddr(\"glMapNamedBufferRangeEXT\"))\n\tgpMapObjectBufferATI = (C.GPMAPOBJECTBUFFERATI)(getProcAddr(\"glMapObjectBufferATI\"))\n\tgpMapParameterfvNV = (C.GPMAPPARAMETERFVNV)(getProcAddr(\"glMapParameterfvNV\"))\n\tgpMapParameterivNV = (C.GPMAPPARAMETERIVNV)(getProcAddr(\"glMapParameterivNV\"))\n\tgpMapTexture2DINTEL = (C.GPMAPTEXTURE2DINTEL)(getProcAddr(\"glMapTexture2DINTEL\"))\n\tgpMapVertexAttrib1dAPPLE = (C.GPMAPVERTEXATTRIB1DAPPLE)(getProcAddr(\"glMapVertexAttrib1dAPPLE\"))\n\tgpMapVertexAttrib1fAPPLE = (C.GPMAPVERTEXATTRIB1FAPPLE)(getProcAddr(\"glMapVertexAttrib1fAPPLE\"))\n\tgpMapVertexAttrib2dAPPLE = (C.GPMAPVERTEXATTRIB2DAPPLE)(getProcAddr(\"glMapVertexAttrib2dAPPLE\"))\n\tgpMapVertexAttrib2fAPPLE = (C.GPMAPVERTEXATTRIB2FAPPLE)(getProcAddr(\"glMapVertexAttrib2fAPPLE\"))\n\tgpMaterialf = (C.GPMATERIALF)(getProcAddr(\"glMaterialf\"))\n\tif gpMaterialf == nil {\n\t\treturn errors.New(\"glMaterialf\")\n\t}\n\tgpMaterialfv = (C.GPMATERIALFV)(getProcAddr(\"glMaterialfv\"))\n\tif gpMaterialfv == nil {\n\t\treturn errors.New(\"glMaterialfv\")\n\t}\n\tgpMateriali = (C.GPMATERIALI)(getProcAddr(\"glMateriali\"))\n\tif gpMateriali == nil {\n\t\treturn errors.New(\"glMateriali\")\n\t}\n\tgpMaterialiv = (C.GPMATERIALIV)(getProcAddr(\"glMaterialiv\"))\n\tif gpMaterialiv == nil {\n\t\treturn errors.New(\"glMaterialiv\")\n\t}\n\tgpMaterialxOES = (C.GPMATERIALXOES)(getProcAddr(\"glMaterialxOES\"))\n\tgpMaterialxvOES = (C.GPMATERIALXVOES)(getProcAddr(\"glMaterialxvOES\"))\n\tgpMatrixFrustumEXT = (C.GPMATRIXFRUSTUMEXT)(getProcAddr(\"glMatrixFrustumEXT\"))\n\tgpMatrixIndexPointerARB = (C.GPMATRIXINDEXPOINTERARB)(getProcAddr(\"glMatrixIndexPointerARB\"))\n\tgpMatrixIndexubvARB = (C.GPMATRIXINDEXUBVARB)(getProcAddr(\"glMatrixIndexubvARB\"))\n\tgpMatrixIndexuivARB = (C.GPMATRIXINDEXUIVARB)(getProcAddr(\"glMatrixIndexuivARB\"))\n\tgpMatrixIndexusvARB = (C.GPMATRIXINDEXUSVARB)(getProcAddr(\"glMatrixIndexusvARB\"))\n\tgpMatrixLoad3x2fNV = (C.GPMATRIXLOAD3X2FNV)(getProcAddr(\"glMatrixLoad3x2fNV\"))\n\tgpMatrixLoad3x3fNV = (C.GPMATRIXLOAD3X3FNV)(getProcAddr(\"glMatrixLoad3x3fNV\"))\n\tgpMatrixLoadIdentityEXT = (C.GPMATRIXLOADIDENTITYEXT)(getProcAddr(\"glMatrixLoadIdentityEXT\"))\n\tgpMatrixLoadTranspose3x3fNV = (C.GPMATRIXLOADTRANSPOSE3X3FNV)(getProcAddr(\"glMatrixLoadTranspose3x3fNV\"))\n\tgpMatrixLoadTransposedEXT = (C.GPMATRIXLOADTRANSPOSEDEXT)(getProcAddr(\"glMatrixLoadTransposedEXT\"))\n\tgpMatrixLoadTransposefEXT = (C.GPMATRIXLOADTRANSPOSEFEXT)(getProcAddr(\"glMatrixLoadTransposefEXT\"))\n\tgpMatrixLoaddEXT = (C.GPMATRIXLOADDEXT)(getProcAddr(\"glMatrixLoaddEXT\"))\n\tgpMatrixLoadfEXT = (C.GPMATRIXLOADFEXT)(getProcAddr(\"glMatrixLoadfEXT\"))\n\tgpMatrixMode = (C.GPMATRIXMODE)(getProcAddr(\"glMatrixMode\"))\n\tif gpMatrixMode == nil {\n\t\treturn errors.New(\"glMatrixMode\")\n\t}\n\tgpMatrixMult3x2fNV = (C.GPMATRIXMULT3X2FNV)(getProcAddr(\"glMatrixMult3x2fNV\"))\n\tgpMatrixMult3x3fNV = (C.GPMATRIXMULT3X3FNV)(getProcAddr(\"glMatrixMult3x3fNV\"))\n\tgpMatrixMultTranspose3x3fNV = (C.GPMATRIXMULTTRANSPOSE3X3FNV)(getProcAddr(\"glMatrixMultTranspose3x3fNV\"))\n\tgpMatrixMultTransposedEXT = (C.GPMATRIXMULTTRANSPOSEDEXT)(getProcAddr(\"glMatrixMultTransposedEXT\"))\n\tgpMatrixMultTransposefEXT = (C.GPMATRIXMULTTRANSPOSEFEXT)(getProcAddr(\"glMatrixMultTransposefEXT\"))\n\tgpMatrixMultdEXT = (C.GPMATRIXMULTDEXT)(getProcAddr(\"glMatrixMultdEXT\"))\n\tgpMatrixMultfEXT = (C.GPMATRIXMULTFEXT)(getProcAddr(\"glMatrixMultfEXT\"))\n\tgpMatrixOrthoEXT = (C.GPMATRIXORTHOEXT)(getProcAddr(\"glMatrixOrthoEXT\"))\n\tgpMatrixPopEXT = (C.GPMATRIXPOPEXT)(getProcAddr(\"glMatrixPopEXT\"))\n\tgpMatrixPushEXT = (C.GPMATRIXPUSHEXT)(getProcAddr(\"glMatrixPushEXT\"))\n\tgpMatrixRotatedEXT = (C.GPMATRIXROTATEDEXT)(getProcAddr(\"glMatrixRotatedEXT\"))\n\tgpMatrixRotatefEXT = (C.GPMATRIXROTATEFEXT)(getProcAddr(\"glMatrixRotatefEXT\"))\n\tgpMatrixScaledEXT = (C.GPMATRIXSCALEDEXT)(getProcAddr(\"glMatrixScaledEXT\"))\n\tgpMatrixScalefEXT = (C.GPMATRIXSCALEFEXT)(getProcAddr(\"glMatrixScalefEXT\"))\n\tgpMatrixTranslatedEXT = (C.GPMATRIXTRANSLATEDEXT)(getProcAddr(\"glMatrixTranslatedEXT\"))\n\tgpMatrixTranslatefEXT = (C.GPMATRIXTRANSLATEFEXT)(getProcAddr(\"glMatrixTranslatefEXT\"))\n\tgpMaxShaderCompilerThreadsARB = (C.GPMAXSHADERCOMPILERTHREADSARB)(getProcAddr(\"glMaxShaderCompilerThreadsARB\"))\n\tgpMaxShaderCompilerThreadsKHR = (C.GPMAXSHADERCOMPILERTHREADSKHR)(getProcAddr(\"glMaxShaderCompilerThreadsKHR\"))\n\tgpMemoryBarrier = (C.GPMEMORYBARRIER)(getProcAddr(\"glMemoryBarrier\"))\n\tif gpMemoryBarrier == nil {\n\t\treturn errors.New(\"glMemoryBarrier\")\n\t}\n\tgpMemoryBarrierByRegion = (C.GPMEMORYBARRIERBYREGION)(getProcAddr(\"glMemoryBarrierByRegion\"))\n\tgpMemoryBarrierEXT = (C.GPMEMORYBARRIEREXT)(getProcAddr(\"glMemoryBarrierEXT\"))\n\tgpMemoryObjectParameterivEXT = (C.GPMEMORYOBJECTPARAMETERIVEXT)(getProcAddr(\"glMemoryObjectParameterivEXT\"))\n\tgpMinSampleShading = (C.GPMINSAMPLESHADING)(getProcAddr(\"glMinSampleShading\"))\n\tif gpMinSampleShading == nil {\n\t\treturn errors.New(\"glMinSampleShading\")\n\t}\n\tgpMinSampleShadingARB = (C.GPMINSAMPLESHADINGARB)(getProcAddr(\"glMinSampleShadingARB\"))\n\tgpMinmax = (C.GPMINMAX)(getProcAddr(\"glMinmax\"))\n\tgpMinmaxEXT = (C.GPMINMAXEXT)(getProcAddr(\"glMinmaxEXT\"))\n\tgpMultMatrixd = (C.GPMULTMATRIXD)(getProcAddr(\"glMultMatrixd\"))\n\tif gpMultMatrixd == nil {\n\t\treturn errors.New(\"glMultMatrixd\")\n\t}\n\tgpMultMatrixf = (C.GPMULTMATRIXF)(getProcAddr(\"glMultMatrixf\"))\n\tif gpMultMatrixf == nil {\n\t\treturn errors.New(\"glMultMatrixf\")\n\t}\n\tgpMultMatrixxOES = (C.GPMULTMATRIXXOES)(getProcAddr(\"glMultMatrixxOES\"))\n\tgpMultTransposeMatrixd = (C.GPMULTTRANSPOSEMATRIXD)(getProcAddr(\"glMultTransposeMatrixd\"))\n\tif gpMultTransposeMatrixd == nil {\n\t\treturn errors.New(\"glMultTransposeMatrixd\")\n\t}\n\tgpMultTransposeMatrixdARB = (C.GPMULTTRANSPOSEMATRIXDARB)(getProcAddr(\"glMultTransposeMatrixdARB\"))\n\tgpMultTransposeMatrixf = (C.GPMULTTRANSPOSEMATRIXF)(getProcAddr(\"glMultTransposeMatrixf\"))\n\tif gpMultTransposeMatrixf == nil {\n\t\treturn errors.New(\"glMultTransposeMatrixf\")\n\t}\n\tgpMultTransposeMatrixfARB = (C.GPMULTTRANSPOSEMATRIXFARB)(getProcAddr(\"glMultTransposeMatrixfARB\"))\n\tgpMultTransposeMatrixxOES = (C.GPMULTTRANSPOSEMATRIXXOES)(getProcAddr(\"glMultTransposeMatrixxOES\"))\n\tgpMultiDrawArrays = (C.GPMULTIDRAWARRAYS)(getProcAddr(\"glMultiDrawArrays\"))\n\tif gpMultiDrawArrays == nil {\n\t\treturn errors.New(\"glMultiDrawArrays\")\n\t}\n\tgpMultiDrawArraysEXT = (C.GPMULTIDRAWARRAYSEXT)(getProcAddr(\"glMultiDrawArraysEXT\"))\n\tgpMultiDrawArraysIndirect = (C.GPMULTIDRAWARRAYSINDIRECT)(getProcAddr(\"glMultiDrawArraysIndirect\"))\n\tif gpMultiDrawArraysIndirect == nil {\n\t\treturn errors.New(\"glMultiDrawArraysIndirect\")\n\t}\n\tgpMultiDrawArraysIndirectAMD = (C.GPMULTIDRAWARRAYSINDIRECTAMD)(getProcAddr(\"glMultiDrawArraysIndirectAMD\"))\n\tgpMultiDrawArraysIndirectBindlessCountNV = (C.GPMULTIDRAWARRAYSINDIRECTBINDLESSCOUNTNV)(getProcAddr(\"glMultiDrawArraysIndirectBindlessCountNV\"))\n\tgpMultiDrawArraysIndirectBindlessNV = (C.GPMULTIDRAWARRAYSINDIRECTBINDLESSNV)(getProcAddr(\"glMultiDrawArraysIndirectBindlessNV\"))\n\tgpMultiDrawArraysIndirectCountARB = (C.GPMULTIDRAWARRAYSINDIRECTCOUNTARB)(getProcAddr(\"glMultiDrawArraysIndirectCountARB\"))\n\tgpMultiDrawElementArrayAPPLE = (C.GPMULTIDRAWELEMENTARRAYAPPLE)(getProcAddr(\"glMultiDrawElementArrayAPPLE\"))\n\tgpMultiDrawElements = (C.GPMULTIDRAWELEMENTS)(getProcAddr(\"glMultiDrawElements\"))\n\tif gpMultiDrawElements == nil {\n\t\treturn errors.New(\"glMultiDrawElements\")\n\t}\n\tgpMultiDrawElementsBaseVertex = (C.GPMULTIDRAWELEMENTSBASEVERTEX)(getProcAddr(\"glMultiDrawElementsBaseVertex\"))\n\tif gpMultiDrawElementsBaseVertex == nil {\n\t\treturn errors.New(\"glMultiDrawElementsBaseVertex\")\n\t}\n\tgpMultiDrawElementsEXT = (C.GPMULTIDRAWELEMENTSEXT)(getProcAddr(\"glMultiDrawElementsEXT\"))\n\tgpMultiDrawElementsIndirect = (C.GPMULTIDRAWELEMENTSINDIRECT)(getProcAddr(\"glMultiDrawElementsIndirect\"))\n\tif gpMultiDrawElementsIndirect == nil {\n\t\treturn errors.New(\"glMultiDrawElementsIndirect\")\n\t}\n\tgpMultiDrawElementsIndirectAMD = (C.GPMULTIDRAWELEMENTSINDIRECTAMD)(getProcAddr(\"glMultiDrawElementsIndirectAMD\"))\n\tgpMultiDrawElementsIndirectBindlessCountNV = (C.GPMULTIDRAWELEMENTSINDIRECTBINDLESSCOUNTNV)(getProcAddr(\"glMultiDrawElementsIndirectBindlessCountNV\"))\n\tgpMultiDrawElementsIndirectBindlessNV = (C.GPMULTIDRAWELEMENTSINDIRECTBINDLESSNV)(getProcAddr(\"glMultiDrawElementsIndirectBindlessNV\"))\n\tgpMultiDrawElementsIndirectCountARB = (C.GPMULTIDRAWELEMENTSINDIRECTCOUNTARB)(getProcAddr(\"glMultiDrawElementsIndirectCountARB\"))\n\tgpMultiDrawMeshTasksIndirectCountNV = (C.GPMULTIDRAWMESHTASKSINDIRECTCOUNTNV)(getProcAddr(\"glMultiDrawMeshTasksIndirectCountNV\"))\n\tgpMultiDrawMeshTasksIndirectNV = (C.GPMULTIDRAWMESHTASKSINDIRECTNV)(getProcAddr(\"glMultiDrawMeshTasksIndirectNV\"))\n\tgpMultiDrawRangeElementArrayAPPLE = (C.GPMULTIDRAWRANGEELEMENTARRAYAPPLE)(getProcAddr(\"glMultiDrawRangeElementArrayAPPLE\"))\n\tgpMultiModeDrawArraysIBM = (C.GPMULTIMODEDRAWARRAYSIBM)(getProcAddr(\"glMultiModeDrawArraysIBM\"))\n\tgpMultiModeDrawElementsIBM = (C.GPMULTIMODEDRAWELEMENTSIBM)(getProcAddr(\"glMultiModeDrawElementsIBM\"))\n\tgpMultiTexBufferEXT = (C.GPMULTITEXBUFFEREXT)(getProcAddr(\"glMultiTexBufferEXT\"))\n\tgpMultiTexCoord1bOES = (C.GPMULTITEXCOORD1BOES)(getProcAddr(\"glMultiTexCoord1bOES\"))\n\tgpMultiTexCoord1bvOES = (C.GPMULTITEXCOORD1BVOES)(getProcAddr(\"glMultiTexCoord1bvOES\"))\n\tgpMultiTexCoord1d = (C.GPMULTITEXCOORD1D)(getProcAddr(\"glMultiTexCoord1d\"))\n\tif gpMultiTexCoord1d == nil {\n\t\treturn errors.New(\"glMultiTexCoord1d\")\n\t}\n\tgpMultiTexCoord1dARB = (C.GPMULTITEXCOORD1DARB)(getProcAddr(\"glMultiTexCoord1dARB\"))\n\tgpMultiTexCoord1dv = (C.GPMULTITEXCOORD1DV)(getProcAddr(\"glMultiTexCoord1dv\"))\n\tif gpMultiTexCoord1dv == nil {\n\t\treturn errors.New(\"glMultiTexCoord1dv\")\n\t}\n\tgpMultiTexCoord1dvARB = (C.GPMULTITEXCOORD1DVARB)(getProcAddr(\"glMultiTexCoord1dvARB\"))\n\tgpMultiTexCoord1f = (C.GPMULTITEXCOORD1F)(getProcAddr(\"glMultiTexCoord1f\"))\n\tif gpMultiTexCoord1f == nil {\n\t\treturn errors.New(\"glMultiTexCoord1f\")\n\t}\n\tgpMultiTexCoord1fARB = (C.GPMULTITEXCOORD1FARB)(getProcAddr(\"glMultiTexCoord1fARB\"))\n\tgpMultiTexCoord1fv = (C.GPMULTITEXCOORD1FV)(getProcAddr(\"glMultiTexCoord1fv\"))\n\tif gpMultiTexCoord1fv == nil {\n\t\treturn errors.New(\"glMultiTexCoord1fv\")\n\t}\n\tgpMultiTexCoord1fvARB = (C.GPMULTITEXCOORD1FVARB)(getProcAddr(\"glMultiTexCoord1fvARB\"))\n\tgpMultiTexCoord1hNV = (C.GPMULTITEXCOORD1HNV)(getProcAddr(\"glMultiTexCoord1hNV\"))\n\tgpMultiTexCoord1hvNV = (C.GPMULTITEXCOORD1HVNV)(getProcAddr(\"glMultiTexCoord1hvNV\"))\n\tgpMultiTexCoord1i = (C.GPMULTITEXCOORD1I)(getProcAddr(\"glMultiTexCoord1i\"))\n\tif gpMultiTexCoord1i == nil {\n\t\treturn errors.New(\"glMultiTexCoord1i\")\n\t}\n\tgpMultiTexCoord1iARB = (C.GPMULTITEXCOORD1IARB)(getProcAddr(\"glMultiTexCoord1iARB\"))\n\tgpMultiTexCoord1iv = (C.GPMULTITEXCOORD1IV)(getProcAddr(\"glMultiTexCoord1iv\"))\n\tif gpMultiTexCoord1iv == nil {\n\t\treturn errors.New(\"glMultiTexCoord1iv\")\n\t}\n\tgpMultiTexCoord1ivARB = (C.GPMULTITEXCOORD1IVARB)(getProcAddr(\"glMultiTexCoord1ivARB\"))\n\tgpMultiTexCoord1s = (C.GPMULTITEXCOORD1S)(getProcAddr(\"glMultiTexCoord1s\"))\n\tif gpMultiTexCoord1s == nil {\n\t\treturn errors.New(\"glMultiTexCoord1s\")\n\t}\n\tgpMultiTexCoord1sARB = (C.GPMULTITEXCOORD1SARB)(getProcAddr(\"glMultiTexCoord1sARB\"))\n\tgpMultiTexCoord1sv = (C.GPMULTITEXCOORD1SV)(getProcAddr(\"glMultiTexCoord1sv\"))\n\tif gpMultiTexCoord1sv == nil {\n\t\treturn errors.New(\"glMultiTexCoord1sv\")\n\t}\n\tgpMultiTexCoord1svARB = (C.GPMULTITEXCOORD1SVARB)(getProcAddr(\"glMultiTexCoord1svARB\"))\n\tgpMultiTexCoord1xOES = (C.GPMULTITEXCOORD1XOES)(getProcAddr(\"glMultiTexCoord1xOES\"))\n\tgpMultiTexCoord1xvOES = (C.GPMULTITEXCOORD1XVOES)(getProcAddr(\"glMultiTexCoord1xvOES\"))\n\tgpMultiTexCoord2bOES = (C.GPMULTITEXCOORD2BOES)(getProcAddr(\"glMultiTexCoord2bOES\"))\n\tgpMultiTexCoord2bvOES = (C.GPMULTITEXCOORD2BVOES)(getProcAddr(\"glMultiTexCoord2bvOES\"))\n\tgpMultiTexCoord2d = (C.GPMULTITEXCOORD2D)(getProcAddr(\"glMultiTexCoord2d\"))\n\tif gpMultiTexCoord2d == nil {\n\t\treturn errors.New(\"glMultiTexCoord2d\")\n\t}\n\tgpMultiTexCoord2dARB = (C.GPMULTITEXCOORD2DARB)(getProcAddr(\"glMultiTexCoord2dARB\"))\n\tgpMultiTexCoord2dv = (C.GPMULTITEXCOORD2DV)(getProcAddr(\"glMultiTexCoord2dv\"))\n\tif gpMultiTexCoord2dv == nil {\n\t\treturn errors.New(\"glMultiTexCoord2dv\")\n\t}\n\tgpMultiTexCoord2dvARB = (C.GPMULTITEXCOORD2DVARB)(getProcAddr(\"glMultiTexCoord2dvARB\"))\n\tgpMultiTexCoord2f = (C.GPMULTITEXCOORD2F)(getProcAddr(\"glMultiTexCoord2f\"))\n\tif gpMultiTexCoord2f == nil {\n\t\treturn errors.New(\"glMultiTexCoord2f\")\n\t}\n\tgpMultiTexCoord2fARB = (C.GPMULTITEXCOORD2FARB)(getProcAddr(\"glMultiTexCoord2fARB\"))\n\tgpMultiTexCoord2fv = (C.GPMULTITEXCOORD2FV)(getProcAddr(\"glMultiTexCoord2fv\"))\n\tif gpMultiTexCoord2fv == nil {\n\t\treturn errors.New(\"glMultiTexCoord2fv\")\n\t}\n\tgpMultiTexCoord2fvARB = (C.GPMULTITEXCOORD2FVARB)(getProcAddr(\"glMultiTexCoord2fvARB\"))\n\tgpMultiTexCoord2hNV = (C.GPMULTITEXCOORD2HNV)(getProcAddr(\"glMultiTexCoord2hNV\"))\n\tgpMultiTexCoord2hvNV = (C.GPMULTITEXCOORD2HVNV)(getProcAddr(\"glMultiTexCoord2hvNV\"))\n\tgpMultiTexCoord2i = (C.GPMULTITEXCOORD2I)(getProcAddr(\"glMultiTexCoord2i\"))\n\tif gpMultiTexCoord2i == nil {\n\t\treturn errors.New(\"glMultiTexCoord2i\")\n\t}\n\tgpMultiTexCoord2iARB = (C.GPMULTITEXCOORD2IARB)(getProcAddr(\"glMultiTexCoord2iARB\"))\n\tgpMultiTexCoord2iv = (C.GPMULTITEXCOORD2IV)(getProcAddr(\"glMultiTexCoord2iv\"))\n\tif gpMultiTexCoord2iv == nil {\n\t\treturn errors.New(\"glMultiTexCoord2iv\")\n\t}\n\tgpMultiTexCoord2ivARB = (C.GPMULTITEXCOORD2IVARB)(getProcAddr(\"glMultiTexCoord2ivARB\"))\n\tgpMultiTexCoord2s = (C.GPMULTITEXCOORD2S)(getProcAddr(\"glMultiTexCoord2s\"))\n\tif gpMultiTexCoord2s == nil {\n\t\treturn errors.New(\"glMultiTexCoord2s\")\n\t}\n\tgpMultiTexCoord2sARB = (C.GPMULTITEXCOORD2SARB)(getProcAddr(\"glMultiTexCoord2sARB\"))\n\tgpMultiTexCoord2sv = (C.GPMULTITEXCOORD2SV)(getProcAddr(\"glMultiTexCoord2sv\"))\n\tif gpMultiTexCoord2sv == nil {\n\t\treturn errors.New(\"glMultiTexCoord2sv\")\n\t}\n\tgpMultiTexCoord2svARB = (C.GPMULTITEXCOORD2SVARB)(getProcAddr(\"glMultiTexCoord2svARB\"))\n\tgpMultiTexCoord2xOES = (C.GPMULTITEXCOORD2XOES)(getProcAddr(\"glMultiTexCoord2xOES\"))\n\tgpMultiTexCoord2xvOES = (C.GPMULTITEXCOORD2XVOES)(getProcAddr(\"glMultiTexCoord2xvOES\"))\n\tgpMultiTexCoord3bOES = (C.GPMULTITEXCOORD3BOES)(getProcAddr(\"glMultiTexCoord3bOES\"))\n\tgpMultiTexCoord3bvOES = (C.GPMULTITEXCOORD3BVOES)(getProcAddr(\"glMultiTexCoord3bvOES\"))\n\tgpMultiTexCoord3d = (C.GPMULTITEXCOORD3D)(getProcAddr(\"glMultiTexCoord3d\"))\n\tif gpMultiTexCoord3d == nil {\n\t\treturn errors.New(\"glMultiTexCoord3d\")\n\t}\n\tgpMultiTexCoord3dARB = (C.GPMULTITEXCOORD3DARB)(getProcAddr(\"glMultiTexCoord3dARB\"))\n\tgpMultiTexCoord3dv = (C.GPMULTITEXCOORD3DV)(getProcAddr(\"glMultiTexCoord3dv\"))\n\tif gpMultiTexCoord3dv == nil {\n\t\treturn errors.New(\"glMultiTexCoord3dv\")\n\t}\n\tgpMultiTexCoord3dvARB = (C.GPMULTITEXCOORD3DVARB)(getProcAddr(\"glMultiTexCoord3dvARB\"))\n\tgpMultiTexCoord3f = (C.GPMULTITEXCOORD3F)(getProcAddr(\"glMultiTexCoord3f\"))\n\tif gpMultiTexCoord3f == nil {\n\t\treturn errors.New(\"glMultiTexCoord3f\")\n\t}\n\tgpMultiTexCoord3fARB = (C.GPMULTITEXCOORD3FARB)(getProcAddr(\"glMultiTexCoord3fARB\"))\n\tgpMultiTexCoord3fv = (C.GPMULTITEXCOORD3FV)(getProcAddr(\"glMultiTexCoord3fv\"))\n\tif gpMultiTexCoord3fv == nil {\n\t\treturn errors.New(\"glMultiTexCoord3fv\")\n\t}\n\tgpMultiTexCoord3fvARB = (C.GPMULTITEXCOORD3FVARB)(getProcAddr(\"glMultiTexCoord3fvARB\"))\n\tgpMultiTexCoord3hNV = (C.GPMULTITEXCOORD3HNV)(getProcAddr(\"glMultiTexCoord3hNV\"))\n\tgpMultiTexCoord3hvNV = (C.GPMULTITEXCOORD3HVNV)(getProcAddr(\"glMultiTexCoord3hvNV\"))\n\tgpMultiTexCoord3i = (C.GPMULTITEXCOORD3I)(getProcAddr(\"glMultiTexCoord3i\"))\n\tif gpMultiTexCoord3i == nil {\n\t\treturn errors.New(\"glMultiTexCoord3i\")\n\t}\n\tgpMultiTexCoord3iARB = (C.GPMULTITEXCOORD3IARB)(getProcAddr(\"glMultiTexCoord3iARB\"))\n\tgpMultiTexCoord3iv = (C.GPMULTITEXCOORD3IV)(getProcAddr(\"glMultiTexCoord3iv\"))\n\tif gpMultiTexCoord3iv == nil {\n\t\treturn errors.New(\"glMultiTexCoord3iv\")\n\t}\n\tgpMultiTexCoord3ivARB = (C.GPMULTITEXCOORD3IVARB)(getProcAddr(\"glMultiTexCoord3ivARB\"))\n\tgpMultiTexCoord3s = (C.GPMULTITEXCOORD3S)(getProcAddr(\"glMultiTexCoord3s\"))\n\tif gpMultiTexCoord3s == nil {\n\t\treturn errors.New(\"glMultiTexCoord3s\")\n\t}\n\tgpMultiTexCoord3sARB = (C.GPMULTITEXCOORD3SARB)(getProcAddr(\"glMultiTexCoord3sARB\"))\n\tgpMultiTexCoord3sv = (C.GPMULTITEXCOORD3SV)(getProcAddr(\"glMultiTexCoord3sv\"))\n\tif gpMultiTexCoord3sv == nil {\n\t\treturn errors.New(\"glMultiTexCoord3sv\")\n\t}\n\tgpMultiTexCoord3svARB = (C.GPMULTITEXCOORD3SVARB)(getProcAddr(\"glMultiTexCoord3svARB\"))\n\tgpMultiTexCoord3xOES = (C.GPMULTITEXCOORD3XOES)(getProcAddr(\"glMultiTexCoord3xOES\"))\n\tgpMultiTexCoord3xvOES = (C.GPMULTITEXCOORD3XVOES)(getProcAddr(\"glMultiTexCoord3xvOES\"))\n\tgpMultiTexCoord4bOES = (C.GPMULTITEXCOORD4BOES)(getProcAddr(\"glMultiTexCoord4bOES\"))\n\tgpMultiTexCoord4bvOES = (C.GPMULTITEXCOORD4BVOES)(getProcAddr(\"glMultiTexCoord4bvOES\"))\n\tgpMultiTexCoord4d = (C.GPMULTITEXCOORD4D)(getProcAddr(\"glMultiTexCoord4d\"))\n\tif gpMultiTexCoord4d == nil {\n\t\treturn errors.New(\"glMultiTexCoord4d\")\n\t}\n\tgpMultiTexCoord4dARB = (C.GPMULTITEXCOORD4DARB)(getProcAddr(\"glMultiTexCoord4dARB\"))\n\tgpMultiTexCoord4dv = (C.GPMULTITEXCOORD4DV)(getProcAddr(\"glMultiTexCoord4dv\"))\n\tif gpMultiTexCoord4dv == nil {\n\t\treturn errors.New(\"glMultiTexCoord4dv\")\n\t}\n\tgpMultiTexCoord4dvARB = (C.GPMULTITEXCOORD4DVARB)(getProcAddr(\"glMultiTexCoord4dvARB\"))\n\tgpMultiTexCoord4f = (C.GPMULTITEXCOORD4F)(getProcAddr(\"glMultiTexCoord4f\"))\n\tif gpMultiTexCoord4f == nil {\n\t\treturn errors.New(\"glMultiTexCoord4f\")\n\t}\n\tgpMultiTexCoord4fARB = (C.GPMULTITEXCOORD4FARB)(getProcAddr(\"glMultiTexCoord4fARB\"))\n\tgpMultiTexCoord4fv = (C.GPMULTITEXCOORD4FV)(getProcAddr(\"glMultiTexCoord4fv\"))\n\tif gpMultiTexCoord4fv == nil {\n\t\treturn errors.New(\"glMultiTexCoord4fv\")\n\t}\n\tgpMultiTexCoord4fvARB = (C.GPMULTITEXCOORD4FVARB)(getProcAddr(\"glMultiTexCoord4fvARB\"))\n\tgpMultiTexCoord4hNV = (C.GPMULTITEXCOORD4HNV)(getProcAddr(\"glMultiTexCoord4hNV\"))\n\tgpMultiTexCoord4hvNV = (C.GPMULTITEXCOORD4HVNV)(getProcAddr(\"glMultiTexCoord4hvNV\"))\n\tgpMultiTexCoord4i = (C.GPMULTITEXCOORD4I)(getProcAddr(\"glMultiTexCoord4i\"))\n\tif gpMultiTexCoord4i == nil {\n\t\treturn errors.New(\"glMultiTexCoord4i\")\n\t}\n\tgpMultiTexCoord4iARB = (C.GPMULTITEXCOORD4IARB)(getProcAddr(\"glMultiTexCoord4iARB\"))\n\tgpMultiTexCoord4iv = (C.GPMULTITEXCOORD4IV)(getProcAddr(\"glMultiTexCoord4iv\"))\n\tif gpMultiTexCoord4iv == nil {\n\t\treturn errors.New(\"glMultiTexCoord4iv\")\n\t}\n\tgpMultiTexCoord4ivARB = (C.GPMULTITEXCOORD4IVARB)(getProcAddr(\"glMultiTexCoord4ivARB\"))\n\tgpMultiTexCoord4s = (C.GPMULTITEXCOORD4S)(getProcAddr(\"glMultiTexCoord4s\"))\n\tif gpMultiTexCoord4s == nil {\n\t\treturn errors.New(\"glMultiTexCoord4s\")\n\t}\n\tgpMultiTexCoord4sARB = (C.GPMULTITEXCOORD4SARB)(getProcAddr(\"glMultiTexCoord4sARB\"))\n\tgpMultiTexCoord4sv = (C.GPMULTITEXCOORD4SV)(getProcAddr(\"glMultiTexCoord4sv\"))\n\tif gpMultiTexCoord4sv == nil {\n\t\treturn errors.New(\"glMultiTexCoord4sv\")\n\t}\n\tgpMultiTexCoord4svARB = (C.GPMULTITEXCOORD4SVARB)(getProcAddr(\"glMultiTexCoord4svARB\"))\n\tgpMultiTexCoord4xOES = (C.GPMULTITEXCOORD4XOES)(getProcAddr(\"glMultiTexCoord4xOES\"))\n\tgpMultiTexCoord4xvOES = (C.GPMULTITEXCOORD4XVOES)(getProcAddr(\"glMultiTexCoord4xvOES\"))\n\tgpMultiTexCoordP1ui = (C.GPMULTITEXCOORDP1UI)(getProcAddr(\"glMultiTexCoordP1ui\"))\n\tif gpMultiTexCoordP1ui == nil {\n\t\treturn errors.New(\"glMultiTexCoordP1ui\")\n\t}\n\tgpMultiTexCoordP1uiv = (C.GPMULTITEXCOORDP1UIV)(getProcAddr(\"glMultiTexCoordP1uiv\"))\n\tif gpMultiTexCoordP1uiv == nil {\n\t\treturn errors.New(\"glMultiTexCoordP1uiv\")\n\t}\n\tgpMultiTexCoordP2ui = (C.GPMULTITEXCOORDP2UI)(getProcAddr(\"glMultiTexCoordP2ui\"))\n\tif gpMultiTexCoordP2ui == nil {\n\t\treturn errors.New(\"glMultiTexCoordP2ui\")\n\t}\n\tgpMultiTexCoordP2uiv = (C.GPMULTITEXCOORDP2UIV)(getProcAddr(\"glMultiTexCoordP2uiv\"))\n\tif gpMultiTexCoordP2uiv == nil {\n\t\treturn errors.New(\"glMultiTexCoordP2uiv\")\n\t}\n\tgpMultiTexCoordP3ui = (C.GPMULTITEXCOORDP3UI)(getProcAddr(\"glMultiTexCoordP3ui\"))\n\tif gpMultiTexCoordP3ui == nil {\n\t\treturn errors.New(\"glMultiTexCoordP3ui\")\n\t}\n\tgpMultiTexCoordP3uiv = (C.GPMULTITEXCOORDP3UIV)(getProcAddr(\"glMultiTexCoordP3uiv\"))\n\tif gpMultiTexCoordP3uiv == nil {\n\t\treturn errors.New(\"glMultiTexCoordP3uiv\")\n\t}\n\tgpMultiTexCoordP4ui = (C.GPMULTITEXCOORDP4UI)(getProcAddr(\"glMultiTexCoordP4ui\"))\n\tif gpMultiTexCoordP4ui == nil {\n\t\treturn errors.New(\"glMultiTexCoordP4ui\")\n\t}\n\tgpMultiTexCoordP4uiv = (C.GPMULTITEXCOORDP4UIV)(getProcAddr(\"glMultiTexCoordP4uiv\"))\n\tif gpMultiTexCoordP4uiv == nil {\n\t\treturn errors.New(\"glMultiTexCoordP4uiv\")\n\t}\n\tgpMultiTexCoordPointerEXT = (C.GPMULTITEXCOORDPOINTEREXT)(getProcAddr(\"glMultiTexCoordPointerEXT\"))\n\tgpMultiTexEnvfEXT = (C.GPMULTITEXENVFEXT)(getProcAddr(\"glMultiTexEnvfEXT\"))\n\tgpMultiTexEnvfvEXT = (C.GPMULTITEXENVFVEXT)(getProcAddr(\"glMultiTexEnvfvEXT\"))\n\tgpMultiTexEnviEXT = (C.GPMULTITEXENVIEXT)(getProcAddr(\"glMultiTexEnviEXT\"))\n\tgpMultiTexEnvivEXT = (C.GPMULTITEXENVIVEXT)(getProcAddr(\"glMultiTexEnvivEXT\"))\n\tgpMultiTexGendEXT = (C.GPMULTITEXGENDEXT)(getProcAddr(\"glMultiTexGendEXT\"))\n\tgpMultiTexGendvEXT = (C.GPMULTITEXGENDVEXT)(getProcAddr(\"glMultiTexGendvEXT\"))\n\tgpMultiTexGenfEXT = (C.GPMULTITEXGENFEXT)(getProcAddr(\"glMultiTexGenfEXT\"))\n\tgpMultiTexGenfvEXT = (C.GPMULTITEXGENFVEXT)(getProcAddr(\"glMultiTexGenfvEXT\"))\n\tgpMultiTexGeniEXT = (C.GPMULTITEXGENIEXT)(getProcAddr(\"glMultiTexGeniEXT\"))\n\tgpMultiTexGenivEXT = (C.GPMULTITEXGENIVEXT)(getProcAddr(\"glMultiTexGenivEXT\"))\n\tgpMultiTexImage1DEXT = (C.GPMULTITEXIMAGE1DEXT)(getProcAddr(\"glMultiTexImage1DEXT\"))\n\tgpMultiTexImage2DEXT = (C.GPMULTITEXIMAGE2DEXT)(getProcAddr(\"glMultiTexImage2DEXT\"))\n\tgpMultiTexImage3DEXT = (C.GPMULTITEXIMAGE3DEXT)(getProcAddr(\"glMultiTexImage3DEXT\"))\n\tgpMultiTexParameterIivEXT = (C.GPMULTITEXPARAMETERIIVEXT)(getProcAddr(\"glMultiTexParameterIivEXT\"))\n\tgpMultiTexParameterIuivEXT = (C.GPMULTITEXPARAMETERIUIVEXT)(getProcAddr(\"glMultiTexParameterIuivEXT\"))\n\tgpMultiTexParameterfEXT = (C.GPMULTITEXPARAMETERFEXT)(getProcAddr(\"glMultiTexParameterfEXT\"))\n\tgpMultiTexParameterfvEXT = (C.GPMULTITEXPARAMETERFVEXT)(getProcAddr(\"glMultiTexParameterfvEXT\"))\n\tgpMultiTexParameteriEXT = (C.GPMULTITEXPARAMETERIEXT)(getProcAddr(\"glMultiTexParameteriEXT\"))\n\tgpMultiTexParameterivEXT = (C.GPMULTITEXPARAMETERIVEXT)(getProcAddr(\"glMultiTexParameterivEXT\"))\n\tgpMultiTexRenderbufferEXT = (C.GPMULTITEXRENDERBUFFEREXT)(getProcAddr(\"glMultiTexRenderbufferEXT\"))\n\tgpMultiTexSubImage1DEXT = (C.GPMULTITEXSUBIMAGE1DEXT)(getProcAddr(\"glMultiTexSubImage1DEXT\"))\n\tgpMultiTexSubImage2DEXT = (C.GPMULTITEXSUBIMAGE2DEXT)(getProcAddr(\"glMultiTexSubImage2DEXT\"))\n\tgpMultiTexSubImage3DEXT = (C.GPMULTITEXSUBIMAGE3DEXT)(getProcAddr(\"glMultiTexSubImage3DEXT\"))\n\tgpMulticastBarrierNV = (C.GPMULTICASTBARRIERNV)(getProcAddr(\"glMulticastBarrierNV\"))\n\tgpMulticastBlitFramebufferNV = (C.GPMULTICASTBLITFRAMEBUFFERNV)(getProcAddr(\"glMulticastBlitFramebufferNV\"))\n\tgpMulticastBufferSubDataNV = (C.GPMULTICASTBUFFERSUBDATANV)(getProcAddr(\"glMulticastBufferSubDataNV\"))\n\tgpMulticastCopyBufferSubDataNV = (C.GPMULTICASTCOPYBUFFERSUBDATANV)(getProcAddr(\"glMulticastCopyBufferSubDataNV\"))\n\tgpMulticastCopyImageSubDataNV = (C.GPMULTICASTCOPYIMAGESUBDATANV)(getProcAddr(\"glMulticastCopyImageSubDataNV\"))\n\tgpMulticastFramebufferSampleLocationsfvNV = (C.GPMULTICASTFRAMEBUFFERSAMPLELOCATIONSFVNV)(getProcAddr(\"glMulticastFramebufferSampleLocationsfvNV\"))\n\tgpMulticastGetQueryObjecti64vNV = (C.GPMULTICASTGETQUERYOBJECTI64VNV)(getProcAddr(\"glMulticastGetQueryObjecti64vNV\"))\n\tgpMulticastGetQueryObjectivNV = (C.GPMULTICASTGETQUERYOBJECTIVNV)(getProcAddr(\"glMulticastGetQueryObjectivNV\"))\n\tgpMulticastGetQueryObjectui64vNV = (C.GPMULTICASTGETQUERYOBJECTUI64VNV)(getProcAddr(\"glMulticastGetQueryObjectui64vNV\"))\n\tgpMulticastGetQueryObjectuivNV = (C.GPMULTICASTGETQUERYOBJECTUIVNV)(getProcAddr(\"glMulticastGetQueryObjectuivNV\"))\n\tgpMulticastScissorArrayvNVX = (C.GPMULTICASTSCISSORARRAYVNVX)(getProcAddr(\"glMulticastScissorArrayvNVX\"))\n\tgpMulticastViewportArrayvNVX = (C.GPMULTICASTVIEWPORTARRAYVNVX)(getProcAddr(\"glMulticastViewportArrayvNVX\"))\n\tgpMulticastViewportPositionWScaleNVX = (C.GPMULTICASTVIEWPORTPOSITIONWSCALENVX)(getProcAddr(\"glMulticastViewportPositionWScaleNVX\"))\n\tgpMulticastWaitSyncNV = (C.GPMULTICASTWAITSYNCNV)(getProcAddr(\"glMulticastWaitSyncNV\"))\n\tgpNamedBufferAttachMemoryNV = (C.GPNAMEDBUFFERATTACHMEMORYNV)(getProcAddr(\"glNamedBufferAttachMemoryNV\"))\n\tgpNamedBufferData = (C.GPNAMEDBUFFERDATA)(getProcAddr(\"glNamedBufferData\"))\n\tgpNamedBufferDataEXT = (C.GPNAMEDBUFFERDATAEXT)(getProcAddr(\"glNamedBufferDataEXT\"))\n\tgpNamedBufferPageCommitmentARB = (C.GPNAMEDBUFFERPAGECOMMITMENTARB)(getProcAddr(\"glNamedBufferPageCommitmentARB\"))\n\tgpNamedBufferPageCommitmentEXT = (C.GPNAMEDBUFFERPAGECOMMITMENTEXT)(getProcAddr(\"glNamedBufferPageCommitmentEXT\"))\n\tgpNamedBufferPageCommitmentMemNV = (C.GPNAMEDBUFFERPAGECOMMITMENTMEMNV)(getProcAddr(\"glNamedBufferPageCommitmentMemNV\"))\n\tgpNamedBufferStorage = (C.GPNAMEDBUFFERSTORAGE)(getProcAddr(\"glNamedBufferStorage\"))\n\tgpNamedBufferStorageEXT = (C.GPNAMEDBUFFERSTORAGEEXT)(getProcAddr(\"glNamedBufferStorageEXT\"))\n\tgpNamedBufferStorageExternalEXT = (C.GPNAMEDBUFFERSTORAGEEXTERNALEXT)(getProcAddr(\"glNamedBufferStorageExternalEXT\"))\n\tgpNamedBufferStorageMemEXT = (C.GPNAMEDBUFFERSTORAGEMEMEXT)(getProcAddr(\"glNamedBufferStorageMemEXT\"))\n\tgpNamedBufferSubData = (C.GPNAMEDBUFFERSUBDATA)(getProcAddr(\"glNamedBufferSubData\"))\n\tgpNamedBufferSubDataEXT = (C.GPNAMEDBUFFERSUBDATAEXT)(getProcAddr(\"glNamedBufferSubDataEXT\"))\n\tgpNamedCopyBufferSubDataEXT = (C.GPNAMEDCOPYBUFFERSUBDATAEXT)(getProcAddr(\"glNamedCopyBufferSubDataEXT\"))\n\tgpNamedFramebufferDrawBuffer = (C.GPNAMEDFRAMEBUFFERDRAWBUFFER)(getProcAddr(\"glNamedFramebufferDrawBuffer\"))\n\tgpNamedFramebufferDrawBuffers = (C.GPNAMEDFRAMEBUFFERDRAWBUFFERS)(getProcAddr(\"glNamedFramebufferDrawBuffers\"))\n\tgpNamedFramebufferParameteri = (C.GPNAMEDFRAMEBUFFERPARAMETERI)(getProcAddr(\"glNamedFramebufferParameteri\"))\n\tgpNamedFramebufferParameteriEXT = (C.GPNAMEDFRAMEBUFFERPARAMETERIEXT)(getProcAddr(\"glNamedFramebufferParameteriEXT\"))\n\tgpNamedFramebufferReadBuffer = (C.GPNAMEDFRAMEBUFFERREADBUFFER)(getProcAddr(\"glNamedFramebufferReadBuffer\"))\n\tgpNamedFramebufferRenderbuffer = (C.GPNAMEDFRAMEBUFFERRENDERBUFFER)(getProcAddr(\"glNamedFramebufferRenderbuffer\"))\n\tgpNamedFramebufferRenderbufferEXT = (C.GPNAMEDFRAMEBUFFERRENDERBUFFEREXT)(getProcAddr(\"glNamedFramebufferRenderbufferEXT\"))\n\tgpNamedFramebufferSampleLocationsfvARB = (C.GPNAMEDFRAMEBUFFERSAMPLELOCATIONSFVARB)(getProcAddr(\"glNamedFramebufferSampleLocationsfvARB\"))\n\tgpNamedFramebufferSampleLocationsfvNV = (C.GPNAMEDFRAMEBUFFERSAMPLELOCATIONSFVNV)(getProcAddr(\"glNamedFramebufferSampleLocationsfvNV\"))\n\tgpNamedFramebufferSamplePositionsfvAMD = (C.GPNAMEDFRAMEBUFFERSAMPLEPOSITIONSFVAMD)(getProcAddr(\"glNamedFramebufferSamplePositionsfvAMD\"))\n\tgpNamedFramebufferTexture = (C.GPNAMEDFRAMEBUFFERTEXTURE)(getProcAddr(\"glNamedFramebufferTexture\"))\n\tgpNamedFramebufferTexture1DEXT = (C.GPNAMEDFRAMEBUFFERTEXTURE1DEXT)(getProcAddr(\"glNamedFramebufferTexture1DEXT\"))\n\tgpNamedFramebufferTexture2DEXT = (C.GPNAMEDFRAMEBUFFERTEXTURE2DEXT)(getProcAddr(\"glNamedFramebufferTexture2DEXT\"))\n\tgpNamedFramebufferTexture3DEXT = (C.GPNAMEDFRAMEBUFFERTEXTURE3DEXT)(getProcAddr(\"glNamedFramebufferTexture3DEXT\"))\n\tgpNamedFramebufferTextureEXT = (C.GPNAMEDFRAMEBUFFERTEXTUREEXT)(getProcAddr(\"glNamedFramebufferTextureEXT\"))\n\tgpNamedFramebufferTextureFaceEXT = (C.GPNAMEDFRAMEBUFFERTEXTUREFACEEXT)(getProcAddr(\"glNamedFramebufferTextureFaceEXT\"))\n\tgpNamedFramebufferTextureLayer = (C.GPNAMEDFRAMEBUFFERTEXTURELAYER)(getProcAddr(\"glNamedFramebufferTextureLayer\"))\n\tgpNamedFramebufferTextureLayerEXT = (C.GPNAMEDFRAMEBUFFERTEXTURELAYEREXT)(getProcAddr(\"glNamedFramebufferTextureLayerEXT\"))\n\tgpNamedProgramLocalParameter4dEXT = (C.GPNAMEDPROGRAMLOCALPARAMETER4DEXT)(getProcAddr(\"glNamedProgramLocalParameter4dEXT\"))\n\tgpNamedProgramLocalParameter4dvEXT = (C.GPNAMEDPROGRAMLOCALPARAMETER4DVEXT)(getProcAddr(\"glNamedProgramLocalParameter4dvEXT\"))\n\tgpNamedProgramLocalParameter4fEXT = (C.GPNAMEDPROGRAMLOCALPARAMETER4FEXT)(getProcAddr(\"glNamedProgramLocalParameter4fEXT\"))\n\tgpNamedProgramLocalParameter4fvEXT = (C.GPNAMEDPROGRAMLOCALPARAMETER4FVEXT)(getProcAddr(\"glNamedProgramLocalParameter4fvEXT\"))\n\tgpNamedProgramLocalParameterI4iEXT = (C.GPNAMEDPROGRAMLOCALPARAMETERI4IEXT)(getProcAddr(\"glNamedProgramLocalParameterI4iEXT\"))\n\tgpNamedProgramLocalParameterI4ivEXT = (C.GPNAMEDPROGRAMLOCALPARAMETERI4IVEXT)(getProcAddr(\"glNamedProgramLocalParameterI4ivEXT\"))\n\tgpNamedProgramLocalParameterI4uiEXT = (C.GPNAMEDPROGRAMLOCALPARAMETERI4UIEXT)(getProcAddr(\"glNamedProgramLocalParameterI4uiEXT\"))\n\tgpNamedProgramLocalParameterI4uivEXT = (C.GPNAMEDPROGRAMLOCALPARAMETERI4UIVEXT)(getProcAddr(\"glNamedProgramLocalParameterI4uivEXT\"))\n\tgpNamedProgramLocalParameters4fvEXT = (C.GPNAMEDPROGRAMLOCALPARAMETERS4FVEXT)(getProcAddr(\"glNamedProgramLocalParameters4fvEXT\"))\n\tgpNamedProgramLocalParametersI4ivEXT = (C.GPNAMEDPROGRAMLOCALPARAMETERSI4IVEXT)(getProcAddr(\"glNamedProgramLocalParametersI4ivEXT\"))\n\tgpNamedProgramLocalParametersI4uivEXT = (C.GPNAMEDPROGRAMLOCALPARAMETERSI4UIVEXT)(getProcAddr(\"glNamedProgramLocalParametersI4uivEXT\"))\n\tgpNamedProgramStringEXT = (C.GPNAMEDPROGRAMSTRINGEXT)(getProcAddr(\"glNamedProgramStringEXT\"))\n\tgpNamedRenderbufferStorage = (C.GPNAMEDRENDERBUFFERSTORAGE)(getProcAddr(\"glNamedRenderbufferStorage\"))\n\tgpNamedRenderbufferStorageEXT = (C.GPNAMEDRENDERBUFFERSTORAGEEXT)(getProcAddr(\"glNamedRenderbufferStorageEXT\"))\n\tgpNamedRenderbufferStorageMultisample = (C.GPNAMEDRENDERBUFFERSTORAGEMULTISAMPLE)(getProcAddr(\"glNamedRenderbufferStorageMultisample\"))\n\tgpNamedRenderbufferStorageMultisampleAdvancedAMD = (C.GPNAMEDRENDERBUFFERSTORAGEMULTISAMPLEADVANCEDAMD)(getProcAddr(\"glNamedRenderbufferStorageMultisampleAdvancedAMD\"))\n\tgpNamedRenderbufferStorageMultisampleCoverageEXT = (C.GPNAMEDRENDERBUFFERSTORAGEMULTISAMPLECOVERAGEEXT)(getProcAddr(\"glNamedRenderbufferStorageMultisampleCoverageEXT\"))\n\tgpNamedRenderbufferStorageMultisampleEXT = (C.GPNAMEDRENDERBUFFERSTORAGEMULTISAMPLEEXT)(getProcAddr(\"glNamedRenderbufferStorageMultisampleEXT\"))\n\tgpNamedStringARB = (C.GPNAMEDSTRINGARB)(getProcAddr(\"glNamedStringARB\"))\n\tgpNewList = (C.GPNEWLIST)(getProcAddr(\"glNewList\"))\n\tif gpNewList == nil {\n\t\treturn errors.New(\"glNewList\")\n\t}\n\tgpNewObjectBufferATI = (C.GPNEWOBJECTBUFFERATI)(getProcAddr(\"glNewObjectBufferATI\"))\n\tgpNormal3b = (C.GPNORMAL3B)(getProcAddr(\"glNormal3b\"))\n\tif gpNormal3b == nil {\n\t\treturn errors.New(\"glNormal3b\")\n\t}\n\tgpNormal3bv = (C.GPNORMAL3BV)(getProcAddr(\"glNormal3bv\"))\n\tif gpNormal3bv == nil {\n\t\treturn errors.New(\"glNormal3bv\")\n\t}\n\tgpNormal3d = (C.GPNORMAL3D)(getProcAddr(\"glNormal3d\"))\n\tif gpNormal3d == nil {\n\t\treturn errors.New(\"glNormal3d\")\n\t}\n\tgpNormal3dv = (C.GPNORMAL3DV)(getProcAddr(\"glNormal3dv\"))\n\tif gpNormal3dv == nil {\n\t\treturn errors.New(\"glNormal3dv\")\n\t}\n\tgpNormal3f = (C.GPNORMAL3F)(getProcAddr(\"glNormal3f\"))\n\tif gpNormal3f == nil {\n\t\treturn errors.New(\"glNormal3f\")\n\t}\n\tgpNormal3fVertex3fSUN = (C.GPNORMAL3FVERTEX3FSUN)(getProcAddr(\"glNormal3fVertex3fSUN\"))\n\tgpNormal3fVertex3fvSUN = (C.GPNORMAL3FVERTEX3FVSUN)(getProcAddr(\"glNormal3fVertex3fvSUN\"))\n\tgpNormal3fv = (C.GPNORMAL3FV)(getProcAddr(\"glNormal3fv\"))\n\tif gpNormal3fv == nil {\n\t\treturn errors.New(\"glNormal3fv\")\n\t}\n\tgpNormal3hNV = (C.GPNORMAL3HNV)(getProcAddr(\"glNormal3hNV\"))\n\tgpNormal3hvNV = (C.GPNORMAL3HVNV)(getProcAddr(\"glNormal3hvNV\"))\n\tgpNormal3i = (C.GPNORMAL3I)(getProcAddr(\"glNormal3i\"))\n\tif gpNormal3i == nil {\n\t\treturn errors.New(\"glNormal3i\")\n\t}\n\tgpNormal3iv = (C.GPNORMAL3IV)(getProcAddr(\"glNormal3iv\"))\n\tif gpNormal3iv == nil {\n\t\treturn errors.New(\"glNormal3iv\")\n\t}\n\tgpNormal3s = (C.GPNORMAL3S)(getProcAddr(\"glNormal3s\"))\n\tif gpNormal3s == nil {\n\t\treturn errors.New(\"glNormal3s\")\n\t}\n\tgpNormal3sv = (C.GPNORMAL3SV)(getProcAddr(\"glNormal3sv\"))\n\tif gpNormal3sv == nil {\n\t\treturn errors.New(\"glNormal3sv\")\n\t}\n\tgpNormal3xOES = (C.GPNORMAL3XOES)(getProcAddr(\"glNormal3xOES\"))\n\tgpNormal3xvOES = (C.GPNORMAL3XVOES)(getProcAddr(\"glNormal3xvOES\"))\n\tgpNormalFormatNV = (C.GPNORMALFORMATNV)(getProcAddr(\"glNormalFormatNV\"))\n\tgpNormalP3ui = (C.GPNORMALP3UI)(getProcAddr(\"glNormalP3ui\"))\n\tif gpNormalP3ui == nil {\n\t\treturn errors.New(\"glNormalP3ui\")\n\t}\n\tgpNormalP3uiv = (C.GPNORMALP3UIV)(getProcAddr(\"glNormalP3uiv\"))\n\tif gpNormalP3uiv == nil {\n\t\treturn errors.New(\"glNormalP3uiv\")\n\t}\n\tgpNormalPointer = (C.GPNORMALPOINTER)(getProcAddr(\"glNormalPointer\"))\n\tif gpNormalPointer == nil {\n\t\treturn errors.New(\"glNormalPointer\")\n\t}\n\tgpNormalPointerEXT = (C.GPNORMALPOINTEREXT)(getProcAddr(\"glNormalPointerEXT\"))\n\tgpNormalPointerListIBM = (C.GPNORMALPOINTERLISTIBM)(getProcAddr(\"glNormalPointerListIBM\"))\n\tgpNormalPointervINTEL = (C.GPNORMALPOINTERVINTEL)(getProcAddr(\"glNormalPointervINTEL\"))\n\tgpNormalStream3bATI = (C.GPNORMALSTREAM3BATI)(getProcAddr(\"glNormalStream3bATI\"))\n\tgpNormalStream3bvATI = (C.GPNORMALSTREAM3BVATI)(getProcAddr(\"glNormalStream3bvATI\"))\n\tgpNormalStream3dATI = (C.GPNORMALSTREAM3DATI)(getProcAddr(\"glNormalStream3dATI\"))\n\tgpNormalStream3dvATI = (C.GPNORMALSTREAM3DVATI)(getProcAddr(\"glNormalStream3dvATI\"))\n\tgpNormalStream3fATI = (C.GPNORMALSTREAM3FATI)(getProcAddr(\"glNormalStream3fATI\"))\n\tgpNormalStream3fvATI = (C.GPNORMALSTREAM3FVATI)(getProcAddr(\"glNormalStream3fvATI\"))\n\tgpNormalStream3iATI = (C.GPNORMALSTREAM3IATI)(getProcAddr(\"glNormalStream3iATI\"))\n\tgpNormalStream3ivATI = (C.GPNORMALSTREAM3IVATI)(getProcAddr(\"glNormalStream3ivATI\"))\n\tgpNormalStream3sATI = (C.GPNORMALSTREAM3SATI)(getProcAddr(\"glNormalStream3sATI\"))\n\tgpNormalStream3svATI = (C.GPNORMALSTREAM3SVATI)(getProcAddr(\"glNormalStream3svATI\"))\n\tgpObjectLabel = (C.GPOBJECTLABEL)(getProcAddr(\"glObjectLabel\"))\n\tif gpObjectLabel == nil {\n\t\treturn errors.New(\"glObjectLabel\")\n\t}\n\tgpObjectLabelKHR = (C.GPOBJECTLABELKHR)(getProcAddr(\"glObjectLabelKHR\"))\n\tgpObjectPtrLabel = (C.GPOBJECTPTRLABEL)(getProcAddr(\"glObjectPtrLabel\"))\n\tif gpObjectPtrLabel == nil {\n\t\treturn errors.New(\"glObjectPtrLabel\")\n\t}\n\tgpObjectPtrLabelKHR = (C.GPOBJECTPTRLABELKHR)(getProcAddr(\"glObjectPtrLabelKHR\"))\n\tgpObjectPurgeableAPPLE = (C.GPOBJECTPURGEABLEAPPLE)(getProcAddr(\"glObjectPurgeableAPPLE\"))\n\tgpObjectUnpurgeableAPPLE = (C.GPOBJECTUNPURGEABLEAPPLE)(getProcAddr(\"glObjectUnpurgeableAPPLE\"))\n\tgpOrtho = (C.GPORTHO)(getProcAddr(\"glOrtho\"))\n\tif gpOrtho == nil {\n\t\treturn errors.New(\"glOrtho\")\n\t}\n\tgpOrthofOES = (C.GPORTHOFOES)(getProcAddr(\"glOrthofOES\"))\n\tgpOrthoxOES = (C.GPORTHOXOES)(getProcAddr(\"glOrthoxOES\"))\n\tgpPNTrianglesfATI = (C.GPPNTRIANGLESFATI)(getProcAddr(\"glPNTrianglesfATI\"))\n\tgpPNTrianglesiATI = (C.GPPNTRIANGLESIATI)(getProcAddr(\"glPNTrianglesiATI\"))\n\tgpPassTexCoordATI = (C.GPPASSTEXCOORDATI)(getProcAddr(\"glPassTexCoordATI\"))\n\tgpPassThrough = (C.GPPASSTHROUGH)(getProcAddr(\"glPassThrough\"))\n\tif gpPassThrough == nil {\n\t\treturn errors.New(\"glPassThrough\")\n\t}\n\tgpPassThroughxOES = (C.GPPASSTHROUGHXOES)(getProcAddr(\"glPassThroughxOES\"))\n\tgpPatchParameterfv = (C.GPPATCHPARAMETERFV)(getProcAddr(\"glPatchParameterfv\"))\n\tif gpPatchParameterfv == nil {\n\t\treturn errors.New(\"glPatchParameterfv\")\n\t}\n\tgpPatchParameteri = (C.GPPATCHPARAMETERI)(getProcAddr(\"glPatchParameteri\"))\n\tif gpPatchParameteri == nil {\n\t\treturn errors.New(\"glPatchParameteri\")\n\t}\n\tgpPathColorGenNV = (C.GPPATHCOLORGENNV)(getProcAddr(\"glPathColorGenNV\"))\n\tgpPathCommandsNV = (C.GPPATHCOMMANDSNV)(getProcAddr(\"glPathCommandsNV\"))\n\tgpPathCoordsNV = (C.GPPATHCOORDSNV)(getProcAddr(\"glPathCoordsNV\"))\n\tgpPathCoverDepthFuncNV = (C.GPPATHCOVERDEPTHFUNCNV)(getProcAddr(\"glPathCoverDepthFuncNV\"))\n\tgpPathDashArrayNV = (C.GPPATHDASHARRAYNV)(getProcAddr(\"glPathDashArrayNV\"))\n\tgpPathFogGenNV = (C.GPPATHFOGGENNV)(getProcAddr(\"glPathFogGenNV\"))\n\tgpPathGlyphIndexArrayNV = (C.GPPATHGLYPHINDEXARRAYNV)(getProcAddr(\"glPathGlyphIndexArrayNV\"))\n\tgpPathGlyphIndexRangeNV = (C.GPPATHGLYPHINDEXRANGENV)(getProcAddr(\"glPathGlyphIndexRangeNV\"))\n\tgpPathGlyphRangeNV = (C.GPPATHGLYPHRANGENV)(getProcAddr(\"glPathGlyphRangeNV\"))\n\tgpPathGlyphsNV = (C.GPPATHGLYPHSNV)(getProcAddr(\"glPathGlyphsNV\"))\n\tgpPathMemoryGlyphIndexArrayNV = (C.GPPATHMEMORYGLYPHINDEXARRAYNV)(getProcAddr(\"glPathMemoryGlyphIndexArrayNV\"))\n\tgpPathParameterfNV = (C.GPPATHPARAMETERFNV)(getProcAddr(\"glPathParameterfNV\"))\n\tgpPathParameterfvNV = (C.GPPATHPARAMETERFVNV)(getProcAddr(\"glPathParameterfvNV\"))\n\tgpPathParameteriNV = (C.GPPATHPARAMETERINV)(getProcAddr(\"glPathParameteriNV\"))\n\tgpPathParameterivNV = (C.GPPATHPARAMETERIVNV)(getProcAddr(\"glPathParameterivNV\"))\n\tgpPathStencilDepthOffsetNV = (C.GPPATHSTENCILDEPTHOFFSETNV)(getProcAddr(\"glPathStencilDepthOffsetNV\"))\n\tgpPathStencilFuncNV = (C.GPPATHSTENCILFUNCNV)(getProcAddr(\"glPathStencilFuncNV\"))\n\tgpPathStringNV = (C.GPPATHSTRINGNV)(getProcAddr(\"glPathStringNV\"))\n\tgpPathSubCommandsNV = (C.GPPATHSUBCOMMANDSNV)(getProcAddr(\"glPathSubCommandsNV\"))\n\tgpPathSubCoordsNV = (C.GPPATHSUBCOORDSNV)(getProcAddr(\"glPathSubCoordsNV\"))\n\tgpPathTexGenNV = (C.GPPATHTEXGENNV)(getProcAddr(\"glPathTexGenNV\"))\n\tgpPauseTransformFeedback = (C.GPPAUSETRANSFORMFEEDBACK)(getProcAddr(\"glPauseTransformFeedback\"))\n\tif gpPauseTransformFeedback == nil {\n\t\treturn errors.New(\"glPauseTransformFeedback\")\n\t}\n\tgpPauseTransformFeedbackNV = (C.GPPAUSETRANSFORMFEEDBACKNV)(getProcAddr(\"glPauseTransformFeedbackNV\"))\n\tgpPixelDataRangeNV = (C.GPPIXELDATARANGENV)(getProcAddr(\"glPixelDataRangeNV\"))\n\tgpPixelMapfv = (C.GPPIXELMAPFV)(getProcAddr(\"glPixelMapfv\"))\n\tif gpPixelMapfv == nil {\n\t\treturn errors.New(\"glPixelMapfv\")\n\t}\n\tgpPixelMapuiv = (C.GPPIXELMAPUIV)(getProcAddr(\"glPixelMapuiv\"))\n\tif gpPixelMapuiv == nil {\n\t\treturn errors.New(\"glPixelMapuiv\")\n\t}\n\tgpPixelMapusv = (C.GPPIXELMAPUSV)(getProcAddr(\"glPixelMapusv\"))\n\tif gpPixelMapusv == nil {\n\t\treturn errors.New(\"glPixelMapusv\")\n\t}\n\tgpPixelMapx = (C.GPPIXELMAPX)(getProcAddr(\"glPixelMapx\"))\n\tgpPixelStoref = (C.GPPIXELSTOREF)(getProcAddr(\"glPixelStoref\"))\n\tif gpPixelStoref == nil {\n\t\treturn errors.New(\"glPixelStoref\")\n\t}\n\tgpPixelStorei = (C.GPPIXELSTOREI)(getProcAddr(\"glPixelStorei\"))\n\tif gpPixelStorei == nil {\n\t\treturn errors.New(\"glPixelStorei\")\n\t}\n\tgpPixelStorex = (C.GPPIXELSTOREX)(getProcAddr(\"glPixelStorex\"))\n\tgpPixelTexGenParameterfSGIS = (C.GPPIXELTEXGENPARAMETERFSGIS)(getProcAddr(\"glPixelTexGenParameterfSGIS\"))\n\tgpPixelTexGenParameterfvSGIS = (C.GPPIXELTEXGENPARAMETERFVSGIS)(getProcAddr(\"glPixelTexGenParameterfvSGIS\"))\n\tgpPixelTexGenParameteriSGIS = (C.GPPIXELTEXGENPARAMETERISGIS)(getProcAddr(\"glPixelTexGenParameteriSGIS\"))\n\tgpPixelTexGenParameterivSGIS = (C.GPPIXELTEXGENPARAMETERIVSGIS)(getProcAddr(\"glPixelTexGenParameterivSGIS\"))\n\tgpPixelTexGenSGIX = (C.GPPIXELTEXGENSGIX)(getProcAddr(\"glPixelTexGenSGIX\"))\n\tgpPixelTransferf = (C.GPPIXELTRANSFERF)(getProcAddr(\"glPixelTransferf\"))\n\tif gpPixelTransferf == nil {\n\t\treturn errors.New(\"glPixelTransferf\")\n\t}\n\tgpPixelTransferi = (C.GPPIXELTRANSFERI)(getProcAddr(\"glPixelTransferi\"))\n\tif gpPixelTransferi == nil {\n\t\treturn errors.New(\"glPixelTransferi\")\n\t}\n\tgpPixelTransferxOES = (C.GPPIXELTRANSFERXOES)(getProcAddr(\"glPixelTransferxOES\"))\n\tgpPixelTransformParameterfEXT = (C.GPPIXELTRANSFORMPARAMETERFEXT)(getProcAddr(\"glPixelTransformParameterfEXT\"))\n\tgpPixelTransformParameterfvEXT = (C.GPPIXELTRANSFORMPARAMETERFVEXT)(getProcAddr(\"glPixelTransformParameterfvEXT\"))\n\tgpPixelTransformParameteriEXT = (C.GPPIXELTRANSFORMPARAMETERIEXT)(getProcAddr(\"glPixelTransformParameteriEXT\"))\n\tgpPixelTransformParameterivEXT = (C.GPPIXELTRANSFORMPARAMETERIVEXT)(getProcAddr(\"glPixelTransformParameterivEXT\"))\n\tgpPixelZoom = (C.GPPIXELZOOM)(getProcAddr(\"glPixelZoom\"))\n\tif gpPixelZoom == nil {\n\t\treturn errors.New(\"glPixelZoom\")\n\t}\n\tgpPixelZoomxOES = (C.GPPIXELZOOMXOES)(getProcAddr(\"glPixelZoomxOES\"))\n\tgpPointAlongPathNV = (C.GPPOINTALONGPATHNV)(getProcAddr(\"glPointAlongPathNV\"))\n\tgpPointParameterf = (C.GPPOINTPARAMETERF)(getProcAddr(\"glPointParameterf\"))\n\tif gpPointParameterf == nil {\n\t\treturn errors.New(\"glPointParameterf\")\n\t}\n\tgpPointParameterfARB = (C.GPPOINTPARAMETERFARB)(getProcAddr(\"glPointParameterfARB\"))\n\tgpPointParameterfEXT = (C.GPPOINTPARAMETERFEXT)(getProcAddr(\"glPointParameterfEXT\"))\n\tgpPointParameterfSGIS = (C.GPPOINTPARAMETERFSGIS)(getProcAddr(\"glPointParameterfSGIS\"))\n\tgpPointParameterfv = (C.GPPOINTPARAMETERFV)(getProcAddr(\"glPointParameterfv\"))\n\tif gpPointParameterfv == nil {\n\t\treturn errors.New(\"glPointParameterfv\")\n\t}\n\tgpPointParameterfvARB = (C.GPPOINTPARAMETERFVARB)(getProcAddr(\"glPointParameterfvARB\"))\n\tgpPointParameterfvEXT = (C.GPPOINTPARAMETERFVEXT)(getProcAddr(\"glPointParameterfvEXT\"))\n\tgpPointParameterfvSGIS = (C.GPPOINTPARAMETERFVSGIS)(getProcAddr(\"glPointParameterfvSGIS\"))\n\tgpPointParameteri = (C.GPPOINTPARAMETERI)(getProcAddr(\"glPointParameteri\"))\n\tif gpPointParameteri == nil {\n\t\treturn errors.New(\"glPointParameteri\")\n\t}\n\tgpPointParameteriNV = (C.GPPOINTPARAMETERINV)(getProcAddr(\"glPointParameteriNV\"))\n\tgpPointParameteriv = (C.GPPOINTPARAMETERIV)(getProcAddr(\"glPointParameteriv\"))\n\tif gpPointParameteriv == nil {\n\t\treturn errors.New(\"glPointParameteriv\")\n\t}\n\tgpPointParameterivNV = (C.GPPOINTPARAMETERIVNV)(getProcAddr(\"glPointParameterivNV\"))\n\tgpPointParameterxOES = (C.GPPOINTPARAMETERXOES)(getProcAddr(\"glPointParameterxOES\"))\n\tgpPointParameterxvOES = (C.GPPOINTPARAMETERXVOES)(getProcAddr(\"glPointParameterxvOES\"))\n\tgpPointSize = (C.GPPOINTSIZE)(getProcAddr(\"glPointSize\"))\n\tif gpPointSize == nil {\n\t\treturn errors.New(\"glPointSize\")\n\t}\n\tgpPointSizexOES = (C.GPPOINTSIZEXOES)(getProcAddr(\"glPointSizexOES\"))\n\tgpPollAsyncSGIX = (C.GPPOLLASYNCSGIX)(getProcAddr(\"glPollAsyncSGIX\"))\n\tgpPollInstrumentsSGIX = (C.GPPOLLINSTRUMENTSSGIX)(getProcAddr(\"glPollInstrumentsSGIX\"))\n\tgpPolygonMode = (C.GPPOLYGONMODE)(getProcAddr(\"glPolygonMode\"))\n\tif gpPolygonMode == nil {\n\t\treturn errors.New(\"glPolygonMode\")\n\t}\n\tgpPolygonOffset = (C.GPPOLYGONOFFSET)(getProcAddr(\"glPolygonOffset\"))\n\tif gpPolygonOffset == nil {\n\t\treturn errors.New(\"glPolygonOffset\")\n\t}\n\tgpPolygonOffsetClamp = (C.GPPOLYGONOFFSETCLAMP)(getProcAddr(\"glPolygonOffsetClamp\"))\n\tgpPolygonOffsetClampEXT = (C.GPPOLYGONOFFSETCLAMPEXT)(getProcAddr(\"glPolygonOffsetClampEXT\"))\n\tgpPolygonOffsetEXT = (C.GPPOLYGONOFFSETEXT)(getProcAddr(\"glPolygonOffsetEXT\"))\n\tgpPolygonOffsetxOES = (C.GPPOLYGONOFFSETXOES)(getProcAddr(\"glPolygonOffsetxOES\"))\n\tgpPolygonStipple = (C.GPPOLYGONSTIPPLE)(getProcAddr(\"glPolygonStipple\"))\n\tif gpPolygonStipple == nil {\n\t\treturn errors.New(\"glPolygonStipple\")\n\t}\n\tgpPopAttrib = (C.GPPOPATTRIB)(getProcAddr(\"glPopAttrib\"))\n\tif gpPopAttrib == nil {\n\t\treturn errors.New(\"glPopAttrib\")\n\t}\n\tgpPopClientAttrib = (C.GPPOPCLIENTATTRIB)(getProcAddr(\"glPopClientAttrib\"))\n\tif gpPopClientAttrib == nil {\n\t\treturn errors.New(\"glPopClientAttrib\")\n\t}\n\tgpPopDebugGroup = (C.GPPOPDEBUGGROUP)(getProcAddr(\"glPopDebugGroup\"))\n\tif gpPopDebugGroup == nil {\n\t\treturn errors.New(\"glPopDebugGroup\")\n\t}\n\tgpPopDebugGroupKHR = (C.GPPOPDEBUGGROUPKHR)(getProcAddr(\"glPopDebugGroupKHR\"))\n\tgpPopGroupMarkerEXT = (C.GPPOPGROUPMARKEREXT)(getProcAddr(\"glPopGroupMarkerEXT\"))\n\tgpPopMatrix = (C.GPPOPMATRIX)(getProcAddr(\"glPopMatrix\"))\n\tif gpPopMatrix == nil {\n\t\treturn errors.New(\"glPopMatrix\")\n\t}\n\tgpPopName = (C.GPPOPNAME)(getProcAddr(\"glPopName\"))\n\tif gpPopName == nil {\n\t\treturn errors.New(\"glPopName\")\n\t}\n\tgpPresentFrameDualFillNV = (C.GPPRESENTFRAMEDUALFILLNV)(getProcAddr(\"glPresentFrameDualFillNV\"))\n\tgpPresentFrameKeyedNV = (C.GPPRESENTFRAMEKEYEDNV)(getProcAddr(\"glPresentFrameKeyedNV\"))\n\tgpPrimitiveBoundingBoxARB = (C.GPPRIMITIVEBOUNDINGBOXARB)(getProcAddr(\"glPrimitiveBoundingBoxARB\"))\n\tgpPrimitiveRestartIndex = (C.GPPRIMITIVERESTARTINDEX)(getProcAddr(\"glPrimitiveRestartIndex\"))\n\tif gpPrimitiveRestartIndex == nil {\n\t\treturn errors.New(\"glPrimitiveRestartIndex\")\n\t}\n\tgpPrimitiveRestartIndexNV = (C.GPPRIMITIVERESTARTINDEXNV)(getProcAddr(\"glPrimitiveRestartIndexNV\"))\n\tgpPrimitiveRestartNV = (C.GPPRIMITIVERESTARTNV)(getProcAddr(\"glPrimitiveRestartNV\"))\n\tgpPrioritizeTextures = (C.GPPRIORITIZETEXTURES)(getProcAddr(\"glPrioritizeTextures\"))\n\tif gpPrioritizeTextures == nil {\n\t\treturn errors.New(\"glPrioritizeTextures\")\n\t}\n\tgpPrioritizeTexturesEXT = (C.GPPRIORITIZETEXTURESEXT)(getProcAddr(\"glPrioritizeTexturesEXT\"))\n\tgpPrioritizeTexturesxOES = (C.GPPRIORITIZETEXTURESXOES)(getProcAddr(\"glPrioritizeTexturesxOES\"))\n\tgpProgramBinary = (C.GPPROGRAMBINARY)(getProcAddr(\"glProgramBinary\"))\n\tif gpProgramBinary == nil {\n\t\treturn errors.New(\"glProgramBinary\")\n\t}\n\tgpProgramBufferParametersIivNV = (C.GPPROGRAMBUFFERPARAMETERSIIVNV)(getProcAddr(\"glProgramBufferParametersIivNV\"))\n\tgpProgramBufferParametersIuivNV = (C.GPPROGRAMBUFFERPARAMETERSIUIVNV)(getProcAddr(\"glProgramBufferParametersIuivNV\"))\n\tgpProgramBufferParametersfvNV = (C.GPPROGRAMBUFFERPARAMETERSFVNV)(getProcAddr(\"glProgramBufferParametersfvNV\"))\n\tgpProgramEnvParameter4dARB = (C.GPPROGRAMENVPARAMETER4DARB)(getProcAddr(\"glProgramEnvParameter4dARB\"))\n\tgpProgramEnvParameter4dvARB = (C.GPPROGRAMENVPARAMETER4DVARB)(getProcAddr(\"glProgramEnvParameter4dvARB\"))\n\tgpProgramEnvParameter4fARB = (C.GPPROGRAMENVPARAMETER4FARB)(getProcAddr(\"glProgramEnvParameter4fARB\"))\n\tgpProgramEnvParameter4fvARB = (C.GPPROGRAMENVPARAMETER4FVARB)(getProcAddr(\"glProgramEnvParameter4fvARB\"))\n\tgpProgramEnvParameterI4iNV = (C.GPPROGRAMENVPARAMETERI4INV)(getProcAddr(\"glProgramEnvParameterI4iNV\"))\n\tgpProgramEnvParameterI4ivNV = (C.GPPROGRAMENVPARAMETERI4IVNV)(getProcAddr(\"glProgramEnvParameterI4ivNV\"))\n\tgpProgramEnvParameterI4uiNV = (C.GPPROGRAMENVPARAMETERI4UINV)(getProcAddr(\"glProgramEnvParameterI4uiNV\"))\n\tgpProgramEnvParameterI4uivNV = (C.GPPROGRAMENVPARAMETERI4UIVNV)(getProcAddr(\"glProgramEnvParameterI4uivNV\"))\n\tgpProgramEnvParameters4fvEXT = (C.GPPROGRAMENVPARAMETERS4FVEXT)(getProcAddr(\"glProgramEnvParameters4fvEXT\"))\n\tgpProgramEnvParametersI4ivNV = (C.GPPROGRAMENVPARAMETERSI4IVNV)(getProcAddr(\"glProgramEnvParametersI4ivNV\"))\n\tgpProgramEnvParametersI4uivNV = (C.GPPROGRAMENVPARAMETERSI4UIVNV)(getProcAddr(\"glProgramEnvParametersI4uivNV\"))\n\tgpProgramLocalParameter4dARB = (C.GPPROGRAMLOCALPARAMETER4DARB)(getProcAddr(\"glProgramLocalParameter4dARB\"))\n\tgpProgramLocalParameter4dvARB = (C.GPPROGRAMLOCALPARAMETER4DVARB)(getProcAddr(\"glProgramLocalParameter4dvARB\"))\n\tgpProgramLocalParameter4fARB = (C.GPPROGRAMLOCALPARAMETER4FARB)(getProcAddr(\"glProgramLocalParameter4fARB\"))\n\tgpProgramLocalParameter4fvARB = (C.GPPROGRAMLOCALPARAMETER4FVARB)(getProcAddr(\"glProgramLocalParameter4fvARB\"))\n\tgpProgramLocalParameterI4iNV = (C.GPPROGRAMLOCALPARAMETERI4INV)(getProcAddr(\"glProgramLocalParameterI4iNV\"))\n\tgpProgramLocalParameterI4ivNV = (C.GPPROGRAMLOCALPARAMETERI4IVNV)(getProcAddr(\"glProgramLocalParameterI4ivNV\"))\n\tgpProgramLocalParameterI4uiNV = (C.GPPROGRAMLOCALPARAMETERI4UINV)(getProcAddr(\"glProgramLocalParameterI4uiNV\"))\n\tgpProgramLocalParameterI4uivNV = (C.GPPROGRAMLOCALPARAMETERI4UIVNV)(getProcAddr(\"glProgramLocalParameterI4uivNV\"))\n\tgpProgramLocalParameters4fvEXT = (C.GPPROGRAMLOCALPARAMETERS4FVEXT)(getProcAddr(\"glProgramLocalParameters4fvEXT\"))\n\tgpProgramLocalParametersI4ivNV = (C.GPPROGRAMLOCALPARAMETERSI4IVNV)(getProcAddr(\"glProgramLocalParametersI4ivNV\"))\n\tgpProgramLocalParametersI4uivNV = (C.GPPROGRAMLOCALPARAMETERSI4UIVNV)(getProcAddr(\"glProgramLocalParametersI4uivNV\"))\n\tgpProgramNamedParameter4dNV = (C.GPPROGRAMNAMEDPARAMETER4DNV)(getProcAddr(\"glProgramNamedParameter4dNV\"))\n\tgpProgramNamedParameter4dvNV = (C.GPPROGRAMNAMEDPARAMETER4DVNV)(getProcAddr(\"glProgramNamedParameter4dvNV\"))\n\tgpProgramNamedParameter4fNV = (C.GPPROGRAMNAMEDPARAMETER4FNV)(getProcAddr(\"glProgramNamedParameter4fNV\"))\n\tgpProgramNamedParameter4fvNV = (C.GPPROGRAMNAMEDPARAMETER4FVNV)(getProcAddr(\"glProgramNamedParameter4fvNV\"))\n\tgpProgramParameter4dNV = (C.GPPROGRAMPARAMETER4DNV)(getProcAddr(\"glProgramParameter4dNV\"))\n\tgpProgramParameter4dvNV = (C.GPPROGRAMPARAMETER4DVNV)(getProcAddr(\"glProgramParameter4dvNV\"))\n\tgpProgramParameter4fNV = (C.GPPROGRAMPARAMETER4FNV)(getProcAddr(\"glProgramParameter4fNV\"))\n\tgpProgramParameter4fvNV = (C.GPPROGRAMPARAMETER4FVNV)(getProcAddr(\"glProgramParameter4fvNV\"))\n\tgpProgramParameteri = (C.GPPROGRAMPARAMETERI)(getProcAddr(\"glProgramParameteri\"))\n\tif gpProgramParameteri == nil {\n\t\treturn errors.New(\"glProgramParameteri\")\n\t}\n\tgpProgramParameteriARB = (C.GPPROGRAMPARAMETERIARB)(getProcAddr(\"glProgramParameteriARB\"))\n\tgpProgramParameteriEXT = (C.GPPROGRAMPARAMETERIEXT)(getProcAddr(\"glProgramParameteriEXT\"))\n\tgpProgramParameters4dvNV = (C.GPPROGRAMPARAMETERS4DVNV)(getProcAddr(\"glProgramParameters4dvNV\"))\n\tgpProgramParameters4fvNV = (C.GPPROGRAMPARAMETERS4FVNV)(getProcAddr(\"glProgramParameters4fvNV\"))\n\tgpProgramPathFragmentInputGenNV = (C.GPPROGRAMPATHFRAGMENTINPUTGENNV)(getProcAddr(\"glProgramPathFragmentInputGenNV\"))\n\tgpProgramStringARB = (C.GPPROGRAMSTRINGARB)(getProcAddr(\"glProgramStringARB\"))\n\tgpProgramSubroutineParametersuivNV = (C.GPPROGRAMSUBROUTINEPARAMETERSUIVNV)(getProcAddr(\"glProgramSubroutineParametersuivNV\"))\n\tgpProgramUniform1d = (C.GPPROGRAMUNIFORM1D)(getProcAddr(\"glProgramUniform1d\"))\n\tif gpProgramUniform1d == nil {\n\t\treturn errors.New(\"glProgramUniform1d\")\n\t}\n\tgpProgramUniform1dEXT = (C.GPPROGRAMUNIFORM1DEXT)(getProcAddr(\"glProgramUniform1dEXT\"))\n\tgpProgramUniform1dv = (C.GPPROGRAMUNIFORM1DV)(getProcAddr(\"glProgramUniform1dv\"))\n\tif gpProgramUniform1dv == nil {\n\t\treturn errors.New(\"glProgramUniform1dv\")\n\t}\n\tgpProgramUniform1dvEXT = (C.GPPROGRAMUNIFORM1DVEXT)(getProcAddr(\"glProgramUniform1dvEXT\"))\n\tgpProgramUniform1f = (C.GPPROGRAMUNIFORM1F)(getProcAddr(\"glProgramUniform1f\"))\n\tif gpProgramUniform1f == nil {\n\t\treturn errors.New(\"glProgramUniform1f\")\n\t}\n\tgpProgramUniform1fEXT = (C.GPPROGRAMUNIFORM1FEXT)(getProcAddr(\"glProgramUniform1fEXT\"))\n\tgpProgramUniform1fv = (C.GPPROGRAMUNIFORM1FV)(getProcAddr(\"glProgramUniform1fv\"))\n\tif gpProgramUniform1fv == nil {\n\t\treturn errors.New(\"glProgramUniform1fv\")\n\t}\n\tgpProgramUniform1fvEXT = (C.GPPROGRAMUNIFORM1FVEXT)(getProcAddr(\"glProgramUniform1fvEXT\"))\n\tgpProgramUniform1i = (C.GPPROGRAMUNIFORM1I)(getProcAddr(\"glProgramUniform1i\"))\n\tif gpProgramUniform1i == nil {\n\t\treturn errors.New(\"glProgramUniform1i\")\n\t}\n\tgpProgramUniform1i64ARB = (C.GPPROGRAMUNIFORM1I64ARB)(getProcAddr(\"glProgramUniform1i64ARB\"))\n\tgpProgramUniform1i64NV = (C.GPPROGRAMUNIFORM1I64NV)(getProcAddr(\"glProgramUniform1i64NV\"))\n\tgpProgramUniform1i64vARB = (C.GPPROGRAMUNIFORM1I64VARB)(getProcAddr(\"glProgramUniform1i64vARB\"))\n\tgpProgramUniform1i64vNV = (C.GPPROGRAMUNIFORM1I64VNV)(getProcAddr(\"glProgramUniform1i64vNV\"))\n\tgpProgramUniform1iEXT = (C.GPPROGRAMUNIFORM1IEXT)(getProcAddr(\"glProgramUniform1iEXT\"))\n\tgpProgramUniform1iv = (C.GPPROGRAMUNIFORM1IV)(getProcAddr(\"glProgramUniform1iv\"))\n\tif gpProgramUniform1iv == nil {\n\t\treturn errors.New(\"glProgramUniform1iv\")\n\t}\n\tgpProgramUniform1ivEXT = (C.GPPROGRAMUNIFORM1IVEXT)(getProcAddr(\"glProgramUniform1ivEXT\"))\n\tgpProgramUniform1ui = (C.GPPROGRAMUNIFORM1UI)(getProcAddr(\"glProgramUniform1ui\"))\n\tif gpProgramUniform1ui == nil {\n\t\treturn errors.New(\"glProgramUniform1ui\")\n\t}\n\tgpProgramUniform1ui64ARB = (C.GPPROGRAMUNIFORM1UI64ARB)(getProcAddr(\"glProgramUniform1ui64ARB\"))\n\tgpProgramUniform1ui64NV = (C.GPPROGRAMUNIFORM1UI64NV)(getProcAddr(\"glProgramUniform1ui64NV\"))\n\tgpProgramUniform1ui64vARB = (C.GPPROGRAMUNIFORM1UI64VARB)(getProcAddr(\"glProgramUniform1ui64vARB\"))\n\tgpProgramUniform1ui64vNV = (C.GPPROGRAMUNIFORM1UI64VNV)(getProcAddr(\"glProgramUniform1ui64vNV\"))\n\tgpProgramUniform1uiEXT = (C.GPPROGRAMUNIFORM1UIEXT)(getProcAddr(\"glProgramUniform1uiEXT\"))\n\tgpProgramUniform1uiv = (C.GPPROGRAMUNIFORM1UIV)(getProcAddr(\"glProgramUniform1uiv\"))\n\tif gpProgramUniform1uiv == nil {\n\t\treturn errors.New(\"glProgramUniform1uiv\")\n\t}\n\tgpProgramUniform1uivEXT = (C.GPPROGRAMUNIFORM1UIVEXT)(getProcAddr(\"glProgramUniform1uivEXT\"))\n\tgpProgramUniform2d = (C.GPPROGRAMUNIFORM2D)(getProcAddr(\"glProgramUniform2d\"))\n\tif gpProgramUniform2d == nil {\n\t\treturn errors.New(\"glProgramUniform2d\")\n\t}\n\tgpProgramUniform2dEXT = (C.GPPROGRAMUNIFORM2DEXT)(getProcAddr(\"glProgramUniform2dEXT\"))\n\tgpProgramUniform2dv = (C.GPPROGRAMUNIFORM2DV)(getProcAddr(\"glProgramUniform2dv\"))\n\tif gpProgramUniform2dv == nil {\n\t\treturn errors.New(\"glProgramUniform2dv\")\n\t}\n\tgpProgramUniform2dvEXT = (C.GPPROGRAMUNIFORM2DVEXT)(getProcAddr(\"glProgramUniform2dvEXT\"))\n\tgpProgramUniform2f = (C.GPPROGRAMUNIFORM2F)(getProcAddr(\"glProgramUniform2f\"))\n\tif gpProgramUniform2f == nil {\n\t\treturn errors.New(\"glProgramUniform2f\")\n\t}\n\tgpProgramUniform2fEXT = (C.GPPROGRAMUNIFORM2FEXT)(getProcAddr(\"glProgramUniform2fEXT\"))\n\tgpProgramUniform2fv = (C.GPPROGRAMUNIFORM2FV)(getProcAddr(\"glProgramUniform2fv\"))\n\tif gpProgramUniform2fv == nil {\n\t\treturn errors.New(\"glProgramUniform2fv\")\n\t}\n\tgpProgramUniform2fvEXT = (C.GPPROGRAMUNIFORM2FVEXT)(getProcAddr(\"glProgramUniform2fvEXT\"))\n\tgpProgramUniform2i = (C.GPPROGRAMUNIFORM2I)(getProcAddr(\"glProgramUniform2i\"))\n\tif gpProgramUniform2i == nil {\n\t\treturn errors.New(\"glProgramUniform2i\")\n\t}\n\tgpProgramUniform2i64ARB = (C.GPPROGRAMUNIFORM2I64ARB)(getProcAddr(\"glProgramUniform2i64ARB\"))\n\tgpProgramUniform2i64NV = (C.GPPROGRAMUNIFORM2I64NV)(getProcAddr(\"glProgramUniform2i64NV\"))\n\tgpProgramUniform2i64vARB = (C.GPPROGRAMUNIFORM2I64VARB)(getProcAddr(\"glProgramUniform2i64vARB\"))\n\tgpProgramUniform2i64vNV = (C.GPPROGRAMUNIFORM2I64VNV)(getProcAddr(\"glProgramUniform2i64vNV\"))\n\tgpProgramUniform2iEXT = (C.GPPROGRAMUNIFORM2IEXT)(getProcAddr(\"glProgramUniform2iEXT\"))\n\tgpProgramUniform2iv = (C.GPPROGRAMUNIFORM2IV)(getProcAddr(\"glProgramUniform2iv\"))\n\tif gpProgramUniform2iv == nil {\n\t\treturn errors.New(\"glProgramUniform2iv\")\n\t}\n\tgpProgramUniform2ivEXT = (C.GPPROGRAMUNIFORM2IVEXT)(getProcAddr(\"glProgramUniform2ivEXT\"))\n\tgpProgramUniform2ui = (C.GPPROGRAMUNIFORM2UI)(getProcAddr(\"glProgramUniform2ui\"))\n\tif gpProgramUniform2ui == nil {\n\t\treturn errors.New(\"glProgramUniform2ui\")\n\t}\n\tgpProgramUniform2ui64ARB = (C.GPPROGRAMUNIFORM2UI64ARB)(getProcAddr(\"glProgramUniform2ui64ARB\"))\n\tgpProgramUniform2ui64NV = (C.GPPROGRAMUNIFORM2UI64NV)(getProcAddr(\"glProgramUniform2ui64NV\"))\n\tgpProgramUniform2ui64vARB = (C.GPPROGRAMUNIFORM2UI64VARB)(getProcAddr(\"glProgramUniform2ui64vARB\"))\n\tgpProgramUniform2ui64vNV = (C.GPPROGRAMUNIFORM2UI64VNV)(getProcAddr(\"glProgramUniform2ui64vNV\"))\n\tgpProgramUniform2uiEXT = (C.GPPROGRAMUNIFORM2UIEXT)(getProcAddr(\"glProgramUniform2uiEXT\"))\n\tgpProgramUniform2uiv = (C.GPPROGRAMUNIFORM2UIV)(getProcAddr(\"glProgramUniform2uiv\"))\n\tif gpProgramUniform2uiv == nil {\n\t\treturn errors.New(\"glProgramUniform2uiv\")\n\t}\n\tgpProgramUniform2uivEXT = (C.GPPROGRAMUNIFORM2UIVEXT)(getProcAddr(\"glProgramUniform2uivEXT\"))\n\tgpProgramUniform3d = (C.GPPROGRAMUNIFORM3D)(getProcAddr(\"glProgramUniform3d\"))\n\tif gpProgramUniform3d == nil {\n\t\treturn errors.New(\"glProgramUniform3d\")\n\t}\n\tgpProgramUniform3dEXT = (C.GPPROGRAMUNIFORM3DEXT)(getProcAddr(\"glProgramUniform3dEXT\"))\n\tgpProgramUniform3dv = (C.GPPROGRAMUNIFORM3DV)(getProcAddr(\"glProgramUniform3dv\"))\n\tif gpProgramUniform3dv == nil {\n\t\treturn errors.New(\"glProgramUniform3dv\")\n\t}\n\tgpProgramUniform3dvEXT = (C.GPPROGRAMUNIFORM3DVEXT)(getProcAddr(\"glProgramUniform3dvEXT\"))\n\tgpProgramUniform3f = (C.GPPROGRAMUNIFORM3F)(getProcAddr(\"glProgramUniform3f\"))\n\tif gpProgramUniform3f == nil {\n\t\treturn errors.New(\"glProgramUniform3f\")\n\t}\n\tgpProgramUniform3fEXT = (C.GPPROGRAMUNIFORM3FEXT)(getProcAddr(\"glProgramUniform3fEXT\"))\n\tgpProgramUniform3fv = (C.GPPROGRAMUNIFORM3FV)(getProcAddr(\"glProgramUniform3fv\"))\n\tif gpProgramUniform3fv == nil {\n\t\treturn errors.New(\"glProgramUniform3fv\")\n\t}\n\tgpProgramUniform3fvEXT = (C.GPPROGRAMUNIFORM3FVEXT)(getProcAddr(\"glProgramUniform3fvEXT\"))\n\tgpProgramUniform3i = (C.GPPROGRAMUNIFORM3I)(getProcAddr(\"glProgramUniform3i\"))\n\tif gpProgramUniform3i == nil {\n\t\treturn errors.New(\"glProgramUniform3i\")\n\t}\n\tgpProgramUniform3i64ARB = (C.GPPROGRAMUNIFORM3I64ARB)(getProcAddr(\"glProgramUniform3i64ARB\"))\n\tgpProgramUniform3i64NV = (C.GPPROGRAMUNIFORM3I64NV)(getProcAddr(\"glProgramUniform3i64NV\"))\n\tgpProgramUniform3i64vARB = (C.GPPROGRAMUNIFORM3I64VARB)(getProcAddr(\"glProgramUniform3i64vARB\"))\n\tgpProgramUniform3i64vNV = (C.GPPROGRAMUNIFORM3I64VNV)(getProcAddr(\"glProgramUniform3i64vNV\"))\n\tgpProgramUniform3iEXT = (C.GPPROGRAMUNIFORM3IEXT)(getProcAddr(\"glProgramUniform3iEXT\"))\n\tgpProgramUniform3iv = (C.GPPROGRAMUNIFORM3IV)(getProcAddr(\"glProgramUniform3iv\"))\n\tif gpProgramUniform3iv == nil {\n\t\treturn errors.New(\"glProgramUniform3iv\")\n\t}\n\tgpProgramUniform3ivEXT = (C.GPPROGRAMUNIFORM3IVEXT)(getProcAddr(\"glProgramUniform3ivEXT\"))\n\tgpProgramUniform3ui = (C.GPPROGRAMUNIFORM3UI)(getProcAddr(\"glProgramUniform3ui\"))\n\tif gpProgramUniform3ui == nil {\n\t\treturn errors.New(\"glProgramUniform3ui\")\n\t}\n\tgpProgramUniform3ui64ARB = (C.GPPROGRAMUNIFORM3UI64ARB)(getProcAddr(\"glProgramUniform3ui64ARB\"))\n\tgpProgramUniform3ui64NV = (C.GPPROGRAMUNIFORM3UI64NV)(getProcAddr(\"glProgramUniform3ui64NV\"))\n\tgpProgramUniform3ui64vARB = (C.GPPROGRAMUNIFORM3UI64VARB)(getProcAddr(\"glProgramUniform3ui64vARB\"))\n\tgpProgramUniform3ui64vNV = (C.GPPROGRAMUNIFORM3UI64VNV)(getProcAddr(\"glProgramUniform3ui64vNV\"))\n\tgpProgramUniform3uiEXT = (C.GPPROGRAMUNIFORM3UIEXT)(getProcAddr(\"glProgramUniform3uiEXT\"))\n\tgpProgramUniform3uiv = (C.GPPROGRAMUNIFORM3UIV)(getProcAddr(\"glProgramUniform3uiv\"))\n\tif gpProgramUniform3uiv == nil {\n\t\treturn errors.New(\"glProgramUniform3uiv\")\n\t}\n\tgpProgramUniform3uivEXT = (C.GPPROGRAMUNIFORM3UIVEXT)(getProcAddr(\"glProgramUniform3uivEXT\"))\n\tgpProgramUniform4d = (C.GPPROGRAMUNIFORM4D)(getProcAddr(\"glProgramUniform4d\"))\n\tif gpProgramUniform4d == nil {\n\t\treturn errors.New(\"glProgramUniform4d\")\n\t}\n\tgpProgramUniform4dEXT = (C.GPPROGRAMUNIFORM4DEXT)(getProcAddr(\"glProgramUniform4dEXT\"))\n\tgpProgramUniform4dv = (C.GPPROGRAMUNIFORM4DV)(getProcAddr(\"glProgramUniform4dv\"))\n\tif gpProgramUniform4dv == nil {\n\t\treturn errors.New(\"glProgramUniform4dv\")\n\t}\n\tgpProgramUniform4dvEXT = (C.GPPROGRAMUNIFORM4DVEXT)(getProcAddr(\"glProgramUniform4dvEXT\"))\n\tgpProgramUniform4f = (C.GPPROGRAMUNIFORM4F)(getProcAddr(\"glProgramUniform4f\"))\n\tif gpProgramUniform4f == nil {\n\t\treturn errors.New(\"glProgramUniform4f\")\n\t}\n\tgpProgramUniform4fEXT = (C.GPPROGRAMUNIFORM4FEXT)(getProcAddr(\"glProgramUniform4fEXT\"))\n\tgpProgramUniform4fv = (C.GPPROGRAMUNIFORM4FV)(getProcAddr(\"glProgramUniform4fv\"))\n\tif gpProgramUniform4fv == nil {\n\t\treturn errors.New(\"glProgramUniform4fv\")\n\t}\n\tgpProgramUniform4fvEXT = (C.GPPROGRAMUNIFORM4FVEXT)(getProcAddr(\"glProgramUniform4fvEXT\"))\n\tgpProgramUniform4i = (C.GPPROGRAMUNIFORM4I)(getProcAddr(\"glProgramUniform4i\"))\n\tif gpProgramUniform4i == nil {\n\t\treturn errors.New(\"glProgramUniform4i\")\n\t}\n\tgpProgramUniform4i64ARB = (C.GPPROGRAMUNIFORM4I64ARB)(getProcAddr(\"glProgramUniform4i64ARB\"))\n\tgpProgramUniform4i64NV = (C.GPPROGRAMUNIFORM4I64NV)(getProcAddr(\"glProgramUniform4i64NV\"))\n\tgpProgramUniform4i64vARB = (C.GPPROGRAMUNIFORM4I64VARB)(getProcAddr(\"glProgramUniform4i64vARB\"))\n\tgpProgramUniform4i64vNV = (C.GPPROGRAMUNIFORM4I64VNV)(getProcAddr(\"glProgramUniform4i64vNV\"))\n\tgpProgramUniform4iEXT = (C.GPPROGRAMUNIFORM4IEXT)(getProcAddr(\"glProgramUniform4iEXT\"))\n\tgpProgramUniform4iv = (C.GPPROGRAMUNIFORM4IV)(getProcAddr(\"glProgramUniform4iv\"))\n\tif gpProgramUniform4iv == nil {\n\t\treturn errors.New(\"glProgramUniform4iv\")\n\t}\n\tgpProgramUniform4ivEXT = (C.GPPROGRAMUNIFORM4IVEXT)(getProcAddr(\"glProgramUniform4ivEXT\"))\n\tgpProgramUniform4ui = (C.GPPROGRAMUNIFORM4UI)(getProcAddr(\"glProgramUniform4ui\"))\n\tif gpProgramUniform4ui == nil {\n\t\treturn errors.New(\"glProgramUniform4ui\")\n\t}\n\tgpProgramUniform4ui64ARB = (C.GPPROGRAMUNIFORM4UI64ARB)(getProcAddr(\"glProgramUniform4ui64ARB\"))\n\tgpProgramUniform4ui64NV = (C.GPPROGRAMUNIFORM4UI64NV)(getProcAddr(\"glProgramUniform4ui64NV\"))\n\tgpProgramUniform4ui64vARB = (C.GPPROGRAMUNIFORM4UI64VARB)(getProcAddr(\"glProgramUniform4ui64vARB\"))\n\tgpProgramUniform4ui64vNV = (C.GPPROGRAMUNIFORM4UI64VNV)(getProcAddr(\"glProgramUniform4ui64vNV\"))\n\tgpProgramUniform4uiEXT = (C.GPPROGRAMUNIFORM4UIEXT)(getProcAddr(\"glProgramUniform4uiEXT\"))\n\tgpProgramUniform4uiv = (C.GPPROGRAMUNIFORM4UIV)(getProcAddr(\"glProgramUniform4uiv\"))\n\tif gpProgramUniform4uiv == nil {\n\t\treturn errors.New(\"glProgramUniform4uiv\")\n\t}\n\tgpProgramUniform4uivEXT = (C.GPPROGRAMUNIFORM4UIVEXT)(getProcAddr(\"glProgramUniform4uivEXT\"))\n\tgpProgramUniformHandleui64ARB = (C.GPPROGRAMUNIFORMHANDLEUI64ARB)(getProcAddr(\"glProgramUniformHandleui64ARB\"))\n\tgpProgramUniformHandleui64NV = (C.GPPROGRAMUNIFORMHANDLEUI64NV)(getProcAddr(\"glProgramUniformHandleui64NV\"))\n\tgpProgramUniformHandleui64vARB = (C.GPPROGRAMUNIFORMHANDLEUI64VARB)(getProcAddr(\"glProgramUniformHandleui64vARB\"))\n\tgpProgramUniformHandleui64vNV = (C.GPPROGRAMUNIFORMHANDLEUI64VNV)(getProcAddr(\"glProgramUniformHandleui64vNV\"))\n\tgpProgramUniformMatrix2dv = (C.GPPROGRAMUNIFORMMATRIX2DV)(getProcAddr(\"glProgramUniformMatrix2dv\"))\n\tif gpProgramUniformMatrix2dv == nil {\n\t\treturn errors.New(\"glProgramUniformMatrix2dv\")\n\t}\n\tgpProgramUniformMatrix2dvEXT = (C.GPPROGRAMUNIFORMMATRIX2DVEXT)(getProcAddr(\"glProgramUniformMatrix2dvEXT\"))\n\tgpProgramUniformMatrix2fv = (C.GPPROGRAMUNIFORMMATRIX2FV)(getProcAddr(\"glProgramUniformMatrix2fv\"))\n\tif gpProgramUniformMatrix2fv == nil {\n\t\treturn errors.New(\"glProgramUniformMatrix2fv\")\n\t}\n\tgpProgramUniformMatrix2fvEXT = (C.GPPROGRAMUNIFORMMATRIX2FVEXT)(getProcAddr(\"glProgramUniformMatrix2fvEXT\"))\n\tgpProgramUniformMatrix2x3dv = (C.GPPROGRAMUNIFORMMATRIX2X3DV)(getProcAddr(\"glProgramUniformMatrix2x3dv\"))\n\tif gpProgramUniformMatrix2x3dv == nil {\n\t\treturn errors.New(\"glProgramUniformMatrix2x3dv\")\n\t}\n\tgpProgramUniformMatrix2x3dvEXT = (C.GPPROGRAMUNIFORMMATRIX2X3DVEXT)(getProcAddr(\"glProgramUniformMatrix2x3dvEXT\"))\n\tgpProgramUniformMatrix2x3fv = (C.GPPROGRAMUNIFORMMATRIX2X3FV)(getProcAddr(\"glProgramUniformMatrix2x3fv\"))\n\tif gpProgramUniformMatrix2x3fv == nil {\n\t\treturn errors.New(\"glProgramUniformMatrix2x3fv\")\n\t}\n\tgpProgramUniformMatrix2x3fvEXT = (C.GPPROGRAMUNIFORMMATRIX2X3FVEXT)(getProcAddr(\"glProgramUniformMatrix2x3fvEXT\"))\n\tgpProgramUniformMatrix2x4dv = (C.GPPROGRAMUNIFORMMATRIX2X4DV)(getProcAddr(\"glProgramUniformMatrix2x4dv\"))\n\tif gpProgramUniformMatrix2x4dv == nil {\n\t\treturn errors.New(\"glProgramUniformMatrix2x4dv\")\n\t}\n\tgpProgramUniformMatrix2x4dvEXT = (C.GPPROGRAMUNIFORMMATRIX2X4DVEXT)(getProcAddr(\"glProgramUniformMatrix2x4dvEXT\"))\n\tgpProgramUniformMatrix2x4fv = (C.GPPROGRAMUNIFORMMATRIX2X4FV)(getProcAddr(\"glProgramUniformMatrix2x4fv\"))\n\tif gpProgramUniformMatrix2x4fv == nil {\n\t\treturn errors.New(\"glProgramUniformMatrix2x4fv\")\n\t}\n\tgpProgramUniformMatrix2x4fvEXT = (C.GPPROGRAMUNIFORMMATRIX2X4FVEXT)(getProcAddr(\"glProgramUniformMatrix2x4fvEXT\"))\n\tgpProgramUniformMatrix3dv = (C.GPPROGRAMUNIFORMMATRIX3DV)(getProcAddr(\"glProgramUniformMatrix3dv\"))\n\tif gpProgramUniformMatrix3dv == nil {\n\t\treturn errors.New(\"glProgramUniformMatrix3dv\")\n\t}\n\tgpProgramUniformMatrix3dvEXT = (C.GPPROGRAMUNIFORMMATRIX3DVEXT)(getProcAddr(\"glProgramUniformMatrix3dvEXT\"))\n\tgpProgramUniformMatrix3fv = (C.GPPROGRAMUNIFORMMATRIX3FV)(getProcAddr(\"glProgramUniformMatrix3fv\"))\n\tif gpProgramUniformMatrix3fv == nil {\n\t\treturn errors.New(\"glProgramUniformMatrix3fv\")\n\t}\n\tgpProgramUniformMatrix3fvEXT = (C.GPPROGRAMUNIFORMMATRIX3FVEXT)(getProcAddr(\"glProgramUniformMatrix3fvEXT\"))\n\tgpProgramUniformMatrix3x2dv = (C.GPPROGRAMUNIFORMMATRIX3X2DV)(getProcAddr(\"glProgramUniformMatrix3x2dv\"))\n\tif gpProgramUniformMatrix3x2dv == nil {\n\t\treturn errors.New(\"glProgramUniformMatrix3x2dv\")\n\t}\n\tgpProgramUniformMatrix3x2dvEXT = (C.GPPROGRAMUNIFORMMATRIX3X2DVEXT)(getProcAddr(\"glProgramUniformMatrix3x2dvEXT\"))\n\tgpProgramUniformMatrix3x2fv = (C.GPPROGRAMUNIFORMMATRIX3X2FV)(getProcAddr(\"glProgramUniformMatrix3x2fv\"))\n\tif gpProgramUniformMatrix3x2fv == nil {\n\t\treturn errors.New(\"glProgramUniformMatrix3x2fv\")\n\t}\n\tgpProgramUniformMatrix3x2fvEXT = (C.GPPROGRAMUNIFORMMATRIX3X2FVEXT)(getProcAddr(\"glProgramUniformMatrix3x2fvEXT\"))\n\tgpProgramUniformMatrix3x4dv = (C.GPPROGRAMUNIFORMMATRIX3X4DV)(getProcAddr(\"glProgramUniformMatrix3x4dv\"))\n\tif gpProgramUniformMatrix3x4dv == nil {\n\t\treturn errors.New(\"glProgramUniformMatrix3x4dv\")\n\t}\n\tgpProgramUniformMatrix3x4dvEXT = (C.GPPROGRAMUNIFORMMATRIX3X4DVEXT)(getProcAddr(\"glProgramUniformMatrix3x4dvEXT\"))\n\tgpProgramUniformMatrix3x4fv = (C.GPPROGRAMUNIFORMMATRIX3X4FV)(getProcAddr(\"glProgramUniformMatrix3x4fv\"))\n\tif gpProgramUniformMatrix3x4fv == nil {\n\t\treturn errors.New(\"glProgramUniformMatrix3x4fv\")\n\t}\n\tgpProgramUniformMatrix3x4fvEXT = (C.GPPROGRAMUNIFORMMATRIX3X4FVEXT)(getProcAddr(\"glProgramUniformMatrix3x4fvEXT\"))\n\tgpProgramUniformMatrix4dv = (C.GPPROGRAMUNIFORMMATRIX4DV)(getProcAddr(\"glProgramUniformMatrix4dv\"))\n\tif gpProgramUniformMatrix4dv == nil {\n\t\treturn errors.New(\"glProgramUniformMatrix4dv\")\n\t}\n\tgpProgramUniformMatrix4dvEXT = (C.GPPROGRAMUNIFORMMATRIX4DVEXT)(getProcAddr(\"glProgramUniformMatrix4dvEXT\"))\n\tgpProgramUniformMatrix4fv = (C.GPPROGRAMUNIFORMMATRIX4FV)(getProcAddr(\"glProgramUniformMatrix4fv\"))\n\tif gpProgramUniformMatrix4fv == nil {\n\t\treturn errors.New(\"glProgramUniformMatrix4fv\")\n\t}\n\tgpProgramUniformMatrix4fvEXT = (C.GPPROGRAMUNIFORMMATRIX4FVEXT)(getProcAddr(\"glProgramUniformMatrix4fvEXT\"))\n\tgpProgramUniformMatrix4x2dv = (C.GPPROGRAMUNIFORMMATRIX4X2DV)(getProcAddr(\"glProgramUniformMatrix4x2dv\"))\n\tif gpProgramUniformMatrix4x2dv == nil {\n\t\treturn errors.New(\"glProgramUniformMatrix4x2dv\")\n\t}\n\tgpProgramUniformMatrix4x2dvEXT = (C.GPPROGRAMUNIFORMMATRIX4X2DVEXT)(getProcAddr(\"glProgramUniformMatrix4x2dvEXT\"))\n\tgpProgramUniformMatrix4x2fv = (C.GPPROGRAMUNIFORMMATRIX4X2FV)(getProcAddr(\"glProgramUniformMatrix4x2fv\"))\n\tif gpProgramUniformMatrix4x2fv == nil {\n\t\treturn errors.New(\"glProgramUniformMatrix4x2fv\")\n\t}\n\tgpProgramUniformMatrix4x2fvEXT = (C.GPPROGRAMUNIFORMMATRIX4X2FVEXT)(getProcAddr(\"glProgramUniformMatrix4x2fvEXT\"))\n\tgpProgramUniformMatrix4x3dv = (C.GPPROGRAMUNIFORMMATRIX4X3DV)(getProcAddr(\"glProgramUniformMatrix4x3dv\"))\n\tif gpProgramUniformMatrix4x3dv == nil {\n\t\treturn errors.New(\"glProgramUniformMatrix4x3dv\")\n\t}\n\tgpProgramUniformMatrix4x3dvEXT = (C.GPPROGRAMUNIFORMMATRIX4X3DVEXT)(getProcAddr(\"glProgramUniformMatrix4x3dvEXT\"))\n\tgpProgramUniformMatrix4x3fv = (C.GPPROGRAMUNIFORMMATRIX4X3FV)(getProcAddr(\"glProgramUniformMatrix4x3fv\"))\n\tif gpProgramUniformMatrix4x3fv == nil {\n\t\treturn errors.New(\"glProgramUniformMatrix4x3fv\")\n\t}\n\tgpProgramUniformMatrix4x3fvEXT = (C.GPPROGRAMUNIFORMMATRIX4X3FVEXT)(getProcAddr(\"glProgramUniformMatrix4x3fvEXT\"))\n\tgpProgramUniformui64NV = (C.GPPROGRAMUNIFORMUI64NV)(getProcAddr(\"glProgramUniformui64NV\"))\n\tgpProgramUniformui64vNV = (C.GPPROGRAMUNIFORMUI64VNV)(getProcAddr(\"glProgramUniformui64vNV\"))\n\tgpProgramVertexLimitNV = (C.GPPROGRAMVERTEXLIMITNV)(getProcAddr(\"glProgramVertexLimitNV\"))\n\tgpProvokingVertex = (C.GPPROVOKINGVERTEX)(getProcAddr(\"glProvokingVertex\"))\n\tif gpProvokingVertex == nil {\n\t\treturn errors.New(\"glProvokingVertex\")\n\t}\n\tgpProvokingVertexEXT = (C.GPPROVOKINGVERTEXEXT)(getProcAddr(\"glProvokingVertexEXT\"))\n\tgpPushAttrib = (C.GPPUSHATTRIB)(getProcAddr(\"glPushAttrib\"))\n\tif gpPushAttrib == nil {\n\t\treturn errors.New(\"glPushAttrib\")\n\t}\n\tgpPushClientAttrib = (C.GPPUSHCLIENTATTRIB)(getProcAddr(\"glPushClientAttrib\"))\n\tif gpPushClientAttrib == nil {\n\t\treturn errors.New(\"glPushClientAttrib\")\n\t}\n\tgpPushClientAttribDefaultEXT = (C.GPPUSHCLIENTATTRIBDEFAULTEXT)(getProcAddr(\"glPushClientAttribDefaultEXT\"))\n\tgpPushDebugGroup = (C.GPPUSHDEBUGGROUP)(getProcAddr(\"glPushDebugGroup\"))\n\tif gpPushDebugGroup == nil {\n\t\treturn errors.New(\"glPushDebugGroup\")\n\t}\n\tgpPushDebugGroupKHR = (C.GPPUSHDEBUGGROUPKHR)(getProcAddr(\"glPushDebugGroupKHR\"))\n\tgpPushGroupMarkerEXT = (C.GPPUSHGROUPMARKEREXT)(getProcAddr(\"glPushGroupMarkerEXT\"))\n\tgpPushMatrix = (C.GPPUSHMATRIX)(getProcAddr(\"glPushMatrix\"))\n\tif gpPushMatrix == nil {\n\t\treturn errors.New(\"glPushMatrix\")\n\t}\n\tgpPushName = (C.GPPUSHNAME)(getProcAddr(\"glPushName\"))\n\tif gpPushName == nil {\n\t\treturn errors.New(\"glPushName\")\n\t}\n\tgpQueryCounter = (C.GPQUERYCOUNTER)(getProcAddr(\"glQueryCounter\"))\n\tif gpQueryCounter == nil {\n\t\treturn errors.New(\"glQueryCounter\")\n\t}\n\tgpQueryMatrixxOES = (C.GPQUERYMATRIXXOES)(getProcAddr(\"glQueryMatrixxOES\"))\n\tgpQueryObjectParameteruiAMD = (C.GPQUERYOBJECTPARAMETERUIAMD)(getProcAddr(\"glQueryObjectParameteruiAMD\"))\n\tgpQueryResourceNV = (C.GPQUERYRESOURCENV)(getProcAddr(\"glQueryResourceNV\"))\n\tgpQueryResourceTagNV = (C.GPQUERYRESOURCETAGNV)(getProcAddr(\"glQueryResourceTagNV\"))\n\tgpRasterPos2d = (C.GPRASTERPOS2D)(getProcAddr(\"glRasterPos2d\"))\n\tif gpRasterPos2d == nil {\n\t\treturn errors.New(\"glRasterPos2d\")\n\t}\n\tgpRasterPos2dv = (C.GPRASTERPOS2DV)(getProcAddr(\"glRasterPos2dv\"))\n\tif gpRasterPos2dv == nil {\n\t\treturn errors.New(\"glRasterPos2dv\")\n\t}\n\tgpRasterPos2f = (C.GPRASTERPOS2F)(getProcAddr(\"glRasterPos2f\"))\n\tif gpRasterPos2f == nil {\n\t\treturn errors.New(\"glRasterPos2f\")\n\t}\n\tgpRasterPos2fv = (C.GPRASTERPOS2FV)(getProcAddr(\"glRasterPos2fv\"))\n\tif gpRasterPos2fv == nil {\n\t\treturn errors.New(\"glRasterPos2fv\")\n\t}\n\tgpRasterPos2i = (C.GPRASTERPOS2I)(getProcAddr(\"glRasterPos2i\"))\n\tif gpRasterPos2i == nil {\n\t\treturn errors.New(\"glRasterPos2i\")\n\t}\n\tgpRasterPos2iv = (C.GPRASTERPOS2IV)(getProcAddr(\"glRasterPos2iv\"))\n\tif gpRasterPos2iv == nil {\n\t\treturn errors.New(\"glRasterPos2iv\")\n\t}\n\tgpRasterPos2s = (C.GPRASTERPOS2S)(getProcAddr(\"glRasterPos2s\"))\n\tif gpRasterPos2s == nil {\n\t\treturn errors.New(\"glRasterPos2s\")\n\t}\n\tgpRasterPos2sv = (C.GPRASTERPOS2SV)(getProcAddr(\"glRasterPos2sv\"))\n\tif gpRasterPos2sv == nil {\n\t\treturn errors.New(\"glRasterPos2sv\")\n\t}\n\tgpRasterPos2xOES = (C.GPRASTERPOS2XOES)(getProcAddr(\"glRasterPos2xOES\"))\n\tgpRasterPos2xvOES = (C.GPRASTERPOS2XVOES)(getProcAddr(\"glRasterPos2xvOES\"))\n\tgpRasterPos3d = (C.GPRASTERPOS3D)(getProcAddr(\"glRasterPos3d\"))\n\tif gpRasterPos3d == nil {\n\t\treturn errors.New(\"glRasterPos3d\")\n\t}\n\tgpRasterPos3dv = (C.GPRASTERPOS3DV)(getProcAddr(\"glRasterPos3dv\"))\n\tif gpRasterPos3dv == nil {\n\t\treturn errors.New(\"glRasterPos3dv\")\n\t}\n\tgpRasterPos3f = (C.GPRASTERPOS3F)(getProcAddr(\"glRasterPos3f\"))\n\tif gpRasterPos3f == nil {\n\t\treturn errors.New(\"glRasterPos3f\")\n\t}\n\tgpRasterPos3fv = (C.GPRASTERPOS3FV)(getProcAddr(\"glRasterPos3fv\"))\n\tif gpRasterPos3fv == nil {\n\t\treturn errors.New(\"glRasterPos3fv\")\n\t}\n\tgpRasterPos3i = (C.GPRASTERPOS3I)(getProcAddr(\"glRasterPos3i\"))\n\tif gpRasterPos3i == nil {\n\t\treturn errors.New(\"glRasterPos3i\")\n\t}\n\tgpRasterPos3iv = (C.GPRASTERPOS3IV)(getProcAddr(\"glRasterPos3iv\"))\n\tif gpRasterPos3iv == nil {\n\t\treturn errors.New(\"glRasterPos3iv\")\n\t}\n\tgpRasterPos3s = (C.GPRASTERPOS3S)(getProcAddr(\"glRasterPos3s\"))\n\tif gpRasterPos3s == nil {\n\t\treturn errors.New(\"glRasterPos3s\")\n\t}\n\tgpRasterPos3sv = (C.GPRASTERPOS3SV)(getProcAddr(\"glRasterPos3sv\"))\n\tif gpRasterPos3sv == nil {\n\t\treturn errors.New(\"glRasterPos3sv\")\n\t}\n\tgpRasterPos3xOES = (C.GPRASTERPOS3XOES)(getProcAddr(\"glRasterPos3xOES\"))\n\tgpRasterPos3xvOES = (C.GPRASTERPOS3XVOES)(getProcAddr(\"glRasterPos3xvOES\"))\n\tgpRasterPos4d = (C.GPRASTERPOS4D)(getProcAddr(\"glRasterPos4d\"))\n\tif gpRasterPos4d == nil {\n\t\treturn errors.New(\"glRasterPos4d\")\n\t}\n\tgpRasterPos4dv = (C.GPRASTERPOS4DV)(getProcAddr(\"glRasterPos4dv\"))\n\tif gpRasterPos4dv == nil {\n\t\treturn errors.New(\"glRasterPos4dv\")\n\t}\n\tgpRasterPos4f = (C.GPRASTERPOS4F)(getProcAddr(\"glRasterPos4f\"))\n\tif gpRasterPos4f == nil {\n\t\treturn errors.New(\"glRasterPos4f\")\n\t}\n\tgpRasterPos4fv = (C.GPRASTERPOS4FV)(getProcAddr(\"glRasterPos4fv\"))\n\tif gpRasterPos4fv == nil {\n\t\treturn errors.New(\"glRasterPos4fv\")\n\t}\n\tgpRasterPos4i = (C.GPRASTERPOS4I)(getProcAddr(\"glRasterPos4i\"))\n\tif gpRasterPos4i == nil {\n\t\treturn errors.New(\"glRasterPos4i\")\n\t}\n\tgpRasterPos4iv = (C.GPRASTERPOS4IV)(getProcAddr(\"glRasterPos4iv\"))\n\tif gpRasterPos4iv == nil {\n\t\treturn errors.New(\"glRasterPos4iv\")\n\t}\n\tgpRasterPos4s = (C.GPRASTERPOS4S)(getProcAddr(\"glRasterPos4s\"))\n\tif gpRasterPos4s == nil {\n\t\treturn errors.New(\"glRasterPos4s\")\n\t}\n\tgpRasterPos4sv = (C.GPRASTERPOS4SV)(getProcAddr(\"glRasterPos4sv\"))\n\tif gpRasterPos4sv == nil {\n\t\treturn errors.New(\"glRasterPos4sv\")\n\t}\n\tgpRasterPos4xOES = (C.GPRASTERPOS4XOES)(getProcAddr(\"glRasterPos4xOES\"))\n\tgpRasterPos4xvOES = (C.GPRASTERPOS4XVOES)(getProcAddr(\"glRasterPos4xvOES\"))\n\tgpRasterSamplesEXT = (C.GPRASTERSAMPLESEXT)(getProcAddr(\"glRasterSamplesEXT\"))\n\tgpReadBuffer = (C.GPREADBUFFER)(getProcAddr(\"glReadBuffer\"))\n\tif gpReadBuffer == nil {\n\t\treturn errors.New(\"glReadBuffer\")\n\t}\n\tgpReadInstrumentsSGIX = (C.GPREADINSTRUMENTSSGIX)(getProcAddr(\"glReadInstrumentsSGIX\"))\n\tgpReadPixels = (C.GPREADPIXELS)(getProcAddr(\"glReadPixels\"))\n\tif gpReadPixels == nil {\n\t\treturn errors.New(\"glReadPixels\")\n\t}\n\tgpReadnPixels = (C.GPREADNPIXELS)(getProcAddr(\"glReadnPixels\"))\n\tgpReadnPixelsARB = (C.GPREADNPIXELSARB)(getProcAddr(\"glReadnPixelsARB\"))\n\tgpReadnPixelsKHR = (C.GPREADNPIXELSKHR)(getProcAddr(\"glReadnPixelsKHR\"))\n\tgpRectd = (C.GPRECTD)(getProcAddr(\"glRectd\"))\n\tif gpRectd == nil {\n\t\treturn errors.New(\"glRectd\")\n\t}\n\tgpRectdv = (C.GPRECTDV)(getProcAddr(\"glRectdv\"))\n\tif gpRectdv == nil {\n\t\treturn errors.New(\"glRectdv\")\n\t}\n\tgpRectf = (C.GPRECTF)(getProcAddr(\"glRectf\"))\n\tif gpRectf == nil {\n\t\treturn errors.New(\"glRectf\")\n\t}\n\tgpRectfv = (C.GPRECTFV)(getProcAddr(\"glRectfv\"))\n\tif gpRectfv == nil {\n\t\treturn errors.New(\"glRectfv\")\n\t}\n\tgpRecti = (C.GPRECTI)(getProcAddr(\"glRecti\"))\n\tif gpRecti == nil {\n\t\treturn errors.New(\"glRecti\")\n\t}\n\tgpRectiv = (C.GPRECTIV)(getProcAddr(\"glRectiv\"))\n\tif gpRectiv == nil {\n\t\treturn errors.New(\"glRectiv\")\n\t}\n\tgpRects = (C.GPRECTS)(getProcAddr(\"glRects\"))\n\tif gpRects == nil {\n\t\treturn errors.New(\"glRects\")\n\t}\n\tgpRectsv = (C.GPRECTSV)(getProcAddr(\"glRectsv\"))\n\tif gpRectsv == nil {\n\t\treturn errors.New(\"glRectsv\")\n\t}\n\tgpRectxOES = (C.GPRECTXOES)(getProcAddr(\"glRectxOES\"))\n\tgpRectxvOES = (C.GPRECTXVOES)(getProcAddr(\"glRectxvOES\"))\n\tgpReferencePlaneSGIX = (C.GPREFERENCEPLANESGIX)(getProcAddr(\"glReferencePlaneSGIX\"))\n\tgpReleaseKeyedMutexWin32EXT = (C.GPRELEASEKEYEDMUTEXWIN32EXT)(getProcAddr(\"glReleaseKeyedMutexWin32EXT\"))\n\tgpReleaseShaderCompiler = (C.GPRELEASESHADERCOMPILER)(getProcAddr(\"glReleaseShaderCompiler\"))\n\tif gpReleaseShaderCompiler == nil {\n\t\treturn errors.New(\"glReleaseShaderCompiler\")\n\t}\n\tgpRenderGpuMaskNV = (C.GPRENDERGPUMASKNV)(getProcAddr(\"glRenderGpuMaskNV\"))\n\tgpRenderMode = (C.GPRENDERMODE)(getProcAddr(\"glRenderMode\"))\n\tif gpRenderMode == nil {\n\t\treturn errors.New(\"glRenderMode\")\n\t}\n\tgpRenderbufferStorage = (C.GPRENDERBUFFERSTORAGE)(getProcAddr(\"glRenderbufferStorage\"))\n\tif gpRenderbufferStorage == nil {\n\t\treturn errors.New(\"glRenderbufferStorage\")\n\t}\n\tgpRenderbufferStorageEXT = (C.GPRENDERBUFFERSTORAGEEXT)(getProcAddr(\"glRenderbufferStorageEXT\"))\n\tgpRenderbufferStorageMultisample = (C.GPRENDERBUFFERSTORAGEMULTISAMPLE)(getProcAddr(\"glRenderbufferStorageMultisample\"))\n\tif gpRenderbufferStorageMultisample == nil {\n\t\treturn errors.New(\"glRenderbufferStorageMultisample\")\n\t}\n\tgpRenderbufferStorageMultisampleAdvancedAMD = (C.GPRENDERBUFFERSTORAGEMULTISAMPLEADVANCEDAMD)(getProcAddr(\"glRenderbufferStorageMultisampleAdvancedAMD\"))\n\tgpRenderbufferStorageMultisampleCoverageNV = (C.GPRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENV)(getProcAddr(\"glRenderbufferStorageMultisampleCoverageNV\"))\n\tgpRenderbufferStorageMultisampleEXT = (C.GPRENDERBUFFERSTORAGEMULTISAMPLEEXT)(getProcAddr(\"glRenderbufferStorageMultisampleEXT\"))\n\tgpReplacementCodePointerSUN = (C.GPREPLACEMENTCODEPOINTERSUN)(getProcAddr(\"glReplacementCodePointerSUN\"))\n\tgpReplacementCodeubSUN = (C.GPREPLACEMENTCODEUBSUN)(getProcAddr(\"glReplacementCodeubSUN\"))\n\tgpReplacementCodeubvSUN = (C.GPREPLACEMENTCODEUBVSUN)(getProcAddr(\"glReplacementCodeubvSUN\"))\n\tgpReplacementCodeuiColor3fVertex3fSUN = (C.GPREPLACEMENTCODEUICOLOR3FVERTEX3FSUN)(getProcAddr(\"glReplacementCodeuiColor3fVertex3fSUN\"))\n\tgpReplacementCodeuiColor3fVertex3fvSUN = (C.GPREPLACEMENTCODEUICOLOR3FVERTEX3FVSUN)(getProcAddr(\"glReplacementCodeuiColor3fVertex3fvSUN\"))\n\tgpReplacementCodeuiColor4fNormal3fVertex3fSUN = (C.GPREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUN)(getProcAddr(\"glReplacementCodeuiColor4fNormal3fVertex3fSUN\"))\n\tgpReplacementCodeuiColor4fNormal3fVertex3fvSUN = (C.GPREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUN)(getProcAddr(\"glReplacementCodeuiColor4fNormal3fVertex3fvSUN\"))\n\tgpReplacementCodeuiColor4ubVertex3fSUN = (C.GPREPLACEMENTCODEUICOLOR4UBVERTEX3FSUN)(getProcAddr(\"glReplacementCodeuiColor4ubVertex3fSUN\"))\n\tgpReplacementCodeuiColor4ubVertex3fvSUN = (C.GPREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUN)(getProcAddr(\"glReplacementCodeuiColor4ubVertex3fvSUN\"))\n\tgpReplacementCodeuiNormal3fVertex3fSUN = (C.GPREPLACEMENTCODEUINORMAL3FVERTEX3FSUN)(getProcAddr(\"glReplacementCodeuiNormal3fVertex3fSUN\"))\n\tgpReplacementCodeuiNormal3fVertex3fvSUN = (C.GPREPLACEMENTCODEUINORMAL3FVERTEX3FVSUN)(getProcAddr(\"glReplacementCodeuiNormal3fVertex3fvSUN\"))\n\tgpReplacementCodeuiSUN = (C.GPREPLACEMENTCODEUISUN)(getProcAddr(\"glReplacementCodeuiSUN\"))\n\tgpReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN = (C.GPREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUN)(getProcAddr(\"glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN\"))\n\tgpReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN = (C.GPREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUN)(getProcAddr(\"glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN\"))\n\tgpReplacementCodeuiTexCoord2fNormal3fVertex3fSUN = (C.GPREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUN)(getProcAddr(\"glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN\"))\n\tgpReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN = (C.GPREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUN)(getProcAddr(\"glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN\"))\n\tgpReplacementCodeuiTexCoord2fVertex3fSUN = (C.GPREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUN)(getProcAddr(\"glReplacementCodeuiTexCoord2fVertex3fSUN\"))\n\tgpReplacementCodeuiTexCoord2fVertex3fvSUN = (C.GPREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUN)(getProcAddr(\"glReplacementCodeuiTexCoord2fVertex3fvSUN\"))\n\tgpReplacementCodeuiVertex3fSUN = (C.GPREPLACEMENTCODEUIVERTEX3FSUN)(getProcAddr(\"glReplacementCodeuiVertex3fSUN\"))\n\tgpReplacementCodeuiVertex3fvSUN = (C.GPREPLACEMENTCODEUIVERTEX3FVSUN)(getProcAddr(\"glReplacementCodeuiVertex3fvSUN\"))\n\tgpReplacementCodeuivSUN = (C.GPREPLACEMENTCODEUIVSUN)(getProcAddr(\"glReplacementCodeuivSUN\"))\n\tgpReplacementCodeusSUN = (C.GPREPLACEMENTCODEUSSUN)(getProcAddr(\"glReplacementCodeusSUN\"))\n\tgpReplacementCodeusvSUN = (C.GPREPLACEMENTCODEUSVSUN)(getProcAddr(\"glReplacementCodeusvSUN\"))\n\tgpRequestResidentProgramsNV = (C.GPREQUESTRESIDENTPROGRAMSNV)(getProcAddr(\"glRequestResidentProgramsNV\"))\n\tgpResetHistogram = (C.GPRESETHISTOGRAM)(getProcAddr(\"glResetHistogram\"))\n\tgpResetHistogramEXT = (C.GPRESETHISTOGRAMEXT)(getProcAddr(\"glResetHistogramEXT\"))\n\tgpResetMemoryObjectParameterNV = (C.GPRESETMEMORYOBJECTPARAMETERNV)(getProcAddr(\"glResetMemoryObjectParameterNV\"))\n\tgpResetMinmax = (C.GPRESETMINMAX)(getProcAddr(\"glResetMinmax\"))\n\tgpResetMinmaxEXT = (C.GPRESETMINMAXEXT)(getProcAddr(\"glResetMinmaxEXT\"))\n\tgpResizeBuffersMESA = (C.GPRESIZEBUFFERSMESA)(getProcAddr(\"glResizeBuffersMESA\"))\n\tgpResolveDepthValuesNV = (C.GPRESOLVEDEPTHVALUESNV)(getProcAddr(\"glResolveDepthValuesNV\"))\n\tgpResumeTransformFeedback = (C.GPRESUMETRANSFORMFEEDBACK)(getProcAddr(\"glResumeTransformFeedback\"))\n\tif gpResumeTransformFeedback == nil {\n\t\treturn errors.New(\"glResumeTransformFeedback\")\n\t}\n\tgpResumeTransformFeedbackNV = (C.GPRESUMETRANSFORMFEEDBACKNV)(getProcAddr(\"glResumeTransformFeedbackNV\"))\n\tgpRotated = (C.GPROTATED)(getProcAddr(\"glRotated\"))\n\tif gpRotated == nil {\n\t\treturn errors.New(\"glRotated\")\n\t}\n\tgpRotatef = (C.GPROTATEF)(getProcAddr(\"glRotatef\"))\n\tif gpRotatef == nil {\n\t\treturn errors.New(\"glRotatef\")\n\t}\n\tgpRotatexOES = (C.GPROTATEXOES)(getProcAddr(\"glRotatexOES\"))\n\tgpSampleCoverage = (C.GPSAMPLECOVERAGE)(getProcAddr(\"glSampleCoverage\"))\n\tif gpSampleCoverage == nil {\n\t\treturn errors.New(\"glSampleCoverage\")\n\t}\n\tgpSampleCoverageARB = (C.GPSAMPLECOVERAGEARB)(getProcAddr(\"glSampleCoverageARB\"))\n\tgpSampleCoveragexOES = (C.GPSAMPLECOVERAGEXOES)(getProcAddr(\"glSampleCoveragexOES\"))\n\tgpSampleMapATI = (C.GPSAMPLEMAPATI)(getProcAddr(\"glSampleMapATI\"))\n\tgpSampleMaskEXT = (C.GPSAMPLEMASKEXT)(getProcAddr(\"glSampleMaskEXT\"))\n\tgpSampleMaskIndexedNV = (C.GPSAMPLEMASKINDEXEDNV)(getProcAddr(\"glSampleMaskIndexedNV\"))\n\tgpSampleMaskSGIS = (C.GPSAMPLEMASKSGIS)(getProcAddr(\"glSampleMaskSGIS\"))\n\tgpSampleMaski = (C.GPSAMPLEMASKI)(getProcAddr(\"glSampleMaski\"))\n\tif gpSampleMaski == nil {\n\t\treturn errors.New(\"glSampleMaski\")\n\t}\n\tgpSamplePatternEXT = (C.GPSAMPLEPATTERNEXT)(getProcAddr(\"glSamplePatternEXT\"))\n\tgpSamplePatternSGIS = (C.GPSAMPLEPATTERNSGIS)(getProcAddr(\"glSamplePatternSGIS\"))\n\tgpSamplerParameterIiv = (C.GPSAMPLERPARAMETERIIV)(getProcAddr(\"glSamplerParameterIiv\"))\n\tif gpSamplerParameterIiv == nil {\n\t\treturn errors.New(\"glSamplerParameterIiv\")\n\t}\n\tgpSamplerParameterIuiv = (C.GPSAMPLERPARAMETERIUIV)(getProcAddr(\"glSamplerParameterIuiv\"))\n\tif gpSamplerParameterIuiv == nil {\n\t\treturn errors.New(\"glSamplerParameterIuiv\")\n\t}\n\tgpSamplerParameterf = (C.GPSAMPLERPARAMETERF)(getProcAddr(\"glSamplerParameterf\"))\n\tif gpSamplerParameterf == nil {\n\t\treturn errors.New(\"glSamplerParameterf\")\n\t}\n\tgpSamplerParameterfv = (C.GPSAMPLERPARAMETERFV)(getProcAddr(\"glSamplerParameterfv\"))\n\tif gpSamplerParameterfv == nil {\n\t\treturn errors.New(\"glSamplerParameterfv\")\n\t}\n\tgpSamplerParameteri = (C.GPSAMPLERPARAMETERI)(getProcAddr(\"glSamplerParameteri\"))\n\tif gpSamplerParameteri == nil {\n\t\treturn errors.New(\"glSamplerParameteri\")\n\t}\n\tgpSamplerParameteriv = (C.GPSAMPLERPARAMETERIV)(getProcAddr(\"glSamplerParameteriv\"))\n\tif gpSamplerParameteriv == nil {\n\t\treturn errors.New(\"glSamplerParameteriv\")\n\t}\n\tgpScaled = (C.GPSCALED)(getProcAddr(\"glScaled\"))\n\tif gpScaled == nil {\n\t\treturn errors.New(\"glScaled\")\n\t}\n\tgpScalef = (C.GPSCALEF)(getProcAddr(\"glScalef\"))\n\tif gpScalef == nil {\n\t\treturn errors.New(\"glScalef\")\n\t}\n\tgpScalexOES = (C.GPSCALEXOES)(getProcAddr(\"glScalexOES\"))\n\tgpScissor = (C.GPSCISSOR)(getProcAddr(\"glScissor\"))\n\tif gpScissor == nil {\n\t\treturn errors.New(\"glScissor\")\n\t}\n\tgpScissorArrayv = (C.GPSCISSORARRAYV)(getProcAddr(\"glScissorArrayv\"))\n\tif gpScissorArrayv == nil {\n\t\treturn errors.New(\"glScissorArrayv\")\n\t}\n\tgpScissorExclusiveArrayvNV = (C.GPSCISSOREXCLUSIVEARRAYVNV)(getProcAddr(\"glScissorExclusiveArrayvNV\"))\n\tgpScissorExclusiveNV = (C.GPSCISSOREXCLUSIVENV)(getProcAddr(\"glScissorExclusiveNV\"))\n\tgpScissorIndexed = (C.GPSCISSORINDEXED)(getProcAddr(\"glScissorIndexed\"))\n\tif gpScissorIndexed == nil {\n\t\treturn errors.New(\"glScissorIndexed\")\n\t}\n\tgpScissorIndexedv = (C.GPSCISSORINDEXEDV)(getProcAddr(\"glScissorIndexedv\"))\n\tif gpScissorIndexedv == nil {\n\t\treturn errors.New(\"glScissorIndexedv\")\n\t}\n\tgpSecondaryColor3b = (C.GPSECONDARYCOLOR3B)(getProcAddr(\"glSecondaryColor3b\"))\n\tif gpSecondaryColor3b == nil {\n\t\treturn errors.New(\"glSecondaryColor3b\")\n\t}\n\tgpSecondaryColor3bEXT = (C.GPSECONDARYCOLOR3BEXT)(getProcAddr(\"glSecondaryColor3bEXT\"))\n\tgpSecondaryColor3bv = (C.GPSECONDARYCOLOR3BV)(getProcAddr(\"glSecondaryColor3bv\"))\n\tif gpSecondaryColor3bv == nil {\n\t\treturn errors.New(\"glSecondaryColor3bv\")\n\t}\n\tgpSecondaryColor3bvEXT = (C.GPSECONDARYCOLOR3BVEXT)(getProcAddr(\"glSecondaryColor3bvEXT\"))\n\tgpSecondaryColor3d = (C.GPSECONDARYCOLOR3D)(getProcAddr(\"glSecondaryColor3d\"))\n\tif gpSecondaryColor3d == nil {\n\t\treturn errors.New(\"glSecondaryColor3d\")\n\t}\n\tgpSecondaryColor3dEXT = (C.GPSECONDARYCOLOR3DEXT)(getProcAddr(\"glSecondaryColor3dEXT\"))\n\tgpSecondaryColor3dv = (C.GPSECONDARYCOLOR3DV)(getProcAddr(\"glSecondaryColor3dv\"))\n\tif gpSecondaryColor3dv == nil {\n\t\treturn errors.New(\"glSecondaryColor3dv\")\n\t}\n\tgpSecondaryColor3dvEXT = (C.GPSECONDARYCOLOR3DVEXT)(getProcAddr(\"glSecondaryColor3dvEXT\"))\n\tgpSecondaryColor3f = (C.GPSECONDARYCOLOR3F)(getProcAddr(\"glSecondaryColor3f\"))\n\tif gpSecondaryColor3f == nil {\n\t\treturn errors.New(\"glSecondaryColor3f\")\n\t}\n\tgpSecondaryColor3fEXT = (C.GPSECONDARYCOLOR3FEXT)(getProcAddr(\"glSecondaryColor3fEXT\"))\n\tgpSecondaryColor3fv = (C.GPSECONDARYCOLOR3FV)(getProcAddr(\"glSecondaryColor3fv\"))\n\tif gpSecondaryColor3fv == nil {\n\t\treturn errors.New(\"glSecondaryColor3fv\")\n\t}\n\tgpSecondaryColor3fvEXT = (C.GPSECONDARYCOLOR3FVEXT)(getProcAddr(\"glSecondaryColor3fvEXT\"))\n\tgpSecondaryColor3hNV = (C.GPSECONDARYCOLOR3HNV)(getProcAddr(\"glSecondaryColor3hNV\"))\n\tgpSecondaryColor3hvNV = (C.GPSECONDARYCOLOR3HVNV)(getProcAddr(\"glSecondaryColor3hvNV\"))\n\tgpSecondaryColor3i = (C.GPSECONDARYCOLOR3I)(getProcAddr(\"glSecondaryColor3i\"))\n\tif gpSecondaryColor3i == nil {\n\t\treturn errors.New(\"glSecondaryColor3i\")\n\t}\n\tgpSecondaryColor3iEXT = (C.GPSECONDARYCOLOR3IEXT)(getProcAddr(\"glSecondaryColor3iEXT\"))\n\tgpSecondaryColor3iv = (C.GPSECONDARYCOLOR3IV)(getProcAddr(\"glSecondaryColor3iv\"))\n\tif gpSecondaryColor3iv == nil {\n\t\treturn errors.New(\"glSecondaryColor3iv\")\n\t}\n\tgpSecondaryColor3ivEXT = (C.GPSECONDARYCOLOR3IVEXT)(getProcAddr(\"glSecondaryColor3ivEXT\"))\n\tgpSecondaryColor3s = (C.GPSECONDARYCOLOR3S)(getProcAddr(\"glSecondaryColor3s\"))\n\tif gpSecondaryColor3s == nil {\n\t\treturn errors.New(\"glSecondaryColor3s\")\n\t}\n\tgpSecondaryColor3sEXT = (C.GPSECONDARYCOLOR3SEXT)(getProcAddr(\"glSecondaryColor3sEXT\"))\n\tgpSecondaryColor3sv = (C.GPSECONDARYCOLOR3SV)(getProcAddr(\"glSecondaryColor3sv\"))\n\tif gpSecondaryColor3sv == nil {\n\t\treturn errors.New(\"glSecondaryColor3sv\")\n\t}\n\tgpSecondaryColor3svEXT = (C.GPSECONDARYCOLOR3SVEXT)(getProcAddr(\"glSecondaryColor3svEXT\"))\n\tgpSecondaryColor3ub = (C.GPSECONDARYCOLOR3UB)(getProcAddr(\"glSecondaryColor3ub\"))\n\tif gpSecondaryColor3ub == nil {\n\t\treturn errors.New(\"glSecondaryColor3ub\")\n\t}\n\tgpSecondaryColor3ubEXT = (C.GPSECONDARYCOLOR3UBEXT)(getProcAddr(\"glSecondaryColor3ubEXT\"))\n\tgpSecondaryColor3ubv = (C.GPSECONDARYCOLOR3UBV)(getProcAddr(\"glSecondaryColor3ubv\"))\n\tif gpSecondaryColor3ubv == nil {\n\t\treturn errors.New(\"glSecondaryColor3ubv\")\n\t}\n\tgpSecondaryColor3ubvEXT = (C.GPSECONDARYCOLOR3UBVEXT)(getProcAddr(\"glSecondaryColor3ubvEXT\"))\n\tgpSecondaryColor3ui = (C.GPSECONDARYCOLOR3UI)(getProcAddr(\"glSecondaryColor3ui\"))\n\tif gpSecondaryColor3ui == nil {\n\t\treturn errors.New(\"glSecondaryColor3ui\")\n\t}\n\tgpSecondaryColor3uiEXT = (C.GPSECONDARYCOLOR3UIEXT)(getProcAddr(\"glSecondaryColor3uiEXT\"))\n\tgpSecondaryColor3uiv = (C.GPSECONDARYCOLOR3UIV)(getProcAddr(\"glSecondaryColor3uiv\"))\n\tif gpSecondaryColor3uiv == nil {\n\t\treturn errors.New(\"glSecondaryColor3uiv\")\n\t}\n\tgpSecondaryColor3uivEXT = (C.GPSECONDARYCOLOR3UIVEXT)(getProcAddr(\"glSecondaryColor3uivEXT\"))\n\tgpSecondaryColor3us = (C.GPSECONDARYCOLOR3US)(getProcAddr(\"glSecondaryColor3us\"))\n\tif gpSecondaryColor3us == nil {\n\t\treturn errors.New(\"glSecondaryColor3us\")\n\t}\n\tgpSecondaryColor3usEXT = (C.GPSECONDARYCOLOR3USEXT)(getProcAddr(\"glSecondaryColor3usEXT\"))\n\tgpSecondaryColor3usv = (C.GPSECONDARYCOLOR3USV)(getProcAddr(\"glSecondaryColor3usv\"))\n\tif gpSecondaryColor3usv == nil {\n\t\treturn errors.New(\"glSecondaryColor3usv\")\n\t}\n\tgpSecondaryColor3usvEXT = (C.GPSECONDARYCOLOR3USVEXT)(getProcAddr(\"glSecondaryColor3usvEXT\"))\n\tgpSecondaryColorFormatNV = (C.GPSECONDARYCOLORFORMATNV)(getProcAddr(\"glSecondaryColorFormatNV\"))\n\tgpSecondaryColorP3ui = (C.GPSECONDARYCOLORP3UI)(getProcAddr(\"glSecondaryColorP3ui\"))\n\tif gpSecondaryColorP3ui == nil {\n\t\treturn errors.New(\"glSecondaryColorP3ui\")\n\t}\n\tgpSecondaryColorP3uiv = (C.GPSECONDARYCOLORP3UIV)(getProcAddr(\"glSecondaryColorP3uiv\"))\n\tif gpSecondaryColorP3uiv == nil {\n\t\treturn errors.New(\"glSecondaryColorP3uiv\")\n\t}\n\tgpSecondaryColorPointer = (C.GPSECONDARYCOLORPOINTER)(getProcAddr(\"glSecondaryColorPointer\"))\n\tif gpSecondaryColorPointer == nil {\n\t\treturn errors.New(\"glSecondaryColorPointer\")\n\t}\n\tgpSecondaryColorPointerEXT = (C.GPSECONDARYCOLORPOINTEREXT)(getProcAddr(\"glSecondaryColorPointerEXT\"))\n\tgpSecondaryColorPointerListIBM = (C.GPSECONDARYCOLORPOINTERLISTIBM)(getProcAddr(\"glSecondaryColorPointerListIBM\"))\n\tgpSelectBuffer = (C.GPSELECTBUFFER)(getProcAddr(\"glSelectBuffer\"))\n\tif gpSelectBuffer == nil {\n\t\treturn errors.New(\"glSelectBuffer\")\n\t}\n\tgpSelectPerfMonitorCountersAMD = (C.GPSELECTPERFMONITORCOUNTERSAMD)(getProcAddr(\"glSelectPerfMonitorCountersAMD\"))\n\tgpSemaphoreParameterivNV = (C.GPSEMAPHOREPARAMETERIVNV)(getProcAddr(\"glSemaphoreParameterivNV\"))\n\tgpSemaphoreParameterui64vEXT = (C.GPSEMAPHOREPARAMETERUI64VEXT)(getProcAddr(\"glSemaphoreParameterui64vEXT\"))\n\tgpSeparableFilter2D = (C.GPSEPARABLEFILTER2D)(getProcAddr(\"glSeparableFilter2D\"))\n\tgpSeparableFilter2DEXT = (C.GPSEPARABLEFILTER2DEXT)(getProcAddr(\"glSeparableFilter2DEXT\"))\n\tgpSetFenceAPPLE = (C.GPSETFENCEAPPLE)(getProcAddr(\"glSetFenceAPPLE\"))\n\tgpSetFenceNV = (C.GPSETFENCENV)(getProcAddr(\"glSetFenceNV\"))\n\tgpSetFragmentShaderConstantATI = (C.GPSETFRAGMENTSHADERCONSTANTATI)(getProcAddr(\"glSetFragmentShaderConstantATI\"))\n\tgpSetInvariantEXT = (C.GPSETINVARIANTEXT)(getProcAddr(\"glSetInvariantEXT\"))\n\tgpSetLocalConstantEXT = (C.GPSETLOCALCONSTANTEXT)(getProcAddr(\"glSetLocalConstantEXT\"))\n\tgpSetMultisamplefvAMD = (C.GPSETMULTISAMPLEFVAMD)(getProcAddr(\"glSetMultisamplefvAMD\"))\n\tgpShadeModel = (C.GPSHADEMODEL)(getProcAddr(\"glShadeModel\"))\n\tif gpShadeModel == nil {\n\t\treturn errors.New(\"glShadeModel\")\n\t}\n\tgpShaderBinary = (C.GPSHADERBINARY)(getProcAddr(\"glShaderBinary\"))\n\tif gpShaderBinary == nil {\n\t\treturn errors.New(\"glShaderBinary\")\n\t}\n\tgpShaderOp1EXT = (C.GPSHADEROP1EXT)(getProcAddr(\"glShaderOp1EXT\"))\n\tgpShaderOp2EXT = (C.GPSHADEROP2EXT)(getProcAddr(\"glShaderOp2EXT\"))\n\tgpShaderOp3EXT = (C.GPSHADEROP3EXT)(getProcAddr(\"glShaderOp3EXT\"))\n\tgpShaderSource = (C.GPSHADERSOURCE)(getProcAddr(\"glShaderSource\"))\n\tif gpShaderSource == nil {\n\t\treturn errors.New(\"glShaderSource\")\n\t}\n\tgpShaderSourceARB = (C.GPSHADERSOURCEARB)(getProcAddr(\"glShaderSourceARB\"))\n\tgpShaderStorageBlockBinding = (C.GPSHADERSTORAGEBLOCKBINDING)(getProcAddr(\"glShaderStorageBlockBinding\"))\n\tif gpShaderStorageBlockBinding == nil {\n\t\treturn errors.New(\"glShaderStorageBlockBinding\")\n\t}\n\tgpShadingRateImageBarrierNV = (C.GPSHADINGRATEIMAGEBARRIERNV)(getProcAddr(\"glShadingRateImageBarrierNV\"))\n\tgpShadingRateImagePaletteNV = (C.GPSHADINGRATEIMAGEPALETTENV)(getProcAddr(\"glShadingRateImagePaletteNV\"))\n\tgpShadingRateSampleOrderCustomNV = (C.GPSHADINGRATESAMPLEORDERCUSTOMNV)(getProcAddr(\"glShadingRateSampleOrderCustomNV\"))\n\tgpShadingRateSampleOrderNV = (C.GPSHADINGRATESAMPLEORDERNV)(getProcAddr(\"glShadingRateSampleOrderNV\"))\n\tgpSharpenTexFuncSGIS = (C.GPSHARPENTEXFUNCSGIS)(getProcAddr(\"glSharpenTexFuncSGIS\"))\n\tgpSignalSemaphoreEXT = (C.GPSIGNALSEMAPHOREEXT)(getProcAddr(\"glSignalSemaphoreEXT\"))\n\tgpSignalSemaphoreui64NVX = (C.GPSIGNALSEMAPHOREUI64NVX)(getProcAddr(\"glSignalSemaphoreui64NVX\"))\n\tgpSignalVkFenceNV = (C.GPSIGNALVKFENCENV)(getProcAddr(\"glSignalVkFenceNV\"))\n\tgpSignalVkSemaphoreNV = (C.GPSIGNALVKSEMAPHORENV)(getProcAddr(\"glSignalVkSemaphoreNV\"))\n\tgpSpecializeShaderARB = (C.GPSPECIALIZESHADERARB)(getProcAddr(\"glSpecializeShaderARB\"))\n\tgpSpriteParameterfSGIX = (C.GPSPRITEPARAMETERFSGIX)(getProcAddr(\"glSpriteParameterfSGIX\"))\n\tgpSpriteParameterfvSGIX = (C.GPSPRITEPARAMETERFVSGIX)(getProcAddr(\"glSpriteParameterfvSGIX\"))\n\tgpSpriteParameteriSGIX = (C.GPSPRITEPARAMETERISGIX)(getProcAddr(\"glSpriteParameteriSGIX\"))\n\tgpSpriteParameterivSGIX = (C.GPSPRITEPARAMETERIVSGIX)(getProcAddr(\"glSpriteParameterivSGIX\"))\n\tgpStartInstrumentsSGIX = (C.GPSTARTINSTRUMENTSSGIX)(getProcAddr(\"glStartInstrumentsSGIX\"))\n\tgpStateCaptureNV = (C.GPSTATECAPTURENV)(getProcAddr(\"glStateCaptureNV\"))\n\tgpStencilClearTagEXT = (C.GPSTENCILCLEARTAGEXT)(getProcAddr(\"glStencilClearTagEXT\"))\n\tgpStencilFillPathInstancedNV = (C.GPSTENCILFILLPATHINSTANCEDNV)(getProcAddr(\"glStencilFillPathInstancedNV\"))\n\tgpStencilFillPathNV = (C.GPSTENCILFILLPATHNV)(getProcAddr(\"glStencilFillPathNV\"))\n\tgpStencilFunc = (C.GPSTENCILFUNC)(getProcAddr(\"glStencilFunc\"))\n\tif gpStencilFunc == nil {\n\t\treturn errors.New(\"glStencilFunc\")\n\t}\n\tgpStencilFuncSeparate = (C.GPSTENCILFUNCSEPARATE)(getProcAddr(\"glStencilFuncSeparate\"))\n\tif gpStencilFuncSeparate == nil {\n\t\treturn errors.New(\"glStencilFuncSeparate\")\n\t}\n\tgpStencilFuncSeparateATI = (C.GPSTENCILFUNCSEPARATEATI)(getProcAddr(\"glStencilFuncSeparateATI\"))\n\tgpStencilMask = (C.GPSTENCILMASK)(getProcAddr(\"glStencilMask\"))\n\tif gpStencilMask == nil {\n\t\treturn errors.New(\"glStencilMask\")\n\t}\n\tgpStencilMaskSeparate = (C.GPSTENCILMASKSEPARATE)(getProcAddr(\"glStencilMaskSeparate\"))\n\tif gpStencilMaskSeparate == nil {\n\t\treturn errors.New(\"glStencilMaskSeparate\")\n\t}\n\tgpStencilOp = (C.GPSTENCILOP)(getProcAddr(\"glStencilOp\"))\n\tif gpStencilOp == nil {\n\t\treturn errors.New(\"glStencilOp\")\n\t}\n\tgpStencilOpSeparate = (C.GPSTENCILOPSEPARATE)(getProcAddr(\"glStencilOpSeparate\"))\n\tif gpStencilOpSeparate == nil {\n\t\treturn errors.New(\"glStencilOpSeparate\")\n\t}\n\tgpStencilOpSeparateATI = (C.GPSTENCILOPSEPARATEATI)(getProcAddr(\"glStencilOpSeparateATI\"))\n\tgpStencilOpValueAMD = (C.GPSTENCILOPVALUEAMD)(getProcAddr(\"glStencilOpValueAMD\"))\n\tgpStencilStrokePathInstancedNV = (C.GPSTENCILSTROKEPATHINSTANCEDNV)(getProcAddr(\"glStencilStrokePathInstancedNV\"))\n\tgpStencilStrokePathNV = (C.GPSTENCILSTROKEPATHNV)(getProcAddr(\"glStencilStrokePathNV\"))\n\tgpStencilThenCoverFillPathInstancedNV = (C.GPSTENCILTHENCOVERFILLPATHINSTANCEDNV)(getProcAddr(\"glStencilThenCoverFillPathInstancedNV\"))\n\tgpStencilThenCoverFillPathNV = (C.GPSTENCILTHENCOVERFILLPATHNV)(getProcAddr(\"glStencilThenCoverFillPathNV\"))\n\tgpStencilThenCoverStrokePathInstancedNV = (C.GPSTENCILTHENCOVERSTROKEPATHINSTANCEDNV)(getProcAddr(\"glStencilThenCoverStrokePathInstancedNV\"))\n\tgpStencilThenCoverStrokePathNV = (C.GPSTENCILTHENCOVERSTROKEPATHNV)(getProcAddr(\"glStencilThenCoverStrokePathNV\"))\n\tgpStopInstrumentsSGIX = (C.GPSTOPINSTRUMENTSSGIX)(getProcAddr(\"glStopInstrumentsSGIX\"))\n\tgpStringMarkerGREMEDY = (C.GPSTRINGMARKERGREMEDY)(getProcAddr(\"glStringMarkerGREMEDY\"))\n\tgpSubpixelPrecisionBiasNV = (C.GPSUBPIXELPRECISIONBIASNV)(getProcAddr(\"glSubpixelPrecisionBiasNV\"))\n\tgpSwizzleEXT = (C.GPSWIZZLEEXT)(getProcAddr(\"glSwizzleEXT\"))\n\tgpSyncTextureINTEL = (C.GPSYNCTEXTUREINTEL)(getProcAddr(\"glSyncTextureINTEL\"))\n\tgpTagSampleBufferSGIX = (C.GPTAGSAMPLEBUFFERSGIX)(getProcAddr(\"glTagSampleBufferSGIX\"))\n\tgpTangent3bEXT = (C.GPTANGENT3BEXT)(getProcAddr(\"glTangent3bEXT\"))\n\tgpTangent3bvEXT = (C.GPTANGENT3BVEXT)(getProcAddr(\"glTangent3bvEXT\"))\n\tgpTangent3dEXT = (C.GPTANGENT3DEXT)(getProcAddr(\"glTangent3dEXT\"))\n\tgpTangent3dvEXT = (C.GPTANGENT3DVEXT)(getProcAddr(\"glTangent3dvEXT\"))\n\tgpTangent3fEXT = (C.GPTANGENT3FEXT)(getProcAddr(\"glTangent3fEXT\"))\n\tgpTangent3fvEXT = (C.GPTANGENT3FVEXT)(getProcAddr(\"glTangent3fvEXT\"))\n\tgpTangent3iEXT = (C.GPTANGENT3IEXT)(getProcAddr(\"glTangent3iEXT\"))\n\tgpTangent3ivEXT = (C.GPTANGENT3IVEXT)(getProcAddr(\"glTangent3ivEXT\"))\n\tgpTangent3sEXT = (C.GPTANGENT3SEXT)(getProcAddr(\"glTangent3sEXT\"))\n\tgpTangent3svEXT = (C.GPTANGENT3SVEXT)(getProcAddr(\"glTangent3svEXT\"))\n\tgpTangentPointerEXT = (C.GPTANGENTPOINTEREXT)(getProcAddr(\"glTangentPointerEXT\"))\n\tgpTbufferMask3DFX = (C.GPTBUFFERMASK3DFX)(getProcAddr(\"glTbufferMask3DFX\"))\n\tgpTessellationFactorAMD = (C.GPTESSELLATIONFACTORAMD)(getProcAddr(\"glTessellationFactorAMD\"))\n\tgpTessellationModeAMD = (C.GPTESSELLATIONMODEAMD)(getProcAddr(\"glTessellationModeAMD\"))\n\tgpTestFenceAPPLE = (C.GPTESTFENCEAPPLE)(getProcAddr(\"glTestFenceAPPLE\"))\n\tgpTestFenceNV = (C.GPTESTFENCENV)(getProcAddr(\"glTestFenceNV\"))\n\tgpTestObjectAPPLE = (C.GPTESTOBJECTAPPLE)(getProcAddr(\"glTestObjectAPPLE\"))\n\tgpTexAttachMemoryNV = (C.GPTEXATTACHMEMORYNV)(getProcAddr(\"glTexAttachMemoryNV\"))\n\tgpTexBuffer = (C.GPTEXBUFFER)(getProcAddr(\"glTexBuffer\"))\n\tif gpTexBuffer == nil {\n\t\treturn errors.New(\"glTexBuffer\")\n\t}\n\tgpTexBufferARB = (C.GPTEXBUFFERARB)(getProcAddr(\"glTexBufferARB\"))\n\tgpTexBufferEXT = (C.GPTEXBUFFEREXT)(getProcAddr(\"glTexBufferEXT\"))\n\tgpTexBufferRange = (C.GPTEXBUFFERRANGE)(getProcAddr(\"glTexBufferRange\"))\n\tif gpTexBufferRange == nil {\n\t\treturn errors.New(\"glTexBufferRange\")\n\t}\n\tgpTexBumpParameterfvATI = (C.GPTEXBUMPPARAMETERFVATI)(getProcAddr(\"glTexBumpParameterfvATI\"))\n\tgpTexBumpParameterivATI = (C.GPTEXBUMPPARAMETERIVATI)(getProcAddr(\"glTexBumpParameterivATI\"))\n\tgpTexCoord1bOES = (C.GPTEXCOORD1BOES)(getProcAddr(\"glTexCoord1bOES\"))\n\tgpTexCoord1bvOES = (C.GPTEXCOORD1BVOES)(getProcAddr(\"glTexCoord1bvOES\"))\n\tgpTexCoord1d = (C.GPTEXCOORD1D)(getProcAddr(\"glTexCoord1d\"))\n\tif gpTexCoord1d == nil {\n\t\treturn errors.New(\"glTexCoord1d\")\n\t}\n\tgpTexCoord1dv = (C.GPTEXCOORD1DV)(getProcAddr(\"glTexCoord1dv\"))\n\tif gpTexCoord1dv == nil {\n\t\treturn errors.New(\"glTexCoord1dv\")\n\t}\n\tgpTexCoord1f = (C.GPTEXCOORD1F)(getProcAddr(\"glTexCoord1f\"))\n\tif gpTexCoord1f == nil {\n\t\treturn errors.New(\"glTexCoord1f\")\n\t}\n\tgpTexCoord1fv = (C.GPTEXCOORD1FV)(getProcAddr(\"glTexCoord1fv\"))\n\tif gpTexCoord1fv == nil {\n\t\treturn errors.New(\"glTexCoord1fv\")\n\t}\n\tgpTexCoord1hNV = (C.GPTEXCOORD1HNV)(getProcAddr(\"glTexCoord1hNV\"))\n\tgpTexCoord1hvNV = (C.GPTEXCOORD1HVNV)(getProcAddr(\"glTexCoord1hvNV\"))\n\tgpTexCoord1i = (C.GPTEXCOORD1I)(getProcAddr(\"glTexCoord1i\"))\n\tif gpTexCoord1i == nil {\n\t\treturn errors.New(\"glTexCoord1i\")\n\t}\n\tgpTexCoord1iv = (C.GPTEXCOORD1IV)(getProcAddr(\"glTexCoord1iv\"))\n\tif gpTexCoord1iv == nil {\n\t\treturn errors.New(\"glTexCoord1iv\")\n\t}\n\tgpTexCoord1s = (C.GPTEXCOORD1S)(getProcAddr(\"glTexCoord1s\"))\n\tif gpTexCoord1s == nil {\n\t\treturn errors.New(\"glTexCoord1s\")\n\t}\n\tgpTexCoord1sv = (C.GPTEXCOORD1SV)(getProcAddr(\"glTexCoord1sv\"))\n\tif gpTexCoord1sv == nil {\n\t\treturn errors.New(\"glTexCoord1sv\")\n\t}\n\tgpTexCoord1xOES = (C.GPTEXCOORD1XOES)(getProcAddr(\"glTexCoord1xOES\"))\n\tgpTexCoord1xvOES = (C.GPTEXCOORD1XVOES)(getProcAddr(\"glTexCoord1xvOES\"))\n\tgpTexCoord2bOES = (C.GPTEXCOORD2BOES)(getProcAddr(\"glTexCoord2bOES\"))\n\tgpTexCoord2bvOES = (C.GPTEXCOORD2BVOES)(getProcAddr(\"glTexCoord2bvOES\"))\n\tgpTexCoord2d = (C.GPTEXCOORD2D)(getProcAddr(\"glTexCoord2d\"))\n\tif gpTexCoord2d == nil {\n\t\treturn errors.New(\"glTexCoord2d\")\n\t}\n\tgpTexCoord2dv = (C.GPTEXCOORD2DV)(getProcAddr(\"glTexCoord2dv\"))\n\tif gpTexCoord2dv == nil {\n\t\treturn errors.New(\"glTexCoord2dv\")\n\t}\n\tgpTexCoord2f = (C.GPTEXCOORD2F)(getProcAddr(\"glTexCoord2f\"))\n\tif gpTexCoord2f == nil {\n\t\treturn errors.New(\"glTexCoord2f\")\n\t}\n\tgpTexCoord2fColor3fVertex3fSUN = (C.GPTEXCOORD2FCOLOR3FVERTEX3FSUN)(getProcAddr(\"glTexCoord2fColor3fVertex3fSUN\"))\n\tgpTexCoord2fColor3fVertex3fvSUN = (C.GPTEXCOORD2FCOLOR3FVERTEX3FVSUN)(getProcAddr(\"glTexCoord2fColor3fVertex3fvSUN\"))\n\tgpTexCoord2fColor4fNormal3fVertex3fSUN = (C.GPTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUN)(getProcAddr(\"glTexCoord2fColor4fNormal3fVertex3fSUN\"))\n\tgpTexCoord2fColor4fNormal3fVertex3fvSUN = (C.GPTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUN)(getProcAddr(\"glTexCoord2fColor4fNormal3fVertex3fvSUN\"))\n\tgpTexCoord2fColor4ubVertex3fSUN = (C.GPTEXCOORD2FCOLOR4UBVERTEX3FSUN)(getProcAddr(\"glTexCoord2fColor4ubVertex3fSUN\"))\n\tgpTexCoord2fColor4ubVertex3fvSUN = (C.GPTEXCOORD2FCOLOR4UBVERTEX3FVSUN)(getProcAddr(\"glTexCoord2fColor4ubVertex3fvSUN\"))\n\tgpTexCoord2fNormal3fVertex3fSUN = (C.GPTEXCOORD2FNORMAL3FVERTEX3FSUN)(getProcAddr(\"glTexCoord2fNormal3fVertex3fSUN\"))\n\tgpTexCoord2fNormal3fVertex3fvSUN = (C.GPTEXCOORD2FNORMAL3FVERTEX3FVSUN)(getProcAddr(\"glTexCoord2fNormal3fVertex3fvSUN\"))\n\tgpTexCoord2fVertex3fSUN = (C.GPTEXCOORD2FVERTEX3FSUN)(getProcAddr(\"glTexCoord2fVertex3fSUN\"))\n\tgpTexCoord2fVertex3fvSUN = (C.GPTEXCOORD2FVERTEX3FVSUN)(getProcAddr(\"glTexCoord2fVertex3fvSUN\"))\n\tgpTexCoord2fv = (C.GPTEXCOORD2FV)(getProcAddr(\"glTexCoord2fv\"))\n\tif gpTexCoord2fv == nil {\n\t\treturn errors.New(\"glTexCoord2fv\")\n\t}\n\tgpTexCoord2hNV = (C.GPTEXCOORD2HNV)(getProcAddr(\"glTexCoord2hNV\"))\n\tgpTexCoord2hvNV = (C.GPTEXCOORD2HVNV)(getProcAddr(\"glTexCoord2hvNV\"))\n\tgpTexCoord2i = (C.GPTEXCOORD2I)(getProcAddr(\"glTexCoord2i\"))\n\tif gpTexCoord2i == nil {\n\t\treturn errors.New(\"glTexCoord2i\")\n\t}\n\tgpTexCoord2iv = (C.GPTEXCOORD2IV)(getProcAddr(\"glTexCoord2iv\"))\n\tif gpTexCoord2iv == nil {\n\t\treturn errors.New(\"glTexCoord2iv\")\n\t}\n\tgpTexCoord2s = (C.GPTEXCOORD2S)(getProcAddr(\"glTexCoord2s\"))\n\tif gpTexCoord2s == nil {\n\t\treturn errors.New(\"glTexCoord2s\")\n\t}\n\tgpTexCoord2sv = (C.GPTEXCOORD2SV)(getProcAddr(\"glTexCoord2sv\"))\n\tif gpTexCoord2sv == nil {\n\t\treturn errors.New(\"glTexCoord2sv\")\n\t}\n\tgpTexCoord2xOES = (C.GPTEXCOORD2XOES)(getProcAddr(\"glTexCoord2xOES\"))\n\tgpTexCoord2xvOES = (C.GPTEXCOORD2XVOES)(getProcAddr(\"glTexCoord2xvOES\"))\n\tgpTexCoord3bOES = (C.GPTEXCOORD3BOES)(getProcAddr(\"glTexCoord3bOES\"))\n\tgpTexCoord3bvOES = (C.GPTEXCOORD3BVOES)(getProcAddr(\"glTexCoord3bvOES\"))\n\tgpTexCoord3d = (C.GPTEXCOORD3D)(getProcAddr(\"glTexCoord3d\"))\n\tif gpTexCoord3d == nil {\n\t\treturn errors.New(\"glTexCoord3d\")\n\t}\n\tgpTexCoord3dv = (C.GPTEXCOORD3DV)(getProcAddr(\"glTexCoord3dv\"))\n\tif gpTexCoord3dv == nil {\n\t\treturn errors.New(\"glTexCoord3dv\")\n\t}\n\tgpTexCoord3f = (C.GPTEXCOORD3F)(getProcAddr(\"glTexCoord3f\"))\n\tif gpTexCoord3f == nil {\n\t\treturn errors.New(\"glTexCoord3f\")\n\t}\n\tgpTexCoord3fv = (C.GPTEXCOORD3FV)(getProcAddr(\"glTexCoord3fv\"))\n\tif gpTexCoord3fv == nil {\n\t\treturn errors.New(\"glTexCoord3fv\")\n\t}\n\tgpTexCoord3hNV = (C.GPTEXCOORD3HNV)(getProcAddr(\"glTexCoord3hNV\"))\n\tgpTexCoord3hvNV = (C.GPTEXCOORD3HVNV)(getProcAddr(\"glTexCoord3hvNV\"))\n\tgpTexCoord3i = (C.GPTEXCOORD3I)(getProcAddr(\"glTexCoord3i\"))\n\tif gpTexCoord3i == nil {\n\t\treturn errors.New(\"glTexCoord3i\")\n\t}\n\tgpTexCoord3iv = (C.GPTEXCOORD3IV)(getProcAddr(\"glTexCoord3iv\"))\n\tif gpTexCoord3iv == nil {\n\t\treturn errors.New(\"glTexCoord3iv\")\n\t}\n\tgpTexCoord3s = (C.GPTEXCOORD3S)(getProcAddr(\"glTexCoord3s\"))\n\tif gpTexCoord3s == nil {\n\t\treturn errors.New(\"glTexCoord3s\")\n\t}\n\tgpTexCoord3sv = (C.GPTEXCOORD3SV)(getProcAddr(\"glTexCoord3sv\"))\n\tif gpTexCoord3sv == nil {\n\t\treturn errors.New(\"glTexCoord3sv\")\n\t}\n\tgpTexCoord3xOES = (C.GPTEXCOORD3XOES)(getProcAddr(\"glTexCoord3xOES\"))\n\tgpTexCoord3xvOES = (C.GPTEXCOORD3XVOES)(getProcAddr(\"glTexCoord3xvOES\"))\n\tgpTexCoord4bOES = (C.GPTEXCOORD4BOES)(getProcAddr(\"glTexCoord4bOES\"))\n\tgpTexCoord4bvOES = (C.GPTEXCOORD4BVOES)(getProcAddr(\"glTexCoord4bvOES\"))\n\tgpTexCoord4d = (C.GPTEXCOORD4D)(getProcAddr(\"glTexCoord4d\"))\n\tif gpTexCoord4d == nil {\n\t\treturn errors.New(\"glTexCoord4d\")\n\t}\n\tgpTexCoord4dv = (C.GPTEXCOORD4DV)(getProcAddr(\"glTexCoord4dv\"))\n\tif gpTexCoord4dv == nil {\n\t\treturn errors.New(\"glTexCoord4dv\")\n\t}\n\tgpTexCoord4f = (C.GPTEXCOORD4F)(getProcAddr(\"glTexCoord4f\"))\n\tif gpTexCoord4f == nil {\n\t\treturn errors.New(\"glTexCoord4f\")\n\t}\n\tgpTexCoord4fColor4fNormal3fVertex4fSUN = (C.GPTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUN)(getProcAddr(\"glTexCoord4fColor4fNormal3fVertex4fSUN\"))\n\tgpTexCoord4fColor4fNormal3fVertex4fvSUN = (C.GPTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUN)(getProcAddr(\"glTexCoord4fColor4fNormal3fVertex4fvSUN\"))\n\tgpTexCoord4fVertex4fSUN = (C.GPTEXCOORD4FVERTEX4FSUN)(getProcAddr(\"glTexCoord4fVertex4fSUN\"))\n\tgpTexCoord4fVertex4fvSUN = (C.GPTEXCOORD4FVERTEX4FVSUN)(getProcAddr(\"glTexCoord4fVertex4fvSUN\"))\n\tgpTexCoord4fv = (C.GPTEXCOORD4FV)(getProcAddr(\"glTexCoord4fv\"))\n\tif gpTexCoord4fv == nil {\n\t\treturn errors.New(\"glTexCoord4fv\")\n\t}\n\tgpTexCoord4hNV = (C.GPTEXCOORD4HNV)(getProcAddr(\"glTexCoord4hNV\"))\n\tgpTexCoord4hvNV = (C.GPTEXCOORD4HVNV)(getProcAddr(\"glTexCoord4hvNV\"))\n\tgpTexCoord4i = (C.GPTEXCOORD4I)(getProcAddr(\"glTexCoord4i\"))\n\tif gpTexCoord4i == nil {\n\t\treturn errors.New(\"glTexCoord4i\")\n\t}\n\tgpTexCoord4iv = (C.GPTEXCOORD4IV)(getProcAddr(\"glTexCoord4iv\"))\n\tif gpTexCoord4iv == nil {\n\t\treturn errors.New(\"glTexCoord4iv\")\n\t}\n\tgpTexCoord4s = (C.GPTEXCOORD4S)(getProcAddr(\"glTexCoord4s\"))\n\tif gpTexCoord4s == nil {\n\t\treturn errors.New(\"glTexCoord4s\")\n\t}\n\tgpTexCoord4sv = (C.GPTEXCOORD4SV)(getProcAddr(\"glTexCoord4sv\"))\n\tif gpTexCoord4sv == nil {\n\t\treturn errors.New(\"glTexCoord4sv\")\n\t}\n\tgpTexCoord4xOES = (C.GPTEXCOORD4XOES)(getProcAddr(\"glTexCoord4xOES\"))\n\tgpTexCoord4xvOES = (C.GPTEXCOORD4XVOES)(getProcAddr(\"glTexCoord4xvOES\"))\n\tgpTexCoordFormatNV = (C.GPTEXCOORDFORMATNV)(getProcAddr(\"glTexCoordFormatNV\"))\n\tgpTexCoordP1ui = (C.GPTEXCOORDP1UI)(getProcAddr(\"glTexCoordP1ui\"))\n\tif gpTexCoordP1ui == nil {\n\t\treturn errors.New(\"glTexCoordP1ui\")\n\t}\n\tgpTexCoordP1uiv = (C.GPTEXCOORDP1UIV)(getProcAddr(\"glTexCoordP1uiv\"))\n\tif gpTexCoordP1uiv == nil {\n\t\treturn errors.New(\"glTexCoordP1uiv\")\n\t}\n\tgpTexCoordP2ui = (C.GPTEXCOORDP2UI)(getProcAddr(\"glTexCoordP2ui\"))\n\tif gpTexCoordP2ui == nil {\n\t\treturn errors.New(\"glTexCoordP2ui\")\n\t}\n\tgpTexCoordP2uiv = (C.GPTEXCOORDP2UIV)(getProcAddr(\"glTexCoordP2uiv\"))\n\tif gpTexCoordP2uiv == nil {\n\t\treturn errors.New(\"glTexCoordP2uiv\")\n\t}\n\tgpTexCoordP3ui = (C.GPTEXCOORDP3UI)(getProcAddr(\"glTexCoordP3ui\"))\n\tif gpTexCoordP3ui == nil {\n\t\treturn errors.New(\"glTexCoordP3ui\")\n\t}\n\tgpTexCoordP3uiv = (C.GPTEXCOORDP3UIV)(getProcAddr(\"glTexCoordP3uiv\"))\n\tif gpTexCoordP3uiv == nil {\n\t\treturn errors.New(\"glTexCoordP3uiv\")\n\t}\n\tgpTexCoordP4ui = (C.GPTEXCOORDP4UI)(getProcAddr(\"glTexCoordP4ui\"))\n\tif gpTexCoordP4ui == nil {\n\t\treturn errors.New(\"glTexCoordP4ui\")\n\t}\n\tgpTexCoordP4uiv = (C.GPTEXCOORDP4UIV)(getProcAddr(\"glTexCoordP4uiv\"))\n\tif gpTexCoordP4uiv == nil {\n\t\treturn errors.New(\"glTexCoordP4uiv\")\n\t}\n\tgpTexCoordPointer = (C.GPTEXCOORDPOINTER)(getProcAddr(\"glTexCoordPointer\"))\n\tif gpTexCoordPointer == nil {\n\t\treturn errors.New(\"glTexCoordPointer\")\n\t}\n\tgpTexCoordPointerEXT = (C.GPTEXCOORDPOINTEREXT)(getProcAddr(\"glTexCoordPointerEXT\"))\n\tgpTexCoordPointerListIBM = (C.GPTEXCOORDPOINTERLISTIBM)(getProcAddr(\"glTexCoordPointerListIBM\"))\n\tgpTexCoordPointervINTEL = (C.GPTEXCOORDPOINTERVINTEL)(getProcAddr(\"glTexCoordPointervINTEL\"))\n\tgpTexEnvf = (C.GPTEXENVF)(getProcAddr(\"glTexEnvf\"))\n\tif gpTexEnvf == nil {\n\t\treturn errors.New(\"glTexEnvf\")\n\t}\n\tgpTexEnvfv = (C.GPTEXENVFV)(getProcAddr(\"glTexEnvfv\"))\n\tif gpTexEnvfv == nil {\n\t\treturn errors.New(\"glTexEnvfv\")\n\t}\n\tgpTexEnvi = (C.GPTEXENVI)(getProcAddr(\"glTexEnvi\"))\n\tif gpTexEnvi == nil {\n\t\treturn errors.New(\"glTexEnvi\")\n\t}\n\tgpTexEnviv = (C.GPTEXENVIV)(getProcAddr(\"glTexEnviv\"))\n\tif gpTexEnviv == nil {\n\t\treturn errors.New(\"glTexEnviv\")\n\t}\n\tgpTexEnvxOES = (C.GPTEXENVXOES)(getProcAddr(\"glTexEnvxOES\"))\n\tgpTexEnvxvOES = (C.GPTEXENVXVOES)(getProcAddr(\"glTexEnvxvOES\"))\n\tgpTexFilterFuncSGIS = (C.GPTEXFILTERFUNCSGIS)(getProcAddr(\"glTexFilterFuncSGIS\"))\n\tgpTexGend = (C.GPTEXGEND)(getProcAddr(\"glTexGend\"))\n\tif gpTexGend == nil {\n\t\treturn errors.New(\"glTexGend\")\n\t}\n\tgpTexGendv = (C.GPTEXGENDV)(getProcAddr(\"glTexGendv\"))\n\tif gpTexGendv == nil {\n\t\treturn errors.New(\"glTexGendv\")\n\t}\n\tgpTexGenf = (C.GPTEXGENF)(getProcAddr(\"glTexGenf\"))\n\tif gpTexGenf == nil {\n\t\treturn errors.New(\"glTexGenf\")\n\t}\n\tgpTexGenfv = (C.GPTEXGENFV)(getProcAddr(\"glTexGenfv\"))\n\tif gpTexGenfv == nil {\n\t\treturn errors.New(\"glTexGenfv\")\n\t}\n\tgpTexGeni = (C.GPTEXGENI)(getProcAddr(\"glTexGeni\"))\n\tif gpTexGeni == nil {\n\t\treturn errors.New(\"glTexGeni\")\n\t}\n\tgpTexGeniv = (C.GPTEXGENIV)(getProcAddr(\"glTexGeniv\"))\n\tif gpTexGeniv == nil {\n\t\treturn errors.New(\"glTexGeniv\")\n\t}\n\tgpTexGenxOES = (C.GPTEXGENXOES)(getProcAddr(\"glTexGenxOES\"))\n\tgpTexGenxvOES = (C.GPTEXGENXVOES)(getProcAddr(\"glTexGenxvOES\"))\n\tgpTexImage1D = (C.GPTEXIMAGE1D)(getProcAddr(\"glTexImage1D\"))\n\tif gpTexImage1D == nil {\n\t\treturn errors.New(\"glTexImage1D\")\n\t}\n\tgpTexImage2D = (C.GPTEXIMAGE2D)(getProcAddr(\"glTexImage2D\"))\n\tif gpTexImage2D == nil {\n\t\treturn errors.New(\"glTexImage2D\")\n\t}\n\tgpTexImage2DMultisample = (C.GPTEXIMAGE2DMULTISAMPLE)(getProcAddr(\"glTexImage2DMultisample\"))\n\tif gpTexImage2DMultisample == nil {\n\t\treturn errors.New(\"glTexImage2DMultisample\")\n\t}\n\tgpTexImage2DMultisampleCoverageNV = (C.GPTEXIMAGE2DMULTISAMPLECOVERAGENV)(getProcAddr(\"glTexImage2DMultisampleCoverageNV\"))\n\tgpTexImage3D = (C.GPTEXIMAGE3D)(getProcAddr(\"glTexImage3D\"))\n\tif gpTexImage3D == nil {\n\t\treturn errors.New(\"glTexImage3D\")\n\t}\n\tgpTexImage3DEXT = (C.GPTEXIMAGE3DEXT)(getProcAddr(\"glTexImage3DEXT\"))\n\tgpTexImage3DMultisample = (C.GPTEXIMAGE3DMULTISAMPLE)(getProcAddr(\"glTexImage3DMultisample\"))\n\tif gpTexImage3DMultisample == nil {\n\t\treturn errors.New(\"glTexImage3DMultisample\")\n\t}\n\tgpTexImage3DMultisampleCoverageNV = (C.GPTEXIMAGE3DMULTISAMPLECOVERAGENV)(getProcAddr(\"glTexImage3DMultisampleCoverageNV\"))\n\tgpTexImage4DSGIS = (C.GPTEXIMAGE4DSGIS)(getProcAddr(\"glTexImage4DSGIS\"))\n\tgpTexPageCommitmentARB = (C.GPTEXPAGECOMMITMENTARB)(getProcAddr(\"glTexPageCommitmentARB\"))\n\tgpTexPageCommitmentMemNV = (C.GPTEXPAGECOMMITMENTMEMNV)(getProcAddr(\"glTexPageCommitmentMemNV\"))\n\tgpTexParameterIiv = (C.GPTEXPARAMETERIIV)(getProcAddr(\"glTexParameterIiv\"))\n\tif gpTexParameterIiv == nil {\n\t\treturn errors.New(\"glTexParameterIiv\")\n\t}\n\tgpTexParameterIivEXT = (C.GPTEXPARAMETERIIVEXT)(getProcAddr(\"glTexParameterIivEXT\"))\n\tgpTexParameterIuiv = (C.GPTEXPARAMETERIUIV)(getProcAddr(\"glTexParameterIuiv\"))\n\tif gpTexParameterIuiv == nil {\n\t\treturn errors.New(\"glTexParameterIuiv\")\n\t}\n\tgpTexParameterIuivEXT = (C.GPTEXPARAMETERIUIVEXT)(getProcAddr(\"glTexParameterIuivEXT\"))\n\tgpTexParameterf = (C.GPTEXPARAMETERF)(getProcAddr(\"glTexParameterf\"))\n\tif gpTexParameterf == nil {\n\t\treturn errors.New(\"glTexParameterf\")\n\t}\n\tgpTexParameterfv = (C.GPTEXPARAMETERFV)(getProcAddr(\"glTexParameterfv\"))\n\tif gpTexParameterfv == nil {\n\t\treturn errors.New(\"glTexParameterfv\")\n\t}\n\tgpTexParameteri = (C.GPTEXPARAMETERI)(getProcAddr(\"glTexParameteri\"))\n\tif gpTexParameteri == nil {\n\t\treturn errors.New(\"glTexParameteri\")\n\t}\n\tgpTexParameteriv = (C.GPTEXPARAMETERIV)(getProcAddr(\"glTexParameteriv\"))\n\tif gpTexParameteriv == nil {\n\t\treturn errors.New(\"glTexParameteriv\")\n\t}\n\tgpTexParameterxOES = (C.GPTEXPARAMETERXOES)(getProcAddr(\"glTexParameterxOES\"))\n\tgpTexParameterxvOES = (C.GPTEXPARAMETERXVOES)(getProcAddr(\"glTexParameterxvOES\"))\n\tgpTexRenderbufferNV = (C.GPTEXRENDERBUFFERNV)(getProcAddr(\"glTexRenderbufferNV\"))\n\tgpTexStorage1D = (C.GPTEXSTORAGE1D)(getProcAddr(\"glTexStorage1D\"))\n\tif gpTexStorage1D == nil {\n\t\treturn errors.New(\"glTexStorage1D\")\n\t}\n\tgpTexStorage2D = (C.GPTEXSTORAGE2D)(getProcAddr(\"glTexStorage2D\"))\n\tif gpTexStorage2D == nil {\n\t\treturn errors.New(\"glTexStorage2D\")\n\t}\n\tgpTexStorage2DMultisample = (C.GPTEXSTORAGE2DMULTISAMPLE)(getProcAddr(\"glTexStorage2DMultisample\"))\n\tif gpTexStorage2DMultisample == nil {\n\t\treturn errors.New(\"glTexStorage2DMultisample\")\n\t}\n\tgpTexStorage3D = (C.GPTEXSTORAGE3D)(getProcAddr(\"glTexStorage3D\"))\n\tif gpTexStorage3D == nil {\n\t\treturn errors.New(\"glTexStorage3D\")\n\t}\n\tgpTexStorage3DMultisample = (C.GPTEXSTORAGE3DMULTISAMPLE)(getProcAddr(\"glTexStorage3DMultisample\"))\n\tif gpTexStorage3DMultisample == nil {\n\t\treturn errors.New(\"glTexStorage3DMultisample\")\n\t}\n\tgpTexStorageMem1DEXT = (C.GPTEXSTORAGEMEM1DEXT)(getProcAddr(\"glTexStorageMem1DEXT\"))\n\tgpTexStorageMem2DEXT = (C.GPTEXSTORAGEMEM2DEXT)(getProcAddr(\"glTexStorageMem2DEXT\"))\n\tgpTexStorageMem2DMultisampleEXT = (C.GPTEXSTORAGEMEM2DMULTISAMPLEEXT)(getProcAddr(\"glTexStorageMem2DMultisampleEXT\"))\n\tgpTexStorageMem3DEXT = (C.GPTEXSTORAGEMEM3DEXT)(getProcAddr(\"glTexStorageMem3DEXT\"))\n\tgpTexStorageMem3DMultisampleEXT = (C.GPTEXSTORAGEMEM3DMULTISAMPLEEXT)(getProcAddr(\"glTexStorageMem3DMultisampleEXT\"))\n\tgpTexStorageSparseAMD = (C.GPTEXSTORAGESPARSEAMD)(getProcAddr(\"glTexStorageSparseAMD\"))\n\tgpTexSubImage1D = (C.GPTEXSUBIMAGE1D)(getProcAddr(\"glTexSubImage1D\"))\n\tif gpTexSubImage1D == nil {\n\t\treturn errors.New(\"glTexSubImage1D\")\n\t}\n\tgpTexSubImage1DEXT = (C.GPTEXSUBIMAGE1DEXT)(getProcAddr(\"glTexSubImage1DEXT\"))\n\tgpTexSubImage2D = (C.GPTEXSUBIMAGE2D)(getProcAddr(\"glTexSubImage2D\"))\n\tif gpTexSubImage2D == nil {\n\t\treturn errors.New(\"glTexSubImage2D\")\n\t}\n\tgpTexSubImage2DEXT = (C.GPTEXSUBIMAGE2DEXT)(getProcAddr(\"glTexSubImage2DEXT\"))\n\tgpTexSubImage3D = (C.GPTEXSUBIMAGE3D)(getProcAddr(\"glTexSubImage3D\"))\n\tif gpTexSubImage3D == nil {\n\t\treturn errors.New(\"glTexSubImage3D\")\n\t}\n\tgpTexSubImage3DEXT = (C.GPTEXSUBIMAGE3DEXT)(getProcAddr(\"glTexSubImage3DEXT\"))\n\tgpTexSubImage4DSGIS = (C.GPTEXSUBIMAGE4DSGIS)(getProcAddr(\"glTexSubImage4DSGIS\"))\n\tgpTextureAttachMemoryNV = (C.GPTEXTUREATTACHMEMORYNV)(getProcAddr(\"glTextureAttachMemoryNV\"))\n\tgpTextureBarrier = (C.GPTEXTUREBARRIER)(getProcAddr(\"glTextureBarrier\"))\n\tgpTextureBarrierNV = (C.GPTEXTUREBARRIERNV)(getProcAddr(\"glTextureBarrierNV\"))\n\tgpTextureBuffer = (C.GPTEXTUREBUFFER)(getProcAddr(\"glTextureBuffer\"))\n\tgpTextureBufferEXT = (C.GPTEXTUREBUFFEREXT)(getProcAddr(\"glTextureBufferEXT\"))\n\tgpTextureBufferRange = (C.GPTEXTUREBUFFERRANGE)(getProcAddr(\"glTextureBufferRange\"))\n\tgpTextureBufferRangeEXT = (C.GPTEXTUREBUFFERRANGEEXT)(getProcAddr(\"glTextureBufferRangeEXT\"))\n\tgpTextureColorMaskSGIS = (C.GPTEXTURECOLORMASKSGIS)(getProcAddr(\"glTextureColorMaskSGIS\"))\n\tgpTextureImage1DEXT = (C.GPTEXTUREIMAGE1DEXT)(getProcAddr(\"glTextureImage1DEXT\"))\n\tgpTextureImage2DEXT = (C.GPTEXTUREIMAGE2DEXT)(getProcAddr(\"glTextureImage2DEXT\"))\n\tgpTextureImage2DMultisampleCoverageNV = (C.GPTEXTUREIMAGE2DMULTISAMPLECOVERAGENV)(getProcAddr(\"glTextureImage2DMultisampleCoverageNV\"))\n\tgpTextureImage2DMultisampleNV = (C.GPTEXTUREIMAGE2DMULTISAMPLENV)(getProcAddr(\"glTextureImage2DMultisampleNV\"))\n\tgpTextureImage3DEXT = (C.GPTEXTUREIMAGE3DEXT)(getProcAddr(\"glTextureImage3DEXT\"))\n\tgpTextureImage3DMultisampleCoverageNV = (C.GPTEXTUREIMAGE3DMULTISAMPLECOVERAGENV)(getProcAddr(\"glTextureImage3DMultisampleCoverageNV\"))\n\tgpTextureImage3DMultisampleNV = (C.GPTEXTUREIMAGE3DMULTISAMPLENV)(getProcAddr(\"glTextureImage3DMultisampleNV\"))\n\tgpTextureLightEXT = (C.GPTEXTURELIGHTEXT)(getProcAddr(\"glTextureLightEXT\"))\n\tgpTextureMaterialEXT = (C.GPTEXTUREMATERIALEXT)(getProcAddr(\"glTextureMaterialEXT\"))\n\tgpTextureNormalEXT = (C.GPTEXTURENORMALEXT)(getProcAddr(\"glTextureNormalEXT\"))\n\tgpTexturePageCommitmentEXT = (C.GPTEXTUREPAGECOMMITMENTEXT)(getProcAddr(\"glTexturePageCommitmentEXT\"))\n\tgpTexturePageCommitmentMemNV = (C.GPTEXTUREPAGECOMMITMENTMEMNV)(getProcAddr(\"glTexturePageCommitmentMemNV\"))\n\tgpTextureParameterIiv = (C.GPTEXTUREPARAMETERIIV)(getProcAddr(\"glTextureParameterIiv\"))\n\tgpTextureParameterIivEXT = (C.GPTEXTUREPARAMETERIIVEXT)(getProcAddr(\"glTextureParameterIivEXT\"))\n\tgpTextureParameterIuiv = (C.GPTEXTUREPARAMETERIUIV)(getProcAddr(\"glTextureParameterIuiv\"))\n\tgpTextureParameterIuivEXT = (C.GPTEXTUREPARAMETERIUIVEXT)(getProcAddr(\"glTextureParameterIuivEXT\"))\n\tgpTextureParameterf = (C.GPTEXTUREPARAMETERF)(getProcAddr(\"glTextureParameterf\"))\n\tgpTextureParameterfEXT = (C.GPTEXTUREPARAMETERFEXT)(getProcAddr(\"glTextureParameterfEXT\"))\n\tgpTextureParameterfv = (C.GPTEXTUREPARAMETERFV)(getProcAddr(\"glTextureParameterfv\"))\n\tgpTextureParameterfvEXT = (C.GPTEXTUREPARAMETERFVEXT)(getProcAddr(\"glTextureParameterfvEXT\"))\n\tgpTextureParameteri = (C.GPTEXTUREPARAMETERI)(getProcAddr(\"glTextureParameteri\"))\n\tgpTextureParameteriEXT = (C.GPTEXTUREPARAMETERIEXT)(getProcAddr(\"glTextureParameteriEXT\"))\n\tgpTextureParameteriv = (C.GPTEXTUREPARAMETERIV)(getProcAddr(\"glTextureParameteriv\"))\n\tgpTextureParameterivEXT = (C.GPTEXTUREPARAMETERIVEXT)(getProcAddr(\"glTextureParameterivEXT\"))\n\tgpTextureRangeAPPLE = (C.GPTEXTURERANGEAPPLE)(getProcAddr(\"glTextureRangeAPPLE\"))\n\tgpTextureRenderbufferEXT = (C.GPTEXTURERENDERBUFFEREXT)(getProcAddr(\"glTextureRenderbufferEXT\"))\n\tgpTextureStorage1D = (C.GPTEXTURESTORAGE1D)(getProcAddr(\"glTextureStorage1D\"))\n\tgpTextureStorage1DEXT = (C.GPTEXTURESTORAGE1DEXT)(getProcAddr(\"glTextureStorage1DEXT\"))\n\tgpTextureStorage2D = (C.GPTEXTURESTORAGE2D)(getProcAddr(\"glTextureStorage2D\"))\n\tgpTextureStorage2DEXT = (C.GPTEXTURESTORAGE2DEXT)(getProcAddr(\"glTextureStorage2DEXT\"))\n\tgpTextureStorage2DMultisample = (C.GPTEXTURESTORAGE2DMULTISAMPLE)(getProcAddr(\"glTextureStorage2DMultisample\"))\n\tgpTextureStorage2DMultisampleEXT = (C.GPTEXTURESTORAGE2DMULTISAMPLEEXT)(getProcAddr(\"glTextureStorage2DMultisampleEXT\"))\n\tgpTextureStorage3D = (C.GPTEXTURESTORAGE3D)(getProcAddr(\"glTextureStorage3D\"))\n\tgpTextureStorage3DEXT = (C.GPTEXTURESTORAGE3DEXT)(getProcAddr(\"glTextureStorage3DEXT\"))\n\tgpTextureStorage3DMultisample = (C.GPTEXTURESTORAGE3DMULTISAMPLE)(getProcAddr(\"glTextureStorage3DMultisample\"))\n\tgpTextureStorage3DMultisampleEXT = (C.GPTEXTURESTORAGE3DMULTISAMPLEEXT)(getProcAddr(\"glTextureStorage3DMultisampleEXT\"))\n\tgpTextureStorageMem1DEXT = (C.GPTEXTURESTORAGEMEM1DEXT)(getProcAddr(\"glTextureStorageMem1DEXT\"))\n\tgpTextureStorageMem2DEXT = (C.GPTEXTURESTORAGEMEM2DEXT)(getProcAddr(\"glTextureStorageMem2DEXT\"))\n\tgpTextureStorageMem2DMultisampleEXT = (C.GPTEXTURESTORAGEMEM2DMULTISAMPLEEXT)(getProcAddr(\"glTextureStorageMem2DMultisampleEXT\"))\n\tgpTextureStorageMem3DEXT = (C.GPTEXTURESTORAGEMEM3DEXT)(getProcAddr(\"glTextureStorageMem3DEXT\"))\n\tgpTextureStorageMem3DMultisampleEXT = (C.GPTEXTURESTORAGEMEM3DMULTISAMPLEEXT)(getProcAddr(\"glTextureStorageMem3DMultisampleEXT\"))\n\tgpTextureStorageSparseAMD = (C.GPTEXTURESTORAGESPARSEAMD)(getProcAddr(\"glTextureStorageSparseAMD\"))\n\tgpTextureSubImage1D = (C.GPTEXTURESUBIMAGE1D)(getProcAddr(\"glTextureSubImage1D\"))\n\tgpTextureSubImage1DEXT = (C.GPTEXTURESUBIMAGE1DEXT)(getProcAddr(\"glTextureSubImage1DEXT\"))\n\tgpTextureSubImage2D = (C.GPTEXTURESUBIMAGE2D)(getProcAddr(\"glTextureSubImage2D\"))\n\tgpTextureSubImage2DEXT = (C.GPTEXTURESUBIMAGE2DEXT)(getProcAddr(\"glTextureSubImage2DEXT\"))\n\tgpTextureSubImage3D = (C.GPTEXTURESUBIMAGE3D)(getProcAddr(\"glTextureSubImage3D\"))\n\tgpTextureSubImage3DEXT = (C.GPTEXTURESUBIMAGE3DEXT)(getProcAddr(\"glTextureSubImage3DEXT\"))\n\tgpTextureView = (C.GPTEXTUREVIEW)(getProcAddr(\"glTextureView\"))\n\tif gpTextureView == nil {\n\t\treturn errors.New(\"glTextureView\")\n\t}\n\tgpTrackMatrixNV = (C.GPTRACKMATRIXNV)(getProcAddr(\"glTrackMatrixNV\"))\n\tgpTransformFeedbackAttribsNV = (C.GPTRANSFORMFEEDBACKATTRIBSNV)(getProcAddr(\"glTransformFeedbackAttribsNV\"))\n\tgpTransformFeedbackBufferBase = (C.GPTRANSFORMFEEDBACKBUFFERBASE)(getProcAddr(\"glTransformFeedbackBufferBase\"))\n\tgpTransformFeedbackBufferRange = (C.GPTRANSFORMFEEDBACKBUFFERRANGE)(getProcAddr(\"glTransformFeedbackBufferRange\"))\n\tgpTransformFeedbackStreamAttribsNV = (C.GPTRANSFORMFEEDBACKSTREAMATTRIBSNV)(getProcAddr(\"glTransformFeedbackStreamAttribsNV\"))\n\tgpTransformFeedbackVaryings = (C.GPTRANSFORMFEEDBACKVARYINGS)(getProcAddr(\"glTransformFeedbackVaryings\"))\n\tif gpTransformFeedbackVaryings == nil {\n\t\treturn errors.New(\"glTransformFeedbackVaryings\")\n\t}\n\tgpTransformFeedbackVaryingsEXT = (C.GPTRANSFORMFEEDBACKVARYINGSEXT)(getProcAddr(\"glTransformFeedbackVaryingsEXT\"))\n\tgpTransformFeedbackVaryingsNV = (C.GPTRANSFORMFEEDBACKVARYINGSNV)(getProcAddr(\"glTransformFeedbackVaryingsNV\"))\n\tgpTransformPathNV = (C.GPTRANSFORMPATHNV)(getProcAddr(\"glTransformPathNV\"))\n\tgpTranslated = (C.GPTRANSLATED)(getProcAddr(\"glTranslated\"))\n\tif gpTranslated == nil {\n\t\treturn errors.New(\"glTranslated\")\n\t}\n\tgpTranslatef = (C.GPTRANSLATEF)(getProcAddr(\"glTranslatef\"))\n\tif gpTranslatef == nil {\n\t\treturn errors.New(\"glTranslatef\")\n\t}\n\tgpTranslatexOES = (C.GPTRANSLATEXOES)(getProcAddr(\"glTranslatexOES\"))\n\tgpUniform1d = (C.GPUNIFORM1D)(getProcAddr(\"glUniform1d\"))\n\tif gpUniform1d == nil {\n\t\treturn errors.New(\"glUniform1d\")\n\t}\n\tgpUniform1dv = (C.GPUNIFORM1DV)(getProcAddr(\"glUniform1dv\"))\n\tif gpUniform1dv == nil {\n\t\treturn errors.New(\"glUniform1dv\")\n\t}\n\tgpUniform1f = (C.GPUNIFORM1F)(getProcAddr(\"glUniform1f\"))\n\tif gpUniform1f == nil {\n\t\treturn errors.New(\"glUniform1f\")\n\t}\n\tgpUniform1fARB = (C.GPUNIFORM1FARB)(getProcAddr(\"glUniform1fARB\"))\n\tgpUniform1fv = (C.GPUNIFORM1FV)(getProcAddr(\"glUniform1fv\"))\n\tif gpUniform1fv == nil {\n\t\treturn errors.New(\"glUniform1fv\")\n\t}\n\tgpUniform1fvARB = (C.GPUNIFORM1FVARB)(getProcAddr(\"glUniform1fvARB\"))\n\tgpUniform1i = (C.GPUNIFORM1I)(getProcAddr(\"glUniform1i\"))\n\tif gpUniform1i == nil {\n\t\treturn errors.New(\"glUniform1i\")\n\t}\n\tgpUniform1i64ARB = (C.GPUNIFORM1I64ARB)(getProcAddr(\"glUniform1i64ARB\"))\n\tgpUniform1i64NV = (C.GPUNIFORM1I64NV)(getProcAddr(\"glUniform1i64NV\"))\n\tgpUniform1i64vARB = (C.GPUNIFORM1I64VARB)(getProcAddr(\"glUniform1i64vARB\"))\n\tgpUniform1i64vNV = (C.GPUNIFORM1I64VNV)(getProcAddr(\"glUniform1i64vNV\"))\n\tgpUniform1iARB = (C.GPUNIFORM1IARB)(getProcAddr(\"glUniform1iARB\"))\n\tgpUniform1iv = (C.GPUNIFORM1IV)(getProcAddr(\"glUniform1iv\"))\n\tif gpUniform1iv == nil {\n\t\treturn errors.New(\"glUniform1iv\")\n\t}\n\tgpUniform1ivARB = (C.GPUNIFORM1IVARB)(getProcAddr(\"glUniform1ivARB\"))\n\tgpUniform1ui = (C.GPUNIFORM1UI)(getProcAddr(\"glUniform1ui\"))\n\tif gpUniform1ui == nil {\n\t\treturn errors.New(\"glUniform1ui\")\n\t}\n\tgpUniform1ui64ARB = (C.GPUNIFORM1UI64ARB)(getProcAddr(\"glUniform1ui64ARB\"))\n\tgpUniform1ui64NV = (C.GPUNIFORM1UI64NV)(getProcAddr(\"glUniform1ui64NV\"))\n\tgpUniform1ui64vARB = (C.GPUNIFORM1UI64VARB)(getProcAddr(\"glUniform1ui64vARB\"))\n\tgpUniform1ui64vNV = (C.GPUNIFORM1UI64VNV)(getProcAddr(\"glUniform1ui64vNV\"))\n\tgpUniform1uiEXT = (C.GPUNIFORM1UIEXT)(getProcAddr(\"glUniform1uiEXT\"))\n\tgpUniform1uiv = (C.GPUNIFORM1UIV)(getProcAddr(\"glUniform1uiv\"))\n\tif gpUniform1uiv == nil {\n\t\treturn errors.New(\"glUniform1uiv\")\n\t}\n\tgpUniform1uivEXT = (C.GPUNIFORM1UIVEXT)(getProcAddr(\"glUniform1uivEXT\"))\n\tgpUniform2d = (C.GPUNIFORM2D)(getProcAddr(\"glUniform2d\"))\n\tif gpUniform2d == nil {\n\t\treturn errors.New(\"glUniform2d\")\n\t}\n\tgpUniform2dv = (C.GPUNIFORM2DV)(getProcAddr(\"glUniform2dv\"))\n\tif gpUniform2dv == nil {\n\t\treturn errors.New(\"glUniform2dv\")\n\t}\n\tgpUniform2f = (C.GPUNIFORM2F)(getProcAddr(\"glUniform2f\"))\n\tif gpUniform2f == nil {\n\t\treturn errors.New(\"glUniform2f\")\n\t}\n\tgpUniform2fARB = (C.GPUNIFORM2FARB)(getProcAddr(\"glUniform2fARB\"))\n\tgpUniform2fv = (C.GPUNIFORM2FV)(getProcAddr(\"glUniform2fv\"))\n\tif gpUniform2fv == nil {\n\t\treturn errors.New(\"glUniform2fv\")\n\t}\n\tgpUniform2fvARB = (C.GPUNIFORM2FVARB)(getProcAddr(\"glUniform2fvARB\"))\n\tgpUniform2i = (C.GPUNIFORM2I)(getProcAddr(\"glUniform2i\"))\n\tif gpUniform2i == nil {\n\t\treturn errors.New(\"glUniform2i\")\n\t}\n\tgpUniform2i64ARB = (C.GPUNIFORM2I64ARB)(getProcAddr(\"glUniform2i64ARB\"))\n\tgpUniform2i64NV = (C.GPUNIFORM2I64NV)(getProcAddr(\"glUniform2i64NV\"))\n\tgpUniform2i64vARB = (C.GPUNIFORM2I64VARB)(getProcAddr(\"glUniform2i64vARB\"))\n\tgpUniform2i64vNV = (C.GPUNIFORM2I64VNV)(getProcAddr(\"glUniform2i64vNV\"))\n\tgpUniform2iARB = (C.GPUNIFORM2IARB)(getProcAddr(\"glUniform2iARB\"))\n\tgpUniform2iv = (C.GPUNIFORM2IV)(getProcAddr(\"glUniform2iv\"))\n\tif gpUniform2iv == nil {\n\t\treturn errors.New(\"glUniform2iv\")\n\t}\n\tgpUniform2ivARB = (C.GPUNIFORM2IVARB)(getProcAddr(\"glUniform2ivARB\"))\n\tgpUniform2ui = (C.GPUNIFORM2UI)(getProcAddr(\"glUniform2ui\"))\n\tif gpUniform2ui == nil {\n\t\treturn errors.New(\"glUniform2ui\")\n\t}\n\tgpUniform2ui64ARB = (C.GPUNIFORM2UI64ARB)(getProcAddr(\"glUniform2ui64ARB\"))\n\tgpUniform2ui64NV = (C.GPUNIFORM2UI64NV)(getProcAddr(\"glUniform2ui64NV\"))\n\tgpUniform2ui64vARB = (C.GPUNIFORM2UI64VARB)(getProcAddr(\"glUniform2ui64vARB\"))\n\tgpUniform2ui64vNV = (C.GPUNIFORM2UI64VNV)(getProcAddr(\"glUniform2ui64vNV\"))\n\tgpUniform2uiEXT = (C.GPUNIFORM2UIEXT)(getProcAddr(\"glUniform2uiEXT\"))\n\tgpUniform2uiv = (C.GPUNIFORM2UIV)(getProcAddr(\"glUniform2uiv\"))\n\tif gpUniform2uiv == nil {\n\t\treturn errors.New(\"glUniform2uiv\")\n\t}\n\tgpUniform2uivEXT = (C.GPUNIFORM2UIVEXT)(getProcAddr(\"glUniform2uivEXT\"))\n\tgpUniform3d = (C.GPUNIFORM3D)(getProcAddr(\"glUniform3d\"))\n\tif gpUniform3d == nil {\n\t\treturn errors.New(\"glUniform3d\")\n\t}\n\tgpUniform3dv = (C.GPUNIFORM3DV)(getProcAddr(\"glUniform3dv\"))\n\tif gpUniform3dv == nil {\n\t\treturn errors.New(\"glUniform3dv\")\n\t}\n\tgpUniform3f = (C.GPUNIFORM3F)(getProcAddr(\"glUniform3f\"))\n\tif gpUniform3f == nil {\n\t\treturn errors.New(\"glUniform3f\")\n\t}\n\tgpUniform3fARB = (C.GPUNIFORM3FARB)(getProcAddr(\"glUniform3fARB\"))\n\tgpUniform3fv = (C.GPUNIFORM3FV)(getProcAddr(\"glUniform3fv\"))\n\tif gpUniform3fv == nil {\n\t\treturn errors.New(\"glUniform3fv\")\n\t}\n\tgpUniform3fvARB = (C.GPUNIFORM3FVARB)(getProcAddr(\"glUniform3fvARB\"))\n\tgpUniform3i = (C.GPUNIFORM3I)(getProcAddr(\"glUniform3i\"))\n\tif gpUniform3i == nil {\n\t\treturn errors.New(\"glUniform3i\")\n\t}\n\tgpUniform3i64ARB = (C.GPUNIFORM3I64ARB)(getProcAddr(\"glUniform3i64ARB\"))\n\tgpUniform3i64NV = (C.GPUNIFORM3I64NV)(getProcAddr(\"glUniform3i64NV\"))\n\tgpUniform3i64vARB = (C.GPUNIFORM3I64VARB)(getProcAddr(\"glUniform3i64vARB\"))\n\tgpUniform3i64vNV = (C.GPUNIFORM3I64VNV)(getProcAddr(\"glUniform3i64vNV\"))\n\tgpUniform3iARB = (C.GPUNIFORM3IARB)(getProcAddr(\"glUniform3iARB\"))\n\tgpUniform3iv = (C.GPUNIFORM3IV)(getProcAddr(\"glUniform3iv\"))\n\tif gpUniform3iv == nil {\n\t\treturn errors.New(\"glUniform3iv\")\n\t}\n\tgpUniform3ivARB = (C.GPUNIFORM3IVARB)(getProcAddr(\"glUniform3ivARB\"))\n\tgpUniform3ui = (C.GPUNIFORM3UI)(getProcAddr(\"glUniform3ui\"))\n\tif gpUniform3ui == nil {\n\t\treturn errors.New(\"glUniform3ui\")\n\t}\n\tgpUniform3ui64ARB = (C.GPUNIFORM3UI64ARB)(getProcAddr(\"glUniform3ui64ARB\"))\n\tgpUniform3ui64NV = (C.GPUNIFORM3UI64NV)(getProcAddr(\"glUniform3ui64NV\"))\n\tgpUniform3ui64vARB = (C.GPUNIFORM3UI64VARB)(getProcAddr(\"glUniform3ui64vARB\"))\n\tgpUniform3ui64vNV = (C.GPUNIFORM3UI64VNV)(getProcAddr(\"glUniform3ui64vNV\"))\n\tgpUniform3uiEXT = (C.GPUNIFORM3UIEXT)(getProcAddr(\"glUniform3uiEXT\"))\n\tgpUniform3uiv = (C.GPUNIFORM3UIV)(getProcAddr(\"glUniform3uiv\"))\n\tif gpUniform3uiv == nil {\n\t\treturn errors.New(\"glUniform3uiv\")\n\t}\n\tgpUniform3uivEXT = (C.GPUNIFORM3UIVEXT)(getProcAddr(\"glUniform3uivEXT\"))\n\tgpUniform4d = (C.GPUNIFORM4D)(getProcAddr(\"glUniform4d\"))\n\tif gpUniform4d == nil {\n\t\treturn errors.New(\"glUniform4d\")\n\t}\n\tgpUniform4dv = (C.GPUNIFORM4DV)(getProcAddr(\"glUniform4dv\"))\n\tif gpUniform4dv == nil {\n\t\treturn errors.New(\"glUniform4dv\")\n\t}\n\tgpUniform4f = (C.GPUNIFORM4F)(getProcAddr(\"glUniform4f\"))\n\tif gpUniform4f == nil {\n\t\treturn errors.New(\"glUniform4f\")\n\t}\n\tgpUniform4fARB = (C.GPUNIFORM4FARB)(getProcAddr(\"glUniform4fARB\"))\n\tgpUniform4fv = (C.GPUNIFORM4FV)(getProcAddr(\"glUniform4fv\"))\n\tif gpUniform4fv == nil {\n\t\treturn errors.New(\"glUniform4fv\")\n\t}\n\tgpUniform4fvARB = (C.GPUNIFORM4FVARB)(getProcAddr(\"glUniform4fvARB\"))\n\tgpUniform4i = (C.GPUNIFORM4I)(getProcAddr(\"glUniform4i\"))\n\tif gpUniform4i == nil {\n\t\treturn errors.New(\"glUniform4i\")\n\t}\n\tgpUniform4i64ARB = (C.GPUNIFORM4I64ARB)(getProcAddr(\"glUniform4i64ARB\"))\n\tgpUniform4i64NV = (C.GPUNIFORM4I64NV)(getProcAddr(\"glUniform4i64NV\"))\n\tgpUniform4i64vARB = (C.GPUNIFORM4I64VARB)(getProcAddr(\"glUniform4i64vARB\"))\n\tgpUniform4i64vNV = (C.GPUNIFORM4I64VNV)(getProcAddr(\"glUniform4i64vNV\"))\n\tgpUniform4iARB = (C.GPUNIFORM4IARB)(getProcAddr(\"glUniform4iARB\"))\n\tgpUniform4iv = (C.GPUNIFORM4IV)(getProcAddr(\"glUniform4iv\"))\n\tif gpUniform4iv == nil {\n\t\treturn errors.New(\"glUniform4iv\")\n\t}\n\tgpUniform4ivARB = (C.GPUNIFORM4IVARB)(getProcAddr(\"glUniform4ivARB\"))\n\tgpUniform4ui = (C.GPUNIFORM4UI)(getProcAddr(\"glUniform4ui\"))\n\tif gpUniform4ui == nil {\n\t\treturn errors.New(\"glUniform4ui\")\n\t}\n\tgpUniform4ui64ARB = (C.GPUNIFORM4UI64ARB)(getProcAddr(\"glUniform4ui64ARB\"))\n\tgpUniform4ui64NV = (C.GPUNIFORM4UI64NV)(getProcAddr(\"glUniform4ui64NV\"))\n\tgpUniform4ui64vARB = (C.GPUNIFORM4UI64VARB)(getProcAddr(\"glUniform4ui64vARB\"))\n\tgpUniform4ui64vNV = (C.GPUNIFORM4UI64VNV)(getProcAddr(\"glUniform4ui64vNV\"))\n\tgpUniform4uiEXT = (C.GPUNIFORM4UIEXT)(getProcAddr(\"glUniform4uiEXT\"))\n\tgpUniform4uiv = (C.GPUNIFORM4UIV)(getProcAddr(\"glUniform4uiv\"))\n\tif gpUniform4uiv == nil {\n\t\treturn errors.New(\"glUniform4uiv\")\n\t}\n\tgpUniform4uivEXT = (C.GPUNIFORM4UIVEXT)(getProcAddr(\"glUniform4uivEXT\"))\n\tgpUniformBlockBinding = (C.GPUNIFORMBLOCKBINDING)(getProcAddr(\"glUniformBlockBinding\"))\n\tif gpUniformBlockBinding == nil {\n\t\treturn errors.New(\"glUniformBlockBinding\")\n\t}\n\tgpUniformBufferEXT = (C.GPUNIFORMBUFFEREXT)(getProcAddr(\"glUniformBufferEXT\"))\n\tgpUniformHandleui64ARB = (C.GPUNIFORMHANDLEUI64ARB)(getProcAddr(\"glUniformHandleui64ARB\"))\n\tgpUniformHandleui64NV = (C.GPUNIFORMHANDLEUI64NV)(getProcAddr(\"glUniformHandleui64NV\"))\n\tgpUniformHandleui64vARB = (C.GPUNIFORMHANDLEUI64VARB)(getProcAddr(\"glUniformHandleui64vARB\"))\n\tgpUniformHandleui64vNV = (C.GPUNIFORMHANDLEUI64VNV)(getProcAddr(\"glUniformHandleui64vNV\"))\n\tgpUniformMatrix2dv = (C.GPUNIFORMMATRIX2DV)(getProcAddr(\"glUniformMatrix2dv\"))\n\tif gpUniformMatrix2dv == nil {\n\t\treturn errors.New(\"glUniformMatrix2dv\")\n\t}\n\tgpUniformMatrix2fv = (C.GPUNIFORMMATRIX2FV)(getProcAddr(\"glUniformMatrix2fv\"))\n\tif gpUniformMatrix2fv == nil {\n\t\treturn errors.New(\"glUniformMatrix2fv\")\n\t}\n\tgpUniformMatrix2fvARB = (C.GPUNIFORMMATRIX2FVARB)(getProcAddr(\"glUniformMatrix2fvARB\"))\n\tgpUniformMatrix2x3dv = (C.GPUNIFORMMATRIX2X3DV)(getProcAddr(\"glUniformMatrix2x3dv\"))\n\tif gpUniformMatrix2x3dv == nil {\n\t\treturn errors.New(\"glUniformMatrix2x3dv\")\n\t}\n\tgpUniformMatrix2x3fv = (C.GPUNIFORMMATRIX2X3FV)(getProcAddr(\"glUniformMatrix2x3fv\"))\n\tif gpUniformMatrix2x3fv == nil {\n\t\treturn errors.New(\"glUniformMatrix2x3fv\")\n\t}\n\tgpUniformMatrix2x4dv = (C.GPUNIFORMMATRIX2X4DV)(getProcAddr(\"glUniformMatrix2x4dv\"))\n\tif gpUniformMatrix2x4dv == nil {\n\t\treturn errors.New(\"glUniformMatrix2x4dv\")\n\t}\n\tgpUniformMatrix2x4fv = (C.GPUNIFORMMATRIX2X4FV)(getProcAddr(\"glUniformMatrix2x4fv\"))\n\tif gpUniformMatrix2x4fv == nil {\n\t\treturn errors.New(\"glUniformMatrix2x4fv\")\n\t}\n\tgpUniformMatrix3dv = (C.GPUNIFORMMATRIX3DV)(getProcAddr(\"glUniformMatrix3dv\"))\n\tif gpUniformMatrix3dv == nil {\n\t\treturn errors.New(\"glUniformMatrix3dv\")\n\t}\n\tgpUniformMatrix3fv = (C.GPUNIFORMMATRIX3FV)(getProcAddr(\"glUniformMatrix3fv\"))\n\tif gpUniformMatrix3fv == nil {\n\t\treturn errors.New(\"glUniformMatrix3fv\")\n\t}\n\tgpUniformMatrix3fvARB = (C.GPUNIFORMMATRIX3FVARB)(getProcAddr(\"glUniformMatrix3fvARB\"))\n\tgpUniformMatrix3x2dv = (C.GPUNIFORMMATRIX3X2DV)(getProcAddr(\"glUniformMatrix3x2dv\"))\n\tif gpUniformMatrix3x2dv == nil {\n\t\treturn errors.New(\"glUniformMatrix3x2dv\")\n\t}\n\tgpUniformMatrix3x2fv = (C.GPUNIFORMMATRIX3X2FV)(getProcAddr(\"glUniformMatrix3x2fv\"))\n\tif gpUniformMatrix3x2fv == nil {\n\t\treturn errors.New(\"glUniformMatrix3x2fv\")\n\t}\n\tgpUniformMatrix3x4dv = (C.GPUNIFORMMATRIX3X4DV)(getProcAddr(\"glUniformMatrix3x4dv\"))\n\tif gpUniformMatrix3x4dv == nil {\n\t\treturn errors.New(\"glUniformMatrix3x4dv\")\n\t}\n\tgpUniformMatrix3x4fv = (C.GPUNIFORMMATRIX3X4FV)(getProcAddr(\"glUniformMatrix3x4fv\"))\n\tif gpUniformMatrix3x4fv == nil {\n\t\treturn errors.New(\"glUniformMatrix3x4fv\")\n\t}\n\tgpUniformMatrix4dv = (C.GPUNIFORMMATRIX4DV)(getProcAddr(\"glUniformMatrix4dv\"))\n\tif gpUniformMatrix4dv == nil {\n\t\treturn errors.New(\"glUniformMatrix4dv\")\n\t}\n\tgpUniformMatrix4fv = (C.GPUNIFORMMATRIX4FV)(getProcAddr(\"glUniformMatrix4fv\"))\n\tif gpUniformMatrix4fv == nil {\n\t\treturn errors.New(\"glUniformMatrix4fv\")\n\t}\n\tgpUniformMatrix4fvARB = (C.GPUNIFORMMATRIX4FVARB)(getProcAddr(\"glUniformMatrix4fvARB\"))\n\tgpUniformMatrix4x2dv = (C.GPUNIFORMMATRIX4X2DV)(getProcAddr(\"glUniformMatrix4x2dv\"))\n\tif gpUniformMatrix4x2dv == nil {\n\t\treturn errors.New(\"glUniformMatrix4x2dv\")\n\t}\n\tgpUniformMatrix4x2fv = (C.GPUNIFORMMATRIX4X2FV)(getProcAddr(\"glUniformMatrix4x2fv\"))\n\tif gpUniformMatrix4x2fv == nil {\n\t\treturn errors.New(\"glUniformMatrix4x2fv\")\n\t}\n\tgpUniformMatrix4x3dv = (C.GPUNIFORMMATRIX4X3DV)(getProcAddr(\"glUniformMatrix4x3dv\"))\n\tif gpUniformMatrix4x3dv == nil {\n\t\treturn errors.New(\"glUniformMatrix4x3dv\")\n\t}\n\tgpUniformMatrix4x3fv = (C.GPUNIFORMMATRIX4X3FV)(getProcAddr(\"glUniformMatrix4x3fv\"))\n\tif gpUniformMatrix4x3fv == nil {\n\t\treturn errors.New(\"glUniformMatrix4x3fv\")\n\t}\n\tgpUniformSubroutinesuiv = (C.GPUNIFORMSUBROUTINESUIV)(getProcAddr(\"glUniformSubroutinesuiv\"))\n\tif gpUniformSubroutinesuiv == nil {\n\t\treturn errors.New(\"glUniformSubroutinesuiv\")\n\t}\n\tgpUniformui64NV = (C.GPUNIFORMUI64NV)(getProcAddr(\"glUniformui64NV\"))\n\tgpUniformui64vNV = (C.GPUNIFORMUI64VNV)(getProcAddr(\"glUniformui64vNV\"))\n\tgpUnlockArraysEXT = (C.GPUNLOCKARRAYSEXT)(getProcAddr(\"glUnlockArraysEXT\"))\n\tgpUnmapBuffer = (C.GPUNMAPBUFFER)(getProcAddr(\"glUnmapBuffer\"))\n\tif gpUnmapBuffer == nil {\n\t\treturn errors.New(\"glUnmapBuffer\")\n\t}\n\tgpUnmapBufferARB = (C.GPUNMAPBUFFERARB)(getProcAddr(\"glUnmapBufferARB\"))\n\tgpUnmapNamedBuffer = (C.GPUNMAPNAMEDBUFFER)(getProcAddr(\"glUnmapNamedBuffer\"))\n\tgpUnmapNamedBufferEXT = (C.GPUNMAPNAMEDBUFFEREXT)(getProcAddr(\"glUnmapNamedBufferEXT\"))\n\tgpUnmapObjectBufferATI = (C.GPUNMAPOBJECTBUFFERATI)(getProcAddr(\"glUnmapObjectBufferATI\"))\n\tgpUnmapTexture2DINTEL = (C.GPUNMAPTEXTURE2DINTEL)(getProcAddr(\"glUnmapTexture2DINTEL\"))\n\tgpUpdateObjectBufferATI = (C.GPUPDATEOBJECTBUFFERATI)(getProcAddr(\"glUpdateObjectBufferATI\"))\n\tgpUploadGpuMaskNVX = (C.GPUPLOADGPUMASKNVX)(getProcAddr(\"glUploadGpuMaskNVX\"))\n\tgpUseProgram = (C.GPUSEPROGRAM)(getProcAddr(\"glUseProgram\"))\n\tif gpUseProgram == nil {\n\t\treturn errors.New(\"glUseProgram\")\n\t}\n\tgpUseProgramObjectARB = (C.GPUSEPROGRAMOBJECTARB)(getProcAddr(\"glUseProgramObjectARB\"))\n\tgpUseProgramStages = (C.GPUSEPROGRAMSTAGES)(getProcAddr(\"glUseProgramStages\"))\n\tif gpUseProgramStages == nil {\n\t\treturn errors.New(\"glUseProgramStages\")\n\t}\n\tgpUseProgramStagesEXT = (C.GPUSEPROGRAMSTAGESEXT)(getProcAddr(\"glUseProgramStagesEXT\"))\n\tgpUseShaderProgramEXT = (C.GPUSESHADERPROGRAMEXT)(getProcAddr(\"glUseShaderProgramEXT\"))\n\tgpVDPAUFiniNV = (C.GPVDPAUFININV)(getProcAddr(\"glVDPAUFiniNV\"))\n\tgpVDPAUGetSurfaceivNV = (C.GPVDPAUGETSURFACEIVNV)(getProcAddr(\"glVDPAUGetSurfaceivNV\"))\n\tgpVDPAUInitNV = (C.GPVDPAUINITNV)(getProcAddr(\"glVDPAUInitNV\"))\n\tgpVDPAUIsSurfaceNV = (C.GPVDPAUISSURFACENV)(getProcAddr(\"glVDPAUIsSurfaceNV\"))\n\tgpVDPAUMapSurfacesNV = (C.GPVDPAUMAPSURFACESNV)(getProcAddr(\"glVDPAUMapSurfacesNV\"))\n\tgpVDPAURegisterOutputSurfaceNV = (C.GPVDPAUREGISTEROUTPUTSURFACENV)(getProcAddr(\"glVDPAURegisterOutputSurfaceNV\"))\n\tgpVDPAURegisterVideoSurfaceNV = (C.GPVDPAUREGISTERVIDEOSURFACENV)(getProcAddr(\"glVDPAURegisterVideoSurfaceNV\"))\n\tgpVDPAURegisterVideoSurfaceWithPictureStructureNV = (C.GPVDPAUREGISTERVIDEOSURFACEWITHPICTURESTRUCTURENV)(getProcAddr(\"glVDPAURegisterVideoSurfaceWithPictureStructureNV\"))\n\tgpVDPAUSurfaceAccessNV = (C.GPVDPAUSURFACEACCESSNV)(getProcAddr(\"glVDPAUSurfaceAccessNV\"))\n\tgpVDPAUUnmapSurfacesNV = (C.GPVDPAUUNMAPSURFACESNV)(getProcAddr(\"glVDPAUUnmapSurfacesNV\"))\n\tgpVDPAUUnregisterSurfaceNV = (C.GPVDPAUUNREGISTERSURFACENV)(getProcAddr(\"glVDPAUUnregisterSurfaceNV\"))\n\tgpValidateProgram = (C.GPVALIDATEPROGRAM)(getProcAddr(\"glValidateProgram\"))\n\tif gpValidateProgram == nil {\n\t\treturn errors.New(\"glValidateProgram\")\n\t}\n\tgpValidateProgramARB = (C.GPVALIDATEPROGRAMARB)(getProcAddr(\"glValidateProgramARB\"))\n\tgpValidateProgramPipeline = (C.GPVALIDATEPROGRAMPIPELINE)(getProcAddr(\"glValidateProgramPipeline\"))\n\tif gpValidateProgramPipeline == nil {\n\t\treturn errors.New(\"glValidateProgramPipeline\")\n\t}\n\tgpValidateProgramPipelineEXT = (C.GPVALIDATEPROGRAMPIPELINEEXT)(getProcAddr(\"glValidateProgramPipelineEXT\"))\n\tgpVariantArrayObjectATI = (C.GPVARIANTARRAYOBJECTATI)(getProcAddr(\"glVariantArrayObjectATI\"))\n\tgpVariantPointerEXT = (C.GPVARIANTPOINTEREXT)(getProcAddr(\"glVariantPointerEXT\"))\n\tgpVariantbvEXT = (C.GPVARIANTBVEXT)(getProcAddr(\"glVariantbvEXT\"))\n\tgpVariantdvEXT = (C.GPVARIANTDVEXT)(getProcAddr(\"glVariantdvEXT\"))\n\tgpVariantfvEXT = (C.GPVARIANTFVEXT)(getProcAddr(\"glVariantfvEXT\"))\n\tgpVariantivEXT = (C.GPVARIANTIVEXT)(getProcAddr(\"glVariantivEXT\"))\n\tgpVariantsvEXT = (C.GPVARIANTSVEXT)(getProcAddr(\"glVariantsvEXT\"))\n\tgpVariantubvEXT = (C.GPVARIANTUBVEXT)(getProcAddr(\"glVariantubvEXT\"))\n\tgpVariantuivEXT = (C.GPVARIANTUIVEXT)(getProcAddr(\"glVariantuivEXT\"))\n\tgpVariantusvEXT = (C.GPVARIANTUSVEXT)(getProcAddr(\"glVariantusvEXT\"))\n\tgpVertex2bOES = (C.GPVERTEX2BOES)(getProcAddr(\"glVertex2bOES\"))\n\tgpVertex2bvOES = (C.GPVERTEX2BVOES)(getProcAddr(\"glVertex2bvOES\"))\n\tgpVertex2d = (C.GPVERTEX2D)(getProcAddr(\"glVertex2d\"))\n\tif gpVertex2d == nil {\n\t\treturn errors.New(\"glVertex2d\")\n\t}\n\tgpVertex2dv = (C.GPVERTEX2DV)(getProcAddr(\"glVertex2dv\"))\n\tif gpVertex2dv == nil {\n\t\treturn errors.New(\"glVertex2dv\")\n\t}\n\tgpVertex2f = (C.GPVERTEX2F)(getProcAddr(\"glVertex2f\"))\n\tif gpVertex2f == nil {\n\t\treturn errors.New(\"glVertex2f\")\n\t}\n\tgpVertex2fv = (C.GPVERTEX2FV)(getProcAddr(\"glVertex2fv\"))\n\tif gpVertex2fv == nil {\n\t\treturn errors.New(\"glVertex2fv\")\n\t}\n\tgpVertex2hNV = (C.GPVERTEX2HNV)(getProcAddr(\"glVertex2hNV\"))\n\tgpVertex2hvNV = (C.GPVERTEX2HVNV)(getProcAddr(\"glVertex2hvNV\"))\n\tgpVertex2i = (C.GPVERTEX2I)(getProcAddr(\"glVertex2i\"))\n\tif gpVertex2i == nil {\n\t\treturn errors.New(\"glVertex2i\")\n\t}\n\tgpVertex2iv = (C.GPVERTEX2IV)(getProcAddr(\"glVertex2iv\"))\n\tif gpVertex2iv == nil {\n\t\treturn errors.New(\"glVertex2iv\")\n\t}\n\tgpVertex2s = (C.GPVERTEX2S)(getProcAddr(\"glVertex2s\"))\n\tif gpVertex2s == nil {\n\t\treturn errors.New(\"glVertex2s\")\n\t}\n\tgpVertex2sv = (C.GPVERTEX2SV)(getProcAddr(\"glVertex2sv\"))\n\tif gpVertex2sv == nil {\n\t\treturn errors.New(\"glVertex2sv\")\n\t}\n\tgpVertex2xOES = (C.GPVERTEX2XOES)(getProcAddr(\"glVertex2xOES\"))\n\tgpVertex2xvOES = (C.GPVERTEX2XVOES)(getProcAddr(\"glVertex2xvOES\"))\n\tgpVertex3bOES = (C.GPVERTEX3BOES)(getProcAddr(\"glVertex3bOES\"))\n\tgpVertex3bvOES = (C.GPVERTEX3BVOES)(getProcAddr(\"glVertex3bvOES\"))\n\tgpVertex3d = (C.GPVERTEX3D)(getProcAddr(\"glVertex3d\"))\n\tif gpVertex3d == nil {\n\t\treturn errors.New(\"glVertex3d\")\n\t}\n\tgpVertex3dv = (C.GPVERTEX3DV)(getProcAddr(\"glVertex3dv\"))\n\tif gpVertex3dv == nil {\n\t\treturn errors.New(\"glVertex3dv\")\n\t}\n\tgpVertex3f = (C.GPVERTEX3F)(getProcAddr(\"glVertex3f\"))\n\tif gpVertex3f == nil {\n\t\treturn errors.New(\"glVertex3f\")\n\t}\n\tgpVertex3fv = (C.GPVERTEX3FV)(getProcAddr(\"glVertex3fv\"))\n\tif gpVertex3fv == nil {\n\t\treturn errors.New(\"glVertex3fv\")\n\t}\n\tgpVertex3hNV = (C.GPVERTEX3HNV)(getProcAddr(\"glVertex3hNV\"))\n\tgpVertex3hvNV = (C.GPVERTEX3HVNV)(getProcAddr(\"glVertex3hvNV\"))\n\tgpVertex3i = (C.GPVERTEX3I)(getProcAddr(\"glVertex3i\"))\n\tif gpVertex3i == nil {\n\t\treturn errors.New(\"glVertex3i\")\n\t}\n\tgpVertex3iv = (C.GPVERTEX3IV)(getProcAddr(\"glVertex3iv\"))\n\tif gpVertex3iv == nil {\n\t\treturn errors.New(\"glVertex3iv\")\n\t}\n\tgpVertex3s = (C.GPVERTEX3S)(getProcAddr(\"glVertex3s\"))\n\tif gpVertex3s == nil {\n\t\treturn errors.New(\"glVertex3s\")\n\t}\n\tgpVertex3sv = (C.GPVERTEX3SV)(getProcAddr(\"glVertex3sv\"))\n\tif gpVertex3sv == nil {\n\t\treturn errors.New(\"glVertex3sv\")\n\t}\n\tgpVertex3xOES = (C.GPVERTEX3XOES)(getProcAddr(\"glVertex3xOES\"))\n\tgpVertex3xvOES = (C.GPVERTEX3XVOES)(getProcAddr(\"glVertex3xvOES\"))\n\tgpVertex4bOES = (C.GPVERTEX4BOES)(getProcAddr(\"glVertex4bOES\"))\n\tgpVertex4bvOES = (C.GPVERTEX4BVOES)(getProcAddr(\"glVertex4bvOES\"))\n\tgpVertex4d = (C.GPVERTEX4D)(getProcAddr(\"glVertex4d\"))\n\tif gpVertex4d == nil {\n\t\treturn errors.New(\"glVertex4d\")\n\t}\n\tgpVertex4dv = (C.GPVERTEX4DV)(getProcAddr(\"glVertex4dv\"))\n\tif gpVertex4dv == nil {\n\t\treturn errors.New(\"glVertex4dv\")\n\t}\n\tgpVertex4f = (C.GPVERTEX4F)(getProcAddr(\"glVertex4f\"))\n\tif gpVertex4f == nil {\n\t\treturn errors.New(\"glVertex4f\")\n\t}\n\tgpVertex4fv = (C.GPVERTEX4FV)(getProcAddr(\"glVertex4fv\"))\n\tif gpVertex4fv == nil {\n\t\treturn errors.New(\"glVertex4fv\")\n\t}\n\tgpVertex4hNV = (C.GPVERTEX4HNV)(getProcAddr(\"glVertex4hNV\"))\n\tgpVertex4hvNV = (C.GPVERTEX4HVNV)(getProcAddr(\"glVertex4hvNV\"))\n\tgpVertex4i = (C.GPVERTEX4I)(getProcAddr(\"glVertex4i\"))\n\tif gpVertex4i == nil {\n\t\treturn errors.New(\"glVertex4i\")\n\t}\n\tgpVertex4iv = (C.GPVERTEX4IV)(getProcAddr(\"glVertex4iv\"))\n\tif gpVertex4iv == nil {\n\t\treturn errors.New(\"glVertex4iv\")\n\t}\n\tgpVertex4s = (C.GPVERTEX4S)(getProcAddr(\"glVertex4s\"))\n\tif gpVertex4s == nil {\n\t\treturn errors.New(\"glVertex4s\")\n\t}\n\tgpVertex4sv = (C.GPVERTEX4SV)(getProcAddr(\"glVertex4sv\"))\n\tif gpVertex4sv == nil {\n\t\treturn errors.New(\"glVertex4sv\")\n\t}\n\tgpVertex4xOES = (C.GPVERTEX4XOES)(getProcAddr(\"glVertex4xOES\"))\n\tgpVertex4xvOES = (C.GPVERTEX4XVOES)(getProcAddr(\"glVertex4xvOES\"))\n\tgpVertexArrayAttribBinding = (C.GPVERTEXARRAYATTRIBBINDING)(getProcAddr(\"glVertexArrayAttribBinding\"))\n\tgpVertexArrayAttribFormat = (C.GPVERTEXARRAYATTRIBFORMAT)(getProcAddr(\"glVertexArrayAttribFormat\"))\n\tgpVertexArrayAttribIFormat = (C.GPVERTEXARRAYATTRIBIFORMAT)(getProcAddr(\"glVertexArrayAttribIFormat\"))\n\tgpVertexArrayAttribLFormat = (C.GPVERTEXARRAYATTRIBLFORMAT)(getProcAddr(\"glVertexArrayAttribLFormat\"))\n\tgpVertexArrayBindVertexBufferEXT = (C.GPVERTEXARRAYBINDVERTEXBUFFEREXT)(getProcAddr(\"glVertexArrayBindVertexBufferEXT\"))\n\tgpVertexArrayBindingDivisor = (C.GPVERTEXARRAYBINDINGDIVISOR)(getProcAddr(\"glVertexArrayBindingDivisor\"))\n\tgpVertexArrayColorOffsetEXT = (C.GPVERTEXARRAYCOLOROFFSETEXT)(getProcAddr(\"glVertexArrayColorOffsetEXT\"))\n\tgpVertexArrayEdgeFlagOffsetEXT = (C.GPVERTEXARRAYEDGEFLAGOFFSETEXT)(getProcAddr(\"glVertexArrayEdgeFlagOffsetEXT\"))\n\tgpVertexArrayElementBuffer = (C.GPVERTEXARRAYELEMENTBUFFER)(getProcAddr(\"glVertexArrayElementBuffer\"))\n\tgpVertexArrayFogCoordOffsetEXT = (C.GPVERTEXARRAYFOGCOORDOFFSETEXT)(getProcAddr(\"glVertexArrayFogCoordOffsetEXT\"))\n\tgpVertexArrayIndexOffsetEXT = (C.GPVERTEXARRAYINDEXOFFSETEXT)(getProcAddr(\"glVertexArrayIndexOffsetEXT\"))\n\tgpVertexArrayMultiTexCoordOffsetEXT = (C.GPVERTEXARRAYMULTITEXCOORDOFFSETEXT)(getProcAddr(\"glVertexArrayMultiTexCoordOffsetEXT\"))\n\tgpVertexArrayNormalOffsetEXT = (C.GPVERTEXARRAYNORMALOFFSETEXT)(getProcAddr(\"glVertexArrayNormalOffsetEXT\"))\n\tgpVertexArrayParameteriAPPLE = (C.GPVERTEXARRAYPARAMETERIAPPLE)(getProcAddr(\"glVertexArrayParameteriAPPLE\"))\n\tgpVertexArrayRangeAPPLE = (C.GPVERTEXARRAYRANGEAPPLE)(getProcAddr(\"glVertexArrayRangeAPPLE\"))\n\tgpVertexArrayRangeNV = (C.GPVERTEXARRAYRANGENV)(getProcAddr(\"glVertexArrayRangeNV\"))\n\tgpVertexArraySecondaryColorOffsetEXT = (C.GPVERTEXARRAYSECONDARYCOLOROFFSETEXT)(getProcAddr(\"glVertexArraySecondaryColorOffsetEXT\"))\n\tgpVertexArrayTexCoordOffsetEXT = (C.GPVERTEXARRAYTEXCOORDOFFSETEXT)(getProcAddr(\"glVertexArrayTexCoordOffsetEXT\"))\n\tgpVertexArrayVertexAttribBindingEXT = (C.GPVERTEXARRAYVERTEXATTRIBBINDINGEXT)(getProcAddr(\"glVertexArrayVertexAttribBindingEXT\"))\n\tgpVertexArrayVertexAttribDivisorEXT = (C.GPVERTEXARRAYVERTEXATTRIBDIVISOREXT)(getProcAddr(\"glVertexArrayVertexAttribDivisorEXT\"))\n\tgpVertexArrayVertexAttribFormatEXT = (C.GPVERTEXARRAYVERTEXATTRIBFORMATEXT)(getProcAddr(\"glVertexArrayVertexAttribFormatEXT\"))\n\tgpVertexArrayVertexAttribIFormatEXT = (C.GPVERTEXARRAYVERTEXATTRIBIFORMATEXT)(getProcAddr(\"glVertexArrayVertexAttribIFormatEXT\"))\n\tgpVertexArrayVertexAttribIOffsetEXT = (C.GPVERTEXARRAYVERTEXATTRIBIOFFSETEXT)(getProcAddr(\"glVertexArrayVertexAttribIOffsetEXT\"))\n\tgpVertexArrayVertexAttribLFormatEXT = (C.GPVERTEXARRAYVERTEXATTRIBLFORMATEXT)(getProcAddr(\"glVertexArrayVertexAttribLFormatEXT\"))\n\tgpVertexArrayVertexAttribLOffsetEXT = (C.GPVERTEXARRAYVERTEXATTRIBLOFFSETEXT)(getProcAddr(\"glVertexArrayVertexAttribLOffsetEXT\"))\n\tgpVertexArrayVertexAttribOffsetEXT = (C.GPVERTEXARRAYVERTEXATTRIBOFFSETEXT)(getProcAddr(\"glVertexArrayVertexAttribOffsetEXT\"))\n\tgpVertexArrayVertexBindingDivisorEXT = (C.GPVERTEXARRAYVERTEXBINDINGDIVISOREXT)(getProcAddr(\"glVertexArrayVertexBindingDivisorEXT\"))\n\tgpVertexArrayVertexBuffer = (C.GPVERTEXARRAYVERTEXBUFFER)(getProcAddr(\"glVertexArrayVertexBuffer\"))\n\tgpVertexArrayVertexBuffers = (C.GPVERTEXARRAYVERTEXBUFFERS)(getProcAddr(\"glVertexArrayVertexBuffers\"))\n\tgpVertexArrayVertexOffsetEXT = (C.GPVERTEXARRAYVERTEXOFFSETEXT)(getProcAddr(\"glVertexArrayVertexOffsetEXT\"))\n\tgpVertexAttrib1d = (C.GPVERTEXATTRIB1D)(getProcAddr(\"glVertexAttrib1d\"))\n\tif gpVertexAttrib1d == nil {\n\t\treturn errors.New(\"glVertexAttrib1d\")\n\t}\n\tgpVertexAttrib1dARB = (C.GPVERTEXATTRIB1DARB)(getProcAddr(\"glVertexAttrib1dARB\"))\n\tgpVertexAttrib1dNV = (C.GPVERTEXATTRIB1DNV)(getProcAddr(\"glVertexAttrib1dNV\"))\n\tgpVertexAttrib1dv = (C.GPVERTEXATTRIB1DV)(getProcAddr(\"glVertexAttrib1dv\"))\n\tif gpVertexAttrib1dv == nil {\n\t\treturn errors.New(\"glVertexAttrib1dv\")\n\t}\n\tgpVertexAttrib1dvARB = (C.GPVERTEXATTRIB1DVARB)(getProcAddr(\"glVertexAttrib1dvARB\"))\n\tgpVertexAttrib1dvNV = (C.GPVERTEXATTRIB1DVNV)(getProcAddr(\"glVertexAttrib1dvNV\"))\n\tgpVertexAttrib1f = (C.GPVERTEXATTRIB1F)(getProcAddr(\"glVertexAttrib1f\"))\n\tif gpVertexAttrib1f == nil {\n\t\treturn errors.New(\"glVertexAttrib1f\")\n\t}\n\tgpVertexAttrib1fARB = (C.GPVERTEXATTRIB1FARB)(getProcAddr(\"glVertexAttrib1fARB\"))\n\tgpVertexAttrib1fNV = (C.GPVERTEXATTRIB1FNV)(getProcAddr(\"glVertexAttrib1fNV\"))\n\tgpVertexAttrib1fv = (C.GPVERTEXATTRIB1FV)(getProcAddr(\"glVertexAttrib1fv\"))\n\tif gpVertexAttrib1fv == nil {\n\t\treturn errors.New(\"glVertexAttrib1fv\")\n\t}\n\tgpVertexAttrib1fvARB = (C.GPVERTEXATTRIB1FVARB)(getProcAddr(\"glVertexAttrib1fvARB\"))\n\tgpVertexAttrib1fvNV = (C.GPVERTEXATTRIB1FVNV)(getProcAddr(\"glVertexAttrib1fvNV\"))\n\tgpVertexAttrib1hNV = (C.GPVERTEXATTRIB1HNV)(getProcAddr(\"glVertexAttrib1hNV\"))\n\tgpVertexAttrib1hvNV = (C.GPVERTEXATTRIB1HVNV)(getProcAddr(\"glVertexAttrib1hvNV\"))\n\tgpVertexAttrib1s = (C.GPVERTEXATTRIB1S)(getProcAddr(\"glVertexAttrib1s\"))\n\tif gpVertexAttrib1s == nil {\n\t\treturn errors.New(\"glVertexAttrib1s\")\n\t}\n\tgpVertexAttrib1sARB = (C.GPVERTEXATTRIB1SARB)(getProcAddr(\"glVertexAttrib1sARB\"))\n\tgpVertexAttrib1sNV = (C.GPVERTEXATTRIB1SNV)(getProcAddr(\"glVertexAttrib1sNV\"))\n\tgpVertexAttrib1sv = (C.GPVERTEXATTRIB1SV)(getProcAddr(\"glVertexAttrib1sv\"))\n\tif gpVertexAttrib1sv == nil {\n\t\treturn errors.New(\"glVertexAttrib1sv\")\n\t}\n\tgpVertexAttrib1svARB = (C.GPVERTEXATTRIB1SVARB)(getProcAddr(\"glVertexAttrib1svARB\"))\n\tgpVertexAttrib1svNV = (C.GPVERTEXATTRIB1SVNV)(getProcAddr(\"glVertexAttrib1svNV\"))\n\tgpVertexAttrib2d = (C.GPVERTEXATTRIB2D)(getProcAddr(\"glVertexAttrib2d\"))\n\tif gpVertexAttrib2d == nil {\n\t\treturn errors.New(\"glVertexAttrib2d\")\n\t}\n\tgpVertexAttrib2dARB = (C.GPVERTEXATTRIB2DARB)(getProcAddr(\"glVertexAttrib2dARB\"))\n\tgpVertexAttrib2dNV = (C.GPVERTEXATTRIB2DNV)(getProcAddr(\"glVertexAttrib2dNV\"))\n\tgpVertexAttrib2dv = (C.GPVERTEXATTRIB2DV)(getProcAddr(\"glVertexAttrib2dv\"))\n\tif gpVertexAttrib2dv == nil {\n\t\treturn errors.New(\"glVertexAttrib2dv\")\n\t}\n\tgpVertexAttrib2dvARB = (C.GPVERTEXATTRIB2DVARB)(getProcAddr(\"glVertexAttrib2dvARB\"))\n\tgpVertexAttrib2dvNV = (C.GPVERTEXATTRIB2DVNV)(getProcAddr(\"glVertexAttrib2dvNV\"))\n\tgpVertexAttrib2f = (C.GPVERTEXATTRIB2F)(getProcAddr(\"glVertexAttrib2f\"))\n\tif gpVertexAttrib2f == nil {\n\t\treturn errors.New(\"glVertexAttrib2f\")\n\t}\n\tgpVertexAttrib2fARB = (C.GPVERTEXATTRIB2FARB)(getProcAddr(\"glVertexAttrib2fARB\"))\n\tgpVertexAttrib2fNV = (C.GPVERTEXATTRIB2FNV)(getProcAddr(\"glVertexAttrib2fNV\"))\n\tgpVertexAttrib2fv = (C.GPVERTEXATTRIB2FV)(getProcAddr(\"glVertexAttrib2fv\"))\n\tif gpVertexAttrib2fv == nil {\n\t\treturn errors.New(\"glVertexAttrib2fv\")\n\t}\n\tgpVertexAttrib2fvARB = (C.GPVERTEXATTRIB2FVARB)(getProcAddr(\"glVertexAttrib2fvARB\"))\n\tgpVertexAttrib2fvNV = (C.GPVERTEXATTRIB2FVNV)(getProcAddr(\"glVertexAttrib2fvNV\"))\n\tgpVertexAttrib2hNV = (C.GPVERTEXATTRIB2HNV)(getProcAddr(\"glVertexAttrib2hNV\"))\n\tgpVertexAttrib2hvNV = (C.GPVERTEXATTRIB2HVNV)(getProcAddr(\"glVertexAttrib2hvNV\"))\n\tgpVertexAttrib2s = (C.GPVERTEXATTRIB2S)(getProcAddr(\"glVertexAttrib2s\"))\n\tif gpVertexAttrib2s == nil {\n\t\treturn errors.New(\"glVertexAttrib2s\")\n\t}\n\tgpVertexAttrib2sARB = (C.GPVERTEXATTRIB2SARB)(getProcAddr(\"glVertexAttrib2sARB\"))\n\tgpVertexAttrib2sNV = (C.GPVERTEXATTRIB2SNV)(getProcAddr(\"glVertexAttrib2sNV\"))\n\tgpVertexAttrib2sv = (C.GPVERTEXATTRIB2SV)(getProcAddr(\"glVertexAttrib2sv\"))\n\tif gpVertexAttrib2sv == nil {\n\t\treturn errors.New(\"glVertexAttrib2sv\")\n\t}\n\tgpVertexAttrib2svARB = (C.GPVERTEXATTRIB2SVARB)(getProcAddr(\"glVertexAttrib2svARB\"))\n\tgpVertexAttrib2svNV = (C.GPVERTEXATTRIB2SVNV)(getProcAddr(\"glVertexAttrib2svNV\"))\n\tgpVertexAttrib3d = (C.GPVERTEXATTRIB3D)(getProcAddr(\"glVertexAttrib3d\"))\n\tif gpVertexAttrib3d == nil {\n\t\treturn errors.New(\"glVertexAttrib3d\")\n\t}\n\tgpVertexAttrib3dARB = (C.GPVERTEXATTRIB3DARB)(getProcAddr(\"glVertexAttrib3dARB\"))\n\tgpVertexAttrib3dNV = (C.GPVERTEXATTRIB3DNV)(getProcAddr(\"glVertexAttrib3dNV\"))\n\tgpVertexAttrib3dv = (C.GPVERTEXATTRIB3DV)(getProcAddr(\"glVertexAttrib3dv\"))\n\tif gpVertexAttrib3dv == nil {\n\t\treturn errors.New(\"glVertexAttrib3dv\")\n\t}\n\tgpVertexAttrib3dvARB = (C.GPVERTEXATTRIB3DVARB)(getProcAddr(\"glVertexAttrib3dvARB\"))\n\tgpVertexAttrib3dvNV = (C.GPVERTEXATTRIB3DVNV)(getProcAddr(\"glVertexAttrib3dvNV\"))\n\tgpVertexAttrib3f = (C.GPVERTEXATTRIB3F)(getProcAddr(\"glVertexAttrib3f\"))\n\tif gpVertexAttrib3f == nil {\n\t\treturn errors.New(\"glVertexAttrib3f\")\n\t}\n\tgpVertexAttrib3fARB = (C.GPVERTEXATTRIB3FARB)(getProcAddr(\"glVertexAttrib3fARB\"))\n\tgpVertexAttrib3fNV = (C.GPVERTEXATTRIB3FNV)(getProcAddr(\"glVertexAttrib3fNV\"))\n\tgpVertexAttrib3fv = (C.GPVERTEXATTRIB3FV)(getProcAddr(\"glVertexAttrib3fv\"))\n\tif gpVertexAttrib3fv == nil {\n\t\treturn errors.New(\"glVertexAttrib3fv\")\n\t}\n\tgpVertexAttrib3fvARB = (C.GPVERTEXATTRIB3FVARB)(getProcAddr(\"glVertexAttrib3fvARB\"))\n\tgpVertexAttrib3fvNV = (C.GPVERTEXATTRIB3FVNV)(getProcAddr(\"glVertexAttrib3fvNV\"))\n\tgpVertexAttrib3hNV = (C.GPVERTEXATTRIB3HNV)(getProcAddr(\"glVertexAttrib3hNV\"))\n\tgpVertexAttrib3hvNV = (C.GPVERTEXATTRIB3HVNV)(getProcAddr(\"glVertexAttrib3hvNV\"))\n\tgpVertexAttrib3s = (C.GPVERTEXATTRIB3S)(getProcAddr(\"glVertexAttrib3s\"))\n\tif gpVertexAttrib3s == nil {\n\t\treturn errors.New(\"glVertexAttrib3s\")\n\t}\n\tgpVertexAttrib3sARB = (C.GPVERTEXATTRIB3SARB)(getProcAddr(\"glVertexAttrib3sARB\"))\n\tgpVertexAttrib3sNV = (C.GPVERTEXATTRIB3SNV)(getProcAddr(\"glVertexAttrib3sNV\"))\n\tgpVertexAttrib3sv = (C.GPVERTEXATTRIB3SV)(getProcAddr(\"glVertexAttrib3sv\"))\n\tif gpVertexAttrib3sv == nil {\n\t\treturn errors.New(\"glVertexAttrib3sv\")\n\t}\n\tgpVertexAttrib3svARB = (C.GPVERTEXATTRIB3SVARB)(getProcAddr(\"glVertexAttrib3svARB\"))\n\tgpVertexAttrib3svNV = (C.GPVERTEXATTRIB3SVNV)(getProcAddr(\"glVertexAttrib3svNV\"))\n\tgpVertexAttrib4Nbv = (C.GPVERTEXATTRIB4NBV)(getProcAddr(\"glVertexAttrib4Nbv\"))\n\tif gpVertexAttrib4Nbv == nil {\n\t\treturn errors.New(\"glVertexAttrib4Nbv\")\n\t}\n\tgpVertexAttrib4NbvARB = (C.GPVERTEXATTRIB4NBVARB)(getProcAddr(\"glVertexAttrib4NbvARB\"))\n\tgpVertexAttrib4Niv = (C.GPVERTEXATTRIB4NIV)(getProcAddr(\"glVertexAttrib4Niv\"))\n\tif gpVertexAttrib4Niv == nil {\n\t\treturn errors.New(\"glVertexAttrib4Niv\")\n\t}\n\tgpVertexAttrib4NivARB = (C.GPVERTEXATTRIB4NIVARB)(getProcAddr(\"glVertexAttrib4NivARB\"))\n\tgpVertexAttrib4Nsv = (C.GPVERTEXATTRIB4NSV)(getProcAddr(\"glVertexAttrib4Nsv\"))\n\tif gpVertexAttrib4Nsv == nil {\n\t\treturn errors.New(\"glVertexAttrib4Nsv\")\n\t}\n\tgpVertexAttrib4NsvARB = (C.GPVERTEXATTRIB4NSVARB)(getProcAddr(\"glVertexAttrib4NsvARB\"))\n\tgpVertexAttrib4Nub = (C.GPVERTEXATTRIB4NUB)(getProcAddr(\"glVertexAttrib4Nub\"))\n\tif gpVertexAttrib4Nub == nil {\n\t\treturn errors.New(\"glVertexAttrib4Nub\")\n\t}\n\tgpVertexAttrib4NubARB = (C.GPVERTEXATTRIB4NUBARB)(getProcAddr(\"glVertexAttrib4NubARB\"))\n\tgpVertexAttrib4Nubv = (C.GPVERTEXATTRIB4NUBV)(getProcAddr(\"glVertexAttrib4Nubv\"))\n\tif gpVertexAttrib4Nubv == nil {\n\t\treturn errors.New(\"glVertexAttrib4Nubv\")\n\t}\n\tgpVertexAttrib4NubvARB = (C.GPVERTEXATTRIB4NUBVARB)(getProcAddr(\"glVertexAttrib4NubvARB\"))\n\tgpVertexAttrib4Nuiv = (C.GPVERTEXATTRIB4NUIV)(getProcAddr(\"glVertexAttrib4Nuiv\"))\n\tif gpVertexAttrib4Nuiv == nil {\n\t\treturn errors.New(\"glVertexAttrib4Nuiv\")\n\t}\n\tgpVertexAttrib4NuivARB = (C.GPVERTEXATTRIB4NUIVARB)(getProcAddr(\"glVertexAttrib4NuivARB\"))\n\tgpVertexAttrib4Nusv = (C.GPVERTEXATTRIB4NUSV)(getProcAddr(\"glVertexAttrib4Nusv\"))\n\tif gpVertexAttrib4Nusv == nil {\n\t\treturn errors.New(\"glVertexAttrib4Nusv\")\n\t}\n\tgpVertexAttrib4NusvARB = (C.GPVERTEXATTRIB4NUSVARB)(getProcAddr(\"glVertexAttrib4NusvARB\"))\n\tgpVertexAttrib4bv = (C.GPVERTEXATTRIB4BV)(getProcAddr(\"glVertexAttrib4bv\"))\n\tif gpVertexAttrib4bv == nil {\n\t\treturn errors.New(\"glVertexAttrib4bv\")\n\t}\n\tgpVertexAttrib4bvARB = (C.GPVERTEXATTRIB4BVARB)(getProcAddr(\"glVertexAttrib4bvARB\"))\n\tgpVertexAttrib4d = (C.GPVERTEXATTRIB4D)(getProcAddr(\"glVertexAttrib4d\"))\n\tif gpVertexAttrib4d == nil {\n\t\treturn errors.New(\"glVertexAttrib4d\")\n\t}\n\tgpVertexAttrib4dARB = (C.GPVERTEXATTRIB4DARB)(getProcAddr(\"glVertexAttrib4dARB\"))\n\tgpVertexAttrib4dNV = (C.GPVERTEXATTRIB4DNV)(getProcAddr(\"glVertexAttrib4dNV\"))\n\tgpVertexAttrib4dv = (C.GPVERTEXATTRIB4DV)(getProcAddr(\"glVertexAttrib4dv\"))\n\tif gpVertexAttrib4dv == nil {\n\t\treturn errors.New(\"glVertexAttrib4dv\")\n\t}\n\tgpVertexAttrib4dvARB = (C.GPVERTEXATTRIB4DVARB)(getProcAddr(\"glVertexAttrib4dvARB\"))\n\tgpVertexAttrib4dvNV = (C.GPVERTEXATTRIB4DVNV)(getProcAddr(\"glVertexAttrib4dvNV\"))\n\tgpVertexAttrib4f = (C.GPVERTEXATTRIB4F)(getProcAddr(\"glVertexAttrib4f\"))\n\tif gpVertexAttrib4f == nil {\n\t\treturn errors.New(\"glVertexAttrib4f\")\n\t}\n\tgpVertexAttrib4fARB = (C.GPVERTEXATTRIB4FARB)(getProcAddr(\"glVertexAttrib4fARB\"))\n\tgpVertexAttrib4fNV = (C.GPVERTEXATTRIB4FNV)(getProcAddr(\"glVertexAttrib4fNV\"))\n\tgpVertexAttrib4fv = (C.GPVERTEXATTRIB4FV)(getProcAddr(\"glVertexAttrib4fv\"))\n\tif gpVertexAttrib4fv == nil {\n\t\treturn errors.New(\"glVertexAttrib4fv\")\n\t}\n\tgpVertexAttrib4fvARB = (C.GPVERTEXATTRIB4FVARB)(getProcAddr(\"glVertexAttrib4fvARB\"))\n\tgpVertexAttrib4fvNV = (C.GPVERTEXATTRIB4FVNV)(getProcAddr(\"glVertexAttrib4fvNV\"))\n\tgpVertexAttrib4hNV = (C.GPVERTEXATTRIB4HNV)(getProcAddr(\"glVertexAttrib4hNV\"))\n\tgpVertexAttrib4hvNV = (C.GPVERTEXATTRIB4HVNV)(getProcAddr(\"glVertexAttrib4hvNV\"))\n\tgpVertexAttrib4iv = (C.GPVERTEXATTRIB4IV)(getProcAddr(\"glVertexAttrib4iv\"))\n\tif gpVertexAttrib4iv == nil {\n\t\treturn errors.New(\"glVertexAttrib4iv\")\n\t}\n\tgpVertexAttrib4ivARB = (C.GPVERTEXATTRIB4IVARB)(getProcAddr(\"glVertexAttrib4ivARB\"))\n\tgpVertexAttrib4s = (C.GPVERTEXATTRIB4S)(getProcAddr(\"glVertexAttrib4s\"))\n\tif gpVertexAttrib4s == nil {\n\t\treturn errors.New(\"glVertexAttrib4s\")\n\t}\n\tgpVertexAttrib4sARB = (C.GPVERTEXATTRIB4SARB)(getProcAddr(\"glVertexAttrib4sARB\"))\n\tgpVertexAttrib4sNV = (C.GPVERTEXATTRIB4SNV)(getProcAddr(\"glVertexAttrib4sNV\"))\n\tgpVertexAttrib4sv = (C.GPVERTEXATTRIB4SV)(getProcAddr(\"glVertexAttrib4sv\"))\n\tif gpVertexAttrib4sv == nil {\n\t\treturn errors.New(\"glVertexAttrib4sv\")\n\t}\n\tgpVertexAttrib4svARB = (C.GPVERTEXATTRIB4SVARB)(getProcAddr(\"glVertexAttrib4svARB\"))\n\tgpVertexAttrib4svNV = (C.GPVERTEXATTRIB4SVNV)(getProcAddr(\"glVertexAttrib4svNV\"))\n\tgpVertexAttrib4ubNV = (C.GPVERTEXATTRIB4UBNV)(getProcAddr(\"glVertexAttrib4ubNV\"))\n\tgpVertexAttrib4ubv = (C.GPVERTEXATTRIB4UBV)(getProcAddr(\"glVertexAttrib4ubv\"))\n\tif gpVertexAttrib4ubv == nil {\n\t\treturn errors.New(\"glVertexAttrib4ubv\")\n\t}\n\tgpVertexAttrib4ubvARB = (C.GPVERTEXATTRIB4UBVARB)(getProcAddr(\"glVertexAttrib4ubvARB\"))\n\tgpVertexAttrib4ubvNV = (C.GPVERTEXATTRIB4UBVNV)(getProcAddr(\"glVertexAttrib4ubvNV\"))\n\tgpVertexAttrib4uiv = (C.GPVERTEXATTRIB4UIV)(getProcAddr(\"glVertexAttrib4uiv\"))\n\tif gpVertexAttrib4uiv == nil {\n\t\treturn errors.New(\"glVertexAttrib4uiv\")\n\t}\n\tgpVertexAttrib4uivARB = (C.GPVERTEXATTRIB4UIVARB)(getProcAddr(\"glVertexAttrib4uivARB\"))\n\tgpVertexAttrib4usv = (C.GPVERTEXATTRIB4USV)(getProcAddr(\"glVertexAttrib4usv\"))\n\tif gpVertexAttrib4usv == nil {\n\t\treturn errors.New(\"glVertexAttrib4usv\")\n\t}\n\tgpVertexAttrib4usvARB = (C.GPVERTEXATTRIB4USVARB)(getProcAddr(\"glVertexAttrib4usvARB\"))\n\tgpVertexAttribArrayObjectATI = (C.GPVERTEXATTRIBARRAYOBJECTATI)(getProcAddr(\"glVertexAttribArrayObjectATI\"))\n\tgpVertexAttribBinding = (C.GPVERTEXATTRIBBINDING)(getProcAddr(\"glVertexAttribBinding\"))\n\tif gpVertexAttribBinding == nil {\n\t\treturn errors.New(\"glVertexAttribBinding\")\n\t}\n\tgpVertexAttribDivisor = (C.GPVERTEXATTRIBDIVISOR)(getProcAddr(\"glVertexAttribDivisor\"))\n\tif gpVertexAttribDivisor == nil {\n\t\treturn errors.New(\"glVertexAttribDivisor\")\n\t}\n\tgpVertexAttribDivisorARB = (C.GPVERTEXATTRIBDIVISORARB)(getProcAddr(\"glVertexAttribDivisorARB\"))\n\tgpVertexAttribFormat = (C.GPVERTEXATTRIBFORMAT)(getProcAddr(\"glVertexAttribFormat\"))\n\tif gpVertexAttribFormat == nil {\n\t\treturn errors.New(\"glVertexAttribFormat\")\n\t}\n\tgpVertexAttribFormatNV = (C.GPVERTEXATTRIBFORMATNV)(getProcAddr(\"glVertexAttribFormatNV\"))\n\tgpVertexAttribI1i = (C.GPVERTEXATTRIBI1I)(getProcAddr(\"glVertexAttribI1i\"))\n\tif gpVertexAttribI1i == nil {\n\t\treturn errors.New(\"glVertexAttribI1i\")\n\t}\n\tgpVertexAttribI1iEXT = (C.GPVERTEXATTRIBI1IEXT)(getProcAddr(\"glVertexAttribI1iEXT\"))\n\tgpVertexAttribI1iv = (C.GPVERTEXATTRIBI1IV)(getProcAddr(\"glVertexAttribI1iv\"))\n\tif gpVertexAttribI1iv == nil {\n\t\treturn errors.New(\"glVertexAttribI1iv\")\n\t}\n\tgpVertexAttribI1ivEXT = (C.GPVERTEXATTRIBI1IVEXT)(getProcAddr(\"glVertexAttribI1ivEXT\"))\n\tgpVertexAttribI1ui = (C.GPVERTEXATTRIBI1UI)(getProcAddr(\"glVertexAttribI1ui\"))\n\tif gpVertexAttribI1ui == nil {\n\t\treturn errors.New(\"glVertexAttribI1ui\")\n\t}\n\tgpVertexAttribI1uiEXT = (C.GPVERTEXATTRIBI1UIEXT)(getProcAddr(\"glVertexAttribI1uiEXT\"))\n\tgpVertexAttribI1uiv = (C.GPVERTEXATTRIBI1UIV)(getProcAddr(\"glVertexAttribI1uiv\"))\n\tif gpVertexAttribI1uiv == nil {\n\t\treturn errors.New(\"glVertexAttribI1uiv\")\n\t}\n\tgpVertexAttribI1uivEXT = (C.GPVERTEXATTRIBI1UIVEXT)(getProcAddr(\"glVertexAttribI1uivEXT\"))\n\tgpVertexAttribI2i = (C.GPVERTEXATTRIBI2I)(getProcAddr(\"glVertexAttribI2i\"))\n\tif gpVertexAttribI2i == nil {\n\t\treturn errors.New(\"glVertexAttribI2i\")\n\t}\n\tgpVertexAttribI2iEXT = (C.GPVERTEXATTRIBI2IEXT)(getProcAddr(\"glVertexAttribI2iEXT\"))\n\tgpVertexAttribI2iv = (C.GPVERTEXATTRIBI2IV)(getProcAddr(\"glVertexAttribI2iv\"))\n\tif gpVertexAttribI2iv == nil {\n\t\treturn errors.New(\"glVertexAttribI2iv\")\n\t}\n\tgpVertexAttribI2ivEXT = (C.GPVERTEXATTRIBI2IVEXT)(getProcAddr(\"glVertexAttribI2ivEXT\"))\n\tgpVertexAttribI2ui = (C.GPVERTEXATTRIBI2UI)(getProcAddr(\"glVertexAttribI2ui\"))\n\tif gpVertexAttribI2ui == nil {\n\t\treturn errors.New(\"glVertexAttribI2ui\")\n\t}\n\tgpVertexAttribI2uiEXT = (C.GPVERTEXATTRIBI2UIEXT)(getProcAddr(\"glVertexAttribI2uiEXT\"))\n\tgpVertexAttribI2uiv = (C.GPVERTEXATTRIBI2UIV)(getProcAddr(\"glVertexAttribI2uiv\"))\n\tif gpVertexAttribI2uiv == nil {\n\t\treturn errors.New(\"glVertexAttribI2uiv\")\n\t}\n\tgpVertexAttribI2uivEXT = (C.GPVERTEXATTRIBI2UIVEXT)(getProcAddr(\"glVertexAttribI2uivEXT\"))\n\tgpVertexAttribI3i = (C.GPVERTEXATTRIBI3I)(getProcAddr(\"glVertexAttribI3i\"))\n\tif gpVertexAttribI3i == nil {\n\t\treturn errors.New(\"glVertexAttribI3i\")\n\t}\n\tgpVertexAttribI3iEXT = (C.GPVERTEXATTRIBI3IEXT)(getProcAddr(\"glVertexAttribI3iEXT\"))\n\tgpVertexAttribI3iv = (C.GPVERTEXATTRIBI3IV)(getProcAddr(\"glVertexAttribI3iv\"))\n\tif gpVertexAttribI3iv == nil {\n\t\treturn errors.New(\"glVertexAttribI3iv\")\n\t}\n\tgpVertexAttribI3ivEXT = (C.GPVERTEXATTRIBI3IVEXT)(getProcAddr(\"glVertexAttribI3ivEXT\"))\n\tgpVertexAttribI3ui = (C.GPVERTEXATTRIBI3UI)(getProcAddr(\"glVertexAttribI3ui\"))\n\tif gpVertexAttribI3ui == nil {\n\t\treturn errors.New(\"glVertexAttribI3ui\")\n\t}\n\tgpVertexAttribI3uiEXT = (C.GPVERTEXATTRIBI3UIEXT)(getProcAddr(\"glVertexAttribI3uiEXT\"))\n\tgpVertexAttribI3uiv = (C.GPVERTEXATTRIBI3UIV)(getProcAddr(\"glVertexAttribI3uiv\"))\n\tif gpVertexAttribI3uiv == nil {\n\t\treturn errors.New(\"glVertexAttribI3uiv\")\n\t}\n\tgpVertexAttribI3uivEXT = (C.GPVERTEXATTRIBI3UIVEXT)(getProcAddr(\"glVertexAttribI3uivEXT\"))\n\tgpVertexAttribI4bv = (C.GPVERTEXATTRIBI4BV)(getProcAddr(\"glVertexAttribI4bv\"))\n\tif gpVertexAttribI4bv == nil {\n\t\treturn errors.New(\"glVertexAttribI4bv\")\n\t}\n\tgpVertexAttribI4bvEXT = (C.GPVERTEXATTRIBI4BVEXT)(getProcAddr(\"glVertexAttribI4bvEXT\"))\n\tgpVertexAttribI4i = (C.GPVERTEXATTRIBI4I)(getProcAddr(\"glVertexAttribI4i\"))\n\tif gpVertexAttribI4i == nil {\n\t\treturn errors.New(\"glVertexAttribI4i\")\n\t}\n\tgpVertexAttribI4iEXT = (C.GPVERTEXATTRIBI4IEXT)(getProcAddr(\"glVertexAttribI4iEXT\"))\n\tgpVertexAttribI4iv = (C.GPVERTEXATTRIBI4IV)(getProcAddr(\"glVertexAttribI4iv\"))\n\tif gpVertexAttribI4iv == nil {\n\t\treturn errors.New(\"glVertexAttribI4iv\")\n\t}\n\tgpVertexAttribI4ivEXT = (C.GPVERTEXATTRIBI4IVEXT)(getProcAddr(\"glVertexAttribI4ivEXT\"))\n\tgpVertexAttribI4sv = (C.GPVERTEXATTRIBI4SV)(getProcAddr(\"glVertexAttribI4sv\"))\n\tif gpVertexAttribI4sv == nil {\n\t\treturn errors.New(\"glVertexAttribI4sv\")\n\t}\n\tgpVertexAttribI4svEXT = (C.GPVERTEXATTRIBI4SVEXT)(getProcAddr(\"glVertexAttribI4svEXT\"))\n\tgpVertexAttribI4ubv = (C.GPVERTEXATTRIBI4UBV)(getProcAddr(\"glVertexAttribI4ubv\"))\n\tif gpVertexAttribI4ubv == nil {\n\t\treturn errors.New(\"glVertexAttribI4ubv\")\n\t}\n\tgpVertexAttribI4ubvEXT = (C.GPVERTEXATTRIBI4UBVEXT)(getProcAddr(\"glVertexAttribI4ubvEXT\"))\n\tgpVertexAttribI4ui = (C.GPVERTEXATTRIBI4UI)(getProcAddr(\"glVertexAttribI4ui\"))\n\tif gpVertexAttribI4ui == nil {\n\t\treturn errors.New(\"glVertexAttribI4ui\")\n\t}\n\tgpVertexAttribI4uiEXT = (C.GPVERTEXATTRIBI4UIEXT)(getProcAddr(\"glVertexAttribI4uiEXT\"))\n\tgpVertexAttribI4uiv = (C.GPVERTEXATTRIBI4UIV)(getProcAddr(\"glVertexAttribI4uiv\"))\n\tif gpVertexAttribI4uiv == nil {\n\t\treturn errors.New(\"glVertexAttribI4uiv\")\n\t}\n\tgpVertexAttribI4uivEXT = (C.GPVERTEXATTRIBI4UIVEXT)(getProcAddr(\"glVertexAttribI4uivEXT\"))\n\tgpVertexAttribI4usv = (C.GPVERTEXATTRIBI4USV)(getProcAddr(\"glVertexAttribI4usv\"))\n\tif gpVertexAttribI4usv == nil {\n\t\treturn errors.New(\"glVertexAttribI4usv\")\n\t}\n\tgpVertexAttribI4usvEXT = (C.GPVERTEXATTRIBI4USVEXT)(getProcAddr(\"glVertexAttribI4usvEXT\"))\n\tgpVertexAttribIFormat = (C.GPVERTEXATTRIBIFORMAT)(getProcAddr(\"glVertexAttribIFormat\"))\n\tif gpVertexAttribIFormat == nil {\n\t\treturn errors.New(\"glVertexAttribIFormat\")\n\t}\n\tgpVertexAttribIFormatNV = (C.GPVERTEXATTRIBIFORMATNV)(getProcAddr(\"glVertexAttribIFormatNV\"))\n\tgpVertexAttribIPointer = (C.GPVERTEXATTRIBIPOINTER)(getProcAddr(\"glVertexAttribIPointer\"))\n\tif gpVertexAttribIPointer == nil {\n\t\treturn errors.New(\"glVertexAttribIPointer\")\n\t}\n\tgpVertexAttribIPointerEXT = (C.GPVERTEXATTRIBIPOINTEREXT)(getProcAddr(\"glVertexAttribIPointerEXT\"))\n\tgpVertexAttribL1d = (C.GPVERTEXATTRIBL1D)(getProcAddr(\"glVertexAttribL1d\"))\n\tif gpVertexAttribL1d == nil {\n\t\treturn errors.New(\"glVertexAttribL1d\")\n\t}\n\tgpVertexAttribL1dEXT = (C.GPVERTEXATTRIBL1DEXT)(getProcAddr(\"glVertexAttribL1dEXT\"))\n\tgpVertexAttribL1dv = (C.GPVERTEXATTRIBL1DV)(getProcAddr(\"glVertexAttribL1dv\"))\n\tif gpVertexAttribL1dv == nil {\n\t\treturn errors.New(\"glVertexAttribL1dv\")\n\t}\n\tgpVertexAttribL1dvEXT = (C.GPVERTEXATTRIBL1DVEXT)(getProcAddr(\"glVertexAttribL1dvEXT\"))\n\tgpVertexAttribL1i64NV = (C.GPVERTEXATTRIBL1I64NV)(getProcAddr(\"glVertexAttribL1i64NV\"))\n\tgpVertexAttribL1i64vNV = (C.GPVERTEXATTRIBL1I64VNV)(getProcAddr(\"glVertexAttribL1i64vNV\"))\n\tgpVertexAttribL1ui64ARB = (C.GPVERTEXATTRIBL1UI64ARB)(getProcAddr(\"glVertexAttribL1ui64ARB\"))\n\tgpVertexAttribL1ui64NV = (C.GPVERTEXATTRIBL1UI64NV)(getProcAddr(\"glVertexAttribL1ui64NV\"))\n\tgpVertexAttribL1ui64vARB = (C.GPVERTEXATTRIBL1UI64VARB)(getProcAddr(\"glVertexAttribL1ui64vARB\"))\n\tgpVertexAttribL1ui64vNV = (C.GPVERTEXATTRIBL1UI64VNV)(getProcAddr(\"glVertexAttribL1ui64vNV\"))\n\tgpVertexAttribL2d = (C.GPVERTEXATTRIBL2D)(getProcAddr(\"glVertexAttribL2d\"))\n\tif gpVertexAttribL2d == nil {\n\t\treturn errors.New(\"glVertexAttribL2d\")\n\t}\n\tgpVertexAttribL2dEXT = (C.GPVERTEXATTRIBL2DEXT)(getProcAddr(\"glVertexAttribL2dEXT\"))\n\tgpVertexAttribL2dv = (C.GPVERTEXATTRIBL2DV)(getProcAddr(\"glVertexAttribL2dv\"))\n\tif gpVertexAttribL2dv == nil {\n\t\treturn errors.New(\"glVertexAttribL2dv\")\n\t}\n\tgpVertexAttribL2dvEXT = (C.GPVERTEXATTRIBL2DVEXT)(getProcAddr(\"glVertexAttribL2dvEXT\"))\n\tgpVertexAttribL2i64NV = (C.GPVERTEXATTRIBL2I64NV)(getProcAddr(\"glVertexAttribL2i64NV\"))\n\tgpVertexAttribL2i64vNV = (C.GPVERTEXATTRIBL2I64VNV)(getProcAddr(\"glVertexAttribL2i64vNV\"))\n\tgpVertexAttribL2ui64NV = (C.GPVERTEXATTRIBL2UI64NV)(getProcAddr(\"glVertexAttribL2ui64NV\"))\n\tgpVertexAttribL2ui64vNV = (C.GPVERTEXATTRIBL2UI64VNV)(getProcAddr(\"glVertexAttribL2ui64vNV\"))\n\tgpVertexAttribL3d = (C.GPVERTEXATTRIBL3D)(getProcAddr(\"glVertexAttribL3d\"))\n\tif gpVertexAttribL3d == nil {\n\t\treturn errors.New(\"glVertexAttribL3d\")\n\t}\n\tgpVertexAttribL3dEXT = (C.GPVERTEXATTRIBL3DEXT)(getProcAddr(\"glVertexAttribL3dEXT\"))\n\tgpVertexAttribL3dv = (C.GPVERTEXATTRIBL3DV)(getProcAddr(\"glVertexAttribL3dv\"))\n\tif gpVertexAttribL3dv == nil {\n\t\treturn errors.New(\"glVertexAttribL3dv\")\n\t}\n\tgpVertexAttribL3dvEXT = (C.GPVERTEXATTRIBL3DVEXT)(getProcAddr(\"glVertexAttribL3dvEXT\"))\n\tgpVertexAttribL3i64NV = (C.GPVERTEXATTRIBL3I64NV)(getProcAddr(\"glVertexAttribL3i64NV\"))\n\tgpVertexAttribL3i64vNV = (C.GPVERTEXATTRIBL3I64VNV)(getProcAddr(\"glVertexAttribL3i64vNV\"))\n\tgpVertexAttribL3ui64NV = (C.GPVERTEXATTRIBL3UI64NV)(getProcAddr(\"glVertexAttribL3ui64NV\"))\n\tgpVertexAttribL3ui64vNV = (C.GPVERTEXATTRIBL3UI64VNV)(getProcAddr(\"glVertexAttribL3ui64vNV\"))\n\tgpVertexAttribL4d = (C.GPVERTEXATTRIBL4D)(getProcAddr(\"glVertexAttribL4d\"))\n\tif gpVertexAttribL4d == nil {\n\t\treturn errors.New(\"glVertexAttribL4d\")\n\t}\n\tgpVertexAttribL4dEXT = (C.GPVERTEXATTRIBL4DEXT)(getProcAddr(\"glVertexAttribL4dEXT\"))\n\tgpVertexAttribL4dv = (C.GPVERTEXATTRIBL4DV)(getProcAddr(\"glVertexAttribL4dv\"))\n\tif gpVertexAttribL4dv == nil {\n\t\treturn errors.New(\"glVertexAttribL4dv\")\n\t}\n\tgpVertexAttribL4dvEXT = (C.GPVERTEXATTRIBL4DVEXT)(getProcAddr(\"glVertexAttribL4dvEXT\"))\n\tgpVertexAttribL4i64NV = (C.GPVERTEXATTRIBL4I64NV)(getProcAddr(\"glVertexAttribL4i64NV\"))\n\tgpVertexAttribL4i64vNV = (C.GPVERTEXATTRIBL4I64VNV)(getProcAddr(\"glVertexAttribL4i64vNV\"))\n\tgpVertexAttribL4ui64NV = (C.GPVERTEXATTRIBL4UI64NV)(getProcAddr(\"glVertexAttribL4ui64NV\"))\n\tgpVertexAttribL4ui64vNV = (C.GPVERTEXATTRIBL4UI64VNV)(getProcAddr(\"glVertexAttribL4ui64vNV\"))\n\tgpVertexAttribLFormat = (C.GPVERTEXATTRIBLFORMAT)(getProcAddr(\"glVertexAttribLFormat\"))\n\tif gpVertexAttribLFormat == nil {\n\t\treturn errors.New(\"glVertexAttribLFormat\")\n\t}\n\tgpVertexAttribLFormatNV = (C.GPVERTEXATTRIBLFORMATNV)(getProcAddr(\"glVertexAttribLFormatNV\"))\n\tgpVertexAttribLPointer = (C.GPVERTEXATTRIBLPOINTER)(getProcAddr(\"glVertexAttribLPointer\"))\n\tif gpVertexAttribLPointer == nil {\n\t\treturn errors.New(\"glVertexAttribLPointer\")\n\t}\n\tgpVertexAttribLPointerEXT = (C.GPVERTEXATTRIBLPOINTEREXT)(getProcAddr(\"glVertexAttribLPointerEXT\"))\n\tgpVertexAttribP1ui = (C.GPVERTEXATTRIBP1UI)(getProcAddr(\"glVertexAttribP1ui\"))\n\tif gpVertexAttribP1ui == nil {\n\t\treturn errors.New(\"glVertexAttribP1ui\")\n\t}\n\tgpVertexAttribP1uiv = (C.GPVERTEXATTRIBP1UIV)(getProcAddr(\"glVertexAttribP1uiv\"))\n\tif gpVertexAttribP1uiv == nil {\n\t\treturn errors.New(\"glVertexAttribP1uiv\")\n\t}\n\tgpVertexAttribP2ui = (C.GPVERTEXATTRIBP2UI)(getProcAddr(\"glVertexAttribP2ui\"))\n\tif gpVertexAttribP2ui == nil {\n\t\treturn errors.New(\"glVertexAttribP2ui\")\n\t}\n\tgpVertexAttribP2uiv = (C.GPVERTEXATTRIBP2UIV)(getProcAddr(\"glVertexAttribP2uiv\"))\n\tif gpVertexAttribP2uiv == nil {\n\t\treturn errors.New(\"glVertexAttribP2uiv\")\n\t}\n\tgpVertexAttribP3ui = (C.GPVERTEXATTRIBP3UI)(getProcAddr(\"glVertexAttribP3ui\"))\n\tif gpVertexAttribP3ui == nil {\n\t\treturn errors.New(\"glVertexAttribP3ui\")\n\t}\n\tgpVertexAttribP3uiv = (C.GPVERTEXATTRIBP3UIV)(getProcAddr(\"glVertexAttribP3uiv\"))\n\tif gpVertexAttribP3uiv == nil {\n\t\treturn errors.New(\"glVertexAttribP3uiv\")\n\t}\n\tgpVertexAttribP4ui = (C.GPVERTEXATTRIBP4UI)(getProcAddr(\"glVertexAttribP4ui\"))\n\tif gpVertexAttribP4ui == nil {\n\t\treturn errors.New(\"glVertexAttribP4ui\")\n\t}\n\tgpVertexAttribP4uiv = (C.GPVERTEXATTRIBP4UIV)(getProcAddr(\"glVertexAttribP4uiv\"))\n\tif gpVertexAttribP4uiv == nil {\n\t\treturn errors.New(\"glVertexAttribP4uiv\")\n\t}\n\tgpVertexAttribParameteriAMD = (C.GPVERTEXATTRIBPARAMETERIAMD)(getProcAddr(\"glVertexAttribParameteriAMD\"))\n\tgpVertexAttribPointer = (C.GPVERTEXATTRIBPOINTER)(getProcAddr(\"glVertexAttribPointer\"))\n\tif gpVertexAttribPointer == nil {\n\t\treturn errors.New(\"glVertexAttribPointer\")\n\t}\n\tgpVertexAttribPointerARB = (C.GPVERTEXATTRIBPOINTERARB)(getProcAddr(\"glVertexAttribPointerARB\"))\n\tgpVertexAttribPointerNV = (C.GPVERTEXATTRIBPOINTERNV)(getProcAddr(\"glVertexAttribPointerNV\"))\n\tgpVertexAttribs1dvNV = (C.GPVERTEXATTRIBS1DVNV)(getProcAddr(\"glVertexAttribs1dvNV\"))\n\tgpVertexAttribs1fvNV = (C.GPVERTEXATTRIBS1FVNV)(getProcAddr(\"glVertexAttribs1fvNV\"))\n\tgpVertexAttribs1hvNV = (C.GPVERTEXATTRIBS1HVNV)(getProcAddr(\"glVertexAttribs1hvNV\"))\n\tgpVertexAttribs1svNV = (C.GPVERTEXATTRIBS1SVNV)(getProcAddr(\"glVertexAttribs1svNV\"))\n\tgpVertexAttribs2dvNV = (C.GPVERTEXATTRIBS2DVNV)(getProcAddr(\"glVertexAttribs2dvNV\"))\n\tgpVertexAttribs2fvNV = (C.GPVERTEXATTRIBS2FVNV)(getProcAddr(\"glVertexAttribs2fvNV\"))\n\tgpVertexAttribs2hvNV = (C.GPVERTEXATTRIBS2HVNV)(getProcAddr(\"glVertexAttribs2hvNV\"))\n\tgpVertexAttribs2svNV = (C.GPVERTEXATTRIBS2SVNV)(getProcAddr(\"glVertexAttribs2svNV\"))\n\tgpVertexAttribs3dvNV = (C.GPVERTEXATTRIBS3DVNV)(getProcAddr(\"glVertexAttribs3dvNV\"))\n\tgpVertexAttribs3fvNV = (C.GPVERTEXATTRIBS3FVNV)(getProcAddr(\"glVertexAttribs3fvNV\"))\n\tgpVertexAttribs3hvNV = (C.GPVERTEXATTRIBS3HVNV)(getProcAddr(\"glVertexAttribs3hvNV\"))\n\tgpVertexAttribs3svNV = (C.GPVERTEXATTRIBS3SVNV)(getProcAddr(\"glVertexAttribs3svNV\"))\n\tgpVertexAttribs4dvNV = (C.GPVERTEXATTRIBS4DVNV)(getProcAddr(\"glVertexAttribs4dvNV\"))\n\tgpVertexAttribs4fvNV = (C.GPVERTEXATTRIBS4FVNV)(getProcAddr(\"glVertexAttribs4fvNV\"))\n\tgpVertexAttribs4hvNV = (C.GPVERTEXATTRIBS4HVNV)(getProcAddr(\"glVertexAttribs4hvNV\"))\n\tgpVertexAttribs4svNV = (C.GPVERTEXATTRIBS4SVNV)(getProcAddr(\"glVertexAttribs4svNV\"))\n\tgpVertexAttribs4ubvNV = (C.GPVERTEXATTRIBS4UBVNV)(getProcAddr(\"glVertexAttribs4ubvNV\"))\n\tgpVertexBindingDivisor = (C.GPVERTEXBINDINGDIVISOR)(getProcAddr(\"glVertexBindingDivisor\"))\n\tif gpVertexBindingDivisor == nil {\n\t\treturn errors.New(\"glVertexBindingDivisor\")\n\t}\n\tgpVertexBlendARB = (C.GPVERTEXBLENDARB)(getProcAddr(\"glVertexBlendARB\"))\n\tgpVertexBlendEnvfATI = (C.GPVERTEXBLENDENVFATI)(getProcAddr(\"glVertexBlendEnvfATI\"))\n\tgpVertexBlendEnviATI = (C.GPVERTEXBLENDENVIATI)(getProcAddr(\"glVertexBlendEnviATI\"))\n\tgpVertexFormatNV = (C.GPVERTEXFORMATNV)(getProcAddr(\"glVertexFormatNV\"))\n\tgpVertexP2ui = (C.GPVERTEXP2UI)(getProcAddr(\"glVertexP2ui\"))\n\tif gpVertexP2ui == nil {\n\t\treturn errors.New(\"glVertexP2ui\")\n\t}\n\tgpVertexP2uiv = (C.GPVERTEXP2UIV)(getProcAddr(\"glVertexP2uiv\"))\n\tif gpVertexP2uiv == nil {\n\t\treturn errors.New(\"glVertexP2uiv\")\n\t}\n\tgpVertexP3ui = (C.GPVERTEXP3UI)(getProcAddr(\"glVertexP3ui\"))\n\tif gpVertexP3ui == nil {\n\t\treturn errors.New(\"glVertexP3ui\")\n\t}\n\tgpVertexP3uiv = (C.GPVERTEXP3UIV)(getProcAddr(\"glVertexP3uiv\"))\n\tif gpVertexP3uiv == nil {\n\t\treturn errors.New(\"glVertexP3uiv\")\n\t}\n\tgpVertexP4ui = (C.GPVERTEXP4UI)(getProcAddr(\"glVertexP4ui\"))\n\tif gpVertexP4ui == nil {\n\t\treturn errors.New(\"glVertexP4ui\")\n\t}\n\tgpVertexP4uiv = (C.GPVERTEXP4UIV)(getProcAddr(\"glVertexP4uiv\"))\n\tif gpVertexP4uiv == nil {\n\t\treturn errors.New(\"glVertexP4uiv\")\n\t}\n\tgpVertexPointer = (C.GPVERTEXPOINTER)(getProcAddr(\"glVertexPointer\"))\n\tif gpVertexPointer == nil {\n\t\treturn errors.New(\"glVertexPointer\")\n\t}\n\tgpVertexPointerEXT = (C.GPVERTEXPOINTEREXT)(getProcAddr(\"glVertexPointerEXT\"))\n\tgpVertexPointerListIBM = (C.GPVERTEXPOINTERLISTIBM)(getProcAddr(\"glVertexPointerListIBM\"))\n\tgpVertexPointervINTEL = (C.GPVERTEXPOINTERVINTEL)(getProcAddr(\"glVertexPointervINTEL\"))\n\tgpVertexStream1dATI = (C.GPVERTEXSTREAM1DATI)(getProcAddr(\"glVertexStream1dATI\"))\n\tgpVertexStream1dvATI = (C.GPVERTEXSTREAM1DVATI)(getProcAddr(\"glVertexStream1dvATI\"))\n\tgpVertexStream1fATI = (C.GPVERTEXSTREAM1FATI)(getProcAddr(\"glVertexStream1fATI\"))\n\tgpVertexStream1fvATI = (C.GPVERTEXSTREAM1FVATI)(getProcAddr(\"glVertexStream1fvATI\"))\n\tgpVertexStream1iATI = (C.GPVERTEXSTREAM1IATI)(getProcAddr(\"glVertexStream1iATI\"))\n\tgpVertexStream1ivATI = (C.GPVERTEXSTREAM1IVATI)(getProcAddr(\"glVertexStream1ivATI\"))\n\tgpVertexStream1sATI = (C.GPVERTEXSTREAM1SATI)(getProcAddr(\"glVertexStream1sATI\"))\n\tgpVertexStream1svATI = (C.GPVERTEXSTREAM1SVATI)(getProcAddr(\"glVertexStream1svATI\"))\n\tgpVertexStream2dATI = (C.GPVERTEXSTREAM2DATI)(getProcAddr(\"glVertexStream2dATI\"))\n\tgpVertexStream2dvATI = (C.GPVERTEXSTREAM2DVATI)(getProcAddr(\"glVertexStream2dvATI\"))\n\tgpVertexStream2fATI = (C.GPVERTEXSTREAM2FATI)(getProcAddr(\"glVertexStream2fATI\"))\n\tgpVertexStream2fvATI = (C.GPVERTEXSTREAM2FVATI)(getProcAddr(\"glVertexStream2fvATI\"))\n\tgpVertexStream2iATI = (C.GPVERTEXSTREAM2IATI)(getProcAddr(\"glVertexStream2iATI\"))\n\tgpVertexStream2ivATI = (C.GPVERTEXSTREAM2IVATI)(getProcAddr(\"glVertexStream2ivATI\"))\n\tgpVertexStream2sATI = (C.GPVERTEXSTREAM2SATI)(getProcAddr(\"glVertexStream2sATI\"))\n\tgpVertexStream2svATI = (C.GPVERTEXSTREAM2SVATI)(getProcAddr(\"glVertexStream2svATI\"))\n\tgpVertexStream3dATI = (C.GPVERTEXSTREAM3DATI)(getProcAddr(\"glVertexStream3dATI\"))\n\tgpVertexStream3dvATI = (C.GPVERTEXSTREAM3DVATI)(getProcAddr(\"glVertexStream3dvATI\"))\n\tgpVertexStream3fATI = (C.GPVERTEXSTREAM3FATI)(getProcAddr(\"glVertexStream3fATI\"))\n\tgpVertexStream3fvATI = (C.GPVERTEXSTREAM3FVATI)(getProcAddr(\"glVertexStream3fvATI\"))\n\tgpVertexStream3iATI = (C.GPVERTEXSTREAM3IATI)(getProcAddr(\"glVertexStream3iATI\"))\n\tgpVertexStream3ivATI = (C.GPVERTEXSTREAM3IVATI)(getProcAddr(\"glVertexStream3ivATI\"))\n\tgpVertexStream3sATI = (C.GPVERTEXSTREAM3SATI)(getProcAddr(\"glVertexStream3sATI\"))\n\tgpVertexStream3svATI = (C.GPVERTEXSTREAM3SVATI)(getProcAddr(\"glVertexStream3svATI\"))\n\tgpVertexStream4dATI = (C.GPVERTEXSTREAM4DATI)(getProcAddr(\"glVertexStream4dATI\"))\n\tgpVertexStream4dvATI = (C.GPVERTEXSTREAM4DVATI)(getProcAddr(\"glVertexStream4dvATI\"))\n\tgpVertexStream4fATI = (C.GPVERTEXSTREAM4FATI)(getProcAddr(\"glVertexStream4fATI\"))\n\tgpVertexStream4fvATI = (C.GPVERTEXSTREAM4FVATI)(getProcAddr(\"glVertexStream4fvATI\"))\n\tgpVertexStream4iATI = (C.GPVERTEXSTREAM4IATI)(getProcAddr(\"glVertexStream4iATI\"))\n\tgpVertexStream4ivATI = (C.GPVERTEXSTREAM4IVATI)(getProcAddr(\"glVertexStream4ivATI\"))\n\tgpVertexStream4sATI = (C.GPVERTEXSTREAM4SATI)(getProcAddr(\"glVertexStream4sATI\"))\n\tgpVertexStream4svATI = (C.GPVERTEXSTREAM4SVATI)(getProcAddr(\"glVertexStream4svATI\"))\n\tgpVertexWeightPointerEXT = (C.GPVERTEXWEIGHTPOINTEREXT)(getProcAddr(\"glVertexWeightPointerEXT\"))\n\tgpVertexWeightfEXT = (C.GPVERTEXWEIGHTFEXT)(getProcAddr(\"glVertexWeightfEXT\"))\n\tgpVertexWeightfvEXT = (C.GPVERTEXWEIGHTFVEXT)(getProcAddr(\"glVertexWeightfvEXT\"))\n\tgpVertexWeighthNV = (C.GPVERTEXWEIGHTHNV)(getProcAddr(\"glVertexWeighthNV\"))\n\tgpVertexWeighthvNV = (C.GPVERTEXWEIGHTHVNV)(getProcAddr(\"glVertexWeighthvNV\"))\n\tgpVideoCaptureNV = (C.GPVIDEOCAPTURENV)(getProcAddr(\"glVideoCaptureNV\"))\n\tgpVideoCaptureStreamParameterdvNV = (C.GPVIDEOCAPTURESTREAMPARAMETERDVNV)(getProcAddr(\"glVideoCaptureStreamParameterdvNV\"))\n\tgpVideoCaptureStreamParameterfvNV = (C.GPVIDEOCAPTURESTREAMPARAMETERFVNV)(getProcAddr(\"glVideoCaptureStreamParameterfvNV\"))\n\tgpVideoCaptureStreamParameterivNV = (C.GPVIDEOCAPTURESTREAMPARAMETERIVNV)(getProcAddr(\"glVideoCaptureStreamParameterivNV\"))\n\tgpViewport = (C.GPVIEWPORT)(getProcAddr(\"glViewport\"))\n\tif gpViewport == nil {\n\t\treturn errors.New(\"glViewport\")\n\t}\n\tgpViewportArrayv = (C.GPVIEWPORTARRAYV)(getProcAddr(\"glViewportArrayv\"))\n\tif gpViewportArrayv == nil {\n\t\treturn errors.New(\"glViewportArrayv\")\n\t}\n\tgpViewportIndexedf = (C.GPVIEWPORTINDEXEDF)(getProcAddr(\"glViewportIndexedf\"))\n\tif gpViewportIndexedf == nil {\n\t\treturn errors.New(\"glViewportIndexedf\")\n\t}\n\tgpViewportIndexedfv = (C.GPVIEWPORTINDEXEDFV)(getProcAddr(\"glViewportIndexedfv\"))\n\tif gpViewportIndexedfv == nil {\n\t\treturn errors.New(\"glViewportIndexedfv\")\n\t}\n\tgpViewportPositionWScaleNV = (C.GPVIEWPORTPOSITIONWSCALENV)(getProcAddr(\"glViewportPositionWScaleNV\"))\n\tgpViewportSwizzleNV = (C.GPVIEWPORTSWIZZLENV)(getProcAddr(\"glViewportSwizzleNV\"))\n\tgpWaitSemaphoreEXT = (C.GPWAITSEMAPHOREEXT)(getProcAddr(\"glWaitSemaphoreEXT\"))\n\tgpWaitSemaphoreui64NVX = (C.GPWAITSEMAPHOREUI64NVX)(getProcAddr(\"glWaitSemaphoreui64NVX\"))\n\tgpWaitSync = (C.GPWAITSYNC)(getProcAddr(\"glWaitSync\"))\n\tif gpWaitSync == nil {\n\t\treturn errors.New(\"glWaitSync\")\n\t}\n\tgpWaitVkSemaphoreNV = (C.GPWAITVKSEMAPHORENV)(getProcAddr(\"glWaitVkSemaphoreNV\"))\n\tgpWeightPathsNV = (C.GPWEIGHTPATHSNV)(getProcAddr(\"glWeightPathsNV\"))\n\tgpWeightPointerARB = (C.GPWEIGHTPOINTERARB)(getProcAddr(\"glWeightPointerARB\"))\n\tgpWeightbvARB = (C.GPWEIGHTBVARB)(getProcAddr(\"glWeightbvARB\"))\n\tgpWeightdvARB = (C.GPWEIGHTDVARB)(getProcAddr(\"glWeightdvARB\"))\n\tgpWeightfvARB = (C.GPWEIGHTFVARB)(getProcAddr(\"glWeightfvARB\"))\n\tgpWeightivARB = (C.GPWEIGHTIVARB)(getProcAddr(\"glWeightivARB\"))\n\tgpWeightsvARB = (C.GPWEIGHTSVARB)(getProcAddr(\"glWeightsvARB\"))\n\tgpWeightubvARB = (C.GPWEIGHTUBVARB)(getProcAddr(\"glWeightubvARB\"))\n\tgpWeightuivARB = (C.GPWEIGHTUIVARB)(getProcAddr(\"glWeightuivARB\"))\n\tgpWeightusvARB = (C.GPWEIGHTUSVARB)(getProcAddr(\"glWeightusvARB\"))\n\tgpWindowPos2d = (C.GPWINDOWPOS2D)(getProcAddr(\"glWindowPos2d\"))\n\tif gpWindowPos2d == nil {\n\t\treturn errors.New(\"glWindowPos2d\")\n\t}\n\tgpWindowPos2dARB = (C.GPWINDOWPOS2DARB)(getProcAddr(\"glWindowPos2dARB\"))\n\tgpWindowPos2dMESA = (C.GPWINDOWPOS2DMESA)(getProcAddr(\"glWindowPos2dMESA\"))\n\tgpWindowPos2dv = (C.GPWINDOWPOS2DV)(getProcAddr(\"glWindowPos2dv\"))\n\tif gpWindowPos2dv == nil {\n\t\treturn errors.New(\"glWindowPos2dv\")\n\t}\n\tgpWindowPos2dvARB = (C.GPWINDOWPOS2DVARB)(getProcAddr(\"glWindowPos2dvARB\"))\n\tgpWindowPos2dvMESA = (C.GPWINDOWPOS2DVMESA)(getProcAddr(\"glWindowPos2dvMESA\"))\n\tgpWindowPos2f = (C.GPWINDOWPOS2F)(getProcAddr(\"glWindowPos2f\"))\n\tif gpWindowPos2f == nil {\n\t\treturn errors.New(\"glWindowPos2f\")\n\t}\n\tgpWindowPos2fARB = (C.GPWINDOWPOS2FARB)(getProcAddr(\"glWindowPos2fARB\"))\n\tgpWindowPos2fMESA = (C.GPWINDOWPOS2FMESA)(getProcAddr(\"glWindowPos2fMESA\"))\n\tgpWindowPos2fv = (C.GPWINDOWPOS2FV)(getProcAddr(\"glWindowPos2fv\"))\n\tif gpWindowPos2fv == nil {\n\t\treturn errors.New(\"glWindowPos2fv\")\n\t}\n\tgpWindowPos2fvARB = (C.GPWINDOWPOS2FVARB)(getProcAddr(\"glWindowPos2fvARB\"))\n\tgpWindowPos2fvMESA = (C.GPWINDOWPOS2FVMESA)(getProcAddr(\"glWindowPos2fvMESA\"))\n\tgpWindowPos2i = (C.GPWINDOWPOS2I)(getProcAddr(\"glWindowPos2i\"))\n\tif gpWindowPos2i == nil {\n\t\treturn errors.New(\"glWindowPos2i\")\n\t}\n\tgpWindowPos2iARB = (C.GPWINDOWPOS2IARB)(getProcAddr(\"glWindowPos2iARB\"))\n\tgpWindowPos2iMESA = (C.GPWINDOWPOS2IMESA)(getProcAddr(\"glWindowPos2iMESA\"))\n\tgpWindowPos2iv = (C.GPWINDOWPOS2IV)(getProcAddr(\"glWindowPos2iv\"))\n\tif gpWindowPos2iv == nil {\n\t\treturn errors.New(\"glWindowPos2iv\")\n\t}\n\tgpWindowPos2ivARB = (C.GPWINDOWPOS2IVARB)(getProcAddr(\"glWindowPos2ivARB\"))\n\tgpWindowPos2ivMESA = (C.GPWINDOWPOS2IVMESA)(getProcAddr(\"glWindowPos2ivMESA\"))\n\tgpWindowPos2s = (C.GPWINDOWPOS2S)(getProcAddr(\"glWindowPos2s\"))\n\tif gpWindowPos2s == nil {\n\t\treturn errors.New(\"glWindowPos2s\")\n\t}\n\tgpWindowPos2sARB = (C.GPWINDOWPOS2SARB)(getProcAddr(\"glWindowPos2sARB\"))\n\tgpWindowPos2sMESA = (C.GPWINDOWPOS2SMESA)(getProcAddr(\"glWindowPos2sMESA\"))\n\tgpWindowPos2sv = (C.GPWINDOWPOS2SV)(getProcAddr(\"glWindowPos2sv\"))\n\tif gpWindowPos2sv == nil {\n\t\treturn errors.New(\"glWindowPos2sv\")\n\t}\n\tgpWindowPos2svARB = (C.GPWINDOWPOS2SVARB)(getProcAddr(\"glWindowPos2svARB\"))\n\tgpWindowPos2svMESA = (C.GPWINDOWPOS2SVMESA)(getProcAddr(\"glWindowPos2svMESA\"))\n\tgpWindowPos3d = (C.GPWINDOWPOS3D)(getProcAddr(\"glWindowPos3d\"))\n\tif gpWindowPos3d == nil {\n\t\treturn errors.New(\"glWindowPos3d\")\n\t}\n\tgpWindowPos3dARB = (C.GPWINDOWPOS3DARB)(getProcAddr(\"glWindowPos3dARB\"))\n\tgpWindowPos3dMESA = (C.GPWINDOWPOS3DMESA)(getProcAddr(\"glWindowPos3dMESA\"))\n\tgpWindowPos3dv = (C.GPWINDOWPOS3DV)(getProcAddr(\"glWindowPos3dv\"))\n\tif gpWindowPos3dv == nil {\n\t\treturn errors.New(\"glWindowPos3dv\")\n\t}\n\tgpWindowPos3dvARB = (C.GPWINDOWPOS3DVARB)(getProcAddr(\"glWindowPos3dvARB\"))\n\tgpWindowPos3dvMESA = (C.GPWINDOWPOS3DVMESA)(getProcAddr(\"glWindowPos3dvMESA\"))\n\tgpWindowPos3f = (C.GPWINDOWPOS3F)(getProcAddr(\"glWindowPos3f\"))\n\tif gpWindowPos3f == nil {\n\t\treturn errors.New(\"glWindowPos3f\")\n\t}\n\tgpWindowPos3fARB = (C.GPWINDOWPOS3FARB)(getProcAddr(\"glWindowPos3fARB\"))\n\tgpWindowPos3fMESA = (C.GPWINDOWPOS3FMESA)(getProcAddr(\"glWindowPos3fMESA\"))\n\tgpWindowPos3fv = (C.GPWINDOWPOS3FV)(getProcAddr(\"glWindowPos3fv\"))\n\tif gpWindowPos3fv == nil {\n\t\treturn errors.New(\"glWindowPos3fv\")\n\t}\n\tgpWindowPos3fvARB = (C.GPWINDOWPOS3FVARB)(getProcAddr(\"glWindowPos3fvARB\"))\n\tgpWindowPos3fvMESA = (C.GPWINDOWPOS3FVMESA)(getProcAddr(\"glWindowPos3fvMESA\"))\n\tgpWindowPos3i = (C.GPWINDOWPOS3I)(getProcAddr(\"glWindowPos3i\"))\n\tif gpWindowPos3i == nil {\n\t\treturn errors.New(\"glWindowPos3i\")\n\t}\n\tgpWindowPos3iARB = (C.GPWINDOWPOS3IARB)(getProcAddr(\"glWindowPos3iARB\"))\n\tgpWindowPos3iMESA = (C.GPWINDOWPOS3IMESA)(getProcAddr(\"glWindowPos3iMESA\"))\n\tgpWindowPos3iv = (C.GPWINDOWPOS3IV)(getProcAddr(\"glWindowPos3iv\"))\n\tif gpWindowPos3iv == nil {\n\t\treturn errors.New(\"glWindowPos3iv\")\n\t}\n\tgpWindowPos3ivARB = (C.GPWINDOWPOS3IVARB)(getProcAddr(\"glWindowPos3ivARB\"))\n\tgpWindowPos3ivMESA = (C.GPWINDOWPOS3IVMESA)(getProcAddr(\"glWindowPos3ivMESA\"))\n\tgpWindowPos3s = (C.GPWINDOWPOS3S)(getProcAddr(\"glWindowPos3s\"))\n\tif gpWindowPos3s == nil {\n\t\treturn errors.New(\"glWindowPos3s\")\n\t}\n\tgpWindowPos3sARB = (C.GPWINDOWPOS3SARB)(getProcAddr(\"glWindowPos3sARB\"))\n\tgpWindowPos3sMESA = (C.GPWINDOWPOS3SMESA)(getProcAddr(\"glWindowPos3sMESA\"))\n\tgpWindowPos3sv = (C.GPWINDOWPOS3SV)(getProcAddr(\"glWindowPos3sv\"))\n\tif gpWindowPos3sv == nil {\n\t\treturn errors.New(\"glWindowPos3sv\")\n\t}\n\tgpWindowPos3svARB = (C.GPWINDOWPOS3SVARB)(getProcAddr(\"glWindowPos3svARB\"))\n\tgpWindowPos3svMESA = (C.GPWINDOWPOS3SVMESA)(getProcAddr(\"glWindowPos3svMESA\"))\n\tgpWindowPos4dMESA = (C.GPWINDOWPOS4DMESA)(getProcAddr(\"glWindowPos4dMESA\"))\n\tgpWindowPos4dvMESA = (C.GPWINDOWPOS4DVMESA)(getProcAddr(\"glWindowPos4dvMESA\"))\n\tgpWindowPos4fMESA = (C.GPWINDOWPOS4FMESA)(getProcAddr(\"glWindowPos4fMESA\"))\n\tgpWindowPos4fvMESA = (C.GPWINDOWPOS4FVMESA)(getProcAddr(\"glWindowPos4fvMESA\"))\n\tgpWindowPos4iMESA = (C.GPWINDOWPOS4IMESA)(getProcAddr(\"glWindowPos4iMESA\"))\n\tgpWindowPos4ivMESA = (C.GPWINDOWPOS4IVMESA)(getProcAddr(\"glWindowPos4ivMESA\"))\n\tgpWindowPos4sMESA = (C.GPWINDOWPOS4SMESA)(getProcAddr(\"glWindowPos4sMESA\"))\n\tgpWindowPos4svMESA = (C.GPWINDOWPOS4SVMESA)(getProcAddr(\"glWindowPos4svMESA\"))\n\tgpWindowRectanglesEXT = (C.GPWINDOWRECTANGLESEXT)(getProcAddr(\"glWindowRectanglesEXT\"))\n\tgpWriteMaskEXT = (C.GPWRITEMASKEXT)(getProcAddr(\"glWriteMaskEXT\"))\n\treturn nil\n}", "func (p *BW) HasAlpha() bool {\n\treturn false\n}", "func (asf authorizationStrategyFactory) Create(c *Credentials) Strategy {\n\treturn newExternalTokenStrategy(asf.create(c))\n}", "func (s *invadersSystem) createAlien(x, y int, sprite, alt image.Rectangle, points int) {\n\te := s.world.SpawnEntity()\n\tpos := components.NewPosition(x, y)\n\ts.world.AddComponent(e.Id(), pos)\n\ts.world.AddComponent(e.Id(), components.NewStatus(components.StatusActive))\n\ts.world.AddComponent(e.Id(), components.NewSprite(s.src, sprite, alt, alienExplode))\n\ts.world.AddComponent(e.Id(), components.NewCollision(sprite))\n\ts.world.AddComponent(e.Id(), components.NewInvader(points))\n\n\ts.invaders[e.Id()] = pos\n}", "func CreateAlphabet(description []string) Alphabet {\n\talphabets := make([]Alphabet, 0)\n\n\tfor _, symbols := range description {\n\t\tif alphabet, ok := alphabetMap[symbols]; ok {\n\t\t\talphabets = append(alphabets, alphabet)\n\t\t\tcontinue\n\t\t}\n\n\t\talphabets = append(alphabets, NewSimpleAlphabet([]rune(symbols)))\n\t}\n\n\treturn NewCompositeAlphabet(alphabets)\n}", "func createAlphaCursorOrIconFromImage(im image.Image, hotspot image.Point, fIcon bool) (HICON, error) {\n\n\thBitmap, err := hBitmapFromImage(im)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tdefer DeleteObject(HGDIOBJ(hBitmap))\n\n\t// Create an empty mask bitmap.\n\thMonoBitmap := CreateBitmap(int32(im.Bounds().Dx()), int32(im.Bounds().Dy()), 1, 1, nil)\n\tif hMonoBitmap == 0 {\n\t\treturn 0, newError(\"CreateBitmap failed\")\n\t}\n\tdefer DeleteObject(HGDIOBJ(hMonoBitmap))\n\n\tvar ii ICONINFO\n\tif fIcon {\n\t\tii.FIcon = TRUE\n\t}\n\tii.XHotspot = uint32(hotspot.X)\n\tii.YHotspot = uint32(hotspot.Y)\n\tii.HbmMask = hMonoBitmap\n\tii.HbmColor = hBitmap\n\n\t// Create the alpha cursor with the alpha DIB section.\n\thIconOrCursor := CreateIconIndirect(&ii)\n\n\treturn hIconOrCursor, nil\n}", "func Create(constructor func() base.IGameObject2D) base.IGameObject2D {\r\n\treturn doCreate(constructor, infra.BoolPtr_True)\r\n}", "func LRNGradAlpha(value float32) LRNGradAttr {\n\treturn func(m optionalAttr) {\n\t\tm[\"alpha\"] = value\n\t}\n}", "func NewInstanceExemplar(srcPtr interface{}) factory.Exemplar {\n\n\ttyp := reflect.TypeOf(srcPtr)\n\n\tif typ.Kind() != reflect.Ptr {\n\t\tpanic(\"Should be a pointer\")\n\t}\n\n\ttyp = typ.Elem()\n\n\treturn &nie{\n\t\ttyp: typ,\n\t\th: fmt.Sprintf(\"%x\", sha256.Sum256([]byte(typ.String()))),\n\t}\n}", "func (obj *material) Alpha() Alpha {\n\treturn obj.alpha\n}", "func (d *Activity) ACreate() error {\n\treturn nil\n}", "func (bi *baseInstance) toBeta() *beta.Instance {\n\tinst := &beta.Instance{Name: bi.name, Zone: bi.zone, NetworkInterfaces: []*beta.NetworkInterface{{}}}\n\tif bi.aliasRange != \"\" {\n\t\tinst.NetworkInterfaces[0].AliasIpRanges = []*beta.AliasIpRange{\n\t\t\t{IpCidrRange: bi.aliasRange, SubnetworkRangeName: util.TestSecondaryRangeName},\n\t\t}\n\t}\n\treturn inst\n}", "func New(rnd *random.Random) *Fn {\n\treturn &Fn{\n\t\trnd: rnd,\n\t}\n}", "func (*CreateInstanceGroup) name() string {\n\treturn \"createInstanceGroup\"\n}", "func TypeCreateInstance(type_ Type) *TypeInstance {\n\tc_type := (C.GType)(type_)\n\n\tretC := C.g_type_create_instance(c_type)\n\tretGo := TypeInstanceNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "func New(nodeIDs []gpa.NodeID, me gpa.NodeID, f int, ccCreateFun func(round int) gpa.GPA, log *logger.Logger) ABA {\n\tnodeIdx := map[gpa.NodeID]bool{}\n\tfor _, n := range nodeIDs {\n\t\tnodeIdx[n] = true\n\t}\n\ta := &abaImpl{\n\t\tnodeIDs: nodeIDs,\n\t\tnodeIdx: nodeIdx,\n\t\tround: -1,\n\t\tccInsts: []gpa.GPA{},\n\t\tccCreateFun: ccCreateFun,\n\t\toutput: nil,\n\t\tpostponedMsgs: []*msgVote{},\n\t\tlog: log,\n\t}\n\ta.varBinVals = newBinVals(nodeIDs, f, a.uponBinValuesUpdated)\n\ta.varAuxVals = newAuxVals(nodeIDs, f, a.uponAuxValsReady)\n\ta.varDone = newVarDone(nodeIDs, me, f, a.uponTerminationCondition, log)\n\ta.uponDecisionInputs = newUponDecisionInputs(a.uponDecisionInputsReceived)\n\ta.msgWrapper = gpa.NewMsgWrapper(msgTypeWrapped, a.selectSubsystem)\n\ta.asGPA = gpa.NewOwnHandler(me, a)\n\treturn a\n}", "func (p *FuncPool) AddInstance(fID, imageName string) (string, error) {\n\tf := p.getFunction(fID, imageName)\n\n\tlogger := log.WithFields(log.Fields{\"fID\": f.fID})\n\n\tf.OnceAddInstance.Do(\n\t\tfunc() {\n\t\t\tlogger.Debug(\"Function is inactive, starting the instance...\")\n\t\t\tf.AddInstance()\n\t\t})\n\n\treturn \"Instance started\", nil\n}", "func (h *acmeAdminResponder) CreateExternalAccountKey(w http.ResponseWriter, _ *http.Request) {\n\trender.Error(w, admin.NewError(admin.ErrorNotImplementedType, \"this functionality is currently only available in Certificate Manager: https://u.step.sm/cm\"))\n}", "func createLatestService(t *testing.T, clients *test.Clients, names test.ResourceNames) (*v1alpha1.Service, error) {\n\topt := v1alpha1testing.WithInlineConfigSpec(*v1a1test.ConfigurationSpec(names.Image, &v1a1test.Options{}))\n\tservice := v1alpha1testing.ServiceWithoutNamespace(names.Service, opt)\n\tv1a1test.LogResourceObject(t, v1a1test.ResourceObjects{Service: service})\n\treturn clients.ServingAlphaClient.Services.Create(service)\n}", "func CreateBuiltinAssign() *functions.BuiltinFunction {\n\treturn functions.NewBuiltinFunction(Assign, 2, false)\n}", "func WrapInstantiateFunc(f func(p Params) (check.Func, error)) func (interface{}) (check.Func, error) {\n\treturn func(paramsInt interface{}) (check.Func, error) {\n\t\treturn f(paramsInt.(Params))\n\t}\n}", "func newInstance(moduleName, name string, priv interface{}) (*BaseInstance, error) {\n\tfactory, found := instanceFactories[moduleName]\n\tif !found {\n\t\treturn nil, fmt.Errorf(\"Module '%s' doesn't exist.\\n\", moduleName)\n\t}\n\n\trp, ok := ringParams[moduleName]\n\tif !ok {\n\t\trp = defaultRingParam\n\t}\n\n\tbi := &BaseInstance{name: name}\n\n\tringName := fmt.Sprintf(\"input-%s\", name)\n\tbi.input = dpdk.RingCreate(ringName, rp.Count, rp.SocketId, dpdk.RING_F_SC_DEQ)\n\tif bi.input == nil {\n\t\treturn nil, fmt.Errorf(\"Input ring creation faild for %s.\\n\", name)\n\t}\n\n\tif rp.SecondaryInput {\n\t\tringName := fmt.Sprintf(\"input2-%s\", name)\n\t\tbi.input2 = dpdk.RingCreate(ringName, rp.Count, rp.SocketId, dpdk.RING_F_SC_DEQ)\n\t\tif bi.input2 == nil {\n\t\t\treturn nil, fmt.Errorf(\"Second input ring creation failed for %s\", name)\n\t\t}\n\t}\n\n\tbi.rules = newRules()\n\n\tinstance, err := factory(bi, priv)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Creating module '%s' with name '%s' failed: %v\\n\", moduleName, name, err)\n\t}\n\tbi.instance = instance\n\n\treturn bi, nil\n}", "func (bil *baseInstanceList) newBetaGetHook() func(ctx context.Context, key *meta.Key, m *cloud.MockBetaInstances) (bool, *beta.Instance, error) {\n\treturn func(ctx context.Context, key *meta.Key, m *cloud.MockBetaInstances) (bool, *beta.Instance, error) {\n\t\tm.Lock.Lock()\n\t\tdefer m.Lock.Unlock()\n\n\t\tif _, found := m.Objects[*key]; !found {\n\t\t\tm.Objects[*key] = &cloud.MockInstancesObj{Obj: bil.getOrCreateBaseInstance(key).toBeta()}\n\t\t}\n\t\treturn false, nil, nil\n\t}\n}", "func (a *HyperflexApiService) CreateHyperflexFeatureLimitExternal(ctx context.Context) ApiCreateHyperflexFeatureLimitExternalRequest {\n\treturn ApiCreateHyperflexFeatureLimitExternalRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "func newExponentialBackoff() *exponentialBackoff {\n\tb := &backoff.Backoff{\n\t\tMin: DefaultMinBackoff,\n\t\tMax: DefaultMaxBackoff,\n\t\tJitter: true,\n\t}\n\treturn &exponentialBackoff{b: *b, currentDelay: b.Duration()}\n}", "func (b *BetaDistribution) GetAlpha() float64 {\n\treturn b.alpha\n}", "func newInstance(x *runtime.Runtime, p *build.Instance, v *adt.Vertex) *Instance {\n\t// TODO: associate root source with structLit.\n\tinst := &Instance{\n\t\troot: v,\n\t\tinst: p,\n\t}\n\tif p != nil {\n\t\tinst.ImportPath = p.ImportPath\n\t\tinst.Dir = p.Dir\n\t\tinst.PkgName = p.PkgName\n\t\tinst.DisplayName = p.ImportPath\n\t\tif p.Err != nil {\n\t\t\tinst.setListOrError(p.Err)\n\t\t}\n\t}\n\n\tx.AddInst(p.ImportPath, v, p)\n\tx.SetBuildData(p, inst)\n\tinst.index = x\n\treturn inst\n}", "func (d *driverMock) CreateInstance(ctx context.Context, publicKey string) (string, error) {\n\tif d.CreateInstanceErr != nil {\n\t\treturn \"\", d.CreateInstanceErr\n\t}\n\n\td.CreateInstanceID = \"ocid1...\"\n\n\treturn d.CreateInstanceID, nil\n}", "func (c *Color) Alpha() float32 {\n\treturn c.a\n}", "func (fd FeatureDefinition) Create() Feature {\n\tfeature := C.OGR_F_Create(fd.cval)\n\treturn Feature{feature}\n}", "func (f *FakeInstance) Create(_ context.Context, _ *govultr.InstanceCreateReq) (*govultr.Instance, *http.Response, error) {\n\tpanic(\"implement me\")\n}", "func (wds *WeaponAISystem) New(w *ecs.World) {\n\n}", "func (c *InstanceManagerClient) EngineInstanceCreate(req *EngineInstanceCreateRequest) (*longhorn.InstanceProcess, error) {\n\tif err := CheckInstanceManagerCompatibility(c.apiMinVersion, c.apiVersion); err != nil {\n\t\treturn nil, err\n\t}\n\n\tbinary := \"\"\n\targs := []string{}\n\treplicaAddresses := map[string]string{}\n\n\tvar err error\n\n\tfrontend, err := GetEngineInstanceFrontend(req.Engine.Spec.BackendStoreDriver, req.VolumeFrontend)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tswitch req.Engine.Spec.BackendStoreDriver {\n\tcase longhorn.BackendStoreDriverTypeV1:\n\t\tbinary, args, err = getBinaryAndArgsForEngineProcessCreation(req.Engine, frontend, req.EngineReplicaTimeout, req.ReplicaFileSyncHTTPClientTimeout, req.DataLocality, req.EngineCLIAPIVersion)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\tcase longhorn.BackendStoreDriverTypeV2:\n\t\treplicaAddresses = req.Engine.Status.CurrentReplicaAddressMap\n\t}\n\n\tif c.GetAPIVersion() < 4 {\n\t\t/* Fall back to the old way of creating engine process */\n\t\tprocess, err := c.processManagerGrpcClient.ProcessCreate(req.Engine.Name, binary, DefaultEnginePortCount, args, []string{DefaultPortArg})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn parseProcess(imapi.RPCToProcess(process)), nil\n\t}\n\n\tinstance, err := c.instanceServiceGrpcClient.InstanceCreate(&imclient.InstanceCreateRequest{\n\t\tBackendStoreDriver: string(req.Engine.Spec.BackendStoreDriver),\n\t\tName: req.Engine.Name,\n\t\tInstanceType: string(longhorn.InstanceManagerTypeEngine),\n\t\tVolumeName: req.Engine.Spec.VolumeName,\n\t\tSize: uint64(req.Engine.Spec.VolumeSize),\n\t\tPortCount: DefaultEnginePortCount,\n\t\tPortArgs: []string{DefaultPortArg},\n\n\t\tBinary: binary,\n\t\tBinaryArgs: args,\n\n\t\tEngine: imclient.EngineCreateRequest{\n\t\t\tReplicaAddressMap: replicaAddresses,\n\t\t\tFrontend: frontend,\n\t\t},\n\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn parseInstance(instance), nil\n}", "func DefaultInstance() *FunctionProvider {\n\tif instance == nil {\n\t\tinstance = &(FunctionProvider{})\n\t}\n\n\treturn instance\n}", "func (vp *scalewayProvider) CreateInstance(log *logging.Logger, options providers.CreateInstanceOptions, dnsProvider providers.DnsProvider) (providers.ClusterInstance, error) {\n\t// Create server\n\tid, err := vp.createServer(options)\n\tif err != nil {\n\t\treturn providers.ClusterInstance{}, maskAny(err)\n\t}\n\n\t// Wait for the server to be active\n\tserver, err := vp.waitUntilServerActive(id, false)\n\tif err != nil {\n\t\treturn providers.ClusterInstance{}, maskAny(err)\n\t}\n\n\tif options.RoleLoadBalancer {\n\t\tpublicIpv4 := server.PublicAddress.IP\n\t\tpublicIpv6 := \"\"\n\t\tif err := providers.RegisterInstance(vp.Logger, dnsProvider, options, server.Name, options.RoleLoadBalancer, publicIpv4, publicIpv6); err != nil {\n\t\t\treturn providers.ClusterInstance{}, maskAny(err)\n\t\t}\n\t}\n\n\tvp.Logger.Infof(\"Server '%s' is ready\", server.Name)\n\n\treturn vp.clusterInstance(server, false), nil\n}", "func CreateIngress(name string) *extv1beta1.Ingress {\n\treturn &extv1beta1.Ingress{\n\t\tTypeMeta: genTypeMeta(gvk.Ingress),\n\t\tObjectMeta: genObjectMeta(name, true),\n\t\tSpec: extv1beta1.IngressSpec{\n\t\t\tBackend: &extv1beta1.IngressBackend{\n\t\t\t\tServiceName: \"app\",\n\t\t\t\tServicePort: intstr.FromInt(80),\n\t\t\t},\n\t\t},\n\t}\n}", "func LeakyReluAlpha(value float32) LeakyReluAttr {\n\treturn func(m optionalAttr) {\n\t\tm[\"alpha\"] = value\n\t}\n}", "func (client BaseClient) CreateFeatureInstanceSender(req *http.Request) (*http.Response, error) {\n\treturn autorest.SendWithSender(client, req,\n\t\tautorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n}", "func newProtonInstance(proton core.Protoner) reflect.Value {\n\tbaseValue := reflect.ValueOf(proton)\n\n\t// try to create new value of proton\n\tmethod := baseValue.MethodByName(\"New\")\n\tif method.IsValid() {\n\t\treturns := method.Call(emptyParameters)\n\t\tif len(returns) <= 0 {\n\t\t\tpanic(fmt.Sprintf(\"Method New must has at least 1 returns. now %d\", len(returns)))\n\t\t}\n\t\treturn returns[0]\n\t} else {\n\t\t// return reflect.New(reflect.TypeOf(proton).Elem())\n\t\treturn newInstance(reflect.TypeOf(proton))\n\t}\n}", "func CreateInactive(constructor func() base.IGameObject2D) base.IGameObject2D {\r\n\treturn doCreate(constructor, infra.BoolPtr_False)\r\n}", "func NewCreateFnDefault(code int) *CreateFnDefault {\n\treturn &CreateFnDefault{\n\t\t_statusCode: code,\n\t}\n}", "func isAlpha(b byte) bool {\n\treturn (b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z')\n}", "func isAlpha(b byte) bool {\n\treturn (b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z')\n}", "func NewAnt(graph *g.Graph, alpha, beta uint) *Ant {\n\tvar ant Ant\n\n\tant.graph = graph\n\tant.alpha = alpha\n\tant.beta = beta\n\n\t// place the ant at a random position on the graph\n\tinitialVertex := graph.GetRandomVertex()\n\tant.currentVertex = initialVertex\n\tant.visitedVertices = make(map[float64]*g.Vertex)\n\tant.visitedVertices[initialVertex.Hash()] = initialVertex\n\tant.tour = []*g.Vertex{initialVertex}\n\n\treturn &ant\n}", "func DrawArraysInstancedBaseInstance(mode uint32, first int32, count int32, instancecount int32, baseinstance uint32) {\n C.glowDrawArraysInstancedBaseInstance(gpDrawArraysInstancedBaseInstance, (C.GLenum)(mode), (C.GLint)(first), (C.GLsizei)(count), (C.GLsizei)(instancecount), (C.GLuint)(baseinstance))\n}", "func SampleAlpha(alpha string) {\n\n}", "func (h *Adapter) CreateInstance(kubeconfig []byte, contextName string, ch *chan interface{}) error {\n\terr := h.validateKubeconfig(kubeconfig)\n\tif err != nil {\n\t\treturn ErrCreateInstance(err)\n\t}\n\n\terr = h.createKubeClient(kubeconfig)\n\tif err != nil {\n\t\treturn ErrCreateInstance(err)\n\t}\n\n\terr = h.createKubeconfig(kubeconfig)\n\tif err != nil {\n\t\treturn ErrCreateInstance(err)\n\t}\n\n\terr = h.createMesheryKubeclient(kubeconfig)\n\tif err != nil {\n\t\treturn ErrCreateInstance(err)\n\t}\n\n\th.ClientcmdConfig.CurrentContext = contextName\n\th.Channel = ch\n\n\treturn nil\n}", "func (c *Client) CreateInstance(displayName, availabilityDomain, compartmentID, nodeShape, nodeImageName, nodeSubnetID, sshUser, authorizedKeys string, nodeOCPUs, nodeMemoryInGBs int) (string, error) {\n\n\treq := identity.ListAvailabilityDomainsRequest{}\n\treq.CompartmentId = &compartmentID\n\tads, err := c.identityClient.ListAvailabilityDomains(context.Background(), req)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Just in case shortened or lower-case availability domain name was used\n\tlog.Debugf(\"Resolving availability domain from %s\", availabilityDomain)\n\tfor _, ad := range ads.Items {\n\t\tif strings.Contains(*ad.Name, strings.ToUpper(availabilityDomain)) {\n\t\t\tlog.Debugf(\"Availability domain %s\", *ad.Name)\n\t\t\tavailabilityDomain = *ad.Name\n\t\t}\n\t}\n\n\timageID, err := c.getImageID(compartmentID, nodeImageName)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// Create the launch compute instance request\n\trequest := core.LaunchInstanceRequest{\n\t\tLaunchInstanceDetails: core.LaunchInstanceDetails{\n\t\t\tAvailabilityDomain: &availabilityDomain,\n\t\t\tCompartmentId: &compartmentID,\n\t\t\tShape: &nodeShape,\n\t\t\tCreateVnicDetails: &core.CreateVnicDetails{\n\t\t\t\tSubnetId: &nodeSubnetID,\n\t\t\t},\n\t\t\tDisplayName: &displayName,\n\t\t\tMetadata: map[string]string{\n\t\t\t\t\"ssh_authorized_keys\": authorizedKeys,\n\t\t\t\t\"user_data\": base64.StdEncoding.EncodeToString(createCloudInitScript(sshUser)),\n\t\t\t},\n\t\t\tSourceDetails: core.InstanceSourceViaImageDetails{\n\t\t\t\tImageId: imageID,\n\t\t\t},\n\t\t},\n\t}\n\n\tif nodeOCPUs > 0 {\n\t\toCPUs := float32(nodeOCPUs)\n\t\tmemoryInGBs := float32(nodeMemoryInGBs)\n\n\t\tLaunchInstanceShapeConfigDetails := core.LaunchInstanceShapeConfigDetails{\n\t\t\tOcpus: &oCPUs,\n\t\t\tMemoryInGBs: &memoryInGBs,\n\t\t}\n\t\trequest.ShapeConfig = &LaunchInstanceShapeConfigDetails\n\t}\n\n\tlog.Debugf(\"Launching instance with cloud-init: %s\", string(createCloudInitScript(sshUser)))\n\n\tcreateResp, err := c.computeClient.LaunchInstance(context.Background(), request)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\t// wait until lifecycle status is Running\n\tpollUntilRunning := func(r common.OCIOperationResponse) bool {\n\t\tif converted, ok := r.Response.(core.GetInstanceResponse); ok {\n\t\t\treturn converted.LifecycleState != core.InstanceLifecycleStateRunning\n\t\t}\n\t\treturn true\n\t}\n\n\t// create get instance request with a retry policy which takes a function\n\t// to determine shouldRetry or not\n\tpollingGetRequest := core.GetInstanceRequest{\n\t\tInstanceId: createResp.Instance.Id,\n\t\tRequestMetadata: helpers.GetRequestMetadataWithCustomizedRetryPolicy(pollUntilRunning),\n\t}\n\n\tinstance, pollError := c.computeClient.GetInstance(context.Background(), pollingGetRequest)\n\tif pollError != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn *instance.Id, nil\n}", "func TestAlphaToBetaConversion(t *testing.T) {\n\ttests := []struct {\n\t\tname string\n\t\tinput *ArgoCD\n\t\texpectedOutput *v1beta1.ArgoCD\n\t}{\n\t\t// dex conversion\n\t\t{\n\t\t\tname: \".dex -> .sso.dex\",\n\t\t\tinput: makeTestArgoCDAlpha(func(cr *ArgoCD) {\n\t\t\t\tcr.Spec.Dex = &ArgoCDDexSpec{\n\t\t\t\t\tOpenShiftOAuth: true,\n\t\t\t\t\tImage: \"test\",\n\t\t\t\t\tVersion: \"latest\",\n\t\t\t\t}\n\t\t\t}),\n\t\t\texpectedOutput: makeTestArgoCDBeta(func(cr *v1beta1.ArgoCD) {\n\t\t\t\tcr.Spec.SSO = &v1beta1.ArgoCDSSOSpec{\n\t\t\t\t\tProvider: \"dex\",\n\t\t\t\t\tDex: &v1beta1.ArgoCDDexSpec{\n\t\t\t\t\t\tOpenShiftOAuth: true,\n\t\t\t\t\t\tImage: \"test\",\n\t\t\t\t\t\tVersion: \"latest\",\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t}),\n\t\t},\n\t\t{\n\t\t\tname: \"Conflict: .dex & .sso.dex -> .sso.dex (values from v1alpha1.spec.dex)\",\n\t\t\tinput: makeTestArgoCDAlpha(func(cr *ArgoCD) {\n\t\t\t\tcr.Spec.Dex = &ArgoCDDexSpec{\n\t\t\t\t\tOpenShiftOAuth: true,\n\t\t\t\t\tResources: &corev1.ResourceRequirements{\n\t\t\t\t\t\tLimits: corev1.ResourceList{\n\t\t\t\t\t\t\tcorev1.ResourceMemory: resourcev1.MustParse(\"2048Mi\"),\n\t\t\t\t\t\t\tcorev1.ResourceCPU: resourcev1.MustParse(\"2000m\"),\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t\tcr.Spec.SSO = &ArgoCDSSOSpec{\n\t\t\t\t\tProvider: SSOProviderTypeDex,\n\t\t\t\t\tDex: &ArgoCDDexSpec{\n\t\t\t\t\t\tConfig: \"test-config\",\n\t\t\t\t\t\tImage: \"test-image\",\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t}),\n\t\t\texpectedOutput: makeTestArgoCDBeta(func(cr *v1beta1.ArgoCD) {\n\t\t\t\tcr.Spec.SSO = &v1beta1.ArgoCDSSOSpec{\n\t\t\t\t\tProvider: v1beta1.SSOProviderTypeDex,\n\t\t\t\t\tDex: &v1beta1.ArgoCDDexSpec{\n\t\t\t\t\t\tOpenShiftOAuth: true,\n\t\t\t\t\t\tResources: &corev1.ResourceRequirements{\n\t\t\t\t\t\t\tLimits: corev1.ResourceList{\n\t\t\t\t\t\t\t\tcorev1.ResourceMemory: resourcev1.MustParse(\"2048Mi\"),\n\t\t\t\t\t\t\t\tcorev1.ResourceCPU: resourcev1.MustParse(\"2000m\"),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t}),\n\t\t},\n\t\t{\n\t\t\tname: \"Missing dex provider: .dex & .sso.dex -> .spec.sso(values from v1alpha1.spec.dex with dex provider set)\",\n\t\t\tinput: makeTestArgoCDAlpha(func(cr *ArgoCD) {\n\t\t\t\tcr.Spec.Dex = &ArgoCDDexSpec{\n\t\t\t\t\tConfig: \"test-config\",\n\t\t\t\t}\n\t\t\t\tcr.Spec.SSO = &ArgoCDSSOSpec{\n\t\t\t\t\tDex: &ArgoCDDexSpec{\n\t\t\t\t\t\tOpenShiftOAuth: false,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t}),\n\t\t\texpectedOutput: makeTestArgoCDBeta(func(cr *v1beta1.ArgoCD) {\n\t\t\t\tcr.Spec.SSO = &v1beta1.ArgoCDSSOSpec{\n\t\t\t\t\tProvider: v1beta1.SSOProviderTypeDex,\n\t\t\t\t\tDex: &v1beta1.ArgoCDDexSpec{\n\t\t\t\t\t\tConfig: \"test-config\",\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t}),\n\t\t},\n\t\t{\n\t\t\tname: \"Missing dex provider without deprecated dex: .sso.dex -> .sso(values from v1alpha1.spec.sso)\",\n\t\t\tinput: makeTestArgoCDAlpha(func(cr *ArgoCD) {\n\t\t\t\tcr.Spec.SSO = &ArgoCDSSOSpec{\n\t\t\t\t\tDex: &ArgoCDDexSpec{\n\t\t\t\t\t\tOpenShiftOAuth: false,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t}),\n\t\t\texpectedOutput: makeTestArgoCDBeta(func(cr *v1beta1.ArgoCD) {\n\t\t\t\tcr.Spec.SSO = &v1beta1.ArgoCDSSOSpec{\n\t\t\t\t\tDex: &v1beta1.ArgoCDDexSpec{\n\t\t\t\t\t\tOpenShiftOAuth: false,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t}),\n\t\t},\n\n\t\t// dex + keycloak - .spec.dex has more priority\n\t\t{\n\t\t\tname: \"Conflict: .dex & .sso.keycloak provider -> .sso.dex + .sso.keycloak with dex provider\",\n\t\t\tinput: makeTestArgoCDAlpha(func(cr *ArgoCD) {\n\t\t\t\tcr.Spec.Dex = &ArgoCDDexSpec{\n\t\t\t\t\tOpenShiftOAuth: true,\n\t\t\t\t}\n\t\t\t\tcr.Spec.SSO = &ArgoCDSSOSpec{\n\t\t\t\t\tProvider: SSOProviderTypeKeycloak,\n\t\t\t\t\tKeycloak: &ArgoCDKeycloakSpec{\n\t\t\t\t\t\tImage: \"keycloak\",\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t}),\n\t\t\texpectedOutput: makeTestArgoCDBeta(func(cr *v1beta1.ArgoCD) {\n\t\t\t\tcr.Spec.SSO = &v1beta1.ArgoCDSSOSpec{\n\t\t\t\t\tProvider: v1beta1.SSOProviderTypeDex,\n\t\t\t\t\tDex: &v1beta1.ArgoCDDexSpec{\n\t\t\t\t\t\tOpenShiftOAuth: true,\n\t\t\t\t\t},\n\t\t\t\t\tKeycloak: &v1beta1.ArgoCDKeycloakSpec{\n\t\t\t\t\t\tImage: \"keycloak\",\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t}),\n\t\t},\n\n\t\t// keycloak conversion\n\t\t{\n\t\t\tname: \".sso.VerifyTLS -> .sso.Keycloak.VerifyTLS\",\n\t\t\tinput: makeTestArgoCDAlpha(func(cr *ArgoCD) {\n\t\t\t\ttls := new(bool)\n\t\t\t\t*tls = false\n\t\t\t\tcr.Spec.SSO = &ArgoCDSSOSpec{\n\t\t\t\t\tProvider: SSOProviderTypeKeycloak,\n\t\t\t\t\tKeycloak: &ArgoCDKeycloakSpec{\n\t\t\t\t\t\tRootCA: \"__CA__\",\n\t\t\t\t\t},\n\t\t\t\t\tVerifyTLS: tls,\n\t\t\t\t}\n\t\t\t}),\n\t\t\texpectedOutput: makeTestArgoCDBeta(func(cr *v1beta1.ArgoCD) {\n\t\t\t\ttls := new(bool)\n\t\t\t\t*tls = false\n\t\t\t\tcr.Spec.SSO = &v1beta1.ArgoCDSSOSpec{\n\t\t\t\t\tProvider: v1beta1.SSOProviderTypeKeycloak,\n\t\t\t\t\tKeycloak: &v1beta1.ArgoCDKeycloakSpec{\n\t\t\t\t\t\tRootCA: \"__CA__\",\n\t\t\t\t\t\tVerifyTLS: tls,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t}),\n\t\t},\n\t\t{\n\t\t\tname: \".sso.Image without provider -> .sso.Keycloak.Image without provider\",\n\t\t\tinput: makeTestArgoCDAlpha(func(cr *ArgoCD) {\n\t\t\t\tcr.Spec.SSO = &ArgoCDSSOSpec{\n\t\t\t\t\tImage: \"test-image\",\n\t\t\t\t}\n\t\t\t}),\n\t\t\texpectedOutput: makeTestArgoCDBeta(func(cr *v1beta1.ArgoCD) {\n\t\t\t\tcr.Spec.SSO = &v1beta1.ArgoCDSSOSpec{\n\t\t\t\t\tKeycloak: &v1beta1.ArgoCDKeycloakSpec{\n\t\t\t\t\t\tImage: \"test-image\",\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t}),\n\t\t},\n\n\t\t// other fields\n\t\t{\n\t\t\tname: \"ArgoCD Example - Empty\",\n\t\t\tinput: makeTestArgoCDAlpha(func(cr *ArgoCD) {}),\n\t\t\texpectedOutput: makeTestArgoCDBeta(func(cr *v1beta1.ArgoCD) {}),\n\t\t},\n\t\t{\n\t\t\tname: \"ArgoCD Example - Dex + RBAC\",\n\t\t\tinput: makeTestArgoCDAlpha(func(cr *ArgoCD) {\n\t\t\t\tcr.Spec.Dex = &ArgoCDDexSpec{\n\t\t\t\t\tOpenShiftOAuth: true,\n\t\t\t\t}\n\n\t\t\t\tdefaultPolicy := \"role:readonly\"\n\t\t\t\tpolicy := \"g, system:cluster-admins, role:admin\"\n\t\t\t\tscope := \"[groups]\"\n\t\t\t\tcr.Spec.RBAC = ArgoCDRBACSpec{\n\t\t\t\t\tDefaultPolicy: &defaultPolicy,\n\t\t\t\t\tPolicy: &policy,\n\t\t\t\t\tScopes: &scope,\n\t\t\t\t}\n\n\t\t\t\tcr.Spec.Server = ArgoCDServerSpec{\n\t\t\t\t\tRoute: ArgoCDRouteSpec{\n\t\t\t\t\t\tEnabled: true,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t}),\n\t\t\texpectedOutput: makeTestArgoCDBeta(func(cr *v1beta1.ArgoCD) {\n\t\t\t\tcr.Spec.SSO = &v1beta1.ArgoCDSSOSpec{\n\t\t\t\t\tProvider: v1beta1.SSOProviderTypeDex,\n\t\t\t\t\tDex: &v1beta1.ArgoCDDexSpec{\n\t\t\t\t\t\tOpenShiftOAuth: true,\n\t\t\t\t\t},\n\t\t\t\t}\n\n\t\t\t\tdefaultPolicy := \"role:readonly\"\n\t\t\t\tpolicy := \"g, system:cluster-admins, role:admin\"\n\t\t\t\tscope := \"[groups]\"\n\t\t\t\tcr.Spec.RBAC = v1beta1.ArgoCDRBACSpec{\n\t\t\t\t\tDefaultPolicy: &defaultPolicy,\n\t\t\t\t\tPolicy: &policy,\n\t\t\t\t\tScopes: &scope,\n\t\t\t\t}\n\n\t\t\t\tcr.Spec.Server = v1beta1.ArgoCDServerSpec{\n\t\t\t\t\tRoute: v1beta1.ArgoCDRouteSpec{\n\t\t\t\t\t\tEnabled: true,\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t}),\n\t\t},\n\t\t{\n\t\t\tname: \"ArgoCD Example - ResourceCustomizations\",\n\t\t\tinput: makeTestArgoCDAlpha(func(cr *ArgoCD) {\n\t\t\t\tcr.Spec.ResourceIgnoreDifferences = &ResourceIgnoreDifference{\n\t\t\t\t\tAll: &IgnoreDifferenceCustomization{\n\t\t\t\t\t\tJsonPointers: []string{\n\t\t\t\t\t\t\t\"/spec/replicas\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\tManagedFieldsManagers: []string{\n\t\t\t\t\t\t\t\"kube-controller-manager\",\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tResourceIdentifiers: []ResourceIdentifiers{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tGroup: \"admissionregistration.k8s.io\",\n\t\t\t\t\t\t\tKind: \"MutatingWebhookConfiguration\",\n\t\t\t\t\t\t\tCustomization: IgnoreDifferenceCustomization{\n\t\t\t\t\t\t\t\tJqPathExpressions: []string{\n\t\t\t\t\t\t\t\t\t\"'.webhooks[]?.clientConfig.caBundle'\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tGroup: \"apps\",\n\t\t\t\t\t\t\tKind: \"Deployment\",\n\t\t\t\t\t\t\tCustomization: IgnoreDifferenceCustomization{\n\t\t\t\t\t\t\t\tManagedFieldsManagers: []string{\n\t\t\t\t\t\t\t\t\t\"kube-controller-manager\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tJsonPointers: []string{\n\t\t\t\t\t\t\t\t\t\"/spec/replicas\",\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\tcr.Spec.ResourceHealthChecks = []ResourceHealthCheck{\n\t\t\t\t\t{\n\t\t\t\t\t\tGroup: \"certmanager.k8s.io\",\n\t\t\t\t\t\tKind: \"Certificate\",\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t\tcr.Spec.ResourceActions = []ResourceAction{\n\t\t\t\t\t{\n\t\t\t\t\t\tGroup: \"apps\",\n\t\t\t\t\t\tKind: \"Deployment\",\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t}),\n\t\t\texpectedOutput: makeTestArgoCDBeta(func(cr *v1beta1.ArgoCD) {\n\t\t\t\tcr.Spec.ResourceIgnoreDifferences = &v1beta1.ResourceIgnoreDifference{\n\t\t\t\t\tAll: &v1beta1.IgnoreDifferenceCustomization{\n\t\t\t\t\t\tJsonPointers: []string{\n\t\t\t\t\t\t\t\"/spec/replicas\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\tManagedFieldsManagers: []string{\n\t\t\t\t\t\t\t\"kube-controller-manager\",\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tResourceIdentifiers: []v1beta1.ResourceIdentifiers{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tGroup: \"admissionregistration.k8s.io\",\n\t\t\t\t\t\t\tKind: \"MutatingWebhookConfiguration\",\n\t\t\t\t\t\t\tCustomization: v1beta1.IgnoreDifferenceCustomization{\n\t\t\t\t\t\t\t\tJqPathExpressions: []string{\n\t\t\t\t\t\t\t\t\t\"'.webhooks[]?.clientConfig.caBundle'\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tGroup: \"apps\",\n\t\t\t\t\t\t\tKind: \"Deployment\",\n\t\t\t\t\t\t\tCustomization: v1beta1.IgnoreDifferenceCustomization{\n\t\t\t\t\t\t\t\tManagedFieldsManagers: []string{\n\t\t\t\t\t\t\t\t\t\"kube-controller-manager\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tJsonPointers: []string{\n\t\t\t\t\t\t\t\t\t\"/spec/replicas\",\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\tcr.Spec.ResourceHealthChecks = []v1beta1.ResourceHealthCheck{\n\t\t\t\t\t{\n\t\t\t\t\t\tGroup: \"certmanager.k8s.io\",\n\t\t\t\t\t\tKind: \"Certificate\",\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t\tcr.Spec.ResourceActions = []v1beta1.ResourceAction{\n\t\t\t\t\t{\n\t\t\t\t\t\tGroup: \"apps\",\n\t\t\t\t\t\tKind: \"Deployment\",\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t}),\n\t\t},\n\t\t{\n\t\t\tname: \"ArgoCD Example - Image + ExtraConfig\",\n\t\t\tinput: makeTestArgoCDAlpha(func(cr *ArgoCD) {\n\t\t\t\tcr.Spec.Image = \"test-image\"\n\t\t\t\tcr.Spec.ExtraConfig = map[string]string{\n\t\t\t\t\t\"ping\": \"pong\",\n\t\t\t\t}\n\t\t\t}),\n\t\t\texpectedOutput: makeTestArgoCDBeta(func(cr *v1beta1.ArgoCD) {\n\t\t\t\tcr.Spec.Image = \"test-image\"\n\t\t\t\tcr.Spec.ExtraConfig = map[string]string{\n\t\t\t\t\t\"ping\": \"pong\",\n\t\t\t\t}\n\t\t\t}),\n\t\t},\n\t\t{\n\t\t\tname: \"ArgoCD Example - Sever + Import\",\n\t\t\tinput: makeTestArgoCDAlpha(func(cr *ArgoCD) {\n\t\t\t\tcr.Spec.Server.Autoscale = ArgoCDServerAutoscaleSpec{\n\t\t\t\t\tEnabled: true,\n\t\t\t\t}\n\t\t\t\tcr.Spec.Import = &ArgoCDImportSpec{\n\t\t\t\t\tName: \"test-name\",\n\t\t\t\t}\n\t\t\t\tcr.Spec.Server = ArgoCDServerSpec{\n\t\t\t\t\tHost: \"test-host.argocd.org\",\n\t\t\t\t\tGRPC: ArgoCDServerGRPCSpec{\n\t\t\t\t\t\tIngress: ArgoCDIngressSpec{\n\t\t\t\t\t\t\tEnabled: false,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tIngress: ArgoCDIngressSpec{\n\t\t\t\t\t\tEnabled: true,\n\t\t\t\t\t\tTLS: []v1.IngressTLS{\n\t\t\t\t\t\t\t{Hosts: []string{\n\t\t\t\t\t\t\t\t\"test-tls\",\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\tInsecure: true,\n\t\t\t\t}\n\t\t\t}),\n\t\t\texpectedOutput: makeTestArgoCDBeta(func(cr *v1beta1.ArgoCD) {\n\t\t\t\tcr.Spec.Server.Autoscale = v1beta1.ArgoCDServerAutoscaleSpec{\n\t\t\t\t\tEnabled: true,\n\t\t\t\t}\n\t\t\t\tcr.Spec.Import = &v1beta1.ArgoCDImportSpec{\n\t\t\t\t\tName: \"test-name\",\n\t\t\t\t}\n\t\t\t\tcr.Spec.Server = v1beta1.ArgoCDServerSpec{\n\t\t\t\t\tHost: \"test-host.argocd.org\",\n\t\t\t\t\tGRPC: v1beta1.ArgoCDServerGRPCSpec{\n\t\t\t\t\t\tIngress: v1beta1.ArgoCDIngressSpec{\n\t\t\t\t\t\t\tEnabled: false,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tIngress: v1beta1.ArgoCDIngressSpec{\n\t\t\t\t\t\tEnabled: true,\n\t\t\t\t\t\tTLS: []v1.IngressTLS{\n\t\t\t\t\t\t\t{Hosts: []string{\n\t\t\t\t\t\t\t\t\"test-tls\",\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\tInsecure: true,\n\t\t\t\t}\n\t\t\t}),\n\t\t},\n\t}\n\n\tfor _, test := range tests {\n\t\tt.Run(test.name, func(t *testing.T) {\n\n\t\t\t// Set v1beta1 object in Hub, converted values will be set in this object.\n\t\t\tvar hub conversion.Hub = &v1beta1.ArgoCD{}\n\n\t\t\t// Call ConvertTo function to convert v1alpha1 version to v1beta1\n\t\t\ttest.input.ConvertTo(hub)\n\n\t\t\t// Fetch the converted object\n\t\t\tresult := hub.(*v1beta1.ArgoCD)\n\n\t\t\t// Compare converted object with expected.\n\t\t\tassert.Equal(t, test.expectedOutput, result)\n\t\t})\n\t}\n}", "func Func(fn func()) Tween {\n\treturn &funcTween{fn: fn}\n}", "func CreateInstance(clsid *GUID, iid *GUID) (unk *IUnknown, err error) {\n\tif iid == nil {\n\t\tiid = IID_IUnknown\n\t}\n\thr, _, _ := procCoCreateInstance.Call(\n\t\tuintptr(unsafe.Pointer(clsid)),\n\t\t0,\n\t\tCLSCTX_SERVER,\n\t\tuintptr(unsafe.Pointer(iid)),\n\t\tuintptr(unsafe.Pointer(&unk)))\n\tif hr != 0 {\n\t\terr = NewError(hr)\n\t}\n\treturn\n}", "func (client BaseClient) CreateFeatureInstanceResponder(resp *http.Response) (result FeatureInstance, 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.6043546", "0.5760104", "0.55689955", "0.5432456", "0.5378459", "0.51932424", "0.5067308", "0.47532403", "0.47486067", "0.4742491", "0.4714502", "0.46710274", "0.46535036", "0.4641085", "0.4622145", "0.46179128", "0.45826337", "0.45740536", "0.4569083", "0.45574677", "0.45426637", "0.45400658", "0.45152625", "0.44837078", "0.4472761", "0.44644743", "0.4457209", "0.44444117", "0.44382223", "0.44371396", "0.44287", "0.4424041", "0.44043863", "0.43785638", "0.43687317", "0.43622455", "0.43561867", "0.43452695", "0.4342129", "0.4334711", "0.43262118", "0.43244514", "0.4321854", "0.43208358", "0.4318432", "0.43162572", "0.43123186", "0.4310904", "0.43085685", "0.4277965", "0.42734048", "0.4254274", "0.4249938", "0.4249148", "0.4245678", "0.42352614", "0.4235091", "0.423459", "0.42319247", "0.4229171", "0.4224073", "0.4222884", "0.4221673", "0.4220788", "0.4218549", "0.42180404", "0.42129627", "0.4208005", "0.42033798", "0.42018673", "0.4200391", "0.41830692", "0.41819575", "0.41779715", "0.41760334", "0.41739804", "0.41734445", "0.4172732", "0.41714266", "0.41691968", "0.41661865", "0.41625795", "0.4159888", "0.41492292", "0.41322777", "0.4122242", "0.41203064", "0.41178036", "0.41155764", "0.41146076", "0.41146076", "0.4113141", "0.41081282", "0.41038635", "0.41022938", "0.40986234", "0.409696", "0.40879127", "0.40874183", "0.40873262" ]
0.70179
0
JSON2map json to map.
func (d *Dao) JSON2map(msg json.RawMessage) (map[string]interface{}, error) { var result map[string]interface{} if err := json.Unmarshal([]byte(msg), &result); err != nil { return nil, err } return result, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func convertJsonToMapData(jsonData string) (mapData map[string]string, err error) {\n jsonMap := map[string]interface{}{}\n if err = json.Unmarshal([]byte(jsonData), &jsonMap); err != nil {\n return nil, err\n }\n mapData = exposeJsonData(jsonMap)\n return mapData, nil\n}", "func convertJSONToMap(valor string) (map[string]interface{}, error) {\n\n\t//Create the Json element\n\td := json.NewDecoder(strings.NewReader(valor))\n\td.UseNumber()\n\tvar f interface{}\n\terr := d.Decode(&f)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t//transform it to a map\n\tm := f.(map[string]interface{})\n\treturn m, nil\n\n}", "func ConvertJsonToMap(jsonStr string) (map[string]interface{}, error) {\n\tlogger.Logging(logger.DEBUG, \"IN\")\n\tdefer logger.Logging(logger.DEBUG, \"OUT\")\n\n\tresult := make(map[string]interface{})\n\terr := json.Unmarshal([]byte(jsonStr), &result)\n\tif err != nil {\n\t\treturn nil, errors.InvalidJSON{\"Unmarshalling Failed\"}\n\t}\n\treturn result, err\n}", "func JSONStringToMap(result string) map[string]interface{} {\n\tjsonPD := make(map[string]interface{})\n\tbyt := []byte(result)\n\terr := json.Unmarshal(byt, &jsonPD)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\treturn jsonPD\n}", "func JSONString2Map(str string) (map[string]string, error) {\n\tresult := make(map[string]string)\n\terr := json.Unmarshal([]byte(str), &result)\n\treturn result, err\n}", "func Map2JSON(jsonmap map[string]string) (string, error) {\n\tjbytes, err := json.Marshal(jsonmap)\n\treturn string(jbytes), err\n}", "func MakeMapFromJSON(file string) (map[string]string, error) {\n\tm := map[string]interface{}{}\n\tf, err := os.Open(file)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(err.Error())\n\t}\n\tdefer f.Close()\n\tscanner := bufio.NewScanner(f)\n\tscanner.Split(bufio.ScanLines)\n\tvar s string\n\tfor scanner.Scan() {\n\t\ts += scanner.Text()\n\t}\n\n\tif err := json.Unmarshal([]byte(s), &m); err != nil {\n\t\treturn nil, fmt.Errorf(err.Error())\n\t}\n\tmm := map[string]string{}\n\tfor k, v := range m {\n\t\tswitch x := v.(type) {\n\t\tcase string:\n\t\t\tmm[k] = x\n\t\tcase float64:\n\t\t\tif x == float64(int64(x)) {\n\t\t\t\tmm[k] = fmt.Sprintf(\"%.0f\", x)\n\t\t\t} else {\n\t\t\t\tmm[k] = fmt.Sprintf(\"%f\", x)\n\t\t\t}\n\t\tcase bool:\n\t\t\tmm[k] = fmt.Sprintf(\"%v\", x)\n\n\t\t}\n\t}\n\treturn mm, nil\n}", "func JSONStringToMap(subject string) map[string]string {\n\toutputMap := make(map[string]string)\n\terr := json.Unmarshal([]byte(subject), &outputMap)\n\tif err != nil {\n\t\treturn nil\n\t}\n\treturn outputMap\n}", "func jsonMap(v interface{}) interface{} {\n\tif reflect.TypeOf(v).Kind() == reflect.Map {\n\t\trv := reflect.ValueOf(v)\n\t\ttmp := make(map[string]interface{}, len(rv.MapKeys()))\n\t\tfor _, key := range rv.MapKeys() {\n\t\t\ttmp[fmt.Sprint(key.Interface())] = jsonMap(rv.MapIndex(key).Interface())\n\t\t}\n\n\t\treturn tmp\n\t}\n\n\treturn v\n}", "func jsonToDict(input []byte) (map[string]interface{}, error) {\n\tvar dict map[string]interface{}\n\terr := json.Unmarshal(input, &dict)\n\treturn dict, err\n}", "func Struct2Map(obj interface{}) map[string]interface{} {\n\tv := reflect.ValueOf(obj)\n\tt := v.Elem()\n\ttypeOfType := t.Type()\n\n\tvar data = make(map[string]interface{})\n\tfor i := 0; i < t.NumField(); i++ {\n\t\tvar f string\n\t\tif typeOfType.Field(i).Tag.Get(\"json\") == \"\" {\n\t\t\tf = typeOfType.Field(i).Name\n\t\t} else {\n\t\t\tf = typeOfType.Field(i).Tag.Get(\"json\")\n\t\t}\n\t\tdata[f] = t.Field(i).Interface()\n\t}\n\treturn data\n}", "func toMap(i interface{}) (iMap map[string]interface{}, err error) {\n\tbytes, err := json.Marshal(i)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = json.Unmarshal(bytes, &iMap)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn\n}", "func ToMap(obj interface{}) map[string]interface{} {\n\tvar result map[string]interface{}\n\tresultRec, _ := json.Marshal(obj)\n\tjson.Unmarshal(resultRec, &result)\n\treturn result\n}", "func (j Json) Map() map[string]interface{} {\n\tif m, ok := gjson.Parse(string(j)).Value().(map[string]interface{}); ok {\n\t\treturn m\n\t}\n\treturn nil\n}", "func jsonToMap(str string) (map[string]interface{}, error) {\n\tif logger.IsEnabled(LogTypeDebug) {\n\t\tlogger.Log(CallerName(), LogTypeDebug,\n\t\t\tfmt.Sprintf(\"The string value of \\\"kam-defs\\\" property is %s\", str))\n\t}\n\tbytes := []byte(str)\n\tvar kamMap map[string]interface{}\n\terr := json.Unmarshal(bytes, &kamMap)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn kamMap, nil\n}", "func JSONString2MapInterface(str string) (map[string]interface{}, error) {\n\tresult := make(map[string]interface{})\n\terr := json.Unmarshal([]byte(str), &result)\n\treturn result, err\n}", "func (m *Map) FromJSON(data []byte) error {\n\telements := make(map[string]interface{})\n\terr := json.Unmarshal(data, &elements)\n\tif err == nil {\n\t\tm.Clear()\n\t\tfor key, value := range elements {\n\t\t\tm.Put(key, value)\n\t\t}\n\t}\n\treturn err\n}", "func ConvertMapToJson(data map[string]interface{}) (string, error) {\n\tlogger.Logging(logger.DEBUG, \"IN\")\n\tdefer logger.Logging(logger.DEBUG, \"OUT\")\n\n\tresult, err := json.Marshal(data)\n\tif err != nil {\n\t\treturn \"\", errors.Unknown{\"json marshalling failed\"}\n\t}\n\treturn string(result), nil\n}", "func GetMap(bytJSON []byte, key string) (jsonMap map[string]string, err error) {\n\tget := make(map[string]string)\n\tvar jsonArr []interface{}\n\tvar jsonObj map[string]interface{}\n\tvar jsonStr string\n\tvar jsonBool bool\n\tvar jsonInt int\n\tvar jsonFloat float64\n\terr = json.Unmarshal(bytJSON, &jsonArr)\n\tif err != nil {\n\t\terr = json.Unmarshal(bytJSON, &jsonObj)\n\t\tif err != nil {\n\t\t\terr = json.Unmarshal(bytJSON, &jsonInt)\n\t\t\tif err != nil {\n\t\t\t\terr = json.Unmarshal(bytJSON, &jsonFloat)\n\t\t\t\tif err != nil {\n\t\t\t\t\terr = json.Unmarshal(bytJSON, &jsonBool)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\terr = json.Unmarshal(bytJSON, &jsonStr)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\terr = errors.New(\"unnable to get this json file into a map\")\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tget[key] = `\"` + jsonStr + `\"`\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tget[key] = strconv.FormatBool(jsonBool)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tget[key] = strconv.FormatFloat(jsonFloat, 'f', -1, 64)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tget[key] = strconv.Itoa(jsonInt)\n\t\t\t}\n\t\t} else {\n\t\t\tget[key] = \"json:object \"\n\t\t\tz := 0\n\t\t\tfor n, el := range jsonObj {\n\t\t\t\tif z == 0 {\n\t\t\t\t\tget[key] += n\n\t\t\t\t} else {\n\t\t\t\t\tget[key] += \" \" + n\n\t\t\t\t}\n\t\t\t\tbyt, _ := json.Marshal(el)\n\t\t\t\trJSON := make(map[string]string)\n\t\t\t\trJSON, err = GetMap(byt, newKey(key, n))\n\t\t\t\tfor n, el := range rJSON {\n\t\t\t\t\tget[n] = el\n\t\t\t\t}\n\t\t\t\tz++\n\t\t\t}\n\t\t}\n\t} else {\n\t\tget[key] = \"json:array \"\n\t\tz := 0\n\t\tfor n, el := range jsonArr {\n\t\t\tif z == 0 {\n\t\t\t\tget[key] += strconv.Itoa(n)\n\t\t\t} else {\n\t\t\t\tget[key] += \" \" + strconv.Itoa(n)\n\t\t\t}\n\t\t\tbyt, _ := json.Marshal(el)\n\t\t\trJSON := make(map[string]string)\n\t\t\trJSON, err = GetMap(byt, newKey(key, strconv.Itoa(n)))\n\t\t\tfor n, el := range rJSON {\n\t\t\t\tget[n] = el\n\t\t\t}\n\t\t\tz++\n\t\t}\n\t}\n\n\treturn get, err\n}", "func GetMap(json []byte, path ...string) (map[string]string, error) {\n\tif string(json) == \"[]\" || string(json) == \"{}\" {\n\t\treturn nil, nil\n\t}\n\tstart, end, err := getStartEnd(json, path...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmainMap := make(map[string]string)\n\tif json[start] == 123 && json[end-1] == 125 {\n\t\terr = IterateKeyValue(json, func(key, val []byte) (bool, error) {\n\t\t\tmainMap[string(key)] = string(val)\n\t\t\treturn true, nil\n\t\t}, path...)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn mainMap, nil\n\t}\n\tif json[start] == 91 && json[end-1] == 93 {\n\t\tcount := 0\n\t\terr = IterateArray(json, func(val []byte) (bool, error) {\n\t\t\tmainMap[strconv.Itoa(count)] = string(val)\n\t\t\tcount++\n\t\t\treturn true, nil\n\t\t}, path...)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn mainMap, nil\n\t}\n\treturn nil, ErrBadJSON(start)\n}", "func stringToMap(str string) (map[string]interface{}, error) {\n\tvar jsonDataMap map[string]interface{}\n\td := json.NewDecoder(strings.NewReader(str))\n\td.UseNumber()\n\terr := d.Decode(&jsonDataMap)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn jsonDataMap, nil\n}", "func ToMap(content []byte, target map[string]interface{}) (map[string]interface{}, error) {\n\tif target == nil {\n\t\ttarget = make(map[string]interface{})\n\t}\n\tr := bytes.NewReader(content)\n\tn := make(map[string]interface{})\n\terr := serial.DecodeJSON(r, &n)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err = mergeMaps(target, n); err != nil {\n\t\treturn nil, err\n\t}\n\treturn target, nil\n}", "func (p *MaMjsJSON) toMapMsjPet() ser.MapMsjPet {\n\tmsjs := make(ser.MapMsjPet)\n\tfor _, item := range p.Msjs {\n\t\tcod, m := item.toStMsjPet()\n\t\tmsjs[cod] = m\n\t}\n\treturn msjs\n}", "func Struct2Map(v interface{}) (map[string]interface{}, error) {\n bytes, err := json.Marshal(v)\n if err != nil {\n return nil, err\n }\n data := make(map[string]interface{})\n if err := json.Unmarshal(bytes, &data); err != nil {\n return nil, err\n }\n return data, nil\n}", "func marshalToMap(v interface{}) (map[string]interface{}, error) {\n\tbytes, err := json.Marshal(v)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdata := make(map[string]interface{})\n\terr = json.Unmarshal(bytes, &data)\n\treturn data, err\n}", "func jsonToMap(rawValues interface{}) (map[string]json.RawMessage, error) {\n\tbytes, err := json.Marshal(rawValues)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvals := map[string]json.RawMessage{}\n\terr = json.Unmarshal(bytes, &vals)\n\n\treturn vals, err\n}", "func StringToJsonMap(s string) (map[string]string, error) {\n\tvar result map[string]string\n\tif s != \"\" {\n\t\tif err := json.Unmarshal([]byte(s), &result); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif result == nil {\n\t\tresult = map[string]string{}\n\t}\n\treturn result, nil\n}", "func JsonTextToObj(jsonText string) (interface{}, error) {\n\tdata := []byte(jsonText)\n\tvar jsonMap interface{}\n\tdecoder := json.NewDecoder(bytes.NewReader(data))\n\terr := decoder.Decode(&jsonMap)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn jsonMap, nil\n}", "func (c *Config) ToMapToMaps(pointer interface{}, mapping ...map[string]string) error {\n\tif j := c.getJson(); j != nil {\n\t\treturn j.ToMapToMaps(pointer, mapping...)\n\t}\n\treturn errors.New(\"configuration not found\")\n}", "func StructToMap(in interface{}) (out map[string]interface{}) {\n\t// TODO use reflect to avoid encode-map-to-JSON then decode-JSON-to-struct\n\tout = nil\n\tif enc, err := json.Marshal(in); err == nil {\n\t\tout = make(map[string]interface{})\n\t\terr1 := json.Unmarshal(enc, &out)\n\t\tif err1 != nil {\n\t\t\tpanic(err1)\n\t\t}\n\t} else {\n\t\tpanic(err)\n\t}\n\treturn\n}", "func ToMap(componentName, src, root string) (map[string]interface{}, error) {\n\tobj, err := jsonnetParseFn(\"params.libsonnet\", src)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"parse jsonnet\")\n\t}\n\n\tcomponentObject, err := componentParams(obj, componentName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tm, err := convertObjectToMapFn(componentObject)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif componentName == \"\" {\n\t\treturn m[root].(map[string]interface{}), nil\n\t}\n\n\tparamsMap, ok := m[componentName].(map[string]interface{})\n\tif !ok {\n\t\treturn nil, errors.Errorf(\"component %q params is not an object\", componentName)\n\t}\n\n\treturn paramsMap, nil\n}", "func (j *JSONData) Map(path ...interface{}) (map[string]interface{}, error) {\n\tjson, err := j.get(path...)\n\treturn json.MustMap(), err\n}", "func (m *Map) UnmarshalJSON(bs []byte) (err error) {\n\tvar keys []string\n\tif err = json.Unmarshal(bs, &keys); err != nil {\n\t\treturn\n\t}\n\n\t*m = makeMap(keys)\n\treturn\n}", "func (m *MapTransform) UnmarshalJSON(b []byte) error {\n\treturn json.Unmarshal(b, &m.Pairs)\n}", "func FromJSON(rawJSON []byte) ConfigMap {\n\tmapsi := make(map[string]interface{})\n\terr := json.Unmarshal(rawJSON, &mapsi)\n\tif err != nil {\n\t\tlog.Printf(\"error unmarshaling JSON: %s\", err)\n\t}\n\treturn New(mapsi)\n}", "func JSONToMapOfInterfaces(input string) (map[string]any, error) {\n\tvar data map[string]any\n\tbyt := []byte(input)\n\n\tif err := json.Unmarshal(byt, &data); err != nil {\n\t\treturn nil, err\n\t}\n\treturn data, nil\n}", "func DecodedMap(data []byte) interface{} {\n\tvar v interface{}\n\tif err := json.Unmarshal(data, &v); err != nil {\n\t\treturn nil\n\t} else {\n\t\treturn v\n\t}\n}", "func (m *JSONMap) UnmarshalJSON(b []byte) error {\n\tt := map[string]interface{}{}\n\terr := json.Unmarshal(b, &t)\n\t*m = JSONMap(t)\n\treturn err\n}", "func (status *Status) GetJSONMap() map[string]interface{} {\n\tb, err := json.Marshal(status)\n\tif err != nil {\n\t\tlog.Error(err, \"Unable to marshal json\")\n\t\treturn status.CustomStatus\n\t}\n\tif err := json.Unmarshal(b, &status.CustomStatus); err != nil {\n\t\tlog.Error(err, \"Unable to unmarshal json\")\n\t}\n\treturn status.CustomStatus\n}", "func mapFromString(s string, t reflect.Type) (interface{}, error) {\n\tmp := reflect.New(t)\n\tif s != \"\" {\n\t\terr := json.Unmarshal([]byte(s), mp.Interface())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\tmp.Elem().Set(reflect.MakeMap(t))\n\t}\n\treturn mp.Elem().Interface(), nil\n}", "func ToMap(object *js.Object) map[string]interface{} {\n\treturn object.Interface().(map[string]interface{})\n}", "func mapJSON(field reflect.Value, parentMod string, args jsonOutputConfig) (any, error) {\n\tvar errs errlist.List\n\t// Order of elements determines the order in which keys will be processed.\n\tvar pairs []mapValuePair\n\n\titer := field.MapRange()\n\tfor iter.Next() {\n\t\tkn, err := mapKeyToJSONString(iter.Key(), args)\n\t\tif err != nil {\n\t\t\terrs.Add(err)\n\t\t\tcontinue\n\t\t}\n\t\tpairs = append(pairs, mapValuePair{k: kn, v: iter.Value()})\n\t}\n\tslices.SortFunc(pairs, func(a, b mapValuePair) int { return strings.Compare(a.k, b.k) })\n\n\tjs, err := mapValuePairsToJSON(pairs, parentMod, args)\n\terrs.Add(err)\n\tif errs.Err() != nil {\n\t\treturn nil, errs.Err()\n\t}\n\treturn js, nil\n}", "func ValuesFromJSON(data []byte) (map[string]string, error) {\n\ttemp := map[string]string{}\n\tif err := json.Unmarshal(data, &temp); err != nil {\n\t\treturn nil, err\n\t}\n\treturn temp, nil\n}", "func (c *Config) ToMapToMap(pointer interface{}, mapping ...map[string]string) error {\n\tif j := c.getJson(); j != nil {\n\t\treturn j.ToMapToMap(pointer, mapping...)\n\t}\n\treturn errors.New(\"configuration not found\")\n}", "func ToMapStringInterface(r io.Reader) (map[string]interface{}, error) {\n\tresults := make(map[string]interface{})\n\n\tdecoder := json.NewDecoder(r)\n\tdecoder.UseNumber()\n\tdecodeErr := decoder.Decode(&results)\n\n\tswitch {\n\tcase decodeErr == io.EOF:\n\t\tfmt.Println(\"request has no body, decoding skipped returning nil\")\n\t\treturn nil, nil\n\tcase decodeErr != nil:\n\t\treturn nil, fmt.Errorf(\"Failed to decode reader, error %s\", decodeErr.Error())\n\t}\n\n\treturn results, nil\n}", "func (d *FieldDescription) ToMap() (map[string]interface{}, error) {\n\tvar result map[string]interface{}\n\tencoded, err := json.Marshal(d)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err := json.Unmarshal(encoded, &result); err != nil {\n\t\treturn nil, err\n\t}\n\treturn result, nil\n}", "func ResponseToMap(body io.Reader) (map[string][]map[string]string, error) {\n\tbuff, err := ioutil.ReadAll(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar objMap map[string][]map[string]string\n\tif err := json.Unmarshal(buff, &objMap); err != nil {\n\t\treturn nil, err\n\t}\n\treturn objMap, nil\n}", "func getJsonBytesFromMap(data map[string]interface{}) ([]byte, error) {\n\tjsonData, err := json.Marshal(data)\n\tif err != nil {\n\t\tfmt.Println(\"Invalid data object, can't parse to json:\")\n\t\tfmt.Println(\"Error:\", err)\n\t\tfmt.Println(\"Data:\", data)\n\t\treturn nil, err\n\t}\n\treturn jsonData, nil\n}", "func TestJSON(t *testing.T) {\n\n\tsrcJSON := []byte(`{\"float\": 1.2, \"int\": 1, \"bool\": true, \"array\":[\"apple\", 2]}`)\n\tvar m map[string]interface{}\n\terr := json.Unmarshal(srcJSON, &m)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tfmt.Printf(\"%T, %T, %T, %T, %T %T\\n\", m[\"float\"], m[\"int\"], m[\"bool\"], m[\"array\"], m[\"array\"].([]interface{})[0], m[\"array\"].([]interface{})[1])\n}", "func mapToReadableJson(mapArg []map[string]string) string {\n\tjsonMarshalled, _ := json.MarshalIndent(mapArg, \"\", \" \")\n\tjsonAsString := string(jsonMarshalled)\n\treturn jsonAsString\n}", "func (u *Util) StructToMap(data interface{}) (map[string]interface{}, error) {\n result := make(map[string]interface{})\n\n b, err := json.Marshal(data)\n if err != nil { return nil, err }\n\n err = json.Unmarshal(b, &result)\n return result, err\n}", "func toMapStringString(v interface{}) (map[string]string, error) {\n\n\tout, err := json.Marshal(v)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar f interface{}\n\n\terr = json.Unmarshal(out, &f)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ts := f.(map[string]interface{})\n\n\tresult := map[string]string{}\n\n\tfor k, v := range s {\n\t\tswitch t := v.(type) {\n\t\tcase string:\n\t\t\tresult[k] = t\n\t\t}\n\t}\n\n\treturn result, nil\n}", "func JSONSliceOfInterfaceToSliceOfMaps(input []any) ([]map[any]any, error) {\n\toutputMap := make([]map[any]any, 0)\n\tfor _, current := range input {\n\t\tdata, err := JSONToMapOfInterfaces(current.(string))\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tmap2 := map[any]any{}\n\n\t\tfor k, v := range data {\n\t\t\tmap2[k] = v\n\t\t}\n\n\t\toutputMap = append(outputMap, map2)\n\t}\n\treturn outputMap, nil\n}", "func (image *Image) ToMap() map[string]interface{} {\n\tdata := make(map[string]interface{})\n\timage.UpdateMap(data)\n\n\treturn data\n}", "func parseMap(m map[string]interface{}) (map[string]interface{}, error) {\n\n\tresult := make(map[string]interface{})\n\n\tfor k, v := range m {\n\t\tswitch vt := v.(type) {\n\t\tcase map[string]interface{}:\n\t\t\tnestedMap, err := parseMap(vt)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tresult[k] = nestedMap\n\t\tcase []interface{}:\n\t\t\tnestedList, err := parseListOfMaps(vt)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tresult[k] = nestedList\n\t\tcase float64:\n\t\t\ttestInt, err := strconv.ParseInt((fmt.Sprintf(\"%v\", vt)), 10, 0)\n\t\t\tif err == nil {\n\t\t\t\tresult[k] = int(testInt)\n\t\t\t} else {\n\t\t\t\tresult[k] = vt\n\t\t\t}\n\t\tdefault:\n\t\t\tresult[k] = vt\n\t\t}\n\n\t}\n\n\treturn result, nil\n}", "func jsonDecode(js []byte) (map[string]interface{}, error) {\n\tvar decoded map[string]interface{}\n\tif err := json.Unmarshal(js, &decoded); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn decoded, nil\n}", "func (f *ForkParams) ToMap() (map[string]interface{}, error) {\n\tvar inMap map[string]interface{}\n\tinrec, err := json.Marshal(f)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = json.Unmarshal(inrec, &inMap)\n\treturn inMap, err\n}", "func parse(in []byte) ([]map[string]string, error) {\n\tvar u []map[string]string\n\terr := json.Unmarshal(in, &u)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error parsing JSON : %v\", err)\n\t}\n\n\treturn u, nil\n}", "func extractJSONObj(jsonBlob []byte) (map[string]interface{}, error) {\n\tvar j map[string]interface{}\n\n\terr := json.Unmarshal(jsonBlob, &j)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn j, nil\n}", "func json2form(v interface{}) map[string]string {\n\tvalue := reflect.ValueOf(v)\n\tt := value.Type()\n\tparams := make(map[string]string)\n\tfor i := 0; i < value.NumField(); i++ {\n\t\tf := t.Field(i)\n\t\tname := f.Tag.Get(\"json\")\n\t\tfv := value.Field(i).Interface()\n\t\tif fv == nil {\n\t\t\tcontinue\n\t\t}\n\t\tswitch x := fv.(type) {\n\t\tcase *string:\n\t\t\tif x != nil {\n\t\t\t\tparams[name] = *x\n\t\t\t}\n\t\tcase string:\n\t\t\tif x != \"\" {\n\t\t\t\tparams[name] = x\n\t\t\t}\n\t\tcase int:\n\t\t\tif x != 0 {\n\t\t\t\tparams[name] = strconv.Itoa(x)\n\t\t\t}\n\t\tcase *bool:\n\t\t\tif x != nil {\n\t\t\t\tparams[name] = fmt.Sprintf(\"%v\", *x)\n\t\t\t}\n\t\tcase int64:\n\t\t\tif x != 0 {\n\t\t\t\tparams[name] = strconv.FormatInt(x, 10)\n\t\t\t}\n\t\tcase float64:\n\t\t\tparams[name] = fmt.Sprintf(\"%.2f\", x)\n\t\tcase []string:\n\t\t\tif len(x) > 0 {\n\t\t\t\tparams[name] = strings.Join(x, \" \")\n\t\t\t}\n\t\tcase map[string]string:\n\t\t\tfor mapkey, mapvalue := range x {\n\t\t\t\tparams[name+\"[\"+mapkey+\"]\"] = mapvalue\n\t\t\t}\n\t\tcase *Error:\n\t\t\t// do not turn into form values. This is for the return response only\n\t\tdefault:\n\t\t\t// ignore\n\t\t\tpanic(fmt.Errorf(\"Unknown field type: \" + value.Field(i).Type().String()))\n\t\t}\n\t}\n\treturn params\n}", "func ParseJSONtoStory(jsonFile string) (map[string]Arc, error) {\n\tjsonText, err := ioutil.ReadFile(jsonFile)\n\tif err!=nil {\n\t\tlog.Println(err)\n\t}\n\tfs := make(map[string]Arc)\n\terr = json.Unmarshal(jsonText, &fs)\n\t\n\treturn fs,err\n}", "func jsonDecode(js []byte) (map[string]interface{}, error) {\n\tvar decoded map[string]interface{}\n\tdecoder := json.NewDecoder(strings.NewReader(string(js)))\n\tdecoder.UseNumber()\n\n\tif err := decoder.Decode(&decoded); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn decoded, nil\n}", "func MakeMap(d *json.Decoder) MetricMap {\n\tflMap := make(MetricMap)\n\tvar output map[string]interface{}\n\n\tif d == nil {\n\t\tlog.Error(\"JSON decoder not iniatilized\")\n\t\treturn flMap\n\t}\n\n\tif err := d.Decode(&output); err != nil {\n\t\tlog.WithField(\"error\", err).Error(\"Error while decoding json\")\n\t\treturn flMap\n\t}\n\n\taddFields(&flMap, \"\", output)\n\n\treturn flMap\n}", "func StructToMap(a interface{}) (IObject, error) {\r\n\tb, err := json.Marshal(a)\r\n\tif err != nil {\r\n\t\treturn nil, TypeConvertError{}\r\n\t}\r\n\tvar f interface{}\r\n\terr = json.Unmarshal(b, &f)\r\n\tif res, ok := f.(map[string]interface{}); ok {\r\n\r\n\t\treturn NewObject(res)\r\n\t}\r\n\treturn nil, TypeConvertError{}\r\n}", "func ConvertToMap(input string, kind string) (map[string]string, error) {\n\tresult := make(map[string]string)\n\tif input == \"\" {\n\t\treturn result, nil\n\t}\n\tinputs := strings.Split(input, \",\")\n\treturn ConvertSliceToMap(inputs, kind)\n}", "func Convert(datum map[string]interface{}, schema string) (map[string]interface{}, error) {\n\tvar err error\n\tvar parsedSchema, converted map[string]interface{}\n\tvar out interface{}\n\n\tif err = json.Unmarshal([]byte(schema), &parsedSchema); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif out, err = derive(datum, parsedSchema); err != nil {\n\t\treturn nil, err\n\t}\n\n\tconverted, _ = out.(map[string]interface{})\n\treturn converted, nil\n}", "func JsonToData(path string, in io.Reader, consumer px.ValueConsumer) {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tpanic(px.Error(px.InvalidJson, issue.H{`path`: path, `detail`: r}))\n\t\t}\n\t}()\n\td := json.NewDecoder(in)\n\td.UseNumber()\n\tjsonValues(consumer, d)\n}", "func NewMap(in io.Reader) (*Map, error) {\n\tvar mapper Map\n\tif err := json.NewDecoder(in).Decode(&mapper); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &mapper, nil\n}", "func Struct2Map(st interface{}) map[string]interface{} {\n\tvt := reflect.TypeOf(st)\n\tvv := reflect.ValueOf(st)\n\tvar data = make(map[string]interface{})\n\tfor i := 0; i < vt.NumField(); i++ {\n\t\tf := vt.Field(i)\n\t\tv := vv.Field(i)\n\t\tchKey := f.Tag.Get(\"json\")\n\t\tswitch v.Kind() {\n\t\tcase reflect.String:\n\t\t\tif s, ok := v.Interface().(string); ok && s != \"\" {\n\t\t\t\tdata[chKey] = s\n\t\t\t}\n\t\tcase reflect.Int:\n\t\t\tif i, ok := v.Interface().(int); ok && i != 0 {\n\t\t\t\tdata[chKey] = i\n\t\t\t}\n\t\tcase reflect.Struct:\n\t\t\tif t, ok := v.Interface().(time.Time); ok && t != (time.Time{}) {\n\t\t\t\tdata[chKey] = t\n\t\t\t}\n\t\tcase reflect.Uint64:\n\t\t\tif u64, ok := v.Interface().(uint64); ok && u64 != 0 {\n\t\t\t\tdata[chKey] = u64\n\t\t\t}\n\t\tcase reflect.Int64:\n\t\t\tif u64, ok := v.Interface().(int64); ok && u64 != 0 {\n\t\t\t\tdata[chKey] = u64\n\t\t\t}\n\t\tcase reflect.Uint:\n\t\t\tif u, ok := v.Interface().(uint); ok && u != 0 {\n\t\t\t\tdata[chKey] = u\n\t\t\t}\n\t\tcase reflect.Float32:\n\t\t\tif u, ok := v.Interface().(float32); ok && u != 0 {\n\t\t\t\tdata[chKey] = u\n\t\t\t}\n\t\tcase reflect.Float64:\n\t\t\tif u, ok := v.Interface().(float64); ok && u != 0 {\n\t\t\t\tdata[chKey] = u\n\t\t\t}\n\t\tcase reflect.Bool:\n\t\t\tif u, ok := v.Interface().(bool); ok {\n\t\t\t\tdata[chKey] = u\n\t\t\t}\n\n\t\tdefault:\n\t\t\tglog.Error(\"unsupport common query type: \" + string(chKey))\n\t\t}\n\t}\n\treturn data\n}", "func decodeJSON(data map[string]interface{}, v interface{}) error {\n\tb, err := json.Marshal(data)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := json.Unmarshal(b, &v); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (m Map) Json() Json {\n\tj, _ := NewJson(m)\n\treturn j\n}", "func JSONMapStringInterface(r io.Reader) (map[string]interface{}, error) {\n\treturn ToMapStringInterface(r)\n}", "func MapToStruct(request map[string]interface{}, result interface{}) error {\n\tcfg := &mapstructure.DecoderConfig{\n\t\tMetadata: nil,\n\t\tResult: result,\n\t\tTagName: \"json\",\n\t}\n\n\tdecoder, err := mapstructure.NewDecoder(cfg)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = decoder.Decode(request)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (nm *NetworkMap) UnmarshalJSON(b []byte) error {\n\tvar raw interface{}\n\tif err := json.Unmarshal(b, &raw); err != nil {\n\t\treturn err\n\t}\n\tfor key, v := range raw.(map[string]interface{}) {\n\t\tswitch key {\n\t\tcase \"map-vtag\":\n\t\t\tif v, ok := v.(string); ok {\n\t\t\t\tnm.VersionTag = v\n\t\t\t}\n\t\tcase \"map\":\n\t\t\tif len(nm.Map) == 0 {\n\t\t\t\tnm.Map = make(map[string]EndpointAddrGroup)\n\t\t\t}\n\t\t\tfor pid, vv := range v.(map[string]interface{}) {\n\t\t\t\tswitch vv := vv.(type) {\n\t\t\t\tcase map[string]interface{}:\n\t\t\t\t\teag := make(EndpointAddrGroup)\n\t\t\t\t\tif err := eag.decode(vv); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tnm.Map[pid] = eag\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func ExampleUnmarshal_map() {\n\tstr := \"{\\\"a\\\":1,\\\"b\\\":2,\\\"c\\\":3}\"\n\tobj, err := Unmarshal([]byte(str))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tm, ok := obj.(map[string]interface{})\n\tif ok {\n\t\tif v, ok := m[\"b\"]; ok {\n\t\t\tfmt.Println(\"B:\", v)\n\t\t}\n\t}\n\t// Output: B: 2\n}", "func parseYaml_jsonable(txt []byte) (map[string]interface{}, error) {\n\tstructure := make(map[string]interface{})\n\terr := yaml.Unmarshal(txt, structure)\n\tif err!=nil {\n\t\treturn nil, err\n\t}\n\tr, e := transformData(structure)\n\treturn r.(map[string]interface{}), e\n}", "func JSONtoArgs(Avalbytes []byte) (map[string]interface{}, error) {\n\n\tvar data map[string]interface{}\n\n\tif err := json.Unmarshal(Avalbytes, &data); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn data, nil\n}", "func CleanupJSON(input interface{}) interface{} {\n\tif inputMap, ok := input.(map[string]interface{}); ok {\n\t\tnewMap := make(map[string]interface{})\n\t\tfor key, value := range inputMap {\n\t\t\tswitch v := value.(type) {\n\t\t\tcase string:\n\t\t\t\t// Strings must not be empty\n\t\t\t\tif v != \"\" {\n\t\t\t\t\tnewMap[key] = value\n\t\t\t\t}\n\t\t\tcase []interface{}:\n\t\t\t\t// Arrays must not be empty\n\t\t\t\tif len(v) > 0 {\n\t\t\t\t\tvar newArray []interface{} = nil\n\t\t\t\t\tfor _, value := range v {\n\t\t\t\t\t\tnewArray = append(newArray, CleanupJSON(value))\n\t\t\t\t\t}\n\t\t\t\t\tnewMap[key] = newArray\n\t\t\t\t}\n\t\t\tcase map[string]interface{}:\n\t\t\t\t// Objects must not be empty\n\t\t\t\tif len(v) > 0 {\n\t\t\t\t\tnewMapValue := CleanupJSON(value).(map[string]interface{})\n\t\t\t\t\tif len(newMapValue) > 0 {\n\t\t\t\t\t\tnewMap[key] = newMapValue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\tif value != nil {\n\t\t\t\t\tnewMap[key] = value\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn newMap\n\t}\n\treturn input\n}", "func MapFromInterface(i interface{}) map[string]interface{} {\n\treturn i.(map[string]interface{})\n}", "func mapMovieToJson(m *Movie) jsonMovie {\r\n\treturn jsonMovie{\r\n\t\tID: m.ID,\r\n\t\tTitle: m.Title,\r\n\t\tReleaseDate: m.ReleaseDate,\r\n\t\tDuration: m.Duration,\r\n\t\tTrailerURL: m.TrailerURL,\r\n\t}\r\n}", "func StructToMap(v interface{}) operator.M {\n\tdata := make(operator.M)\n\tbytes, _ := json.Marshal(v)\n\t_ = json.Unmarshal(bytes, &data)\n\treturn data\n}", "func jsonToContainers(json []types.ContainerJSON) []types.Container {\n\tres := make([]types.Container, len(json))\n\tfor i, val := range json {\n\t\tres[i] = jsonToSingleContainer(val)\n\t}\n\treturn res\n}", "func convertYamlMap(m map[string]interface{}) (map[string]interface{}, error) {\n\tstack := []map[string]interface{}{m}\n\tfor len(stack) > 0 {\n\t\tvar current map[string]interface{}\n\t\tcurrent, stack = stack[len(stack)-1], stack[:len(stack)-1]\n\t\tfor k, v := range current {\n\t\t\tswitch vv := v.(type) {\n\t\t\tcase map[interface{}]interface{}:\n\t\t\t\ttmp := make(map[string]interface{})\n\t\t\t\tfor sk, sv := range vv {\n\t\t\t\t\tif _, ok := sk.(string); !ok {\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"map key %v is not a string\", sk)\n\t\t\t\t\t}\n\t\t\t\t\ttmp[sk.(string)] = sv\n\t\t\t\t}\n\t\t\t\tdelete(current, k)\n\t\t\t\tcurrent[k] = tmp\n\t\t\t\tstack = append(stack, tmp)\n\t\t\tdefault:\n\t\t\t}\n\t\t}\n\t}\n\treturn m, nil\n}", "func GetAllMap(json []byte, keys []string, path ...string) (map[string]string, error) {\n\tvar err error\n\tvar val string\n\tresults := make(map[string]string)\n\tfor _, k := range keys {\n\t\tval, err = GetString(json, append(path, k)...)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresults[k] = val\n\t}\n\treturn results, nil\n}", "func parseMap(v interface{}) (map[string]interface{}, error) {\n\tstructRfl := reflect.ValueOf(v)\n\n\tresult := map[string]interface{}{}\n\n\t// Fail if the passed type is not a map\n\tif structRfl.Kind() != reflect.Map {\n\t\treturn result, fmt.Errorf(\"Expected map, got: %s\", structRfl.Kind().String())\n\t}\n\n\tmapRange := structRfl.MapRange()\n\tfor mapRange.Next() {\n\t\tresult[mapRange.Key().String()] = mapRange.Value().Interface()\n\t}\n\n\treturn result, nil\n}", "func FromJSON(r io.Reader) (Config, error) {\n\td := json.NewDecoder(r)\n\tm := make(map[string]interface{})\n\terr := d.Decode(&m)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn FromTieredMap(m), nil\n}", "func Map2Struct(jmap interface{}, s interface{}) error {\n tmpDataJson, err := json.Marshal(jmap)\n if err != nil {\n return err\n }\n err = json.Unmarshal(tmpDataJson, &s)\n if err != nil {\n return err\n }\n return nil\n}", "func DynamicJSONToStruct(data interface{}, target interface{}) error {\n\t// TODO: convert straight to a json typed map (mergo + iterate?)\n\tb, err := WriteJSON(data)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn ReadJSON(b, target)\n}", "func InterfaceToMap(jsonInterface interface{}) (map[string]interface{}, error) {\n\tb, err := json.Marshal(jsonInterface)\n\tif err != nil {\n\t\treturn nil, errorutils.CheckError(err)\n\t}\n\tnewMap := make(map[string]interface{})\n\terr = errorutils.CheckError(json.Unmarshal(b, &newMap))\n\treturn newMap, err\n}", "func (p *Client) ConvertMap() db.StData {\n\treturn db.StData{\n\t\t\"name\": p.Name,\n\t\t\"segment1\": p.Segment1,\n\t\t\"segment2\": p.Segment2,\n\t\t\"segment3\": p.Segment3,\n\t\t\"segment4\": p.Segment4,\n\t\t\"platformId\": p.PlatformID,\n\t\t\"clientId\": p.ClientID,\n\t}\n}", "func (s StorageGetResponse) ToMap() map[string]string {\n\tm := make(map[string]string)\n\tfor _, item := range s {\n\t\tm[item.Key] = item.Value\n\t}\n\n\treturn m\n}", "func (c *Config) GetJsonMap(pattern string, def ...interface{}) map[string]*gjson.Json {\n\tif j := c.getJson(); j != nil {\n\t\treturn j.GetJsonMap(pattern, def...)\n\t}\n\treturn nil\n}", "func JSONToYAML(j []byte) ([]byte, error) {\n\t// Convert the JSON to an object.\n\tvar jsonObj interface{}\n\t// We are using yaml.Unmarshal here (instead of json.Unmarshal) because the\n\t// Go JSON library doesn't try to pick the right number type (int, float,\n\t// etc.) when unmarshalling to interface{}, it just picks float64\n\t// universally. go-yaml does go through the effort of picking the right\n\t// number type, so we can preserve number type throughout this process.\n\terr := yaml.Unmarshal(j, &jsonObj)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Marshal this object into YAML.\n\treturn yaml.Marshal(jsonObj)\n}", "func jsonNameMap(structType interface{}) map[string]string {\n\tsType := reflect.TypeOf(structType)\n\tnFields := sType.NumField()\n\tret := make(map[string]string, nFields)\n\tfor i := 0; i < nFields; i++ {\n\t\tf := sType.Field(i)\n\t\tjsonName := strings.SplitN(f.Tag.Get(\"json\"), \",\", 2)[0]\n\t\tif jsonName == \"\" || jsonName == \"-\" {\n\t\t\tcontinue\n\t\t}\n\t\tret[f.Name] = jsonName\n\t}\n\treturn ret\n}", "func (p Payload) Map() map[string]interface{} {\n\toutput := make(map[string]interface{})\n\terr := mapstructure.Decode(p, &output)\n\n\tif err != nil {\n\t\toutput = map[string]interface{}{\n\t\t\t\"error\": \"error in parsing response payload.\",\n\t\t}\n\t}\n\n\treturn output\n}", "func (c *Config) GetMapToMaps(pattern string, pointer interface{}, mapping ...map[string]string) error {\n\tif j := c.getJson(); j != nil {\n\t\treturn j.GetMapToMaps(pattern, pointer, mapping...)\n\t}\n\treturn errors.New(\"configuration not found\")\n}", "func convertJSON(in interface{}, out interface{}) error {\n\tb, err := json.Marshal(in)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to marshal %v: %v\", in, err)\n\t}\n\n\tif err := json.Unmarshal(b, out); err != nil {\n\t\treturn fmt.Errorf(\"failed to unmarshal %v: %v\", string(b), err)\n\t}\n\treturn nil\n}", "func TestJson(t *testing.T) {\n\t// 不支持根不是对象的yaml\n\tcases := []string{\n\t\t`{\"a\":1,\"b\":\"abc2\",\"d\":[{\"x\":2,\"a\":1}]}`,\n\t\t`{\"z\":{\"b\":1,\"d\":[{\"x\":1,\"b\":2,\"f\":1.244555},{\"d\":\"fsdaf\",\"c\":\"123\"}]},\"o\":{\"x\":{\"d\":1,\"c\":2,\"x\":3,\"a\":4}}}`,\n\t}\n\n\tfor _, c := range cases {\n\t\ti := MapSlice{}\n\t\terr := json.Unmarshal([]byte(c), &i)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"Unmarshal '%s' err: %s\", c, err)\n\t\t}\n\n\t\tbs, err := json.Marshal(i)\n\t\tif err != nil {\n\t\t\tt.Fatal()\n\t\t}\n\t\tif string(bs) != c {\n\t\t\tt.Errorf(\"Unexpected result on JSON: '%s'\", cases)\n\t\t\tt.Log(\"Got: \", string(bs))\n\t\t\tt.Log(\"Expected:\", c)\n\t\t}\n\t}\n\n\tt.Log(\"ok\")\n}", "func MapsFromViper(v treeReader) *MapConvert {\n\tm := &MapConvert{}\n\tdef := DefaultMapper()\n\tif v.IsSet(\"gc_types\") {\n\t\tm.GCTypes = gcTypes(v, def.GCTypes)\n\t}\n\tif v.IsSet(\"memory_bytes\") {\n\t\tm.MemoryTypes = memoryTypes(v, def.MemoryTypes)\n\t}\n\treturn m\n}", "func (j *JSON) UnmarshalJSON(bs []byte) error {\n\tif len(bs) == 0 {\n\t\tj.Valid = false\n\t\tj.Map = nil\n\t\treturn nil\n\t}\n\n\tresult := make(map[string]interface{})\n\n\tif err := json.Unmarshal(bs, &result); err != nil {\n\t\tj.Valid = false\n\t\treturn err\n\t}\n\n\tj.Valid = true\n\tj.Map = result\n\treturn nil\n}" ]
[ "0.7647089", "0.75463164", "0.75444764", "0.70857203", "0.70798063", "0.6983131", "0.69329846", "0.6865958", "0.6786214", "0.6720798", "0.64745486", "0.64674044", "0.6463809", "0.6428421", "0.64141566", "0.6314296", "0.63012236", "0.61638206", "0.6154641", "0.61392885", "0.61162925", "0.60774624", "0.6033669", "0.6006282", "0.5998346", "0.59721756", "0.59233284", "0.5869651", "0.5862117", "0.58507276", "0.58373094", "0.58142185", "0.5769394", "0.5749153", "0.57296795", "0.57294416", "0.5708332", "0.5707173", "0.56697494", "0.56568295", "0.5623613", "0.56217843", "0.5619169", "0.56058496", "0.55950844", "0.5559748", "0.5550122", "0.554381", "0.55390173", "0.5537065", "0.55196285", "0.55064476", "0.5485344", "0.54847914", "0.5475616", "0.5463205", "0.5459305", "0.54557985", "0.5455765", "0.54523635", "0.54482025", "0.54296356", "0.53917533", "0.5386001", "0.536821", "0.5349485", "0.5349097", "0.5343467", "0.53394836", "0.5326421", "0.5323445", "0.5319078", "0.5317561", "0.53162193", "0.52961487", "0.52803624", "0.52695507", "0.52409524", "0.5237917", "0.5233714", "0.5229774", "0.52288175", "0.5200764", "0.51957047", "0.5170928", "0.5170349", "0.5168079", "0.5151135", "0.51503885", "0.5147062", "0.51382446", "0.5133356", "0.5128", "0.51119685", "0.51112145", "0.5106248", "0.51044434", "0.50978386", "0.5094566", "0.5074356" ]
0.7429084
3
testAwsClient returns a mock awsClient with the services stubbed from the teststubs package.
func testAwsClient() *awsClient { client := awsClient{} client.EC2 = teststubs.CreateTestEC2InstanceMock() client.AutoScaling = teststubs.CreateTestAutoScalingMock() client.Route53 = teststubs.CreateTestRoute53Mock() return &client }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func initAwsClient() aws.Client {\n\treturn aws.NewClient(\"elastisys-billing-data\")\n}", "func NewAwsClient() (*AwsClient, error) {\n\n\ts, err := session.NewSession(&aws.Config{\n\t\tMaxRetries: aws.Int(0),\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to connect to AWS metadata service: %s\", err)\n\t}\n\n\tmd := ec2metadata.New(s)\n\tidDoc, err := md.GetInstanceIdentityDocument()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to GetInstanceIdentityDocument: %s\", err)\n\t}\n\tclient := ec2.New(s, aws.NewConfig().WithRegion(idDoc.Region))\n\n\tlogrus.Debug(\"NewAwsClient built\")\n\treturn &AwsClient{\n\t\taws: client,\n\t\tinstanceID: idDoc.InstanceID,\n\t\tprivateIP: idDoc.PrivateIP,\n\t\tnicIPtoID: make(map[string]string),\n\t}, nil\n}", "func NewAwsClientWrapper(client awsclient.Client) *AwsClientWrapper {\n\treturn &AwsClientWrapper{client: client}\n}", "func NewMockAPIClient(account string, userID string) *MockAwsClient {\n\treturn &MockAwsClient{\n\t\tAccount: account,\n\t\tUserID: userID,\n\t}\n}", "func (m *MockMappedResource) Aws() aws.Resource {\n\tret := m.ctrl.Call(m, \"Aws\")\n\tret0, _ := ret[0].(aws.Resource)\n\treturn ret0\n}", "func NewElasticClientMock(url string) (*elastic.Client, error) {\n\tclient, err := elastic.NewSimpleClient(elastic.SetURL(url))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn client, nil\n}", "func NewMockS3Client(ctrl *gomock.Controller) *MockS3Client {\n\tmock := &MockS3Client{ctrl: ctrl}\n\tmock.recorder = &MockS3ClientMockRecorder{mock}\n\treturn mock\n}", "func NewMockS3Client(ctrl *gomock.Controller) *MockS3Client {\n\tmock := &MockS3Client{ctrl: ctrl}\n\tmock.recorder = &MockS3ClientMockRecorder{mock}\n\treturn mock\n}", "func (_m *IRsaClientDeps) AwsConfig(_a0 log.T, appConfig appconfig.SsmagentConfig, service string, region string) *aws.Config {\n\tret := _m.Called(_a0, appConfig, service, region)\n\n\tvar r0 *aws.Config\n\tif rf, ok := ret.Get(0).(func(log.T, appconfig.SsmagentConfig, string, string) *aws.Config); ok {\n\t\tr0 = rf(_a0, appConfig, service, region)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*aws.Config)\n\t\t}\n\t}\n\n\treturn r0\n}", "func getS3Client() *http.Client {\n\t// return aws.RetryingClient\n\treturn http.DefaultClient\n}", "func NewAwsClientFromEnv() (*Client, error) {\n\taccessKey := os.Getenv(\"AWS_ACCESS_KEY_ID\")\n\tif accessKey == \"\" {\n\t\taccessKey = os.Getenv(\"AWS_ACCESS_KEY\")\n\t\tif accessKey == \"\" {\n\t\t\treturn nil, errors.New(\"AWS_ACCESS_KEY_ID or AWS_ACCESS_KEY not found in environment\")\n\t\t}\n\t}\n\n\tsecretKey := os.Getenv(\"AWS_SECRET_ACCESS_KEY\")\n\tif secretKey == \"\" {\n\t\tsecretKey = os.Getenv(\"AWS_SECRET_KEY\")\n\t\tif secretKey == \"\" {\n\t\t\treturn nil, errors.New(\"AWS_SECRET_ACCESS_KEY or AWS_SECRET_KEY not found in environment\")\n\t\t}\n\t}\n\n\tregion := os.Getenv(\"AWS_REGION\")\n\tif region == \"\" {\n\t\treturn nil, errors.New(\"AWS_REGION not found in environment\")\n\t}\n\n\tsessionToken := os.Getenv(\"AWS_SESSION_TOKEN\")\n\tendpoint := \"https://dynamodb.\" + region + \".amazonaws.com/\"\n\treturn NewClient(newAwsExecutorToken(endpoint, region, accessKey, secretKey, sessionToken)), nil\n}", "func NewAWSClient(config *types.Configuration, stats *types.Statistics, statsdClient, dogstatsdClient *statsd.Client) (*Client, error) {\r\n\r\n\tif config.AWS.AccessKeyID != \"\" && config.AWS.SecretAccessKey != \"\" && config.AWS.Region != \"\" {\r\n\t\tos.Setenv(\"AWS_ACCESS_KEY_ID\", config.AWS.AccessKeyID)\r\n\t\tos.Setenv(\"AWS_SECRET_ACCESS_KEY\", config.AWS.SecretAccessKey)\r\n\t\tos.Setenv(\"AWS_DEFAULT_REGION\", config.AWS.Region)\r\n\t}\r\n\r\n\tsess, err := session.NewSession(&aws.Config{\r\n\t\tRegion: aws.String(config.AWS.Region)},\r\n\t)\r\n\tif err != nil {\r\n\t\tlog.Printf(\"[ERROR] : AWS - %v\\n\", \"Error while creating AWS Session\")\r\n\t\treturn nil, errors.New(\"Error while creating AWS Session\")\r\n\t}\r\n\r\n\t_, err = sts.New(session.New()).GetCallerIdentity(&sts.GetCallerIdentityInput{})\r\n\tif err != nil {\r\n\t\tlog.Printf(\"[ERROR] : AWS - %v\\n\", \"Error while getting AWS Token\")\r\n\t\treturn nil, errors.New(\"Error while getting AWS Token\")\r\n\t}\r\n\r\n\tvar endpointURL *url.URL\r\n\tendpointURL, err = url.Parse(config.AWS.SQS.URL)\r\n\tif err != nil {\r\n\t\tlog.Printf(\"[ERROR] : AWS SQS - %v\\n\", err.Error())\r\n\t\treturn nil, ErrClientCreation\r\n\t}\r\n\r\n\treturn &Client{\r\n\t\tOutputType: \"AWS\",\r\n\t\tEndpointURL: endpointURL,\r\n\t\tConfig: config,\r\n\t\tAWSSession: sess,\r\n\t\tStats: stats,\r\n\t\tStatsdClient: statsdClient,\r\n\t\tDogstatsdClient: dogstatsdClient,\r\n\t}, nil\r\n}", "func (c *BaseAwsClient) Client() *BaseAwsClient {\n\treturn c\n}", "func (c *Clients) AwsIamClient() *iam.IAM {\n\tif c.AwsIam == nil {\n\t\tsess, err := session.NewSession(\n\t\t\t&aws.Config{\n\t\t\t\tRegion: aws.String(c.ClientConfigs.AwsRegion),\n\t\t\t},\n\t\t)\n\t\tif err != nil {\n\t\t\tlog.Fatalln(\"There was a problem configuring the AWS client. Ensure your AWS credentials are exported to your environment\", err)\n\t\t} else {\n\t\t\tc.AwsIam = iam.New(sess)\n\t\t}\n\t}\n\treturn c.AwsIam\n}", "func TestAWS(t *testing.T) {\n\tlogger = runner.NewLogger(\"aws_test\")\n\n\tlogger.Info(\"TestAWS completed\")\n}", "func (m *MockMappedResource) HasAws() bool {\n\tret := m.ctrl.Call(m, \"HasAws\")\n\tret0, _ := ret[0].(bool)\n\treturn ret0\n}", "func NewMockStravaClient(ctrl *gomock.Controller) *MockStravaClient {\n\tmock := &MockStravaClient{ctrl: ctrl}\n\tmock.recorder = &MockStravaClientMockRecorder{mock}\n\treturn mock\n}", "func (client *ApiECSClient) serviceClient() (*svc.AmazonEC2ContainerServiceV20141113Client, error) {\n\tconfig := client.config\n\n\tsigner := authv4.NewHttpSigner(config.AWSRegion, ECS_SERVICE, client.CredentialProvider(), nil)\n\n\tc := codec.AwsJson{Host: config.APIEndpoint, SignerV4: signer}\n\n\td, err := dialer.TLS(config.APIEndpoint, config.APIPort, &tls.Config{InsecureSkipVerify: client.insecureSkipVerify})\n\n\tif err != nil {\n\t\tlog.Error(\"Cannot resolve url\", \"url\", config.APIEndpoint, \"port\", config.APIPort, \"err\", err)\n\t\treturn nil, err\n\t}\n\n\tecs := svc.NewAmazonEC2ContainerServiceV20141113Client(d, c)\n\treturn ecs, nil\n}", "func MockECSServiceStateGetter(mockClient ecsiface.ClientAPI) *ECSServiceStateGetter {\n\treturn &ECSServiceStateGetter{\n\t\tclient: mockClient,\n\t}\n}", "func NewMockStudyServiceApiClient(ctrl *gomock.Controller) *MockStudyServiceApiClient {\n\tmock := &MockStudyServiceApiClient{ctrl: ctrl}\n\tmock.recorder = &MockStudyServiceApiClientMockRecorder{mock}\n\treturn mock\n}", "func getAWSClient(ctx context.Context, conf *config.Config, sess *session.Session, region config.Region) (*cziAWS.Client, error) {\n\t// for things meant to be run as a user\n\tuserConf := &aws.Config{\n\t\tRegion: aws.String(region.AWSRegion),\n\t}\n\n\tlambdaConf := userConf\n\tif conf.LambdaConfig.RoleARN != nil {\n\t\t// for things meant to be run as an assumed role\n\t\tlambdaConf = &aws.Config{\n\t\t\tRegion: aws.String(region.AWSRegion),\n\t\t\tCredentials: stscreds.NewCredentials(\n\t\t\t\tsess,\n\t\t\t\t*conf.LambdaConfig.RoleARN, func(p *stscreds.AssumeRoleProvider) {\n\t\t\t\t\tp.TokenProvider = stscreds.StdinTokenProvider\n\t\t\t\t},\n\t\t\t),\n\t\t}\n\t}\n\tawsClient := cziAWS.New(sess).\n\t\tWithIAM(userConf).\n\t\tWithKMS(userConf).\n\t\tWithSTS(userConf).\n\t\tWithLambda(lambdaConf)\n\treturn awsClient, nil\n}", "func MockComputeClient() *compute.ComputeClient {\n\treturn &compute.ComputeClient{\n\t\tClient: testutils.NewMockClient(testutils.MockClientInput{\n\t\t\tAccountName: accountURL,\n\t\t}),\n\t}\n}", "func NewEC2Client(config EC2ClientConfig) (*AwsEC2, error) {\n\tif config.ControllerID == \"\" {\n\t\treturn nil, fmt.Errorf(\"ControllerID is a required parameter\")\n\t}\n\tif config.Nametag == \"\" {\n\t\treturn nil, fmt.Errorf(\"Nametag is a required parameter\")\n\t}\n\tec2Client, err := getEC2Client(config.EndpointURL, config.InsecureTLSSkipVerify)\n\tif err != nil {\n\t\treturn nil, util.WrapError(err, \"Error creating EC2 client\")\n\t}\n\tvar ecsClient *ecs.ECS\n\tif config.ECSClusterName != \"\" {\n\t\tecsClient, err = getECSClient(config.EndpointURL, config.InsecureTLSSkipVerify)\n\t\tif err != nil {\n\t\t\treturn nil, util.WrapError(err, \"Error creating ECS client\")\n\t\t}\n\t}\n\tssmClient, err := getSSMClient(config.EndpointURL, config.InsecureTLSSkipVerify)\n\tif err != nil {\n\t\treturn nil, util.WrapError(err, \"creating SSM client\")\n\t}\n\tiamClient, err := getIAMClient(config.EndpointURL, config.InsecureTLSSkipVerify)\n\tif err != nil {\n\t\treturn nil, util.WrapError(err, \"creating IAM client\")\n\t}\n\tclient := &AwsEC2{\n\t\tclient: ec2Client,\n\t\tecs: ecsClient,\n\t\tssm: ssmClient,\n\t\tiam: iamClient,\n\t\tecsClusterName: config.ECSClusterName,\n\t\tcontrollerID: config.ControllerID,\n\t\tnametag: config.Nametag,\n\t}\n\tclient.vpcID, client.vpcCIDR, err = client.assertVPCExists(config.VPCID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient.subnetID = config.SubnetID\n\tif client.subnetID == \"\" {\n\t\tclient.subnetID, err = detectCurrentSubnet()\n\t\tif err != nil {\n\t\t\treturn nil, util.WrapError(err, \"Could not detect current subnet from metadata service. Please supply an AWS subnet id in provider.yaml\")\n\t\t}\n\t}\n\tclient.region = os.Getenv(\"AWS_REGION\")\n\n\tsubnetAttrs, err := client.getSubnetAttributes(client.subnetID)\n\tif err != nil {\n\t\treturn nil, util.WrapError(err, \"Error getting subnet attributes\")\n\t}\n\tclient.availabilityZone = subnetAttrs.AZ\n\tclient.usePublicIPs = !config.PrivateIPOnly\n\tif subnetAttrs.AddressAffinity == cloud.PrivateAddress {\n\t\tklog.V(2).Infoln(\"cells will run in a private subnet (no route to internet gateway)\")\n\t\tclient.usePublicIPs = false\n\t}\n\treturn client, nil\n}", "func NewClient(accessKeyID, secretAccessKey, region string) ClientInterface {\n\tvar (\n\t\tawsConfig = &aws.Config{\n\t\t\tCredentials: credentials.NewStaticCredentials(accessKeyID, secretAccessKey, \"\"),\n\t\t}\n\t\tsess = session.Must(session.NewSession(awsConfig))\n\t\tconfig = &aws.Config{Region: aws.String(region)}\n\t)\n\n\treturn &Client{\n\t\tEC2: ec2.New(sess, config),\n\t\tELB: elb.New(sess, config),\n\t\tSTS: sts.New(sess, config),\n\t}\n}", "func newS3Client(config *S3StorageConfig) (S3Client, error) {\n\tcfg := &awsbase.Config{\n\t\tAccessKey: config.AccessKey,\n\t\tAssumeRoleARN: config.RoleARN,\n\t\tProfile: config.Profile,\n\t\tRegion: config.Region,\n\t\tSecretKey: config.SecretKey,\n\t\tSkipCredsValidation: config.SkipCredentialsValidation,\n\t\tSkipMetadataApiCheck: config.SkipMetadataAPICheck,\n\t}\n\n\tsess, err := awsbase.GetSession(cfg)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to new s3 client: %s\", err)\n\t}\n\n\tclient := s3.New(sess.Copy(&aws.Config{\n\t\tEndpoint: aws.String(config.Endpoint),\n\t\tS3ForcePathStyle: aws.Bool(config.ForcePathStyle),\n\t}))\n\n\treturn client, nil\n}", "func NewMockApiClient() *MockApiClient {\n\treturn &MockApiClient{}\n}", "func NewMockecsClient(ctrl *gomock.Controller) *MockecsClient {\n\tmock := &MockecsClient{ctrl: ctrl}\n\tmock.recorder = &MockecsClientMockRecorder{mock}\n\treturn mock\n}", "func NewMockecsClient(ctrl *gomock.Controller) *MockecsClient {\n\tmock := &MockecsClient{ctrl: ctrl}\n\tmock.recorder = &MockecsClientMockRecorder{mock}\n\treturn mock\n}", "func (s AWSTestSuite) TestGetAWS() {\n\ts.Equal(\"ID\", env.GetAWSAccessKeyID())\n\ts.Equal(\"test.example.com\", env.GetAWSBucket())\n\ts.Equal(\"/backup/database\", env.GetAWSPath())\n\ts.Equal(\"secret\", env.GetAWSSecretAccessKey())\n\ts.Equal(\"us-east-1\", env.GetAWSRegion())\n}", "func NewClient(config *config.Config) *Client {\n\tclient := &Client{\n\t\tConfig: config,\n\t\telbv2Svc: map[string]*elbv2.ELBV2{},\n\t\tecsSvc: map[string]*ecs.ECS{},\n\t}\n\n\tfor service := range config.Services {\n\t\tsession := session.New(&aws.Config{\n\t\t\tRegion: aws.String(config.GetRegion(service)),\n\t\t})\n\n\t\tclient.elbv2Svc[service] = elbv2.New(session)\n\t\tclient.ecsSvc[service] = ecs.New(session)\n\t}\n\n\treturn client\n}", "func NewClient(accessKeyID, secretAccessKey, region, endpoint, bucket string) S3Client {\n\tsess, err := session.NewSession(&aws.Config{\n\t\tRegion: aws.String(region),\n\t\tEndpoint: aws.String(endpoint),\n\t\tCredentials: credentials.NewStaticCredentials(accessKeyID, secretAccessKey, \"\"),\n\t})\n\tif err != nil {\n\t\tlog.Printf(\"[ERROR]: %v\\n\", \"Error while creating S3 Session\")\n\t\treturn nil\n\t}\n\n\treturn &s3Client{\n\t\tbucket,\n\t\ts3manager.NewUploader(sess),\n\t}\n}", "func NewMockClient(obj ...runtime.Object) *kube.K8sClient {\n\tclient := &kube.K8sClient{\n\t\tClient: fake.NewSimpleClientset(obj...),\n\t}\n\n\treturn client\n}", "func NewClient(accessKeyID, secretAccessKey, region string) (*Client, error) {\n\tvar (\n\t\tawsConfig = &aws.Config{\n\t\t\tCredentials: credentials.NewStaticCredentials(accessKeyID, secretAccessKey, \"\"),\n\t\t}\n\t\tconfig = &aws.Config{Region: aws.String(region)}\n\t)\n\n\ts, err := session.NewSession(awsConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Client{\n\t\tEC2: ec2.New(s, config),\n\t\tELB: elb.New(s, config),\n\t\tELBv2: elbv2.New(s, config),\n\t\tIAM: iam.New(s, config),\n\t\tSTS: sts.New(s, config),\n\t\tS3: s3.New(s, config),\n\t}, nil\n}", "func newInputService2ProtocolTestClient(cfg aws.Config, handlers request.Handlers, partitionID, endpoint, signingRegion, signingName, resolvedRegion string) *InputService2ProtocolTest {\n\tsvc := &InputService2ProtocolTest{\n\t\tClient: client.New(\n\t\t\tcfg,\n\t\t\tmetadata.ClientInfo{\n\t\t\t\tServiceName: \"InputService2ProtocolTest\",\n\t\t\t\tServiceID: \"InputService2ProtocolTest\",\n\t\t\t\tSigningName: signingName,\n\t\t\t\tSigningRegion: signingRegion,\n\t\t\t\tPartitionID: partitionID,\n\t\t\t\tEndpoint: endpoint,\n\t\t\t\tAPIVersion: \"\",\n\t\t\t\tResolvedRegion: resolvedRegion,\n\t\t\t\tJSONVersion: \"1.1\",\n\t\t\t\tTargetPrefix: \"com.amazonaws.foo\",\n\t\t\t},\n\t\t\thandlers,\n\t\t),\n\t}\n\n\t// Handlers\n\tsvc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)\n\tsvc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)\n\tsvc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)\n\tsvc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)\n\tsvc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)\n\n\treturn svc\n}", "func NewAWS(ctx arn.Ctx, r ...Router) *AWS {\n\troot := append(ChainRouter{STSRouter{}}, r...)\n\tw := &AWS{\n\t\tCtxRouter: CtxRouter{arn.Ctx{}: &root},\n\t\tCtx: ctx,\n\t}\n\tw.Cfg = awsmock.Config(func(q *aws.Request) {\n\t\tw.mu.Lock()\n\t\tdefer w.mu.Unlock()\n\t\tif q := w.newRequest(q); !w.Route(q) {\n\t\t\tpanic(\"mock: \" + q.Name() + \" not handled\")\n\t\t}\n\t})\n\tw.Cfg.Region = ctx.Region\n\tw.Cfg.Credentials = w.UserCreds(\"\", \"alice\")\n\treturn w\n}", "func (m *MockIBuilder) GetClient(controllerName string, kubeClient client.Client, input awsclient.NewAwsClientInput) (awsclient.Client, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetClient\", controllerName, kubeClient, input)\n\tret0, _ := ret[0].(awsclient.Client)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func NewMockClient() fab.FabricClient {\n\tchannels := make(map[string]fab.Channel)\n\tc := &MockClient{channels: channels, cryptoSuite: nil, stateStore: nil, userContext: nil, config: NewMockConfig()}\n\treturn c\n}", "func NewClient(config Config) (engine.AWSClient, error) {\n\tsvc, err := session.NewSession(&aws.Config{\n\t\tCredentials: credentials.NewStaticCredentials(\n\t\t\tconfig.AccessKey,\n\t\t\tconfig.AccessSecret,\n\t\t\t\"\",\n\t\t),\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &awsClient{\n\t\tsvc: svc,\n\t\ts3Bucket: config.S3Bucket,\n\t\ts3Region: config.S3Region,\n\t\tsesRegion: config.SESRegion,\n\t\tmailFrom: mail.Address{\n\t\t\tName: \"scvl\",\n\t\t\tAddress: config.MailFrom,\n\t\t},\n\t\tmailBccAddresses: []*string{aws.String(config.MailBCCAddress)},\n\t\tmainDomain: config.MainDomain,\n\t\tfileDomain: config.FileDomain,\n\t}, nil\n}", "func NewClient(cfg aws.Config) Client {\n\treturn sqs.NewFromConfig(cfg)\n}", "func NewMockClient() *GCSClient {\n\treturn &GCSClient{}\n}", "func getS3Client(region string) (*s3.S3, error) {\n\tsess, err := session.NewSession(&aws.Config{\n\t\tRegion: aws.String(region)},\n\t)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn s3.New(sess), nil\n}", "func MockGithubClient(statusCode int, response string) ClientWrapper {\n\treturn Client(NewTestClient(MockRoundTripper{\n\t\tStatusCode: statusCode,\n\t\tResponse: response,\n\t}))\n}", "func NewMockClient(response interface{}, err error) utils.EndpointRequester {\n\treturn &mockClient{\n\t\tresponse: response,\n\t\terr: err,\n\t}\n}", "func NewClientMock(t minimock.Tester) *ClientMock {\n\tm := &ClientMock{t: t}\n\tif controller, ok := t.(minimock.MockController); ok {\n\t\tcontroller.RegisterMocker(m)\n\t}\n\n\tm.ActivatePrototypeMock = mClientMockActivatePrototype{mock: m}\n\tm.ActivatePrototypeMock.callArgs = []*ClientMockActivatePrototypeParams{}\n\n\tm.DeployCodeMock = mClientMockDeployCode{mock: m}\n\tm.DeployCodeMock.callArgs = []*ClientMockDeployCodeParams{}\n\n\tm.GetAbandonedRequestMock = mClientMockGetAbandonedRequest{mock: m}\n\tm.GetAbandonedRequestMock.callArgs = []*ClientMockGetAbandonedRequestParams{}\n\n\tm.GetCodeMock = mClientMockGetCode{mock: m}\n\tm.GetCodeMock.callArgs = []*ClientMockGetCodeParams{}\n\n\tm.GetObjectMock = mClientMockGetObject{mock: m}\n\tm.GetObjectMock.callArgs = []*ClientMockGetObjectParams{}\n\n\tm.GetPendingsMock = mClientMockGetPendings{mock: m}\n\tm.GetPendingsMock.callArgs = []*ClientMockGetPendingsParams{}\n\n\tm.HasPendingsMock = mClientMockHasPendings{mock: m}\n\tm.HasPendingsMock.callArgs = []*ClientMockHasPendingsParams{}\n\n\tm.InjectCodeDescriptorMock = mClientMockInjectCodeDescriptor{mock: m}\n\tm.InjectCodeDescriptorMock.callArgs = []*ClientMockInjectCodeDescriptorParams{}\n\n\tm.InjectFinishMock = mClientMockInjectFinish{mock: m}\n\n\tm.InjectObjectDescriptorMock = mClientMockInjectObjectDescriptor{mock: m}\n\tm.InjectObjectDescriptorMock.callArgs = []*ClientMockInjectObjectDescriptorParams{}\n\n\tm.RegisterIncomingRequestMock = mClientMockRegisterIncomingRequest{mock: m}\n\tm.RegisterIncomingRequestMock.callArgs = []*ClientMockRegisterIncomingRequestParams{}\n\n\tm.RegisterOutgoingRequestMock = mClientMockRegisterOutgoingRequest{mock: m}\n\tm.RegisterOutgoingRequestMock.callArgs = []*ClientMockRegisterOutgoingRequestParams{}\n\n\tm.RegisterResultMock = mClientMockRegisterResult{mock: m}\n\tm.RegisterResultMock.callArgs = []*ClientMockRegisterResultParams{}\n\n\tm.StateMock = mClientMockState{mock: m}\n\n\treturn m\n}", "func NewAWSClient(sess *session.Session, region string) (*AWSClient, error) {\n\tconfig := aws.NewConfig()\n\tsvcEC2Metadata := ec2metadata.New(sess)\n\n\t// get region when the region did not pass via a command-line option.\n\t// attempt get region is following order.\n\t// 1. Load config in AWS SDK for Go\n\t// - see also https://docs.aws.amazon.com/sdk-for-go/api/aws/session/\n\t// 2. Get region via EC2 Metadata\n\t// 3. Set \"ap-northeast-1\" in hardcoding as backward compatibility for previous versions\n\tif region == \"\" {\n\t\tr := *sess.Config.Region\n\n\t\tif r == \"\" {\n\t\t\tr, _ = getRegion(svcEC2Metadata)\n\t\t}\n\n\t\tif r == \"\" {\n\t\t\tr = \"ap-northeast-1\"\n\t\t}\n\n\t\tregion = r\n\t}\n\n\tconfig = config.WithRegion(region)\n\n\treturn &AWSClient{\n\t\tsvcEC2: ec2.New(sess, config),\n\t\tsvcEC2Metadata: svcEC2Metadata,\n\t\tconfig: config,\n\t}, nil\n}", "func NewClient() dns.Interface {\n\treturn &mockClient{\n\t\tzoneStore: map[string]dns.Zone{},\n\t\trecordSetStore: map[string]dns.RecordSet{},\n\t}\n}", "func newInputService2ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *InputService2ProtocolTest {\n\tsvc := &InputService2ProtocolTest{\n\t\tClient: client.New(\n\t\t\tcfg,\n\t\t\tmetadata.ClientInfo{\n\t\t\t\tServiceName: \"inputservice2protocoltest\",\n\t\t\t\tSigningRegion: signingRegion,\n\t\t\t\tEndpoint: endpoint,\n\t\t\t\tAPIVersion: \"2014-01-01\",\n\t\t\t},\n\t\t\thandlers,\n\t\t),\n\t}\n\n\t// Handlers\n\tsvc.Handlers.Sign.PushBack(v4.Sign)\n\tsvc.Handlers.Build.PushBackNamed(restxml.BuildHandler)\n\tsvc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler)\n\tsvc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler)\n\tsvc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler)\n\n\treturn svc\n}", "func NewClient(table string, region string) *Client {\n\ts := dynamo.New(session.New(), &aws.Config{Region: aws.String(region)})\n\treturn &Client{\n\t\tsession: s,\n\t\ttable: s.Table(table),\n\t}\n}", "func getClient() *s3.S3 {\n\tvar client *s3.S3\n\tclient = s3.New(session.New(&aws.Config{\n\t\tRegion: aws.String(\"us-east-1\"),\n\t\tCredentials: credentials.NewSharedCredentials(\"\", credentialsProfile),\n\t}))\n\treturn client\n}", "func NewMockClient(opts ...MockClientOption) *MockClient {\n\tc := &MockClient{}\n\tfor _, o := range opts {\n\t\tc.ApplyOption(o)\n\t}\n\treturn c\n}", "func GetAwsSession(cfg config.ServerConfig) (*session.Session, error) {\n\tvar providers []credentials.Provider\n\n\tcustomResolver := func(service, region string, optFns ...func(*endpoints.Options)) (endpoints.ResolvedEndpoint, error) {\n\t\tif service == endpoints.RdsServiceID && cfg.AwsEndpointRdsURL != \"\" {\n\t\t\treturn endpoints.ResolvedEndpoint{\n\t\t\t\tURL: cfg.AwsEndpointRdsURL,\n\t\t\t\tSigningRegion: cfg.AwsEndpointSigningRegion,\n\t\t\t}, nil\n\t\t}\n\t\tif service == endpoints.Ec2ServiceID && cfg.AwsEndpointEc2URL != \"\" {\n\t\t\treturn endpoints.ResolvedEndpoint{\n\t\t\t\tURL: cfg.AwsEndpointEc2URL,\n\t\t\t\tSigningRegion: cfg.AwsEndpointSigningRegion,\n\t\t\t}, nil\n\t\t}\n\t\tif service == endpoints.MonitoringServiceID && cfg.AwsEndpointCloudwatchURL != \"\" {\n\t\t\treturn endpoints.ResolvedEndpoint{\n\t\t\t\tURL: cfg.AwsEndpointCloudwatchURL,\n\t\t\t\tSigningRegion: cfg.AwsEndpointSigningRegion,\n\t\t\t}, nil\n\t\t}\n\t\tif service == endpoints.LogsServiceID && cfg.AwsEndpointCloudwatchLogsURL != \"\" {\n\t\t\treturn endpoints.ResolvedEndpoint{\n\t\t\t\tURL: cfg.AwsEndpointCloudwatchLogsURL,\n\t\t\t\tSigningRegion: cfg.AwsEndpointSigningRegion,\n\t\t\t}, nil\n\t\t}\n\n\t\treturn endpoints.DefaultResolver().EndpointFor(service, region, optFns...)\n\t}\n\n\tif cfg.AwsAccessKeyID != \"\" {\n\t\tproviders = append(providers, &credentials.StaticProvider{\n\t\t\tValue: credentials.Value{\n\t\t\t\tAccessKeyID: cfg.AwsAccessKeyID,\n\t\t\t\tSecretAccessKey: cfg.AwsSecretAccessKey,\n\t\t\t\tSessionToken: \"\",\n\t\t\t},\n\t\t})\n\t}\n\n\t// add default providers\n\tproviders = append(providers, &credentials.EnvProvider{})\n\tproviders = append(providers, &credentials.SharedCredentialsProvider{Filename: \"\", Profile: \"\"})\n\n\t// add the metadata service\n\tdef := defaults.Get()\n\tdef.Config.HTTPClient = config.CreateEC2IMDSHTTPClient(cfg)\n\tdef.Config.MaxRetries = aws.Int(2)\n\tproviders = append(providers, defaults.RemoteCredProvider(*def.Config, def.Handlers))\n\n\tcreds := credentials.NewChainCredentials(providers)\n\n\tif cfg.AwsAssumeRole != \"\" || (cfg.AwsWebIdentityTokenFile != \"\" && cfg.AwsRoleArn != \"\") {\n\t\tsess, err := session.NewSession(&aws.Config{\n\t\t\tCredentials: creds,\n\t\t\tCredentialsChainVerboseErrors: aws.Bool(true),\n\t\t\tRegion: aws.String(cfg.AwsRegion),\n\t\t\tHTTPClient: cfg.HTTPClient,\n\t\t\tEndpointResolver: endpoints.ResolverFunc(customResolver),\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif cfg.AwsAssumeRole != \"\" {\n\t\t\tcreds = stscreds.NewCredentials(sess, cfg.AwsAssumeRole)\n\t\t} else if cfg.AwsWebIdentityTokenFile != \"\" && cfg.AwsRoleArn != \"\" {\n\t\t\tcreds = stscreds.NewWebIdentityCredentials(sess, cfg.AwsRoleArn, \"\", cfg.AwsWebIdentityTokenFile)\n\t\t}\n\t}\n\n\treturn session.NewSession(&aws.Config{\n\t\tCredentials: creds,\n\t\tCredentialsChainVerboseErrors: aws.Bool(true),\n\t\tRegion: aws.String(cfg.AwsRegion),\n\t\tHTTPClient: cfg.HTTPClient,\n\t\tEndpointResolver: endpoints.ResolverFunc(customResolver),\n\t})\n}", "func NewClient(httpClient *http.Client) (*Client, error) {\n\tif httpClient == nil {\n\t\thttpClient = http.DefaultClient\n\t}\n\n\tc := &Client{}\n\n\tbaseURL, _ := url.Parse(DefaultBaseURL)\n\tvsspsBaseURL, _ := url.Parse(DefaultVsspsBaseURL)\n\tvsaexBaseURL, _ := url.Parse(DefaultVsaexBaseURL)\n\n\tc.client = httpClient\n\tc.BaseURL = *baseURL\n\tc.VsspsBaseURL = *vsspsBaseURL\n\tc.VsaexBaseURL = *vsaexBaseURL\n\tc.UserAgent = userAgent\n\n\tc.Boards = &BoardsService{client: c}\n\tc.BuildDefinitions = &BuildDefinitionsService{client: c}\n\tc.Builds = &BuildsService{client: c}\n\tc.DeliveryPlans = &DeliveryPlansService{client: c}\n\tc.Favourites = &FavouritesService{client: c}\n\tc.Git = &GitService{client: c}\n\tc.Iterations = &IterationsService{client: c}\n\tc.PolicyEvaluations = &PolicyEvaluationsService{client: c}\n\tc.PullRequests = &PullRequestsService{client: c}\n\tc.Teams = &TeamsService{client: c}\n\tc.Tests = &TestsService{client: c}\n\tc.Users = &UsersService{client: c}\n\tc.UserEntitlements = &UserEntitlementsService{client: c}\n\tc.WorkItems = &WorkItemsService{client: c}\n\n\treturn c, nil\n}", "func setupFakeClient(url string) *Client {\n\treturn &Client{\n\t\tServiceEndpoint: ServiceEndpoint{\n\t\t\tRequestURL: url,\n\t\t\tDocsURL: \"some-docs-url\",\n\t\t},\n\t}\n}", "func TestAWSIAM(t *testing.T) {\n\tctx, cancel := context.WithCancel(context.Background())\n\tt.Cleanup(cancel)\n\n\t// Setup AWS database objects.\n\trdsInstance := &rds.DBInstance{\n\t\tDBInstanceArn: aws.String(\"arn:aws:rds:us-west-1:123456789012:db:postgres-rds\"),\n\t\tDBInstanceIdentifier: aws.String(\"postgres-rds\"),\n\t\tDbiResourceId: aws.String(\"db-xyz\"),\n\t}\n\n\tauroraCluster := &rds.DBCluster{\n\t\tDBClusterArn: aws.String(\"arn:aws:rds:us-east-1:123456789012:cluster:postgres-aurora\"),\n\t\tDBClusterIdentifier: aws.String(\"postgres-aurora\"),\n\t\tDbClusterResourceId: aws.String(\"cluster-xyz\"),\n\t}\n\n\tredshiftCluster := &redshift.Cluster{\n\t\tClusterNamespaceArn: aws.String(\"arn:aws:redshift:us-east-2:123456789012:namespace:namespace-xyz\"),\n\t\tClusterIdentifier: aws.String(\"redshift-cluster-1\"),\n\t}\n\n\t// Configure mocks.\n\tstsClient := &mocks.STSMock{\n\t\tARN: \"arn:aws:iam::123456789012:role/test-role\",\n\t}\n\n\trdsClient := &mocks.RDSMock{\n\t\tDBInstances: []*rds.DBInstance{rdsInstance},\n\t\tDBClusters: []*rds.DBCluster{auroraCluster},\n\t}\n\n\tredshiftClient := &mocks.RedshiftMock{\n\t\tClusters: []*redshift.Cluster{redshiftCluster},\n\t}\n\n\tiamClient := &mocks.IAMMock{}\n\n\t// Setup database resources.\n\trdsDatabase, err := types.NewDatabaseV3(types.Metadata{\n\t\tName: \"postgres-rds\",\n\t}, types.DatabaseSpecV3{\n\t\tProtocol: defaults.ProtocolPostgres,\n\t\tURI: \"localhost\",\n\t\tAWS: types.AWS{Region: \"localhost\", AccountID: \"123456789012\", RDS: types.RDS{InstanceID: \"postgres-rds\", ResourceID: \"postgres-rds-resource-id\"}},\n\t})\n\trequire.NoError(t, err)\n\n\tauroraDatabase, err := types.NewDatabaseV3(types.Metadata{\n\t\tName: \"postgres-aurora\",\n\t}, types.DatabaseSpecV3{\n\t\tProtocol: defaults.ProtocolPostgres,\n\t\tURI: \"localhost\",\n\t\tAWS: types.AWS{Region: \"localhost\", AccountID: \"123456789012\", RDS: types.RDS{ClusterID: \"postgres-aurora\", ResourceID: \"postgres-aurora-resource-id\"}},\n\t})\n\trequire.NoError(t, err)\n\n\trdsProxy, err := types.NewDatabaseV3(types.Metadata{\n\t\tName: \"rds-proxy\",\n\t}, types.DatabaseSpecV3{\n\t\tProtocol: defaults.ProtocolPostgres,\n\t\tURI: \"localhost\",\n\t\tAWS: types.AWS{Region: \"localhost\", AccountID: \"123456789012\", RDSProxy: types.RDSProxy{Name: \"rds-proxy\", ResourceID: \"rds-proxy-resource-id\"}},\n\t})\n\trequire.NoError(t, err)\n\n\tredshiftDatabase, err := types.NewDatabaseV3(types.Metadata{\n\t\tName: \"redshift\",\n\t}, types.DatabaseSpecV3{\n\t\tProtocol: defaults.ProtocolPostgres,\n\t\tURI: \"localhost\",\n\t\tAWS: types.AWS{Region: \"localhost\", AccountID: \"123456789012\", Redshift: types.Redshift{ClusterID: \"redshift-cluster-1\"}},\n\t})\n\trequire.NoError(t, err)\n\n\telasticache, err := types.NewDatabaseV3(types.Metadata{\n\t\tName: \"aws-elasticache\",\n\t}, types.DatabaseSpecV3{\n\t\tProtocol: \"redis\",\n\t\tURI: \"clustercfg.my-redis-cluster.xxxxxx.cac1.cache.amazonaws.com:6379\",\n\t\tAWS: types.AWS{\n\t\t\tAccountID: \"123456789012\",\n\t\t\tElastiCache: types.ElastiCache{\n\t\t\t\tReplicationGroupID: \"some-group\",\n\t\t\t},\n\t\t},\n\t})\n\trequire.NoError(t, err)\n\n\t// Make configurator.\n\ttaskChan := make(chan struct{})\n\twaitForTaskProcessed := func(t *testing.T) {\n\t\tselect {\n\t\tcase <-taskChan:\n\t\tcase <-time.After(5 * time.Second):\n\t\t\trequire.Fail(t, \"Failed to wait for task is processed\")\n\t\t}\n\t}\n\tassumedRole := types.AssumeRole{\n\t\tRoleARN: \"arn:aws:iam::123456789012:role/role-to-assume\",\n\t\tExternalID: \"externalid123\",\n\t}\n\tconfigurator, err := NewIAM(ctx, IAMConfig{\n\t\tAccessPoint: &mockAccessPoint{},\n\t\tClients: &clients.TestCloudClients{\n\t\t\tRDS: rdsClient,\n\t\t\tRedshift: redshiftClient,\n\t\t\tSTS: stsClient,\n\t\t\tIAM: iamClient,\n\t\t},\n\t\tHostID: \"host-id\",\n\t\tonProcessedTask: func(iamTask, error) {\n\t\t\ttaskChan <- struct{}{}\n\t\t},\n\t})\n\trequire.NoError(t, err)\n\trequire.NoError(t, configurator.Start(ctx))\n\n\tpolicyName, err := configurator.getPolicyName()\n\trequire.NoError(t, err)\n\n\ttests := map[string]struct {\n\t\tdatabase types.Database\n\t\twantPolicyContains string\n\t\tgetIAMAuthEnabled func() bool\n\t}{\n\t\t\"RDS\": {\n\t\t\tdatabase: rdsDatabase,\n\t\t\twantPolicyContains: rdsDatabase.GetAWS().RDS.ResourceID,\n\t\t\tgetIAMAuthEnabled: func() bool {\n\t\t\t\tout := aws.BoolValue(rdsInstance.IAMDatabaseAuthenticationEnabled)\n\t\t\t\t// reset it\n\t\t\t\trdsInstance.IAMDatabaseAuthenticationEnabled = aws.Bool(false)\n\t\t\t\treturn out\n\t\t\t},\n\t\t},\n\t\t\"Aurora\": {\n\t\t\tdatabase: auroraDatabase,\n\t\t\twantPolicyContains: auroraDatabase.GetAWS().RDS.ResourceID,\n\t\t\tgetIAMAuthEnabled: func() bool {\n\t\t\t\tout := aws.BoolValue(auroraCluster.IAMDatabaseAuthenticationEnabled)\n\t\t\t\t// reset it\n\t\t\t\tauroraCluster.IAMDatabaseAuthenticationEnabled = aws.Bool(false)\n\t\t\t\treturn out\n\t\t\t},\n\t\t},\n\t\t\"RDS Proxy\": {\n\t\t\tdatabase: rdsProxy,\n\t\t\twantPolicyContains: rdsProxy.GetAWS().RDSProxy.ResourceID,\n\t\t\tgetIAMAuthEnabled: func() bool {\n\t\t\t\treturn true // it always is for rds proxy.\n\t\t\t},\n\t\t},\n\t\t\"Redshift\": {\n\t\t\tdatabase: redshiftDatabase,\n\t\t\twantPolicyContains: redshiftDatabase.GetAWS().Redshift.ClusterID,\n\t\t\tgetIAMAuthEnabled: func() bool {\n\t\t\t\treturn true // it always is for redshift.\n\t\t\t},\n\t\t},\n\t\t\"ElastiCache\": {\n\t\t\tdatabase: elasticache,\n\t\t\twantPolicyContains: elasticache.GetAWS().ElastiCache.ReplicationGroupID,\n\t\t\tgetIAMAuthEnabled: func() bool {\n\t\t\t\treturn true // it always is for ElastiCache.\n\t\t\t},\n\t\t},\n\t}\n\n\tfor testName, tt := range tests {\n\t\tfor _, assumeRole := range []types.AssumeRole{{}, assumedRole} {\n\t\t\tgetRolePolicyInput := &iam.GetRolePolicyInput{\n\t\t\t\tRoleName: aws.String(\"test-role\"),\n\t\t\t\tPolicyName: aws.String(policyName),\n\t\t\t}\n\t\t\tdatabase := tt.database.Copy()\n\t\t\tif assumeRole.RoleARN != \"\" {\n\t\t\t\ttestName += \" with assumed role\"\n\t\t\t\tgetRolePolicyInput.RoleName = aws.String(\"role-to-assume\")\n\t\t\t\tmeta := database.GetAWS()\n\t\t\t\tmeta.AssumeRoleARN = assumeRole.RoleARN\n\t\t\t\tmeta.ExternalID = assumeRole.ExternalID\n\t\t\t\tdatabase.SetStatusAWS(meta)\n\t\t\t}\n\t\t\tt.Run(testName, func(t *testing.T) {\n\t\t\t\t// Initially unspecified since no tasks has ran yet.\n\t\t\t\trequire.Equal(t, types.IAMPolicyStatus_IAM_POLICY_STATUS_UNSPECIFIED, database.GetAWS().IAMPolicyStatus)\n\n\t\t\t\t// Configure database and make sure IAM is enabled and policy was attached.\n\t\t\t\terr = configurator.Setup(ctx, database)\n\t\t\t\trequire.NoError(t, err)\n\t\t\t\twaitForTaskProcessed(t)\n\t\t\t\toutput, err := iamClient.GetRolePolicyWithContext(ctx, getRolePolicyInput)\n\t\t\t\trequire.NoError(t, err)\n\t\t\t\trequire.True(t, tt.getIAMAuthEnabled())\n\t\t\t\trequire.Contains(t, aws.StringValue(output.PolicyDocument), tt.wantPolicyContains)\n\n\t\t\t\terr = configurator.UpdateIAMStatus(database)\n\t\t\t\trequire.NoError(t, err)\n\t\t\t\trequire.Equal(t, types.IAMPolicyStatus_IAM_POLICY_STATUS_SUCCESS, database.GetAWS().IAMPolicyStatus, \"must be success because iam policy was set up\")\n\n\t\t\t\t// Deconfigure database, policy should get detached.\n\t\t\t\terr = configurator.Teardown(ctx, database)\n\t\t\t\trequire.NoError(t, err)\n\t\t\t\twaitForTaskProcessed(t)\n\t\t\t\t_, err = iamClient.GetRolePolicyWithContext(ctx, getRolePolicyInput)\n\t\t\t\trequire.True(t, trace.IsNotFound(err))\n\t\t\t\tmeta := database.GetAWS()\n\t\t\t\tif meta.AssumeRoleARN != \"\" {\n\t\t\t\t\trequire.Equal(t, []string{meta.AssumeRoleARN}, stsClient.GetAssumedRoleARNs())\n\t\t\t\t\trequire.Equal(t, []string{meta.ExternalID}, stsClient.GetAssumedRoleExternalIDs())\n\t\t\t\t\tstsClient.ResetAssumeRoleHistory()\n\t\t\t\t}\n\n\t\t\t\terr = configurator.UpdateIAMStatus(database)\n\t\t\t\trequire.NoError(t, err)\n\t\t\t\trequire.Equal(t, types.IAMPolicyStatus_IAM_POLICY_STATUS_UNSPECIFIED, database.GetAWS().IAMPolicyStatus, \"must be unspecified because task is tearing down\")\n\t\t\t})\n\t\t}\n\t}\n}", "func NewMockClient() cortex_cache.Cache {\n\treturn &mockClient{\n\t\tclient: map[string][]byte{},\n\t}\n}", "func newAwsServiceDiscoveryServices(c *TrussleV1Client, namespace string) *awsServiceDiscoveryServices {\n\treturn &awsServiceDiscoveryServices{\n\t\tclient: c.RESTClient(),\n\t\tns: namespace,\n\t}\n}", "func TestAWSMetadata(t *testing.T) {\n\t// Configure RDS API mock.\n\trds := &mocks.RDSMock{\n\t\tDBInstances: []*rds.DBInstance{\n\t\t\t// Standalone RDS instance.\n\t\t\t{\n\t\t\t\tDBInstanceArn: aws.String(\"arn:aws:rds:us-west-1:123456789012:db:postgres-rds\"),\n\t\t\t\tDBInstanceIdentifier: aws.String(\"postgres-rds\"),\n\t\t\t\tDbiResourceId: aws.String(\"db-xyz\"),\n\t\t\t\tIAMDatabaseAuthenticationEnabled: aws.Bool(true),\n\t\t\t},\n\t\t\t// Instance that is a part of an Aurora cluster.\n\t\t\t{\n\t\t\t\tDBInstanceArn: aws.String(\"arn:aws:rds:us-east-1:123456789012:db:postgres-aurora-1\"),\n\t\t\t\tDBInstanceIdentifier: aws.String(\"postgres-aurora-1\"),\n\t\t\t\tDBClusterIdentifier: aws.String(\"postgres-aurora\"),\n\t\t\t},\n\t\t},\n\t\tDBClusters: []*rds.DBCluster{\n\t\t\t// Aurora cluster.\n\t\t\t{\n\t\t\t\tDBClusterArn: aws.String(\"arn:aws:rds:us-east-1:123456789012:cluster:postgres-aurora\"),\n\t\t\t\tDBClusterIdentifier: aws.String(\"postgres-aurora\"),\n\t\t\t\tDbClusterResourceId: aws.String(\"cluster-xyz\"),\n\t\t\t},\n\t\t},\n\t\tDBProxies: []*rds.DBProxy{\n\t\t\t{\n\t\t\t\tDBProxyArn: aws.String(\"arn:aws:rds:us-east-1:123456789012:db-proxy:prx-resource-id\"),\n\t\t\t\tDBProxyName: aws.String(\"rds-proxy\"),\n\t\t\t},\n\t\t},\n\t\tDBProxyEndpoints: []*rds.DBProxyEndpoint{\n\t\t\t{\n\t\t\t\tDBProxyEndpointName: aws.String(\"rds-proxy-endpoint\"),\n\t\t\t\tDBProxyName: aws.String(\"rds-proxy\"),\n\t\t\t},\n\t\t},\n\t}\n\n\t// Configure Redshift API mock.\n\tredshift := &mocks.RedshiftMock{\n\t\tClusters: []*redshift.Cluster{\n\t\t\t{\n\t\t\t\tClusterNamespaceArn: aws.String(\"arn:aws:redshift:us-west-1:123456789012:namespace:namespace-id\"),\n\t\t\t\tClusterIdentifier: aws.String(\"redshift-cluster-1\"),\n\t\t\t},\n\t\t\t{\n\t\t\t\tClusterNamespaceArn: aws.String(\"arn:aws:redshift:us-east-2:210987654321:namespace:namespace-id\"),\n\t\t\t\tClusterIdentifier: aws.String(\"redshift-cluster-2\"),\n\t\t\t},\n\t\t},\n\t}\n\n\t// Configure ElastiCache API mock.\n\telasticache := &mocks.ElastiCacheMock{\n\t\tReplicationGroups: []*elasticache.ReplicationGroup{\n\t\t\t{\n\t\t\t\tARN: aws.String(\"arn:aws:elasticache:us-west-1:123456789012:replicationgroup:my-redis\"),\n\t\t\t\tReplicationGroupId: aws.String(\"my-redis\"),\n\t\t\t\tClusterEnabled: aws.Bool(true),\n\t\t\t\tTransitEncryptionEnabled: aws.Bool(true),\n\t\t\t\tUserGroupIds: []*string{aws.String(\"my-user-group\")},\n\t\t\t},\n\t\t},\n\t}\n\n\t// Configure MemoryDB API mock.\n\tmemorydb := &mocks.MemoryDBMock{\n\t\tClusters: []*memorydb.Cluster{\n\t\t\t{\n\t\t\t\tARN: aws.String(\"arn:aws:memorydb:us-west-1:123456789012:cluster:my-cluster\"),\n\t\t\t\tName: aws.String(\"my-cluster\"),\n\t\t\t\tTLSEnabled: aws.Bool(true),\n\t\t\t\tACLName: aws.String(\"my-user-group\"),\n\t\t\t},\n\t\t},\n\t}\n\n\tstsMock := &mocks.STSMock{}\n\n\t// Configure Redshift Serverless API mock.\n\tredshiftServerlessWorkgroup := mocks.RedshiftServerlessWorkgroup(\"my-workgroup\", \"us-west-1\")\n\tredshiftServerlessEndpoint := mocks.RedshiftServerlessEndpointAccess(redshiftServerlessWorkgroup, \"my-endpoint\", \"us-west-1\")\n\tredshiftServerless := &mocks.RedshiftServerlessMock{\n\t\tWorkgroups: []*redshiftserverless.Workgroup{redshiftServerlessWorkgroup},\n\t\tEndpoints: []*redshiftserverless.EndpointAccess{redshiftServerlessEndpoint},\n\t}\n\n\t// Create metadata fetcher.\n\tmetadata, err := NewMetadata(MetadataConfig{\n\t\tClients: &cloud.TestCloudClients{\n\t\t\tRDS: rds,\n\t\t\tRedshift: redshift,\n\t\t\tElastiCache: elasticache,\n\t\t\tMemoryDB: memorydb,\n\t\t\tRedshiftServerless: redshiftServerless,\n\t\t\tSTS: stsMock,\n\t\t},\n\t})\n\trequire.NoError(t, err)\n\n\ttests := []struct {\n\t\tname string\n\t\tinAWS types.AWS\n\t\toutAWS types.AWS\n\t}{\n\t\t{\n\t\t\tname: \"RDS instance\",\n\t\t\tinAWS: types.AWS{\n\t\t\t\tAssumeRoleARN: \"arn:aws:iam::123456789012:role/DBDiscoverer\",\n\t\t\t\tExternalID: \"externalID123\",\n\t\t\t\tRDS: types.RDS{\n\t\t\t\t\tInstanceID: \"postgres-rds\",\n\t\t\t\t},\n\t\t\t},\n\t\t\toutAWS: types.AWS{\n\t\t\t\tRegion: \"us-west-1\",\n\t\t\t\tAccountID: \"123456789012\",\n\t\t\t\tAssumeRoleARN: \"arn:aws:iam::123456789012:role/DBDiscoverer\",\n\t\t\t\tExternalID: \"externalID123\",\n\t\t\t\tRDS: types.RDS{\n\t\t\t\t\tInstanceID: \"postgres-rds\",\n\t\t\t\t\tResourceID: \"db-xyz\",\n\t\t\t\t\tIAMAuth: true,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"Aurora cluster\",\n\t\t\tinAWS: types.AWS{\n\t\t\t\tAssumeRoleARN: \"arn:aws:iam::123456789012:role/DBDiscoverer\",\n\t\t\t\tExternalID: \"externalID123\",\n\t\t\t\tRDS: types.RDS{\n\t\t\t\t\tInstanceID: \"postgres-aurora\",\n\t\t\t\t},\n\t\t\t},\n\t\t\toutAWS: types.AWS{\n\t\t\t\tRegion: \"us-east-1\",\n\t\t\t\tAccountID: \"123456789012\",\n\t\t\t\tAssumeRoleARN: \"arn:aws:iam::123456789012:role/DBDiscoverer\",\n\t\t\t\tExternalID: \"externalID123\",\n\t\t\t\tRDS: types.RDS{\n\t\t\t\t\tClusterID: \"postgres-aurora\",\n\t\t\t\t\tResourceID: \"cluster-xyz\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"RDS instance, part of Aurora cluster\",\n\t\t\tinAWS: types.AWS{\n\t\t\t\tAssumeRoleARN: \"arn:aws:iam::123456789012:role/DBDiscoverer\",\n\t\t\t\tExternalID: \"externalID123\",\n\t\t\t\tRDS: types.RDS{\n\t\t\t\t\tInstanceID: \"postgres-aurora-1\",\n\t\t\t\t},\n\t\t\t},\n\t\t\toutAWS: types.AWS{\n\t\t\t\tRegion: \"us-east-1\",\n\t\t\t\tAccountID: \"123456789012\",\n\t\t\t\tAssumeRoleARN: \"arn:aws:iam::123456789012:role/DBDiscoverer\",\n\t\t\t\tExternalID: \"externalID123\",\n\t\t\t\tRDS: types.RDS{\n\t\t\t\t\tClusterID: \"postgres-aurora\",\n\t\t\t\t\tResourceID: \"cluster-xyz\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"Redshift cluster 1\",\n\t\t\tinAWS: types.AWS{\n\t\t\t\tAssumeRoleARN: \"arn:aws:iam::123456789012:role/DBDiscoverer\",\n\t\t\t\tExternalID: \"externalID123\",\n\t\t\t\tRedshift: types.Redshift{\n\t\t\t\t\tClusterID: \"redshift-cluster-1\",\n\t\t\t\t},\n\t\t\t},\n\t\t\toutAWS: types.AWS{\n\t\t\t\tAccountID: \"123456789012\",\n\t\t\t\tRegion: \"us-west-1\",\n\t\t\t\tAssumeRoleARN: \"arn:aws:iam::123456789012:role/DBDiscoverer\",\n\t\t\t\tExternalID: \"externalID123\",\n\t\t\t\tRedshift: types.Redshift{\n\t\t\t\t\tClusterID: \"redshift-cluster-1\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"Redshift cluster 2\",\n\t\t\tinAWS: types.AWS{\n\t\t\t\tAssumeRoleARN: \"arn:aws:iam::123456789012:role/DBDiscoverer\",\n\t\t\t\tExternalID: \"externalID123\",\n\t\t\t\tRedshift: types.Redshift{\n\t\t\t\t\tClusterID: \"redshift-cluster-2\",\n\t\t\t\t},\n\t\t\t},\n\t\t\toutAWS: types.AWS{\n\t\t\t\tAccountID: \"210987654321\",\n\t\t\t\tRegion: \"us-east-2\",\n\t\t\t\tAssumeRoleARN: \"arn:aws:iam::123456789012:role/DBDiscoverer\",\n\t\t\t\tExternalID: \"externalID123\",\n\t\t\t\tRedshift: types.Redshift{\n\t\t\t\t\tClusterID: \"redshift-cluster-2\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"ElastiCache\",\n\t\t\tinAWS: types.AWS{\n\t\t\t\tAssumeRoleARN: \"arn:aws:iam::123456789012:role/DBDiscoverer\",\n\t\t\t\tExternalID: \"externalID123\",\n\t\t\t\tElastiCache: types.ElastiCache{\n\t\t\t\t\tReplicationGroupID: \"my-redis\",\n\t\t\t\t\tEndpointType: \"configuration\",\n\t\t\t\t},\n\t\t\t},\n\t\t\toutAWS: types.AWS{\n\t\t\t\tAccountID: \"123456789012\",\n\t\t\t\tRegion: \"us-west-1\",\n\t\t\t\tAssumeRoleARN: \"arn:aws:iam::123456789012:role/DBDiscoverer\",\n\t\t\t\tExternalID: \"externalID123\",\n\t\t\t\tElastiCache: types.ElastiCache{\n\t\t\t\t\tReplicationGroupID: \"my-redis\",\n\t\t\t\t\tUserGroupIDs: []string{\"my-user-group\"},\n\t\t\t\t\tTransitEncryptionEnabled: true,\n\t\t\t\t\tEndpointType: \"configuration\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"MemoryDB\",\n\t\t\tinAWS: types.AWS{\n\t\t\t\tAssumeRoleARN: \"arn:aws:iam::123456789012:role/DBDiscoverer\",\n\t\t\t\tExternalID: \"externalID123\",\n\t\t\t\tMemoryDB: types.MemoryDB{\n\t\t\t\t\tClusterName: \"my-cluster\",\n\t\t\t\t\tEndpointType: \"cluster\",\n\t\t\t\t},\n\t\t\t},\n\t\t\toutAWS: types.AWS{\n\t\t\t\tAccountID: \"123456789012\",\n\t\t\t\tRegion: \"us-west-1\",\n\t\t\t\tAssumeRoleARN: \"arn:aws:iam::123456789012:role/DBDiscoverer\",\n\t\t\t\tExternalID: \"externalID123\",\n\t\t\t\tMemoryDB: types.MemoryDB{\n\t\t\t\t\tClusterName: \"my-cluster\",\n\t\t\t\t\tACLName: \"my-user-group\",\n\t\t\t\t\tTLSEnabled: true,\n\t\t\t\t\tEndpointType: \"cluster\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"RDS Proxy\",\n\t\t\tinAWS: types.AWS{\n\t\t\t\tRegion: \"us-east-1\",\n\t\t\t\tAssumeRoleARN: \"arn:aws:iam::123456789012:role/DBDiscoverer\",\n\t\t\t\tExternalID: \"externalID123\",\n\t\t\t\tRDSProxy: types.RDSProxy{\n\t\t\t\t\tName: \"rds-proxy\",\n\t\t\t\t},\n\t\t\t},\n\t\t\toutAWS: types.AWS{\n\t\t\t\tAccountID: \"123456789012\",\n\t\t\t\tRegion: \"us-east-1\",\n\t\t\t\tAssumeRoleARN: \"arn:aws:iam::123456789012:role/DBDiscoverer\",\n\t\t\t\tExternalID: \"externalID123\",\n\t\t\t\tRDSProxy: types.RDSProxy{\n\t\t\t\t\tName: \"rds-proxy\",\n\t\t\t\t\tResourceID: \"prx-resource-id\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"RDS Proxy custom endpoint\",\n\t\t\tinAWS: types.AWS{\n\t\t\t\tRegion: \"us-east-1\",\n\t\t\t\tAssumeRoleARN: \"arn:aws:iam::123456789012:role/DBDiscoverer\",\n\t\t\t\tExternalID: \"externalID123\",\n\t\t\t\tRDSProxy: types.RDSProxy{\n\t\t\t\t\tCustomEndpointName: \"rds-proxy-endpoint\",\n\t\t\t\t},\n\t\t\t},\n\t\t\toutAWS: types.AWS{\n\t\t\t\tAccountID: \"123456789012\",\n\t\t\t\tRegion: \"us-east-1\",\n\t\t\t\tAssumeRoleARN: \"arn:aws:iam::123456789012:role/DBDiscoverer\",\n\t\t\t\tExternalID: \"externalID123\",\n\t\t\t\tRDSProxy: types.RDSProxy{\n\t\t\t\t\tName: \"rds-proxy\",\n\t\t\t\t\tCustomEndpointName: \"rds-proxy-endpoint\",\n\t\t\t\t\tResourceID: \"prx-resource-id\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"Redshift Serverless workgroup\",\n\t\t\tinAWS: types.AWS{\n\t\t\t\tRegion: \"us-west-1\",\n\t\t\t\tAssumeRoleARN: \"arn:aws:iam::123456789012:role/DBDiscoverer\",\n\t\t\t\tExternalID: \"externalID123\",\n\t\t\t\tRedshiftServerless: types.RedshiftServerless{\n\t\t\t\t\tWorkgroupName: \"my-workgroup\",\n\t\t\t\t},\n\t\t\t},\n\t\t\toutAWS: types.AWS{\n\t\t\t\tAccountID: \"123456789012\",\n\t\t\t\tRegion: \"us-west-1\",\n\t\t\t\tAssumeRoleARN: \"arn:aws:iam::123456789012:role/DBDiscoverer\",\n\t\t\t\tExternalID: \"externalID123\",\n\t\t\t\tRedshiftServerless: types.RedshiftServerless{\n\t\t\t\t\tWorkgroupName: \"my-workgroup\",\n\t\t\t\t\tWorkgroupID: \"some-uuid-for-my-workgroup\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"Redshift Serverless VPC endpoint\",\n\t\t\tinAWS: types.AWS{\n\t\t\t\tRegion: \"us-west-1\",\n\t\t\t\tAssumeRoleARN: \"arn:aws:iam::123456789012:role/DBDiscoverer\",\n\t\t\t\tExternalID: \"externalID123\",\n\t\t\t\tRedshiftServerless: types.RedshiftServerless{\n\t\t\t\t\tEndpointName: \"my-endpoint\",\n\t\t\t\t},\n\t\t\t},\n\t\t\toutAWS: types.AWS{\n\t\t\t\tAccountID: \"123456789012\",\n\t\t\t\tRegion: \"us-west-1\",\n\t\t\t\tAssumeRoleARN: \"arn:aws:iam::123456789012:role/DBDiscoverer\",\n\t\t\t\tExternalID: \"externalID123\",\n\t\t\t\tRedshiftServerless: types.RedshiftServerless{\n\t\t\t\t\tWorkgroupName: \"my-workgroup\",\n\t\t\t\t\tEndpointName: \"my-endpoint\",\n\t\t\t\t\tWorkgroupID: \"some-uuid-for-my-workgroup\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\tctx := context.Background()\n\tfor _, test := range tests {\n\t\tt.Run(test.name, func(t *testing.T) {\n\t\t\tdatabase, err := types.NewDatabaseV3(types.Metadata{\n\t\t\t\tName: \"test\",\n\t\t\t}, types.DatabaseSpecV3{\n\t\t\t\tProtocol: defaults.ProtocolPostgres,\n\t\t\t\tURI: \"localhost\",\n\t\t\t\tAWS: test.inAWS,\n\t\t\t})\n\t\t\trequire.NoError(t, err)\n\n\t\t\terr = metadata.Update(ctx, database)\n\t\t\trequire.NoError(t, err)\n\t\t\trequire.Equal(t, test.outAWS, database.GetAWS())\n\t\t\trequire.Equal(t, []string{test.inAWS.AssumeRoleARN}, stsMock.GetAssumedRoleARNs())\n\t\t\trequire.Equal(t, []string{test.inAWS.ExternalID}, stsMock.GetAssumedRoleExternalIDs())\n\t\t\tstsMock.ResetAssumeRoleHistory()\n\t\t})\n\t}\n}", "func (s3Driver *S3ArtifactDriver) newMinioClient() (*minio.Client, error) {\n\tvar minioClient *minio.Client\n\tvar err error\n\tif s3Driver.Region != \"\" {\n\t\tminioClient, err = minio.NewWithRegion(s3Driver.Endpoint, s3Driver.AccessKey, s3Driver.SecretKey, s3Driver.Secure, s3Driver.Region)\n\t} else {\n\t\tminioClient, err = minio.New(s3Driver.Endpoint, s3Driver.AccessKey, s3Driver.SecretKey, s3Driver.Secure)\n\t}\n\tif err != nil {\n\t\treturn nil, errors.InternalWrapError(err)\n\t}\n\treturn minioClient, nil\n}", "func NewMock() Client {\n\treturn &mockClient{}\n}", "func createTestEC2InstanceMock() *ec2.EC2 {\n\tconn := ec2.New(session.New(), nil)\n\tconn.Handlers.Clear()\n\n\tconn.Handlers.Send.PushBack(func(r *request.Request) {\n\t\tswitch p := r.Params.(type) {\n\t\tcase *ec2.DescribeImagesInput:\n\t\t\tout, err := testDescribeImages(p)\n\t\t\tif out != nil {\n\t\t\t\t*r.Data.(*ec2.DescribeImagesOutput) = *out\n\t\t\t}\n\t\t\tr.Error = err\n\t\tcase *ec2.DescribeInstancesInput:\n\t\t\tout, err := testDescribeInstances(p)\n\t\t\tif out != nil {\n\t\t\t\t*r.Data.(*ec2.DescribeInstancesOutput) = *out\n\t\t\t}\n\t\t\tr.Error = err\n\t\tcase *ec2.RunInstancesInput:\n\t\t\tout, err := testRunInstances(p)\n\t\t\tif out != nil {\n\t\t\t\t*r.Data.(*ec2.Reservation) = *out\n\t\t\t}\n\t\t\tr.Error = err\n\t\tcase *ec2.TerminateInstancesInput:\n\t\t\tout, err := testTerminateInstances(p)\n\t\t\tif out != nil {\n\t\t\t\t*r.Data.(*ec2.TerminateInstancesOutput) = *out\n\t\t\t}\n\t\t\tr.Error = err\n\t\tdefault:\n\t\t\tpanic(fmt.Errorf(\"Unsupported input type %T\", p))\n\t\t}\n\t})\n\treturn conn\n}", "func (m *MockQueryer) Client() *elastic.Client {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Client\")\n\tret0, _ := ret[0].(*elastic.Client)\n\treturn ret0\n}", "func (b *backend) clientEC2(ctx context.Context, s logical.Storage, region, accountID string) (*ec2.EC2, error) {\n\tstsRole, err := b.stsRoleForAccount(ctx, s, accountID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tb.configMutex.RLock()\n\tif b.EC2ClientsMap[region] != nil && b.EC2ClientsMap[region][stsRole] != nil {\n\t\tdefer b.configMutex.RUnlock()\n\t\t// If the client object was already created, return it\n\t\treturn b.EC2ClientsMap[region][stsRole], nil\n\t}\n\n\t// Release the read lock and acquire the write lock\n\tb.configMutex.RUnlock()\n\tb.configMutex.Lock()\n\tdefer b.configMutex.Unlock()\n\n\t// If the client gets created while switching the locks, return it\n\tif b.EC2ClientsMap[region] != nil && b.EC2ClientsMap[region][stsRole] != nil {\n\t\treturn b.EC2ClientsMap[region][stsRole], nil\n\t}\n\n\t// Create an AWS config object using a chain of providers\n\tvar awsConfig *aws.Config\n\tawsConfig, err = b.getClientConfig(ctx, s, region, stsRole, accountID, \"ec2\")\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif awsConfig == nil {\n\t\treturn nil, fmt.Errorf(\"could not retrieve valid assumed credentials\")\n\t}\n\n\t// Create a new EC2 client object, cache it and return the same\n\tclient := ec2.New(session.New(awsConfig))\n\tif client == nil {\n\t\treturn nil, fmt.Errorf(\"could not obtain ec2 client\")\n\t}\n\tif _, ok := b.EC2ClientsMap[region]; !ok {\n\t\tb.EC2ClientsMap[region] = map[string]*ec2.EC2{stsRole: client}\n\t} else {\n\t\tb.EC2ClientsMap[region][stsRole] = client\n\t}\n\n\treturn b.EC2ClientsMap[region][stsRole], nil\n}", "func MockGithubClient(responses []MockResponse) ClientWrapper {\n\treturn Client(NewTestClient(&MockRoundTripper{\n\t\tResponses: responses,\n\t}))\n}", "func ResourceServiceEndpointAws() *schema.Resource {\n\tr := genBaseServiceEndpointResource(flattenServiceEndpointAws, expandServiceEndpointAws)\n\tr.Schema[\"access_key_id\"] = &schema.Schema{\n\t\tType: schema.TypeString,\n\t\tRequired: true,\n\t\tDefaultFunc: schema.EnvDefaultFunc(\"AZDO_AWS_SERVICE_CONNECTION_ACCESS_KEY_ID\", nil),\n\t\tDescription: \"The AWS access key ID for signing programmatic requests.\",\n\t}\n\tr.Schema[\"secret_access_key\"] = &schema.Schema{\n\t\tType: schema.TypeString,\n\t\tRequired: true,\n\t\tDefaultFunc: schema.EnvDefaultFunc(\"AZDO_AWS_SERVICE_CONNECTION_SECRET_ACCESS_KEY\", nil),\n\t\tDescription: \"The AWS secret access key for signing programmatic requests.\",\n\t\tSensitive: true,\n\t\tDiffSuppressFunc: tfhelper.DiffFuncSuppressSecretChanged,\n\t}\n\tsaSecretHashKey, saSecretHashSchema := tfhelper.GenerateSecreteMemoSchema(\"secret_access_key\")\n\tr.Schema[saSecretHashKey] = saSecretHashSchema\n\tr.Schema[\"session_token\"] = &schema.Schema{\n\t\tType: schema.TypeString,\n\t\tOptional: true,\n\t\tDefaultFunc: schema.EnvDefaultFunc(\"AZDO_AWS_SERVICE_CONNECTION_SESSION_TOKEN\", nil),\n\t\tDescription: \"The AWS session token for signing programmatic requests.\",\n\t\tSensitive: true,\n\t\tDiffSuppressFunc: tfhelper.DiffFuncSuppressSecretChanged,\n\t}\n\tstSecretHashKey, stSecretHashSchema := tfhelper.GenerateSecreteMemoSchema(\"session_token\")\n\tr.Schema[stSecretHashKey] = stSecretHashSchema\n\tr.Schema[\"role_to_assume\"] = &schema.Schema{\n\t\tType: schema.TypeString,\n\t\tOptional: true,\n\t\tDefaultFunc: schema.EnvDefaultFunc(\"AZDO_AWS_SERVICE_CONNECTION_RTA\", nil),\n\t\tDescription: \"The Amazon Resource Name (ARN) of the role to assume.\",\n\t}\n\tr.Schema[\"role_session_name\"] = &schema.Schema{\n\t\tType: schema.TypeString,\n\t\tOptional: true,\n\t\tDefaultFunc: schema.EnvDefaultFunc(\"AZDO_AWS_SERVICE_CONNECTION_RSN\", nil),\n\t\tDescription: \"Optional identifier for the assumed role session.\",\n\t}\n\tr.Schema[\"external_id\"] = &schema.Schema{\n\t\tType: schema.TypeString,\n\t\tOptional: true,\n\t\tDefaultFunc: schema.EnvDefaultFunc(\"AZDO_AWS_SERVICE_CONNECTION_EXTERNAL_ID\", nil),\n\t\tDescription: \"A unique identifier that is used by third parties when assuming roles in their customers' accounts, aka cross-account role access.\",\n\t}\n\treturn r\n}", "func (b *backend) clientEC2(s logical.Storage, region string, stsRole string) (*ec2.EC2, error) {\n\tb.configMutex.RLock()\n\tif b.EC2ClientsMap[region] != nil && b.EC2ClientsMap[region][stsRole] != nil {\n\t\tdefer b.configMutex.RUnlock()\n\t\t// If the client object was already created, return it\n\t\treturn b.EC2ClientsMap[region][stsRole], nil\n\t}\n\n\t// Release the read lock and acquire the write lock\n\tb.configMutex.RUnlock()\n\tb.configMutex.Lock()\n\tdefer b.configMutex.Unlock()\n\n\t// If the client gets created while switching the locks, return it\n\tif b.EC2ClientsMap[region] != nil && b.EC2ClientsMap[region][stsRole] != nil {\n\t\treturn b.EC2ClientsMap[region][stsRole], nil\n\t}\n\n\t// Create an AWS config object using a chain of providers\n\tvar awsConfig *aws.Config\n\tvar err error\n\tawsConfig, err = b.getClientConfig(s, region, stsRole, \"ec2\")\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif awsConfig == nil {\n\t\treturn nil, fmt.Errorf(\"could not retrieve valid assumed credentials\")\n\t}\n\n\t// Create a new EC2 client object, cache it and return the same\n\tclient := ec2.New(session.New(awsConfig))\n\tif client == nil {\n\t\treturn nil, fmt.Errorf(\"could not obtain ec2 client\")\n\t}\n\tif _, ok := b.EC2ClientsMap[region]; !ok {\n\t\tb.EC2ClientsMap[region] = map[string]*ec2.EC2{stsRole: client}\n\t} else {\n\t\tb.EC2ClientsMap[region][stsRole] = client\n\t}\n\n\treturn b.EC2ClientsMap[region][stsRole], nil\n}", "func (m *MockManagedClusterScoper) ClientSecret() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ClientSecret\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}", "func NewAWSClient(configPath string) (*s3.Client, error) {\n\tmyCfg := readConfig(configPath)\n\tos.Setenv(\"AWS_ACCESS_KEY_ID\", myCfg.AccessKey)\n\tos.Setenv(\"AWS_SECRET_ACCESS_KEY\", myCfg.SecretKey)\n\tcfg, err := config.LoadDefaultConfig(context.TODO(), config.WithRegion(myCfg.Regin))\n\tif err != nil {\n\t\tpanic(\"configuration error, \" + err.Error())\n\t}\n\tclient := s3.NewFromConfig(cfg)\n\treturn client, nil\n}", "func (m Mock) client() *http.Client {\n\tif m._client == nil {\n\t\tm._client = http.DefaultClient\n\t}\n\n\treturn m._client\n}", "func NewClient(endpoint string) (*gophercloud.ProviderClient, error) {\n\tif endpoint == \"\" {\n\t\treturn os.NewClient(RackspaceUSIdentity)\n\t}\n\treturn os.NewClient(endpoint)\n}", "func (_m *IRsaClientDeps) NewSsmSdk(p client.ConfigProvider, cfgs ...*aws.Config) *ssm.SSM {\n\t_va := make([]interface{}, len(cfgs))\n\tfor _i := range cfgs {\n\t\t_va[_i] = cfgs[_i]\n\t}\n\tvar _ca []interface{}\n\t_ca = append(_ca, p)\n\t_ca = append(_ca, _va...)\n\tret := _m.Called(_ca...)\n\n\tvar r0 *ssm.SSM\n\tif rf, ok := ret.Get(0).(func(client.ConfigProvider, ...*aws.Config) *ssm.SSM); ok {\n\t\tr0 = rf(p, cfgs...)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*ssm.SSM)\n\t\t}\n\t}\n\n\treturn r0\n}", "func (m *MockClusterScoper) ClientSecret() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ClientSecret\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}", "func NewClient(baseARN string, regional bool) *Client {\n\treturn &Client{\n\t\tBaseARN: baseARN,\n\t\tEndpoint: \"sts.amazonaws.com\",\n\t\tUseRegionalEndpoint: regional,\n\t}\n}", "func (m *MockManager) SetECSClient(arg0 api.ECSClient, arg1 string) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"SetECSClient\", arg0, arg1)\n}", "func NewIamClient(t *testing.T, region string) *iam.IAM {\n\tclient, err := NewIamClientE(t, region)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\treturn client\n}", "func TestGetObject(t *testing.T) {\n\tmock := mockS3Impl{\n\t\tInMemoryStore: make(map[string]string),\n\t}\n\n\tmock.InMemoryStore[\"foo\"] = \"bar\"\n\n\tmyservice := mockS3.Myservice{\n\t\tS3Client: mock,\n\t}\n\n\tstr, err := myservice.GetObjectAsString(\"foo\")\n\tif err != nil {\n\t\tt.Fail()\n\t}\n\n\tif str != \"bar\" {\n\t\tt.Fail()\n\t}\n}", "func NewMockEDVClient(edvServerURL string, readDocumentFirstReturnValue,\n\treadDocumentSubsequentReturnValue *models.EncryptedDocument, queryVaultReturnValue []string) *Client {\n\treturn &Client{edvServerURL: edvServerURL, ReadDocumentSubsequentReturnValue: readDocumentSubsequentReturnValue,\n\t\tReadDocumentFirstReturnValue: readDocumentFirstReturnValue,\n\t\tQueryVaultReturnValue: queryVaultReturnValue}\n}", "func NewMockImageClient(ctrl *gomock.Controller) *MockImageClient {\n\tmock := &MockImageClient{ctrl: ctrl}\n\tmock.recorder = &MockImageClientMockRecorder{mock}\n\treturn mock\n}", "func NewTestClientNew() *Client {\n\tif testClient == nil {\n\t\ttestClient = NewClientNew(TestAccessKeyId, TestAccessKeySecret)\n\t}\n\treturn testClient\n}", "func NewMockSsmClient(ctrl *gomock.Controller) *MockSsmClient {\n\tmock := &MockSsmClient{ctrl: ctrl}\n\tmock.recorder = &MockSsmClientMockRecorder{mock}\n\treturn mock\n}", "func NewS3Client(region string) (*S3Client, error) {\n\tsess, err := session.NewSessionWithOptions(session.Options{\n\t\tConfig: aws.Config{Region: aws.String(region)},\n\t\tSharedConfigState: session.SharedConfigEnable,\n\t})\n\n\tif err != nil {\n\t\treturn &S3Client{}, fmt.Errorf(\"Failed to initiate an S3Client. Error: %+v\", err)\n\t}\n\n\treturn &S3Client{\n\t\ts3Manager: s3.New(sess),\n\t}, nil\n}", "func newMockClient(doer func(*http.Request) (*http.Response, error)) *http.Client {\n\treturn &http.Client{\n\t\tTransport: transportFunc(doer),\n\t}\n}", "func (m *MockManagedClusterScope) ClientSecret() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ClientSecret\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}", "func NewClient(opts *cli.Options) (*servicebus.Namespace, error) {\n\tc, err := servicebus.NewNamespace(servicebus.NamespaceWithConnectionString(opts.Azure.ConnectionString))\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to create new azure service bus client\")\n\t}\n\treturn c, nil\n}", "func (m *MockProviderKubectlClient) GetEksaAWSDatacenterConfig(arg0 context.Context, arg1, arg2, arg3 string) (*v1alpha1.AWSDatacenterConfig, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetEksaAWSDatacenterConfig\", arg0, arg1, arg2, arg3)\n\tret0, _ := ret[0].(*v1alpha1.AWSDatacenterConfig)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func New(awsConfig *aws.Config) *Client {\n\tctx := aws.BackgroundContext()\n\tsess := session.Must(session.NewSession(awsConfig))\n\tiam := iam.New(sess)\n\troute53 := route53.New(sess)\n\tec2 := ec2.New(sess)\n\treturn &Client{\n\t\tIAM: iam,\n\t\tRoute53: route53,\n\t\tEC2: ec2,\n\t\tContext: ctx,\n\t}\n}", "func clientForTest() *Client {\n\tc, err := NewClient()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\touts, active, err := c.Outputs()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tif active < 0 {\n\t\tfor _, out := range outs {\n\t\t\tif !out.Available {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\terr = out.Activate()\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n\terr = c.SetVolume(0.5)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn c\n}", "func NewClient(httpClient *http.Client) *Client {\n\tif httpClient == nil {\n\t\thttpClient = http.DefaultClient\n\t}\n\tc := &Client{client: httpClient}\n\tc.common.client = c\n\tc.Search = (*SearchService)(&c.common)\n\tc.PlaceSuggest = (*PlaceSuggestService)(&c.common)\n\tc.SpaceDetail = (*SpaceDetailService)(&c.common)\n\tc.Reviews = (*ReviewsService)(&c.common)\n\n\treturn c\n}", "func newAWSKMSClient(sess client.ConfigProvider, region, arn string) AWSKMSClient {\n\treturn AWSKMSClient{\n\t\tKMS: clientFactory(sess, aws.NewConfig().WithRegion(region)),\n\t\tRegion: region,\n\t\tARN: arn,\n\t}\n}", "func NewClient(httpClient *http.Client) *Client {\n\tif httpClient == nil {\n\t\thttpClient = &http.Client{}\n\t}\n\tbaseURL, _ := url.Parse(defaultBaseURL)\n\n\tc := &Client{client: httpClient, BaseURL: baseURL, UserAgent: userAgent}\n\tc.common.client = c\n\tc.Datasets = (*DatasetsService)(&c.common)\n\tc.Streams = (*StreamsService)(&c.common)\n\tc.Users = (*UsersService)(&c.common)\n\tc.Groups = (*GroupsService)(&c.common)\n\tc.Pages = (*PagesService)(&c.common)\n\tc.Logs = (*ActivityLogsService)(&c.common)\n\tc.Accounts = (*AccountsService)(&c.common)\n\n\treturn c\n}", "func (asg *Autoscaling) NewClient() (*Client, error) {\n\tvar svc Client\n\n\tsess, err := newSession(asg.Region)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Cannot open a new AWS session: %v\", err)\n\t}\n\n\tsvc.AutoScaling = autoscaling.New(sess)\n\n\treturn &svc, nil\n}", "func NewTestHandlerOptsAndClient(\n\tt *testing.T,\n) (\n\tplacementhandler.HandlerOptions,\n\t*kv.MockStore,\n\t*clusterclient.MockClient,\n) {\n\tctrl := gomock.NewController(t)\n\n\tplacementProto := &placementpb.Placement{\n\t\tInstances: map[string]*placementpb.Instance{\n\t\t\t\"host1\": {\n\t\t\t\tId: \"host1\",\n\t\t\t\tIsolationGroup: \"rack1\",\n\t\t\t\tZone: \"test\",\n\t\t\t\tWeight: 1,\n\t\t\t\tEndpoint: \"http://host1:1234\",\n\t\t\t\tHostname: \"host1\",\n\t\t\t\tPort: 1234,\n\t\t\t},\n\t\t\t\"host2\": {\n\t\t\t\tId: \"host2\",\n\t\t\t\tIsolationGroup: \"rack1\",\n\t\t\t\tZone: \"test\",\n\t\t\t\tWeight: 1,\n\t\t\t\tEndpoint: \"http://host2:1234\",\n\t\t\t\tHostname: \"host2\",\n\t\t\t\tPort: 1234,\n\t\t\t},\n\t\t},\n\t}\n\n\tmockPlacement := clusterplacement.NewMockPlacement(ctrl)\n\tmockPlacement.EXPECT().Proto().Return(placementProto, nil).AnyTimes()\n\tmockPlacement.EXPECT().Version().Return(0).AnyTimes()\n\n\treturn NewTestHandlerOptsAndClientWithPlacement(t, ctrl, mockPlacement)\n}", "func newInputService4ProtocolTestClient(cfg aws.Config, handlers request.Handlers, partitionID, endpoint, signingRegion, signingName, resolvedRegion string) *InputService4ProtocolTest {\n\tsvc := &InputService4ProtocolTest{\n\t\tClient: client.New(\n\t\t\tcfg,\n\t\t\tmetadata.ClientInfo{\n\t\t\t\tServiceName: \"InputService4ProtocolTest\",\n\t\t\t\tServiceID: \"InputService4ProtocolTest\",\n\t\t\t\tSigningName: signingName,\n\t\t\t\tSigningRegion: signingRegion,\n\t\t\t\tPartitionID: partitionID,\n\t\t\t\tEndpoint: endpoint,\n\t\t\t\tAPIVersion: \"\",\n\t\t\t\tResolvedRegion: resolvedRegion,\n\t\t\t\tJSONVersion: \"1.1\",\n\t\t\t\tTargetPrefix: \"com.amazonaws.foo\",\n\t\t\t},\n\t\t\thandlers,\n\t\t),\n\t}\n\n\t// Handlers\n\tsvc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)\n\tsvc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)\n\tsvc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)\n\tsvc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)\n\tsvc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)\n\n\treturn svc\n}", "func newClient(auth azure.Authorizer) *azureClient {\n\tc := newPrivateZonesClient(auth.SubscriptionID(), auth.BaseURI(), auth.Authorizer())\n\tv := newVirtualNetworkLinksClient(auth.SubscriptionID(), auth.BaseURI(), auth.Authorizer())\n\tr := newRecordSetsClient(auth.SubscriptionID(), auth.BaseURI(), auth.Authorizer())\n\treturn &azureClient{c, v, r}\n}", "func bindTestClient(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(TestClientABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor), nil\n}", "func NewMockClient() MockClient {\n\tvar ret = MockClient{}\n\tret.Data = make(map[string][]http.Response)\n\treturn ret\n}", "func NewTestClient(t *testing.T) *Client {\n\tconf := &Config{\n\t\tUsername: \"user\",\n\t\tPassword: \"pass\",\n\t}\n\n\tcl, err := NewClient(\"service\", \"hostname\", conf)\n\tif err != nil {\n\t\tt.Fatalf(\"could not create client\\n%v\", err)\n\t}\n\n\treturn cl\n}", "func mockClientFactoryGenerator(setupFn ...func(c istioclient.Interface)) func() (istioclient.Interface, error) {\n\toutFactory := func() (istioclient.Interface, error) {\n\t\tc := kube.NewFakeClient().Istio()\n\t\tfor _, f := range setupFn {\n\t\t\tf(c)\n\t\t}\n\t\treturn c, nil\n\t}\n\n\treturn outFactory\n}", "func newClient(httpClient *http.Client) (c *Client) {\n\tc = &Client{httpClient: httpClient}\n\tc.service.client = c\n\tc.Auth = (*AuthService)(&c.service)\n\tc.Providers = (*ProvidersService)(&c.service)\n\tc.Projects = (*ProjectsService)(&c.service)\n\tc.Releases = (*ReleasesService)(&c.service)\n\tc.SlackChannels = (*SlackChannelsService)(&c.service)\n\tc.TelegramChats = (*TelegramChatsService)(&c.service)\n\tc.DiscordChannels = (*DiscordChannelsService)(&c.service)\n\tc.HangoutsChatWebhooks = (*HangoutsChatWebhooksService)(&c.service)\n\tc.MicrosoftTeamsWebhooks = (*MicrosoftTeamsWebhooksService)(&c.service)\n\tc.MattermostWebhooks = (*MattermostWebhooksService)(&c.service)\n\tc.RocketchatWebhooks = (*RocketchatWebhooksService)(&c.service)\n\tc.MatrixRooms = (*MatrixRoomsService)(&c.service)\n\tc.Webhooks = (*WebhooksService)(&c.service)\n\tc.Tags = (*TagsService)(&c.service)\n\treturn c\n}", "func newInputService3ProtocolTestClient(cfg aws.Config, handlers request.Handlers, partitionID, endpoint, signingRegion, signingName, resolvedRegion string) *InputService3ProtocolTest {\n\tsvc := &InputService3ProtocolTest{\n\t\tClient: client.New(\n\t\t\tcfg,\n\t\t\tmetadata.ClientInfo{\n\t\t\t\tServiceName: \"InputService3ProtocolTest\",\n\t\t\t\tServiceID: \"InputService3ProtocolTest\",\n\t\t\t\tSigningName: signingName,\n\t\t\t\tSigningRegion: signingRegion,\n\t\t\t\tPartitionID: partitionID,\n\t\t\t\tEndpoint: endpoint,\n\t\t\t\tAPIVersion: \"\",\n\t\t\t\tResolvedRegion: resolvedRegion,\n\t\t\t\tJSONVersion: \"1.1\",\n\t\t\t\tTargetPrefix: \"com.amazonaws.foo\",\n\t\t\t},\n\t\t\thandlers,\n\t\t),\n\t}\n\n\t// Handlers\n\tsvc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)\n\tsvc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)\n\tsvc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)\n\tsvc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)\n\tsvc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)\n\n\treturn svc\n}", "func Ec2Client(region string) *ec2.EC2 {\n\treturn ec2.New(session.New(), aws.NewConfig().WithRegion(region))\n}" ]
[ "0.7048978", "0.69335866", "0.6909078", "0.64017856", "0.6223387", "0.599097", "0.5983542", "0.5983542", "0.59282684", "0.5838514", "0.58328265", "0.5807848", "0.57984537", "0.5796397", "0.5769719", "0.5767413", "0.5696134", "0.5691321", "0.5682976", "0.5660174", "0.55832285", "0.5542308", "0.55326605", "0.55288416", "0.5494661", "0.5490182", "0.5472231", "0.5472231", "0.5452528", "0.54479015", "0.5439139", "0.5438804", "0.54279035", "0.54227966", "0.54153156", "0.5410779", "0.5391", "0.5346569", "0.5319216", "0.53123295", "0.53045046", "0.53008014", "0.52889925", "0.5287409", "0.52735007", "0.5259861", "0.52133936", "0.5175973", "0.516957", "0.5153394", "0.5136832", "0.5132004", "0.51081854", "0.5107317", "0.51054823", "0.5104774", "0.50993156", "0.508696", "0.5078595", "0.5073132", "0.5070707", "0.5067012", "0.50664705", "0.50630784", "0.50627196", "0.50542283", "0.50497293", "0.50431794", "0.50242", "0.5014466", "0.50025076", "0.49982917", "0.49910027", "0.49896437", "0.49833784", "0.4983216", "0.49823102", "0.4974363", "0.49701312", "0.49632475", "0.4957407", "0.49538928", "0.49527943", "0.4951782", "0.49506813", "0.49493685", "0.4945805", "0.4942622", "0.49416977", "0.4940343", "0.4933536", "0.49296165", "0.4927103", "0.4926307", "0.49209434", "0.49175128", "0.49040088", "0.49027047", "0.4902035", "0.48982635" ]
0.85333425
0
FirstFileByHash gets a file in db from its hash
func FirstFileByHash(fileHash string) (File, error) { var file File q := Db().Unscoped().First(&file, "file_hash = ?", fileHash) return file, q.Error }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func getFileHash(filename string) ([]byte, error) {\n\thasher := sha1.New()\n\tf, err := os.Open(filename)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Opening %e for hashing: %q\",\n\t\t\tfilename, err)\n\t}\n\tdefer f.Close()\n\n\t_, err = io.Copy(hasher, f)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Reading %e for hashing: %q\",\n\t\t\tfilename, err)\n\t}\n\treturn hasher.Sum(nil), nil\n}", "func OpenFileByHash(Hash string) {\n\n\tfileInfo, err := dbGetFile(Hash)\n\tif err != nil {\n\t\tpushError(\"Error on open file\", err.Error())\n\t\treturn\n\t}\n\tOpenOSPath(fileInfo.Path)\n}", "func (sl *SearchList) GetByHash(hash []byte) *FileMetaData {\n\tsl.mutex.Lock()\n\tfor _, sd := range sl.searchData {\n\t\tfor _, fmd := range sd.MetaDataList {\n\t\t\tif bytes.Equal(fmd.HashValue, hash) {\n\t\t\t\tsl.mutex.Unlock()\n\t\t\t\treturn &fmd\n\t\t\t}\n\t\t}\n\t}\n\tsl.mutex.Unlock()\n\treturn nil\n}", "func (q *BlobQuery) First(ctx context.Context) (*Blob, error) {\n\treturn q.driver.queryFirst(ctx, q)\n}", "func FindChunkByHash(h string, db *gorm.DB) (*Chunk, error) {\n\tvar chunk Chunk\n\treturn &chunk, db.Where(\"hash = ?\", h).First(&chunk).Error\n}", "func (r *Repository) fileOpenAtHash(filePath string, hash plumbing.Hash) (io.ReadCloser, int64, error) {\n\t// Check if Repository is nil to avoid a panic if this function is called\n\t// before repo has been cloned\n\tif r.Repository == nil {\n\t\treturn nil, 0, errors.New(\"Repository is nil\")\n\t}\n\n\tcommit, err := r.CommitObject(hash)\n\tif err != nil {\n\t\treturn nil, 0, fmt.Errorf(\"Commit object of %v: %s\", hash, err)\n\t}\n\n\ttree, err := commit.Tree()\n\tif err != nil {\n\t\treturn nil, 0, fmt.Errorf(\"Tree of commit %v: %s\", commit.TreeHash, err)\n\t}\n\n\t// If filePath has a leading slash remove it as tree entries don't have a leading slash.\n\tif path.IsAbs(filePath) {\n\t\tfilePath = filePath[1:]\n\t}\n\n\tentry, err := tree.FindEntry(filePath)\n\tif err != nil {\n\t\treturn nil, 0, fmt.Errorf(\"Path in tree %s: %s\", filePath, err)\n\t}\n\n\tobject, err := r.BlobObject(entry.Hash)\n\tif err != nil {\n\t\treturn nil, 0, fmt.Errorf(\"Blob object of %v: %s\", entry.Hash, err)\n\t}\n\n\treader, err := object.Reader()\n\n\treturn reader, object.Size, err\n}", "func GetBlockByHash(hash []byte, file *os.File, db *sql.DB) ([]byte, error) {\n\tfile.Seek(0, io.SeekStart) // reset seek pointer\n\n\tvar blockPos int\n\tvar blockSize int\n\t// need the position, size and hash of the block from databse\n\trows, err := db.Query(sqlstatements.GET_POSITION_SIZE_HASH_FROM_METADATA)\n\tif err != nil {\n\t\treturn nil, errors.New(\"Failed to create rows to iterate to find position and size of wanted block\")\n\t}\n\tvar pos int\n\tvar size int\n\tvar bHash string\n\tfor rows.Next() {\n\t\trows.Scan(&pos, &size, &bHash)\n\t\tif bHash == string(hash) {\n\t\t\t// save the wanted block size and position\n\t\t\tblockPos = pos\n\t\t\tblockSize = size\n\t\t}\n\t}\n\n\t// goes to the positition of the block given through param\n\t_, err = file.Seek(int64(blockPos)+4, 0)\n\tif err != nil {\n\t\treturn nil, errors.New(\"Failed to seek up to given blocks position in file\")\n\t}\n\n\t// store the bytes from the file reading from the seeked position to the size of the block\n\tbl := make([]byte, blockSize)\n\t_, err = io.ReadAtLeast(file, bl, blockSize)\n\tif err != nil {\n\t\treturn nil, errors.New(\"Unable to read file data from the blocks start to it's end\")\n\t}\n\n\treturn bl, nil\n}", "func getHash(path Path) (result string, err os.Error) {\n\t// make a new hash calculator\n\thash := sha1.New()\n\t\n\t// if we can open the file...\n\tif file, err := os.Open(string(path), os.O_RDONLY, 0); err == nil {\n\t\t// and if we can copy its contents to the hash\n\t\tif _, err := io.Copy(hash, file); err == nil {\n\t\t\t// then we have a result\n\t\t\tresult = encodeBase64(hash.Sum())\n\t\t}\n\t}\n\t// return, whether we have nil for result or error\n\treturn\n}", "func hash_file_sha1(f File_s) (string, error) {\n\t//Initialize variable returnMD5String now in case an error has to be returned\n\tvar returnSHA1String string\n\n\t//Open the filepath passed by the argument and check for any error\n\tfile, err := os.Open(f.path)\n\tif err != nil {\n\t\treturn returnSHA1String, err\n\t}\n\t// Read first 20 bytes.\n\tb1 := make([]byte, 20)\n\tfile.Read(b1)\n\tss := f.Name + string(f.Size) + string(b1)\n\t//Tell the program to call the following function when the current function returns\n\tdefer file.Close()\n\n\t//Open a new SHA1 hash interface to write to\n\thash := sha1.New()\n\n\thash.Write([]byte(ss))\n\t//Get the 20 bytes hash\n\thashInBytes := hash.Sum(nil)[:20]\n\n\t//Convert the bytes to a string\n\treturnSHA1String = hex.EncodeToString(hashInBytes)\n\n\treturn returnSHA1String, nil\n\n}", "func (s *Drive) GetFile(sha256sum []byte) ([]byte, error) {\n\treturn nil, nil\n}", "func SimilarFiles(sha256 string, userId int, limit int) (result []File) {\n\tvar imgInDb File\n\tDB.Where(\"sha256 = ?\", sha256).First(&imgInDb)\n\n\t// file with hash not found\n\tif imgInDb.Id < 1 {\n\t\tlog.Printf(\"file with hash %v not found\", sha256)\n\t\treturn\n\t}\n\n\tquery1 := `\nSELECT HAMMINGDISTANCE(?,?,?,?,files.phash_a,files.phash_b,files.phash_c,files.phash_d) AS dist,\n files.id,\n sha256,\n file_name,\n file_path,\n size_b,\n mimes.mime\nFROM files\nINNER JOIN mimes ON files.mime_id = mimes.id\nINNER JOIN file_users ON files.id = file_users.file_id\nWHERE sha256 != ?\nAND file_users.user_id = ?\nAND files.phash_a != 0\nAND files.phash_b != 0\nAND files.phash_c != 0\nAND files.phash_d != 0\nORDER BY dist ASC\nLIMIT ?\n`\n\n\tstmt1, err := DB.DB().Prepare(query1)\n\tif err != nil {\n\t\tlog.Printf(\"%v\", err)\n\t\treturn\n\t}\n\tdefer stmt1.Close()\n\trows1, err := stmt1.Query(imgInDb.PhashA, imgInDb.PhashB, imgInDb.PhashC, imgInDb.PhashD, imgInDb.Sha256, userId, limit)\n\tif err != nil {\n\t\tlog.Printf(\"%v\", err)\n\t\treturn\n\t}\n\tdefer rows1.Close()\n\tfor rows1.Next() {\n\t\tvar list File\n\t\terr := rows1.Scan(&list.Distance, &list.Id, &list.Sha256, &list.Filename, &list.FilePath, &list.SizeB, &list.Mime)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"sql scan error: %v\", err)\n\t\t\treturn\n\t\t}\n\t\tresult = append(result, list)\n\t}\n\n\treturn result\n}", "func GetFileHash(file *os.File, t string) ([]byte, error) {\n\t_, err := file.Seek(0, 0)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tswitch t {\n\tcase \"md5\":\n\t\th := md5.New()\n\t\t_, err = io.Copy(h, file)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn h.Sum(nil), nil\n\tcase \"sha1\":\n\t\th := sha1.New()\n\t\t_, err = io.Copy(h, file)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn h.Sum(nil), nil\n\tcase \"sha256\":\n\t\th := sha256.New()\n\t\t_, err = io.Copy(h, file)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn h.Sum(nil), nil\n\tdefault:\n\t\th := crc32.NewIEEE()\n\t\t_, err = io.Copy(h, file)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn h.Sum(nil), nil\n\t}\n}", "func (g Index) GetSha1(path IndexPath) Sha1 {\n\tfor _, entry := range g.Objects {\n\t\tif entry.PathName == path {\n\t\t\treturn entry.Sha1\n\t\t}\n\t}\n\treturn Sha1{}\n}", "func (upload *Upload) GetFileByReference(ref string) (file *File) {\n\tfor _, file := range upload.Files {\n\t\tif file.Reference == ref {\n\t\t\treturn file\n\t\t}\n\t}\n\n\treturn nil\n}", "func (s *Store) scanFirstDocumentationFilePath(rows *sql.Rows, queryErr error) (_ *string, err error) {\n\tif queryErr != nil {\n\t\treturn nil, queryErr\n\t}\n\tdefer func() { err = basestore.CloseRows(rows, err) }()\n\n\tif !rows.Next() {\n\t\treturn nil, nil\n\t}\n\n\tvar filePath *string\n\tif err := rows.Scan(&filePath); err != nil {\n\t\treturn nil, err\n\t}\n\treturn filePath, nil\n}", "func (ds *dedupedStorage) getPrimaryContent(hash zerodisk.Hash) (content []byte, err error) {\n\tcmd := ardb.Command(command.Get, hash.Bytes())\n\treturn ardb.OptBytes(ds.cluster.DoFor(int64(hash[0]), cmd))\n}", "func (src *HybridAnalysis) FindFile(sample *Sample) {\n\t// default not found\n\tsrc.CanDownload = false\n\tsrc.HasFile = false\n\n\tif sample.SHA256 == \"\" {\n\t\tlog.Printf(\"Hash type is unsupported, Hybrid Analysis requires SHA256\")\n\t\treturn\n\t}\n\n\tclient := &http.Client{}\n\treq, err := http.NewRequest(\"GET\", fmt.Sprintf(\"https://www.hybrid-analysis.com/api/v2/overview/%s\", sample.SHA256), nil)\n\treq.Header.Add(\"api-key\", config[\"HA_API_KEY\"].(string))\n\treq.Header.Add(\"User-Agent\", \"Falcon\") // suggested by the API docs to avoid UA blacklists\n\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tlog.Println(\"Error when contacting HA: \" + err.Error())\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode == 404 {\n\t\t// file wasn't found on HA\n\t\tsrc.HasFile = false\n\t\treturn\n\t}\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tlog.Println(\"Failed to get bytes from HA response: \" + err.Error())\n\t\treturn\n\t}\n\n\tvar jsonDataRaw interface{}\n\terr = json.Unmarshal(body, &jsonDataRaw)\n\tif err != nil {\n\t\tlog.Println(\"Error parsing JSON data from HA: \" + err.Error())\n\t}\n\tvar jsonData map[string]interface{} = jsonDataRaw.(map[string]interface{})\n\n\t// if the top-level key 'sha256' == our hash, file exists\n\t// if the top-level key 'message' == 'Not Found', file doesn't exist\n\t// not found already handled by 404 above\n\n\tif val := jsonData[\"sha256\"]; val.(string) == sample.SHA256 {\n\t\tsrc.HasFile = true\n\t\tsrc.CanDownload = true\n\t\tsrc.URL = fmt.Sprintf(\"https://www.hybrid-analysis.com/sample/%s\", sample.SHA256)\n\t} else {\n\t\tlog.Printf(\"Got an unknown response from HA\")\n\t}\n}", "func hashFile(h hash.Hash, filename string) ([]byte, error) {\n\tf, err := os.Open(filename)\n\tif err != nil {\n\t\treturn nil, errs.FileError(err, filename)\n\t}\n\n\tif _, err := io.Copy(h, f); err != nil {\n\t\treturn nil, errs.FileError(err, filename)\n\t}\n\n\treturn h.Sum(nil), nil\n}", "func (u *uploader) getFileByName(name string, dirID int64) *File {\n\tf, err := u.db.FindFile(name, dirID)\n\tswitch {\n\tcase err == app.ErrNotFound:\n\t\treturn nil\n\tcase err != nil:\n\t\tapp.Log.Panicf(\"Local database returned err, panic!: %s\", err)\n\t\treturn nil\n\tdefault:\n\t\treturn f\n\t}\n}", "func HashFileSha1(hs string) []byte {\n\tfile, err := os.Open(hs)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tdefer func() {\n\t\terr := file.Close()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}()\n\n\tdata := sha1.New()\n\tif _, err := io.Copy(data, file); err != nil {\n\t\tpanic(err)\n\t}\n\n\thash := data.Sum(nil)\n\treturn hash[:]\n}", "func (this *SysEmojiFileLogic)GetSysFileListFirst(emoji entity.EmojiFile)map[string]interface{} {\n\tresult,err := this.Orm.Table(\"sys_emoji_file\").Where(map[string]interface{}{\n\t\t\"md5_encode\" : emoji.Md5Encode,\n\t\t\"extension\" : \".mp4\",\n\t}).Fields(\"path,base_path,extension,name\").First()\n\tunity.ErrorCheck(err)\n\treturn result\n}", "func (br *BlockRepository) FindByHash(hash string) (*types.Block, *rTypes.Error) {\n\trf, err := br.findRecordFileByHash(hash)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn br.constructBlockResponse(rf, rf.BlockIndex), nil\n}", "func createfilehash(path string) (string, error) {\n f, err := os.Open(path)\n defer f.Close()\n if err != nil {\n return \"\", err\n } \n hash, err := ssdeep.HashFilename(path) //confusing function title, not mine!\n if err != nil {\n return \"\", nil\n }\n return hash, nil\n}", "func getBlob(tx *sql.Tx, digest string) (*Blob, error) {\n\tvar b *Blob\n\trows, err := tx.Query(\"SELECT * from blobinfo WHERE digest == $1\", digest)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor rows.Next() {\n\t\tb = &Blob{}\n\t\tif err := blobRowScan(rows, b); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t// No more than one row for digest must exist.\n\t\tbreak\n\t}\n\tif err := rows.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn b, err\n}", "func (m *dbManager) RetrieveBlockPathByHash(hash []byte) (string, error) {\n\tvar metadataJSON []byte\n\tvar metadata BlockMetadata\n\tm.db.View(func(tx *bolt.Tx) error {\n\t\tblockBucket := tx.Bucket([]byte(blockBucketName))\n\t\tmetadataJSON = blockBucket.Get(hash)\n\t\treturn nil\n\t})\n\n\terr := json.Unmarshal(metadataJSON, &metadata)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tpath := metadata.Path\n\treturn path, nil\n}", "func (d *DiskStore) Get(hash string) (stream.Blob, shared.BlobTrace, error) {\n\tstart := time.Now()\n\terr := d.initOnce()\n\tif err != nil {\n\t\treturn nil, shared.NewBlobTrace(time.Since(start), d.Name()), err\n\t}\n\n\tblob, err := os.ReadFile(d.path(hash))\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn nil, shared.NewBlobTrace(time.Since(start), d.Name()), errors.Err(ErrBlobNotFound)\n\t\t}\n\t\treturn nil, shared.NewBlobTrace(time.Since(start), d.Name()), errors.Err(err)\n\t}\n\treturn blob, shared.NewBlobTrace(time.Since(start), d.Name()), nil\n}", "func (s *store) RetrieveRequestByHash(hash string) (*http.Request, error) {\n\tdebugf(\"Got into store.RetrieveRequestByHash with hash key => \", hash)\n\treturn s.RetrieveRequestByFileName(requestPrefix + formatPrefix + hash)\n}", "func getHash(path string) string {\n myfile, err := os.Open(path)\n if err != nil {\n log.Fatal(\"ERROR: problem opening path:\", err)\n }\n defer myfile.Close()\n \n hasher := sha256.New()\n\n if _, err := io.Copy(hasher, myfile); err != nil {\n log.Fatal(\"ERROR: problem copying file into hasher:\", err)\n }\n \n return hex.EncodeToString(hasher.Sum(nil))\n}", "func (c *Client) First(filename string, rra int) (time.Time, error) {\n\treturn c.parseTime(c.ExecCmd(NewCmd(\"first\").WithArgs(filename, rra)))\n}", "func (i *DataIndex) getBlob(hash string, fpath string) error {\n\n\t// disallow empty paths\n\tif len(fpath) == 0 {\n\t\treturn fmt.Errorf(\"get blob %.7s - error: no path supplied\", hash)\n\t}\n\n\tfpath = path.Clean(fpath)\n\n\tpErr(\"get blob %.7s %s\\n\", hash, fpath)\n\tw, err := createFile(fpath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer w.Close()\n\n\treturn i.copyBlob(hash, w)\n}", "func (q filesStorageQuery) One(exec boil.Executor) (*FilesStorage, error) {\n\to := &FilesStorage{}\n\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Bind(nil, exec, o)\n\tif err != nil {\n\t\tif errors.Cause(err) == sql.ErrNoRows {\n\t\t\treturn nil, sql.ErrNoRows\n\t\t}\n\t\treturn nil, errors.Wrap(err, \"models: failed to execute a one query for files_storages\")\n\t}\n\n\tif err := o.doAfterSelectHooks(exec); err != nil {\n\t\treturn o, err\n\t}\n\n\treturn o, nil\n}", "func (db *Database) preimage(hash common.Hash) ([]byte, error) {\n\t// Retrieve the node from cache if available\n\tdb.lock.RLock()\n\tpreimage := db.preimages[hash]\n\tdb.lock.RUnlock()\n\n\tif preimage != nil {\n\t\treturn preimage, nil\n\t}\n\t// Content unavailable in memory, attempt to retrieve from disk\n\treturn db.diskdb.Get(db.secureKey(hash[:]))\n}", "func Get(sha1 string)FileMeta{\n\treturn fileMetas[sha1]\n}", "func (f *FileService) GetFileHash(ctx context.Context, header *multipart.FileHeader) (string, error) {\n\thash, err := hashFile(f.HashKey, header)\n\tif err != nil {\n\t\treturn \"\", api.Errorf(api.EINTERNAL, \"Could not hash file\")\n\t}\n\treturn hash, nil\n}", "func FirstExistingFile(list []string) string {\n\tvar saved string\n\tfor i := range list {\n\t\tsaved = list[i]\n\t\t_, err := os.Stat(list[i])\n\t\tif os.IsNotExist(err) {\n\t\t\tcontinue\n\t\t}\n\t\tbreak\n\t}\n\treturn saved\n}", "func (w *WorkFileWriter) FirstStartFile(filepath string) string {\n\treturn w.getStartFileName(filepath, 0)\n}", "func (g *GitLocal) GetFirstCommitSha(dir string) (string, error) {\n\treturn g.GitCLI.GetFirstCommitSha(dir)\n}", "func (fh *FilesystemHandler) GetSpecificSimpleBlob(URL string) (*models.SimpleBlob, error) {\n\treturn nil, nil\n\n}", "func (m *RecManager) FindByFilenameShort(records []*RecShort, filename string) *RecShort {\n\tfor _, rec := range records {\n\t\tif rec.Filename == filename {\n\t\t\treturn rec\n\t\t}\n\t}\n\treturn nil\n}", "func (src *URLhaus) FindFile(sample *Sample) {\n\t// default not found\n\tsrc.CanDownload = false\n\tsrc.HasFile = false\n\n\t// make request\n\t// urlhaus supports md5 or sha256\n\tkey := \"\"\n\thash := \"\"\n\tif sample.MD5 != \"\" {\n\t\tkey = \"md5_hash\"\n\t\thash = sample.MD5\n\t} else if sample.SHA256 != \"\" {\n\t\tkey = \"sha256_hash\"\n\t\thash = sample.SHA256\n\t} else {\n\t\tlog.Println(\"Hash type is unsupported, URLhaus requires MD5 or SHA256\")\n\t\treturn\n\t}\n\tformData := url.Values{\n\t\tkey: {hash},\n\t}\n\n\tresp, err := http.PostForm(\"https://urlhaus-api.abuse.ch/v1/payload\", formData)\n\tif err != nil {\n\t\tlog.Println(\"Error when contacting URLhaus: \" + err.Error())\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tlog.Println(\"Failed to get bytes from URLhaus response: \" + err.Error())\n\t\treturn\n\t}\n\n\t// parse json response\n\tvar jsonDataRaw interface{}\n\terr = json.Unmarshal(body, &jsonDataRaw)\n\tif err != nil {\n\t\tlog.Println(\"Error parsing JSON data from URLhaus: \" + err.Error())\n\t}\n\tvar jsonData map[string]interface{} = jsonDataRaw.(map[string]interface{})\n\n\t// if the top-level key 'query_status' == 'ok', file exists\n\t// if the top-level key 'query_status' == 'hash_not_found', file doesn't exist\n\tqueryStatus, ok := jsonData[\"query_status\"]\n\tif !ok {\n\t\tlog.Println(\"Failed to get query_status field in MB response\")\n\t\treturn\n\t}\n\n\tif queryStatus == \"ok\" {\n\t\tsrc.HasFile = true\n\t\tsrc.CanDownload = true\n\n\t\t// save hashes\n\t\t// since data is the same, it's ok to overwrite Sample members\n\t\tsha256 := strings.Trim(string(gjson.GetBytes(body, \"sha256_hash\").Raw), \"\\\"\")\n\t\tmd5 := strings.Trim(string(gjson.GetBytes(body, \"md5_hash\").Raw), \"\\\"\")\n\t\tsample.MD5 = md5\n\t\tsample.SHA256 = sha256\n\n\t\tsrc.URL = fmt.Sprintf(\"https://urlhaus.abuse.ch/browse.php?search=%s\", sha256)\n\t} else if queryStatus == \"no_results\" {\n\t\t// hash not found\n\t\tsrc.CanDownload = false\n\t} else {\n\t\tlog.Println(\"Got an unknown response from URLhaus\")\n\t}\n}", "func (s *Service) getFile(resID int, fileType int, version int) (file *model.ResourceFile, err error) {\n\tfile = &model.ResourceFile{}\n\tvar (\n\t\tres *model.Resource // current version\n\t\tresHis *model.Resource // history version\n\t\tpoolID int\n\t)\n\tif res, err = s.dao.ParseResID(ctx, resID); err != nil {\n\t\tlog.Error(\"[getFile]-[findPool %d]-Error(%v)\", resID, err)\n\t\treturn\n\t}\n\tpoolID = int(res.PoolID)\n\tif version != 0 { // full pkg of the history version\n\t\tif resHis, err = s.dao.ParseResVer(ctx, poolID, version); err != nil {\n\t\t\tlog.Error(\"[getFile]-[findVersion]-Error(%v)\", err)\n\t\t\treturn\n\t\t}\n\t\tresID = int(resHis.ID)\n\t}\n\tif file, err = s.dao.ReadyFile(ctx, resID, fileType); err != nil {\n\t\tlog.Error(errFormat, \"getUrl\", \"First\", err)\n\t}\n\treturn\n}", "func getPathByHash(ctx context.Context, baseDir, hash, extension string) string {\n\tbaseImageDir := filepath.Join(baseDir, \"media\", \"files\")\n\tfilename := hash + \".\" + extension\n\n\timgURL := filepath.Join(baseImageDir, hash[:2], hash[2:4], filename)\n\n\treturn imgURL\n}", "func (ut *UploadTracker) hashFile(path string) (isolated.HexDigest, error) {\n\tif result, ok := ut.fileHashCache[path]; ok {\n\t\treturn result.digest, result.err\n\t}\n\n\tdigest, err := ut.doHashFile(path)\n\tut.fileHashCache[path] = hashResult{digest, err}\n\treturn digest, err\n}", "func fileHash(path string) ([]byte, error) {\n\tif path == \"\" {\n\t\treturn nil, fmt.Errorf(\"path was empty: %w\", errInput)\n\t}\n\tf, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"os.Open(%q) returned %v: %w\", path, err, errPath)\n\t}\n\tdefer f.Close()\n\n\th := sha256.New()\n\tif _, err := io.Copy(h, f); err != nil {\n\t\treturn nil, fmt.Errorf(\"hashing %q returned %v: %w\", f.Name(), path, errIO)\n\t}\n\thash := h.Sum(nil)\n\treturn hash, nil\n}", "func (qt *QueueTx) GetByHash(transaction *DbTransaction, hash []byte) (bool, error) {\r\n\treturn isFound(GetDB(transaction).Where(\"hash = ?\", hash).First(qt))\r\n}", "func readFirstFile(groupDir string, filenames []string) (string, error) {\n\tvar errors *multierror.Error\n\t// If reading all the files fails, return list of read errors.\n\tfor _, filename := range filenames {\n\t\tcontent, err := Blkio.Group(groupDir).Read(filename)\n\t\tif err == nil {\n\t\t\treturn content, nil\n\t\t}\n\t\terrors = multierror.Append(errors, err)\n\t}\n\terr := errors.ErrorOrNil()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"could not read any of files %q: %w\", filenames, err)\n\t}\n\treturn \"\", nil\n}", "func (c *appContext) findAndPickOne(key string, svc *s3.S3, s *Stack) (string, bool) {\n\tme := \"findAndPickOne\"\n\tdefer respTime(me)() // don't forget the extra parentheses\n\ts.Push(me, \"<-\")\n\n\troot := strings.TrimSuffix(key, filepath.Ext(key))\n\ts.Push(me, \"root: \"+root)\n\n\tparams := &s3.ListObjectsInput{\n\t\tBucket: aws.String(c.bucket), // Required\n\t\tMaxKeys: aws.Int64(c.maxDCfiles),\n\t\tPrefix: aws.String(root),\n\t}\n\tresp, err := svc.ListObjects(params)\n\n\tif err != nil {\n\t\t// Print the error, cast err to awserr.Error to get the Code and\n\t\t// Message from an error.\n\t\ts.Push(me, \"S3 error getting diversified files\")\n\t\tdlog.Error.Printf(\"error getting diversified files for: %s, %s\", root, err)\n\t\treturn \"\", false\n\t}\n\n\tif len(resp.Contents) == 0 {\n\t\ts.Push(me, \"resp.Contents=0\")\n\t\tdlog.Error.Printf(\"found no diversified files for: %s\", root)\n\t\treturn \"\", false\n\t}\n\n\trand.Seed(time.Now().UTC().UnixNano())\n\tk := resp.Contents[rand.Intn(len(resp.Contents))]\n\ts.Push(me, \"result: \"+*k.Key)\n\ts.Push(me, \"->\")\n\treturn *k.Key, true\n\n}", "func getFileForName(files []*zip.File, name string) (*zip.File, error) {\n\tfor _, file := range files {\n\t\tif file.Name == name {\n\t\t\treturn file, nil\n\t\t}\n\t}\n\n\treturn nil, fmt.Errorf(\"File not found: %s\", name)\n}", "func hashFile(file io.Reader) []byte {\n\thash := suite.Hash()\n\tbuflen := 1024 * 1024\n\tbuf := make([]byte, buflen)\n\tread := buflen\n\tfor read == buflen {\n\t\tvar err error\n\t\tread, err = file.Read(buf)\n\t\tif err != nil && err != io.EOF {\n\t\t\tdbg.Fatal(\"Error while reading bytes\")\n\t\t}\n\t\thash.Write(buf)\n\t}\n\treturn hash.Sum(nil)\n}", "func getBlkFromHash(hash [constants.HASHSIZE]byte) Block {\n\tvar retBlk Block\n\tsess, err := mgo.Dial(\"localhost\")\n\tcheckerror(err)\n\tdefer sess.Close()\n\thandle := sess.DB(\"Goin\").C(\"Blocks\")\n\tBlkQuery := handle.Find(bson.M{\"hash\": hash})\n\terr = BlkQuery.One(&retBlk)\n\tif err != nil {\n\t\treturn Block{}\n\t}\n\treturn retBlk\n}", "func dbFetchHeaderByHash(dbTx database.Tx, hash *common.Hash) (*protos.BlockHeader, error) {\n\theaderBytes, err := dbTx.FetchBlockHeader(database.NewNormalBlockKey(hash))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar header protos.BlockHeader\n\terr = header.Deserialize(bytes.NewReader(headerBytes))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &header, nil\n}", "func (db *Database) dbFileForClientFile(f File, c Client) DbFile {\n\tdbC := db.dbClientForClient(c)\n\trows, err := db.Query(\"SELECT * FROM File WHERE name=$1 AND ownerId=$2\", f.name, dbC.id)\n\tif err != nil {\n\t\tlog.Fatalln(\"Unable to get file for name\", f.name, \":\", err)\n\t}\n\tdefer rows.Close()\n\tif !rows.Next() {\n\t\tlog.Fatalln(\"No row for file\", f.name)\n\t}\n\treturn NewDbFile(rows)\n}", "func (f *FileHash) GetHash() (value []byte) {\n\tif f == nil {\n\t\treturn\n\t}\n\treturn f.Hash\n}", "func GetSpecific(path string) (*File, error) {\n\tresolv, err := os.ReadFile(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &File{Content: resolv, Hash: hashData(resolv)}, nil\n}", "func (f *FileService) GetPathByHash(ctx context.Context, hash, extension string) string {\n\treturn getPathByHash(ctx, f.baseDir, hash, extension)\n}", "func GetFileFromRepo(key string) (File, error) {\n\tif len(key) == 0 || !isValidUUID(key) {\n\t\treturn File{}, errors.New(\"Empty or invalid key\")\n\t}\n\treturn fileRepo.GetObject(key)\n}", "func (s InputSecureFileArray) First() (v InputSecureFile, ok bool) {\n\tif len(s) < 1 {\n\t\treturn\n\t}\n\treturn s[0], true\n}", "func GetPhotoByUserAndHash(photos *[]Photo, hash string) *Photo {\n\n\tfor _, photo := range *photos {\n\t\tif photo.Hash == hash {\n\t\t\treturn &photo\n\t\t}\n\t}\n\n\treturn nil\n}", "func (filedb *FileDB) findDBFileByName(sdfsFileName string) int {\n\tfor i, entry := range *filedb {\n\t\tif entry.sdfsName == sdfsFileName {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}", "func (db *FileDB) GetRandomFile() (File, error) {\n\tUUIDs := db.GetUUIDs()\n\n\tif len(UUIDs) == 0 {\n\t\treturn File{}, ErrFileDBEmpty\n\t}\n\n\t// pick random from slice\n\trandomUUID := UUIDs[RandomInt(0, len(UUIDs))]\n\tfile, ok := db.Published.Get(randomUUID)\n\tif !ok {\n\t\treturn File{}, errors.New(\"file does not exist\")\n\t}\n\n\treturn file, nil\n}", "func (ut *UploadTracker) doHashFile(path string) (isolated.HexDigest, error) {\n\tf, err := ut.lOS.Open(path)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer f.Close()\n\treturn isolated.Hash(ut.checker.Hash(), f)\n}", "func (repo *GitRepository) GetFile(id string) ([]byte, error) {\n\tgitRepo, err := git.OpenRepository(repo.Path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\toid, err := git.NewOid(id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tblob, err := gitRepo.LookupBlob(oid)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn blob.Contents(), nil\n}", "func (upload *Upload) GetFile(ID string) (file *File) {\n\tfor _, file := range upload.Files {\n\t\tif file.ID == ID {\n\t\t\treturn file\n\t\t}\n\t}\n\n\treturn nil\n}", "func HashFile(strFilepath string) []BlockHash {\n\tvar c, startWindowPosition, index, cmatch, lenCurr int = 0, 0, 0, 0, -1\n\tvar hash uint64 = 0\n\tvar currByte byte\n\tvar window WindowBytes\n\tvar hashBlock [16]byte\n\tvar arrBlockHash []BlockHash\n\n\t//\n\tfmt.Println(\"Start hash of file \", strFilepath)\n\n\t// Check if file exists\n\tif _, err := os.Stat(strFilepath); os.IsNotExist(err) {\n\t\treturn arrBlockHash\n\t}\n\n\twindow.init(HASH_WINDOW_SIZE)\n\n\t// Read file\n\tf, err := os.Open(strFilepath)\n\tif err != nil {\n\t\tfmt.Println(\"Err in opening file\", err)\n\t\treturn arrBlockHash\n\t}\n\tdefer func() {\n\t\tif err := f.Close(); err != nil {\n\t\t\tfmt.Println(\"Err in closing file\", err)\n\t\t\treturn\n\t\t}\n\t}()\n\treader := bufio.NewReader(f)\n\n\t// Reset the read window, we'll slide from there\n\tlenCurr, err = window.readFull(reader)\n\tif err != nil && lenCurr <= 0 {\n\t\tfmt.Println(\"Err in reading file\", err)\n\t\treturn arrBlockHash\n\t}\n\tc += lenCurr\n\t// Calculate window hash (first time)\n\tfor index, currByte = range window.currBytes {\n\t\thash += uint64(currByte) * math.Pow(HASH_PRIME_ROOT, HASH_WINDOW_SIZE-index-1)\n\t}\n\n\tfor {\n\t\t// Check if we fit the match, and at least a certain amount of bytes\n\t\tif (hash | HASH_MASK) == hash {\n\n\t\t\t// New match, md5 it\n\t\t\tcmatch++\n\t\t\thashBlock = md5.Sum(window.currBlock)\n\t\t\tarrBlockHash = append(arrBlockHash, BlockHash{Length: lenCurr, Hash: hashBlock, PositionInFile: startWindowPosition})\n\n\t\t\t// Reset the read window, we'll slide from there\n\t\t\tlenCurr, err = window.readFull(reader)\n\t\t\tif err != nil && lenCurr <= 0 {\n\t\t\t\tfmt.Println(\"Error in hashfile\", err)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tstartWindowPosition = c\n\t\t\tc += lenCurr\n\t\t\t// Calculate next window hash\n\t\t\thash = 0\n\t\t\tfor index, currByte = range window.currBytes {\n\t\t\t\thash += uint64(currByte) * math.Pow(HASH_PRIME_ROOT, HASH_WINDOW_SIZE-index-1)\n\t\t\t}\n\n\t\t} else {\n\t\t\t// No fit, we keep going for this block\n\t\t\tcurrByte, err = reader.ReadByte()\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Error in hashfile2\", err)\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\t// Magic hash\n\t\t\thash -= uint64(window.getFirstByte()) * math.Pow(HASH_PRIME_ROOT, HASH_WINDOW_SIZE-1)\n\t\t\thash *= HASH_PRIME_ROOT\n\t\t\thash += uint64(currByte)\n\n\t\t\t// Add new byte read\n\t\t\twindow.addByte(currByte)\n\t\t\tc++\n\t\t\tlenCurr++\n\t\t}\n\t}\n\n\t// Last block, if not empty\n\tif lenCurr > 0 {\n\t\thashBlock = md5.Sum(window.currBlock)\n\t\tarrBlockHash = append(arrBlockHash, BlockHash{Length: lenCurr, Hash: hashBlock, PositionInFile: startWindowPosition})\n\t}\n\n\tfmt.Printf(\"Found %d matches!\\n\", cmatch)\n\tfmt.Printf(\"Went through %d bytes!\\n\", c)\n\n\treturn arrBlockHash\n}", "func (d *DriveDB) FileById(fileId string) (*gdrive.File, error) {\n\tvar res gdrive.File\n\terr := d.get(fileKey(fileId), &res)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &res, nil\n}", "func getLatestHistoryFile(dir string) (item historyItem) {\n\tfileList, err := getHistoryFileList(dir)\n\t// start from 0\n\tif len(fileList) == 0 || err != nil {\n\t\titem.index = 0\n\t\titem.path = filepath.Join(dir, fmt.Sprintf(\"%s%s\", historyPrefix, strconv.Itoa(item.index)))\n\t\treturn\n\t}\n\n\tlatestItem := fileList[0]\n\n\tif latestItem.info.Size() >= historySize {\n\t\titem.index = latestItem.index + 1\n\t\titem.path = filepath.Join(dir, fmt.Sprintf(\"%s%s\", historyPrefix, strconv.Itoa(item.index)))\n\t} else {\n\t\titem = latestItem\n\t}\n\n\treturn\n}", "func getFile(chart *chart.Chart, name string) *chart.File {\n\tfor _, file := range chart.Files {\n\t\tif file.Name == name {\n\t\t\treturn file\n\t\t}\n\t}\n\treturn nil\n}", "func GetFileId(path string, followSymlink bool) (FileId, error) {}", "func (node *Node) get(hashedFile int) (string, error) {\n\tnode.dataStoreLock.RLock()\n\tdefer node.dataStoreLock.RUnlock()\n\t// Check if key-value pair exists\n\t// value is the value of hashedFile while ok is a bool\n\t// if hashFile does not exist, keyExists is False\n\tvalue, keyExists := node.hashTable[hashedFile]\n\tif keyExists {\n\t\treturn value, nil\n\t} else {\n\t\treturn \"\", errors.New(\"File with identifier \" + strconv.Itoa(hashedFile) + \" does not exist in hash table\")\n\t}\n}", "func (f *FileCache) nextReadFile() (name string) {\n\tvar names []string\n\tf.eLock.RLock()\n\tfor name = range f.logs {\n\t\tnames = append(names, name)\n\t}\n\tf.eLock.RUnlock()\n\tif len(names) > 0 {\n\t\tsort.Strings(names)\n\t\tname = names[0]\n\t}\n\treturn\n}", "func (repo *PostgresRepo) GetFile(id int, project int) (earthworks.FileObject, error) {\n\tfile := earthworks.FileObject{}\n\tq := `\n\t\tSELECT file, filename FROM project_file WHERE id=$1 AND project=$2 AND expired_at IS NULL\n\t`\n\terr := repo.db.QueryRowx(q, id, project).StructScan(&file)\n\treturn file, err\n}", "func (f FileRepo) FindByID(context context.Context, id string) (*model.FileDTO, error) {\n\tobjID, err := primitive.ObjectIDFromHex(id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tquery := bson.M{\n\t\t\"_id\": objID,\n\t}\n\tvar file model.File\n\terr = f.collection.FindOne(context, query).Decode(&file)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn file.DTO(), nil\n}", "func firstExistingFilePath(paths ...string) string {\n\tfor _, f := range paths {\n\t\tif utils.FileExists(f) {\n\t\t\treturn f\n\t\t}\n\t}\n\treturn \"\"\n}", "func testSingleFileGet(t *testing.T, tg *siatest.TestGroup) {\n\t// Grab the first of the group's renters\n\trenter := tg.Renters()[0]\n\t// Upload file, creating a piece for each host in the group\n\tdataPieces := uint64(1)\n\tparityPieces := uint64(len(tg.Hosts())) - dataPieces\n\tfileSize := 100 + siatest.Fuzz()\n\t_, _, err := renter.UploadNewFileBlocking(fileSize, dataPieces, parityPieces)\n\tif err != nil {\n\t\tt.Fatal(\"Failed to upload a file for testing: \", err)\n\t}\n\n\tfiles, err := renter.Files()\n\tif err != nil {\n\t\tt.Fatal(\"Failed to get renter files: \", err)\n\t}\n\n\tvar file modules.FileInfo\n\tfor _, f := range files {\n\t\tfile, err = renter.File(f.SiaPath)\n\t\tif err != nil {\n\t\t\tt.Fatal(\"Failed to request single file\", err)\n\t\t}\n\t\tif file != f {\n\t\t\tt.Fatal(\"Single file queries does not match file previously requested.\")\n\t\t}\n\t}\n}", "func (fs *FileSystem) GetI(i int) (f File, err error) {\n\tfiles, err := fs.getAllFromPreparedQuery(`\n\t\tSELECT * FROM fs LIMIT 1 OFFSET ?`, i)\n\tif err != nil {\n\t\terr = errors.Wrap(err, \"Stat\")\n\t}\n\tif len(files) == 0 {\n\t\terr = errors.New(\"no files\")\n\t} else {\n\t\tf = files[0]\n\t}\n\n\tif f.IsCompressed {\n\t\tf.Data = decompressByte(f.Data)\n\t\tf.Size = len(f.Data)\n\t}\n\treturn\n}", "func (c _StoreImpl) Photo_ByHashMd5(HashMd5 string) (*Photo, bool) {\n\to, ok := RowCacheIndex.Get(\"Photo_HashMd5:\" + fmt.Sprintf(\"%v\", HashMd5))\n\tif ok {\n\t\tif obj, ok := o.(*Photo); ok {\n\t\t\treturn obj, true\n\t\t}\n\t}\n\n\trow, err := NewPhoto_Selector().HashMd5_Eq(HashMd5).GetRow(base.DB)\n\tif err == nil {\n\t\tRowCacheIndex.Set(\"Photo_HashMd5:\"+fmt.Sprintf(\"%v\", row.HashMd5), row, 0)\n\t\treturn row, true\n\t}\n\n\tXOLogErr(err)\n\treturn nil, false\n}", "func (r PostgresRepository) Find(hash string) string {\n\trows, err := r.db.Query(\"SELECT url FROM urls WHERE hash = ?\", hash)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\tdefer rows.Close()\n\tif !rows.Next() {\n\t\treturn \"\"\n\t}\n\tvar url string\n\trows.Scan(&url)\n\treturn url\n}", "func fileHash(filePath string) (uint32, error) {\n\tinputFile, err := os.Open(filePath)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tdefer inputFile.Close()\n\n\thasher := xxHash32.New(0xCAFE) // type hash.Hash32\n\tdefer hasher.Reset()\n\n\t_, err = io.Copy(hasher, inputFile)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn hasher.Sum32(), nil\n}", "func GetFileMeta(fileSha1 string) FileMeta {\n\treturn fileMetas[fileSha1]\n}", "func FileBinSHA1(path string) (binHash []byte, err error) {\n\tvar data2 []byte\n\tbinHash = xu.SHA1_BIN_NONE\n\tfound, err := xf.PathExists(path)\n\tif err == nil && !found {\n\t\terr = errors.New(\"IllegalArgument: empty path or non-existent file\")\n\t}\n\tif err == nil {\n\t\tdata2, err = ioutil.ReadFile(path)\n\t}\n\tif err == nil {\n\t\td2 := sha1.New()\n\t\td2.Write(data2)\n\t\tbinHash = d2.Sum(nil)\n\t}\n\treturn\n}", "func getFileById(id string) (*drive.File, error) {\n\tfor ntries := 0; ; ntries++ {\n\t\tfile, err := drivesvc.Files.Get(id).Do()\n\t\tif err == nil {\n\t\t\treturn file, nil\n\t\t} else if err = tryToHandleDriveAPIError(err, ntries); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n}", "func (db *Database) dbFilePartFromFilePart(fp FilePart) DbFilePart {\n\trows, err := db.Query(\"SELECT * FROM FilePart WHERE name=$1 AND fileIndex=$2\", fp.name, fp.index)\n\tif err != nil {\n\t\tlog.Fatalln(\"Unable to get file path for name\", fp.name, \":\", err)\n\t}\n\tdefer rows.Close()\n\tif !rows.Next() {\n\t\tlog.Fatalln(\"No row for file path\", fp.name)\n\t}\n\treturn NewDbFilePart(rows)\n\n}", "func hasher(filename string) ([]byte, error) {\n\tbs, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\th := sha256.New()\n\th.Write(bs)\n\ta := h.Sum([]byte{})\n\treturn a, nil\n}", "func (sdeep *SSDEEP) FuzzyByte(blob []byte) (*FuzzyHash, error) {\n\tn := len(blob)\n\tif n < minFileSize {\n\t\treturn nil, errors.New(\"Did not process files large enough to produce meaningful results\")\n\t}\n\tsdeep.getBlockSize(n)\n\tr := bytes.NewReader(blob)\n\treturn sdeep.FuzzyReader(r, \"\")\n}", "func (p *NoteStoreClient) GetResourceByHash(ctx context.Context, authenticationToken string, noteGuid GUID, contentHash []byte, withData bool, withRecognition bool, withAlternateData bool) (r *Resource, err error) {\n var _args149 NoteStoreGetResourceByHashArgs\n _args149.AuthenticationToken = authenticationToken\n _args149.NoteGuid = noteGuid\n _args149.ContentHash = contentHash\n _args149.WithData = withData\n _args149.WithRecognition = withRecognition\n _args149.WithAlternateData = withAlternateData\n var _result150 NoteStoreGetResourceByHashResult\n if err = p.Client_().Call(ctx, \"getResourceByHash\", &_args149, &_result150); err != nil {\n return\n }\n switch {\n case _result150.UserException!= nil:\n return r, _result150.UserException\n case _result150.SystemException!= nil:\n return r, _result150.SystemException\n case _result150.NotFoundException!= nil:\n return r, _result150.NotFoundException\n }\n\n return _result150.GetSuccess(), nil\n}", "func (sm SectorMap) FirstFreeFile() byte {\n\tfor file := byte(0x01); file < 0xfe; file++ {\n\t\tsectors := sm.SectorsForFile(file)\n\t\tif len(sectors) == 0 {\n\t\t\treturn file\n\t\t}\n\t}\n\treturn 0\n}", "func (storage *B2Storage) FindChunk(threadIndex int, chunkID string, isFossil bool) (filePath string, exist bool, size int64, err error) {\n filePath = \"chunks/\" + chunkID\n if isFossil {\n filePath += \".fsl\"\n }\n exist, _, size, err = storage.GetFileInfo(threadIndex, filePath)\n return filePath, exist, size, err\n}", "func (userdata *User) LoadFile(filename string) (dataBytes []byte, err error) {\r\n\r\n\t//TODO: This is a toy implementation.\r\n\t/*\r\n\t\tstorageKey, _ := uuid.FromBytes([]byte(filename + userdata.Username)[:16])\r\n\t\tdataJSON, ok := userlib.DatastoreGet(storageKey)\r\n\t\tif !ok {\r\n\t\t\treturn nil, errors.New(strings.ToTitle(\"File not found!\"))\r\n\t\t}\r\n\t\tjson.Unmarshal(dataJSON, &dataBytes)\r\n\t*/\r\n\t//if file DNE, return error. retrieve fileKey from Datastore\r\n\tupdatedUser, err := GetLatestUser(userdata.UUID_, userdata.PasswordHash, userdata.HMACKey, userdata.EncKey)\r\n\tif err != nil {\r\n\t\treturn nil, errors.New(\"Failed to retrieve latest user info.\")\r\n\t}\r\n\tfileKey, found := updatedUser.Filespace[filename]\r\n\r\n\tif !found {\r\n\t\treturn nil, errors.New(\"File not found in user's filespace.\")\r\n\t}\r\n\r\n\t//again, check if ur loading shared file, if so retrieve through access token\r\n\tvar latestFileKey FileKey\r\n\t_, own := updatedUser.FilesOwned[filename]\r\n\tif !own { //this is just in case a revocation has happened and the fileKey data has changed\r\n\t\tat := userdata.AccessTokens[filename]\r\n\t\tlatestFileKey, err = updatedUser.RetrieveAccessToken(at)\r\n\t\tif err != nil {\r\n\t\t\treturn nil, errors.New(\"Failed to retrieve access token.\")\r\n\t\t}\r\n\t} else {\r\n\t\tfileKeyDS, found2 := userlib.DatastoreGet(fileKey.KeyId)\r\n\t\tif !found2 {\r\n\t\t\treturn nil, errors.New(\"File not found in DataStore.\")\r\n\t\t}\r\n\r\n\t\tlen_data := len(fileKeyDS) - userlib.HashSizeBytes\r\n\t\t//fix ag panic\r\n\t\tif len_data < 0 || len_data > len(fileKeyDS) || len(fileKeyDS[:len_data]) < userlib.HashSizeBytes {\r\n\t\t\t//automatically return error, file has been changed\r\n\t\t\treturn nil, errors.New(\"FileKey data length has changed.\")\r\n\t\t}\r\n\r\n\t\t//verify integrity of both fileKey struct and the file itself\r\n\t\tcomputedMac, _ := userlib.HMACEval(fileKey.HMAC_key, fileKeyDS[:len_data])\r\n\t\tif !userlib.HMACEqual(computedMac, fileKeyDS[len_data:]) {\r\n\t\t\treturn nil, errors.New(\"File key struct has been tampered with in Datastore.\")\r\n\t\t}\r\n\r\n\t\t//decrypt fileKey in datastore to get latest version\r\n\t\t//decrypt > depad > unmarshal\r\n\t\tfileKey_pad := userlib.SymDec(fileKey.Enc_key, fileKeyDS[:len_data])\r\n\t\tfileKey_decrypt := PKCS(fileKey_pad, \"remove\")\r\n\t\terr = json.Unmarshal(fileKey_decrypt, &latestFileKey) //set current fileKey to latest\r\n\t}\r\n\r\n\t//now that we know fileKey is ok and we have the latest version,\r\n\t//check integrity of each file in file append\r\n\tvar filePart []byte //this is the retrieved file elements DATA field\r\n\r\n\tfor i := 1; i <= latestFileKey.NumFiles; i++ {\r\n\t\t//retrieve appropriate fileElem from Datastore, generate correct file ID\r\n\t\tkeyMsg := latestFileKey.KeyId.String() + \"_\" + strconv.Itoa(i) //i is index of file\r\n\t\tkey_bytes, _ := userlib.HMACEval(latestFileKey.HMAC_key, []byte(keyMsg))\r\n\t\tfileID, _ := uuid.FromBytes(key_bytes[:16])\r\n\r\n\t\tfile_enc, err := userlib.DatastoreGet(fileID)\r\n\t\tlen_file := len(file_enc) - userlib.HashSizeBytes\r\n\r\n\t\tif !err {\r\n\t\t\terror_msg := \"File part not found: \" + keyMsg\r\n\t\t\treturn nil, errors.New(error_msg)\r\n\t\t}\r\n\r\n\t\t//fix ag out of bounds error\r\n\t\tif len_file < 0 || len_file > len(file_enc) || len(file_enc[:len_file]) < userlib.HashSizeBytes {\r\n\t\t\t//automatically return error, file has been changed\r\n\t\t\treturn nil, errors.New(\"File data length has changed.\")\r\n\t\t}\r\n\r\n\t\t//check integrity through HMAC\r\n\t\tfileMAC, _ := userlib.HMACEval(latestFileKey.HMAC_key, file_enc[:len_file])\r\n\t\tif !userlib.HMACEqual(fileMAC, file_enc[len_file:]) {\r\n\t\t\terror_msg := \"File part has been compromised: \" + keyMsg\r\n\t\t\treturn nil, errors.New(error_msg)\r\n\t\t}\r\n\r\n\t\t//decrypt, depad, demarshal, and extract data field\r\n\t\tfile_dec := userlib.SymDec(latestFileKey.Enc_key, file_enc[:len_file])\r\n\t\tfile_dec = PKCS(file_dec, \"remove\")\r\n\t\tvar file_demarsh FileElem\r\n\t\terr2 := json.Unmarshal(file_dec, &file_demarsh)\r\n\r\n\t\tif err2 != nil {\r\n\t\t\terror_msg := \"Error unmarshaling this file part: \" + keyMsg\r\n\t\t\treturn nil, errors.New(error_msg)\r\n\t\t}\r\n\r\n\t\t//finally we have the unmarshaled file struct, set filePart to the data\r\n\t\tfilePart = file_demarsh.Filedata\r\n\t\tdataBytes = append(dataBytes, filePart...)\r\n\t}\r\n\r\n\treturn dataBytes, nil\r\n}", "func (fs *FingerprintSet) MatchFirst(name string, data string) *recog.FingerprintMatch {\n\tnomatch := &recog.FingerprintMatch{Matched: false}\n\tfdb, ok := fs.Databases[name]\n\tif !ok {\n\t\tnomatch.Errors = append(nomatch.Errors, fmt.Errorf(\"database %s is missing\", name))\n\t\treturn nomatch\n\t}\n\treturn fdb.MatchFirst(data)\n}", "func (s *Store) ContainsResultFileHash(ctx context.Context, fileName, md5 string) (bool, error) {\n\tdefer metrics2.FuncTimer().Stop()\n\tc := combine(fileName, md5)\n\tq := s.client.Collection(ingestionCollection).Where(fileHashField, \"==\", c).Limit(1)\n\tfound := false\n\terr := s.client.IterDocs(ctx, \"contains\", c, q, maxAttempts, maxDuration, func(doc *firestore.DocumentSnapshot) error {\n\t\tif doc != nil {\n\t\t\tfound = true\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn false, skerr.Wrapf(err, \"reading %s:%s in firestore\", fileName, md5)\n\t}\n\treturn found, nil\n}", "func (s *Store) idFile(ctx context.Context, name string) string {\n\tif s.crypto == nil {\n\t\treturn \"\"\n\t}\n\n\tfn := name\n\n\tvar cnt uint8\n\n\tfor {\n\t\tcnt++\n\t\tif cnt > 100 {\n\t\t\tbreak\n\t\t}\n\n\t\tif fn == \"\" || fn == Sep {\n\t\t\tbreak\n\t\t}\n\n\t\tgfn := filepath.Join(fn, s.crypto.IDFile())\n\t\tif s.storage.Exists(ctx, gfn) {\n\t\t\treturn gfn\n\t\t}\n\n\t\tfn = filepath.Dir(fn)\n\t}\n\n\treturn s.crypto.IDFile()\n}", "func (log *PbftLog) GetBlockByHash(hash common.Hash) *types.Block {\n\tvar found *types.Block\n\tit := log.Blocks().Iterator()\n\tfor block := range it.C {\n\t\tif block.(*types.Block).Hash() == hash {\n\t\t\tfound = block.(*types.Block)\n\t\t\tit.Stop()\n\t\t}\n\t}\n\treturn found\n}", "func (n *OpenBazaarNode) GetPostFromHash(hash string) (*pb.SignedPost, error) {\n\t// Read posts.json\n\tindexPath := path.Join(n.RepoPath, \"root\", \"posts.json\")\n\tfile, err := ioutil.ReadFile(indexPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Unmarshal the index\n\tvar index []postData\n\terr = json.Unmarshal(file, &index)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Extract slug that matches hash\n\tvar slug string\n\tfor _, data := range index {\n\t\tif data.Hash == hash {\n\t\t\tslug = data.Slug\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif slug == \"\" {\n\t\treturn nil, errors.New(\"post does not exist\")\n\t}\n\treturn n.GetPostFromSlug(slug)\n}", "func (s *service) getExecutable(w http.ResponseWriter, r *http.Request, p httprouter.Params) {\n\tf, err := s.store.Executable(p.ByName(\"hash\"))\n\tif err != nil {\n\t\twriteError(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\tdefer f.Close()\n\n\t// We ignore the error here, because the zero-value is fine in case of\n\t// error.\n\tinfo, _ := f.Stat()\n\thttp.ServeContent(w, r, info.Name(), info.ModTime(), f)\n}", "func OpenAndHashFile(filename string) (*HashedFile, error) {\n\tf, err := os.Open(filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\thf := &HashedFile{MD5: md5.New()}\n\tio.Copy(hf, f)\n\thf.FileContents = bytes.NewReader(hf.filecontents)\n\treturn hf, nil\n}", "func (st SymbolTable) FileForName(filename string) (byte, error) {\n\tif addr := parseAddressFilename(filename); addr != 0 {\n\t\treturn addr, nil\n\t}\n\n\tfor _, symbol := range st {\n\t\tif strings.EqualFold(symbol.Name, filename) {\n\t\t\tif symbol.Address > 0xDF00 && symbol.Address < 0xDFFE {\n\t\t\t\treturn byte(symbol.Address - 0xDF00), nil\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn 0, errors.FileNotFoundf(\"filename %q not found\", filename)\n}", "func (d *PartialDriver) First() (version uint, err error) {\n\tif version, ok := d.migrations.First(); ok {\n\t\treturn version, nil\n\t}\n\treturn 0, &fs.PathError{\n\t\tOp: \"first\",\n\t\tPath: d.path,\n\t\tErr: fs.ErrNotExist,\n\t}\n}", "func getFingerprint(fn string) (fingerprint string, err kv.Error) {\n\tdata, errGo := ioutil.ReadFile(fn)\n\tif errGo != nil {\n\t\treturn \"\", kv.Wrap(errGo).With(\"filename\", fn).With(\"stack\", stack.Trace().TrimRuntime())\n\t}\n\n\tkey, err := extractPubKey(data)\n\tif err != nil {\n\t\treturn \"\", err.With(\"filename\", fn)\n\t}\n\n\treturn ssh.FingerprintSHA256(key), nil\n}", "func (repo Repository) GetByFullPath(fullpath string) (data []byte, err error) {\n\tfullPath := path.Join(repo.StorageDir, fullpath)\n\tdata, err = ioutil.ReadFile(fullPath)\n\n\treturn\n}", "func Sha1File(path string) (string, error) {\n\treturn crypto.Sha1File(path)\n}" ]
[ "0.62578005", "0.6151854", "0.6131234", "0.6067959", "0.5953786", "0.5925322", "0.59186417", "0.5798851", "0.5763395", "0.57267666", "0.5697053", "0.5683563", "0.5677908", "0.566324", "0.5657986", "0.56350976", "0.5629759", "0.5610483", "0.5590056", "0.5578331", "0.55579907", "0.5557649", "0.5556433", "0.55394346", "0.55238736", "0.54641944", "0.5455739", "0.5431737", "0.5428758", "0.5425912", "0.5417566", "0.54037607", "0.539052", "0.53864664", "0.5385154", "0.5373972", "0.5353626", "0.534773", "0.53429544", "0.5340531", "0.5337968", "0.53364164", "0.5328547", "0.53191924", "0.5316273", "0.5310968", "0.53040105", "0.5303038", "0.5300328", "0.52950394", "0.52806884", "0.5265502", "0.52450675", "0.5236462", "0.52290696", "0.52238154", "0.52203435", "0.52108616", "0.518715", "0.51835245", "0.51759934", "0.51694113", "0.5159945", "0.5155818", "0.5149093", "0.514655", "0.51434535", "0.5137595", "0.5135344", "0.5135065", "0.513207", "0.5131928", "0.51175886", "0.511084", "0.5110052", "0.51098096", "0.51025283", "0.50954175", "0.5086905", "0.5083502", "0.50823927", "0.50817853", "0.5079383", "0.5073452", "0.50711864", "0.5068598", "0.50638586", "0.5055657", "0.50543064", "0.50487256", "0.5047541", "0.5037929", "0.5035827", "0.5030963", "0.5028077", "0.5025282", "0.5024688", "0.50136024", "0.5011864", "0.5003359" ]
0.86666566
0
BeforeCreate creates a random UID if needed before inserting a new row to the database.
func (m *File) BeforeCreate(scope *gorm.Scope) error { if rnd.IsUID(m.FileUID, 'f') { return nil } return scope.SetColumn("FileUID", rnd.PPID('f')) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (u *UUID) BeforeCreate(tx *gorm.DB) (err error) {\n\tu.ID, err = uuid.NewV4()\n\tif err != nil {\n\t\terr = errors.New(\"can't save invalid data\")\n\t}\n\treturn\n}", "func (t *Test) BeforeCreate(tx *gorm.DB) error {\n\tid, err := uuid.NewRandom()\n\tt.ID = BinaryUUID(id)\n\treturn err\n}", "func (user *UserCredential) BeforeCreate(scope *gorm.Scope) error {\n\treturn scope.SetColumn(\"ID\", uuid.New().String())\n}", "func (ul *UserLogin) BeforeCreate(tx *gorm.DB) error {\n\tgenerateUUID := uuid.New()\n\tif ul.UUID == \"\" {\n\t\tul.UUID = generateUUID.String()\n\t}\n\treturn nil\n}", "func (user *User) BeforeCreate(scope *gorm.Scope) error {\n\tscope.SetColumn(\"userID\", uuid.NewV4())\n\treturn nil\n}", "func (a *Account) BeforeCreate(scope *gorm.Scope) error {\n\tuuid := uuid.Must(uuid.NewRandom()).String()\n\tscope.SetColumn(\"ID\", uuid)\n\n\treturn nil\n}", "func (base *Base) BeforeCreate(tx *gorm.DB) error {\n\tuuid, err := uuid.NewV4()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Save new id\n\tbase.ID = uuid.String()\n\n\treturn nil\n}", "func (s *Secret) BeforeCreate(scope *gorm.Scope) error {\n\tuuid := uuid.NewV4()\n\treturn scope.SetColumn(\"ID\", uuid.String())\n}", "func (s *UserState) BeforeCreate(scope *gorm.Scope) error {\n\terr := scope.SetColumn(\"id\", uuid.NewV4().String())\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (tenant *Tenant) BeforeCreate(tx *gorm.DB) (err error) {\n\tuuid := uuid.New()\n\ttenant.ID = uuid\n\n\treturn\n}", "func (access *UserAccesses) BeforeCreate(db *gorm.DB) {\n\taccess.UUID = uuid.NewV4().String()\n\treturn\n}", "func (base *Base) BeforeCreate(tx *gorm.DB) error {\n\t// uuid.New() creates a new random UUID or panics.\n\tbase.ID = uuid.New()\n\n\t// generate timestamps\n\tnow := time.Now().UTC()\n\tbase.CreatedAt, base.UpdatedAt = now, now\n\n\treturn nil\n}", "func (p *Post) BeforeCreate(scope *gorm.Scope) error {\n\tscope.SetColumn(\"ID\", uuid.New().String())\n\treturn nil\n}", "func (us *UserAppSession) BeforeCreate(scope *gorm.Scope) error {\n\tscope.SetColumn(\"CreatedAt\", time.Now())\n\tif identifier, err := random.GenerateRandomString(64); err == nil {\n\t\tscope.SetColumn(\"Identifier\", identifier)\n\n\t}\n\treturn nil\n}", "func (base *Todo) BeforeCreate(scope *gorm.Scope) error {\n\tuid := uuid.NewV4()\n\n\treturn scope.SetColumn(\"Id\", uid)\n}", "func (c *Company) BeforeCreate(db *gorm.DB) (err error) {\n\tuuid := uuid.NewV4()\n\n\tlog.Println(\"UUID IS GENERATED\")\n\tc.Base.ID = uuid\n\treturn\n}", "func (base *Base) BeforeCreate(scope *gorm.Scope) error {\n\treturn scope.SetColumn(\"ID\", uuid.NewV4())\n}", "func (base *BaseUUID) BeforeCreate(scope *gorm.Scope) error {\n\tuuidVal := uuid.NewV4()\n\treturn scope.SetColumn(\"ID\", uuidVal)\n}", "func (u *User) BeforeCreate(scope *gorm.Scope) error {\n\tid := uuid.NewV4()\n\n\tscope.SetColumn(\"id\", id.String())\n\tscope.SetColumn(\"created_at\", time.Now())\n\tscope.SetColumn(\"updated_at\", time.Now())\n\n\treturn nil\n}", "func (base *Base) BeforeCreate(scope *gorm.Scope) error {\n\tuuid := uuid.NewV4()\n\treturn scope.SetColumn(\"ID\", uuid)\n}", "func (t *Task) BeforeCreate(tx *gorm.DB) (err error) {\n\tt.ID = uuid.New().String()\n\n\treturn\n}", "func (base *Base) BeforeCreate(scope *gorm.Scope) error {\n\tuuid := uuid.NewV4()\n\treturn scope.SetColumn(\"ID\", uuid.String())\n}", "func (*TimeRecord) BeforeCreate(scope *gorm.Scope) error {\n\treturn scope.SetColumn(\"id\", NewUUID())\n}", "func (u *User) BeforeCreate(tx *gorm.DB) error {\n\tif u.CreatedUnix == 0 {\n\t\tu.CreatedUnix = tx.NowFunc().Unix()\n\t\tu.UpdatedUnix = u.CreatedUnix\n\t}\n\treturn nil\n}", "func (prj *Project) BeforeCreate(tx *gorm.DB) (err error) {\n\tprj.ID = uuid.New()\n\treturn nil\n}", "func (user *UserModel) BeforeCreate(scope *gorm.Scope) error {\n\tscope.SetColumn(\"ID\", uuid.Must(uuid.NewV4()))\n\tscope.SetColumn(\"CreatedAt\", time.Now())\n\tuser.EncryptPassword()\n\treturn nil\n}", "func (oauthClient *OauthClient) BeforeCreate(scope *gorm.Scope) error {\n\tuuid := uuid.NewV4()\n\tif oauthClient.ID.String() == \"00000000-0000-0000-0000-000000000000\" {\n\t\treturn scope.SetColumn(\"ID\", uuid)\n\t}\n\treturn nil\n}", "func (n *Notification) BeforeCreate(scope *gorm.Scope) error {\n\treturn scope.SetColumn(\"NotificationID\", uuid.New().String())\n}", "func (sc *StorageCategory) BeforeCreate(tx *gorm.DB) error {\n\tgenerateUUID := uuid.New()\n\tif sc.UUID == \"\" {\n\t\tsc.UUID = generateUUID.String()\n\t}\n\treturn nil\n}", "func (u *User) BeforeSave() error {\n\tif u.ID == 0 && u.UUID == \"\" {\n\t\t// Create uuid for new user\n\t\tuid, errU := NewUUID()\n\t\tif errU != nil {\n\t\t\treturn errU\n\t\t}\n\t\tu.UUID = uid.String()\n\t}\n\treturn nil\n}", "func (m *Model) BeforeCreate(tx *gorm.DB) (err error) {\n\tnowInt64 := int64(time.Now().UnixNano() / 1000)\n\tm.CreatedAtUsec = nowInt64\n\tm.UpdatedAtUsec = nowInt64\n\treturn nil\n}", "func (m *Model) BeforeCreate(tx *gorm.DB) (err error) {\n\tnowInt64 := int64(time.Now().UnixNano() / 1000)\n\tm.CreatedAtUsec = nowInt64\n\tm.UpdatedAtUsec = nowInt64\n\treturn nil\n}", "func (user *User) BeforeCreate(transaction *gorm.DB) error {\n return nil\n}", "func (j *Job) BeforeCreate(_ *gorm.DB) (err error) {\n\tj.ID = common.GenerateID(j)\n\tj.IDShort = j.GetIDShort()\n\treturn nil\n}", "func (vote *Vote) BeforeCreate(scope *gorm.Scope) error {\n scope.SetColumn(\"CreatedAt\", time.Now())\n scope.SetColumn(\"Uuid\", uuid.NewV4())\n return nil\n}", "func (*ReportedCase) BeforeCreate(scope *gorm.Scope) error {\n\treturn scope.SetColumn(\"CaseID\", uuid.New().String())\n}", "func (model *Model) BeforeInsert() {\n\tmodel.ID = fmt.Sprintf(\"%s\", uuid.NewV4())\n}", "func (task *Task) BeforeCreate(scope *gorm.Scope) error {\n\ttask.Id = util.GetNewUuid()\n\ttask.DDL = time.Now()\n\treturn nil\n}", "func (model *Model) BeforeCreate(scope *gorm.Scope) error {\n\tscope.SetColumn(\"CreatedOn\", time.Now().Unix())\n\treturn nil\n}", "func (version *Version) BeforeCreate() (err error) {\n\tif version.UUID == \"\" {\n\t\tversion.UUID = uuid.New()\n\t}\n\n\treturn\n}", "func (u *Admin) BeforeCreate(scope *gorm.Scope) error {\n\tscope.SetColumn(\"Password\", generateHash(u.Password))\n\n\treturn nil\n}", "func (u *User) BeforeCreate() error {\n\tsalt := util.RandStr(10, \"normal\")\n\n\th := md5.New()\n\n\tio.WriteString(h, salt)\n\n\tu.Salt = salt\n\n\tpassword := fmt.Sprintf(\"%x\", h.Sum(nil))\n\n\tfmt.Println(salt, password)\n\n\treturn nil\n}", "func (m *BaseModel) BeforeCreate(scope *gorm.Scope) error {\n\tif err := scope.SetColumn(\"ID\", uuid.New().String()); err != nil {\n\t\treturn err\n\t}\n\n\tif err := scope.SetColumn(\"Version\", 0); err != nil {\n\t\treturn err\n\t}\n\n\tif err := scope.SetColumn(\"Created\", time.Now().UTC()); err != nil {\n\t\treturn err\n\t}\n\n\tif err := scope.SetColumn(\"Updated\", time.Now().UTC()); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (u *User) BeforeCreate(tx *gorm.DB) (err error) {\n\tu.Password, err = passwordHash(u.Password)\n\treturn err\n}", "func (p *Profile) BeforeCreate(scope *gorm.Scope) (err error) {\n\tfmt.Println(\"Before Create\")\n\treturn\n}", "func (u *OAuthToken) BeforeCreate(sess db.Session) error {\n\tu.CreatedAt = GetTimeUTCPointer()\n\treturn nil\n}", "func (u *User) BeforeCreate(tx *pop.Connection) error {\n\thash, err := bcrypt.GenerateFromPassword([]byte(u.Password), bcrypt.DefaultCost)\n\tif err != nil {\n\t\treturn errors.WithStack(err)\n\t}\n\tu.Password = string(hash)\n\treturn nil\n}", "func (user *User) BeforeCreate(db *gorm.DB) (err error) {\n\tif user.Password != \"\" {\n\t\thash, err := hashPassword(user.Password)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdb.Model(user).Where(&User{Email: user.Email}).Update(\"Password\", hash)\n\t\treturn nil\n\t}\n\treturn errors.New(\"password null\")\n}", "func (p *Plan) BeforeCreate(scope *gorm.Scope) error {\n\tscope.SetColumn(\"CreatedAt\", time.Now())\n\n\treturn nil\n}", "func (u *User) BeforeInsert(db orm.DB) error {\n\tnow := time.Now()\n\tif u.CreatedAt.IsZero() {\n\t\tu.CreatedAt = now\n\t\tu.UpdatedAt = now\n\t}\n\n\terr := u.validatePin()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn u.Validate()\n}", "func (t *TreeImage) BeforeSave(tx *gorm.DB) (err error) {\n\tif t.UUID == \"\" {\n\t\tt.UUID = utilities.UUID()\n\t}\n\treturn\n}", "func (term *Term) BeforeCreate(tx *gorm.DB) (err error) {\n\tterm.ID = uuid.NewV4()\n\tterm.UpdatedByID = term.CreatedByID\n\tif len(term.RelatedTerms) > 0 {\n\t\tfor index := range term.RelatedTerms {\n\t\t\tterm.RelatedTerms[index].ID = uuid.NewV4()\n\t\t\tterm.RelatedTerms[index].TermID = term.ID\n\t\t}\n\t}\n\treturn\n}", "func (f *Formation) BeforeCreate(tx *gorm.DB) error {\n\terr := f.Validate()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"invalid formation object:\\n%w\", err)\n\t}\n\treturn nil\n}", "func (d UserData) CreateUID() int64 {\n\tval := d.ModelData.Get(models.NewFieldName(\"CreateUID\", \"create_uid\"))\n\tif !d.Has(models.NewFieldName(\"CreateUID\", \"create_uid\")) {\n\t\treturn *new(int64)\n\t}\n\treturn val.(int64)\n}", "func (skeleton *Skeleton) BeforeCreate() error {\n\ttimeNow := time.Now().UTC().Format(time.RFC3339)\n\tformattedTime, err := time.Parse(time.RFC3339, timeNow)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to parse time. %v\", err)\n\t}\n\tskeleton.UpdatedAt = &formattedTime\n\tskeleton.CreatedAt = &formattedTime\n\treturn nil\n}", "func (e *TransactionEvent) BeforeSave() error {\n\tif e.DeviceId == \"\" {\n\t\t// Create uuid - used in tests\n\t\tuid, errU := NewUUID()\n\t\tif errU != nil {\n\t\t\treturn errU\n\t\t}\n\t\te.DeviceId = uid.String()\n\t}\n\treturn nil\n}", "func (group *Group) BeforeCreate() error {\n\tgroup.ID = mgobson.NewObjectId().Hex()\n\n\t_, err := govalidator.ValidateStruct(group)\n\tif err != nil {\n\t\treturn helpers.NewError(http.StatusBadRequest, \"input_not_valid\", err.Error(), err)\n\t}\n\treturn nil\n}", "func (s UserSet) CreateUID() int64 {\n\tres, _ := s.RecordCollection.Get(models.NewFieldName(\"CreateUID\", \"create_uid\")).(int64)\n\treturn res\n}", "func (p *Job) BeforeInsert(db orm.DB) error {\n\tp.CreatedAt = time.Now()\n\tp.UpdatedAt = time.Now()\n\treturn nil\n}", "func (m *BaseModel) BeforeSave() {\n\tif !m.ID.Valid() {\n\t\tm.ID = bson.NewObjectId()\n\t}\n\n\tnow := time.Now().UnixNano() / int64(time.Millisecond)\n\tif !(m.CreatedOn > 0) {\n\t\tm.CreatedOn = now\n\t}\n\n\tm.UpdatedOn = now\n}", "func (r *Repository) CleanBeforeCreate(a *Auth) (bool, error) {\n\tRequest := request.New(DB)\n\t_, err := Request.\n\t\tDelete().\n\t\tFrom(r.tableName).\n\t\tWhere(Request.NewCond(UserID, \"=\", strconv.Itoa(a.UserID))).\n\t\tWhere(Request.NewCond(DeviceIDColumn, \"=\", a.DeviceID)).\n\t\tExec()\n\tif err != nil {\n\t\tfmt.Println(\"CleanBeforeCreate: \", err)\n\t\treturn false, err\n\t}\n\treturn true, nil\n}", "func (u *User) BeforeDelete(db orm.DB) error {\n\treturn nil\n}", "func (tm *TicketMessage) BeforeCreate() {\n\ttm.Date = time.Now().UTC()\n}", "func (d UserData) SetCreateUID(value int64) m.UserData {\n\td.ModelData.Set(models.NewFieldName(\"CreateUID\", \"create_uid\"), value)\n\treturn d\n}", "func (c FieldsCollection) CreateUID() *models.Field {\n\treturn c.MustGet(\"CreateUID\")\n}", "func (s UserSet) SetCreateUID(value int64) {\n\ts.RecordCollection.Set(models.NewFieldName(\"CreateUID\", \"create_uid\"), value)\n}", "func (key *GPGKey) BeforeInsert() {\n\tkey.AddedUnix = timeutil.TimeStampNow()\n}", "func (u *Admin) AfterCreate(scope *gorm.Scope) error {\n\t// Create auth identity\n\tnow := time.Now()\n\n\tauthIdentity := &auth_identity.AuthIdentity{}\n\tauthIdentity.Provider = \"password\"\n\tauthIdentity.UID = u.Email\n\tauthIdentity.EncryptedPassword = u.Password\n\tauthIdentity.UserID = fmt.Sprint(u.ID)\n\tauthIdentity.ConfirmedAt = &now\n\n\tdatabase.Conn.Create(authIdentity)\n\n\treturn nil\n}", "func CreateUID(name string, author string) string {\n\tuid := author + \";\" + name\n\n\t_data := []byte(uid)\n\n\tuid = fmt.Sprintf(\"%x\", md5.Sum(_data))\n\n\treturn uid\n}", "func (g *Group) AfterCreate(db *gorm.DB) (err error) {\n\thd := hashids.NewData()\n\thd.Salt = config.HashID.Salt\n\thd.MinLength = config.HashID.MinLength\n\th := hashids.NewWithData(hd)\n\n\ta := []int{0}\n\ta[0] = int(g.ID)\n\n\t// Encode\n\te, _ := h.Encode(a)\n\tg.HashID = e\n\n\t// Save\n\tdb.Save(&g)\n\treturn\n}", "func (user *User) BeforeDelete(transaction *gorm.DB) error {\n return nil\n}", "func (user *User) BeforeSave(scope *gorm.Scope) error {\n\t// Validate all fields\n\tif _, err := govalidator.ValidateStruct(user); err != nil {\n\t\treturn errors.New(\"validation failed\")\n\t}\n\n\treturn nil\n}", "func (a MySQLAdapter) Create(user entity.User) (uid int, err error) {\n\tinsertStmt := fmt.Sprintf(\"INSERT INTO %s VALUES (DEFAULT, ?, ?, ?, ?)\", a.table)\n\thashedPwd, err := passgen.HashPassword([]byte(user.Password))\n\tif err != nil {\n\t\treturn uid, err\n\t}\n\tres, err := a.db.Exec(insertStmt, user.Username, hashedPwd, user.Email, time.Now())\n\tif err != nil {\n\t\treturn uid, err\n\t}\n\tlastInsertID, err := res.LastInsertId()\n\tif err != nil {\n\t\treturn uid, err\n\t}\n\tuid = int(lastInsertID)\n\treturn uid, nil\n}", "func (d UserData) HasCreateUID() bool {\n\treturn d.ModelData.Has(models.NewFieldName(\"CreateUID\", \"create_uid\"))\n}", "func (quiz *Quiz) AfterCreate(tx *gorm.DB) (err error) {\n\thash := hashUtils.GenerateHash([]uint{quiz.ID}, os.Getenv(\"QUIZZES_SALT\"))\n\ttx.Model(quiz).UpdateColumn(\"hash\", hash)\n\treturn\n}", "func (l *Loottable) BeforeSave() error {\n\treturn nil\n}", "func (v *VerificationCode) BeforeSave(tx *gorm.DB) error {\n\tv.IssuingUserIDPtr = uintPtr(v.IssuingUserID)\n\tv.IssuingAppIDPtr = uintPtr(v.IssuingAppID)\n\n\tif v.RealmID == 0 {\n\t\tv.AddError(\"realm_id\", \"is required\")\n\t}\n\n\tif len(v.IssuingExternalID) > 255 {\n\t\tv.AddError(\"issuingExternalID\", \"cannot exceed 255 characters\")\n\t}\n\n\treturn v.ErrorOrNil()\n}", "func updateTimeStampAndUUIDForCreateCallback(scope *gorm.Scope) {\n\tif !scope.HasError() {\n\t\tuserIDInterface, _ := scope.Get(\"user_id\")\n\t\tuserID, _ := userIDInterface.(int64)\n\t\tnowTime := util.GetCurrentTime()\n\t\tif createTimeField, ok := scope.FieldByName(\"CreatedTime\"); ok {\n\t\t\tif createTimeField.IsBlank {\n\t\t\t\tcreateTimeField.Set(nowTime)\n\t\t\t}\n\t\t}\n\t\tif createUserIDField, ok := scope.FieldByName(\"CreateUserID\"); ok {\n\t\t\tif createUserIDField.IsBlank {\n\t\t\t\tcreateUserIDField.Set(userID)\n\t\t\t}\n\t\t}\n\t\tif idField, ok := scope.FieldByName(\"ID\"); ok {\n\t\t\tif idField.IsBlank {\n\t\t\t\tidField.Set(util.GenerateSnowFlakeID(int64(rand.Intn(100))))\n\t\t\t}\n\t\t}\n\t\tif modifyTimeField, ok := scope.FieldByName(\"UpdatedTime\"); ok {\n\t\t\tif modifyTimeField.IsBlank {\n\t\t\t\tmodifyTimeField.Set(nowTime)\n\t\t\t}\n\t\t}\n\t\tif updateUserIDField, ok := scope.FieldByName(\"UpdateUserID\"); ok {\n\t\t\tif updateUserIDField.IsBlank {\n\t\t\t\tupdateUserIDField.Set(userID)\n\t\t\t}\n\t\t}\n\n\t\tif updateDVersionField, ok := scope.FieldByName(\"DVersion\"); ok {\n\t\t\tif updateDVersionField.IsBlank {\n\t\t\t\tupdateDVersionField.Set(uuid.NewV4().String())\n\t\t\t}\n\t\t}\n\t}\n}", "func (mmCreate *PaymentRepositoryMock) CreateBeforeCounter() uint64 {\n\treturn mm_atomic.LoadUint64(&mmCreate.beforeCreateCounter)\n}", "func (m *Middleware) MustNewUID() ksuid.KSUID {\n\tuid, err := ksuid.NewRandomWithTime(m.clock.Now())\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"failed to generate KSUID: %w\", err))\n\t}\n\treturn uid\n}", "func (mmCreateTag *TagCreatorMock) CreateTagBeforeCounter() uint64 {\n\treturn mm_atomic.LoadUint64(&mmCreateTag.beforeCreateTagCounter)\n}", "func (a *Agent) PreInsert(s gorp.SqlExecutor) error {\n\ta.Created = time.Now() // or time.Now().UnixNano()\n\ta.Updated = a.Created\n\treturn nil\n}", "func (crtEP *MdlPersonCreateExt) BeforeDB(ent interface{}) error {\n\n\t// fmt.Println(\"TypeOf ent:\", reflect.TypeOf(ent))\n\t// fmt.Println(\"ValueOf ent:\", reflect.ValueOf(ent))\n\t// p := ent.(*models.Person)\n\n\t// make changes / validate the content struct pointer (p) here\n\t// p.Name = \"A new field value\"\n\treturn nil\n}", "func (u *UserEntity) BeforeSave() error {\n\thashedPassword, err := security.Hash(u.Password)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tu.Password = string(hashedPassword)\n\treturn nil\n}", "func (term *Term) BeforeSave(tx *gorm.DB) (err error) {\n\tterm.UpdatedAt = time.Now()\n\tterm.UpdatedByID = term.CreatedByID\n\tif len(term.RelatedTerms) > 0 {\n\t\tfor index := range term.RelatedTerms {\n\t\t\tterm.RelatedTerms[index].ID = uuid.NewV4()\n\t\t\tterm.RelatedTerms[index].TermID = term.ID\n\t\t}\n\t}\n\treturn\n}", "func (p *Profile) AfterCreate(scope *gorm.Scope) (err error) {\n\tfmt.Println(\"After Create\")\n\treturn\n}", "func (h *Hook) PreInsert(s gorp.SqlExecutor) error {\n\th.CreatedAt = util.NowMilli()\n\th.UpdatedAt = h.CreatedAt\n\treturn nil\n}", "func (id *User) Create(tx *sql.Tx) error {\n\tsql := `INSERT INTO \"user\" DEFAULT VALUES RETURNING id`\n\treturn tx.QueryRow(sql).Scan(id)\n}", "func (user *User) BeforeSave(db *gorm.DB) (err error) {\n\tif user.Password != \"\" {\n\t\tif err = user.setEncryptedPassword(); err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\treturn\n}", "func (i *Item) Create() error {\n\tif len(i.UserUUID) < MinIDLength {\n\t\treturn validationError{fmt.Errorf(\"user_uuid too short\")}\n\t}\n\n\tif i.UUID == \"\" {\n\t\tid := uuid.New()\n\t\ti.UUID = uuid.Must(id, nil).String()\n\t}\n\ti.CreatedAt = time.Now().UTC()\n\ti.UpdatedAt = time.Now().UTC()\n\tlogger.LogIfDebug(\"Create:\", i.UUID)\n\treturn db.Query(\n\t\tstrings.TrimSpace(`\n\t\tINSERT INTO items (\n\t\t\tuuid, user_uuid, content, content_type, enc_item_key, auth_hash, deleted, created_at, updated_at\n\t\t) VALUES(?,?,?,?,?,?,?,?,?)`),\n\t\ti.UUID, i.UserUUID, i.Content, i.ContentType, i.EncItemKey, i.AuthHash, i.Deleted, i.CreatedAt, i.UpdatedAt,\n\t)\n}", "func (u *DBUser) BeforeSave() error {\n\tu.RawLogin = u.Login.String()\n\treturn nil\n}", "func (a *Vault) PreInsert(s gorp.SqlExecutor) error {\n\ta.Created = time.Now() // or time.Now().UnixNano()\n\ta.Updated = a.Created\n\treturn nil\n}", "func (u *User) BeforeSave() error {\n hashed, err := bcrypt.GenerateFromPassword([]byte(u.Password), bcrypt.DefaultCost)\n if err != nil {\n return err\n }\n\n u.Password = string(hashed)\n\n return nil\n}", "func (f *userFactory) MustCreate() *ent.User {\n\tu, err := f.Create()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn u\n}", "func (claim *Claim) BeforeSave(tx *gorm.DB) (e error) {\n\tif claim.ClaimantID > 0 {\n\t\tclaimant := Claimant{}\n\t\tclaimant.ID = claim.ClaimantID\n\n\t\terr := tx.Model(&Claimant{}).Where(Claimant{\n\t\t\tSpaceID: claim.SpaceID,\n\t\t}).First(&claimant).Error\n\n\t\tif err != nil {\n\t\t\treturn errors.New(\"claimant do not belong to same space\")\n\t\t}\n\t}\n\n\tif claim.RatingID > 0 {\n\t\trating := Rating{}\n\t\trating.ID = claim.RatingID\n\n\t\terr := tx.Model(&Rating{}).Where(Rating{\n\t\t\tSpaceID: claim.SpaceID,\n\t\t}).First(&rating).Error\n\n\t\tif err != nil {\n\t\t\treturn errors.New(\"rating do not belong to same space\")\n\t\t}\n\t}\n\n\treturn nil\n}", "func (a *Account) BeforeSave(tx *pop.Connection) error {\n\tnow := time.Now()\n\ta.UpdatedAt = now\n\treturn nil\n}", "func (u *User) BeforeUpdate(db orm.DB) error {\n\tu.UpdatedAt = time.Now()\n\treturn u.Validate()\n}", "func (cd *CreationDateField) InitializeCreationDate() {\n\tcd.CreationDate = common.Now()\n}", "func (r *TxRecord) PreInsert(gorp.SqlExecutor) (err error) {\n\tr.Created = time.Now().Unix()\n\treturn r.Serialize()\n}", "func AuthorizeCreate(db *gorm.DB, data *Authorize) (err error) {\n\tdata.Ctime = time.Now().Unix()\n\n\tif err = db.Create(data).Error; err != nil {\n\t\tmus.Logger.Error(\"create authorize error\", zap.Error(err))\n\t\treturn\n\t}\n\treturn\n}" ]
[ "0.84029025", "0.8310223", "0.8202489", "0.819799", "0.8183065", "0.81000215", "0.8055971", "0.8014467", "0.79928696", "0.7975748", "0.7965782", "0.795956", "0.79569185", "0.79568416", "0.7953217", "0.7938061", "0.79378754", "0.791402", "0.7910534", "0.78698087", "0.7842463", "0.78351593", "0.7765921", "0.7730602", "0.7704858", "0.76119065", "0.7567444", "0.7494032", "0.74485004", "0.7428318", "0.7360462", "0.7360462", "0.736037", "0.7338125", "0.7312855", "0.72843724", "0.7262176", "0.72483027", "0.71575356", "0.7155176", "0.70743644", "0.7055239", "0.69944614", "0.69833475", "0.6920008", "0.68865705", "0.6733889", "0.6724981", "0.67068094", "0.6632821", "0.6613621", "0.6581546", "0.6430416", "0.6391975", "0.6245633", "0.62261724", "0.62137854", "0.6157454", "0.604128", "0.59990585", "0.59116167", "0.591114", "0.58915675", "0.5872217", "0.5792955", "0.5771207", "0.57080275", "0.5664071", "0.56316704", "0.5619561", "0.5616207", "0.5551796", "0.55468", "0.5538291", "0.55321664", "0.5519715", "0.54876274", "0.54719436", "0.54615986", "0.54591936", "0.54397327", "0.5415136", "0.5406412", "0.53938454", "0.5344516", "0.53345907", "0.5330202", "0.53256994", "0.5318371", "0.530462", "0.5277208", "0.5265406", "0.5231172", "0.520772", "0.518943", "0.5180801", "0.5176343", "0.5175009", "0.5158403", "0.5150142" ]
0.7810695
22
ShareFileName returns a meaningful file name useful for sharing.
func (m *File) ShareFileName() string { photo := m.RelatedPhoto() if photo == nil { return fmt.Sprintf("%s.%s", m.FileHash, m.FileType) } else if len(m.FileHash) < 8 { return fmt.Sprintf("%s.%s", rnd.UUID(), m.FileType) } else if photo.TakenAtLocal.IsZero() || photo.PhotoTitle == "" { return fmt.Sprintf("%s.%s", m.FileHash, m.FileType) } name := strings.Title(slug.MakeLang(photo.PhotoTitle, "en")) taken := photo.TakenAtLocal.Format("20060102-150405") token := rnd.Token(3) result := fmt.Sprintf("%s-%s-%s.%s", taken, name, token, m.FileType) return result }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o GroupContainerVolumeOutput) ShareName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v GroupContainerVolume) *string { return v.ShareName }).(pulumi.StringPtrOutput)\n}", "func (o GroupInitContainerVolumeOutput) ShareName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v GroupInitContainerVolume) *string { return v.ShareName }).(pulumi.StringPtrOutput)\n}", "func ShareWith(name string) string {\n\tif strings.TrimSpace(name) == \"\" {\n\t\treturn \"One for you, one for me.\"\n\t}\n\t//return \"One for \" + name + \", one for me.\"\n\treturn fmt.Sprintf(\"One for %s, one for me.\", name)\n\n}", "func ShareWith(name string) string {\n\n\tif name == \"\" {\n\t\treturn \"One for you, one for me.\"\n\t} else {\n\t\treturn fmt.Sprintf(\"One for %v, one for me.\", name)\n\t}\n}", "func ShareWith(name string) string {\n\tif name == \"\" {\n\t\treturn \"One for you, one for me.\"\n\t}\n\treturn \"One for \" + name + \", one for me.\"\n}", "func ShareWith(name string) string {\n\n\ttwo_for_one := \"\"\n\tif len(name) == 0 {\n\t\ttwo_for_one = \"One for you, one for me.\"\n\t} else {\n\t\ttwo_for_one = fmt.Sprintf(\"One for %s, one for me.\", name)\n\t}\n\treturn two_for_one\n}", "func ShareWith(name string) string {\n\tif name != \"\" {\n\t\treturn \"One for \" + name + \", one for me.\"\n\t}\n\treturn \"One for you, one for me.\"\n}", "func ShareWith(name string) string {\n\tif len(strings.TrimSpace(name)) == 0 {\n\t\tname = \"you\"\n\t}\n\treturn \"One for \" + name + \", one for me.\"\n}", "func ShareWith(name string) string {\n\tif name == \"\" || !unicode.IsLetter([]rune(name)[0]) {\n\t\tname = \"you\"\n\t}\n\n\treturn fmt.Sprintf(\"One for %s, one for me.\", name)\n}", "func (o PolicyFileShareOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *PolicyFileShare) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)\n}", "func (userdata *User) ShareFile(filename string, recipient string) (\n\tmagic_string string, err error) {\n\t//initialize the \"sender string\" for sharing record\n\tsender := userdata.Username\n\trecipPublic, exists := userlib.KeystoreGet(recipient + \"PK\")\n\tif exists != true {\n\t\treturn \"\", errors.New(\"recipient does not exist\")\n\t}\n\tvar recordUuid userlib.UUID\n\tstillShared := userdata.stillShared(filename)\n\t//encryption key for sharing record, to share to recipient through accesstruct\n\tvar eKey []byte\n\tvar User_HMAC []byte\n\t//if the user has stored the file themself:\n\t//pull the user's fileKeys for specific filename\n\tif fileKeys, ok := userdata.Files[filename]; ok {\n\t\t//pull the user's filestruct encryption key from file's fileKeys struct\n\t\tplainkey := fileKeys.EKey\n\n\t\t//get data location from fileKeys\n\t\tfilelocation := fileKeys.FileStruct\n\n\t\t//get hmac from fileKeys\n\t\thmacKey := fileKeys.HMACKey\n\n\t\t//create and populate the sharing record with its arguments\n\t\tvar record SharingRecord\n\t\trecord.Datalocation = filelocation\n\t\trecord.Ekey = plainkey\n\t\trecord.Sender = sender\n\t\tsalt2 := userlib.Hash([]byte(filename + userdata.Password + userdata.Username))\n\t\tHashKey := userlib.Argon2Key([]byte(userdata.Password), salt2[:16], uint32(userlib.AESKeySize))\n\t\trecord.HmacKey = HashKey\n\t\trecord.Hmac = hmacKey\n\n\t\t//checks if file is tampered with before sharing\n\t\tvar storedFileStruct Stored\n\t\tstoredfileCheck, _ := userlib.DatastoreGet(filelocation)\n\t\tjson.Unmarshal(storedfileCheck, storedFileStruct)\n\t\tHmacStored, _ := userlib.HMACEval(HashKey, storedFileStruct.EncryptedM)\n\t\tif userlib.HMACEqual(HmacStored, storedFileStruct.HMAC) {\n\t\t\treturn \"\", errors.New(\"file has been tampered with\")\n\n\t\t}\n\n\t\t//symmetrically encrypt sharingRecord with randomly generated key\n\t\t//first marshal then pad record struct\n\t\tmarshRecord, _ := json.Marshal(record)\n\t\tmarshRecord = padFile(marshRecord)\n\t\t//generate IV\n\t\tIV := userlib.RandomBytes(userlib.AESKeySize)\n\t\t//generate key for Symmetric encryption\n\t\tsalt := userlib.Hash([]byte(userdata.Password + userdata.Username))\n\t\tencryptionKey := userlib.Argon2Key([]byte(userdata.Password), salt[:16], uint32(userlib.AESKeySize))\n\t\t//encrypt the user struct\n\t\tencryptedMessage := userlib.SymEnc(encryptionKey, IV, marshRecord)\n\t\t//Get the HMAC key\n\t\thashKey := userlib.Argon2Key([]byte(userdata.Password), salt[16:], uint32(userlib.AESKeySize))\n\t\tUser_HMAC, _ = userlib.HMACEval(hashKey, []byte(encryptedMessage))\n\n\t\tstoredRecord := Stored{User_HMAC, encryptedMessage}\n\t\tmarshStoredrecord, _ := json.Marshal(storedRecord)\n\n\t\t//store signed/marshalled/encrypted sharing record in the datastore at a random uuid\n\t\trecordUuid = uuid.New()\n\t\tuserlib.DatastoreSet(recordUuid, marshStoredrecord)\n\n\t\tuserdata.RecordKeys[filename + recipient] = encryptionKey\n\n\t\teKey = encryptionKey\n\n\t\t//else if the user has received the file from someone else and user still has access to the file they received\n\t} else if senderAccess, ok := userdata.ReceivedFiles[filename]; ok && stillShared {\n\t\t//share the same sharing record sender uses with the recipient (when sender access gets revoked, so does recipient's)\n\t\trecordUuid = senderAccess.Recordlocation\n\t\teKey = senderAccess.Key\n\t\tUser_HMAC = senderAccess.RecordHMAC\n\t\t//if sender doesn't have access to the file, this should be untested behavior\n\t} else if ok {\n\t\t//delete the accessStruct for sender's file because senders access to the file is gone, no point in having an access struct for it\n\t\tdelete(userdata.ReceivedFiles, filename)\n\t\tstillShared = false\n\t\treturn \"\", errors.New(\"the sender no longer has the file in question\")\n\t} else {\n\t\treturn \"\", errors.New(\"the sender does not have the file in question\")\n\t}\n\n\t//set pointer to the new sharing record in the user's userdata\n\tuserdata.SharedFiles[filename + recipient] = recordUuid\n\n\t//create accessRecord with necessary info to point to sharingRecord, properly encrypt/format as a magic_string, then return this magic_string\n\tvar access AccessRecord\n\taccess.Key = eKey\n\taccess.Recordlocation = recordUuid\n\taccess.RecordHMAC = User_HMAC\n\tmarshAccess, _ := json.Marshal(access)\n\n\tcipherAccess, _ := userlib.PKEEnc(recipPublic, marshAccess[:len(marshAccess)/2])\n\tcipherAccess2, _ := userlib.PKEEnc(recipPublic, marshAccess[len(marshAccess)/2:])\n\n\n\taccessSig, _ := userlib.DSSign(userdata.DS, marshAccess)\n\tsignedAccess := Signed{accessSig, cipherAccess, cipherAccess2}\n\n\tmarshSignedaccess, _ := json.Marshal(signedAccess)\n\n\tmagic_string = hex.EncodeToString(marshSignedaccess)\n\n\treturn magic_string, nil\n}", "func ShareWith(name string) string {\n\tif name == \"\" {\n\t\tname = \"you\"\n\t}\n\n\treturn \"One for \" + name + \", one for me.\"\n}", "func ShareWith(name string) string {\n\tif name == \"\" {\n\t\tname = \"you\"\n\t}\n\treturn \"One for \" + name + \", one for me.\"\n}", "func ShareWith(name string) string {\n\tif name == \"\" {\n\t\tname = \"you\"\n\t}\n\treturn \"One for \" + name + \", one for me.\"\n}", "func ShareWith(name string) string {\n\tif name == \"\" {\n\t\tname = \"you\"\n\t}\n\treturn \"One for \" + name + \", one for me.\"\n}", "func ShareWith(n string) string {\n\tname := n\n\tif name == \"\" {\n\t\tname = \"you\"\n\t}\n\n\treturn fmt.Sprintf(\"One for %s, one for me.\", name)\n}", "func ShareWith(name string) string {\n\tmessage := \"One for %s, one for me.\"\n\n\treturn fmt.Sprintf(message, Addressed(name))\n}", "func ShareWith(name string) string {\n\tif name == \"\" {\n\t\tname = \"you\"\n\t}\n\treturn fmt.Sprintf(\"One for %s, one for me.\", name)\n}", "func ShareWith(name string) string {\n\tif name == \"\" {\n\t\tname = \"you\"\n\t}\n\treturn fmt.Sprintf(\"One for %s, one for me.\", name)\n}", "func ShareWith(name string) string {\n\tif name == \"\" {\n\t\tname = \"you\"\n\t}\n\treturn fmt.Sprintf(\"One for %s, one for me.\", name)\n}", "func ShareWith(name string) string {\n\tif name == \"\" {\n\t\tname = \"you\"\n\t}\n\n\treturn fmt.Sprintf(\"One for %s, one for me.\", name)\n}", "func ShareWith(name string) string {\n\tif name == \"\" {\n\t\tname = \"you\"\n\t}\n\n\treturn fmt.Sprintf(\"One for %s, one for me.\", name)\n}", "func getCanonicalName(account string, shareName string, filePath string) string {\n\t// Share: \"/file/account/sharename\"\n\t// File: \"/file/account/sharename/filename\"\n\t// File: \"/file/account/sharename/directoryname/filename\"\n\telements := []string{\"/file/\", account, \"/\", shareName}\n\tif filePath != \"\" {\n\t\tdfp := strings.Replace(filePath, \"\\\\\", \"/\", -1)\n\t\tif dfp[0] == '/' {\n\t\t\tdfp = dfp[1:]\n\t\t}\n\t\telements = append(elements, \"/\", dfp)\n\t}\n\treturn strings.Join(elements, \"\")\n}", "func ShareWith(name string) string {\n\tvar who string\n\tif len(name) > 0 {\n\t\twho = name\n\t} else {\n\t\twho = \"you\"\n\t}\n\treturn fmt.Sprintf(\"One for %s, one for me.\", who)\n}", "func (o ShareOutput) ShareId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Share) pulumi.StringOutput { return v.ShareId }).(pulumi.StringOutput)\n}", "func (o ShareOutput) MountName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Share) pulumi.StringOutput { return v.MountName }).(pulumi.StringOutput)\n}", "func ShareWith(name string) string {\n\n\tif name == \"\" {\n\t\tname = \"you\"\n\t}\n\treturn start + name + end\n\n}", "func (fs FileStorageSettings) FileName() string {\n\tpath := \"\"\n\tif fs.Type == FileStorageTypeLocal {\n\t\tpath = fs.Local.Path\n\t} else if fs.Type == FileStorageTypeS3 {\n\t\tpath = fs.S3.Key\n\t}\n\treturn filepath.Base(path)\n}", "func ShareWith(name string) string {\n\t// assign name the value \"you\" if string is empty.\n\tif name == \"\" {\n\t\tname = \"you\"\n\t}\n\t// concat the massage\n\treturn fmt.Sprintf(\"One for %s, one for me.\", name)\n\t\n}", "func (c *Client) Share(path string, username string, write bool) (err error) {\n\tvar ret string\n\terr = c.server.Call(\"share\", &ret, path, username, write, c.session)\n\tif err != nil {\n\t\treturn client.MakeFatalError(err)\n\t}\n\tif ret != \"\" {\n\t\treturn fmt.Errorf(ret)\n\t}\n\treturn nil\n}", "func (userdata *User) ShareFile(filename string, recipient string) (\r\n\taccessToken uuid.UUID, err error) {\r\n\tpublic_key, valid := userlib.KeystoreGet(recipient)\r\n\r\n\tif !valid {\r\n\t\treturn uuid.Nil, errors.New(\"invalid recipient\")\r\n\t}\r\n\r\n\tuser_files := userdata.Files[filename]\r\n\taccess_token := append(user_files.Encrypt_Key, user_files.HMAC_Key...)\r\n\t// fmt.Print(\"Access Token #1: \")\r\n\t// fmt.Println(access_token)\r\n\t// fmt.Print(\"Share File HMAC Key: \")\r\n\t// fmt.Println(user_files.HMAC_Key)\r\n\tcipher_text, _ := userlib.PKEEnc(public_key, access_token)\r\n\tsignature, _ := userlib.DSSign(userdata.RSA_Secret_Key, cipher_text)\r\n\tinvitation := ShareInvitation{signature, cipher_text, user_files.Meta_Data_Location}\r\n\r\n\tmarhsal_invitation, _ := json.Marshal(invitation)\r\n\taccessToken = uuid.New()\r\n\tuserlib.DatastoreSet(accessToken, marhsal_invitation)\r\n\r\n\treturn accessToken, err\r\n}", "func (o DatastoreFileshareOutput) Name() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *DatastoreFileshare) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)\n}", "func ShareWith(you string) string {\r\n\tif len(you) == 0 {\r\n\t\tyou = \"you\"\r\n\t}\r\n\treturn fmt.Sprintf(\"One for %v, one for me.\", you)\r\n}", "func shortFileName(file string) string {\n\treturn filepath.Base(file)\n}", "func createUniqueFileName() string {\n\n\t// Get a timestamp\n\ttv := syscall.Timeval{}\n\tsyscall.Gettimeofday(&tv)\n\tleft := fmt.Sprintf(\"%d.%d\", tv.Sec, tv.Usec)\n\n\t// Just generate a random number for now\n\tb := make([]byte, 16)\n\trand.Read(b)\n\tmiddle := fmt.Sprintf(\"%x\", b)\n\n\t// The right dot should be the hostname\n\tright, _ := os.Hostname()\n\n\t// Put the pieces together\n\tcombined := []string{left, middle, right}\n\treturn strings.Join(combined, \".\")\n}", "func ShareWith(s string) string {\n\tif s == \"\" {\n\t\ts = \"you\"\n\t}\n\n\treturn strings.Join([]string{\"One for \", s, \", one for me.\"}, \"\")\n}", "func ShareWith(person string) string {\n\tif person == \"\" {\n\t\tperson = \"you\"\n\t}\n\n\treturn \"One for \" + person + \", one for me.\"\n}", "func ShareWith(person string) string {\n\n if person == \"\" {\n person = \"you\"\n }\n\n\treturn fmt.Sprintf(\"One for %s, one for me.\", person)\n}", "func shareID(account string, createdOn int64) string {\n\tvar buf bytes.Buffer\n\t_, _ = buf.WriteString(hex.EncodeToString(nanoToBigEndianBytes(createdOn)))\n\t_, _ = buf.WriteString(account)\n\treturn buf.String()\n}", "func (o DatastoreFileshareOutput) StorageFileshareId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *DatastoreFileshare) pulumi.StringOutput { return v.StorageFileshareId }).(pulumi.StringOutput)\n}", "func (s *CreateShareOutput) SetShareName(v string) *CreateShareOutput {\n\ts.ShareName = &v\n\treturn s\n}", "func ManifestFileName(fileNumber table.FileNumber) string {\n\treturn fmt.Sprintf(\"%s%06d\", ManifestPrefix, fileNumber)\n}", "func (c *CacheHandle) FileName() string {\n\treturn c.Digest + \".\" + c.Type\n}", "func ShareWith(name string) string {\n\tif name == \"\" {\n\t\tname = \"you\"\n\t}\n\t// Write some code here to pass the test suite.\n\t// Then remove all the stock comments.\n\t// They're here to help you get started but they only clutter a finished solution.\n\t// If you leave them in, reviewers may protest!\n\treturn fmt.Sprintf(\"One for %s, one for me.\", name)\n}", "func (gb *CurrentGrantBuilder) Share(n string) GrantExecutable {\n\treturn &CurrentGrantExecutable{\n\t\tgrantName: gb.qualifiedName,\n\t\tgrantType: gb.grantType,\n\t\tgranteeName: n,\n\t\tgranteeType: shareType,\n\t}\n}", "func (util copyHandlerUtil) stripSASFromFileShareUrl(fileUrl url.URL) *url.URL {\n\tfuParts := azfile.NewFileURLParts(fileUrl)\n\tfuParts.SAS = azfile.SASQueryParameters{}\n\tfUrl := fuParts.URL()\n\treturn &fUrl\n}", "func (s *SubscriberResource) SetResourceShareName(v string) *SubscriberResource {\n\ts.ResourceShareName = &v\n\treturn s\n}", "func FileName(filename string) string {\n\t_, filename = filepath.Split(filename)\n\n\treturn filename\n}", "func FileName(name string) string {\n\treturn ReplaceExt(filepath.Base(name), \"\")\n}", "func (s *Single) Filename() string {\n\tif len(Lockfile) > 0 {\n\t\treturn Lockfile\n\t}\n\treturn filepath.Join(os.TempDir(), fmt.Sprintf(\"%s.lock\", s.name))\n}", "func ExampleShareURL() {\n\t// From the Azure portal, get your Storage account file service URL endpoint.\n\taccountName, accountKey := accountInfo()\n\n\t// Create a ShareURL object that wraps a soon-to-be-created share's URL and a default pipeline.\n\tu, _ := url.Parse(fmt.Sprintf(\"https://%s.file.core.windows.net/mysharegeneral\", accountName))\n\tcredential, err := azfile.NewSharedKeyCredential(accountName, accountKey)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tshareURL := azfile.NewShareURL(*u, azfile.NewPipeline(credential, azfile.PipelineOptions{}))\n\n\tctx := context.Background() // This example uses a never-expiring context\n\n\t// Create a share with some metadata (string key/value pairs) and default quota.\n\t// NOTE: Metadata key names are always converted to lowercase before being sent to the Storage Service.\n\t// Therefore, you should always use lowercase letters; especially when querying a map for a metadata key.\n\t_, err = shareURL.Create(ctx, azfile.Metadata{\"createdby\": \"Jeffrey&Jiachen\"}, 0)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// Query the share's metadata\n\tget, err := shareURL.GetProperties(ctx)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// Show the share's metadata\n\tmetadata := get.NewMetadata()\n\tfor k, v := range metadata {\n\t\tfmt.Print(k + \"=\" + v + \"\\n\")\n\t}\n\n\t// Update the metadata and write it back to the share\n\tmetadata[\"updateby\"] = \"Jiachen\" // NOTE: The keyname is in all lowercase letters\n\t_, err = shareURL.SetMetadata(ctx, metadata)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// NOTE: The SetMetadata & SetQuota methods update the share's ETag & LastModified properties\n\n\t// Delete the share\n\t_, err = shareURL.Delete(ctx, azfile.DeleteSnapshotsOptionNone)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// Output:\n\t// createdby=Jeffrey&Jiachen\n}", "func GetFileName(file *multipart.FileHeader) (newFileName string, err error) {\n\treturn strconv.Itoa(int(time.Now().Unix())) + file.Filename, nil\n}", "func (rf *HTTPResFile) FileName() string {\n\treturn filepath.Base(rf.path)\n}", "func (s *ShareDetails) SetShareName(v string) *ShareDetails {\n\ts.ShareName = &v\n\treturn s\n}", "func (o EventHubOutputDataSourceOutput) SharedAccessPolicyName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v EventHubOutputDataSource) *string { return v.SharedAccessPolicyName }).(pulumi.StringPtrOutput)\n}", "func (o EventHubV2OutputDataSourceOutput) SharedAccessPolicyName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v EventHubV2OutputDataSource) *string { return v.SharedAccessPolicyName }).(pulumi.StringPtrOutput)\n}", "func (a *Response) FileName() string {\r\n\t_, file := filepath.Split(a.filePath)\r\n\treturn file\r\n}", "func (d *DirEntry) FileName() string {\n\tcpointer := (*C.char)(unsafe.Pointer(&d.fileName[0]))\n\tclength := C.int(d.FileNameSize)\n\tfileName := C.GoStringN(cpointer, clength)\n\treturn fileName\n}", "func (s *CreateShareInput) SetShareName(v string) *CreateShareInput {\n\ts.ShareName = &v\n\treturn s\n}", "func (userdata *User) ShareFile(filename string, recipient string) (\n\tmsgid string, err error) {\n\t\n\t\n\t////////////////// Loading The file //////////////////////////\n\n\n\tvar Mapping UserFile\n\tvar Share UserFile\n\n // Generating address and key for UserFile pair\n\tAddr,E := UserFileCredentials(userdata.Username,userdata.Password,filename)\t\n\tuserlib.DebugMsg(\"SHARE: User %v File %v stored at Addr=%v E=%v\",userdata.Username,filename,Addr,E)\n\n\t//Fetching Encrypted UserFile structure from memory\n\tciphertext,valid := userlib.DatastoreGet(Addr)\n\tif(!valid){\n\t\terr3 := errors.New(strings.ToTitle(\"No such file\"))\n\t\treturn msgid,err3\n\t}\n\n\t//Decrypting UserFileData\n\tplaintext,err10 := decryptAES(ciphertext, E)\n\tif(err10!=nil) {\n\t\treturn msgid,err10\n\t}\n\n\terr3 := json.Unmarshal(plaintext,&Mapping)\n\n\tif(err!=nil){\n\t\treturn msgid,err\n\t}\n\n\t//////Verifying HMAC\n\tvar temp UserFile\n\ttemp.Location=Mapping.Location\n\ttemp.Key=Mapping.Key\n\n\tstr,_ := json.Marshal(temp)\n\n\thmac := userlib.NewHMAC(E)\n\thmac.Write([]byte(str))\n\ttemp.Hmac=hmac.Sum(nil)\n\n\tif !userlib.Equal(temp.Hmac, Mapping.Hmac) {\n\t\terr3 = errors.New(strings.ToTitle(\"UserFile record corrupted by server.\"))\n\t\tuserlib.DebugMsg(\"%v\",err3)\n\t\treturn msgid,err3\n\t}\n\n\t//Fetching Sender's and recipient's Keys\n\tKey := userdata.RSAKey\n\tReceiverKey,valid := userlib.KeystoreGet(recipient) \n\tif(!valid){\n\t\treturn msgid,errors.New(strings.ToTitle(\"Recipient not found\"))\n\t}\n\n\t/////////////////////////////////////////////////////////////////////////////////////////\n\t// Storing sharing information\n\t/////////////////////////////////////////////////////////////////////////////////////////\n\n\tseed1 := uuid.New().String()\n\tseed2 := uuid.New().String()\n\tseed3 := uuid.New().String() \n\n // Generating address and key for record containing sharing information\n\tRecordLocation := getAddress([]byte(seed1))\n\tE1 :=[]rune(string(userlib.Argon2Key([]byte(seed2),[]byte(seed3),16)))\n\tuserlib.DebugMsg(\"SHARE: Sharing Record stored at Addr=%v E=%v\",RecordLocation,E1)\n\n\t// Populating sharingRecord (message to be sent)\n\tvar Data sharingRecord \n\t//Data.Location = RecordLocation\n\tData.Seed1 = seed1\n\tData.Seed2 = seed2\n\tData.Seed3 = seed3\n\n\t// Populating Share\n\tShare.Location = Mapping.Location\n\tShare.Key=Mapping.Key\n\tstr1,_ := json.Marshal(Share)\n\n\thmac1 := userlib.NewHMAC([]byte(string(E1)))\n\thmac1.Write([]byte(str1))\n\tShare.Hmac=hmac1.Sum(nil)\n\n\t//Marshalling FileData structure\n\tstr3,_ := json.Marshal(Share)\n\n\t//Encrypting FileData structure with E1\n\tciphertext3 := encryptAES([]byte(str3), []byte(string(E1))[:16]) \n\n\t// Storing encrypted FileData structure at Addr1\n\tuserlib.DebugMsg(\"Stored at %v is %v\",RecordLocation,ciphertext3)\n\tuserlib.DatastoreSet(RecordLocation,ciphertext3)\n\n\t//Encrypting with recipient's public key\n\tstr2,_ := json.Marshal(Data)\n\tencrypted,err := userlib.RSAEncrypt(&ReceiverKey,str2,nil)\n\tif(err!=nil){\n\t\treturn msgid,err\n\t}\n\n\t//RSA signing\n\tsign, err := userlib.RSASign(Key, str2)\n\tif err != nil {\n\t\treturn msgid,err\n\t}\n\t\n\tmsgid = string(encrypted)\n\n\tuserlib.DatastoreSet(getAddress(encrypted),sign)\n\n\treturn msgid,nil\n}", "func (o StreamInputIotHubOutput) SharedAccessPolicyName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *StreamInputIotHub) pulumi.StringOutput { return v.SharedAccessPolicyName }).(pulumi.StringOutput)\n}", "func fileName(part *multipart.Part) string {\n\tfilename := part.FileName()\n\tif escaped, err := url.QueryUnescape(filename); err == nil {\n\t\tfilename = escaped\n\t} // if there is a unescape error, just treat the name as unescaped\n\n\treturn path.Clean(\"/\" + filename)\n}", "func (p *Post) GetFileName() string {\n\ttimeStamp, _ := time.Parse(time.RubyDate, p.CreatedAt)\n\treturn fmt.Sprintf(\"%d-%s-%dx%d.%s\", timeStamp.Unix(), p.Id, p.Width, p.Height, getFileExt(p.FileURL))\n}", "func StatsAggregatorHandleSharedName(value string) StatsAggregatorHandleAttr {\n\treturn func(m optionalAttr) {\n\t\tm[\"shared_name\"] = value\n\t}\n}", "func FileName(filename string) string {\n\treturn strings.TrimSuffix(filename, filepath.Ext(filename))\n}", "func ShareFromString(share string) (Share, bool) {\n\tswitch share {\n\tcase \"inGame\":\n\t\treturn ShareInGame, true\n\tcase \"private\":\n\t\treturn SharePrivate, true\n\tdefault:\n\t\treturn ShareInGame, false\n\t}\n}", "func sanitizedName(filename string) string {\n\tif len(filename) > 1 && filename[1] == ':' &&\n\t\truntime.GOOS == \"windows\" {\n\t\tfilename = filename[2:]\n\t}\n\tfilename = filepath.ToSlash(filename)\n\tfilename = strings.TrimLeft(filename, \"/.\")\n\treturn strings.Replace(filename, \"../\", \"\", -1)\n}", "func (cache *FileCache) GetFileName(key string) string {\n\tpath := filepath.Join(cache.dir, key)\n\tif _, err := os.Stat(path); os.IsNotExist(err) {\n\t\treturn \"\"\n\t}\n\tif abs, err := filepath.Abs(path); err == nil {\n\t\treturn abs\n\t}\n\treturn \"\"\n}", "func NewFileShare(ctx *pulumi.Context,\n\tname string, args *FileShareArgs, opts ...pulumi.ResourceOption) (*FileShare, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.AccountName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'AccountName'\")\n\t}\n\tif args.ResourceGroupName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ResourceGroupName'\")\n\t}\n\taliases := pulumi.Aliases([]pulumi.Alias{\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:storage/v20210201:FileShare\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:storage:FileShare\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:storage:FileShare\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:storage/v20190401:FileShare\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:storage/v20190401:FileShare\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:storage/v20190601:FileShare\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:storage/v20190601:FileShare\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:storage/v20200801preview:FileShare\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:storage/v20200801preview:FileShare\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:storage/v20210101:FileShare\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:storage/v20210101:FileShare\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-native:storage/v20210401:FileShare\"),\n\t\t},\n\t\t{\n\t\t\tType: pulumi.String(\"azure-nextgen:storage/v20210401:FileShare\"),\n\t\t},\n\t})\n\topts = append(opts, aliases)\n\tvar resource FileShare\n\terr := ctx.RegisterResource(\"azure-native:storage/v20210201:FileShare\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (userdata *User) ShareFile(filename string, recipient string) (\r\n\taccessToken uuid.UUID, err error) {\r\n\tvar shareInvite ShareInvite\r\n\tvar fileKeyMeta FileKeyMeta\r\n\t//IMPLEMENT SHAREDUSERS AND USERTOKENS in FILEKEYSTRUCT\r\n\r\n\t//check is file exists in users file space\r\n\tupdatedUser, err := GetLatestUser(userdata.UUID_, userdata.PasswordHash, userdata.HMACKey, userdata.EncKey)\r\n\tif err != nil {\r\n\t\treturn uuid.Nil, errors.New(\"Failed to retrieve latest user info.\")\r\n\t}\r\n\r\n\tvar fk FileKey\r\n\tfileKey, fileFound := updatedUser.Filespace[filename]\r\n\r\n\tif !fileFound {\r\n\t\treturn uuid.Nil, errors.New(\"File does not exist in caller's personal filespace.\")\r\n\t}\r\n\r\n\t//what if this person is sharing a shared file? check access token!\r\n\t_, own := updatedUser.FilesOwned[filename]\r\n\tif !own { //this is just in case a revocation has happened and the fileKey data has changed\r\n\t\tat := userdata.AccessTokens[filename]\r\n\t\tfk, err = updatedUser.RetrieveAccessToken(at)\r\n\t\tif err != nil {\r\n\t\t\treturn uuid.Nil, errors.New(\"Failed to retrieve access token.\")\r\n\t\t}\r\n\t} else { //just in case fileKey data has changed from a recent session\r\n\t\tcurrFileKey, _ := userlib.DatastoreGet(fileKey.KeyId)\r\n\t\tlen_data := len(currFileKey) - userlib.HashSizeBytes\r\n\r\n\t\tif len_data < 0 || len_data > len(currFileKey) || len(currFileKey[:len_data]) < userlib.HashSizeBytes {\r\n\t\t\t//automatically return error, file has been changed\r\n\t\t\treturn uuid.Nil, errors.New(\"FileKey data length has changed.\")\r\n\t\t}\r\n\t\t//verify integrity of both fileKey struct and the file itself\r\n\t\tcomputedMac, _ := userlib.HMACEval(fileKey.HMAC_key, currFileKey[:len_data])\r\n\t\tif !userlib.HMACEqual(computedMac, currFileKey[len_data:]) {\r\n\t\t\treturn uuid.Nil, errors.New(\"File key struct has been tampered with in Datastore.\")\r\n\t\t}\r\n\t\t//decrypt + depad fileKey from DS to current fileKey var (overwrite)\r\n\t\tdecrypt := userlib.SymDec(fileKey.Enc_key, currFileKey[:len_data])\r\n\t\tdecrypt = PKCS(decrypt, \"remove\")\r\n\r\n\t\terr = json.Unmarshal(decrypt, &fk)\r\n\t\tif err != nil {\r\n\t\t\treturn uuid.Nil, errors.New(\"Error demarshaling.\")\r\n\t\t}\r\n\t}\r\n\r\n\t//check if recipient exists\r\n\tpubKey, userFound := userlib.KeystoreGet(recipient + \"public_key\")\r\n\tif !userFound {\r\n\t\treturn uuid.Nil, errors.New(\"Recepient not found.\")\r\n\t}\r\n\r\n\t//populate Shareinvite and FileKeyMeta struct\r\n\tfileKeyMeta.DSid = fk.KeyId\r\n\tfileKeyMeta.HMACkey = fk.HMAC_key\r\n\tfileKeyMeta.ENCkey = fk.Enc_key\r\n\r\n\tfkm_json, _ := json.Marshal(fileKeyMeta)\r\n\t//encrypt FileKeyMeta using RSA\r\n\tfileKeyMeta_enc, _ := userlib.PKEEnc(pubKey, fkm_json) //dont need to pad?\r\n\r\n\t//Marshal the fileKeyMeta info\r\n\tshareInvite.RSAFileKey = fileKeyMeta_enc\r\n\t//msg for signature is the RSA encrypted, MARSHALED FileMetaKey struct\r\n\tshareInvite.Signature, _ = userlib.DSSign(userdata.PrivSignKey, shareInvite.RSAFileKey)\r\n\tshareInvite.Sender = updatedUser.Username\r\n\tshareInvite_json, _ := json.Marshal(shareInvite)\r\n\r\n\taccessToken = uuid.New() //generate random accessToken\r\n\tuserlib.DatastoreSet(accessToken, shareInvite_json)\r\n\r\n\t//update SharedUsers and UserTokens fields in fileKey\r\n\t//if they are a DIRECT sharer (meaning theyre one level below owner) generate key\r\n\t//and put recipient in their list\r\n\t//else, put them under the direct sharer from their lineage\r\n\tfk.UserTokens[recipient] = accessToken //update user tokens for possible revoking later\r\n\tlist, direct_user := fk.SharedUsers[updatedUser.Username] //should return true if user is a key\r\n\tif own {\r\n\t\tvar emptyList []string\r\n\t\tfk.SharedUsers[recipient] = emptyList\r\n\t} else if direct_user {\r\n\t\tlist = append(list, recipient) //add recipient to direct sharer's list\r\n\t\tfk.SharedUsers[recipient] = list\r\n\t} else { //indirect user case, iterate over map of shared users\r\n\t\tvar originalSharer string\r\n\t\t//provides each key and respective value\r\n\t\tfor directSharer, listShared := range fk.SharedUsers {\r\n\t\t\tfor _, indirectSharer := range listShared {\r\n\t\t\t\tif updatedUser.Username == indirectSharer {\r\n\t\t\t\t\toriginalSharer = directSharer\r\n\t\t\t\t\tbreak\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif originalSharer != \"\" {\r\n\t\t\t\tbreak //break out of second for loop if you've found the original sharer\r\n\t\t\t}\r\n\t\t}\r\n\t\tif originalSharer == \"\" {\r\n\t\t\treturn uuid.Nil, errors.New(\"User is not owner but could not find who shared file with them.\")\r\n\t\t}\r\n\t\tlist = append(list, recipient)\r\n\t\tfk.SharedUsers[originalSharer] = list //add the recipient of this indirect user to list\r\n\t}\r\n\t//Now lets send the updated fileKey to the Datastore\r\n\tfileKey_json, _ := json.Marshal(fk)\r\n\tfk_IV := userlib.RandomBytes(userlib.AESBlockSizeBytes)\r\n\tfileKey_enc := userlib.SymEnc(fk.Enc_key, fk_IV, PKCS(fileKey_json, \"add\"))\r\n\t//Add HMACs for both file key and file elem struct (runtime corresponds to size of appended file, nothing else)\r\n\tfk_hmac, _ := userlib.HMACEval(fk.HMAC_key, fileKey_enc)\r\n\tfileKey_enc = append(fileKey_enc, fk_hmac...)\r\n\tuserlib.DatastoreSet(fileKey.KeyId, fileKey_enc)\r\n\r\n\treturn accessToken, nil\r\n}", "func WholeFileReaderV2SharedName(value string) WholeFileReaderV2Attr {\n\treturn func(m optionalAttr) {\n\t\tm[\"shared_name\"] = value\n\t}\n}", "func (o EventHubStreamInputDataSourceOutput) SharedAccessPolicyName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v EventHubStreamInputDataSource) *string { return v.SharedAccessPolicyName }).(pulumi.StringPtrOutput)\n}", "func (cs *ControllerServer) getVolumeSharePath(vol *nfsVolume) string {\n\treturn filepath.Join(string(filepath.Separator), vol.baseDir, vol.subDir)\n}", "func (o ServiceBusTopicOutputDataSourceOutput) SharedAccessPolicyName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ServiceBusTopicOutputDataSource) *string { return v.SharedAccessPolicyName }).(pulumi.StringPtrOutput)\n}", "func StageSharedName(value string) StageAttr {\n\treturn func(m optionalAttr) {\n\t\tm[\"shared_name\"] = value\n\t}\n}", "func (o EventHubV2StreamInputDataSourceOutput) SharedAccessPolicyName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v EventHubV2StreamInputDataSource) *string { return v.SharedAccessPolicyName }).(pulumi.StringPtrOutput)\n}", "func (o EventHubOutputDataSourceResponseOutput) SharedAccessPolicyName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v EventHubOutputDataSourceResponse) *string { return v.SharedAccessPolicyName }).(pulumi.StringPtrOutput)\n}", "func ShareFiles(w http.ResponseWriter, r *http.Request) {\n\t//log\n\tnow, userIP := globalPkg.SetLogObj(r)\n\tlogobj := logpkg.LogStruct{\"_\", now, userIP, \"macAdress\", \"ShareFiles\", \"file\", \"_\", \"_\", \"_\", 0}\n\tvar ShareFiledataObj ShareFiledata\n\tdecoder := json.NewDecoder(r.Body)\n\tdecoder.DisallowUnknownFields()\n\terr := decoder.Decode(&ShareFiledataObj)\n\tif err != nil {\n\t\tglobalPkg.SendError(w, \"please enter your correct request\")\n\t\tglobalPkg.WriteLog(logobj, \"please enter your correct request\", \"failed\")\n\t\treturn\n\t}\n\ttime.Sleep(time.Millisecond * 10) // for handle unknown issue\n\taccountObj := account.GetAccountByAccountPubicKey(ShareFiledataObj.Publickey)\n\tif accountObj.AccountPublicKey != ShareFiledataObj.Publickey {\n\t\tglobalPkg.SendError(w, \"error in public key\")\n\t\tglobalPkg.WriteLog(logobj, \"error in public key\", \"failed\")\n\t\treturn\n\t}\n\tif accountObj.AccountPassword != ShareFiledataObj.Password {\n\t\tglobalPkg.SendError(w, \"error in password\")\n\t\tglobalPkg.WriteLog(logobj, \"error in password\", \"failed\")\n\t\treturn\n\t}\n\t// check user own this file id\n\tfiles := accountObj.Filelist\n\tfound := false\n\tfor _, fileObj := range files {\n\t\tif fileObj.Fileid == ShareFiledataObj.FileID {\n\t\t\tfound = true\n\t\t}\n\t}\n\tif !found {\n\t\tglobalPkg.SendError(w, \"You don't have this file\")\n\t\tglobalPkg.WriteLog(logobj, \"You don't have this file\", \"failed\")\n\t\treturn\n\t}\n\t// check pk already exist in blockchain\n\taccountList := accountdb.GetAllAccounts()\n\tfor _, pk := range ShareFiledataObj.PermissionPkList {\n\t\tif !containspk(accountList, pk) {\n\t\t\tglobalPkg.SendError(w, \"this public key is not associated with any account\")\n\t\t\tglobalPkg.WriteLog(logobj, \"You don't have this file\", \"failed\")\n\t\t\treturn\n\t\t}\n\t}\n\t// Signture string\n\tvalidSig := false\n\tpk1 := account.FindpkByAddress(accountObj.AccountPublicKey).Publickey\n\tif pk1 != \"\" {\n\t\tpublickey1 := cryptogrpghy.ParsePEMtoRSApublicKey(pk1)\n\t\tstrpermissionlist := strings.Join(ShareFiledataObj.PermissionPkList, \"\")\n\t\tfmt.Println(\"strpermissionlist : \", strpermissionlist)\n\t\tsignatureData := strpermissionlist + ShareFiledataObj.FileID + ShareFiledataObj.Publickey\n\t\tvalidSig = cryptogrpghy.VerifyPKCS1v15(ShareFiledataObj.Signture, signatureData, *publickey1)\n\t} else {\n\t\tvalidSig = false\n\t}\n\t// validSig = true\n\tif !validSig {\n\t\tglobalPkg.SendError(w, \"you are not allowed to share file\")\n\t\tglobalPkg.WriteLog(logobj, \"you are not allowed to share file\", \"failed\")\n\t\treturn\n\t}\n\t//\n\n\tfilelistOwner := accountObj.Filelist\n\t// add account index see file , ownerpk , fileid\n\t//append share file id , ownerpk to account index want to share file to you\n\tfor _, pk := range ShareFiledataObj.PermissionPkList {\n\t\tvar sharedfileObj filestorage.SharedFile\n\t\tvar ownerfileObj filestorage.OwnersharedFile\n\t\tvar ownerfileObj2 filestorage.OwnersharedFile\n\t\tvar foundOwnerpk bool\n\t\taccountind := account.GetAccountByAccountPubicKey(pk)\n\t\tsharedfileObj.AccountIndex = accountind.AccountIndex\n\t\townedsharefile := filestorage.FindSharedfileByAccountIndex(sharedfileObj.AccountIndex)\n\t\tif pk != ShareFiledataObj.Publickey { //same owner share to himself\n\t\t\tif len(ownedsharefile.OwnerSharefile) != 0 {\n\t\t\t\tfor _, ownedsharefileObj := range ownedsharefile.OwnerSharefile {\n\n\t\t\t\t\tif ownedsharefileObj.OwnerPublicKey == ShareFiledataObj.Publickey {\n\t\t\t\t\t\tfoundOwnerpk = true\n\t\t\t\t\t\tif !containsfileid(ownedsharefileObj.Fileid, ShareFiledataObj.FileID) {\n\t\t\t\t\t\t\townedsharefileObj.Fileid = append(ownedsharefileObj.Fileid, ShareFiledataObj.FileID)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tsharedfileObj.OwnerSharefile = append(sharedfileObj.OwnerSharefile, ownedsharefileObj)\n\t\t\t\t}\n\t\t\t\tif !foundOwnerpk {\n\t\t\t\t\townerfileObj2.OwnerPublicKey = ShareFiledataObj.Publickey\n\t\t\t\t\townerfileObj2.Fileid = append(ownerfileObj2.Fileid, ShareFiledataObj.FileID)\n\t\t\t\t\tsharedfileObj.OwnerSharefile = append(sharedfileObj.OwnerSharefile, ownerfileObj2)\n\t\t\t\t}\n\n\t\t\t} else {\n\t\t\t\townerfileObj.OwnerPublicKey = ShareFiledataObj.Publickey\n\t\t\t\townerfileObj.Fileid = append(ownerfileObj.Fileid, ShareFiledataObj.FileID)\n\t\t\t\tsharedfileObj.OwnerSharefile = append(sharedfileObj.OwnerSharefile, ownerfileObj)\n\t\t\t}\n\t\t\tbroadcastTcp.BoardcastingTCP(sharedfileObj, \"sharefile\", \"file\")\n\t\t\t//append permisssionlist to account owner filelist\n\t\t\tfor m := range filelistOwner {\n\t\t\t\tif filelistOwner[m].Fileid == ShareFiledataObj.FileID {\n\t\t\t\t\tif !containsfileid(filelistOwner[m].PermissionList, pk) {\n\t\t\t\t\t\tfilelistOwner[m].PermissionList = append(filelistOwner[m].PermissionList, pk)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\taccountObj.Filelist = filelistOwner\n\tbroadcastTcp.BoardcastingTCP(accountObj, \"updateaccountFilelist\", \"file\")\n\n\tglobalPkg.SendResponseMessage(w, \"you shared file successfully\")\n\tglobalPkg.WriteLog(logobj, \"you shared file successfully\", \"success\")\n}", "func fileName() (name string) {\n\tfor {\n\t\tlength := randSource.Intn(maxFileNameLength-minFileNameLength) + minFileNameLength\n\t\tname = random.StringFn(length, randSource.Intn)\n\t\tif _, found := fileNames[name]; !found {\n\t\t\tbreak\n\t\t}\n\t}\n\tfileNames[name] = struct{}{}\n\treturn name\n}", "func (o ServiceBusQueueOutputDataSourceOutput) SharedAccessPolicyName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ServiceBusQueueOutputDataSource) *string { return v.SharedAccessPolicyName }).(pulumi.StringPtrOutput)\n}", "func ExperimentalStatsAggregatorHandleSharedName(value string) ExperimentalStatsAggregatorHandleAttr {\n\treturn func(m optionalAttr) {\n\t\tm[\"shared_name\"] = value\n\t}\n}", "func (o ShareSettingsResponseOutput) ShareType() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ShareSettingsResponse) string { return v.ShareType }).(pulumi.StringOutput)\n}", "func (o EventHubV2OutputDataSourceResponseOutput) SharedAccessPolicyName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v EventHubV2OutputDataSourceResponse) *string { return v.SharedAccessPolicyName }).(pulumi.StringPtrOutput)\n}", "func ShardedFilename(scope *Scope, basename tf.Output, shard tf.Output, num_shards tf.Output) (filename tf.Output) {\n\tif scope.Err() != nil {\n\t\treturn\n\t}\n\topspec := tf.OpSpec{\n\t\tType: \"ShardedFilename\",\n\t\tInput: []tf.Input{\n\t\t\tbasename, shard, num_shards,\n\t\t},\n\t}\n\top := scope.AddOperation(opspec)\n\treturn op.Output(0)\n}", "func (o DatastoreFileshareOutput) SharedAccessSignature() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *DatastoreFileshare) pulumi.StringPtrOutput { return v.SharedAccessSignature }).(pulumi.StringPtrOutput)\n}", "func (s *ResourceShareInvitation) SetResourceShareName(v string) *ResourceShareInvitation {\n\ts.ResourceShareName = &v\n\treturn s\n}", "func (o AppSharedCredentialsOutput) SharedUsername() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *AppSharedCredentials) pulumi.StringPtrOutput { return v.SharedUsername }).(pulumi.StringPtrOutput)\n}", "func (e *Automation) GetFileName() string {\n\treturn fmt.Sprintf(\n\t\t\"%s_v%d_%d.json\",\n\t\te.Name,\n\t\te.VersionNumber,\n\t\te.ID)\n}", "func (s *ResourceShareAssociation) SetResourceShareName(v string) *ResourceShareAssociation {\n\ts.ResourceShareName = &v\n\treturn s\n}", "func GenerateFileName(directoryName string) (string, string) {\n\tpieces := strings.Split(directoryName, \"-\")\n\treturn pieces[0], pieces[1]\n}", "func (o EventHubStreamInputDataSourceResponseOutput) SharedAccessPolicyName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v EventHubStreamInputDataSourceResponse) *string { return v.SharedAccessPolicyName }).(pulumi.StringPtrOutput)\n}", "func (o *MicrosoftGraphItemReference) GetShareId() string {\n\tif o == nil || o.ShareId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.ShareId\n}", "func SafeFileName(str string) string {\n\tname := strings.ToLower(str)\n\tname = path.Clean(path.Base(name))\n\tname = strings.Trim(name, \" \")\n\tseparators, err := regexp.Compile(`[ &_=+:]`)\n\tif err == nil {\n\t\tname = separators.ReplaceAllString(name, \"-\")\n\t}\n\tlegal, err := regexp.Compile(`[^[:alnum:]-.]`)\n\tif err == nil {\n\t\tname = legal.ReplaceAllString(name, \"\")\n\t}\n\tfor strings.Contains(name, \"--\") {\n\t\tname = strings.Replace(name, \"--\", \"-\", -1)\n\t}\n\treturn name\n}", "func (o ServiceBusTopicOutputDataSourceResponseOutput) SharedAccessPolicyName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ServiceBusTopicOutputDataSourceResponse) *string { return v.SharedAccessPolicyName }).(pulumi.StringPtrOutput)\n}", "func (o EventHubV2StreamInputDataSourceResponseOutput) SharedAccessPolicyName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v EventHubV2StreamInputDataSourceResponse) *string { return v.SharedAccessPolicyName }).(pulumi.StringPtrOutput)\n}", "func GenerateFileName(dir, name, issueNumber, format string) string {\n\treturn fmt.Sprintf(\"%s/%s-%s.%s\", dir, name, issueNumber, format)\n}", "func (o IoTHubStreamInputDataSourceOutput) SharedAccessPolicyName() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v IoTHubStreamInputDataSource) *string { return v.SharedAccessPolicyName }).(pulumi.StringPtrOutput)\n}", "func GetStaticFileName(path string) (name string) {\r\n\tpathFormal := filepath.FromSlash(filepath.Clean(path))\r\n\tslashIdx := strings.LastIndex(pathFormal, \"\\\\\")\r\n\r\n\tif isStatic, _ := StaticSuffixDetermine(pathFormal[slashIdx+1:], \"\"); isStatic {\r\n\t\treturn pathFormal[slashIdx+1:]\r\n\t}\r\n\treturn \"\"\r\n}", "func ShareCommand(c *cli.Context, i storage.Impl) (n storage.Note, url string, err error) {\n\tnName, err := NoteName(c)\n\tif err != nil {\n\t\treturn n, url, err\n\t}\n\n\tn, err = i.LoadNote(nName)\n\tif err != nil {\n\t\treturn n, url, err\n\t}\n\n\turl, err = reader.ShareNote(n, \"http://hastebin.com/documents\")\n\n\tif err != nil {\n\t\treturn n, url, err\n\t}\n\n\treturn n, url, nil\n}", "func IsFileShared(evt *slack.MessageEvent) bool {\n\t// FIXME: return evt.Type == \"file_shared\"\n\treturn evt.SubType == \"file_share\"\n}" ]
[ "0.66359633", "0.6560258", "0.6278022", "0.620389", "0.61743456", "0.6163814", "0.6140713", "0.60629475", "0.60067683", "0.597289", "0.5948809", "0.5939293", "0.5936532", "0.5936532", "0.5936532", "0.59198195", "0.5908578", "0.59022635", "0.59022635", "0.59022635", "0.5890661", "0.5890661", "0.5848503", "0.5843223", "0.58317417", "0.581958", "0.57780826", "0.57266736", "0.5714538", "0.5611892", "0.5609791", "0.5545039", "0.5501733", "0.5474283", "0.54613596", "0.5448496", "0.5447586", "0.54362726", "0.5414893", "0.5402496", "0.5353231", "0.53518397", "0.53438085", "0.53218716", "0.5305696", "0.5299613", "0.525229", "0.52468306", "0.5225172", "0.51898235", "0.518735", "0.5185726", "0.5171044", "0.5162658", "0.5161251", "0.5160055", "0.5159532", "0.51579", "0.5157434", "0.5156228", "0.5143557", "0.5142116", "0.5141767", "0.5133646", "0.51243424", "0.5109553", "0.51032335", "0.50971794", "0.5096847", "0.5094602", "0.5070958", "0.50676346", "0.50644076", "0.50610405", "0.50561196", "0.5047039", "0.501533", "0.50145495", "0.5012159", "0.50118744", "0.5009612", "0.5006849", "0.50061125", "0.4991178", "0.49860534", "0.49854386", "0.49836802", "0.49709278", "0.49673826", "0.49672487", "0.49539486", "0.49538493", "0.49363616", "0.4932756", "0.4930921", "0.49285457", "0.49282506", "0.49246016", "0.49218252", "0.4921762" ]
0.8188587
0
Changed returns true if new and old file size or modified time are different.
func (m File) Changed(fileSize int64, fileModified time.Time) bool { if m.DeletedAt != nil { return true } if m.FileSize != fileSize { return true } if m.FileModified.Round(time.Second).Equal(fileModified.Round(time.Second)) { return false } return true }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func changed(fpath string, n int64) bool {\n\t// gather file status\n\tfstat, err := os.Stat(fpath)\n\t// err check\n\tif err != nil {\n\t\t// if err; print timestamp and err, then panic\n\t\tlog.Panic(err)\n\t}\n\t// no err; eval and return (true) file been modified within the last n seconds\n\treturn fstat.ModTime().Unix() >= time.Now().Unix()-n\n}", "func fileChanged(repo *git.Repository, path string) (bool, error) {\n\tstatus, err := repo.StatusFile(path)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tif status == git.StatusWtNew || status == git.StatusWtModified ||\n\t\tstatus == git.StatusWtDeleted {\n\t\treturn true, nil\n\t}\n\n\treturn false, nil\n}", "func (this *File) isModified() bool {\n\treturn this.modified\n}", "func (c *WOFClone) HasChanged(local string, remote string) (bool, error) {\n\n\tchange := true\n\n\t// OPEN FH\n\n\tatomic.AddInt64(&c.Filehandles, 1)\n\n\tdefer func() {\n\t\tatomic.AddInt64(&c.Filehandles, -1)\n\t}()\n\n\t// we used to do the following with a helper function in go-whosonfirst-utils\n\t// but that package has gotten unweildy and out of control - I am thinking about\n\t// a generic WOF \"hashing\" package but that started turning in to quicksand so\n\t// in the interest of just removing go-whosonfirst-utils as a dependency we're\n\t// going to do it the old-skool way by hand, for now (20170718/thisisaaronland)\n\n\tbody, err := ioutil.ReadFile(local)\n\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tenc := md5.Sum(body)\n\tlocal_hash := hex.EncodeToString(enc[:])\n\n\t// see notes above\n\n\t/*\n\t\thash, err := hash.NewMD5Hash()\n\n\t\tif err != nil {\n\t\t return false, err\n\t\t}\n\n\t\tlocal_hash, err := hash.HashFile(local)\n\n\t\tif err != nil {\n\t\t return false, err\n\t\t}\n\t*/\n\n\tif err != nil {\n\t\tc.Logger.Error(\"Failed to hash %s, becase %v\", local, err)\n\n\t\tc.SetMaxFilehandles()\n\t\treturn change, err\n\t}\n\n\treturn c.HasHashChanged(local_hash, remote)\n}", "func (d Delta) Changed() bool { return d.Before != d.After }", "func (ms *MetricSet) haveFilesChanged() (bool, error) {\n\tvar stats syscall.Stat_t\n\tfor _, path := range ms.userFiles {\n\t\tif err := syscall.Stat(path, &stats); err != nil {\n\t\t\treturn true, errors.Wrapf(err, \"failed to stat %v\", path)\n\t\t}\n\n\t\tctime := time.Unix(int64(stats.Ctim.Sec), int64(stats.Ctim.Nsec))\n\t\tif ms.lastRead.Before(ctime) {\n\t\t\tms.log.Debugf(\"File changed: %v (lastRead=%v, ctime=%v)\", path, ms.lastRead, ctime)\n\n\t\t\treturn true, nil\n\t\t}\n\t}\n\n\treturn false, nil\n}", "func (o *Note) Changed() bool {\n return o.diff.SubKey != nil ||\n\t\to.diff.Number != nil ||\n\t\to.diff.Velocity != nil\n}", "func filesModified(fileModTimes map[string]time.Time) bool {\n\treturnVal := false\n\tfor f := range fileModTimes {\n\t\tfInfo, err := os.Stat(f)\n\t\tif err != nil {\n\t\t\toutput.FatalError(err)\n\t\t}\n\t\tif fileModTimes[f] != fInfo.ModTime() {\n\t\t\tfileModTimes[f] = fInfo.ModTime()\n\t\t\treturnVal = true\n\t\t}\n\t}\n\treturn returnVal\n}", "func (d *Dry) Changed() bool {\n\td.state.mutex.Lock()\n\tdefer d.state.mutex.Unlock()\n\treturn d.state.changed\n}", "func (bc *Catalog) IsChanged() bool {\n\tbc.lock.RLock()\n\tdefer bc.lock.RUnlock()\n\treturn bc.lastAcked < bc.epoch\n}", "func (c *ComparableResult) IsChanged() bool {\n\treturn len(c.Added) != 0 || len(c.Deleted) != 0 || len(c.Changed) != 0\n}", "func (o *Cell) Changed() bool {\n return o.diff.Hue != nil ||\n\t\to.diff.X != nil ||\n\t\to.diff.Y != nil ||\n\t\to.diff.AudioPath != nil ||\n\t\to.diff.MapName != nil ||\n\t\to.diff.Class != nil ||\n\t\to.diff.MidiNote != nil\n}", "func (config Config) HasLoadedConfigurationFileBeenModified() bool {\n\tif fileInfo, err := os.Stat(config.filePath); err == nil {\n\t\tif !fileInfo.ModTime().IsZero() {\n\t\t\treturn config.lastFileModTime.Unix() != fileInfo.ModTime().Unix()\n\t\t}\n\t}\n\treturn false\n}", "func (i Instance) Changed(old Instance) bool {\n\treturn i.State != old.State ||\n\t\ti.StatusCode != old.StatusCode\n}", "func (t *Tmpl) IsModified() (yep bool, err error) {\n\n\tvar errStop = errors.New(\"stop\")\n\n\tvar walkFunc = func(path string, info os.FileInfo, err error) (_ error) {\n\n\t\t// handle walking error if any\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// skip all except regular files\n\t\tif !info.Mode().IsRegular() {\n\t\t\treturn\n\t\t}\n\n\t\t// filter by extension\n\t\tif filepath.Ext(path) != t.ext {\n\t\t\treturn\n\t\t}\n\n\t\tif yep = info.ModTime().After(t.loadedAt); yep == true {\n\t\t\treturn errStop\n\t\t}\n\n\t\treturn\n\t}\n\n\t// clear the errStop\n\tif err = filepath.Walk(t.dir, walkFunc); err == errStop {\n\t\terr = nil\n\t}\n\n\treturn\n}", "func (f *Flash) Changed() bool {\n\treturn f.changed\n}", "func (file *File) needsReload() bool {\n\tif file.path == \":memory:\" {\n\t\treturn false\n\t}\n\n\tsi, err := os.Stat(file.path)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\t// First update or the file was modified after the last update.\n\tif file.lastMod.IsZero() || si.ModTime().After(file.lastMod) {\n\t\tfile.lastMod = si.ModTime()\n\t\treturn true\n\t}\n\n\treturn false\n}", "func Modified(file io.ReadSeeker) (time.Time, error) {\n\t_, m, err := times(file)\n\treturn m, err\n}", "func (f *file) SizeNow() int64 { return f.sz }", "func (m *Meta) HasChanged(ctx context.Context, fs afs.Service) (bool, error) {\n\tif m.baseURL == \"\" {\n\t\treturn false, nil\n\t}\n\tif !m.isCheckDue(time.Now()) {\n\t\treturn false, nil\n\t}\n\n\troutes, err := fs.List(ctx, m.baseURL, option.NewRecursive(true))\n\tif err != nil {\n\t\treturn false, errors.Wrapf(err, \"failed to load rules %v\", m.baseURL)\n\t}\n\tif !m.hasChanges(routes) {\n\t\treturn false, nil\n\t}\n\tm.mutex.Lock()\n\tdefer m.mutex.Unlock()\n\tm.routes = make(map[string]time.Time)\n\tfor _, route := range routes {\n\t\tif route.IsDir() || !(path.Ext(route.Name()) == \".json\" || path.Ext(route.Name()) == \".yaml\") {\n\t\t\tcontinue\n\t\t}\n\t\tm.routes[route.URL()] = route.ModTime()\n\t}\n\treturn true, nil\n}", "func (g *GitLocal) HasFileChanged(dir string, fileName string) (bool, error) {\n\treturn g.GitCLI.HasFileChanged(dir, fileName)\n}", "func (b *Buffer) Modified() bool {\n\treturn b.IsModified\n}", "func (entry *UtxoEntry) isModified() bool {\n\treturn entry.state&utxoStateModified == utxoStateModified\n}", "func (rCalc *SingleRuleCalculator) Changed() bool { return rCalc.changed }", "func IsNewerThanTime(filePath string, unixNanoTime int64) (newer bool, err error) {\n if newer = true; unixNanoTime > 0 {\n var fileinfo os.FileInfo\n if fileinfo, err = os.Stat(filePath); err == nil && fileinfo != nil {\n newer = fileinfo.ModTime().UnixNano() > unixNanoTime\n }\n }\n return\n}", "func (dm *DagModifier) HasChanges() bool {\n\treturn dm.wrBuf != nil\n}", "func GetTimePassedSinceModified(f File) time.Duration {\n\tnow := time.Now()\n\tdiff := now.Sub(f.Modified)\n\treturn diff\n}", "func (c *Namespace) HasChanged(k K8sResource) bool {\n\treturn false\n}", "func (o *ExecStartAndAttachOptions) Changed(fieldName string) bool {\n\tr := reflect.ValueOf(o)\n\tvalue := reflect.Indirect(r).FieldByName(fieldName)\n\treturn !value.IsNil()\n}", "func (tv *TextView) IsChanged() bool {\n\tif tv.Buf != nil && tv.Buf.IsChanged() {\n\t\treturn true\n\t}\n\treturn false\n}", "func (o *CommitOptions) Changed(fieldName string) bool {\n\treturn util.Changed(o, fieldName)\n}", "func (o *CommitOptions) Changed(fieldName string) bool {\n\treturn util.Changed(o, fieldName)\n}", "func (o *CreateOptions) Changed(fieldName string) bool {\n\treturn util.Changed(o, fieldName)\n}", "func (f *File) WasTransformed() bool {\n\treturn len(f.Bytes) > 0\n}", "func (t *Pongo2Engine) IsModified() (yep bool, err error) {\n\tvar errStop = errors.New(\"stop\")\n\tvar walkFunc = func(path string, info os.FileInfo, err error) (_ error) {\n\n\t\t// handle walking error if any\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// skip all except regular files\n\t\t// TODO: follow symlinks\n\t\tif !info.Mode().IsRegular() {\n\t\t\treturn\n\t\t}\n\n\t\t// filter by extension\n\t\tif filepath.Ext(path) != t.opts.ext {\n\t\t\treturn\n\t\t}\n\n\t\tif yep = info.ModTime().After(t.loadedAt); yep == true {\n\t\t\treturn errStop\n\t\t}\n\n\t\treturn\n\t}\n\t// clear the errStop\n\tif err = filepath.Walk(t.opts.templateDir, walkFunc); err == errStop {\n\t\terr = nil\n\t}\n\treturn\n}", "func HasBeenChanged(d *appsv1.Deployment) bool {\n\toktetoRevision := d.Annotations[okLabels.RevisionAnnotation]\n\tif oktetoRevision == \"\" {\n\t\treturn false\n\t}\n\treturn oktetoRevision != d.Annotations[revisionAnnotation]\n}", "func (u *UserCalculator) Changed() bool { return u.changed }", "func (o *InfoOptions) Changed(fieldName string) bool {\n\tr := reflect.ValueOf(o)\n\tvalue := reflect.Indirect(r).FieldByName(fieldName)\n\treturn !value.IsNil()\n}", "func (g *Graph) HasChanged() bool {\n\treturn g.dirty\n}", "func objectChanged(oldObj, newObj runtime.Object) (bool, error) {\n\told := oldObj.DeepCopyObject()\n\tnew := newObj.DeepCopyObject()\n\n\t// Set resource version\n\taccessor := meta.NewAccessor()\n\tcurrentResourceVersion, err := accessor.ResourceVersion(old)\n\tif err == nil {\n\t\taccessor.SetResourceVersion(new, currentResourceVersion)\n\t}\n\n\t// Calculate diff between old and new object\n\tdiff, err := patch.DefaultPatchMaker.Calculate(old, new)\n\tif err != nil {\n\t\treturn true, errors.Wrap(err, \"failed to calculate object diff\")\n\t} else if diff.IsEmpty() {\n\t\treturn false, nil\n\t}\n\tlogger.Debugf(\"%v\", diff.String())\n\n\t// It looks like there is a diff\n\t// if the status changed, we do nothing\n\tvar patch map[string]interface{}\n\tjson.Unmarshal(diff.Patch, &patch)\n\tdelete(patch, \"status\")\n\tif len(patch) == 0 {\n\t\treturn false, nil\n\t}\n\n\t// Get object meta\n\tobjectMeta, err := meta.Accessor(newObj)\n\tif err != nil {\n\t\treturn true, errors.Wrap(err, \"failed to get object meta\")\n\t}\n\n\t// This handles the case where the object is deleted\n\tspec := patch[\"spec\"]\n\tif spec != nil {\n\t\tlogger.Infof(\"object spec %q changed with %v\", objectMeta.GetName(), spec)\n\t}\n\n\treturn true, nil\n}", "func (c *CoWIdler) Updated() bool {\n\treturn c.newStatus != nil\n}", "func (fi *fileInfo) ModTime() time.Time { return fi.mtime }", "func (o *ExportOptions) Changed(fieldName string) bool {\n\treturn util.Changed(o, fieldName)\n}", "func (s *txAllocState) Updated() bool {\n\treturn s.meta.Updated() || s.data.Updated()\n}", "func (ms *ModifiedColumnStructure) IsOrderChanged() bool {\n\treturn ms.ModifiedAfter != \"\"\n}", "func (o *ReservationModel) GetModifiedOk() (*time.Time, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Modified, true\n}", "func (eln *EmptyLeafNode) Changed() bool {\n\treturn false\n}", "func checkLastModified(w http.ResponseWriter, r *http.Request, modtime time.Time) bool {\n if modtime.IsZero() {\n return false\n }\n\n // The Date-Modified header truncates sub-second precision, so\n // use mtime < t+1s instead of mtime <= t to check for unmodified.\n if t, err := time.Parse(http.TimeFormat, r.Header.Get(\"If-Modified-Since\")); err == nil && modtime.Before(t.Add(1*time.Second)) {\n h := w.Header()\n delete(h, \"Content-Type\")\n delete(h, \"Content-Length\")\n w.WriteHeader(http.StatusNotModified)\n return true\n }\n w.Header().Set(\"Last-Modified\", modtime.UTC().Format(http.TimeFormat))\n return false\n}", "func (this *File) SetModified() {\n\tthis.log.Debug2(\"<persistence.File>SetModified{}\")\n\tthis.Lock()\n\tdefer this.Unlock()\n\tthis.modified = true\n}", "func (tb *TextBuf) IsChanged() bool {\n\treturn tb.HasFlag(int(TextBufChanged))\n}", "func (f *File) LastModified() (*time.Time, error) {\n\tattr, err := f.getObjectAttrs()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &attr.Updated, nil\n}", "func (o *Vm) GetModifiedOnOk() (*time.Time, bool) {\n\tif o == nil || o.ModifiedOn == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ModifiedOn, true\n}", "func (folderWatcher *FolderWatcher) Modified() chan bool {\n\treturn folderWatcher.modified\n}", "func StatusChanged(scheme *runtime.Scheme, oldo runtime.Object, newo runtime.Object) (bool, error) {\n\t// Get the old status value.\n\tou, err := GetUnstructuredObject(scheme, oldo)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"failed to convert old Object to Unstructured: %v\", err)\n\t}\n\toldStatus, err := GetObjectStatus(ou.Object)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"failed to get old Object status: %v\", err)\n\t}\n\n\t// Get the new status value.\n\tnu, err := GetUnstructuredObject(scheme, newo)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"failed to convert new Object to Unstructured: %v\", err)\n\t}\n\tnewStatus, err := GetObjectStatus(nu.Object)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"failed to get new Object status: %v\", err)\n\t}\n\n\t// Compare the status values.\n\tif !reflect.DeepEqual(oldStatus, newStatus) {\n\t\treturn true, nil\n\t}\n\treturn false, nil\n}", "func (b *S3Bucket) HasPolicyChanged(policyVersion string) (bool, error) {\n\tif *b.Spec.LocalPermission != b.Status.LastLocalPermission {\n\t\treturn true, nil\n\t}\n\tpolicyInt, err := strconv.Atoi(policyVersion[1:])\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tif b.Status.LastUserPolicyVersion != policyInt && b.Status.LastUserPolicyVersion < policyInt {\n\t\treturn true, nil\n\t}\n\n\treturn false, nil\n}", "func (m *MessageDescriptor) Updated() bool { return m.updated }", "func (m *stateManager) Changed() bool {\n\treturn m.stateChanged\n}", "func (s *Secret) HasChanged(k K8sResource) bool {\n\treturn true\n}", "func changed_ornot(filename, hash string) bool {\n\tif val, ok := FDB[filename]; ok {\n\t\tif val == hash {\n\t\t\treturn false\n\t\t} else {\n\t\t\tFDB[filename] = hash\n\t\t}\n\t} else {\n\t\tFDB[filename] = hash\n\t}\n\treturn true\n}", "func (d *driver) StorageChanged(cr *opapi.ImageRegistry, modified *bool) bool {\n\tvar storageChanged bool\n\n\tif cr.Status.Storage.State.S3 == nil || cr.Status.Storage.State.S3.Bucket != cr.Spec.Storage.S3.Bucket {\n\t\tstorageChanged = true\n\t}\n\n\tutil.UpdateCondition(cr, opapi.StorageExists, operatorapi.ConditionUnknown, \"S3 Bucket Changed\", \"S3 bucket is in an unknown state\", modified)\n\n\treturn storageChanged\n}", "func (g *Git) Changes() (bool, error) {\n\tw, err := g.repo.Worktree()\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tstatus, err := w.Status()\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\treturn !status.IsClean(), nil\n}", "func updateModificationTimeToNow(ctx context.Context, tconn *chrome.TestConn, folderPath, filename string) error {\n\tfilePath := filepath.Join(folderPath, filename)\n\tnowTime := time.Now().Local()\n\treturn os.Chtimes(filePath, nowTime, nowTime)\n}", "func (o *FeatureFlag) GetModifiedOk() (time.Time, bool) {\n\tif o == nil || o.Modified == nil {\n\t\tvar ret time.Time\n\t\treturn ret, false\n\t}\n\treturn *o.Modified, true\n}", "func checkLastModified(w http.ResponseWriter, r *http.Request, modtime time.Time) bool {\n\tif modtime.IsZero() {\n\t\treturn false\n\t}\n\n\t// The Date-Modified header truncates sub-second precision, so\n\t// use mtime < t+1s instead of mtime <= t to check for unmodified.\n\tif t, err := time.Parse(http.TimeFormat, r.Header.Get(\"If-Modified-Since\")); err == nil && modtime.Before(t.Add(1*time.Second)) {\n\t\th := w.Header()\n\t\tdelete(h, \"Content-Type\")\n\t\tdelete(h, \"Content-Length\")\n\t\tw.WriteHeader(http.StatusNotModified)\n\t\treturn true\n\t}\n\tw.Header().Set(\"Last-Modified\", modtime.UTC().Format(http.TimeFormat))\n\treturn false\n}", "func (e *FileEvent) IsModify() bool {\n\treturn (e.flags & EventFlagItemModified) == EventFlagItemModified\n}", "func (s *Store) HasExpirationChanged() bool {\n\ts.lock.RLock()\n\texpirationChanged := s.expirationChanged\n\ts.lock.RUnlock()\n\treturn expirationChanged\n}", "func (in *RecordSetGroup) TemplateVersionChanged() bool {\n\t// Ignore bool since it will still record changed\n\tlabel, _ := in.GetTemplateVersionLabel()\n\treturn label != controllerutils.ComputeHash(in.Spec)\n}", "func (s *InMemoryDocumentSessionOperations) HasChanged(entity Object) bool {\n\tdocumentInfo := s.documentsByEntity[entity]\n\n\tif documentInfo == nil {\n\t\treturn false\n\t}\n\n\tdocument := EntityToJson_convertEntityToJson(entity, documentInfo)\n\treturn s.EntityChanged(document, documentInfo, nil)\n}", "func (m *FileMutation) UpdateTime() (r time.Time, exists bool) {\n\tv := m.update_time\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "func certsChanged(origCertChecksum []byte, origKeyChecksum []byte, origAuthCAChecksum []byte) bool {\n\t// Check if all files exist.\n\tcertNotEmpty, err := fileExistsAndNotEmpty(tlsCert)\n\tif err != nil {\n\t\tklog.Warningf(\"error checking if changed TLS cert file empty/exists: %v\", err)\n\t\treturn false\n\t}\n\tkeyNotEmpty, err := fileExistsAndNotEmpty(tlsKey)\n\tif err != nil {\n\t\tklog.Warningf(\"error checking if changed TLS key file empty/exists: %v\", err)\n\t\treturn false\n\t}\n\tcaNotEmpty, err := fileExistsAndNotEmpty(authCAFile)\n\tif err != nil {\n\t\tklog.Warningf(\"error checking if changed auth CA file empty/exists: %v\", err)\n\t\treturn false\n\t}\n\n\tif !certNotEmpty || !keyNotEmpty || !caNotEmpty {\n\t\t// One of the files is missing despite some file event.\n\t\tklog.V(1).Infof(\"certificate, key or auth CA is missing or empty, certificates will not be rotated\")\n\t\treturn false\n\t}\n\tcurrentCertChecksum := checksumFile(tlsCert)\n\tcurrentKeyChecksum := checksumFile(tlsKey)\n\tcurrentAuthCAChecksum := checksumFile(authCAFile)\n\n\tklog.V(2).Infof(\"certificate checksums before: %x, %x, %x. checksums after: %x, %x, %x\",\n\t\torigCertChecksum, origKeyChecksum, origAuthCAChecksum, currentCertChecksum, currentKeyChecksum, currentAuthCAChecksum)\n\t// Check if the non-empty certificate/key or auth CA files have actually changed.\n\tif !bytes.Equal(origCertChecksum, currentCertChecksum) && !bytes.Equal(origKeyChecksum, currentKeyChecksum) ||\n\t\t!bytes.Equal(origAuthCAChecksum, currentAuthCAChecksum) {\n\t\tklog.Infof(\"cert and key or auth CA changed, need to restart the metrics server\")\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (i *Ignitor) IsUpdated(generation int64) bool {\n\ti.flow.m.Lock()\n\tdefer i.flow.m.Unlock()\n\treturn generation > i.generation\n}", "func (spec *Spec) warnIfHasChangedOnDisk() {\n\tspecStat, err := os.Stat(spec.Path)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\tlog.Warningf(\"spec %s was removed from on disk\", spec)\n\t\t} else {\n\t\t\tlog.Warningf(\"spec %s failed to be checked on disk: %s\", spec, err)\n\t\t}\n\t} else if specStat.ModTime().After(spec.loadTime) {\n\t\tlog.Warningf(\"spec %s has changed on disk\", spec)\n\t} else {\n\t\tlog.Debugf(\"spec %s hasn't changed on disk\", spec)\n\t}\n}", "func (spec *Spec) warnIfHasChangedOnDisk() {\n\tspecStat, err := os.Stat(spec.Path)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\tlog.Warningf(\"spec %s was removed from on disk\", spec)\n\t\t} else {\n\t\t\tlog.Warningf(\"spec %s failed to be checked on disk: %s\", spec, err)\n\t\t}\n\t} else if specStat.ModTime().After(spec.loadTime) {\n\t\tlog.Warningf(\"spec %s has changed on disk\", spec)\n\t} else {\n\t\tlog.Debugf(\"spec %s hasn't changed on disk\", spec)\n\t}\n}", "func (p MetadataChangedPredicate) Update(e event.UpdateEvent) bool {\n\tif e.ObjectOld == nil {\n\t\treturn false\n\t}\n\n\tif e.ObjectNew == nil {\n\t\treturn false\n\t}\n\n\tmetaChanged := !reflect.DeepEqual(e.ObjectOld.GetLabels(), e.ObjectNew.GetLabels()) ||\n\t\t!reflect.DeepEqual(e.ObjectOld.GetAnnotations(), e.ObjectNew.GetAnnotations()) ||\n\t\t!reflect.DeepEqual(e.ObjectOld.GetFinalizers(), e.ObjectNew.GetFinalizers())\n\n\treturn metaChanged\n}", "func (o *LocalDatabaseProvider) GetUpdatedOk() (*time.Time, bool) {\n\tif o == nil || o.Updated == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Updated, true\n}", "func (p *Page) IsNewer(other time.Time) bool {\n\treturn p.file.Modified.After(other) || p.meta.Modified.After(other)\n}", "func fileMetadataMatches(info os.FileInfo, encrypt bool,\n\tdriveFile *drive.File) (bool, error) {\n\tlocalSize := info.Size()\n\tdriveSize := driveFile.FileSize\n\tif encrypt {\n\t\t// We store a copy of the initialization vector at the start of\n\t\t// the file stored in Google Drive; account for this when\n\t\t// comparing the file sizes.\n\t\tdriveSize -= aes.BlockSize\n\t}\n\tif localSize != driveSize {\n\t\t// File sizes mismatch; update needed.\n\t\treturn false, nil\n\t}\n\n\tdriveTime, err := getModificationTime(driveFile)\n\tif err != nil {\n\t\treturn true, err\n\t}\n\n\t// Finally, check if the local modification time is different than the\n\t// modification time of the file the last time it was updated on Drive;\n\t// if it is, we return false and an upload will be done..\n\tlocalTime := info.ModTime()\n\tdebug.Printf(\"localTime: %v, driveTime: %v\", localTime, driveTime)\n\treturn localTime.Equal(driveTime), nil\n}", "func (o *IncidentTeamResponseAttributes) GetModifiedOk() (*time.Time, bool) {\n\tif o == nil || o.Modified == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Modified, true\n}", "func (n *Sub) IsUpdate(w *model.Watcher) bool {\n\treturn n.w.Mtime.Unix() != w.Mtime.Unix()\n}", "func (o *InlineResponse200115) HasLastChangedOn() bool {\n\tif o != nil && o.LastChangedOn != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (bi *BinaryInfo) LastModified() time.Time {\n\treturn bi.lastModified\n}", "func isTruncated(fp *os.File, since *SinceDBInfo) (truncated bool, err error) {\n\tvar (\n\t\tfi os.FileInfo\n\t)\n\tif fi, err = fp.Stat(); err != nil {\n\t\treturn\n\t}\n\t// Old offset larger than file size.\n\tif fi.Size() < since.Offset {\n\t\ttruncated = true\n\t} else {\n\t\ttruncated = false\n\t}\n\treturn\n}", "func (f *File) CurrentWith(other *File) bool {\n\tif IsMetaFileName(f.Name) {\n\t\tdiff := f.LastModified.Sub(other.LastModified)\n\t\totherIsSameOrOlder := (time.Duration(0) * time.Second) <= diff\n\t\treturn f.Size == other.Size && otherIsSameOrOlder\n\t}\n\treturn f.Size == other.Size\n}", "func (o *ZoneZone) GetUpdatedOk() (*time.Time, bool) {\n\tif o == nil || o.Updated == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Updated, true\n}", "func (m *SynapsesPersist) Changed() {\n\tm.changed = true\n}", "func (o *Ga4ghChemotherapy) HasUpdated() bool {\n\tif o != nil && o.Updated != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func urlContentModified(url string, historyTime *time.Time) (bool, error) {\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\treturn false, errors.Wrapf(err, \"error getting %q\", url)\n\t}\n\tif lastModified := resp.Header.Get(\"Last-Modified\"); lastModified != \"\" {\n\t\tlastModifiedTime, err := time.Parse(time.RFC1123, lastModified)\n\t\tif err != nil {\n\t\t\treturn false, errors.Wrapf(err, \"error parsing time for %q\", url)\n\t\t}\n\t\treturn lastModifiedTime.After(*historyTime), nil\n\t}\n\tlogrus.Debugf(\"Response header did not have Last-Modified %q, will rebuild.\", url)\n\treturn true, nil\n}", "func (o *Ga4ghChemotherapy) GetUpdatedOk() (string, bool) {\n\tif o == nil || o.Updated == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Updated, true\n}", "func (gc *GitCommit) SameDiffStat(b *GitCommit) bool {\n\tif len(gc.Files) != len(b.Files) {\n\t\treturn false\n\t}\n\tfor i, af := range gc.Files {\n\t\tbf := b.Files[i]\n\t\tif af == nil || bf == nil {\n\t\t\treturn false\n\t\t}\n\t\tif *af != *bf {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func (c *Context) ViewChanging() bool {\n\tif c.WatchOnly() {\n\t\treturn false\n\t}\n\n\tcv := c.ChangeViewPayloads[c.MyIndex]\n\n\treturn cv != nil && cv.GetChangeView().NewViewNumber() > c.ViewNumber\n}", "func (ms *ModifiedColumnStructure) IsRenamed() bool {\n\treturn ms.BeforeField != ms.Column.Field\n}", "func (obj *BlobAttribute) GetIsModified() bool {\n\treturn obj.getIsModified()\n}", "func (o *KubeOptions) Changed(fieldName string) bool {\n\treturn util.Changed(o, fieldName)\n}", "func (e *Entry) timeToUpdate() bool {\n\tnow := e.clk.Now()\n\te.mu.RLock()\n\tdefer e.mu.RUnlock()\n\t// no response or nextUpdate is in the past\n\tif e.response == nil || e.nextUpdate.Before(now) {\n\t\te.info(\"Stale response, updating immediately\")\n\t\treturn true\n\t}\n\tif e.maxAge > 0 {\n\t\t// cache max age has expired\n\t\tif e.lastSync.Add(e.maxAge).Before(now) {\n\t\t\te.info(\"max-age has expired, updating immediately\")\n\t\t\treturn true\n\t\t}\n\t}\n\n\t// update window is last quarter of NextUpdate - ThisUpdate\n\t// TODO: support using NextPublish instead of ThisUpdate if provided\n\t// in responses\n\twindowSize := e.nextUpdate.Sub(e.thisUpdate) / 4\n\tupdateWindowStarts := e.nextUpdate.Add(-windowSize)\n\tif updateWindowStarts.After(now) {\n\t\treturn false\n\t}\n\n\t// randomly pick time in update window\n\tupdateTime := updateWindowStarts.Add(time.Second * time.Duration(mrand.Intn(int(windowSize.Seconds()))))\n\tif updateTime.Before(now) {\n\t\te.info(\"Time to update\")\n\t\treturn true\n\t}\n\treturn false\n}", "func (f *FlagSet) Changed(name string) bool {\n\tflag := f.Lookup(name)\n\t// If a flag doesn't exist, it wasn't changed....\n\tif flag == nil {\n\t\treturn false\n\t}\n\treturn flag.Changed\n}", "func IsUpdateNeeded(filepath string, updateInterval time.Duration) (bool, error) {\n\tinfo, err := os.Stat(filepath)\n\tif os.IsNotExist(err) {\n\t\treturn true, ResetUpdateTime(filepath)\n\t} else if err != nil {\n\t\treturn false, err\n\t}\n\n\ttimeSinceMod := time.Since(info.ModTime())\n\n\tif timeSinceMod >= updateInterval {\n\t\treturn true, nil\n\t}\n\n\treturn false, nil\n}", "func (i *MetadataInfo) Update(info MetadataInfo) bool {\n\tif info.Clock > i.Clock {\n\t\ti.Clock = info.Clock\n\t\ti.Data = info.Data\n\t\treturn true\n\t}\n\treturn false\n}", "func FlagChanged(flagName string) bool {\n\treturn cmdFlags.Changed(flagName)\n}", "func (dw *DirWatcher) onModified(node *Node, newDirInfo os.FileInfo) {\n\tdw.fs.Update(node, newDirInfo)\n\n\tvar (\n\t\tns = NodeState{\n\t\t\tNode: *node,\n\t\t\tState: FileStateUpdateMode,\n\t\t}\n\t)\n\n\tselect {\n\tcase dw.qchanges <- ns:\n\tdefault:\n\t}\n}", "func (bot *ExchangeBot) IsUpdated() bool {\n\toldestValid := time.Now().Add(-bot.RequestExpiry)\n\tfor _, xc := range bot.Exchanges {\n\t\tlastUpdate := xc.LastUpdate()\n\t\tif lastUpdate.Before(oldestValid) {\n\t\t\treturn false\n\t\t}\n\t\tif xc.LastFail().After(lastUpdate) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}" ]
[ "0.75655305", "0.67521596", "0.6684405", "0.66769093", "0.6674829", "0.6527093", "0.6508151", "0.62846386", "0.6242328", "0.6241945", "0.62293434", "0.61957556", "0.61909664", "0.6162874", "0.6141628", "0.6094587", "0.609175", "0.60210913", "0.60209006", "0.59465164", "0.5945957", "0.59391683", "0.59061176", "0.58933306", "0.58887964", "0.5887732", "0.58861333", "0.58713996", "0.58526754", "0.58238703", "0.5777793", "0.5777793", "0.5773401", "0.5768597", "0.5762094", "0.5754881", "0.5747054", "0.57366306", "0.57361466", "0.57279533", "0.5722197", "0.5703457", "0.56966275", "0.5695034", "0.5679899", "0.566718", "0.56554824", "0.5655073", "0.5625973", "0.5602077", "0.560088", "0.557849", "0.5547097", "0.55427235", "0.553364", "0.55272263", "0.55115783", "0.55007523", "0.5487309", "0.5485201", "0.5475308", "0.5467517", "0.5453079", "0.54368883", "0.543687", "0.5430614", "0.542577", "0.5389627", "0.53880143", "0.538207", "0.537933", "0.5376842", "0.5376842", "0.5374006", "0.5373057", "0.53722906", "0.5364139", "0.53544563", "0.5349398", "0.53279006", "0.53176665", "0.5310356", "0.5302042", "0.5300311", "0.529575", "0.52864337", "0.5283668", "0.5271427", "0.52707076", "0.52543867", "0.5252084", "0.5250687", "0.52428496", "0.523795", "0.52327543", "0.5215737", "0.52134717", "0.5211103", "0.5206931", "0.52007747" ]
0.8399493
0
Purge removes a file from the index by marking it as missing.
func (m *File) Purge() error { return Db().Unscoped().Model(m).Updates(map[string]interface{}{"file_missing": true, "file_primary": false}).Error }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (w *TimedRotatingFileWriter) purge() {\n\tpathes, err := filepath.Glob(w.pathPrefix + \"*\")\n\tif err != nil {\n\t\tlogError(err)\n\t\treturn\n\t}\n\n\tcount := len(pathes) - int(w.backupCount) - 1\n\tif count > 0 {\n\t\tvar name string\n\t\tw.lock.Lock()\n\t\tif w.file != nil { // not closed\n\t\t\tname = w.file.Name()\n\t\t}\n\t\tw.lock.Unlock()\n\t\tsort.Strings(pathes)\n\t\tfor i := 0; i < count; i++ {\n\t\t\tpath := pathes[i]\n\t\t\tif path != name {\n\t\t\t\terr = os.Remove(path)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogError(err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "func (u *upstream) purge(ctx context.Context, dir string) (err error) {\n\tif do := u.f.Features().Purge; do != nil {\n\t\terr = do(ctx, dir)\n\t} else {\n\t\terr = operations.Purge(ctx, u.f, dir)\n\t}\n\treturn err\n}", "func (f *Fs) Purge(ctx context.Context, dir string) (err error) {\n\treturn f.purgeCheck(ctx, dir, false)\n}", "func (f *Fs) Purge(ctx context.Context, dir string) error {\n\treturn f.purgeCheck(ctx, dir, false)\n}", "func (f *Fs) Purge(ctx context.Context, dir string) error {\n\t// Caution: Deleting a folder may orphan objects. It's important\n\t// to remove the contents of the folder before you delete the\n\t// folder. That's because removing a folder using DELETE does not\n\t// remove the objects contained within the folder. If you delete\n\t// a folder without first deleting its contents, the contents may\n\t// be rendered inaccessible.\n\t//\n\t// An alternative to permanently deleting a folder is moving it to the\n\t// Deleted Files folder. A folder (and all its contents) in the\n\t// Deleted Files folder can be recovered. Your app can retrieve the\n\t// link to the user's Deleted Files folder from the <deleted> element\n\t// in the user resource representation. Your application can then move\n\t// a folder to the Deleted Files folder by issuing an HTTP PUT request\n\t// to the URL that represents the file resource and provide as input,\n\t// XML that specifies in the <parent> element the link to the Deleted\n\t// Files folder.\n\tif f.opt.HardDelete {\n\t\treturn fs.ErrorCantPurge\n\t}\n\treturn f.purgeCheck(ctx, dir, false)\n}", "func (f *Fs) Purge(ctx context.Context, dir string) error {\n\tif f.root == \"\" && dir == \"\" {\n\t\treturn f.multithread(ctx, func(ctx context.Context, u *upstream) error {\n\t\t\treturn u.purge(ctx, \"\")\n\t\t})\n\t}\n\tu, uRemote, err := f.findUpstream(dir)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn u.purge(ctx, uRemote)\n}", "func (f *Fs) Purge() error {\n\tdo := f.Fs.Features().Purge\n\tif do == nil {\n\t\treturn fs.ErrorCantPurge\n\t}\n\treturn do()\n}", "func (obj *LineFile) deleteIndexFiles() {\n\tfilePrefix := obj.filePathHash\n\tindexFolder := path.Join(obj.fileDir, \"index\")\n\tos.MkdirAll(indexFolder, 0755)\n\tDeleteFiles(indexFolder, filePrefix+\"_*.idx\")\n}", "func (ms *DynamoDBStorage) Purge(ctx *Context, loc string, t int64) (int64, error) {\n\tLog(INFO, ctx, \"DynamoDBStorage.Purge\", \"location\", loc, \"t\", t)\n\tpanic(fmt.Errorf(\"DynamoDBStorage.Purge not implemented\"))\n}", "func (dump *Dump) purge(existed Int32Map, stats *ParseStatistics) {\n\tfor id, cont := range dump.ContentIndex {\n\t\tif _, ok := existed[id]; !ok {\n\t\t\tfor _, ip4 := range cont.IPv4 {\n\t\t\t\tdump.RemoveFromIPv4Index(ip4.IPv4, cont.ID)\n\t\t\t}\n\n\t\t\tfor _, ip6 := range cont.IPv6 {\n\t\t\t\tip6 := string(ip6.IPv6)\n\t\t\t\tdump.RemoveFromIPv6Index(ip6, cont.ID)\n\t\t\t}\n\n\t\t\tfor _, subnet6 := range cont.SubnetIPv6 {\n\t\t\t\tdump.RemoveFromSubnetIPv6Index(subnet6.SubnetIPv6, cont.ID)\n\t\t\t}\n\n\t\t\tfor _, subnet4 := range cont.SubnetIPv4 {\n\t\t\t\tdump.RemoveFromSubnetIPv4Index(subnet4.SubnetIPv4, cont.ID)\n\t\t\t}\n\n\t\t\tfor _, u := range cont.URL {\n\t\t\t\tdump.RemoveFromURLIndex(NormalizeURL(u.URL), cont.ID)\n\t\t\t}\n\n\t\t\tfor _, domain := range cont.Domain {\n\t\t\t\tdump.RemoveFromDomainIndex(NormalizeDomain(domain.Domain), cont.ID)\n\t\t\t}\n\n\t\t\tdump.RemoveFromDecisionIndex(cont.Decision, cont.ID)\n\t\t\tdump.RemoveFromDecisionOrgIndex(cont.DecisionOrg, cont.ID)\n\t\t\tdump.RemoveFromDecisionWithoutNoIndex(cont.ID)\n\t\t\tdump.RemoveFromEntryTypeIndex(entryTypeKey(cont.EntryType, cont.DecisionOrg), cont.ID)\n\n\t\t\tdelete(dump.ContentIndex, id)\n\n\t\t\tstats.RemoveCount++\n\t\t}\n\t}\n}", "func Purge() error {\n\tconfigDir := configdir.New(vendorName, projectName)\n\tfileDir = configDir.QueryCacheFolder()\n\tlogging.Log(fmt.Sprintf(\"Deleting %v\", fileDir.Path))\n\treturn os.RemoveAll(fileDir.Path)\n}", "func (f *File) Forget() {\n\tino := f.info.Inode\n\tdefer func() {\n\t\tlog.LogDebugf(\"TRACE Forget: ino(%v)\", ino)\n\t}()\n\n\tf.super.ic.Delete(ino)\n\n\tf.super.fslock.Lock()\n\tdelete(f.super.nodeCache, ino)\n\tf.super.fslock.Unlock()\n\n\tif err := f.super.ec.EvictStream(ino); err != nil {\n\t\tlog.LogWarnf(\"Forget: stream not ready to evict, ino(%v) err(%v)\", ino, err)\n\t\treturn\n\t}\n\n\tif !f.super.orphan.Evict(ino) {\n\t\treturn\n\t}\n\n\tif err := f.super.mw.Evict(ino); err != nil {\n\t\tlog.LogWarnf(\"Forget Evict: ino(%v) err(%v)\", ino, err)\n\t}\n}", "func (reader *Reader) deleteEmptyRejected() {\n\tfinfo, e := os.Stat(reader.Rejected)\n\tif e != nil {\n\t\treturn\n\t}\n\n\tif finfo.Size() >= 0 {\n\t\t_ = os.Remove(reader.Rejected)\n\t}\n}", "func removeIndex(indexPath string) {\n\tmetaPath := filepath.Join(indexPath, \"index_meta.json\")\n\tif !Exists(metaPath) {\n\t\tcommon.Log.Error(\"%q doesn't appear to a be a Bleve index. %q doesn't exist.\",\n\t\t\tindexPath, metaPath)\n\t\treturn\n\t}\n\tif err := RemoveDirectory(indexPath); err != nil {\n\t\tcommon.Log.Error(\"RemoveDirectory(%q) failed. err=%v\", indexPath, err)\n\t}\n}", "func (f *IndexFile) Release() { f.wg.Done() }", "func (f *FileRotator) purgeOldFiles() {\n\tfor {\n\t\tselect {\n\t\tcase <-f.purgeCh:\n\t\t\tvar fIndexes []int\n\t\t\tfiles, err := ioutil.ReadDir(f.path)\n\t\t\tif err != nil {\n\t\t\t\tf.logger.Error(\"error getting directory listing\", \"error\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// Inserting all the rotated files in a slice\n\t\t\tfor _, fi := range files {\n\t\t\t\tif strings.HasPrefix(fi.Name(), f.baseFileName) {\n\t\t\t\t\tfileIdx := strings.TrimPrefix(fi.Name(), fmt.Sprintf(\"%s.\", f.baseFileName))\n\t\t\t\t\tn, err := strconv.Atoi(fileIdx)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tf.logger.Error(\"error extracting file index\", \"error\", err)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tfIndexes = append(fIndexes, n)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Not continuing to delete files if the number of files is not more\n\t\t\t// than MaxFiles\n\t\t\tif len(fIndexes) <= f.MaxFiles {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Sorting the file indexes so that we can purge the older files and keep\n\t\t\t// only the number of files as configured by the user\n\t\t\tsort.Ints(fIndexes)\n\t\t\ttoDelete := fIndexes[0 : len(fIndexes)-f.MaxFiles]\n\t\t\tfor _, fIndex := range toDelete {\n\t\t\t\tfname := filepath.Join(f.path, fmt.Sprintf(\"%s.%d\", f.baseFileName, fIndex))\n\t\t\t\terr := os.RemoveAll(fname)\n\t\t\t\tif err != nil {\n\t\t\t\t\tf.logger.Error(\"error removing file\", \"filename\", fname, \"error\", err)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tf.fileLock.Lock()\n\t\t\tf.oldestLogFileIdx = fIndexes[0]\n\t\t\tf.fileLock.Unlock()\n\t\tcase <-f.doneCh:\n\t\t\treturn\n\t\t}\n\t}\n}", "func (fs *fileStorage) deleteUnusedFiles() {\n\tpath := fs.folder[:len(fs.folder)-1]\n\tlistFiles, err := ioutil.ReadDir(path)\n\tif err == nil {\n\t\tfor _, finfo := range listFiles {\n\t\t\tif finfo.IsDir() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfname := finfo.Name()\n\t\t\tif fname == \"index.dat\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tidx := checkValidFileDataName(fname)\n\t\t\tif idx == -1 {\n\t\t\t\tfn := fs.folder + fname\n\t\t\t\tfs.log.Info(\"Remove unknown file %s\", fn)\n\t\t\t\tos.Remove(fn)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t_, ok := fs.freeCounts[StorageIdx(idx)]\n\t\t\tif !ok {\n\t\t\t\tfn := fs.folder + fname\n\t\t\t\tfs.log.Info(\"Remove unknown file %s\", fn)\n\t\t\t\tos.Remove(fn)\n\t\t\t}\n\t\t}\n\t}\n}", "func (s store) Remove(index string) {\n\n\trunThreadSafe(func() {\n\t\tdelete(s, index)\n\t})\n\n\ts.writeToDisk()\n}", "func (g *Index) RemoveFile(file IndexPath) {\n\tfor i, entry := range g.Objects {\n\t\tif entry.PathName == file {\n\t\t\t//println(\"Should remove \", i)\n\t\t\tg.Objects = append(g.Objects[:i], g.Objects[i+1:]...)\n\t\t\tg.NumberIndexEntries -= 1\n\t\t\treturn\n\t\t}\n\t}\n}", "func cleanup(indexDir string, repos []string, now time.Time) {\n\tstart := time.Now()\n\ttrashDir := filepath.Join(indexDir, \".trash\")\n\tif err := os.MkdirAll(trashDir, 0755); err != nil {\n\t\tlog.Printf(\"failed to create trash dir: %v\", err)\n\t}\n\n\ttrash := getShards(trashDir)\n\tindex := getShards(indexDir)\n\n\ttombstonesEnabled := zoekt.TombstonesEnabled(indexDir)\n\n\t// trash: Remove old shards and conflicts with index\n\tminAge := now.Add(-24 * time.Hour)\n\tfor repo, shards := range trash {\n\t\told := false\n\t\tfor _, shard := range shards {\n\t\t\tif shard.ModTime.Before(minAge) {\n\t\t\t\told = true\n\t\t\t} else if shard.ModTime.After(now) {\n\t\t\t\tdebug.Printf(\"trashed shard %s has timestamp in the future, reseting to now\", shard.Path)\n\t\t\t\t_ = os.Chtimes(shard.Path, now, now)\n\t\t\t}\n\t\t}\n\n\t\tif _, conflicts := index[repo]; !conflicts && !old {\n\t\t\tcontinue\n\t\t}\n\n\t\tlog.Printf(\"removing old shards from trash for %s\", repo)\n\t\tremoveAll(shards...)\n\t\tdelete(trash, repo)\n\t}\n\n\t// index: Move missing repos from trash into index\n\tfor _, repo := range repos {\n\t\t// Delete from index so that index will only contain shards to be\n\t\t// trashed.\n\t\tdelete(index, repo)\n\n\t\tshards, ok := trash[repo]\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\n\t\tlog.Printf(\"restoring shards from trash for %s\", repo)\n\t\tmoveAll(indexDir, shards)\n\t\tshardsLog(indexDir, \"restore\", shards, repo)\n\t}\n\n\t// index: Move non-existent repos into trash\n\tfor repo, shards := range index {\n\t\t// Best-effort touch. If touch fails, we will just remove from the\n\t\t// trash sooner.\n\t\tfor _, shard := range shards {\n\t\t\t_ = os.Chtimes(shard.Path, now, now)\n\t\t}\n\n\t\tif tombstonesEnabled {\n\t\t\t// 1 repo can be split across many simple shards but it should only be contained\n\t\t\t// in 1 compound shard. Hence we check that len(shards)==1 and only consider the\n\t\t\t// shard at index 0.\n\t\t\tif len(shards) == 1 && strings.HasPrefix(filepath.Base(shards[0].Path), \"compound-\") {\n\t\t\t\tshardsLog(indexDir, \"tomb\", shards, repo)\n\t\t\t\tif err := zoekt.SetTombstone(shards[0].Path, repo); err != nil {\n\t\t\t\t\tlog.Printf(\"error setting tombstone for %s in shard %s: %s. Removing shard\\n\", repo, shards[0].Path, err)\n\t\t\t\t\t_ = os.Remove(shards[0].Path)\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tmoveAll(trashDir, shards)\n\t\tshardsLog(indexDir, \"remove\", shards, repo)\n\t}\n\n\t// Remove old .tmp files from crashed indexer runs-- for example, if\n\t// an indexer OOMs, it will leave around .tmp files, usually in a loop.\n\tmaxAge := now.Add(-4 * time.Hour)\n\tif failures, err := filepath.Glob(filepath.Join(indexDir, \"*.tmp\")); err != nil {\n\t\tlog.Printf(\"Glob: %v\", err)\n\t} else {\n\t\tfor _, f := range failures {\n\t\t\tst, err := os.Stat(f)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"Stat(%q): %v\", f, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif !st.IsDir() && st.ModTime().Before(maxAge) {\n\t\t\t\tlog.Printf(\"removing old tmp file: %s\", f)\n\t\t\t\tos.Remove(f)\n\t\t\t}\n\t\t}\n\t}\n\tmetricCleanupDuration.Observe(time.Since(start).Seconds())\n}", "func (i *API) purgeDB() error {\n\tif err := i.Close(); err != nil {\n\t\tlog.Error(errors.Wrapf(types.ErrStorePurgeClose, \"Infra API: %s\", err))\n\t}\n\n\tif err := os.RemoveAll(i.primaryDBPath); err != nil {\n\t\tlog.Error(errors.Wrapf(types.ErrStorePurgeNuke, \"Infra API: %s | Primary DB: %v\", err, i.primaryDBPath))\n\t}\n\n\tif err := os.RemoveAll(i.backupDBPath); err != nil {\n\t\tlog.Error(errors.Wrapf(types.ErrStorePurgeNuke, \"Infra API: %s | Backup DB: %v\", err, i.backupDBPath))\n\t}\n\treturn nil\n}", "func (i *Index) Remove() error {\n\treturn i.db.DeleteFile()\n}", "func (sfs *SafeFileSet) Delete(metahash [32]byte) {\n\tsfs.filesSet.Delete(metahash)\n}", "func (idx *Unique) Delete() error {\n\treturn os.RemoveAll(idx.indexRootDir)\n}", "func (fs *fileStorage) restoreIndexFile() error {\n\tIsOneFileProcessed := false\n\tif err := fs.prepareIndexFile(); err != nil {\n\t\treturn err\n\t}\n\tpath := fs.folder[:len(fs.folder)-1]\n\tlistFiles, err := ioutil.ReadDir(path)\n\tif err == nil {\n\t\tfor _, finfo := range listFiles {\n\t\t\tif finfo.IsDir() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfname := finfo.Name()\n\t\t\tif fname == \"index.dat\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tidx := checkValidFileDataName(fname)\n\t\t\tif idx == -1 {\n\t\t\t\tfn := fs.folder + fname\n\t\t\t\tfs.log.Info(\"Remove unknown file %s\", fn)\n\t\t\t\terr = os.Remove(fn)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\terr = fs.restoreStorageFile(StorageIdx(idx))\n\t\t\tif err != nil {\n\t\t\t\tfn := fs.folder + fname\n\t\t\t\tfs.log.Info(\"Remove unknown file %s\", fn)\n\t\t\t\terr = os.Remove(fn)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tIsOneFileProcessed = true\n\t\t}\n\t}\n\tif !IsOneFileProcessed {\n\t\treturn errors.New(\"not found any valid storage file\")\n\t}\n\treturn nil\n}", "func TestPurge(t *testing.T) {\n\tpurgedId, err := testCli.Purge([]api.PurgeTask{\n\t\t{\n\t\t\tUrl: \"http://my.domain.com/path/to/purge/2.data\",\n\t\t},\n\t\t{\n\t\t\tUrl: \"http://my.domain.com/path/to/purege/html/\",\n\t\t\tType: \"directory\",\n\t\t},\n\t})\n\n\tt.Logf(\"purgedId: %s\", string(purgedId))\n\tcheckClientErr(t, \"Purge\", err)\n}", "func (s *GDrive) Purge(ctx context.Context, days time.Duration) (err error) {\n\tnextPageToken := \"\"\n\n\texpirationDate := time.Now().Add(-1 * days).Format(time.RFC3339)\n\tq := fmt.Sprintf(\"'%s' in parents and modifiedTime < '%s' and mimeType!='%s' and trashed=false\", s.rootID, expirationDate, gDriveDirectoryMimeType)\n\tl, err := s.list(nextPageToken, q)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor 0 < len(l.Files) {\n\t\tfor _, fi := range l.Files {\n\t\t\terr = s.service.Files.Delete(fi.Id).Context(ctx).Do()\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tif l.NextPageToken == \"\" {\n\t\t\tbreak\n\t\t}\n\n\t\tl, err = s.list(l.NextPageToken, q)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\treturn\n}", "func (f *IndexFile) Retain() { f.wg.Add(1) }", "func (i *Index) DeleteAll(ctx context.Context, store Store) error {\n\tdiff, err := i.verify(ctx, store, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor k, v := range diff.MissingFromSource {\n\t\tif fkm, ok := diff.PresentInIndex[k]; ok {\n\t\t\tfor pk := range v {\n\t\t\t\tfkm[pk] = struct{}{}\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tdiff.PresentInIndex[k] = v\n\t}\n\n\treturn i.remove(ctx, store, diff.PresentInIndex)\n}", "func NeuraxPurgeSelf() {\n\tos.Remove(os.Args[0])\n\tos.Exit(0)\n}", "func (f *File) Delete() error {\n\tif f != nil {\n\t\tfor _, v := range f.versions {\n\t\t\tv.Delete()\n\t\t}\n\t\tif err := f.directory.removeFile(f); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (c *ttlCache) purge() {\n\tc.mutex.Lock()\n\tdefer c.mutex.Unlock()\n\tfor key, value := range c.entries {\n\t\tif value.expireTime.Before(time.Now()) {\n\t\t\tdelete(c.entries, key)\n\t\t}\n\t}\n\n}", "func PurgeFiles(files []string) error {\n\tvar errArray []string\n\nNEXT:\n\tfor _, file := range files {\n\t\tif _, err := os.Stat(file); os.IsNotExist(err) {\n\t\t\t// errArray = append(errArray, fmt.Sprintf(\"%q: %v\", file, err))\n\t\t\tcontinue NEXT\n\t\t}\n\t\tif !DeleteFile(file) {\n\t\t\terrArray = append(errArray, fmt.Sprintf(\"could not remove %q\", file))\n\t\t}\n\t}\n\tswitch len(errArray) > 0 {\n\tcase true:\n\t\terr := fmt.Errorf(\"%v\", strings.Join(errArray, \"\\n\"))\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (s *VolumeStore) Purge(name string) {\n\ts.globalLock.Lock()\n\tv, exists := s.names[name]\n\tif exists {\n\t\tif _, err := volumedrivers.RemoveDriver(v.DriverName()); err != nil {\n\t\t\tlogrus.Errorf(\"Error dereferencing volume driver: %v\", err)\n\t\t}\n\t}\n\tif err := s.removeMeta(name); err != nil {\n\t\tlogrus.Errorf(\"Error removing volume metadata for volume %q: %v\", name, err)\n\t}\n\tdelete(s.names, name)\n\tdelete(s.refs, name)\n\tdelete(s.labels, name)\n\tdelete(s.options, name)\n\ts.globalLock.Unlock()\n}", "func (i ImageIndexer) DeleteFromIndex(request DeleteFromIndexRequest) error {\n\tbuildDir, outDockerfile, cleanup, err := buildContext(request.Generate, request.OutDockerfile)\n\tdefer cleanup()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdatabasePath, err := i.ExtractDatabase(buildDir, request.FromIndex, request.CaFile, request.SkipTLSVerify, request.PlainHTTP)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Run opm registry delete on the database\n\tdeleteFromRegistryReq := registry.DeleteFromRegistryRequest{\n\t\tPackages: request.Operators,\n\t\tInputDatabase: databasePath,\n\t\tPermissive: request.Permissive,\n\t}\n\n\t// Delete the bundles from the registry\n\terr = i.RegistryDeleter.DeleteFromRegistry(deleteFromRegistryReq)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// generate the dockerfile\n\tdockerfile := i.DockerfileGenerator.GenerateIndexDockerfile(request.BinarySourceImage, databasePath)\n\terr = write(dockerfile, outDockerfile, i.Logger)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif request.Generate {\n\t\treturn nil\n\t}\n\n\t// build the dockerfile\n\terr = build(outDockerfile, request.Tag, i.CommandRunner, i.Logger)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (c *cache) purgeOld(maxAge time.Duration) {\n\tc.itemMu.Lock()\n\tdefer c.itemMu.Unlock()\n\tcutoff := time.Now().Add(-maxAge)\n\tfor name, item := range c.item {\n\t\t// If not locked and access time too long ago - delete the file\n\t\tdt := item.atime.Sub(cutoff)\n\t\t// fs.Debugf(name, \"atime=%v cutoff=%v, dt=%v\", item.atime, cutoff, dt)\n\t\tif item.opens == 0 && dt < 0 {\n\t\t\tosPath := filepath.Join(c.root, filepath.FromSlash(name))\n\t\t\terr := os.Remove(osPath)\n\t\t\tif err != nil {\n\t\t\t\tfs.Errorf(name, \"Failed to remove from cache: %v\", err)\n\t\t\t} else {\n\t\t\t\tfs.Debugf(name, \"Removed from cache\")\n\t\t\t}\n\t\t\t// Remove the entry\n\t\t\tdelete(c.item, name)\n\t\t}\n\t}\n}", "func (s *FileStore) GC() error {\n\ts.Lock()\n\tdefer s.Unlock()\n\timagesInUse, err := s.getImageHexDigestsInUse()\n\tif err != nil {\n\t\treturn err\n\t}\n\tglobExpr := filepath.Join(s.dataDir(), \"*\")\n\tmatches, err := filepath.Glob(globExpr)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Glob(): %q: %v\", globExpr, err)\n\t}\n\tfor _, m := range matches {\n\t\tif imagesInUse[filepath.Base(m)] {\n\t\t\tcontinue\n\t\t}\n\t\tglog.V(1).Infof(\"GC: removing unreferenced image file %q\", m)\n\t\tif err := os.Remove(m); err != nil {\n\t\t\tglog.Warningf(\"GC: removing %q: %v\", m, err)\n\t\t}\n\t}\n\treturn nil\n}", "func (s *Storage) Remove(sha256Hash string) error {\n\t// The mgo gridfs interface does not allow us to atomically\n\t// remove a file, so we go behind the scenes to rename\n\t// the file if and only if the decremented reference count\n\t// is zero.\n\tblobRef := hashName(sha256Hash)\n\tchange := mgo.Change{\n\t\tUpdate: bson.D{{\"$inc\", bson.D{{\"metadata.refcount\", -1}}}},\n\t\tReturnNew: true,\n\t}\n\tvar doc struct {\n\t\tMetadata refCountMeta\n\t}\n\t_, err := s.fs.Files.Find(bson.D{{\"filename\", blobRef}}).Apply(change, &doc)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif doc.Metadata.RefCount != 0 {\n\t\treturn nil\n\t}\n\t// The ref count has just reached zero. Rename the file atomically,\n\t// but only if the ref count has not been inremented in the meantime.\n\tnewName := \"deleted-\" + bson.NewObjectId().Hex()\n\terr = s.fs.Files.Update(\n\t\tbson.D{{\"filename\", blobRef}, {\"metadata.refcount\", 0}},\n\t\tbson.D{{\"$set\", bson.D{{\"filename\", newName}}}},\n\t)\n\tif err == mgo.ErrNotFound {\n\t\t// Someone else must have got there first.\n\t\treturn nil\n\t}\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot rename file before deletion: %v\", err)\n\t}\n\treturn s.fs.Remove(newName)\n}", "func (e *esearch) wipe() error {\n\n\t// Delete indexes\n\tdeleteIndexResp, err := e.client.DeleteIndex(e.index + \"-*\").Do(e.ctx)\n\tif elastic.IsNotFound(err) {\n\t\t// We're good\n\t} else if elastic.IsStatusCode(err, 400) {\n\t\t// This means that it's an alias and not an index, also okay\n\t} else if err != nil {\n\t\treturn fmt.Errorf(\"Failed to remove Elasticsearch base index '%s' error: %v\", e.index+\"*\", err)\n\t} else if !deleteIndexResp.Acknowledged {\n\t\treturn fmt.Errorf(\"Failed to receive Elasticsearch delete indexes response\")\n\t}\n\n\t// Delete Aliases\n\tdeleteAliasesRepsonse, err := e.client.Alias().Remove(\"*\", e.index+\"-*\").Do(e.ctx)\n\tif elastic.IsNotFound(err) {\n\t\t// We're good\n\t} else if err != nil {\n\t\treturn fmt.Errorf(\"Failed to remove Elasticsearch partition aliases '%s' error: %v\", e.index+\"*\", err)\n\t} else if !deleteAliasesRepsonse.Acknowledged {\n\t\treturn fmt.Errorf(\"Failed to receive Elasticsearch delete partition aliases response\")\n\t}\n\n\treturn nil\n}", "func (q *chunkQueue) discard(index uint32) error {\n\tif q.snapshot == nil {\n\t\treturn nil\n\t}\n\tpath := q.chunkFiles[index]\n\tif path == \"\" {\n\t\treturn nil\n\t}\n\terr := os.Remove(path)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to remove chunk %v: %w\", index, err)\n\t}\n\tdelete(q.chunkFiles, index)\n\tdelete(q.chunkReturned, index)\n\tdelete(q.chunkAllocated, index)\n\treturn nil\n}", "func purgeFTBFSList() {\n\tfor url,_ := range(ftbfsList) {\n\t\tcollection.Remove(bson.M{\"url\":url})\n\t}\n}", "func (u *baseUploader) CleanFiles() {\n\n\tif u.ST.IsReserve {\n\t\treturn\n\t}\n\tfor _, fpath := range u.successedFiles {\n\t\tif err := os.Remove(fpath); err != nil {\n\t\t\tlog.Logger.Error(\"remove file got error\", zap.Error(err))\n\t\t}\n\t\tlog.Logger.Info(\"remove file\", zap.String(\"fpath\", fpath))\n\t}\n}", "func (st *MemStorage) Delete(gun string) error {\n\tst.lock.Lock()\n\tdefer st.lock.Unlock()\n\tfor k := range st.tufMeta {\n\t\tif strings.HasPrefix(k, gun) {\n\t\t\tdelete(st.tufMeta, k)\n\t\t}\n\t}\n\tdelete(st.checksums, gun)\n\treturn nil\n}", "func (r *Repository) RemoveFromIndex(e *StatusEntry) error {\n\tif !e.Indexed() {\n\t\treturn ErrEntryNotIndexed\n\t}\n\tindex, err := r.essence.Index()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := index.RemoveByPath(e.diffDelta.OldFile.Path); err != nil {\n\t\treturn err\n\t}\n\tdefer index.Free()\n\treturn index.Write()\n}", "func (f File) Delete() File {\n\t//DPrintf(\"delete %v from versions %v\", f.Path, f)\n\tif f.Deleted {\n\t\tDPrintf(\"WARNING: deleting an already deleted file\")\n\t}\n\tf.Deleted = true\n\treturn f\n}", "func (f *Fs) purgeCheck(ctx context.Context, dir string, check bool) error {\n\troot := path.Join(f.root, dir)\n\tif root == \"\" {\n\t\treturn errors.New(\"can't purge root directory\")\n\t}\n\tdc := f.dirCache\n\tdirectoryID, err := dc.FindDir(ctx, dir, false)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif check {\n\t\tfound, err := f.listAll(ctx, directoryID, func(item *api.File) bool {\n\t\t\treturn true\n\t\t}, func(item *api.Collection) bool {\n\t\t\treturn true\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif found {\n\t\t\treturn fs.ErrorDirectoryNotEmpty\n\t\t}\n\t}\n\n\terr = f.delete(ctx, false, directoryID, root, f.opt.HardDelete || check)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tf.dirCache.FlushDir(dir)\n\treturn nil\n}", "func (repo *PostgresRepo) DeleteFile(id int, project int) error {\n\tf := earthworks.File{}\n\n\t// First get the filename for the file to be archived, so we can archive all\n\t// versions of it\n\tnameQuery := `\n\t\tSELECT filename FROM project_file WHERE id=$1 AND project=$2 AND expired_at IS NULL\n\t`\n\n\terr := repo.db.QueryRowx(nameQuery, id, project).StructScan(&f)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// now set all version of the file (for this project) to archived.\n\tq := `\n\t\tUPDATE project_file SET expired_at=NOW() WHERE filename=$1 AND project=$2\n\t`\n\t_, err = repo.db.Exec(q, f.Filename, project)\n\treturn err\n}", "func (sd *StateDB) purge() {\n\t// TODO\n\t// purge will cause a panic problem, so temporaly comments the code.\n\t//\n\t// panic: [fatal error: concurrent map writes]\n\t// reason: the reason is that [sd.beats] is been concurrently called and\n\t// there is no lock handling this parameter.\n\n\t// for addr, lastbeat := range sd.beats {\n\t// \t// skip dirty states\n\t// \tif _, in := sd.journal.dirties[addr]; in {\n\t// \t\tcontinue\n\t// \t}\n\t// \tif _, in := sd.dirtyset[addr]; in {\n\t// \t\tcontinue\n\t// \t}\n\t// \tif time.Since(lastbeat) > sd.conf.BeatExpireTime {\n\t// \t\tsd.deleteStateObject(addr)\n\t// \t}\n\t// }\n}", "func (s *storageImpl) Delete(ctx context.Context, module, version string) error {\n\tconst op errors.Op = \"fs.Delete\"\n\tctx, span := observ.StartSpan(ctx, op.String())\n\tdefer span.End()\n\tversionedPath := s.versionLocation(module, version)\n\texists, err := s.Exists(ctx, module, version)\n\tif err != nil {\n\t\treturn errors.E(op, err, errors.M(module), errors.V(version))\n\t}\n\tif !exists {\n\t\treturn errors.E(op, errors.M(module), errors.V(version), errors.KindNotFound)\n\t}\n\treturn s.filesystem.RemoveAll(versionedPath)\n}", "func (e *Execution) purge(threshold uint64) {\n\tfor blockID, record := range e.records {\n\t\tif record.Block.Header.Height < threshold {\n\t\t\tdelete(e.records, blockID)\n\t\t}\n\t}\n}", "func (c *GorCache) Purge() {\n\tc.purgeChan <- true\n}", "func (f *MangleFile) Delete() {\n\tf.deleted = true\n}", "func (c *index) Drop(rm kv.RetrieverMutator) error {\n\tit, err := rm.Iter(c.prefix, c.prefix.PrefixNext())\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer it.Close()\n\n\t// remove all indices\n\tfor it.Valid() {\n\t\tif !it.Key().HasPrefix(c.prefix) {\n\t\t\tbreak\n\t\t}\n\t\terr := rm.Delete(it.Key())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = it.Next()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func NeuraxPurge() {\n\tDataSender := cf.SendDataUDP\n\tif N.CommProto == \"tcp\" {\n\t\tDataSender = cf.SendDataTCP\n\t}\n\tfor _, host := range InfectedHosts {\n\t\terr := DataSender(host, N.CommPort, \"purge\")\n\t\tReportError(\"Cannot perform purge\", err)\n\t}\n\thandle_command(\"purge\")\n}", "func (m *Ico) Purge(w http.ResponseWriter, r *http.Request, p service.Params) (*service.Response, error) {\n\t// Get source for this request, pulling the region and bucket names from request headers.\n\tsrc, err := m.getSource(r.Header.Get(\"X-S3-Region\"), r.Header.Get(\"X-S3-Bucket\"))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Get image URL from request.\n\timgPath := p.Get(\"image\")\n\tif imgPath == \"\" {\n\t\treturn nil, fmt.Errorf(\"image URL is unset or empty\")\n\t}\n\n\timgDir, imgName := path.Split(imgPath)\n\n\t// Fetch list of directories in image path and append image name to each directory.\n\tdirList, err := src.ListDirs(imgDir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdirList = append(dirList, imgDir)\n\tfor i := range dirList {\n\t\tdirList[i] = path.Join(dirList[i], imgName)\n\t}\n\n\t// Delete images from local and remote cache.\n\tif err = src.Delete(dirList...); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &service.Response{http.StatusOK, map[string]bool{\"result\": true}}, nil\n}", "func (r Reserve) Delete() {\n\tos.Remove(r.path)\n}", "func (storage *B2Storage) DeleteFile(threadIndex int, filePath string) (err error) {\n\n if strings.HasSuffix(filePath, \".fsl\") {\n filePath = filePath[:len(filePath) - len(\".fsl\")]\n entries, err := storage.clients[threadIndex].ListFileNames(filePath, true, true)\n if err != nil {\n return err\n }\n\n toBeDeleted := false\n\n for _, entry := range entries {\n if entry.FileName != filePath || (!toBeDeleted && entry.Action != \"hide\" ) {\n continue\n }\n\n toBeDeleted = true\n\n err = storage.clients[threadIndex].DeleteFile(filePath, entry.FileID)\n if err != nil {\n return err\n }\n }\n\n return nil\n\n } else {\n entries, err := storage.clients[threadIndex].ListFileNames(filePath, true, false)\n if err != nil {\n return err\n }\n\n if len(entries) == 0 {\n return nil\n }\n return storage.clients[threadIndex].DeleteFile(filePath, entries[0].FileID)\n }\n}", "func (kvStore *KvStore) Delete(key string) (err error) {\n\tif len(kvStore.files) <= 0 {\n\t\tlog.Fatal(\"No files\")\n\t}\n\n\t// See Write - lots of work to be done here\n\tcount := len(kvStore.files)\n\terr = kvStore.files[count-1].Delete(key)\n\tsize, _ := kvStore.files[count-1].Size()\n\t// Just use 100 for the moment\n\tif size > 100 {\n\t\tnewFile, err2 := gklogfile.Open(fmt.Sprintf(\"c:\\\\devwork\\\\go\\\\gokave_data\\\\%s\\\\%d.gkv\", kvStore.storeName, time.Now().UTC().UnixNano()))\n\t\tif err != nil {\n\t\t\treturn err2\n\t\t}\n\t\t// This needs to be in a write mutex when we update the current file. All operations apart from this are 'read'\n\t\tkvStore.files = append(kvStore.files, newFile)\n\t}\n\tfmt.Printf(\"File size: %d\\n\", size)\n\treturn\n}", "func (index *spdIndex) Clear() {\n\tindex.mapping.Clear()\n}", "func Remove(file string) {\n\tknownFiles[file] = false\n\tdelete(allFiles, file)\n}", "func FileDeleteHandler(w http.ResponseWriter, r *http.Request) {\n\tr.ParseForm()\n\n\tfileSha1 := r.Form.Get(\"filehash\")\n\tfileMeta := meta.GetFileMeta(fileSha1)\n\n\t//delete file from disk\n\terr := os.Remove(fileMeta.FileAddr)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// delete file index\n\tmeta.RemoveFileMeta(fileSha1)\n\n\tw.WriteHeader(http.StatusOK)\n}", "func (t *Table) Delete() error {\n\tif t.fd == nil {\n\t\tt.blocksData = nil\n\t\tt.indexData = nil\n\t\treturn nil\n\t}\n\tif t.blockCache != nil {\n\t\tfor blk := 0; blk < t.numBlocks; blk++ {\n\t\t\tkey := t.blockCacheKey(blk)\n\t\t\tif v, ok := t.blockCache.Get(key); ok {\n\t\t\t\tif b, ok := v.(*block); ok {\n\t\t\t\t\tb.done()\n\t\t\t\t}\n\t\t\t\tt.blockCache.Del(key)\n\t\t\t}\n\t\t}\n\t}\n\tif t.indexCache != nil {\n\t\tt.indexCache.Del(t.id)\n\t}\n\tif len(t.blocksData) != 0 {\n\t\ty.Munmap(t.blocksData)\n\t}\n\tt.index = nil\n\tif len(t.indexData) != 0 {\n\t\ty.Munmap(t.indexData)\n\t}\n\tif err := t.fd.Truncate(0); err != nil {\n\t\t// This is very important to let the FS know that the file is deleted.\n\t\treturn err\n\t}\n\tfilename := t.fd.Name()\n\tif err := t.fd.Close(); err != nil {\n\t\treturn err\n\t}\n\tif err := os.Remove(filename); err != nil {\n\t\treturn err\n\t}\n\treturn os.Remove(filename + idxFileSuffix)\n}", "func (p *MessagePartition) releaseIndexfile(fileId uint64, file *os.File) {\n\tfile.Close()\n}", "func (s *API) PurgeQueue(w http.ResponseWriter, req *http.Request) {\n\tlog.Debug(\"PurgeQueue\")\n\tw.WriteHeader(http.StatusNotImplemented)\n}", "func (storage JSONStorage) Delete(indexToBeDeleted int64) {\n\tfile, err := ioutil.ReadFile(storage.FileName)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\ttodos := []Task{}\n\tjson.Unmarshal(file, &todos)\n\ttodos = append(todos[:indexToBeDeleted], todos[indexToBeDeleted:]...)\n\tjsonData, err := json.MarshalIndent(todos, \"\", \"\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tioutil.WriteFile(storage.FileName, jsonData, 0644)\n}", "func (t *tOps) remove(f *tFile) {\n\tt.cache.Delete(0, uint64(f.fd.Num), func() {\n\t\tif err := t.s.stor.Remove(f.fd); err != nil {\n\t\t\tt.s.logf(\"table@remove removing @%d %q\", f.fd.Num, err)\n\t\t} else {\n\t\t\tt.s.logf(\"table@remove removed @%d\", f.fd.Num)\n\t\t}\n\t\tif t.evictRemoved && t.bcache != nil {\n\t\t\tt.bcache.EvictNS(uint64(f.fd.Num))\n\t\t}\n\t})\n}", "func (s *MemorySeriesStorage) purgeSeries(fp model.Fingerprint, m model.Metric, quarantineReason error) {\n\ts.fpLocker.Lock(fp)\n\n\tvar (\n\t\tseries *memorySeries\n\t\tok bool\n\t)\n\n\tif series, ok = s.fpToSeries.get(fp); ok {\n\t\ts.fpToSeries.del(fp)\n\t\ts.memorySeries.Dec()\n\t\tm = series.metric\n\n\t\t// Adjust s.chunksToPersist and chunk.NumMemChunks down by\n\t\t// the number of chunks in this series that are not\n\t\t// persisted yet. Persisted chunks will be deducted from\n\t\t// chunk.NumMemChunks upon eviction.\n\t\tnumChunksNotYetPersisted := len(series.chunkDescs) - series.persistWatermark\n\t\tatomic.AddInt64(&chunk.NumMemChunks, int64(-numChunksNotYetPersisted))\n\t\tif !series.headChunkClosed {\n\t\t\t// Head chunk wasn't counted as waiting for persistence yet.\n\t\t\t// (But it was counted as a chunk in memory.)\n\t\t\tnumChunksNotYetPersisted--\n\t\t}\n\t\ts.incNumChunksToPersist(-numChunksNotYetPersisted)\n\n\t} else {\n\t\ts.persistence.purgeArchivedMetric(fp) // Ignoring error. There is nothing we can do.\n\t}\n\tif m != nil {\n\t\t// If we know a metric now, unindex it in any case.\n\t\t// purgeArchivedMetric might have done so already, but we cannot\n\t\t// be sure. Unindexing in idempotent, though.\n\t\ts.persistence.unindexMetric(fp, m)\n\t}\n\t// Attempt to delete/quarantine the series file in any case.\n\tif quarantineReason == nil {\n\t\t// No reason stated, simply delete the file.\n\t\tif _, err := s.persistence.deleteSeriesFile(fp); err != nil {\n\t\t\tlog.\n\t\t\t\tWith(\"fingerprint\", fp).\n\t\t\t\tWith(\"metric\", m).\n\t\t\t\tWith(\"error\", err).\n\t\t\t\tError(\"Error deleting series file.\")\n\t\t}\n\t\ts.seriesOps.WithLabelValues(requestedPurge).Inc()\n\t} else {\n\t\tif err := s.persistence.quarantineSeriesFile(fp, quarantineReason, m); err == nil {\n\t\t\ts.seriesOps.WithLabelValues(completedQurantine).Inc()\n\t\t} else {\n\t\t\ts.seriesOps.WithLabelValues(failedQuarantine).Inc()\n\t\t\tlog.\n\t\t\t\tWith(\"fingerprint\", fp).\n\t\t\t\tWith(\"metric\", m).\n\t\t\t\tWith(\"reason\", quarantineReason).\n\t\t\t\tWith(\"error\", err).\n\t\t\t\tError(\"Error quarantining series file.\")\n\t\t}\n\t}\n\n\ts.fpLocker.Unlock(fp)\n}", "func (c *Cluster) Purge(maxAge time.Duration) {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\n\tc.lastPurge = time.Now()\n\n\tvar removalKeys []string\n\n\tfor k, v := range c.members {\n\t\tif maxAge == 0 || time.Since(v) > maxAge {\n\t\t\tremovalKeys = append(removalKeys, k)\n\t\t}\n\t}\n\n\tfor _, key := range removalKeys {\n\t\tdelete(c.members, key)\n\t}\n}", "func (f *File) Delete() {\n\tif f.path != \"\" {\n\t\tos.Remove(f.path)\n\t}\n}", "func (c *Cache) purge() {\n\tc.lock.Lock()\n\tdefer c.lock.Unlock()\n\n\tif c.onEvicted != nil {\n\t\tfor _, v := range c.getElements() {\n\t\t\tc.onEvicted(v.Value)\n\t\t}\n\t}\n\tc.evictList = list.New()\n}", "func (h FileHandler) Remove(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\thash := vars[\"filehash\"]\n\n\tfilepath := getHashedFilepath(h.staticDir, hash)\n\n\tif exist := h.fs.Exist(filepath); !exist {\n\t\th.sendBadRequestError(w, \"file with that name doesn`t exist\")\n\t\treturn\n\t}\n\n\tif err := h.fs.RemoveFile(getHashedFilepath(h.staticDir, hash)); err != nil {\n\t\th.sendInternalError(w, \"removing file failed\")\n\t\treturn\n\t}\n\n\tw.Write([]byte(\"ok\"))\n}", "func Delete(c *cli.Context) {\n\tprinter.Progress(\"Kombusting\")\n\n\tfileName := c.Args().Get(0)\n\tif fileName == \"\" {\n\t\tprinter.Fatal(\n\t\t\tfmt.Errorf(\"Can't upsert file, no source template provided\"),\n\t\t\tfmt.Sprintf(\n\t\t\t\t\"Add the path to the source template file you want to generate like: `kombustion upsert template.yaml`.\",\n\t\t\t),\n\t\t\t\"https://www.kombustion.io/api/manifest/\",\n\t\t)\n\t}\n\n\tmanifestFile := manifest.FindAndLoadManifest()\n\n\tenvironment := c.String(\"environment\")\n\n\tstackName := cloudformation.GetStackName(manifestFile, fileName, environment, c.String(\"stack-name\"))\n\n\tregion := c.String(\"region\")\n\tif region == \"\" {\n\t\t// If no region was provided by the cli flag, check for the default in the manifest\n\t\tif manifestFile.Region != \"\" {\n\t\t\tregion = manifestFile.Region\n\t\t}\n\t}\n\n\ttasks.DeleteStack(\n\t\tstackName,\n\t\tc.GlobalString(\"profile\"),\n\t\tregion,\n\t)\n}", "func (pi *PackageIndexer) Remove(pack *Package) string {\n\tpi.mutex.Lock() \n\tdefer pi.mutex.Unlock()\n\t// package not indexed, return OK\n\tif pi.Query(pack.name) == FAIL {\n\t\treturn OK\n\t}\n\t// check if any packages depend on the package to be removed \n\t// go through each package in the index\n\tfor _, p := range pi.packs {\n\t\t// go through each package's dependencies \n\t\tfor _, dep := range p.deps {\n\t\t\t// a package's dependency depends on the package to be removed\n\t\t\tif pack.name == dep.name {\n\t\t\t\treturn FAIL\n\t\t\t}\n\t\t}\n\t}\n\t// remove package from index \n\tdelete(pi.packs, pack.name)\n\n\treturn OK \n}", "func (i *Index) Populate(ctx context.Context, store Store, opts ...PopulateOption) (n int, err error) {\n\tvar config PopulateConfig\n\n\tfor _, opt := range opts {\n\t\topt(&config)\n\t}\n\n\t// verify the index to derive missing index\n\t// we can skip missing source lookup as we're\n\t// only interested in populating the missing index\n\tdiff, err := i.verify(ctx, store, config.RemoveDanglingForeignKeys)\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"looking up missing indexes: %w\", err)\n\t}\n\n\tflush := func(batch kvSlice) error {\n\t\tif len(batch) == 0 {\n\t\t\treturn nil\n\t\t}\n\n\t\tif err := store.Update(ctx, func(tx Tx) error {\n\t\t\tindexBucket, err := i.indexBucket(tx)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tfor _, pair := range batch {\n\t\t\t\t// insert missing item into index\n\t\t\t\tif err := indexBucket.Put(pair[0], pair[1]); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tn++\n\t\t\t}\n\n\t\t\treturn nil\n\t\t}); err != nil {\n\t\t\treturn fmt.Errorf(\"updating index: %w\", err)\n\t\t}\n\n\t\treturn nil\n\t}\n\n\tvar batch kvSlice\n\n\tfor fk, fkm := range diff.MissingFromIndex {\n\t\tfor pk := range fkm {\n\t\t\tbatch = append(batch, [2][]byte{indexKey([]byte(fk), []byte(pk)), []byte(pk)})\n\n\t\t\tif len(batch) >= i.populateBatchSize {\n\t\t\t\tif err := flush(batch); err != nil {\n\t\t\t\t\treturn n, err\n\t\t\t\t}\n\n\t\t\t\tbatch = batch[:0]\n\t\t\t}\n\t\t}\n\t}\n\n\tif err := flush(batch); err != nil {\n\t\treturn n, err\n\t}\n\n\tif config.RemoveDanglingForeignKeys {\n\t\treturn n, i.remove(ctx, store, diff.MissingFromSource)\n\t}\n\n\treturn n, nil\n}", "func remove(pkg *pkg) error {\n\t// ensure no package are depending on this pkg\n\texistingPkg, ok := indexRead(pkg.Name)\n\tif ok {\n\t\tif len(existingPkg.DependantPkgs) != 0 {\n\t\t\treturn isDependant\n\t\t}\n\n\t\tupdateDependents(existingPkg, nil)\n\t}\n\n\tlocker.Lock()\n\tdefer locker.Unlock()\n\n\t// remove the index\n\tdelete(indexedPkgs, pkg.Name)\n\n\treturn nil\n}", "func (sm SectorMap) Delete(file byte) {\n\tfor i, f := range sm {\n\t\tif f == file {\n\t\t\tsm[i] = FileFree\n\t\t}\n\t}\n}", "func (s *Service) Purge(c context.Context, aids []int64) (err error) {\n\tfor _, aid := range aids {\n\t\tvar stat *api.Stat\n\t\tif stat, err = s.dao.Stat(c, aid); err != nil {\n\t\t\treturn\n\t\t}\n\t\ts.updateCache(stat)\n\t}\n\treturn\n}", "func (c *cache) purge() {\n\tp := make([]item, c.maxSize)\n\tt := time.Now()\n\tn := 0\n\tfor i := 0; i < c.curSize; i++ {\n\t\tif t.Sub(c.stories[i].t) < c.timeout {\n\t\t\tp[n] = c.stories[i]\n\t\t\tn++\n\t\t}\n\t}\n\tc.mutx.Lock()\n\tdefer c.mutx.Unlock()\n\tc.stories = p\n\tc.curSize = n\n}", "func (idx *Unique) Delete() error {\n\tctx, err := idx.getAuthenticatedContext(context.Background())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn deleteIndexRoot(ctx, idx.storageProvider, idx.indexRootDir)\n}", "func (i *queueIndex) close() error {\n\treturn i.indexArena.Unmap()\n}", "func (fc *fileCache) Delete(key string) {\n\tfc.cache.Delete(key)\n\tfc.dirty = true\n}", "func RemoveAll(path string) error", "func (*dao) Purge(ctx context.Context, retentionHour int, includeOperations []string, dryRun bool) (int64, error) {\n\tormer, err := orm.FromContext(ctx)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tif dryRun {\n\t\treturn dryRunPurge(ormer, retentionHour, includeOperations)\n\t}\n\tsql := \"DELETE FROM audit_log WHERE op_time < NOW() - ? * interval '1 hour' \"\n\tfilterOps := permitOps(includeOperations)\n\tif len(filterOps) == 0 {\n\t\tlog.Infof(\"no operation selected, skip to purge audit log\")\n\t\treturn 0, nil\n\t}\n\tsql = sql + \"AND lower(operation) IN ('\" + strings.Join(filterOps, \"','\") + \"')\"\n\tlog.Debugf(\"the sql is %v\", sql)\n\n\tr, err := ormer.Raw(sql, retentionHour).Exec()\n\tif err != nil {\n\t\tlog.Errorf(\"failed to purge audit log, error %v\", err)\n\t\treturn 0, err\n\t}\n\tdelRows, rErr := r.RowsAffected()\n\tif rErr != nil {\n\t\tlog.Errorf(\"failed to purge audit log, error %v\", rErr)\n\t\treturn 0, rErr\n\t}\n\tlog.Infof(\"purged %d audit logs in the database\", delRows)\n\n\treturn delRows, err\n}", "func deleteAllInt(index int, testMode bool) error {\n\tallPaths, errPaths := getPaths()\n\tif errPaths != nil {\n\t\tcolor.Red(\":: Error while reading .tempestcf\")\n\t\treturn errPaths\n\t}\n\tif index >= 0 && index < len(allPaths) {\n\t\tfor indx, indPath := range allPaths {\n\t\t\tif index == indx {\n\t\t\t\t// color.Cyan(indPath)\n\t\t\t\tfInt, fInfo, eInt := fetchAll(indPath)\n\t\t\t\tif eInt != nil {\n\t\t\t\t\tfmt.Println(\"-----\", eInt)\n\t\t\t\t}\n\t\t\t\tif fInfo != nil {\n\t\t\t\t\treturn emptyFile(indPath, fInfo, testMode)\n\t\t\t\t}\n\t\t\t\treturn deleteAllStr(indPath, fInt, testMode)\n\t\t\t}\n\t\t}\n\t}\n\treturn errors.New(\"Nothing to purge\")\n}", "func (i *Index) Delete(tr fdb.Transaction, primaryTuple tuple.Tuple, key tuple.Tuple) {\n\tif key == nil {\n\t\tfmt.Println(\"index key is NIL strange behavior\")\n\t\t// no need to clean, this field wasn't indexed\n\t\treturn\n\t}\n\tsub := i.dir.Sub(key...)\n\tif i.Unique {\n\t\tfmt.Println(\"+++ delete the index\", sub)\n\t\ttr.Clear(sub)\n\t} else {\n\t\t// Add primary here\n\t\tsub = sub.Sub(primaryTuple...)\n\t\ttr.Clear(sub) // removing old keys\n\t}\n}", "func (c *Client) QueuePurge(queue string, noWait bool, connOpts *ConnectOpts) error {\n\tdefaultConnOpts := DefaultConnectOpts()\n\tif connOpts != nil {\n\t\tdefaultConnOpts = connOpts\n\t}\n\n\tconn, err := c.connect(defaultConnOpts)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer conn.Close()\n\n\tch, err := conn.Channel()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer ch.Close()\n\n\tnum, err := ch.QueuePurge(queue, noWait)\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Printf(\"%d messages purged from queue [%s].\\n\", num, queue)\n\n\treturn nil\n}", "func deleteFile( filename string) {\n // createFile() // use the createFile first, then delete file\n checkExistence(filename)\n err := os.Remove(filename)\n u.ErrNil(err, \"Unable to remove testfile1.txt\")\n log.Printf(\"Deleted %s\", filename)\n}", "func (f *FakeController) Purge(deployments []string, log log.Logger) error {\n\treturn nil\n}", "func (a *App) Purge() {\r\n\t// As we gonna loop and change this varibale we\r\n\t// lock it during all the purging process\r\n\ta.Transactions.Lock()\r\n\tdefer a.Transactions.Unlock()\r\n\r\n\t// Eventhough that we only need to change\r\n\t// the stats in some cases, its ok to lock during\r\n\t// the entire process, so noone can access to\r\n\t// partial information\r\n\ta.Stats.Lock()\r\n\tdefer a.Stats.Unlock()\r\n\r\n\tnow := time.Now()\r\n\r\n\t// Loop while there are invalid txs\r\n\tfor {\r\n\t\tif len(a.Transactions.T) == 0 {\r\n\t\t\tbreak\r\n\t\t}\r\n\r\n\t\tpivot := a.Transactions.T[0]\r\n\r\n\t\t// If the last tx is in the PurgTime interval\r\n\t\t// then we are ok, no need to purge txs\r\n\t\tif now.Sub(pivot.Timestamp) < a.PurgeTime {\r\n\t\t\tbreak\r\n\t\t}\r\n\r\n\t\t// Update the stats\r\n\t\ta.Stats.S.Sum -= pivot.Amount\r\n\t\ta.Stats.S.Count -= 1\r\n\r\n\t\t// Update the average\r\n\t\tif a.Stats.S.Count == 0 {\r\n\t\t\ta.Stats.S.Avg = 0.0\r\n\t\t} else {\r\n\t\t\ta.Stats.S.Avg = a.Stats.S.Sum / float64(a.Stats.S.Count)\r\n\t\t}\r\n\r\n\t\t// Min update only when queue has elements\r\n\t\tif minQueueLen := len(a.Stats.S.MinQueue); minQueueLen > 0 {\r\n\t\t\ttmp := binaryDelete(a.Stats.S.MinQueue, pivot.Amount, descendingOrder)\r\n\t\t\ta.Stats.S.MinQueue = tmp\r\n\r\n\t\t\tif minQueueLen == 1 {\r\n\t\t\t\ta.Stats.S.Min = MaxFloat64\r\n\t\t\t} else {\r\n\t\t\t\ta.Stats.S.Min = a.Stats.S.MinQueue[minQueueLen-2]\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Max update, equivalent to the Min\r\n\t\tif maxQueueLen := len(a.Stats.S.MaxQueue); maxQueueLen > 0 {\r\n\t\t\ttmp := binaryDelete(a.Stats.S.MaxQueue, pivot.Amount, ascendingOrder)\r\n\t\t\ta.Stats.S.MaxQueue = tmp\r\n\r\n\t\t\tif maxQueueLen == 1 {\r\n\t\t\t\ta.Stats.S.Max = -MaxFloat64\r\n\t\t\t} else {\r\n\t\t\t\ta.Stats.S.Max = a.Stats.S.MaxQueue[maxQueueLen-2]\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Remove the old tx\r\n\t\ta.Transactions.T = a.Transactions.T[1:]\r\n\t}\r\n}", "func (g *GistFile) Delete(id string) (*http.Response, error) {\n\turll := fmt.Sprintf(\"/gists/%s\", id)\n\treq, err := http.NewRequest(http.MethodDelete, urll, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp, err := auth.Session.Client.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn resp, nil\n}", "func cleanDiscoCache(absolutePath string, filepaths []string, updated map[string]bool, errors *errorlist.Errors) {\n\tfor _, fp := range filepaths {\n\t\t_, filename := filepath.Split(fp)\n\t\tif !updated[filename] {\n\t\t\tfp = path.Join(absolutePath, filename)\n\t\t\tif err := os.Remove(fp); err != nil {\n\t\t\t\terrors.Add(fmt.Errorf(\"Error deleting expired Discovery doc %v: %v\", fp, err))\n\t\t\t}\n\t\t}\n\t}\n}", "func (file *File) Delete(name string) {\n\tdelete(file.cache, name)\n}", "func (vfs *volatileVFS) Delete(name string) C.int {\n\tvfs.mu.Lock()\n\tdefer vfs.mu.Unlock()\n\n\tfile, ok := vfs.files[name]\n\tif !ok {\n\t\tvfs.errno = C.ENOENT\n\t\treturn C.SQLITE_IOERR_DELETE_NOENT\n\t}\n\n\t// Check that there are no consumers of this file.\n\tfor iFd := range vfs.fds {\n\t\tif vfs.fds[iFd] == file {\n\t\t\tvfs.errno = C.EBUSY\n\t\t\treturn C.SQLITE_IOERR_DELETE\n\t\t}\n\t}\n\n\tdelete(vfs.files, name)\n\n\treturn C.SQLITE_OK\n}", "func (self Source) Delete() {\n\tC.walDeleteSource(C.ALuint(self))\n}", "func (i *BTreeIndex) Delete(key string) {\r\n\ti.Lock()\r\n\tdefer i.Unlock()\r\n\tif i.BTree == nil || i.LessFunction == nil {\r\n\t\tpanic(\"uninitialized index\")\r\n\t}\r\n\ti.BTree.Delete(btreeString{s: key, l: i.LessFunction})\r\n}", "func (o *DeleteRestapiV10AccountAccountIDExtensionExtensionIDMessageStoreMessageIDParams) SetPurge(purge *bool) {\n\to.Purge = purge\n}", "func deleteFile(path string) error {\n\tif _, err := os.Stat(path); err != nil {\n\t\t// return nil if file doesn't exist\n\t\treturn nil\n\t}\n\treturn os.Remove(path)\n}", "func Delete(c *cli.Context) {\n\tobjectStore := core.NewFilesystemStore(\".\")\n\n\tfileName := c.Args().Get(0)\n\tif fileName == \"\" {\n\t\tprinter.Fatal(\n\t\t\tfmt.Errorf(\"Can't upsert file, no source template provided\"),\n\t\t\t\"Add the path to the source template file you want to generate like: `kombustion upsert template.yaml`.\",\n\t\t\t\"https://www.kombustion.io/api/manifest/\",\n\t\t)\n\t}\n\n\tclient := &cloudformation.Wrapper{}\n\tprofile := c.GlobalString(\"profile\")\n\tregion := c.String(\"region\")\n\tenvName := c.String(\"environment\")\n\tstackName := c.String(\"stack-name\")\n\tmanifestFile := c.GlobalString(\"manifest-file\")\n\n\ttaskDelete(\n\t\tclient,\n\t\tobjectStore,\n\t\tfileName,\n\t\tprofile,\n\t\tstackName,\n\t\tregion,\n\t\tenvName,\n\t\tmanifestFile,\n\t)\n}", "func (fs *Ipfs) Delete(path string) error {\n\t// Remoe file if on disk and unpinn\n\tif fname, err := fs.makeFilename(path); err == nil {\n\t\tos.Remove(fname)\n\t}\n\n\tipath := ipath.New(path)\n\treturn fs.coreAPI.Pin().Rm(context.Background(), ipath)\n}", "func (a *Agent) purgeCheck(checkID types.CheckID) error {\n\tcheckPath := filepath.Join(a.config.DataDir, checksDir, checkIDHash(checkID))\n\tif _, err := os.Stat(checkPath); err == nil {\n\t\treturn os.Remove(checkPath)\n\t}\n\treturn nil\n}" ]
[ "0.64328444", "0.6051783", "0.5989495", "0.5970119", "0.5874667", "0.5830594", "0.5762296", "0.5714067", "0.5655797", "0.5615129", "0.5609594", "0.55285734", "0.54087853", "0.5383649", "0.5319065", "0.53037643", "0.5299404", "0.5286626", "0.52761537", "0.5270946", "0.5259426", "0.52334714", "0.5194501", "0.51914215", "0.51777434", "0.51724505", "0.51593125", "0.51429266", "0.51106024", "0.5106225", "0.5103177", "0.5061674", "0.5049653", "0.5045844", "0.5017378", "0.5014768", "0.5012715", "0.5007158", "0.5004935", "0.49907002", "0.49863377", "0.49811688", "0.49779963", "0.49578056", "0.4933531", "0.49190405", "0.49125677", "0.49113208", "0.49110994", "0.48964602", "0.48868766", "0.4881329", "0.48812395", "0.48677093", "0.4867519", "0.48646834", "0.48617792", "0.4856304", "0.48484692", "0.48295173", "0.4827448", "0.48245707", "0.4819774", "0.48166528", "0.48138565", "0.4809409", "0.4800908", "0.48003495", "0.4795427", "0.4790324", "0.47854638", "0.47826448", "0.4772076", "0.4763203", "0.47630325", "0.4761957", "0.47497356", "0.47493693", "0.47478577", "0.47109976", "0.47049877", "0.4703191", "0.4698494", "0.46855676", "0.46850687", "0.46762958", "0.46743688", "0.46721336", "0.4668523", "0.46665737", "0.46626306", "0.4660974", "0.46592265", "0.46572697", "0.46559602", "0.46489543", "0.46446115", "0.4644234", "0.46441278", "0.46414855" ]
0.65604246
0
AllFilesMissing returns true, if all files for the photo of this file are missing.
func (m *File) AllFilesMissing() bool { count := 0 if err := Db().Model(&File{}). Where("photo_id = ? AND file_missing = 0", m.PhotoID). Count(&count).Error; err != nil { log.Errorf("file: %s", err.Error()) } return count == 0 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func missing(ctx context.Context, r reflow.Repository, files ...reflow.File) ([]reflow.File, error) {\n\texists := make([]bool, len(files))\n\tg, ctx := errgroup.WithContext(ctx)\n\tfor i, file := range files {\n\t\ti, file := i, file\n\t\tg.Go(func() error {\n\t\t\t_, err := r.Stat(ctx, file.ID)\n\t\t\tif err == nil {\n\t\t\t\texists[i] = true\n\t\t\t} else if errors.Is(errors.NotExist, err) {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn err\n\t\t})\n\t}\n\tif err := g.Wait(); err != nil {\n\t\treturn nil, err\n\t}\n\tall := files\n\tfiles = nil\n\tfor i := range exists {\n\t\tif !exists[i] {\n\t\t\tfiles = append(files, all[i])\n\t\t}\n\t}\n\treturn files, nil\n}", "func allFilesExist(dir string, filenames []string) bool {\n\tfor _, filename := range filenames {\n\t\tpath := filepath.Join(dir, filename)\n\t\tif _, err := os.Stat(path); err != nil {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func (a *Archive) Empty() bool {\n\treturn len(a.Files) == 0\n}", "func (o *ViewProjectActivePages) HasFiles() bool {\n\tif o != nil && o.Files != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *V1DownloadSummary) HasAvailableFiles() bool {\n\tif o != nil && o.AvailableFiles != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func FileEmpty(name string) bool {\n\tstat, err := os.Stat(name)\n\treturn os.IsNotExist(err) || stat.Size() <= 0\n}", "func (o *OpenapiProcessFileAllOf) HasFileInfo() bool {\n\tif o != nil && o.FileInfo != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func checkFilesEmpty(test *TestData, c *tomlParser.TestCase,\n\tempty bool) error {\n\n\tvar fileList []string\n\tfor _, fileName := range c.FileNames {\n\t\tfiles, err := misc.GenerateFileList(fileName, c.IDRange)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfileList = append(fileList, files...)\n\t}\n\n\tif len(fileList) == 0 {\n\t\treturn fmt.Errorf(\"no files to test specified\")\n\t}\n\n\tvar sizeCheck func(int64) bool\n\tvar message string\n\tif empty {\n\t\tsizeCheck = func(s int64) bool { return s == 0 }\n\t\tmessage = \"non-empty\"\n\t} else {\n\t\tsizeCheck = func(s int64) bool {\n\t\t\tif c.FileSize == 0 {\n\t\t\t\treturn s != 0\n\t\t\t}\n\t\t\treturn s == c.FileSize\n\t\t}\n\t\tmessage = \"empty\"\n\t}\n\n\tvar badFileList []string\n\tfor _, fileName := range fileList {\n\t\tfilePaths, err := file.GetDataPaths(test.Path, fileName, test.Run.Seed, 1)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to construct data path for file %s:\\n%s\",\n\t\t\t\tfileName, err)\n\t\t}\n\n\t\tfor _, filePath := range filePaths {\n\t\t\tfi, err := os.Stat(filePath)\n\t\t\tif err != nil || !sizeCheck(fi.Size()) {\n\t\t\t\tbadFileList = append(badFileList, filePath)\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(badFileList) != 0 {\n\t\tbadFiles := strings.Join(badFileList, \"\\n\\t\\t\")\n\t\treturn fmt.Errorf(\"the following files were either missing, %s, or had \"+\n\t\t\t\"the wrong size:\\n\\n\\t\\t%s\", message, badFiles)\n\t}\n\treturn nil\n}", "func (o *OpenapiProcessFileAllOf) HasFailureReason() bool {\n\tif o != nil && o.FailureReason != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func areAllChangelistDescriptionsEmpty(descriptions []p4lib.Description) bool {\n\tfor _, desc := range descriptions {\n\t\tif len(desc.Files) != 0 {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func (a *Archive) Valid() bool {\n\tpaths := make(map[string]bool)\n\tfor _, f := range a.Reader.File {\n\t\tpaths[f.Name] = true\n\t}\n\texpected := []string{\n\t\t\"data/js/tweet_index.js\",\n\t\t\"data/js/user_details.js\",\n\t\t\"data/js/payload_details.js\",\n\t}\n\tfor _, path := range expected {\n\t\tif !paths[path] {\n\t\t\tlog.Printf(\"expected %s in zip file\", path)\n\t\t\treturn false\n\t\t}\n\t}\n\tfoundTweets := false\n\tfor path, _ := range paths {\n\t\tif matched, _ := filepath.Match(tweetJsonGlob, path); matched {\n\t\t\tfoundTweets = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif !foundTweets {\n\t\tlog.Printf(\"expected to find at least one tweets JSON file in zip archive\")\n\t\treturn false\n\t}\n\treturn true\n}", "func isEmptyFormFile(f *multipart.FileHeader) bool { return false }", "func hasFileFields(i interface{}, tagname string) bool {\n\tfound := false\n\n\trefl.WalkTaggedFields(reflect.ValueOf(i), func(v reflect.Value, sf reflect.StructField, tag string) {\n\t\tif sf.Type == multipartFileType || sf.Type == multipartFileHeaderType ||\n\t\t\tsf.Type == multipartFilesType || sf.Type == multipartFileHeadersType {\n\t\t\tfound = true\n\n\t\t\treturn\n\t\t}\n\t}, tagname)\n\n\treturn found\n}", "func (s *Syncthing) IsAllOverwritten() bool {\n\tfor _, folder := range s.Folders {\n\t\tif !folder.Overwritten {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func (t *DataProcessorTask) HasInputFiles() bool {\n\treturn t.Has(InputFiles)\n}", "func NonZeroFileExists(filename string) bool {\n\n\tif info, err := os.Stat(filename); err == nil {\n\t\tif info.Size() > 0 {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "func (o *OpenapiProcessFileAllOf) HasSpecFilePath() bool {\n\tif o != nil && o.SpecFilePath != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (m *File) NoJPEG() bool {\n\treturn m.FileType != string(fs.TypeJpeg)\n}", "func checkFiles(files []ignv2_2types.File) bool {\n\tcheckedFiles := make(map[string]bool)\n\tfor i := len(files) - 1; i >= 0; i-- {\n\t\tf := files[i]\n\t\t// skip over checked validated files\n\t\tif _, ok := checkedFiles[f.Path]; ok {\n\t\t\tcontinue\n\t\t}\n\t\tmode := defaultFilePermissions\n\t\tif f.Mode != nil {\n\t\t\tmode = os.FileMode(*f.Mode)\n\t\t}\n\t\tcontents, err := dataurl.DecodeString(f.Contents.Source)\n\t\tif err != nil {\n\t\t\tglog.Errorf(\"couldn't parse file: %v\", err)\n\t\t\treturn false\n\t\t}\n\t\tif status := checkFileContentsAndMode(f.Path, contents.Data, mode); !status {\n\t\t\treturn false\n\t\t}\n\t\tcheckedFiles[f.Path] = true\n\t}\n\treturn true\n}", "func (v *GenerateServiceResponse) IsSetFiles() bool {\n\treturn v != nil && v.Files != nil\n}", "func nonZeroFileExists(filename string) bool {\n\tinfo, err := os.Stat(filename)\n\tif os.IsNotExist(err) {\n\t\treturn false\n\t}\n\tif info.IsDir() {\n\t\treturn false\n\t}\n\treturn info.Size() > 0\n}", "func fileExistsAndNotEmpty(fName string) (bool, error) {\n\tif fi, err := os.Stat(fName); err == nil {\n\t\treturn (fi.Size() != 0), nil\n\t} else if errors.Is(err, os.ErrNotExist) {\n\t\treturn false, nil\n\t} else {\n\t\t// Some other error, file may not exist.\n\t\treturn false, err\n\t}\n}", "func (d Type) Missing() bool {\n\treturn d == MissingA || d == MissingB\n}", "func (a *AzureInfoer) HasImages() bool {\n\treturn false\n}", "func (o *UcsdBackupInfoAllOf) HasBackupFileName() bool {\n\tif o != nil && o.BackupFileName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func anyNonRead(source *Source) bool {\n\tfor _, entry := range source.Entries {\n\t\tif !entry.Read {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (pm *PathMap) isEmpty() bool {\n\treturn len(pm.dirs)+len(pm.blobs) == 0\n}", "func (t *FileType) IsEmpty() bool {\n\treturn len(t.FileTypes) < 1 &&\n\t\tt.MinLength == 0 &&\n\t\tt.MaxLength == 2147483647\n}", "func (o *VulnUpdateNotificationPayloadAllOf) HasImageDigest() bool {\n\tif o != nil && o.ImageDigest != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (l *Library) LoadAll() bool {\n\tok := false\n\tl.RLock()\n\tdefer l.RUnlock()\n\tfiles, err := ioutil.ReadDir(l.BaseDir)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\treturn false\n\t}\n\n\tfor _, file := range files {\n\t\tif file.IsDir() {\n\t\t\tl.Books[file.Name()] = *NewBook(l.BaseDir, file.Name())\n\t\t}\n\t}\n\tok = true\n\treturn ok\n}", "func (bg *bufferedGroup) isEmpty() bool {\n return len(bg.images) == 0 || bg.firstTimeKey.IsZero()\n}", "func (ms *MetricSet) haveFilesChanged() (bool, error) {\n\tvar stats syscall.Stat_t\n\tfor _, path := range ms.userFiles {\n\t\tif err := syscall.Stat(path, &stats); err != nil {\n\t\t\treturn true, errors.Wrapf(err, \"failed to stat %v\", path)\n\t\t}\n\n\t\tctime := time.Unix(int64(stats.Ctim.Sec), int64(stats.Ctim.Nsec))\n\t\tif ms.lastRead.Before(ctime) {\n\t\t\tms.log.Debugf(\"File changed: %v (lastRead=%v, ctime=%v)\", path, ms.lastRead, ctime)\n\n\t\t\treturn true, nil\n\t\t}\n\t}\n\n\treturn false, nil\n}", "func HasFiles() predicate.Location {\n\treturn predicate.Location(func(s *sql.Selector) {\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(Table, FieldID),\n\t\t\tsqlgraph.To(FilesTable, FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, FilesTable, FilesColumn),\n\t\t)\n\t\tsqlgraph.HasNeighbors(s, step)\n\t},\n\t)\n}", "func (o *ViewProjectActivePages) GetFilesOk() (*bool, bool) {\n\tif o == nil || o.Files == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Files, true\n}", "func isEmptyFile(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err != nil {\n\t\tif !os.IsNotExist(err) {\n\t\t\treturn false, err\n\t\t}\n\n\t\treturn true, nil\n\t}\n\n\tcontents, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tstrContents := string(contents)\n\treturn strings.TrimSpace(strContents) == \"\", nil\n}", "func (o *ApplianceImageBundleAllOf) HasFingerprint() bool {\n\tif o != nil && o.Fingerprint != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (s *SwiftLocation) DiscoverExistingFiles(matcher Matcher) error {\n\tprefix := string(s.ObjectNamePrefix)\n\tif prefix != \"\" && !strings.HasSuffix(prefix, \"/\") {\n\t\tprefix += \"/\"\n\t}\n\n\tif s.Container == nil {\n\t\treturn fmt.Errorf(\n\t\t\t\"could not list objects in Swift at %s/%s: not connected to Swift\",\n\t\t\ts.ContainerName, prefix,\n\t\t)\n\t}\n\n\titer := s.Container.Objects()\n\titer.Prefix = prefix\n\ts.FileExists = make(map[string]bool)\n\terr := iter.Foreach(func(object *schwift.Object) error {\n\t\ts.FileExists[object.Name()] = true\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\n\t\t\t\"could not list objects in Swift at %s/%s: %s\",\n\t\t\ts.ContainerName, prefix, err.Error(),\n\t\t)\n\t}\n\n\treturn nil\n}", "func (opts Options) IsValid() bool {\n\treturn len(opts.Filepaths) > 0\n}", "func isEmpty(name string) (bool, error) {\n\tf, err := os.Open(name)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tdefer f.Close()\n\n\t_, err = f.Readdirnames(1)\n\tif err == io.EOF {\n\t\treturn true, nil\n\t}\n\treturn false, err // not empty or error\n}", "func (this *Target) AllFiles() []interfaces.FileSpec {\n\tfiles := this.files()\n\tfor _, fileSpec := range this.Files {\n\t\tswitch fileSpec.(type) {\n\t\tcase interfaces.TargetSpec:\n\t\t\tfilegroup := fileSpec.(interfaces.TargetSpec).Target().(*Target)\n\t\t\tfiles = append(files, filegroup.AllFiles()...)\n\t\t}\n\t}\n\n\treturn files\n}", "func validateOutputFiles(copies []*sbox_proto.Copy, sandboxDir string) []error {\n\tvar missingOutputErrors []error\n\tfor _, copyPair := range copies {\n\t\tfromPath := joinPath(sandboxDir, copyPair.GetFrom())\n\t\tfileInfo, err := os.Stat(fromPath)\n\t\tif err != nil {\n\t\t\tmissingOutputErrors = append(missingOutputErrors, fmt.Errorf(\"%s: does not exist\", fromPath))\n\t\t\tcontinue\n\t\t}\n\t\tif fileInfo.IsDir() {\n\t\t\tmissingOutputErrors = append(missingOutputErrors, fmt.Errorf(\"%s: not a file\", fromPath))\n\t\t}\n\t}\n\treturn missingOutputErrors\n}", "func (o *OpenapiProcessFileAllOf) HasFileProcessingStatus() bool {\n\tif o != nil && o.FileProcessingStatus != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (ac *AnchorMap) KeysAreMissing() bool {\n\tfor _, v := range ac.anchorMap {\n\t\tif !v {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (pd PackageDifference) Any() bool {\n\tif len(pd.Additions) > 0 || len(pd.Removals) > 0 || len(pd.Changes) > 0 {\n\t\treturn true\n\t}\n\treturn false\n}", "func (t *DataProcessorTask) HasOutputFiles() bool {\n\treturn t.Has(OutputFiles)\n}", "func (this ActivityStreamsImageProperty) Empty() bool {\n\treturn this.Len() == 0\n}", "func IsEmpty(path string) (bool, error) {\n\tpath = file.ExpandPath(path)\n\td, err := os.Open(path)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tdefer d.Close()\n\t// Check ONLY the next file's metadata, as no need to check more to know whether the directory is empty or not.\n\t_, err = d.Readdir(1)\n\tif err == io.EOF {\n\t\treturn true, nil\n\t}\n\treturn false, err\n}", "func (o *OsInstallAllOf) HasImage() bool {\n\tif o != nil && o.Image != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func isEmpty(path string) bool {\n\tfi, err := os.Stat(path)\n\tif err != nil {\n\t\tFatal(err)\n\t}\n\n\tif !fi.IsDir() {\n\t\treturn fi.Size() == 0\n\t}\n\n\tf, err := os.Open(path)\n\tif err != nil {\n\t\tFatal(err)\n\t}\n\tdefer f.Close()\n\n\tnames, err := f.Readdirnames(-1)\n\tif err != nil && err != io.EOF {\n\t\tFatal(err)\n\t}\n\n\tfor _, name := range names {\n\t\tif len(name) > 0 && name[0] != '.' {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func (set *AppleSet) ContainsAll(i ...Apple) bool {\n\tif set == nil {\n\t\treturn false\n\t}\n\n\tset.s.RLock()\n\tdefer set.s.RUnlock()\n\n\tfor _, v := range i {\n\t\tif !set.Contains(v) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func (p *ArchiveCheckEmpty) IsEmpty() bool {\n\treturn !p.hasFiles\n}", "func missingFields(fields ...string) bool {\n\tfor _, field := range fields {\n\t\tif field == \"\" {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (f *file) IsDir() bool {\n\treturn f.files != nil && len(f.files) > 0\n}", "func (r *DetectionResults) HasFailures() bool {\n\treturn r.Summary.Types.Filesize > 0 || r.Summary.Types.Filename > 0 || r.Summary.Types.Filecontent > 0\n}", "func (o *OpenapiProcessFileAllOf) HasFileDownloadStatus() bool {\n\tif o != nil && o.FileDownloadStatus != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *OpenapiProcessFileAllOf) HasFileValidationStatus() bool {\n\tif o != nil && o.FileValidationStatus != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func FileExsit(file ...string) (exsit bool) {\n\tfor _, f := range file {\n\t\tfi, err := os.Stat(f)\n\t\tif (err == nil && os.IsExist(err)) || !fi.IsDir() {\n\t\t\texsit = true\n\t\t}\n\t}\n\treturn\n}", "func hasSlides(fis []os.FileInfo) bool {\n\tfor _, fi := range fis {\n\t\tif !fi.IsDir() && pathpkg.Ext(fi.Name()) == \".slide\" {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (f Files) Validate() error {\n\tfor _, f := range f.FileList {\n\t\tif len(f) == 0 {\n\t\t\treturn errors.Wrap(ErrValidatingData, \"File in FileList requires a name\")\n\t\t}\n\t}\n\treturn nil\n}", "func IsEmpty(fs Fs, path string) (bool, error) {\n\tif b, _ := Exists(fs, path); !b {\n\t\treturn false, fmt.Errorf(\"%q path does not exist\", path)\n\t}\n\tfi, err := fs.Stat(path)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tif fi.IsDir() {\n\t\tf, err := fs.Open(path)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\tdefer f.Close()\n\t\tlist, err := f.Readdir(-1)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\treturn len(list) == 0, nil\n\t}\n\treturn fi.Size() == 0, nil\n}", "func (d *DataDirectory) IsEmpty() (bool, error) {\n\tdir, err := os.Open(d.path)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"failed to open data directory %s: %v\", d.path, err)\n\t}\n\tdefer dir.Close()\n\t_, err = dir.Readdirnames(1)\n\tif err == io.EOF {\n\t\treturn true, nil\n\t}\n\treturn false, err\n}", "func (sample *SampleImage) Exists() bool {\n\treturn filesystem.Exists(sample.RootDir)\n}", "func isEmptyDirent(dirent *syscall.Dirent) bool {\n\treturn dirent.Ino == 0\n}", "func countNonDirectoryFiles(files []os.FileInfo) int {\n\tNonDirectoryFiles := 0\n\tfor _, f := range files {\n\t\tif !f.IsDir() {\n\t\t\tNonDirectoryFiles++\n\t\t}\n\t}\n\treturn NonDirectoryFiles\n}", "func (result *FedoraResult) AllRecordsSucceeded() bool {\n\tfor _, record := range result.MetadataRecords {\n\t\tif false == record.Succeeded() {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func (o *AnalysisArchiveSummary) HasTotalImageCount() bool {\n\tif o != nil && o.TotalImageCount != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (s *FileSet) Present(file string) bool {\n\treturn s.files[file]\n}", "func (m *Map) HasAll(dots []Dot) bool {\n\tfor _, dot := range dots {\n\t\tif !m.area.ContainsDot(dot) {\n\t\t\treturn false\n\t\t}\n\n\t\tp := atomic.LoadPointer(m.fields[dot.Y][dot.X])\n\t\tif p == unsafe.Pointer(uintptr(0)) {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "func All() []File {\n\tall := make([]File, len(allFiles))\n\tfor _, f := range allFiles {\n\t\tall = append(all, f)\n\t}\n\treturn all\n}", "func missing(tr types.Trace) bool {\n\tcount := 0\n\tfor _, x := range tr {\n\t\tif x == vec32.MissingDataSentinel {\n\t\t\tcount++\n\t\t}\n\t}\n\treturn (100*count)/len(tr) > 50\n}", "func (d *Dir) Valid() bool {\n\treturn len(d.Filename) > 0 && len(d.Package) > 0\n}", "func (iter *SyncFolderIterator) Next() bool {\n\treturn len(iter.fileInfos) > 0\n}", "func (f *File) Exists() (bool, error) {\n\t_, err := f.getObjectAttrs()\n\tif err != nil {\n\t\tif err.Error() == doesNotExistError {\n\t\t\treturn false, nil\n\t\t}\n\t\treturn false, err\n\t}\n\treturn true, nil\n}", "func (o *ApplianceImageBundleAllOf) HasDebugPackages() bool {\n\tif o != nil && o.DebugPackages != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (rst *watcherSyncerTester) allEventsHandled() bool {\n\teventsHandled := true\n\tfor _, l := range rst.lws {\n\t\teventsHandled = eventsHandled && (len(l.listCallResults) == 0)\n\t\teventsHandled = eventsHandled && (len(l.stopEvents) == 0)\n\t\teventsHandled = eventsHandled && (len(l.results) == 0)\n\t}\n\treturn eventsHandled\n}", "func IsEmpty(name string) (bool, error) {\n\tf, err := os.Open(name)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tdefer f.Close()\n\n\t_, err = f.Readdir(1)\n\n\tif err == io.EOF {\n\t\treturn true, nil\n\t}\n\treturn false, err\n}", "func (eksUtils eksDetectorUtils) fileExists(filename string) bool {\n\tinfo, err := os.Stat(filename)\n\treturn err == nil && !info.IsDir()\n}", "func (backend *ESClient) ProfilesMissing(allHashes []string) (missingHashes []string, err error) {\n\tidsQuery := elastic.NewIdsQuery(mappings.DocType)\n\tidsQuery.Ids(allHashes...)\n\tdocVersionQuery := elastic.NewMatchQuery(\"doc_version\", \"1\")\n\n\tboolQuery := elastic.NewBoolQuery()\n\tboolQuery = boolQuery.Must(idsQuery)\n\tboolQuery = boolQuery.Must(docVersionQuery)\n\n\tesIndex := relaxting.CompProfilesIndex\n\n\tfsc := elastic.NewFetchSourceContext(false)\n\n\tsearchSource := elastic.NewSearchSource().\n\t\tFetchSourceContext(fsc).\n\t\tQuery(boolQuery).\n\t\tSize(1000)\n\n\tsource, err := searchSource.Source()\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"ProfilesMissing unable to get Source\")\n\t}\n\trelaxting.LogQueryPartMin(esIndex, source, \"ProfilesMissing query searchSource\")\n\n\tsearchResult, err := backend.client.Search().\n\t\tSearchSource(searchSource).\n\t\tIndex(esIndex).\n\t\tDo(context.Background())\n\n\tif err != nil {\n\t\treturn missingHashes, errors.Wrap(err, \"ProfilesMissing unable to complete search\")\n\t}\n\n\tlogrus.Debugf(\"ProfilesMissing got %d meta profiles in %d milliseconds\\n\", searchResult.TotalHits(), searchResult.TookInMillis)\n\texistingHashes := make(map[string]struct{}, searchResult.TotalHits())\n\n\tif searchResult.TotalHits() > 0 && searchResult.Hits.TotalHits > 0 {\n\t\tfor _, hit := range searchResult.Hits.Hits {\n\t\t\texistingHashes[hit.Id] = struct{}{}\n\t\t}\n\t}\n\n\tfor _, oneHash := range allHashes {\n\t\tif _, ok := existingHashes[oneHash]; !ok {\n\t\t\tmissingHashes = append(missingHashes, oneHash)\n\t\t}\n\t}\n\n\tlogrus.Debugf(\"ProfilesMissing returning missingHashes: %v\\n\", missingHashes)\n\treturn missingHashes, nil\n}", "func (d *SourceFilesystem) Contains(filename string) bool {\n\tfor _, dir := range d.Dirs {\n\t\tif strings.HasPrefix(filename, dir.Meta().Filename) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (o *InlineObject1) HasFile() bool {\n\tif o != nil && o.File != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func UploadAll(key fsdb.Key) bool {\n\treturn false\n}", "func (s *StorageSpec) AnyUseAllDevices() bool {\n\tif s.Selection.GetUseAllDevices() {\n\t\treturn true\n\t}\n\n\tfor _, n := range s.Nodes {\n\t\tif n.Selection.GetUseAllDevices() {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "func (rf *RepositoryFile) Exists() bool {\n\t// Always overwrite template files\n\tif rf.IsTemplate {\n\t\treturn false\n\t}\n\n\tfsfileInfo, err := os.Lstat(rf.FSPath)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\t// Checking attributes and owner/group IDs\n\tif fsfileInfo.Mode() != rf.Mode {\n\t\treturn false\n\t}\n\tif fsfileInfo.Sys() == nil {\n\t\treturn false\n\t}\n\tfsfileUid := int(fsfileInfo.Sys().(*syscall.Stat_t).Uid)\n\tfsfileGid := int(fsfileInfo.Sys().(*syscall.Stat_t).Gid)\n\n\tif fsfileUid != rf.Uid || fsfileGid != rf.Gid {\n\t\treturn false\n\t}\n\n\tswitch {\n\tcase rf.Mode.IsDir():\n\t\tif !fsfileInfo.Mode().IsDir() {\n\t\t\treturn false\n\t\t}\n\tcase rf.Mode&os.ModeSymlink != 0:\n\t\tif fsfileInfo.Mode()&os.ModeSymlink == 0 {\n\t\t\treturn false\n\t\t}\n\t\tdest1, err := os.Readlink(rf.Path)\n\t\tif err != nil {\n\t\t\treturn false\n\t\t}\n\t\tdest2, err := os.Readlink(rf.FSPath)\n\t\tif err != nil {\n\t\t\treturn false\n\t\t}\n\t\tif dest1 != dest2 {\n\t\t\treturn false\n\t\t}\n\tcase rf.Mode.IsRegular():\n\t\tif !fsfileInfo.Mode().IsRegular() {\n\t\t\treturn false\n\t\t}\n\t\tif !equalContent(rf.Path, rf.FSPath) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "func IgnoreFiles(e *colly.HTMLElement, files []string) bool {\n\tignore := false\n\tfor i := 0; i < len(files); i++ {\n\t\tif strings.Contains(e.Attr(\"href\"), files[i]) {\n\t\t\tignore = true\n\t\t}\n\t}\n\treturn ignore\n}", "func (m *StorageMock) MinimockAllDone() bool {\n\tfor _, e := range m.AllMock.expectations {\n\t\tif mm_atomic.LoadUint64(&e.Counter) < 1 {\n\t\t\treturn false\n\t\t}\n\t}\n\n\t// if default expectation was set then invocations count should be greater than zero\n\tif m.AllMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterAllCounter) < 1 {\n\t\treturn false\n\t}\n\t// if func was set then invocations count should be greater than zero\n\tif m.funcAll != nil && mm_atomic.LoadUint64(&m.afterAllCounter) < 1 {\n\t\treturn false\n\t}\n\treturn true\n}", "func RemoveAll(name string)(bool){\n\t_,err := os.Stat(name)\n\tif err == nil {\n\t\terrRe := os.RemoveAll(name)\n\t\tif errRe != nil {\n\t\t\tfmt.Println(errRe)\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t}\n\tif os.IsExist(err) {\n\t\terrRe := os.RemoveAll(name)\n\t\tif errRe != nil {\n\t\t\tfmt.Println(errRe)\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t}\n\treturn true\n}", "func (wd WorkDir) IsEmpty(dir string) bool {\n\tname := wd.Join(dir)\n\tf, err := os.Open(name)\n\tif err != nil {\n\t\treturn false\n\t}\n\tdefer f.Close()\n\n\t_, err = f.Readdirnames(1) // Or f.Readdir(1)\n\tif err == io.EOF {\n\t\treturn true\n\t}\n\treturn false\n}", "func (this ActivityStreamsImagePropertyIterator) HasAny() bool {\n\treturn this.IsActivityStreamsImage() ||\n\t\tthis.IsActivityStreamsLink() ||\n\t\tthis.IsActivityStreamsMention() ||\n\t\tthis.iri != nil\n}", "func IsFileExisting(filename string) bool {\n\t_, err := os.Stat(filename)\n\tif err == nil {\n\t\treturn true\n\t}\n\tif os.IsNotExist(err) {\n\t\treturn false\n\t}\n\treturn true\n}", "func (o *UcsdBackupInfoAllOf) HasFailureReason() bool {\n\tif o != nil && o.FailureReason != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func isDirEmpty(name string) bool {\n\tf, err := os.Open(name)\n\tif err != nil {\n\t\treturn true\n\t}\n\tdefer f.Close()\n\n\t_, err = f.Readdir(1)\n\treturn err == io.EOF\n}", "func (o *ArchivedAnalysis) HasImageDigest() bool {\n\tif o != nil && o.ImageDigest != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func isIgnoredFile(fileName string, fileRoot string) bool {\n\t// ignore root directory when checking ignore matching\n\ttrimmedName := strings.Replace(fileName, fileRoot, \"\", 1)\n\tfor _, pattern := range ignorePatterns {\n\t\tif wildcard.PatternMatch(trimmedName, pattern) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func hasBuildFile(ctx Context, dir string) bool {\n\tfor _, buildFile := range buildFiles {\n\t\t_, err := os.Stat(filepath.Join(dir, buildFile))\n\t\tif err == nil {\n\t\t\treturn true\n\t\t}\n\t\tif !os.IsNotExist(err) {\n\t\t\tctx.Fatalf(\"Error retrieving the build file stats: %v\", err)\n\t\t}\n\t}\n\treturn false\n}", "func FileExists(root string) bool {\n\t_, err := os.Stat(root)\n\treturn !os.IsNotExist(err)\n}", "func (o *PcloudImagesGetallNotFound) IsSuccess() bool {\n\treturn false\n}", "func (a *Assertions) FileExists(filepath string, userMessageComponents ...interface{}) bool {\n\ta.assertion()\n\tif didFail, message := shouldFileExist(filepath); didFail {\n\t\treturn a.fail(message, userMessageComponents...)\n\t}\n\treturn true\n}", "func fileExists(filename string) bool {\n\tif file, err := os.Stat(filename); os.IsNotExist(err) || file.IsDir() {\n\t\treturn false\n\t}\n\treturn true\n}", "func (page ImagePage) IsEmpty() (bool, error) {\n\timages, err := ExtractImages(page)\n\tif err != nil {\n\t\treturn true, err\n\t}\n\treturn len(images) == 0, nil\n}", "func (o *ApplianceImageBundleAllOf) HasAnsiblePackages() bool {\n\tif o != nil && o.AnsiblePackages != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}" ]
[ "0.65503687", "0.64398694", "0.5954523", "0.58424675", "0.57891077", "0.5778483", "0.574279", "0.56509024", "0.55799437", "0.5509933", "0.54750395", "0.54446423", "0.53924906", "0.53809565", "0.53588015", "0.53319484", "0.53288835", "0.53181213", "0.53008044", "0.52956885", "0.5289504", "0.5234387", "0.5234326", "0.5232961", "0.5224628", "0.5219011", "0.5205499", "0.52039623", "0.5202835", "0.5180478", "0.5177853", "0.5176312", "0.51709163", "0.5163928", "0.51595604", "0.514543", "0.51408577", "0.5111955", "0.5085856", "0.50826776", "0.50789624", "0.5068755", "0.50599194", "0.50465685", "0.5027515", "0.5009743", "0.5003851", "0.49873438", "0.497917", "0.49728853", "0.4969706", "0.49609423", "0.4954185", "0.49539015", "0.49493116", "0.49479654", "0.49445117", "0.4940862", "0.4929658", "0.49295077", "0.49247077", "0.49200955", "0.49130997", "0.49128053", "0.49069348", "0.49044588", "0.4903044", "0.4901261", "0.48893934", "0.48828954", "0.48806146", "0.48794535", "0.48765236", "0.48733404", "0.48692682", "0.4866232", "0.48660624", "0.48523492", "0.48514804", "0.4850382", "0.48489267", "0.48483688", "0.48396572", "0.48344582", "0.48275048", "0.482335", "0.48196208", "0.48171425", "0.48142934", "0.4813844", "0.48008588", "0.4783845", "0.47836167", "0.477938", "0.4776322", "0.477376", "0.4772906", "0.47693253", "0.47678974", "0.47655147" ]
0.8592274
0
Saves the file in the database.
func (m *File) Save() error { if m.PhotoID == 0 { return fmt.Errorf("file: photo id is empty (%s)", m.FileUID) } if err := Db().Save(m).Error; err != nil { return err } photo := Photo{} return Db().Model(m).Related(&photo).Error }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (f *File) Save() error {\n\tif f.Id == 0 {\n\t\treturn dbAccess.Insert(f)\n\t} else {\n\t\t_, err := dbAccess.Update(f)\n\t\treturn err\n\t}\n}", "func (m *FileUserDatabase) Save() (err error) {\n\tm.RLock()\n\n\tdefer m.RUnlock()\n\n\tif err = m.ToDatabaseModel().Write(m.Path); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (s *Storage) Save(m *model.FileInfo) error {\n\tvar err error\n\t// s.mu.Lock()\n\t// _, err = s.database.Exec(\"CREATE TABLE IF NOT EXISTS finfo (id SERIAL PRIMARY KEY, name TEXT, mode TEXT, mod_time TEXT, size TEXT)\")\n\t// s.mu.Unlock()\n\t// if err != nil {\n\t// \tprintln(\".err1\", err.Error())\n\t// \treturn err\n\t// }\n\n\ts.mu.Lock()\n\tstmt := \"INSERT INTO finfo (name, mode, mod_time, size) VALUES ($1, $2, $3, $4)\"\n\t_, err = s.database.Exec(stmt, m.Name, m.Mode, m.ModTime, m.Size)\n\ts.mu.Unlock()\n\tlog.Printf(\"insertion to the database: %s %s %s %d\", m.Name, m.Mode, m.ModTime, m.Size)\n\tif err != nil {\n\t\tprintln(\".err3\", err.Error())\n\t\treturn err\n\t}\n\n\treturn err\n}", "func (d *Database) SaveToFile() error {\n\t//TODO Use absolute path\n\terr := os.Chdir(\"../\" + config.DBFolder)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn err\n\t}\n\n\tf, err := os.Create(fmt.Sprintf(\"%s%d\", d.DatabaseName, d.Dlog.GetIndex()))\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn errors.New(\"error\")\n\t}\n\n\tfmt.Printf(\"Saving database instance to file. Max index: %d\\n\", d.Dlog.GetIndex())\n\tencoder := gob.NewEncoder(f)\n\terr = encoder.Encode(d.Data)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tf.Close()\n\n\treturn nil\n}", "func (fs *FileSystem) Save(f File) (err error) {\n\tfs.Lock()\n\tdefer fs.Unlock()\n\n\ttx, err := fs.db.Begin()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"begin Save\")\n\t}\n\n\tstmt, err := tx.Prepare(`\n\tINSERT OR REPLACE INTO\n\t\tfs\n\t(\n\t\tname, \n\t\tpermissions,\n\t\tuser_id,\n\t\tgroup_id,\n\t\tsize,\n\t\tcreated,\n\t\tmodified,\n\t\tdata,\n\t\tcompressed,\n\t\tencrypted\n\t) \n\t\tvalues \t\n\t(\n\t\t?, \n\t\t?,\n\t\t?,\n\t\t?,\n\t\t?,\n\t\t?,\n\t\t?,\n\t\t?,\n\t\t?,\n\t\t?\n\t)`)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"stmt Save\")\n\t}\n\tdefer stmt.Close()\n\n\t_, err = stmt.Exec(\n\t\tf.Name,\n\t\tf.Permissions,\n\t\tf.UserID,\n\t\tf.GroupID,\n\t\tf.Size,\n\t\tf.Created,\n\t\tf.Modified,\n\t\tf.Data,\n\t\tf.IsCompressed,\n\t\tf.IsEncrypted,\n\t)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"exec Save\")\n\t}\n\terr = tx.Commit()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"commit Save\")\n\t}\n\treturn\n\n}", "func (d *DB) Save() (err error) {\n\tb, err := json.MarshalIndent(d, \"\", \" \")\n\tif err != nil {\n\t\treturn\n\t}\n\terr = ioutil.WriteFile(d.filePath, b, os.ModePerm)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"Can't save the DB at path %q: %v\", d.filePath, err)\n\t\treturn\n\t}\n\treturn\n}", "func (f fileRecord) Save() bool {\n\t// Open database connection\n\tdb, err := dbConnect()\n\tif err != nil {\n\t\tlog.Println(err.Error())\n\t\treturn false\n\t}\n\n\t// Save fileRecord\n\tif err := db.SaveFileRecord(f); err != nil {\n\t\tlog.Println(err.Error())\n\t\treturn false\n\t}\n\n\tif err := db.Close(); err != nil {\n\t\tlog.Println(err.Error())\n\t}\n\n\treturn true\n}", "func (repo Repository) Save(file domain.File) error {\n\tfileDir := path.Join(repo.StorageDir, file.Path)\n\terr := os.MkdirAll(fileDir, 0777)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfilePath := path.Join(fileDir, file.Name)\n\tf, err := os.OpenFile(filePath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0777)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = f.Write(file.Data)\n\n\treturn err\n}", "func (bck *FileBackup) Save() error {\n\tconfig.Logger.Info(\"Writing database to file\")\n\tstart := time.Now()\n\n\tsize, err := bck.writeFile()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to save database\")\n\t}\n\n\tconfig.Logger.Info(\"Wrote database\", zap.Int(\"size (bytes)\", size), zap.Int(\"hashes\", bck.db.Hashes()), zap.Duration(\"duration\", time.Since(start)))\n\n\treturn nil\n}", "func (db *jsonDB) save() error {\n\tvar jsonData []byte\n\tdb.rwMutex.Lock()\n\tdefer db.rwMutex.Unlock()\n\tfile, err := os.OpenFile(db.path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0220)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"Cannot open DB File %v for Write\", db.path)\n\t}\n\tdefer func() {\n\t\terr = file.Close()\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Error closing DB file %v\\n%v\", db.path, err)\n\t\t}\n\t}()\n\terr = common.ToJSON(&db.data, &jsonData)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Cannot enncode JSON\")\n\t}\n\n\t_, err = file.Write(jsonData)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"Cannot write to DB file %v\", db.path)\n\t}\n\n\treturn nil\n}", "func (userFile *UserFile) Save(txn *sql.Tx) bool {\n\treturn conn.Exec(txn, \"insert ignore into `\"+userFileTable+\"` (`user_name`,`file_sha1`,`file_name`,`file_size`,`upload_at`) values (?,?,?,?,?)\", userFile.UserName, userFile.FileSha1, userFile.FileName, userFile.FileSize, userFile.UploadAt)\n}", "func (file *File) Save() {\n\tif file.autoFmt {\n\t\terr := file.Fmt()\n\t\tif err != nil {\n\t\t\tfile.NotifyUser(err.Error())\n\t\t}\n\t}\n\tfile.SnapshotSaved()\n\tcontents := []byte(file.ToString())\n\terr := ioutil.WriteFile(file.Name, contents, file.fileMode)\n\tif err != nil {\n\t\tfile.NotifyUser(\"Save Failed: \" + err.Error())\n\t} else {\n\t\tfile.savedBuffer.ReplaceBuffer(file.buffer.DeepDup())\n\t\tfile.NotifyUser(\"Saved.\")\n\t\tfile.modTime = time.Now()\n\t\tfile.md5sum = md5.Sum(contents)\n\t}\n}", "func (connection *Connection) Save(path string) error {\n\tjson, err := json.Marshal(connection)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = ioutil.WriteFile(path, json, 0644)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (d *Database) Save() error {\n\tb, err := json.Marshal(d.State)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Save\n\tif err := ioutil.WriteFile(d.FilePath, b, os.ModePerm); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (t *Type) Save(file string) error {\n\tif file == \"\" {\n\t\treturn errors.New(\"unable to save schema, no file specified\")\n\t}\n\n\tlog.WithFields(log.Fields{\n\t\t\"schema_file\": file,\n\t}).Debug(\"saving schema\")\n\n\tschemaFile, err := json.MarshalIndent(t, \"\", \" \")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn ioutil.WriteFile(file, schemaFile, 0644)\n}", "func (gist *Gist) Save() {\n\t_, err := Db.NamedExec(`\n\t\tUPDATE gists SET title = :title,\n\t\tcontent = :content, public = :public, updated_at = :updated_at WHERE id = :id`, gist,\n\t)\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "func (m *FileDatabaseModel) Write(fileName string) (err error) {\n\tvar (\n\t\tdata []byte\n\t)\n\n\tif data, err = yaml.Marshal(m); err != nil {\n\t\treturn err\n\t}\n\n\treturn os.WriteFile(fileName, data, fileAuthenticationMode)\n}", "func (p *plugin) saveFile() {\n\tp.m.RLock()\n\terr := util.WriteFile(p.file, p.users, true)\n\tp.m.RUnlock()\n\n\tif err != nil {\n\t\tlog.Println(\"[stats] save:\", err)\n\t}\n}", "func (d deck) saveToFile(fileName string) error{\n\n\t// WriteFile (filename, [] byte, permission)\n\treturn ioutil.WriteFile(fileName, []byte (d.toString()), 0666)\n}", "func (f *FilePersist) Save(ctx context.Context, data map[string]string) error {\n\tfr, err := os.OpenFile(f.filename, os.O_WRONLY, 0644)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to open file for persist: %w\", err)\n\t}\n\tdefer fr.Close()\n\tif err := json.NewEncoder(fr).Encode(data); err != nil {\n\t\treturn fmt.Errorf(\"unable to encode: %w\", err)\n\t}\n\treturn nil\n}", "func (s store) Save() {\n\ts.writeToDisk()\n}", "func (db *FileDB) SerializeToFile() (err error) {\n\tdb.LockAll()\n\tdefer db.UnlockAll()\n\n\t// create/truncate file for writing to\n\tfile, err := os.Create(db.file)\n\tif err != nil {\n\t\tCritical.Log(err)\n\t\treturn err\n\t}\n\tdefer file.Close()\n\n\t// encode & store DB to file\n\tif err = gob.NewEncoder(file).Encode(&db); err != nil {\n\t\tCritical.Log(err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (s *Siegfried) Save(path string) error {\n\tls := persist.NewLoadSaver(nil)\n\tls.SaveTime(s.C)\n\ts.em.Save(ls)\n\ts.mm.Save(ls)\n\ts.cm.Save(ls)\n\ts.bm.Save(ls)\n\ts.tm.Save(ls)\n\tls.SaveTinyUInt(len(s.ids))\n\tfor _, i := range s.ids {\n\t\ti.Save(ls)\n\t}\n\tif ls.Err != nil {\n\t\treturn ls.Err\n\t}\n\tf, err := os.Create(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\t_, err = f.Write(append(config.Magic(), byte(config.Version()[0]), byte(config.Version()[1])))\n\tif err != nil {\n\t\treturn err\n\t}\n\tz, err := flate.NewWriter(f, 1)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = z.Write(ls.Bytes())\n\tz.Close()\n\treturn err\n}", "func uploadSaveDB(userID, filename string) {\n\tsplitFilename := strings.Split(filename, \".\")\n\textension := splitFilename[len(splitFilename)-1]\n\tname := strings.Join(splitFilename[:len(splitFilename)-1], \".\")\n\n\tmodel.SoundSave(db.GetConn(), &model.Sound{\n\t\tUserID: userID,\n\t\tName: name,\n\t\tExtension: extension,\n\t})\n}", "func SaveFile(name string, content string) {\n\tmyself, error := user.Current()\n\n\tif error != nil {\n\t\tfmt.Println(error)\n\t}\n\n\tfullPath := myself.HomeDir + \"/Documents/Server/\" + name\n\tfmt.Println(\"FILE SAVED AT => \" + fullPath)\n\tioutil.WriteFile(fullPath, []byte(content), 0644)\n}", "func (doc *Document) SaveToDB() error {\n\terr := model.SetIdentity(string(doc.ID), doc)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, pk := range doc.PublicKey {\n\t\terr := pk.SaveToDB()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (m *SynapsesPersist) Save() {\n\tif m.changed {\n\t\tfmt.Println(\"Saving synaptic data...\")\n\t\tindentedJSON, _ := json.MarshalIndent(m.Synapses, \"\", \" \")\n\n\t\tdataPath, err := filepath.Abs(m.relativePath)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\terr = ioutil.WriteFile(dataPath+m.file, indentedJSON, 0644)\n\t\tif err != nil {\n\t\t\tlog.Fatalln(\"ERROR:\", err)\n\t\t}\n\n\t\tm.Clean()\n\t\tfmt.Println(\"Synaptic data saved\")\n\t}\n}", "func (store *Storage) Save(key []byte, value []byte) error {\n\terr := store.db.Put(store.writeOptions, key, value)\n\tif err != nil {\n\t\tfmt.Println(\"Write data to RocksDB failed!\")\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (d deck) saveTofile(filename string) error {\n\treturn ioutil.WriteFile(filename, []byte(d.toString()), 0666)\n}", "func (s *siteData) save() error {\n\tvar err error\n\tif err = db.open(); err != nil {\n\t\treturn err\n\t}\n\tdefer db.close()\n\n\tsiteConf := []string{\"site\"}\n\tif err = db.bolt.SetValue(siteConf, \"title\", s.Title); err != nil {\n\t\treturn err\n\t}\n\tif err = db.bolt.SetInt(siteConf, \"port\", s.Port); err != nil {\n\t\treturn err\n\t}\n\tif err = db.bolt.SetValue(siteConf, \"session-name\", s.SessionName); err != nil {\n\t\treturn err\n\t}\n\treturn db.bolt.SetValue(siteConf, \"server-dir\", s.ServerDir)\n}", "func saveFile(conn *contact.Connection, file string, wg *sync.WaitGroup) {\n\tdefer wg.Done()\n\tfullPath := syncDir + file\n\n\t// Create the file and any parent directories\n\tfilePtr, err := synth.CreateFile(fullPath)\n\tif err != nil {\n\t\tlog.Printf(\"error creating file %s\\n\", fullPath)\n\t\treturn\n\t}\n\tdefer filePtr.Close()\n\n\tbuffer := bufio.NewWriter(filePtr)\n\tfor {\n\t\t// Get the next file block from the server\n\t\t_, data, err := conn.Read()\n\t\tif err != nil {\n\t\t\tlog.Printf(\"error reading file %s contents from connection\\n\", fullPath)\n\t\t\treturn\n\t\t}\n\n\t\t// An empty message indicates the end of the file\n\t\tif len(data) == 0 {\n\t\t\tbreak\n\t\t}\n\n\t\t// Remove any trailing NUL bytes\n\t\tdata = bytes.TrimRight(data, \"\\x00\")\n\n\t\t// Write the block to disk\n\t\t_, err = buffer.Write(data)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"error writing file %s contents to disk\\n\", fullPath)\n\t\t\treturn\n\t\t}\n\t}\n\n\tbuffer.Flush()\n\tfmt.Printf(\"File %s saved to disk.\\n\", file)\n}", "func (driver *SQLDriver) Save(paste *pastes.Paste) error {\n\t// Execute an INSERT statement to create the paste\n\t_, err := driver.database.Exec(\"INSERT INTO ? (?, ?, ?, ?, ?, ?)\", driver.table, paste.ID, paste.Content, paste.SuggestedSyntaxType, paste.DeletionToken, paste.Created, paste.AutoDelete)\n\treturn err\n}", "func savingFile(states AllStates, ID string) {\n\tfile, err := os.Create(\"elevator_states.txt\") //Creates file that will only contain latest data\n\t//checks for errors and saves to file as JSON\n\tcheck(err)\n\te := json.NewEncoder(file).Encode(states) //saves the AllStates struct to file\n\tcheck(e)\n}", "func (d deck) saveToFile(filename string) error {\n\treturn ioutil.WriteFile(filename, []byte(d.toString()), 0755)\n}", "func (u *User) Save() error {\n\tdb, err := storm.Open(dbPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer db.Close()\n\treturn db.Save(u)\n}", "func (d deck) saveToFile(fileName string) error {\n\treturn ioutil.WriteFile(fileName, []byte(d.toString()), 0776)\n}", "func (n *nameHistory) Save() error {\n\tif !n.isChanged {\n\t\treturn nil\n\t}\n\n\tfp, err := os.OpenFile(n.filepath, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, os.ModePerm)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not open %q file: %v\", n.filepath, err)\n\t}\n\tdefer fp.Close()\n\n\tif err := yaml.NewEncoder(fp).Encode(n.entries); err != nil {\n\t\treturn fmt.Errorf(\"could not save table name history: %v\", err)\n\t}\n\n\tif err := utils.SyncFileAndDirectory(fp); err != nil {\n\t\treturn fmt.Errorf(\"could not sync oid to name map file: %v\", err)\n\t}\n\n\tn.isChanged = false\n\n\treturn nil\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 (d deck) saveToFile(filename string) error {\n\treturn ioutil.WriteFile(filename, []byte(d.toString()), 0666) //0666 is a default permission\n}", "func Save() {\n\tgo db.save()\n}", "func (c *Country) Save() error {\n\tif err := c.validate(); err != nil {\n\t\treturn err\n\t}\n\tdb, err := storm.Open(dbPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer db.Close()\n\treturn db.Save(c)\n}", "func (buf *Buf) Save(file string) error {\n\tif file == \"\" {\n\t\treturn errors.New(\"No filename given\")\n\t}\n\n\tbs := []byte(buf.Text())\n\terr := ioutil.WriteFile(file, bs, 0644)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"%s\", err)\n\t}\n\n\tbuf.Name = file\n\tbuf.ClearDirty()\n\treturn nil\n}", "func (d deck) saveToFile(filename string) error {\n\treturn ioutil.WriteFile(filename, []byte(d.toString()), 0666)\n}", "func (d deck) saveToFile(filename string) error {\n\treturn ioutil.WriteFile(filename, []byte(d.toString()), 0666)\n}", "func (d deck) saveToFile(filename string) error {\n\treturn ioutil.WriteFile(filename, []byte(d.toString()), 0666)\n}", "func (d deck) saveToFile(filename string) error {\n\treturn ioutil.WriteFile(filename, []byte(d.toString()), 0666)\n}", "func fileWrite() {\n\t\n\tfileHandle, err := os.Create(edb.ofname) \t/* Create the file */\n if err != nil { \n \tfmt.Println(err)\n \tos.Exit(1)\n } \n\n\tdefer fileHandle.Close()\n\n\tif emptyEmployeeDB() {\n\t\tfmt.Println(\"EmployeeDB is Empty\")\n\t} else {\n\t\t/* retrieve one employee at a time and write into file */\n\t\tfor n := edb.elist.head; n != nil; n = n.next {\n\t\t\ts := fmt.Sprintf(\"%s;%d;%d\\n\", n.emp.name, n.emp.age, n.emp.salary)\n\t\t\tl, err := fileHandle.Write([]byte(s))\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\t\t\tif l != len(s) {\n\t\t\t\tfmt.Println(\"failed to write data\")\n\t\t\t\tos.Exit(1)\n\t\t\t}\t\t\n\t\t}\n\t}\n\tfmt.Printf(\"\\nFile: %s write done\", edb.ofname)\n}", "func (s Storage) Save(bucket, key string, data Storable) error {\n\tif !s.Opened {\n\t\treturn fmt.Errorf(\"db must be opened before saving\")\n\t}\n\terr := s.DB.Update(func(tx *bolt.Tx) error {\n\t\tmBucket, err := tx.CreateBucketIfNotExists([]byte(bucket))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error creating bucket : %s\", err)\n\t\t}\n\t\tenc, err := data.Encode()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Could not encode : %s\", err)\n\t\t}\n\t\terr = mBucket.Put([]byte(key), enc)\n\t\treturn err\n\t})\n\treturn err\n}", "func SaveDb(keyfile string, namefile string, sizefile int64, pathFile string) error {\n\n\ttimes := fmt.Sprintf(\"%s\", time.Now())\n\n\tstringJson := JsonDataDb{keyfile, namefile, sizefile, pathFile, times}\n\n\trespJson, err := json.Marshal(stringJson)\n\n\trespJsonX := string(respJson)\n\n\terr = Save(keyfile, respJsonX)\n\n\tif err == nil {\n\n\t\t//fmt.Println(\"save sucess..\")\n\t\treturn nil\n\n\t} else {\n\n\t\t//fmt.Println(\"Error\", err)\n\t\treturn err\n\t}\n}", "func (f *File) Save(name string) error {\n\treturn ioutil.WriteFile(name, []byte(f.String()), 0666)\n}", "func (pk *PublicKey) SaveToDB() error {\n\treturn model.SetPublicKey(string(pk.ID), pk)\n}", "func (channel *Channel) Save() {\n\t// Build the data with be saved\n\tdat, err := json.Marshal(channel.ToSerialize())\n\tif err != nil {\n\t\tlog.Errorf(\"Can't serialize the channel: %s\", err)\n\t\treturn\n\t}\n\n\tdb := storage.GetDB()\n\tdb.Put([]byte(fmt.Sprintf(\"/channel/%s\", channel.Name)), dat, nil)\n\tlog.Debugf(\"Channel %s saved into database\", channel.Name)\n}", "func (cm *ClosestMatch) Save(filename string) error {\n\tf, err := os.Create(filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\tenc := gob.NewEncoder(f)\n\treturn enc.Encode(cm)\n}", "func GhostFileSave(name, fpath string) error {\n\tbucket, err := db.GetBucket(ghostBucketName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trootAppDir, _ := filepath.Abs(assets.GetRootAppDir())\n\tfpath, _ = filepath.Abs(fpath)\n\tif !strings.HasPrefix(fpath, rootAppDir) {\n\t\treturn fmt.Errorf(\"Invalid path '%s' is not a subdirectory of '%s'\", fpath, rootAppDir)\n\t}\n\n\tdata, err := ioutil.ReadFile(fpath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tstorageLog.Infof(\"Saved '%s' file to database %d byte(s)\", name, len(data))\n\tbucket.Set(fmt.Sprintf(\"%s.%s\", ghostDatetimeNamespace, name), []byte(time.Now().Format(time.RFC1123)))\n\treturn bucket.Set(fmt.Sprintf(\"%s.%s\", ghostFileNamespace, name), data)\n}", "func (d deck) saveToFile(filename string) error {\n\t//convert the d deck to single string (toString) and then convert to []byte slice and finally WritesFile create the file\n\treturn ioutil.WriteFile(filename, []byte(d.toString()), 0666)\n}", "func (c *IntentClassifier) Save(file string) error {\n\n\tbuf := new(bytes.Buffer)\n\tencoder := gob.NewEncoder(buf)\n\n\terr := encoder.Encode(c)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error encoding model: %s\", err)\n\t}\n\n\tname, version := c.getMeta()\n\tpersist.Save(file, persist.Modeldata{\n\t\tData: buf.Bytes(),\n\t\tName: name,\n\t\tVersion: version,\n\t})\n\treturn nil\n}", "func Save() error {\n\treturn nil\n}", "func (ifile *Indexfile) Save(lfindex *Index) error {\n\tifile.Open(CREATE | WRITE_ONLY | APPEND)\n\tdefer ifile.Close()\n\t_, err := ifile.LockedWriteAt(lfindex.ToBytes(), 0)\n\treturn err\n}", "func Save(path string, v interface{}) error {\n\tformatter, err := parsePath(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfile, err := os.OpenFile(path, os.O_TRUNC|os.O_CREATE|os.O_WRONLY, 0644)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer file.Close()\n\treturn formatter.Encode(file, v)\n}", "func (s *Song) Save() error {\n\treturn DB.SaveSong(s)\n}", "func SaveFile(name string, v interface{}) error {\n\tdata, err := json.Marshal(v)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tp := filepath.Join(path, name)\n\terr = ioutil.WriteFile(p, data, 0740)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (u *Ayaneru) Save() error {\n\ttable := u.database.Init()\n\tdefer table.Close()\n\n\tresult, err := table.Exec(\"insert into ayanerus (source, url, created_at) values (?, ?, now());\", u.Source, u.URL)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"sql execute error\")\n\t}\n\n\tu.ID, _ = result.LastInsertId()\n\treturn nil\n}", "func (d deck) saveToFile (filename string) error {\n\t\treturn ioutil.WriteFile(filename, []byte (d.toString()), 0666)\n}", "func (p *Page) save() error {\n\tbody := fmt.Sprintf(\"<!-- Ingredients -->\\n%s\\n<!-- Instructions -->\\n%s\", p.Ingredients, p.Instructions)\n\treturn ioutil.WriteFile(filepath.Join(pagesDir, p.Filename+\".txt\"), []byte(body), 0600)\n}", "func (b *Bookmarks) Save() error {\n\treturn b.WriteToFile(b.Filename)\n}", "func SaveFile(path string, data []byte) error {\n\treturn ioutil.WriteFile(path, data, 0644)\n}", "func (k *FileKeystore) Save() error {\n\tk.Lock()\n\terr := k.doSave(true)\n\tk.Unlock()\n\treturn err\n}", "func (r *Report) Save() error {\n\treturn r.file.Save(r.fileName)\n}", "func (thread *Thread) Save() {\n\tDB.Set(\"Thread\", thread.ID, thread)\n}", "func (r *Root) Save(ctx context.Context, key string, replace bool) error {\n\tif r.FileKey == \"\" {\n\t\treturn errors.New(\"missing file key\")\n\t}\n\tbits, err := proto.Marshal(Encode(r))\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn r.cas.Put(ctx, blob.PutOptions{\n\t\tKey: key,\n\t\tData: bits,\n\t\tReplace: replace,\n\t})\n}", "func (s *Store) Save() error {\n\tbk, err := os.OpenFile(filepath.Join(s.rwDirPath, storeBkName), os.O_RDWR|os.O_CREATE, 0666)\n\tif err != nil {\n\t\treturn errors.Wrap(err, err.Error())\n\t}\n\tdefer bk.Close()\n\n\tdst, err := os.OpenFile(filepath.Join(s.rwDirPath, storeName), os.O_RDWR|os.O_CREATE, 0666)\n\tif err != nil {\n\t\treturn errors.Wrap(err, err.Error())\n\t}\n\tdefer dst.Close()\n\n\t// backing up current store\n\t_, err = io.Copy(bk, dst)\n\tif err != nil {\n\t\treturn errors.Wrap(err, err.Error())\n\t}\n\n\tenc := gob.NewEncoder(dst)\n\tbook := s.Clone()\n\terr = enc.Encode(book)\n\tif err != nil {\n\t\treturn errors.Wrap(err, err.Error())\n\t}\n\treturn nil\n}", "func (f *File) Save(path string) (err error) {\n\tdefer func() {\n\t\tif err != nil {\n\t\t\terr = fmt.Errorf(\"File.Save(%s): %w\", path, err)\n\t\t}\n\t}()\n\ttarget, err := os.Create(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif ie := target.Close(); ie != nil {\n\t\t\terr = fmt.Errorf(\"write:%+v close:%w\", err, ie)\n\t\t}\n\t}()\n\terr = f.Write(target)\n\treturn\n}", "func (file *File) Save() error {\n\tif file.path == \":memory:\" {\n\t\treturn nil\n\t}\n\n\t// Maybe an easier way is to use ioutil.WriteFile\n\tfp, err := os.OpenFile(file.path, os.O_TRUNC|os.O_WRONLY|os.O_CREATE, 0644)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer fp.Close()\n\n\tif len(file.cache) == 0 {\n\t\tfp.WriteString(\"\\n\")\n\t\treturn nil\n\t}\n\n\tfor _, alias := range file.cache {\n\t\tfp.WriteString(alias.String() + \"\\n\")\n\t}\n\n\treturn nil\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 (r *Router) SaveToDB() error {\n\tr.rMutex.RLock()\n\tdefer r.rMutex.RUnlock()\n\treturn r.saveToDB()\n}", "func (d *DiskStorage) Save() error {\n\n\tvar file, err = os.OpenFile(d.path, os.O_RDWR, 0644)\n\tif d.isError(err) {\n\t\treturn err\n\t}\n\tdefer file.Close()\n\n\t_, errWrite := file.WriteString(d.String())\n\treturn errWrite\n}", "func (xsml *XfileServiceMetricLog) Save(db XODB) error {\n\tif xsml.Exists() {\n\t\treturn xsml.Update(db)\n\t}\n\n\treturn xsml.Replace(db)\n}", "func (d *Database) Save(db DB, table string, src interface{}) error {\n\treturn d.SaveContext(context.Background(), db, table, src)\n}", "func (j Journal) Save() error {\n\t// marshal journal to JSON\n\tdata, err := json.Marshal(j)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// truncate and rewrite to the journal file\n\tjournalFilePath, err := getJournalPath(j.Name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tjournalFile, err := os.OpenFile(journalFilePath, os.O_TRUNC|os.O_CREATE|os.O_RDWR, 0660)\n\tdefer journalFile.Close()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := journalFile.Write(data); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (app *service) Save(genesis Genesis) error {\n\tjs, err := app.adapter.ToJSON(genesis)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn app.fileService.Save(app.fileNameWithExt, js)\n}", "func (entry *EditLogEntry) Save() {\n\tDB.Set(\"EditLogEntry\", entry.ID, entry)\n}", "func (c *ConfigurationFile) Save() error {\n\tcontent, err := json.Marshal(c)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = ioutil.WriteFile(c.location.get(), content, 0600)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (n *Node) Store(data []byte, file *File) error {\n\tfullpath := filepath.Join(n.basepath, file.Name)\n\n\terr := os.WriteFile(fullpath, data, os.ModePerm)\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\terr = n.database.Update(func(tx *bolt.Tx) error {\n\t\tb, err := tx.CreateBucketIfNotExists(FilesBucket)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif k := b.Get(file.ID[:]); k != nil {\n\t\t\treturn ErrKeyAlreadyExists\n\t\t}\n\n\t\tif err = b.Put(file.ID[:], []byte(file.Name)); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t})\n\n\tif err != nil {\n\t\tremoveErr := os.Remove(fullpath)\n\n\t\tif removeErr != nil {\n\t\t\treturn removeErr\n\t\t}\n\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func persistToFile(records []Record, filePath string) {\n\n\tfmt.Printf(\"\\n Writing all in-memory records to %s.\\n\", filePath)\n\n\theaders := \t[]string { \n\t\t\"CheeseId\", \"CheeseName\", \"ManufacturerName\", \"ManufacturerProvCode\", \"ManufacturingType\",\n\t\t\"WebSite\", \"FatContentPercent\", \"MoisturePercent\", \"Particularities\", \"Flavour\", \"Characteristics\",\n\t\t\"Ripening\", \"Organic\", \"CategoryType\", \"MilkType\", \"MilkTreatmentType\", \"RindType\", \"LastUpdateDate\",\n\t}\n\n\t// create file\n\tfile, err := os.Create(filePath)\n\tcheck(err)\n\tdefer file.Close()\n\n\t// initialize csv writer\n writer := csv.NewWriter(file)\n\tdefer writer.Flush()\n\n\t// write headers\n\terr = writer.Write(headers)\n\tcheck(err)\n\n\t// loop through records and write each one to the CSV\n\tfor i := 0; i < len(records); i++ {\n\t\terr = writer.Write(recordToSlice(records[i]))\n\t\tcheck(err)\n\t}\n\n\tfmt.Printf(\"\\n Done writing to %s.\\n\", filePath)\n\t\n}", "func (d *DiskSpec) Save(db XODB) error {\n\tif d.Exists() {\n\t\treturn d.Update(db)\n\t}\n\n\treturn d.Insert(db)\n}", "func (j *Job) Save(ctx context.Context) (err error) {\n\tt := utils.FromTaskContext(ctx)\n\n\tcontent, err := msgpack.Marshal(j)\n\tif err != nil {\n\t\treturn\n\t}\n\n\terr = contexts.DB.Put(constants.FormatJobKey(t, j.Path), content, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn\n}", "func Save(obj any, file string) error {\n\tfp, err := os.Create(file)\n\tdefer fp.Close()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn err\n\t}\n\tbw := bufio.NewWriter(fp)\n\terr = Write(obj, bw)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn err\n\t}\n\terr = bw.Flush()\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\treturn err\n}", "func (c *Cryptor) Save(filename string, plaintext []byte) error {\n\tciphertext, err := c.Encrypt(plaintext)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := ioutil.WriteFile(filename, ciphertext, 0644); err != nil {\n\t\treturn fmt.Errorf(\"writing file: %s\", err)\n\t}\n\treturn nil\n}", "func (m *MovieStorage) Save() (*MovieStorage, error) {\n\terr := Db.Driver.Write(Db.Collections.Movies, m.ID, m)\n\treturn m, err\n}", "func (repo PostgresRepository) Save(document entity.Document) error {\n\t_, err := repo.db.Table(\"documents\").Insert(&document)\n\treturn err\n}", "func (b *BlockCreator) save() error {\n\treturn persist.SaveJSON(settingsMetadata, b.persist, filepath.Join(b.persistDir, settingsFile))\n}", "func (n *Name) Save(tx *sql.Tx) (sql.Result, error) {\n\tif err := db.Validate(n); err != nil {\n\t\treturn nil, err\n\t}\n\treturn tx.Exec(\n\t\t\"INSERT INTO split_name(route_id, position, name) VALUES (?, ?, ?)\",\n\t\tn.RouteID,\n\t\tn.Position,\n\t\tn.Name,\n\t)\n}", "func (tb *TextBuf) SaveFile(filename gi.FileName) error {\n\terr := ioutil.WriteFile(string(filename), tb.Txt, 0644)\n\tif err != nil {\n\t\tgi.PromptDialog(nil, gi.DlgOpts{Title: \"Could not Save to File\", Prompt: err.Error()}, gi.AddOk, gi.NoCancel, nil, nil)\n\t\tlog.Println(err)\n\t} else {\n\t\ttb.Filename = filename\n\t\ttb.SetName(string(filename)) // todo: modify in any way?\n\t\ttb.Stat()\n\t}\n\treturn err\n}", "func Save(path string, object interface{}) error {\n\tfile, err := os.Create(path)\n\tif err == nil {\n\t\tencoder := gob.NewEncoder(file)\n\t\tencoder.Encode(object)\n\t}\n\tfile.Close()\n\treturn err\n}", "func (p *Page) save() error {\n filename := p.Title + \".txt\"\n return ioutil.WriteFile(filename, p.Body, 0600)\n}", "func (b *BaseHandler) SavePostFile(name, to string) error {\n\tb.request.ParseForm()\n\tfile, _, err := b.GetPostFile(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer file.Close()\n\n\tout, err := os.Create(to)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer out.Close()\n\n\t_, err = io.Copy(out, file)\n\n\treturn err\n}", "func Save(keyS string, valueS string) error {\n\n\tdb := Connect()\n\n\t//defer db.Close()\n\n\tkey := []byte(keyS)\n\tvalue := []byte(valueS)\n\n\terr := db.Update(func(tx *bolt.Tx) error {\n\n\t\tbucket, err := tx.CreateBucketIfNotExists(Database)\n\n\t\tif err != nil {\n\n\t\t\treturn err\n\t\t}\n\n\t\terr = bucket.Put(key, value)\n\n\t\tif err != nil {\n\n\t\t\treturn err\n\n\t\t} else {\n\n\t\t\t//fmt.Println(\"save sucess\")\n\t\t\treturn nil\n\t\t}\n\t})\n\n\tif err != nil {\n\n\t\tfmt.Println(\"erro try save \", err)\n\t\tos.Exit(1)\n\t}\n\n\treturn nil\n}", "func SaveToDB(table, resourceID string, data interface{}) error {\n\tdataByte, err := json.Marshal(data)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"while marshalling data, got: %v\", err)\n\t}\n\treturn db.Connector.Create(table, resourceID, string(dataByte))\n}", "func Save(path string, v interface{}, opts Options) (err error) {\n\tvar (\n\t\tfile *os.File\n\t\ttmp = path + \".tmp.\" + cmn.GenTie()\n\t)\n\tif file, err = cmn.CreateFile(tmp); err != nil {\n\t\treturn\n\t}\n\tdefer func() {\n\t\t_ = file.Close()\n\t\tif err != nil {\n\t\t\tos.Remove(tmp)\n\t\t}\n\t}()\n\tif err = Encode(file, v, opts); err != nil {\n\t\treturn\n\t}\n\tif err = file.Close(); err != nil {\n\t\treturn\n\t}\n\terr = os.Rename(tmp, path)\n\treturn\n}", "func Save(path string, v interface{}) error {\n\tlock.Lock()\n\tdefer lock.Unlock()\n\tf, err := os.Create(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\tr, err := Marshal(v)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = io.Copy(f, r)\n\treturn err\n}" ]
[ "0.73783314", "0.7349587", "0.71819556", "0.67951024", "0.6762142", "0.66945714", "0.6616788", "0.6465668", "0.64551836", "0.64359796", "0.6241281", "0.62347543", "0.6229493", "0.6196043", "0.61927414", "0.60702246", "0.60512924", "0.6015019", "0.60047877", "0.5984366", "0.5984108", "0.5983407", "0.598052", "0.59798753", "0.5978524", "0.59768057", "0.59690124", "0.5958438", "0.59396595", "0.5932854", "0.5926596", "0.5916172", "0.59148365", "0.59095013", "0.58899873", "0.5885076", "0.58807856", "0.5880591", "0.5878915", "0.58732826", "0.5857502", "0.58532435", "0.5849738", "0.5849738", "0.5849738", "0.5849738", "0.5844186", "0.58441126", "0.5832575", "0.58159864", "0.58081424", "0.58060074", "0.579803", "0.5793945", "0.5783141", "0.57767576", "0.5772924", "0.57694554", "0.57626665", "0.57613474", "0.5758308", "0.5734109", "0.57305473", "0.5724427", "0.5721448", "0.57174647", "0.5709012", "0.5698617", "0.56879085", "0.5682893", "0.56796634", "0.56753945", "0.5651566", "0.5651152", "0.5649059", "0.56427705", "0.5637403", "0.56318986", "0.5622437", "0.5612869", "0.5606139", "0.5601031", "0.55923736", "0.5586309", "0.5585079", "0.5571754", "0.5568439", "0.55663085", "0.55649847", "0.55536693", "0.55493456", "0.5545796", "0.55365324", "0.5535941", "0.5535558", "0.5535267", "0.553366", "0.5530674", "0.5530141", "0.5526794" ]
0.6545621
7
UpdateVideoInfos updates related video infos based on this file.
func (m *File) UpdateVideoInfos() error { values := FileInfos{} if err := deepcopier.Copy(&values).From(m); err != nil { return err } return Db().Model(File{}).Where("photo_id = ? AND file_video = 1", m.PhotoID).Updates(values).Error }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (client *Client) UpdateVideoInfos(request *UpdateVideoInfosRequest) (_result *UpdateVideoInfosResponse, _err error) {\n\truntime := &util.RuntimeOptions{}\n\t_result = &UpdateVideoInfosResponse{}\n\t_body, _err := client.UpdateVideoInfosWithOptions(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) UpdateVideoInfosWithOptions(request *UpdateVideoInfosRequest, runtime *util.RuntimeOptions) (_result *UpdateVideoInfosResponse, _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.UpdateContent)) {\n\t\tquery[\"UpdateContent\"] = request.UpdateContent\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"UpdateVideoInfos\"),\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 = &UpdateVideoInfosResponse{}\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) UpdateVideoInfo(request *UpdateVideoInfoRequest) (_result *UpdateVideoInfoResponse, _err error) {\n\truntime := &util.RuntimeOptions{}\n\t_result = &UpdateVideoInfoResponse{}\n\t_body, _err := client.UpdateVideoInfoWithOptions(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) UpdateVideoInfoWithOptions(request *UpdateVideoInfoRequest, runtime *util.RuntimeOptions) (_result *UpdateVideoInfoResponse, _err error) {\n\t_err = util.ValidateModel(request)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\tquery := map[string]interface{}{}\n\tif !tea.BoolValue(util.IsUnset(request.CateId)) {\n\t\tquery[\"CateId\"] = request.CateId\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.CoverURL)) {\n\t\tquery[\"CoverURL\"] = request.CoverURL\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.Description)) {\n\t\tquery[\"Description\"] = request.Description\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.Tags)) {\n\t\tquery[\"Tags\"] = request.Tags\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.Title)) {\n\t\tquery[\"Title\"] = request.Title\n\t}\n\n\tif !tea.BoolValue(util.IsUnset(request.VideoId)) {\n\t\tquery[\"VideoId\"] = request.VideoId\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"UpdateVideoInfo\"),\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 = &UpdateVideoInfoResponse{}\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 (amv *AMV) RefreshInfo() error {\n\tif amv.File == \"\" {\n\t\treturn fmt.Errorf(\"Video file has not been uploaded yet for AMV %s\", amv.ID)\n\t}\n\n\tinfo, err := video.GetInfo(path.Join(Root, \"videos\", \"amvs\", amv.File))\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tamv.Info = *info\n\treturn nil\n}", "func (e *ObservableEditableBuffer) UpdateInfo(filename string, d os.FileInfo) error {\n\treturn e.details.UpdateInfo(filename, d)\n}", "func (client *Client) GetVideoInfos(request *GetVideoInfosRequest) (_result *GetVideoInfosResponse, _err error) {\n\truntime := &util.RuntimeOptions{}\n\t_result = &GetVideoInfosResponse{}\n\t_body, _err := client.GetVideoInfosWithOptions(request, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_result = _body\n\treturn _result, _err\n}", "func Update(recordings storage.Recordings) {\n\tapi := slack.New(os.Getenv(\"SLACK_API_KEY\"))\n\tchannels, err := api.GetChannels(true)\n\tif nil != err {\n\t\tlog.Println(err.Error())\n\t\treturn\n\t}\n\n\tsearchFilesAndAddToRecordings(api, channels, recordings, \"mp4\")\n\tsearchFilesAndAddToRecordings(api, channels, recordings, \"m4a\")\n}", "func (client *Client) GetVideoInfosWithOptions(request *GetVideoInfosRequest, runtime *util.RuntimeOptions) (_result *GetVideoInfosResponse, _err error) {\n\t_err = util.ValidateModel(request)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\tquery := map[string]interface{}{}\n\tif !tea.BoolValue(util.IsUnset(request.VideoIds)) {\n\t\tquery[\"VideoIds\"] = request.VideoIds\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"GetVideoInfos\"),\n\t\tVersion: tea.String(\"2017-03-21\"),\n\t\tProtocol: tea.String(\"HTTPS\"),\n\t\tPathname: tea.String(\"/\"),\n\t\tMethod: tea.String(\"POST\"),\n\t\tAuthType: tea.String(\"AK\"),\n\t\tStyle: tea.String(\"RPC\"),\n\t\tReqBodyType: tea.String(\"formData\"),\n\t\tBodyType: tea.String(\"json\"),\n\t}\n\t_result = &GetVideoInfosResponse{}\n\t_body, _err := client.CallApi(params, req, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_err = tea.Convert(_body, &_result)\n\treturn _result, _err\n}", "func (s *Service) hdlVideoUpdateBinLog(nMsg, oMsg []byte) {\n\tvar (\n\t\tnv = &archive.Video{}\n\t\tov = &archive.Video{}\n\t\terr error\n\t)\n\tif err = json.Unmarshal(nMsg, nv); err != nil {\n\t\tlog.Error(\"json.Unmarshal(%s) error(%v)\", nMsg, err)\n\t\treturn\n\t}\n\tif err = json.Unmarshal(oMsg, ov); err != nil {\n\t\tlog.Error(\"json.Unmarshal(%s) error(%v)\", oMsg, err)\n\t\treturn\n\t}\n\tif nv.Status != ov.Status {\n\t\ts.hdlVideoAudit(*nv, *ov)\n\t}\n\tif ov.XcodeState != nv.XcodeState {\n\t\ts.hdlXcodeTime(*nv, *ov)\n\t}\n\t// 视频状态变为待审核(视频信息改动或者一转完成)\n\tif nv.Status != ov.Status {\n\t\tif nv.Status == archive.VideoStatusWait { //待审核\n\t\t\ts.hdlVideoTask(context.TODO(), nv.Filename)\n\t\t}\n\t\tif nv.Status == archive.VideoStatusDelete { //视频删除\n\t\t\ts.arc.DelDispatch(context.TODO(), nv.Aid, nv.Cid)\n\t\t}\n\t}\n}", "func GetVideoInfo(path string) (info *VideoInfo, err error) {\n\tdefer func() {\n\t\tif err != nil {\n\t\t\terr = errors.Wrap(err, \"get video info\")\n\t\t}\n\t}()\n\n\t// Make sure file exists so we can give a clean error\n\t// message in this case, instead of depending on ffmpeg.\n\tif _, err := os.Stat(path); err != nil {\n\t\treturn nil, err\n\t}\n\n\tlines, err := infoOutputLines(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar foundFPS, foundSize bool\n\tresult := &VideoInfo{}\n\n\tfpsExp := regexp.MustCompilePOSIX(\" ([0-9\\\\.]*) fps,\")\n\tsizeExp := regexp.MustCompilePOSIX(\" ([0-9]+)x([0-9]+)(,| )\")\n\tfor _, line := range lines {\n\t\tif !strings.Contains(line, \"Video:\") {\n\t\t\tcontinue\n\t\t}\n\t\tif match := fpsExp.FindStringSubmatch(line); match != nil {\n\t\t\tfoundFPS = true\n\t\t\tfps, err := strconv.ParseFloat(match[1], 0)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, errors.Wrap(err, \"parse FPS\")\n\t\t\t}\n\t\t\tresult.FPS = fps\n\t\t}\n\t\tif match := sizeExp.FindStringSubmatch(line); match != nil {\n\t\t\tfoundSize = true\n\t\t\tvar size [2]int\n\t\t\tfor i, s := range match[1:3] {\n\t\t\t\tn, err := strconv.Atoi(s)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, errors.Wrap(err, \"parse dimensions\")\n\t\t\t\t}\n\t\t\t\tsize[i] = n\n\t\t\t}\n\t\t\tresult.Width = size[0]\n\t\t\tresult.Height = size[1]\n\t\t}\n\t}\n\n\tif !foundFPS {\n\t\treturn nil, errors.New(\"could not find fps in output\")\n\t}\n\tif !foundSize {\n\t\treturn nil, errors.New(\"could not find dimensions in output\")\n\t}\n\treturn result, nil\n}", "func (client *Client) UpdateAttachedMediaInfos(request *UpdateAttachedMediaInfosRequest) (_result *UpdateAttachedMediaInfosResponse, _err error) {\n\truntime := &util.RuntimeOptions{}\n\t_result = &UpdateAttachedMediaInfosResponse{}\n\t_body, _err := client.UpdateAttachedMediaInfosWithOptions(request, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_result = _body\n\treturn _result, _err\n}", "func (fv *FileView) UpdateFiles() {\n\tupdt := fv.UpdateStart()\n\tdefer fv.UpdateEnd(updt)\n\tvar win oswin.Window\n\tif fv.Viewport != nil && fv.Viewport.Win != nil && fv.Viewport.Win.OSWin != nil {\n\t\twin = fv.Viewport.Win.OSWin\n\t} else {\n\t\twin = oswin.TheApp.WindowInFocus()\n\t}\n\n\tfv.UpdatePath()\n\tpf := fv.PathField()\n\tif len(gi.SavedPaths) == 0 {\n\t\tgi.OpenPaths()\n\t}\n\tgi.SavedPaths.AddPath(fv.DirPath, gi.Prefs.SavedPathsMax)\n\tgi.SavePaths()\n\tsp := []string(gi.SavedPaths)\n\tsp = append(sp, fileViewResetPaths)\n\tpf.ItemsFromStringList(sp, true, 0)\n\tpf.SetText(fv.DirPath)\n\tsf := fv.SelField()\n\tsf.SetText(fv.SelFile)\n\toswin.TheApp.Cursor(win).Push(cursor.Wait)\n\tdefer oswin.TheApp.Cursor(win).Pop()\n\n\tfv.Files = make([]*FileInfo, 0, 1000)\n\tfilepath.Walk(fv.DirPath, func(path string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\temsg := fmt.Sprintf(\"Path %q: Error: %v\", fv.DirPath, err)\n\t\t\t// if fv.Viewport != nil {\n\t\t\t// \tgi.PromptDialog(fv.Viewport, \"FileView UpdateFiles\", emsg, true, false, nil, nil)\n\t\t\t// } else {\n\t\t\tlog.Printf(\"gi.FileView error: %v\\n\", emsg)\n\t\t\t// }\n\t\t\treturn nil // ignore\n\t\t}\n\t\tif path == fv.DirPath { // proceed..\n\t\t\treturn nil\n\t\t}\n\t\tfi, ferr := NewFileInfo(path)\n\t\tkeep := ferr == nil\n\t\tif fv.FilterFunc != nil {\n\t\t\tkeep = fv.FilterFunc(fv, fi)\n\t\t}\n\t\tif keep {\n\t\t\tfv.Files = append(fv.Files, fi)\n\t\t}\n\t\tif info.IsDir() {\n\t\t\treturn filepath.SkipDir\n\t\t}\n\t\treturn nil\n\t})\n\n\tsv := fv.FilesView()\n\tsv.SelField = \"Name\"\n\tsv.SelVal = fv.SelFile\n\tsv.UpdateFromSlice()\n\tfv.SelectedIdx = sv.SelectedIdx\n\tif sv.SelectedIdx >= 0 {\n\t\tsv.ScrollToRow(sv.SelectedIdx)\n\t}\n}", "func handleUploadedZipVideo(tempDir string) map[string]string {\n\tfileHandleMsgMap := make(map[string]string)\n\tfilepath.Walk(tempDir, func(path string, info os.FileInfo, err error) error {\n\t\tvar msg string\n\t\tj := jewelry{}\n\t\tif info.IsDir() {\n\t\t\tmsg = fmt.Sprintf(\"SKIP folder %s\", info.Name())\n\t\t\tutil.Traceln(msg)\n\t\t\treturn nil\n\t\t}\n\t\tvar filename string\n\t\tbs, err := ioutil.ReadFile(path)\n\t\tif err != nil {\n\t\t\tmsg = errors.GetMessage(err)\n\t\t\treturn nil\n\t\t}\n\t\tif !filetype.IsVideo(bs) {\n\t\t\tmsg = fmt.Sprintf(\"%s is not video\", info.Name())\n\t\t\tutil.Traceln(msg)\n\t\t\treturn nil\n\t\t}\n\t\text := filepath.Ext(info.Name())\n\t\tif ext == \"\" {\n\t\t\tmsg = fmt.Sprintf(\"SKIP file %s as the file has no extension\", info.Name())\n\t\t\tutil.Traceln(msg)\n\t\t\treturn nil\n\t\t}\n\n\t\tif ext == \"mp4\" || ext == \"mov\" || ext == \"ogv\" || ext == \"webm\" {\n\t\t\tfilename = fmt.Sprintf(\"beyoudiamond-video-%s\", info.Name())\n\t\t} else {\n\t\t\tmsg = fmt.Sprintf(\"Uploaded file %s extension is not supported\", info.Name())\n\t\t\tutil.Traceln(msg)\n\t\t\treturn nil\n\t\t}\n\n\t\tj.StockID = strings.Split(info.Name(), \"-\")[0]\n\t\tif err := j.isJewelryExistByStockID(); err != nil {\n\t\t\tmsg = errors.GetMessage(err)\n\t\t\treturn nil\n\t\t}\n\t\tif err := util.RunWithStdOutput(\"mv\", path, filepath.Join(\".video\", \"jewelry\", filename)); err != nil {\n\t\t\tmsg = errors.GetMessage(err)\n\t\t\treturn nil\n\t\t}\n\t\tj.VideoLink = filename\n\t\tq := j.composeUpdateQuery()\n\t\tif _, err := dbExec(q); err != nil {\n\t\t\tmsg = errors.GetMessage(err)\n\t\t\treturn nil\n\t\t}\n\n\t\tif msg == \"\" {\n\t\t\tfileHandleMsgMap[info.Name()] = msg\n\t\t} else {\n\t\t\tfileHandleMsgMap[info.Name()] = \"uploaded\"\n\t\t}\n\t\treturn nil\n\t})\n\treturn fileHandleMsgMap\n}", "func (s *Synchronizer) UpdateInfo() {\n\ts.l.Lock()\n\tdefer s.l.Unlock()\n\n\ts.forceSync[syncMethodInfo] = false\n}", "func (w *walker) updateFileInfo(file, curFile protocol.FileInfo) protocol.FileInfo {\n\tif file.Type == protocol.FileInfoTypeFile && runtime.GOOS == \"windows\" {\n\t\t// If we have an existing index entry, copy the executable bits\n\t\t// from there.\n\t\tfile.Permissions |= (curFile.Permissions & 0111)\n\t}\n\tfile.Version = curFile.Version.Update(w.ShortID)\n\tfile.ModifiedBy = w.ShortID\n\tfile.LocalFlags = w.LocalFlags\n\treturn file\n}", "func (d *Dao) Videos2(c context.Context, aid int64) (vs []*archive.Video, err error) {\n\trows, err := d.db.Query(c, _videos2SQL, aid)\n\tif err != nil {\n\t\tlog.Error(\"d.db.Query(%s, %d) error(%v)\", _videos2SQL, aid, err)\n\t\treturn\n\t}\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\tv := &archive.Video{}\n\t\tif err = rows.Scan(&v.ID, &v.Filename, &v.Cid, &v.Aid, &v.Title, &v.Desc, &v.SrcType, &v.Duration, &v.Filesize, &v.Resolutions,\n\t\t\t&v.Playurl, &v.FailCode, &v.Index, &v.Attribute, &v.XcodeState, &v.Status, &v.State, &v.CTime, &v.MTime); err != nil {\n\t\t\tlog.Error(\"rows.Scan error(%v)\", err)\n\t\t\treturn\n\t\t}\n\t\tvs = append(vs, v)\n\t}\n\treturn\n}", "func (amv *AMV) SetVideoBytes(data []byte) error {\n\tfileName := amv.ID + \".webm\"\n\tfilePath := path.Join(Root, \"videos\", \"amvs\", fileName)\n\terr := ioutil.WriteFile(filePath, data, 0644)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Run mkclean\n\toptimizedFile := filePath + \".optimized\"\n\n\tcmd := exec.Command(\n\t\t\"mkclean\",\n\t\t\"--doctype\", \"4\",\n\t\t\"--keep-cues\",\n\t\t\"--optimize\",\n\t\tfilePath,\n\t\toptimizedFile,\n\t)\n\n\tcmd.Stdout = os.Stdout\n\tcmd.Stderr = os.Stderr\n\tcmd.Stdin = os.Stdin\n\n\terr = cmd.Start()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = cmd.Wait()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Now delete the original file and replace it with the optimized file\n\terr = os.Remove(filePath)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = os.Rename(optimizedFile, filePath)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Refresh video file info\n\tamv.File = fileName\n\treturn amv.RefreshInfo()\n}", "func (fc *FileInCore) updateFileInCore(volID uint64, vf *proto.File, volLoc *DataReplica, volLocIndex int) {\n\tif vf.Modified > fc.LastModify {\n\t\tfc.LastModify = vf.Modified\n\t}\n\n\tisFind := false\n\tfor i := 0; i < len(fc.MetadataArray); i++ {\n\t\tif fc.MetadataArray[i].getLocationAddr() == volLoc.Addr {\n\t\t\tfc.MetadataArray[i].Crc = vf.Crc\n\t\t\tfc.MetadataArray[i].Size = vf.Size\n\t\t\tisFind = true\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif isFind == false {\n\t\tfm := newFileMetadata(vf.Crc, volLoc.Addr, volLocIndex, vf.Size)\n\t\tfc.MetadataArray = append(fc.MetadataArray, fm)\n\t}\n\n}", "func Update () {\n // Compute the current time rounded to the interval\n roundTime := time.Now().Round(config.Timing.Period)\n unixTimeString := strconv.FormatInt(roundTime.Unix(), 10);\n\n // Query Twitch for each filter's streams, and assemble a map of unique\n // streams along with all filters which found them\n taggedStreams := make(map[string]*taggedStream)\n filters := database.GetAllFilters()\n for _, filter := range filters {\n // Make appropriate Twitch query\n var sr *twitchapi.GetStreamsResponse\n if filter.QueryType == database.QueryTypeStreams {\n sr = twitchapi.AllStreams(filter.QueryParam)\n }\n //} else if filter.QueryType == database.QueryTypeFollows {\n // sr = twitchapi.FollowedStreams(filter.QueryParam)\n //}\n // Assimilate all recieved streams into our tagged stream map\n for _, s := range sr.Streams {\n id := s.ChannelId\n if _, seen := taggedStreams[id]; !seen { // Idiom to check if in map\n taggedStreams[id] = &taggedStream{Stream:s}\n }\n taggedStreams[id].AppendFilter(filter.ID)\n }\n database.UpdateFilter(filter.ID, roundTime)\n }\n\n // For each (stream, filters) pair, grab and save a snapshot to the DB\n for _, sf := range taggedStreams {\n stream := sf.Stream\n channelName := stream.ChannelDisplayName\n status := stream.Status\n fmt.Printf(\"(%v) %v: %v\\n\", len(sf.FilterIds), channelName, status)\n\n // Query Twitch for the channel's most recent (current) archive video ID\n archive := twitchapi.ChannelRecentArchive(stream.ChannelId)\n\n // If this snapshot doesn't correspond to the most recent archive, then\n // either the streamer has disabled archiving, the archive somehow isn't\n // accessible yet, or something else. So, store no VOD for this thumb.\n vodID := \"\"\n vodSeconds := 0\n vodTime := roundTime\n if archive != nil {\n if archive.Broadcast_Id == stream.Id {\n vodID = archive.Id\n vodSeconds = int(roundTime.Sub(archive.Created_At_Time).Seconds())\n //vodTime = archive.Created_At_Time\n } else {\n fmt.Printf(\"recent archive is not current stream\\n\")\n }\n } else {\n fmt.Printf(\"recent archive was nil\\n\")\n }\n\n // Download stream preview image from Twitch\n imagePath := config.Path.ImagesRelative + \"/\" +\n stream.ChannelName + \"_\" + unixTimeString + \".jpg\"\n imageDLPath := config.Path.Root + imagePath\n imageUrl := stream.Preview\n DownloadImage(imageUrl, imageDLPath)\n\n // Finally, store new info for this stream in the DB\n database.AddThumbToDB(\n roundTime, stream.ChannelName, stream.ChannelDisplayName,\n vodSeconds, vodID, imagePath, vodTime, stream.Status,\n stream.Viewers, sf.FilterIds)\n\n // Query Twitch for the channel's recent clips.\n // Commented out 2022-02-14 due to helix API migration and we don't even\n // or prune these clips anyways.\n //cr := twitchapi.TopClipsDay(stream.ChannelName)\n //for _, clip := range cr.Clips {\n // database.AddClipToDB(clip.TrackingId, clip.Created_At_Time,\n // clip.Thumbnails.Small, clip.Url, stream.ChannelName)\n //}\n }\n\n // Delete old streams (and their thumbs, follows, image files) from the DB\n database.PruneOldStreams(roundTime)\n\n RegenerateFilterPages()\n\n // TODO: Occasionally check for \"stray\" data:\n // (Also perform this check on app startup)\n // Follows whose stream or filter no longer exists\n // Have to check for each one.\n // Thumbs whose stream no longer exists\n // Total of streams NumThumbs != # thumbs\n // Image files whose thumb no longer exists\n // # image files != # thumbs\n\n fmt.Printf(\"update finish\\n\")\n /*fmt.Printf(\"%v deleted\\n\", numDeleted)\n fmt.Printf(\"%v thumbs \\n\", database.NumThumbs())\n fmt.Printf(\"%v jpg files\\n\", NumFilesInDir(config.Path.Images))\n fmt.Printf(\"%v distinct channels\\n\", len(database.DistinctChannels()))*/\n}", "func (n *TreeNode) Update(files []*FileAnnouncement) {\n\tlog.Printf(\"FAT: update starting (%d items)\", len(files))\n\t// TODO sort files by fullname\n\tfor _, fa := range files {\n\t\tfa.ensureInit()\n\t}\n\tn.update(files)\n\tlog.Printf(\"FAT: update finished (%d items)\", len(files))\n}", "func (r *Routine) Update() {\n\tr.muted = false\n\tr.vol = -1\n\n\tout, err := r.runCmd()\n\tif err != nil {\n\t\tr.err = err\n\t\treturn\n\t}\n\n\t// Find the line that has the percentage volume and mute status in it.\n\tlines := strings.Split(out, \"\\n\")\n\tfor _, line := range lines {\n\t\tif strings.Contains(line, \"Playback\") && strings.Contains(line, \"%]\") {\n\t\t\t// We found it. Check the mute status, then pull out the volume.\n\t\t\tfields := strings.Fields(line)\n\t\t\tfor _, field := range fields {\n\t\t\t\tfield = strings.Trim(field, \"[]\")\n\t\t\t\tif field == \"off\" {\n\t\t\t\t\tr.muted = true\n\t\t\t\t} else if strings.HasSuffix(field, \"%\") {\n\t\t\t\t\ts := strings.TrimRight(field, \"%\")\n\t\t\t\t\tvol, err := strconv.Atoi(s)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tr.err = err\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tr.vol = normalize(vol)\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif r.vol < 0 {\n\t\tr.err = fmt.Errorf(\"no volume found for %s\", r.control)\n\t}\n}", "func EnumerateVideos(URL string, videos chan FlatVideo) (int, error) {\n\tvar (\n\t\tcount int\n\t\tfinalError error\n\t)\n\n\terr := doYoutubedl([]string{ytFlatPlaylist, ytDumpJSON, URL}, func(stdin io.ReadCloser, stderr io.ReadCloser) {\n\t\tdefer func() {\n\t\t\tif videos != nil {\n\t\t\t\tclose(videos)\n\t\t\t}\n\t\t}()\n\t\treader := bufio.NewReader(stdin)\n\t\tfor {\n\t\t\tline, err := reader.ReadString('\\n')\n\t\t\tif err != nil {\n\t\t\t\tif err != io.EOF {\n\t\t\t\t\tfinalError = err\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tcount++\n\n\t\t\tif videos != nil {\n\t\t\t\tvar fv = FlatVideo{}\n\t\t\t\terr := json.Unmarshal([]byte(line), &fv)\n\t\t\t\tif err != nil {\n\t\t\t\t\tfinalError = err\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tvideos <- fv\n\t\t\t}\n\t\t}\n\t})\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\n\treturn count, finalError\n}", "func (video *FakeVideo) UpdateVideo(userID string) (err error) {\n\tif video.Name == \"\" {\n\t\terr = errors.New(\"the video name cannot be empty\")\n\n\t\treturn\n\t}\n\n\terr = nil\n\n\treturn\n}", "func ProbeFiles(dir string, files []string, folderdates []string) [][]string {\n\tvar matrix [][]string\n\t// matrix = append(matrix, []string{\n\t// \t\"Filename\",\n\t// \t\"File Type\",\n\t// \t\"Folder Date\",\n\t// \t\"Folder Day Number\",\n\t// \t\"Edit Date\",\n\t// \t\"Edit Day Number\",\n\t// \t\"Edit Day\",\n\t// \t\"Month\",\n\t// \t\"Year\",\n\t// \t\"Time\",\n\t// \t\"Timezone\",\n\t// \t\"Duration\",\n\t// \t\"Size\",\n\t// \t\"Bitrate\",\n\t// \t\"Format\",\n\t// \t\"Formant Long\"})\n\n\tmatrix = append(matrix, []string{\n\t\t\"Filename\",\n\t\t\"FolderDate\",\n\t\t\"Folder Month\",\n\t\t\"Folder Day\",\n\t\t\"Folder Year\",\n\t\t\"Edit Date\",\n\t\t\"Edit Month\",\n\t\t\"Edit Day\",\n\t\t\"Edit Year\",\n\t\t\"Edit Day Number\",\n\t\t\"Timestamp\",\n\t\t\"Timezone\",\n\t\t\"Duration\",\n\t\t\"Size\",\n\t\t\"Bitrate\",\n\t\t\"Format\",\n\t\t\"Formant Long\"})\n\t// Probe Video Files\n\tfor h := 0; h < len(files); h++ {\n\t\tnew := dir + \"/\" + folderdates[h] + \"/edits/\" + files[h]\n\t\t// fmt.Println(new)\n\t\tdata, err := ffprobe.GetProbeData(new, 5000*time.Millisecond)\n\t\tif err != nil {\n\t\t\tlog.Panicf(\"Error getting data: %v\", err)\n\t\t}\n\n\t\tbuf, err := json.MarshalIndent(data, \"\", \" \")\n\t\tif err != nil {\n\t\t\tlog.Panicf(\"Error unmarshalling: %v\", err)\n\t\t}\n\t\t// log.Print(string(buf))\n\n\t\tvar probed Ffprobe\n\t\tif err := json.Unmarshal(buf, &probed); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\t// ffprobeFilename := probed.Format.Filename\n\t\t// cleanName := filepath.Base(ffprobeFilename)\n\n\t\t// unixdate := string(probed.Format.Tags.CreationTime.Format(time.RFC850))\n\n\t\t// s := strings.Split(unixdate, \",\")\n\t\t// // date := s[1][1:11]\n\t\t// day := s[0]\n\t\t// dayNum := s[1][1:3]\n\t\t// month := s[1][4:7]\n\t\t// year := \"20\" + s[1][8:11]\n\t\t// edittime := s[1][11:19]\n\t\t// loc := s[1][20:23]\n\t\t// folderDay := folderdates[h][3:5]\n\n\t\t// // fmt.Println(date, day, dayNum, month, year, time, loc)\n\n\t\t// fmt.Println(cleanName[:len(cleanName)-4], cleanName[len(cleanName)-4:], folderdates[h], month, folderDay, year, folderDay, day, dayNum, month, year, edittime, loc, probed.Format.Duration, probed.Format.Tags.CreationTime, probed.Format.FormatLongName, probed.Format.Size)\n\n\t\tffprobeFilename := probed.Format.Filename\n\t\tcleanFilename := filepath.Base(ffprobeFilename)\n\n\t\tfmt.Println(cleanFilename)\n\t\tfmt.Println(probed.Format.Duration)\n\t\tfmt.Println(probed.Format.Tags.CreationTime)\n\t\tfmt.Println(probed.Format.FormatLongName)\n\t\tfmt.Println(probed.Format.Size)\n\n\t\tunixdate := string(probed.Format.Tags.CreationTime.Format(time.RFC850))\n\n\t\ts := strings.Split(unixdate, \",\")\n\t\tfolderMonth := folderdates[h][:2]\n\t\tfolderDay := folderdates[h][3:5]\n\t\tfolderYear := folderdates[h][len(folderdates[h])-4:]\n\t\teditDate := s[1][1:11]\n\t\teditMonth := s[1][4:7]\n\t\teditDay := s[0]\n\t\teditYear := \"20\" + s[1][8:11]\n\t\teditDayNumber := s[1][1:3]\n\t\ttimestamp := s[1][11:19]\n\t\tloc := s[1][20:23]\n\n\t\tfmt.Println(\"______________________________________\")\n\t\tmatrix = append(matrix, []string{\n\t\t\t// cleanFilename[:len(cleanFilename)-4],\n\t\t\tcleanFilename,\n\t\t\tfolderdates[h],\n\t\t\tfolderMonth,\n\t\t\tfolderDay,\n\t\t\tfolderYear,\n\t\t\teditMonth,\n\t\t\teditDate,\n\t\t\teditDay,\n\t\t\teditYear,\n\t\t\teditDayNumber,\n\t\t\ttimestamp,\n\t\t\tloc,\n\t\t\tprobed.Format.Duration,\n\t\t\tprobed.Format.Size,\n\t\t\tprobed.Format.BitRate,\n\t\t\tprobed.Format.FormatName,\n\t\t\tprobed.Format.FormatLongName})\n\t\t// matrix = append(matrix, []string{\n\t\t// \tcleanName[:len(cleanName)-4],\n\t\t// \t// cleanName[len(cleanName)-4:],\n\t\t// \tfolderdates[h],\n\t\t// \tfolderDay,\n\t\t// \t// date,\n\t\t// \tday,\n\t\t// \tdayNum,\n\t\t// \tmonth,\n\t\t// \tyear,\n\t\t// \tedittime,\n\t\t// \tloc,\n\t\t// \tprobed.Format.Duration,\n\t\t// \tprobed.Format.Size,\n\t\t// \tprobed.Format.BitRate,\n\t\t// \tprobed.Format.FormatName,\n\t\t// \tprobed.Format.FormatLongName})\n\t}\n\t// fmt.Println(matrix)\n\treturn matrix\n}", "func UpdateZvolInfo(vol *apis.ZFSVolume) error {\n\tfinalizers := []string{ZFSFinalizer}\n\tlabels := map[string]string{ZFSNodeKey: NodeID}\n\n\tif vol.Finalizers != nil {\n\t\treturn nil\n\t}\n\n\tnewVol, err := volbuilder.BuildFrom(vol).\n\t\tWithFinalizer(finalizers).\n\t\tWithVolumeStatus(ZFSStatusReady).\n\t\tWithLabels(labels).Build()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = volbuilder.NewKubeclient().WithNamespace(OpenEBSNamespace).Update(newVol)\n\treturn err\n}", "func UpdateInfo(m messages.Base) error {\n\tif core.Debug {\n\t\tmessage(\"debug\", \"Entering into agents.UpdateInfo function\")\n\t}\n\n\tp := m.Payload.(messages.AgentInfo)\n\n\tif !isAgent(m.ID) {\n\t\tmessage(\"warn\", \"The agent was not found while processing an AgentInfo message\")\n\t\treturn fmt.Errorf(\"%s is not a known agent\", m.ID)\n\t}\n\tif core.Debug {\n\t\tmessage(\"debug\", \"Processing new agent info\")\n\t\tmessage(\"debug\", fmt.Sprintf(\"Agent Version: %s\", p.Version))\n\t\tmessage(\"debug\", fmt.Sprintf(\"Agent Build: %s\", p.Build))\n\t\tmessage(\"debug\", fmt.Sprintf(\"Agent waitTime: %s\", p.WaitTime))\n\t\tmessage(\"debug\", fmt.Sprintf(\"Agent skew: %d\", p.Skew))\n\t\tmessage(\"debug\", fmt.Sprintf(\"Agent paddingMax: %d\", p.PaddingMax))\n\t\tmessage(\"debug\", fmt.Sprintf(\"Agent maxRetry: %d\", p.MaxRetry))\n\t\tmessage(\"debug\", fmt.Sprintf(\"Agent failedCheckin: %d\", p.FailedCheckin))\n\t\tmessage(\"debug\", fmt.Sprintf(\"Agent proto: %s\", p.Proto))\n\t\tmessage(\"debug\", fmt.Sprintf(\"Agent killdate: %s\", time.Unix(p.KillDate, 0).UTC().Format(time.RFC3339)))\n\t}\n\tLog(m.ID, fmt.Sprintf(\"Processing AgentInfo message:\"))\n\tLog(m.ID, fmt.Sprintf(\"\\tAgent Version: %s \", p.Version))\n\tLog(m.ID, fmt.Sprintf(\"\\tAgent Build: %s \", p.Build))\n\tLog(m.ID, fmt.Sprintf(\"\\tAgent waitTime: %s \", p.WaitTime))\n\tLog(m.ID, fmt.Sprintf(\"\\tAgent skew: %d \", p.Skew))\n\tLog(m.ID, fmt.Sprintf(\"\\tAgent paddingMax: %d \", p.PaddingMax))\n\tLog(m.ID, fmt.Sprintf(\"\\tAgent maxRetry: %d \", p.MaxRetry))\n\tLog(m.ID, fmt.Sprintf(\"\\tAgent failedCheckin: %d \", p.FailedCheckin))\n\tLog(m.ID, fmt.Sprintf(\"\\tAgent proto: %s \", p.Proto))\n\tLog(m.ID, fmt.Sprintf(\"\\tAgent KillDate: %s\", time.Unix(p.KillDate, 0).UTC().Format(time.RFC3339)))\n\n\tAgents[m.ID].Version = p.Version\n\tAgents[m.ID].Build = p.Build\n\tAgents[m.ID].WaitTime = p.WaitTime\n\tAgents[m.ID].Skew = p.Skew\n\tAgents[m.ID].PaddingMax = p.PaddingMax\n\tAgents[m.ID].MaxRetry = p.MaxRetry\n\tAgents[m.ID].FailedCheckin = p.FailedCheckin\n\tAgents[m.ID].Proto = p.Proto\n\tAgents[m.ID].KillDate = p.KillDate\n\n\tAgents[m.ID].Architecture = p.SysInfo.Architecture\n\tAgents[m.ID].HostName = p.SysInfo.HostName\n\tAgents[m.ID].Pid = p.SysInfo.Pid\n\tAgents[m.ID].Ips = p.SysInfo.Ips\n\tAgents[m.ID].Platform = p.SysInfo.Platform\n\tAgents[m.ID].UserName = p.SysInfo.UserName\n\tAgents[m.ID].UserGUID = p.SysInfo.UserGUID\n\n\tif core.Debug {\n\t\tmessage(\"debug\", \"Leaving agents.UpdateInfo function\")\n\t}\n\treturn nil\n}", "func GetFileInfo(Filename string) ([]Track, []Track, []Track, error) {\n\ttype Info struct {\n\t\tFileName string `json:\"file_name\"`\n\t\tTracks []struct {\n\t\t\tCodec string `json:\"codec\"`\n\t\t\tID int `json:\"id\"`\n\t\t\tProperties struct {\n\t\t\t\tLanguage string `json:\"language\"`\n\t\t\t}\n\t\t\tType string `json:\"type\"`\n\t\t} `json:\"tracks\"`\n\t}\n\tout, err := exec.Command(\"mkvmerge\", \"-F\", \"json\", \"-i\", Filename).Output()\n\tif err != nil {\n\t\tcolor.Red.Println(\"Error: Can't open the file\")\n\t\t//os.Exit(1) <-------\n\t}\n\tvar mkvinfo Info\n\terr = json.Unmarshal(out, &mkvinfo)\n\tif err != nil {\n\t\tcolor.Red.Println(\"Error: Can't extract information from the file\")\n\t\tos.Exit(1)\n\t}\n\n\tif len(mkvinfo.Tracks) == 0 {\n\t\treturn nil, nil, nil, exec.ErrNotFound\n\t}\n\n\tif len(mkvinfo.Tracks) == 1 && mkvinfo.Tracks[0].Type == \"subtitles\" {\n\t\treturn nil, nil, nil, exec.ErrNotFound\n\t}\n\n\tvar Videos []Track\n\tvar Audios []Track\n\tvar Audios2 []Track\n\tvar Subtitles []Track\n\tvar Subtitles2 []Track\n\tvar Tracktmp []Track\n\tfor k := range mkvinfo.Tracks {\n\t\tTracktmp = []Track{{\n\t\t\tID: mkvinfo.Tracks[k].ID,\n\t\t\tLang: mkvinfo.Tracks[k].Properties.Language,\n\t\t\tCodec: mkvinfo.Tracks[k].Codec,\n\t\t}}\n\n\t\tswitch mkvinfo.Tracks[k].Type {\n\t\tcase \"video\":\n\n\t\t\tVideos = append(Videos, Tracktmp[0])\n\t\tcase \"audio\":\n\t\t\tif mkvinfo.Tracks[k].Properties.Language == CFG.SortLang {\n\t\t\t\tAudios = append(Audios, Tracktmp[0])\n\t\t\t} else {\n\t\t\t\tAudios2 = append(Audios2, Tracktmp[0])\n\t\t\t}\n\n\t\tcase \"subtitles\":\n\t\t\tif mkvinfo.Tracks[k].Properties.Language == CFG.SortLang {\n\t\t\t\tSubtitles = append(Subtitles, Tracktmp[0])\n\t\t\t} else {\n\t\t\t\tSubtitles2 = append(Subtitles2, Tracktmp[0])\n\t\t\t}\n\t\t}\n\n\t}\n\tfor k := range Audios2 {\n\t\tAudios = append(Audios, Audios2[k])\n\t}\n\tfor k := range Subtitles2 {\n\t\tSubtitles = append(Subtitles, Subtitles2[k])\n\t}\n\tif CFG.MaxTracksAudio > 0 && len(Audios) >= CFG.MaxTracksAudio {\n\t\tAudios = Audios[:CFG.MaxTracksAudio]\n\t}\n\tif CFG.MaxTracksSub > 0 && len(Subtitles) >= CFG.MaxTracksSub {\n\t\tSubtitles = Subtitles[:CFG.MaxTracksSub]\n\t}\n\n\tif len(Videos) == 0 {\n\t\treturn nil, nil, nil, exec.ErrNotFound\n\t}\n\n\treturn Videos, Audios, Subtitles, nil\n\n}", "func loadNewVideosFromMyChannel(knownVideos *tomlKnownVideos) {\n\n\tclient := getClient(youtube.YoutubeReadonlyScope)\n\tservice, err := youtube.New(client)\n\n\t// videoMeta data does not exist if there is no local data in knownvideos.toml\n\tif knownVideos.Videos == nil {\n\t\tknownVideos.Videos = make(map[string]videoMeta)\n\t}\n\tif err != nil {\n\t\tlog.Fatalf(\"Error creating YouTube client: %v\", err)\n\t}\n\n\tresponse := channelsListMine(service, \"contentDetails\")\n\n\tfor _, channel := range response.Items {\n\t\tplaylistId := channel.ContentDetails.RelatedPlaylists.Uploads\n\n\t\t// Print the playlist ID for the list of uploaded videos.\n\t\tfmt.Printf(\"Checking for new videos in list %s\\r\\n\", playlistId)\n\n\t\tnextPageToken := \"\"\n\t\tvar numItemsPerPage int64 = 35\t\t\t// max 50 https://developers.google.com/youtube/v3/docs/playlistItems/list#parameters\n\t\tfoundNewVideos := false\t\t\t\t\t// if we added videos, we will look for next page of videos\n\t\tfor {\n\t\t\t// Retrieve next set of items in the playlist.\n\t\t\t// Items are not returned in perfectly sorted order, so just go through all pages to get all items\n\t\t\t// Revisit this if it gets too slow\n\t\t\tplaylistResponse := playlistItemsList(service, \"snippet,ContentDetails\", playlistId, nextPageToken, numItemsPerPage)\n\n\t\t\tfor _, playlistItem := range playlistResponse.Items {\n\t\t\t\tfoundNewVideos = addNewVideosToList(playlistItem, knownVideos)\n\t\t\t}\n\n\t\t\tif foundNewVideos {\n\t\t\t\tfmt.Println(\"Found some new videos. Let's look for more!\")\n\t\t\t} else {\n\t\t\t\tfmt.Printf(\"Searched %v videos and found nothing new. Let's move on.\\r\\n\",numItemsPerPage)\n\t\t\t\t// The results are not exactly ordered by publishDate, so there could be cases where we didn't find expected videos\n\t\t\t\tfmt.Println(\"If we should have found some, increase numItemsPerPage or remove \\\"!foundNewVideos ||\\\" from code\")\n\t\t\t}\n\t\t\t// Set the token to retrieve the next page of results\n\t\t\t// or exit the loop if all results have (apparently) been retrieved.\n\t\t\tnextPageToken = playlistResponse.NextPageToken\n\t\t\tif !foundNewVideos || nextPageToken == \"\" {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n}", "func updateListing(whatsNewsDir string, release *androidpublisher.TrackRelease) error {\n\tlog.Debugf(\"Checking if updating listing is required, whats new dir is '%v'\", whatsNewsDir)\n\tif whatsNewsDir != \"\" {\n\t\tfmt.Println()\n\t\tlog.Infof(\"Update listing started\")\n\n\t\trecentChangesMap, err := readLocalisedRecentChanges(whatsNewsDir)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to read whatsnews, error: %s\", err)\n\t\t}\n\n\t\tvar releaseNotes []*androidpublisher.LocalizedText\n\t\tfor language, recentChanges := range recentChangesMap {\n\t\t\treleaseNotes = append(releaseNotes, &androidpublisher.LocalizedText{\n\t\t\t\tLanguage: language,\n\t\t\t\tText: recentChanges,\n\t\t\t})\n\t\t}\n\t\trelease.ReleaseNotes = releaseNotes\n\t\tlog.Infof(\"Update listing finished\")\n\t}\n\treturn nil\n}", "func (client *Client) UpdateAttachedMediaInfosWithOptions(request *UpdateAttachedMediaInfosRequest, runtime *util.RuntimeOptions) (_result *UpdateAttachedMediaInfosResponse, _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.UpdateContent)) {\n\t\tquery[\"UpdateContent\"] = request.UpdateContent\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"UpdateAttachedMediaInfos\"),\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 = &UpdateAttachedMediaInfosResponse{}\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 (e *Engine) updateVservers() {\n\te.clusterLock.RLock()\n\tcluster := e.cluster\n\te.clusterLock.RUnlock()\n\n\t// Delete vservers that no longer exist in the new configuration.\n\tfor name, vserver := range e.vservers {\n\t\tif cluster.Vservers[name] == nil {\n\t\t\tlog.Infof(\"Stopping unconfigured vserver %s\", name)\n\t\t\tvserver.stop()\n\t\t\t<-vserver.stopped\n\t\t\tdelete(e.vservers, name)\n\t\t\te.vserverLock.Lock()\n\t\t\tdelete(e.vserverSnapshots, name)\n\t\t\te.vserverLock.Unlock()\n\t\t}\n\t}\n\n\t// Spawn new vservers and provide current configurations.\n\tfor _, config := range cluster.Vservers {\n\t\tif e.vservers[config.Name] == nil {\n\t\t\tvserver := newVserver(e)\n\t\t\tgo vserver.run()\n\t\t\te.vservers[config.Name] = vserver\n\t\t}\n\t}\n\tfor _, override := range e.overrides {\n\t\te.distributeOverride(override)\n\t}\n\tfor _, config := range cluster.Vservers {\n\t\te.vservers[config.Name].updateConfig(config)\n\t}\n}", "func (pv *PixView) DirInfo(reset bool) {\n\tfdir := filepath.Join(pv.ImageDir, pv.Folder)\n\ttdir := pv.ThumbDir()\n\tos.MkdirAll(tdir, 0775)\n\n\t// fmt.Printf(\"starting...\\n\")\n\timgs, err := dirs.AllFiles(fdir)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\timgs = imgs[1:] // first one is the directory itself\n\tnfl := len(imgs)\n\tpv.Info = make(picinfo.Pics, nfl)\n\n\t// fmt.Printf(\"N files %d\\n\", nfl)\n\n\t// first pass fill in from existing info -- no locking\n\tfor i := nfl - 1; i >= 0; i-- {\n\t\tfn := filepath.Base(imgs[i])\n\t\tfnext, _ := dirs.SplitExt(fn)\n\t\tpi, has := pv.AllInfo[fnext]\n\t\tif has {\n\t\t\tpv.Info[i] = pi\n\t\t\tcontinue\n\t\t}\n\t\ttyp := filecat.SupportedFromFile(imgs[i])\n\t\tif typ.Cat() != filecat.Image { // todo: movies!\n\t\t\timgs = append(imgs[:i], imgs[i+1:]...)\n\t\t\tpv.Info = append(pv.Info[:i], pv.Info[i+1:]...)\n\t\t} else {\n\t\t\tfmt.Printf(\"found new file: %s\\n\", fn)\n\t\t}\n\t}\n\n\tnfl = len(imgs)\n\tpv.PProg.Start(nfl)\n\n\tncp := runtime.NumCPU()\n\tnper := nfl / 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 = nfl\n\t\t}\n\t\tgo pv.InfoUpdtThr(fdir, imgs, st, ed)\n\t\tpv.WaitGp.Add(1)\n\t\tst = ed\n\t}\n\tpv.WaitGp.Wait()\n\tpv.InfoClean()\n\t// fmt.Printf(\"second pass done\\n\")\n\tpv.Info.SortByDate(true)\n\t// fmt.Printf(\"sort done\\n\")\n\tpv.Thumbs = pv.Info.Thumbs()\n\tgo pv.SaveAllInfo()\n\tig := pv.ImgGrid()\n\tig.SetImages(pv.Thumbs, reset)\n\t// fmt.Printf(\"done\\n\")\n}", "func (idx *Indexing) initFilesInfo() {\n\n\tfor _, file := range idx.Files {\n\t\t// Get previous file data\n\t\tprevFileData := idx.Repo.getFileInfoAsObj(file.fileUniqueKey)\n\t\tif (File{}) != prevFileData {\n\t\t\tif prevFileData.fileHash != file.fileHash && prevFileData.fileSize != file.fileSize {\n\t\t\t\tidx.Repo.deleteFileInfo(file.fileUniqueKey)\n\t\t\t\tidx.Repo.insIntoMainInfoFileTable(file)\n\t\t\t\tidx.trueIndexing(file)\n\t\t\t}\n\t\t} else {\n\t\t\tidx.Repo.insIntoMainInfoFileTable(file)\n\t\t\tidx.trueIndexing(file)\n\t\t}\n\t}\n}", "func updateImageMetaInfos(folder *mfg.FolderContent) {\n\tvar newestTime int64 = math.MinInt64\n\tfor _, imgFile := range folder.Files {\n\t\timgMeta, exists := folder.ImageMetadata[imgFile]\n\t\tif !exists {\n\t\t\timgMeta = readImageInfo(imgFile, folder.GetFullPathFile(imgFile))\n\t\t\tfolder.ImageMetadata[imgFile] = imgMeta\n\t\t}\n\n\t\tif imgMeta.Exif.Time != nil && *imgMeta.Exif.Time > newestTime {\n\t\t\tnewestTime = *imgMeta.Exif.Time\n\t\t}\n\t}\n\n\ttitle, timestamp, ok := parseTitleAndDateFromFoldername(folder.Name)\n\tfolder.Title = strings.Replace(title, \"_\", \" \", -1)\n\n\tif ok {\n\t\tfTime := timestamp.UnixNano() / 1000 / 1000\n\t\tfolder.Time = &fTime\n\t} else if newestTime != math.MinInt64 {\n\t\tfolder.Time = &newestTime\n\t}\n\n\tfor i := range folder.Folder {\n\t\tupdateImageMetaInfos(&folder.Folder[i])\n\t\t// update the folder time if any sub folder has a newer time\n\t\tif folder.Time == nil || (folder.Folder[i].Time != nil && *folder.Time < *folder.Folder[i].Time) {\n\t\t\tfolder.Time = folder.Folder[i].Time\n\t\t}\n\t}\n}", "func videosHandler(videoChan chan ytvideo.YTVideo, tPoolNum chan int) {\n\tvideo := <-videoChan\n\t<-tPoolNum // get a turn in the pool\n\tdefer consumeThread(tPoolNum) // to give turn to other threads\n\tif debugOutput {\n\t\tfmt.Println(video.Id)\n\t}\n\tytdl := youtube_dl.YoutubeDl{}\n\tytdl.Path = \"$GOPATH/src/app/srts\"\n\terr := ytdl.DownloadVideo(video.Id)\n\tif err != nil {\n\t\tlog.Printf(\"%v\", err)\n\t}\n\t//if debugOutput {\n\t//\tlog.Printf(\"command : %v\", command)\n\t//}\n\tfmt.Print(\".\");\n\tStoreValue(video)\n\tgetVideoSuggestions(video.Id, videoChan, \"12\", tPoolNum)// 12 is a random token that works as initial value\n}", "func (cs *Record) SetFileInfo(filename string, version string) {\n\tcs.Filename = filename\n\tcs.Version = version\n}", "func (l *Level) UpdateVis(fov Field) {\n\tfor _, row := range l.Map {\n\t\tfor _, tile := range row {\n\t\t\ttile.Visible = false\n\t\t}\n\t}\n\n\tp := l.game.Player\n\tfor _, pt := range fov {\n\t\ttile := l.At(pt)\n\n\t\tif a := tile.Actor; a != nil && !a.IsPlayer() {\n\t\t\tp.Learner.GainXPSight(a)\n\t\t\ta.Seen = true\n\t\t}\n\n\t\ttile.Items.EachItem(func(item *Obj) {\n\t\t\tp.Learner.GainXPSight(item)\n\t\t\titem.Seen = true\n\t\t})\n\n\t\ttile.Visible = true\n\t\ttile.Seen = true\n\t}\n}", "func Update(file string) (*File, error) {\n\n\tif IsKnown(file) {\n\t\tfileInfo := allFiles[file]\n\n\t\t// Update LastModified and ETag\n\t\tfileInfo.LastModified = time.Now().String()\n\t\tfileInfo.Etag = cache.CalculateHash(file, fileInfo.LastModified)\n\n\t\tfileInfo.Bytes = []byte{}\n\t\tfileInfo.Dependencies = []string{}\n\n\t\t// Reapply transformers\n\t\tapplyTransformers(&fileInfo)\n\n\t\t// Dependencies need to be updated aswell!\n\t\tanalyzeFile(&fileInfo)\n\n\t\tallFiles[file] = fileInfo\n\n\t\treturn &fileInfo, nil\n\t}\n\n\treturn Add(file)\n\n}", "func (ts *Server) UpdateCellInfoFields(ctx context.Context, cell string, update func(*topodatapb.CellInfo) error) error {\n\tfilePath := pathForCellInfo(cell)\n\tfor {\n\t\tci := &topodatapb.CellInfo{}\n\n\t\t// Read the file, unpack the contents.\n\t\tcontents, version, err := ts.globalCell.Get(ctx, filePath)\n\t\tswitch {\n\t\tcase err == nil:\n\t\t\tif err := ci.UnmarshalVT(contents); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tcase IsErrType(err, NoNode):\n\t\t\t// Nothing to do.\n\t\tdefault:\n\t\t\treturn err\n\t\t}\n\n\t\t// Call update method.\n\t\tif err = update(ci); err != nil {\n\t\t\tif IsErrType(err, NoUpdateNeeded) {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\n\t\t// Pack and save.\n\t\tcontents, err = ci.MarshalVT()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif _, err = ts.globalCell.Update(ctx, filePath, contents, version); !IsErrType(err, BadVersion) {\n\t\t\t// This includes the 'err=nil' case.\n\t\t\treturn err\n\t\t}\n\t}\n}", "func (*UpdateVideoV1Response) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_video_api_ocp_video_api_proto_rawDescGZIP(), []int{11}\n}", "func (d *Dao) AvidVideoMap(ctx context.Context, avids []int64) (avidVideoMap map[int64]*model.UpCardVideo, err error) {\n\tavidVideoMap = make(map[int64]*model.UpCardVideo)\n\tarchives, err := d.listArchives(ctx, avids)\n\tif err != nil {\n\t\tlog.Error(\"d.listArchives error(%v) arg(%v)\", err, avids)\n\t\terr = ecode.CreativeArcServiceErr\n\t\treturn\n\t}\n\n\tfor avid, data := range archives {\n\t\tvideo := transfer(avid, data)\n\t\tavidVideoMap[avid] = video\n\t}\n\treturn\n}", "func (manager *MetricsCacheManager) UpdateSystemInfoMetrics(infos *milvuspb.GetMetricsResponse) {\n\tmanager.systemInfoMetricsMtx.Lock()\n\tdefer manager.systemInfoMetricsMtx.Unlock()\n\n\tmanager.systemInfoMetrics = infos\n\tmanager.systemInfoMetricsInvalid = false\n\tmanager.systemInfoMetricsLastUpdatedTime = time.Now()\n}", "func (s *sitesController) UpdateJsonFiles() {\n\tfor _, config := range s.configs {\n\t\tRewriteJson(config)\n\t}\n}", "func (s *SE) SetStructInfo(newStructInfo bg.StructInfo) {\n\ts.StructInfo = newStructInfo\n}", "func (virtualmedia *VirtualMedia) Update() error {\n\t// Get a representation of the object's original state so we can find what\n\t// to update.\n\toriginal := new(VirtualMedia)\n\terr := original.UnmarshalJSON(virtualmedia.rawData)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treadWriteFields := []string{\n\t\t\"Image\",\n\t\t\"Inserted\",\n\t\t\"Password\",\n\t\t\"TransferMethod\",\n\t\t\"TransferProtocolType\",\n\t\t\"UserName\",\n\t\t\"WriteProtected\",\n\t}\n\n\toriginalElement := reflect.ValueOf(original).Elem()\n\tcurrentElement := reflect.ValueOf(virtualmedia).Elem()\n\n\treturn virtualmedia.Entity.Update(originalElement, currentElement, readWriteFields)\n}", "func (d *DescriptionParser) UpdateReports(s *Scanner, wg *sync.WaitGroup) {\n\ts.ResetLastErrorFunc()\n\tvalues := rgxDescription.FindStringSubmatch(d.text)\n\tfor i, key := range rgxDescription.SubexpNames() {\n\t\tif key == \"testcase\" {\n\t\t\ts.testMapIterator[values[i]] = reports.NewTestFunc(values[i])\n\t\t}\n\t}\n}", "func UpdateVault(s SiteFile) (err error) {\n\tsi, err := GetSitesFile()\n\tif err != nil {\n\t\tlog.Fatalf(\"Could not get pass dir: %s\", err.Error())\n\t}\n\tsiteFileContents, err := json.MarshalIndent(s, \"\", \"\\t\")\n\tif err != nil {\n\t\tlog.Fatalf(\"Could not marshal site info: %s\", err.Error())\n\t}\n\n\t// Write the site with the newly appended site to the file.\n\terr = ioutil.WriteFile(si, siteFileContents, 0666)\n\treturn\n}", "func (c *ospfCollector) Update(ch chan<- prometheus.Metric) error {\n\tcmd := \"show ip ospf vrf all interface json\"\n\n\tif len(c.instanceIDs) > 0 {\n\t\tfor _, id := range c.instanceIDs {\n\t\t\tjsonOSPFInterface, err := executeOSPFMultiInstanceCommand(cmd, id)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif err = processOSPFInterface(ch, jsonOSPFInterface, c.descriptions, id); err != nil {\n\t\t\t\treturn cmdOutputProcessError(cmd, string(jsonOSPFInterface), err)\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\n\tjsonOSPFInterface, err := executeOSPFCommand(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err = processOSPFInterface(ch, jsonOSPFInterface, c.descriptions, 0); err != nil {\n\t\treturn cmdOutputProcessError(cmd, string(jsonOSPFInterface), err)\n\t}\n\treturn nil\n}", "func (client *Client) GetVideoInfo(request *GetVideoInfoRequest) (_result *GetVideoInfoResponse, _err error) {\n\truntime := &util.RuntimeOptions{}\n\t_result = &GetVideoInfoResponse{}\n\t_body, _err := client.GetVideoInfoWithOptions(request, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_result = _body\n\treturn _result, _err\n}", "func (s *Sysinfo) Update() {\n\tinfo := syscall.Sysinfo_t{}\n\terr := syscall.Sysinfo(&info)\n\tif err != nil {\n\t\tlog.Printf(\"Sysinfo call failed: %s\", err.Error())\n\t\treturn\n\t}\n\n\ts.uptime = uint64(info.Uptime)\n\ts.memTotal = info.Totalram\n\ts.memFree = info.Freeram\n\ts.memShared = info.Sharedram\n\ts.memBuffer = info.Bufferram\n\ts.swapTotal = info.Totalswap\n\ts.swapFree = info.Freeswap\n\ts.load = info.Loads\n\ts.procs = uint64(info.Procs)\n}", "func (c *meminfoCollector) Update(ch chan<- prometheus.Metric) error {\n\tvar metricType prometheus.ValueType\n\tmemInfo, err := c.getMemInfo()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"couldn't get meminfo: %w\", err)\n\t}\n\tlevel.Debug(c.logger).Log(\"msg\", \"Set node_mem\", \"memInfo\", memInfo)\n\tfor k, v := range memInfo {\n\t\tif strings.HasSuffix(k, \"_total\") {\n\t\t\tmetricType = prometheus.CounterValue\n\t\t} else {\n\t\t\tmetricType = prometheus.GaugeValue\n\t\t}\n\t\tch <- prometheus.MustNewConstMetric(\n\t\t\tprometheus.NewDesc(\n\t\t\t\tprometheus.BuildFQName(namespace, memInfoSubsystem, k),\n\t\t\t\tfmt.Sprintf(\"Memory information field %s.\", k),\n\t\t\t\tnil, nil,\n\t\t\t),\n\t\t\tmetricType, v,\n\t\t)\n\t}\n\treturn nil\n}", "func update(vs *ViewServer, primary string, backup string){\n\tvs.currentView.Viewnum += 1\n\tvs.currentView.Primary = primary\n\tvs.currentView.Backup = backup\n\tvs.idleServer = \"\"\n\tvs.primaryACK = false\n\tvs.backupACK = false\n}", "func (dn *Daemon) updateFiles(oldIgnConfig, newIgnConfig ign3types.Config, skipCertificateWrite bool) error {\n\tklog.Info(\"Updating files\")\n\tif err := dn.writeFiles(newIgnConfig.Storage.Files, skipCertificateWrite); err != nil {\n\t\treturn err\n\t}\n\tif err := dn.writeUnits(newIgnConfig.Systemd.Units); err != nil {\n\t\treturn err\n\t}\n\treturn dn.deleteStaleData(oldIgnConfig, newIgnConfig)\n}", "func (fpc *FakePVCControl) UpdateMetaInfo(tc *v1alpha1.TidbCluster, pvc *corev1.PersistentVolumeClaim, pod *corev1.Pod) error {\n\tdefer fpc.updatePVCTracker.inc()\n\tif fpc.updatePVCTracker.errorReady() {\n\t\tdefer fpc.updatePVCTracker.reset()\n\t\treturn fpc.updatePVCTracker.err\n\t}\n\tif pvc.Labels == nil {\n\t\tpvc.Labels = make(map[string]string)\n\t}\n\tif pvc.Annotations == nil {\n\t\tpvc.Annotations = make(map[string]string)\n\t}\n\tsetIfNotEmpty(pvc.Labels, label.AppLabelKey, pod.Labels[label.AppLabelKey])\n\tsetIfNotEmpty(pvc.Labels, label.OwnerLabelKey, pod.Labels[label.OwnerLabelKey])\n\tsetIfNotEmpty(pvc.Labels, label.ClusterLabelKey, pod.Labels[label.ClusterLabelKey])\n\tsetIfNotEmpty(pvc.Labels, label.ClusterIDLabelKey, pod.Labels[label.ClusterIDLabelKey])\n\tsetIfNotEmpty(pvc.Labels, label.MemberIDLabelKey, pod.Labels[label.MemberIDLabelKey])\n\tsetIfNotEmpty(pvc.Labels, label.StoreIDLabelKey, pod.Labels[label.StoreIDLabelKey])\n\tsetIfNotEmpty(pvc.Annotations, label.AnnPodNameKey, pod.GetName())\n\treturn fpc.PVCIndexer.Update(pvc)\n}", "func (f5 *BigIP) HandleVSUpdate(msg comm.Message) comm.Message {\n\n\tvs, err := f5.cli.GetVirtualServer(f5.addPartitionToName(msg.Service.Name))\n\tif err != nil {\n\t\tmsg.Error = fmt.Sprintf(\"Could not get VS %v %v\", msg.Service.Name, err.Error())\n\t\treturn msg\n\t}\n\n\t// check if pool attached to vs needs to be changed\n\tif vs != nil {\n\t\tif err := f5.upsertPool(msg); err != nil {\n\t\t\tmsg.Error = err.Error()\n\t\t\treturn msg\n\t\t}\n\n\t\t// check if virtual's IP is the one we got in msg\n\t\tif !strings.Contains(vs.Destination, msg.Service.PublicIP+\":\"+strconv.Itoa(f5.getLBPort(msg))) {\n\t\t\tlog.Debugf(\"pool %v: exposed IP differs\", msg.Service.Name)\n\t\t\tif err := f5.cli.ModifyVirtualServer(vs.Name, &bigip.VirtualServer{Destination: msg.Service.PublicIP + \":\" + strconv.Itoa(f5.getLBPort(msg))}); err != nil {\n\t\t\t\tmsg.Error = err.Error()\n\t\t\t\treturn msg\n\t\t\t}\n\t\t}\n\n\t\tlog.Debugf(\"f5ltm, nothing to do for service %v\", msg.Service.Name)\n\t\treturn msg\n\t}\n\n\tlog.Debugf(\"%v not found, creating pool and virtual server\", msg.Service.Name)\n\n\t_, err = f5.createPool(msg)\n\tif err != nil {\n\t\tmsg.Error = err.Error()\n\t\treturn msg\n\t}\n\n\tif err := f5.createVirtualServer(msg); err != nil {\n\t\tmsg.Error = err.Error()\n\t\treturn msg\n\t}\n\treturn msg\n}", "func (*VodUpdateMediaInfoResponse) Descriptor() ([]byte, []int) {\n\treturn file_vod_response_response_vod_proto_rawDescGZIP(), []int{10}\n}", "func (client *VideosClient) updateHandleResponse(resp *http.Response) (VideosClientUpdateResponse, error) {\n\tresult := VideosClientUpdateResponse{}\n\tif err := runtime.UnmarshalAsJSON(resp, &result.VideoEntity); err != nil {\n\t\treturn VideosClientUpdateResponse{}, err\n\t}\n\treturn result, nil\n}", "func (v *IADs) SetInfo() error {\n\thr, _, _ := syscall.Syscall(\n\t\tuintptr(v.VTable().SetInfo),\n\t\t1,\n\t\tuintptr(unsafe.Pointer(v)),\n\t\t0,\n\t\t0)\n\tif hr != 0 {\n\t\treturn convertHresultToError(hr)\n\t}\n\treturn nil\n}", "func (vl *VlanBridge) SvcProviderUpdate(svcName string, providers []string) {\n}", "func (fv *FileView) UpdateFilesAction() {\n\tfv.FileSig.Emit(fv.This, int64(FileViewWillUpdate), fv.DirPath)\n\tfv.SetFullReRender()\n\tfv.UpdateFiles()\n\tfv.FileSig.Emit(fv.This, int64(FileViewUpdated), fv.DirPath)\n}", "func (o *OpenapiProcessFileAllOf) SetFileInfo(v OpenapiOpenApiSpecificationRelationship) {\n\to.FileInfo = &v\n}", "func ExampleVideoAnalyzersClient_BeginUpdate() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclient, err := armvideoanalyzer.NewVideoAnalyzersClient(\"00000000-0000-0000-0000-000000000000\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpoller, err := client.BeginUpdate(ctx,\n\t\t\"contoso\",\n\t\t\"contosotv\",\n\t\tarmvideoanalyzer.Update{\n\t\t\tTags: map[string]*string{\n\t\t\t\t\"key1\": to.Ptr(\"value3\"),\n\t\t\t},\n\t\t},\n\t\tnil)\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 (d *Dao) UpVideoCovers(c context.Context, covers []string) (cvs []string, err error) {\n\tvar (\n\t\tnfsURL string\n\t)\n\tfor _, cv := range covers {\n\t\t// get nfs file\n\t\tbs, err := d.bvcCover(cv)\n\t\tif err != nil || len(bs) == 0 {\n\t\t\tlog.Error(\"d.UpVideoCovers(%s) error(%v) or bs==0\", nfsURL, err)\n\t\t\tcontinue\n\t\t}\n\t\t// up to bfs\n\t\tbfsPath, err := d.UploadArc(c, http.DetectContentType(bs), bytes.NewReader(bs))\n\t\tif err != nil {\n\t\t\tlog.Error(\"d.UpVideoCovers raw url(%s) error(%v)\", cv, err)\n\t\t\tcontinue\n\t\t}\n\t\t// parse bfs return path\n\t\tif err != nil {\n\t\t\tlog.Error(\"url.Parse(%v) error(%v)\", bfsPath, err)\n\t\t\tcontinue\n\t\t}\n\t\tcvs = append(cvs, bfsPath)\n\t\tlog.Info(\"UpVideoCovers cover(%s) bfs (%s)\", cv, bfsPath)\n\t}\n\treturn\n}", "func (e *PlanReplayerLoadInfo) Update(data []byte) error {\n\tb := bytes.NewReader(data)\n\tz, err := zip.NewReader(b, int64(len(data)))\n\tif err != nil {\n\t\treturn errors.AddStack(err)\n\t}\n\n\t// load variable\n\terr = loadVariables(e.Ctx, z)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// build schema and table first\n\tfor _, zipFile := range z.File {\n\t\tif zipFile.Name == fmt.Sprintf(\"schema/%v\", domain.PlanReplayerSchemaMetaFile) {\n\t\t\tcontinue\n\t\t}\n\t\tpath := strings.Split(zipFile.Name, \"/\")\n\t\tif len(path) == 2 && strings.Compare(path[0], \"schema\") == 0 {\n\t\t\terr = createSchemaAndItems(e.Ctx, zipFile)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// set tiflash replica if exists\n\terr = loadSetTiFlashReplica(e.Ctx, z)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// build view next\n\tfor _, zipFile := range z.File {\n\t\tpath := strings.Split(zipFile.Name, \"/\")\n\t\tif len(path) == 2 && strings.Compare(path[0], \"view\") == 0 {\n\t\t\terr = createSchemaAndItems(e.Ctx, zipFile)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// load stats\n\tfor _, zipFile := range z.File {\n\t\tpath := strings.Split(zipFile.Name, \"/\")\n\t\tif len(path) == 2 && strings.Compare(path[0], \"stats\") == 0 {\n\t\t\terr = loadStats(e.Ctx, zipFile)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\terr = loadAllBindings(e.Ctx, z)\n\tif err != nil {\n\t\tlogutil.BgLogger().Warn(\"load bindings failed\", zap.Error(err))\n\t\te.Ctx.GetSessionVars().StmtCtx.AppendWarning(fmt.Errorf(\"load bindings failed, err:%v\", err))\n\t}\n\treturn nil\n}", "func (*UpdateVideoV1Request) Descriptor() ([]byte, []int) {\n\treturn file_api_ocp_video_api_ocp_video_api_proto_rawDescGZIP(), []int{10}\n}", "func (e EventStruct) Update() error {\n\tfor _, migration := range m {\n\t\tcontainer.C.MigrationService.SetMigration(migration)\n\t}\n\n\treturn container.C.MigrationService.RunMigrations()\n}", "func SetInfos(arg InfosT) {\n\tinfos = arg\n}", "func (ln *linuxNetworking) UpdateVirtualServer(ipvsSvc *ipvs.Service) error {\n\tln.Lock()\n\tdefer ln.Unlock()\n\n\treturn ln.ipvsHandle.UpdateService(ipvsSvc)\n}", "func (leaf *Node) update(newInfo os.FileInfo, withContent bool) (err error) {\n\tif newInfo == nil {\n\t\tnewInfo, err = os.Stat(leaf.SysPath)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"lib/memfs: Node.update %q: %s\",\n\t\t\t\tleaf.Path, err.Error())\n\t\t}\n\t}\n\n\tif leaf.Mode != newInfo.Mode() {\n\t\tleaf.Mode = newInfo.Mode()\n\t\treturn nil\n\t}\n\n\tleaf.ModTime = newInfo.ModTime()\n\tleaf.Size = newInfo.Size()\n\n\tif !withContent || newInfo.IsDir() {\n\t\treturn nil\n\t}\n\n\treturn leaf.updateContent()\n}", "func ExtractVideoInformation(config VideoConfiguration) (VideoInformation, error) {\n\tfmt.Print(\"Extracting video information\")\n\t// Extract frames to configured dir\n\tframePaths, err := video.ExtractFrames(config.VideoPath(), config.FrameOutputDirectory())\n\tif err != nil {\n\t\treturn VideoInformation{}, err\n\t}\n\tprintProgressDot()\n\n\t// Predict intertitle frames\n\tpredictions, err := predictIntertitles(framePaths, config.PredictorPath())\n\tif err != nil {\n\t\treturn VideoInformation{}, err\n\t}\n\tprintProgressDot()\n\n\t// Smooth intertitle frames\n\tsmoothIntertitles(predictions, config.SmoothingClosingThreshold(), config.SmoothingOpeningThreshold())\n\tprintProgressDot()\n\n\t// Get some basic video info\n\tbasicInfo, err := video.GetBasicInformation(config.VideoPath())\n\tif err != nil {\n\t\treturn VideoInformation{}, err\n\t}\n\tprintProgressDot()\n\n\t// Extract intertitle timings\n\tinterRanges, err := intertitle.MapRanges(predictions, basicInfo.FPS, framePaths)\n\tif err != nil {\n\t\treturn VideoInformation{}, err\n\t}\n\tprintDone()\n\n\treturn VideoInformation{\n\t\tVideoFPS: basicInfo.FPS,\n\t\tVideoHeight: basicInfo.Height,\n\t\tVideoWidth: basicInfo.Width,\n\t\tIntertitleRanges: interRanges,\n\t}, nil\n}", "func (s *Service) treatDiffV(diff *ugcmdl.VideoDiff) (err error) {\n\tvar (\n\t\tnewPages []*arcmdl.Page\n\t\tpage *arcmdl.Page\n\t\taid = diff.Aid\n\t\ttx *sql.Tx\n\t)\n\t// all the operations about this archive's videos, will be in one transaction\n\tif tx, err = s.dao.BeginTran(ctx); err != nil {\n\t\tlog.Error(\"BeginTran Error %v\", err)\n\t\treturn\n\t}\n\t// add new videos\n\tif len(diff.New) > 0 {\n\t\tfor _, v := range diff.New {\n\t\t\tif page, err = s.pagePick(ctx, v, aid, \"\"); err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tnewPages = append(newPages, page)\n\t\t}\n\t\tif err = s.dao.TxAddVideos(tx, newPages, aid); err != nil {\n\t\t\ttx.Rollback()\n\t\t\treturn\n\t\t}\n\t}\n\tif len(diff.Removed) > 0 {\n\t\tfor _, v := range diff.Removed {\n\t\t\tif err = s.dao.TxDelVideo(tx, v); err != nil {\n\t\t\t\ttx.Rollback()\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\tif len(diff.Updated) > 0 {\n\t\tfor _, v := range diff.Updated {\n\t\t\tif err = s.dao.TxUpdateVideo(tx, v); err != nil {\n\t\t\t\ttx.Rollback()\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\ttx.Commit()\n\treturn\n}", "func (client *Client) GetVideoInfoWithOptions(request *GetVideoInfoRequest, runtime *util.RuntimeOptions) (_result *GetVideoInfoResponse, _err error) {\n\t_err = util.ValidateModel(request)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\tquery := map[string]interface{}{}\n\tif !tea.BoolValue(util.IsUnset(request.VideoId)) {\n\t\tquery[\"VideoId\"] = request.VideoId\n\t}\n\n\treq := &openapi.OpenApiRequest{\n\t\tQuery: openapiutil.Query(query),\n\t}\n\tparams := &openapi.Params{\n\t\tAction: tea.String(\"GetVideoInfo\"),\n\t\tVersion: tea.String(\"2017-03-21\"),\n\t\tProtocol: tea.String(\"HTTPS\"),\n\t\tPathname: tea.String(\"/\"),\n\t\tMethod: tea.String(\"POST\"),\n\t\tAuthType: tea.String(\"AK\"),\n\t\tStyle: tea.String(\"RPC\"),\n\t\tReqBodyType: tea.String(\"formData\"),\n\t\tBodyType: tea.String(\"json\"),\n\t}\n\t_result = &GetVideoInfoResponse{}\n\t_body, _err := client.CallApi(params, req, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_err = tea.Convert(_body, &_result)\n\treturn _result, _err\n}", "func (m *Manager) UpdateChannelAds(ca []ChannelAd) error {\n\tvar q = fmt.Sprintf(\"UPDATE %s SET updated_at=?,warning=? , view=? WHERE channel_id=? AND ad_id=?\", ChannelAdTableFull)\n\tfor i := range ca {\n\t\t_, err := m.GetDbMap().Exec(\n\t\t\tq,\n\t\t\ttime.Now(),\n\t\t\tca[i].Warning,\n\t\t\tca[i].View,\n\t\t\tca[i].ChannelID,\n\t\t\tca[i].AdID,\n\t\t)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (s *Synchronizer) UpdateMonitors() {\n\ts.l.Lock()\n\tdefer s.l.Unlock()\n\n\ts.forceSync[syncMethodAccountConfig] = true\n\ts.forceSync[syncMethodMonitor] = true\n}", "func (s *HTTPserver) ServeFiles(serverStarted chan<- struct{}, videoPath, subtitlesPath string, tvpayload *HTTPPayload) error {\n\tfiles := &filesToServe{\n\t\tVideo: videoPath,\n\t\tSubtitles: subtitlesPath,\n\t}\n\n\ts.mux.HandleFunc(\"/\"+filepath.Base(files.Video), files.serveVideoHandler)\n\ts.mux.HandleFunc(\"/\"+filepath.Base(files.Subtitles), files.serveSubtitlesHandler)\n\ts.mux.HandleFunc(\"/callback\", tvpayload.callbackHandler)\n\n\tln, err := net.Listen(\"tcp\", s.http.Addr)\n\tserverStarted <- struct{}{}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Server Listen fail\")\n\t}\n\ts.http.Serve(ln)\n\treturn nil\n}", "func (m *MonkeyWrench) UpdateStructMulti(table string, sourceData interface{}) error {\n\treturn m.applyStructMutations(table, sourceData, spanner.UpdateStruct)\n}", "func (m *Monocular) UpdateMetadata(info *interfaces.Info, userGUID string, echoContext echo.Context) {\n}", "func (fr *FileResource) Update() error {\n\t// Purge extra files\n\tif fr.Purge {\n\t\tfor name := range fr.extra {\n\t\t\tdstFile := utils.NewFileUtil(name)\n\t\t\tfr.Printf(\"purging %s\\n\", name)\n\t\t\tif err := dstFile.Remove(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// Fix outdated files\n\tfor _, item := range fr.outdated {\n\t\tdstFile := utils.NewFileUtil(item.dst)\n\n\t\t// Update file content if needed\n\t\tif item.flags&flagOutdatedContent != 0 {\n\t\t\t// Create parent directory for file if missing\n\t\t\tdstDir := filepath.Dir(item.dst)\n\t\t\t_, err := os.Stat(dstDir)\n\t\t\tif os.IsNotExist(err) {\n\t\t\t\tif err := os.MkdirAll(dstDir, 0755); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tsrcFile := utils.NewFileUtil(item.src)\n\t\t\tsrcMd5, err := srcFile.Md5()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tfr.Printf(\"setting content of %s to md5:%s\\n\", item.dst, srcMd5)\n\t\t\tif err := dstFile.CopyFrom(item.src, true); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\t// Update permissions if needed\n\t\tif item.flags&flagOutdatedPermissions != 0 {\n\t\t\tfr.Printf(\"setting permissions of %s to %#o\\n\", item.dst, fr.Mode)\n\t\t\tif err := dstFile.Chmod(os.FileMode(fr.Mode)); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\t// Update ownership if needed\n\t\tif item.flags&flagOutdatedOwner != 0 {\n\t\t\tfr.Printf(\"setting owner of %s to %s:%s\\n\", item.dst, fr.Owner, fr.Group)\n\t\t\tif err := dstFile.SetOwner(fr.Owner, fr.Group); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func UpdateDescsByID(e echo.Context) error {\n\tdesc := db.Descs{}\n\te.Bind(&desc)\n\n\tif err := config.DB.Updates(&desc).Where(\"id= ?\", desc.ID).Error; err != nil {\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, err.Error())\n\t}\n\treturn e.JSON(http.StatusOK, map[string]interface{}{\n\t\t\"message\": \"Berhasil Mengubah Data Deskripsi\",\n\t\t\"descs\": desc,\n\t})\n}", "func (c *Cache) updateStats() error {\n\tvar newUsed int64\n\terr := c.walk(func(osPath string, fi os.FileInfo, name string) error {\n\t\tif !fi.IsDir() {\n\t\t\t// Update the atime with that of the file\n\t\t\tatime := times.Get(fi).AccessTime()\n\t\t\tc.updateStat(name, atime, fi.Size())\n\t\t\tnewUsed += fi.Size()\n\t\t} else {\n\t\t\tc.cacheDir(name)\n\t\t}\n\t\treturn nil\n\t})\n\tc.itemMu.Lock()\n\tc.used = newUsed\n\tc.itemMu.Unlock()\n\treturn err\n}", "func UpdateHandler(infoer Infoer, args Args) (int, error) {\n\tcandidateUpdateReq, err := NewCandidateUpdateRequest(args, infoer)\n\tif err != nil {\n\t\treturn EXIT_ERROR, err\n\t}\n\n\ttmpDir, err := CreateTempDir()\n\tif nil != err {\n\t\terr = fmt.Errorf(\"failed to create temp dir; %w\", err)\n\t\treturn EXIT_ERROR, err\n\t}\n\tdefer DeleteDirectory(tmpDir)\n\n\t// write the contents of the wys file to disk (contains details about the available update)\n\twysFilePath := filepath.Join(tmpDir, \"wys\")\n\terr = os.WriteFile(wysFilePath, candidateUpdateReq.CandidateWysFileContent.Bytes(), 0644)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"failed to write WYS file to: %v; %w\", wysFilePath, err)\n\t\treturn EXIT_ERROR, err\n\t}\n\n\t// download WYU (this is the archive with the updated files)\n\twys := candidateUpdateReq.ConfigWYS\n\twyuFilePath := filepath.Join(tmpDir, \"wyu\")\n\tif err := wys.getWyuFile(args, wyuFilePath); err != nil {\n\t\treturn EXIT_ERROR, err\n\t}\n\n\tiuc := candidateUpdateReq.ConfigIUC\n\tif iuc.IucPublicKey.Value != nil {\n\t\tif len(wys.FileSha1) == 0 {\n\t\t\terr = fmt.Errorf(\"The update is not signed. All updates must be signed in order to be installed.\")\n\t\t\treturn EXIT_ERROR, err\n\t\t}\n\n\t\t// convert the public key from the WYC file to an rsa.PublicKey\n\t\tkey, err := ParsePublicKey(string(iuc.IucPublicKey.Value))\n\t\tvar rsa rsa.PublicKey\n\t\trsa.N = key.Modulus\n\t\trsa.E = key.Exponent\n\n\t\t// hash the downloaded WYU file\n\t\tsha1hash, err := GenerateSHA1HashFromFilePath(wyuFilePath)\n\t\tif nil != err {\n\t\t\terr = fmt.Errorf(\"The downloaded file \\\"%s\\\" failed the signature validation: %w\", wyuFilePath, err)\n\t\t\treturn EXIT_ERROR, err\n\t\t}\n\n\t\t// verify the signature of the WYU file (the signed hash is included in the WYS file)\n\t\terr = VerifyHash(&rsa, sha1hash, wys.FileSha1)\n\t\tif nil != err {\n\t\t\terr = fmt.Errorf(\"The downloaded file \\\"%s\\\" is not signed. %w\", wyuFilePath, err)\n\t\t\treturn EXIT_ERROR, err\n\t\t}\n\t}\n\n\t// extract the WYU to tmpDir\n\t_, files, err := Unzip(wyuFilePath, tmpDir)\n\tif nil != err {\n\t\terr = fmt.Errorf(\"error unzipping %s; %w\", wyuFilePath, err)\n\t\treturn EXIT_ERROR, err\n\t}\n\n\t// get the details of the update\n\t// the update \"config\" is \"updtdetails.udt\"\n\t// the \"files\" are the updated files\n\tudt, updates, err := GetUpdateDetails(files)\n\tif nil != err {\n\t\treturn EXIT_ERROR, err\n\t}\n\n\t// backup the existing files that will be overwritten by the update\n\tinstDir := GetExeDir()\n\tbackupDir, err := BackupFiles(updates, instDir)\n\tdefer DeleteDirectory(backupDir)\n\tif nil != err {\n\t\t// Errors from rollback may occur from missing expected files - ignore\n\t\tRollbackFiles(backupDir, instDir)\n\t\treturn EXIT_ERROR, err\n\t}\n\n\t// TODO is there a way to clean this up\n\terr = InstallUpdate(udt, updates, instDir)\n\tif nil != err {\n\t\terr = fmt.Errorf(\"error applying update; %w\", err)\n\t\t// TODO rollback should restore client.wyc\n\t\tRollbackFiles(backupDir, instDir)\n\n\t\terr = os.Rename(wysFilePath, filepath.Join(instDir, INSTALL_FAILED_SENTINAL_WYS_FILE_NAME))\n\t\tif err != nil {\n\t\t\terr = fmt.Errorf(\"error renaming %s to failed install sentinel; %w\", wysFilePath, err)\n\t\t}\n\n\t\t// start services, best effort\n\t\tfor _, s := range udt.ServiceToStartAfterUpdate {\n\t\t\tsvc := ValueToString(&s)\n\t\t\t_ = StartService(svc)\n\t\t}\n\t\treturn EXIT_ERROR, err\n\t}\n\n\t// we haven't erred, write latest version number and exit\n\t// Newest version is recorded and we wipe out all temp files\n\tUpdateWYCWithNewVersionNumber(iuc, args.Cdata, wys.VersionToUpdate)\n\treturn EXIT_SUCCESS, nil\n}", "func UpdateDevs(name string, checkTresHold bool) (ok bool) {\n\tok = false\n\trequest := RpcRequest{\"{\\\"command\\\":\\\"devs\\\"}\", make(chan []byte), name}\n\n\tminerInfo := miners[name]\n\n\tvar devs DevsResponse\n\n\t//Ignore the error at the moment since it not implement in the Send() yet\n\tresponse, _ := request.Send()\n\n\t//Parse the data into a DevsResponse\n\tdevs.Parse(response)\n\n\t//If we got data back\n\tif len(response) != 0 {\n\t\t//Set ok to true\n\t\tok = true\n\t\t//Should we do a treshold check?\n\t\tif checkTresHold == true {\n\t\t\t//Need to sum up the mhs5s to get the current total hashrate for the miner\n\t\t\tmhs5s := 0.0\n\t\t\tfor i := 0; i < len(devs.Devs); i++ {\n\t\t\t\tvar dev = &devs.Devs[i]\n\t\t\t\tmhs5s += dev.MHS5s\n\t\t\t}\n\t\t\tCheckMhsThresHold(mhs5s, devs.Status[0].When, minerInfo.Client)\n\t\t\t//If the threshold is checked then do a alive check as well\n\t\t\tCheckAliveStatus(devs, name)\n\t\t}\n\t}\n\n\t//Lock it\n\tminerInfo.DevsWrap.Mu.Lock()\n\t//Save the summary\n\tminerInfo.DevsWrap.Devs = devs\n\t//Now unlock\n\tminerInfo.DevsWrap.Mu.Unlock()\n\n\treturn\n}", "func ConvertInternalMuteInfos(muteInfos []*models.VodMuteInfoResponse) []*rpc.VodMuteInfoResponse {\n\tresp := make([]*rpc.VodMuteInfoResponse, len(muteInfos))\n\tfor i, muteInfo := range muteInfos {\n\t\tresp[i] = ConvertInternalMuteInfo(muteInfo)\n\t}\n\treturn resp\n}", "func (fv *FileView) UpdateFavs() {\n\tsv := fv.FavsView()\n\tsv.UpdateFromSlice()\n}", "func (i *Indexer) visitEachDefinitionInfo(name string, fn func(d *DefinitionInfo)) {\n\tmaps := []map[interface{}]*DefinitionInfo{\n\t\ti.consts,\n\t\ti.funcs,\n\t\ti.imports,\n\t\ti.labels,\n\t\ti.types,\n\t\ti.vars,\n\t}\n\n\tn := uint64(0)\n\tfor _, m := range maps {\n\t\tn += uint64(len(m))\n\t}\n\n\tch := make(chan func())\n\n\tgo func() {\n\t\tdefer close(ch)\n\n\t\tfor _, m := range maps {\n\t\t\tfor _, d := range m {\n\t\t\t\tt := d\n\t\t\t\tch <- func() { fn(t) }\n\t\t\t}\n\t\t}\n\t}()\n\n\twg, count := parallel.Run(ch)\n\toutput.WithProgressParallel(wg, name, i.outputOptions, count, n)\n}", "func (settings Settings) UpdateDistances(lat float64, lon float64) {\n\tfor i, server := range settings.Servers {\n\t\tsettings.Servers[i].Distance = Distance(\n\t\t\tserver.Lat*degToRad, server.Lon*degToRad,\n\t\t\tlat*degToRad, lon*degToRad)\n\t}\n}", "func (s *JSONStore) Update(v NanosVolume) error {\n\tvar volumes []NanosVolume\n\tvar vol NanosVolume\n\tf, err := os.Open(s.path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdec := json.NewDecoder(f)\n\tfor {\n\t\tvar cur NanosVolume\n\t\terr = dec.Decode(&cur)\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif cur.ID == v.ID {\n\t\t\tcur = v\n\t\t\tvol = v\n\t\t}\n\t\tvolumes = append(volumes, cur)\n\t}\n\tif vol.ID == \"\" {\n\t\treturn errVolumeNotFound(v.ID)\n\t}\n\tf.Close()\n\n\tf, _ = os.OpenFile(s.path, os.O_RDWR|os.O_TRUNC, 0644)\n\tbuf := bytes.NewBuffer([]byte{})\n\tenc := json.NewEncoder(buf)\n\tfor _, vol := range volumes {\n\t\terr = enc.Encode(vol)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t_, err = f.Write(buf.Bytes())\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func ListRPMFilesInfo(files []string, productVersion string) ([]RPMInfo, error) {\n\tlog.Printf(\"Entering repo::ListRPMFilesInfo(%v, %v)\", files, productVersion)\n\tdefer log.Println(\"Exiting repo::ListRPMFilesInfo\")\n\n\tvar info []RPMInfo\n\tfor _, file := range files {\n\t\tmetaData, err := rpm.GetRPMPackageInfo(filepath.FromSlash(file))\n\t\tif err != nil {\n\t\t\treturn info, logutil.PrintNLogError(\"Failed to get software details.\")\n\t\t}\n\t\tparsedData := rpm.ParseMetaData(string(metaData))\n\n\t\tif _, ok := parsedData[FormatVersionName]; !ok {\n\t\t\tlistData := v1RPMInfo{\n\t\t\t\tDescription: parsedData[\"Description\"],\n\t\t\t\tFileName: filepath.Base(file),\n\t\t\t\tName: filepath.Base(file),\n\t\t\t\tSummary: parsedData[\"Summary\"],\n\t\t\t\tType: parsedData[\"Type\"],\n\t\t\t\tURL: parsedData[\"URL\"],\n\t\t\t\tVersion: parsedData[\"Version\"],\n\t\t\t\tReboot: \"n/a\",\n\t\t\t}\n\t\t\tlistData.Estimate.Hours = \"0\"\n\t\t\tlistData.Estimate.Minutes = \"0\"\n\t\t\tlistData.Estimate.Seconds = \"0\"\n\t\t\tif \"\" != productVersion {\n\t\t\t\tversionInfo, err := version.GetCompatibileVersionInfo(productVersion, parsedData[\"VersionInfo\"])\n\t\t\t\t//In case of error, i.e the version of rpm and product version is not compatible we ignore error and contiune execution\n\t\t\t\t//This error is expected when the rpm is already applied. List API should still return rpm details\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Printf(\"Error in GetCompatibileVersionInfo::(%s)...\",\n\t\t\t\t\t\terr)\n\t\t\t\t}\n\t\t\t\tlistData.matchedVersion = versionInfo.Version\n\t\t\t\tlistData.Reboot = versionInfo.Reboot\n\t\t\t\tlistData.Estimate.Hours = versionInfo.Estimate.Hours\n\t\t\t\tlistData.Estimate.Minutes = versionInfo.Estimate.Minutes\n\t\t\t\tlistData.Estimate.Seconds = versionInfo.Estimate.Seconds\n\t\t\t}\n\n\t\t\tinfo = append(info, listData)\n\t\t} else {\n\t\t\tlog.Printf(\"%s: %v\", FormatVersionName, parsedData[FormatVersionName])\n\n\t\t\tlistData := v2RPMInfo{\n\t\t\t\tFileName: filepath.Base(file),\n\t\t\t\tName: parsedData[\"Name\"],\n\t\t\t\tVersion: parsedData[\"Version\"],\n\t\t\t\tRelease: parsedData[\"Release\"],\n\t\t\t\tURL: parsedData[\"URL\"],\n\t\t\t}\n\t\t\trpmInfo := parsedData[\"RPM Info\"]\n\t\t\terr := yaml.Unmarshal([]byte(rpmInfo), &listData)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"yaml.Unmarshal(%s, %+v); Error: %s\",\n\t\t\t\t\trpmInfo, &listData, err.Error())\n\t\t\t}\n\t\t\tt, err := parseDate(parsedData[\"Build Date\"])\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"Build date: %+v\\n\", t)\n\t\t\t\t// listData.BuildDate = t\n\t\t\t}\n\t\t\tif \"\" != productVersion {\n\t\t\t\tallVersionsInfo := struct {\n\t\t\t\t\tVersionInfo []struct {\n\t\t\t\t\t\tVersion string `yaml:\"product-version\"`\n\t\t\t\t\t\tv2productVersion `yaml:\",inline\"`\n\t\t\t\t\t} `yaml:\"compatibility-info\"`\n\t\t\t\t}{}\n\n\t\t\t\terr := yaml.Unmarshal([]byte(rpmInfo), &allVersionsInfo)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Printf(\"yaml.Unmarshal(%s, %+v); Error: %s\",\n\t\t\t\t\t\trpmInfo, &allVersionsInfo, err.Error())\n\t\t\t\t}\n\n\t\t\t\t// INFO: First check Version as-is,\n\t\t\t\t// \tif there is no match, then do pattern comparison.\n\t\t\t\tfor _, vInfo := range allVersionsInfo.VersionInfo {\n\t\t\t\t\tif productVersion == vInfo.Version {\n\t\t\t\t\t\tlistData.v2productVersion = vInfo.v2productVersion\n\t\t\t\t\t\tlistData.matchedVersion = vInfo.Version\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif listData.matchedVersion == \"\" {\n\t\t\t\t\tfor _, vInfo := range allVersionsInfo.VersionInfo {\n\t\t\t\t\t\tif version.Compare(productVersion, vInfo.Version) {\n\t\t\t\t\t\t\tlistData.v2productVersion = vInfo.v2productVersion\n\t\t\t\t\t\t\tlistData.matchedVersion = vInfo.Version\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\tinfo = append(info, listData)\n\t\t}\n\t}\n\n\treturn info, nil\n}", "func ParseVideo(path string) (*Video, error) {\n\tf, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tinfo, err := f.Stat()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsize := info.Size()\n\ttimestamp := info.ModTime()\n\tmodified := timestamp.Format(\"2006-01-02 03:04 PM\")\n\tname := info.Name()\n\t// ID is name without extension\n\tidx := strings.LastIndex(name, \".\")\n\tif idx == -1 {\n\t\tidx = len(name)\n\t}\n\tid := name[:idx]\n\tm, err := tag.ReadFrom(f)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ttitle := m.Title()\n\t// Default title is filename\n\tif title == \"\" {\n\t\ttitle = name\n\t}\n\tv := &Video{\n\t\tID: id,\n\t\tTitle: title,\n\t\tAlbum: m.Album(),\n\t\tDescription: m.Comment(),\n\t\tModified: modified,\n\t\tSize: size,\n\t\tTimestamp: timestamp,\n\t}\n\t// Add thumbnail (if exists)\n\tp := m.Picture()\n\tif p != nil {\n\t\tv.Thumb = p.Data\n\t\tv.ThumbType = p.MIMEType\n\t}\n\treturn v, nil\n}", "func updateMetadataStreams(tx *gorm.DB, key string, ms []MetadataStream) error {\n\t// Delete existing metadata streams\n\terr := tx.Where(\"record_key = ?\", key).\n\t\tDelete(MetadataStream{}).\n\t\tError\n\tif err != nil {\n\t\treturn fmt.Errorf(\"delete MD streams: %v\", err)\n\t}\n\n\t// Add new metadata streams\n\tfor _, v := range ms {\n\t\terr = tx.Create(&MetadataStream{\n\t\t\tRecordKey: key,\n\t\t\tID: v.ID,\n\t\t\tPayload: v.Payload,\n\t\t}).Error\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"create MD stream %v: %v\",\n\t\t\t\tv.ID, err)\n\t\t}\n\t}\n\n\treturn nil\n}", "func UpdateDevfileContent(path string, handlers []DevfileUpdater) {\n\tif len(handlers) == 0 {\n\t\t//Nothing to do => skip\n\t\treturn\n\t}\n\n\td, err := parser.ParseDevfile(parser.ParserArgs{\n\t\tPath: path,\n\t\tFlattenedDevfile: pointer.Bool(false),\n\t\tSetBooleanDefaults: pointer.Bool(false),\n\t})\n\tExpect(err).NotTo(HaveOccurred())\n\tfor _, h := range handlers {\n\t\terr = h(&d)\n\t\tExpect(err).NotTo(HaveOccurred())\n\t}\n\terr = d.WriteYamlDevfile()\n\tExpect(err).NotTo(HaveOccurred())\n}", "func (s *Service) update(entry ytfeed.Entry, file string, fi FeedInfo) ytfeed.Entry {\n\tentry.File = file\n\n\t// only reset time if published not too long ago\n\t// this is done to avoid initial set of entries added with a new channel to the top of the feed\n\tif time.Since(entry.Published) < time.Hour*24 {\n\t\tlog.Printf(\"[DEBUG] reset published time for %s, from %s to %s (%v), %s\",\n\t\t\tentry.VideoID, entry.Published.Format(time.RFC3339), time.Now().Format(time.RFC3339),\n\t\t\ttime.Since(entry.Published), entry.String())\n\t\tentry.Published = time.Now() // reset published ts to prevent possible out-of-order entries\n\t} else {\n\t\tlog.Printf(\"[DEBUG] keep published time for %s, %s\", entry.VideoID, entry.Published.Format(time.RFC3339))\n\t}\n\n\tif !strings.Contains(entry.Title, fi.Name) { // if title doesn't contains channel name add it\n\t\tentry.Title = fi.Name + \": \" + entry.Title\n\t}\n\n\tentry.Duration = s.DurationService.File(file)\n\tlog.Printf(\"[DEBUG] updated entry: %s\", entry.String())\n\treturn entry\n}", "func (s *JSONStore) Update(v NanosVolume) error {\n\tvar volumes []NanosVolume\n\tvar vol NanosVolume\n\tf, err := os.Open(s.path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdec := json.NewDecoder(f)\n\tfor {\n\t\tvar cur NanosVolume\n\t\terr = dec.Decode(&cur)\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif cur.ID == v.ID {\n\t\t\tcur = v\n\t\t\tvol = v\n\t\t}\n\t\tvolumes = append(volumes, cur)\n\t}\n\tif vol.ID == \"\" {\n\t\treturn ErrVolumeNotFound(v.ID)\n\t}\n\tf.Close()\n\n\tf, _ = os.OpenFile(s.path, os.O_RDWR|os.O_TRUNC, 0644)\n\tbuf := bytes.NewBuffer([]byte{})\n\tenc := json.NewEncoder(buf)\n\tfor _, vol := range volumes {\n\t\terr = enc.Encode(vol)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t_, err = f.Write(buf.Bytes())\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (mr *MockStudyServiceApiClientMockRecorder) StreamParticipantFileInfos(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\tvarargs := append([]interface{}{arg0, arg1}, arg2...)\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"StreamParticipantFileInfos\", reflect.TypeOf((*MockStudyServiceApiClient)(nil).StreamParticipantFileInfos), varargs...)\n}", "func (userInfo *NoAuthUserInfo) UpdateUserInfo(profile *uaaUser) (int, error) {\n\treturn 0, errors.New(\"Update not supported\")\n}", "func (d *Data) FillUpStreamsData() {\n\tfor id, stream := range d.Streams {\n\t\t// fill up ID\n\t\tstream.ID = id\n\t\tif stream.Quality == \"\" {\n\t\t\tstream.Quality = id\n\t\t}\n\n\t\t// generate the merged file extension\n\t\tif d.Type == DataTypeVideo && stream.Ext == \"\" {\n\t\t\text := stream.Parts[0].Ext\n\t\t\t// The file extension in `Parts` is used as the merged file extension by default, except for the following formats\n\t\t\tswitch ext {\n\t\t\t// ts and flv files should be merged into an mp4 file\n\t\t\tcase \"ts\", \"flv\", \"f4v\":\n\t\t\t\text = \"mp4\"\n\t\t\t}\n\t\t\tstream.Ext = ext\n\t\t}\n\n\t\t// calculate total size\n\t\tif stream.Size > 0 {\n\t\t\tcontinue\n\t\t}\n\t\tvar size int64\n\t\tfor _, part := range stream.Parts {\n\t\t\tsize += part.Size\n\t\t}\n\t\tstream.Size = size\n\t}\n}", "func (t *Track) ComputePrivateInfos() {\n\tt.computeBandwidth()\n\tt.extractCodec()\n}", "func (c *AmazonCloudDrive) Update(opts ...AmazonCloudDriveOption) {\n\tfor _, opt := range opts {\n\t\topt.ApplyAmazonCloudDrive(c)\n\t}\n}", "func (c *Config) UpdateUserInfo(u *UserInfo) {\n\tc.Idx = -1\n\tfor k, v := range c.Users {\n\t\tif v.AppKey == u.AppKey {\n\t\t\tc.Idx = k\n\t\t\tbreak\n\t\t}\n\t}\n\tif c.Idx == -1 {\n\t\tc.Idx = len(c.Users)\n\t\tc.Users = append(c.Users, u)\n\t} else {\n\t\tc.Users[c.Idx] = u\n\t}\n}" ]
[ "0.6978023", "0.62464947", "0.6018699", "0.54503715", "0.53032506", "0.51049614", "0.4891234", "0.4817862", "0.479241", "0.47753602", "0.47642994", "0.47477904", "0.47180936", "0.4712157", "0.47082183", "0.46735656", "0.46287072", "0.46063936", "0.46043897", "0.46037504", "0.45504585", "0.4537329", "0.45091298", "0.45067802", "0.4457425", "0.4456056", "0.4400967", "0.4392086", "0.43860132", "0.434035", "0.43329027", "0.43269625", "0.43144503", "0.4282082", "0.4239404", "0.4226397", "0.42249134", "0.42012006", "0.41974077", "0.4185308", "0.41646188", "0.41629064", "0.41562238", "0.41468474", "0.41219947", "0.41202757", "0.4112585", "0.4103133", "0.40867928", "0.4079561", "0.40598357", "0.40541488", "0.40349862", "0.40322146", "0.4017599", "0.4014906", "0.40133196", "0.4010508", "0.4004047", "0.39949152", "0.39859384", "0.3979247", "0.39761007", "0.39717934", "0.39683285", "0.39653128", "0.39529714", "0.39524785", "0.3951045", "0.39491338", "0.39438108", "0.39415514", "0.39326555", "0.39288515", "0.39264214", "0.39208913", "0.39157924", "0.39079574", "0.3902745", "0.39014181", "0.39005676", "0.38937652", "0.38928813", "0.3881777", "0.38769856", "0.38600793", "0.385561", "0.3850522", "0.38476703", "0.3845567", "0.38448218", "0.38335338", "0.38314053", "0.38285595", "0.382591", "0.38236004", "0.38203204", "0.38067096", "0.3805339", "0.38045335" ]
0.8323434
0
Updates a column in the database.
func (m *File) Update(attr string, value interface{}) error { return UnscopedDb().Model(m).UpdateColumn(attr, value).Error }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (ac *AdminClient) UpdateColumn(ctx context.Context, db, table string, columnFamilies *tspb.ColumnFamilyMeta, columns *tspb.ColumnMeta) error {\n\tin := &tspb.UpdateColumnRequest{\n\t\tDatabase: db,\n\t\tTable: table,\n\t\tColumnFamilies: columnFamilies,\n\t\tColumns: columns,\n\t}\n\treturn retry.Invoke(ctx, func(ctx context.Context, settings retry.CallSettings) error {\n\t\t_, err := ac.pbCli.UpdateColumn(ctx, in)\n\t\treturn err\n\t})\n}", "func (repo *feedRepository) execUpdateStatementOnColumn(column, value string, id uint) error {\n\t_, err := repo.db.Exec(fmt.Sprintf(`\n\t\t\tUPDATE feeds \n\t\t\tSET %s = $1 \n\t\t\tWHERE id = $2`, column), value, id)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"updating failed of %s column with %s because of: %w\", column, value, err)\n\t}\n\treturn nil\n}", "func (m *Account) Update(attr string, value interface{}) error {\n\treturn UnscopedDb().Model(m).UpdateColumn(attr, value).Error\n}", "func (s *ProjectsService) UpdateProjectColumn(ctx context.Context, columnID int64, opt *ProjectColumnOptions) (*ProjectColumn, *Response, error) {\n\tu := fmt.Sprintf(\"projects/columns/%v\", columnID)\n\treq, err := s.client.NewRequest(\"PATCH\", u, opt)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\t// TODO: remove custom Accept headers when APIs fully launch.\n\treq.Header.Set(\"Accept\", mediaTypeProjectsPreview)\n\n\tcolumn := &ProjectColumn{}\n\tresp, err := s.client.Do(ctx, req, column)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn column, resp, nil\n}", "func (b *SqliteBuilder) AlterColumn(table, col, typ string) *Query {\n\tq := b.NewQuery(\"\")\n\tq.LastError = errors.New(\"SQLite does not support altering column\")\n\treturn q\n}", "func updateDBColumnNullable(fi *fieldInfo) {\n\tadapter := adapters[db.DriverName()]\n\tvar verb string\n\tif adapter.fieldIsNotNull(fi) {\n\t\tverb = \"SET\"\n\t} else {\n\t\tverb = \"DROP\"\n\t}\n\tquery := fmt.Sprintf(`\n\t\tALTER TABLE %s\n\t\tALTER COLUMN %s %s NOT NULL\n\t`, adapter.quoteTableName(fi.mi.tableName), fi.json, verb)\n\tdbExecuteNoTx(query)\n}", "func (p *partitionImpl) setColumnDirty(colName string) {\n\tp.colIsDirty[colName] = true\n\t// remove internal, serialized data for column because it's no longer useful\n\tp.internalData.ColData[colName].Data = nil\n}", "func (matrix Matrix4) SetColumn(columnIndex int, columnData vector.Vector) Matrix4 {\n\tfor i := range matrix {\n\t\tmatrix[i][columnIndex] = columnData[i]\n\t}\n\treturn matrix\n}", "func (ub *UpdateBuilder) Set(column string, value interface{}) *UpdateBuilder {\n\tub.sql = ub.sql.Set(column, value)\n\treturn ub\n}", "func addNewColumn(ctx context.Context, w io.Writer, adminClient *database.DatabaseAdminClient, database string) error {\n\top, err := adminClient.UpdateDatabaseDdl(ctx, &adminpb.UpdateDatabaseDdlRequest{\n\t\tDatabase: database,\n\t\tStatements: []string{\n\t\t\t\"ALTER TABLE Albums ADD COLUMN MarketingBudget INT64\",\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := op.Wait(ctx); err != nil {\n\t\treturn err\n\t}\n\tfmt.Fprintf(w, \"Added MarketingBudget column\\n\")\n\treturn nil\n}", "func (d *Driver) SetColumn(idx int, c int, rV byte) error {\n\tfor r := 0; r < 8; r++ {\n\t\tvar on bool\n\t\tif (rV>>byte(7-r))&0x01 == 1 {\n\t\t\ton = true\n\t\t}\n\t\tif err := d.SetLed(idx, r, c, on); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (_article *Article) UpdateColumns(am map[string]interface{}) error {\n\tif _article.Id == 0 {\n\t\treturn errors.New(\"Invalid Id field: it can't be a zero value\")\n\t}\n\terr := UpdateArticle(_article.Id, am)\n\treturn err\n}", "func updateDBColumnDataType(fi *fieldInfo) {\n\tadapter := adapters[db.DriverName()]\n\tquery := fmt.Sprintf(`\n\t\tALTER TABLE %s\n\t\tALTER COLUMN %s SET DATA TYPE %s\n\t`, adapter.quoteTableName(fi.mi.tableName), fi.json, adapter.typeSQL(fi))\n\tdbExecuteNoTx(query)\n}", "func (i *Info) SetField(column string, value interface{}) error {\n\tfieldName, ok := i.Metadata.Fields[column]\n\tif !ok {\n\t\treturn fmt.Errorf(\"SetField: column %s not found in orm info\", column)\n\t}\n\tfieldValue := reflect.ValueOf(i.Obj).Elem().FieldByName(fieldName)\n\n\tif !fieldValue.Type().AssignableTo(reflect.TypeOf(value)) {\n\t\treturn fmt.Errorf(\"column %s: native value %v (%s) is not assignable to field %s (%s)\",\n\t\t\tcolumn, value, reflect.TypeOf(value), fieldName, fieldValue.Type())\n\t}\n\tfieldValue.Set(reflect.ValueOf(value))\n\treturn nil\n}", "func (d *Dev) WriteColumn(column int, data uint16) error {\n\t_, err := d.dev.Write([]byte{byte(column * 2), byte(data & 0xFF), byte(data >> 8)})\n\treturn err\n}", "func updateTableField(stub shim.ChaincodeStubInterface, args []string) ([]byte, error) {\n\n\tif len(args) != 4 {\n\t\treturn nil, errors.New(\"Incorrect number of arguments. Expecting 4\")\n\t}\n\n\ttableName, keyValue, columnName, columnNewValue := args[0], args[1], args[2], args[3]\n\n\trow, err := getRowByKeyValue(stub, tableName, keyValue)\n\tif err != nil {\n\t\treturn nil, errors.New(\"An error occured in func updateTableField: \" + err.Error())\n\t}\n\n\tvar f bool\n\tvar columnOldValue string\n\n\ttbl, err := stub.GetTable(tableName)\n\tif err != nil {\n\t\treturn nil, errors.New(\"An error occured while getting table in getRowByKeyValue func: \" + err.Error())\n\t}\n\n\t// This Println is temporary for logging purposes\n\tfmt.Println(\"====== Before update =========================\")\n\tfor i, c := range row.GetColumns() {\n\t\t// This Printf is temporary for logging purposes\n\t\tfmt.Printf(\"Column number: '%v', Column name: '%v', Column value: '%v'\\n\", i, tbl.ColumnDefinitions[i].Name, c.GetString_())\n\t\tif tbl.ColumnDefinitions[i].Name == columnName {\n\t\t\tcolumnOldValue = c.GetString_()\n\t\t\t// Consider replace row.Columns[i] = ... with c = ...\n\t\t\trow.Columns[i] = &shim.Column{Value: &shim.Column_String_{String_: columnNewValue}}\n\t\t\tf = true\n\t\t\t// Consider add break\n\t\t}\n\t}\n\n\t// This Println is temporary for logging purposes\n\tfmt.Println(\"====== After update =========================\")\n\t// This Printf is temporary for logging purposes\n\tfor i, c := range row.GetColumns() {\n\t\tfmt.Printf(\"Column number: '%v', Column name: '%v', Column value: '%v'\\n\", i, tbl.ColumnDefinitions[i].Name, c.GetString_())\n\t}\n\t// This Println is temporary for logging purposes\n\tfmt.Println(\"=============================================\")\n\n\tif !f {\n\t\treturn nil, errors.New(\"Column '\" + columnName + \"' is missing\")\n\t}\n\n\tok, errreplace := stub.ReplaceRow(tableName, row)\n\tif errreplace != nil {\n\t\treturn nil, errors.New(\"An error occured while running updateTableField func: \" + errreplace.Error())\n\t}\n\t//This check might be redundant.\n\tif !ok {\n\t\treturn nil, errors.New(\"A row does not exist the given key\")\n\t}\n\n\tfmt.Printf(\"Column '%v' of the row of key value '%v' in the table '%v' has been successfuly updated from value '%v' to value '%v'\\n\", columnName, keyValue, tableName, columnOldValue, columnNewValue)\n\n\treturn nil, nil\n}", "func (_m *MockORM) UpdateColumn(attrs ...interface{}) ORM {\n\tret := _m.Called(attrs)\n\n\tvar r0 ORM\n\tif rf, ok := ret.Get(0).(func(...interface{}) ORM); ok {\n\t\tr0 = rf(attrs...)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(ORM)\n\t\t}\n\t}\n\n\treturn r0\n}", "func (s *BasePlSqlParserListener) EnterColumn_based_update_set_clause(ctx *Column_based_update_set_clauseContext) {\n}", "func (d *Dataset) UpdateColumns(a *config.AppContext, cols []models.Node) ([]models.Node, error) {\n\tds := models.Dataset(*d)\n\tres, err := (&ds).UpdateColumns(a.Log, a.Db, cols)\n\t*d = Dataset(ds)\n\treturn res, err\n}", "func (b *UpdateBuilder) Set(col interface{}, val interface{}) *UpdateBuilder {\n\tb.Update.Exprs = append(b.Update.Exprs, makeUpdateExpr(b.table, col, val))\n\treturn b\n}", "func (j *Parser) column(\n\ttable *Table,\n\tcolumnName string,\n\tnotNull bool,\n\tjsSchema extv1.JSONSchemaProps,\n) error {\n\tj.logger.WithValues(\n\t\t\"table\", table.Name,\n\t\t\"column\", columnName,\n\t\t\"notNull\", notNull,\n\t\t\"type\", jsSchema.Type,\n\t\t\"format\", jsSchema.Format,\n\t).Info(\"Adding new column to table.\")\n\tcolumn, err := NewColumn(columnName, jsSchema.Type, jsSchema.Format, notNull)\n\tif err != nil {\n\t\treturn err\n\t}\n\ttable.AddColumn(column)\n\treturn nil\n}", "func (c *cassandraConnector) Update(\n\tctx context.Context,\n\te *base.Definition,\n\trow []base.Column,\n\tkeyCols []base.Column,\n) error {\n\n\t// split keyCols into a list of names and values to compose query stmt using\n\t// names and use values in the session query call, so the order needs to be\n\t// maintained.\n\tkeyColNames, keyColValues := splitColumnNameValue(keyCols)\n\n\t// split row into a list of names and values to compose query stmt using\n\t// names and use values in the session query call, so the order needs to be\n\t// maintained.\n\tcolNames, colValues := splitColumnNameValue(row)\n\n\t// Prepare update statement\n\tstmt, err := UpdateStmt(\n\t\tTable(e.Name),\n\t\tUpdates(colNames),\n\t\tConditions(keyColNames),\n\t)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// list of values to be supplied in the query\n\tupdateVals := append(colValues, keyColValues...)\n\n\tq := c.Session.Query(\n\t\tstmt, updateVals...).WithContext(ctx)\n\n\tif err := q.Exec(); err != nil {\n\t\tsendCounters(c.executeFailScope, e.Name, update, err)\n\t\treturn err\n\t}\n\n\tsendLatency(c.scope, e.Name, update, time.Duration(q.Latency()))\n\tsendCounters(c.executeSuccessScope, e.Name, update, nil)\n\treturn nil\n}", "func (s *DB) UpdateField(data interface{}, fieldName string, value interface{}) error {\n\treturn s.root.UpdateField(data, fieldName, value)\n}", "func (o *Smallblog) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tsmallblogUpdateCacheMut.RLock()\n\tcache, cached := smallblogUpdateCache[key]\n\tsmallblogUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tsmallblogAllColumns,\n\t\t\tsmallblogPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update smallblog, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE `smallblog` SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, smallblogPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(smallblogType, smallblogMapping, append(wl, smallblogPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update smallblog row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for smallblog\")\n\t}\n\n\tif !cached {\n\t\tsmallblogUpdateCacheMut.Lock()\n\t\tsmallblogUpdateCache[key] = cache\n\t\tsmallblogUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "func UpdatePerson(db *sql.DB) {}", "func (d *PublicRoomsServerDatabase) updateBooleanAttribute(\n\tattrName string, event gomatrixserverlib.Event, content interface{},\n\tfield *string, strForTrue string,\n) error {\n\tif err := json.Unmarshal(event.Content(), content); err != nil {\n\t\treturn err\n\t}\n\n\tvar attrValue bool\n\tif *field == strForTrue {\n\t\tattrValue = true\n\t} else {\n\t\tattrValue = false\n\t}\n\n\treturn d.statements.updateRoomAttribute(attrName, attrValue, event.RoomID())\n}", "func (s Serializer) IndexColumn(buf cmpbin.WriteableBytesBuffer, c IndexColumn) (err error) {\n\tdefer recoverTo(&err)\n\n\tif !c.Descending {\n\t\tpanicIf(buf.WriteByte(0))\n\t} else {\n\t\tpanicIf(buf.WriteByte(1))\n\t}\n\t_, err = cmpbin.WriteString(buf, c.Property)\n\treturn\n}", "func setCol(mat *DenseMatrix, which int, col []float64) *DenseMatrix {\n\tif mat.Rows() != len(col) {\n\t\tfmt.Println(\"The column to set needs to be the same dimension as the matrix\")\n\t}\n\t// iterate over rows to set the values for a selected columns\n\tfor i := 0; i < mat.Rows(); i++ {\n\t\tmat.Set(i, which, col[i])\n\t}\n\treturn mat\n}", "func (builder *Builder) Column(col uint) *Builder {\n\treturn builder.With(Column(col))\n}", "func (b *Blueprint) Set(column string, allowed []string) *ColumnDefinition {\n\treturn b.addColumn(\"set\", column, &ColumnOptions{\n\t\tAllowed: allowed,\n\t})\n}", "func (this *TableDef) ModifyColumnNameOfIndexByColumn(opType int, oldColName string, newColName string) {\n\tvar (\n\t\tifContain bool = false\n\t)\n\n\t// handle unique keys\n\tfor k := range this.UniqueKeys {\n\t\tifContain = false\n\t\tfor i, oneColName := range this.UniqueKeys[k].ColumnNames {\n\t\t\tif oneColName == oldColName {\n\t\t\t\t// only drop and change make the column name change\n\t\t\t\tifContain = true\n\t\t\t\tif opType == CalterColumnTypeChange {\n\t\t\t\t\tif newColName != oldColName && newColName != \"\" {\n\t\t\t\t\t\t// column name changed\n\t\t\t\t\t\tthis.UniqueKeys[k].ColumnNames[i] = newColName\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif opType == CalterColumnTypeDrop && ifContain {\n\t\t\t// delete any unique key contain the column\n\t\t\tdelete(this.UniqueKeys, k)\n\t\t}\n\t}\n\tif len(this.UniqueKeys) == 0 {\n\t\tthis.UniqueKeys = nil\n\t}\n\n\t// handle primary key\n\tifContain = false\n\tfor i, oneColName := range this.PrimaryKey.ColumnNames {\n\t\tif oneColName == oldColName {\n\t\t\t// only drop and change make the column name change\n\t\t\tifContain = true\n\t\t\tif opType == CalterColumnTypeChange {\n\t\t\t\tif newColName != oldColName && newColName != \"\" {\n\t\t\t\t\t// column name changed\n\t\t\t\t\tthis.PrimaryKey.ColumnNames[i] = newColName\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif opType == CalterColumnTypeDrop && ifContain {\n\t\t// delete primary key\n\t\tthis.PrimaryKey = nil\n\t}\n}", "func (c Column) UpdateString() string {\n\tvName := c.Name\n\tif strings.Contains(vName, \".\") {\n\t\ttmp := strings.Split(vName, \".\")\n\t\tvName = tmp[1]\n\t}\n\treturn fmt.Sprintf(\"%s = :%s\", c.Name, vName)\n}", "func updateDBColumnDefault(fi *fieldInfo) {\n\tadapter := adapters[db.DriverName()]\n\tdefValue := adapter.fieldSQLDefault(fi)\n\tvar query string\n\tif defValue == \"\" {\n\t\tquery = fmt.Sprintf(`\n\t\t\tALTER TABLE %s\n\t\t\tALTER COLUMN %s DROP DEFAULT\n\t\t`, adapter.quoteTableName(fi.mi.tableName), fi.json)\n\t} else {\n\t\tquery = fmt.Sprintf(`\n\t\t\tALTER TABLE %s\n\t\t\tALTER COLUMN %s SET DEFAULT %s\n\t\t`, adapter.quoteTableName(fi.mi.tableName), fi.json, adapter.fieldSQLDefault(fi))\n\t}\n\tdbExecuteNoTx(query)\n}", "func (m *Mytable) UpdateColumns(ctx context.Context, cols ...string) (*spanner.Mutation, error) {\n\t// add primary keys to columns to update by primary keys\n\tcolsWithPKeys := append(cols, MytablePrimaryKeys()...)\n\n\tvalues, err := m.columnsToValues(colsWithPKeys)\n\tif err != nil {\n\t\treturn nil, newErrorWithCode(codes.InvalidArgument, \"Mytable.UpdateColumns\", \"mytable\", err)\n\t}\n\n\treturn spanner.Update(\"mytable\", colsWithPKeys, values), nil\n}", "func (gbio *GBIO) SetCol(data byte) {\n\tgbio.col = data & 0x30\n}", "func (sc SuperColumn) putColumn(column IColumn) bool {\n\t_, ok := column.(SuperColumn)\n\tif !ok {\n\t\tlog.Fatal(\"Only Super column objects should be put here\")\n\t}\n\tif sc.Name != column.getName() {\n\t\tlog.Fatal(\"The name should match the name of the current super column\")\n\t}\n\tcolumns := column.GetSubColumns()\n\tfor _, subColumn := range columns {\n\t\tsc.addColumn(subColumn)\n\t}\n\tif column.getMarkedForDeleteAt() > sc.markedForDeleteAt {\n\t\tsc.markForDeleteAt(column.getLocalDeletionTime(), column.getMarkedForDeleteAt())\n\t}\n\treturn false\n}", "func (repo *PostAttributeRepository) Update(attribute *entity.PostAttribute, tableName string) error {\n\n\tprevAttribute := new(entity.PostAttribute)\n\terr := repo.conn.Table(tableName).Where(\"id = ?\", attribute.ID).First(prevAttribute).Error\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = repo.conn.Table(tableName).Save(attribute).Error\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (d *PublicRoomsServerDatabase) updateStringAttribute(\n\tattrName string, event gomatrixserverlib.Event, content interface{},\n\tfield *string,\n) error {\n\tif err := json.Unmarshal(event.Content(), content); err != nil {\n\t\treturn err\n\t}\n\n\treturn d.statements.updateRoomAttribute(attrName, *field, event.RoomID())\n}", "func NewColumn(URL *url.URL, x float64) error {\n\treq := NewColumnRequest{X: x}\n\treturn request(URL, http.MethodPut, req, nil)\n}", "func (m *MySQL) Update(todo *schema.Todo) error {\n\tvar stmt = `UPDATE Todo SET Title = ?, Complete = ? WHERE ID = ?`\n\t_, err := m.DB.Exec(stmt, todo.Title, todo.Complete, todo.ID)\n\n\tif err != nil {\n\t\tprintln(\"Exec err:\", err.Error())\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func Set(col string, expr Expr) Option {\n\treturn func(q Query) Query {\n\t\tif q.stmt == _Update {\n\t\t\tq.clauses = append(q.clauses, setClause{\n\t\t\t\tcol: col,\n\t\t\t\texpr: Lit(expr.Build()),\n\t\t\t})\n\t\t\tq.args = append(q.args, expr.Args()...)\n\t\t}\n\t\treturn q\n\t}\n}", "func (mc *MultiCursor) SetColumn() {\n\tcol := mc.cursors[0].col\n\tminRow, maxRow := mc.MinMaxRow()\n\tmc.cursors = []Cursor{}\n\tfor row := minRow; row <= maxRow; row++ {\n\t\tcursor := Cursor{row: row, col: col, colwant: col}\n\t\tmc.Append(cursor)\n\t}\n}", "func updateTimeStampForUpdateCallback(scope *gorm.Scope) {\n\tif _, ok := scope.Get(\"gorm:update_column\"); !ok {\n\t\tscope.SetColumn(\"TimeEdit\", util.GetTimeNow())\n\t}\n}", "func UpdateDeviceTwinField(deviceID string, name string, col string, value interface{}) error {\n\tnum, err := dbm.DBAccess.QueryTable(DeviceTwinTableName).Filter(\"deviceid\", deviceID).Filter(\"name\", name).Update(map[string]interface{}{col: value})\n\tklog.V(4).Infof(\"Update affected Num: %d, %s\", num, err)\n\treturn err\n}", "func (col COLUMN) AlterCol() (str string) {\n\tstr = \"alter table \" + col.TABLE_NAME + \" modify \" + col.COLUMN_NAME + \" \" + col.DATA_TYPE\n\n\tswitch col.DATA_TYPE {\n\tcase \"VARCHAR2\", \"CHAR\", \"VARCHAR\", \"NVARCHAR2\":\n\t\tstr = str + \"(\" + col.DATA_LENGTH + \")\"\n\t}\n\tif col.NULLABLE == \"N\" {\n\t\tstr = str + \" not null \"\n\t}\n\n\tif col.DATA_DEFAULT.Valid {\n\t\tstr = str + \" default \" + col.DATA_DEFAULT.String + \",\" + \"\\n\"\n\t} else {\n\t\tstr = str + \",\" + \"\\n\"\n\t}\n\n\tstr = str + \";\\n\"\n\n\tfmt.Println(str)\n\tWriteSqlFile(Conf.SqlFile, str)\n\n\treturn str\n}", "func (o *ItemSide) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tkey := makeCacheKey(columns, nil)\n\titemSideUpdateCacheMut.RLock()\n\tcache, cached := itemSideUpdateCache[key]\n\titemSideUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\titemSideAllColumns,\n\t\t\titemSidePrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update item_sides, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"item_sides\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", 0, itemSidePrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(itemSideType, itemSideMapping, append(wl, itemSidePrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update item_sides row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for item_sides\")\n\t}\n\n\tif !cached {\n\t\titemSideUpdateCacheMut.Lock()\n\t\titemSideUpdateCache[key] = cache\n\t\titemSideUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, nil\n}", "func (u *UserModel) Update(expression interface{}) error {\n\treturn database.DB().Model(u).Update(expression).Error\n}", "func (repo repository) removeColumn(ctx context.Context, signatureID, columnName string) (*models.Signature, error) {\n\tf := logrus.Fields{\n\t\t\"functionName\": \"removeColumn\",\n\t\t\"signatureID\": signatureID,\n\t\t\"columnName\": columnName,\n\t}\n\tlog.WithFields(f).Debug(\"removing column from signature\")\n\n\t// Update dynamoDB table\n\tinput := &dynamodb.UpdateItemInput{\n\t\tTableName: aws.String(repo.signatureTableName),\n\t\tKey: map[string]*dynamodb.AttributeValue{\n\t\t\t\"signature_id\": {\n\t\t\t\tS: aws.String(signatureID),\n\t\t\t},\n\t\t},\n\t\tExpressionAttributeNames: map[string]*string{\n\t\t\t\"#\" + columnName: aws.String(columnName),\n\t\t},\n\t\t//ExpressionAttributeValues: map[string]*dynamodb.AttributeValue{\n\t\t//\t\":a\": {\n\t\t//\t\tS: aws.String(\"bar\"),\n\t\t//\t},\n\t\t//},\n\t\tUpdateExpression: aws.String(\"REMOVE #\" + columnName), //aws.String(\"REMOVE github_org_whitelist\"),\n\t\tReturnValues: aws.String(dynamodb.ReturnValueNone),\n\t}\n\n\t_, updateErr := repo.dynamoDBClient.UpdateItem(input)\n\tif updateErr != nil {\n\t\tlog.WithFields(f).Warnf(\"error removing approval lists column %s for signature ID: %s, error: %v\", columnName, signatureID, updateErr)\n\t\treturn nil, updateErr\n\t}\n\n\tupdatedSig, sigErr := repo.GetSignature(ctx, signatureID)\n\tif sigErr != nil {\n\t\treturn nil, sigErr\n\t}\n\n\treturn updatedSig, nil\n}", "func (o *Building) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\to.UpdatedAt = currTime\n\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tbuildingUpdateCacheMut.RLock()\n\tcache, cached := buildingUpdateCache[key]\n\tbuildingUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tbuildingColumns,\n\t\t\tbuildingPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"record: unable to update buildings, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"buildings\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, buildingPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(buildingType, buildingMapping, append(wl, buildingPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"record: unable to update buildings row\")\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 update for buildings\")\n\t}\n\n\tif !cached {\n\t\tbuildingUpdateCacheMut.Lock()\n\t\tbuildingUpdateCache[key] = cache\n\t\tbuildingUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "func (ue *UserEvent) UpdateColumns(ctx context.Context, cols ...string) (*spanner.Mutation, error) {\n\t// add primary keys to columns to update by primary keys\n\tcolsWithPKeys := append(cols, UserEventPrimaryKeys()...)\n\n\tvalues, err := ue.columnsToValues(colsWithPKeys)\n\tif err != nil {\n\t\treturn nil, newErrorWithCode(codes.InvalidArgument, \"UserEvent.UpdateColumns\", \"UserEvent\", err)\n\t}\n\n\treturn spanner.Update(\"UserEvent\", colsWithPKeys, values), nil\n}", "func (b *InsertBuilder) OnDupKeyUpdateColumn(col interface{}) *InsertBuilder {\n\tcolName := getColName(b.table, col)\n\tval := &FuncExpr{Name: \"VALUES\", Exprs: []SelectExpr{&NonStarExpr{Expr: colName}}}\n\treturn b.OnDupKeyUpdate(col, val)\n}", "func (o *Weather) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tweatherUpdateCacheMut.RLock()\n\tcache, cached := weatherUpdateCache[key]\n\tweatherUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tweatherColumns,\n\t\t\tweatherPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"db: unable to update weather, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"prh\\\".\\\"weather\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, weatherPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(weatherType, weatherMapping, append(wl, weatherPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"db: unable to update weather row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"db: failed to get rows affected by update for weather\")\n\t}\n\n\tif !cached {\n\t\tweatherUpdateCacheMut.Lock()\n\t\tweatherUpdateCache[key] = cache\n\t\tweatherUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "func (b *SqliteBuilder) RenameColumn(table, oldName, newName string) *Query {\n\tq := b.NewQuery(\"\")\n\tq.LastError = errors.New(\"SQLite does not support renaming columns\")\n\treturn q\n}", "func (o *Doc) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tqueries.SetScanner(&o.UpdatedAt, currTime)\n\t}\n\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tdocUpdateCacheMut.RLock()\n\tcache, cached := docUpdateCache[key]\n\tdocUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tdocAllColumns,\n\t\t\tdocPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update doc, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE `doc` SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, docPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(docType, docMapping, append(wl, docPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update doc row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for doc\")\n\t}\n\n\tif !cached {\n\t\tdocUpdateCacheMut.Lock()\n\t\tdocUpdateCache[key] = cache\n\t\tdocUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "func (q *Query) Column(node models.ColumnNode, index types.Oid, format ...models.Format) {\n\toid := append(node.Oid, index...)\n\tq.add(node.Name, node.Type, oid, format)\n}", "func (m *Mat2f) SetCol(col int, v Vec2f) {\n\tm[col*2+0] = v[0]\n\tm[col*2+1] = v[1]\n}", "func (db *DB) Update(key string, value string, item interface{}) error {\n\tif db.tablename.length() <= 0 {\n\t\treturn errors.New(MongoDBErrTableName)\n\t}\n\treturn db.Collection[db.tablename].Update(bson.D{{Name: key, Value: value}}, item)\n}", "func UpdateCharacter(char *Character) bool {\n\tdb := GetConnect()\n\tdefer db.Close()\n\n\terr := db.Update(char)\n\treturn err == nil\n}", "func (b UpdateBuilder) Set(column string, value interface{}) UpdateCondition {\n\treturn builder.Append(b, \"SetClauses\", setClause{column: column, value: value}).(UpdateBuilder)\n}", "func (a *ActionNode) AddColumn(col int) {\n\ta.Token.AddColumn(col)\n}", "func (data *DatabaseConnection) UpdateChannel(ch *Channel){\n\tpStatement, _ := data.Database.Prepare(\"UPDATE channels SET Active = ? WHERE Name = ?\")\n\tdefer pStatement.Close()\n\tpStatement.Exec(ch.Active, ch.Name)\n}", "func (v *IconView) SetPixbufColumn(column int) {\n\tC.gtk_icon_view_set_pixbuf_column(v.native(), C.gint(column))\n}", "func (v *IconView) SetTextColumn(column int) {\n\tC.gtk_icon_view_set_text_column(v.native(), C.gint(column))\n}", "func (v *IconView) SetMarkupColumn(column int) {\n\tC.gtk_icon_view_set_markup_column(v.native(), C.gint(column))\n}", "func (o *Description) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\tqueries.SetScanner(&o.UpdatedAt, currTime)\n\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tdescriptionUpdateCacheMut.RLock()\n\tcache, cached := descriptionUpdateCache[key]\n\tdescriptionUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tdescriptionColumns,\n\t\t\tdescriptionPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update descriptions, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE `descriptions` SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, descriptionPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(descriptionType, descriptionMapping, append(wl, descriptionPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update descriptions row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for descriptions\")\n\t}\n\n\tif !cached {\n\t\tdescriptionUpdateCacheMut.Lock()\n\t\tdescriptionUpdateCache[key] = cache\n\t\tdescriptionUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "func setColumnOption(c *Column, key, value string) error {\n\tswitch key {\n\tcase columnOptionAutoIncrement:\n\t\tc.Auto = new(int64)\n\t\tif len(value) > 0 {\n\t\t\tstart, err := strconv.ParseInt(value, 10, 64)\n\t\t\tif err != nil {\n\t\t\t\treturn util.Errorf(\"error parsing auto-increment start value %q: %v\", value, err)\n\t\t\t}\n\t\t\t*c.Auto = start\n\t\t} else {\n\t\t\t*c.Auto = 1\n\t\t}\n\tcase columnOptionForeignKey:\n\t\tif len(value) == 0 {\n\t\t\treturn util.Errorf(\"foreign key must specify reference as <Table>[.<Column>]\")\n\t\t}\n\t\tc.ForeignKey = value\n\tcase columnOptionFullTextIndex:\n\t\tc.Index = indexTypeFullText\n\tcase columnOptionInterleave:\n\t\tc.Interleave = true\n\tcase columnOptionLocationIndex:\n\t\tc.Index = indexTypeLocation\n\tcase columnOptionOnDelete:\n\t\tswitch value {\n\t\tcase columnDeleteOptionCascade, columnDeleteOptionSetNull:\n\t\t\tc.OnDelete = value\n\t\tdefault:\n\t\t\treturn util.Errorf(\"column option %q must specify either %q or %q\", key, columnDeleteOptionCascade, columnDeleteOptionSetNull)\n\t\t}\n\tcase columnOptionPrimaryKey:\n\t\tif len(value) > 0 {\n\t\t\treturn util.Errorf(\"column option %q should not specify a value\", key)\n\t\t}\n\t\tc.PrimaryKey = true\n\tcase columnOptionScatter:\n\t\tif len(value) > 0 {\n\t\t\treturn util.Errorf(\"column option %q should not specify a value\", key)\n\t\t}\n\t\tc.Scatter = true\n\tcase columnOptionSecondaryIndex:\n\t\tc.Index = indexTypeSecondary\n\tcase columnOptionUniqueIndex:\n\t\tc.Index = indexTypeUnique\n\tdefault:\n\t\treturn util.Errorf(\"unrecognized column option: %q\", key)\n\t}\n\treturn nil\n}", "func updateDBColumns(mi *modelInfo) {\n\tadapter := adapters[db.DriverName()]\n\tdbColumns := adapter.columns(mi.tableName)\n\t// create or update columns from registry data\n\tfor colName, fi := range mi.fields.registryByJSON {\n\t\tif colName == \"id\" || !fi.isStored() {\n\t\t\tcontinue\n\t\t}\n\t\tdbColData, ok := dbColumns[colName]\n\t\tif !ok {\n\t\t\tcreateDBColumn(fi)\n\t\t}\n\t\tif dbColData.DataType != adapter.typeSQL(fi) {\n\t\t\tupdateDBColumnDataType(fi)\n\t\t}\n\t\tif (dbColData.IsNullable == \"NO\" && !adapter.fieldIsNotNull(fi)) ||\n\t\t\t(dbColData.IsNullable == \"YES\" && adapter.fieldIsNotNull(fi)) {\n\t\t\tupdateDBColumnNullable(fi)\n\t\t}\n\t\tif dbColData.ColumnDefault.Valid &&\n\t\t\tdbColData.ColumnDefault.String != adapter.fieldSQLDefault(fi) {\n\t\t\tupdateDBColumnDefault(fi)\n\t\t}\n\t}\n\t// drop columns that no longer exist\n\tfor colName := range dbColumns {\n\t\tif _, ok := mi.fields.registryByJSON[colName]; !ok {\n\t\t\tdropDBColumn(mi.tableName, colName)\n\t\t}\n\t}\n}", "func Update(db gorp.SqlExecutor, mig *sdk.Migration) error {\n\treturn sdk.WrapError(gorpmapping.Update(db, mig), \"Unable to update migration %s\", mig.Name)\n}", "func (t *PgAttributeType) Update() *qb.UpdateBuilder {\n\treturn t.table.Update()\n}", "func (o *Channel) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tchannelUpdateCacheMut.RLock()\n\tcache, cached := channelUpdateCache[key]\n\tchannelUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tchannelAllColumns,\n\t\t\tchannelPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update channels, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"channels\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, channelPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(channelType, channelMapping, append(wl, channelPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update channels row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for channels\")\n\t}\n\n\tif !cached {\n\t\tchannelUpdateCacheMut.Lock()\n\t\tchannelUpdateCache[key] = cache\n\t\tchannelUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "func (Model) Update(model interface{}, field string, value interface{}) {\n\twhereValues := make(map[string]interface{})\n\twhereValues[field] = value\n\tdb.Update(model, whereValues)\n}", "func (m *Mytable) Update(ctx context.Context) *spanner.Mutation {\n\treturn spanner.Update(\"mytable\", MytableColumns(), []interface{}{\n\t\tm.A, m.B,\n\t})\n}", "func (df *DataFrame) SetField(name string, val starlark.Value) error {\n\tif df.frozen {\n\t\treturn fmt.Errorf(\"cannot set, DataFrame is frozen\")\n\t}\n\n\tif name == \"columns\" {\n\t\tidx, ok := val.(*Index)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"cannot assign to 'columns', wrong type\")\n\t\t}\n\t\tdf.columns = idx\n\t\treturn nil\n\t}\n\treturn starlark.NoSuchAttrError(name)\n}", "func (o *Node) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tkey := makeCacheKey(columns, nil)\n\tnodeUpdateCacheMut.RLock()\n\tcache, cached := nodeUpdateCache[key]\n\tnodeUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tnodeAllColumns,\n\t\t\tnodePrimaryKeyColumns,\n\t\t)\n\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update node, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"node\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, nodePrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(nodeType, nodeMapping, append(wl, nodePrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update node row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for node\")\n\t}\n\n\tif !cached {\n\t\tnodeUpdateCacheMut.Lock()\n\t\tnodeUpdateCache[key] = cache\n\t\tnodeUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, nil\n}", "func (db *Database) UpdateBio(id string, bio string) error {\n\t// OWASP Top 10 2017 #1: Injection\n\t// We construct our SQL query via string concatenation with untrusted user\n\t// input, so we're vulnerable to a SQL injection. For example, if bio is:\n\t//\n\t// \"' WHERE 0=1; DROP TABLE users; --\"\n\t//\n\t// then the attacker can drop out table, as the query is expanded to:\n\t//\n\t// UPDATE users SET bio = '' WHERE 0=1; DROP TABLE users; --' WHERE id = ...\n\t//\n\t// The attacker can make arbitrary modifications to our database, as well as\n\t// read arbitrary DB contents via their own 'bio' field.\n\t//\n\t// To avoid injection, we should be using setting parameters in Golang's\n\t// \"Query\" function (see other DB functions in 'db.go'), rather than\n\t// constructing SQL queries via string concatenation.\n\n\tstmt := \"UPDATE users SET bio = '\" + bio + \"' WHERE id = '\" + id + \"'\"\n\n\t_, err := db.conn.Exec(stmt)\n\n\t// Return an error containing a stacktrace here to demonstrate #6: Security\n\t// Misconfiguration. See 'router.go' for more information.\n\treturn errors.Wrap(err, \"\")\n}", "func (d *Database) Update(db DB, table string, src interface{}) error {\n\t// gather the query parts\n\tnames, err := d.Columns(src, false)\n\tif err != nil {\n\t\treturn err\n\t}\n\tplaceholders, err := d.Placeholders(src, false)\n\tif err != nil {\n\t\treturn err\n\t}\n\tvalues, err := d.Values(src, false)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// form the column=placeholder pairs\n\tvar pairs []string\n\tfor i := 0; i < len(names) && i < len(placeholders); i++ {\n\t\tpair := fmt.Sprintf(\"%s=%s\", d.quoted(names[i]), placeholders[i])\n\t\tpairs = append(pairs, pair)\n\t}\n\n\tpkName, pkValue, err := d.PrimaryKey(src)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif pkName == \"\" {\n\t\treturn fmt.Errorf(\"meddler.Update: no primary key field\")\n\t}\n\tif pkValue < 1 {\n\t\treturn fmt.Errorf(\"meddler.Update: primary key must be an integer > 0\")\n\t}\n\tph := d.placeholder(len(placeholders) + 1)\n\n\t// run the query\n\tq := fmt.Sprintf(\"UPDATE %s SET %s WHERE %s=%s\", d.quoted(table),\n\t\tstrings.Join(pairs, \",\"),\n\t\td.quoted(pkName), ph)\n\tvalues = append(values, pkValue)\n\n\tif _, err := db.Exec(q, values...); err != nil {\n\t\treturn &dbErr{msg: \"meddler.Update: DB error in Exec\", err: err}\n\t}\n\n\treturn nil\n}", "func (o *CMFMusic) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tcmfMusicUpdateCacheMut.RLock()\n\tcache, cached := cmfMusicUpdateCache[key]\n\tcmfMusicUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tcmfMusicAllColumns,\n\t\t\tcmfMusicPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update cmf_music, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE `cmf_music` SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, cmfMusicPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(cmfMusicType, cmfMusicMapping, append(wl, cmfMusicPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update cmf_music row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for cmf_music\")\n\t}\n\n\tif !cached {\n\t\tcmfMusicUpdateCacheMut.Lock()\n\t\tcmfMusicUpdateCache[key] = cache\n\t\tcmfMusicUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "func (o *CMFTurntable) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tcmfTurntableUpdateCacheMut.RLock()\n\tcache, cached := cmfTurntableUpdateCache[key]\n\tcmfTurntableUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tcmfTurntableAllColumns,\n\t\t\tcmfTurntablePrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update cmf_turntable, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE `cmf_turntable` SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, cmfTurntablePrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(cmfTurntableType, cmfTurntableMapping, append(wl, cmfTurntablePrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update cmf_turntable row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for cmf_turntable\")\n\t}\n\n\tif !cached {\n\t\tcmfTurntableUpdateCacheMut.Lock()\n\t\tcmfTurntableUpdateCache[key] = cache\n\t\tcmfTurntableUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "func (n *node) UpdateField(data interface{}, fieldName string, value interface{}) error {\n\treturn n.update(data, func(ref *reflect.Value, current *reflect.Value, info *modelInfo) error {\n\t\tf := current.FieldByName(fieldName)\n\t\tif !f.IsValid() {\n\t\t\treturn ErrNotFound\n\t\t}\n\t\ttf, _ := current.Type().FieldByName(fieldName)\n\t\tif tf.PkgPath != \"\" {\n\t\t\treturn ErrNotFound\n\t\t}\n\t\tv := reflect.ValueOf(value)\n\t\tif v.Kind() != f.Kind() {\n\t\t\treturn ErrIncompatibleValue\n\t\t}\n\t\tf.Set(v)\n\t\tidxInfo, ok := info.Indexes[fieldName]\n\t\tif ok {\n\t\t\tidxInfo.Value = &f\n\t\t\tidxInfo.IsZero = idxInfo.isZero()\n\t\t}\n\t\treturn nil\n\t})\n}", "func updateTimeStampForUpdateCallback(scope *gorm.Scope) {\n\tif _, ok := scope.Get(\"gorm:update_column\"); !ok {\n\t\tscope.SetColumn(\"ModifiedOn\", time.Now())\n\t}\n}", "func ColumnToggle(name string) {\n\tcol := GlobalColumns[colIndex(name)]\n\tcol.Enabled = !col.Enabled\n\tlog.Noticef(\"config change [column-%s]: %t -> %t\", col.Name, !col.Enabled, col.Enabled)\n}", "func (m *Module) InternalUpdate(ctx context.Context, dbAlias, project, col string, req *model.UpdateRequest) error {\n\tm.RLock()\n\tdefer m.RUnlock()\n\n\t// validate the update operation\n\tdbType, err := m.getDBType(dbAlias)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := helpers.ValidateUpdateOperation(ctx, dbAlias, dbType, col, req.Operation, req.Update, req.Find, m.schemaDoc); err != nil {\n\t\treturn err\n\t}\n\n\tcrud, err := m.getCrudBlock(dbAlias)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := crud.IsClientSafe(ctx); err != nil {\n\t\treturn err\n\t}\n\n\t// Adjust where clause\n\tif err := helpers.AdjustWhereClause(ctx, dbAlias, model.DBType(dbType), col, m.schemaDoc, req.Find); err != nil {\n\t\treturn err\n\t}\n\n\t// Perform the update operation\n\tn, err := crud.Update(ctx, col, req)\n\n\t// Invoke the metric hook if the operation was successful\n\tif err == nil {\n\t\tm.metricHook(m.project, dbAlias, col, n, model.Update)\n\t}\n\n\treturn err\n}", "func UpdateNumField(key string, value int64) UpdateOption {\n\treturn func() string {\n\t\treturn fmt.Sprintf(\"%s = %d\", key, value)\n\t}\n}", "func (m MariaDB) Update(ctx context.Context, ep entity.PersonalData) (int64, error) {\n\tp := receive(ep)\n\tsqlQuery := \"UPDATE person SET name=?, last_name=?, phone=?, email=?, year_od_birth=? where id= ?\"\n\n\trslt, err := m.Person.ExecContext(ctx, sqlQuery, p.Name, p.LastName, p.Phone, p.Email, p.YearOfBirth, p.ID)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"could not update data\")\n\t}\n\tcount, err := rslt.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"rows are not affected\")\n\t}\n\treturn count, nil\n}", "func (m *MySQL)UpdateVal(i interface{}, columns ...string)(sql.Result, error){\n\tif i == nil || len(columns) == 0 {\n\t\treturn nil, fmt.Errorf(\"interface is nil or columns is empty\")\n\t}\n\ttable, cols, err := getColumns(i)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvals := []interface{}{}\n\tfor _, c := range cols{\n\t\tfor _, column := range columns {\n\t\t\tif c.Name == column {\n\t\t\t\tvals = append(vals, c.Ref)\n\t\t\t}\n\t\t}\n\t}\n\tsql := fmt.Sprintf(\"update %s set %s =?;\", table, strings.Join(columns, \"=? \"))\n\treturn m.Exec(sql, vals...)\n}", "func updateName(name string, id int) {\n\tsqlStatement := `\nUPDATE people\nSET Name = $2\nWHERE id = $1;`\n\t_, err := Db.Exec(sqlStatement, id, name)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(\"People Name Updated\", id)\n\n}", "func (o *Constraint) Update(db *gorm.DB, fields ...ConstraintDBSchemaField) error {\n\tdbNameToFieldName := map[string]interface{}{\n\t\t\"id\": o.ID,\n\t\t\"created_at\": o.CreatedAt,\n\t\t\"updated_at\": o.UpdatedAt,\n\t\t\"deleted_at\": o.DeletedAt,\n\t\t\"segment_id\": o.SegmentID,\n\t\t\"property\": o.Property,\n\t\t\"operator\": o.Operator,\n\t\t\"value\": o.Value,\n\t}\n\tu := map[string]interface{}{}\n\tfor _, f := range fields {\n\t\tfs := f.String()\n\t\tu[fs] = dbNameToFieldName[fs]\n\t}\n\tif err := db.Model(o).Updates(u).Error; err != nil {\n\t\tif err == gorm.ErrRecordNotFound {\n\t\t\treturn err\n\t\t}\n\n\t\treturn fmt.Errorf(\"can't update Constraint %v fields %v: %s\",\n\t\t\to, fields, err)\n\t}\n\n\treturn nil\n}", "func (s *BasePlSqlParserListener) ExitColumn_based_update_set_clause(ctx *Column_based_update_set_clauseContext) {\n}", "func (c *Client) ModifyDirectConnectAttribute(request *ModifyDirectConnectAttributeRequest) (response *ModifyDirectConnectAttributeResponse, err error) {\n if request == nil {\n request = NewModifyDirectConnectAttributeRequest()\n }\n response = NewModifyDirectConnectAttributeResponse()\n err = c.Send(request, response)\n return\n}", "func (table *Table) Add(name string, length int) int {\n\t_, exists := table.Columns[name]\n\tif exists {\n\t\treturn st.ColumnAlreadyExists\n\t}\n\tif len(name) > constant.MaxColumnNameLength {\n\t\treturn st.ColumnNameTooLong\n\t}\n\tif length <= 0 {\n\t\treturn st.InvalidColumnLength\n\t}\n\tvar numberOfRows int\n\tnumberOfRows, status := table.NumberOfRows()\n\tif status == st.OK && numberOfRows > 0 {\n\t\t// Rebuild data file if there are already rows in the table.\n\t\t// (To leave space for the new column)\n\t\tstatus = table.RebuildDataFile(name, length)\n\t\ttable.pushNewColumn(name, length)\n\t} else {\n\t\tnewColumn := table.pushNewColumn(name, length)\n\t\t// Write definition of the new column into definition file.\n\t\t_, err := table.DefFile.Seek(0, 2)\n\t\tif err != nil {\n\t\t\tlogg.Err(\"table\", \"Add\", err.String())\n\t\t\treturn st.CannotSeekTableDefFile\n\t\t}\n\t\t_, err = table.DefFile.WriteString(column.ColumnToDef(newColumn))\n\t\tif err != nil {\n\t\t\tlogg.Err(\"table\", \"Add\", err.String())\n\t\t\treturn st.CannotWriteTableDefFile\n\t\t}\n\t}\n\ttable.RowLength += length\n\treturn st.OK\n}", "func ExampleUpdate() {\n\tupd := q.Update(q.T(\"user\")).Set(q.C(\"name\"), \"hackme\").Where(q.Eq(q.C(\"id\"), 1))\n\tfmt.Println(upd)\n\t// Even in this case, the original name is used as a table and a column name\n\t// because Insert, Delete and Update aren't supporting \"AS\" syntax.\n\tu := q.T(\"user\", \"u\")\n\tfmt.Println(q.Update(u).Set(u.C(\"name\"), \"hackme\").Where(q.Eq(u.C(\"id\"), 1)))\n\t// When overwriting in the same name, the last one is effective.\n\tfmt.Println(q.Update(u).Set(u.C(\"name\"), \"hackyou\").Set(u.C(\"name\"), \"hackme\").Where(q.Eq(u.C(\"id\"), 1)))\n\t// Output:\n\t// UPDATE \"user\" SET \"name\" = ? WHERE \"id\" = ? [hackme 1]\n\t// UPDATE \"user\" SET \"name\" = ? WHERE \"id\" = ? [hackme 1]\n\t// UPDATE \"user\" SET \"name\" = ? WHERE \"id\" = ? [hackme 1]\n}", "func (o *Post) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\to.UpdatedAt = currTime\n\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tpostUpdateCacheMut.RLock()\n\tcache, cached := postUpdateCache[key]\n\tpostUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tpostColumns,\n\t\t\tpostPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"orm: unable to update posts, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"posts\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, postPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(postType, postMapping, append(wl, postPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, values)\n\t}\n\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"orm: unable to update posts row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"orm: failed to get rows affected by update for posts\")\n\t}\n\n\tif !cached {\n\t\tpostUpdateCacheMut.Lock()\n\t\tpostUpdateCache[key] = cache\n\t\tpostUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "func (o *Friendship) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\tfriendshipUpdateCacheMut.RLock()\n\tcache, cached := friendshipUpdateCache[key]\n\tfriendshipUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\tfriendshipAllColumns,\n\t\t\tfriendshipPrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update friendship, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE `friendship` SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"`\", \"`\", 0, wl),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, friendshipPrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(friendshipType, friendshipMapping, append(wl, friendshipPrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update friendship row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for friendship\")\n\t}\n\n\tif !cached {\n\t\tfriendshipUpdateCacheMut.Lock()\n\t\tfriendshipUpdateCache[key] = cache\n\t\tfriendshipUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "func (d *Dosen) Update(db *sql.DB, namaDosen string) error {\n\tif d.ID == \"\" {\n\t\treturn fmt.Errorf(\"id tidak bolehh kosong\")\n\t}\n\tquery := \"UPDATE dosen Set namaDosen = $1 WHERE id = $2\"\n\t_, err := db.Exec(query, namaDosen, &d.ID)\n\treturn err\n}", "func (pg *PGStorage) Update(a *Address) error {\n\tvar err error\n\t_, err = pg.con.Exec(`\n\t\t\tUPDATE address set ballance = $1, income = $2, outcome = $3\n\t\t\tWHERE id=$4`,\n\t\ta.Ballance,\n\t\ta.Income,\n\t\ta.Outcome,\n\t\ta.ID,\n\t)\n\treturn err\n}", "func (s *Screen) ProcessColumn(input string) error {\n\tmatch := ColumnRegexp.FindStringSubmatch(input)\n\tif len(match) == 0 {\n\t\treturn fmt.Errorf(\"Failed regexp for column: %s\", input)\n\t}\n\n\tvalues, err := advent.StringsToInts(match[1:])\n\tif err != nil {\n\t\treturn err\n\t}\n\tcolumn, length := values[0], uint(values[1])\n\n\t// Get all the pixels of this column into a convenient array.\n\tvar pixels []bool\n\tfor y := 0; y < ScreenHeight; y++ {\n\t\tvar lit bool\n\t\tlit, err = s.IsLit(column, y)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpixels = append(pixels, lit)\n\t}\n\n\t// Shift the pixels.\n\tpixels = ShiftRight(pixels, length)\n\n\t// Update their lit values.\n\tfor y, lit := range pixels {\n\t\tif lit {\n\t\t\terr = s.Light(column, y)\n\t\t} else {\n\t\t\terr = s.Dark(column, y)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (t *ColumnsType) Update() *qb.UpdateBuilder {\n\treturn t.table.Update()\n}", "func (o *Employee) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\temployeeUpdateCacheMut.RLock()\n\tcache, cached := employeeUpdateCache[key]\n\temployeeUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\temployeeAllColumns,\n\t\t\temployeePrimaryKeyColumns,\n\t\t)\n\n\t\tif !columns.IsWhitelist() {\n\t\t\twl = strmangle.SetComplement(wl, []string{\"created_at\"})\n\t\t}\n\t\tif len(wl) == 0 {\n\t\t\treturn 0, errors.New(\"models: unable to update employee, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"employee\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, employeePrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(employeeType, employeeMapping, append(wl, employeePrimaryKeyColumns...))\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\n\tvalues := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), cache.valueMapping)\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, values)\n\t}\n\tvar result sql.Result\n\tresult, err = exec.ExecContext(ctx, cache.query, values...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update employee row\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to get rows affected by update for employee\")\n\t}\n\n\tif !cached {\n\t\temployeeUpdateCacheMut.Lock()\n\t\temployeeUpdateCache[key] = cache\n\t\temployeeUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "func (a *Anime) Update() error {\n\tdata, err := json.Marshal(a)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn database.DB.Set(a.Key(), data, -1).Err()\n}", "func (m *Mixin) UpdateAttribute(attr string, value interface{}) error {\n\treturn m.selfScope().UpdateAttribute(attr, value)\n}" ]
[ "0.7177344", "0.66587347", "0.6550741", "0.61995155", "0.6190919", "0.5953806", "0.5941242", "0.5761681", "0.5723162", "0.56922853", "0.56387645", "0.5605422", "0.5605204", "0.5500729", "0.54454195", "0.54064965", "0.5363489", "0.53318655", "0.53164065", "0.53014636", "0.5298278", "0.52746016", "0.527377", "0.52662855", "0.5255313", "0.52495927", "0.52309155", "0.52208686", "0.52163076", "0.51888084", "0.51885307", "0.5185041", "0.51561934", "0.514983", "0.5147853", "0.513879", "0.5136187", "0.513554", "0.51314163", "0.50941724", "0.50926083", "0.5089788", "0.50452185", "0.5037131", "0.5029831", "0.5023869", "0.5018311", "0.50041133", "0.49791375", "0.49752235", "0.49726018", "0.49712577", "0.49701428", "0.49632037", "0.4960398", "0.4959377", "0.49567863", "0.49535128", "0.49470443", "0.493765", "0.4935737", "0.49189693", "0.49176693", "0.49010262", "0.4898461", "0.48935384", "0.48897976", "0.48783594", "0.4877418", "0.48680606", "0.48634914", "0.48604104", "0.4857717", "0.4851917", "0.48453978", "0.48203197", "0.48196396", "0.48155418", "0.48121294", "0.48092023", "0.48011217", "0.4799171", "0.47871703", "0.47825438", "0.47818753", "0.47778243", "0.47762004", "0.4772776", "0.47721696", "0.4770761", "0.476704", "0.47642437", "0.47636408", "0.4762845", "0.4758642", "0.4756337", "0.4754679", "0.47542953", "0.47541428", "0.47474054" ]
0.673911
1
RelatedPhoto returns the related photo entity.
func (m *File) RelatedPhoto() *Photo { if m.Photo != nil { return m.Photo } photo := Photo{} UnscopedDb().Model(m).Related(&photo) return &photo }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *RelationshipManager) GetPhoto() string {\n\tif o == nil || o.Photo.Get() == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Photo.Get()\n}", "func (m *Group) GetPhoto()(ProfilePhotoable) {\n return m.photo\n}", "func (p *parser) GetRelated(a *goquery.Selection) *model.ClubRelated {\n\td := related{area: a, cleanImg: p.cleanImg}\n\td.setDetail()\n\treturn &d.data\n}", "func (m *User) GetPhoto()(ProfilePhotoable) {\n return m.photo\n}", "func (o *User) GetPhoto() AnyOfmicrosoftGraphProfilePhoto {\n\tif o == nil || o.Photo == nil {\n\t\tvar ret AnyOfmicrosoftGraphProfilePhoto\n\t\treturn ret\n\t}\n\treturn *o.Photo\n}", "func (p *PageRelatedArticle) GetPhotoID() (value int64, ok bool) {\n\tif !p.Flags.Has(2) {\n\t\treturn value, false\n\t}\n\treturn p.PhotoID, true\n}", "func (r *entityImpl) Related(p schema.EntityRelatedFieldResolverParams) (interface{}, error) {\n\tentity := p.Source.(*types.Entity)\n\tclient := r.factory.NewWithContext(p.Context)\n\n\t// fetch & omit source\n\tentities, err := fetchEntities(client, entity.Namespace, func(obj *types.Entity) bool {\n\t\treturn obj.Name != entity.Name\n\t})\n\tif err != nil {\n\t\treturn []interface{}{}, err\n\t}\n\n\t// sort\n\tscores := map[int]int{}\n\tfor i, en := range entities {\n\t\tmatched := strings.Intersect(\n\t\t\tappend(en.Subscriptions, en.EntityClass, en.System.Platform),\n\t\t\tappend(entity.Subscriptions, entity.EntityClass, entity.System.Platform),\n\t\t)\n\t\tscores[i] = len(matched)\n\t}\n\tsort.Slice(entities, func(i, j int) bool {\n\t\treturn scores[i] > scores[j]\n\t})\n\n\t// limit\n\tlimit := clampInt(p.Args.Limit, 0, len(entities))\n\treturn entities[0:limit], nil\n}", "func (b *BotInfo) GetPhoto() (value Photo) {\n\tif b == nil {\n\t\treturn\n\t}\n\treturn b.Photo\n}", "func (c *ChatInviteLinkInfo) GetPhoto() (value ChatPhotoInfo) {\n\tif c == nil {\n\t\treturn\n\t}\n\treturn c.Photo\n}", "func (m *RelatedContact) GetRelationship()(*ContactRelationship) {\n val, err := m.GetBackingStore().Get(\"relationship\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*ContactRelationship)\n }\n return nil\n}", "func (b *BotApp) GetPhoto() (value PhotoClass) {\n\tif b == nil {\n\t\treturn\n\t}\n\treturn b.Photo\n}", "func (msg *Message) PhotoReply(fileID, caption string) Sendable {\n\treturn photoReply{\n\t\tPhotoConfig: tgbotapi.PhotoConfig{\n\t\t\tChatID: msg.Chat.ID,\n\t\t\tReplyToMessageID: msg.replyID,\n\n\t\t\tUseExistingPhoto: true,\n\n\t\t\tFileID: fileID,\n\t\t\tCaption: caption,\n\t\t},\n\n\t\tbot: msg.bot,\n\t}\n}", "func (r *HasOneRelation) Get(m mgm.Model) error {\n\treturn mgm.Coll(r.related).First(r.filterByRelation(nil), m)\n}", "func (o *RelationshipManager) GetPhotoOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Photo.Get(), o.Photo.IsSet()\n}", "func FetchRelated(baseURL, resourceType, id, relationship string) (*jsh.Document, *http.Response, error) {\n\trequest, err := FetchRelatedRequest(baseURL, resourceType, id, relationship)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn Do(request, jsh.ObjectMode)\n}", "func (p *NoteStoreClient) FindRelated(ctx context.Context, authenticationToken string, query *RelatedQuery, resultSpec *RelatedResultSpec) (r *RelatedResult_, err error) {\n var _args189 NoteStoreFindRelatedArgs\n _args189.AuthenticationToken = authenticationToken\n _args189.Query = query\n _args189.ResultSpec = resultSpec\n var _result190 NoteStoreFindRelatedResult\n if err = p.Client_().Call(ctx, \"findRelated\", &_args189, &_result190); err != nil {\n return\n }\n switch {\n case _result190.UserException!= nil:\n return r, _result190.UserException\n case _result190.SystemException!= nil:\n return r, _result190.SystemException\n case _result190.NotFoundException!= nil:\n return r, _result190.NotFoundException\n }\n\n return _result190.GetSuccess(), nil\n}", "func (client Client) Related(parameters Parameters) (RelatedResultContainer, error) {\n\tvar result relatedResultWrapper\n\n\tif err := client.search(parameters.GetURI(SearchTypeRelated), &result); err != nil {\n\t\treturn RelatedResultContainer{}, err\n\t}\n\n\treturn result.Data, nil\n}", "func (p *NoteStoreClient) FindRelated(ctx context.Context, authenticationToken string, query *RelatedQuery, resultSpec *RelatedResultSpec) (r *RelatedResult, userException *Errors.EDAMUserException, systemException *Errors.EDAMSystemException, notFoundException *Errors.EDAMNotFoundException, err error) {\n\tif err = p.sendFindRelated(ctx, authenticationToken, query, resultSpec); err != nil {\n\t\treturn\n\t}\n\treturn p.recvFindRelated(ctx)\n}", "func (as AccountStorage) GetRelationship(ctx sdk.Context, me types.AccountKey, other types.AccountKey) (*Relationship, sdk.Error) {\n\tstore := ctx.KVStore(as.key)\n\trelationshipByte := store.Get(getRelationshipKey(me, other))\n\tif relationshipByte == nil {\n\t\treturn nil, nil\n\t}\n\tqueue := new(Relationship)\n\tif err := as.cdc.UnmarshalJSON(relationshipByte, queue); err != nil {\n\t\treturn nil, ErrFailedToUnmarshalRelationship(err)\n\t}\n\treturn queue, nil\n}", "func (h *Creator) GetRelationship(model interface{}, field string) http.HandlerFunc {\n\tmappedModel := h.c.MustGetModelStruct(model)\n\tsField, ok := mappedModel.RelationField(field)\n\tif !ok {\n\t\tlog.Panicf(\"Field: '%s' not found for the model: '%s'\", mappedModel.String())\n\t}\n\treturn h.handleGetRelationship(mappedModel, sField, \"\")\n}", "func (o *RelationshipManager) HasPhoto() bool {\n\tif o != nil && o.Photo.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (box *TestEntityRelatedBox) Get(id uint64) (*TestEntityRelated, error) {\n\tobject, err := box.Box.Get(id)\n\tif err != nil {\n\t\treturn nil, err\n\t} else if object == nil {\n\t\treturn nil, nil\n\t}\n\treturn object.(*TestEntityRelated), nil\n}", "func (s *SponsoredWebPage) GetPhoto() (value PhotoClass, ok bool) {\n\tif s == nil {\n\t\treturn\n\t}\n\tif !s.Flags.Has(0) {\n\t\treturn value, false\n\t}\n\treturn s.Photo, true\n}", "func (o *ResourcepoolPoolMember) GetResource() MoBaseMoRelationship {\n\tif o == nil || o.Resource == nil {\n\t\tvar ret MoBaseMoRelationship\n\t\treturn ret\n\t}\n\treturn *o.Resource\n}", "func (m Message) ReplyPhoto(filepath string, caption ...string) {\n\tmessage := &ReplyMessage{}\n\tmsg := tgbotapi.NewPhotoUpload(m.Chat.ID, filepath)\n\tif len(caption) > 0 {\n\t\tmsg.Caption = caption[0]\n\t}\n\tmessage.msg = msg\n\tm.replies <- message\n}", "func (m *ItemPhotoRequestBuilder) Get(ctx context.Context, requestConfiguration *ItemPhotoRequestBuilderGetRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ProfilePhotoable, error) {\n requestInfo, err := m.ToGetRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateProfilePhotoFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.ProfilePhotoable), nil\n}", "func (u *User) GetPhoto() (value UserProfilePhotoClass, ok bool) {\n\tif u == nil {\n\t\treturn\n\t}\n\tif !u.Flags.Has(5) {\n\t\treturn value, false\n\t}\n\treturn u.Photo, true\n}", "func (c _StoreImpl) Photo_ByPostId(PostId int) (*Photo, bool) {\n\to, ok := RowCacheIndex.Get(\"Photo_PostId2:\" + fmt.Sprintf(\"%v\", PostId))\n\tif ok {\n\t\tif obj, ok := o.(*Photo); ok {\n\t\t\treturn obj, true\n\t\t}\n\t}\n\n\trow, err := NewPhoto_Selector().PostId_Eq(PostId).GetRow(base.DB)\n\tif err == nil {\n\t\tRowCacheIndex.Set(\"Photo_PostId2:\"+fmt.Sprintf(\"%v\", row.PostId), row, 0)\n\t\treturn row, true\n\t}\n\n\tXOLogErr(err)\n\treturn nil, false\n}", "func (o *EventAttributes) GetRelatedEventId() int64 {\n\tif o == nil || o.RelatedEventId == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\treturn *o.RelatedEventId\n}", "func (b *Bot) SendPhoto() (*Message, error) {\n\treturn nil, nil\n}", "func GetPicture(id uint, db *gorm.DB) *Picture {\n\t//Preloaded needed to give us the image and its id\n\tpicture := new(Picture)\n\tdb.Find(picture, id)\n\tif picture.ImageID == id {\n\t\treturn picture\n\t}\n\treturn nil\n}", "func (o *PostGetOneParams) SetRelated(related []string) {\n\to.Related = related\n}", "func (m *User) GetPhotos()([]ProfilePhotoable) {\n return m.photos\n}", "func (c *ClientWithResponses) AppStoreReviewDetailsAppStoreReviewAttachmentsGetToManyRelatedWithResponse(ctx context.Context, id string, params *AppStoreReviewDetailsAppStoreReviewAttachmentsGetToManyRelatedParams, reqEditors ...RequestEditorFn) (*AppStoreReviewDetailsAppStoreReviewAttachmentsGetToManyRelatedResponse, error) {\n\trsp, err := c.AppStoreReviewDetailsAppStoreReviewAttachmentsGetToManyRelated(ctx, id, params, reqEditors...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ParseAppStoreReviewDetailsAppStoreReviewAttachmentsGetToManyRelatedResponse(rsp)\n}", "func (o *RelationshipManager) UnsetPhoto() {\n\to.Photo.Unset()\n}", "func (u *User) GetPhotoID(tx *pop.Connection) (*string, error) {\n\tif err := tx.Load(u, \"PhotoFile\"); err != nil {\n\t\treturn nil, err\n\t}\n\tif u.FileID.Valid {\n\t\tphotoID := u.PhotoFile.UUID.String()\n\t\treturn &photoID, nil\n\t}\n\n\treturn nil, nil\n}", "func (o *ResourcepoolPoolMember) GetPool() ResourcepoolPoolRelationship {\n\tif o == nil || o.Pool == nil {\n\t\tvar ret ResourcepoolPoolRelationship\n\t\treturn ret\n\t}\n\treturn *o.Pool\n}", "func (r *run) updatePhoto(ctx context.Context, parent *importer.Object, ph photo) (ret error) {\n\tif ph.ID == \"\" {\n\t\treturn errors.New(\"photo has no ID\")\n\t}\n\n\t// fileRefStr, in addition to being used as the camliConent value, is used\n\t// as a sentinel: if it is still blank after the call to\n\t// ChildPathObjectOrFunc, it means that a permanode for the photo object\n\t// already exists.\n\tvar fileRefStr string\n\t// picasAttrs holds the attributes of the picasa node for the photo, if any is found.\n\tvar picasAttrs url.Values\n\n\tfilename := ph.filename()\n\n\tphotoNode, err := parent.ChildPathObjectOrFunc(ph.ID, func() (*importer.Object, error) {\n\t\th := blob.NewHash()\n\t\trc, err := r.downloader.openPhoto(ctx, ph)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfileRef, err := schema.WriteFileFromReader(r.Host.Target(), filename, io.TeeReader(rc, h))\n\t\trc.Close()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfileRefStr = fileRef.String()\n\t\twholeRef := blob.RefFromHash(h)\n\t\tpn, attrs, err := findExistingPermanode(r.Host.Searcher(), wholeRef)\n\t\tif err != nil {\n\t\t\tif err != os.ErrNotExist {\n\t\t\t\treturn nil, fmt.Errorf(\"could not look for permanode with %v as camliContent : %v\", fileRefStr, err)\n\t\t\t}\n\t\t\treturn r.Host.NewObject()\n\t\t}\n\t\tif attrs != nil {\n\t\t\tpicasAttrs = attrs\n\t\t}\n\t\treturn r.Host.ObjectFromRef(pn)\n\t})\n\tif err != nil {\n\t\tif fileRefStr != \"\" {\n\t\t\treturn fmt.Errorf(\"error getting permanode for photo %q, with content %v: $v\", ph.ID, fileRefStr, err)\n\t\t}\n\t\treturn fmt.Errorf(\"error getting permanode for photo %q: %v\", ph.ID, err)\n\t}\n\n\tif fileRefStr == \"\" {\n\t\t// photoNode was created in a previous run, but it is not\n\t\t// guaranteed its attributes were set. e.g. the importer might have\n\t\t// been interrupted. So we check for an existing camliContent.\n\t\tif camliContent := photoNode.Attr(nodeattr.CamliContent); camliContent == \"\" {\n\t\t\t// looks like an incomplete node, so we need to re-download.\n\t\t\trc, err := r.downloader.openPhoto(ctx, ph)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfileRef, err := schema.WriteFileFromReader(r.Host.Target(), filename, rc)\n\t\t\trc.Close()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tfileRefStr = fileRef.String()\n\t\t}\n\t} else {\n\t\tif picasAttrs.Get(nodeattr.CamliContent) != \"\" {\n\t\t\t// We've just created a new file schema, but we're also recycling a\n\t\t\t// picasa node, and we prefer keeping the existing file schema from the\n\t\t\t// picasa node, because the file from Drive never gets updates\n\t\t\t// (https://productforums.google.com/forum/#!msg/drive/HbNOd1o40CQ/VfIJCncyAAAJ).\n\t\t\t// Thanks to blob deduplication, these two file schemas are most likely\n\t\t\t// the same anyway. If not, the newly created one will/should get GCed\n\t\t\t// eventually.\n\t\t\tfileRefStr = picasAttrs.Get(nodeattr.CamliContent)\n\t\t}\n\t}\n\n\tattrs := []string{\n\t\tattrDriveId, ph.ID,\n\t\tnodeattr.Version, strconv.FormatInt(ph.Version, 10),\n\t\tnodeattr.Title, ph.title(picasAttrs.Get(nodeattr.Title)),\n\t\tnodeattr.Description, orAltAttr(ph.Description, picasAttrs.Get(nodeattr.Description)),\n\t\tnodeattr.DateCreated, schema.RFC3339FromTime(ph.CreatedTime),\n\t\tnodeattr.DateModified, orAltAttr(schema.RFC3339FromTime(ph.ModifiedTime), picasAttrs.Get(nodeattr.DateModified)),\n\t\t// Even if the node already had some nodeattr.URL picasa attribute, it's\n\t\t// ok to overwrite it, because from what I've tested it's useless nowadays\n\t\t// (gives a 404 in a browser). Plus, we don't overwrite the actually useful\n\t\t// \"picasaMediaURL\" attribute.\n\t\tnodeattr.URL, ph.WebContentLink,\n\t}\n\n\tif ph.Location != nil {\n\t\tif ph.Location.Altitude != 0 {\n\t\t\tattrs = append(attrs, nodeattr.Altitude, floatToString(ph.Location.Altitude))\n\t\t}\n\t\tif ph.Location.Latitude != 0 || ph.Location.Longitude != 0 {\n\t\t\tattrs = append(attrs,\n\t\t\t\tnodeattr.Latitude, floatToString(ph.Location.Latitude),\n\t\t\t\tnodeattr.Longitude, floatToString(ph.Location.Longitude),\n\t\t\t)\n\t\t}\n\t}\n\tif err := photoNode.SetAttrs(attrs...); err != nil {\n\t\treturn err\n\t}\n\n\tif fileRefStr != \"\" {\n\t\t// camliContent is set last, as its presence defines whether we consider a\n\t\t// photo successfully updated.\n\t\tif err := photoNode.SetAttr(nodeattr.CamliContent, fileRefStr); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (c *UnsavedPostImageClient) Get(ctx context.Context, id int) (*UnsavedPostImage, error) {\n\treturn c.Query().Where(unsavedpostimage.ID(id)).Only(ctx)\n}", "func (m *Group) GetPhotos()([]ProfilePhotoable) {\n return m.photos\n}", "func (reading_EntityInfo) PutRelated(ob *objectbox.ObjectBox, object interface{}, id uint64) error {\n\treturn nil\n}", "func (p *PaymentsPaymentForm) GetPhoto() (value WebDocumentClass, ok bool) {\n\tif p == nil {\n\t\treturn\n\t}\n\tif !p.Flags.Has(5) {\n\t\treturn value, false\n\t}\n\treturn p.Photo, true\n}", "func GetRelation(id, other ID) (Relation, error) {\n\trelation := Relation{}\n\terr := Userdb.Model(&relation).Where(\"id = ?\", id).Where(\"other_id = ?\",\n\t\tother).Select()\n\treturn relation, err\n}", "func (c *PostImageClient) Get(ctx context.Context, id int) (*PostImage, error) {\n\treturn c.Query().Where(postimage.ID(id)).Only(ctx)\n}", "func (o *BulkResult) GetMoDeepCloner() BulkMoDeepClonerRelationship {\n\tif o == nil || o.MoDeepCloner == nil {\n\t\tvar ret BulkMoDeepClonerRelationship\n\t\treturn ret\n\t}\n\treturn *o.MoDeepCloner\n}", "func (f DueToRelatedField) Tag() quickfix.Tag { return tag.DueToRelated }", "func (pr *PhotosRepo) GetById(id int64) (entity.Photo, error) {\n\tvar imageUrl string\n\n\trow := pr.db.QueryRow(`SELECT image_url FROM photos WHERE id=?`, id)\n\tif err := row.Scan(&imageUrl); err != nil {\n\t\treturn entity.Photo{}, err\n\t}\n\n\treturn entity.Photo{\n\t\tId: id,\n\t\tUrl: imageUrl,\n\t}, nil\n}", "func (o *RelationshipManager) SetPhoto(v string) {\n\to.Photo.Set(&v)\n}", "func BoxForTestEntityRelated(ob *objectbox.ObjectBox) *TestEntityRelatedBox {\n\treturn &TestEntityRelatedBox{\n\t\tBox: ob.InternalBox(5),\n\t}\n}", "func (m Model) GetImage() image.Image {\n\treturn m.Image\n}", "func (r RepositoryImpl) GetVoteEntity(id int64) *VoteEntity {\n\tif v, ok := r.database[id]; ok {\n\t\treturn &v\n\t}\n\treturn nil\n}", "func (b *Bot) SendPhoto(request axon.O) (result axon.O, err error) {\n\tvar response interface{}\n\tif response, err = b.doPostMultipart(\"sendPhoto\", request); err == nil {\n\t\tresult = response.(map[string]interface{})\n\t}\n\treturn\n}", "func (o *RelationshipManager) SetPhotoNil() {\n\to.Photo.Set(nil)\n}", "func (p *Parser) GetClubRelated(id int) (*model.ClubRelated, int, error) {\n\tq := map[string]interface{}{\"cid\": id}\n\tdoc, code, err := p.getDoc(utils.BuildURLWithQuery(q, malURL, \"clubs.php\"), \"#contentWrapper\")\n\tif err != nil {\n\t\treturn nil, code, err\n\t}\n\treturn p.club.GetRelated(doc), http.StatusOK, nil\n}", "func GetRelationship(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *RelationshipState, opts ...pulumi.ResourceOption) (*Relationship, error) {\n\tvar resource Relationship\n\terr := ctx.ReadResource(\"azure-native:customerinsights/v20170426:Relationship\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (o *ResourcepoolPoolMember) GetPeer() ResourcepoolLeaseRelationship {\n\tif o == nil || o.Peer == nil {\n\t\tvar ret ResourcepoolLeaseRelationship\n\t\treturn ret\n\t}\n\treturn *o.Peer\n}", "func (q braceletPhotoQuery) One() (*BraceletPhoto, error) {\n\to := &BraceletPhoto{}\n\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Bind(o)\n\tif err != nil {\n\t\tif errors.Cause(err) == sql.ErrNoRows {\n\t\t\treturn nil, sql.ErrNoRows\n\t\t}\n\t\treturn nil, errors.Wrap(err, \"models: failed to execute a one query for bracelet_photo\")\n\t}\n\n\treturn o, nil\n}", "func GetPhotoHandler(c *gin.Context) {\n\tif !service.VerifyAPIRequest(c, c.Request.Header[\"Token\"]) {\n\t\treturn\n\t}\n\tif photoid, err := strconv.Atoi(c.Param(\"photoID\")); err == nil {\n\t\tphoto, err := MyStore.GetPhoto(photoid)\n\t\tif err == nil {\n\t\t\tc.Header(\"Access-Control-Allow-Origin\", \"*\")\n\t\t\tc.Header(\"Content-Type\", \"application/json\")\n\t\t\tc.JSON(http.StatusOK, photo)\n\t\t} else {\n\t\t\tpanic(err)\n\t\t}\n\t} else {\n\t\tpanic(err)\n\t}\n}", "func (q pictureQuery) One() (*Picture, error) {\n\to := &Picture{}\n\n\tqueries.SetLimit(q.Query, 1)\n\n\terr := q.Bind(o)\n\tif err != nil {\n\t\tif errors.Cause(err) == sql.ErrNoRows {\n\t\t\treturn nil, sql.ErrNoRows\n\t\t}\n\t\treturn nil, errors.Wrap(err, \"models: failed to execute a one query for pictures\")\n\t}\n\n\tif err := o.doAfterSelectHooks(queries.GetExecutor(q.Query)); err != nil {\n\t\treturn o, err\n\t}\n\n\treturn o, nil\n}", "func (c *UnsavedPostAttachmentClient) Get(ctx context.Context, id int) (*UnsavedPostAttachment, error) {\n\treturn c.Query().Where(unsavedpostattachment.ID(id)).Only(ctx)\n}", "func (o *GetRecipeInformation200ResponseExtendedIngredientsInner) GetImage() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Image\n}", "func (m *TeamItemRequestBuilder) Photo()(*ica5ec7aca95820534d087da722646ac0c0eb14565fc4c028141ff7080240b58d.PhotoRequestBuilder) {\n return ica5ec7aca95820534d087da722646ac0c0eb14565fc4c028141ff7080240b58d.NewPhotoRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "func GetImage(id uint, db *gorm.DB) *Image {\n\timage := new(Image)\n\tdb.Find(image, id)\n\tif image.ID == id {\n\t\treturn image\n\t}\n\treturn nil\n}", "func (o *OsInstallAllOf) GetImage() SoftwarerepositoryOperatingSystemFileRelationship {\n\tif o == nil || o.Image == nil {\n\t\tvar ret SoftwarerepositoryOperatingSystemFileRelationship\n\t\treturn ret\n\t}\n\treturn *o.Image\n}", "func (m *Meta) Image() Image {\n\treturn m.Inherent.Image\n}", "func (i *InputInlineQueryResultPhoto) GetPhotoWidth() (value int32) {\n\tif i == nil {\n\t\treturn\n\t}\n\treturn i.PhotoWidth\n}", "func (o *ResourcepoolPoolMember) GetAssignedToEntity() []MoBaseMoRelationship {\n\tif o == nil {\n\t\tvar ret []MoBaseMoRelationship\n\t\treturn ret\n\t}\n\treturn o.AssignedToEntity\n}", "func (o *IppoolPoolMember) GetAssignedToEntity() MoBaseMoRelationship {\n\tif o == nil || o.AssignedToEntity == nil {\n\t\tvar ret MoBaseMoRelationship\n\t\treturn ret\n\t}\n\treturn *o.AssignedToEntity\n}", "func (o LookupNoteResultOutput) RelatedUrl() RelatedUrlResponseArrayOutput {\n\treturn o.ApplyT(func(v LookupNoteResult) []RelatedUrlResponse { return v.RelatedUrl }).(RelatedUrlResponseArrayOutput)\n}", "func (c *Client) GetPhoto(device string) ([]byte, error) {\n\treq := fmt.Sprintf(\"%s/img/%s\", c.serviceURL, device)\n\tlogger.Printf(\"photo request %s\", req)\n\tres, err := http.Get(req)\n\tif err != nil {\n\t\tlogger.Printf(\"photo request to %s, %s\", device, err)\n\t\treturn nil, err\n\t}\n\tdefer res.Body.Close()\n\tif res.StatusCode != http.StatusOK {\n\t\tvar resStr string\n\t\tif buf, readErr := ioutil.ReadAll(res.Body); readErr == nil {\n\t\t\tresStr = string(buf)\n\t\t}\n\t\tlogger.Printf(\"response to request %s: %s, %s\", device, res.Status, resStr)\n\t\treturn nil, fmt.Errorf(\"photo response (status %d) %s\", res.StatusCode, resStr)\n\t}\n\n\tdata, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\tlogger.Printf(\"reading bytes from %s photo response, %s\", device, err)\n\t\treturn nil, err\n\t}\n\treturn data, nil\n}", "func (o *PostGetOneParams) WithRelated(related []string) *PostGetOneParams {\n\to.SetRelated(related)\n\treturn o\n}", "func GetPhotoByUserAndHash(photos *[]Photo, hash string) *Photo {\n\n\tfor _, photo := range *photos {\n\t\tif photo.Hash == hash {\n\t\t\treturn &photo\n\t\t}\n\t}\n\n\treturn nil\n}", "func (e EntityRepository) GetRelatedEntities(entity models.Entity, limit int, offset int) ([]models.Entity, error) {\n\treturn repositoryHandler.entityRepository.GetRelatedEntities(entity, limit, offset)\n}", "func (o *User) GetPhotos() []MicrosoftGraphProfilePhoto {\n\tif o == nil || o.Photos == nil {\n\t\tvar ret []MicrosoftGraphProfilePhoto\n\t\treturn ret\n\t}\n\treturn *o.Photos\n}", "func (g *Goods) ListRelated(c Context) {\n\t// TODO\n\tc.String(http.StatusOK, \"get related goods list\")\n}", "func (o *GetRecipeInformation200ResponseExtendedIngredientsInner) GetOriginal() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Original\n}", "func (u *User) GetPhotoURL(tx *pop.Connection) (*string, error) {\n\tif err := tx.Load(u, \"PhotoFile\"); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif !u.FileID.Valid {\n\t\tif u.AuthPhotoURL.Valid {\n\t\t\treturn &u.AuthPhotoURL.String, nil\n\t\t}\n\t\turl := gravatarURL(u.Email)\n\t\treturn &url, nil\n\t}\n\n\tif err := u.PhotoFile.RefreshURL(tx); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &u.PhotoFile.URL, nil\n}", "func (*ArticlePhoto) Descriptor() ([]byte, []int) {\n\treturn file_contents_v1_news_photo_proto_rawDescGZIP(), []int{0}\n}", "func (event_EntityInfo) PutRelated(ob *objectbox.ObjectBox, object interface{}, id uint64) error {\n\treturn nil\n}", "func (testEntityRelated_EntityInfo) Load(txn *objectbox.Transaction, bytes []byte) (interface{}, error) {\n\tvar table = &flatbuffers.Table{\n\t\tBytes: bytes,\n\t\tPos: flatbuffers.GetUOffsetT(bytes),\n\t}\n\tvar id = table.GetUint64Slot(4, 0)\n\n\tvar relNext *EntityByValue\n\tif rId := table.GetUint64Slot(8, 0); rId > 0 {\n\t\tif err := txn.RunWithCursor(EntityByValueBinding.Id, func(targetCursor *objectbox.Cursor) error {\n\t\t\tif relObject, err := targetCursor.Get(rId); err != nil {\n\t\t\t\treturn err\n\t\t\t} else if relObj, ok := relObject.(*EntityByValue); ok {\n\t\t\t\trelNext = relObj\n\t\t\t} else {\n\t\t\t\tvar relObj = relObject.(EntityByValue)\n\t\t\t\trelNext = &relObj\n\t\t\t}\n\t\t\treturn nil\n\t\t}); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tvar relNextSlice []EntityByValue\n\tif err := txn.RunWithCursor(TestEntityRelatedBinding.Id, func(cursor *objectbox.Cursor) error {\n\t\tif rSlice, err := cursor.RelationGetAll(6, EntityByValueBinding.Id, id); err != nil {\n\t\t\treturn err\n\t\t} else {\n\t\t\trelNextSlice = rSlice.([]EntityByValue)\n\t\t\treturn nil\n\t\t}\n\t}); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &TestEntityRelated{\n\t\tId: id,\n\t\tName: fbutils.GetStringSlot(table, 6),\n\t\tNext: relNext,\n\t\tNextSlice: relNextSlice,\n\t}, nil\n}", "func (db *DB) GetRelated(id string) []Related {\n\tds := []Related{}\n\tif psql, args, err := selectRelated.Where(squirrel.Eq{\"id\": id}).ToSql(); err != nil {\n\t\tdb.GetLogger().Println(err)\n\t\treturn nil\n\t} else if _, err := db.GetDB().Select(&ds, psql, args...); err != nil {\n\t\tdb.GetLogger().Println(err)\n\t\treturn nil\n\t}\n\treturn ds\n}", "func (c *PostAttachmentClient) Get(ctx context.Context, id int) (*PostAttachment, error) {\n\treturn c.Query().Where(postattachment.ID(id)).Only(ctx)\n}", "func (i *InputInlineQueryResultPhoto) GetPhotoHeight() (value int32) {\n\tif i == nil {\n\t\treturn\n\t}\n\treturn i.PhotoHeight\n}", "func (entity_EntityInfo) Load(txn *objectbox.Transaction, bytes []byte) (interface{}, error) {\n\tvar table = &flatbuffers.Table{\n\t\tBytes: bytes,\n\t\tPos: flatbuffers.GetUOffsetT(bytes),\n\t}\n\tvar id = table.GetUint64Slot(4, 0)\n\n\tvar relRelated *TestEntityRelated\n\tif rId := table.GetUint64Slot(46, 0); rId > 0 {\n\t\tif err := txn.RunWithCursor(TestEntityRelatedBinding.Id, func(targetCursor *objectbox.Cursor) error {\n\t\t\tif relObject, err := targetCursor.Get(rId); err != nil {\n\t\t\t\treturn err\n\t\t\t} else if relObj, ok := relObject.(*TestEntityRelated); ok {\n\t\t\t\trelRelated = relObj\n\t\t\t} else {\n\t\t\t\tvar relObj = relObject.(TestEntityRelated)\n\t\t\t\trelRelated = &relObj\n\t\t\t}\n\t\t\treturn nil\n\t\t}); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\trelRelated = &TestEntityRelated{}\n\t}\n\n\tvar relRelatedPtr *TestEntityRelated\n\tif rId := table.GetUint64Slot(48, 0); rId > 0 {\n\t\tif err := txn.RunWithCursor(TestEntityRelatedBinding.Id, func(targetCursor *objectbox.Cursor) error {\n\t\t\tif relObject, err := targetCursor.Get(rId); err != nil {\n\t\t\t\treturn err\n\t\t\t} else if relObj, ok := relObject.(*TestEntityRelated); ok {\n\t\t\t\trelRelatedPtr = relObj\n\t\t\t} else {\n\t\t\t\tvar relObj = relObject.(TestEntityRelated)\n\t\t\t\trelRelatedPtr = &relObj\n\t\t\t}\n\t\t\treturn nil\n\t\t}); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tvar relRelatedPtr2 *TestEntityRelated\n\tif rId := table.GetUint64Slot(50, 0); rId > 0 {\n\t\tif err := txn.RunWithCursor(TestEntityRelatedBinding.Id, func(targetCursor *objectbox.Cursor) error {\n\t\t\tif relObject, err := targetCursor.Get(rId); err != nil {\n\t\t\t\treturn err\n\t\t\t} else if relObj, ok := relObject.(*TestEntityRelated); ok {\n\t\t\t\trelRelatedPtr2 = relObj\n\t\t\t} else {\n\t\t\t\tvar relObj = relObject.(TestEntityRelated)\n\t\t\t\trelRelatedPtr2 = &relObj\n\t\t\t}\n\t\t\treturn nil\n\t\t}); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tvar relRelatedSlice []EntityByValue\n\tif err := txn.RunWithCursor(EntityBinding.Id, func(cursor *objectbox.Cursor) error {\n\t\tif rSlice, err := cursor.RelationGetAll(4, EntityByValueBinding.Id, id); err != nil {\n\t\t\treturn err\n\t\t} else {\n\t\t\trelRelatedSlice = rSlice.([]EntityByValue)\n\t\t\treturn nil\n\t\t}\n\t}); err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar relRelatedPtrSlice []*TestEntityRelated\n\tif err := txn.RunWithCursor(EntityBinding.Id, func(cursor *objectbox.Cursor) error {\n\t\tif rSlice, err := cursor.RelationGetAll(5, TestEntityRelatedBinding.Id, id); err != nil {\n\t\t\treturn err\n\t\t} else {\n\t\t\trelRelatedPtrSlice = rSlice.([]*TestEntityRelated)\n\t\t\treturn nil\n\t\t}\n\t}); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Entity{\n\t\tId: id,\n\t\tInt: int(table.GetUint64Slot(6, 0)),\n\t\tInt8: table.GetInt8Slot(8, 0),\n\t\tInt16: table.GetInt16Slot(10, 0),\n\t\tInt32: table.GetInt32Slot(12, 0),\n\t\tInt64: table.GetInt64Slot(14, 0),\n\t\tUint: uint(table.GetUint64Slot(16, 0)),\n\t\tUint8: table.GetUint8Slot(18, 0),\n\t\tUint16: table.GetUint16Slot(20, 0),\n\t\tUint32: table.GetUint32Slot(22, 0),\n\t\tUint64: table.GetUint64Slot(24, 0),\n\t\tBool: table.GetBoolSlot(26, false),\n\t\tString: fbutils.GetStringSlot(table, 28),\n\t\tStringVector: fbutils.GetStringVectorSlot(table, 44),\n\t\tByte: table.GetByteSlot(30, 0),\n\t\tByteVector: fbutils.GetByteVectorSlot(table, 32),\n\t\tRune: rune(table.GetInt32Slot(34, 0)),\n\t\tFloat32: table.GetFloat32Slot(36, 0),\n\t\tFloat64: table.GetFloat64Slot(38, 0),\n\t\tDate: timeInt64ToEntityProperty(table.GetInt64Slot(40, 0)),\n\t\tComplex128: complex128BytesToEntityProperty(fbutils.GetByteVectorSlot(table, 42)),\n\t\tRelated: *relRelated,\n\t\tRelatedPtr: relRelatedPtr,\n\t\tRelatedPtr2: relRelatedPtr2,\n\t\tRelatedSlice: relRelatedSlice,\n\t\tRelatedPtrSlice: relRelatedPtrSlice,\n\t}, nil\n}", "func (o *User) GetPhotoOk() (AnyOfmicrosoftGraphProfilePhoto, bool) {\n\tif o == nil || o.Photo == nil {\n\t\tvar ret AnyOfmicrosoftGraphProfilePhoto\n\t\treturn ret, false\n\t}\n\treturn *o.Photo, true\n}", "func GetPhoto(token string, width int, getter URLGetter) ([]byte, string, error) {\n\ttype fbImageResp struct {\n\t\tPicture struct {\n\t\t\tData struct {\n\t\t\t\tURL string `json:\"url\"`\n\t\t\t} `json:\"data\"`\n\t\t} `json:\"picture\"`\n\t}\n\n\tvar payload fbImageResp\n\t_, err := fetch(getter, token, []string{fmt.Sprintf(\"picture.width(%d)\", width)}, &payload)\n\tif err != nil {\n\t\treturn nil, \"\", err\n\t}\n\n\tresp, err := getter.Get(payload.Picture.Data.URL)\n\tif err != nil {\n\t\treturn nil, \"\", fmt.Errorf(\"failed to fetch facebook profile image: %v\", err)\n\t}\n\tdefer resp.Body.Close()\n\n\tdata, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, \"\", err\n\t}\n\n\treturn data, resp.Header.Get(\"Content-Type\"), nil\n}", "func (m *TeamTemplatesItemDefinitionsItemTeamDefinitionPhotoRequestBuilder) Get(ctx context.Context, requestConfiguration *TeamTemplatesItemDefinitionsItemTeamDefinitionPhotoRequestBuilderGetRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.ProfilePhotoable, error) {\n requestInfo, err := m.ToGetRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.CreateProfilePhotoFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.ProfilePhotoable), nil\n}", "func (obj *HyperflexExtFcStoragePolicyRelationship) GetActualInstance() interface{} {\n\tif obj == nil {\n\t\treturn nil\n\t}\n\tif obj.HyperflexExtFcStoragePolicy != nil {\n\t\treturn obj.HyperflexExtFcStoragePolicy\n\t}\n\n\tif obj.MoMoRef != nil {\n\t\treturn obj.MoMoRef\n\t}\n\n\t// all schemas are nil\n\treturn nil\n}", "func (q braceletPhotoQuery) OneP() *BraceletPhoto {\n\to, err := q.One()\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n\n\treturn o\n}", "func (getPersonPictureInteractor GetPersonPictureInteractor) GetPersonPicture(request request.GetPersonPictureRequest) {\n\tpersonID := request.PersonID\n\tpicture := getPersonPictureInteractor.Repository.FindPicture(personID)\n\tgetPersonPictureResponse := response.GetPersonPictureResponse{\n\t\tPictureBytes: picture.PictureBytes,\n\t}\n\tgetPersonPictureInteractor.Output.DisplayPicture(getPersonPictureResponse)\n}", "func (o *AnalyzeRecipeInstructions200ResponseParsedInstructionsInnerStepsInnerIngredientsInner) GetImage() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Image\n}", "func (c *Client) DownloadPhoto(ctx context.Context, p *DownloadPhotoPayload) (res *DownloadedPhoto, err error) {\n\tvar ires interface{}\n\tires, err = c.DownloadPhotoEndpoint(ctx, p)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn ires.(*DownloadedPhoto), nil\n}", "func FindBraceletPhoto(exec boil.Executor, id int, selectCols ...string) (*BraceletPhoto, error) {\n\tbraceletPhotoObj := &BraceletPhoto{}\n\n\tsel := \"*\"\n\tif len(selectCols) > 0 {\n\t\tsel = strings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, selectCols), \",\")\n\t}\n\tquery := fmt.Sprintf(\n\t\t\"select %s from `bracelet_photo` where `id`=?\", sel,\n\t)\n\n\tq := queries.Raw(exec, query, id)\n\n\terr := q.Bind(braceletPhotoObj)\n\tif err != nil {\n\t\tif errors.Cause(err) == sql.ErrNoRows {\n\t\t\treturn nil, sql.ErrNoRows\n\t\t}\n\t\treturn nil, errors.Wrap(err, \"models: unable to select from bracelet_photo\")\n\t}\n\n\treturn braceletPhotoObj, nil\n}", "func (p *PageRelatedArticle) SetPhotoID(value int64) {\n\tp.Flags.Set(2)\n\tp.PhotoID = value\n}", "func (p *Pet) GetRelationModel(relation *mapping.StructField) (mapping.Model, error) {\n\tswitch relation.Index[0] {\n\tcase 2: // Owner\n\t\tif p.Owner == nil {\n\t\t\treturn nil, nil\n\t\t}\n\t\treturn p.Owner, nil\n\tdefault:\n\t\treturn nil, errors.Wrapf(mapping.ErrInvalidRelationField, \"provided invalid relation: '%s' for model: '%T'\", relation, p)\n\t}\n}", "func GetPhotoByID(id string) (*models.Photo, error) {\n\tclient, ctx, cancel := getDBConnection()\n\tdefer cancel()\n\tdefer client.Disconnect(ctx)\n\n\tcol := client.Database(\"cat-scribers\").Collection(\"photos\")\n\n\toid, _ := primitive.ObjectIDFromHex(id)\n\n\tquery := bson.M{\"_id\": oid}\n\n\tphotoDAO := models.PhotoDAO{}\n\n\terr := col.FindOne(ctx, query).Decode(&photoDAO)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tphoto := models.Photo{}\n\n\tphotoDAO.ToModel(&photo)\n\n\treturn &photo, nil\n}", "func (entity_EntityInfo) PutRelated(txn *objectbox.Transaction, object interface{}, id uint64) error {\n\tif rel := &object.(*Entity).Related; rel != nil {\n\t\trId, err := TestEntityRelatedBinding.GetId(rel)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t} else if rId == 0 {\n\t\t\tif err := txn.RunWithCursor(TestEntityRelatedBinding.Id, func(targetCursor *objectbox.Cursor) error {\n\t\t\t\t_, err := targetCursor.Put(rel) // NOTE Put/PutAsync() has a side-effect of setting the rel.ID\n\t\t\t\treturn err\n\t\t\t}); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\tif rel := object.(*Entity).RelatedPtr; rel != nil {\n\t\trId, err := TestEntityRelatedBinding.GetId(rel)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t} else if rId == 0 {\n\t\t\tif err := txn.RunWithCursor(TestEntityRelatedBinding.Id, func(targetCursor *objectbox.Cursor) error {\n\t\t\t\t_, err := targetCursor.Put(rel) // NOTE Put/PutAsync() has a side-effect of setting the rel.ID\n\t\t\t\treturn err\n\t\t\t}); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\tif rel := object.(*Entity).RelatedPtr2; rel != nil {\n\t\trId, err := TestEntityRelatedBinding.GetId(rel)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t} else if rId == 0 {\n\t\t\tif err := txn.RunWithCursor(TestEntityRelatedBinding.Id, func(targetCursor *objectbox.Cursor) error {\n\t\t\t\t_, err := targetCursor.Put(rel) // NOTE Put/PutAsync() has a side-effect of setting the rel.ID\n\t\t\t\treturn err\n\t\t\t}); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\tif err := txn.RunWithCursor(EntityBinding.Id, func(cursor *objectbox.Cursor) error {\n\t\treturn cursor.RelationReplace(4, EntityByValueBinding.Id, id, object, object.(*Entity).RelatedSlice)\n\t}); err != nil {\n\t\treturn err\n\t}\n\tif err := txn.RunWithCursor(EntityBinding.Id, func(cursor *objectbox.Cursor) error {\n\t\treturn cursor.RelationReplace(5, TestEntityRelatedBinding.Id, id, object, object.(*Entity).RelatedPtrSlice)\n\t}); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func GetImage(c *gin.Context) {\n\tid := c.Params.ByName(\"id\")\n\tvar image []models.Image\n\tmodels.DB.First(&image, id)\n\tc.JSON(http.StatusOK, gin.H{\"data\": image})\n}", "func (a *AppPriceTiersApiService) AppPriceTiersPricePointsGetToManyRelated(ctx _context.Context, id string, localVarOptionals *AppPriceTiersApiAppPriceTiersPricePointsGetToManyRelatedOpts) (AppPricePointsResponse, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodGet\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue AppPricePointsResponse\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/v1/appPriceTiers/{id}/pricePoints\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"id\"+\"}\", _neturl.PathEscape(parameterToString(id, \"\")), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif localVarOptionals != nil && localVarOptionals.FieldsAppPricePoints.IsSet() {\n\t\tlocalVarQueryParams.Add(\"fields[appPricePoints]\", parameterToString(localVarOptionals.FieldsAppPricePoints.Value(), \"csv\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Limit.IsSet() {\n\t\tlocalVarQueryParams.Add(\"limit\", parameterToString(localVarOptionals.Limit.Value(), \"\"))\n\t}\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"application/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 400 {\n\t\t\tvar v ErrorResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 403 {\n\t\t\tvar v ErrorResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 404 {\n\t\t\tvar v ErrorResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "func (s *SponsoredWebPage) GetPhotoAsNotEmpty() (*Photo, bool) {\n\tif value, ok := s.GetPhoto(); ok {\n\t\treturn value.AsNotEmpty()\n\t}\n\treturn nil, false\n}" ]
[ "0.6488386", "0.61046696", "0.603713", "0.6001199", "0.54746544", "0.5453277", "0.5383735", "0.53622997", "0.5291938", "0.52840054", "0.52774143", "0.50438464", "0.5002121", "0.49208587", "0.4861997", "0.48423246", "0.4829565", "0.48267308", "0.4819409", "0.48145086", "0.4770252", "0.4761204", "0.4754325", "0.47129673", "0.47047934", "0.46996823", "0.46939674", "0.46726352", "0.46700191", "0.46629235", "0.4648491", "0.4643485", "0.4626089", "0.46167734", "0.46115074", "0.46082994", "0.46037775", "0.46031803", "0.45730427", "0.45715526", "0.4553857", "0.45422626", "0.45226106", "0.4511783", "0.44669634", "0.44621128", "0.44612747", "0.44606352", "0.44512603", "0.4429652", "0.4419609", "0.4400124", "0.43927708", "0.4390233", "0.43869004", "0.43688834", "0.43663335", "0.43640265", "0.43538827", "0.43504772", "0.4340379", "0.43329406", "0.43322402", "0.4321254", "0.43098992", "0.43026835", "0.4299312", "0.42980936", "0.42893133", "0.4278512", "0.42675146", "0.4265373", "0.4255954", "0.4254927", "0.42523086", "0.42508256", "0.4246349", "0.4245965", "0.4240729", "0.42395452", "0.42366114", "0.42358518", "0.42296746", "0.4227698", "0.42184108", "0.4215503", "0.42114758", "0.4209935", "0.42080668", "0.42071575", "0.42048776", "0.42024505", "0.41988453", "0.41902754", "0.41858158", "0.41564566", "0.41540053", "0.415186", "0.41514063", "0.41478336" ]
0.8024101
0
NoJPEG returns true if the file is not a JPEG image file.
func (m *File) NoJPEG() bool { return m.FileType != string(fs.TypeJpeg) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func TestJpegData(t *testing.T){\n\tsImagePath := \"./corpus/image/jpeg-sample.jpg\"\n\tsImagePath,_ = filepath.Abs(sImagePath)\n\tif oBytes, err := ioutil.ReadFile(sImagePath); err == nil{\n\t\tif bValid, oErr := IsBytesContentAValidType(oBytes, &types.JPEGType{}); bValid == false{\n\t\t\tif oErr != nil{\n\t\t\t\tt.Error(\"Image Has Less Than The Required Header Bytes\")\n\t\t\t}else{\n\t\t\t\tt.Error(\"Image Is Not A Jpeg File\")\n\t\t\t}\n\t\t}\n\t}\n}", "func checkJpgExt(filename string) bool {\n\treturn strings.ToLower(filepath.Ext(filename)) == \".jpg\"\n}", "func isImage(ext string) bool {\n\tswitch ext {\n\tcase \".jpg\", \".jpeg\", \".png\", \".git\", \".bmp\", \".tiff\":\n\t\treturn true\n\t}\n\treturn false\n}", "func isAnImage(fileName string) bool {\n\treturn stringInSlice(strings.ToLower(filepath.Ext(fileName)), []string{\".jpg\", \".jpeg\", \".png\", \".gif\"})\n}", "func (*GuluFile) IsImg(extension string) bool {\n\text := strings.ToLower(extension)\n\n\tswitch ext {\n\tcase \".jpg\", \".jpeg\", \".bmp\", \".gif\", \".png\", \".svg\", \".ico\":\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}", "func isSupportedImageFile(text string) bool {\n\text := filepath.Ext(text)\n\tif strings.EqualFold(ext, \".jpg\") {\n\t\treturn true\n\t}\n\tif strings.EqualFold(ext, \".png\") {\n\t\treturn true\n\t}\n\tif strings.EqualFold(ext, \".gif\") {\n\t\treturn true\n\t}\n\treturn false\n}", "func (f File) IsImage() bool {\n\treturn media.IsImageFormat(f.Url)\n}", "func isImage(extension string) bool {\n\tfor _, v := range imageTypes {\n\t\tif strings.Compare(v, extension) == 0 {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func checkImage(url string) bool {\n\treq, err := http.NewRequest(\"HEAD\", url, nil)\n\tif err != nil {\n\t\treturn false\n\t}\n\tvar client http.Client\n\tresp, err := client.Do(req)\n\tif err != nil || len(resp.Header[\"Content-Length\"]) == 0 || len(resp.Header[\"Content-Type\"]) == 0 {\n\t\treturn false\n\t}\n\tdefer resp.Body.Close()\n\tmb, _ := strconv.Atoi(resp.Header[\"Content-Length\"][0])\n\tif mb > 10*1024*1024 {\n\t\treturn false\n\t}\n\tif !strings.HasPrefix(resp.Header[\"Content-Type\"][0], \"image\") {\n\t\treturn false\n\t}\n\treturn true\n}", "func IsImageFile(fileName string) bool {\n\timRegexp := regexp.MustCompile(ImgExtensionsReg)\n\treturn imRegexp.MatchString(fileName)\n}", "func IsFile(filename string) (bool, error) {\n fi, err := os.Stat(filename)\n if err != nil {\n var mu bool\n return mu, err\n }\n return fi.Mode().IsRegular(), nil\n}", "func IsImage(filePath string) bool {\n\tbuf, err := filesystem.BufferHeaderFromFile(filePath, 100)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\tkind, _ := filetype.Image(buf)\n\n\treturn kind != filetype.Unknown && kind != filematchers.TypePsd && kind != filematchers.TypeTiff && kind != filematchers.TypeCR2\n}", "func skipFileType(info os.FileInfo) bool {\n\tif info.Mode()&os.ModeTemporary != 0 {\n\t\treturn true\n\t}\n\tswitch info.Mode() & os.ModeType {\n\tcase os.ModeDir, os.ModeSymlink:\n\t\treturn false\n\t}\n\tif info.Mode().IsRegular() {\n\t\treturn false\n\t}\n\treturn true\n}", "func isImage(path string) bool {\n\text := strings.TrimPrefix(filepath.Ext(path), \".\")\n\treturn imageExtensions.contains(ext)\n}", "func isImage(fl FieldLevel) bool {\n\tmimetypes := map[string]bool{\n\t\t\"image/bmp\": true,\n\t\t\"image/cis-cod\": true,\n\t\t\"image/gif\": true,\n\t\t\"image/ief\": true,\n\t\t\"image/jpeg\": true,\n\t\t\"image/jp2\": true,\n\t\t\"image/jpx\": true,\n\t\t\"image/jpm\": true,\n\t\t\"image/pipeg\": true,\n\t\t\"image/png\": true,\n\t\t\"image/svg+xml\": true,\n\t\t\"image/tiff\": true,\n\t\t\"image/webp\": true,\n\t\t\"image/x-cmu-raster\": true,\n\t\t\"image/x-cmx\": true,\n\t\t\"image/x-icon\": true,\n\t\t\"image/x-portable-anymap\": true,\n\t\t\"image/x-portable-bitmap\": true,\n\t\t\"image/x-portable-graymap\": true,\n\t\t\"image/x-portable-pixmap\": true,\n\t\t\"image/x-rgb\": true,\n\t\t\"image/x-xbitmap\": true,\n\t\t\"image/x-xpixmap\": true,\n\t\t\"image/x-xwindowdump\": true,\n\t}\n\tfield := fl.Field()\n\n\tswitch field.Kind() {\n\tcase reflect.String:\n\t\tfilePath := field.String()\n\t\tfileInfo, err := os.Stat(filePath)\n\n\t\tif err != nil {\n\t\t\treturn false\n\t\t}\n\n\t\tif fileInfo.IsDir() {\n\t\t\treturn false\n\t\t}\n\n\t\tfile, err := os.Open(filePath)\n\t\tif err != nil {\n\t\t\treturn false\n\t\t}\n\t\tdefer file.Close()\n\n\t\tmime, err := mimetype.DetectReader(file)\n\t\tif err != nil {\n\t\t\treturn false\n\t\t}\n\n\t\tif _, ok := mimetypes[mime.String()]; ok {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func isEmptyFormFile(f *multipart.FileHeader) bool { return false }", "func verifyJPG(t *testing.T, img image.Image, goldenPath string) {\n\tgoldenBytes := readFile(goldenPath)\n\n\tout := bytes.NewBuffer(nil)\n\tjpeg.Encode(out, img, &jpeg.Options{Quality: JPG_QUALITY})\n\n\tif !bytes.Equal(out.Bytes(), *goldenBytes) {\n\t\tt.Error(\"Merge() did not produce expected output; please verify image manually\")\n\t}\n}", "func (m Metadata) IsFile() bool {\n\treturn m.Mode&sIFREG == sIFREG\n}", "func IsGif(filePath string) bool {\n\tbuf, err := filesystem.BufferHeaderFromFile(filePath, 100)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\treturn filetype.IsMIME(buf, \"image/gif\")\n}", "func (img *Image) writeAsJPEG() (image.Image, error) {\n\tvar err error\n\text, err := imaging.FormatFromExtension(img.Extension)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"couldn't format from extension: %s\", img.Extension)\n\t}\n\n\tswitch ext {\n\tcase imaging.JPEG:\n\t\tbreak\n\tcase imaging.PNG:\n\t\terr = jpeg.Encode(&img.buf, img.Image, &jpeg.Options{}) // TODO: Quality\n\t\tbreak\n\tcase imaging.GIF:\n\t\terr = jpeg.Encode(&img.buf, img.Image, &jpeg.Options{}) // TODO: Quality\n\t\tbreak\n\tdefault:\n\t\terr = errors.New(\"format is not supported yet\")\n\t\tbreak\n\t}\n\treturn img.Image, err\n}", "func FileEmpty(name string) bool {\n\tstat, err := os.Stat(name)\n\treturn os.IsNotExist(err) || stat.Size() <= 0\n}", "func (me TxsdImpactSimpleContentExtensionType) IsFile() bool { return me.String() == \"file\" }", "func isGoFile(f *os.FileInfo) bool {\n\treturn strings.HasSuffix(f.Name, \".go\") && !strings.HasSuffix(f.Name, \"_test.go\")\n}", "func (me TxsdMimeTypeSequenceType) IsImage() bool { return me.String() == \"image\" }", "func (m *SendPhoto) IsMultipart() bool {\n\treturn m.File != nil\n}", "func isFile(path string) bool {\n\tf, err := os.Stat(path)\n\treturn err == nil && f.Mode().IsRegular()\n}", "func (me TdtypeType) IsFile() bool { return me.String() == \"file\" }", "func (m *Metadata) IsFile() bool {\n\treturn (strings.ToLower(m.Tag) == MetadataTypeFile)\n}", "func IsRegularFile(fi os.FileInfo) bool {\n\tif fi == nil {\n\t\treturn false\n\t}\n\n\treturn fi.Mode()&(os.ModeType|os.ModeCharDevice) == 0\n}", "func (p *Parser) IsPNG() (bool, error) {\n\tb, err := p.br.Peek(8)\n\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\treturn bytes.Compare(pngHeader, b) == 0, nil\n}", "func (g *goldTryjobProcessor) noUpload(builder, commit string) bool {\n\tif g.cfgFile == \"\" {\n\t\treturn false\n\t}\n\n\tctx := context.Background()\n\tcfgContent, err := g.vcs.GetFile(ctx, g.cfgFile, commit)\n\tif err != nil {\n\t\tsklog.Errorf(\"Error retrieving %s: %s\", g.cfgFile, err)\n\t}\n\n\t// Parse the config file used to generate the tasks.\n\tconfig := struct {\n\t\tNoUpload []string `json:\"no_upload\"`\n\t}{}\n\tif err := json.Unmarshal([]byte(cfgContent), &config); err != nil {\n\t\tsklog.Errorf(\"Unable to parse %s. Got error: %s\", g.cfgFile, err)\n\t}\n\n\t// See if we match the builders that should not be uploaded.\n\tfor _, s := range config.NoUpload {\n\t\tm, err := regexp.MatchString(s, builder)\n\t\tif err != nil {\n\t\t\tglog.Errorf(\"Error matching regex: %s\", err)\n\t\t\tcontinue\n\t\t}\n\t\tif m {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (t *FileType) IsEmpty() bool {\n\treturn len(t.FileTypes) < 1 &&\n\t\tt.MinLength == 0 &&\n\t\tt.MaxLength == 2147483647\n}", "func IsFile(filename string) bool {\n\tfi, err := os.Stat(filename)\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn fi.Mode().IsRegular()\n}", "func isImage(extName string) bool {\n\tfor i := 0; i < len(supportImageExtNames); i++ {\n\t\tif supportImageExtNames[i] == extName {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func isPluginFile(fimg *sif.FileImage) bool {\n\treturn false\n}", "func IsImage(uri string, checkType int32) bool {\n\tif checkType == CheckTypeExt {\n\t\turi = NewFileName(uri).CleanUrl()\n\t\text := path.Ext(uri)\n\t\tif ext == \".jpg\" ||\n\t\t\text == \".png\" ||\n\t\t\text == \".svg\" ||\n\t\t\text == \".gif\" ||\n\t\t\text == \".jpeg\" ||\n\t\t\text == \".webp\" ||\n\t\t\text == \".icon\" {\n\t\t\treturn true\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tif checkType == CheckTypeMimeType {\n\t\tmime := MimeType(uri)\n\t\tif mime == \"\" {\n\t\t\treturn false\n\t\t}\n\n\t\tfor _, imgMime := range ImageMimeTypes {\n\t\t\tif imgMime == mime {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn false\n\t}\n\treturn false\n}", "func (file *GalangFile) IsJSONFile(path string) bool {\n\tb, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\tlogs.Error(err)\n\t\treturn false\n\t}\n\treturn file.IsJSONByte(b)\n}", "func IsErrUploadNotExist(err error) bool {\n\t_, ok := err.(ErrAttachmentNotExist)\n\treturn ok\n}", "func isEmptyFile(path string) (bool, error) {\n\t_, err := os.Stat(path)\n\tif err != nil {\n\t\tif !os.IsNotExist(err) {\n\t\t\treturn false, err\n\t\t}\n\n\t\treturn true, nil\n\t}\n\n\tcontents, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tstrContents := string(contents)\n\treturn strings.TrimSpace(strContents) == \"\", nil\n}", "func (n *dnode) IsFile() bool {\n\treturn n.dnType == dnTypeBlob\n}", "func isAllowedImageType(mimeType string) bool {\n\t_, exists := validImageTypes[mimeType]\n\n\treturn exists\n}", "func (fs fsObjects) isMultipartUpload(bucket, prefix string) bool {\n\tuploadsIDPath := pathJoin(fs.fsPath, bucket, prefix, uploadsJSONFile)\n\t_, err := fsStatFile(uploadsIDPath)\n\tif err != nil {\n\t\tif err == errFileNotFound {\n\t\t\treturn false\n\t\t}\n\t\terrorIf(err, \"Unable to access uploads.json \"+uploadsIDPath)\n\t\treturn false\n\t}\n\treturn true\n}", "func isPng(s io.Reader) bool {\n\th := make([]byte, 8)\n\t_, err := io.ReadFull(s, h)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\treturn string(h) == magic\n}", "func isFile(filePath string) bool {\n\tfileInfo, _ := os.Stat(filePath)\n\treturn fileInfo.Mode().IsRegular()\n}", "func (m *SendAnimation) IsMultipart() bool {\n\treturn m.File != nil && m.ThumbFile != nil\n}", "func (input *Input) IsUpload() bool {\n\treturn strings.Contains(input.Header(\"Content-Type\"), \"multipart/form-data\")\n}", "func isRegular(filename string) bool {\n\tstat, err := os.Lstat(filename)\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn stat.Mode().IsRegular()\n}", "func ImageFileName(fileName string) bool {\n\text := strings.ToLower(filepath.Ext(fileName))\n\treturn types.MemberOf(ext, []string{\".png\", \".webp\", \".tif\", \".tiff\", \".jpg\", \".jpeg\"})\n}", "func (handler *DockerImageHandler) isImageFile(path string) bool {\n\tfileName := filepath.Base(path)\n\tmatch, err := regexp.Match(\"^.*@.*@.*$\", []byte(fileName))\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn match\n}", "func (input *BeegoInput) IsUpload() bool {\n\treturn strings.Contains(input.Header(\"Content-Type\"), \"multipart/form-data\")\n}", "func (m *SendAudio) IsMultipart() bool {\n\treturn m.File != nil && m.ThumbFile != nil\n}", "func isJunkFile(abspath string) bool {\n\t_, filename := filepath.Split(abspath)\n\tfor _, v := range junkFilePrefixes {\n\t\tif strings.HasPrefix(filename, v) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (t *Link) HasUnknownMediaType() (ok bool) {\n\treturn t.mediaType != nil && t.mediaType.unknown_ != nil\n\n}", "func Formatjpg(img image.Image, filepath string) (err error) {\n\tout, err := os.Create(filepath)\n\tdefer out.Close()\n\treturn jpeg.Encode(out, img, &jpeg.Options{Quality: 100})\n\n}", "func (*StorageFileJpeg) TypeName() string {\n\treturn \"storage.fileJpeg\"\n}", "func NonZeroFileExists(filename string) bool {\n\n\tif info, err := os.Stat(filename); err == nil {\n\t\tif info.Size() > 0 {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "func (a *PDFApiService) SaveAsJPEGFile(ctx _context.Context, pdfSaveAsJpegParameters PdfSaveAsJpegParameters) (*os.File, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue *os.File\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/api/pdf/SaveAsJPEGFile\"\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json-patch+json\", \"application/json\", \"text/json\", \"application/_*+json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"text/plain\", \"application/json\", \"text/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = &pdfSaveAsJpegParameters\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 200 {\n\t\t\tvar v *os.File\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "func checkFile(filename string) bool {\n\tif filename == \"\" {\n\t\treturn true\n\t}\n\tif _, err := os.Stat(filename); os.IsNotExist(err) {\n\t\treturn false\n\t}\n\treturn true\n}", "func IsFile(node *restic.Node) bool {\n\treturn node.Type == \"file\"\n}", "func ReadJpeg(fhnd *os.File) (image Image, err error) {\n\timage = Image{apps: map[string]APP{}}\n\treader, n, err := newJpegReader(fhnd)\n\tif n == 0 || err != nil {\n\t\treturn\n\t}\n\n\tmarker := uint16(0)\n\tbinary.Read(reader, binary.BigEndian, &marker)\n\tif marker != cSOI {\n\t\treturn image, &exifError{\"Wrong format\"}\n\t}\n\n\tappHeader := make([]byte, 2)\n\tfor true {\n\t\tn, err = reader.Read(appHeader)\n\t\tif n != len(appHeader) || err != nil {\n\t\t\tbreak\n\t\t}\n\t\tif appHeader[0] == 0xFF {\n\t\t\tfor appHeader[1] == 0xFF {\n\t\t\t\tappHeader[1] = reader.ReadByte()\n\t\t\t}\n\n\t\t\tmarker = binary.BigEndian.Uint16(appHeader)\n\t\t\tsegment, ok := aSegments[marker]\n\t\t\tif !ok {\n\t\t\t\treturn image, &exifError{\"Unidentified APP marker encountered\"}\n\t\t\t}\n\n\t\t\tapp, err := segment.reader(marker, reader)\n\t\t\tif err != nil {\n\t\t\t\treturn image, err\n\t\t\t}\n\n\t\t\tif app == nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tlog.Debug(fmt.Sprintf(\"Registering APP %s, Length:%v\\n\", app.Name(), app.Length()))\n\t\t\timage.apps[app.Name()] = app\n\n\t\t} else {\n\t\t\t// Not a section marker\n\t\t\tmarker = binary.BigEndian.Uint16(appHeader)\n\t\t\treturn image, &exifError{fmt.Sprintf(\"Encountered invalid section marker 0x%X\", marker)}\n\t\t}\n\t}\n\treturn image, nil\n}", "func (page ImagePage) IsEmpty() (bool, error) {\n\timages, err := ExtractImages(page)\n\tif err != nil {\n\t\treturn true, err\n\t}\n\treturn len(images) == 0, nil\n}", "func ValidateFileType(bytes []byte) (isValid bool, err error) {\n\tif bytes == nil {\n\t\treturn false, NewError(constant.FileMustBeNotNull)\n\t}\n\tfileType := http.DetectContentType(bytes)\n\tlog.Println(fmt.Sprintf(\"The file type is %s\", fileType))\n\tif fileType != constant.JpgType {\n\t\treturn false, NewError(constant.FileNotPermitted)\n\t}\n\treturn true, nil\n}", "func IsSupportedFileType(fileName string) bool {\n\text := strings.ToLower(filepath.Ext(fileName))\n\t_, exists := supportedFileTypes[ext]\n\n\treturn exists\n}", "func isJSONFile(path string) bool {\n\treturn strings.ToLower(filepath.Ext(path)) == \".json\"\n}", "func isAllowedFileType(mimeType string) bool {\n\t_, exists := validFileTypes[mimeType]\n\n\treturn exists\n}", "func IsFile(path string) bool {\n\tfileInfo, err := os.Stat(path)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\treturn fileInfo.Mode().IsRegular()\n}", "func (ros RealOS) IsRegularFile(p string) bool {\n\tif stat, err := os.Stat(path.Clean(p)); err == nil {\n\t\tif !stat.IsDir() {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func NoFilter(hdr *tar.Header) bool {\n\treturn true\n}", "func (this ActivityStreamsImageProperty) Empty() bool {\n\treturn this.Len() == 0\n}", "func (s *FileStore) removeImageIfItsNotNeeded(name, keepData string) (bool, error) {\n\tlinkFileName := s.linkFileName(name)\n\tswitch _, err := os.Lstat(linkFileName); {\n\tcase err == nil:\n\t\tdest, err := os.Readlink(linkFileName)\n\t\tif err != nil {\n\t\t\treturn false, fmt.Errorf(\"error reading link %q: %v\", linkFileName, err)\n\t\t}\n\t\tdestName := filepath.Base(dest)\n\t\tif destName == keepData {\n\t\t\treturn false, nil\n\t\t}\n\t\tif err := os.Remove(linkFileName); err != nil {\n\t\t\treturn false, fmt.Errorf(\"can't remove %q: %v\", linkFileName, err)\n\t\t}\n\t\treturn true, s.removeIfUnreferenced(destName)\n\tcase os.IsNotExist(err):\n\t\treturn true, nil\n\tdefault:\n\t\treturn false, fmt.Errorf(\"can't stat %q: %v\", linkFileName, err)\n\t}\n}", "func isFile(path string) (bool, error) {\n\tvar err error\n\tvar info os.FileInfo\n\t// run stat on the file and if the it returns no error,\n\t// read the fileInfo to check if its a file or not\n\tif info, err = os.Stat(path); err == nil {\n\t\tif info.Mode().IsRegular() {\n\t\t\treturn true, nil\n\t\t}\n\t}\n\t// stat returned an error and here we are checking if it was os.PathError\n\tif !os.IsNotExist(err) {\n\t\treturn false, nil\n\t}\n\t// after running through all the possible checks, return false and an err\n\treturn false, err\n}", "func isMetadataFile(filename string) bool {\n\treturn strings.HasSuffix(filename, metaFileExt)\n}", "func (v *Validation) IsFormImage(fd *FormData, field string, exts ...string) (ok bool) {\n\tmime := fd.FileMimeType(field)\n\tif mime == \"\" {\n\t\treturn\n\t}\n\n\tvar fileExt string\n\tfor ext, imgMime := range imageMimeTypes {\n\t\tif imgMime == mime {\n\t\t\tfileExt = ext\n\t\t\tok = true\n\t\t\tbreak\n\t\t}\n\t}\n\n\t// don't limit mime type\n\tif len(exts) == 0 {\n\t\treturn ok // only check is an image\n\t}\n\n\treturn Enum(fileExt, exts)\n}", "func isMetadataFile(filename string) bool {\n\treturn metadataMatch.MatchString(filename)\n}", "func IsFile(path string) bool {\n\treturn !IsDir(path)\n}", "func (me TxsdImpactSimpleContentExtensionType) IsUnknown() bool { return me.String() == \"unknown\" }", "func isFile(name string) bool {\n\tinfo, err := os.Stat(name)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn !info.IsDir()\n}", "func isFileExist(filename string) bool {\n\tif _, err := os.Stat(filename); err == nil {\n\t\treturn true\n\t}\n\treturn false\n}", "func FileIsRegular(path string) bool {\n\treturn util.FileIsRegular(path)\n}", "func JPEG(filename string, l Level, text string) error {\n\treturn NewJPEGWriter(l).QRFile(filename, text)\n}", "func (me TxsdNodeRoleSimpleContentExtensionCategory) IsFile() bool { return me.String() == \"file\" }", "func PhotoNotNil() predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.NotNull(s.C(FieldPhoto)))\n\t})\n}", "func nonZeroFileExists(filename string) bool {\n\tinfo, err := os.Stat(filename)\n\tif os.IsNotExist(err) {\n\t\treturn false\n\t}\n\tif info.IsDir() {\n\t\treturn false\n\t}\n\treturn info.Size() > 0\n}", "func isSupportedType(fileName string) bool {\n\tparts := strings.Split(fileName, \".\")\n\textension := parts[len(parts)-1]\n\tsupported := false\n\tif len(parts) > 1 && len(extension) > 0 {\n\t\tfor _, el := range supportedExtensions {\n\t\t\tif extension == el {\n\t\t\t\tsupported = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\treturn supported\n}", "func (ctx *Context) IsUpload() bool {\r\n\treturn strings.Contains(ctx.HeaderParam(HeaderContentType), MIMEMultipartForm)\r\n}", "func PictureNotNil() predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.NotNull(s.C(FieldPicture)))\n\t})\n}", "func (sj *hpscanJob) FixJPEG(w io.Writer, r io.Reader, ActualLineNumber int) (written int64, err error) {\n\ti := 0\n\tbuf := make([]byte, 256)\n\tl, err := r.Read(buf)\n\tif l != len(buf) || (buf[0] != 0xff && buf[1] != 0xd8) {\n\t\treturn 0, errors.New(\"Not a JPEG stream\")\n\t}\n\ti = 2\n\tfor i < len(buf) && buf[i] == 0xff && buf[i+1] != 0xc0 {\n\t\tsize := int(buf[i+2])<<8 + int(buf[i+3]) + 2\n\t\tif size < 0 {\n\t\t\treturn 0, errors.New(\"Frame lengh invalid\")\n\t\t}\n\t\ti += size\n\t}\n\tif i >= len(buf) || (buf[i] != 0xff && buf[i+1] != 0xc0) {\n\t\treturn 0, errors.New(\"SOF marker not found in the header\")\n\t}\n\n\t// Fix line number\n\ti += 5\n\tif buf[i] == 0xff && buf[i+1] == 0xff {\n\t\t// Affected image\n\t\tbuf[i] = byte(ActualLineNumber >> 8)\n\t\tbuf[i+1] = byte(ActualLineNumber & 0x00ff)\n\t}\n\t// Write header\n\tl, err = w.Write(buf)\n\twritten += int64(l) /* jpegfix gets jpeg stream delivered by HP scanner when using ADF\n\tSegment DCT 0xFFC0 has a bad Lines field.\n\n\t*/\n\n\t// stream\n\tif l == len(buf) && err == nil {\n\t\tbuf = make([]byte, 32*1024)\n\t\tfor {\n\t\t\tnr, er := r.Read(buf)\n\t\t\tif nr > 0 {\n\t\t\t\tnw, ew := w.Write(buf[0:nr])\n\t\t\t\tif nw > 0 {\n\t\t\t\t\twritten += int64(nw)\n\t\t\t\t}\n\t\t\t\tif ew != nil {\n\t\t\t\t\terr = ew\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tif nr != nw {\n\t\t\t\t\terr = io.ErrShortWrite\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif er == io.EOF {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif er != nil {\n\t\t\t\terr = er\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\treturn written, err\n}", "func isImage(n *html.Node) bool {\n\treturn n.Type == html.ElementNode && n.Data == \"img\"\n}", "func IsFile(fsPath string) bool {\n if len(fsPath) == 0 {\n return false\n }\n stat, err := os.Stat(fsPath)\n return err == nil && stat.Mode().IsRegular()\n}", "func isMultipartObject(storage StorageAPI, bucket, object string) bool {\n\t_, err := storage.StatFile(bucket, pathJoin(object, multipartMetaFile))\n\tif err != nil {\n\t\tif err == errFileNotFound {\n\t\t\treturn false\n\t\t}\n\t\terrorIf(err, \"Failed to stat file \"+bucket+pathJoin(object, multipartMetaFile))\n\t\treturn false\n\t}\n\treturn true\n}", "func (o *SoftwarerepositoryCategoryMapper) HasImageType() bool {\n\tif o != nil && o.ImageType != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (h ExifHeader) IsValid() bool {\n\treturn h.ByteOrder != nil && h.FirstIfdOffset > 0 && h.FirstIfd != ifds.NullIFD\n}", "func (fu FileURL) IsFileURL() bool {\n\treturn true\n}", "func (e *TypeError) IsNot() bool {\n\treturn e.Obj == nil\n}", "func IsHiddenFile(fileName string) bool {\n\treturn strings.Index(fileName, \".\") == 0\n}", "func (m *SendDocument) IsMultipart() bool {\n\treturn m.File != nil && m.ThumbFile != nil\n}", "func (s *SponsoredWebPage) GetPhotoAsNotEmpty() (*Photo, bool) {\n\tif value, ok := s.GetPhoto(); ok {\n\t\treturn value.AsNotEmpty()\n\t}\n\treturn nil, false\n}", "func needsConversion(mediaType string, compressionType compression.Type) (bool, error) {\n\tswitch compressionType {\n\tcase compression.Uncompressed:\n\t\tif !images.IsLayerType(mediaType) || compression.FromMediaType(mediaType) == compression.Uncompressed {\n\t\t\treturn false, nil\n\t\t}\n\tcase compression.Gzip:\n\t\tif !images.IsLayerType(mediaType) || compression.FromMediaType(mediaType) == compression.Gzip {\n\t\t\treturn false, nil\n\t\t}\n\tcase compression.Zstd:\n\t\tif !images.IsLayerType(mediaType) || compression.FromMediaType(mediaType) == compression.Zstd {\n\t\t\treturn false, nil\n\t\t}\n\tcase compression.EStargz:\n\t\tif !images.IsLayerType(mediaType) {\n\t\t\treturn false, nil\n\t\t}\n\tdefault:\n\t\treturn false, fmt.Errorf(\"unknown compression type during conversion: %q\", compressionType)\n\t}\n\treturn true, nil\n}", "func (o *FileInfoThumbnail) GetMimeOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Mime, true\n}", "func (a *PDFApiService) SaveAsJPEG(ctx _context.Context, pdfSaveAsJpegParameters PdfSaveAsJpegParameters) (PdfSaveAsJpegResponse, *_nethttp.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = _nethttp.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue PdfSaveAsJpegResponse\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/api/pdf/SaveAsJPEG\"\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHTTPContentTypes := []string{\"application/json-patch+json\", \"application/json\", \"text/json\", \"application/_*+json\"}\n\n\t// set Content-Type header\n\tlocalVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)\n\tif localVarHTTPContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHTTPContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHTTPHeaderAccepts := []string{\"text/plain\", \"application/json\", \"text/json\"}\n\n\t// set Accept header\n\tlocalVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)\n\tif localVarHTTPHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHTTPHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = &pdfSaveAsJpegParameters\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\tif localVarHTTPResponse.StatusCode == 200 {\n\t\t\tvar v PdfSaveAsJpegResponse\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}" ]
[ "0.6288124", "0.6275033", "0.58513457", "0.5795136", "0.5696326", "0.5535645", "0.5528806", "0.5335886", "0.53028905", "0.5269344", "0.52500373", "0.5232964", "0.5213771", "0.5205567", "0.52036333", "0.5174562", "0.51682454", "0.5152891", "0.5104604", "0.51032245", "0.50277096", "0.50242126", "0.49881175", "0.49875554", "0.4970902", "0.49569595", "0.4946309", "0.49436882", "0.4942164", "0.49213567", "0.49176604", "0.4912077", "0.49117082", "0.49087065", "0.49085498", "0.49077767", "0.4900354", "0.48809326", "0.48775005", "0.48531356", "0.48471436", "0.48261288", "0.48227885", "0.4818003", "0.48068342", "0.4778451", "0.47588772", "0.47441593", "0.4714432", "0.469999", "0.46934956", "0.46907315", "0.46848136", "0.46805888", "0.46741122", "0.4668887", "0.46664223", "0.46626168", "0.46544507", "0.46371964", "0.4635182", "0.46263993", "0.46219608", "0.46218547", "0.46160257", "0.46144122", "0.46117678", "0.46020517", "0.4589338", "0.4589182", "0.45770139", "0.45736054", "0.45699817", "0.4564097", "0.45634505", "0.4558444", "0.45582688", "0.45455623", "0.45418802", "0.4539887", "0.4536968", "0.4536803", "0.45361614", "0.45291615", "0.45272592", "0.45258814", "0.45230442", "0.4518505", "0.45128292", "0.45098904", "0.45081162", "0.45033026", "0.450112", "0.44993803", "0.44937095", "0.4492439", "0.4489861", "0.44888383", "0.44877657", "0.44700617" ]
0.88416547
0
Links returns all share links for this entity.
func (m *File) Links() Links { return FindLinks("", m.FileUID) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *AggregatedDomain) Links(info *bambou.FetchingInfo) (LinksList, *bambou.Error) {\n\n\tvar list LinksList\n\terr := bambou.CurrentSession().FetchChildren(o, LinkIdentity, &list, info)\n\treturn list, err\n}", "func (s *shares) List() ([]Share, error) {\n\tres, err := s.c.baseRequest(http.MethodGet, routes.shares, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar r sharesListResponse\n\tres.JSON(&r)\n\treturn r.Ocs.Data, nil\n}", "func (s *Series) links() []Link {\n\treturn s.Links\n}", "func (tweetFetcher *TweetFetcher) FetchLinks() ([]core.LinkItem, error) {\n\ttweets, _, err := tweetFetcher.client.Timelines.HomeTimeline(\n\t\t&twitter.HomeTimelineParams{\n\t\t\tCount: SINGLE_FETCH_LIMIT,\n\t\t\tSinceID: tweetFetcher.lastSinceID,\n\t\t\tExcludeReplies: utils.NewBool(true)})\n\n\tif err != nil {\n\t\treturn nil, errors.New(\"Failed fetching new tweets \" +\n\t\t\terr.Error())\n\t}\n\n\turls := make([]core.LinkItem, 0, 20)\n\tfor _, tweet := range tweets {\n\t\ttweetFetcher.lastSinceID = utils.Max(tweetFetcher.lastSinceID,\n\t\t\ttweet.ID)\n\t\tlinks, err := utils.ExtractURLs(tweet.Text)\n\t\tif err == nil {\n\t\t\tfor _, link := range links {\n\t\t\t\turls = append(urls, core.LinkItem{PageURL: link})\n\t\t\t}\n\t\t}\n\t}\n\treturn urls, nil\n}", "func (g *Game) links() []Link {\n\treturn g.Links\n}", "func (*AwsNetworkAclImporter) Links() map[string]string {\n\treturn map[string]string{\n\t\t\"vpc_id\": \"aws_vpc.id\",\n\t\t\"subnet_ids\": \"aws_subnet.id\",\n\t}\n}", "func (*XMLDocument) Links() (links window.HTMLCollection) {\n\tmacro.Rewrite(\"$_.links\")\n\treturn links\n}", "func GetAll() []Link {\n\tstatement, err := database.Db.Prepare(\"select L.id, L.title, L.address, L.UserID, U.Username from Links L inner join Users U on L.UserID = U.ID\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer statement.Close()\n\trows, err := statement.Query()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer rows.Close()\n\tvar links []Link\n\tvar username string\n\tvar id string\n\tfor rows.Next() {\n\t\tvar link Link\n\t\terr := rows.Scan(&link.ID, &link.Title, &link.Address, &id, &username)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tlink.User = &model.User{\n\t\t\tID: id,\n\t\t\tUsername: username,\n\t\t}\n\t\tlinks = append(links, link)\n\t}\n\tif err = rows.Err(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn links\n}", "func (e *Event) Links() []*Link {\n\tlinks := make([]*Link, len(e.links))\n\tcopy(links, e.links)\n\treturn links\n}", "func (g *Graph) Links() []*Link {\n\treturn g.links\n}", "func (s *Single) DirectLinks() *DirectLinks {\n\tdlinks := &DirectLinks{}\n\terr := pop.Q(DB).\n\t\tLeftJoin(\"accounts\", \"accounts.id = direct_links.account_id\").\n\t\tLeftJoin(\"users\", \"accounts.id = users.account_id\").\n\t\tWhere(\"users.single_id = ?\", s.ID).\n\t\tOrder(\"direct_links.created_at desc\").\n\t\tAll(dlinks)\n\tif err != nil {\n\t\tlog.Errorf(\"Err: %v\", err)\n\t\treturn nil\n\t}\n\treturn dlinks\n}", "func (w *CrawlerWorker) GetLinks() []string {\n\tvar links []string\n\tfor link := range w.links {\n\t\tlinks = append(links, link)\n\t}\n\treturn links\n}", "func ListLinks(_ web.C, w http.ResponseWriter, r *http.Request) {\n\taccount := r.Header.Get(\"X-Remote-User\")\n\tfor _, l := range links {\n\t\tif l.Owner == account {\n\t\t\tfmt.Fprintf(w, \"%s\\n\", l.ShortLink)\n\t\t}\n\t}\n}", "func (controller *LinkController) List(w http.ResponseWriter, r *http.Request) {\n\topts := options.NewOptionsFromContext(r.Context())\n\tuser, _ := models.NewUserFromContext(r.Context())\n\n\tlinks, err := controller.linkRepository.FindAllByUserWithContext(r.Context(), *user, *opts)\n\n\tif err != nil {\n\t\tutils.RespondWithError(&w, http.StatusBadRequest, models.NewError(\"Id is not provided\"))\n\t\treturn\n\t}\n\n\tutils.RespondWithJSON(&w, http.StatusOK, links)\n}", "func GetLinks(zone, app, tenant string) []Link {\n\ttenantStr := func() string {\n\t\tif len(tenant) == 0 {\n\t\t\treturn \"\"\n\t\t}\n\t\treturn \"-tenant=\" + tenant\n\t}()\n\toutput := RunCmd(fmt.Sprintf(\"%s api -zone %s -app %s -fetch-links %s\", ActlPath, zone, app, tenantStr))\n\tlistOfLinks := []Link{}\n\tyaml.Unmarshal([]byte(output), &listOfLinks)\n\treturn listOfLinks\n}", "func (lb *Leaderboard) links() []Link {\n\treturn lb.Links\n}", "func (o *Authorization) GetLinks() AuthorizationAllOfLinks {\n\tif o == nil || o.Links == nil {\n\t\tvar ret AuthorizationAllOfLinks\n\t\treturn ret\n\t}\n\treturn *o.Links\n}", "func (r *Repository) GetLinks() []string {\n\treturn getLinks(r.FullDescription)\n}", "func (page *Page) Links() (links []string, err error) {\n\tif err = page.Parse(); err != nil {\n\t\treturn\n\t}\n\tpage.doc.Find(\"a\").Each(func(i int, elem *goquery.Selection) {\n\t\tif href, ok := elem.Attr(\"href\"); ok {\n\t\t\tlinks = append(links, href)\n\t\t}\n\t})\n\treturn\n}", "func (*AwsRoute53RecordImporter) Links() map[string]string {\n\treturn map[string]string{}\n}", "func GetAllLinks(title string, targetAPI *Config) ([]string, error) {\n\treturn fetchLoop(title, targetAPI, nil)\n}", "func (w *WikiPage) GetLinks() []string {\n\treturn w.links\n}", "func (sm *Manager) ListShares(ctx context.Context, filters []*ocm.ListOCMSharesRequest_Filter) ([]*ocm.Share, error) {\n\tbodyStr, err := json.Marshal(filters)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t_, respBody, err := sm.do(ctx, Action{\"ListShares\", string(bodyStr)}, getUsername(ctx))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar respArr []ShareAltMap\n\terr = json.Unmarshal(respBody, &respArr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar pointers = make([]*ocm.Share, len(respArr))\n\tfor i := 0; i < len(respArr); i++ {\n\t\taltResult := respArr[i]\n\t\tpointers[i] = &ocm.Share{\n\t\t\tId: altResult.ID,\n\t\t\tResourceId: altResult.ResourceID,\n\t\t\tPermissions: altResult.Permissions,\n\t\t\tGrantee: &provider.Grantee{\n\t\t\t\tId: altResult.Grantee.ID,\n\t\t\t},\n\t\t\tOwner: altResult.Owner,\n\t\t\tCreator: altResult.Creator,\n\t\t\tCtime: altResult.Ctime,\n\t\t\tMtime: altResult.Mtime,\n\t\t}\n\t}\n\treturn pointers, err\n}", "func GetPublicShareLinkFromHal(json []byte) string {\n\treturn StripTemplateParameter(gjson.Get(string(json), \"_links.publicShare.href\").String())\n}", "func (ms Span) Links() SpanLinkSlice {\n\treturn newSpanLinkSlice(&ms.orig.Links)\n}", "func (r *viewResolver) Links(\n\tctx context.Context, view *models.View, searchString *string, first *int, after *string,\n\tlast *int, before *string,\n) (models.LinkConnection, error) {\n\tmods := view.Filter([]qm.QueryMod{\n\t\tqm.OrderBy(\"created_at desc\"),\n\t\tqm.Limit(pageSizeOrDefault(first)),\n\t\tqm.InnerJoin(\"repositories r on links.repository_id = r.id\"),\n\t})\n\n\tif searchString != nil && *searchString != \"\" {\n\t\tmods = append(mods, qm.Where(\"title ilike '%%' || ? || '%%'\", searchString))\n\t}\n\n\tscope := models.Links(mods...)\n\tconn, err := scope.All(ctx, r.DB)\n\treturn linkConnection(view, conn, err)\n}", "func (ldb *linkdb) Links() ([]*LinkRecord, error) {\n\tldb.device.Lock()\n\tdefer ldb.device.Unlock()\n\terr := ldb.refresh()\n\treturn ldb.links, err\n}", "func (o *ObservedProperty) SetLinks(externalURL string) {\n\to.NavDatastreams = CreateEntityLink(o.Datastreams == nil, externalURL, EntityLinkObservedProperties.ToString(), EntityLinkDatastreams.ToString(), o.ID)\n}", "func (r ResourceGetter) Links(u string) ([]string, error) {\n\tln := make([]string, 0)\n\tresp, err := http.Get(u)\n\tif err != nil {\n\t\treturn ln, err\n\t}\n\tif http.StatusOK != resp.StatusCode {\n\t\treturn ln, errors.New(\"non-200 HTTP status code\")\n\t}\n\tb, err := ioutil.ReadAll(resp.Body)\n\tdefer resp.Body.Close()\n\tif err != nil {\n\t\treturn ln, err\n\t}\n\tpu, err := url.ParseRequestURI(u)\n\tif err != nil {\n\t\treturn ln, err\n\t}\n\treturn r.ParseFunc(pu.Host, string(b)), nil\n}", "func (f *file) Links() []string {\n return nil // no links.\n}", "func FetchLinks(config LinkConfig) []string {\n\n\tval := struct{}{}\n\tidx := cmap.New()\n\tprinter := NewPrinter(config)\n\tidx.SetIfAbsent(config.Host, val)\n\tc := colly.NewCollector()\n\t// Find and visit all links\n\tc.OnHTML(\"a[href]\", func(e *colly.HTMLElement) {\n\t\turl := e.Attr(\"href\")\n\n\t\tif config.IsInHost(url) && !config.IsFile(url) && !idx.Has(url) {\n\t\t\tidx.SetIfAbsent(url, val)\n\t\t\te.Request.Visit(url)\n\t\t}\n\t})\n\n\tc.OnRequest(func(r *colly.Request) {\n\t\turl := r.URL.String()\n\t\tprinter.queue <- url\n\t})\n\n\tc.Visit(config.Host)\n\n\treturn printer.Start()\n}", "func MatchLinks() []string {\n\n\tdocument := getDocument(\"https://hltv.org/results?content=stats&stars=1\")\n\n\tlinks := make([]string, 0, 100)\n\n\tdocument.Find(\".result-con a\").Each(func(index int, element *goquery.Selection) {\n\t\thref, exists := element.Attr(\"href\")\n\t\tif exists {\n\t\t\tlinks = append(links, \"https://hltv.org\"+href)\n\t\t}\n\t})\n\n\treturn links\n}", "func (s *InMemoryGraph) Links(fromID, toID uuid.UUID, retrievedBefore time.Time) (graph.LinkIterator, error) {\n\tfrom, to := fromID.String(), toID.String()\n\n\ts.mu.RLock()\n\tvar list []*graph.Link\n\tfor linkID, link := range s.links {\n\t\tif id := linkID.String(); id >= from && id < to && link.RetrievedAt.Before(retrievedBefore) {\n\t\t\tlist = append(list, link)\n\t\t}\n\t}\n\ts.mu.RUnlock()\n\n\treturn &linkIterator{s: s, links: list}, nil\n}", "func (m *Manager) ListShares(ctx context.Context, filters []*collaboration.Filter) ([]*collaboration.Share, error) {\n\tif err := m.initialize(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tuser, ok := ctxpkg.ContextGetUser(ctx)\n\tif !ok {\n\t\treturn nil, errtypes.UserRequired(\"error getting user from context\")\n\t}\n\tvar rIDs []*provider.ResourceId\n\tif len(filters) != 0 {\n\t\tgrouped := share.GroupFiltersByType(filters)\n\t\tfor _, g := range grouped {\n\t\t\tfor _, f := range g {\n\t\t\t\tif f.GetResourceId() != nil {\n\t\t\t\t\trIDs = append(rIDs, f.GetResourceId())\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tvar (\n\t\tcreatedShareIds []string\n\t\terr error\n\t)\n\t// in spaces, always use the resourceId\n\t// We could have more than one resourceID\n\t// which would form a logical OR\n\tif len(rIDs) != 0 {\n\t\tfor _, rID := range rIDs {\n\t\t\tshareIDs, err := m.indexer.FindBy(&collaboration.Share{},\n\t\t\t\tindexer.NewField(\"ResourceId\", resourceIDToIndex(rID)),\n\t\t\t)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tcreatedShareIds = append(createdShareIds, shareIDs...)\n\t\t}\n\t} else {\n\t\tcreatedShareIds, err = m.indexer.FindBy(&collaboration.Share{},\n\t\t\tindexer.NewField(\"OwnerId\", userIDToIndex(user.Id)),\n\t\t\tindexer.NewField(\"CreatorId\", userIDToIndex(user.Id)),\n\t\t)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// We use shareMem as a temporary lookup store to check which shares were\n\t// already added. This is to prevent duplicates.\n\tshareMem := make(map[string]struct{})\n\tresult := []*collaboration.Share{}\n\tfor _, id := range createdShareIds {\n\t\ts, err := m.getShareByID(ctx, id)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif share.MatchesFilters(s, filters) {\n\t\t\tresult = append(result, s)\n\t\t\tshareMem[s.Id.OpaqueId] = struct{}{}\n\t\t}\n\t}\n\n\t// If a user requests to list shares which have not been created by them\n\t// we have to explicitly fetch these shares and check if the user is\n\t// allowed to list the shares.\n\t// Only then can we add these shares to the result.\n\tgrouped := share.GroupFiltersByType(filters)\n\tidFilter, ok := grouped[collaboration.Filter_TYPE_RESOURCE_ID]\n\tif !ok {\n\t\treturn result, nil\n\t}\n\n\tshareIDsByResourceID := make(map[string]*provider.ResourceId)\n\tfor _, filter := range idFilter {\n\t\tresourceID := filter.GetResourceId()\n\t\tshareIDs, err := m.indexer.FindBy(&collaboration.Share{},\n\t\t\tindexer.NewField(\"ResourceId\", resourceIDToIndex(resourceID)),\n\t\t)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, shareID := range shareIDs {\n\t\t\tshareIDsByResourceID[shareID] = resourceID\n\t\t}\n\t}\n\n\t// statMem is used as a local cache to prevent statting resources which\n\t// already have been checked.\n\tstatMem := make(map[string]struct{})\n\tfor shareID, resourceID := range shareIDsByResourceID {\n\t\tif _, handled := shareMem[shareID]; handled {\n\t\t\t// We don't want to add a share multiple times when we added it\n\t\t\t// already.\n\t\t\tcontinue\n\t\t}\n\n\t\tif _, checked := statMem[resourceIDToIndex(resourceID)]; !checked {\n\t\t\tsReq := &provider.StatRequest{\n\t\t\t\tRef: &provider.Reference{ResourceId: resourceID},\n\t\t\t}\n\t\t\tsRes, err := m.gatewayClient.Stat(ctx, sReq)\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif sRes.Status.Code != rpcv1beta1.Code_CODE_OK {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif !sRes.Info.PermissionSet.ListGrants {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tstatMem[resourceIDToIndex(resourceID)] = struct{}{}\n\t\t}\n\n\t\ts, err := m.getShareByID(ctx, shareID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif share.MatchesFilters(s, filters) {\n\t\t\tresult = append(result, s)\n\t\t\tshareMem[s.Id.OpaqueId] = struct{}{}\n\t\t}\n\t}\n\n\treturn result, nil\n}", "func GetLinks(body string, host string) ([]string, error) {\n\tvar links []string\n\tresult := linkTagRegex.FindAllStringSubmatch(body, -1)\n\n\tfor _, tag := range result {\n\t\turl, err := ValidateURL(tag[1], host)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif url != nil {\n\t\t\tlinks = append(links, url.String())\n\t\t}\n\t}\n\n\tlinks = Deduplicate(links)\n\n\treturn links, nil\n}", "func (routing *DemoDeviceStreamRouting) HTMLLinks() (links []gin.H) {\n\treturn []gin.H{\n\t\tgin.H{\n\t\t\t\"Name\": \"laptop\",\n\t\t\t\"FontAwesomeClass\": \"fa-laptop\",\n\t\t\t\"RawImageURL\": \"/demo/images/raw-drnic-laptop.png\",\n\t\t\t\"ObjectDetectorImageURL\": \"/demo/images/objectdetector-drnic-laptop.png\",\n\t\t\t\"EdgeDetectorImageURL\": \"/demo/images/edgedetector-drnic-laptop.png\",\n\t\t},\n\t\tgin.H{\n\t\t\t\"Name\": \"raspberrypi\",\n\t\t\t\"FontAwesomeClass\": \"fa-camera-retro\",\n\t\t\t\"RawImageURL\": \"/demo/images/raw-drnic-pi.png\",\n\t\t\t\"ObjectDetectorImageURL\": \"/demo/images/objectdetector-drnic-pi.png\",\n\t\t\t\"EdgeDetectorImageURL\": \"/demo/images/edgedetector-drnic-pi.png\",\n\t\t},\n\t}\n}", "func (web *Web) Links(url string) []string {\n\n\t// Get page content\n\tresp, err := http.Get(url)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn []string{}\n\t}\n\tdefer resp.Body.Close()\n\n\t// Return all links for web page\n\treturn web.getLinks(resp.Body)\n}", "func (c *StorageClient) SnapLinks() *SnapLinksClient {\n\treturn &SnapLinksClient{c.Client}\n}", "func (sm *Manager) ListShares(ctx context.Context, user *userpb.User, filters []*ocm.ListOCMSharesRequest_Filter) ([]*ocm.Share, error) {\n\tdata, err := json.Marshal(filters)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t_, respBody, err := sm.do(ctx, Action{\"ListShares\", string(data)}, getUsername(user))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar respArr []ShareAltMap\n\tif err := json.Unmarshal(respBody, &respArr); err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar lst = make([]*ocm.Share, 0, len(respArr))\n\tfor _, altResult := range respArr {\n\t\tlst = append(lst, &ocm.Share{\n\t\t\tId: altResult.ID,\n\t\t\tGrantee: &provider.Grantee{\n\t\t\t\tId: altResult.Grantee.ID,\n\t\t\t},\n\t\t\tOwner: altResult.Owner,\n\t\t\tCreator: altResult.Creator,\n\t\t\tCtime: altResult.Ctime,\n\t\t\tMtime: altResult.Mtime,\n\t\t})\n\t}\n\treturn lst, nil\n}", "func (c *Client) ListPlayShare() ([]*PlayShare, error) {\n\tresp, err := c.Get(aqbOrigin + \"/aqb/blog/post/webdav/index.php?format=json\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tb, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar psl playShareResponse\n\tif err := json.Unmarshal(b, &psl); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif !psl.IsSuccess {\n\t\treturn nil, fmt.Errorf(\"server returns error: %s\", psl.Message)\n\t}\n\n\treturn psl.List, nil\n}", "func (o *PolicyItemsPage) GetLinks() []Link {\n\tif o == nil || o.Links == nil {\n\t\tvar ret []Link\n\t\treturn ret\n\t}\n\treturn *o.Links\n}", "func (o *Block) GetSymlinks(ctx context.Context) (symlinks [][]byte, err error) {\n\terr = o.object.CallWithContext(ctx, \"org.freedesktop.DBus.Properties.Get\", 0, InterfaceBlock, \"Symlinks\").Store(&symlinks)\n\treturn\n}", "func (m *settings) getLinks(w http.ResponseWriter, r *http.Request) {\n\tvar s string\n\tfor _, v := range m.redirects {\n\t\ts += fmt.Sprintf(\"Shortname: %s -> Url: %s Count %d <BR>\", v.Shortname, v.Url, v.Requests)\n\t}\n\tsendHtml(w, s)\n}", "func getAndShowLinks(htmlTag string, page *html.Node, allLinks *[]string) (links[] string) {\n\tlinks = getLinks(htmlTag, page, links)\n\t*allLinks = append(*allLinks, links...)\n\treturn links\n}", "func GetLinks() []string {\n\tvar urls []string\n\n\t//Fetch the -urls flag from console\n\tcmdUrlsString := flag.String(\"urls\", \"\", \"a string\")\n\tflag.Parse()\n\n\t//Split comma separated string of urls into slice of urls.\n\tcmdUrls := strings.Split(*cmdUrlsString, \",\")\n\n\t//Merge the urls from config with the urls from command flag.\n\turls = append(urls, Settings.GetStringSlice(\"urls\")...)\n\turls = append(urls, cmdUrls...)\n\n\treturn urls\n}", "func (*AwsIamAccountPasswordPolicyImporter) Links() map[string]string {\n\treturn map[string]string{}\n}", "func aliasLinks(e *osv.Entry) []link {\n\tvar links []link\n\tfor _, a := range e.Aliases {\n\t\tprefix, _, _ := strings.Cut(a, \"-\")\n\t\tswitch prefix {\n\t\tcase \"CVE\":\n\t\t\tlinks = append(links, link{Body: a, Href: mitreAdvisoryUrlPrefix + a})\n\t\tcase \"GHSA\":\n\t\t\tlinks = append(links, link{Body: a, Href: githubAdvisoryUrlPrefix + a})\n\t\tdefault:\n\t\t\tlinks = append(links, link{Body: a})\n\t\t}\n\t}\n\treturn links\n}", "func GetLinks(body, host, scheme string) (urls []string) {\n\tmatched := linkExp.FindAllStringSubmatch(body, -1)\n\n\tfor _, one := range matched {\n\t\tnewURL := one[2]\n\t\tu, err := urlUtil.Parse(newURL)\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t\tif u.Host == \"\" {\n\t\t\tnewURL = host + newURL\n\t\t}\n\n\t\tif u.Scheme == \"\" {\n\t\t\tnewURL = scheme + \"://\" + newURL\n\t\t}\n\t\turls = append(urls, newURL)\n\t}\n\treturn\n}", "func (o *Bitlinks) GetLinks() []BitlinkBody {\n\tif o == nil || o.Links == nil {\n\t\tvar ret []BitlinkBody\n\t\treturn ret\n\t}\n\treturn *o.Links\n}", "func (o *VmRestorePoint) GetLinks() []Link {\n\tif o == nil || o.Links == nil {\n\t\tvar ret []Link\n\t\treturn ret\n\t}\n\treturn *o.Links\n}", "func (lr *FakeLinkRepo) List(ctx context.Context, limit, skip int) ([]shortener.Link, error) {\n\tlr.ListCalled = true\n\treturn lr.ListFn(ctx, limit, skip)\n}", "func (o *DeployKey) GetLinks() BranchingModelSettingsLinks {\n\tif o == nil || o.Links == nil {\n\t\tvar ret BranchingModelSettingsLinks\n\t\treturn ret\n\t}\n\treturn *o.Links\n}", "func (d *DataCollector) FindAllLinks(url string) error {\n\tresp, err := http.Get(url)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer resp.Body.Close()\n\tbody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tb := string(body)\n\tregex := regexp.MustCompile(`href=\".*\"`)\n\t//regex := regexp.MustCompile(`<a href=\".*\">`)\n\tstrs := regex.FindAllString(b, -1)\n\n\tvar out []byte\n\n\tfor i := 0; i < len(strs); i++ {\n\t\tout = append(out, []byte(fmt.Sprintf(\"%s\\n\", strs[i]))...)\n\t}\n\n\td.Output(out)\n\treturn nil\n}", "func LinksFrom(titles []string) chan Links {\n return allLinks(\"pl\", \"links\", titles)\n}", "func (s *DataStore) ListShareManagers() (map[string]*longhorn.ShareManager, error) {\n\titemMap := map[string]*longhorn.ShareManager{}\n\n\tlist, err := s.smLister.ShareManagers(s.namespace).List(labels.Everything())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, itemRO := range list {\n\t\t// Cannot use cached object from lister\n\t\titemMap[itemRO.Name] = itemRO.DeepCopy()\n\t}\n\treturn itemMap, nil\n}", "func GetLinks(ctx context.Context, client dynamic.Interface) ([]Link, error) {\n\tlist, err := client.Resource(LinkGVR).List(ctx, metav1.ListOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlinks := []Link{}\n\terrs := []string{}\n\tfor _, u := range list.Items {\n\t\tlink, err := NewLink(u)\n\t\tif err != nil {\n\t\t\terrs = append(errs, fmt.Sprintf(\"failed to parse Link %s: %s\", u.GetName(), err))\n\t\t} else {\n\t\t\tlinks = append(links, link)\n\t\t}\n\t}\n\tif len(errs) > 0 {\n\t\treturn nil, errors.New(strings.Join(errs, \"\\n\"))\n\t}\n\treturn links, nil\n}", "func (*AwsSnsTopicSubscriptionImporter) Links() map[string]string {\n\treturn map[string]string{\n\t\t\"topic_arn\": \"aws_sns_topic.arn\",\n\t\t\"endpoint\": \"aws_sqs_queue.arn\",\n\t}\n}", "func (p *Post) SetLinks(ctx context.Context) {\n\tbaseURL := ctx.Value(APIConfigKey).(APIConfig).APIBaseURL\n\tlinks := RestLink{}\n\n\tidStr := strconv.FormatUint(p.ID, 10)\n\n\turl := NewLinkURL(baseURL, p.Type)\n\n\tlinks.Collection = append(links.Collection, HrefMap(url.Collection()))\n\n\tlinks.SelfLink = append(links.SelfLink, HrefMap(url.Self(idStr)))\n\n\tlinks.About = append(links.About, HrefMap(url.About()))\n\n\tlinks.Author = append(links.Author, GetEmbeddableLink(url.Author(p.Author)))\n\n\tlinks.Replies = append(links.Replies, GetEmbeddableLink(url.Replies(idStr)))\n\n\tif p.FeaturedMedia != 0 {\n\t\tlinks.FeaturedMedia = append(links.FeaturedMedia, GetEmbeddableLink(url.FeaturedMedia(p.FeaturedMedia)))\n\t}\n\n\tlinks.VersionHistory = append(links.VersionHistory, HrefMap(url.Revisions(idStr)))\n\n\tlinks.Attachment = append(links.Attachment, HrefMap(url.Attachment(idStr)))\n\n\tlinks.Curies = append(links.Curies, &Curie{Name: \"wp\", Href: url.Curies(), Templated: true})\n\n\tif p.Type == PostType {\n\t\tlinks.Term = append(links.Term, TermPost{Href: url.Categories(idStr), Embeddable: true, Taxonomy: TagType})\n\t\tlinks.Term = append(links.Term, TermPost{Href: url.Tags(idStr), Embeddable: true, Taxonomy: CategoryType})\n\t}\n\n\tp.Links = links\n}", "func (b *Bucket) RemoteLinks(ctx context.Context, pth string) (links Links, err error) {\n\tif b.links != nil {\n\t\treturn *b.links, nil\n\t}\n\tctx, err = b.Context(ctx)\n\tif err != nil {\n\t\treturn\n\t}\n\tres, err := b.clients.Buckets.Links(ctx, b.Key(), pth)\n\tif err != nil {\n\t\treturn\n\t}\n\tlinks = Links{URL: res.Url, WWW: res.Www, IPNS: res.Ipns}\n\tb.links = &links\n\treturn links, err\n}", "func hrefs(r io.Reader, base *url.URL) []string {\n\tlinks, _ := link.Parse(r)\n\tvar ret []string\n\tfor _, link := range links {\n\t\tparsedURL, err := url.Parse(link.Href)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tparsedURL.RawQuery = \"\" // strip query string to prevent multiple variations of same URL\n\t\tparsedURL.Fragment = \"\"\n\t\tresolvedLink := base.ResolveReference(parsedURL)\n\t\tret = append(ret, resolvedLink.String())\n\t}\n\treturn ret\n}", "func hrefs(r io.Reader, baseURL string) (res []string) {\n\tlinks, _ := link.Parse(r)\n\tfor _, l := range links {\n\t\tswitch {\n\t\tcase strings.HasPrefix(l.Href, \"/\"):\n\t\t\tres = append(res, baseURL+l.Href)\n\t\tcase strings.HasPrefix(l.Href, \"http\"):\n\t\t\tres = append(res, l.Href)\n\t\t}\n\t}\n\treturn\n}", "func (h *Howdoi) getLinks() ([]string, error) {\n\treq := fmt.Sprintf(requestURL, \"stackoverflow.com\", h.Question)\n\tdoc, err := goquery.NewDocument(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresult := doc.Find(\".l\")\n\tif len(result.Nodes) == 0 {\n\t\tresult = doc.Find(\".r a\")\n\t\tif len(result.Nodes) == 0 {\n\t\t\tfmt.Println(noAnswerFound)\n\t\t\tos.Exit(0)\n\t\t}\n\t}\n\tlinks := []string{}\n\n\tresult.Each(func(i int, s *goquery.Selection) {\n\t\tlink, _ := s.Attr(\"href\")\n\t\tparsed, err := url.Parse(link)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"ERROR on Link\", link)\n\t\t\treturn\n\t\t}\n\t\tquery := parsed.Query()\n\t\tlink = query[\"q\"][0]\n\n\t\tif strings.Contains(link, \"question\") {\n\t\t\t// adding only the questions links\n\t\t\tlinks = append(links, link)\n\t\t}\n\t})\n\treturn links, nil\n}", "func (c *Crawler) generateLinksFrom() {\n\tfor _, page := range c.SiteMap {\n\t\tfor _, l := range page.Links {\n\t\t\tc.SiteMap[l.URL.Path].appendLinkedFrom(link{\n\t\t\t\tURL: page.URL,\n\t\t\t})\n\t\t}\n\t}\n}", "func ReadAllLinks(filter ...string) []*LinkObj {\n\tLog.Warnln(filter)\n\tdb := GetDbConnection(\"sqlite3\", \"bot.db\")\n\tdefer db.Close()\n\t// rows, er := db.Queryx(\"select * from link_store\")\n\tlinks := []*LinkObj{}\n\tvar er error\n\tif len(filter) == 0 {\n\t\ter = db.Select(&links, \"select * from link_store\")\n\t} else {\n\t\ter = db.Select(&links, \"select * from link_store where descrip like $1\", \"%\"+filter[0]+\"%\")\n\t}\n\n\tif er != nil {\n\t\tLog.Errorln(errors.Wrap(er, \"Unable to fetch link_store\"))\n\t}\n\tLog.Warnln(links)\n\tfor _, link := range links {\n\t\tLog.Infoln(link.Username)\n\t\tLog.Infoln(link.Descrip)\n\t\tLog.Infoln(link.Link)\n\t\tLog.Infoln(link.ID)\n\t}\n\treturn links\n}", "func (hl *HtmlLinks) linksGet(n *html.Node, url string) {\n\tvar link string\n\n\tif n.Type == html.ElementNode && n.Data == \"a\" {\n\t\tfor _, a := range n.Attr {\n\t\t\tif a.Key == \"href\" {\n\t\t\t\tif strings.HasPrefix(a.Val, \"http://\") {\n\t\t\t\t\tlink = a.Val\n\t\t\t\t} else {\n\t\t\t\t\tlink = path.Join(url, a.Val)\n\t\t\t\t}\n\t\t\t\n\t\t\t\thl.links = append(hl.links, link)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\tfor c := n.FirstChild; c != nil; c = c.NextSibling {\n\t\thl.linksGet(c, url)\n\t}\n}", "func (o *Authorization) SetLinks(v AuthorizationAllOfLinks) {\n\to.Links = &v\n}", "func (p *Page) PopulateLinks() {\n\tp.Init()\n\n\trec := p.Embedded.Records\n\n\t//verify paging params\n\tvar selfUrl sUrl.URL\n\tif p.FullURL != nil {\n\t\tselfUrl = sUrl.URL(*p.FullURL).\n\t\t\tSetParam(\"cursor\", p.Cursor).\n\t\t\tSetParam(\"order\", p.Order).\n\t\t\tSetParam(\"limit\", strconv.FormatInt(int64(p.Limit), 10))\n\t}\n\n\t//self: re-encode existing query params\n\tp.Links.Self = NewLink(selfUrl.String())\n\n\t//next: update cursor to last record (if any)\n\tnextUrl := selfUrl\n\tif len(rec) > 0 {\n\t\tnextUrl = nextUrl.SetParam(\"cursor\", rec[len(rec)-1].PagingToken())\n\t}\n\tp.Links.Next = NewLink(nextUrl.String())\n\n\t//prev: inverse order and update cursor to first record (if any)\n\tprevUrl := selfUrl.SetParam(\"order\", p.InvertedOrder())\n\tif len(rec) > 0 {\n\t\tprevUrl = prevUrl.SetParam(\"cursor\", rec[0].PagingToken())\n\t}\n\tp.Links.Prev = NewLink(prevUrl.String())\n}", "func (o *Tasks) GetLinks() Links {\n\tif o == nil || o.Links == nil {\n\t\tvar ret Links\n\t\treturn ret\n\t}\n\treturn *o.Links\n}", "func (c *Client) GetShares(path string) (shares []client.Share, err error) {\n\tvar ret []internal.Share\n\terr = c.server.Call(\"showShares\", &ret, path, c.session)\n\tif err != nil {\n\t\treturn nil, client.MakeFatalError(err)\n\t}\n\tif ret == nil {\n\t\treturn nil, errors.New(\"No sharees\")\n\t}\n\tvar ret2 []client.Share\n\tfor _,element := range ret {\n\t\tret2 = append(ret2, element)\n\t}\n\treturn ret2, nil\n}", "func ShareLists(hrcSrvShare unsafe.Pointer, hrcSrvSource unsafe.Pointer) unsafe.Pointer {\n\tret, _, _ := syscall.Syscall(gpShareLists, 2, uintptr(hrcSrvShare), uintptr(hrcSrvSource), 0)\n\treturn (unsafe.Pointer)(ret)\n}", "func (i *IpldRawNode) Links() []*node.Link {\n\treturn nil\n}", "func (p *Parser) GetLinks(htm string) ([]string, error) {\n\tcleanedHtm := strings.NewReader(p.trimDocument(htm))\n\thtmlTree, err := html.Parse(cleanedHtm)\n\tlinks := make(map[string]bool)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar crawl func(node *html.Node)\n\tcrawl = func(node *html.Node) {\n\t\tif node.Type == html.ElementNode && node.Data == \"a\" {\n\t\t\tattributes := node.Attr\n\t\t\tfor _, attr := range attributes {\n\t\t\t\tif attr.Key == \"href\" {\n\t\t\t\t\tlinks[attr.Val] = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor child := node.FirstChild; child != nil; child = child.NextSibling {\n\t\t\tcrawl(child)\n\t\t}\n\t}\n\n\tcrawl(htmlTree)\n\n\tkeys := make([]string, 0, len(links))\n\tfor key := range links {\n\t\tkeys = append(keys, key)\n\t}\n\n\tkeys = p.prependDomainToLinks(p.removeExcludedLinks(p.filterPatternLinks(keys)))\n\treturn keys, nil\n}", "func (cli *Client) PeopleShare(data map[string]interface{}) (r map[string]interface{}, e error) {\n\tr, e = cli.call(\"POST\", \"people\", \"\", \"/shares\", data)\n\treturn r, e\n}", "func (c Container) Links() []string {\n\tvar links []string\n\n\tdependsOnLabelValue := c.getLabelValueOrEmpty(dependsOnLabel)\n\n\tif dependsOnLabelValue != \"\" {\n\t\tfor _, link := range strings.Split(dependsOnLabelValue, \",\") {\n\t\t\t// Since the container names need to start with '/', let's prepend it if it's missing\n\t\t\tif !strings.HasPrefix(link, \"/\") {\n\t\t\t\tlink = \"/\" + link\n\t\t\t}\n\t\t\tlinks = append(links, link)\n\t\t}\n\n\t\treturn links\n\t}\n\n\tif (c.containerInfo != nil) && (c.containerInfo.HostConfig != nil) {\n\t\tfor _, link := range c.containerInfo.HostConfig.Links {\n\t\t\tname := strings.Split(link, \":\")[0]\n\t\t\tlinks = append(links, name)\n\t\t}\n\n\t\t// If the container uses another container for networking, it can be considered an implicit link\n\t\t// since the container would stop working if the network supplier were to be recreated\n\t\tnetworkMode := c.containerInfo.HostConfig.NetworkMode\n\t\tif networkMode.IsContainer() {\n\t\t\tlinks = append(links, networkMode.ConnectedContainer())\n\t\t}\n\t}\n\n\treturn links\n}", "func (m *Printer) GetShares()([]PrinterShareable) {\n val, err := m.GetBackingStore().Get(\"shares\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]PrinterShareable)\n }\n return nil\n}", "func (o *Operation) PopulateLinks() error {\n\tvar tmpLink Link\n\tvar description sql.NullString\n\n\trows, err := db.Query(\"SELECT ID, fromPortalID, toPortalID, description FROM link WHERE opID = ?\", o.ID)\n\tif err != nil {\n\t\tLog.Error(err)\n\t\treturn err\n\t}\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\terr := rows.Scan(&tmpLink.ID, &tmpLink.From, &tmpLink.To, &description)\n\t\tif err != nil {\n\t\t\tLog.Error(err)\n\t\t\tcontinue\n\t\t}\n\t\tif description.Valid {\n\t\t\ttmpLink.Desc = description.String\n\t\t} else {\n\t\t\ttmpLink.Desc = \"\"\n\t\t}\n\t\to.Links = append(o.Links, tmpLink)\n\t}\n\treturn nil\n}", "func (sm *Manager) ListReceivedShares(ctx context.Context) ([]*ocm.ReceivedShare, error) {\n\t_, respBody, err := sm.do(ctx, Action{\"ListReceivedShares\", string(\"\")}, getUsername(ctx))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar respArr []ReceivedShareAltMap\n\terr = json.Unmarshal(respBody, &respArr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar pointers = make([]*ocm.ReceivedShare, len(respArr))\n\tfor i := 0; i < len(respArr); i++ {\n\t\taltResultShare := respArr[i].Share\n\t\tif altResultShare == nil {\n\t\t\tpointers[i] = &ocm.ReceivedShare{\n\t\t\t\tShare: nil,\n\t\t\t\tState: respArr[i].State,\n\t\t\t}\n\t\t} else {\n\t\t\tpointers[i] = &ocm.ReceivedShare{\n\t\t\t\tShare: &ocm.Share{\n\t\t\t\t\tId: altResultShare.ID,\n\t\t\t\t\tResourceId: altResultShare.ResourceID,\n\t\t\t\t\tPermissions: altResultShare.Permissions,\n\t\t\t\t\tGrantee: &provider.Grantee{\n\t\t\t\t\t\tId: altResultShare.Grantee.ID,\n\t\t\t\t\t},\n\t\t\t\t\tOwner: altResultShare.Owner,\n\t\t\t\t\tCreator: altResultShare.Creator,\n\t\t\t\t\tCtime: altResultShare.Ctime,\n\t\t\t\t\tMtime: altResultShare.Mtime,\n\t\t\t\t},\n\t\t\t\tState: respArr[i].State,\n\t\t\t}\n\t\t}\n\t}\n\treturn pointers, err\n\n}", "func (o *Run) GetLinks() RunLinks {\n\tif o == nil || o.Links == nil {\n\t\tvar ret RunLinks\n\t\treturn ret\n\t}\n\treturn *o.Links\n}", "func (m *Manager) ListReceivedShares(ctx context.Context, filters []*collaboration.Filter) ([]*collaboration.ReceivedShare, error) {\n\tif err := m.initialize(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tuser, ok := ctxpkg.ContextGetUser(ctx)\n\tif !ok {\n\t\treturn nil, errtypes.UserRequired(\"error getting user from context\")\n\t}\n\n\tresult := []*collaboration.ReceivedShare{}\n\n\tids, err := granteeToIndex(&provider.Grantee{\n\t\tType: provider.GranteeType_GRANTEE_TYPE_USER,\n\t\tId: &provider.Grantee_UserId{UserId: user.Id},\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treceivedIds, err := m.indexer.FindBy(&collaboration.Share{},\n\t\tindexer.NewField(\"GranteeId\", ids),\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, group := range user.Groups {\n\t\tindex, err := granteeToIndex(&provider.Grantee{\n\t\t\tType: provider.GranteeType_GRANTEE_TYPE_GROUP,\n\t\t\tId: &provider.Grantee_GroupId{GroupId: &groupv1beta1.GroupId{OpaqueId: group}},\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tgroupIds, err := m.indexer.FindBy(&collaboration.Share{},\n\t\t\tindexer.NewField(\"GranteeId\", index),\n\t\t)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treceivedIds = append(receivedIds, groupIds...)\n\t}\n\n\tfor _, id := range receivedIds {\n\t\ts, err := m.getShareByID(ctx, id)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif !share.MatchesFilters(s, filters) {\n\t\t\tcontinue\n\t\t}\n\t\tmetadata, err := m.downloadMetadata(ctx, s)\n\t\tif err != nil {\n\t\t\tif _, ok := err.(errtypes.NotFound); !ok {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\t// use default values if the grantee didn't configure anything yet\n\t\t\tmetadata = ReceivedShareMetadata{\n\t\t\t\tState: collaboration.ShareState_SHARE_STATE_PENDING,\n\t\t\t}\n\t\t}\n\t\tresult = append(result, &collaboration.ReceivedShare{\n\t\t\tShare: s,\n\t\t\tState: metadata.State,\n\t\t\tMountPoint: metadata.MountPoint,\n\t\t})\n\t}\n\treturn result, nil\n}", "func (p *Page) PopulateLinks() {\n\tp.Init()\n\tfmts := p.BasePath + \"?order=%s&limit=%d&cursor=%s\"\n\tlb := LinkBuilder{p.BaseURL}\n\n\tp.Links.Self = lb.Linkf(fmts, p.Order, p.Limit, p.Cursor)\n\trec := p.Embedded.Records\n\n\tif len(rec) > 0 {\n\t\tp.Links.Next = lb.Linkf(fmts, p.Order, p.Limit, rec[len(rec)-1].PagingToken())\n\t\tp.Links.Prev = lb.Linkf(fmts, p.InvertedOrder(), p.Limit, rec[0].PagingToken())\n\t} else {\n\t\tp.Links.Next = lb.Linkf(fmts, p.Order, p.Limit, p.Cursor)\n\t\tp.Links.Prev = lb.Linkf(fmts, p.InvertedOrder(), p.Limit, p.Cursor)\n\t}\n}", "func linkMentionsAndHashtags(htmlText template.HTML, mentionsUsername, hashtags []string) template.HTML {\n\n\ttext := string(htmlText)\n\tfor _, tag := range mentionsUsername {\n\t\ttext = strings.Replace(text, \"@\"+tag, \"<a class='mention-link' href='/user/\"+tag+\"'>@\"+tag+\"</a>\", -1)\n\t}\n\n\tfor _, tag := range hashtags {\n\t\ttext = strings.Replace(text, \"#\"+tag, \"<a class='hashtag-link' href='/search?tag=\"+tag+\"'>#\"+tag+\"</a>\", -1)\n\t}\n\n\treturn template.HTML(text)\n}", "func TestList(t *testing.T) {\n\tth.SetupHTTP()\n\tdefer th.TeardownHTTP()\n\n\tMockListResponse(t)\n\n\tallPages, err := sharetypes.List(client.ServiceClient(), &sharetypes.ListOpts{}).AllPages()\n\tth.AssertNoErr(t, err)\n\tactual, err := sharetypes.ExtractShareTypes(allPages)\n\tth.AssertNoErr(t, err)\n\texpected := []sharetypes.ShareType{\n\t\t{\n\t\t\tID: \"be27425c-f807-4500-a056-d00721db45cf\",\n\t\t\tName: \"default\",\n\t\t\tIsPublic: true,\n\t\t\tExtraSpecs: map[string]interface{}{\"snapshot_support\": \"True\", \"driver_handles_share_servers\": \"True\"},\n\t\t\tRequiredExtraSpecs: map[string]interface{}{\"driver_handles_share_servers\": \"True\"},\n\t\t},\n\t\t{\n\t\t\tID: \"f015bebe-c38b-4c49-8832-00143b10253b\",\n\t\t\tName: \"d\",\n\t\t\tIsPublic: true,\n\t\t\tExtraSpecs: map[string]interface{}{\"driver_handles_share_servers\": \"false\", \"snapshot_support\": \"True\"},\n\t\t\tRequiredExtraSpecs: map[string]interface{}{\"driver_handles_share_servers\": \"false\"},\n\t\t},\n\t}\n\n\tth.CheckDeepEquals(t, expected, actual)\n}", "func (lr *FakeLinkDao) List(ctx context.Context, skip, limit int) ([]shortener.Link, error) {\n\tlr.ListCalled = true\n\treturn lr.ListFn(ctx, limit, skip)\n}", "func (o *BranchingModelSettings) GetLinks() BranchingModelSettingsLinks {\n\tif o == nil || o.Links == nil {\n\t\tvar ret BranchingModelSettingsLinks\n\t\treturn ret\n\t}\n\treturn *o.Links\n}", "func allLinks(prefix, prop string, titles []string) chan Links {\n c := make(chan Links)\n\n go func(prefix, prop string, titles []string) {\n // Holds Wikipedia's \"continue\" string if we have more results to fetch. Set after the first request\n var cont string\n\n // Wikipedia can batch process up to 50 page titles at a time\n for _, titlesBatch := range batch(titles, 50) {\n // Continue paginating through results as long as Wikipedia is telling us to continue\n for i := 0; i == 0 || len(cont) > 0; i++ {\n queryURL := buildQuery(prefix, prop, titlesBatch, cont)\n body, err := get(queryURL)\n if err != nil {\n // If Wikipedia returns an error, just panic instead of doing an exponential back-off\n panic(err)\n }\n\n // Parse the response\n resp := linksResponse{prefix: prefix, prop: prop}\n err = json.Unmarshal(body, &resp)\n if err != nil {\n panic(err)\n }\n\n c <- resp.Links\n cont = resp.Continue\n }\n }\n close(c)\n }(prefix, prop, titles)\n\n return c\n}", "func enrichLinkTypeList(ctx *workItemLinkContext, list *app.WorkItemLinkTypeList) error {\n\t// Add \"links\" element\n\tfor _, data := range list.Data {\n\t\trelatedURL := rest.AbsoluteURL(ctx.Request, ctx.LinkFunc(*data.ID))\n\t\tdata.Links = &app.GenericLinks{\n\t\t\tSelf: &relatedURL,\n\t\t\tRelated: &relatedURL,\n\t\t}\n\t}\n\treturn nil\n}", "func (resp *DataResponse) SetLinks(self string, related string, first string, last string, prev string, next string){\n\tresp.Links.Self = self\n\tresp.Links.Related = related\n\tresp.Links.First = first\n\tresp.Links.Last = last\n\tresp.Links.Prev = prev\n\tresp.Links.Next = next\n}", "func (rule *Rule) GenerateLinks() ([]string, error) {\n\t//page pattern is {page}\n\tvar links []string\n\tpagePattern := \"{page}\"\n\tif !strings.Contains(rule.LinkPattern, pagePattern) {\n\t\treturn nil, errors.New(utility.Enums().ErrorMessages.LackOfInfo)\n\t}\n\tpage := 1\n\tfor page <= rule.TotalPages {\n\t\tlinks = append(links, strings.ReplaceAll(rule.LinkPattern, pagePattern, strconv.Itoa(page)))\n\t\tpage++\n\t}\n\treturn links, nil\n}", "func (s *shareManagerLister) ShareManagers(namespace string) ShareManagerNamespaceLister {\n\treturn shareManagerNamespaceLister{indexer: s.indexer, namespace: namespace}\n}", "func getLinksForServerInformation(relationer MarshalLinkedRelations, name string, information ServerInformation) *Links {\n\tlinks := &Links{}\n\n\tif information != serverInformationNil {\n\t\tprefix := strings.Trim(information.GetBaseURL(), \"/\")\n\t\tnamespace := strings.Trim(information.GetPrefix(), \"/\")\n\t\tstructType := getStructType(relationer)\n\n\t\tif namespace != \"\" {\n\t\t\tprefix += \"/\" + namespace\n\t\t}\n\n\t\tlinks.Self = fmt.Sprintf(\"%s/%s/%s/relationships/%s\", prefix, structType, relationer.GetID(), name)\n\t\tlinks.Related = fmt.Sprintf(\"%s/%s/%s/%s\", prefix, structType, relationer.GetID(), name)\n\n\t\treturn links\n\t}\n\n\treturn nil\n}", "func (c *Collector) Link() string {\n\treturn URLForResults(c.referenceID, c.config)\n}", "func Link(attrs []htmlgo.Attribute) HTML {\n\treturn &htmlgo.Tree{Tag: \"link\", Attributes: attrs, SelfClosing: true}\n}", "func (p *Peer) GetContentLinks(contentList []string) map[string][]string {\n\tallContent := p.GetState().GetNodeFieldsMap(\"DiskContent\")\n\ttoReturn := make(map[string][]string)\n\tfor nodeAddress, diskContent := range allContent {\n\t\tourContent := diskContent.(state.SignedList).Data\n\t\t// Convert to an interface array\n\t\ts := make([]interface{}, len(ourContent))\n\t\tfor i, v := range ourContent {\n\t\t\ts[i] = v\n\t\t}\n\t\tourContentSet := mapset.NewSetFromSlice(s)\n\t\t// Check to see if the current node we're iterating over has any of the\n\t\t// content we want\n\t\tfor _, contentWanted := range contentList {\n\t\t\tif ourContentSet.Contains(contentWanted) {\n\t\t\t\tif toReturn[contentWanted] == nil {\n\t\t\t\t\ttoReturn[contentWanted] = make([]string, 0)\n\t\t\t\t}\n\t\t\t\t// Add the URL to the map\n\t\t\t\tlink := p.createContentLink(nodeAddress, contentWanted)\n\t\t\t\tif link != \"\" {\n\t\t\t\t\ttoReturn[contentWanted] = append(toReturn[contentWanted], link)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn toReturn\n}", "func (o *Authorization) GetLinksOk() (*AuthorizationAllOfLinks, bool) {\n\tif o == nil || o.Links == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Links, true\n}", "func (m *mgr) ListReceivedShares(ctx context.Context, filters []*collaboration.Filter) ([]*collaboration.ReceivedShare, error) {\n\tm.Lock()\n\tdefer m.Unlock()\n\n\tuser := ctxpkg.ContextMustGetUser(ctx)\n\tmem := make(map[string]int)\n\tvar rss []*collaboration.ReceivedShare\n\tfor _, s := range m.model.Shares {\n\t\tif !share.IsCreatedByUser(s, user) &&\n\t\t\tshare.IsGrantedToUser(s, user) &&\n\t\t\tshare.MatchesFilters(s, filters) {\n\n\t\t\trs := m.convert(user.Id, s)\n\t\t\tidx, seen := mem[s.ResourceId.OpaqueId]\n\t\t\tif !seen {\n\t\t\t\trss = append(rss, rs)\n\t\t\t\tmem[s.ResourceId.OpaqueId] = len(rss) - 1\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// When we arrive here there was already a share for this resource.\n\t\t\t// if there is a mix-up of shares of type group and shares of type user we need to deduplicate them, since it points\n\t\t\t// to the same resource. Leave the more explicit and hide the less explicit. In this case we hide the group shares\n\t\t\t// and return the user share to the user.\n\t\t\tother := rss[idx]\n\t\t\tif other.Share.Grantee.Type == provider.GranteeType_GRANTEE_TYPE_GROUP && s.Grantee.Type == provider.GranteeType_GRANTEE_TYPE_USER {\n\t\t\t\tif other.State == rs.State {\n\t\t\t\t\trss[idx] = rs\n\t\t\t\t} else {\n\t\t\t\t\trss = append(rss, rs)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rss, nil\n}", "func (o *ObservedProperty) SetAllLinks(externalURL string) {\n\to.SetSelfLink(externalURL)\n\to.SetLinks(externalURL)\n\n\tfor _, d := range o.Datastreams {\n\t\td.SetAllLinks(externalURL)\n\t}\n}", "func (wo *WorkOrder) QueryLinks() *LinkQuery {\n\treturn (&WorkOrderClient{wo.config}).QueryLinks(wo)\n}", "func (client ProviderShareSubscriptionsClient) ListByShareSender(req *http.Request) (*http.Response, error) {\n\treturn client.Send(req, azure.DoRetryWithRegistration(client.Client))\n}", "func (l Links) String() string {\n\tvar strs []string\n\tfor _, link := range l {\n\t\tstrs = append(strs, link.String())\n\t}\n\treturn strings.Join(strs, \" , \")\n}", "func (s UserSet) Share() bool {\n\tres, _ := s.RecordCollection.Get(models.NewFieldName(\"Share\", \"share\")).(bool)\n\treturn res\n}" ]
[ "0.6276772", "0.61079675", "0.5796411", "0.56870514", "0.5610111", "0.5547555", "0.5494846", "0.54766333", "0.5420125", "0.53896433", "0.53839827", "0.53587574", "0.53537816", "0.53324753", "0.5315518", "0.53092885", "0.5303786", "0.5303338", "0.52954614", "0.52587503", "0.52457976", "0.52415705", "0.5238516", "0.51654255", "0.5140697", "0.50945127", "0.5072941", "0.50609034", "0.5060291", "0.504883", "0.5045733", "0.50228095", "0.5021205", "0.50208575", "0.50116056", "0.49904114", "0.49695563", "0.49669152", "0.49432918", "0.49145183", "0.49137893", "0.490347", "0.48990673", "0.48751217", "0.48642084", "0.4858996", "0.48405433", "0.48345673", "0.48325408", "0.48218477", "0.4814899", "0.4814579", "0.4801049", "0.4778067", "0.4763362", "0.4758358", "0.47579935", "0.47472346", "0.47409216", "0.47357446", "0.4730953", "0.47194538", "0.47191244", "0.4710058", "0.47003296", "0.46906766", "0.46672055", "0.46654493", "0.4660951", "0.4656493", "0.46546993", "0.4650853", "0.46474785", "0.46460626", "0.46428707", "0.464107", "0.4639963", "0.46310142", "0.46278566", "0.4610855", "0.46044424", "0.45946687", "0.45931998", "0.45931387", "0.45847514", "0.45837265", "0.45806852", "0.45801592", "0.45753783", "0.45728695", "0.4565906", "0.4562399", "0.45488507", "0.4548288", "0.450721", "0.44888607", "0.44883582", "0.4451869", "0.44383565", "0.44303998" ]
0.5210252
23
effectiveSr gets the current effective scroll region in buffer coordinates
func (h *windowsAnsiEventHandler) effectiveSr(window SMALL_RECT) scrollRegion { top := addInRange(window.Top, h.sr.top, window.Top, window.Bottom) bottom := addInRange(window.Top, h.sr.bottom, window.Top, window.Bottom) if top >= bottom { top = window.Top bottom = window.Bottom } return scrollRegion{top: top, bottom: bottom} }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (h *windowsAnsiEventHandler) scroll(param int, sr scrollRegion, info *CONSOLE_SCREEN_BUFFER_INFO) error {\n\th.logf(\"scroll: scrollTop: %d, scrollBottom: %d\", sr.top, sr.bottom)\n\th.logf(\"scroll: windowTop: %d, windowBottom: %d\", info.Window.Top, info.Window.Bottom)\n\n\t// Copy from and clip to the scroll region (full buffer width)\n\tscrollRect := SMALL_RECT{\n\t\tTop: sr.top,\n\t\tBottom: sr.bottom,\n\t\tLeft: 0,\n\t\tRight: info.Size.X - 1,\n\t}\n\n\t// Origin to which area should be copied\n\tdestOrigin := COORD{\n\t\tX: 0,\n\t\tY: sr.top - int16(param),\n\t}\n\n\tchar := CHAR_INFO{\n\t\tUnicodeChar: ' ',\n\t\tAttributes: h.attributes,\n\t}\n\n\tif err := ScrollConsoleScreenBuffer(h.fd, scrollRect, scrollRect, destOrigin, char); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (s *State) ConsumeScroll() {\n\tif !s.disabled && s.hovered {\n\t\ts.scroll = image.Point{}\n\t}\n}", "func (sv *ScrollView) scroll(sb int32, cmd uint16) int {\n\tvar pos int32\n\tvar si win.SCROLLINFO\n\tsi.CbSize = uint32(unsafe.Sizeof(si))\n\tsi.FMask = win.SIF_PAGE | win.SIF_POS | win.SIF_RANGE | win.SIF_TRACKPOS\n\n\twin.GetScrollInfo(sv.hWnd, sb, &si)\n\n\tpos = si.NPos\n\n\tswitch cmd {\n\tcase win.SB_LINELEFT: // == win.SB_LINEUP\n\t\tpos -= int32(sv.IntFrom96DPI(20))\n\n\tcase win.SB_LINERIGHT: // == win.SB_LINEDOWN\n\t\tpos += int32(sv.IntFrom96DPI(20))\n\n\tcase win.SB_PAGELEFT: // == win.SB_PAGEUP\n\t\tpos -= int32(si.NPage)\n\n\tcase win.SB_PAGERIGHT: // == win.SB_PAGEDOWN\n\t\tpos += int32(si.NPage)\n\n\tcase win.SB_THUMBTRACK:\n\t\tpos = si.NTrackPos\n\t}\n\n\tif pos < 0 {\n\t\tpos = 0\n\t}\n\tif pos > si.NMax+1-int32(si.NPage) {\n\t\tpos = si.NMax + 1 - int32(si.NPage)\n\t}\n\n\tsi.FMask = win.SIF_POS\n\tsi.NPos = pos\n\twin.SetScrollInfo(sv.hWnd, sb, &si, true)\n\n\treturn -int(pos)\n}", "func (r *Reader) effectiveLatency() time.Duration {\n\tlatency := r.averageLatency.Value()\n\n\tif latency == 0 {\n\t\treturn r.instantaneousLatency\n\t}\n\n\treturn time.Duration(\n\t\tlatency * float64(time.Second),\n\t)\n}", "func (i *InputHandler) GetMouseScroll() float32 { return i.mouseScrollDelta }", "func (s *State) Scroll() image.Point {\n\tif !s.disabled && s.hovered {\n\t\treturn s.scroll\n\t} else {\n\t\treturn image.Point{}\n\t}\n}", "func (self *scroll) Scope() float64 {\n\treturn self.scope\n}", "func (s *Scroll) update() {\n\tdif := s.ratio.Inv()\n\tif dif.X < 0 {\n\t\tif s.X.Use && (!s.useVel || s.X.selected) {\n\t\t\ts.offset.X = dif.X * (1 - s.X.position) // needs to be inverted or it ll look unnatural\n\t\t} else {\n\t\t\ts.offset.X = mat.Clamp(s.offset.X, dif.X, 0)\n\t\t\ts.X.position = 1 - s.offset.X/dif.X // make sure to move bar too\n\t\t}\n\t} else {\n\t\ts.offset.X = 0\n\t}\n\n\tif dif.Y < 0 {\n\t\tif s.Y.Use && (!s.useVel || s.Y.selected) {\n\t\t\ts.offset.Y = dif.Y * s.Y.position\n\t\t} else {\n\t\t\ts.offset.Y = mat.Clamp(s.offset.Y, dif.Y, 0)\n\t\t\ts.Y.position = s.offset.Y / dif.Y\n\t\t}\n\t} else {\n\t\ts.offset.Y = 0\n\t}\n}", "func (w *dewindow) realpaint(buf *demodel.CharBuffer, viewport *viewer.Viewport) {\n\tw.Lock()\n\tdefer w.Unlock()\n\n\tdefer func() {\n\t\tw.painting = false\n\t}()\n\tw.painting = true\n\n\tif w.buffer == nil {\n\t\treturn\n\t}\n\tdst := w.buffer.RGBA()\n\n\t// Fill the buffer with the window background colour before\n\t// drawing the web page on top of it.\n\t// This should logically be in the viewport code itself, but importing\n\t// kbmap to switch on the mode sentinals would result in a cyclical\n\t// import.\n\tif viewport.BackgroundMode != viewer.StableBackground {\n\t\tswitch viewport.GetKeyboardMode() {\n\t\tcase kbmap.InsertMode:\n\t\t\tdraw.Draw(dst, dst.Bounds(), &image.Uniform{renderer.InsertBackground}, image.ZP, draw.Src)\n\t\tcase kbmap.DeleteMode:\n\t\t\tdraw.Draw(dst, dst.Bounds(), &image.Uniform{renderer.DeleteBackground}, image.ZP, draw.Src)\n\t\tdefault:\n\t\t\tdraw.Draw(dst, dst.Bounds(), &image.Uniform{renderer.NormalBackground}, image.ZP, draw.Src)\n\t\t}\n\t} else {\n\t\tdraw.Draw(dst, dst.Bounds(), &image.Uniform{renderer.NormalBackground}, image.ZP, draw.Src)\n\t}\n\n\ts := w.sz.Size()\n\n\tcontentBounds := dst.Bounds()\n\ttagBounds := tagSize\n\t// ensure that the tag takes no more than half the window, so that the content doesn't get\n\t// drowned out by commands that output more to stderr than they should.\n\tif wHeight := s.Y; tagBounds.Max.Y > wHeight/2 {\n\t\ttagBounds.Max.Y = wHeight / 2\n\t}\n\tcontentBounds.Min.Y = tagBounds.Max.Y\n\n\ttagline.RenderInto(dst.SubImage(image.Rectangle{image.ZP, image.Point{s.X, tagBounds.Max.Y}}).(*image.RGBA), buf.Tagline, clipRectangle(w.sz, viewport))\n\tviewport.RenderInto(dst.SubImage(image.Rectangle{image.Point{0, tagBounds.Max.Y}, s}).(*image.RGBA), buf, clipRectangle(w.sz, viewport))\n\n\tw.Upload(image.Point{0, 0}, w.buffer, dst.Bounds())\n\tw.Publish()\n\treturn\n}", "func (w *Widget) getDeviceClientCoords(clientAreaType TClientAreaType) (region Region, clipRegion ClippingRegion) {\r\n var parentRegion Region\r\n var parentClip ClippingRegion\r\n\r\n\tif w.parent == nil {\r\n region = Region{\r\n x1: w.left,\r\n y1: w.top,\r\n x2: w.left + w.w - 1,\r\n y2: w.top + w.h - 1,\r\n }\r\n parentClip = ClippingRegion{\r\n x1: region.x1,\r\n y1: region.y1,\r\n x2: region.x2,\r\n y2: region.y2,\r\n }\r\n\t} else {\r\n\t\tparentRegion, parentClip = w.parent.getDeviceClientCoords(windowClientArea)\r\n\r\n region = Region{\r\n x1: parentRegion.x1 + w.left,\r\n y1: parentRegion.y1 + w.top,\r\n x2: parentRegion.x1 + w.left + w.w - 1,\r\n y2: parentRegion.y1 + w.top + w.h - 1,\r\n }\r\n\t}\r\n\r\n if clientAreaType == windowWithBorders || clientAreaType == windowClientArea {\r\n if w.border.top != BorderStyleNone {\r\n region.y1++\r\n // clipRegion.y1++\r\n }\r\n if w.border.left != BorderStyleNone {\r\n region.x1++\r\n // clipRegion.x1++\r\n }\r\n if w.border.bottom != BorderStyleNone {\r\n region.y2--\r\n // clipRegion.y2--\r\n }\r\n if w.border.right != BorderStyleNone {\r\n region.x2--\r\n // clipRegion.x2--\r\n }\r\n }\r\n\r\n // Adjust clipRegion\r\n if w.parent != nil {\r\n clipRegion.x1 = maxInt(region.x1, parentClip.x1)\r\n clipRegion.y1 = maxInt(region.y1, parentClip.y1)\r\n clipRegion.x2 = minInt(region.x2, parentClip.x2)\r\n clipRegion.y2 = minInt(region.y2, parentClip.y2)\r\n }\r\n\r\n\treturn\r\n}", "func (self *Graphics) OffsetY() int{\n return self.Object.Get(\"offsetY\").Int()\n}", "func (h *windowsAnsiEventHandler) scrollLine(columns int, position COORD, info *CONSOLE_SCREEN_BUFFER_INFO) error {\n\t// Copy from and clip to the scroll region (full buffer width)\n\tscrollRect := SMALL_RECT{\n\t\tTop: position.Y,\n\t\tBottom: position.Y,\n\t\tLeft: position.X,\n\t\tRight: info.Size.X - 1,\n\t}\n\n\t// Origin to which area should be copied\n\tdestOrigin := COORD{\n\t\tX: position.X - int16(columns),\n\t\tY: position.Y,\n\t}\n\n\tchar := CHAR_INFO{\n\t\tUnicodeChar: ' ',\n\t\tAttributes: h.attributes,\n\t}\n\n\tif err := ScrollConsoleScreenBuffer(h.fd, scrollRect, scrollRect, destOrigin, char); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (b *AppendOnlyBufferedBatch) Selection() []int {\n\tif b.batch.Selection() != nil {\n\t\treturn b.sel\n\t}\n\treturn nil\n}", "func (c *ScrollSprite) OnRender() {\n\t// engosdl.Logger.Trace().Str(\"sprite\", spr.GetName()).Msg(\"OnRender\")\n\tx := int32(c.GetEntity().GetTransform().GetPosition().X)\n\ty := int32(c.GetEntity().GetTransform().GetPosition().Y)\n\twidth := c.width * int32(c.GetEntity().GetTransform().GetScale().X)\n\theight := c.height * int32(c.GetEntity().GetTransform().GetScale().Y)\n\tW, H, _ := engosdl.GetRenderer().GetOutputSize()\n\tif c.Scroll.Y == -1 {\n\t\ty = y % height\n\t} else if c.Scroll.X == -1 {\n\t\tx = x % width\n\t}\n\tdisplayFrom := &sdl.Rect{X: 0, Y: 0, W: width, H: height}\n\tdisplayAt := &sdl.Rect{X: x, Y: y, W: width, H: height}\n\tc.renderer.CopyEx(c.textures[0],\n\t\tdisplayFrom,\n\t\tdisplayAt,\n\t\t0,\n\t\t&sdl.Point{},\n\t\tsdl.FLIP_NONE)\n\tif c.Scroll.Y == -1 && (y+height) < H {\n\t\tc.renderer.CopyEx(c.textures[0],\n\t\t\t&sdl.Rect{X: 0, Y: 0, W: width, H: height},\n\t\t\t&sdl.Rect{X: x, Y: y + height, W: width, H: height},\n\t\t\t0,\n\t\t\t&sdl.Point{},\n\t\t\tsdl.FLIP_NONE)\n\t} else if c.Scroll.X == -1 && (x+width) < W {\n\t\tc.renderer.CopyEx(c.textures[0],\n\t\t\t&sdl.Rect{X: 0, Y: 0, W: width, H: height},\n\t\t\t&sdl.Rect{X: x + width, Y: y, W: width, H: height},\n\t\t\t0,\n\t\t\t&sdl.Point{},\n\t\t\tsdl.FLIP_NONE)\n\t}\n}", "func Reslice(slc []byte, lidx int, uidx int) []byte {\n\tslice := AllocateMake(uidx)\n\tslice = slc[lidx:uidx]\n\treturn slice\n}", "func optimalPageSize(opts optimalPageSizeOpts) int {\n\tpageSize := 15\n\tif opts.terminalHeight != 0 {\n\t\tpageSize = opts.terminalHeight\n\t} else if _, height, err := term.GetSize(0); err == nil {\n\t\tpageSize = height\n\t}\n\tif pageSize > opts.nopts {\n\t\tpageSize = opts.nopts\n\t}\n\tconst buffer = 5\n\tif pageSize > buffer {\n\t\tpageSize = pageSize - buffer\n\t}\n\treturn pageSize\n}", "func (e *ObservableEditableBuffer) RedoSeq() int {\n\treturn e.f.RedoSeq()\n}", "func (obj *Device) GetScissorRect() (r RECT, err Error) {\n\tret, _, _ := syscall.Syscall(\n\t\tobj.vtbl.GetScissorRect,\n\t\t2,\n\t\tuintptr(unsafe.Pointer(obj)),\n\t\tuintptr(unsafe.Pointer(&r)),\n\t\t0,\n\t)\n\terr = toErr(ret)\n\treturn\n}", "func (BlobRangeFinderImpl) getIntersection(r ds3Models.Range, offset int64, length int64) ds3Models.Range {\n var intersection ds3Models.Range\n if r.Start < offset {\n intersection.Start = offset\n } else {\n intersection.Start = r.Start\n }\n\n if r.End < offset + length - 1 {\n intersection.End = r.End\n } else {\n intersection.End = offset + length - 1\n }\n return intersection\n}", "func (tv *TextView) RenderStartPos() mat32.Vec2 {\n\tst := &tv.Sty\n\tspc := st.BoxSpace()\n\tpos := tv.LayData.AllocPos.AddScalar(spc)\n\treturn pos\n}", "func (obj *material) Viewport() viewports.Viewport {\n\treturn obj.viewport\n}", "func (self *Graphics) CameraOffset() *Point{\n return &Point{self.Object.Get(\"cameraOffset\")}\n}", "func (s *ServicesWidget) Buffer() gizaktermui.Buffer {\n\ts.Lock()\n\tdefer s.Unlock()\n\tbuf := gizaktermui.NewBuffer()\n\tif !s.mounted {\n\t\treturn buf\n\t}\n\ty := s.screen.Bounds().Min.Y\n\n\ts.prepareForRendering()\n\twidgetHeader := appui.NewWidgetHeader()\n\twidgetHeader.HeaderEntry(\"Services\", strconv.Itoa(s.RowCount()))\n\tif s.filterPattern != \"\" {\n\t\twidgetHeader.HeaderEntry(\"Active filter\", s.filterPattern)\n\t}\n\twidgetHeader.Y = y\n\tbuf.Merge(widgetHeader.Buffer())\n\ty += widgetHeader.GetHeight()\n\t//Empty line between the header and the rest of the content\n\ty++\n\ts.updateHeader()\n\ts.header.SetY(y)\n\tbuf.Merge(s.header.Buffer())\n\ty += s.header.GetHeight()\n\n\tselected := s.selectedIndex - s.startIndex\n\n\tfor i, serviceRow := range s.visibleRows() {\n\t\tserviceRow.SetY(y)\n\t\ty += serviceRow.GetHeight()\n\t\tif i != selected {\n\t\t\tserviceRow.NotHighlighted()\n\t\t} else {\n\t\t\tserviceRow.Highlighted()\n\t\t}\n\t\tbuf.Merge(serviceRow.Buffer())\n\t}\n\treturn buf\n}", "func (w *Window) Slice() []float64 {\n\tw.mx.RLock()\n\t// 4 Times faster than \"defer Unlock\"\n\tret := w.base[w.start : w.start+w.Len]\n\tw.mx.RUnlock()\n\treturn ret\n}", "func (f ChangeLineSpaceFilter) getLineRanges(src image.Image) lineRanges {\n\tbounds := src.Bounds()\n\tsrcWidth, srcHeight := bounds.Dx(), bounds.Dy()\n\tthreshold16 := f.option.Threshold * 256\n\n\tvar ranges lineRanges\n\tvar r lineRange\n\n\tmaxDotCount := int(f.option.EmptyLineThreshold)\n\tif f.option.EmptyLineThreshold < 1 {\n\t\tmaxDotCount = int(float64(srcWidth) * f.option.EmptyLineThreshold)\n\t}\n\tfor y := 0; y < srcHeight; y++ {\n\t\temptyLine := true\n\t\tdotCount := 0\n\t\tfor x := 0; x < srcWidth; x++ {\n\t\t\tr, g, b, _ := src.At(x, y).RGBA()\n\t\t\tbrightness := getBrightness(r, g, b)\n\t\t\tif brightness < threshold16 {\n\t\t\t\tdotCount++\n\t\t\t\tif dotCount >= maxDotCount {\n\t\t\t\t\temptyLine = false\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif emptyLine {\n\t\t\tif y == 0 {\n\t\t\t\tr = lineRange{start: y, end: y, emptyLine: true}\n\t\t\t} else {\n\t\t\t\tif r.emptyLine {\n\t\t\t\t\tr.end = y\n\t\t\t\t} else {\n\t\t\t\t\tranges = append(ranges, r)\n\t\t\t\t\tr = lineRange{start: y, end: y, emptyLine: true}\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tif y == 0 {\n\t\t\t\tr = lineRange{start: y, end: y, emptyLine: false}\n\t\t\t} else {\n\t\t\t\tif r.emptyLine {\n\t\t\t\t\tranges = append(ranges, r)\n\t\t\t\t\tr = lineRange{start: y, end: y, emptyLine: false}\n\t\t\t\t} else {\n\t\t\t\t\tr.end = y\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\tranges = append(ranges, r)\n\treturn ranges\n}", "func (ref *UIElement) RTFForRange(r Range) []byte {\n\ta := cfstr(RTFForRangeParameterizedAttribute)\n\tdefer C.CFRelease(C.CFTypeRef(a))\n\n\tcfRange := C.CFRangeMake(C.CFIndex(r.Location), C.CFIndex(r.Length))\n\taxRangeValue := C.AXValueCreate(C.kAXValueTypeCFRange, unsafe.Pointer(&cfRange))\n\tdefer C.CFRelease(C.CFTypeRef(axRangeValue))\n\tvar value C.CFTypeRef\n\tC.AXUIElementCopyParameterizedAttributeValue(ref.obj, a, axRangeValue, &value)\n\tif value == nil {\n\t\treturn []byte{}\n\t}\n\tdefer C.CFRelease(value)\n\tif C.CFGetTypeID(value) != C.CFDataGetTypeID() {\n\t\treturn []byte{}\n\t}\n\tlength := int(C.CFDataGetLength(C.CFDataRef(value)))\n\tdata := make([]byte, length)\n\tptr := uintptr(unsafe.Pointer(C.CFDataGetBytePtr(C.CFDataRef(value))))\n\tfor i := 0; i < length; i++ {\n\t\tdata[i] = byte(*(*C.UInt8)(unsafe.Pointer(ptr)))\n\t\tptr = ptr + 1\n\t}\n\treturn data\n}", "func (s *Scroll) updateOffset() {\n\tch := s.children.Slice()\n\toff := s.offset\n\tif s.X.use && s.Y.use { // have to shift whole thing because of strange dimensions\n\t\toff.Y += s.BarWidth\n\t}\n\tfor i := 0; i < len(ch); i++ {\n\t\tch[i].Value.Offest = off\n\t}\n}", "func getPosLimit(pos Point, max *Point, rv int32) (start, end Point) {\n\tif (pos.X - rv) < 0 {\n\t\tstart.X = 0\n\t\tend.X = 2 * rv\n\t} else if (pos.X + rv) > max.X {\n\t\tend.X = max.X\n\t\tstart.X = max.X - 2*rv\n\t} else {\n\t\tstart.X = pos.X - rv\n\t\tend.X = pos.X + rv\n\t}\n\n\tif (pos.Y - rv) < 0 {\n\t\tstart.Y = 0\n\t\tend.Y = 2 * rv\n\t} else if (pos.Y + rv) > max.Y {\n\t\tend.Y = max.Y\n\t\tstart.Y = max.Y - 2*rv\n\t} else {\n\t\tstart.Y = pos.Y - rv\n\t\tend.Y = pos.Y + rv\n\t}\n\n\tif start.X < 0 {\n\t\tstart.X = 0\n\t}\n\n\tif end.X > max.X {\n\t\tend.X = max.X\n\t}\n\n\tif start.Y < 0 {\n\t\tstart.Y = 0\n\t}\n\n\tif end.Y > max.Y {\n\t\tend.Y = max.Y\n\t}\n\n\treturn\n}", "func (r *ImageRef) ResY() float64 {\n\treturn float64(r.image.Yres)\n}", "func (re *TCPLoop) minResolution(start int64, end int64, cur_step uint32) uint32 {\n\n\tuse_min := cur_step\n\tif DEFAULT_MIN_RESOLUTION > use_min {\n\t\tuse_min = DEFAULT_MIN_RESOLUTION\n\t}\n\tcur_pts := uint32(end-start) / use_min\n\n\tif re.Metrics == nil {\n\t\tif cur_pts > MAX_METRIC_POINTS {\n\t\t\treturn uint32(end-start) / MAX_METRIC_POINTS\n\t\t}\n\t\treturn use_min\n\t}\n\treturn use_min\n}", "func (dd *dictDecoder) availRead() int {\n\treturn dd.wrPos - dd.rdPos\n}", "func (ch *clientSecureChannel) ReceiveBufferSize() uint32 {\n\treturn ch.receiveBufferSize\n}", "func (self Source) GetRolloffFactor() (gain float32) {\n\treturn self.Getf(AlRolloffFactor)\n}", "func TexBufferRange(target uint32, internalformat uint32, buffer uint32, offset int, size int) {\n\tsyscall.Syscall6(gpTexBufferRange, 5, uintptr(target), uintptr(internalformat), uintptr(buffer), uintptr(offset), uintptr(size), 0)\n}", "func (s *ItemScroller) vRecalc() {\n\n\t// Checks if scroll bar should be visible or not\n\tscroll := false\n\tif s.first > 0 {\n\t\tscroll = true\n\t} else {\n\t\tvar posY float32\n\t\tfor _, item := range s.items[s.first:] {\n\t\t\tposY += item.Height()\n\t\t\tif posY > s.height {\n\t\t\t\tscroll = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\ts.setVScrollBar(scroll)\n\n\t// Compute size of scroll button\n\tif scroll && s.autoButtonSize {\n\t\tvar totalHeight float32\n\t\tfor _, item := range s.items {\n\t\t\t// TODO OPTIMIZATION\n\t\t\t// Break when the view/content proportion becomes smaller than the minimum button size\n\t\t\ttotalHeight += item.Height()\n\t\t}\n\t\ts.vscroll.SetButtonSize(s.height * s.height / totalHeight)\n\t}\n\n\t// Items width\n\twidth := s.ContentWidth()\n\tif scroll {\n\t\twidth -= s.vscroll.Width()\n\t}\n\n\tvar posY float32\n\t// Sets positions of all items\n\tfor pos, ipan := range s.items {\n\t\titem := ipan.GetPanel()\n\t\tif pos < s.first {\n\t\t\titem.SetVisible(false)\n\t\t\tcontinue\n\t\t}\n\t\t// If item is after last visible, sets not visible\n\t\tif posY > s.height {\n\t\t\titem.SetVisible(false)\n\t\t\tcontinue\n\t\t}\n\t\t// Sets item position\n\t\titem.SetVisible(true)\n\t\titem.SetPosition(0, posY)\n\t\tif s.adjustItem {\n\t\t\titem.SetWidth(width)\n\t\t}\n\t\tposY += ipan.Height()\n\t}\n\n\t// Set scroll bar value if recalc was not due by scroll event\n\tif scroll && !s.scrollBarEvent {\n\t\ts.vscroll.SetValue(float32(s.first) / float32(s.maxFirst()))\n\t}\n\ts.scrollBarEvent = false\n}", "func (t *Tile) ScaledRelativePos(p Point) (np Point) {\n\trelPos := t.RelativePos(p)\n\tnp = Point{relPos.X / t.Width, relPos.Y / t.Width}\n\treturn\n}", "func (m *wasiSnapshotPreview1Impl) fdRead(pfd wasiFd, piovs list) (rv wasiSize, err wasiErrno) {\n\tf, err := m.files.getFile(pfd, wasiRightsFdRead)\n\tif err != wasiErrnoSuccess {\n\t\treturn 0, err\n\t}\n\n\tn, ferr := f.Readv(m.buffers(wasiIovecArray(piovs)))\n\tif ferr != nil {\n\t\treturn n, fileErrno(ferr)\n\t}\n\treturn n, wasiErrnoSuccess\n}", "func (*CMsgSetVerticalScroll) Descriptor() ([]byte, []int) {\n\treturn file_steam_htmlmessages_proto_rawDescGZIP(), []int{38}\n}", "func (tb *TextBuf) Region(st, ed TextPos) *TextBufEdit {\n\tst = tb.ValidPos(st)\n\ted = tb.ValidPos(ed)\n\tif st == ed {\n\t\treturn nil\n\t}\n\tif !st.IsLess(ed) {\n\t\tlog.Printf(\"giv.TextBuf : starting position must be less than ending!: st: %v, ed: %v\\n\", st, ed)\n\t\treturn nil\n\t}\n\ttbe := &TextBufEdit{Reg: NewTextRegionPos(st, ed)}\n\ttb.LinesMu.RLock()\n\tdefer tb.LinesMu.RUnlock()\n\tif ed.Ln == st.Ln {\n\t\tsz := ed.Ch - st.Ch\n\t\ttbe.Text = make([][]rune, 1)\n\t\ttbe.Text[0] = make([]rune, sz)\n\t\tcopy(tbe.Text[0][:sz], tb.Lines[st.Ln][st.Ch:ed.Ch])\n\t} else {\n\t\t// first get chars on start and end\n\t\tnlns := (ed.Ln - st.Ln) + 1\n\t\ttbe.Text = make([][]rune, nlns)\n\t\tstln := st.Ln\n\t\tif st.Ch > 0 {\n\t\t\tec := len(tb.Lines[st.Ln])\n\t\t\tsz := ec - st.Ch\n\t\t\tif sz > 0 {\n\t\t\t\ttbe.Text[0] = make([]rune, sz)\n\t\t\t\tcopy(tbe.Text[0][0:sz], tb.Lines[st.Ln][st.Ch:])\n\t\t\t}\n\t\t\tstln++\n\t\t}\n\t\tedln := ed.Ln\n\t\tif ed.Ch < len(tb.Lines[ed.Ln]) {\n\t\t\ttbe.Text[ed.Ln-st.Ln] = make([]rune, ed.Ch)\n\t\t\tcopy(tbe.Text[ed.Ln-st.Ln], tb.Lines[ed.Ln][:ed.Ch])\n\t\t\tedln--\n\t\t}\n\t\tfor ln := stln; ln <= edln; ln++ {\n\t\t\tti := ln - st.Ln\n\t\t\tsz := len(tb.Lines[ln])\n\t\t\ttbe.Text[ti] = make([]rune, sz)\n\t\t\tcopy(tbe.Text[ti], tb.Lines[ln])\n\t\t}\n\t}\n\treturn tbe\n}", "func (b *BaseElement) GetScrollLeft() int32 {\n\treturn b.sl\n}", "func StableOffsetScroll(o int, s, dn, in int) int {\n\t// TODO: need to know if the insertion/delete is on the same line to try to keep the line percentage (smooth scrolling)\n\n\ted := s + dn // end of deletes\n\tei := s + in // end of inserts\n\n\tif o <= s { // o<s<={ed,ei}\n\t\treturn o\n\t}\n\tif o <= ed { // s<o<=ed\n\t\tif o <= ei { // s<o<={ed,ei}\n\t\t\treturn o // inserts cover the deletes\n\t\t} else { // s<ei<o<=ed\n\t\t\t// add missing to cover the deletes\n\t\t\treturn o - (o - ei)\n\t\t}\n\t}\n\tif o <= ei { // s<ed<o<=ei\n\t\t// inserts cover the deletes\n\t\treturn o\n\t}\n\t// s<{ed,ei}<o\n\to += in - dn // add missing bytes to reach old offset\n\treturn o\n}", "func (s *ItemScroller) recalc() {\n\n\tif s.vert {\n\t\ts.vRecalc()\n\t} else {\n\t\ts.hRecalc()\n\t}\n}", "func (crv RSIDVARCols) FindVRChromPosRange(first, last uint64, chrom uint8, posMin, posMax uint32) (uint32, uint64, uint64) {\n\tcfirst := C.uint64_t(first)\n\tclast := C.uint64_t(last)\n\trsid := uint32(C.find_vr_chrompos_range(castGoRSIDVARColsToC(crv), &cfirst, &clast, C.uint8_t(chrom), C.uint32_t(posMin), C.uint32_t(posMax)))\n\treturn rsid, uint64(cfirst), uint64(clast)\n}", "func (_c *calibrationData) Adjust(rawStick [2]uint16) [2]int16 {\n\tc := _c\n\tif c == nil {\n\t\tc = &fakeCalibrationData\n\t} else if (c.xMinOff == 0) || (c.xMaxOff == 0) || (c.yMinOff == 0) || (c.yMaxOff == 0) {\n\t\tc = &fakeCalibrationData\n\t} else if (c.xCenter == 0xFFF) || (c.yCenter == 0xFFF) {\n\t\tc = &fakeCalibrationData\n\t}\n\n\tvar out [2]int16\n\t// careful - need to upcast to int before multiplying\n\t// 1. convert to signed\n\t// 2. subtract center value\n\t// 3. widen to int (!)\n\t// 4. multiply by desiredRange\n\t// 5. divide by range-from-center\n\tif rawStick[0] < c.xCenter {\n\t\tout[0] = int16(int((int16(rawStick[0]) - int16(c.xCenter))) * desiredRange / int(c.xMinOff))\n\t} else {\n\t\tout[0] = int16(int((int16(rawStick[0]) - int16(c.xCenter))) * desiredRange / int(c.xMaxOff))\n\t}\n\tif rawStick[1] < c.yCenter {\n\t\tout[1] = int16(int((int16(rawStick[1]) - int16(c.yCenter))) * desiredRange / int(c.yMinOff))\n\t} else {\n\t\tout[1] = int16(int((int16(rawStick[1]) - int16(c.yCenter))) * desiredRange / int(c.yMaxOff))\n\t}\n\n\t// 6. clamp\n\tif out[0] > desiredRange || out[0] < -desiredRange || out[1] > desiredRange || out[1] < -desiredRange {\n\t\tvar modX, modY float64 = float64(out[0]), float64(out[1])\n\t\tif modX > desiredRange || modX < -desiredRange {\n\t\t\t// overFactor is slightly over 1 or slightly under -1\n\t\t\toverFactor := modX / desiredRange\n\t\t\toverFactor = math.Copysign(overFactor, 1.0)\n\t\t\tmodX /= overFactor\n\t\t\tmodY /= overFactor\n\t\t}\n\t\tif modY > desiredRange || modY < -desiredRange {\n\t\t\t// overFactor is slightly over 1 or slightly under -1\n\t\t\toverFactor := modY / desiredRange\n\t\t\toverFactor = math.Copysign(overFactor, 1.0)\n\t\t\tmodX /= overFactor\n\t\t\tmodY /= overFactor\n\t\t}\n\t\t// clamp again in case of fraction weirdness\n\t\tif modX > desiredRange {\n\t\t\tmodX = desiredRange\n\t\t}\n\t\tif modX < -desiredRange {\n\t\t\tmodX = -desiredRange\n\t\t}\n\t\tif modY > desiredRange {\n\t\t\tmodY = desiredRange\n\t\t}\n\t\tif modY < -desiredRange {\n\t\t\tmodY = -desiredRange\n\t\t}\n\t\tout[0], out[1] = int16(modX), int16(modY)\n\t}\n\n\treturn out\n}", "func (e *Editor) Selection() (start, end int) {\n\treturn e.caret.start.ofs, e.caret.end.ofs\n}", "func (c *Context) recalc() {\n\tc.scale = fixed.Int26_6(c.fontSize * c.dpi * (64.0 / 72.0))\n\tif c.f == nil {\n\t\tc.r.SetBounds(0, 0)\n\t} else {\n\t\tb := c.f.Bounds(c.scale)\n\t\txmin := +int(b.Min.X) >> 6\n\t\tymin := -int(b.Max.Y) >> 6\n\t\txmax := +int(b.Max.X+63) >> 6\n\t\tymax := -int(b.Min.Y-63) >> 6\n\t\tc.r.SetBounds(xmax-xmin, ymax-ymin)\n\t}\n\tfor i := range c.cache {\n\t\tc.cache[i] = cacheEntry{}\n\t}\n}", "func getScreenSizeRangeRequest(c *xgb.Conn, Window xproto.Window) []byte {\n\tsize := 8\n\tb := 0\n\tbuf := make([]byte, size)\n\n\tc.ExtLock.RLock()\n\tbuf[b] = c.Extensions[\"RANDR\"]\n\tc.ExtLock.RUnlock()\n\tb += 1\n\n\tbuf[b] = 6 // request opcode\n\tb += 1\n\n\txgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units\n\tb += 2\n\n\txgb.Put32(buf[b:], uint32(Window))\n\tb += 4\n\n\treturn buf\n}", "func (snake *Snake) GetDrawTail() DrawTail {\n\n\tout := make(DrawTail, snake.length)\n\n\tbeginning, ending := snake.GetSegments()\n\n\tfor i := len(beginning) - 1; i >= 0; i-- {\n\t\tout <- beginning[i]\n\t}\n\n\tfor i := len(ending) - 1; i >= 0; i-- {\n\t\tout <- ending[i]\n\t}\n\n\tclose(out)\n\treturn out\n\n}", "func (b *Buffer) getCursorMinXPos() int {\n return b.getLineMetaChars() + 1\n}", "func (spriteBatch *SpriteBatch) GetDrawRange() (int, int) {\n\tmin := 0\n\tmax := spriteBatch.count - 1\n\tif spriteBatch.rangeMax >= 0 {\n\t\tmax = int(math.Min(float64(spriteBatch.rangeMax), float64(max)))\n\t}\n\tif spriteBatch.rangeMin >= 0 {\n\t\tmin = int(math.Min(float64(spriteBatch.rangeMin), float64(max)))\n\t}\n\treturn min, max\n}", "func (r Rect) Y0() float64 { return r.y0 }", "func (s *Scroll) Update(w *ggl.Window, delta float64) {\n\tif s.dirty {\n\t\ts.dirty = false\n\t\ts.update()\n\t\ts.updateOffset()\n\t\ts.move(s.Frame.Min.Sub(s.margin.Min).Sub(s.Offest), false)\n\t\ts.Scene.Redraw.Notify()\n\t}\n\n\tif s.useVel {\n\t\ts.useVel = s.vel.Len2() > .01\n\t\tif !s.X.selected && !s.Y.selected {\n\t\t\ts.offset.AddE(s.vel)\n\t\t}\n\t\tif s.Friction < 0 {\n\t\t\ts.vel = mat.ZV\n\t\t} else {\n\t\t\t// we don't want to get crazy if frames are low\n\t\t\ts.vel.SubE(s.vel.Scaled(math.Min(s.Friction*delta, 1)))\n\t\t}\n\t\ts.dirty = true\n\n\t}\n\n\tif !s.Hovering {\n\t\treturn\n\t}\n\n\tscroll := w.MouseScroll()\n\tif scroll.Y != 0 {\n\t\ts.vel.Y -= scroll.Y * s.ScrollSensitivity\n\t\ts.useVel = true\n\t}\n\n\tif w.JustReleased(key.MouseLeft) {\n\t\ts.X.selected = false\n\t\ts.Y.selected = false\n\t\treturn\n\t}\n\n\tif !w.Pressed(key.MouseLeft) {\n\t\treturn\n\t}\n\n\tvar (\n\t\tmouse = w.MousePrevPos()\n\t\tmove = mouse.To(w.MousePos())\n\t\tas, ae = s.barBounds(&s.X, 0)\n\t\tbs, be = s.barBounds(&s.Y, 1)\n\t)\n\n\tif s.X.Use && s.X.use && s.X.selected || (s.corner.Y > mouse.Y && mouse.X >= as && mouse.X <= ae) {\n\t\tif w.JustPressed(key.MouseLeft) {\n\t\t\ts.X.selected = true\n\t\t}\n\t\tif s.X.selected {\n\t\t\ts.X.Move(-move.X)\n\t\t\ts.dirty = true\n\t\t}\n\t} else if !s.Scene.TextSelected {\n\t\ts.vel.X = move.X\n\t\ts.useVel = true\n\t}\n\n\tif s.Y.Use && s.Y.use && s.Y.selected || (s.corner.X < mouse.X && mouse.Y >= bs && mouse.Y <= be) {\n\t\tif w.JustPressed(key.MouseLeft) {\n\t\t\ts.Y.selected = true\n\t\t}\n\t\tif s.Y.selected {\n\t\t\ts.Y.Move(move.Y)\n\t\t\ts.dirty = true\n\t\t}\n\t} else if !s.Scene.TextSelected {\n\t\ts.vel.Y = move.Y\n\t\ts.useVel = true\n\t}\n\n}", "func (is ImageSurface) Stride() int {\n\treturn is.stride\n}", "func (o *ARVRInterface) GetRenderTargetsize() gdnative.Vector2 {\n\t//log.Println(\"Calling ARVRInterface.GetRenderTargetsize()\")\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(\"ARVRInterface\", \"get_render_targetsize\")\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 (self *Graphics) GetLocalBounds() *Rectangle{\n return &Rectangle{self.Object.Call(\"getLocalBounds\")}\n}", "func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) {\n\tvar lroff _libgo_loff_t_type\n\tvar plroff *_libgo_loff_t_type\n\tif roff != nil {\n\t\tlroff = _libgo_loff_t_type(*roff)\n\t\tplroff = &lroff\n\t}\n\tvar lwoff _libgo_loff_t_type\n\tvar plwoff *_libgo_loff_t_type\n\tif woff != nil {\n\t\tlwoff = _libgo_loff_t_type(*woff)\n\t\tplwoff = &lwoff\n\t}\n\tn, err = splice(rfd, plroff, wfd, plwoff, len, flags)\n\tif roff != nil {\n\t\t*roff = int64(lroff)\n\t}\n\tif woff != nil {\n\t\t*woff = int64(lwoff)\n\t}\n\treturn\n}", "func NextReadableMemoryRegion(p process.Process, address uintptr) (region MemoryRegion, harderror error, softerrors []error) {\n\tr1, h1, s1 := NextMemoryRegionAccess(p, address, Readable)\n\tfor {\n\t\tr2, h2, _ := NextMemoryRegionAccess(p, r1.Address+uintptr(r1.Size), Readable)\n\t\tif (h2 != nil) || (r2 == NoRegionAvailable) || (r2.Address > r1.Address+uintptr(r1.Size)) {\n\t\t\tbreak\n\t\t} // if\n\n\t\tr1.Size += r2.Size\n\t}\n\n\treturn r1, h1, s1\n\t// return NextMemoryRegionAccess(p, address, Readable)\n}", "func TexBufferRange(target uint32, internalformat uint32, buffer uint32, offset int, size int) {\n C.glowTexBufferRange(gpTexBufferRange, (C.GLenum)(target), (C.GLenum)(internalformat), (C.GLuint)(buffer), (C.GLintptr)(offset), (C.GLsizeiptr)(size))\n}", "func (s *ClampDirectionOffset) Restitution() float64 {\n\treturn s.restitution\n}", "func calculateRangeOffset(pr net.PortRange) int {\n\t// default values for min(max($min, rangeSize/$step), $max)\n\tconst (\n\t\tmin = 16\n\t\tmax = 128\n\t\tstep = 32\n\t)\n\n\trangeSize := pr.Size\n\t// offset should always be smaller than the range size\n\tif rangeSize <= min {\n\t\treturn 0\n\t}\n\n\toffset := rangeSize / step\n\tif offset < min {\n\t\treturn min\n\t}\n\tif offset > max {\n\t\treturn max\n\t}\n\treturn int(offset)\n}", "func CalcReplicas(elasticity *v1.Elasticity, publishingRate float64, currentReplicas float64) (newNumRep int32, bufferSize int32) {\n\n\t// minimum capacity -------\n\tif publishingRate < float64(elasticity.Spec.Deployment.Capacity) {\n\t\tminReplicas := int32(1)\n\t\tif elasticity.Spec.Deployment.MinReplicas != nil {\n\t\t\tminReplicas = *elasticity.Spec.Deployment.MinReplicas\n\t\t}\n\t\treturn minReplicas + elasticity.Spec.Buffer.Initial, elasticity.Spec.Buffer.Initial\n\t}\n\n\tvar bufferForCalc float64\n\tif elasticity.Status.BufferedReplicas == 0 {\n\t\tbufferForCalc = float64(elasticity.Spec.Buffer.Initial)\n\t} else {\n\t\tbufferForCalc = float64(elasticity.Status.BufferedReplicas)\n\t}\n\n\t// current capacity ---\n\tbaseWorkload := BaseWorkload(publishingRate, float64(elasticity.Spec.Deployment.Capacity))\n\t// adjust anticipation ---\n\tbufferSize = AdjustBufferAmount(publishingRate, float64(currentReplicas), bufferForCalc, float64(elasticity.Spec.Deployment.Capacity), float64(elasticity.Spec.Buffer.Threshold), elasticity.Spec.Buffer.Initial)\n\ttotalReplicas := baseWorkload + bufferSize\n\n\t// maximum capacity ---\n\tif totalReplicas > elasticity.Spec.Deployment.MaxReplicas {\n\t\ttotalReplicas = elasticity.Spec.Deployment.MaxReplicas\n\t\tbufferSize = elasticity.Spec.Buffer.Initial\n\t}\n\n\treturn totalReplicas, bufferSize\n\n}", "func (r *Reader) AdjustedOffset(br *bufio.Reader) int64 {\n\treturn r.Request.Offset - int64(br.Buffered())\n}", "func (ren *RenderComponent) generateBufferContent() []float32 {\n\tscaleX := ren.scale.X\n\tscaleY := ren.scale.Y\n\trotation := float32(0.0)\n\ttransparency := float32(1.0)\n\tc := ren.Color\n\n\tfx := float32(0)\n\tfy := float32(0)\n\tfx2 := ren.drawable.Width()\n\tfy2 := ren.drawable.Height()\n\n\tif scaleX != 1 || scaleY != 1 {\n\t\t//fx *= scaleX\n\t\t//fy *= scaleY\n\t\tfx2 *= scaleX\n\t\tfy2 *= scaleY\n\t}\n\n\tp1x := fx\n\tp1y := fy\n\tp2x := fx\n\tp2y := fy2\n\tp3x := fx2\n\tp3y := fy2\n\tp4x := fx2\n\tp4y := fy\n\n\tvar x1 float32\n\tvar y1 float32\n\tvar x2 float32\n\tvar y2 float32\n\tvar x3 float32\n\tvar y3 float32\n\tvar x4 float32\n\tvar y4 float32\n\n\tif rotation != 0 {\n\t\trot := rotation * (math.Pi / 180.0)\n\n\t\tcos := math.Cos(rot)\n\t\tsin := math.Sin(rot)\n\n\t\tx1 = cos*p1x - sin*p1y\n\t\ty1 = sin*p1x + cos*p1y\n\n\t\tx2 = cos*p2x - sin*p2y\n\t\ty2 = sin*p2x + cos*p2y\n\n\t\tx3 = cos*p3x - sin*p3y\n\t\ty3 = sin*p3x + cos*p3y\n\n\t\tx4 = x1 + (x3 - x2)\n\t\ty4 = y3 - (y2 - y1)\n\t} else {\n\t\tx1 = p1x\n\t\ty1 = p1y\n\n\t\tx2 = p2x\n\t\ty2 = p2y\n\n\t\tx3 = p3x\n\t\ty3 = p3y\n\n\t\tx4 = p4x\n\t\ty4 = p4y\n\t}\n\n\tcolorR, colorG, colorB, _ := c.RGBA()\n\n\tred := colorR\n\tgreen := colorG << 8\n\tblue := colorB << 16\n\talpha := uint32(transparency*255.0) << 24\n\n\ttint := math.Float32frombits((alpha | blue | green | red) & 0xfeffffff)\n\n\tu, v, u2, v2 := ren.drawable.View()\n\n\treturn []float32{x1, y1, u, v, tint, x4, y4, u2, v, tint, x3, y3, u2, v2, tint, x2, y2, u, v2, tint}\n}", "func AdjustBufferAmount(publishingRate float64, currentReplicas float64, currentBuffer float64, currentPerf float64, bufferThreshold float64, initialBuffer int32) (newBufferSize int32) {\n\tusage := publishingRate / ((currentReplicas - currentBuffer) * currentPerf)\n\n\tbufferThresh := bufferThreshold / 100.0\n\n\t//if the usage is touching the buffer check how much.\n\tif usage > 1 {\n\t\tdifference := publishingRate - ((currentReplicas - currentBuffer) * currentPerf)\n\t\tbufferUsage := difference / (currentBuffer * currentPerf)\n\t\tif bufferUsage > bufferThresh {\n\t\t\treturn int32(currentBuffer + 1)\n\t\t}\n\t} else {\n\t\t// if usage is less then we need to scale down the buffer\n\t\t// TODO: check this to add initialbuffer\n\t\treturn int32(math.Max(float64(initialBuffer), currentBuffer-1))\n\t}\n\treturn int32(currentBuffer)\n}", "func (self *scroll) Size() float64 {\n\treturn self.size\n}", "func (tv *TextView) RenderRegionToEnd(st TextPos, sty *gi.Style, bgclr *gi.ColorSpec) {\n\tspos := tv.CharStartPos(st)\n\tepos := spos\n\tepos.Y += tv.LineHeight\n\tepos.X = float32(tv.VpBBox.Max.X)\n\tif int(mat32.Ceil(epos.Y)) < tv.VpBBox.Min.Y || int(mat32.Floor(spos.Y)) > tv.VpBBox.Max.Y {\n\t\treturn\n\t}\n\n\trs := &tv.Viewport.Render\n\tpc := &rs.Paint\n\n\tpc.FillBox(rs, spos, epos.Sub(spos), bgclr) // same line, done\n}", "func (g *Game) getSpareBonus(rollIndex int) int {\n\treturn g.rolls[rollIndex+2]\n}", "func (_this *IntersectionObserverEntry) IntersectionRect() *geometry.DOMRectReadOnly {\n\tvar ret *geometry.DOMRectReadOnly\n\tvalue := _this.Value_JS.Get(\"intersectionRect\")\n\tret = geometry.DOMRectReadOnlyFromJS(value)\n\treturn ret\n}", "func (r *Ring) HighestCompleteOffset() int { return r.highestComplete }", "func (v *TextView) GetLineYrange(iter *TextIter) (y, height int) {\n\tvar yx, heightx C.gint\n\tC.gtk_text_view_get_line_yrange(v.native(), iter.native(), &yx, &heightx)\n\treturn int(yx), int(heightx)\n}", "func (d *Device) GetHighestScanLine() uint16 {\n\t// Last scanline id appears to be backporch/2 + 320/2\n\treturn uint16(math.Ceil(float64(d.vSyncLines)/2)/2) + 160\n}", "func getScreenResourcesCurrentRequest(c *xgb.Conn, Window xproto.Window) []byte {\n\tsize := 8\n\tb := 0\n\tbuf := make([]byte, size)\n\n\tc.ExtLock.RLock()\n\tbuf[b] = c.Extensions[\"RANDR\"]\n\tc.ExtLock.RUnlock()\n\tb += 1\n\n\tbuf[b] = 25 // request opcode\n\tb += 1\n\n\txgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units\n\tb += 2\n\n\txgb.Put32(buf[b:], uint32(Window))\n\tb += 4\n\n\treturn buf\n}", "func DrawRangeElements(mode uint32, start uint32, end uint32, count int32, xtype uint32, indices unsafe.Pointer) {\n\tsyscall.Syscall6(gpDrawRangeElements, 6, uintptr(mode), uintptr(start), uintptr(end), uintptr(count), uintptr(xtype), uintptr(indices))\n}", "func (s *videoController) calculateWindowShade(line uint8, dot uint8) (Shade, shadePriority) {\n\tif !s.readFlag(flagBGWindowDisplay) {\n\t\treturn transparrent, shadePriorityHidden\n\t}\n\n\tif !s.readFlag(flagWindowDisplay) {\n\t\treturn transparrent, shadePriorityHidden\n\t}\n\n\twindowStartY := int(s.readRegister(registerFF4A))\n\twindowStartX := int(s.readRegister(registerFF4B)) - 7\n\n\tif int(line) < windowStartY || int(dot) < windowStartX {\n\t\treturn transparrent, shadePriorityHidden\n\t}\n\n\tif windowStartX < 0 || windowStartX == 159 {\n\t\tlog.Printf(\"Warning: window X position set to %d which triggers a hardware bug that is not emulated\", windowStartX)\n\t}\n\n\twindowY := uint16(int(line) - windowStartY)\n\twindowX := uint16(int(dot) - windowStartX)\n\n\t// Find tile # in Window Tile Map. Every tile in the window tile map\n\t// represents a 8x8 pixel area.\n\ttileNumber := s.lookupTileNumber(windowY, windowX, s.readFlag(flagWindowTileMapSelect))\n\ttileY := uint8(windowY % 8)\n\ttileX := uint8(windowX % 8)\n\n\t// lookup color number for x,y coordinate within tile (referenced by tile number)\n\tcolorNum := s.lookupTile(tileY, tileX, tileNumber, s.readFlag(flagBGWindowTileDataSelect))\n\n\tshadePriority := shadePriorityBackgroundWindowOther\n\tif colorNum == 0 {\n\t\tshadePriority = shadePriorityBackgroundWindowZero\n\t}\n\n\tshadePlatter := s.readRegister(registerFF47)\n\treturn lookupShadeInPlatter(shadePlatter, colorNum), shadePriority\n}", "func (e *Editor) offsetToScreenPos(offset int) (combinedPos, func(int) combinedPos) {\n\tvar col, line, idx int\n\tvar x fixed.Int26_6\n\n\tl := e.lines[line]\n\ty := l.Ascent.Ceil()\n\tprevDesc := l.Descent\n\n\titer := func(offset int) combinedPos {\n\tLOOP:\n\t\tfor {\n\t\t\tfor ; col < len(l.Layout.Advances); col++ {\n\t\t\t\tif idx >= offset {\n\t\t\t\t\tbreak LOOP\n\t\t\t\t}\n\n\t\t\t\tx += l.Layout.Advances[col]\n\t\t\t\t_, s := e.editBuffer.runeAt(idx)\n\t\t\t\tidx += s\n\t\t\t}\n\t\t\tif lastLine := line == len(e.lines)-1; lastLine || idx > offset {\n\t\t\t\tbreak LOOP\n\t\t\t}\n\n\t\t\tline++\n\t\t\tx = 0\n\t\t\tcol = 0\n\t\t\tl = e.lines[line]\n\t\t\ty += (prevDesc + l.Ascent).Ceil()\n\t\t\tprevDesc = l.Descent\n\t\t}\n\t\treturn combinedPos{\n\t\t\tlineCol: screenPos{Y: line, X: col},\n\t\t\tx: x + align(e.alignment, e.lines[line].Width, e.viewSize.X),\n\t\t\ty: y,\n\t\t\tofs: offset,\n\t\t}\n\t}\n\treturn iter(offset), iter\n}", "func (e *Emulator) calculateGutterForViewableArea() int {\n\tmaxGutterInX := (e.sz.WidthPx - 2*e.Margin) / (e.PixelPitchToGutterRatio*e.Width + e.Width - 1)\n\tmaxGutterInY := (e.sz.HeightPx - 2*e.Margin) / (e.PixelPitchToGutterRatio*e.Height + e.Height - 1)\n\tif maxGutterInX < maxGutterInY {\n\t\treturn maxGutterInX\n\t}\n\treturn maxGutterInY\n}", "func (s *ItemScroller) hRecalc() {\n\n\t// Checks if scroll bar should be visible or not\n\tscroll := false\n\tif s.first > 0 {\n\t\tscroll = true\n\t} else {\n\t\tvar posX float32\n\t\tfor _, item := range s.items[s.first:] {\n\t\t\tposX += item.GetPanel().Width()\n\t\t\tif posX > s.width {\n\t\t\t\tscroll = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\ts.setHScrollBar(scroll)\n\n\t// Compute size of scroll button\n\tif scroll && s.autoButtonSize {\n\t\tvar totalWidth float32\n\t\tfor _, item := range s.items {\n\t\t\t// TODO OPTIMIZATION\n\t\t\t// Break when the view/content proportion becomes smaller than the minimum button size\n\t\t\ttotalWidth += item.GetPanel().Width()\n\t\t}\n\t\ts.hscroll.SetButtonSize(s.width * s.width / totalWidth)\n\t}\n\n\t// Items height\n\theight := s.ContentHeight()\n\tif scroll {\n\t\theight -= s.hscroll.Height()\n\t}\n\n\tvar posX float32\n\t// Sets positions of all items\n\tfor pos, ipan := range s.items {\n\t\titem := ipan.GetPanel()\n\t\t// If item is before first visible, sets not visible\n\t\tif pos < s.first {\n\t\t\titem.SetVisible(false)\n\t\t\tcontinue\n\t\t}\n\t\t// If item is after last visible, sets not visible\n\t\tif posX > s.width {\n\t\t\titem.SetVisible(false)\n\t\t\tcontinue\n\t\t}\n\t\t// Sets item position\n\t\titem.SetVisible(true)\n\t\titem.SetPosition(posX, 0)\n\t\tif s.adjustItem {\n\t\t\titem.SetHeight(height)\n\t\t}\n\t\tposX += item.Width()\n\t}\n\n\t// Set scroll bar value if recalc was not due by scroll event\n\tif scroll && !s.scrollBarEvent {\n\t\ts.hscroll.SetValue(float32(s.first) / float32(s.maxFirst()))\n\t}\n\ts.scrollBarEvent = false\n}", "func (o *CanvasItem) X_EditGetScale() gdnative.Vector2 {\n\t//log.Println(\"Calling CanvasItem.X_EditGetScale()\")\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_scale\")\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 (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 (rm *resourceManager) sdkFind(\n\tctx context.Context,\n\tr *resource,\n) (*resource, error) {\n\t// If any required fields in the input shape are missing, AWS resource is\n\t// not created yet. Return NotFound here to indicate to callers that the\n\t// resource isn't yet created.\n\tif rm.requiredFieldsMissingFromReadOneInput(r) {\n\t\treturn nil, ackerr.NotFound\n\t}\n\n\tinput, err := rm.newDescribeRequestPayload(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp, respErr := rm.sdkapi.GetStageWithContext(ctx, input)\n\trm.metrics.RecordAPICall(\"READ_ONE\", \"GetStage\", respErr)\n\tif respErr != nil {\n\t\tif awsErr, ok := ackerr.AWSError(respErr); ok && awsErr.Code() == \"NotFoundException\" {\n\t\t\treturn nil, ackerr.NotFound\n\t\t}\n\t\treturn nil, respErr\n\t}\n\n\t// Merge in the information we read from the API call above to the copy of\n\t// the original Kubernetes object we passed to the function\n\tko := r.ko.DeepCopy()\n\n\tif resp.AccessLogSettings != nil {\n\t\tf0 := &svcapitypes.AccessLogSettings{}\n\t\tif resp.AccessLogSettings.DestinationArn != nil {\n\t\t\tf0.DestinationARN = resp.AccessLogSettings.DestinationArn\n\t\t}\n\t\tif resp.AccessLogSettings.Format != nil {\n\t\t\tf0.Format = resp.AccessLogSettings.Format\n\t\t}\n\t\tko.Spec.AccessLogSettings = f0\n\t}\n\tif resp.ApiGatewayManaged != nil {\n\t\tko.Status.APIGatewayManaged = resp.ApiGatewayManaged\n\t}\n\tif resp.AutoDeploy != nil {\n\t\tko.Spec.AutoDeploy = resp.AutoDeploy\n\t}\n\tif resp.ClientCertificateId != nil {\n\t\tko.Spec.ClientCertificateID = resp.ClientCertificateId\n\t}\n\tif resp.CreatedDate != nil {\n\t\tko.Status.CreatedDate = &metav1.Time{*resp.CreatedDate}\n\t}\n\tif resp.DefaultRouteSettings != nil {\n\t\tf5 := &svcapitypes.RouteSettings{}\n\t\tif resp.DefaultRouteSettings.DataTraceEnabled != nil {\n\t\t\tf5.DataTraceEnabled = resp.DefaultRouteSettings.DataTraceEnabled\n\t\t}\n\t\tif resp.DefaultRouteSettings.DetailedMetricsEnabled != nil {\n\t\t\tf5.DetailedMetricsEnabled = resp.DefaultRouteSettings.DetailedMetricsEnabled\n\t\t}\n\t\tif resp.DefaultRouteSettings.LoggingLevel != nil {\n\t\t\tf5.LoggingLevel = resp.DefaultRouteSettings.LoggingLevel\n\t\t}\n\t\tif resp.DefaultRouteSettings.ThrottlingBurstLimit != nil {\n\t\t\tf5.ThrottlingBurstLimit = resp.DefaultRouteSettings.ThrottlingBurstLimit\n\t\t}\n\t\tif resp.DefaultRouteSettings.ThrottlingRateLimit != nil {\n\t\t\tf5.ThrottlingRateLimit = resp.DefaultRouteSettings.ThrottlingRateLimit\n\t\t}\n\t\tko.Spec.DefaultRouteSettings = f5\n\t}\n\tif resp.DeploymentId != nil {\n\t\tko.Spec.DeploymentID = resp.DeploymentId\n\t}\n\tif resp.Description != nil {\n\t\tko.Spec.Description = resp.Description\n\t}\n\tif resp.LastDeploymentStatusMessage != nil {\n\t\tko.Status.LastDeploymentStatusMessage = resp.LastDeploymentStatusMessage\n\t}\n\tif resp.LastUpdatedDate != nil {\n\t\tko.Status.LastUpdatedDate = &metav1.Time{*resp.LastUpdatedDate}\n\t}\n\tif resp.RouteSettings != nil {\n\t\tf10 := map[string]*svcapitypes.RouteSettings{}\n\t\tfor f10key, f10valiter := range resp.RouteSettings {\n\t\t\tf10val := &svcapitypes.RouteSettings{}\n\t\t\tif f10valiter.DataTraceEnabled != nil {\n\t\t\t\tf10val.DataTraceEnabled = f10valiter.DataTraceEnabled\n\t\t\t}\n\t\t\tif f10valiter.DetailedMetricsEnabled != nil {\n\t\t\t\tf10val.DetailedMetricsEnabled = f10valiter.DetailedMetricsEnabled\n\t\t\t}\n\t\t\tif f10valiter.LoggingLevel != nil {\n\t\t\t\tf10val.LoggingLevel = f10valiter.LoggingLevel\n\t\t\t}\n\t\t\tif f10valiter.ThrottlingBurstLimit != nil {\n\t\t\t\tf10val.ThrottlingBurstLimit = f10valiter.ThrottlingBurstLimit\n\t\t\t}\n\t\t\tif f10valiter.ThrottlingRateLimit != nil {\n\t\t\t\tf10val.ThrottlingRateLimit = f10valiter.ThrottlingRateLimit\n\t\t\t}\n\t\t\tf10[f10key] = f10val\n\t\t}\n\t\tko.Spec.RouteSettings = f10\n\t}\n\tif resp.StageName != nil {\n\t\tko.Spec.StageName = resp.StageName\n\t}\n\tif resp.StageVariables != nil {\n\t\tf12 := map[string]*string{}\n\t\tfor f12key, f12valiter := range resp.StageVariables {\n\t\t\tvar f12val string\n\t\t\tf12val = *f12valiter\n\t\t\tf12[f12key] = &f12val\n\t\t}\n\t\tko.Spec.StageVariables = f12\n\t}\n\tif resp.Tags != nil {\n\t\tf13 := map[string]*string{}\n\t\tfor f13key, f13valiter := range resp.Tags {\n\t\t\tvar f13val string\n\t\t\tf13val = *f13valiter\n\t\t\tf13[f13key] = &f13val\n\t\t}\n\t\tko.Spec.Tags = f13\n\t}\n\n\trm.setStatusDefaults(ko)\n\treturn &resource{ko}, nil\n}", "func (s *Slicer) PrepareRenderY() error {\n\tleft := float32(s.irmf.Min[0])\n\tright := float32(s.irmf.Max[0])\n\tbottom := float32(s.irmf.Min[2])\n\ttop := float32(s.irmf.Max[2])\n\tcamera := mgl32.LookAtV(mgl32.Vec3{0, -3, 0}, mgl32.Vec3{0, 0, 0}, mgl32.Vec3{0, 0, 1})\n\tvec3Str := \"fragVert.x,u_slice,fragVert.z\"\n\n\tyPlaneVertices[0], yPlaneVertices[10], yPlaneVertices[25] = left, left, left\n\tyPlaneVertices[5], yPlaneVertices[15], yPlaneVertices[20] = right, right, right\n\tyPlaneVertices[2], yPlaneVertices[7], yPlaneVertices[17] = bottom, bottom, bottom\n\tyPlaneVertices[12], yPlaneVertices[22], yPlaneVertices[27] = top, top, top\n\n\taspectRatio := ((right - left) * s.deltaZ) / ((top - bottom) * s.deltaX)\n\tnewWidth := int(0.5 + (right-left)/float32(s.deltaX))\n\tnewHeight := int(0.5 + (top-bottom)/float32(s.deltaZ))\n\tlog.Printf(\"aspectRatio=%v, newWidth=%v, newHeight=%v\", aspectRatio, newWidth, newHeight)\n\tif aspectRatio*float32(newHeight) < float32(newWidth) {\n\t\tnewHeight = int(0.5 + float32(newWidth)/aspectRatio)\n\t}\n\n\treturn s.prepareRender(newWidth, newHeight, left, right, bottom, top, camera, vec3Str, yPlaneVertices)\n}", "func (s *store) GetRanges(ctx context.Context, bundleID int, path string, startLine, endLine int) (_ []shared.CodeIntelligenceRange, err error) {\n\tctx, _, endObservation := s.operations.getRanges.With(ctx, &err, observation.Args{LogFields: []log.Field{\n\t\tlog.Int(\"bundleID\", bundleID),\n\t\tlog.String(\"path\", path),\n\t\tlog.Int(\"startLine\", startLine),\n\t\tlog.Int(\"endLine\", endLine),\n\t}})\n\tdefer endObservation(1, observation.Args{})\n\n\tdocumentData, exists, err := s.scanFirstDocumentData(s.db.Query(ctx, sqlf.Sprintf(\n\t\trangesDocumentQuery,\n\t\tbundleID,\n\t\tpath,\n\t)))\n\tif err != nil || !exists {\n\t\treturn nil, err\n\t}\n\n\tvar ranges []shared.CodeIntelligenceRange\n\tfor _, occurrence := range documentData.SCIPData.Occurrences {\n\t\tr := translateRange(scip.NewRange(occurrence.Range))\n\n\t\tif (startLine <= r.Start.Line && r.Start.Line < endLine) || (startLine <= r.End.Line && r.End.Line < endLine) {\n\t\t\tdata := extractOccurrenceData(documentData.SCIPData, occurrence)\n\n\t\t\tranges = append(ranges, shared.CodeIntelligenceRange{\n\t\t\t\tRange: r,\n\t\t\t\tDefinitions: convertSCIPRangesToLocations(data.definitions, bundleID, path),\n\t\t\t\tReferences: convertSCIPRangesToLocations(data.references, bundleID, path),\n\t\t\t\tImplementations: convertSCIPRangesToLocations(data.implementations, bundleID, path),\n\t\t\t\tHoverText: strings.Join(data.hoverText, \"\\n\"),\n\t\t\t})\n\t\t}\n\t}\n\n\treturn ranges, nil\n}", "func stepRU(position Point, slice [][]int32) Point {\n\tif position.x+2 < len(slice) &&\n\t\tposition.y-1 >= 0 &&\n\t\tslice[position.y-1][position.x+2] == 0 {\n\t\treturn Point{\n\t\t\tx: position.x + 2,\n\t\t\ty: position.y - 1,\n\t\t}\n\t}\n\treturn notPoint\n}", "func (self *bestFit) calculateLine(xmax epochDays) error {\n\n\t// Check for data\n\tif len(self.ys) < 2 {\n\t\treturn ENOTENOUGHDATAPOINTS\n\t}\n\t\n\t// Calculate sums\n\tvar ySum float64\n\tvar xSum float64\n\tvar xxSum float64\n\tvar xySum float64 \n\txorigin := xmax - epochDays(len(self.ys)-1) \n\tfor x,y := range self.ys {\n\t\trealx:= float64(xorigin)+float64(x)\n\t\tySum += y\n\t\txSum += realx\n\t\txxSum += realx*realx\n\t\txySum += realx*y\n\t}\n\tn := float64(len(self.ys))\n\n\t// Calculate gradient and offset\n\tc := ((ySum*xxSum) - (xSum*xySum)) / ((n*xxSum) - (xSum*xSum))\n\tm := ((n*xySum) - (xSum*ySum)) / ((n*xxSum) - (xSum*xSum))\n\tif (self.c != c || self.m != m) {\n\t\tself.pv++\n\t\tself.c=c\n\t\tself.m=m\n\t}\n\tlogInfo(\"m=\",self.m,\"c=\",self.c)\n\treturn nil\n}", "func (o *CanvasItem) GetViewportRect() gdnative.Rect2 {\n\t//log.Println(\"Calling CanvasItem.GetViewportRect()\")\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\", \"get_viewport_rect\")\n\n\t// Call the parent method.\n\t// Rect2\n\tretPtr := gdnative.NewEmptyRect2()\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.NewRect2FromPointer(retPtr)\n\treturn ret\n}", "func getScreenSizeRangeReply(buf []byte) *GetScreenSizeRangeReply {\n\tv := new(GetScreenSizeRangeReply)\n\tb := 1 // skip reply determinant\n\n\tb += 1 // padding\n\n\tv.Sequence = xgb.Get16(buf[b:])\n\tb += 2\n\n\tv.Length = xgb.Get32(buf[b:]) // 4-byte units\n\tb += 4\n\n\tv.MinWidth = xgb.Get16(buf[b:])\n\tb += 2\n\n\tv.MinHeight = xgb.Get16(buf[b:])\n\tb += 2\n\n\tv.MaxWidth = xgb.Get16(buf[b:])\n\tb += 2\n\n\tv.MaxHeight = xgb.Get16(buf[b:])\n\tb += 2\n\n\tb += 16 // padding\n\n\treturn v\n}", "func ApplyOfficialWindowScaling(storedValue int, rescaleSlope, rescaleIntercept, windowWidth, windowCenter float64, bitsAllocated uint16) uint16 {\n\t// 1: StoredValue to ModalityValue\n\tvar modalityValue float64\n\tif rescaleSlope == 0 {\n\t\t// Via https://dgobbi.github.io/vtk-dicom/doc/api/image_display.html :\n\t\t// For modalities such as ultrasound and MRI that do not have any units,\n\t\t// the RescaleSlope and RescaleIntercept are absent and the Modality\n\t\t// Values are equal to the Stored Values.\n\t\tmodalityValue = float64(storedValue)\n\t} else {\n\t\t// Otherwise, we can apply the rescale slope and intercept to the stored\n\t\t// value.\n\t\tmodalityValue = float64(storedValue)*rescaleSlope + rescaleIntercept\n\t}\n\n\t// 2: ModalityValue to WindowedValue\n\n\t// The key here is that we're using bitsAllocated (e.g., 16 bits) instead of\n\t// bitsStored (e.g., 11 bits)\n\tvar grayLevels float64\n\tswitch bitsAllocated {\n\t// Precompute common cases so you're not exponentiating in the hot path\n\tcase 16:\n\t\tgrayLevels = 65536\n\tcase 8:\n\t\tgrayLevels = 256\n\tdefault:\n\t\tgrayLevels = math.Pow(2, float64(bitsAllocated))\n\t}\n\n\t// We are creating a 16-bit image, so we need to scale the modality value to\n\t// the range of 0-65535. Particularly if we're using 8-bit, then we need to\n\t// scale the 0-255 range to 0-65535, otherwise the images will look black.\n\tsixteenBitCorrection := math.MaxUint16 / uint16(grayLevels-1)\n\n\t// Via https://dgobbi.github.io/vtk-dicom/doc/api/image_display.html : For\n\t// ultrasound (and for 8-bit images in general) the WindowWidth and\n\t// WindowCenter may be absent from the file. If absent, they can be assumed\n\t// to be 256 and 128 respectively, which provides an 8-bit identity mapping.\n\t// Here, instead of assuming 8 bit, we use the grayLevels value.\n\tif windowWidth == 0 && windowCenter == 0 {\n\t\twindowWidth = grayLevels\n\t\twindowCenter = grayLevels / 2\n\t}\n\n\tw := windowWidth - 1.0\n\tc := windowCenter - 0.5\n\n\t// Below the lower bound of our window, draw black\n\tif modalityValue <= c-0.5*w {\n\t\treturn 0\n\t}\n\n\t// Above the upper bound of our window, draw white\n\tif modalityValue > c+0.5*w {\n\t\treturn uint16(grayLevels-1.0) * sixteenBitCorrection\n\t}\n\n\t// Within the window, return a scaled value\n\treturn uint16(((modalityValue-c)/w+0.5)*(grayLevels-1.0)) * sixteenBitCorrection\n\n}", "func _EvtRender(\n\tcontext EvtHandle,\n\tfragment EvtHandle,\n\tflags EvtRenderFlag,\n\tbufferSize uint32,\n\tbuffer *byte,\n\tbufferUsed *uint32,\n\tpropertyCount *uint32,\n) error {\n\tr1, _, e1 := syscall.SyscallN(\n\t\tprocEvtRender.Addr(),\n\t\tuintptr(context),\n\t\tuintptr(fragment),\n\t\tuintptr(flags),\n\t\tuintptr(bufferSize),\n\t\tuintptr(unsafe.Pointer(buffer)), //nolint:gosec // G103: Valid use of unsafe call to pass buffer\n\t\tuintptr(unsafe.Pointer(bufferUsed)), //nolint:gosec // G103: Valid use of unsafe call to pass bufferUsed\n\t\tuintptr(unsafe.Pointer(propertyCount)), //nolint:gosec // G103: Valid use of unsafe call to pass propertyCount\n\t)\n\n\tvar err error\n\tif r1 == 0 {\n\t\tif e1 != 0 {\n\t\t\terr = errnoErr(e1)\n\t\t} else {\n\t\t\terr = syscall.EINVAL\n\t\t}\n\t}\n\treturn err\n}", "func (p *Stream) GetReadPos() int {\n\treturn p.readSeg*streamBlockSize + p.readIndex\n}", "func (this *DtNavMeshQuery) UpdateSlicedFindPath(maxIter int, doneIters *int) DtStatus {\n\tif !DtStatusInProgress(this.m_query.status) {\n\t\treturn this.m_query.status\n\t}\n\t// Make sure the request is still valid.\n\tif !this.m_nav.IsValidPolyRef(this.m_query.startRef) || !this.m_nav.IsValidPolyRef(this.m_query.endRef) {\n\t\tthis.m_query.status = DT_FAILURE\n\t\treturn DT_FAILURE\n\t}\n\n\trayHit := DtRaycastHit{}\n\trayHit.MaxPath = 0\n\n\titer := 0\n\tfor iter < maxIter && !this.m_openList.Empty() {\n\t\titer++\n\n\t\t// Remove node from open list and put it in closed list.\n\t\tbestNode := this.m_openList.Pop()\n\t\tbestNode.Flags &= ^DT_NODE_OPEN\n\t\tbestNode.Flags |= DT_NODE_CLOSED\n\n\t\t// Reached the goal, stop searching.\n\t\tif bestNode.Id == this.m_query.endRef {\n\t\t\tthis.m_query.lastBestNode = bestNode\n\t\t\tdetails := this.m_query.status & DT_STATUS_DETAIL_MASK\n\t\t\tthis.m_query.status = DT_SUCCESS | details\n\t\t\tif doneIters != nil {\n\t\t\t\t*doneIters = iter\n\t\t\t}\n\t\t\treturn this.m_query.status\n\t\t}\n\n\t\t// Get current poly and tile.\n\t\t// The API input has been cheked already, skip checking internal data.\n\t\tbestRef := bestNode.Id\n\t\tvar bestTile *DtMeshTile\n\t\tvar bestPoly *DtPoly\n\t\tif DtStatusFailed(this.m_nav.GetTileAndPolyByRef(bestRef, &bestTile, &bestPoly)) {\n\t\t\t// The polygon has disappeared during the sliced query, fail.\n\t\t\tthis.m_query.status = DT_FAILURE\n\t\t\tif doneIters != nil {\n\t\t\t\t*doneIters = iter\n\t\t\t}\n\t\t\treturn this.m_query.status\n\t\t}\n\n\t\t// Get parent and grand parent poly and tile.\n\t\tvar parentRef, grandpaRef DtPolyRef\n\t\tvar parentTile *DtMeshTile\n\t\tvar parentPoly *DtPoly\n\t\tvar parentNode *DtNode\n\t\tif bestNode.Pidx != 0 {\n\t\t\tparentNode = this.m_nodePool.GetNodeAtIdx(bestNode.Pidx)\n\t\t\tparentRef = parentNode.Id\n\t\t\tif parentNode.Pidx != 0 {\n\t\t\t\tgrandpaRef = this.m_nodePool.GetNodeAtIdx(parentNode.Pidx).Id\n\t\t\t}\n\t\t}\n\t\tif parentRef != 0 {\n\t\t\tinvalidParent := DtStatusFailed(this.m_nav.GetTileAndPolyByRef(parentRef, &parentTile, &parentPoly))\n\t\t\tif invalidParent || (grandpaRef != 0 && !this.m_nav.IsValidPolyRef(grandpaRef)) {\n\t\t\t\t// The polygon has disappeared during the sliced query, fail.\n\t\t\t\tthis.m_query.status = DT_FAILURE\n\t\t\t\tif doneIters != nil {\n\t\t\t\t\t*doneIters = iter\n\t\t\t\t}\n\t\t\t\treturn this.m_query.status\n\t\t\t}\n\t\t}\n\n\t\t// decide whether to test raycast to previous nodes\n\t\ttryLOS := false\n\t\tif (this.m_query.options & DT_FINDPATH_ANY_ANGLE) != 0 {\n\t\t\tif (parentRef != 0) && (DtVdistSqr(parentNode.Pos[:], bestNode.Pos[:]) < this.m_query.raycastLimitSqr) {\n\t\t\t\ttryLOS = true\n\t\t\t}\n\t\t}\n\n\t\tfor i := bestPoly.FirstLink; i != DT_NULL_LINK; i = bestTile.Links[i].Next {\n\t\t\tneighbourRef := bestTile.Links[i].Ref\n\n\t\t\t// Skip invalid ids and do not expand back to where we came from.\n\t\t\tif neighbourRef == 0 || neighbourRef == parentRef {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// Get neighbour poly and tile.\n\t\t\t// The API input has been cheked already, skip checking internal data.\n\t\t\tvar neighbourTile *DtMeshTile\n\t\t\tvar neighbourPoly *DtPoly\n\t\t\tthis.m_nav.GetTileAndPolyByRefUnsafe(neighbourRef, &neighbourTile, &neighbourPoly)\n\n\t\t\tif !this.m_query.filter.PassFilter(neighbourRef, neighbourTile, neighbourPoly) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// get the neighbor node\n\t\t\tneighbourNode := this.m_nodePool.GetNode(neighbourRef, 0)\n\t\t\tif neighbourNode == nil {\n\t\t\t\tthis.m_query.status |= DT_OUT_OF_NODES\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// do not expand to nodes that were already visited from the same parent\n\t\t\tif neighbourNode.Pidx != 0 && neighbourNode.Pidx == bestNode.Pidx {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// If the node is visited the first time, calculate node position.\n\t\t\tif neighbourNode.Flags == 0 {\n\t\t\t\tthis.getEdgeMidPoint2(bestRef, bestPoly, bestTile,\n\t\t\t\t\tneighbourRef, neighbourPoly, neighbourTile,\n\t\t\t\t\tneighbourNode.Pos[:])\n\t\t\t}\n\n\t\t\t// Calculate cost and heuristic.\n\t\t\tvar cost float32\n\t\t\tvar heuristic float32\n\n\t\t\t// raycast parent\n\t\t\tfoundShortCut := false\n\t\t\trayHit.PathCost = 0\n\t\t\trayHit.T = 0\n\t\t\tif tryLOS {\n\t\t\t\tthis.Raycast2(parentRef, parentNode.Pos[:], neighbourNode.Pos[:], this.m_query.filter, DT_RAYCAST_USE_COSTS, &rayHit, grandpaRef)\n\t\t\t\tfoundShortCut = (rayHit.T >= 1.0)\n\t\t\t}\n\n\t\t\t// update move cost\n\t\t\tif foundShortCut {\n\t\t\t\t// shortcut found using raycast. Using shorter cost instead\n\t\t\t\tcost = parentNode.Cost + rayHit.PathCost\n\t\t\t} else {\n\t\t\t\t// No shortcut found.\n\t\t\t\tcurCost := this.m_query.filter.GetCost(bestNode.Pos[:], neighbourNode.Pos[:],\n\t\t\t\t\tparentRef, parentTile, parentPoly,\n\t\t\t\t\tbestRef, bestTile, bestPoly,\n\t\t\t\t\tneighbourRef, neighbourTile, neighbourPoly)\n\t\t\t\tcost = bestNode.Cost + curCost\n\t\t\t}\n\n\t\t\t// Special case for last node.\n\t\t\tif neighbourRef == this.m_query.endRef {\n\t\t\t\tendCost := this.m_query.filter.GetCost(neighbourNode.Pos[:], this.m_query.endPos[:],\n\t\t\t\t\tbestRef, bestTile, bestPoly,\n\t\t\t\t\tneighbourRef, neighbourTile, neighbourPoly,\n\t\t\t\t\t0, nil, nil)\n\n\t\t\t\tcost = cost + endCost\n\t\t\t\theuristic = 0\n\t\t\t} else {\n\t\t\t\theuristic = DtVdist(neighbourNode.Pos[:], this.m_query.endPos[:]) * H_SCALE\n\t\t\t}\n\n\t\t\ttotal := cost + heuristic\n\n\t\t\t// The node is already in open list and the new result is worse, skip.\n\t\t\tif (neighbourNode.Flags&DT_NODE_OPEN) != 0 && total >= neighbourNode.Total {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// The node is already visited and process, and the new result is worse, skip.\n\t\t\tif (neighbourNode.Flags&DT_NODE_CLOSED) != 0 && total >= neighbourNode.Total {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// Add or update the node.\n\t\t\tif foundShortCut {\n\t\t\t\tneighbourNode.Pidx = bestNode.Pidx\n\t\t\t} else {\n\t\t\t\tneighbourNode.Pidx = this.m_nodePool.GetNodeIdx(bestNode)\n\t\t\t}\n\t\t\tneighbourNode.Id = neighbourRef\n\t\t\tneighbourNode.Flags = (neighbourNode.Flags & ^(DT_NODE_CLOSED | DT_NODE_PARENT_DETACHED))\n\t\t\tneighbourNode.Cost = cost\n\t\t\tneighbourNode.Total = total\n\t\t\tif foundShortCut {\n\t\t\t\tneighbourNode.Flags = (neighbourNode.Flags | DT_NODE_PARENT_DETACHED)\n\t\t\t}\n\t\t\tif (neighbourNode.Flags & DT_NODE_OPEN) != 0 {\n\t\t\t\t// Already in open, update node location.\n\t\t\t\tthis.m_openList.Modify(neighbourNode)\n\t\t\t} else {\n\t\t\t\t// Put the node in open list.\n\t\t\t\tneighbourNode.Flags |= DT_NODE_OPEN\n\t\t\t\tthis.m_openList.Push(neighbourNode)\n\t\t\t}\n\n\t\t\t// Update nearest node to target so far.\n\t\t\tif heuristic < this.m_query.lastBestNodeCost {\n\t\t\t\tthis.m_query.lastBestNodeCost = heuristic\n\t\t\t\tthis.m_query.lastBestNode = neighbourNode\n\t\t\t}\n\t\t}\n\t}\n\n\t// Exhausted all nodes, but could not find path.\n\tif this.m_openList.Empty() {\n\t\tdetails := this.m_query.status & DT_STATUS_DETAIL_MASK\n\t\tthis.m_query.status = DT_SUCCESS | details\n\t}\n\n\tif doneIters != nil {\n\t\t*doneIters = iter\n\t}\n\n\treturn this.m_query.status\n}", "func (b *Buffer) Remaining(from Cursor) uint64 {\n\tb.mu.RLock()\n\tdefer b.mu.RUnlock()\n\n\tif from.offset > b.last {\n\t\treturn 0\n\t}\n\n\toff := from.offset\n\tif off < b.first {\n\t\toff = b.first\n\t}\n\tremaining := b.last - off\n\tremaining += uint64(b.frameSize(b.last))\n\treturn remaining\n}", "func (b *BaseElement) CalculateStyle() {\n\tif b.IsHidden() {\n\t\treturn\n\t}\n\tvar x, y, ax, ay, w, minw, maxw, h, minh, maxh, pt, pb, pl, pr, mt, mb, ml, mr, sl, st int32 = b.x, b.y, b.ax, b.ay, b.w, 0, 0, b.h, 0, 0, b.pt, b.pb, b.pl, b.pr, b.mt, b.mb, b.ml, b.mr, b.sl, b.st\n\tif b.Parent != nil {\n\t\tif b.Style.X.Percentage {\n\t\t\tx = int32(b.Style.X.PercentOf(float64(b.Parent.GetWidth())))\n\t\t} else {\n\t\t\tx = int32(b.Style.X.Value)\n\t\t}\n\t\tif !b.Parent.IsContainer() {\n\t\t\tax = int32(b.Parent.GetAbsoluteX()) + x\n\t\t\tx = int32(b.Parent.GetX()) + x\n\t\t} else {\n\t\t\tax = int32(b.Parent.GetAbsoluteX()) + x\n\t\t}\n\t\tx -= b.Parent.GetScrollLeft()\n\t\tax -= b.Parent.GetScrollLeft()\n\t\tif b.Style.Origin.Has(RIGHT) {\n\t\t\tx = b.Parent.GetWidth() - x\n\t\t\tax = b.Parent.GetAbsoluteX() + b.Parent.GetWidth() - ax\n\t\t}\n\t\tvar relY int32\n\t\tif b.Style.Y.Percentage {\n\t\t\trelY = int32(b.Style.Y.PercentOf(float64(b.Parent.GetHeight())))\n\t\t} else {\n\t\t\trelY = int32(b.Style.Y.Value)\n\t\t}\n\t\tif !b.Parent.IsContainer() {\n\t\t\ty = int32(b.Parent.GetY()) + relY\n\t\t} else {\n\t\t\ty = relY\n\t\t}\n\t\tay = int32(b.Parent.GetAbsoluteY()) + relY\n\t\ty -= b.Parent.GetScrollTop()\n\t\tay -= b.Parent.GetScrollTop()\n\t\tif b.Style.Origin.Has(BOTTOM) {\n\t\t\ty = b.Parent.GetHeight() - relY\n\t\t\tay += (b.Parent.GetHeight() - relY*2) // W...why do we do relY*2\n\t\t}\n\t\tif b.Style.W.Percentage {\n\t\t\tw = int32(b.Style.W.PercentOf(float64(b.Parent.GetWidth())))\n\t\t} else {\n\t\t\tw = int32(b.Style.W.Value)\n\t\t}\n\t\tif b.Style.H.Percentage {\n\t\t\th = int32(b.Style.H.PercentOf(float64(b.Parent.GetHeight())))\n\t\t} else {\n\t\t\th = int32(b.Style.H.Value)\n\t\t}\n\t\tif b.Style.MinW.Percentage {\n\t\t\tminw = int32(b.Style.MinW.PercentOf(float64(b.Parent.GetWidth())))\n\t\t} else {\n\t\t\tminw = int32(b.Style.MinW.Value)\n\t\t}\n\t\tif b.Style.MaxW.Percentage {\n\t\t\tmaxw = int32(b.Style.MaxW.PercentOf(float64(b.Parent.GetWidth())))\n\t\t} else {\n\t\t\tmaxw = int32(b.Style.MaxW.Value)\n\t\t}\n\t\tif b.Style.MinH.Percentage {\n\t\t\tminh = int32(b.Style.MinH.PercentOf(float64(b.Parent.GetHeight())))\n\t\t} else {\n\t\t\tminh = int32(b.Style.MinH.Value)\n\t\t}\n\t\tif b.Style.MaxH.Percentage {\n\t\t\tmaxh = int32(b.Style.MaxH.PercentOf(float64(b.Parent.GetHeight())))\n\t\t} else {\n\t\t\tmaxh = int32(b.Style.MaxH.Value)\n\t\t}\n\n\t\t// Padding\n\t\tif b.Style.PaddingLeft.Percentage {\n\t\t\tpl = int32(b.Style.PaddingLeft.PercentOf(float64(b.Parent.GetWidth())))\n\t\t} else {\n\t\t\tpl = int32(b.Style.PaddingLeft.Value)\n\t\t}\n\t\tif b.Style.PaddingRight.Percentage {\n\t\t\tpr = int32(b.Style.PaddingRight.PercentOf(float64(b.Parent.GetWidth())))\n\t\t} else {\n\t\t\tpr = int32(b.Style.PaddingRight.Value)\n\t\t}\n\t\tif b.Style.PaddingTop.Percentage {\n\t\t\tpt = int32(b.Style.PaddingTop.PercentOf(float64(b.Parent.GetHeight())))\n\t\t} else {\n\t\t\tpt = int32(b.Style.PaddingTop.Value)\n\t\t}\n\t\tif b.Style.PaddingBottom.Percentage {\n\t\t\tpb = int32(b.Style.PaddingBottom.PercentOf(float64(b.Parent.GetHeight())))\n\t\t} else {\n\t\t\tpb = int32(b.Style.PaddingBottom.Value)\n\t\t}\n\t\t// Margin\n\t\tif b.Style.MarginLeft.Percentage {\n\t\t\tml = int32(b.Style.MarginLeft.PercentOf(float64(b.Parent.GetWidth())))\n\t\t} else {\n\t\t\tml = int32(b.Style.MarginLeft.Value)\n\t\t}\n\t\tif b.Style.MarginRight.Percentage {\n\t\t\tmr = int32(b.Style.MarginRight.PercentOf(float64(b.Parent.GetWidth())))\n\t\t} else {\n\t\t\tmr = int32(b.Style.MarginRight.Value)\n\t\t}\n\t\tif b.Style.MarginTop.Percentage {\n\t\t\tmt = int32(b.Style.MarginTop.PercentOf(float64(b.Parent.GetHeight())))\n\t\t} else {\n\t\t\tmt = int32(b.Style.MarginTop.Value)\n\t\t}\n\t\tif b.Style.MarginBottom.Percentage {\n\t\t\tmb = int32(b.Style.MarginBottom.PercentOf(float64(b.Parent.GetHeight())))\n\t\t} else {\n\t\t\tmb = int32(b.Style.MarginBottom.Value)\n\t\t}\n\t} else {\n\t\tif !b.Style.X.Percentage {\n\t\t\tx = int32(b.Style.X.Value)\n\t\t}\n\t\tax = x\n\t\tif !b.Style.Y.Percentage {\n\t\t\ty = int32(b.Style.Y.Value)\n\t\t}\n\t\tay = y\n\t\tif !b.Style.W.Percentage {\n\t\t\tw = int32(b.Style.W.Value)\n\t\t}\n\t\tif !b.Style.H.Percentage {\n\t\t\th = int32(b.Style.H.Value)\n\t\t}\n\t\tif !b.Style.MinW.Percentage {\n\t\t\tminw = int32(b.Style.MinW.Value)\n\t\t}\n\t\tif !b.Style.MaxW.Percentage {\n\t\t\tmaxw = int32(b.Style.MaxW.Value)\n\t\t}\n\t\tif !b.Style.MinH.Percentage {\n\t\t\tminh = int32(b.Style.MinH.Value)\n\t\t}\n\t\tif !b.Style.MaxH.Percentage {\n\t\t\tmaxh = int32(b.Style.MaxH.Value)\n\t\t}\n\t\t// Padding\n\t\tif !b.Style.PaddingLeft.Percentage {\n\t\t\tpl = int32(b.Style.PaddingLeft.Value)\n\t\t}\n\t\tif !b.Style.PaddingRight.Percentage {\n\t\t\tpr = int32(b.Style.PaddingRight.Value)\n\t\t}\n\t\tif !b.Style.PaddingTop.Percentage {\n\t\t\tpt = int32(b.Style.PaddingTop.Value)\n\t\t}\n\t\tif !b.Style.PaddingBottom.Percentage {\n\t\t\tpb = int32(b.Style.PaddingBottom.Value)\n\t\t}\n\t\t// Margin\n\t\tif !b.Style.MarginLeft.Percentage {\n\t\t\tml = int32(b.Style.MarginLeft.Value)\n\t\t}\n\t\tif !b.Style.MarginRight.Percentage {\n\t\t\tmr = int32(b.Style.MarginRight.Value)\n\t\t}\n\t\tif !b.Style.MarginTop.Percentage {\n\t\t\tmt = int32(b.Style.MarginTop.Value)\n\t\t}\n\t\tif !b.Style.MarginBottom.Percentage {\n\t\t\tmb = int32(b.Style.MarginBottom.Value)\n\t\t}\n\t}\n\n\tif h < minh {\n\t\th = minh\n\t}\n\tif maxw > 0 && w > maxw {\n\t\tw = maxw\n\t}\n\tif w < minw {\n\t\tw = minw\n\t}\n\tif maxh > 0 && h > maxh {\n\t\th = maxh\n\t}\n\n\t// Check if we're out of bounds relative to our parent.\n\tif b.Parent != nil {\n\t\tpw := b.Parent.GetWidth() / 2\n\t\tph := b.Parent.GetHeight() / 2\n\t\tif x >= -pw && y >= -h && (x-w) <= pw+pw && (y-h) <= ph+ph {\n\t\t\tb.OOB = false\n\t\t} else {\n\t\t\tb.OOB = true\n\t\t}\n\t}\n\n\t// Scroll\n\tif b.Style.ScrollLeft.Percentage {\n\t\tsl = int32(b.Style.ScrollLeft.PercentOf(float64(w)))\n\t} else {\n\t\tsl = int32(b.Style.ScrollLeft.Value)\n\t}\n\tif b.Style.ScrollTop.Percentage {\n\t\tst = int32(b.Style.ScrollTop.PercentOf(float64(h)))\n\t} else {\n\t\tst = int32(b.Style.ScrollTop.Value)\n\t}\n\n\tif x != b.x || y != b.y || ax != b.ax || ay != b.ay || w != b.w || h != b.h || pl != b.pl || pr != b.pr || pt != b.pt || pb != b.pb || ml != b.ml || mr != b.mr || mt != b.mt || mb != b.mb || sl != b.sl || st != b.st {\n\t\tb.x = x\n\t\tb.y = y\n\t\tb.ax = ax\n\t\tb.ay = ay\n\t\tb.w = w + pl + pr\n\t\tb.h = h + pt + pb\n\t\tb.pl = pl\n\t\tb.pr = pr\n\t\tb.pt = pt\n\t\tb.pb = pb\n\t\tb.ml = ml\n\t\tb.mr = mr\n\t\tb.mt = mt\n\t\tb.mb = mb\n\t\tb.st = st\n\t\tb.sl = sl\n\t\tb.Dirty = true\n\t}\n\tif b.Dirty || b.LastStyle != b.Style {\n\t\tif b.Style.Origin.Has(CENTERX) {\n\t\t\tb.x = b.x - b.w/2\n\t\t\tb.ax = b.ax - b.w/2\n\t\t} else if b.Style.Origin.Has(RIGHT) {\n\t\t\tb.x = b.x - b.w - b.mr\n\t\t\tb.ax = b.ax - b.w - b.mr\n\t\t} else {\n\t\t\tb.x = b.x + b.ml\n\t\t\tb.ax = b.ax + b.ml\n\t\t}\n\t\tif b.Style.Origin.Has(CENTERY) {\n\t\t\tb.y = b.y - b.h/2\n\t\t\tb.ay = b.ay - b.h/2\n\t\t} else if b.Style.Origin.Has(BOTTOM) {\n\t\t\tb.y = b.y - b.h - b.mb\n\t\t\tb.ay = b.ay - b.h - b.mb\n\t\t} else {\n\t\t\tb.y = b.y + b.mt\n\t\t\tb.ay = b.ay + b.mt\n\t\t}\n\t\tb.LastStyle = b.Style\n\t\tb.Dirty = true\n\t\tfor _, child := range b.Children {\n\t\t\tchild.CalculateStyle()\n\t\t}\n\t}\n\tb.Restyle = false\n}", "func (debugging *debuggingOpenGL) Scissor(x, y int32, width, height int32) {\n\tdebugging.recordEntry(\"Scissor\", x, y, width, height)\n\tdebugging.gl.Scissor(x, y, width, height)\n\tdebugging.recordExit(\"Scissor\")\n}", "func (s *Scroll) OnFrameChange() {\n\tsize := s.Frame.Size()\n\ts.ratio = s.ChildSize.Sub(size)\n\ts.corner = mat.V(s.Frame.Max.X, s.Frame.Min.Y)\n\n\tratio := s.ratio\n\tif s.X.Use {\n\t\tratio.Y += s.BarWidth\n\t\ts.X.space = size.X\n\t}\n\tif s.Y.Use {\n\t\tratio.X += s.BarWidth\n\t\ts.Y.space = size.Y\n\t}\n\n\ts.X.use = s.X.Use && ratio.X > 0\n\ts.Y.use = s.Y.Use && ratio.Y > 0\n\n\tif s.X.use && s.Y.use {\n\t\ts.X.space -= s.BarWidth\n\t\ts.ratio.Y += s.BarWidth\n\t\ts.Y.space -= s.BarWidth\n\t\ts.ratio.X += s.BarWidth\n\t}\n\n\tif s.X.use {\n\t\ts.X.CalcRatio(s.ChildSize.X)\n\t\ts.corner.Y += s.BarWidth\n\t}\n\tif s.Y.use {\n\t\ts.Y.CalcRatio(s.ChildSize.Y)\n\t\ts.corner.X -= s.BarWidth\n\t}\n\n\ts.SpriteViewport.Area = s.Frame\n}", "func (p *PdfiumImplementation) FPDF_VIEWERREF_GetPrintScaling(request *requests.FPDF_VIEWERREF_GetPrintScaling) (*responses.FPDF_VIEWERREF_GetPrintScaling, error) {\n\tp.Lock()\n\tdefer p.Unlock()\n\n\tdocumentHandle, err := p.getDocumentHandle(request.Document)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tprintScaling := C.FPDF_VIEWERREF_GetPrintScaling(documentHandle.handle)\n\treturn &responses.FPDF_VIEWERREF_GetPrintScaling{\n\t\tPreferPrintScaling: int(printScaling) == 1,\n\t}, nil\n}", "func (ref *UIElement) SharedCharacterRange() Range {\n\tret, _ := ref.RangeAttr(SharedCharacterRangeAttribute)\n\treturn ret\n}", "func DeducePosY(layoutType, inventoryId string, layout map[string]models.Layout, x, y, idx int) float64 {\n\tswitch models.LayoutType(layoutType) {\n\tcase models.CurrencyLayout,\n\t\tmodels.FragmentLayout,\n\t\tmodels.EssenceLayout:\n\t\tif value, ok := layout[strconv.Itoa(x)]; ok {\n\t\t\treturn value.Y\n\t\t}\n\tcase models.MapLayout:\n\t\treturn 0\n\tcase models.UniqueLayout:\n\t\treturn 0\n\tcase models.JewelLayout:\n\t\treturn -47\n\tcase models.InventoryLayout:\n\t\tkey := inventoryId + \"Y\"\n\t\tswitch inventoryId {\n\t\tcase \"MainInventory\":\n\t\t\tif value, ok := models.DefaultInventoryLayout[key]; ok {\n\t\t\t\treturn value + float64(y)*cellSize\n\t\t\t}\n\t\t}\n\t\tif value, ok := models.DefaultInventoryLayout[key]; ok {\n\t\t\treturn value\n\t\t}\n\tcase models.QuadLayout:\n\t\treturn float64(y) * cellSize / 2\n\tdefault:\n\t\treturn float64(y) * cellSize\n\t}\n\treturn 0\n}", "func (e *Emulator) ledRect(col int, row int) image.Rectangle {\n\tx := (col * (e.PixelPitch + e.Gutter)) + e.Margin\n\ty := (row * (e.PixelPitch + e.Gutter)) + e.Margin\n\treturn image.Rect(x, y, x+e.PixelPitch, y+e.PixelPitch)\n}", "func GetScreenSizeRange(c *xgb.Conn, Window xproto.Window) GetScreenSizeRangeCookie {\n\tc.ExtLock.RLock()\n\tdefer c.ExtLock.RUnlock()\n\tif _, ok := c.Extensions[\"RANDR\"]; !ok {\n\t\tpanic(\"Cannot issue request 'GetScreenSizeRange' using the uninitialized extension 'RANDR'. randr.Init(connObj) must be called first.\")\n\t}\n\tcookie := c.NewCookie(true, true)\n\tc.NewRequest(getScreenSizeRangeRequest(c, Window), cookie)\n\treturn GetScreenSizeRangeCookie{cookie}\n}", "func (s *Segment) CurrentReadOffset() Offset {\n\ts.mu.Lock()\n\tdefer s.mu.Unlock()\n\treturn s.chunks[s.chunkIdx].Offset()\n}" ]
[ "0.50889444", "0.4996918", "0.46844086", "0.44587925", "0.440962", "0.433486", "0.43269554", "0.42174834", "0.4213052", "0.41996485", "0.4126185", "0.41192397", "0.41143748", "0.4110905", "0.40728584", "0.4067726", "0.4057868", "0.4057215", "0.40502566", "0.40258878", "0.4019448", "0.4019014", "0.4012429", "0.40117532", "0.3989557", "0.3984809", "0.39695525", "0.39680204", "0.39549863", "0.395397", "0.3953776", "0.39517578", "0.39483646", "0.3944531", "0.39371115", "0.39339042", "0.39217108", "0.3905424", "0.3893761", "0.38866222", "0.38852277", "0.38722426", "0.38711065", "0.38634408", "0.38542408", "0.38490137", "0.38361266", "0.38311538", "0.38294923", "0.38287753", "0.38108188", "0.3804823", "0.3798868", "0.37957004", "0.37911922", "0.37776557", "0.3777211", "0.37727728", "0.37703216", "0.37595788", "0.37594306", "0.37565356", "0.37543586", "0.3747468", "0.3745755", "0.3741642", "0.37364405", "0.3732497", "0.37321475", "0.37318143", "0.37275007", "0.37224054", "0.37103006", "0.37059382", "0.37027735", "0.3690395", "0.36881965", "0.36792982", "0.36792126", "0.3665576", "0.3663304", "0.36628816", "0.3662747", "0.3661307", "0.36597413", "0.36533356", "0.36488923", "0.36447537", "0.3641421", "0.36354434", "0.36330715", "0.3621936", "0.3618328", "0.36170536", "0.36094022", "0.36082834", "0.3603967", "0.36005718", "0.3598388", "0.3598325" ]
0.771656
0
scroll scrolls the provided scroll region by param lines. The scroll region is in buffer coordinates.
func (h *windowsAnsiEventHandler) scroll(param int, sr scrollRegion, info *CONSOLE_SCREEN_BUFFER_INFO) error { h.logf("scroll: scrollTop: %d, scrollBottom: %d", sr.top, sr.bottom) h.logf("scroll: windowTop: %d, windowBottom: %d", info.Window.Top, info.Window.Bottom) // Copy from and clip to the scroll region (full buffer width) scrollRect := SMALL_RECT{ Top: sr.top, Bottom: sr.bottom, Left: 0, Right: info.Size.X - 1, } // Origin to which area should be copied destOrigin := COORD{ X: 0, Y: sr.top - int16(param), } char := CHAR_INFO{ UnicodeChar: ' ', Attributes: h.attributes, } if err := ScrollConsoleScreenBuffer(h.fd, scrollRect, scrollRect, destOrigin, char); err != nil { return err } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (cons *VgaTextConsole) Scroll(dir ScrollDir, lines uint32) {\n\tif lines == 0 || lines > cons.height {\n\t\treturn\n\t}\n\n\tvar i uint32\n\toffset := lines * cons.width\n\n\tswitch dir {\n\tcase ScrollDirUp:\n\t\tfor ; i < (cons.height-lines)*cons.width; i++ {\n\t\t\tcons.fb[i] = cons.fb[i+offset]\n\t\t}\n\tcase ScrollDirDown:\n\t\tfor i = cons.height*cons.width - 1; i >= lines*cons.width; i-- {\n\t\t\tcons.fb[i] = cons.fb[i-offset]\n\t\t}\n\t}\n}", "func (h *windowsAnsiEventHandler) scrollLine(columns int, position COORD, info *CONSOLE_SCREEN_BUFFER_INFO) error {\n\t// Copy from and clip to the scroll region (full buffer width)\n\tscrollRect := SMALL_RECT{\n\t\tTop: position.Y,\n\t\tBottom: position.Y,\n\t\tLeft: position.X,\n\t\tRight: info.Size.X - 1,\n\t}\n\n\t// Origin to which area should be copied\n\tdestOrigin := COORD{\n\t\tX: position.X - int16(columns),\n\t\tY: position.Y,\n\t}\n\n\tchar := CHAR_INFO{\n\t\tUnicodeChar: ' ',\n\t\tAttributes: h.attributes,\n\t}\n\n\tif err := ScrollConsoleScreenBuffer(h.fd, scrollRect, scrollRect, destOrigin, char); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (v *View) UpdateLines(start, end int) {\n\tv.updateLines[0] = start\n\tv.updateLines[1] = end + 1\n}", "func (sv *ScrollView) scroll(sb int32, cmd uint16) int {\n\tvar pos int32\n\tvar si win.SCROLLINFO\n\tsi.CbSize = uint32(unsafe.Sizeof(si))\n\tsi.FMask = win.SIF_PAGE | win.SIF_POS | win.SIF_RANGE | win.SIF_TRACKPOS\n\n\twin.GetScrollInfo(sv.hWnd, sb, &si)\n\n\tpos = si.NPos\n\n\tswitch cmd {\n\tcase win.SB_LINELEFT: // == win.SB_LINEUP\n\t\tpos -= int32(sv.IntFrom96DPI(20))\n\n\tcase win.SB_LINERIGHT: // == win.SB_LINEDOWN\n\t\tpos += int32(sv.IntFrom96DPI(20))\n\n\tcase win.SB_PAGELEFT: // == win.SB_PAGEUP\n\t\tpos -= int32(si.NPage)\n\n\tcase win.SB_PAGERIGHT: // == win.SB_PAGEDOWN\n\t\tpos += int32(si.NPage)\n\n\tcase win.SB_THUMBTRACK:\n\t\tpos = si.NTrackPos\n\t}\n\n\tif pos < 0 {\n\t\tpos = 0\n\t}\n\tif pos > si.NMax+1-int32(si.NPage) {\n\t\tpos = si.NMax + 1 - int32(si.NPage)\n\t}\n\n\tsi.FMask = win.SIF_POS\n\tsi.NPos = pos\n\twin.SetScrollInfo(sv.hWnd, sb, &si, true)\n\n\treturn -int(pos)\n}", "func (win *window) Lines(pt []image.Point) {\n\tif len(pt) < 2 {\n\t\treturn\n\t}\n\tpts := make([]xgb.Point, len(pt))\n\tfor i, p := range pt {\n\t\tpts[i].X, pts[i].Y = int16(p.X), int16(p.Y)\n\t}\n\txwin.PolyLine(xgb.CoordModeOrigin, win.id, win.gc, pts)\n}", "func (d *Device) SetScroll(line int16) {\n\td.buf[0] = uint8(line >> 8)\n\td.buf[1] = uint8(line)\n\td.startWrite()\n\td.sendCommand(VSCRSADD, d.buf[:2])\n\td.endWrite()\n}", "func SetLines(l []string) {\n\tlines = l\n}", "func TextViewScrollToLine(textView *gtk.TextView, line int, highLight ...bool) {\n\tvar doHighLight bool\n\tif len(highLight) > 0 {\n\t\tdoHighLight = highLight[0]\n\t}\n\tvar err error\n\tif line > 0 {\n\t\tif buf, err := textView.GetBuffer(); err == nil {\n\n\t\t\titerTxt0 := buf.GetIterAtLine(line)\n\t\t\titerTxt1 := buf.GetIterAtOffset(buf.GetIterAtLine(line).GetOffset() - 1)\n\n\t\t\tbuf.PlaceCursor(iterTxt0)\n\t\t\tfor gtk.EventsPending() {\n\t\t\t\tgtk.MainIterationDo(false)\n\t\t\t}\n\t\t\ttextView.ScrollToIter(iterTxt0, 0.0, true, 0.5, 0.5)\n\n\t\t\tif doHighLight {\n\t\t\t\tbuf.SelectRange(iterTxt0, iterTxt1) // HighLight current line.\n\t\t\t}\n\t\t}\n\t}\n\tif err != nil {\n\t\tlog.Fatalf(\"TextViewScrollToLine: %s\\n\", err.Error())\n\t}\n}", "func MoveLines(view *gocui.View, current, max, delta int) error {\n\tif view == nil {\n\t\treturn nil\n\t}\n\n\tif delta < 0 {\n\t\tif current <= 0 {\n\t\t\treturn Error(\"at top\")\n\t\t}\n\t\tif current+delta < 0 {\n\t\t\tdelta = -current\n\t\t}\n\t} else {\n\t\tfromBottom := max - current\n\t\tif fromBottom > 0 && delta > fromBottom {\n\t\t\tdelta = fromBottom\n\t\t}\n\t\tif current+1 >= max {\n\t\t\treturn Error(\"at bottom\")\n\t\t}\n\t\tif current+delta >= max {\n\t\t\tdelta = max - current - 1\n\t\t}\n\t}\n\n\tif view != nil && delta != 0 {\n\t\t_, sy := view.Size()\n\t\tox, oy := view.Origin()\n\t\tcx, cy := view.Cursor()\n\n\t\tif delta < 0 {\n\t\t\tif cy+delta < 0 {\n\t\t\t\todelta := maxInt(delta, -oy)\n\t\t\t\tif err := view.SetOrigin(ox, oy+odelta); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tdelta -= odelta\n\t\t\t}\n\t\t} else {\n\t\t\tif cy+delta >= sy {\n\t\t\t\tmy := max - sy\n\t\t\t\tif oy < my {\n\t\t\t\t\todelta := minInt(delta, my-oy)\n\t\t\t\t\tif err := view.SetOrigin(ox, oy+odelta); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tdelta -= odelta\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif delta != 0 {\n\t\t\tif err := view.SetCursor(cx, cy+delta); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (rg Range) Lines(y0, y1 int) Range {\n\tnrg := rg\n\tnrg.Min.Y = rg.Min.Y + y0\n\tnrg.Max.Y = rg.Min.Y + y1\n\treturn rg.Intersect(nrg)\n}", "func (tv *TextView) RenderLines(st, ed int) bool {\n\tif tv == nil || tv.This() == nil {\n\t\treturn false\n\t}\n\tif !tv.This().(gi.Node2D).IsVisible() {\n\t\treturn false\n\t}\n\tif st >= tv.NLines {\n\t\tst = tv.NLines - 1\n\t}\n\tif ed >= tv.NLines {\n\t\ted = tv.NLines - 1\n\t}\n\tif st > ed {\n\t\treturn false\n\t}\n\tvp := tv.Viewport\n\twupdt := tv.TopUpdateStart()\n\tsty := &tv.Sty\n\trs := &vp.Render\n\tpc := &rs.Paint\n\tpos := tv.RenderStartPos()\n\tvar boxMin, boxMax mat32.Vec2\n\trs.PushBounds(tv.VpBBox)\n\t// first get the box to fill\n\tvisSt := -1\n\tvisEd := -1\n\tfor ln := st; ln <= ed; ln++ {\n\t\tlst := tv.CharStartPos(TextPos{Ln: ln}).Y // note: charstart pos includes descent\n\t\tled := lst + mat32.Max(tv.Renders[ln].Size.Y, tv.LineHeight)\n\t\tif int(mat32.Ceil(led)) < tv.VpBBox.Min.Y {\n\t\t\tcontinue\n\t\t}\n\t\tif int(mat32.Floor(lst)) > tv.VpBBox.Max.Y {\n\t\t\tcontinue\n\t\t}\n\t\tlp := pos\n\t\tif visSt < 0 {\n\t\t\tvisSt = ln\n\t\t\tlp.Y = lst\n\t\t\tboxMin = lp\n\t\t}\n\t\tvisEd = ln // just keep updating\n\t\tlp.Y = led\n\t\tboxMax = lp\n\t}\n\tif !(visSt < 0 && visEd < 0) {\n\t\trs.Lock()\n\t\tboxMin.X = float32(tv.VpBBox.Min.X) // go all the way\n\t\tboxMax.X = float32(tv.VpBBox.Max.X) // go all the way\n\t\tpc.FillBox(rs, boxMin, boxMax.Sub(boxMin), &sty.Font.BgColor)\n\t\t// fmt.Printf(\"lns: st: %v ed: %v vis st: %v ed %v box: min %v max: %v\\n\", st, ed, visSt, visEd, boxMin, boxMax)\n\n\t\ttv.RenderDepthBg(visSt, visEd)\n\t\ttv.RenderHighlights(visSt, visEd)\n\t\ttv.RenderScopelights(visSt, visEd)\n\t\ttv.RenderSelect()\n\t\ttv.RenderLineNosBox(visSt, visEd)\n\n\t\tif tv.HasLineNos() {\n\t\t\tfor ln := visSt; ln <= visEd; ln++ {\n\t\t\t\ttv.RenderLineNo(ln)\n\t\t\t}\n\t\t\ttbb := tv.VpBBox\n\t\t\ttbb.Min.X += int(tv.LineNoOff)\n\t\t\trs.Unlock()\n\t\t\trs.PushBounds(tbb)\n\t\t\trs.Lock()\n\t\t}\n\t\tfor ln := visSt; ln <= visEd; ln++ {\n\t\t\tlst := pos.Y + tv.Offs[ln]\n\t\t\tlp := pos\n\t\t\tlp.Y = lst\n\t\t\tlp.X += tv.LineNoOff\n\t\t\ttv.Renders[ln].Render(rs, lp) // not top pos -- already has baseline offset\n\t\t}\n\t\trs.Unlock()\n\t\tif tv.HasLineNos() {\n\t\t\trs.PopBounds()\n\t\t}\n\n\t\ttBBox := image.Rectangle{boxMin.ToPointFloor(), boxMax.ToPointCeil()}\n\t\tvprel := tBBox.Min.Sub(tv.VpBBox.Min)\n\t\ttWinBBox := tv.WinBBox.Add(vprel)\n\t\tvp.This().(gi.Viewport).VpUploadRegion(tBBox, tWinBBox)\n\t\t// fmt.Printf(\"tbbox: %v twinbbox: %v\\n\", tBBox, tWinBBox)\n\t}\n\ttv.PopBounds()\n\ttv.RenderScrolls()\n\ttv.TopUpdateEnd(wupdt)\n\treturn true\n}", "func (v *Label) SetLines(lines int) {\n\tC.gtk_label_set_lines(v.native(), C.gint(lines))\n}", "func (b *Buffer) MoveLinesDown(start int, end int) {\n\t// 0 <= start < end < len(b.lines)\n\t// if end == len(b.lines), we can't do anything here because the\n\t// last line is unaccessible, FIXME\n\tif start < 0 || start >= end || end >= len(b.lines)-1 {\n\t\treturn // what to do? FIXME\n\t}\n\tb.Insert(\n\t\tLoc{0, start},\n\t\tb.Line(end)+\"\\n\",\n\t)\n\tend++\n\tb.Remove(\n\t\tLoc{0, end},\n\t\tLoc{0, end + 1},\n\t)\n}", "func (b *Buffer) Lines(start, end int) []string {\n\tlines := b.lines[start:end]\n\tslice := make([]string, len(lines))\n\tfor _, line := range lines {\n\t\tslice = append(slice, string(line.data))\n\t}\n\treturn slice\n}", "func (d *DXF) Lines(s v2.VecSet) {\n\td.drawing.ChangeLayer(\"Lines\")\n\tp1 := s[0]\n\tfor i := 0; i < len(s)-1; i++ {\n\t\tp0 := p1\n\t\tp1 = s[i+1]\n\t\td.drawing.Line(p0.X, p0.Y, 0, p1.X, p1.Y, 0)\n\t}\n}", "func (s *Screen) JumpLines() {\n\tfmt.Fprint(s.Terminal, \"\\x1b[2J\")\n}", "func (c *ContactService) Scroll(scrollParam string) (ContactList, error) {\n return c.Repository.scroll(scrollParam)\n}", "func (t *Text) DrawLines(at image.Point, scr screen.Screen, win screen.Window) int {\n\tpad := t.setter.opts.Padding\n\tbg := t.setter.opts.DefaultStyle.BG\n\tx0, y0, x1, y1 := at.X, at.Y, at.X+t.size.X, at.Y+t.size.Y\n\tif y1 < y0 {\n\t\ty1 = y0\n\t}\n\tif x1 < x0 {\n\t\tx1 = x0\n\t}\n\tif t.size.X <= 2*pad || t.size.Y <= 2*pad {\n\t\t// Too small, just fill what's there with background.\n\t\twin.Fill(image.Rect(x0, y0, x1, y1), bg, draw.Src)\n\t\treturn y1\n\t}\n\n\tvar y int\n\tx, ynext := at.X+pad, at.Y+pad\n\ttextWidth := (x1 - x0) - 2*pad\n\tfor _, l := range t.lines {\n\t\ty = ynext\n\t\tynext = y + l.h.Round()\n\t\tif ynext > y1-pad {\n\t\t\tynext = y\n\t\t\tbreak\n\t\t}\n\t\tif l.buf == nil && l.w.Round() > 0 {\n\t\t\tvar err error\n\t\t\tsize := image.Pt(l.w.Round(), l.h.Round())\n\t\t\tl.buf, err = scr.NewBuffer(size)\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t\tdrawLine(t, l, l.buf.RGBA())\n\t\t}\n\t\tvar dx int\n\t\tif l.buf != nil && l.w <= fixed.I(textWidth) {\n\t\t\tb := l.buf.Bounds()\n\t\t\tif b.Dx() > textWidth {\n\t\t\t\tb.Max.X = b.Min.X + textWidth\n\t\t\t}\n\t\t\tdx = b.Dx()\n\t\t\twin.Upload(image.Pt(x, y), l.buf, b)\n\t\t}\n\t\tif dx < textWidth {\n\t\t\tlineBG := bg\n\t\t\tif r, ok := lastRune(l); ok && r == '\\n' {\n\t\t\t\ts := l.spans[len(l.spans)-1]\n\t\t\t\t// If the last rune in the line is a \\n, fill with the last span BG.\n\t\t\t\tlineBG = s.BG\n\t\t\t}\n\t\t\twin.Fill(image.Rect(x+dx, y, x1-pad, ynext), lineBG, draw.Src)\n\t\t}\n\t}\n\tif h := trailingNewlineHeight(t); h > 0 && ynext+h <= y1-pad {\n\t\twin.Fill(image.Rect(x, ynext, x1-pad, ynext+h), bg, draw.Src)\n\t\tynext += h\n\t}\n\ty1 = ynext\n\twin.Fill(image.Rect(x0, y0, x1, y0+pad), bg, draw.Src) // top\n\twin.Fill(image.Rect(x0, y0+pad, x0+pad, y1), bg, draw.Src) // left\n\twin.Fill(image.Rect(x1-pad, y0+pad, x1, y1), bg, draw.Src) // right\n\twin.Fill(image.Rect(x0, y1, x1, y1+pad), bg, draw.Src) // bottom\n\treturn y1 + pad\n}", "func DrawLines(destination *ebiten.Image, verts *[]ebiten.Vertex, indices *[]uint16) {\n\n\tvar vPos uint16\n\n\tfor i, idx := range *indices {\n\t\tif i == len(*indices)-1 {\n\t\t\tvPos = 0\n\t\t} else {\n\t\t\tvPos = uint16(i + 1)\n\t\t}\n\n\t\tebitenutil.DrawLine(\n\t\t\tdestination,\n\t\t\tfloat64((*verts)[idx].SrcX), float64((*verts)[idx].SrcY),\n\t\t\tfloat64((*verts)[(*indices)[vPos]].DstX), float64((*verts)[(*indices)[vPos]].DstY),\n\t\t\tcolor.White,\n\t\t)\n\t}\n}", "func ComputeLines(lines chan int, step float64, fractal *image.RGBA) {\n\tfor line := range lines {\n\t\tfor i := 0; i < XSIZE; i++ {\n\t\t\tn := ComplexAt(line, i, step)\n\t\t\titerations := ComputeIterations(n)\n\t\t\tfractal.Set(i, line, FancyColor(iterations))\n\t\t}\n\t}\n}", "func (d *Device) SetScrollArea(topFixedArea, bottomFixedArea int16) {\n\tcopy(d.buf[:6], []uint8{\n\t\tuint8(topFixedArea >> 8), uint8(topFixedArea),\n\t\tuint8(d.height - topFixedArea - bottomFixedArea>>8), uint8(d.height - topFixedArea - bottomFixedArea),\n\t\tuint8(bottomFixedArea >> 8), uint8(bottomFixedArea)})\n\td.startWrite()\n\td.sendCommand(VSCRDEF, d.buf[:6])\n\td.endWrite()\n}", "func setViewCursorToLine(g *gocui.Gui, v *gocui.View, lines []string, selLine string) error {\n\tox, _ := v.Origin()\n\tcx, _ := v.Cursor()\n\tfor y, line := range lines {\n\t\tif line == selLine {\n\t\t\tif err := v.SetCursor(ox, y); err != nil {\n\t\t\t\tif err := v.SetOrigin(cx, y); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func (tv *TextView) RenderAllLines() {\n\tif tv == nil || tv.This() == nil {\n\t\treturn\n\t}\n\tif !tv.This().(gi.Node2D).IsVisible() {\n\t\treturn\n\t}\n\trs := &tv.Viewport.Render\n\trs.PushBounds(tv.VpBBox)\n\twupdt := tv.TopUpdateStart()\n\ttv.RenderAllLinesInBounds()\n\ttv.PopBounds()\n\ttv.Viewport.This().(gi.Viewport).VpUploadRegion(tv.VpBBox, tv.WinBBox)\n\ttv.RenderScrolls()\n\ttv.TopUpdateEnd(wupdt)\n}", "func (w *Writer) matchLines(lines [][]byte, partialMatchIndexes map[int]bool) ([][]byte, [][]byte) {\n\tfirst := w.linesToKeepRange(partialMatchIndexes)\n\tswitch first {\n\tcase -1:\n\t\t// no lines need to be kept\n\t\treturn lines, nil\n\tcase 0:\n\t\t// partial match is always longer then the lines\n\t\treturn nil, lines\n\tdefault:\n\t\treturn lines[:first], lines[first:]\n\t}\n}", "func Lines(abc *models.Art, b *models.Buf) (count int) {\n\ttext := false\n\tfor _, symbol := range abc.Text.Rune {\n\t\tif symbol == '\\n' {\n\t\t\tif text {\n\t\t\t\tcount += b.Height + 1 // with newline\n\t\t\t\ttext = false\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcount++\n\t\t} else {\n\t\t\ttext = true\n\t\t}\n\t}\n\treturn count\n}", "func (h *History) GetLines(lines int) []string {\n\tif lines > len(h.histories) {\n lines = len(h.histories)\n }\n \n // begin := int(math.Abs(float64(lines - h.selected)))\n begin := lines - h.selected\n if lines - h.selected < 0 {\n \tbegin = -begin\n }\n if begin > h.selected - 1 {\n \tbegin = 0\n }\n\treturn h.histories[begin:h.selected]\n}", "func GetLines(start int64, lines int, fileName string) ([][]byte, int64, error) {\n\tvar output [][]byte\n\n\tfile, err := os.Open(fileName)\n\tdefer file.Close()\n\tif err != nil {\n\t\treturn output, start, err\n\t}\n\n\tif _, err := file.Seek(start, io.SeekStart); err != nil {\n\t\treturn output, start, err\n\t}\n\n\tscanner := bufio.NewScanner(file)\n\n\tvar offset int64 = 0\n\tfor i := 0; i < lines; i++ {\n\t\tif scanner.Scan() {\n\t\t\tbytes := scanner.Bytes()\n\t\t\toffset += int64(len(bytes) + 1) // 1 here is for the newline byte\n\t\t\toutput = append(output, bytes)\n\t\t} else if err := scanner.Err(); err != nil {\n\t\t\treturn [][]byte{}, offset, err\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn output, offset, nil\n}", "func CopyLines(from io.Reader, lines []int, to io.Writer) error {\n\tif len(lines) == 0 {\n\t\treturn nil\n\t}\n\n\tlineMap := make(map[int]bool)\n\n\tfor _, l := range lines {\n\t\tlineMap[l] = true\n\t}\n\n\tscanner := bufio.NewScanner(from)\n\tlnum := 0\n\n\tfor scanner.Scan() {\n\t\tline := scanner.Text()\n\n\t\tlnum++\n\n\t\tif _, ok := lineMap[lnum]; !ok {\n\t\t\tcontinue\n\t\t}\n\n\t\tto.Write([]byte(line))\n\t\tto.Write([]byte(fmt.Sprintln()))\n\t}\n\n\tif err := scanner.Err(); err != nil {\n\t\treturn fmt.Errorf(\"reading from file: %v\", err)\n\t}\n\n\treturn nil\n}", "func (file *File) SeekLine(lines int64, whence int) (int64, error) {\n\n\t// return error on bad whence\n\tif whence < 0 || whence > 2 {\n\t\treturn file.Seek(0, whence)\n\t}\n\n\tposition, err := file.Seek(0, whence)\n\n\tbuf := make([]byte, BufferLength)\n\tbufLen := 0\n\tlineSep := byte('\\n')\n\tseekBack := lines < 1\n\tlines = int64(math.Abs(float64(lines)))\n\tmatchCount := int64(0)\n\n\t// seekBack ignores first match\n\t// allows 0 to go to begining of current line\n\tif seekBack {\n\t\tmatchCount = -1\n\t}\n\n\tleftPosition := position\n\toffset := int64(BufferLength * -1)\n\n\tfor b := 1; ; b++ {\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\n\t\tif seekBack {\n\n\t\t\t// on seekBack 2nd buffer onward needs to seek\n\t\t\t// past what was just read plus another buffer size\n\t\t\tif b == 2 {\n\t\t\t\toffset *= 2\n\t\t\t}\n\n\t\t\t// if next seekBack will pass beginning of file\n\t\t\t// buffer is 0 to unread position\n\t\t\tif position+int64(offset) <= 0 {\n\t\t\t\tbuf = make([]byte, leftPosition)\n\t\t\t\tposition, err = file.Seek(0, io.SeekStart)\n\t\t\t\tleftPosition = 0\n\t\t\t} else {\n\t\t\t\tposition, err = file.Seek(offset, io.SeekCurrent)\n\t\t\t\tleftPosition = leftPosition - BufferLength\n\t\t\t}\n\t\t}\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\n\t\tbufLen, err = file.Read(buf)\n\t\tif err != nil {\n\t\t\tbreak\n\t\t} else if seekBack && leftPosition == 0 {\n\t\t\terr = io.EOF\n\t\t}\n\n\t\tfor i := 0; i < bufLen; i++ {\n\t\t\tiToCheck := i\n\t\t\tif seekBack {\n\t\t\t\tiToCheck = bufLen - i - 1\n\t\t\t}\n\t\t\tbyteToCheck := buf[iToCheck]\n\n\t\t\tif byteToCheck == lineSep {\n\t\t\t\tmatchCount++\n\t\t\t}\n\n\t\t\tif matchCount == lines {\n\t\t\t\tif seekBack {\n\t\t\t\t\treturn file.Seek(int64(i)*-1, io.SeekCurrent)\n\t\t\t\t}\n\t\t\t\treturn file.Seek(int64(bufLen*-1+i+1), io.SeekCurrent)\n\t\t\t}\n\t\t}\n\t}\n\n\tif err == io.EOF && !seekBack {\n\t\tposition, _ = file.Seek(0, io.SeekEnd)\n\t} else if err == io.EOF && seekBack {\n\t\tposition, _ = file.Seek(0, io.SeekStart)\n\n\t\t// no io.EOF err on SeekLine(0,0)\n\t\tif lines == 0 {\n\t\t\terr = nil\n\t\t}\n\t}\n\n\treturn position, err\n}", "func SendLines(id string, lines []string) error {\n\tfor _, line := range lines {\n\t\tif err := SendLine(id, line); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func RequestLines(chip string, offsets []int, options ...LineReqOption) (*Lines, error) {\n\tc, err := NewChip(chip)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer c.Close()\n\treturn c.RequestLines(offsets, options...)\n}", "func (ticket *Ticket) AppendLines(lines TicketLines) {\n\tticket.Lines = append(ticket.Lines, lines...)\n}", "func Scroll(n int) string {\n\tif n > 0 {\n\t\treturn Esc + strconv.Itoa(n) + \"S\"\n\t} else if n < 0 {\n\t\treturn Esc + strconv.Itoa(-n) + \"T\"\n\t} else {\n\t\treturn \"\"\n\t}\n}", "func StableOffsetScroll(o int, s, dn, in int) int {\n\t// TODO: need to know if the insertion/delete is on the same line to try to keep the line percentage (smooth scrolling)\n\n\ted := s + dn // end of deletes\n\tei := s + in // end of inserts\n\n\tif o <= s { // o<s<={ed,ei}\n\t\treturn o\n\t}\n\tif o <= ed { // s<o<=ed\n\t\tif o <= ei { // s<o<={ed,ei}\n\t\t\treturn o // inserts cover the deletes\n\t\t} else { // s<ei<o<=ed\n\t\t\t// add missing to cover the deletes\n\t\t\treturn o - (o - ei)\n\t\t}\n\t}\n\tif o <= ei { // s<ed<o<=ei\n\t\t// inserts cover the deletes\n\t\treturn o\n\t}\n\t// s<{ed,ei}<o\n\to += in - dn // add missing bytes to reach old offset\n\treturn o\n}", "func (c *ScrollSprite) SetScroll(scroll *engosdl.Vector) {\n\tc.Scroll = scroll\n}", "func (c *Client) Scroll(scrollID string, timeout string) (*Response, error) {\n\tr := Request{\n\t\tMethod: \"POST\",\n\t\tAPI: \"_search/scroll\",\n\t}\n\n\tif version, err := c.Version(); err != nil {\n\t\treturn nil, err\n\t} else if version > \"2\" {\n\t\tr.Body, err = json.Marshal(map[string]string{\"scroll\": timeout, \"scroll_id\": scrollID})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\tv := url.Values{}\n\t\tv.Add(\"scroll\", timeout)\n\t\tv.Add(\"scroll_id\", scrollID)\n\n\t\tr.ExtraArgs = v\n\t}\n\n\treturn c.Do(&r)\n}", "func (a *RepoAPI) readFileLines(params interface{}) (resp *rpc.Response) {\n\tm := objx.New(cast.ToStringMap(params))\n\tvar revision []string\n\tif rev := m.Get(\"revision\").Str(); rev != \"\" {\n\t\trevision = []string{rev}\n\t}\n\treturn rpc.Success(util.Map{\n\t\t\"lines\": a.mods.Repo.ReadFileLines(m.Get(\"name\").Str(), m.Get(\"path\").Str(), revision...),\n\t})\n}", "func (v *View) ScrollDown(n int) {\n\t// Try to scroll by n but if it would overflow, scroll by 1\n\tif v.topline+n <= len(v.buf.lines)-v.height {\n\t\tv.topline += n\n\t} else if v.topline < len(v.buf.lines)-v.height {\n\t\tv.topline++\n\t}\n}", "func (tv *TextView) LayoutLines(st, ed int, isDel bool) bool {\n\tif tv.Buf == nil || tv.Buf.NumLines() == 0 {\n\t\treturn false\n\t}\n\tsty := &tv.Sty\n\tfst := sty.Font\n\tfst.BgColor.SetColor(nil)\n\tmxwd := float32(tv.LinesSize.X)\n\trerend := false\n\n\ttv.Buf.MarkupMu.RLock()\n\tfor ln := st; ln <= ed; ln++ {\n\t\tcurspans := len(tv.Renders[ln].Spans)\n\t\ttv.Renders[ln].SetHTMLPre(tv.Buf.Markup[ln], &fst, &sty.Text, &sty.UnContext, tv.CSS)\n\t\ttv.Renders[ln].LayoutStdLR(&sty.Text, &sty.Font, &sty.UnContext, tv.RenderSz)\n\t\tif !tv.HasLinks && len(tv.Renders[ln].Links) > 0 {\n\t\t\ttv.HasLinks = true\n\t\t}\n\t\tnwspans := len(tv.Renders[ln].Spans)\n\t\tif nwspans != curspans && (nwspans > 1 || curspans > 1) {\n\t\t\trerend = true\n\t\t}\n\t\tmxwd = mat32.Max(mxwd, tv.Renders[ln].Size.X)\n\t}\n\ttv.Buf.MarkupMu.RUnlock()\n\n\t// update all offsets to end of text\n\tif rerend || isDel || st != ed {\n\t\tofst := st - 1\n\t\tif ofst < 0 {\n\t\t\tofst = 0\n\t\t}\n\t\toff := tv.Offs[ofst]\n\t\tfor ln := ofst; ln < tv.NLines; ln++ {\n\t\t\ttv.Offs[ln] = off\n\t\t\tlsz := mat32.Max(tv.Renders[ln].Size.Y, tv.LineHeight)\n\t\t\toff += lsz\n\t\t}\n\t\textraHalf := tv.LineHeight * 0.5 * float32(tv.VisSize.Y)\n\t\tnwSz := mat32.Vec2{mxwd, off + extraHalf}.ToPointCeil()\n\t\ttv.ResizeIfNeeded(nwSz)\n\t} else {\n\t\tnwSz := mat32.Vec2{mxwd, 0}.ToPointCeil()\n\t\tnwSz.Y = tv.LinesSize.Y\n\t\ttv.ResizeIfNeeded(nwSz)\n\t}\n\treturn rerend\n}", "func (c *Chip) RequestLines(offsets []int, options ...LineReqOption) (*Lines, error) {\n\tfor _, o := range offsets {\n\t\tif o < 0 || o >= c.lines {\n\t\t\treturn nil, ErrInvalidOffset\n\t\t}\n\t}\n\toffsets = append([]int(nil), offsets...)\n\tlro := lineReqOptions{\n\t\tlineConfigOptions: lineConfigOptions{\n\t\t\toffsets: offsets,\n\t\t\tvalues: map[int]int{},\n\t\t\tdefCfg: c.options.config,\n\t\t},\n\t\tconsumer: c.options.consumer,\n\t\tabi: c.options.abi,\n\t\teh: c.options.eh,\n\t}\n\tfor _, option := range options {\n\t\toption.applyLineReqOption(&lro)\n\t}\n\tll := Lines{\n\t\tbaseLine: baseLine{\n\t\t\toffsets: offsets,\n\t\t\tvalues: lro.values,\n\t\t\tchip: c.Name,\n\t\t\tabi: lro.abi,\n\t\t\tdefCfg: lro.defCfg,\n\t\t},\n\t}\n\tvar err error\n\tif ll.abi == 2 {\n\t\tll.vfd, ll.watcher, err = c.getLine(ll.offsets, lro)\n\t} else {\n\t\terr = lro.defCfg.v1Validate()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif lro.eh == nil {\n\t\t\tll.vfd, err = c.getHandleRequest(ll.offsets, lro)\n\t\t} else {\n\t\t\tll.isEvent = true\n\t\t\tll.vfd, ll.watcher, err = c.getEventRequest(ll.offsets, lro)\n\t\t}\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &ll, nil\n}", "func (a localApi) UpdateStepLines(stepName string, lineCount int) error {\n\treturn nil\n}", "func (tv *TextView) RenderSelectLines() {\n\tif tv.PrevSelectReg == TextRegionNil {\n\t\ttv.RenderLines(tv.SelectReg.Start.Ln, tv.SelectReg.End.Ln)\n\t} else {\n\t\tstln := ints.MinInt(tv.SelectReg.Start.Ln, tv.PrevSelectReg.Start.Ln)\n\t\tedln := ints.MaxInt(tv.SelectReg.End.Ln, tv.PrevSelectReg.End.Ln)\n\t\ttv.RenderLines(stln, edln)\n\t}\n\ttv.PrevSelectReg = tv.SelectReg\n}", "func (v *View) ScrollDown(n int) {\n\t// Try to scroll by n but if it would overflow, scroll by 1\n\tif v.Topline+n <= v.Buf.NumLines {\n\t\tv.Topline += n\n\t} else if v.Topline < v.Buf.NumLines-1 {\n\t\tv.Topline++\n\t}\n}", "func framescroll(f *frame.Frame, dl int) {\n\tif f != selecttext.fr {\n\t\tpanic(\"frameselect not right frame\");\n\t}\n\tselecttext.FrameScroll(dl);\n}", "func (fx *Script) Lines() (dialogs []*Line) {\n\n\tresx, resy := float64(fx.Resolution[0]), float64(fx.Resolution[1])\n\n\tfor _, dlg := range fx.scriptIn.Dialog.NotCommented() {\n\n\t\tend := asstime.SSAtoMS(dlg.EndTime)\n\t\tstart := asstime.SSAtoMS(dlg.StartTime)\n\t\tduration := end - start\n\t\ttext := StripSSATags(dlg.Text)\n\t\tfontFace := fx.fontFace[dlg.StyleName]\n\t\twidth, height := utils.MeasureString(fontFace, text)\n\t\twidth *= dlg.Style.Scale[0] / 100.0\n\t\t//width += 2*dlg.Style.Bord + dlg.Style.Shadow\n\t\theight *= dlg.Style.Scale[1] / 100.0\n\n\t\talign := dlg.Style.Alignment\n\t\tml, mr, mv := float64(dlg.Style.Margin[0]),\n\t\t\tfloat64(dlg.Style.Margin[1]),\n\t\t\tfloat64(dlg.Style.Margin[2])\n\n\t\t// Alignment\n\t\tmiddleheight := float64(height) / 2.0\n\t\tmiddlewidth := float64(width) / 2.0\n\n\t\tx := 0.0\n\t\ty := 0.0\n\t\tltop := 0.0\n\t\tlmid := 0.0\n\t\tlbot := 0.0\n\t\tlleft := 0.0\n\t\tlcenter := 0.0\n\t\tlright := 0.0\n\n\t\t// line x\n\t\tswitch align {\n\t\tcase 1, 4, 7: // left\n\t\t\tlleft = ml\n\t\t\tlcenter = lleft + middlewidth\n\t\t\tlright = lleft + width\n\t\t\tx = lleft\n\t\tcase 2, 5, 8: // center\n\t\t\tlleft = resx/2.0 - middlewidth\n\t\t\tlcenter = lleft + middlewidth\n\t\t\tlright = lleft + width\n\t\t\tx = lcenter\n\t\tcase 3, 6, 9: // right\n\t\t\tlleft = resx - mr - width\n\t\t\tlcenter = lleft + middlewidth\n\t\t\tlright = lleft + width\n\t\t\tx = lright\n\t\t}\n\n\t\t// line y\n\t\tswitch align {\n\t\tcase 7, 8, 9: // top\n\t\t\tltop = mv\n\t\t\tlmid = ltop + middleheight\n\t\t\tlbot = ltop + height\n\t\t\ty = ltop\n\t\tcase 4, 5, 6: // middle\n\t\t\tlmid = resy / 2\n\t\t\tltop = lmid - middleheight\n\t\t\tlbot = lmid + middleheight\n\t\t\ty = lmid\n\t\tcase 1, 2, 3: // bottom\n\t\t\tlbot = resy - mv\n\t\t\tlmid = lbot - middleheight\n\t\t\tltop = lbot - height\n\t\t\ty = lbot\n\t\t}\n\n\t\tsyls := GetSyls(dlg.Text)\n\n\t\tcharN := 0\n\t\tfor _, s := range syls {\n\t\t\tsyltext := strings.TrimSpace(s[3])\n\t\t\tif syltext != \"\" {\n\t\t\t\tfor range syltext {\n\t\t\t\t\tcharN++\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\td := &Line{\n\t\t\tDialog: Dialog{\n\t\t\t\tLayer: dlg.Layer,\n\t\t\t\tStartTime: start,\n\t\t\t\tEndTime: end,\n\t\t\t\tDuration: duration,\n\t\t\t\tMidTime: start + int(duration/2),\n\t\t\t\tStyle: dlg.Style,\n\t\t\t\tStyleName: dlg.StyleName,\n\t\t\t\tActor: dlg.Actor,\n\t\t\t\tEffect: dlg.Effect,\n\t\t\t\tText: text,\n\t\t\t\tTags: dlg.Tags,\n\t\t\t\tComment: dlg.Comment,\n\t\t\t\tWidth: float64(width),\n\t\t\t\tHeight: float64(height),\n\t\t\t\tSize: [2]float64{float64(width), float64(height)},\n\t\t\t\tXFix: fx.XFix,\n\t\t\t\tX: float64(x),\n\t\t\t\tY: float64(y),\n\t\t\t\tTop: float64(ltop),\n\t\t\t\tMiddle: float64(lmid),\n\t\t\t\tBottom: float64(lbot),\n\t\t\t\tLeft: float64(lleft),\n\t\t\t\tCenter: float64(lcenter),\n\t\t\t\tRight: float64(lright),\n\t\t\t},\n\t\t\tKara: dlg.Text,\n\t\t\tSylN: len(syls),\n\t\t\tCharN: charN,\n\t\t\tsyls: syls,\n\t\t\tfontFace: fontFace,\n\t\t\tresolution: fx.Resolution,\n\t\t}\n\t\tdialogs = append(dialogs, d)\n\t}\n\treturn dialogs\n}", "func (r Ruler) LineSliceAlong(start float64, stop float64, l Line) Line {\n\tvar sum float64\n\tvar slice []Point\n\n\tfor i := 0; i < len(l)-1; i++ {\n\t\tp0 := l[i]\n\t\tp1 := l[i+1]\n\t\td := r.Distance(p0, p1)\n\n\t\tsum += d\n\n\t\tif sum > start && len(slice) == 0 {\n\t\t\tslice = append(slice, interpolate(p0, p1, (start-(sum-d))/d))\n\t\t}\n\n\t\tif sum >= stop {\n\t\t\tslice = append(slice, interpolate(p0, p1, (stop-(sum-d))/d))\n\t\t\treturn slice\n\t\t}\n\n\t\tif sum > start {\n\t\t\tslice = append(slice, p1)\n\t\t}\n\t}\n\n\treturn slice\n}", "func (b *Buffer) MoveLinesUp(start int, end int) {\n\t// 0 < start < end <= len(b.lines)\n\tif start < 1 || start >= end || end > len(b.lines) {\n\t\treturn // what to do? FIXME\n\t}\n\tif end == len(b.lines) {\n\t\tb.Insert(\n\t\t\tLoc{\n\t\t\t\tutf8.RuneCount(b.lines[end-1].data),\n\t\t\t\tend - 1,\n\t\t\t},\n\t\t\t\"\\n\"+b.Line(start-1),\n\t\t)\n\t} else {\n\t\tb.Insert(\n\t\t\tLoc{0, end},\n\t\t\tb.Line(start-1)+\"\\n\",\n\t\t)\n\t}\n\tb.Remove(\n\t\tLoc{0, start - 1},\n\t\tLoc{0, start},\n\t)\n}", "func (o *GetInterceptionitemsParams) SetRows(rows string) {\n\to.Rows = rows\n}", "func (s *Session) readLines() {\n\tbReader := bufio.NewReader(s.r)\n\tfor {\n\t\tselect {\n\t\tcase <-s.closeChan:\n\t\t\t// close requested, return\n\t\t\treturn\n\n\t\tdefault:\n\t\t\t// read from the reader\n\t\t\tline, err := bReader.ReadString('\\n')\n\t\t\tif err != nil {\n\t\t\t\tif err == io.EOF {\n\t\t\t\t\tlog.Debug(\"VTY connection closed by the remote side.\")\n\t\t\t\t} else {\n\t\t\t\t\terror := fmt.Errorf(\"error by reading from VTY: %s\", err)\n\t\t\t\t\tlog.Error(error)\n\t\t\t\t\ts.errChan <- error\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\t\t\tstr := strings.Trim(line, \" \\r\\n\")\n\t\t\tlog.Debug(\"CLI: \", str)\n\n\t\t\t// write the read string to the channel\n\t\t\ts.rChan <- str\n\t\t}\n\t}\n}", "func PrintLines(cmd *cobra.Command, name string, previousLogLines, logLines []string, color func(a ...interface{}) string) {\n\tfor _, logLine := range logLines {\n\t\tif !logged(logLine, previousLogLines) {\n\t\t\tPrint(cmd, name, logLine, color)\n\t\t}\n\t}\n}", "func LinesDistance(a, b *Line) float64 {\n\tapProj := b.ProjectPoint(a.p)\n\taqProj := b.ProjectPoint(a.q)\n\tbpProj := a.ProjectPoint(b.p)\n\tbqProj := a.ProjectPoint(b.q)\n\tdistances := make([]float64, 0)\n\n\tif !b.ContainsPoint(apProj) {\n\t\tdistances = append(distances,\n\t\t\tmath.Min(Distance(a.p, b.p), Distance(a.p, b.q)))\n\t}\n\n\tif !b.ContainsPoint(aqProj) {\n\t\tdistances = append(distances,\n\t\t\tmath.Min(Distance(a.q, b.p), Distance(a.q, b.q)))\n\t}\n\n\tif !a.ContainsPoint(bpProj) {\n\t\tdistances = append(distances,\n\t\t\tmath.Min(Distance(b.p, a.p), Distance(b.p, a.q)))\n\t}\n\n\tif !a.ContainsPoint(bqProj) {\n\t\tdistances = append(distances,\n\t\t\tmath.Min(Distance(b.q, a.p), Distance(b.q, a.q)))\n\t}\n\n\tsort.Slice(distances, func(i, j int) bool {\n\t\treturn distances[i] < distances[j]\n\t})\n\n\treturn distances[0]\n}", "func (w *Window) Line(v1, v2 *geom.Vec2, r, g, b byte) {\n\t// Always draw from left to right (x1 <= x2)\n\tif v1[0] > v2[0] {\n\t\tv1, v2 = v2, v1\n\t}\n\tdx := v2[0] - v1[0]\n\tdy := v2[1] - v1[1]\n\tvar steps int\n\tif tmath.Absi(dx) > tmath.Absi(dy) {\n\t\tsteps = dx\n\t} else {\n\t\tsteps = tmath.Absi(dy)\n\t}\n\txinc := float64(dx) / float64(steps)\n\tyinc := float64(dy) / float64(steps)\n\tx := float64(v1[0])\n\ty := float64(v1[1])\n\tfor s := 0; s <= steps; s++ {\n\t\tw.Setxy(tmath.Round(x), tmath.Round(y), r, g, b)\n\t\tx += xinc\n\t\ty += yinc\n\t}\n}", "func (l *LogItems) Lines(showTime bool) [][]byte {\n\tl.mx.Lock()\n\tdefer l.mx.Unlock()\n\n\tll := make([][]byte, len(l.items))\n\tfor i, item := range l.items {\n\t\tcolor := l.colors[item.ID()]\n\t\tll[i] = item.Render(int(color-tcell.ColorValid), showTime)\n\t}\n\n\treturn ll\n}", "func (f *File) SetLinesForContent(content []byte) {\n\tvar lines []index\n\tline := index(0)\n\tfor offset, b := range content {\n\t\tif line >= 0 {\n\t\t\tlines = append(lines, line)\n\t\t}\n\t\tline = -1\n\t\tif b == '\\n' {\n\t\t\tline = index(offset) + 1\n\t\t}\n\t}\n\n\t// set lines table\n\tf.mutex.Lock()\n\tf.lines = lines\n\tf.mutex.Unlock()\n}", "func logLines(logLinesChan chan []byte, wg *sync.WaitGroup) {\n\treader := bufio.NewReader(os.Stdin)\n\tfor {\n\t\tl, err := reader.ReadBytes('\\n')\n\t\tif err != nil {\n\t\t\tif err != io.EOF {\n\t\t\t\tlog.Fatalf(\"Error reading stdin: %s\", err.Error())\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tlogLinesChan <- l\n\t}\n\n\twg.Done()\n}", "func (s *Scroller) Scroll(stop <-chan int) {\n\tscrolling := true\n\tgo func() {\n\t\tfor scrolling {\n\t\t\ts.move()\n\t\t\ttime.Sleep(s.delay)\n\t\t}\n\t}()\n\n\tfor value := range stop {\n\t\tif value == 1 {\n\t\t\tscrolling = false\n\t\t\tbreak\n\t\t}\n\t}\n}", "func (tv *TextView) RenderAllLinesInBounds() {\n\t// fmt.Printf(\"render all: %v\\n\", tv.Nm)\n\trs := &tv.Viewport.Render\n\trs.Lock()\n\tpc := &rs.Paint\n\tsty := &tv.Sty\n\ttv.VisSizes()\n\tpos := mat32.NewVec2FmPoint(tv.VpBBox.Min)\n\tepos := mat32.NewVec2FmPoint(tv.VpBBox.Max)\n\tpc.FillBox(rs, pos, epos.Sub(pos), &sty.Font.BgColor)\n\tpos = tv.RenderStartPos()\n\tstln := -1\n\tedln := -1\n\tfor ln := 0; ln < tv.NLines; ln++ {\n\t\tlst := pos.Y + tv.Offs[ln]\n\t\tled := lst + mat32.Max(tv.Renders[ln].Size.Y, tv.LineHeight)\n\t\tif int(mat32.Ceil(led)) < tv.VpBBox.Min.Y {\n\t\t\tcontinue\n\t\t}\n\t\tif int(mat32.Floor(lst)) > tv.VpBBox.Max.Y {\n\t\t\tcontinue\n\t\t}\n\t\tif stln < 0 {\n\t\t\tstln = ln\n\t\t}\n\t\tedln = ln\n\t}\n\n\tif stln < 0 || edln < 0 { // shouldn't happen.\n\t\trs.Unlock()\n\t\treturn\n\t}\n\n\tif tv.HasLineNos() {\n\t\ttv.RenderLineNosBoxAll()\n\n\t\tfor ln := stln; ln <= edln; ln++ {\n\t\t\ttv.RenderLineNo(ln)\n\t\t}\n\t}\n\n\ttv.RenderDepthBg(stln, edln)\n\ttv.RenderHighlights(stln, edln)\n\ttv.RenderScopelights(stln, edln)\n\ttv.RenderSelect()\n\tif tv.HasLineNos() {\n\t\ttbb := tv.VpBBox\n\t\ttbb.Min.X += int(tv.LineNoOff)\n\t\trs.Unlock()\n\t\trs.PushBounds(tbb)\n\t\trs.Lock()\n\t}\n\tfor ln := stln; ln <= edln; ln++ {\n\t\tlst := pos.Y + tv.Offs[ln]\n\t\tlp := pos\n\t\tlp.Y = lst\n\t\tlp.X += tv.LineNoOff\n\t\ttv.Renders[ln].Render(rs, lp) // not top pos -- already has baseline offset\n\t}\n\trs.Unlock()\n\tif tv.HasLineNos() {\n\t\trs.PopBounds()\n\t}\n}", "func parseLines(lines <-chan *tail.Line, hits chan<- *loghit.LogHit, errors chan<- error) {\n\tfor line := range lines {\n\t\tlogHit, err := loghit.New(line.Text)\n\t\tif err != nil {\n\t\t\terrors <- err\n\t\t} else {\n\t\t\thits <- logHit\n\t\t}\n\t}\n}", "func (o *GetSMSitemsParams) SetRows(rows string) {\n\to.Rows = rows\n}", "func (i *InputHandler) setMouseScroll(delta float32) {\n\ti.mouseScrollDeltaPrevious = delta\n}", "func Lines(r io.Reader, callback func(line string) error) (err error) {\n\tscanner := bufio.NewScanner(r)\n\tfor scanner.Scan() {\n\t\terr = callback(scanner.Text())\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn scanner.Err()\n}", "func (s *Screen) ClearLines() {\n\ts.ScreenCursor.Save()\n\ts.ScreenCursor.Home()\n\ts.ClearFromCursor(true)\n\ts.ScreenCursor.Return()\n}", "func (s *Store) LineRange(ln, cnt int) ([]string, error) {\n\tif ln < 0 || ln+cnt >= len(s.lines) {\n\t\treturn nil, fmt.Errorf(\"LineRange: line %v out of range\", ln)\n\t}\n\tstrs := []string{}\n\tfor i := 0; i < cnt; i++ {\n\t\tstrs = append(strs, s.lines[ln+i].String())\n\t}\n\treturn strs, nil\n}", "func (b *PurchaseInvoiceRequestBuilder) PurchaseInvoiceLines() *PurchaseInvoicePurchaseInvoiceLinesCollectionRequestBuilder {\n\tbb := &PurchaseInvoicePurchaseInvoiceLinesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}\n\tbb.baseURL += \"/purchaseInvoiceLines\"\n\treturn bb\n}", "func (r Ruler) LineSlice(start Point, end Point, l Line) Line {\n\tp1 := r.PointOnLine(l, start)\n\tp2 := r.PointOnLine(l, end)\n\n\tif p1.index > p2.index || (p1.index == p2.index && p1.t < p2.t) {\n\t\tp1, p2 = p2, p1\n\t}\n\n\tvar slice Line = []Point{p1.point}\n\n\tleft := p1.index + 1\n\tright := p2.index\n\n\tif l[left] != slice[0] && left <= right {\n\t\tslice = append(slice, l[left])\n\t}\n\n\tfor i := left + 1; i <= right; i++ {\n\t\tslice = append(slice, l[i])\n\t}\n\n\tif l[right] != p2.point {\n\t\tslice = append(slice, p2.point)\n\t}\n\n\treturn slice\n}", "func (a axes) drawLines(p *vg.Painter, xy xyer) {\n\tlim := a.limits\n\tcs := vg.CoordinateSystem{lim.Xmin, lim.Ymax, lim.Xmax, lim.Ymin} // upper left, lower right corner.\n\tfor _, l := range a.plot.Lines {\n\t\t// Append vertical line data to lines separated by NaNs.\n\t\tfor _, t := range l.V {\n\t\t\tl.X = append(l.X, math.NaN(), t, t)\n\t\t\tl.Y = append(l.Y, math.NaN(), lim.Ymin, lim.Ymax)\n\t\t}\n\t\ta.drawLine(p, xy, cs, l, false)\n\t}\n}", "func (v *TextView) SetPixelsAboveLines(px int) {\n\tC.gtk_text_view_set_pixels_above_lines(v.native(), C.gint(px))\n}", "func (w *ScrollWidget) NextLine() error {\n\terr := MoveLines(w.view, w.current, w.max, 1)\n\tw.current = GetLine(w.view)\n\treturn err\n}", "func (t *tui) scrollDown(g *gotui.Gui, v *gotui.View) error {\n\tv, err := g.View(t.currView.viewName)\n\tif err != nil {\n\t\treturn errgo.Mask(err)\n\t}\n\t_, y := v.Origin()\n\t_, maxY := v.Size()\n\tlines := len(v.ViewBufferLines())\n\tresult := y + maxY\n\tif result < lines {\n\t\tif result+maxY > lines {\n\t\t\tresult = result - (result + maxY - lines) - 1\n\t\t\tt.currView.hasMore = false\n\t\t}\n\t\tif result != y {\n\t\t\tt.currView.more = lines - (result + maxY)\n\t\t\tlog.Debugf(\"got %d lines, setting origin to 0,%d: %v\", lines, result, v.SetOrigin(0, result))\n\t\t}\n\t} else {\n\t\tt.currView.hasMore = false\n\t\tt.currView.more = 0\n\t}\n\tt.updateSendTitle()\n\treturn nil\n}", "func (d *AddressCacheItem) SetRows(block BlockID, rows []*dbtypes.AddressRowCompact) {\n\td.mtx.Lock()\n\tdefer d.mtx.Unlock()\n\td.setBlock(block)\n\td.rows = rows\n}", "func (r *Search) Scroll(duration string) *Search {\n\tr.values.Set(\"scroll\", duration)\n\n\treturn r\n}", "func (b *CompanyRequestBuilder) SalesInvoiceLines() *CompanySalesInvoiceLinesCollectionRequestBuilder {\n\tbb := &CompanySalesInvoiceLinesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}\n\tbb.baseURL += \"/salesInvoiceLines\"\n\treturn bb\n}", "func (tv *TextView) RenderScrolls() {\n\tif tv.HasFlag(int(TextViewRenderScrolls)) {\n\t\tly := tv.ParentLayout()\n\t\tif ly != nil {\n\t\t\tly.ReRenderScrolls()\n\t\t}\n\t\ttv.ClearFlag(int(TextViewRenderScrolls))\n\t}\n}", "func (tb *TextBuf) LinesEdited(tbe *TextBufEdit) {\n\ttb.LinesMu.Lock()\n\ttb.MarkupMu.Lock()\n\n\tst, ed := tbe.Reg.Start.Ln, tbe.Reg.End.Ln\n\tfor ln := st; ln <= ed; ln++ {\n\t\ttb.LineBytes[ln] = []byte(string(tb.Lines[ln]))\n\t\ttb.Markup[ln] = HTMLEscapeBytes(tb.LineBytes[ln])\n\t}\n\ttb.MarkupLines(st, ed)\n\ttb.MarkupMu.Unlock()\n\ttb.LinesMu.Unlock()\n\t// probably don't need to do global markup here..\n}", "func ReadLines(r io.Reader) <-chan string {\n\tlines := make(chan string)\n\tgo func() {\n\t\tdefer close(lines)\n\t\tscanner := bufio.NewScanner(r)\n\t\tfor scanner.Scan() {\n\t\t\tlines <- scanner.Text()\n\t\t}\n\t}()\n\treturn lines\n}", "func (ds *DrawServer) getLines(w http.ResponseWriter, r *http.Request) {\n\tjson.NewEncoder(w).Encode(ds.lines)\n}", "func (b *CompanyRequestBuilder) PurchaseInvoiceLines() *CompanyPurchaseInvoiceLinesCollectionRequestBuilder {\n\tbb := &CompanyPurchaseInvoiceLinesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}\n\tbb.baseURL += \"/purchaseInvoiceLines\"\n\treturn bb\n}", "func isInChangedLines(start, end int, changedLines []int) bool {\n\tfor _, line := range changedLines {\n\t\tif line >= start && line <= end {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (tb *TextBuf) AutoScrollViews() {\n\tfor _, tv := range tb.Views {\n\t\tif tv != nil && tv.This() != nil {\n\t\t\ttv.CursorPos = tb.EndPos()\n\t\t\ttv.ScrollCursorInView()\n\t\t}\n\t}\n}", "func LineWords(line, direction int, idx index.Index, lineQuery []string, available map[byte]int) <-chan foundword {\n\tallowed := idx.GetAllowedLetters(lineQuery, available)\n\n\tout := make(chan foundword)\n\tgo func() {\n\t\tdefer close(out)\n\t\tfor left := range GetSubSuffixes(allowed) {\n\t\t\tsubinfo := allowed.MakeSuffix(left)\n\t\t\tif !subinfo.PossiblePrefix() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor seq := range idx.ConstrainedSequences(subinfo) {\n\t\t\t\tout <- foundword{\n\t\t\t\t\tword: string(seq),\n\t\t\t\t\tstart: left,\n\t\t\t\t\tline: line,\n\t\t\t\t\tdirection: direction,\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\treturn out\n}", "func (m *LineMap) Lines() []Line {\n\treturn m.lines\n}", "func (f *file) ReadLines(offset, limit int) ([]string, error) {\n\tf.Lock()\n\tdefer f.Unlock()\n\tfile, err := os.Open(f.filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\toutput := []string{}\n\tline := -1\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tline++\n\t\tif line < offset {\n\t\t\tcontinue\n\t\t}\n\t\tif line >= offset+limit {\n\t\t\tbreak\n\t\t}\n\t\tline := scanner.Text()\n\t\toutput = append(output, line)\n\t}\n\treturn output, nil\n}", "func (self *TileSprite) AutoScroll(x int, y int) {\n self.Object.Call(\"autoScroll\", x, y)\n}", "func (tv *TextView) WrappedLines(ln int) int {\n\tif ln >= len(tv.Renders) {\n\t\treturn 0\n\t}\n\treturn len(tv.Renders[ln].Spans)\n}", "func (c *Client) UpdateSaleOrderLines(ids []int64, sol *SaleOrderLine) error {\n\treturn c.Update(SaleOrderLineModel, ids, sol)\n}", "func codeLines(src []byte, start, end int) (lines []codeLine) {\n\tstartLine := 1\n\tfor i, b := range src {\n\t\tif i == start {\n\t\t\tbreak\n\t\t}\n\t\tif b == '\\n' {\n\t\t\tstartLine++\n\t\t}\n\t}\n\ts := bufio.NewScanner(bytes.NewReader(src[start:end]))\n\tfor n := startLine; s.Scan(); n++ {\n\t\tl := s.Text()\n\t\tif strings.HasSuffix(l, \"OMIT\") {\n\t\t\tcontinue\n\t\t}\n\t\tlines = append(lines, codeLine{L: l, N: n})\n\t}\n\t// Trim leading and trailing blank lines.\n\tfor len(lines) > 0 && len(lines[0].L) == 0 {\n\t\tlines = lines[1:]\n\t}\n\tfor len(lines) > 0 && len(lines[len(lines)-1].L) == 0 {\n\t\tlines = lines[:len(lines)-1]\n\t}\n\treturn\n}", "func (c *Client) FindSaleOrderLines(criteria *Criteria, options *Options) (*SaleOrderLines, error) {\n\tsols := &SaleOrderLines{}\n\tif err := c.SearchRead(SaleOrderLineModel, criteria, options, sols); err != nil {\n\t\treturn nil, err\n\t}\n\treturn sols, nil\n}", "func (b *CompanyRequestBuilder) SalesCreditMemoLines() *CompanySalesCreditMemoLinesCollectionRequestBuilder {\n\tbb := &CompanySalesCreditMemoLinesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}\n\tbb.baseURL += \"/salesCreditMemoLines\"\n\treturn bb\n}", "func Lines(r io.ReadSeeker) (count uint64, err error) {\n\tdefer r.Seek(0, 0)\n\tbuf := make([]byte, 32*1024)\n\tlineSep := []byte{'\\n'}\n\n\tfor {\n\t\tc, err := r.Read(buf)\n\t\tcount += uint64(bytes.Count(buf[:c], lineSep))\n\n\t\tswitch {\n\t\tcase err == io.EOF:\n\t\t\treturn count, nil\n\n\t\tcase err != nil:\n\t\t\treturn count, err\n\t\t}\n\t}\n}", "func (lf *ListFile) IterateLines(iterator func(line string) bool) error {\n\treturn lf.iterateLines(func(b []byte) bool {\n\t\treturn iterator(string(b))\n\t})\n}", "func (p *printer) linesFrom(line int) int {\n\treturn p.out.Line - line\n}", "func (b *CompanyRequestBuilder) JournalLines() *CompanyJournalLinesCollectionRequestBuilder {\n\tbb := &CompanyJournalLinesCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}\n\tbb.baseURL += \"/journalLines\"\n\treturn bb\n}", "func NewScroll(parent sparta.Widget, name string, size, page int, typ ScrollType, rect image.Rectangle) *Scroll {\n\ts := &Scroll{\n\t\tname: name,\n\t\tparent: parent,\n\t\tgeometry: rect,\n\t\tback: backColor,\n\t\tfore: foreColor,\n\t\tsize: size,\n\t\tpage: page,\n\t\ttarget: parent,\n\t\ttyp: typ,\n\t}\n\tsparta.NewWindow(s)\n\treturn s\n}", "func (s *ItemScroller) onScroll(evname string, ev interface{}) {\n\n\tsev := ev.(*window.ScrollEvent)\n\tif sev.Yoffset > 0 {\n\t\ts.ScrollUp()\n\t} else if sev.Yoffset < 0 {\n\t\ts.ScrollDown()\n\t}\n}", "func drawBody(s tcell.Screen, content []string, selectedline int) {\n\tfor i, line := range content {\n\t\t// currentline = i+1 to account for header line taking index 0 on the screen.\n\t\tcurrentline := i + 1\n\t\tif selectedline == currentline {\n\t\t\tcolourRow(s, selectedStyle, currentline)\n\t\t\tputln(s, selectedStyle, line, currentline)\n\t\t} else {\n\t\t\tputln(s, style, line, currentline)\n\t\t}\n\n\t}\n}", "func (s *SyncTask) readLines(input io.Reader, decoders chan<- []byte) error {\n\n\trd := bufio.NewReader(input)\n\n\tfor {\n\t\tline, err := rd.ReadBytes('\\n')\n\t\tswitch err {\n\t\tcase io.EOF:\n\t\t\treturn nil\n\t\tcase nil:\n\t\tdefault:\n\t\t\treturn err\n\t\t}\n\n\t\tdecoders <- line\n\t\tmetrics.fileLines.Add(1)\n\t}\n}", "func GuiScrollPanel(bounds Rectangle, content Rectangle, scroll *Vector2) Rectangle {\n\tcbounds, _ := *(*C.Rectangle)(unsafe.Pointer(&bounds)), cgoAllocsUnknown\n\tccontent, _ := *(*C.Rectangle)(unsafe.Pointer(&content)), cgoAllocsUnknown\n\tcscroll, _ := (*C.Vector2)(unsafe.Pointer(scroll)), cgoAllocsUnknown\n\t__ret := C.GuiScrollPanel(cbounds, ccontent, cscroll)\n\t__v := *newRectangleRef(unsafe.Pointer(&__ret)).convert()\n\treturn __v\n}", "func (self *TileSprite) AutoScrollI(args ...interface{}) {\n self.Object.Call(\"autoScroll\", args)\n}", "func splitLines(lines [][]byte, data []byte) [][]byte {\n\tvar pos int\n\tvar last byte\n\tfor i, c := range data {\n\t\tif c == '\\n' {\n\t\t\tif last == '\\r' {\n\t\t\t\tpos++\n\t\t\t} else {\n\t\t\t\tlines = append(lines, data[pos:i])\n\t\t\t\tpos = i + 1\n\t\t\t}\n\t\t} else if c == '\\r' {\n\t\t\tlines = append(lines, data[pos:i])\n\t\t\tpos = i + 1\n\t\t}\n\t\tlast = c\n\t}\n\tif pos != len(lines) {\n\t\tlines = append(lines, data[pos:])\n\t}\n\treturn lines\n}", "func WriteLines(lines []string, path string) (err error) {\n\tvar (\n\t\tfile *os.File\n\t)\n\n\tif file, err = os.Create(path); err != nil {\n\t\treturn err\n\t}\n\tdefer file.Close()\n\n\tfor _, item := range lines {\n\t\t_, err := file.WriteString(strings.TrimSpace(item) + \"\\n\")\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn nil\n}" ]
[ "0.64334744", "0.6319284", "0.5774536", "0.5645454", "0.55825114", "0.54705334", "0.5405461", "0.53582263", "0.5316812", "0.526089", "0.52484185", "0.5241483", "0.5184795", "0.5115001", "0.5074118", "0.5014235", "0.49999243", "0.49166134", "0.4916111", "0.49033433", "0.48919988", "0.48755875", "0.4868865", "0.48426503", "0.47842428", "0.4741704", "0.47293133", "0.47283557", "0.47126487", "0.46994567", "0.46835527", "0.4672708", "0.4668779", "0.465463", "0.46488062", "0.46446007", "0.46444914", "0.46255228", "0.45769542", "0.4570497", "0.45674196", "0.4542889", "0.454018", "0.4525696", "0.4524287", "0.4519325", "0.4519039", "0.45181623", "0.44742033", "0.44691667", "0.4466109", "0.44648716", "0.44520828", "0.44489026", "0.4439604", "0.44367498", "0.4426154", "0.44203585", "0.4415179", "0.44113588", "0.44108844", "0.44080228", "0.44033372", "0.4394975", "0.43932036", "0.43897626", "0.43765876", "0.43625274", "0.43621463", "0.43590242", "0.4348761", "0.43482617", "0.43403855", "0.43362743", "0.43306145", "0.43117732", "0.4299019", "0.42959544", "0.4285628", "0.42806533", "0.42750934", "0.42702088", "0.4255902", "0.42529252", "0.4244611", "0.4231046", "0.4218121", "0.42161846", "0.4190836", "0.4187443", "0.41806674", "0.4178819", "0.41704175", "0.41649365", "0.41616818", "0.41589487", "0.41578698", "0.41467142", "0.41412064", "0.41400307" ]
0.6262709
2
scrollLine scrolls a line horizontally starting at the provided position by a number of columns.
func (h *windowsAnsiEventHandler) scrollLine(columns int, position COORD, info *CONSOLE_SCREEN_BUFFER_INFO) error { // Copy from and clip to the scroll region (full buffer width) scrollRect := SMALL_RECT{ Top: position.Y, Bottom: position.Y, Left: position.X, Right: info.Size.X - 1, } // Origin to which area should be copied destOrigin := COORD{ X: position.X - int16(columns), Y: position.Y, } char := CHAR_INFO{ UnicodeChar: ' ', Attributes: h.attributes, } if err := ScrollConsoleScreenBuffer(h.fd, scrollRect, scrollRect, destOrigin, char); err != nil { return err } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (w *ScrollWidget) NextLine() error {\n\terr := MoveLines(w.view, w.current, w.max, 1)\n\tw.current = GetLine(w.view)\n\treturn err\n}", "func TextViewScrollToLine(textView *gtk.TextView, line int, highLight ...bool) {\n\tvar doHighLight bool\n\tif len(highLight) > 0 {\n\t\tdoHighLight = highLight[0]\n\t}\n\tvar err error\n\tif line > 0 {\n\t\tif buf, err := textView.GetBuffer(); err == nil {\n\n\t\t\titerTxt0 := buf.GetIterAtLine(line)\n\t\t\titerTxt1 := buf.GetIterAtOffset(buf.GetIterAtLine(line).GetOffset() - 1)\n\n\t\t\tbuf.PlaceCursor(iterTxt0)\n\t\t\tfor gtk.EventsPending() {\n\t\t\t\tgtk.MainIterationDo(false)\n\t\t\t}\n\t\t\ttextView.ScrollToIter(iterTxt0, 0.0, true, 0.5, 0.5)\n\n\t\t\tif doHighLight {\n\t\t\t\tbuf.SelectRange(iterTxt0, iterTxt1) // HighLight current line.\n\t\t\t}\n\t\t}\n\t}\n\tif err != nil {\n\t\tlog.Fatalf(\"TextViewScrollToLine: %s\\n\", err.Error())\n\t}\n}", "func ToLine(line int) Opt {\n\treturn func(s *Scroller) *Scroller {\n\t\tnewS := clone(s)\n\t\tnewS.line = line\n\t\tnewS.pos = -1\n\t\tnewS.offset = false\n\t\tnewS.dir = NoDirection\n\t\treturn newS\n\t}\n}", "func (d *Device) SetScroll(line int16) {\n\td.buf[0] = uint8(line >> 8)\n\td.buf[1] = uint8(line)\n\td.startWrite()\n\td.sendCommand(VSCRSADD, d.buf[:2])\n\td.endWrite()\n}", "func (w *Window) Line(v1, v2 *geom.Vec2, r, g, b byte) {\n\t// Always draw from left to right (x1 <= x2)\n\tif v1[0] > v2[0] {\n\t\tv1, v2 = v2, v1\n\t}\n\tdx := v2[0] - v1[0]\n\tdy := v2[1] - v1[1]\n\tvar steps int\n\tif tmath.Absi(dx) > tmath.Absi(dy) {\n\t\tsteps = dx\n\t} else {\n\t\tsteps = tmath.Absi(dy)\n\t}\n\txinc := float64(dx) / float64(steps)\n\tyinc := float64(dy) / float64(steps)\n\tx := float64(v1[0])\n\ty := float64(v1[1])\n\tfor s := 0; s <= steps; s++ {\n\t\tw.Setxy(tmath.Round(x), tmath.Round(y), r, g, b)\n\t\tx += xinc\n\t\ty += yinc\n\t}\n}", "func (tv *TextView) CursorStartLine() {\n\twupdt := tv.TopUpdateStart()\n\tdefer tv.TopUpdateEnd(wupdt)\n\ttv.ValidateCursor()\n\torg := tv.CursorPos\n\tpos := tv.CursorPos\n\n\tgotwrap := false\n\tif wln := tv.WrappedLines(pos.Ln); wln > 1 {\n\t\tsi, ri, _ := tv.WrappedLineNo(pos)\n\t\tif si > 0 {\n\t\t\tri = 0\n\t\t\tnwc, _ := tv.Renders[pos.Ln].SpanPosToRuneIdx(si, ri)\n\t\t\tpos.Ch = nwc\n\t\t\ttv.CursorPos = pos\n\t\t\ttv.CursorCol = ri\n\t\t\tgotwrap = true\n\t\t}\n\t}\n\tif !gotwrap {\n\t\ttv.CursorPos.Ch = 0\n\t\ttv.CursorCol = tv.CursorPos.Ch\n\t}\n\t// fmt.Printf(\"sol cursorcol: %v\\n\", tv.CursorCol)\n\ttv.SetCursor(tv.CursorPos)\n\ttv.ScrollCursorToLeft()\n\ttv.RenderCursor(true)\n\ttv.CursorSelect(org)\n}", "func (h *DebugHooks) triggerLine(t *Thread, c Cont, l int32) error {\n\tif h.DebugHookFlags&HookFlagLine == 0 || l <= 0 {\n\t\treturn nil\n\t}\n\treturn h.callHook(t, c, lineHookString, IntValue(int64(l)))\n}", "func setViewCursorToLine(g *gocui.Gui, v *gocui.View, lines []string, selLine string) error {\n\tox, _ := v.Origin()\n\tcx, _ := v.Cursor()\n\tfor y, line := range lines {\n\t\tif line == selLine {\n\t\t\tif err := v.SetCursor(ox, y); err != nil {\n\t\t\t\tif err := v.SetOrigin(cx, y); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func (tv *TextView) JumpToLinePrompt() {\n\tgi.StringPromptDialog(tv.Viewport, \"\", \"Line no..\",\n\t\tgi.DlgOpts{Title: \"Jump To Line\", Prompt: \"Line Number to jump to\"},\n\t\ttv.This(), func(recv, send ki.Ki, sig int64, data interface{}) {\n\t\t\tdlg := send.(*gi.Dialog)\n\t\t\tif sig == int64(gi.DialogAccepted) {\n\t\t\t\tval := gi.StringPromptDialogValue(dlg)\n\t\t\t\tln, ok := kit.ToInt(val)\n\t\t\t\tif ok {\n\t\t\t\t\ttv.JumpToLine(int(ln))\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\n}", "func drawLine(w, y int, ln line) int {\n\t// figure out whether the line needs to be shortened\n\tvar truncLen int\n\ttruncIndex := -1\n\tlineWidth := 0\n\tfor _, seg := range ln {\n\t\tlineWidth += len(seg.text)\n\t}\n\tif lineWidth > w-2 {\n\t\t// figure out which segment to shorten\n\t\ttruncIndex = len(ln) - 1\n\t\tfor i, seg := range ln {\n\t\t\tif seg.el != ellipsisNone {\n\t\t\t\ttruncIndex = i\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\t// figure out by how much to shorten it\n\t\ttruncLen = len(ln[truncIndex].text) - (lineWidth - (w - 2) + 3)\n\t\tif truncLen < 0 {\n\t\t\ttruncLen = 0\n\t\t}\n\t}\n\n\t// draw characters\n\tx := 0\n\tfor i, seg := range ln {\n\t\ttext := seg.text\n\n\t\t// ...text\n\t\tif i == truncIndex {\n\t\t\tif seg.el == ellipsisLeft {\n\t\t\t\tx = drawEllipsis(x, y, seg.fg, seg.bg)\n\t\t\t\ttext = text[len(text)-truncLen:]\n\t\t\t} else {\n\t\t\t\ttext = text[:truncLen]\n\t\t\t}\n\t\t}\n\n\t\tfor _, ch := range text {\n\t\t\ttermbox.SetCell(x, y, ch, seg.fg, seg.bg)\n\t\t\tx++\n\t\t}\n\n\t\t// text...\n\t\tif i == truncIndex && seg.el != ellipsisLeft {\n\t\t\tx = drawEllipsis(x, y, seg.fg, seg.bg)\n\t\t}\n\t}\n\n\treturn x\n}", "func (file *File) SeekLine(lines int64, whence int) (int64, error) {\n\n\t// return error on bad whence\n\tif whence < 0 || whence > 2 {\n\t\treturn file.Seek(0, whence)\n\t}\n\n\tposition, err := file.Seek(0, whence)\n\n\tbuf := make([]byte, BufferLength)\n\tbufLen := 0\n\tlineSep := byte('\\n')\n\tseekBack := lines < 1\n\tlines = int64(math.Abs(float64(lines)))\n\tmatchCount := int64(0)\n\n\t// seekBack ignores first match\n\t// allows 0 to go to begining of current line\n\tif seekBack {\n\t\tmatchCount = -1\n\t}\n\n\tleftPosition := position\n\toffset := int64(BufferLength * -1)\n\n\tfor b := 1; ; b++ {\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\n\t\tif seekBack {\n\n\t\t\t// on seekBack 2nd buffer onward needs to seek\n\t\t\t// past what was just read plus another buffer size\n\t\t\tif b == 2 {\n\t\t\t\toffset *= 2\n\t\t\t}\n\n\t\t\t// if next seekBack will pass beginning of file\n\t\t\t// buffer is 0 to unread position\n\t\t\tif position+int64(offset) <= 0 {\n\t\t\t\tbuf = make([]byte, leftPosition)\n\t\t\t\tposition, err = file.Seek(0, io.SeekStart)\n\t\t\t\tleftPosition = 0\n\t\t\t} else {\n\t\t\t\tposition, err = file.Seek(offset, io.SeekCurrent)\n\t\t\t\tleftPosition = leftPosition - BufferLength\n\t\t\t}\n\t\t}\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\n\t\tbufLen, err = file.Read(buf)\n\t\tif err != nil {\n\t\t\tbreak\n\t\t} else if seekBack && leftPosition == 0 {\n\t\t\terr = io.EOF\n\t\t}\n\n\t\tfor i := 0; i < bufLen; i++ {\n\t\t\tiToCheck := i\n\t\t\tif seekBack {\n\t\t\t\tiToCheck = bufLen - i - 1\n\t\t\t}\n\t\t\tbyteToCheck := buf[iToCheck]\n\n\t\t\tif byteToCheck == lineSep {\n\t\t\t\tmatchCount++\n\t\t\t}\n\n\t\t\tif matchCount == lines {\n\t\t\t\tif seekBack {\n\t\t\t\t\treturn file.Seek(int64(i)*-1, io.SeekCurrent)\n\t\t\t\t}\n\t\t\t\treturn file.Seek(int64(bufLen*-1+i+1), io.SeekCurrent)\n\t\t\t}\n\t\t}\n\t}\n\n\tif err == io.EOF && !seekBack {\n\t\tposition, _ = file.Seek(0, io.SeekEnd)\n\t} else if err == io.EOF && seekBack {\n\t\tposition, _ = file.Seek(0, io.SeekStart)\n\n\t\t// no io.EOF err on SeekLine(0,0)\n\t\tif lines == 0 {\n\t\t\terr = nil\n\t\t}\n\t}\n\n\treturn position, err\n}", "func (cons *VgaTextConsole) Scroll(dir ScrollDir, lines uint32) {\n\tif lines == 0 || lines > cons.height {\n\t\treturn\n\t}\n\n\tvar i uint32\n\toffset := lines * cons.width\n\n\tswitch dir {\n\tcase ScrollDirUp:\n\t\tfor ; i < (cons.height-lines)*cons.width; i++ {\n\t\t\tcons.fb[i] = cons.fb[i+offset]\n\t\t}\n\tcase ScrollDirDown:\n\t\tfor i = cons.height*cons.width - 1; i >= lines*cons.width; i-- {\n\t\t\tcons.fb[i] = cons.fb[i-offset]\n\t\t}\n\t}\n}", "func (this *Source) LineColumn(pos int) (int, int) {\n lineNum := 1 + this.LineOffset\n colNum := 0\n text := this.Text\n justReadCR := false\n for i := 0; i < pos; i++ {\n c := text[i]\n if c == '\\r' {\n lineNum++\n colNum = 0\n justReadCR = true\n } else if c == '\\n' {\n if !justReadCR {\n lineNum++\n colNum = 0\n }\n justReadCR = false\n } else {\n colNum++\n justReadCR = false\n }\n }\n return lineNum, colNum\n}", "func dline (x int, y int, height int) {\n\tadd := 1\n\tn := 0\n\theight += height % 2\n\tif height < 0 {\n\t\tadd = -1\n\t}\n\tfor n != height {\n\t\timg.Set(x, y - n, col)\n\t\timg.Set(x, y - n - add, col)\n\t\tx += 1;\n\t\tn += 2 * add\n\t}\n}", "func (native *OpenGL) LineWidth(lw float32) {\n\tgl.LineWidth(lw)\n}", "func (tv *TextView) JumpToLine(ln int) {\n\twupdt := tv.TopUpdateStart()\n\ttv.SetCursorShow(TextPos{Ln: ln - 1})\n\ttv.SavePosHistory(tv.CursorPos)\n\ttv.TopUpdateEnd(wupdt)\n}", "func (ref *UIElement) RangeForLine(line int32) Range {\n\treturn ref.rangeForInt32Attr(RangeForLineParameterizedAttribute, line)\n}", "func (c *Canvas) Line(x1, y1, x2, y2, size float64, color color.RGBA) {\n\tx1, y1 = dimen(x1, y1, c.Width, c.Height)\n\tx2, y2 = dimen(x2, y2, c.Width, c.Height)\n\tlsize := pct(size, c.Width)\n\tAbsLine(c.Container, int(x1), int(y1), int(x2), int(y2), float32(lsize), color)\n\n}", "func lineStart(f *token.File, line int) token.Pos {\n\t// Use binary search to find the start offset of this line.\n\t//\n\t// TODO(rstambler): eventually replace this function with the\n\t// simpler and more efficient (*go/token.File).LineStart, added\n\t// in go1.12.\n\n\tmin := 0 // inclusive\n\tmax := f.Size() // exclusive\n\tfor {\n\t\toffset := (min + max) / 2\n\t\tpos := f.Pos(offset)\n\t\tposn := f.Position(pos)\n\t\tif posn.Line == line {\n\t\t\treturn pos - (token.Pos(posn.Column) - 1)\n\t\t}\n\n\t\tif min+1 >= max {\n\t\t\treturn token.NoPos\n\t\t}\n\n\t\tif posn.Line < line {\n\t\t\tmin = offset\n\t\t} else {\n\t\t\tmax = offset\n\t\t}\n\t}\n}", "func getNextViewLine(g *gocui.Gui, v *gocui.View) (string, error) {\n\tvar l string\n\tvar err error\n\n\t_, cy := v.Cursor()\n\tif l, err = v.Line(cy + 1); err != nil {\n\t\tl = \"\"\n\t}\n\n\treturn l, err\n}", "func (dw *DrawingWand) Line(sx, sy, ex, ey float64) {\n\tC.MagickDrawLine(dw.dw, C.double(sx), C.double(sy), C.double(ex), C.double(ey))\n}", "func (logSeeker *LogSeeker) SeekLinePosition(pos int64) (offset int64, err error) {\n\tif pos == 0 {\n\t\treturn 0, nil\n\t}\n\n\toffset, err = logSeeker.file.Seek(pos, os.SEEK_SET)\n\n\tif err != nil {\n\t\treturn offset, err\n\t}\n\n\tlineSep := byte('\\n')\n\tbuf := make([]byte, 1)\n\n\t_, err = logSeeker.file.Read(buf)\n\n\tif err != nil && err != io.EOF {\n\t\treturn 0, err\n\t}\n\n\tif buf[0] == lineSep {\n\t\toffset, err = logSeeker.Tell()\n\t\treturn\n\t}\n\n\toffset, err = logSeeker.Tell()\n\n\tvar stepSize int64 = 1024\n\n\tseekPos := stepSize\n\tfound := false\n\ti := 0\n\tfor {\n\n\t\tfound = false\n\n\t\tif offset == 0 {\n\t\t\tbreak\n\t\t}\n\n\t\tif offset <= stepSize {\n\t\t\tseekPos = offset\n\t\t} else {\n\t\t\tseekPos = stepSize\n\t\t}\n\n\t\t// fmt.Printf(\"before Seek pos: %d %d\\n\", offset, seekPos)\n\n\t\toffset, err = logSeeker.file.Seek(seekPos*-1, os.SEEK_CUR) // get left chars\n\t\t// fmt.Printf(\"before ReadAt pos: %d\\n\", offset)\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\n\t\tbuf = make([]byte, seekPos)\n\n\t\trealSize, err := logSeeker.file.Read(buf)\n\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t\t// fmt.Printf(\"before content: %v\\n\", string(buf))\n\n\t\ti = realSize - 1\n\t\tfor ; i >= 0; i-- {\n\t\t\tif buf[i] == lineSep {\n\t\t\t\tfound = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif found {\n\n\t\t\t// fmt.Printf(\"Tell pos 1: %d,%d\\n\", offset, i)\n\n\t\t\toffset, err = logSeeker.file.Seek(int64(i-realSize+1), os.SEEK_CUR) //fallback\n\t\t\t// fmt.Printf(\"last pos: %d\\n\", offset)\n\n\t\t\tbreak\n\t\t} else {\n\t\t\toffset, err = logSeeker.file.Seek(int64(realSize)*-1, os.SEEK_CUR)\n\t\t}\n\n\t}\n\n\treturn\n}", "func CursorNextLine(n int) {\n\tfmt.Printf(CSI+CursorNextLineSeq, n)\n}", "func (o *SearchLine) SetLine(v int32) {\n\to.Line = &v\n}", "func (lexer *Lexer) nextLine() {\n lexer.position.Col = 0\n lexer.position.Row++\n}", "func (f *File) AddLine(offset int) {\n\tx := index(offset)\n\tf.mutex.Lock()\n\tif i := len(f.lines); (i == 0 || f.lines[i-1] < x) && x < f.size {\n\t\tf.lines = append(f.lines, x)\n\t}\n\tf.mutex.Unlock()\n}", "func (b *T) LineByNumber(nrLine int) (line *Line) {\n\tswitch {\n\tcase nrLine > 0:\n\t\tline = b.LineByIndex(nrLine - 1)\n\tcase nrLine < 0:\n\t\tline = b.LineByIndexInReverse(-nrLine - 1)\n\t}\n\treturn\n}", "func (v *View) ScrollDown(n int) {\n\t// Try to scroll by n but if it would overflow, scroll by 1\n\tif v.topline+n <= len(v.buf.lines)-v.height {\n\t\tv.topline += n\n\t} else if v.topline < len(v.buf.lines)-v.height {\n\t\tv.topline++\n\t}\n}", "func NewLine(num int, a, b, step float64) model.Collection {\n\tline := NewLineGenerator(a, b, step)\n\tcollection := line.Num(num)\n\treturn collection\n}", "func (path *Path) Line(pt Point) {\n\twriteCommand(&path.buf, \"l\", pt.X, pt.Y)\n}", "func (tm *Term) ScrollLeft() error {\n\ttm.ColSt = ints.MaxInt(tm.ColSt-1, 0)\n\treturn tm.Draw()\n}", "func hLine(img *image.NRGBA, x1, y, x2 int, col color.Color) {\r\n\tfor ; x1 <= x2; x1++ {\r\n\t\timg.Set(x1, y, col)\r\n\t}\r\n}", "func (r Ruler) LineDistance(l Line) float64 {\n\tvar distance float64\n\n\tfor i := 0; i < len(l)-1; i++ {\n\t\tdistance += r.Distance(l[i], l[i+1])\n\t}\n\treturn distance\n}", "func (p *Page) LineTo(x, y float64) {\n\tfmt.Fprint(p.contents, x, y, \" l \")\n}", "func (m *TransposableMatrix) DrawLine(line []Point, suffix string, pivotPointsOnly bool) {\n\tfor i := 0; i < len(line); i++ {\n\t\ts := spf(\"%v%v\", i%10, suffix)\n\t\tif suffix == \"\" {\n\t\t\ts = \"\"\n\t\t}\n\t\tif pivotPointsOnly || i == len(line)-1 {\n\t\t\tm.SetLabel(line[i].x, line[i].y, Slot{Label: s})\n\t\t} else {\n\t\t\tx := util.Min(line[i+1].x, line[i].x)\n\t\t\ty := util.Min(line[i+1].y, line[i].y)\n\t\t\tdx := util.Abs(line[i+1].x - line[i].x)\n\t\t\tdy := util.Abs(line[i+1].y - line[i].y)\n\t\t\t// pf(\"sect :%v %v %v %v \\n\", x, x+dx, y, y+dy)\n\t\t\tfor j := x; j <= x+dx; j++ {\n\t\t\t\tfor k := y; k <= y+dy; k++ {\n\t\t\t\t\tm.SetLabel(j, k, Slot{Label: s})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "func (v *TextView) StartsDisplayLine(iter *TextIter) bool {\n\treturn gobool(C.gtk_text_view_starts_display_line(v.native(), iter.native()))\n}", "func LineWords(line, direction int, idx index.Index, lineQuery []string, available map[byte]int) <-chan foundword {\n\tallowed := idx.GetAllowedLetters(lineQuery, available)\n\n\tout := make(chan foundword)\n\tgo func() {\n\t\tdefer close(out)\n\t\tfor left := range GetSubSuffixes(allowed) {\n\t\t\tsubinfo := allowed.MakeSuffix(left)\n\t\t\tif !subinfo.PossiblePrefix() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor seq := range idx.ConstrainedSequences(subinfo) {\n\t\t\t\tout <- foundword{\n\t\t\t\t\tword: string(seq),\n\t\t\t\t\tstart: left,\n\t\t\t\t\tline: line,\n\t\t\t\t\tdirection: direction,\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\treturn out\n}", "func (t *Table) SetRowLine(line bool) {\n\tt.rowLine = line\n}", "func (b *Buffer) Line(n int) string {\n\tif n >= len(b.lines) {\n\t\treturn \"\"\n\t}\n\treturn string(b.lines[n].data)\n}", "func (v *View) ScrollDown(n int) {\n\t// Try to scroll by n but if it would overflow, scroll by 1\n\tif v.Topline+n <= v.Buf.NumLines {\n\t\tv.Topline += n\n\t} else if v.Topline < v.Buf.NumLines-1 {\n\t\tv.Topline++\n\t}\n}", "func (tb *TextBuf) Line(ln int) []rune {\n\ttb.LinesMu.RLock()\n\tdefer tb.LinesMu.RUnlock()\n\tif ln >= tb.NLines || ln < 0 {\n\t\treturn nil\n\t}\n\treturn tb.Lines[ln]\n}", "func HorizontalLine() string {\n\treturn strings.Repeat(\"-\", termcols)\n}", "func (w *Writer) WriteLine(data []byte) error {\n\tif w.err != nil {\n\t\treturn w.err\n\t}\n\tfor _, fnc := range w.onLine {\n\t\tif ok, err := fnc(data); err != nil {\n\t\t\tw.setError(err)\n\t\t\treturn err\n\t\t} else if !ok {\n\t\t\treturn nil\n\t\t}\n\t}\n\tif w.Timeout != nil {\n\t\terr := w.Timeout(true)\n\t\tif err != nil {\n\t\t\tw.setError(err)\n\t\t\treturn err\n\t\t}\n\t\tdefer w.Timeout(false)\n\t}\n\t_, err := w.bw.Write(data)\n\tif err != nil {\n\t\tw.setError(err)\n\t\treturn err\n\t}\n\treturn nil\n}", "func (tb *TextBuf) BytesLine(ln int) []byte {\n\ttb.LinesMu.RLock()\n\tdefer tb.LinesMu.RUnlock()\n\tif ln >= tb.NLines || ln < 0 {\n\t\treturn nil\n\t}\n\treturn tb.LineBytes[ln]\n}", "func (tv *TextView) RenderLineNo(ln int) {\n\tif !tv.HasLineNos() {\n\t\treturn\n\t}\n\tvp := tv.Viewport\n\tsty := &tv.Sty\n\tspc := sty.BoxSpace()\n\tfst := sty.Font\n\tfst.BgColor.SetColor(nil)\n\trs := &vp.Render\n\tlfmt := fmt.Sprintf(\"%d\", tv.LineNoDigs)\n\tlfmt = \"%\" + lfmt + \"d\"\n\tlnstr := fmt.Sprintf(lfmt, ln+1)\n\ttv.LineNoRender.SetString(lnstr, &fst, &sty.UnContext, &sty.Text, true, 0, 0)\n\tpos := tv.RenderStartPos()\n\tlst := tv.CharStartPos(TextPos{Ln: ln}).Y // note: charstart pos includes descent\n\tpos.Y = lst + mat32.FromFixed(sty.Font.Face.Face.Metrics().Ascent) - +mat32.FromFixed(sty.Font.Face.Face.Metrics().Descent)\n\tpos.X = float32(tv.VpBBox.Min.X) + spc\n\ttv.LineNoRender.Render(rs, pos)\n\t// if ic, ok := tv.LineIcons[ln]; ok {\n\t// \t// todo: render icon!\n\t// }\n}", "func (w *TableWriter) WriteLine(line []string) error {\n\t_, err := fmt.Fprintln(w.writer, strings.Join(line, tab))\n\treturn err\n}", "func (a axes) drawDirectLine(l Line, xy xyer, cs vg.CoordinateSystem) {\n\tr := image.Rectangle{image.Point{a.x, a.y}, image.Point{a.x + a.width, a.y + a.height}}\n\tim := a.parent.SubImage(r)\n\t/*\n\t\tm := raster.Image{\n\t\t\tImage: im.(*image.RGBA),\n\t\t\tColor: a.plot.Style.Color.Order.Get(l.Style.Line.Color, l.Id+1).Color(),\n\t\t}\n\t\tx, y, _ := xy.XY(l)\n\t\traster.FloatLines(m, x, y, raster.CoordinateSystem(cs))\n\t*/\n\tp := vg.NewPainter(im.(*image.RGBA))\n\ta.drawLine(p, xy, cs, l, false)\n\tp.Paint()\n}", "func (imd *IMDraw) Line(thickness float64) {\n\timd.polyline(thickness, false)\n}", "func (s *Store) LineRange(ln, cnt int) ([]string, error) {\n\tif ln < 0 || ln+cnt >= len(s.lines) {\n\t\treturn nil, fmt.Errorf(\"LineRange: line %v out of range\", ln)\n\t}\n\tstrs := []string{}\n\tfor i := 0; i < cnt; i++ {\n\t\tstrs = append(strs, s.lines[ln+i].String())\n\t}\n\treturn strs, nil\n}", "func GetLineIndex(v *gocui.View) int {\n\t_, cy := v.Cursor()\n\treturn cy\n}", "func ComputeLines(lines chan int, step float64, fractal *image.RGBA) {\n\tfor line := range lines {\n\t\tfor i := 0; i < XSIZE; i++ {\n\t\t\tn := ComplexAt(line, i, step)\n\t\t\titerations := ComputeIterations(n)\n\t\t\tfractal.Set(i, line, FancyColor(iterations))\n\t\t}\n\t}\n}", "func (tb *TextBuf) IsValidLine(ln int) bool {\n\tif ln < 0 {\n\t\treturn false\n\t}\n\tnln := tb.NumLines()\n\tif ln >= nln {\n\t\treturn false\n\t}\n\treturn true\n}", "func (s *Surface) SetLineMiterLimit(miter float64) {\n\ts.Ctx.Set(\"miterLimit\", miter)\n}", "func (dw *DrawingWand) PathLineToHorizontalRelative(x float64) {\n\tC.MagickDrawPathLineToHorizontalRelative(dw.dw, C.double(x))\n}", "func (tv *TextView) RenderLineNosBox(st, ed int) {\n\tif !tv.HasLineNos() {\n\t\treturn\n\t}\n\trs := &tv.Viewport.Render\n\tpc := &rs.Paint\n\tsty := &tv.Sty\n\tspc := sty.BoxSpace()\n\tclr := sty.Font.BgColor.Color.Highlight(10)\n\tspos := tv.CharStartPos(TextPos{Ln: st})\n\tspos.X = float32(tv.VpBBox.Min.X)\n\tepos := tv.CharEndPos(TextPos{Ln: ed + 1})\n\tepos.Y -= tv.LineHeight\n\tepos.X = spos.X + tv.LineNoOff - spc\n\t// fmt.Printf(\"line box: st %v ed: %v spos %v epos %v\\n\", st, ed, spos, epos)\n\tpc.FillBoxColor(rs, spos, epos.Sub(spos), clr)\n}", "func (gc *LinearConverter) LineOffset() int {\n\treturn 0\n}", "func (s *SimPDF) NewLine(size float64) {\n\tif size == 0 {\n\t\ts.PDF.Ln(-1)\n\t} else {\n\t\ts.PDF.Ln(size)\n\t}\n}", "func iLine(x1, y1, x2, y2 int, size float32, color color.RGBA) *canvas.Line {\n\tp1 := fyne.Position{X: float32(x1), Y: float32(y1)}\n\tp2 := fyne.Position{X: float32(x2), Y: float32(y2)}\n\tl := &canvas.Line{StrokeColor: color, StrokeWidth: size, Position1: p1, Position2: p2}\n\treturn l\n}", "func getViewLine(g *gocui.Gui, v *gocui.View) (string, error) {\n\tvar l string\n\tvar err error\n\n\t_, cy := v.Cursor()\n\tif l, err = v.Line(cy); err != nil {\n\t\tl = \"\"\n\t}\n\n\treturn l, err\n}", "func line(m draw.Image, x0, y0, x1, y1 int, c color.Color) {\n\tabs := func(x int) int {\n\t\tif x < 0 {\n\t\t\treturn -x\n\t\t}\n\t\treturn x\n\t}\n\n\tvar dx, dy, sx, sy, e, e2 int\n\n\tdx = abs(x1 - x0)\n\tdy = -abs(y1 - y0)\n\tif sx = -1; x0 < x1 {\n\t\tsx = 1\n\t}\n\tif sy = -1; y0 < y1 {\n\t\tsy = 1\n\t}\n\te = dx + dy\n\tfor {\n\t\tm.Set(x0, y0, c)\n\t\tif x0 == x1 && y0 == y1 {\n\t\t\tbreak\n\t\t}\n\t\tif e2 = 2 * e; e2 >= dy {\n\t\t\te += dy\n\t\t\tx0 += sx\n\t\t} else if e2 <= dx {\n\t\t\te += dx\n\t\t\ty0 += sy\n\t\t}\n\t}\n}", "func (w *ScrollWidget) PreviousLine() error {\n\terr := MoveLines(w.view, w.current, w.max, -1)\n\tw.current = GetLine(w.view)\n\treturn err\n}", "func HLine(img *image.RGBA, x1, y, x2 int, col color.Color) {\n\tfor ; x1 <= x2; x1++ {\n\t\timg.Set(x1, y, col)\n\t}\n}", "func LineWidth(width float32) {\n\tsyscall.Syscall(gpLineWidth, 1, uintptr(math.Float32bits(width)), 0, 0)\n}", "func (p *MultiLineParser) sendLine() {\n\tdefer func() {\n\t\tp.buffer.Reset()\n\t\tp.rawDataLen = 0\n\t}()\n\n\tcontent := make([]byte, p.buffer.Len())\n\tcopy(content, p.buffer.Bytes())\n\tif len(content) > 0 || p.rawDataLen > 0 {\n\t\tp.lineHandler.Handle(NewMessage(content, p.status, p.rawDataLen, p.timestamp))\n\t}\n}", "func (cp CommandProperties) AddLine(value int) {\n\tcp.Add(\"line\", strconv.Itoa(value))\n}", "func hline (x1 int, x2 int, y int) {\n\tfor n := x1; n < x2; n++ {\n\t\t\timg.Set(n, y, col)\n\t}\n}", "func hLine(rectImg *image.RGBA, color color.RGBA, x, y, length , width int) {\n\trectLine := image.NewRGBA(image.Rect(x, y, x+length, y+width))\n\tdraw.Draw(rectImg, rectLine.Bounds(), &image.Uniform{color}, image.ZP, draw.Src)\n}", "func (c *container) Line(x1, y1, x2, y2 float64) *Line {\n\tn := &Line{X1: x1, Y1: y1, X2: x2, Y2: y2}\n\tc.contents = append(c.contents, n)\n\n\treturn n\n}", "func (d *DXF) Line(p0, p1 v2.Vec) {\n\td.drawing.ChangeLayer(\"Lines\")\n\td.drawing.Line(p0.X, p0.Y, 0, p1.X, p1.Y, 0)\n}", "func (vr *vectorRenderer) LineTo(x, y int) {\n\tvr.p = append(vr.p, fmt.Sprintf(\"L %d %d\", x, y))\n}", "func (dst *Image) Line(p0, p1 Point, end0, end1 End, thick int, src *Image, sp Point) {\n\tdst.Display.mu.Lock()\n\tdefer dst.Display.mu.Unlock()\n\tdst.lineOp(p0, p1, end0, end1, thick, src, sp, SoverD)\n}", "func (r *Renderer) line(context js.Value, thick int, x1, y1, x2, y2 int) {\n\tcontext.Call(\"moveTo\", nudge(x1, thick)*r.PixelRatio, nudge(y1, thick)*r.PixelRatio)\n\tcontext.Call(\"lineTo\", nudge(x2, thick)*r.PixelRatio, nudge(y2, thick)*r.PixelRatio)\n}", "func GuiLine(bounds Rectangle, text string) {\n\tcbounds, _ := *(*C.Rectangle)(unsafe.Pointer(&bounds)), cgoAllocsUnknown\n\ttext = safeString(text)\n\tctext, _ := unpackPCharString(text)\n\tC.GuiLine(cbounds, ctext)\n\truntime.KeepAlive(text)\n}", "func (p *checkDisplay) WriteLine(line []string) {\n\ts := strings.Join(line, \"\")\n\tp.lines = append(p.lines, s)\n}", "func (rg Range) Line(y int) Range {\n\tif rg.Min.Shift(0, y).In(rg) {\n\t\trg.Min.Y = rg.Min.Y + y\n\t\trg.Max.Y = rg.Min.Y + 1\n\t} else {\n\t\trg = Range{}\n\t}\n\treturn rg\n}", "func (builder *Builder) NextLine(n uint) *Builder {\n\treturn builder.With(NextLine(n))\n}", "func (r Ruler) LineSlice(start Point, end Point, l Line) Line {\n\tp1 := r.PointOnLine(l, start)\n\tp2 := r.PointOnLine(l, end)\n\n\tif p1.index > p2.index || (p1.index == p2.index && p1.t < p2.t) {\n\t\tp1, p2 = p2, p1\n\t}\n\n\tvar slice Line = []Point{p1.point}\n\n\tleft := p1.index + 1\n\tright := p2.index\n\n\tif l[left] != slice[0] && left <= right {\n\t\tslice = append(slice, l[left])\n\t}\n\n\tfor i := left + 1; i <= right; i++ {\n\t\tslice = append(slice, l[i])\n\t}\n\n\tif l[right] != p2.point {\n\t\tslice = append(slice, p2.point)\n\t}\n\n\treturn slice\n}", "func DrawHLine(m draw.Image, x1, y, x2 int) {\n\tfor ; x1 <= x2; x1++ {\n\t\tm.Set(x1, y, color.RGBA{0, 0, 255, 255})\n\t}\n}", "func (r Ruler) PointOnLine(l Line, p Point) PointOnLine {\n\tvar minDist float64 = math.Inf(1)\n\tvar minX, minY, minT, x, y, dx, dy, t float64\n\tvar minI int\n\n\tfor i := 0; i < len(l)-1; i++ {\n\n\t\tx = l[i][0]\n\t\ty = l[i][1]\n\t\tdx = (l[i+1][0] - x) * r.kx\n\t\tdy = (l[i+1][1] - y) * r.ky\n\n\t\tif dx != 0 || dy != 0 {\n\n\t\t\tt = ((p[0]-x)*r.kx*dx + (p[1]-y)*r.ky*dy) / (dx*dx + dy*dy)\n\n\t\t\tif t > 1 {\n\t\t\t\tx = l[i+1][0]\n\t\t\t\ty = l[i+1][1]\n\n\t\t\t} else if t > 0 {\n\t\t\t\tx += (dx / r.kx) * t\n\t\t\t\ty += (dy / r.ky) * t\n\t\t\t}\n\t\t}\n\n\t\tdx = (p[0] - x) * r.kx\n\t\tdy = (p[1] - y) * r.ky\n\n\t\tvar sqDist = dx*dx + dy*dy\n\t\tif sqDist < minDist {\n\t\t\tminDist = sqDist\n\t\t\tminX = x\n\t\t\tminY = y\n\t\t\tminI = i\n\t\t\tminT = t\n\t\t}\n\t}\n\n\treturn PointOnLine{\n\t\tpoint: Point{minX, minY},\n\t\tindex: minI,\n\t\tt: math.Max(0, math.Min(1, minT)),\n\t}\n}", "func DrawLineOnCells(startX int, startY int, endX int, endY int, maxX int, maxY int) [][2]int {\n\tabs := func(x int) int {\n\t\tif x >= 0 {\n\t\t\treturn x\n\t\t} else {\n\t\t\treturn -x\n\t\t}\n\t}\n\n\t// followX indicates whether to move along x or y coordinates\n\tfollowX := abs(endY - startY) <= abs(endX - startX)\n\tvar x0, x1, y0, y1 int\n\tif followX {\n\t\tx0 = startX\n\t\tx1 = endX\n\t\ty0 = startY\n\t\ty1 = endY\n\t} else {\n\t\tx0 = startY\n\t\tx1 = endY\n\t\ty0 = startX\n\t\ty1 = endX\n\t}\n\n\tdeltaX := abs(x1 - x0)\n\tdeltaY := abs(y1 - y0)\n\tvar currentError int = 0\n\n\tvar xstep, ystep int\n\tif x0 < x1 {\n\t\txstep = 1\n\t} else {\n\t\txstep = -1\n\t}\n\tif y0 < y1 {\n\t\tystep = 1\n\t} else {\n\t\tystep = -1\n\t}\n\n\tpoints := make([][2]int, 0, deltaX + 1)\n\taddPoint := func(x int, y int) {\n\t\tif x >= 0 && x < maxX && y >= 0 && y < maxY {\n\t\t\tpoints = append(points, [2]int{x, y})\n\t\t}\n\t}\n\n\tx := x0\n\ty := y0\n\n\tfor x != x1 + xstep {\n\t\tif followX {\n\t\t\taddPoint(x, y)\n\t\t} else {\n\t\t\taddPoint(y, x)\n\t\t}\n\n\t\tx += xstep\n\t\tcurrentError += deltaY\n\t\tif currentError >= deltaX {\n\t\t\ty += ystep\n\t\t\tcurrentError -= deltaX\n\t\t}\n\t}\n\n\treturn points\n}", "func (v *Value) LineWidth(l, offset, tab int) int {\n\tvar width int\n\tif l < len(v.Newlines) {\n\t\twidth += v.Newlines[l][1]\n\t}\n\tif len(v.Tabs[l]) != 0 {\n\t\twidth += tabwidth(v.Tabs[l], offset, tab)\n\t}\n\tif l == len(v.Newlines) {\n\t\twidth += v.Width\n\t}\n\treturn width\n}", "func GuiLine(bounds Rectangle, text string) {\n\tctext := C.CString(text)\n\tdefer C.free(unsafe.Pointer(ctext))\n\tcbounds := *bounds.cptr()\n\tC.GuiLine(cbounds, ctext)\n}", "func drawPhysLine(rgba *image.RGBA, x0, y0, x1, y1 int, col color.Color) {\n\tdx := x1 - x0\n\tif dx < 0 {\n\t\tdx = -dx\n\t}\n\tdy := y1 - y0\n\tif dy < 0 {\n\t\tdy = -dy\n\t}\n\tvar sx, sy int\n\tif x0 < x1 {\n\t\tsx = 1\n\t} else {\n\t\tsx = -1\n\t}\n\tif y0 < y1 {\n\t\tsy = 1\n\t} else {\n\t\tsy = -1\n\t}\n\terr := dx - dy\n\tfor {\n\t\trgba.Set(x0, y0, col)\n\t\tif x0 == x1 && y0 == y1 {\n\t\t\tbreak\n\t\t}\n\t\te2 := 2 * err\n\t\tif e2 > -dy {\n\t\t\terr -= dy\n\t\t\tx0 += sx\n\t\t}\n\t\tif e2 < dx {\n\t\t\terr += dx\n\t\t\ty0 += sy\n\t\t}\n\t}\n}", "func (r Renderer) renderBotLine(dir string, line int) {\n\tfmt.Print(getBotLine(dir, line))\n}", "func (s *Store) NewLine(ln int, st string) {\n\tif ln <= 0 {\n\t\ts.lines = append([]*line{newLine(st)}, s.lines...)\n\t\treturn\n\t}\n\tif ln >= len(s.lines) {\n\t\ts.lines = append(s.lines, newLine(st))\n\t\treturn\n\t}\n\ts.lines = append(s.lines[:ln], append([]*line{newLine(st)}, s.lines[ln:]...)...)\n\tcs := s.undoFac()\n\tcs.AddLine(ln)\n\tcs.ChangeLine(ln+1, \"\", st)\n\ts.AddUndoSet(cs)\n\treturn\n}", "func (this *TableCol) LineCount(maxWidth ...int) int {\n\tif len(maxWidth) == 0 || maxWidth[0] == 0 {\n\t\treturn this.lineCount\n\t}\n\treturn strings.Count(this.Content(maxWidth[0]), \"\\n\") + 1\n}", "func LineWidth(width float32) {\n\tgl.LineWidth(width)\n}", "func Scroll(n int) string {\n\tif n > 0 {\n\t\treturn Esc + strconv.Itoa(n) + \"S\"\n\t} else if n < 0 {\n\t\treturn Esc + strconv.Itoa(-n) + \"T\"\n\t} else {\n\t\treturn \"\"\n\t}\n}", "func (tv *TextView) FirstVisibleLine(stln int) int {\n\tif stln == 0 {\n\t\tperln := float32(tv.LinesSize.Y) / float32(tv.NLines)\n\t\tstln = int(float32(tv.VpBBox.Min.Y-tv.ObjBBox.Min.Y)/perln) - 1\n\t\tif stln < 0 {\n\t\t\tstln = 0\n\t\t}\n\t\tfor ln := stln; ln < tv.NLines; ln++ {\n\t\t\tcpos := tv.CharStartPos(TextPos{Ln: ln})\n\t\t\tif int(mat32.Floor(cpos.Y)) >= tv.VpBBox.Min.Y { // top definitely on screen\n\t\t\t\tstln = ln\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\tlastln := stln\n\tfor ln := stln - 1; ln >= 0; ln-- {\n\t\tcpos := tv.CharStartPos(TextPos{Ln: ln})\n\t\tif int(mat32.Ceil(cpos.Y)) < tv.VpBBox.Min.Y { // top just offscreen\n\t\t\tbreak\n\t\t}\n\t\tlastln = ln\n\t}\n\treturn lastln\n}", "func (s *Basegff3Listener) EnterLine(ctx *LineContext) {}", "func (t *tube) SendLine(input interface{}) (int, error) {\n\tb := Bytes(input)\n\tb = append(b, t.NewLine())\n\treturn t.in.Write(b)\n}", "func DrawLine(p1, p2 types.Vector2, c color.Color, b *buffer.Buffer) {\n\tdeltaX := int(math.Abs(p2.X - p1.X))\n\tdeltaY := -int(math.Abs(p2.Y - p1.Y))\n\n\tsX := 1\n\tsY := 1\n\n\tif p2.X <= p1.X {\n\t\tsX = -1\n\t}\n\n\tif p2.Y <= p1.Y {\n\t\tsY = -1\n\t}\n\n\terr := deltaX + deltaY\n\n\tx := int(p1.X)\n\ty := int(p1.Y)\n\n\tfor {\n\t\tb.DrawPixel(x, y, c)\n\t\tif x == int(p2.X) && y == int(p2.Y) {\n\t\t\tbreak\n\t\t}\n\t\te2 := 2 * err\n\n\t\tif e2 >= deltaY {\n\t\t\terr += deltaY\n\t\t\tx += sX\n\t\t}\n\n\t\tif e2 <= deltaX {\n\t\t\terr += deltaX\n\t\t\ty += sY\n\t\t}\n\t}\n}", "func (tb *TextBuf) LineLen(ln int) int {\n\ttb.LinesMu.RLock()\n\tdefer tb.LinesMu.RUnlock()\n\tif ln >= tb.NLines || ln < 0 {\n\t\treturn 0\n\t}\n\treturn len(tb.Lines[ln])\n}", "func (s *BasemumpsListener) EnterLine(ctx *LineContext) {}", "func (s *Set) SetLineSize(i int) {\n\tif i > s.MaxLineSize {\n\t\ts.LineSize = s.MaxLineSize\n\t} else {\n\t\ts.LineSize = i\n\t}\n}", "func SplitLines(tokens []string, widthFromLineNo widthFunc) [][]string {\n\tlines := make([][]string, 0)\n\tline_no := 0\n\ttoken_no := 0\n\tfor token_no < len(tokens) {\n\t\tlines = append(lines, make([]string, 0))\n\t\twidth := widthFromLineNo(line_no)\n\t\tif width <= 0 {\n\t\t\tlog.Printf(\"Negative width, defaulting to 1 : %d on line %d\\n\", width, line_no)\n\t\t\twidth = 1\n\t\t}\n\t\tfor TotalLength(lines[line_no]) < width {\n\t\t\tlines[line_no] = append(lines[line_no], tokens[token_no])\n\t\t\ttoken_no++\n\t\t\tif token_no == len(tokens) {\n\t\t\t\treturn lines\n\t\t\t}\n\t\t}\n\t\t// advance line number and take off the last token of previous line\n\t\t// since the last token pushed the string over the square width\n\t\t// unless the last line was only one token long\n\t\tif len(lines[line_no]) > 1 {\n\t\t\tlines[line_no] = lines[line_no][:len(lines[line_no])-1]\n\t\t\ttoken_no--\n\t\t}\n\t\tline_no++\n\t}\n\treturn lines\n}", "func (d *Doc) AddLine(x1, y1, x2, y2, width float64, lineStyle LineStyle) {\n\td.GoPdf.SetLineWidth(width)\n\tstyle := string(lineStyle)\n\td.GoPdf.SetLineType(style)\n\td.GoPdf.Line(x1, y1, x2, y2)\n}", "func NewLineGenerator(n int) *LineGenerator {\n\treturn &LineGenerator{\n\t\tnodes: n,\n\t}\n}", "func (c *Chat) LogLine(llp LogLineParsed) {\n\tc.logger.LogLine(llp)\n}", "func LineReader(file *os.File, bus ChannelBus) {\n\tr := openReader(file)\n\tfor line, err := r.ReadString('\\n'); err == nil; line, err = r.ReadString('\\n') {\n\t\tbus.CurrentLine <- line\n\t}\n\tfile.Close()\n\tclose(bus.CurrentLine)\n}" ]
[ "0.6716893", "0.6348061", "0.56597763", "0.5531871", "0.5523367", "0.5433178", "0.5412624", "0.53311795", "0.5283235", "0.5263499", "0.52542454", "0.5210351", "0.51040137", "0.509383", "0.50828135", "0.50809336", "0.5048038", "0.5035988", "0.50099033", "0.4995792", "0.49845833", "0.49718234", "0.49677536", "0.49063316", "0.48924115", "0.48847008", "0.48795977", "0.48629075", "0.48182145", "0.4815251", "0.48139796", "0.4812932", "0.48085627", "0.4804263", "0.47944194", "0.47933975", "0.4757638", "0.47437868", "0.47427002", "0.47402143", "0.47205386", "0.4717527", "0.4709118", "0.4706969", "0.47066104", "0.4702889", "0.4702065", "0.46887466", "0.46824682", "0.46782187", "0.4674815", "0.46639675", "0.46613863", "0.4660838", "0.46457177", "0.4645566", "0.4645417", "0.4644978", "0.46431905", "0.46388918", "0.4634294", "0.4628176", "0.46262383", "0.46236652", "0.46197864", "0.46186376", "0.4611278", "0.46110392", "0.460782", "0.46074232", "0.46047306", "0.46040338", "0.46018335", "0.4601581", "0.45997763", "0.45987156", "0.4598222", "0.45906517", "0.4588158", "0.45765805", "0.45749566", "0.45646185", "0.45631215", "0.4550785", "0.45439705", "0.4538947", "0.4527162", "0.45216078", "0.45144042", "0.4505117", "0.44960892", "0.4483636", "0.4483583", "0.44811675", "0.44776103", "0.4474636", "0.44736648", "0.44639212", "0.44625315", "0.44592762" ]
0.7563582
0
Get all checkins for a given user.
func getAllCheckins(userName string, client *untappd.Client) []*untappd.Checkin { log.Printf("Getting checkins for %s", userName) nCheckins := 50 maxId := math.MaxInt32 allCheckins := make([]*untappd.Checkin, 0) b := &backoff.Backoff{ Min: 60 * time.Second, Max: 30 * time.Minute, Factor: 2, Jitter: true, } for { if len(allCheckins) >= CheckinApiLimit { log.Printf("Api limit reached for %s.", userName) return allCheckins } // The untappd api only allows you to get the lastest 300 checkins // for other users (for non-obvious reasons). limit := min(CheckinApiLimit-len(allCheckins), nCheckins) log.Printf("Getting %d checkins %d through %d. Number of checkins: %d", limit, 0, maxId, len(allCheckins)) checkins, _, err := client.User.CheckinsMinMaxIDLimit(userName, 0, maxId, limit) if err != nil { d := b.Duration() log.Printf("%s, retrying in %s", err, d) time.Sleep(d) continue } //connected b.Reset() log.Printf("Got %d checkins (%s, %d)", len(checkins), userName, maxId) if len(checkins) == 0 { return allCheckins } allCheckins = append(allCheckins, checkins...) maxId = checkins[len(checkins)-1].ID } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (u *UserService) Checkins(username string) ([]*Checkin, *http.Response, error) {\n\t// Use default parameters as specified by API. Max ID is somewhat\n\t// arbitrary, but should provide plenty of headroom, just in case.\n\treturn u.CheckinsMinMaxIDLimit(username, 0, math.MaxInt32, 25)\n}", "func (c *Client) GetUserAll() ([]User, error) {\n\trequest := userGetAllRequest\n\n\tresponse, err := c.QueryHouston(request)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"GetUserAll Failed\")\n\t}\n\n\treturn response.Data.GetUsers, nil\n}", "func (rr *ReserveRoom) QueryCheckins() *CheckInQuery {\n\treturn (&ReserveRoomClient{config: rr.config}).QueryCheckins(rr)\n}", "func (srv *Service) GetAllUsersFromWhitelist() (*[]models.WhitelistUser, error) {\n\t//call driven adapter responsible for getting a deployment from mongo database\n\tresponse, err := srv.mongoRepository.GetAllUsersFromWhitelist()\n\n\tif err != nil {\n\t\t//return the error sent by the repository\n\t\treturn nil, err\n\t}\n\n\treturn &response, nil\n}", "func (user *User) GetAll() (*[]User, error) {\n\tq := ara.NewQuery(`FOR user IN users RETURN user`).Cache(true).BatchSize(500)\n\tlog.Println(q)\n\tresp, err := db.Run(q)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, err\n\t}\n\tvar users []User\n\terr = json.Unmarshal(resp, &users)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn nil, err\n\t}\n\tlog.Println(users)\n\treturn &users, nil\n}", "func (u *User) FetchAll() []User {\n\tvar s Storage\n\tdb := s.Init()\n\tdefer db.Close()\n\n\tvar user User\n\tpeople := []User{}\n\n\tdb.View(func(tx *bolt.Tx) error {\n\t\tbkt := tx.Bucket([]byte(\"USERS\"))\n\t\tc := bkt.Cursor()\n\t\tfor k, v := c.First(); k != nil; k, v = c.Next() {\n\t\t\terr := json.Unmarshal(v, &user)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tpeople = append(people, user)\n\t\t}\n\t\treturn nil\n\t})\n\treturn people\n}", "func (u *usecase) GetAll(ctx context.Context) ([]*User, error) {\n\tusers, err := u.repository.GetAll(ctx)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"error fetching all users\")\n\t}\n\treturn users, nil\n}", "func (s *Supermarket) getAllCheckouts() []*Checkout {\n\treturn append(s.checkoutOpen, s.checkoutClosed...)\n}", "func (u *UserCtr) GetUserAll(c *gin.Context) {\n\tusers, err := model.UserAll(u.DB)\n\tif err != nil {\n\t\tresp := errors.New(err.Error())\n\t\tc.JSON(http.StatusInternalServerError, resp)\n\t\treturn\n\t}\n\n\tif len(users) == 0 {\n\t\tc.JSON(http.StatusOK, make([]*model.User, 0))\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"result\": users,\n\t})\n\treturn\n}", "func fetchAllUser(c *gin.Context) {\n\tvar users []user\n\n\tdb.Find(&users)\n\n\tif len(users) <= 0 {\n\t\tc.JSON(http.StatusNotFound, gin.H{\"status\": http.StatusNotFound, \"message\": \"No user found!\"})\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{\"status\": http.StatusOK, \"data\": users})\n}", "func (us *UserService) GetAll(ctx context.Context) ([]user.User, error) {\n\tctx, cancel := context.WithTimeout(ctx, waitTime*time.Second)\n\tdefer cancel()\n\n\tusers, err := us.repository.GetAll(ctx)\n\tif err != nil {\n\t\tus.log.Error(err)\n\t\treturn nil, err\n\t}\n\n\treturn users, nil\n}", "func (u *UserRepository) GetAll() ([]*models.User, error) {\n\n\t// Here's an array in which you can store the decoded documents\n\tvar result []*models.User\n\n\tcur, err := u.db.User.Find(context.TODO(), bson.M{})\n\t// Close the cursor once finished\n\tdefer cur.Close(context.TODO())\n\tif err != nil {\n\t\tu.log.Errorw(\"failed to get user list\",\n\t\t\t\"error\", err,\n\t\t)\n\t\treturn nil, err\n\t}\n\n\t// Finding multiple documents returns a cursor\n\t// Iterating through the cursor allows us to decode documents one at a time\n\tfor cur.Next(context.TODO()) {\n\t\t// create a value into which the single document can be decoded\n\t\tvar user models.User\n\t\terr := cur.Decode(&user)\n\t\tif err != nil {\n\t\t\tu.log.Errorw(\"failed to decode user model\",\n\t\t\t\t\"error\", err,\n\t\t\t\t\"user\", cur,\n\t\t\t)\n\t\t\tcontinue\n\t\t}\n\t\tresult = append(result, &user)\n\t}\n\t//descending by Last check time\n\tsort.Slice(result, func(i, j int) bool {\n\t\treturn result[i].LastCheck.After(result[j].LastCheck)\n\t})\n\treturn result, nil\n}", "func GetAllUser(c *gin.Context) {\n\tdb := *MongoConfig()\n\tfmt.Println(\"MONGO RUNNING: \", db)\n\n\tusers := model_user.Users{}\n\terr := db.C(UserCollection).Find(bson.M{}).All(&users)\n\n\tif err != nil {\n\t\tc.JSON(200, gin.H{\n\t\t\t\"message\": \"Error Get All User\",\n\t\t})\n\t\treturn\n\t}\n\n\tc.JSON(200, gin.H{\n\t\t\"user\": &users,\n\t})\n}", "func GetAllUser(c *gin.Context) {\n\tuserList := FindAll()\n\n\tif len(userList) <= 0 {\n\t\tc.JSON(http.StatusOK, gin.H{\n\t\t\t\"status\": http.StatusOK,\n\t\t\t\"message\": \"user is not found\",\n\t\t})\n\t} else {\n\t\tc.JSON(http.StatusOK, gin.H{\n\t\t\t\"status\": http.StatusOK,\n\t\t\t\"data\": userList,\n\t\t})\n\t}\n}", "func GetAllUser() ([]User, error) {\n\tvar err error\n\n\t//Get all keys and values of the USER bucket\n\tkeyValues, err := database.GetAll(\"USER\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t//Create a slice of users to store users in\n\tvar users []User\n\n\t//Iterate over the keys and values of the bucket\n\tfor _, val := range keyValues {\n\n\t\t//Iterate over the keys and values of the key an value pair's of the bucket\n\t\tfor _, value := range val {\n\t\t\t//Create user to decode json to\n\t\t\tvar user User\n\n\t\t\t//Decode the values from json to user\n\t\t\terr := json.Unmarshal(value.([]byte), &user)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\t//Append user to list of users\n\t\t\tusers = append(users, user)\n\n\t\t}\n\t}\n\n\t//Return all user in the USER bucket\n\treturn users, nil\n}", "func (userRepository *Repository) All() []User {\n\trows, err := database.Con.Query(\"select id, name, created_at from users\")\n\n\tif err != nil {\n\t\tlog.Fatal(err.Error())\n\t}\n\n\tfor rows.Next() {\n\t\tvar user User\n\n\t\terr := rows.Scan(&user.Id, &user.Name, &user.CreatedAt)\n\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\tuserRepository.users = append(userRepository.users, user)\n\t}\n\n\tif err := rows.Err(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn userRepository.users\n}", "func (c *UserRepoImpl) ReadAll() ([]*model.User, error) {\n\tuserList := make([]*model.User, 0)\n\tif err := c.db.Table(\"user\").Find(&userList).Error; err != nil {\n\t\tlogrus.Error(err)\n\t\treturn nil, errors.New(\"get user list data : error \")\n\t}\n\treturn userList, nil\n}", "func GetAllUser(c *gin.Context) {\n\tif userCollection == nil {\n\t\tuserCollection = db.GetUserCollection()\n\t}\n\n\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\tdefer cancel()\n\n\tvar userInfo []entity.User\n\n\tresult, err := userCollection.Find(ctx, bson.M{})\n\tif err != nil {\n\t\tc.AbortWithStatusJSON(501, gin.H{\"Error\": err.Error()})\n\t\treturn\n\t}\n\tdefer result.Close(ctx)\n\n\tif err := result.All(ctx, &userInfo); err != nil {\n\t\tc.AbortWithStatusJSON(502, gin.H{\"Error\": err.Error()})\n\t\treturn\n\t}\n\n\tfor result.Next(ctx) {\n\t\tvar user entity.User\n\t\tif err = result.Decode(&user); err != nil {\n\t\t\tc.AbortWithStatusJSON(503, gin.H{\"Error\": err.Error()})\n\t\t}\n\t\tuserInfo = append(userInfo, user)\n\t}\n\tc.JSON(200, gin.H{\"Result\": &userInfo})\n}", "func AllUserBets() []User_Bet {\n\torm := get_DBFront()\n\tvar bets []User_Bet\n\terr := orm.SetTable(\"alluserbet\").FindAll(&bets)\n\tif !check_err(err) {\n\t\tLog(Log_Struct{\"error\", \"DB_Error_Line_727\", err})\n\t}\n\treturn bets\n}", "func (rrq *ReserveRoomQuery) QueryCheckins() *CheckInQuery {\n\tquery := &CheckInQuery{config: rrq.config}\n\tquery.path = func(ctx context.Context) (fromU *sql.Selector, err error) {\n\t\tif err := rrq.prepareQuery(ctx); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(reserveroom.Table, reserveroom.FieldID, rrq.sqlQuery()),\n\t\t\tsqlgraph.To(checkin.Table, checkin.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2M, false, reserveroom.CheckinsTable, reserveroom.CheckinsColumn),\n\t\t)\n\t\tfromU = sqlgraph.SetNeighbors(rrq.driver.Dialect(), step)\n\t\treturn fromU, nil\n\t}\n\treturn query\n}", "func (call *UserUsecaseImpl) FindAll() ([]*models.UserWrapper, error) {\n\treturn call.userRepo.FindAll()\n}", "func GetAllLoggedInUsers() ([]models.User, error) {\n\trefreshTokens, err := GetAllRefreshTokens()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar loggedInUsersIDs []uint\n\tfor _, rt := range refreshTokens {\n\t\tloggedInUsersIDs = append(loggedInUsersIDs, rt.UserID)\n\t}\n\n\tvar loggedInUsers []models.User\n\tresult := database.GetPostgresDB().Where(\"id IN ?\", loggedInUsersIDs).Find(&loggedInUsers)\n\tif result.Error != nil {\n\t\treturn nil, result.Error\n\t}\n\treturn loggedInUsers, nil\n}", "func All() ([]User, error) {\n\t// will create db if it doesn't exist and return any error(s)\n\tdb, err := storm.Open(dbPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// don't forget to close connection!\n\tdefer db.Close()\n\n\t// create list of users\n\tusers := []User{}\n\t// use storm's All() function and point it to the newly created list\n\t// Storm requires use of point, even though slices are always passed by reference in Go anyway\n\terr = db.All(&users)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn users, nil\n}", "func AllUsersGet(c *gin.Context) {\n\tmeta := model.TableMetaFromQuery(c)\n\tginutils.WriteGinJSON(c, http.StatusOK, model.AllUsers(meta))\n}", "func GetAllUsers(user *[]models.User) (err error) {\n\tif err = config.DB.Find(user).Error; err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (repo CalendarRepository) GetAll(userID int) (list []CalendarModel) {\n\trepo.c.Find(bson.M{\"userId\": userID}).All(&list)\n\treturn\n}", "func (us *userService) GetAll() ([]*model.User, error) {\n\treturn us.userRepo.GetAll()\n}", "func (r *UserStatesService) List() *UserStatesListCall {\n\tc := &UserStatesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\treturn c\n}", "func (us *Users) All() ([]*User, error) {\n\tusers, err := getUsersWhere(\"\")\n\tif err != nil {\n\t\treturn users, fmt.Errorf(\"unable to get users: %v\", err)\n\t}\n\n\treturn users, nil\n}", "func (repo *Repo) GetAllLobbyUsers() ([]user.User, error) {\n\tlobbyStmt, err := repo.DB.Prepare(\"SELECT User.UserId, User.Username FROM LobbyUsers INNER JOIN User ON LobbyUsers.UserId = User.UserId\")\n\tdefer lobbyStmt.Close()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t\n\tusers := []user.User{}\n\trows, err := lobbyStmt.Query()\n\n\tvar wg sync.WaitGroup\n\tfor rows.Next() {\n\t\tvar u user.User\n\t\terr = rows.Scan(&u.UserID, &u.Username)\n\t\tif err != nil {\n\t\t\tbreak;\n\t\t}\n\n\t\twg.Add(1)\n\t\tgo func () {\n\t\t\tusers = append (users, u)\n\t\t\twg.Done()\n\t\t}()\n\t}\n\n\twg.Wait()\n\treturn users, err\n}", "func (u *UserRepository) GetAll() ([]*domain.User, error) {\n\targs := u.Called()\n\treturn args.Get(0).([]*domain.User), args.Error(1)\n}", "func (m *UserModel) GetAll(teamID string) ([]User, error) {\n\tvar users []User\n\terr := m.db.Where(\"team_id = ?\", teamID).Find(&users).Error\n\n\treturn users, err\n}", "func (s *store) ListByUser(ctx context.Context, userID core.ID) (result []*core.TransactionItem, err error) {\n\n\tresults := make([]*core.TransactionItem, 0)\n\n\tfilter := bson.D{{\n\t\t\"owner\",\n\t\tbson.D{{\n\t\t\t\"$eq\",\n\t\t\tuserID,\n\t\t}},\n\t}}\n\n\tcur, err := s.Col.Find(context.TODO(), filter) // querying the \"folders\" collection\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer cur.Close(context.TODO())\n\n\tfor cur.Next(context.TODO()) {\n\n\t\t// create a value into which the single document can be decoded\n\t\tvar elem core.TransactionItem\n\t\terr := cur.Decode(&elem)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tresults = append(results, &elem)\n\t}\n\n\tif err := cur.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn results, nil\n\n}", "func (ur *UserRepository) GetAll(ctx context.Context) ([]user.User, error) {\n\tq := `\n\tSELECT id, user_name, role\n\tFROM users;\n\t`\n\trows, err := ur.Data.DB.QueryContext(ctx, q)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer rows.Close()\n\n\tvar users []user.User\n\tfor rows.Next() {\n\t\tvar u user.User\n\t\trows.Scan(&u.ID, &u.UserName, &u.Role)\n\t\tusers = append(users, u)\n\t}\n\n\treturn users, nil\n}", "func (u *UserTest) GetAll() ([]*User, error) {\n\tvar users []*User\n\n\tuser := User{\n\t\tID: 1,\n\t\tEmail: \"[email protected]\",\n\t\tFirstName: \"Admin\",\n\t\tLastName: \"Admin\",\n\t\tPassword: \"abc\",\n\t\tActive: 1,\n\t\tIsAdmin: 1,\n\t\tCreatedAt: time.Now(),\n\t\tUpdatedAt: time.Now(),\n\t}\n\n\tusers = append(users, &user)\n\n\treturn users, nil\n}", "func (s *UserService) GetAll() ([]model.User , error){\n\t// variable for all user\n\tvar users []model.User\n\t// get all data in user based on filter if err print error\n\tcursor, err := conn.Collection(\"user\").Find(context.Background(), bson.D{})\n\tif err != nil {\n\t\tprintln(err)\n\t}\n\t// iterate all cursor and append it to users slice\n\tfor cursor.Next(context.TODO()) {\n elem := model.User{}\n if err := cursor.Decode(&elem); err != nil {\n log.Fatal(err)\n }\n users = append(users, elem)\n\t}\n\t// return user\n\treturn users, nil\n}", "func FetchAllUsers(logFilePath string) user.FetchAll {\n\treturn func() ([]user.User, error) {\n\t\tvar sc *bufio.Scanner\n\t\t{\n\t\t\tlogFile, err := os.OpenFile(logFilePath, os.O_RDONLY, 0)\n\t\t\tif err != nil {\n\t\t\t\treturn make([]user.User, 0), err\n\t\t\t}\n\t\t\tdefer logFile.Close()\n\t\t\tsc = bufio.NewScanner(logFile)\n\t\t}\n\n\t\tm := chat.Message{}\n\t\tuserNameMap := make(map[string]bool)\n\t\tus := make([]user.User, 0)\n\t\tfor sc.Scan() {\n\t\t\terr := json.Unmarshal(sc.Bytes(), &m)\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif _, ok := userNameMap[m.From]; !ok {\n\t\t\t\tuserNameMap[m.From] = true\n\t\t\t\tus = append(us, user.User{Name: m.From})\n\t\t\t}\n\t\t}\n\t\treturn us, nil\n\t}\n}", "func (ci *CheckIn) QueryCheckouts() *CheckoutQuery {\n\treturn (&CheckInClient{config: ci.config}).QueryCheckouts(ci)\n}", "func (rs *UserResultSet) All() ([]*User, error) {\n\tvar result []*User\n\tfor rs.Next() {\n\t\trecord, err := rs.Get()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresult = append(result, record)\n\t}\n\treturn result, nil\n}", "func GetUser(usr string) []string {\n\thashed_usr := Hash1(usr)\n\trows := QueryDB(QUERY_GET_USER, hashed_usr)\n\tvar ret []string\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\tvar (\n\t\t\tusername string\n\t\t\tpassword string\n\t\t\tsalt string\n\t\t\tkey string\n\t\t)\n\t\terr = rows.Scan(&username, &password, &salt, &key)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error accessing rows (my_server.go: GetUser)\")\n\t\t\tfmt.Println(err)\n\t\t}\n\t\tret = []string{username, password, salt, key}\n\t}\n\treturn ret\n}", "func (g *GithubFetcher) GetUsersByLogins(ctx context.Context, logins []string, writer *csv.Writer,\n\tfetchCallback func(ctx context.Context, fetched UserFetchResult, writer *csv.Writer)) {\n\tout := make(chan UserFetchResult)\n\tsent := 0\n\tfor _, login := range logins {\n\t\tduration := time.Duration(rand.Intn(len(logins))) * time.Second // about 1 per second but randomly\n\t\tgo func(login string, wait time.Duration) {\n\t\t\ttime.Sleep(wait)\n\n\t\t\tuser, err := g.GetUser(ctx, login)\n\n\t\t\tout <- UserFetchResult{login, user, err}\n\t\t\tsent++\n\t\t\tif sent == len(logins) {\n\t\t\t\tclose(out)\n\t\t\t}\n\t\t}(login, duration)\n\t}\n\n\tfor i := 0; i < len(logins); i++ {\n\t\tselect {\n\t\tcase fetchedUser := <-out:\n\t\t\tfetchCallback(ctx, fetchedUser, writer)\n\t\tcase <-time.After(10 * time.Second):\n\t\t\tlog.Warningf(ctx, \"timeout\")\n\t\t}\n\t}\n\n\tif writer != nil {\n\t\twriter.Flush()\n\t}\n}", "func GetUsers(c *gin.Context) {\n\trequestID := c.GetString(\"x-request-id\")\n\thelper.Logger(requestID, \"\").Infoln(\"RequestID= \", requestID)\n\t// cacheTest := helper.CacheExists(\"xxxxxxxxxx\")\n\t// helper.Logger(requestID, \"\").Infoln(\"cacheTest= \", cacheTest)\n\n\thttpCode, body, erro := helper.MakeHTTPRequest(\"GET\", \"https://api-101.glitch.me/customers\", \"\", nil, true)\n\thelper.Logger(requestID, \"\").Infoln(\"httpCode= \", httpCode)\n\thelper.Logger(requestID, \"\").Infoln(\"body= \", fmt.Sprintf(\"%s\", body))\n\thelper.Logger(requestID, \"\").Infoln(\"error= \", erro)\n\n\tvar user []models.User\n\terr := models.GetAllUsers(&user)\n\tif err != nil {\n\t\tc.AbortWithStatus(http.StatusNotFound)\n\t} else {\n\t\tc.JSON(http.StatusOK, user)\n\t}\n}", "func GetAllUsers(user *[]User) error {\n\treturn config.DB.Find(user).Error\n}", "func (s UseService) GetAllUse() (uses []models.User, err error) {\n\treturn uses, s.repository.Find(&uses).Error\n}", "func (store *dbStore) GetUser(user *structs.User) ([]*structs.User, error) {\r\n\tsqlStatement := fmt.Sprint(\"SELECT * FROM user WHERE username='\", user.Username, \"'\")\r\n\r\n\trows, err := store.db.Query(sqlStatement)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\r\n\tdefer rows.Close()\r\n\r\n\tusers := []*structs.User{}\r\n\r\n\tfor rows.Next() {\r\n\t\tuser := &structs.User{}\r\n\t\tif err := rows.Scan(&user.ID, &user.Username); err != nil {\r\n\t\t\treturn nil, err\r\n\t\t}\r\n\r\n\t\tusers = append(users, user)\r\n\t}\r\n\r\n\treturn users, nil\r\n}", "func GetAll() (users []User) {\n\tdb := getDB()\n\tdefer db.Close()\n\tfmt.Println(\"Before query\")\n\trows, err := db.Query(\"SELECT id, name, age, created FROM user\")\n\tfmt.Println(\"After query\")\n\tcheckErr(err)\n\n\tfor rows.Next() {\n\t\tfmt.Println(\"First loop\")\n\t\tvar user User\n\t\terr = rows.Scan(&user.ID, &user.Name, &user.Age, &user.Created)\n\t\tcheckErr(err)\n\t\tusers = append(users, user)\n\t}\n\tif err = rows.Err(); err != nil {\n\t\tcheckErr(err)\n\t}\n\trows.Close()\n\n\treturn\n}", "func (c *UserStore) All(ctx context.Context) ([]chronograf.User, error) {\n\tall, err := c.Ctrl.Users(ctx, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tur, err := c.Ctrl.UserRoles(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tres := make([]chronograf.User, len(all.Users))\n\tfor i, user := range all.Users {\n\t\trole := ur[user.Name]\n\t\tcr := role.ToChronograf()\n\t\t// For now we are removing all users from a role being returned.\n\t\tfor i, r := range cr {\n\t\t\tr.Users = []chronograf.User{}\n\t\t\tcr[i] = r\n\t\t}\n\n\t\tres[i] = chronograf.User{\n\t\t\tName: user.Name,\n\t\t\tPermissions: ToChronograf(user.Permissions),\n\t\t\tRoles: cr,\n\t\t}\n\t}\n\treturn res, nil\n}", "func (db *BotDB) GetUserGuilds(user uint64) []uint64 {\n\tq, err := db.sqlGetUserGuilds.Query(user)\n\tif db.CheckError(\"GetUserGuilds\", err) != nil {\n\t\treturn []uint64{}\n\t}\n\tdefer q.Close()\n\tr := make([]uint64, 0, 2)\n\tfor q.Next() {\n\t\tvar s uint64\n\t\tif err := q.Scan(&s); err == nil {\n\t\t\tr = append(r, s)\n\t\t}\n\t}\n\treturn r\n}", "func (us *UserService) FindAll(ctx context.Context) ([]User, error) {\n\treturn us.userRepository.FindAll(ctx)\n}", "func FetchAllUsers(c *gin.Context) {\n\ttype userQuery struct {\n\t\tID int64\n\t\tUsername string\n\t\tGender string\n\t}\n\tvar users []userQuery\n\tdb.DB.Table(\"users\").\n\t\tSelect(\"id, username, gender\").\n\t\tScan(&users)\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"msg\": len(users),\n\t\t\"err\": \"\",\n\t\t\"data\": users,\n\t})\n\n}", "func (rep *UserRepository) GetAll() (users []*models.User, err error) {\n\terr = databaseConnection.Find(&users).Error\n\treturn\n}", "func GetAllUser(w http.ResponseWriter, r *http.Request) {\n\tusermanagement, err := getAllusermanagement()\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Unable to get all user. %v\", err)\n\t}\n\n\tjson.NewEncoder(w).Encode(usermanagement)\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 (user UserModel) GetAll() (interface{}, error) {\n\tconn, db := config.DataBase()\n\tdefer db.Close()\n\tvar query = \"SELECT * FROM \" + user.TableName()\n\tvar response []userModelResponse\n\tif err := conn.Raw(query).Scan(&response).Error; err != nil {\n\t\treturn nil, err\n\t}\n\treturn response, nil\n}", "func (db *pg) GetLogsOfUser(ctx context.Context, userID string) ([]*Log, error) {\n\tconst stmt = `SELECT * FROM audit.\"Logs\" WHERE \"UserId\" = $1;`\n\trows, err := db.QueryContext(ctx, stmt, userID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlst := make([]*Log, 0, 100)\n\tfor rows.Next() {\n\t\tl := Log{}\n\t\tif err := rows.Scan(&l.Timestamp, &l.UserID, &l.Action); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tlst = append(lst, &l)\n\t}\n\treturn lst, nil\n}", "func GetAllUserInfo() []User.User {\n\tvar users []User.User\n\tbyteIn, err := ioutil.ReadFile(\"data/User.json\")\n\tcheck(err)\n\tjsonStr := string(byteIn)\n\tjson.Unmarshal([]byte(jsonStr), &users)\n\treturn users\n}", "func (s *userService) GetAll(ctx context.Context, req *pb.Request) (rsp *pb.Response, err error) {\n\tif req.PageNum == 0 || req.PageSize == 0 {\n\t\treq.PageNum = 1\n\t\treq.PageSize = 10\n\t}\n\tusers, err := s.dao.GetAllUsers(ctx, req)\n\tif err != nil {\n\t\treturn\n\t}\n\trsp = &pb.Response{\n\t\tUsers: users,\n\t}\n\treturn\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 (uq *UserQuery) All(ctx context.Context) ([]*User, error) {\n\tif err := uq.prepareQuery(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\treturn uq.sqlAll(ctx)\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 GetAllMarks(user *[]Marks) (err error) {\n\tif err = Config.DB.Find(user).Error; err != nil {\n\t\treturn err\n\t}\n\treturn nil\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 HandleUserGetAll(c *gin.Context) {\n\tvar u User\n\tusers, err := u.GetAll()\n\tif err != nil {\n\t\tc.JSON(http.StatusInternalServerError, gin.H{\n\t\t\t\"code\": 1,\n\t\t\t\"msg\": err.Error(),\n\t\t\t\"data\": gin.H{},\n\t\t})\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"code\": 0,\n\t\t\"msg\": \"ok\",\n\t\t\"data\": users,\n\t})\n}", "func (kph *keePassHTTP) List() (credentials []*Credential, err error) {\n\tresult, err := kph.request(&body{\n\t\tRequestType: \"get-all-logins\",\n\t})\n\tif err == nil {\n\t\tkph.getCredentials(result, &credentials)\n\t}\n\treturn\n}", "func (u *UserService) CheckinsMinMaxIDLimit(username string, minID int, maxID int, limit int) ([]*Checkin, *http.Response, error) {\n\tv := url.Values{}\n\tif minID != 0 {\n\t\tv.Set(\"min_id\", strconv.Itoa(minID))\n\t}\n\tif maxID != math.MaxInt32 {\n\t\tv.Set(\"max_id\", strconv.Itoa(maxID))\n\t}\n\tv.Set(\"limit\", strconv.Itoa(limit))\n\treturn u.client.getCheckins(\"user/checkins/\"+username, v)\n}", "func (q oauthClientQuery) All(exec boil.Executor) (OauthClientSlice, error) {\n\tvar o []*OauthClient\n\n\terr := q.Bind(nil, exec, &o)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"models: failed to assign all query results to OauthClient slice\")\n\t}\n\n\tif len(oauthClientAfterSelectHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterSelectHooks(exec); err != nil {\n\t\t\t\treturn o, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn o, nil\n}", "func (r *Repository) FindAll() []user.User {\n\tdat, err := ioutil.ReadFile(r.FilePath)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tvar users []user.User\n\tif err = json.Unmarshal(dat, &users); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn users\n}", "func (m *User) GetOwnedObjects()([]DirectoryObjectable) {\n return m.ownedObjects\n}", "func GetUserReminds(ctx context.Context, userID string) ([]Remind, error) {\n\tselectSQL := `\n\tSELECT remind_id, content\n\t FROM reminds\n\t WHERE user_id=$1 \n\t ORDER BY remind_id ASC;`\n\n\tvar reminds []Remind\n\n\trows, err := db.QueryContext(ctx, selectSQL, userID)\n\n\tif err != nil {\n\t\treturn reminds, err\n\t}\n\n\tfor rows.Next() {\n\t\tvar remind Remind\n\n\t\tif remindErr := rows.Scan(&remind.RemindID, &remind.Content); remindErr != nil {\n\t\t\treturn reminds, remindErr\n\t\t}\n\n\t\tremind.UserID = userID\n\t\treminds = append(reminds, remind)\n\t}\n\n\tif len(reminds) == 0 {\n\t\treturn reminds, errors.New(\"no reminds found for this user\")\n\t}\n\n\treturn reminds, nil\n}", "func (p *pool) GetLocks(userName string) []*ResourceLock {\n\tvar locked []*ResourceLock\n\tbyUser := len(userName) > 0\n\tfor _, v := range p.locks {\n\t\tif v != nil && (!byUser || userName == v.User) {\n\t\t\tlocked = append(locked, v)\n\t\t}\n\t}\n\tsort.Slice(locked, func(i, j int) bool {\n\t\treturn locked[i].Resource.Name < locked[j].Resource.Name\n\t})\n\n\treturn locked\n}", "func GetAllUsers(client *mongo.Client) (models.Users, error) {\n\tvar result models.Users\n\tvar err error\n\temptyUsersObject := models.Users{}\n\n\tctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)\n\tdefer cancel()\n\n\tcollection := client.Database(\"folks\").Collection(\"users\")\n\tcur, err := collection.Find(ctx, bson.D{}, options.Find())\n\n\tif err != nil {\n\t\treturn emptyUsersObject, err\n\t}\n\n\tfor cur.Next(ctx) {\n\t\tvar user models.User\n\t\terr = cur.Decode(&user)\n\n\t\tif err != nil {\n\t\t\treturn emptyUsersObject, err\n\t\t}\n\n\t\tresult = append(result, user)\n\t}\n\n\tif err = cur.Err(); err != nil {\n\t\treturn emptyUsersObject, err\n\t}\n\n\tcur.Close(ctx)\n\treturn result, nil\n}", "func (s *ServerState) getUsers(c *gin.Context) {\n\tvar u []User\n\tif err := s.DB.Select(&u, \"select * from users\"); err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"status\": err})\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{\"user\": u})\n}", "func GetUsers(c *gin.Context) {\n\tvar users []models.User\n\tlog.Println(\"GetUsers from db\")\n\tdb := db.GetDB()\n\tdb.Find(&users)\n\tc.JSON(http.StatusOK, users)\n}", "func (r *KitsuService) GetUserEntries() []AnimeList {\n\tvar anime []AnimeList\n\n\tif r.ID == \"\" {\n\t\tr.getUserID()\n\t}\n\tvar i map[string]interface{}\n\terr := json.Unmarshal(r.connect(\"edge/users/\"+r.ID+\"/library-entries\"), &i)\n\tif err == nil {\n\t\tAnimeLists := i[\"data\"].([]interface{})\n\t\tfor index, element := range AnimeLists {\n\t\t\tSelector := element.(map[string]interface{})\n\t\t\tstatus := Selector[\"attributes\"].(map[string]interface{})\n\t\t\ttime, err := time.Parse(time.RFC3339, status[\"updatedAt\"].(string))\n\t\t\tif err == nil {\n\t\t\t\tanime = append(anime,\n\t\t\t\t\tAnimeList{\n\t\t\t\t\t\tID: Selector[\"id\"].(string),\n\t\t\t\t\t\tName: r.GetAnimeInfo(Selector[\"id\"].(string)).Name,\n\t\t\t\t\t\tChapterInProgress: int(status[\"progress\"].(float64)),\n\t\t\t\t\t\tupdatedAt: time})\n\t\t\t}\n\t\t\tindex++\n\t\t}\n\t\treturn anime\n\t}\n\treturn anime\n}", "func (r *UserRepositoryImpl) GetAll() ([]*domain.User, error) {\n\trows, err := r.query(\"select id, name from users\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\tus := make([]*domain.User, 0)\n\tfor rows.Next() {\n\t\tu := &domain.User{}\n\t\terr = rows.Scan(&u.ID, &u.Name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tus = append(us, u)\n\t}\n\treturn us, nil\n}", "func (m *AuditLogRoot) GetSignIns()([]SignInable) {\n return m.signIns\n}", "func FetchAllAccount() ([]model.CloudAccount, error) {\n\n\tvar accounts []model.CloudAccount\n\terr := db.From(\"user\").All(&accounts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn accounts, nil\n}", "func (q usernameListingQuery) All(ctx context.Context, exec boil.ContextExecutor) (UsernameListingSlice, error) {\n\tvar o []*UsernameListing\n\n\terr := q.Bind(ctx, exec, &o)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"models: failed to assign all query results to UsernameListing slice\")\n\t}\n\n\treturn o, nil\n}", "func (s *Repository) GetAll(ctx context.Context) ([]Account, error) {\n\tconst limit = 10\n\n\trows, err := s.pool.Query(\n\t\tctx,\n\t\t`select * from \"account\"\n\t\t\t order by \"createdAt\" desc\n\t\t\t limit $1`, limit)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer rows.Close()\n\n\treturn scanAccounts(limit, rows)\n}", "func GetAll(c *gin.Context) {\n\tusers, err := services.UsersService.GetAllUsers()\n\tif err != nil {\n\t\tc.JSON(err.Status, err)\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, users.Marshal(c.GetHeader(\"X-Public\") == \"true\"))\n}", "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 (m *GameModel) AllForUser(userID string) ([]*models.Game, error) {\n\treturn m.gamesFromQuery(`SELECT g.id, g.name, g.franchise_id, f.name AS frachise_name FROM GAMES g LEFT JOIN FRANCHISES f ON f.id = g.franchise_id`, userID)\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 (c *CreditsService) All() ([]Credit, error) {\n req, err := c.client.newAuthenticatedRequest(\"GET\", \"credits\", nil)\n if err != nil {\n return nil, err\n }\n\n credits := make([]Credit, 0)\n _, err = c.client.do(req, &credits)\n if err != nil {\n return nil, err\n }\n\n return credits, nil\n}", "func GetAllUsers(user *[]entity.User, client *statsd.Client) (err error) {\n\tt := client.NewTiming()\n\tif err = config.DB.Find(&user).Error; err != nil {\n\t\treturn err\n\t}\n\tt.Send(\"get_all_users.query_time\")\n\treturn nil\n}", "func (us *UserService) UserAll() (map[int]*railway.User, error) {\n\tdetails := &MethodInfo{\n\t\tName: \"UserAll\",\n\t\tDescription: \"UserAll is the DB method used to UserAll\",\n\t}\n\tquery := fmt.Sprintf(`\n\t\tSELECT %s\n\t\tFROM users \n\t\tWHERE archived=false\n`, userAllColumns)\n\trows, err := us.db.Query(query)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, details.Name)\n\t}\n\tresult := map[int]*railway.User{}\n\tfor rows.Next() {\n\t\ttempUser := &railway.User{}\n\t\trows.Scan(tempUser.Scan()...)\n\t\tresult[tempUser.ID] = tempUser\n\t}\n\trows.Close()\n\n\treturn result, nil\n}", "func AllUsers(users *[]structs.User) error {\n\treturn Db.View(func(tx *bolt.Tx) error {\n\t\tif b := tx.Bucket(userBucket); b != nil {\n\t\t\tif err := b.ForEach(func(k, v []byte) error {\n\t\t\t\tlog.Debugf(\"key=%s, value=%s\\n\", k, v)\n\t\t\t\tu := structs.User{}\n\t\t\t\tif err := User(k, &u); err != nil {\n\t\t\t\t\tlog.Error(err)\n\t\t\t\t}\n\t\t\t\t*users = append(*users, u)\n\t\t\t\treturn nil\n\t\t\t}); err != nil {\n\t\t\t\tlog.Error(err)\n\t\t\t}\n\t\t\tlog.Debugf(\"users %v\", users)\n\t\t\treturn nil\n\t\t}\n\t\treturn fmt.Errorf(\"no bucket for %s\", userBucket)\n\t})\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 (q authUserQuery) All() (AuthUserSlice, error) {\n\tvar o AuthUserSlice\n\n\terr := q.Bind(&o)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"models: failed to assign all query results to AuthUser slice\")\n\t}\n\n\treturn o, 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 GetAllUsers() *[]User {\n\tvar users []User\n\tDb.Find(&users)\n\treturn &users\n}", "func GetAllUsers() []*User {\n\tUserListLock.Acquire(\"get all users\")\n\tdefer UserListLock.Release()\n\tlst := make([]*User, len(UserList))\n\ti := 0\n\tfor _, val := range UserList {\n\t\tlst[i] = val\n\t\ti += 1\n\t}\n\treturn lst\n}", "func (m *MgoUserManager) FindAllUserOnline(offsetId interface{}, limit int) (\n\t[]*auth.User, error) {\n\treturn m.findAllUser(offsetId, limit, bson.M{\n\t\t\"LastActivity\": bson.M{\"$lt\": time.Now().Add(m.OnlineThreshold)},\n\t})\n}", "func GetInsurances(w http.ResponseWriter, req *http.Request) {\n\tuserID := mux.Vars(req)[\"userID\"]\n\n\tlog.Printf(\"Consultando seguros contratados para usuario %s\", userID)\n\n\tresp.SendResponse(w, []string{\"Hogar\", \"Vida\"})\n}", "func (ulq *UserLogQuery) All(ctx context.Context) ([]*UserLog, error) {\n\tif err := ulq.prepareQuery(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\treturn ulq.sqlAll(ctx)\n}", "func GetByUserID(id bson.ObjectId) ([]*Instance, error) {\n\tvar err error\n\tvar c []*Instance\n\n\tif id.Valid() == false {\n\t\treturn nil, errmsg.ErrInvalidID\n\t}\n\n\tres := InstanceCollection.Find(db.Cond{\n\t\t\"user_id\": id,\n\t})\n\n\tif k, _ := res.Count(); k < 1 {\n\t\treturn nil, errmsg.ErrNoSuchItem\n\t}\n\n\tif err = res.All(&c); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c, err\n}", "func (authUserL) LoadUserBraceletRates(e boil.Executor, singular bool, maybeAuthUser interface{}) error {\n\tvar slice []*AuthUser\n\tvar object *AuthUser\n\n\tcount := 1\n\tif singular {\n\t\tobject = maybeAuthUser.(*AuthUser)\n\t} else {\n\t\tslice = *maybeAuthUser.(*AuthUserSlice)\n\t\tcount = len(slice)\n\t}\n\n\targs := make([]interface{}, count)\n\tif singular {\n\t\tif object.R == nil {\n\t\t\tobject.R = &authUserR{}\n\t\t}\n\t\targs[0] = object.ID\n\t} else {\n\t\tfor i, obj := range slice {\n\t\t\tif obj.R == nil {\n\t\t\t\tobj.R = &authUserR{}\n\t\t\t}\n\t\t\targs[i] = obj.ID\n\t\t}\n\t}\n\n\tquery := fmt.Sprintf(\n\t\t\"select * from `bracelet_rate` where `user_id` in (%s)\",\n\t\tstrmangle.Placeholders(dialect.IndexPlaceholders, count, 1, 1),\n\t)\n\tif boil.DebugMode {\n\t\tfmt.Fprintf(boil.DebugWriter, \"%s\\n%v\\n\", query, args)\n\t}\n\n\tresults, err := e.Query(query, args...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to eager load bracelet_rate\")\n\t}\n\tdefer results.Close()\n\n\tvar resultSlice []*BraceletRate\n\tif err = queries.Bind(results, &resultSlice); err != nil {\n\t\treturn errors.Wrap(err, \"failed to bind eager loaded slice bracelet_rate\")\n\t}\n\n\tif singular {\n\t\tobject.R.UserBraceletRates = resultSlice\n\t\treturn nil\n\t}\n\n\tfor _, foreign := range resultSlice {\n\t\tfor _, local := range slice {\n\t\t\tif local.ID == foreign.UserID {\n\t\t\t\tlocal.R.UserBraceletRates = append(local.R.UserBraceletRates, foreign)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (us *UserService) GetAllActive(ctx context.Context) ([]user.User, error) {\n\tctx, cancel := context.WithTimeout(ctx, waitTime*time.Second)\n\tdefer cancel()\n\n\tusers, err := us.repository.GetAllActive(ctx)\n\tif err != nil {\n\t\tus.log.Error(err)\n\t\treturn nil, err\n\t}\n\n\treturn users, nil\n}", "func returnUsersAccounts(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tvar users []User\n\tvar orders []Orders\n\t//fmt.Println(\"Request URI: \", path.Base(r.RequestURI))\n\tusername := path.Base(r.RequestURI)\n\n\t// query for userid\n\tresults, err := db.Query(\"Select * from users where username = ?\", username)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\n\tfor results.Next() {\n\t\tvar user User\n\t\terr := results.Scan(&user.ID, &user.Username)\n\t\tif err != nil {\n\t\t\tpanic(err.Error())\n\t\t}\n\n\t\tusers = append(users, user)\n\t\tfmt.Println(\"Userid: \", users[0].ID)\n\t}\n\n\t// query the orders table with userid and return all rows\n\n\t//select orders.id, users.username, stocks.symbol, shares from orders inner join users on orders.user_id = users.id inner join stocks on orders.stock_id = stocks.id\n\tresults, err = db.Query(\"select orders.id, users.username, stocks.symbol, shares from orders inner join users on orders.user_id = users.id inner join stocks on orders.stock_id = stocks.id where orders.user_id = ?\", users[0].ID)\n\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\n\tfor results.Next() {\n\t\tvar order Orders\n\t\terr = results.Scan(&order.ID, &order.Username, &order.Symbol, &order.Shares)\n\t\tif err != nil {\n\t\t\tpanic(err.Error())\n\t\t}\n\t\torders = append(orders, order)\n\t}\n\tjson.NewEncoder(w).Encode(orders)\n}", "func (q userGoogleQuery) All(ctx context.Context, exec boil.ContextExecutor) (UserGoogleSlice, error) {\n\tvar o []*UserGoogle\n\n\terr := q.Bind(ctx, exec, &o)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"model2: failed to assign all query results to UserGoogle slice\")\n\t}\n\n\tif len(userGoogleAfterSelectHooks) != 0 {\n\t\tfor _, obj := range o {\n\t\t\tif err := obj.doAfterSelectHooks(ctx, exec); err != nil {\n\t\t\t\treturn o, err\n\t\t\t}\n\t\t}\n\t}\n\n\treturn o, nil\n}" ]
[ "0.72173625", "0.53085035", "0.5205436", "0.51556116", "0.50907105", "0.50406814", "0.5024751", "0.5024251", "0.4999442", "0.49918422", "0.49650472", "0.49222946", "0.4913759", "0.48869815", "0.48821768", "0.48712367", "0.4824984", "0.48202866", "0.47888565", "0.47716078", "0.47670078", "0.47651297", "0.4708128", "0.46831024", "0.46760088", "0.46684456", "0.4663986", "0.46590364", "0.46575755", "0.46439564", "0.4641134", "0.4635817", "0.4629539", "0.4629066", "0.4625675", "0.462141", "0.46185112", "0.46166202", "0.46113664", "0.45995116", "0.4593514", "0.45903656", "0.45845547", "0.4573111", "0.45607132", "0.45561373", "0.4550738", "0.45258698", "0.45245716", "0.4521071", "0.45067695", "0.44978818", "0.44963357", "0.44883648", "0.4486589", "0.44754845", "0.44732672", "0.4468815", "0.44634274", "0.44606504", "0.44585764", "0.44410113", "0.44341335", "0.44291934", "0.4428409", "0.44196233", "0.44128484", "0.44126686", "0.44105104", "0.4409206", "0.44071704", "0.44017196", "0.44003874", "0.438879", "0.43844298", "0.43843582", "0.43839177", "0.43819776", "0.4377919", "0.43726796", "0.4365725", "0.43560615", "0.43559963", "0.43528396", "0.43520653", "0.43505552", "0.43503764", "0.4345945", "0.43430755", "0.43364984", "0.43317273", "0.43279165", "0.4325529", "0.4324214", "0.4320943", "0.43190816", "0.4317224", "0.43073738", "0.4307309", "0.43070763" ]
0.74893934
0
Client returns a new DigitalOcean client
func Client(token string, region string, baseURL string) (DobsClient, error) { tokenSrc := oauth2.StaticTokenSource(&oauth2.Token{AccessToken: token}) if baseURL == "" { baseURL = "https://api.digitalocean.com/" } client, err := godo.New(oauth2.NewClient( oauth2.NoContext, tokenSrc), godo.SetUserAgent(userAgent()), godo.SetBaseURL(baseURL), ) return DobsClient{GodoClient: client, Region: region}, err }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (c *Config) Client() (*godo.Client, error) {\n\ttokenSrc := oauth2.StaticTokenSource(&oauth2.Token{\n\t\tAccessToken: c.Token,\n\t})\n\n\tclient := godo.NewClient(oauth2.NewClient(oauth2.NoContext, tokenSrc))\n\n\tlog.Printf(\"[INFO] DigitalOcean Client configured for URL: %s\", client.BaseURL.String())\n\n\treturn client, nil\n}", "func New() *d.Client {\n\tvar err error\n\tif os.Getenv(\"DOCKER_HOST\") != \"\" {\n\t\tclient, err = d.NewClient(os.Getenv(\"DOCKER_HOST\"))\n\t} else {\n\t\tclient, err = d.NewClient(\"DEFAULTHERE\")\n\t}\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t\treturn nil\n\t}\n\n\treturn client\n}", "func NewClient() *client.Client {\n\t// No need to test docker connection if AppMaker and DbMaker are not deployed\n\tif !configs.ServiceConfig.AppMaker.Deploy && !configs.ServiceConfig.DbMaker.Deploy {\n\t\treturn nil\n\t}\n\tcli, err := client.NewEnvClient()\n\tif err != nil {\n\t\tutils.Log(\"Docker-Connection-1\", \"Failed creating Docker Client\", utils.ErrorTAG)\n\t\tutils.LogError(\"Docker-Connection-2\", err)\n\t\tos.Exit(1)\n\t}\n\t_, err = cli.Ping(context.Background())\n\tif err != nil {\n\t\tutils.Log(\"Docker-Connection-3\", \"Connection with Docker Daemon was not established\", utils.ErrorTAG)\n\t\tutils.LogError(\"Docker-Connection-4\", err)\n\t\tos.Exit(1)\n\t}\n\tutils.LogInfo(\"Docker-Connection-5\", \"Docker Daemon Connection Established\")\n\treturn cli\n}", "func New(o *Opt) *Client {\n\treturn &Client{\n\t\to: o,\n\t}\n}", "func newClient(opts *ClientOpts) (*Client, error) {\n\tbaseClient, err := newAPIClient(opts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient := &Client{\n\t\tAPIClient: *baseClient,\n\t}\n\n\t// init base operator\n\tclient.Node = newNodeClient(client)\n\tclient.Namespace = newNameSpaceClient(client)\n\tclient.ConfigMap = newConfigMapClient(client)\n\tclient.Service = newServiceClient(client)\n\tclient.Pod = newPodClient(client)\n\tclient.ReplicationController = newReplicationControllerClient(client)\n\tclient.StatefulSet = newStatefulSetClient(client)\n\tclient.DaemonSet = newDaemonSetClient(client)\n\tclient.Deployment = newDeploymentClient(client)\n\tclient.ReplicaSet = newReplicaSetClient(client)\n\n\treturn client, nil\n}", "func NewClient(useOTE bool, apiKey, apiSecret string) (*Client, error) {\n\tvar endpoint string\n\n\tif useOTE {\n\t\tendpoint = \"https://api.ote-godaddy.com\"\n\t} else {\n\t\tendpoint = \"https://api.godaddy.com\"\n\t}\n\n\tclient := Client{\n\t\tAPIKey: apiKey,\n\t\tAPISecret: apiSecret,\n\t\tAPIEndPoint: endpoint,\n\t\tClient: &http.Client{},\n\t\tRatelimiter: rate.NewLimiter(rate.Every(60*time.Second), 60),\n\t\tTimeout: DefaultTimeout,\n\t}\n\n\t// Get and check the configuration\n\tif err := client.validate(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &client, nil\n}", "func New(g *godo.Client) Client {\n\tc := &client{\n\t\tg: g,\n\t}\n\treturn c\n}", "func NewClient(config ClientConfiguration) *Client {\n\tout := &Client{\n\t\tPort: 22,\n\t\tUser: \"ec2-user\",\n\t}\n\tif config.Host != \"\" {\n\t\tout.Host = config.Host\n\t}\n\tif config.Port != 0 {\n\t\tout.Port = config.Port\n\t}\n\tif config.User != \"\" {\n\t\tout.User = config.User\n\t}\n\tif config.PrivateKeyFile != \"\" {\n\t\tout.PrivateKeyFile = config.PrivateKeyFile\n\t}\n\treturn out\n}", "func New(token string, timeout time.Duration) *DigitalOcean {\n\treturn &DigitalOcean{\n\t\ttoken: token,\n\t\tc: &http.Client{},\n\t\turl: \"https://api.digitalocean.com/v2\",\n\t\ttimeout: timeout,\n\t}\n}", "func New() Client {\n\treturn &client{}\n}", "func NewClient() Client {\n\treturn Client{\n\t\taddress: \"https://ladder.slashdiablo.net\",\n\t}\n}", "func NewClient(apiKey, appKey string) *Client {\n\tbaseUrl := os.Getenv(\"DATADOG_HOST\")\n\tif baseUrl == \"\" {\n\t\tbaseUrl = \"https://api.datadoghq.com\"\n\t}\n\n\treturn &Client{\n\t\tapiKey: apiKey,\n\t\tappKey: appKey,\n\t\tbaseUrl: baseUrl,\n\t\tHttpClient: http.DefaultClient,\n\t\tRetryTimeout: time.Duration(60 * time.Second),\n\t}\n}", "func newClient() (*client, error) {\n\tconfig, err := parsePgEnv()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tc := client{\n\t\tconnConfig: config,\n\n\t\tuser: pg.NewUserService(\n\t\t\tpg.WithHost(config.Host),\n\t\t\tpg.WithPort(config.Port),\n\t\t\tpg.WithDatabase(config.Database),\n\t\t\tpg.WithUser(config.User),\n\t\t\tpg.WithPassword(config.Password),\n\t\t),\n\t}\n\treturn &c, nil\n}", "func New(client *http.Client) *DogHouseClient {\n\tdh := &DogHouseClient{Client: client}\n\tif dh.Client == nil {\n\t\tdh.Client = http.DefaultClient\n\t}\n\tbase := baseEndpoint\n\tif baseEnvURL := os.Getenv(\"REVIEWDOG_GITHUB_APP_URL\"); baseEnvURL != \"\" {\n\t\tbase = baseEnvURL\n\t}\n\tvar err error\n\tdh.BaseURL, err = url.Parse(base)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn dh\n}", "func newClient(ctx context.Context, cfg vcConfig) (*vsClient, error) {\n\tu := url.URL{\n\t\tScheme: \"https\",\n\t\tHost: cfg.server,\n\t\tPath: \"sdk\",\n\t}\n\n\tu.User = url.UserPassword(cfg.user, cfg.password)\n\tinsecure := cfg.insecure\n\n\tgc, err := govmomi.NewClient(ctx, &u, insecure)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"connecting to vSphere API: %w\", err)\n\t}\n\n\trc := rest.NewClient(gc.Client)\n\ttm := tags.NewManager(rc)\n\n\tvsc := vsClient{\n\t\tgovmomi: gc,\n\t\trest: rc,\n\t\ttagManager: tm,\n\t}\n\n\terr = vsc.rest.Login(ctx, u.User)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"logging into rest api: %w\", err)\n\t}\n\n\treturn &vsc, nil\n}", "func NewClient(domain, apikey string, l *log.Logger) (c *Client, err error) {\n\tc = &Client{}\n\tc.l = l\n\tc.httpclient = &http.Client{Timeout: 5 * time.Second} // TODO: provide ability to configure\n\tc.domain = domain\n\tc.apikey = apikey\n\tc.baseURL, err = url.Parse(fmt.Sprintf(\"https://%s.canary.tools/api/v1/\", domain))\n\tif err != nil {\n\t\treturn\n\t}\n\n\tc.l.Debug(\"pinging console...\")\n\terr = c.Ping()\n\treturn\n}", "func NewClient(option *Option) (*Client, error) {\n\thttpClient := http.DefaultClient\n\tbaseURL, _ := url.Parse(defaultBaseURL)\n\n\tc := &Client{client: httpClient, BaseURL: baseURL, UserAgent: userAgent, Option: option}\n\tc.SizesService = &SizesService{client: c}\n\tc.RegionsService = &RegionsService{client: c}\n\tc.DropletsService = &DropletsService{client: c}\n\tc.ImagesService = &ImagesService{client: c, Page: 1, PerPage: 50}\n\tc.SSHKeysService = &SSHKeysService{client: c}\n\tc.AccountService = &AccountService{client: c}\n\n\treturn c, nil\n}", "func NewClient(c *Config) *Client {\n\treturn &Client{\n\t\tBaseURL: BaseURLV1,\n\t\tUname: c.Username,\n\t\tPword: c.Password,\n\t\tHTTPClient: &http.Client{\n\t\t\tTimeout: time.Minute,\n\t\t},\n\t}\n}", "func NewClient(c Config) (Client, error) {\n\tif len(c.Endpoint) == 0 {\n\t\tc.Endpoint = EndpointProduction\n\t}\n\n\treturn &client{\n\t\tapikey: c.APIKey,\n\t\tendpoint: c.Endpoint,\n\t\torganizationid: c.OrganizationID,\n\t\thttpClient: http.DefaultClient,\n\t}, nil\n}", "func NewClient(config *sdk.Config, credential *auth.Credential) *Client {\n\tvar handler sdk.RequestHandler = func(c *sdk.Client, req request.Common) (request.Common, error) {\n\t\terr := req.SetProjectId(PickResourceID(req.GetProjectId()))\n\t\treturn req, err\n\t}\n\tvar (\n\t\tuaccountClient = *uaccount.NewClient(config, credential)\n\t\tuhostClient = *uhost.NewClient(config, credential)\n\t\tunetClient = *unet.NewClient(config, credential)\n\t\tvpcClient = *vpc.NewClient(config, credential)\n\t\tudpnClient = *udpn.NewClient(config, credential)\n\t\tpathxClient = *pathx.NewClient(config, credential)\n\t\tudiskClient = *udisk.NewClient(config, credential)\n\t\tulbClient = *ulb.NewClient(config, credential)\n\t\tudbClient = *udb.NewClient(config, credential)\n\t\tumemClient = *umem.NewClient(config, credential)\n\t\tuphostClient = *uphost.NewClient(config, credential)\n\t\tpuhostClient = *puhost.NewClient(config, credential)\n\t\tpudbClient = *pudb.NewClient(config, credential)\n\t\tpumemClient = *pumem.NewClient(config, credential)\n\t\tppathxClient = *ppathx.NewClient(config, credential)\n\t)\n\n\tuaccountClient.Client.AddRequestHandler(handler)\n\tuhostClient.Client.AddRequestHandler(handler)\n\tunetClient.Client.AddRequestHandler(handler)\n\tvpcClient.Client.AddRequestHandler(handler)\n\tudpnClient.Client.AddRequestHandler(handler)\n\tpathxClient.Client.AddRequestHandler(handler)\n\tudiskClient.Client.AddRequestHandler(handler)\n\tulbClient.Client.AddRequestHandler(handler)\n\tudbClient.Client.AddRequestHandler(handler)\n\tumemClient.Client.AddRequestHandler(handler)\n\tuphostClient.Client.AddRequestHandler(handler)\n\tpuhostClient.Client.AddRequestHandler(handler)\n\tpudbClient.Client.AddRequestHandler(handler)\n\tpumemClient.Client.AddRequestHandler(handler)\n\tppathxClient.Client.AddRequestHandler(handler)\n\n\treturn &Client{\n\t\tuaccountClient,\n\t\tuhostClient,\n\t\tunetClient,\n\t\tvpcClient,\n\t\tudpnClient,\n\t\tpathxClient,\n\t\tudiskClient,\n\t\tulbClient,\n\t\tudbClient,\n\t\tumemClient,\n\t\tuphostClient,\n\t\tpuhostClient,\n\t\tpudbClient,\n\t\tpumemClient,\n\t\tppathxClient,\n\t}\n}", "func NewClient(c *Config) (*Client, error) {\n\tdef := DefaultConfig()\n\tif def == nil {\n\t\treturn nil, fmt.Errorf(\"could not create/read default configuration\")\n\t}\n\tif def.Error != nil {\n\t\treturn nil, errwrap.Wrapf(\"error encountered setting up default configuration: {{err}}\", def.Error)\n\t}\n\n\tif c == nil {\n\t\tc = def\n\t}\n\n\tc.modifyLock.Lock()\n\tdefer c.modifyLock.Unlock()\n\n\tif c.MinRetryWait == 0 {\n\t\tc.MinRetryWait = def.MinRetryWait\n\t}\n\n\tif c.MaxRetryWait == 0 {\n\t\tc.MaxRetryWait = def.MaxRetryWait\n\t}\n\n\tif c.HttpClient == nil {\n\t\tc.HttpClient = def.HttpClient\n\t}\n\tif c.HttpClient.Transport == nil {\n\t\tc.HttpClient.Transport = def.HttpClient.Transport\n\t}\n\n\taddress := c.Address\n\tif c.AgentAddress != \"\" {\n\t\taddress = c.AgentAddress\n\t}\n\n\tu, err := c.ParseAddress(address)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient := &Client{\n\t\taddr: u,\n\t\tconfig: c,\n\t\theaders: make(http.Header),\n\t}\n\n\tif c.ReadYourWrites {\n\t\tclient.replicationStateStore = &replicationStateStore{}\n\t}\n\n\t// Add the VaultRequest SSRF protection header\n\tclient.headers[RequestHeaderName] = []string{\"true\"}\n\n\tif token := os.Getenv(EnvVaultToken); token != \"\" {\n\t\tclient.token = token\n\t}\n\n\tif namespace := os.Getenv(EnvVaultNamespace); namespace != \"\" {\n\t\tclient.setNamespace(namespace)\n\t}\n\n\treturn client, nil\n}", "func NewClient(logger log.Logger, endpoint string, debug bool) Client {\n\tconf := watchman.NewConfiguration()\n\tconf.BasePath = \"http://localhost\" + bind.HTTP(\"watchman\")\n\tconf.Debug = debug\n\n\tif k8s.Inside() {\n\t\tconf.BasePath = \"http://watchman.apps.svc.cluster.local:8080\"\n\t}\n\tif endpoint != \"\" {\n\t\tconf.BasePath = endpoint // override from provided Watchman_ENDPOINT env variable\n\t}\n\n\tlogger = logger.WithKeyValue(\"package\", \"watchman\")\n\tlogger.Log(fmt.Sprintf(\"using %s for Watchman address\", conf.BasePath))\n\n\treturn &moovWatchmanClient{\n\t\tunderlying: watchman.NewAPIClient(conf),\n\t\tlogger: logger,\n\t}\n}", "func New(d database.Service, passphrase string) (*client, error) {\n\t// immediately return if a nil database Service is provided\n\tif d == nil {\n\t\treturn nil, fmt.Errorf(\"empty Database client passed to native secret engine\")\n\t}\n\n\t// create the client object\n\tclient := &client{\n\t\tNative: d,\n\t\tpassphrase: passphrase,\n\t}\n\n\treturn client, nil\n}", "func New(maybeConfig *iam.Config, options ...Option) Doer {\n\tdefaultClient := &http.Client{}\n\tfor i := range options {\n\t\tif options[i] != nil {\n\t\t\toptions[i](defaultClient)\n\t\t}\n\t}\n\tif maybeConfig != nil {\n\t\tauthClient := &authClient{\n\t\t\tclient: defaultClient,\n\t\t\tconfig: maybeConfig,\n\t\t}\n\t\treturn authClient\n\t}\n\treturn defaultClient\n}", "func NewClient(apiKey string) Client {\n\treturn &defaultClient{\n\t\tapiKey: apiKey,\n\t}\n}", "func New(cfg *config.Config) (c *Client) {\n\tc = &Client{\n\t\tapi: httpclient.NewHttpClient(),\n\t\tdebug: cfg.Debug,\n\t\tlastAt: time.Now().UTC(),\n\t\tsecret: cfg.APISecret,\n\t\turl: cfg.APIUrl,\n\t\tversion: cfg.APIVersion,\n\t\twait: 1 * time.Second,\n\t}\n\n\tc.api.Defaults(httpclient.Map{\n\t\t\"Accept\": \"application/json\",\n\t\t\"Content-Type\": \"application/json\",\n\t\thttpclient.OPT_USERAGENT: \"go-crex24\",\n\t\t\"X-CREX24-API-KEY\": cfg.APIKey,\n\t})\n\tif c.debug {\n\t\tfmt.Println(\"X-CREX24-API-KEY:\", c.api.Headers[\"X-CREX24-API-KEY\"])\n\t\tfmt.Println(\"Client.api.Headers:\", c.api.Headers)\n\t}\n\treturn\n}", "func NewClient(apiKey string, custom *http.Client) *Client {\n\tif custom == nil {\n\t\tcustom = http.DefaultClient\n\t}\n\tc := &Client{}\n\tc.http = custom\n\tc.key = apiKey\n\tc.rootURL = igdbURL\n\n\tc.common.client = c\n\tc.Characters = (*CharacterService)(&c.common)\n\tc.Collections = (*CollectionService)(&c.common)\n\tc.Companies = (*CompanyService)(&c.common)\n\tc.Credits = (*CreditService)(&c.common)\n\tc.Engines = (*EngineService)(&c.common)\n\tc.Feeds = (*FeedService)(&c.common)\n\tc.Franchises = (*FranchiseService)(&c.common)\n\tc.Games = (*GameService)(&c.common)\n\tc.GameModes = (*GameModeService)(&c.common)\n\tc.Genres = (*GenreService)(&c.common)\n\tc.Keywords = (*KeywordService)(&c.common)\n\tc.Pages = (*PageService)(&c.common)\n\tc.People = (*PersonService)(&c.common)\n\tc.Perspectives = (*PerspectiveService)(&c.common)\n\tc.Platforms = (*PlatformService)(&c.common)\n\tc.Pulses = (*PulseService)(&c.common)\n\tc.PulseGroups = (*PulseGroupService)(&c.common)\n\tc.PulseSources = (*PulseSourceService)(&c.common)\n\tc.ReleaseDates = (*ReleaseDateService)(&c.common)\n\tc.Reviews = (*ReviewService)(&c.common)\n\tc.Themes = (*ThemeService)(&c.common)\n\tc.Titles = (*TitleService)(&c.common)\n\tc.Versions = (*VersionService)(&c.common)\n\n\treturn c\n}", "func getClient(config vaultAuthOptions) (*api.Client, string, error) {\n\t// create config for connection\n\tvaultCFG := api.DefaultConfig()\n\tvaultCFG.Address = config.URL\n\n\tlog.Debugf(\"Attempting to authenticate user %s to vault %s\", config.Username, config.URL)\n\t// create client\n\tvClient, err := api.NewClient(vaultCFG)\n\tif err != nil {\n\t\tlog.WithError(err).Errorf(color.New(color.Bold).Sprintf(\"Could not connect to Vault at %s.\", config.URL))\n\t\tterminate(1)\n\t\treturn nil, \"\", err\n\t}\n\n\tsys := vClient.Sys()\n\tsealStatus, _ := sys.SealStatus()\n\tif sealStatus.Sealed == true {\n\t\tlog.Fatal(\"Error, Vault is sealed. We cannot authenticate at this time.\")\n\t\tterminate(1)\n\t\treturn nil, \"\", nil\n\t}\n\n\tlog.Infof(\"Requesting Vault authentication for user %s\", config.Username)\n\tauthOptions := map[string]interface{}{\n\t\t\"password\": config.Password,\n\t}\n\n\tloginPath := fmt.Sprintf(\"auth/userpass/login/%s\", config.Username)\n\tsecret, err := vClient.Logical().Write(loginPath, authOptions)\n\tif err != nil {\n\t\tlog.WithError(err).Errorf(color.New(color.Bold).Sprintf(\"Could not authenticate user %s\", config.Username))\n\t\tterminate(1)\n\t\treturn nil, \"\", nil\n\t}\n\n\tvClient.SetToken(secret.Auth.ClientToken)\n\n\tlog.Info(\"Authentication Success\")\n\n\treturn vClient, secret.Auth.ClientToken, nil\n}", "func NewClient(apiKey string) *Client {\n\treturn &Client{&http.Client{}, defaultURL, apiKey}\n}", "func New(apiKey string, secretKey string, opts ...ClientOption) (*client, error) {\n\tc := &client{\n\t\tidGenerator: &id.Generator{},\n\t\tsignatureGenerator: &auth.Generator{},\n\t\tclock: clockwork.NewRealClock(),\n\t\trequester: api.Requester{\n\t\t\tClient: http.DefaultClient,\n\t\t\tBaseURL: productionBaseURL,\n\t\t},\n\t}\n\n\tif err := c.UpdateConfig(apiKey, secretKey, opts...); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn c, nil\n}", "func NewClient(config *yamux.Config, logger *log.Logger) *Client {\n\tif config == nil {\n\t\tconfig = yamux.DefaultConfig()\n\t}\n\tif logger == nil {\n\t\tlogger = log.New(ioutil.Discard, \"[soxy]\", log.LstdFlags)\n\t}\n\tc := Client{\n\t\tconfig: config,\n\t\tlogger: logger,\n\t}\n\treturn &c\n}", "func NewClient(apiKey string) *Client {\n\treturn &Client{\n\t\tclient: &http.Client{Transport: &http.Transport{\n\t\t\tProxy: http.ProxyFromEnvironment,\n\t\t\tDialContext: (&net.Dialer{\n\t\t\t\tTimeout: 30 * time.Second,\n\t\t\t\tKeepAlive: 30 * time.Second,\n\t\t\t\tDualStack: true,\n\t\t\t}).DialContext,\n\t\t\tDisableKeepAlives: true,\n\t\t\tTLSHandshakeTimeout: 10 * time.Second,\n\t\t\tExpectContinueTimeout: 1 * time.Second,\n\t\t}},\n\t\tapiKey: apiKey,\n\t\tURL: DefaultURL,\n\t}\n}", "func New() *Client {\n\treturn &Client{\n\t\tClientInfo: ClientInfo{\n\t\t\t// api defaults\n\t\t\tdatatype: &defaultDatatype,\n\t\t\toutputsize: &defaultOutputsize,\n\t\t},\n\t}\n}", "func New(config Config) (*client, error) {\n\tvar prefix string\n\tswitch config.Version {\n\tcase \"1\":\n\t\tprefix = PrefixVaultV1\n\tcase \"2\":\n\t\tprefix = PrefixVaultV2\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unrecognized vault version of %s\", config.Version)\n\t}\n\n\t// append admin defined prefix if not empty\n\tif config.Prefix != \"\" {\n\t\tprefix = fmt.Sprintf(\"%s/%s\", prefix, config.Prefix)\n\t}\n\n\tconf := api.Config{Address: config.Address}\n\n\t// create Vault client\n\tc, err := api.NewClient(&conf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif config.Token != \"\" {\n\t\tc.SetToken(config.Token)\n\t}\n\n\tclient := &client{\n\t\tVault: c,\n\t\tPrefix: prefix,\n\t\tAuthMethod: config.AuthMethod,\n\t\tRenewal: config.Renewal,\n\t\tAws: awsCfg{\n\t\t\tRole: config.AwsRole,\n\t\t},\n\t}\n\n\tif config.AuthMethod != \"\" {\n\t\terr = client.initialize()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// start the routine to refresh the token\n\t\tgo client.refreshToken()\n\t}\n\n\treturn client, nil\n}", "func newClient(conf config) (*storage.Client, error) {\n\tdb, err := storage.NewDBClient(conf.MongoURI, conf.DBName, conf.MongoMICol, conf.MongoAgCol)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating DB client: %q\", err)\n\t}\n\tdb.Collection(conf.MongoMICol)\n\tbc := storage.NewCloudClient(conf.SwiftUsername, conf.SwiftAPIKey, conf.SwiftAuthURL, conf.SwiftDomain, conf.SwiftContainer)\n\tclient, err := storage.NewClient(db, bc)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating storage.client: %q\", err)\n\t}\n\treturn client, nil\n}", "func New() *Client {\n\treturn &Client{\n\t\tDebug: false,\n\t\tparser: &parser{},\n\t}\n}", "func NewClient(config *Config, token string) (Client, error) {\n\tif config == nil {\n\t\tconfig = &Config{Config: api.DefaultConfig()}\n\t}\n\tclient, err := api.NewClient(config.Config)\n\tif err != nil {\n\t\treturn Client{}, err\n\t}\n\n\tif config.Namespace != \"\" {\n\t\tclient.SetNamespace(config.Namespace)\n\t}\n\n\tclient.SetToken(token)\n\tlog.Entry().Debugf(\"Login to Vault %s in namespace %s successfull\", config.Address, config.Namespace)\n\treturn Client{client.Logical(), config}, nil\n}", "func (m *Main) Client() *pilosa.Client {\n\tclient, err := pilosa.NewClient(m.Server.Host)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn client\n}", "func New(client *sajari.Client) *Client {\n\treturn &Client{\n\t\tc: client,\n\t}\n}", "func NewClient(host, apiKey string) *Client {\n\treturn &Client{\n\t\thost: host,\n\t\tapiKey: apiKey,\n\t\tclient: http.DefaultClient,\n\t}\n}", "func NewClient() Golib {\r\n\treturn &golib{}\r\n}", "func NewClient(with ...ClientOption) *Client {\n\ttimeout := DefaultTimeout\n\n\tclient := &Client{\n\t\tclient: &http.Client{\n\t\t\tTimeout: timeout,\n\t\t},\n\t\tbase: getBaseURL(url.URL{\n\t\t\tScheme: \"https\",\n\t\t\tHost: \"api.secrethub.io\",\n\t\t}),\n\t\tuserAgent: DefaultUserAgent,\n\t}\n\tclient.Options(with...)\n\treturn client\n}", "func NewClient() *Client {\n baseURL, _ := url.Parse(defaultBaseURL)\n return &Client{client: http.DefaultClient, BaseURL: baseURL, UserAgent: userAgent}\n}", "func newClient(token string) *Client {\n\treturn &Client{\n\t\tToken: token,\n\t}\n}", "func NewClient() *Client {\n\tu := getVaultAddr()\n\tauth := getAuthStrategy()\n\treturn &Client{u, auth, \"\", nil}\n}", "func New(addr string) (*Client, error) {\n\treturn &Client{\n\t\taddr: addr,\n\t\thttpClient: &http.Client{},\n\t}, nil\n}", "func New(addr string) (*Client, error) {\n\treturn &Client{\n\t\taddr: addr,\n\t\thttpClient: &http.Client{},\n\t}, nil\n}", "func (c *Config) Client() (interface{}, error) {\n\thttp.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true}\n\turl, _ := url.Parse(c.BaseURL)\n\tclient := pingaccess.NewClient(c.Username, c.Password, url, c.Context, nil)\n\n\tif os.Getenv(\"TF_LOG\") == \"DEBUG\" || os.Getenv(\"TF_LOG\") == \"TRACE\" {\n\t\tclient.LogDebug(true)\n\t}\n\treturn client, nil\n}", "func NewClient(config HostConfig) *Client {\n\tc := &Client{\n\t\tconfig: config,\n\t}\n\tc.client = &http.Client{\n\t\tTransport: &http.Transport{\n\t\t\tTLSClientConfig: &tls.Config{\n\t\t\t\tInsecureSkipVerify: !config.Verify,\n\t\t\t},\n\t\t},\n\t}\n\n\tgrpcAddress := c.config.GRPC\n\tsecure := false\n\tif grpcAddress == `` {\n\t\tu, _ := url.Parse(c.config.API)\n\t\tgrpcAddress = u.Hostname()\n\t\tgrpcPort := u.Port()\n\t\tif u.Scheme == `http` {\n\t\t\tsecure = false\n\t\t\tif grpcPort == `` {\n\t\t\t\tgrpcPort = `80`\n\t\t\t}\n\t\t} else {\n\t\t\tsecure = true\n\t\t\tif grpcPort == `` {\n\t\t\t\tgrpcPort = `443`\n\t\t\t}\n\t\t}\n\n\t\tgrpcAddress = fmt.Sprintf(`%s:%s`, grpcAddress, grpcPort)\n\t}\n\n\tvar conn *grpc.ClientConn\n\tvar err error\n\tif secure {\n\t\tif conn, err = grpc.Dial(\n\t\t\tgrpcAddress,\n\t\t\tgrpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})),\n\t\t\tgrpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(100<<20)),\n\t\t); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t} else {\n\t\tif conn, err = grpc.Dial(\n\t\t\tgrpcAddress,\n\t\t\tgrpc.WithInsecure(),\n\t\t\tgrpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(100<<20)),\n\t\t); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\n\tc.cc = conn\n\n\tc.blog = protocols.NewTaoBlogClient(c.cc)\n\tc.management = protocols.NewManagementClient(c.cc)\n\n\treturn c\n}", "func (o *Okta) client() *http.Client {\n\tif o.myClient == nil {\n\t\to.myClient = &http.Client{\n\t\t\tTransport: &http.Transport{\n\t\t\t\tProxy: http.ProxyFromEnvironment,\n\t\t\t\tDial: (&net.Dialer{\n\t\t\t\t\tTimeout: 30 * time.Second,\n\t\t\t\t\tKeepAlive: 30 * time.Second,\n\t\t\t\t}).Dial,\n\t\t\t\tTLSHandshakeTimeout: 10 * time.Second,\n\t\t\t\tExpectContinueTimeout: 1 * time.Second,\n\t\t\t},\n\t\t}\n\t\tif o.Debug {\n\t\t\to.myClient.Transport = debugTransport{t: o.myClient.Transport, log: o.log}\n\t\t}\n\n\t}\n\treturn o.myClient\n}", "func newVirtualMachineClient(subID string, authorizer auth.Authorizer) (*client, error) {\n\tc, err := wssdcloudclient.GetVirtualMachineClient(&subID, authorizer)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &client{c}, nil\n}", "func New(opts ...Option) *Client {\n\tvar c Client\n\n\tfor _, opt := range opts {\n\t\topt(&c)\n\t}\n\n\tif c.client == nil {\n\t\tc.client = hystrix.NewClient()\n\t}\n\n\tht := httptransport.NewWithClient(\n\t\tc.url.Host,\n\t\tc.url.Path,\n\t\t[]string{c.url.Scheme},\n\t\t&http.Client{\n\t\t\tTransport: NewHystrixTransport(c.client),\n\t\t},\n\t)\n\n\tc.Client = *admin.New(ht, nil)\n\n\treturn &c\n}", "func New(c *Config) Client {\n\treturn newClient(c)\n}", "func NewClient() *Client {\n\t// Init new http.Client.\n\thttpClient := http.DefaultClient\n\n\t// Parse BE URL.\n\tbaseURL, _ := url.Parse(backendURL)\n\n\tc := &Client{\n\t\tclient: httpClient,\n\t\tBackendURL: baseURL,\n\t\tUserAgent: userAgent,\n\t}\n\n\tc.Pwned = &PwnedService{client: c}\n\tc.Cache = &CacheService{client: c}\n\treturn c\n}", "func NewClient(creds Authenticator, apiBaseURL string, httpClient httpClient) *Client {\n\tif apiBaseURL == \"\" {\n\t\tapiBaseURL = fmt.Sprintf(\"https://%s.api.dragonchain.com\", creds.GetDragonchainID())\n\t}\n\tif httpClient == nil {\n\t\thttpClient = &http.Client{}\n\t}\n\tclient := &Client{\n\t\tcreds: creds,\n\t\tapiBaseURL: apiBaseURL,\n\t\thttpClient: httpClient,\n\t}\n\n\treturn client\n}", "func (c *client) newClient() *gitea.Client {\n\treturn c.newClientToken(\"\")\n}", "func NewClient(cfg Config, l *logrus.Logger) (*Client, error) {\n\tctx := context.Background()\n\tkClient := gocloak.NewClient(cfg.Host)\n\tadmin, err := kClient.Login(ctx, adminClientID, cfg.AdminSecret, cfg.AdminRealm, cfg.AdminUser, cfg.AdminPassword)\n\tif err != nil {\n\t\tl.Errorf(\"NewClient\", err, \"failed to log admin user in\")\n\t\treturn nil, err\n\t}\n\tclients, err := kClient.GetClients(ctx, admin.AccessToken, cfg.ClientRealm, gocloak.GetClientsParams{ClientID: &cfg.ClientID})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(clients) == 0 {\n\t\treturn nil, ErrClientNotFound\n\t}\n\n\treturn &Client{\n\t\tcfg: cfg,\n\t\tctx: ctx,\n\t\tkc: kClient,\n\t\tac: &adminClient{\n\t\t\tadmin: admin,\n\t\t\taccessExpiry: time.Now().Add(time.Second * time.Duration(admin.ExpiresIn)),\n\t\t\trefreshExpiry: time.Now().Add(time.Second * time.Duration(admin.RefreshExpiresIn)),\n\t\t},\n\t\tclient: keycloakClient{\n\t\t\tid: *clients[0].ID,\n\t\t\tclientID: *clients[0].ClientID,\n\t\t},\n\t\trealm: cfg.ClientRealm,\n\t\tiss: cfg.Host + \"/auth/realms/\" + cfg.ClientRealm,\n\t\tl: l,\n\t}, nil\n}", "func newClient(cs ConnectionSettings) *client {\n\treturn &client{\n\t\tConnectionSettings: cs,\n\t}\n}", "func New(opt ...Option) Client {\n\n\topts := &Options{}\n\tfor _, o := range opt {\n\t\to(opts)\n\t}\n\n\treturn &defaultClient {\n\t\topts: opts,\n\t\tTransport: transport.DefaultClientTransport,\n\t}\n}", "func NewClient() *Client {\n c := &Client{}\n c.userService.URL = &c.URL\n return c\n}", "func NewClient(config *Config) (client *Client, err error) {\n\t// bootstrap the config\n\tdefConfig := DefaultConfig()\n\n\tif len(config.ApiAddress) == 0 {\n\t\tconfig.ApiAddress = defConfig.ApiAddress\n\t}\n\n\tif len(config.Username) == 0 {\n\t\tconfig.Username = defConfig.Username\n\t}\n\n\tif len(config.Password) == 0 {\n\t\tconfig.Password = defConfig.Password\n\t}\n\n\tif len(config.Token) == 0 {\n\t\tconfig.Token = defConfig.Token\n\t}\n\n\tif len(config.UserAgent) == 0 {\n\t\tconfig.UserAgent = defConfig.UserAgent\n\t}\n\n\tif config.HttpClient == nil {\n\t\tconfig.HttpClient = defConfig.HttpClient\n\t}\n\n\tif config.HttpClient.Transport == nil {\n\t\tconfig.HttpClient.Transport = shallowDefaultTransport()\n\t}\n\n\tvar tp *http.Transport\n\n\tswitch t := config.HttpClient.Transport.(type) {\n\tcase *http.Transport:\n\t\ttp = t\n\tcase *oauth2.Transport:\n\t\tif bt, ok := t.Base.(*http.Transport); ok {\n\t\t\ttp = bt\n\t\t}\n\t}\n\n\tif tp != nil {\n\t\tif tp.TLSClientConfig == nil {\n\t\t\ttp.TLSClientConfig = &tls.Config{}\n\t\t}\n\t\ttp.TLSClientConfig.InsecureSkipVerify = config.SkipSslValidation\n\t}\n\n\tconfig.ApiAddress = strings.TrimRight(config.ApiAddress, \"/\")\n\n\tclient = &Client{\n\t\tConfig: *config,\n\t}\n\n\tif err := client.refreshEndpoint(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn client, nil\n}", "func New(addr string) *Client {\n\treturn &Client{\n\t\taddr: addr,\n\t\tHTTPClient: &http.Client{\n\t\t\tTimeout: 1 * time.Minute,\n\t\t},\n\t}\n}", "func New(algodAddress, algodToken string) (*Client, error) {\n\treturn &Client{\n\t\talgoAddress: algodAddress,\n\t\talgodToken: algodToken,\n\t\tlogger: log.With().Str(\"component\", \"sender\").Str(\"kind\", \"algod\").Logger(),\n\t}, nil\n}", "func New() *Client {\n return &Client{&API{}}\n}", "func NewDogClient() *Client {\n\treturn newClient(dogUrl)\n}", "func (dc *DockerClient) Client() (*client.Client, error) {\n\tif dc.c == nil {\n\t\tvar cli *client.Client\n\t\tvar err error\n\t\tif cli, err = client.NewEnvClient(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdc.c = cli\n\t}\n\treturn dc.c, nil\n}", "func newClient(httpClient *http.Client) (c *Client) {\n\tc = &Client{httpClient: httpClient}\n\tc.service.client = c\n\tc.Auth = (*AuthService)(&c.service)\n\tc.Providers = (*ProvidersService)(&c.service)\n\tc.Projects = (*ProjectsService)(&c.service)\n\tc.Releases = (*ReleasesService)(&c.service)\n\tc.SlackChannels = (*SlackChannelsService)(&c.service)\n\tc.TelegramChats = (*TelegramChatsService)(&c.service)\n\tc.DiscordChannels = (*DiscordChannelsService)(&c.service)\n\tc.HangoutsChatWebhooks = (*HangoutsChatWebhooksService)(&c.service)\n\tc.MicrosoftTeamsWebhooks = (*MicrosoftTeamsWebhooksService)(&c.service)\n\tc.MattermostWebhooks = (*MattermostWebhooksService)(&c.service)\n\tc.RocketchatWebhooks = (*RocketchatWebhooksService)(&c.service)\n\tc.MatrixRooms = (*MatrixRoomsService)(&c.service)\n\tc.Webhooks = (*WebhooksService)(&c.service)\n\tc.Tags = (*TagsService)(&c.service)\n\treturn c\n}", "func (o *Oneview) NewClient() (*ov.OVClient, error) {\n\tvar ovClient *ov.OVClient\n\n\t//If pass invalid API ver, this will be panic.\n\tovc := ovClient.NewOVClient(\n\t\to.Username,\n\t\to.Password,\n\t\to.Domain,\n\t\to.Endpoint,\n\t\tfalse, //ssl verificcation\n\t\to.ApiVersion,\n\t\t\"*\")\n\n\tlog.Debugf(\"Trying to connect HPE OneView endpoint at %v with API Ver %v\", o.Endpoint, o.ApiVersion)\n\t_, err := ovc.GetAPIVersion()\n\tif err != nil {\n\t\tlog.Error(Wrap(err))\n\t\treturn nil, err\n\t}\n\tlog.Debugf(\"Connected %v with API Ver %v\", o.Endpoint, o.ApiVersion)\n\n\treturn ovc, nil\n}", "func NewClient(config Config) Client {\n\treturn DefaultClient{\n\t\tconfig: config,\n\t}\n}", "func New(client netatmo.AuthenticatedClient) *Client {\n\treturn &Client{\n\t\tclient: client,\n\t}\n}", "func New() *Client {\n\treturn &Client{\n\t\tclient: &http.Client{},\n\t\tendpoint: *defaultEndpoint,\n\t}\n}", "func Open(opt ...Option) *Client {\n\treturn &Client{\n\t\tclient: &http.Client{Transport: RoundTripper(opt...)},\n\t}\n}", "func NewClient(options *ClientOptions) *Client {\n\tclient := &Client{\n\t\tappID: options.AppID,\n\t\tappKey: options.AppKey,\n\t\tmasterKey: options.MasterKey,\n\t\tserverURL: options.ServerURL,\n\t}\n\n\tif !strings.HasSuffix(options.AppID, \"MdYXbMMI\") {\n\t\tif client.serverURL == \"\" {\n\t\t\tpanic(fmt.Errorf(\"please set API's serverURL\"))\n\t\t}\n\t}\n\n\t_, debugEnabled := os.LookupEnv(\"LEANCLOUD_DEBUG\")\n\n\tif debugEnabled {\n\t\tclient.requestLogger = log.New(os.Stdout, \"\", log.LstdFlags)\n\t}\n\n\tclient.Users.c = client\n\tclient.Files.c = client\n\tclient.Roles.c = client\n\treturn client\n}", "func New(clientID string, options ...Option) (Client, error) {\n\topts := clientOptions{\n\t\tauthority: base.AuthorityPublicCloud,\n\t\thttpClient: shared.DefaultClient,\n\t}\n\n\tfor _, o := range options {\n\t\to(&opts)\n\t}\n\tif err := opts.validate(); err != nil {\n\t\treturn Client{}, err\n\t}\n\n\tbase, err := base.New(clientID, opts.authority, oauth.New(opts.httpClient), base.WithCacheAccessor(opts.accessor), base.WithClientCapabilities(opts.capabilities), base.WithInstanceDiscovery(!opts.disableInstanceDiscovery))\n\tif err != nil {\n\t\treturn Client{}, err\n\t}\n\treturn Client{base}, nil\n}", "func New() *Client {\n\treturn &Client{}\n}", "func New() *Client {\n\treturn &Client{}\n}", "func NewClient(key, secretKey string) (*Client, error) {\n\tif key == \"\" || secretKey == \"\" {\n\t\treturn &Client{}, errors.New(\"key is missing\")\n\t}\n\n\tbaseurl, _ := url.Parse(defalutBaseURL)\n\tclient := &http.Client{Timeout: time.Duration(10) * time.Second}\n\n\tcli := &Client{accessKey: key, secretAccessKey: secretKey, BaseURL: baseurl, HTTPClient: client}\n\n\treturn cli, nil\n}", "func New() (client *Client) {\n\thttpClient := &http.Client{}\n\treturn &Client{\n\t\thttpClient: httpClient,\n\t\tTimeout: 0,\n\t\tDisableKeepAlives: true,\n\t\tIdleConnectionTimeout: 0,\n\t\ttransport: &http.Transport{},\n\t\tMaxRetriesOnError: 1,\n\t}\n}", "func NewClient(conf *Config, auth *AuthConfig) (*Client, error) {\n\tconfig := DefaultConfig\n\tif conf != nil {\n\t\tconfig = *conf\n\t}\n\n\tauthConf := DefaultAuth\n\tif auth != nil {\n\t\tauthConf = *auth\n\t}\n\n\tlogger, _ := zap.NewProduction()\n\tc := &Client{\n\t\tlog: logger.Sugar(),\n\t\tconfig: config,\n\t\tauthConfig: authConf,\n\t}\n\n\tvar err error\n\tc.TokenService = &TokenService{client: c}\n\tif c.IfNeedAuth() {\n\t\tc.authConfig.JWT, err = c.TokenService.GetNew()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tc.Company = &CompanyService{client: c}\n\tc.Device = &DeviceService{client: c}\n\tc.DeviceGroup = &DeviceGroupService{client: c}\n\tc.Parameter = &ParameterService{client: c}\n\tc.User = &UserService{client: c}\n\tc.Location = &LocationService{client: c}\n\tc.Role = &RoleService{client: c}\n\tc.Subscription = &SubscriptionService{client: c}\n\tc.Manufacturer = &ManufacturerService{client: c}\n\tc.DeviceModel = &DeviceModelService{client: c}\n\tc.Event = &EventService{client: c}\n\tc.EventsSession = &EventsSessionService{client: c}\n\n\treturn c, nil\n}", "func NewClient(apiKey string) *Client {\n\treturn &Client{\n\t\tC: http.Client{\n\t\t\tTimeout: 5 * time.Second,\n\t\t},\n\t\tService: \"https://saucenao.com\",\n\t\tAPIKey: apiKey,\n\t}\n}", "func NewClient(token string) *Client {\n\treturn &Client{\n\t\tclient: &http.Client{},\n\t\ttoken: token,\n\t\tbase: githubBase,\n\t\tdry: false,\n\t}\n}", "func newClient(ctx context.Context) dockerClient {\n\t// TODO this was much easier, don't need special settings at the moment\n\t// docker, err := docker.NewClient(conf.Docker)\n\tclient, err := docker.NewClientFromEnv()\n\tif err != nil {\n\t\tlogrus.WithError(err).Fatal(\"couldn't create docker client\")\n\t}\n\n\tif err := client.Ping(); err != nil {\n\t\tlogrus.WithError(err).Fatal(\"couldn't connect to docker daemon\")\n\t}\n\n\twrap := &dockerWrap{docker: client}\n\tgo wrap.listenEventLoop(ctx)\n\treturn wrap\n}", "func New(opts ClientOptions) Client {\n\taddress := opts.Address\n\tif address == \"\" {\n\t\taddress = defaultAddress\n\t}\n\n\thttpClient := opts.HTTPClient\n\tif httpClient == nil {\n\t\thttpClient = clean.DefaultPooledClient()\n\t\thttpClient.Timeout = defaultTimeout\n\t}\n\n\tlogger := opts.Logger\n\tif logger == nil {\n\t\tlogger = loggy.Discard()\n\t}\n\n\treturn &client{\n\t\taddress: address,\n\t\ttoken: opts.Token,\n\t\thttpClient: httpClient,\n\t\tlog: logger,\n\t}\n}", "func New(opts ...Option) Client {\n\treturn newClient(opts...)\n}", "func (t *BasicAuth) Client() *http.Client {\n\treturn &http.Client{Transport: t}\n}", "func NewClient(o *Option) Client {\n\treturn &client{\n\t\to: o,\n\t}\n}", "func New(opt *Options) (*client, error) {\n\tif err := opt.init(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &client{\n\t\tappKey: opt.AppKey,\n\t\tappSecret: opt.AppSecret,\n\t\tsid: opt.SID,\n\t\tbaseURL: opt.BaseURL,\n\t\thttpClient: opt.HttpClient,\n\t}, nil\n}", "func New(key string, opts ...ClientOption) (*Client, error) {\n\tc := &Client{}\n\tfor _, opt := range opts {\n\t\tc.Lock()\n\t\tif err := opt(c); err != nil {\n\t\t\tc.Unlock()\n\t\t\treturn nil, errors.Wrap(err, \"unable to apply option\")\n\t\t}\n\t\tc.Unlock()\n\t}\n\tc.Lock()\n\tdefer c.Unlock()\n\tif c.httpClient == nil {\n\t\tc.httpClient = &http.Client{}\n\t}\n\tif c.endpoint == \"\" {\n\t\tc.endpoint = fmt.Sprintf(\"%s/%s\", baseURL, apiVersion)\n\t}\n\tif c.logger == nil {\n\t\tc.logger = log.New(os.Stdout, \"\", log.Ldate|log.Ltime|log.Lshortfile)\n\t}\n\tc.apiKey = key\n\tif c.doPing {\n\t\terr := c.Ping()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tglobalClient = c\n\treturn c, nil\n}", "func (vm *dockerVM) newClient() (*docker.Client, error) {\n\treturn newDockerClient()\n}", "func NewClient() *Reitveld {\n\treturn &Reitveld{\n\t\tclient: util.NewTimeoutClient(),\n\t}\n}", "func NewClient(authToken string) *Client {\n\tbaseURL, err := url.Parse(defaultBaseURL)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tc := &Client{\n\t\tauthToken: authToken,\n\t\tBaseURL: baseURL,\n\t\tclient: http.DefaultClient,\n\t}\n\tc.Room = &RoomService{client: c}\n\tc.User = &UserService{client: c}\n\tc.Emoticon = &EmoticonService{client: c}\n\treturn c\n}", "func NewClient() Client {\n\tclient := Client{\n\t\tBaseURL: \"https://openapi.etsy.com/v2\",\n\t\tClient: Authenticate(),\n\t}\n\treturn client\n}", "func NewClient(apiKey string) *Client {\n\treturn &Client{\n\t\thttp: &http.Client{\n\t\t\tTimeout: 30 * time.Second,\n\t\t},\n\t\tAPIKey: apiKey,\n\t}\n}", "func (c *service) Client() *ssh.Client {\n\treturn c.client\n}", "func NewClient() *Client {\n\treturn &Client{\n\t\tHTTPClient: &http.Client{\n\t\t\tTimeout: 5 * time.Minute,\n\t\t},\n\t\tbaseURL: \"https://www.purpleair.com/json\",\n\t}\n}", "func New() *Client {\n\treturn &Client{client: &http.Client{}}\n}", "func NewClient(username string, password string) *Client {\n\tbaseURL, _ := url.Parse(DefaultBaseURL)\n\tc := &Client{HTTP: &http.Client{}, BaseURL: baseURL}\n token, _ := c.GetToken(username, password)\n c.Token = token\n ActiveClient = c\n\treturn c\n}", "func getClient(url string, groupID uint) (*client.Client) {\n\t// RPC API\n\tc, err := client.Dial(url, groupID) // change to your RPC and groupID\n\tif err != nil {\n fmt.Println(\"can not dial to the RPC API, please check the config file gobcos_config.yaml: \", err)\n os.Exit(1)\n\t}\n\treturn c\n}", "func newClient(address string) (c *client, err error) {\n\tif address, err = Host(address); err != nil {\n\t\treturn\n\t}\n\tc = new(client)\n\tif c.client, err = rpc.Dial(\"tcp\", address); err != nil {\n\t\treturn nil, err\n\t}\n\tc.address = address\n\treturn\n}", "func NewClient(config Config) (Client, error) {\n\toptions := api.DefaultConfig()\n\toptions.Address = config.VaultHostname\n\toptions.HttpClient = &http.Client{\n\t\tTimeout: time.Duration(10) * time.Second,\n\t\tTransport: &http.Transport{\n\t\t\tTLSClientConfig: &tls.Config{\n\t\t\t\tInsecureSkipVerify: config.SkipTLSVerify,\n\t\t\t},\n\t\t},\n\t}\n\t// step: get the client\n\tvc, err := api.NewClient(options)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// step: attempt to login and retrieve a token\n\ttoken, err := authorizeClient(vc, config.Credentials)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvc.SetToken(token)\n\n\t// step: create a signer if required\n\tvar signer *client.AuthRemote\n\tif config.CertificateAuthority != nil {\n\t\tsig, err := auth.New(config.CertificateAuthority.Token, []byte{})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tsigner = client.NewAuthServer(config.CertificateAuthority.URL, sig)\n\t}\n\n\treturn &vaultctl{\n\t\tclient: vc,\n\t\tsigner: signer,\n\t\tconfig: &config,\n\t}, nil\n}" ]
[ "0.7644485", "0.6838326", "0.6467211", "0.6448499", "0.643614", "0.64208263", "0.6408532", "0.63571656", "0.63559824", "0.63263404", "0.63164496", "0.62924564", "0.6290828", "0.6277979", "0.6264085", "0.62581366", "0.62565917", "0.6250757", "0.6201332", "0.620133", "0.61952204", "0.6190655", "0.61897504", "0.61816525", "0.6172476", "0.61615473", "0.61497366", "0.6149141", "0.6142458", "0.6139629", "0.6133247", "0.6130151", "0.61249346", "0.6114611", "0.6112625", "0.61088806", "0.61079705", "0.61049527", "0.610264", "0.6101854", "0.60992956", "0.6099195", "0.6094497", "0.6090331", "0.6088599", "0.6086889", "0.6086889", "0.6078047", "0.60780287", "0.6075998", "0.60716796", "0.60708505", "0.607062", "0.60564524", "0.60487705", "0.60423636", "0.60373944", "0.6033942", "0.6032205", "0.6031015", "0.6030789", "0.6029491", "0.60290456", "0.6021582", "0.6021195", "0.6019285", "0.60186464", "0.60157305", "0.6013714", "0.6013459", "0.6010578", "0.60091513", "0.6004046", "0.60037756", "0.6002437", "0.6002437", "0.5997494", "0.59952563", "0.59882873", "0.59766495", "0.597581", "0.5973961", "0.59636414", "0.5962948", "0.5960011", "0.59561086", "0.59521675", "0.5951844", "0.59465176", "0.5945593", "0.59393847", "0.59391737", "0.5938041", "0.5937437", "0.59316736", "0.5928096", "0.5926263", "0.59253514", "0.5920383", "0.59200794" ]
0.72567636
1
GetVolume returns information about a volume from the DO API
func (d DobsClient) GetVolume(ctx Context, name string) (*APIVolume, error) { apiVolume, err := d.getVolumeByName(ctx, name) if err != nil { return nil, err } vol := &APIVolume{ Name: apiVolume.Name, ID: apiVolume.ID, // DropletID: apiVolume.DropletIDs[0], } return vol, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (p *Poloniex) GetVolume(ctx context.Context) (interface{}, error) {\n\tvar resp interface{}\n\tpath := \"/public?command=return24hVolume\"\n\n\treturn resp, p.SendHTTPRequest(ctx, exchange.RestSpot, path, &resp)\n}", "func (d *Data) GetVolume(v dvid.VersionID, vox *Labels, supervoxels bool, scale uint8, roiname dvid.InstanceName) ([]byte, error) {\n\tr, err := imageblk.GetROI(v, roiname, vox)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err := d.GetLabels(v, supervoxels, scale, vox, r); err != nil {\n\t\treturn nil, err\n\t}\n\treturn vox.Data(), nil\n}", "func (digitalocean DigitalOcean) GetVolume(id string) (*godo.Volume, error) {\n\tdoc, err := DigitalOceanClient()\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tvolume, _, err := doc.client.Storage.GetVolume(doc.context, id)\n\n\tif err != nil {\n\t\t//log.Fatal(err)\n\t}\n\n\treturn volume, err\n}", "func GetVolume(id string, name string) (*xmsv3.Volume, error) {\n\tvolume, err := xms.GetVolume(id, name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn volume.Content, nil\n}", "func (client VolumesClient) Get(ctx context.Context, location string, storageSubSystem string, storagePool string, volume string) (result Volume, err error) {\n\treq, err := client.GetPreparer(ctx, location, storageSubSystem, storagePool, volume)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"fabric.VolumesClient\", \"Get\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.GetSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"fabric.VolumesClient\", \"Get\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult, err = client.GetResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"fabric.VolumesClient\", \"Get\", resp, \"Failure responding to request\")\n\t}\n\n\treturn\n}", "func (api *API) GetVolume() (*Volume, error) {\n\tvar resp Volume\n\terr := api.call(\"market_history\", \"get_volume\", EmptyParams, &resp)\n\treturn &resp, err\n}", "func (d *VolumeDriver) GetVolume(name string) (map[string]interface{}, error) {\n\tvar statusMap map[string]interface{}\n\tstatusMap = make(map[string]interface{})\n\tlog.Errorf(\"VolumeDriver GetVolume to be implemented\")\n\treturn statusMap, nil\n}", "func (c *restClient) GetVolume(ctx context.Context, req *netapppb.GetVolumeRequest, opts ...gax.CallOption) (*netapppb.Volume, 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\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\topts = append((*c.CallOptions).GetVolume[0:len((*c.CallOptions).GetVolume):len((*c.CallOptions).GetVolume)], opts...)\n\tunm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}\n\tresp := &netapppb.Volume{}\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(\"GET\", 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\treturn resp, nil\n}", "func GetVolume(c common.Client, uri string) (*Volume, error) {\n\tvar volume Volume\n\treturn &volume, volume.Get(c, uri, &volume)\n}", "func (a *Client) GetVolume(params *GetVolumeParams) (*GetVolumeOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetVolumeParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"GetVolume\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/volumes/{volumeId}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &GetVolumeReader{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.(*GetVolumeOK), nil\n\n}", "func (d *DirDriver) Get(req *volume.GetRequest) (*volume.GetResponse, error) {\n\td.lock.Lock()\n\tdefer d.lock.Unlock()\n\n\tlogrus.Infof(\"Hit Get() endpoint\")\n\n\tvol, exists := d.volumes[req.Name]\n\tif !exists {\n\t\tlogrus.Debugf(\"Did not find volume %s\", req.Name)\n\t\treturn nil, fmt.Errorf(\"no volume with name %s found\", req.Name)\n\t}\n\n\tlogrus.Debugf(\"Found volume %s\", req.Name)\n\n\tresp := new(volume.GetResponse)\n\tresp.Volume = new(volume.Volume)\n\tresp.Volume.Name = vol.name\n\tresp.Volume.Mountpoint = vol.path\n\tresp.Volume.CreatedAt = vol.createTime.String()\n\n\treturn resp, nil\n}", "func (client *Client) GetVolume(id string) (*api.Volume, error) {\n\tvol, err := volumes.Get(client.Volume, id).Extract()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error getting volume: %s\", ProviderErrorToString(err))\n\t}\n\tav := api.Volume{\n\t\tID: vol.ID,\n\t\tName: vol.Name,\n\t\tSize: vol.Size,\n\t\tSpeed: client.getVolumeSpeed(vol.VolumeType),\n\t\tState: toVolumeState(vol.Status),\n\t}\n\treturn &av, nil\n}", "func (d *Device) GetVolume() (string, error) {\n\tres, err := d.send(\"Main.Volume?\")\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"get volume: %v\", err)\n\t}\n\tval, err := extractValue(res)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"get volume: %v\", err)\n\t}\n\treturn val, nil\n}", "func GetVolume(volumeID string) (*apis.ZFSVolume, error) {\n\treturn volbuilder.NewKubeclient().\n\t\tWithNamespace(OpenEBSNamespace).\n\t\tGet(volumeID, metav1.GetOptions{})\n}", "func (s *StackEbrc) GetVolume(ref string) (*abstract.Volume, fail.Error) {\n\tlogrus.Debug(\"ebrc.Client.GetVolume() called\")\n\tdefer logrus.Debug(\"ebrc.Client.GetVolume() done\")\n\n\tvar volume abstract.Volume\n\n\t_, vdc, err := s.getOrgVdc()\n\tif err != nil {\n\t\treturn nil, fail.Wrap(err, fmt.Sprintf(\"Error listing volumes\"))\n\t}\n\n\t// FIXME: Add data\n\tdr, err := vdc.QueryDisk(ref)\n\tif err == nil {\n\t\tthed, err := vdc.FindDiskByHREF(dr.Disk.HREF)\n\t\tif err == nil {\n\t\t\tvolume = abstract.Volume{\n\t\t\t\tName: thed.Disk.Name,\n\t\t\t\tSize: thed.Disk.Size,\n\t\t\t\tID: thed.Disk.Id,\n\t\t\t}\n\t\t}\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &volume, nil\n}", "func (p *EtcdClientV3) GetVolume(volName string) (*storage.VolumeExternal, error) {\n\tvolJSON, err := p.Read(config.VolumeURL + \"/\" + volName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvolExternal := &storage.VolumeExternal{}\n\terr = json.Unmarshal([]byte(volJSON), volExternal)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn volExternal, nil\n}", "func (proxy *remoteDriverProxy) Get(name string) (*remoteVolumeDesc, error) {\n\tvar req = remoteVolumeGetReq{\n\t\tName: name,\n\t}\n\n\tvar resp remoteVolumeGetResp\n\n\tif err := proxy.client.CallService(remoteVolumeGetService, &req, &resp, true); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif resp.Err != \"\" {\n\t\treturn nil, errors.New(resp.Err)\n\t}\n\n\treturn resp.Volume, nil\n}", "func (s *Stack) GetVolume(id string) (*resources.Volume, error) {\n\tif s == nil {\n\t\treturn nil, scerr.InvalidInstanceError()\n\t}\n\tif id == \"\" {\n\t\treturn nil, scerr.InvalidParameterError(\"id\", \"cannot be empty string\")\n\t}\n\n\tdefer concurrency.NewTracer(nil, fmt.Sprintf(\"(%s)\", id), true).WithStopwatch().GoingIn().OnExitTrace()()\n\n\tr := volumesv2.Get(s.VolumeClient, id)\n\tvolume, err := r.Extract()\n\tif err != nil {\n\t\tif _, ok := err.(gc.ErrDefault404); ok {\n\t\t\treturn nil, resources.ResourceNotFoundError(\"volume\", id)\n\t\t}\n\t\treturn nil, scerr.Wrap(err, fmt.Sprintf(\"error getting volume: %s\", ProviderErrorToString(err)))\n\t}\n\n\tav := resources.Volume{\n\t\tID: volume.ID,\n\t\tName: volume.Name,\n\t\tSize: volume.Size,\n\t\tSpeed: s.getVolumeSpeed(volume.VolumeType),\n\t\tState: toVolumeState(volume.Status),\n\t}\n\treturn &av, nil\n}", "func Get(c *golangsdk.ServiceClient, server_id string, volume_id string) (r GetResult) {\n\t_, r.Err = c.Get(getURL(c, server_id, volume_id), &r.Body, nil)\n\treturn\n}", "func (c *Core) GetVolume(id types.VolumeID) (*types.Volume, error) {\n\tc.lock.Lock(id.Name)\n\tdefer c.lock.Unlock(id.Name)\n\n\treturn c.getVolume(id)\n}", "func (v *VolumeService) VolumeInspect(ctx context.Context, volumeID string) (types.Volume, error) {\n\t// verify a volume was provided\n\tif len(volumeID) == 0 {\n\t\treturn types.Volume{}, errors.New(\"no volume provided\")\n\t}\n\n\t// check if the volume is notfound\n\tif strings.Contains(volumeID, \"notfound\") {\n\t\treturn types.Volume{},\n\t\t\t// nolint:golint,stylecheck // messsage is capitalized to match Docker messages\n\t\t\terrdefs.NotFound(fmt.Errorf(\"Error: No such volume: %s\", volumeID))\n\t}\n\n\t// check if the volume is not-found\n\tif strings.Contains(volumeID, \"not-found\") {\n\t\treturn types.Volume{},\n\t\t\t// nolint:golint,stylecheck // messsage is capitalized to match Docker messages\n\t\t\terrdefs.NotFound(fmt.Errorf(\"Error: No such volume: %s\", volumeID))\n\t}\n\n\t// create response object to return\n\tresponse := types.Volume{\n\t\tCreatedAt: time.Now().String(),\n\t\tDriver: \"local\",\n\t\tMountpoint: fmt.Sprintf(\"/var/lib/docker/volumes/%s/_data\", stringid.GenerateRandomID()),\n\t\tName: volumeID,\n\t\tScope: \"local\",\n\t}\n\n\treturn response, nil\n}", "func (srv *VolumeService) Get(ref string) (*api.Volume, error) {\n\tvolumes, err := srv.List()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, volume := range volumes {\n\t\tif volume.ID == ref || volume.Name == ref {\n\t\t\treturn &volume, nil\n\t\t}\n\t}\n\treturn nil, fmt.Errorf(\"Volume '%s' does not exists\", ref)\n}", "func (c *clustermgrClient) GetVolumeInfo(ctx context.Context, vid proto.Vid) (*VolumeInfoSimple, error) {\n\tc.rwLock.RLock()\n\tdefer c.rwLock.RUnlock()\n\n\tspan := trace.SpanFromContextSafe(ctx)\n\n\tinfo, err := c.client.GetVolumeInfo(ctx, &cmapi.GetVolumeArgs{Vid: vid})\n\tif err != nil {\n\t\tspan.Errorf(\"get volume info failed: err[%+v]\", err)\n\t\treturn nil, err\n\t}\n\tret := &VolumeInfoSimple{}\n\tret.set(info)\n\treturn ret, nil\n}", "func (d *driverInfo) Get(name string) (*Volume, error) {\n\tvol, exists := d.volumes[name]\n\tif !exists {\n\t\treturn nil, fmt.Errorf(\"volume '%s' not found\", name)\n\t}\n\n\treturn vol, nil\n}", "func (cli *Client) VolumeInspect(ctx context.Context, volumeID string) (types.Volume, error) {\n\tvar volume types.Volume\n\tresp, err := cli.get(ctx, \"/volumes/\"+volumeID, nil, nil)\n\tif err != nil {\n\t\tif resp.statusCode == http.StatusNotFound {\n\t\t\treturn volume, volumeNotFoundError{volumeID}\n\t\t}\n\t\treturn volume, err\n\t}\n\terr = json.NewDecoder(resp.body).Decode(&volume)\n\tensureReaderClosed(resp)\n\treturn volume, err\n}", "func (v *KubernetesVolume) GetVolume(name string) (corev1.Volume, error) {\n\tvolume := corev1.Volume{\n\t\tName: name,\n\t}\n\tif v.HostPathLegacy != nil {\n\t\treturn volume, errors.New(\"legacy host_path field is not supported anymore, please migrate to hostPath\")\n\t}\n\tif v.HostPath != nil {\n\t\tvolume.VolumeSource = corev1.VolumeSource{\n\t\t\tHostPath: v.HostPath,\n\t\t}\n\t\treturn volume, nil\n\t} else if v.EmptyDir != nil {\n\t\tvolume.VolumeSource = corev1.VolumeSource{\n\t\t\tEmptyDir: v.EmptyDir,\n\t\t}\n\t\treturn volume, nil\n\t} else if v.PersistentVolumeClaim != nil {\n\t\tvolume.VolumeSource = corev1.VolumeSource{\n\t\t\tPersistentVolumeClaim: &v.PersistentVolumeClaim.PersistentVolumeSource,\n\t\t}\n\t\treturn volume, nil\n\t}\n\t// return a default emptydir volume if none configured\n\tvolume.VolumeSource = corev1.VolumeSource{\n\t\tEmptyDir: &corev1.EmptyDirVolumeSource{},\n\t}\n\treturn volume, nil\n}", "func (c *Client) VolumeInspect(instanceID string) (reply *types.Volume, err error) {\n\turl := fmt.Sprintf(\"/admin/volumes/%s\", instanceID)\n\tif _, err = c.httpGet(url, &reply); err != nil {\n\t\treturn nil, err\n\t}\n\treturn reply, nil\n}", "func (c *Client) Volume() (float64, error) {\n\treturn c.GetFloatProperty(\"volume\")\n}", "func (m *ProviderTerms) GetVolume() int64 {\n\tif m.Volume == 0 {\n\t\tmbps := (m.QoS.UploadMbps + m.QoS.DownloadMbps) / octet // mega bytes per second\n\t\tduration := float32(m.ExpiredAt - time.Now()) // duration in seconds\n\t\t// rounded of bytes per second multiplied by duration in seconds\n\t\tm.Volume = int64(mbps * duration)\n\t}\n\n\treturn m.Volume\n}", "func (vs *volumeSet) getVolume(id string) *api.Volume {\n\treturn vs.volumes[id].volume\n}", "func (s *DataStore) GetVolume(name string) (*longhorn.Volume, error) {\n\tresultRO, err := s.vLister.Volumes(s.namespace).Get(name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Cannot use cached object from lister\n\treturn resultRO.DeepCopy(), nil\n}", "func (k *KubeClient) GetVolume(ctx context.Context, nodeName string, driverName string) (map[string]struct{}, error) {\n\tpodList, err := k.getPods(ctx, nodeName)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to retrieve pod list. %s\", err)\n\t}\n\t// get PVC list\n\tpvcList := make(map[string]struct{}, 0)\n\n\tfor _, pod := range podList.Items {\n\t\t// If a pod is being terminating, skip the pod.\n\t\tlog.AddContext(ctx).Infof(\"Get pod [%s], pod.DeletionTimestamp: [%v].\", pod.Name, pod.DeletionTimestamp)\n\t\tif pod.DeletionTimestamp != nil {\n\t\t\tlog.AddContext(ctx).Infof(\"Pod [%s] is terminating, skip it.\", pod.Name)\n\t\t\tcontinue\n\t\t}\n\t\tfor _, volume := range pod.Spec.Volumes {\n\t\t\tif volume.PersistentVolumeClaim != nil {\n\t\t\t\tpvcList[volume.PersistentVolumeClaim.ClaimName+\"@\"+pod.Namespace] = struct{}{}\n\t\t\t}\n\t\t}\n\t}\n\tk8sVolumeHandles := make(map[string]struct{})\n\terrChan := make(chan error)\n\tpvChan := make(chan *corev1.PersistentVolume)\n\n\tdefer func() {\n\t\tclose(errChan)\n\t\tclose(pvChan)\n\t}()\n\t// aggregate all volume information\n\tfor claimName := range pvcList {\n\t\tpvcInfo := strings.Split(claimName, \"@\")\n\t\tif len(pvcInfo) <= 1 {\n\t\t\tlog.AddContext(ctx).Errorf(\"The length of pvcInfo: [%d] is less than 2\", len(pvcInfo))\n\t\t\tcontinue\n\t\t}\n\t\tgo func(claimName string, namespace string,\n\t\t\tvolChan chan<- *corev1.PersistentVolume,\n\t\t\terrorChan chan<- error) {\n\t\t\tvol, err := k.getPVByPVCName(ctx, namespace, claimName)\n\t\t\tif err != nil {\n\t\t\t\terrorChan <- err\n\t\t\t\treturn\n\t\t\t}\n\t\t\tvolChan <- vol\n\t\t}(pvcInfo[0], pvcInfo[1], pvChan, errChan)\n\t}\n\tvar volumeError error\n\tfor i := 0; i < len(pvcList); i++ {\n\t\tselect {\n\t\tcase err := <-errChan:\n\t\t\tvolumeError = err\n\t\tcase volume := <-pvChan:\n\t\t\tif volume.Spec.PersistentVolumeSource.CSI != nil &&\n\t\t\t\tdriverName == volume.Spec.PersistentVolumeSource.CSI.Driver {\n\t\t\t\tk8sVolumeHandles[volume.Spec.PersistentVolumeSource.CSI.VolumeHandle] = struct{}{}\n\t\t\t}\n\t\t}\n\t}\n\tif volumeError != nil {\n\t\treturn nil, volumeError\n\t}\n\tlog.AddContext(ctx).Infof(\"PV list from k8s side for the node %s: %v\", nodeName, k8sVolumeHandles)\n\treturn k8sVolumeHandles, nil\n}", "func (p *VolumePlugin) GetVolume(req *volume.GetRequest) (*volume.Volume, error) {\n\tif req == nil {\n\t\treturn nil, fmt.Errorf(\"must provide non-nil request to GetVolume: %w\", define.ErrInvalidArg)\n\t}\n\n\tif err := p.verifyReachable(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tlogrus.Infof(\"Getting volume %s using plugin %s\", req.Name, p.Name)\n\n\tresp, err := p.sendRequest(req, getPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tif err := p.handleErrorResponse(resp, getPath, req.Name); err != nil {\n\t\treturn nil, err\n\t}\n\n\tgetRespBytes, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"reading response body from volume plugin %s: %w\", p.Name, err)\n\t}\n\n\tgetResp := new(volume.GetResponse)\n\tif err := json.Unmarshal(getRespBytes, getResp); err != nil {\n\t\treturn nil, fmt.Errorf(\"unmarshalling volume plugin %s get response: %w\", p.Name, err)\n\t}\n\n\treturn getResp.Volume, nil\n}", "func (c *VolumeCache) GetVolume(vid proto.Vid) (*client.VolumeInfoSimple, error) {\n\tif vol, ok := c.cache.Get(vid); ok {\n\t\treturn vol, nil\n\t}\n\n\tvol, err := c.UpdateVolume(vid)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn vol, nil\n}", "func GetVolDetails(volName string, obj interface{}) error {\n\taddr := os.Getenv(\"MAPI_ADDR\")\n\tif addr == \"\" {\n\t\terr := util.MAPIADDRNotSet\n\t\tfmt.Printf(\"error getting env variable: %v\", err)\n\t\treturn err\n\t}\n\n\turl := addr + \"/latest/volumes/info/\" + volName\n\tclient := &http.Client{\n\t\tTimeout: timeout,\n\t}\n\tresp, err := client.Get(url)\n\n\tif err != nil {\n\t\tfmt.Printf(\"Could not get response, found error: %v\", err)\n\t\treturn err\n\t}\n\n\tif resp != nil {\n\t\tif resp.StatusCode == 500 {\n\t\t\tfmt.Printf(\"Volume: %s not found at M_API server\\n\", volName)\n\t\t\treturn errors.New(\"Internal Server Error\")\n\t\t} else if resp.StatusCode == 503 {\n\t\t\tfmt.Println(\"M_API server not reachable\")\n\t\t\treturn errors.New(\"Service Unavailable\")\n\t\t} else if resp.StatusCode == 404 {\n\t\t\tfmt.Printf(\"Volume: %s not found at M_API server\\n\", volName)\n\t\t\treturn errors.New(\"Page Not Found\")\n\t\t}\n\n\t} else {\n\t\tfmt.Println(\"M_API server not reachable\")\n\t\treturn err\n\t}\n\n\tdefer resp.Body.Close()\n\treturn json.NewDecoder(resp.Body).Decode(obj)\n}", "func GetVolumesV2() (VolumeV2, error) {\n\tvar volumes VolumeV2\n\tquery := \"/api/datacenter/storage/volume\"\n\tbodyText, err := getResponseBody(query)\n\tif err != nil {\n\t\treturn VolumeV2{}, err\n\t}\n\terr = json.Unmarshal(bodyText, &volumes)\n\tif err != nil {\n\t\tlog.Printf(\"verita-core: Error: %v\", err)\n\t\treturn volumes, err\n\t}\n\treturn volumes, nil\n}", "func (client VolumesClient) GetResponder(resp *http.Response) (result Volume, 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}", "func (v *VolumesServiceMock) Get(podUID string, name string) (vol *api.Volume, err error) {\n\targs := v.Called(podUID, name)\n\tx := args.Get(0)\n\tif x != nil {\n\t\tvol = x.(*api.Volume)\n\t}\n\terr = args.Error(1)\n\treturn\n}", "func (d *MinioDriver) Get(r volume.Request) volume.Response {\n\td.m.Lock()\n\tdefer d.m.Unlock()\n\n\tv, exists := d.volumes[r.Name]\n\tif !exists {\n\t\treturn volumeResp(\"\", \"\", nil, capability, newErrVolNotFound(r.Name).Error())\n\t}\n\n\treturn volumeResp(v.mountpoint, r.Name, nil, capability, \"\")\n}", "func (s *VolumeStore) Get(name string) (volume.Volume, error) {\n\tname = normaliseVolumeName(name)\n\ts.locks.Lock(name)\n\tdefer s.locks.Unlock(name)\n\n\tv, err := s.getVolume(name)\n\tif err != nil {\n\t\treturn nil, &OpErr{Err: err, Name: name, Op: \"get\"}\n\t}\n\ts.setNamed(v, \"\")\n\treturn v, nil\n}", "func (d *VolumeDriver) Get(r volume.Request) volume.Response {\n\tlog.Errorf(\"VolumeDriver Get to be implemented\")\n\treturn volume.Response{Err: \"\"}\n}", "func (p *Plugin) GetVolumeInfo(volumeID, volumeAZ string) (string, *int64, error) {\n\treturn p.plugin.GetVolumeInfo(volumeID, volumeAZ)\n}", "func (s *BoltState) Volume(name string) (*Volume, error) {\n\tif name == \"\" {\n\t\treturn nil, define.ErrEmptyID\n\t}\n\n\tif !s.valid {\n\t\treturn nil, define.ErrDBClosed\n\t}\n\n\tvolName := []byte(name)\n\n\tvolume := new(Volume)\n\tvolume.config = new(VolumeConfig)\n\tvolume.state = new(VolumeState)\n\n\tdb, err := s.getDBCon()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer s.deferredCloseDBCon(db)\n\n\terr = db.View(func(tx *bolt.Tx) error {\n\t\tvolBkt, err := getVolBucket(tx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn s.getVolumeFromDB(volName, volume, volBkt)\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn volume, nil\n}", "func (v *VolumeManager) GetVolume(name string) *Volume {\n\tv.mutex.Lock()\n\tdefer v.mutex.Unlock()\n\treturn v.volumes[name]\n}", "func (r *Root) Get(name string) (volume.Volume, error) {\n\tr.m.Lock()\n\tv, exists := r.volumes[name]\n\tr.m.Unlock()\n\tif !exists {\n\t\treturn nil, fmt.Errorf(\"volume not found\")\n\n\t}\n\treturn v, nil\n}", "func Get(d Driver, vName string) (Volume, Mount, error) {\n\tlog.Debugf(\"Entering Get: name: %s\", vName)\n\td.GetLock().RLock()\n\tdefer d.GetLock().RUnlock()\n\treturn getVolumeMount(d, vName)\n}", "func (a *HyperflexApiService) GetHyperflexVolumeByMoid(ctx context.Context, moid string) ApiGetHyperflexVolumeByMoidRequest {\n\treturn ApiGetHyperflexVolumeByMoidRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tmoid: moid,\n\t}\n}", "func (c *Client) GetVolume(ctx context.Context, req *netapppb.GetVolumeRequest, opts ...gax.CallOption) (*netapppb.Volume, error) {\n\treturn c.internalClient.GetVolume(ctx, req, opts...)\n}", "func (cl *Client) gceVolumeGet(ctx context.Context, name string) (*csp.Volume, error) {\n\tdisk, err := cl.computeService.Disks().Get(cl.projectID, cl.attrs[AttrZone].Value, name).Context(ctx).Do()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn gceDiskToVolume(disk), nil\n}", "func GetVolumeStats(address string, obj interface{}) (error, int) {\n\tcontroller, err := NewControllerClient(address)\n\tif err != nil {\n\t\treturn err, -1\n\t}\n\turl := controller.address + \"/stats\"\n\tresp, err := controller.httpClient.Get(url)\n\tif resp != nil {\n\t\tif resp.StatusCode == 500 {\n\t\t\treturn err, 500\n\t\t} else if resp.StatusCode == 503 {\n\t\t\treturn err, 503\n\t\t}\n\t} else {\n\t\treturn err, -1\n\t}\n\tif err != nil {\n\t\treturn err, -1\n\t}\n\tdefer resp.Body.Close()\n\trc := json.NewDecoder(resp.Body).Decode(obj)\n\treturn rc, 0\n}", "func GetVolInfo(name string) (int32, *vp.GetVolInfoAck) {\n\n\t_, conn, err := utils.DialVolMgr(VolMgrHosts)\n\tif err != nil {\n\t\tlogger.Error(\"GetVolInfo failed,Dial to VolMgrHosts fail :%v\", err)\n\t\treturn -1, nil\n\t}\n\tdefer conn.Close()\n\tvc := vp.NewVolMgrClient(conn)\n\n\tpGetVolInfoReq := &vp.GetVolInfoReq{\n\t\tUUID: name,\n\t}\n\tctx, _ := context.WithTimeout(context.Background(), VOLUME_TIMEOUT_SECONDS*time.Second)\n\tack, err := vc.GetVolInfo(ctx, pGetVolInfoReq)\n\tif err != nil || ack.Ret != 0 {\n\t\treturn -1, &vp.GetVolInfoAck{}\n\t}\n\treturn 0, ack\n}", "func GetVolumeV2(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *VolumeV2State, opts ...pulumi.ResourceOption) (*VolumeV2, error) {\n\tvar resource VolumeV2\n\terr := ctx.ReadResource(\"openstack:blockstorage/volumeV2:VolumeV2\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func GetVolumeInfo(awsSession *session.Session, targets []string) (info []VolInfo, err error) {\n\tclient := ec2.New(awsSession)\n\tinfo = make([]VolInfo, 0)\n\n\tfilters := make([]*ec2.Filter, 0)\n\n\tparams := &ec2.DescribeVolumesInput{}\n\n\t// process targets and massage them into aws type variables\n\tif targets != nil {\n\t\tawsnames := make([]*string, 0)\n\n\t\tfor _, name := range targets {\n\t\t\tawsnames = append(awsnames, aws.String(name))\n\t\t}\n\n\t\tnameFilter := ec2.Filter{\n\t\t\tName: aws.String(\"attachment.instance-id\"),\n\t\t\tValues: awsnames,\n\t\t}\n\n\t\tfilters = append(filters, &nameFilter)\n\t}\n\n\t// add the filters if they exist\n\tif len(filters) > 0 {\n\t\tparams.Filters = filters\n\t}\n\n\t// actually call aws for volume information\n\tresult, err := client.DescribeVolumes(params)\n\tif err != nil {\n\t\tif aerr, ok := err.(awserr.Error); ok {\n\t\t\tswitch aerr.Code() {\n\t\t\tdefault:\n\t\t\t\terr = errors.Wrapf(aerr, \"error searching volumes\")\n\t\t\t\treturn info, err\n\t\t\t}\n\t\t} else {\n\t\t\terr = errors.Wrapf(err, \"error searching volumes\")\n\t\t\treturn info, err\n\t\t}\n\t}\n\n\t// loop through the resulting info, and set up the info we need\n\tfor _, vol := range result.Volumes {\n\t\tinstanceId := *vol.Attachments[0].InstanceId\n\t\tdeviceName := *vol.Attachments[0].Device\n\n\t\ti := VolInfo{\n\t\t\tInstanceId: instanceId,\n\t\t\tDeviceName: deviceName,\n\t\t\tVolumeId: *vol.VolumeId,\n\t\t}\n\n\t\tinfo = append(info, i)\n\t}\n\n\treturn info, err\n}", "func (d *driver) GetVolumeInfo(name string) (*csi.VolumeInfo, error) {\n\ttd, ok := d.client.Storage().(apitypes.StorageDriverVolInspectByName)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\n\t\t\t\"stor driver not by name: %T\", d.client.Storage())\n\t}\n\n\topts := &apitypes.VolumeInspectOpts{\n\t\tOpts: apiutils.NewStore(),\n\t}\n\n\tvol, err := td.VolumeInspectByName(d.ctx, name, opts)\n\tif err != nil {\n\n\t\t// If the volume is not found then return nil for the\n\t\t// volume info to indicate such.\n\t\tif isNotFoundErr(err) {\n\t\t\treturn nil, nil\n\t\t}\n\n\t\treturn nil, err\n\t}\n\n\treturn toVolumeInfo(vol), nil\n}", "func GetVolumeProperties(volumeName, hostName string) (string, error) {\n\tlog.Printf(\"Getting size, disk-format and attached-to-vm for volume [%s] from vm [%s] using docker cli \\n\", volumeName, hostName)\n\tcmd := dockercli.InspectVolume + volumeName + \" --format ' {{index .Status.capacity.size}} {{index .Status.diskformat}} {{index .Status \\\"attached to VM\\\"}}' | sed -e 's/<no value>/detached/' \"\n\treturn ssh.InvokeCommand(hostName, cmd)\n}", "func GetVolumeProperties(volumeName, hostName string) (string, error) {\n\tlog.Printf(\"Getting size, disk-format and attached-to-vm for volume [%s] from vm [%s] using docker cli \\n\", volumeName, hostName)\n\tcmd := dockercli.InspectVolume + volumeName + \" --format ' {{index .Status.capacity.size}} {{index .Status.diskformat}} {{index .Status \\\"attached to VM\\\"}}' | sed -e 's/<no value>/detached/' \"\n\treturn ssh.InvokeCommand(hostName, cmd)\n}", "func (objectSet *VolumeObjectSet) GetObject(id string) (*model.Volume, error) {\r\n\tresponse, err := objectSet.Client.Get(volumePath, id, model.Volume{})\r\n\tif response == nil {\r\n\t\treturn nil, err\r\n\t}\r\n\treturn response.(*model.Volume), err\r\n}", "func (b *Poloniex) GetVolumes() (vc VolumeCollection, err error) {\n\tr, err := b.client.do(\"GET\", \"public?command=return24hVolume\", nil, false)\n\tif err != nil {\n\t\treturn\n\t}\n\tif err = json.Unmarshal(r, &vc); err != nil {\n\t\treturn\n\t}\n\treturn\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 (c *Client) Volume() uint8 {\n\tc.Lock()\n\tdefer c.Unlock()\n\treturn c.volume\n}", "func (c *Client) Volumes() (reply []*types.Volume, err error) {\n\turl := fmt.Sprintf(\"/admin/volumes\")\n\tif _, err = c.httpGet(url, &reply); err != nil {\n\t\treturn nil, err\n\t}\n\treturn reply, nil\n}", "func (o *QtreeCreateRequest) Volume() string {\n\tvar r string\n\tif o.VolumePtr == nil {\n\t\treturn r\n\t}\n\tr = *o.VolumePtr\n\treturn r\n}", "func volumeToAPIType(v volume.Volume) *types.Volume {\n\treturn &types.Volume{\n\t\tName: v.Name(),\n\t\tDriver: v.DriverName(),\n\t\tMountpoint: v.Path(),\n\t}\n}", "func (c *Core) getVolume(id types.VolumeID) (*types.Volume, error) {\n\tctx := driver.Contexts()\n\n\t// first, try to get volume from local store.\n\tobj, err := c.store.Get(id.Name)\n\tif err == nil {\n\t\tv, ok := obj.(*types.Volume)\n\t\tif !ok {\n\t\t\treturn nil, volerr.ErrVolumeNotFound\n\t\t}\n\n\t\t// get the volume driver.\n\t\tdv, err := driver.Get(v.Spec.Backend)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// if the driver implements Getter interface.\n\t\tif d, ok := dv.(driver.Getter); ok {\n\t\t\tcurV, err := d.Get(ctx, id.Name)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, volerr.ErrVolumeNotFound\n\t\t\t}\n\n\t\t\tv.Status.MountPoint = curV.Status.MountPoint\n\t\t}\n\n\t\treturn v, nil\n\t}\n\n\tif err != metastore.ErrObjectNotFound {\n\t\treturn nil, err\n\t}\n\n\t// scan all drivers\n\tlogrus.Debugf(\"probing all drivers for volume with name(%s)\", id.Name)\n\tdrivers, err := driver.GetAll()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, dv := range drivers {\n\t\td, ok := dv.(driver.Getter)\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\n\t\tv, err := d.Get(ctx, id.Name)\n\t\tif err != nil {\n\t\t\t// not found, ignore it\n\t\t\tcontinue\n\t\t}\n\n\t\t// store volume meta\n\t\tif err := c.store.Put(v); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn v, nil\n\t}\n\n\treturn nil, volerr.ErrVolumeNotFound\n}", "func (s *SnapshotsServiceOp) ListVolume(opt *ListOptions) ([]Snapshot, *Response, error) {\n\tlistOpt := listSnapshotOptions{ResourceType: \"volume\"}\n\treturn s.list(opt, &listOpt)\n}", "func (s *SnapshotsServiceOp) ListVolume(ctx context.Context, opt *ListOptions) ([]Snapshot, *Response, error) {\n\tlistOpt := listSnapshotOptions{ResourceType: \"volume\"}\n\treturn s.list(ctx, opt, &listOpt)\n}", "func (s *persistentVolumeLister) Get(name string) (*corev1.PersistentVolume, error) {\n\treturn s.client.CoreV1().PersistentVolumes().Get(name, metav1.GetOptions{})\n}", "func GetVolumeStatus(hostName, volumeName string) (map[string]string, error) {\n\tformatStr1 := \" --format '{{index .Status.access}} {{index .Status \\\"attach-as\\\"}} {{index .Status.capacity.allocated}} {{index .Status.capacity.size}} {{index .Status \\\"clone-from\\\"}}\"\n\tformatStr2 := \" {{index .Status \\\"created by VM\\\"}} {{index .Status.datastore}} {{index .Status.diskformat}} {{index .Status.fstype}} {{index .Status.status}} {{index .Status \\\"attached to VM\\\"}}'\"\n\n\tcmd := dockercli.InspectVolume + volumeName + formatStr1 + formatStr2\n\tout, err := ssh.InvokeCommand(hostName, cmd)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tstatus := make(map[string]string)\n\tval := strings.Fields(out)\n\n\tfor i := 0; i < len(dockercli.VolumeStatusFields); i++ {\n\t\tstatus[dockercli.VolumeStatusFields[i]] = val[i]\n\t}\n\treturn status, nil\n}", "func (c *Client) Volume(guildID string, volume int) error {\n\ttype body struct {\n\t\tOP op `json:\"op\"`\n\t\tGuildID string `json:\"guildId\"`\n\t\tVolume int `json:\"volume\"`\n\t}\n\n\treturn c.send(body{\n\t\tOP: opVolume,\n\t\tGuildID: guildID,\n\t\tVolume: volume,\n\t})\n}", "func (v *VolumeService) VolumeCreate(ctx context.Context, options volume.VolumeCreateBody) (types.Volume, error) {\n\t// verify a volume was provided\n\tif len(options.Name) == 0 {\n\t\treturn types.Volume{}, errors.New(\"no volume provided\")\n\t}\n\n\t// check if the volume is notfound and\n\t// check if the notfound should be ignored\n\tif strings.Contains(options.Name, \"notfound\") &&\n\t\t!strings.Contains(options.Name, \"ignorenotfound\") {\n\t\treturn types.Volume{},\n\t\t\t// nolint:golint,stylecheck // messsage is capitalized to match Docker messages\n\t\t\terrdefs.NotFound(fmt.Errorf(\"Error: No such volume: %s\", options.Name))\n\t}\n\n\t// check if the volume is not-found and\n\t// check if the not-found should be ignored\n\tif strings.Contains(options.Name, \"not-found\") &&\n\t\t!strings.Contains(options.Name, \"ignore-not-found\") {\n\t\treturn types.Volume{},\n\t\t\t// nolint:golint,stylecheck // messsage is capitalized to match Docker messages\n\t\t\terrdefs.NotFound(fmt.Errorf(\"Error: No such volume: %s\", options.Name))\n\t}\n\n\t// create response object to return\n\tresponse := types.Volume{\n\t\tCreatedAt: time.Now().String(),\n\t\tDriver: options.Driver,\n\t\tLabels: options.Labels,\n\t\tMountpoint: fmt.Sprintf(\"/var/lib/docker/volumes/%s/_data\", stringid.GenerateRandomID()),\n\t\tName: options.Name,\n\t\tOptions: options.DriverOpts,\n\t\tScope: \"local\",\n\t}\n\n\treturn response, nil\n}", "func (c *Controller) GetVolumeName(getVolumeNameRequest k8sresources.FlexVolumeGetVolumeNameRequest) k8sresources.FlexVolumeResponse {\n\tc.logger.Println(\"controller-isAttached-start\")\n\tdefer c.logger.Println(\"controller-isAttached-end\")\n\n\treturn k8sresources.FlexVolumeResponse{\n\t\tStatus: \"Not supported\",\n\t}\n}", "func GetCurrentVolume() (string, error) {\n\tout, err := Mpc(\"volume\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tvolume := strings.ReplaceAll(string(out), \"volume:\", \"\")\n\n\treturn volume, nil\n}", "func (s *JSONStore) Get(id string) (NanosVolume, error) {\n\tvar vol NanosVolume\n\tf, err := os.Open(s.path)\n\tif err != nil {\n\t\treturn vol, err\n\t}\n\tdefer f.Close()\n\tdec := json.NewDecoder(f)\n\tfor {\n\t\terr = dec.Decode(&vol)\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\treturn vol, err\n\t\t}\n\t\tif vol.ID == id {\n\t\t\treturn vol, nil\n\t\t}\n\t}\n\treturn vol, ErrVolumeNotFound(id)\n}", "func (s *OsdCsiServer) ControllerGetVolume(\n\tctx context.Context,\n\treq *csi.ControllerGetVolumeRequest,\n) (*csi.ControllerGetVolumeResponse, error) {\n\n\tclogger.WithContext(ctx).Tracef(\"ControllerGetVolume request received. VolumeID: %s\", req.GetVolumeId())\n\n\tvol, err := s.driverGetVolume(ctx, req.GetVolumeId())\n\tif err != nil {\n\t\tif s, ok := status.FromError(err); ok && s.Code() == codes.NotFound {\n\t\t\treturn &csi.ControllerGetVolumeResponse{\n\t\t\t\tVolume: &csi.Volume{\n\t\t\t\t\tVolumeId: req.GetVolumeId(),\n\t\t\t\t},\n\t\t\t\tStatus: &csi.ControllerGetVolumeResponse_VolumeStatus{\n\t\t\t\t\tVolumeCondition: &csi.VolumeCondition{\n\t\t\t\t\t\tAbnormal: true,\n\t\t\t\t\t\tMessage: fmt.Sprintf(\"Volume ID %s not found\", req.GetVolumeId()),\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}, nil\n\t\t}\n\t\treturn nil, err\n\t}\n\n\treturn &csi.ControllerGetVolumeResponse{\n\t\tVolume: &csi.Volume{\n\t\t\tCapacityBytes: int64(vol.Spec.Size),\n\t\t\tVolumeId: vol.Id,\n\t\t},\n\t\tStatus: &csi.ControllerGetVolumeResponse_VolumeStatus{\n\t\t\tVolumeCondition: getVolumeCondition(vol),\n\t\t},\n\t}, nil\n}", "func Inspect(ctx context.Context, nameOrID string) (*libpod.InspectVolumeData, error) {\n\tvar (\n\t\tinspect libpod.InspectVolumeData\n\t)\n\tconn, err := bindings.GetClient(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresponse, err := conn.DoRequest(nil, http.MethodPost, \"/volumes/%s/json\", nil, nameOrID)\n\tif err != nil {\n\t\treturn &inspect, err\n\t}\n\treturn &inspect, response.Process(&inspect)\n}", "func (v *VolumeService) VolumeInspectWithRaw(ctx context.Context, volumeID string) (types.Volume, []byte, error) {\n\t// verify a volume was provided\n\tif len(volumeID) == 0 {\n\t\treturn types.Volume{}, nil, errors.New(\"no volume provided\")\n\t}\n\n\t// check if the volume is notfound\n\tif strings.Contains(volumeID, \"notfound\") {\n\t\treturn types.Volume{}, nil,\n\t\t\t// nolint:golint,stylecheck // messsage is capitalized to match Docker messages\n\t\t\terrdefs.NotFound(fmt.Errorf(\"Error: No such volume: %s\", volumeID))\n\t}\n\n\t// check if the volume is not-found\n\tif strings.Contains(volumeID, \"not-found\") {\n\t\treturn types.Volume{}, nil,\n\t\t\t// nolint:golint,stylecheck // messsage is capitalized to match Docker messages\n\t\t\terrdefs.NotFound(fmt.Errorf(\"Error: No such volume: %s\", volumeID))\n\t}\n\n\t// create response object to return\n\tresponse := types.Volume{\n\t\tCreatedAt: time.Now().String(),\n\t\tDriver: \"local\",\n\t\tMountpoint: fmt.Sprintf(\"/var/lib/docker/volumes/%s/_data\", stringid.GenerateRandomID()),\n\t\tName: volumeID,\n\t\tScope: \"local\",\n\t}\n\n\t// marshal response into raw bytes\n\tb, err := json.Marshal(response)\n\tif err != nil {\n\t\treturn types.Volume{}, nil, err\n\t}\n\n\treturn response, b, nil\n}", "func (s *JSONStore) Get(id string) (NanosVolume, error) {\n\tvar vol NanosVolume\n\tf, err := os.Open(s.path)\n\tif err != nil {\n\t\treturn vol, err\n\t}\n\tdefer f.Close()\n\tdec := json.NewDecoder(f)\n\tfor {\n\t\terr = dec.Decode(&vol)\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\treturn vol, err\n\t\t}\n\t\tif vol.ID == id {\n\t\t\treturn vol, nil\n\t\t}\n\t}\n\treturn vol, errVolumeNotFound(id)\n}", "func (c Investigate) DomainVolume(domain string, opts QueryOptions) (Volume, error) {\n\tu := &url.URL{\n\t\tPath: fmt.Sprintf(\"domains/volume/%s\", domain),\n\t\tRawQuery: url.Values(opts).Encode(),\n\t}\n\tvar out Volume\n\terr := c.Get(c.BaseURL.ResolveReference(u).String(), &out)\n\treturn out, err\n}", "func ReadFromVolume(ctx context.Context,\n\tcl kubernetes.Interface, config *rest.Config, namespace string) (string, error) {\n\tout, _, err := testutils.ExecCmd(config, cl, fmt.Sprintf(\"%s-0\", StatefulSetName), namespace,\n\t\t\"cat /usr/share/nginx/html/index.html\")\n\treturn out, err\n}", "func (r *vdm) Get(volumeName string) (VolumeMap, error) {\n\tfor _, d := range r.drivers {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"moduleName\": r.rexray.Context,\n\t\t\t\"driverName\": d.Name(),\n\t\t\t\"volumeName\": volumeName}).Info(\"vdm.Get\")\n\n\t\treturn d.Get(volumeName)\n\t}\n\treturn nil, errors.ErrNoVolumesDetected\n}", "func List(d Driver) (*volume.ListResponse, error) {\n\tlog.Debugf(\"Entering List\")\n\td.GetLock().Lock()\n\tdefer d.GetLock().Unlock()\n\tvar vols []*volume.Volume\n\tfor name, v := range d.GetVolumes() {\n\t\tlog.Debugf(\"Volume found: %s\", v)\n\t\tm, err := getMount(d, v.GetMount())\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tvols = append(vols, &volume.Volume{Name: name, Status: v.GetStatus(), Mountpoint: m.GetPath()})\n\t}\n\treturn &volume.ListResponse{Volumes: vols}, nil\n}", "func readVolume(devicebytes []byte, keyBlock uint16, debug int) (Volume, error) {\n\tv := Volume{\n\t\tkeyBlock: &VolumeDirectoryKeyBlock{},\n\t\tsubdirsByBlock: make(map[uint16]*Subdirectory),\n\t\tsubdirsByName: make(map[string]*Subdirectory),\n\t\tfirstSubdirBlocks: make(map[uint16]uint16),\n\t}\n\n\tif err := disk.UnmarshalBlock(devicebytes, v.keyBlock, keyBlock); err != nil {\n\t\treturn v, fmt.Errorf(\"cannot read first block of volume directory (block %d): %v\", keyBlock, err)\n\t}\n\t// if debug {\n\t// \tfmt.Fprintf(os.Stderr, \"keyblock: %#v\\n\", v.keyBlock)\n\t// }\n\n\tvbm, err := readVolumeBitMap(devicebytes, v.keyBlock.Header.BitMapPointer)\n\tif err != nil {\n\t\treturn v, err\n\t}\n\n\tv.bitmap = &vbm\n\n\t// if debug {\n\t// \tfmt.Fprintf(os.Stderr, \"volume bitmap: %#v\\n\", v.bitmap)\n\t// }\n\n\tfor block := v.keyBlock.Next; block != 0; block = v.blocks[len(v.blocks)-1].Next {\n\t\tvdb := VolumeDirectoryBlock{}\n\t\tif err := disk.UnmarshalBlock(devicebytes, &vdb, block); err != nil {\n\t\t\treturn v, err\n\t\t}\n\t\tv.blocks = append(v.blocks, &vdb)\n\t\tv.firstSubdirBlocks[block] = keyBlock\n\t\tif debug > 1 {\n\t\t\tfmt.Fprintf(os.Stderr, \" firstSubdirBlocks[%d] → %d\\n\", block, keyBlock)\n\t\t}\n\t\t// if debug {\n\t\t// \tfmt.Fprintf(os.Stderr, \"block: %#v\\n\", vdb)\n\t\t// }\n\t}\n\n\tsdds := v.subdirDescriptors()\n\tif debug > 1 {\n\t\tfmt.Fprintf(os.Stderr, \"got %d top-level subdir descriptors\\n\", len(sdds))\n\t}\n\n\tfor i := 0; i < len(sdds); i++ {\n\t\tsdd := sdds[i]\n\t\tsub, err := readSubdirectory(devicebytes, sdd)\n\t\tif err != nil {\n\t\t\treturn v, err\n\t\t}\n\t\tv.subdirsByBlock[sdd.KeyPointer] = &sub\n\t\tif debug > 1 {\n\t\t\tfmt.Fprintf(os.Stderr, \" subdirsByBlock[%d] → %q\\n\", sdd.KeyPointer, sub.keyBlock.Header.Name())\n\t\t}\n\t\tsdds = append(sdds, sub.subdirDescriptors()...)\n\t\tfor _, block := range sub.blocks {\n\t\t\tv.firstSubdirBlocks[block.block] = sdd.KeyPointer\n\t\t\tif debug > 1 {\n\t\t\t\tfmt.Fprintf(os.Stderr, \" firstSubdirBlocks[%d] → %d\\n\", block.block, sdd.KeyPointer)\n\t\t\t}\n\t\t}\n\t}\n\tif debug > 1 {\n\t\tfmt.Fprintf(os.Stderr, \"got %d total subdir descriptors\\n\", len(sdds))\n\t}\n\n\tfor _, sd := range v.subdirsByBlock {\n\t\tname := sd.keyBlock.Header.Name()\n\t\tif debug > 1 {\n\t\t\tfmt.Fprintf(os.Stderr, \"processing subdir %q\\n\", name)\n\t\t}\n\t\tparentName, err := parentDirName(sd.keyBlock.Header.ParentPointer, keyBlock, v.subdirsByBlock, v.firstSubdirBlocks)\n\t\tif err != nil {\n\t\t\treturn v, err\n\t\t}\n\t\tif parentName != \"\" {\n\t\t\tname = parentName + \"/\" + name\n\t\t}\n\n\t\tv.subdirsByName[name] = sd\n\t}\n\tif debug > 1 {\n\t\tfmt.Fprintf(os.Stderr, \"subdirsByName:\\n\")\n\t\tfor k := range v.subdirsByName {\n\t\t\tfmt.Fprintf(os.Stderr, \" %s\\n\", k)\n\t\t}\n\t}\n\treturn v, nil\n}", "func (c *Client) Volume() (float32, error) {\n\ts, err := c.ServerInfo()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tsinks, err := c.sinks()\n\tfor _, sink := range sinks {\n\t\tif sink.Name != s.DefaultSink {\n\t\t\tcontinue\n\t\t}\n\t\treturn float32(sink.Cvolume[0]) / pulseVolumeMax, nil\n\t}\n\treturn 0, fmt.Errorf(\"PulseAudio error: couldn't query volume - sink %s not found\", s.DefaultSink)\n}", "func (d *Drug) QueryVolume() *VolumeQuery {\n\treturn (&DrugClient{config: d.config}).QueryVolume(d)\n}", "func (o IopingSpecOutput) Volume() IopingSpecVolumeOutput {\n\treturn o.ApplyT(func(v IopingSpec) IopingSpecVolume { return v.Volume }).(IopingSpecVolumeOutput)\n}", "func (o IopingSpecVolumeVolumeSourceQuobyteOutput) Volume() pulumi.StringOutput {\n\treturn o.ApplyT(func(v IopingSpecVolumeVolumeSourceQuobyte) string { return v.Volume }).(pulumi.StringOutput)\n}", "func (srv *VolumeService) List() ([]api.Volume, error) {\n\treturn srv.provider.ListVolumes()\n}", "func (o FioSpecOutput) Volume() FioSpecVolumeOutput {\n\treturn o.ApplyT(func(v FioSpec) FioSpecVolume { return v.Volume }).(FioSpecVolumeOutput)\n}", "func (c *BlockVolumeClient) Details(id string) (*BlockVolume, error) {\n\tvar result BlockVolume\n\tparams := BlockVolumeParams{UniqID: id}\n\n\terr := c.Backend.CallIntoInterface(\"v1/Storage/Block/Volume/details\", params, &result)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &result, nil\n}", "func GetVolumesFromTypeV2(t string) (VolumeV2, error) {\n\tquery := \"/api/datacenter/storage/volumes?type=\" + t\n\treturn getVolumesV2(query)\n}", "func (c *restClient) CreateVolume(ctx context.Context, req *netapppb.CreateVolumeRequest, opts ...gax.CallOption) (*CreateVolumeOperation, error) {\n\tm := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true}\n\tbody := req.GetVolume()\n\tjsonReq, err := m.Marshal(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\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/volumes\", req.GetParent())\n\n\tparams := url.Values{}\n\tparams.Add(\"$alt\", \"json;enum-encoding=int\")\n\tparams.Add(\"volumeId\", fmt.Sprintf(\"%v\", req.GetVolumeId()))\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\", \"parent\", url.QueryEscape(req.GetParent()))}\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(\"POST\", baseUrl.String(), bytes.NewReader(jsonReq))\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 &CreateVolumeOperation{\n\t\tlro: longrunning.InternalNewOperation(*c.LROClient, resp),\n\t\tpollPath: override,\n\t}, nil\n}", "func (o *Volume) GetVolumeId() string {\n\tif o == nil || o.VolumeId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.VolumeId\n}", "func (o *Volume) GetVolumeId() string {\n\tif o == nil || o.VolumeId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.VolumeId\n}", "func getVolumeDetails(svc *ec2.Client, output *ec2.DescribeVolumesOutput, region string) ([]*resource.Resource, error) {\n\tvar ebsVolumes []*resource.Resource\n\tebsLogger.Debug(\"Fetching Ebs Details\")\n\tfor _, volume := range output.Volumes {\n\t\ttags := make(resource.Tags)\n\t\tfor _, t := range volume.Tags {\n\t\t\ttags[*t.Key] = *t.Value\n\t\t}\n\t\t// We need the creation-date when parsing Tags for relative defintions\n\t\t// Ebs Volumes Launch Time is not the creation date. It's the time it was last launched.\n\t\t// TODO To get the creation date we might want to get the creation date of the EBS attached to the Ebs instead\n\t\ttags[\"creation-date\"] = (*volume.CreateTime).String()\n\t\tebsResource := NewResource(*volume.VolumeId, ec2Name)\n\t\tebsResource.Region = region\n\t\t// Get CreationDate by getting LaunchTime of attached Volume\n\t\tebsResource.CreationDate = *volume.CreateTime\n\t\tebsResource.Tags = tags\n\t\tebsResource.Status = resource.Running\n\t\tif len(volume.Attachments) == 0 {\n\t\t\tebsResource.Status = resource.Unused\n\t\t}\n\t\tebsVolumes = append(ebsVolumes, ebsResource)\n\t}\n\n\treturn ebsVolumes, nil\n}", "func (s LifecyclerRPC) Volumes(version string, flagValues map[string]interface{}) ([]string, error) {\n\tvar resp []string\n\terr := s.client.Call(\"Plugin.Volumes\", HostOpts{Version: version, FlagValues: flagValues}, &resp)\n\treturn resp, err\n}", "func (s *VolumeStore) getVolume(name string) (volume.Volume, error) {\n\tvar meta volumeMetadata\n\tmeta, err := s.getMeta(name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdriverName := meta.Driver\n\tif driverName == \"\" {\n\t\ts.globalLock.RLock()\n\t\tv, exists := s.names[name]\n\t\ts.globalLock.RUnlock()\n\t\tif exists {\n\t\t\tmeta.Driver = v.DriverName()\n\t\t\tif err := s.setMeta(name, meta); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\n\tif meta.Driver != \"\" {\n\t\tvol, err := lookupVolume(meta.Driver, name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif vol == nil {\n\t\t\ts.Purge(name)\n\t\t\treturn nil, errNoSuchVolume\n\t\t}\n\n\t\tvar scope string\n\t\tvd, err := volumedrivers.GetDriver(meta.Driver)\n\t\tif err == nil {\n\t\t\tscope = vd.Scope()\n\t\t}\n\t\treturn volumeWrapper{vol, meta.Labels, scope, meta.Options}, nil\n\t}\n\n\tlogrus.Debugf(\"Probing all drivers for volume with name: %s\", name)\n\tdrivers, err := volumedrivers.GetAllDrivers()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, d := range drivers {\n\t\tv, err := d.Get(name)\n\t\tif err != nil || v == nil {\n\t\t\tcontinue\n\t\t}\n\t\tmeta.Driver = v.DriverName()\n\t\tif err := s.setMeta(name, meta); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn volumeWrapper{v, meta.Labels, d.Scope(), meta.Options}, nil\n\t}\n\treturn nil, errNoSuchVolume\n}", "func (b *BigIP) Volumes() (*Volumes, error) {\n\tvar volumes Volumes\n\terr, _ := b.getForEntity(&volumes, uriSys, uriSoftware, uriVolume)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &volumes, nil\n}", "func (state *State) GetVolumeMetrics() []*metrics.ZMetricVolume {\n\treturn state.deviceInfo.VolumeMetrics\n}", "func (l *Location) Volume() string {\n\treturn l.Authority.String()\n}", "func (client *Client) DeleteVolume(name string) (*Response, *ResponseStatus, error) {\n\treturn client.FormattedRequest(\"/delete/volumes/\\\"%s\\\"\", name)\n}" ]
[ "0.7811631", "0.7811133", "0.76150084", "0.731896", "0.7185272", "0.71796584", "0.7160898", "0.7157706", "0.71540654", "0.71509904", "0.714089", "0.71316993", "0.7129938", "0.70592827", "0.69513375", "0.69333804", "0.69192106", "0.68754125", "0.6851122", "0.66887146", "0.66788846", "0.66704375", "0.66413474", "0.6615533", "0.66027206", "0.66013145", "0.6561392", "0.6517941", "0.6505652", "0.64932483", "0.6484873", "0.6483263", "0.6482333", "0.6375278", "0.63621294", "0.6343642", "0.63421726", "0.6333547", "0.6332547", "0.6323639", "0.63207966", "0.6303153", "0.6279845", "0.62596214", "0.624123", "0.62378454", "0.62263405", "0.62200516", "0.62055504", "0.620324", "0.61748344", "0.6172291", "0.616619", "0.615687", "0.6148588", "0.6148588", "0.6144336", "0.61335486", "0.6082326", "0.60724175", "0.6050509", "0.60446525", "0.604402", "0.6041911", "0.60372823", "0.6025818", "0.60008097", "0.59997857", "0.5992799", "0.5985996", "0.59810454", "0.59758055", "0.5954162", "0.5941872", "0.5929634", "0.59182143", "0.5893381", "0.5890119", "0.5857396", "0.58508515", "0.5837981", "0.58243173", "0.5822215", "0.5807249", "0.57861996", "0.5781135", "0.5774951", "0.57708234", "0.5748257", "0.57195985", "0.5695998", "0.56929946", "0.56929946", "0.5685801", "0.5681434", "0.56695443", "0.5668976", "0.5668157", "0.56549203", "0.5645131" ]
0.769777
2
AttachVolume attaches the given volume to the given droplet
func (d DobsClient) AttachVolume(ctx Context, volumeID string, dropletID string) (error) { dropletIDI, err := strconv.Atoi(dropletID) if err != nil { return err } vol, _, err := d.GodoClient.Storage.GetVolume(ctx, volumeID) if err != nil { return err } if len(vol.DropletIDs) > 0 { otherDropletID := vol.DropletIDs[0] if otherDropletID == dropletIDI { log.Printf("Volume %s already attached to this droplet, skipping attach\n", volumeID) return nil } return fmt.Errorf("Volume %s already attached to different droplet %d", volumeID, otherDropletID) } action, _, err := d.GodoClient.StorageActions.Attach(ctx, volumeID, dropletIDI) if err != nil { return err } err = d.waitForAction(ctx, volumeID, action) if err != nil { return err } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (digitalocean DigitalOcean) AttachVolumeToDroplet(volumeID string, dropletID int) error {\n\tdoc, err := DigitalOceanClient()\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t_, _, err = doc.client.StorageActions.Attach(doc.context, volumeID, dropletID)\n\n\treturn err\n}", "func (util *PortworxVolumeUtil) AttachVolume(m *portworxVolumeMounter) (string, error) {\n\tdriver, err := util.getPortworxDriver(m.plugin.host, true /*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\tdevicePath, err := driver.Attach(m.volName)\n\tif err != nil {\n\t\tglog.Errorf(\"Error attaching Portworx Volume (%v): %v\", m.volName, err)\n\t\treturn \"\", err\n\t}\n\treturn devicePath, nil\n}", "func (stack *OpenstackVolumes) AttachVolume(volume *volumes.Volume) error {\n\topts := volumeattach.CreateOpts{\n\t\tVolumeID: volume.ProviderID,\n\t}\n\tmc := NewMetricContext(\"volume\", \"attach\")\n\tvolumeAttachment, err := volumeattach.Create(stack.computeClient, stack.meta.ServerID, opts).Extract()\n\tif mc.ObserveRequest(err) != nil {\n\t\treturn fmt.Errorf(\"error attaching volume %s to server %s: %v\", opts.VolumeID, stack.meta.ServerID, err)\n\t}\n\tvolume.LocalDevice = volumeAttachment.Device\n\treturn nil\n}", "func AttachVolume(ip, volName, containerName string) (string, error) {\n\tlog.Printf(\"Attaching volume [%s] on VM [%s]\\n\", volName, ip)\n\treturn ssh.InvokeCommand(ip, dockercli.RunContainer+\" -d -v \"+volName+\n\t\t\":/vol1 --name \"+containerName+dockercli.TestContainer)\n}", "func (d *DefaultDriver) AttachVolume(volumeID string) (string, error) {\n\treturn \"\", &errors.ErrNotSupported{\n\t\tType: \"Function\",\n\t\tOperation: \"CreateVolume()\",\n\t}\n}", "func (a *AWS) AttachVolume(ctx *lepton.Context, instanceName, name string, attachID int) error {\n\tvol, err := a.findVolumeByName(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tinstance, err := a.findInstanceByName(instanceName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdevice := \"\"\n\tif attachID >= 0 {\n\t\tif attachID >= 1 && attachID <= 25 {\n\t\t\tdevice = \"/dev/sd\" + string(rune('a'+attachID))\n\t\t} else {\n\t\t\treturn fmt.Errorf(\"invalid attachment point %d; allowed values: 1-25\", attachID)\n\t\t}\n\t} else {\n\t\t// Look for an unused device name to be assigned to the volume, starting from \"/dev/sdb\"\n\t\tfor deviceLetter := 'b'; deviceLetter <= 'z'; deviceLetter++ {\n\t\t\tname := \"/dev/sd\" + string(deviceLetter)\n\t\t\tnameUsed := false\n\t\t\tfor _, mapping := range instance.BlockDeviceMappings {\n\t\t\t\tif *mapping.DeviceName == name {\n\t\t\t\t\tnameUsed = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !nameUsed {\n\t\t\t\tdevice = name\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif device == \"\" {\n\t\t\treturn errors.New(\"no available device names\")\n\t\t}\n\t}\n\n\tinput := &ec2.AttachVolumeInput{\n\t\tDevice: aws.String(device),\n\t\tInstanceId: aws.String(*instance.InstanceId),\n\t\tVolumeId: aws.String(*vol.VolumeId),\n\t}\n\t_, err = a.ec2.AttachVolume(input)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (a *HetznerVolumes) AttachVolume(volume *volumes.Volume) error {\n\tctx, cancel := context.WithTimeout(context.Background(), time.Minute)\n\tdefer cancel()\n\n\tvolumeID, err := strconv.Atoi(volume.ProviderID)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to convert volume id %q to int: %w\", volume.ProviderID, err)\n\t}\n\n\thetznerVolume, _, err := a.hcloudClient.Volume.GetByID(ctx, volumeID)\n\tif err != nil || hetznerVolume == nil {\n\t\treturn fmt.Errorf(\"failed to get info for volume id %q: %w\", volume.ProviderID, err)\n\t}\n\n\tif hetznerVolume.Server != nil {\n\t\tif hetznerVolume.Server.ID != a.server.ID {\n\t\t\treturn fmt.Errorf(\"found volume %s(%d) attached to a different server: %d\", hetznerVolume.Name, hetznerVolume.ID, hetznerVolume.Server.ID)\n\t\t}\n\n\t\tklog.V(2).Infof(\"Attached volume %s(%d) to the running server\", hetznerVolume.Name, hetznerVolume.ID)\n\n\t\tvolume.LocalDevice = fmt.Sprintf(\"%s%d\", localDevicePrefix, hetznerVolume.ID)\n\t\treturn nil\n\t}\n\n\tklog.V(2).Infof(\"Attaching volume %s(%d) to the running server\", hetznerVolume.Name, hetznerVolume.ID)\n\n\taction, _, err := a.hcloudClient.Volume.Attach(ctx, hetznerVolume, a.server)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to attach volume %s(%d): %w\", hetznerVolume.Name, hetznerVolume.ID, err)\n\t}\n\n\t_, errCh := a.hcloudClient.Action.WatchProgress(ctx, action)\n\tif err := <-errCh; err != nil {\n\t\treturn fmt.Errorf(\"failed to wait for volume to %s(%d) be ready: %w\", hetznerVolume.Name, hetznerVolume.ID, err)\n\t}\n\n\treturn nil\n}", "func (cl *Client) VolumeAttach(ctx context.Context, vaa *csp.VolumeAttachArgs) (*csp.Volume, error) {\n\tsvc, vid, _ := VolumeIdentifierParse(vaa.VolumeIdentifier)\n\tswitch svc {\n\tcase ServiceGCE:\n\t\treturn cl.gceVolumeAttach(ctx, vaa, vid)\n\t}\n\treturn nil, fmt.Errorf(\"storage type currently unsupported\")\n}", "func Attach(c *golangsdk.ServiceClient, opts AttachOpts) (*jobs.Job, error) {\n\tb, err := golangsdk.BuildRequestBody(opts, \"volumeAttachment\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar r jobs.Job\n\t_, err = c.Post(attachURL(c, opts.ServerId), b, &r, &golangsdk.RequestOpts{\n\t\tMoreHeaders: requestOpts.MoreHeaders,\n\t})\n\treturn &r, err\n}", "func (a *Amazon) AttachVolume(volumeID, instanceID, devicePath string) error {\n\tif err := a.Client.AttachVolume(volumeID, instanceID, devicePath); err != nil {\n\t\treturn err\n\t}\n\n\tcheckAttaching := func(currentPercentage int) (machinestate.State, error) {\n\t\tvol, err := a.Client.VolumeByID(volumeID)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\n\t\tif len(vol.Attachments) == 0 {\n\t\t\treturn machinestate.Pending, nil\n\t\t}\n\n\t\tif aws.StringValue(vol.Attachments[0].State) != \"attached\" {\n\t\t\treturn machinestate.Pending, nil\n\t\t}\n\n\t\treturn machinestate.Stopped, nil\n\t}\n\n\tws := waitstate.WaitState{\n\t\tStateFunc: checkAttaching,\n\t\tDesiredState: machinestate.Stopped,\n\t}\n\treturn ws.Wait()\n}", "func (srv *VolumeService) Attach(volumename string, vmname string, path string, format string) error {\n\t// Get volume ID\n\tvolume, err := srv.Get(volumename)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"No volume found with name or id '%s'\", volumename)\n\t}\n\n\t// Get VM ID\n\tvmService := NewVMService(srv.provider)\n\tvm, err := vmService.Get(vmname)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"No VM found with name or id '%s'\", vmname)\n\t}\n\n\tvolatt, err := srv.provider.CreateVolumeAttachment(api.VolumeAttachmentRequest{\n\t\tName: fmt.Sprintf(\"%s-%s\", volume.Name, vm.Name),\n\t\tServerID: vm.ID,\n\t\tVolumeID: volume.ID,\n\t})\n\tif err != nil {\n\t\t// TODO Use more explicit error\n\t\treturn err\n\t}\n\n\t// Create mount point\n\tmountPoint := path\n\tif path == api.DefaultVolumeMountPoint {\n\t\tmountPoint = api.DefaultVolumeMountPoint + volume.Name\n\t}\n\n\tsshConfig, err := srv.provider.GetSSHConfig(vm.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tserver, err := nfs.NewServer(sshConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = server.MountBlockDevice(volatt.Device, mountPoint)\n\n\tif err != nil {\n\t\tsrv.Detach(volumename, vmname)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (c *Core) AttachVolume(id types.VolumeID, extra map[string]string) (*types.Volume, error) {\n\tc.lock.Lock(id.Name)\n\tdefer c.lock.Unlock(id.Name)\n\n\tv, dv, err := c.getVolumeDriver(id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tctx := driver.Contexts()\n\n\t// merge extra to volume spec extra.\n\tfor key, value := range extra {\n\t\tv.Spec.Extra[key] = value\n\t}\n\n\tif d, ok := dv.(driver.AttachDetach); ok {\n\t\tif err := d.Attach(ctx, v); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// update meta info.\n\tif err := c.store.Put(v); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn v, nil\n}", "func (s *VolumeListener) Attach(inctx context.Context, in *protocol.VolumeAttachmentRequest) (_ *googleprotobuf.Empty, err error) {\n\tdefer fail.OnExitConvertToGRPCStatus(inctx, &err)\n\tdefer fail.OnExitWrapError(inctx, &err, \"cannot attach volume\")\n\n\tempty := &googleprotobuf.Empty{}\n\tif s == nil {\n\t\treturn empty, fail.InvalidInstanceError()\n\t}\n\tif in == nil {\n\t\treturn empty, fail.InvalidParameterCannotBeNilError(\"in\")\n\t}\n\tif inctx == nil {\n\t\treturn nil, fail.InvalidParameterCannotBeNilError(\"inctx\")\n\t}\n\n\tvolumeRef, _ := srvutils.GetReference(in.GetVolume())\n\tif volumeRef == \"\" {\n\t\treturn empty, fail.InvalidRequestError(\"neither name nor id given as reference for volume\")\n\t}\n\thostRef, _ := srvutils.GetReference(in.GetHost())\n\tif hostRef == \"\" {\n\t\treturn empty, fail.InvalidRequestError(\"neither name nor id given as reference for host\")\n\t}\n\tmountPath := in.GetMountPath()\n\n\tfilesystem := in.GetFormat()\n\tdoNotFormat := in.DoNotFormat\n\tdoNotMount := in.DoNotMount\n\n\tjob, xerr := PrepareJob(inctx, in.GetVolume().GetTenantId(), fmt.Sprintf(\"/volume/%s/host/%s/attach\", volumeRef, hostRef))\n\tif xerr != nil {\n\t\treturn nil, xerr\n\t}\n\tdefer job.Close()\n\n\thandler := VolumeHandler(job)\n\tif xerr = handler.Attach(volumeRef, hostRef, mountPath, filesystem, doNotFormat, doNotMount); xerr != nil {\n\t\treturn empty, xerr\n\t}\n\n\treturn empty, nil\n}", "func (c *Client) AttachVolume(ctx context.Context, params *AttachVolumeInput, optFns ...func(*Options)) (*AttachVolumeOutput, error) {\n\tif params == nil {\n\t\tparams = &AttachVolumeInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"AttachVolume\", params, optFns, c.addOperationAttachVolumeMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*AttachVolumeOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "func (g *GCEVolumes) AttachVolume(volume *volumes.Volume) error {\n\tvolumeURL := volume.ProviderID\n\n\tvolumeName := lastComponent(volumeURL)\n\n\tattachedDisk := &compute.AttachedDisk{\n\t\tDeviceName: volumeName,\n\t\t// TODO: The k8s GCE provider sets Kind, but this seems wrong. Open an issue?\n\t\t//Kind: disk.Kind,\n\t\tMode: \"READ_WRITE\",\n\t\tSource: volumeURL,\n\t\tType: \"PERSISTENT\",\n\t}\n\n\tattachOp, err := g.compute.Instances.AttachDisk(g.project, g.zone, g.instanceName, attachedDisk).Do()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error attaching disk %q: %v\", volumeName, err)\n\t}\n\n\terr = WaitForOp(g.compute, attachOp)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error waiting for disk attach to complete %q: %v\", volumeName, err)\n\t}\n\n\tdevicePath := \"/dev/disk/by-id/google-\" + volumeName\n\n\t// TODO: Wait for device to appear?\n\n\tvolume.LocalDevice = devicePath\n\n\treturn nil\n}", "func (attacher *azureDiskAttacher) Attach(spec *volume.Spec, nodeName types.NodeName) (string, error) {\n\tvolumeSource, err := getVolumeSource(spec)\n\tif err != nil {\n\t\tglog.Warningf(\"failed to get azure disk spec\")\n\t\treturn \"\", err\n\t}\n\tinstanceid, err := attacher.azureProvider.InstanceID(nodeName)\n\tif err != nil {\n\t\tglog.Warningf(\"failed to get azure instance id\")\n\t\treturn \"\", fmt.Errorf(\"failed to get azure instance id for node %q\", nodeName)\n\t}\n\tif ind := strings.LastIndex(instanceid, \"/\"); ind >= 0 {\n\t\tinstanceid = instanceid[(ind + 1):]\n\t}\n\n\tlun, err := attacher.azureProvider.GetDiskLun(volumeSource.DiskName, volumeSource.DataDiskURI, nodeName)\n\tif err == cloudprovider.InstanceNotFound {\n\t\t// Log error and continue with attach\n\t\tglog.Warningf(\n\t\t\t\"Error checking if volume is already attached to current node (%q). Will continue and try attach anyway. err=%v\",\n\t\t\tinstanceid, err)\n\t}\n\n\tif err == nil {\n\t\t// Volume is already attached to node.\n\t\tglog.V(4).Infof(\"Attach operation is successful. volume %q is already attached to node %q at lun %d.\", volumeSource.DiskName, instanceid, lun)\n\t} else {\n\t\tglog.V(4).Infof(\"GetDiskLun returned: %v. Initiating attaching volume %q to node %q.\", err, volumeSource.DataDiskURI, nodeName)\n\t\tgetLunMutex.LockKey(instanceid)\n\t\tdefer getLunMutex.UnlockKey(instanceid)\n\n\t\tlun, err = attacher.azureProvider.GetNextDiskLun(nodeName)\n\t\tif err != nil {\n\t\t\tglog.Warningf(\"no LUN available for instance %q\", nodeName)\n\t\t\treturn \"\", fmt.Errorf(\"all LUNs are used, cannot attach volume %q to instance %q\", volumeSource.DiskName, instanceid)\n\t\t}\n\t\tglog.V(4).Infof(\"Trying to attach volume %q lun %d to node %q.\", volumeSource.DataDiskURI, lun, nodeName)\n\t\terr = attacher.azureProvider.AttachDisk(volumeSource.DiskName, volumeSource.DataDiskURI, nodeName, lun, compute.CachingTypes(*volumeSource.CachingMode))\n\t\tif err == nil {\n\t\t\tglog.V(4).Infof(\"Attach operation successful: volume %q attached to node %q.\", volumeSource.DataDiskURI, nodeName)\n\t\t} else {\n\t\t\tglog.V(2).Infof(\"Attach volume %q to instance %q failed with %v\", volumeSource.DataDiskURI, instanceid, err)\n\t\t\treturn \"\", fmt.Errorf(\"Attach volume %q to instance %q failed with %v\", volumeSource.DiskName, instanceid, err)\n\t\t}\n\t}\n\n\treturn strconv.Itoa(int(lun)), err\n}", "func (s *StorageActionsServiceOp) Attach(driveID string, dropletID int) (*Action, *Response, error) {\n\trequest := &ActionRequest{\n\t\t\"type\": \"attach\",\n\t\t\"droplet_id\": dropletID,\n\t}\n\treturn s.doAction(driveID, request)\n}", "func (p *Tmpfs) Attach(ctx driver.Context, v *types.Volume) error {\n\tctx.Log.Debugf(\"Tmpfs attach volume: %s\", v.Name)\n\tmountPath := v.Path()\n\tsize := v.Size()\n\treqID := v.Option(\"reqID\")\n\tids := v.Option(\"ids\")\n\n\tif ids != \"\" {\n\t\tif !strings.Contains(ids, reqID) {\n\t\t\tids = ids + \",\" + reqID\n\t\t}\n\t} else {\n\t\tids = reqID\n\t}\n\n\tif err := os.MkdirAll(mountPath, 0755); err != nil && !os.IsExist(err) {\n\t\treturn fmt.Errorf(\"error creating %q directory: %v\", mountPath, err)\n\t}\n\n\tif !utils.IsMountpoint(mountPath) {\n\t\terr := syscall.Mount(\"shm\", mountPath, \"tmpfs\",\n\t\t\tuintptr(syscall.MS_NOEXEC|syscall.MS_NOSUID|syscall.MS_NODEV),\n\t\t\tfmt.Sprintf(\"mode=1777,size=%s\", size))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"mounting shm tmpfs: %s %v\", mountPath, err)\n\t\t}\n\t}\n\n\tv.SetOption(\"ids\", ids)\n\tv.SetOption(\"freeTime\", \"\")\n\n\treturn nil\n}", "func AttachVolumeWithRestart(ip, volName, containerName string) (string, error) {\n\tlog.Printf(\"Attaching volume [%s] on VM[%s]\\n\", volName, ip)\n\treturn ssh.InvokeCommand(ip, dockercli.RunContainer+\" --restart=always -d -v \"+volName+\n\t\t\":/vol1 --name \"+containerName+\n\t\tdockercli.TestContainer)\n}", "func (driver *Driver) Attach(volumeName, instanceID string) (string, error) {\n\tvolumes, err := driver.sdm.GetVolume(\"\", volumeName)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tswitch {\n\tcase len(volumes) == 0:\n\t\treturn \"\", errors.New(\"No volumes returned by name\")\n\tcase len(volumes) > 1:\n\t\treturn \"\", errors.New(\"Multiple volumes returned by name\")\n\t}\n\n\t_, err = driver.sdm.AttachVolume(true, volumes[0].VolumeID, instanceID)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tvolumes, err = driver.sdm.GetVolume(\"\", volumeName)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn volumes[0].NetworkName, nil\n}", "func (vpcIks *IksVpcSession) AttachVolume(volumeAttachmentRequest provider.VolumeAttachmentRequest) (*provider.VolumeAttachmentResponse, error) {\n\tvpcIks.Logger.Debug(\"Entry of IksVpcSession.AttachVolume method...\")\n\tdefer vpcIks.Logger.Debug(\"Exit from IksVpcSession.AttachVolume method...\")\n\treturn vpcIks.IksSession.AttachVolume(volumeAttachmentRequest)\n}", "func (r *vdm) Attach(volumeName, instanceID string, force bool) (string, error) {\n\tfor _, d := range r.drivers {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"moduleName\": r.rexray.Context,\n\t\t\t\"driverName\": d.Name(),\n\t\t\t\"volumeName\": volumeName,\n\t\t\t\"instanceID\": instanceID,\n\t\t\t\"force\": force}).Info(\"vdm.Attach\")\n\n\t\treturn d.Attach(volumeName, instanceID, force)\n\t}\n\treturn \"\", errors.ErrNoVolumesDetected\n}", "func (cl *Client) gceVolumeAttach(ctx context.Context, vaa *csp.VolumeAttachArgs, vid string) (*csp.Volume, error) {\n\tcomputeService, err := cl.getComputeService(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdeviceName := vid\n\tif !strings.HasPrefix(deviceName, nuvoNamePrefix) {\n\t\tdeviceName = nuvoNamePrefix + vid\n\t}\n\tdisk := &compute.AttachedDisk{\n\t\tDeviceName: deviceName,\n\t\tSource: fmt.Sprintf(diskSourceURL, cl.projectID, cl.attrs[AttrZone].Value, deviceName),\n\t}\n\top, err := computeService.Instances().AttachDisk(cl.projectID, cl.attrs[AttrZone].Value, vaa.NodeIdentifier, disk).Context(ctx).Do()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err = cl.waitForOperation(ctx, op); err != nil {\n\t\treturn nil, err\n\t}\n\tvol, err := cl.vr.gceVolumeGet(ctx, vid)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn vol, nil\n}", "func attach(c *lxc.Container, o *lxc.AttachOptions) {\n\terr := c.AttachShell(*o)\n\tif err != nil {\n\t\terrorExit(2, err)\n\t}\n}", "func (o *snapshotter) attachAndMountBlockDevice(ctx context.Context, snID string, snKey string, writable bool) (retErr error) {\n\tif err := lookup(o.tgtTargetMountpoint(snID)); err == nil {\n\t\treturn nil\n\t}\n\n\t// If the target already exists, it won't be processed, see man TGT-ADMIN(8)\n\ttargetConfPath := o.tgtTargetConfPath(snID, snKey)\n\tout, err := exec.CommandContext(ctx, \"tgt-admin\", \"-e\", \"-c\", targetConfPath).CombinedOutput()\n\tif err != nil {\n\t\t// read the init-debug.log for readable\n\t\tdebugLogPath := o.tgtOverlayBDInitDebuglogPath(snID)\n\t\tif data, derr := ioutil.ReadFile(debugLogPath); derr == nil {\n\t\t\treturn errors.Wrapf(err, \"failed to create target by tgt-admin: %s, more detail in %s\", out, data)\n\t\t}\n\t\treturn errors.Wrapf(err, \"failed to create target by tgt-admin: %s\", out)\n\t}\n\n\ttargetIqn := o.tgtTargetIqn(snID, snKey)\n\tdefer func() {\n\t\tif retErr != nil {\n\t\t\tdeferCtx, deferCancel := rollbackContext()\n\t\t\tdefer deferCancel()\n\n\t\t\tout, err = exec.CommandContext(ctx, \"tgt-admin\", \"--delete\", targetIqn).CombinedOutput()\n\t\t\tif err != nil {\n\t\t\t\tlog.G(deferCtx).WithError(err).Warnf(\"failed to rollback target by tgt-admin: %s\", out)\n\t\t\t}\n\t\t}\n\t}()\n\n\t// Add a portal on a target\n\tout, err = exec.CommandContext(ctx, \"iscsiadm\", \"-m\", \"node\", \"-p\", defaultPortal, \"-T\", targetIqn, \"-o\", \"new\").CombinedOutput()\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to add a portal on a target %s: %s\", targetIqn, out)\n\t}\n\tdefer func() {\n\t\t// rollback the portal\n\t\tif retErr != nil {\n\t\t\tdeferCtx, deferCancel := rollbackContext()\n\t\t\tdefer deferCancel()\n\n\t\t\tout, err = exec.CommandContext(deferCtx, \"iscsiadm\", \"-m\", \"node\", \"-p\", defaultPortal, \"-T\", targetIqn, \"-o\", \"delete\").CombinedOutput()\n\t\t\tif err != nil {\n\t\t\t\tlog.G(deferCtx).WithError(err).Warnf(\"failed to rollback a portal on a target %s: %s\", targetIqn, out)\n\t\t\t}\n\t\t}\n\t}()\n\n\t// Login a portal on a target\n\tout, err = exec.CommandContext(ctx, \"iscsiadm\", \"-m\", \"node\", \"-p\", defaultPortal, \"-T\", targetIqn, \"--login\").CombinedOutput()\n\tif err != nil {\n\t\texiterr, ok := err.(*exec.ExitError)\n\t\tif !ok || iscsi.Errno(exiterr.ExitCode()) != iscsi.ESESSEXISTS {\n\t\t\treturn errors.Wrapf(err, \"failed to login a portal on a target %s: %s\", targetIqn, out)\n\t\t}\n\t}\n\tdefer func() {\n\t\t// NOTE(fuweid): Basically, do login only once. The rollback doesn't impact other running portal.\n\t\tif retErr != nil {\n\t\t\tdeferCtx, deferCancel := rollbackContext()\n\t\t\tdefer deferCancel()\n\n\t\t\tout, err = exec.CommandContext(deferCtx, \"iscsiadm\", \"-m\", \"node\", \"-p\", defaultPortal, \"-T\", targetIqn, \"--logout\").CombinedOutput()\n\t\t\tif err != nil {\n\t\t\t\tlog.G(deferCtx).WithError(err).Warnf(\"failed to rollback to logout on a target %s: %s\", targetIqn, out)\n\t\t\t}\n\t\t}\n\t}()\n\n\t// Find the session and hostNumber mapping\n\thostToSessionID, err := iscsi.GetISCSIHostSessionMapForTarget(targetIqn, defaultPortal)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to get hostNumber->SessionID mapping for %s\", targetIqn)\n\t}\n\n\tif len(hostToSessionID) != 1 {\n\t\treturn errors.Errorf(\"unexpected hostNumber->SessionID mapping result %v for %s\", hostToSessionID, targetIqn)\n\t}\n\n\t// The device doesn't show up instantly. Need retry here.\n\tvar lastErr error = nil\n\tvar mountPoint = o.tgtTargetMountpoint(snID)\n\tfor i := 1; i <= maxAttachAttempts; i++ {\n\t\tfor hostNumber, sessionIDs := range hostToSessionID {\n\t\t\tif len(sessionIDs) != 1 {\n\t\t\t\treturn errors.Errorf(\"unexpected hostNumber->SessionID mapping result %v for %s\", hostToSessionID, targetIqn)\n\t\t\t}\n\n\t\t\t// Assume that both channelID and targetID are zero.\n\t\t\tdevices, err := iscsi.GetDevicesForTarget(targetIqn, hostNumber, sessionIDs[0], 0, 0)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif len(devices) != 1 {\n\t\t\t\tlastErr = errors.Errorf(\"unexpected devices %v for %s\", devices, targetIqn)\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tvar mflag uintptr = unix.MS_RDONLY\n\t\t\tif writable {\n\t\t\t\tmflag = 0\n\t\t\t}\n\n\t\t\t// TODO(fuweid): how to support multiple filesystem?\n\t\t\tif err := unix.Mount(devices[0], mountPoint, \"ext4\", mflag, \"\"); err != nil {\n\t\t\t\treturn errors.Wrapf(err, \"failed to mount the device %s on %s\", devices[0], mountPoint)\n\t\t\t}\n\t\t\tlastErr = nil\n\t\t}\n\n\t\tif lastErr == nil {\n\t\t\tbreak\n\t\t}\n\t\ttime.Sleep(1 * time.Second)\n\t}\n\treturn lastErr\n}", "func (driver *linodeVolumeDriver) ensureVolumeAttached(volumeID int) error {\n\t// TODO: validate whether a volume is in use in a local container\n\n\tapi, err := driver.linodeAPI()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Wait for detachment if already detaching\n\tif err := waitForVolumeNotBusy(api, volumeID); err != nil {\n\t\treturn err\n\t}\n\n\t// Fetch volume\n\tvol, err := api.GetVolume(context.Background(), volumeID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// If volume is already attached, do nothing\n\tif vol.LinodeID != nil && *vol.LinodeID == driver.instanceID {\n\t\treturn nil\n\t}\n\n\t// Forcibly attach the volume if forceAttach is enabled\n\tif forceAttach && vol.LinodeID != nil && *vol.LinodeID != driver.instanceID {\n\t\tif err := detachAndWait(api, volumeID); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn attachAndWait(api, volumeID, driver.instanceID)\n\t}\n\n\t// Throw an error if the instance is not in an attachable state\n\tif vol.LinodeID != nil && *vol.LinodeID != driver.instanceID {\n\t\treturn fmt.Errorf(\"failed to attach volume: volume is currently attached to linode %d\", *vol.LinodeID)\n\t}\n\n\treturn attachAndWait(api, volumeID, driver.instanceID)\n}", "func (client *Client) CreateVolumeAttachment(request api.VolumeAttachmentRequest) (*api.VolumeAttachment, error) {\n\t// Create the attachment\n\tva, err := volumeattach.Create(client.Compute, request.ServerID, volumeattach.CreateOpts{\n\t\tVolumeID: request.VolumeID,\n\t}).Extract()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error creating volume attachment between server %s and volume %s: %s\", request.ServerID, request.VolumeID, ProviderErrorToString(err))\n\t}\n\n\tvaapi := &api.VolumeAttachment{\n\t\tID: va.ID,\n\t\tServerID: va.ServerID,\n\t\tVolumeID: va.VolumeID,\n\t\tDevice: va.Device,\n\t}\n\n\t// Update the metadata\n\n\tmtdVol, err := metadata.LoadVolume(providers.FromClient(client), request.VolumeID)\n\tif err != nil {\n\n\t\t// Detach volume\n\t\tdetach_err := volumeattach.Delete(client.Compute, va.ServerID, va.ID).ExtractErr()\n\t\tif detach_err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Error deleting volume attachment %s: %s\", va.ID, ProviderErrorToString(err))\n\t\t}\n\n\t\treturn nil, err\n\t}\n\terr = mtdVol.Attach(vaapi)\n\tif err != nil {\n\t\t// Detach volume\n\t\tdetach_err := volumeattach.Delete(client.Compute, va.ServerID, va.ID).ExtractErr()\n\t\tif detach_err != nil {\n\t\t\treturn nil, fmt.Errorf(\"Error deleting volume attachment %s: %s\", va.ID, ProviderErrorToString(err))\n\t\t}\n\n\t\treturn vaapi, err\n\t}\n\n\treturn vaapi, nil\n}", "func (d *lvm) MountVolume(vol Volume, op *operations.Operation) error {\n\tunlock := vol.MountLock()\n\tdefer unlock()\n\n\trevert := revert.New()\n\tdefer revert.Fail()\n\n\t// Activate LVM volume if needed.\n\tactivated, err := d.activateVolume(vol)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif activated {\n\t\trevert.Add(func() { _, _ = d.deactivateVolume(vol) })\n\t}\n\n\tif vol.contentType == ContentTypeFS {\n\t\t// Check if already mounted.\n\t\tmountPath := vol.MountPath()\n\t\tif !filesystem.IsMountPoint(mountPath) {\n\t\t\tfsType := vol.ConfigBlockFilesystem()\n\t\t\tvolDevPath := d.lvmDevPath(d.config[\"lvm.vg_name\"], vol.volType, vol.contentType, vol.name)\n\n\t\t\tif vol.mountFilesystemProbe {\n\t\t\t\tfsType, err = fsProbe(volDevPath)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"Failed probing filesystem: %w\", err)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\terr = vol.EnsureMountPath()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tmountFlags, mountOptions := filesystem.ResolveMountOptions(strings.Split(vol.ConfigBlockMountOptions(), \",\"))\n\t\t\terr = TryMount(volDevPath, mountPath, fsType, mountFlags, mountOptions)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Failed to mount LVM logical volume: %w\", err)\n\t\t\t}\n\n\t\t\td.logger.Debug(\"Mounted logical volume\", logger.Ctx{\"volName\": vol.name, \"dev\": volDevPath, \"path\": mountPath, \"options\": mountOptions})\n\t\t}\n\t} else if vol.contentType == ContentTypeBlock {\n\t\t// For VMs, mount the filesystem volume.\n\t\tif vol.IsVMBlock() {\n\t\t\tfsVol := vol.NewVMBlockFilesystemVolume()\n\t\t\terr = d.MountVolume(fsVol, op)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvol.MountRefCountIncrement() // From here on it is up to caller to call UnmountVolume() when done.\n\trevert.Success()\n\treturn nil\n}", "func (util *PortworxVolumeUtil) MountVolume(m *portworxVolumeMounter, mountPath string) error {\n\tdriver, err := util.getPortworxDriver(m.plugin.host, true /*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.Mount(m.volName, mountPath)\n\tif err != nil {\n\t\tglog.Errorf(\"Error mounting Portworx Volume (%v) on Path (%v): %v\", m.volName, mountPath, err)\n\t\treturn err\n\t}\n\treturn nil\n}", "func (k *Kubernetes) AddPodMountVolume(service *apistructs.Service, podSpec *apiv1.PodSpec,\n\tsecretvolmounts []apiv1.VolumeMount, secretvolumes []apiv1.Volume) error {\n\n\tpodSpec.Volumes = make([]apiv1.Volume, 0)\n\n\t//Pay attention to the settings mentioned above, there is only one container in a pod\n\tpodSpec.Containers[0].VolumeMounts = make([]apiv1.VolumeMount, 0)\n\n\t// get cluster info\n\tclusterInfo, err := k.ClusterInfo.Get()\n\tif err != nil {\n\t\treturn errors.Errorf(\"failed to get cluster info, clusterName: %s, (%v)\", k.clusterName, err)\n\t}\n\n\t// hostPath type\n\tfor i, bind := range service.Binds {\n\t\tif bind.HostPath == \"\" || bind.ContainerPath == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\t//Name formation '[a-z0-9]([-a-z0-9]*[a-z0-9])?'\n\t\tname := \"volume\" + \"-bind-\" + strconv.Itoa(i)\n\n\t\thostPath, err := ParseJobHostBindTemplate(bind.HostPath, clusterInfo)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif !strutil.HasPrefixes(hostPath, \"/\") {\n\t\t\tpvcName := strings.Replace(hostPath, \"_\", \"-\", -1)\n\t\t\tsc := \"dice-local-volume\"\n\t\t\tif err := k.pvc.CreateIfNotExists(&apiv1.PersistentVolumeClaim{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: fmt.Sprintf(\"%s-%s\", service.Name, pvcName),\n\t\t\t\t\tNamespace: service.Namespace,\n\t\t\t\t},\n\t\t\t\tSpec: apiv1.PersistentVolumeClaimSpec{\n\t\t\t\t\tAccessModes: []apiv1.PersistentVolumeAccessMode{apiv1.ReadWriteOnce},\n\t\t\t\t\tResources: apiv1.ResourceRequirements{\n\t\t\t\t\t\tRequests: apiv1.ResourceList{\n\t\t\t\t\t\t\tapiv1.ResourceStorage: resource.MustParse(\"10Gi\"),\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tStorageClassName: &sc,\n\t\t\t\t},\n\t\t\t}); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tpodSpec.Volumes = append(podSpec.Volumes,\n\t\t\t\tapiv1.Volume{\n\t\t\t\t\tName: name,\n\t\t\t\t\tVolumeSource: apiv1.VolumeSource{\n\t\t\t\t\t\tPersistentVolumeClaim: &apiv1.PersistentVolumeClaimVolumeSource{\n\t\t\t\t\t\t\tClaimName: fmt.Sprintf(\"%s-%s\", service.Name, pvcName),\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t})\n\n\t\t\tpodSpec.Containers[0].VolumeMounts = append(podSpec.Containers[0].VolumeMounts,\n\t\t\t\tapiv1.VolumeMount{\n\t\t\t\t\tName: name,\n\t\t\t\t\tMountPath: bind.ContainerPath,\n\t\t\t\t\tReadOnly: bind.ReadOnly,\n\t\t\t\t})\n\t\t\tcontinue\n\t\t}\n\n\t\tpodSpec.Volumes = append(podSpec.Volumes,\n\t\t\tapiv1.Volume{\n\t\t\t\tName: name,\n\t\t\t\tVolumeSource: apiv1.VolumeSource{\n\t\t\t\t\tHostPath: &apiv1.HostPathVolumeSource{\n\t\t\t\t\t\tPath: hostPath,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t})\n\n\t\tpodSpec.Containers[0].VolumeMounts = append(podSpec.Containers[0].VolumeMounts,\n\t\t\tapiv1.VolumeMount{\n\t\t\t\tName: name,\n\t\t\t\tMountPath: bind.ContainerPath,\n\t\t\t\tReadOnly: bind.ReadOnly,\n\t\t\t})\n\t}\n\n\t// Configure the business container sidecar shared directory\n\tfor name, sidecar := range service.SideCars {\n\t\tfor _, dir := range sidecar.SharedDirs {\n\t\t\temptyDirVolumeName := strutil.Concat(name, shardDirSuffix)\n\n\t\t\tsrcMount := apiv1.VolumeMount{\n\t\t\t\tName: emptyDirVolumeName,\n\t\t\t\tMountPath: dir.Main,\n\t\t\t\tReadOnly: false, // rw\n\t\t\t}\n\t\t\t// Business master container\n\t\t\tpodSpec.Containers[0].VolumeMounts = append(podSpec.Containers[0].VolumeMounts, srcMount)\n\n\t\t\tpodSpec.Volumes = append(podSpec.Volumes, apiv1.Volume{\n\t\t\t\tName: emptyDirVolumeName,\n\t\t\t\tVolumeSource: apiv1.VolumeSource{\n\t\t\t\t\tEmptyDir: &apiv1.EmptyDirVolumeSource{},\n\t\t\t\t},\n\t\t\t})\n\t\t}\n\t}\n\tif service.InitContainer != nil {\n\t\tfor name, initc := range service.InitContainer {\n\t\t\tfor i, dir := range initc.SharedDirs {\n\t\t\t\tname := fmt.Sprintf(\"%s-%d\", name, i)\n\t\t\t\tsrcMount := apiv1.VolumeMount{\n\t\t\t\t\tName: name,\n\t\t\t\t\tMountPath: dir.Main,\n\t\t\t\t\tReadOnly: false,\n\t\t\t\t}\n\t\t\t\tpodSpec.Containers[0].VolumeMounts = append(podSpec.Containers[0].VolumeMounts, srcMount)\n\t\t\t\tpodSpec.Volumes = append(podSpec.Volumes, apiv1.Volume{\n\t\t\t\t\tName: name,\n\t\t\t\t\tVolumeSource: apiv1.VolumeSource{\n\t\t\t\t\t\tEmptyDir: &apiv1.EmptyDirVolumeSource{},\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\n\tpodSpec.Volumes = append(podSpec.Volumes, secretvolumes...)\n\tpodSpec.Containers[0].VolumeMounts = append(podSpec.Containers[0].VolumeMounts, secretvolmounts...)\n\n\treturn nil\n}", "func (endpoint *BridgedMacvlanEndpoint) Attach(h hypervisor) error {\n\tnetworkLogger().Info(\"Attaching macvlan endpoint\")\n\tif err := xconnectVMNetwork(endpoint, true, h.hypervisorConfig().NumVCPUs, h.hypervisorConfig().DisableVhostNet); err != nil {\n\t\tnetworkLogger().WithError(err).Error(\"Error bridging virtual ep\")\n\t\treturn err\n\t}\n\n\treturn h.addDevice(endpoint, netDev)\n}", "func doAttachVolumeCommand(t *testing.T, fail bool) (client *testutil.SsntpTestClient, tenant string, volume string) {\n\tvar reason payloads.StartFailureReason\n\n\tclient, instances := testStartWorkload(t, 1, false, reason)\n\n\ttenantID := instances[0].TenantID\n\n\tsendStatsCmd(client, t)\n\n\tdata := addTestBlockDevice(t, tenantID)\n\n\tserverCh := server.AddCmdChan(ssntp.AttachVolume)\n\tagentCh := client.AddCmdChan(ssntp.AttachVolume)\n\tvar serverErrorCh chan testutil.Result\n\tvar controllerCh chan struct{}\n\n\tif fail == true {\n\t\tserverErrorCh = server.AddErrorChan(ssntp.AttachVolumeFailure)\n\t\tcontrollerCh = wrappedClient.addErrorChan(ssntp.AttachVolumeFailure)\n\t\tclient.AttachFail = true\n\t\tclient.AttachVolumeFailReason = payloads.AttachVolumeAlreadyAttached\n\n\t\tdefer func() {\n\t\t\tclient.AttachFail = false\n\t\t\tclient.AttachVolumeFailReason = \"\"\n\t\t}()\n\t}\n\n\terr := ctl.AttachVolume(tenantID, data.ID, instances[0].ID, \"\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tresult, err := server.GetCmdChanResult(serverCh, ssntp.AttachVolume)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif result.InstanceUUID != instances[0].ID ||\n\t\tresult.NodeUUID != client.UUID ||\n\t\tresult.VolumeUUID != data.ID {\n\t\tt.Fatalf(\"expected %s %s %s, got %s %s %s\", instances[0].ID, client.UUID, data.ID, result.InstanceUUID, result.NodeUUID, result.VolumeUUID)\n\t}\n\n\tif fail == true {\n\t\t_, err = client.GetCmdChanResult(agentCh, ssntp.AttachVolume)\n\t\tif err == nil {\n\t\t\tt.Fatal(\"Success when Failure expected\")\n\t\t}\n\n\t\t_, err = server.GetErrorChanResult(serverErrorCh, ssntp.AttachVolumeFailure)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\terr = wrappedClient.getErrorChan(controllerCh, ssntp.AttachVolumeFailure)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\t// at this point, the state of the block device should\n\t\t// be set back to available.\n\t\tdata2, err := ctl.ds.GetBlockDevice(data.ID)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\tif data2.State != types.Available {\n\t\t\tt.Fatalf(\"block device state not updated\")\n\t\t}\n\t} else {\n\t\t_, err = client.GetCmdChanResult(agentCh, ssntp.AttachVolume)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}\n\n\treturn client, tenantID, data.ID\n}", "func (k *Kubernetes) AddPodMountVolume(service *apistructs.Service, podSpec *corev1.PodSpec,\n\tsecretvolmounts []corev1.VolumeMount, secretvolumes []corev1.Volume) error {\n\n\tif len(podSpec.Volumes) == 0 {\n\t\tpodSpec.Volumes = make([]corev1.Volume, 0)\n\t}\n\n\t//Pay attention to the settings mentioned above, there is only one container in a pod\n\tif len(podSpec.Containers[0].VolumeMounts) == 0 {\n\t\tpodSpec.Containers[0].VolumeMounts = make([]corev1.VolumeMount, 0)\n\t}\n\n\t// get cluster info\n\tclusterInfo, err := k.ClusterInfo.Get()\n\tif err != nil {\n\t\treturn errors.Errorf(\"failed to get cluster info, clusterName: %s, (%v)\", k.clusterName, err)\n\t}\n\n\t// hostPath type\n\tfor i, bind := range service.Binds {\n\t\tif bind.HostPath == \"\" || bind.ContainerPath == \"\" {\n\t\t\treturn errors.New(\"bind HostPath or ContainerPath is empty\")\n\t\t}\n\t\t//Name formation '[a-z0-9]([-a-z0-9]*[a-z0-9])?'\n\t\tname := \"volume\" + \"-bind-\" + strconv.Itoa(i)\n\n\t\thostPath, err := ParseJobHostBindTemplate(bind.HostPath, clusterInfo)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// The hostPath that does not start with an absolute path is used to apply for local disk resources in the old volume interface\n\t\tif !strings.HasPrefix(hostPath, \"/\") {\n\t\t\t//hostPath = strutil.Concat(\"/mnt/k8s/\", hostPath)\n\t\t\tpvcName := strings.Replace(hostPath, \"_\", \"-\", -1)\n\t\t\tsc := \"dice-local-volume\"\n\t\t\tif err := k.pvc.CreateIfNotExists(&corev1.PersistentVolumeClaim{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tName: fmt.Sprintf(\"%s-%s\", service.Name, pvcName),\n\t\t\t\t\tNamespace: service.Namespace,\n\t\t\t\t},\n\t\t\t\tSpec: corev1.PersistentVolumeClaimSpec{\n\t\t\t\t\tAccessModes: []corev1.PersistentVolumeAccessMode{corev1.ReadWriteOnce},\n\t\t\t\t\tResources: corev1.ResourceRequirements{\n\t\t\t\t\t\tRequests: corev1.ResourceList{\n\t\t\t\t\t\t\tcorev1.ResourceStorage: resource.MustParse(\"10Gi\"),\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tStorageClassName: &sc,\n\t\t\t\t},\n\t\t\t}); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tpodSpec.Volumes = append(podSpec.Volumes,\n\t\t\t\tcorev1.Volume{\n\t\t\t\t\tName: name,\n\t\t\t\t\tVolumeSource: corev1.VolumeSource{\n\t\t\t\t\t\tPersistentVolumeClaim: &corev1.PersistentVolumeClaimVolumeSource{\n\t\t\t\t\t\t\tClaimName: fmt.Sprintf(\"%s-%s\", service.Name, pvcName),\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t})\n\n\t\t\tpodSpec.Containers[0].VolumeMounts = append(podSpec.Containers[0].VolumeMounts,\n\t\t\t\tcorev1.VolumeMount{\n\t\t\t\t\tName: name,\n\t\t\t\t\tMountPath: bind.ContainerPath,\n\t\t\t\t\tReadOnly: bind.ReadOnly,\n\t\t\t\t})\n\t\t\tcontinue\n\t\t}\n\n\t\tpodSpec.Volumes = append(podSpec.Volumes,\n\t\t\tcorev1.Volume{\n\t\t\t\tName: name,\n\t\t\t\tVolumeSource: corev1.VolumeSource{\n\t\t\t\t\tHostPath: &corev1.HostPathVolumeSource{\n\t\t\t\t\t\tPath: hostPath,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t})\n\n\t\tpodSpec.Containers[0].VolumeMounts = append(podSpec.Containers[0].VolumeMounts,\n\t\t\tcorev1.VolumeMount{\n\t\t\t\tName: name,\n\t\t\t\tMountPath: bind.ContainerPath,\n\t\t\t\tReadOnly: bind.ReadOnly,\n\t\t\t})\n\t}\n\n\t// pvc volume type\n\tif len(service.Volumes) > 0 {\n\t\tif err := k.setStatelessServiceVolumes(service, podSpec); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Configure the business container sidecar shared directory\n\tfor name, sidecar := range service.SideCars {\n\t\tfor _, dir := range sidecar.SharedDirs {\n\t\t\temptyDirVolumeName := strutil.Concat(name, shardDirSuffix)\n\n\t\t\tquantitySize := resource.MustParse(k8sapi.PodEmptyDirSizeLimit10Gi)\n\t\t\tif sidecar.Resources.EmptyDirCapacity > 0 {\n\t\t\t\tmaxEmptyDir := fmt.Sprintf(\"%dGi\", sidecar.Resources.EmptyDirCapacity)\n\t\t\t\tquantitySize = resource.MustParse(maxEmptyDir)\n\t\t\t}\n\n\t\t\tsrcMount := corev1.VolumeMount{\n\t\t\t\tName: emptyDirVolumeName,\n\t\t\t\tMountPath: dir.Main,\n\t\t\t\tReadOnly: false, // rw\n\t\t\t}\n\t\t\t// Business master container\n\t\t\tpodSpec.Containers[0].VolumeMounts = append(podSpec.Containers[0].VolumeMounts, srcMount)\n\n\t\t\tpodSpec.Volumes = append(podSpec.Volumes, corev1.Volume{\n\t\t\t\tName: emptyDirVolumeName,\n\t\t\t\tVolumeSource: corev1.VolumeSource{\n\t\t\t\t\tEmptyDir: &corev1.EmptyDirVolumeSource{\n\t\t\t\t\t\tSizeLimit: &quantitySize,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t})\n\t\t}\n\t}\n\tif service.InitContainer != nil {\n\t\tfor name, initc := range service.InitContainer {\n\t\t\tfor i, dir := range initc.SharedDirs {\n\t\t\t\tname := fmt.Sprintf(\"%s-%d\", name, i)\n\t\t\t\tsrcMount := corev1.VolumeMount{\n\t\t\t\t\tName: name,\n\t\t\t\t\tMountPath: dir.Main,\n\t\t\t\t\tReadOnly: false,\n\t\t\t\t}\n\t\t\t\tquantitySize := resource.MustParse(k8sapi.PodEmptyDirSizeLimit10Gi)\n\t\t\t\tif initc.Resources.EmptyDirCapacity > 0 {\n\t\t\t\t\tmaxEmptyDir := fmt.Sprintf(\"%dGi\", initc.Resources.EmptyDirCapacity)\n\t\t\t\t\tquantitySize = resource.MustParse(maxEmptyDir)\n\t\t\t\t}\n\t\t\t\tpodSpec.Containers[0].VolumeMounts = append(podSpec.Containers[0].VolumeMounts, srcMount)\n\t\t\t\tpodSpec.Volumes = append(podSpec.Volumes, corev1.Volume{\n\t\t\t\t\tName: name,\n\t\t\t\t\tVolumeSource: corev1.VolumeSource{\n\t\t\t\t\t\tEmptyDir: &corev1.EmptyDirVolumeSource{\n\t\t\t\t\t\t\tSizeLimit: &quantitySize,\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\tpodSpec.Volumes = append(podSpec.Volumes, secretvolumes...)\n\tpodSpec.Containers[0].VolumeMounts = append(podSpec.Containers[0].VolumeMounts, secretvolmounts...)\n\n\treturn nil\n}", "func (s *StackEbrc) CreateVolumeAttachment(request abstract.VolumeAttachmentRequest) (string, fail.Error) {\n\tlogrus.Debugf(\">>> stacks.ebrc::CreateVolumeAttachment(%s)\", request.Name)\n\tdefer logrus.Debugf(\"<<< stacks.ebrc::CreateVolumeAttachment(%s)\", request.Name)\n\n\tvm, err := s.findVMByID(request.HostID)\n\tif err != nil || utils.IsEmpty(vm) {\n\t\treturn \"\", fail.Wrap(err, fmt.Sprintf(\"Error creating attachment, vm empty\"))\n\t}\n\n\tdisk, err := s.findDiskByID(request.VolumeID)\n\tif err != nil || utils.IsEmpty(disk) {\n\t\treturn \"\", fail.Wrap(err, fmt.Sprintf(\"Error creating attachment, disk empty\"))\n\t}\n\n\tattask, err := vm.AttachDisk(&types.DiskAttachOrDetachParams{Disk: &types.Reference{HREF: disk.Disk.HREF}})\n\tif err != nil {\n\t\treturn \"\", fail.Wrap(err, fmt.Sprintf(\"Error creating attachment\"))\n\t}\n\n\terr = attask.WaitTaskCompletion()\n\tif err != nil {\n\t\treturn \"\", fail.Wrap(err, fmt.Sprintf(\"Error creating attachment\"))\n\t}\n\n\treturn getAttachmentID(request.HostID, request.VolumeID), nil\n}", "func (s *VarlinkInterface) Attach(ctx context.Context, c VarlinkCall, name_ string, detachKeys_ string, start_ bool) error {\n\treturn c.ReplyMethodNotImplemented(ctx, \"io.podman.Attach\")\n}", "func (c *Controller) Attach(attachRequest k8sresources.FlexVolumeAttachRequest) k8sresources.FlexVolumeResponse {\n\tc.logger.Println(\"controller-attach-start\")\n\tdefer c.logger.Println(\"controller-attach-end\")\n\n\tif attachRequest.Version == k8sresources.KubernetesVersion_1_5 {\n\t\tc.logger.Printf(\"k8s 1.5 attach just returning Success\")\n\t\treturn k8sresources.FlexVolumeResponse{\n\t\t\tStatus: \"Success\",\n\t\t}\n\t}\n\tc.logger.Printf(\"For k8s version 1.6 and higher, Ubiquity just returns NOT supported for Attach API. This might change in the future\")\n\treturn k8sresources.FlexVolumeResponse{\n\t\tStatus: \"Not supported\",\n\t}\n}", "func (vpcs *VPCSession) WaitForAttachVolume(volumeAttachmentTemplate provider.VolumeAttachmentRequest) (*provider.VolumeAttachmentResponse, error) {\n\tvpcs.Logger.Debug(\"Entry of WaitForAttachVolume method...\")\n\tdefer vpcs.Logger.Debug(\"Exit from WaitForAttachVolume method...\")\n\tvpcs.Logger.Info(\"Validating basic inputs for WaitForAttachVolume method...\", zap.Reflect(\"volumeAttachmentTemplate\", volumeAttachmentTemplate))\n\terr := vpcs.validateAttachVolumeRequest(volumeAttachmentTemplate)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmaxTimeout, maxRetryAttempt, retryGapDuration := vpcs.Config.GetTimeOutParameters()\n\tretryCount := 0\n\tvpcs.Logger.Info(\"Waiting for volume to be attached\", zap.Int(\"maxTimeout\", maxTimeout))\n\tfor retryCount < maxRetryAttempt {\n\t\tcurrentVolAttachment, errAPI := vpcs.GetVolumeAttachment(volumeAttachmentTemplate)\n\t\tif errAPI == nil && currentVolAttachment.Status == StatusAttached {\n\t\t\t// volume is attached return no error\n\t\t\tvpcs.Logger.Info(\"Volume attachment is complete\", zap.Int(\"retry attempt\", retryCount), zap.Int(\"max retry attepmts\", maxRetryAttempt), zap.Reflect(\"currentVolAttachment\", currentVolAttachment))\n\t\t\treturn currentVolAttachment, nil\n\t\t} else if errAPI != nil {\n\t\t\t// do not retry if there is error\n\t\t\tvpcs.Logger.Error(\"Error occured while finding volume attachment\", zap.Error(errAPI))\n\t\t\tuserErr := userError.GetUserError(string(userError.VolumeAttachFailed), errAPI, volumeAttachmentTemplate.VolumeID, volumeAttachmentTemplate.InstanceID)\n\t\t\treturn nil, userErr\n\t\t}\n\t\t// retry if attach status is not \"attached\"\n\t\tretryCount = retryCount + 1\n\t\tvpcs.Logger.Info(\"Volume is still attaching. Retry..\", zap.Int(\"retry attempt\", retryCount), zap.Int(\"max retry attepmts\", maxRetryAttempt), zap.Reflect(\"currentVolAttachment\", currentVolAttachment))\n\t\ttime.Sleep(retryGapDuration)\n\t}\n\tuserErr := userError.GetUserError(string(userError.VolumeAttachTimedOut), nil, volumeAttachmentTemplate.VolumeID, volumeAttachmentTemplate.InstanceID, vpcs.Config.Timeout)\n\tvpcs.Logger.Info(\"Wait for attach timed out\", zap.Error(userErr))\n\n\treturn nil, userErr\n}", "func ServeAttach(w http.ResponseWriter, req *http.Request, attacher Attacher, podName string, uid types.UID, container string, streamOpts *Options, idleTimeout, streamCreationTimeout time.Duration, supportedProtocols []string) {\n\tctx, ok := createStreams(req, w, streamOpts, supportedProtocols, idleTimeout, streamCreationTimeout)\n\tif !ok {\n\t\t// error is handled by createStreams\n\t\treturn\n\t}\n\tdefer ctx.conn.Close()\n\n\terr := attacher.AttachContainer(req.Context(), podName, uid, container, ctx.stdinStream, ctx.stdoutStream, ctx.stderrStream, ctx.tty, ctx.resizeChan)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"error attaching to container: %v\", err)\n\t\truntime.HandleError(err)\n\t\tctx.writeStatus(apierrors.NewInternalError(err))\n\t} else {\n\t\tctx.writeStatus(&apierrors.StatusError{ErrStatus: metav1.Status{\n\t\t\tStatus: metav1.StatusSuccess,\n\t\t}})\n\t}\n}", "func NewVolumeAttachment(ctx *pulumi.Context,\n\tname string, args *VolumeAttachmentArgs, opts ...pulumi.ResourceOption) (*VolumeAttachment, error) {\n\tif args == nil || args.DropletId == nil {\n\t\treturn nil, errors.New(\"missing required argument 'DropletId'\")\n\t}\n\tif args == nil || args.VolumeId == nil {\n\t\treturn nil, errors.New(\"missing required argument 'VolumeId'\")\n\t}\n\tif args == nil {\n\t\targs = &VolumeAttachmentArgs{}\n\t}\n\tvar resource VolumeAttachment\n\terr := ctx.RegisterResource(\"digitalocean:index/volumeAttachment:VolumeAttachment\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (d *VolumeDriver) MountVolume(name string, fstype string, id string, isReadOnly bool, skipAttach bool) (string, error) {\n\tlog.Errorf(\"VolumeDriver MountVolume to be implemented\")\n\tmountpoint := getMountPoint(name)\n\treturn mountpoint, nil\n}", "func (m *Machine) attachDrive(ctx context.Context, dev models.Drive) error {\n\thostPath := StringValue(dev.PathOnHost)\n\tm.logger.Infof(\"Attaching drive %s, slot %s, root %t.\", hostPath, StringValue(dev.DriveID), BoolValue(dev.IsRootDevice))\n\trespNoContent, err := m.client.PutGuestDriveByID(ctx, StringValue(dev.DriveID), &dev)\n\tif err == nil {\n\t\tm.logger.Printf(\"Attached drive %s: %s\", hostPath, respNoContent.Error())\n\t} else {\n\t\tm.logger.Errorf(\"Attach drive failed: %s: %s\", hostPath, err)\n\t}\n\treturn err\n}", "func (self *AltaActor) mountVolume() error {\n\t// For each volume\n\tfor _, volume := range self.Model.Spec.Volumes {\n\t\tlog.Infof(\"Mounting volume: %+v\", volume)\n\n\t\t// Mount the volume. create it if it doesnt exist\n\t\terr := volumesCtrler.MountVolume(volume, self.Model.CurrNode)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Error mounting volume. Err: %v\", err)\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\t// Trigger next event\n\tself.AltaEvent(\"pullImg\")\n\n\treturn nil\n}", "func (_m *OpenStackMock) AttachVolume(instanceID string, volumeID string) (string, error) {\n\tret := _m.Called(instanceID, volumeID)\n\n\tvar r0 string\n\tif rf, ok := ret.Get(0).(func(string, string) string); ok {\n\t\tr0 = rf(instanceID, volumeID)\n\t} else {\n\t\tr0 = ret.Get(0).(string)\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(string, string) error); ok {\n\t\tr1 = rf(instanceID, volumeID)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "func (endpoint *PhysicalEndpoint) Attach(h hypervisor) error {\n\tnetworkLogger().WithField(\"endpoint-type\", \"physical\").Info(\"Attaching endpoint\")\n\n\t// Unbind physical interface from host driver and bind to vfio\n\t// so that it can be passed to qemu.\n\tif err := bindNICToVFIO(endpoint); err != nil {\n\t\treturn err\n\t}\n\n\t// TODO: use device manager as general device management entrance\n\td := config.VFIODev{\n\t\tBDF: endpoint.BDF,\n\t}\n\n\treturn h.addDevice(d, vfioDev)\n}", "func (endpoint *MacvtapEndpoint) Attach(h hypervisor) error {\n\tnetworkLogger().WithField(\"endpoint-type\", \"macvtap\").Info(\"Attaching endpoint\")\n\tvar err error\n\n\tendpoint.VMFds, err = createMacvtapFds(endpoint.EndpointProperties.Iface.Index, int(h.hypervisorConfig().NumVCPUs))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Could not setup macvtap fds %s: %s\", endpoint.EndpointProperties.Iface.Name, err)\n\t}\n\n\tif !h.hypervisorConfig().DisableVhostNet {\n\t\tvhostFds, err := createVhostFds(int(h.hypervisorConfig().NumVCPUs))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Could not setup vhost fds %s : %s\", endpoint.EndpointProperties.Iface.Name, err)\n\t\t}\n\t\tendpoint.VhostFds = vhostFds\n\t}\n\n\treturn h.addDevice(endpoint, netDev)\n}", "func (endpoint *VirtualEndpoint) Attach(h hypervisor) error {\n\tnetworkLogger().WithField(\"endpoint-type\", \"virtual\").Info(\"Attaching endpoint\")\n\n\tif err := xconnectVMNetwork(endpoint, true, h.hypervisorConfig().NumVCPUs, h.hypervisorConfig().DisableVhostNet); err != nil {\n\t\tnetworkLogger().WithError(err).Error(\"Error bridging virtual endpoint\")\n\t\treturn err\n\t}\n\n\treturn h.addDevice(endpoint, netDev)\n}", "func (c *Container) Attach(vAttach, hAttach AttachPoint) *Container {\n\tc.vAttach, c.hAttach = vAttach, hAttach\n\treturn c\n}", "func (r *Resource) AddVolume(id, minor int, backingDevice, hostname string) error {\n\tv := volume{\n\t\tid: id,\n\t\tminor: minor,\n\t\tbackingDevice: backingDevice,\n\t}\n\n\tr.Lock()\n\tdefer r.Unlock()\n\n\thost, ok := r.host[hostname]\n\tif !ok {\n\t\treturn fmt.Errorf(\"Could not find existing host with hostname: %v\", hostname)\n\t}\n\n\tif err := checkVolumes(host, v); err != nil {\n\t\treturn err\n\t}\n\n\thost.volume[id] = v\n\tr.host[hostname] = host\n\n\treturn nil\n}", "func MountVolume(vol *apis.LVMVolume, mount *MountInfo, podLVInfo *PodLVInfo) error {\n\tvolume := vol.Spec.VolGroup + \"/\" + vol.Name\n\tmounted, err := verifyMountRequest(vol, mount.MountPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif mounted {\n\t\tklog.Infof(\"lvm : already mounted %s => %s\", volume, mount.MountPath)\n\t\treturn nil\n\t}\n\n\tdevicePath := DevPath + volume\n\n\terr = FormatAndMountVol(devicePath, mount)\n\tif err != nil {\n\t\treturn status.Errorf(\n\t\t\tcodes.Internal,\n\t\t\t\"failed to format and mount the volume error: %s\",\n\t\t\terr.Error(),\n\t\t)\n\t}\n\n\tklog.Infof(\"lvm: volume %v mounted %v fs %v\", volume, mount.MountPath, mount.FSType)\n\n\tif ioLimitsEnabled && podLVInfo != nil {\n\t\tif err := setIOLimits(vol, podLVInfo, devicePath); err != nil {\n\t\t\tklog.Warningf(\"lvm: error setting io limits: podUid %s, device %s, err=%v\", podLVInfo.UID, devicePath, err)\n\t\t} else {\n\t\t\tklog.Infof(\"lvm: io limits set for podUid %v, device %s\", podLVInfo.UID, devicePath)\n\t\t}\n\t}\n\n\treturn nil\n}", "func mountVolume(ctx context.Context, src, dest, vID string, size int64, readOnly bool) error {\n\tglog.V(5).Infof(\"[mountVolume] source: %v destination: %v\", src, dest)\n\tif err := SafeMount(src, dest, string(FSTypeXFS),\n\t\tfunc() []MountOption {\n\t\t\tmOpts := []MountOption{\n\t\t\t\tMountOptionMSBind,\n\t\t\t}\n\t\t\tif readOnly {\n\t\t\t\tmOpts = append(mOpts, MountOptionMSReadOnly)\n\t\t\t}\n\t\t\treturn mOpts\n\t\t}(), []string{quotaOption}); err != nil {\n\t\treturn err\n\t}\n\n\tif size > 0 {\n\t\txfsQuota := &xfs.XFSQuota{\n\t\t\tPath: dest,\n\t\t\tProjectID: vID,\n\t\t}\n\t\tif err := xfsQuota.SetQuota(ctx, size); err != nil {\n\t\t\treturn status.Errorf(codes.Internal, \"Error while setting xfs limits: %v\", err)\n\t\t}\n\t}\n\n\treturn nil\n}", "func (attacher *azureDiskAttacher) WaitForAttach(spec *volume.Spec, lunStr string, timeout time.Duration) (string, error) {\n\tvolumeSource, err := getVolumeSource(spec)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif len(lunStr) == 0 {\n\t\treturn \"\", fmt.Errorf(\"WaitForAttach failed for Azure disk %q: lun is empty.\", volumeSource.DiskName)\n\t}\n\n\tlun, err := strconv.Atoi(lunStr)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"WaitForAttach: wrong lun %q, err: %v\", lunStr, err)\n\t}\n\tscsiHostRescan(&osIOHandler{})\n\texe := exec.New()\n\tdevicePath := \"\"\n\n\terr = wait.Poll(checkSleepDuration, timeout, func() (bool, error) {\n\t\tglog.V(4).Infof(\"Checking Azure disk %q(lun %s) is attached.\", volumeSource.DiskName, lunStr)\n\t\tif devicePath, err = findDiskByLun(lun, &osIOHandler{}, exe); err == nil {\n\t\t\tif len(devicePath) == 0 {\n\t\t\t\tglog.Warningf(\"cannot find attached Azure disk %q(lun %s) locally.\", volumeSource.DiskName, lunStr)\n\t\t\t\treturn false, fmt.Errorf(\"cannot find attached Azure disk %q(lun %s) locally.\", volumeSource.DiskName, lunStr)\n\t\t\t}\n\t\t\tglog.V(4).Infof(\"Successfully found attached Azure disk %q(lun %s, device path %s).\", volumeSource.DiskName, lunStr, devicePath)\n\t\t\treturn true, nil\n\t\t} else {\n\t\t\t//Log error, if any, and continue checking periodically\n\t\t\tglog.V(4).Infof(\"Error Stat Azure disk (%q) is attached: %v\", volumeSource.DiskName, err)\n\t\t\treturn false, nil\n\t\t}\n\t})\n\treturn devicePath, err\n}", "func (g *Generator) AddBindMount(source, dest, options string) {\n\tif options == \"\" {\n\t\toptions = \"ro\"\n\t}\n\n\tdefaultOptions := []string{\"bind\"}\n\n\tmnt := rspec.Mount{\n\t\tDestination: dest,\n\t\tType: \"bind\",\n\t\tSource: source,\n\t\tOptions: append(defaultOptions, options),\n\t}\n\tg.initSpec()\n\tg.spec.Mounts = append(g.spec.Mounts, mnt)\n}", "func (s stack) CreateVolumeAttachment(ctx context.Context, request abstract.VolumeAttachmentRequest) (string, fail.Error) {\n\tif valid.IsNil(s) {\n\t\treturn \"\", fail.InvalidInstanceError()\n\t}\n\treturn \"\", fail.NotImplementedError(\"implement me\")\n}", "func (d *lvm) CreateVolume(vol Volume, filler *VolumeFiller, op *operations.Operation) error {\n\trevert := revert.New()\n\tdefer revert.Fail()\n\n\tvolPath := vol.MountPath()\n\terr := vol.EnsureMountPath()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trevert.Add(func() { _ = os.RemoveAll(volPath) })\n\n\terr = d.createLogicalVolume(d.config[\"lvm.vg_name\"], d.thinpoolName(), vol, d.usesThinpool())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error creating LVM logical volume: %w\", err)\n\t}\n\n\trevert.Add(func() { _ = d.DeleteVolume(vol, op) })\n\n\t// For VMs, also create the filesystem volume.\n\tif vol.IsVMBlock() {\n\t\tfsVol := vol.NewVMBlockFilesystemVolume()\n\t\terr := d.CreateVolume(fsVol, nil, op)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\trevert.Add(func() { _ = d.DeleteVolume(fsVol, op) })\n\t}\n\n\terr = vol.MountTask(func(mountPath string, op *operations.Operation) error {\n\t\t// Run the volume filler function if supplied.\n\t\tif filler != nil && filler.Fill != nil {\n\t\t\tvar err error\n\t\t\tvar devPath string\n\n\t\t\tif IsContentBlock(vol.contentType) {\n\t\t\t\t// Get the device path.\n\t\t\t\tdevPath, err = d.GetVolumeDiskPath(vol)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tallowUnsafeResize := false\n\t\t\tif vol.volType == VolumeTypeImage || !d.usesThinpool() {\n\t\t\t\t// Allow filler to resize initial image and non-thin volumes as needed.\n\t\t\t\t// Some storage drivers don't normally allow image volumes to be resized due to\n\t\t\t\t// them having read-only snapshots that cannot be resized. However when creating\n\t\t\t\t// the initial volume and filling it unsafe resizing can be allowed and is required\n\t\t\t\t// in order to support unpacking images larger than the default volume size.\n\t\t\t\t// The filler function is still expected to obey any volume size restrictions\n\t\t\t\t// configured on the pool.\n\t\t\t\t// Unsafe resize is also needed to disable filesystem resize safety checks.\n\t\t\t\t// This is safe because if for some reason an error occurs the volume will be\n\t\t\t\t// discarded rather than leaving a corrupt filesystem.\n\t\t\t\tallowUnsafeResize = true\n\t\t\t}\n\n\t\t\t// Run the filler.\n\t\t\terr = d.runFiller(vol, devPath, filler, allowUnsafeResize)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// Move the GPT alt header to end of disk if needed.\n\t\t\tif vol.IsVMBlock() {\n\t\t\t\terr = d.moveGPTAltHeader(devPath)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif vol.contentType == ContentTypeFS {\n\t\t\t// Run EnsureMountPath again after mounting and filling to ensure the mount directory has\n\t\t\t// the correct permissions set.\n\t\t\terr = vol.EnsureMountPath()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t}, op)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trevert.Success()\n\treturn nil\n}", "func (s *Stack) CreateVolumeAttachment(request resources.VolumeAttachmentRequest) (string, error) {\n\tif s == nil {\n\t\treturn \"\", scerr.InvalidInstanceError()\n\t}\n\tif request.Name == \"\" {\n\t\treturn \"\", scerr.InvalidParameterError(\"request.Name\", \"cannot be empty string\")\n\t}\n\n\tdefer concurrency.NewTracer(nil, \"(\"+request.Name+\")\", true).WithStopwatch().GoingIn().OnExitTrace()()\n\n\t// Creates the attachment\n\tr := volumeattach.Create(s.ComputeClient, request.HostID, volumeattach.CreateOpts{\n\t\tVolumeID: request.VolumeID,\n\t})\n\tva, err := r.Extract()\n\tif err != nil {\n\t\treturn \"\", scerr.Wrap(err, fmt.Sprintf(\"error creating volume attachment between server %s and volume %s: %s\", request.HostID, request.VolumeID, ProviderErrorToString(err)))\n\t}\n\n\treturn va.ID, nil\n}", "func (d DobsClient) DetachVolume(ctx Context, volumeID string, dropletID string) (error) {\n\tdropletIDI, err := strconv.Atoi(dropletID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\taction, _, err := d.GodoClient.StorageActions.DetachByDropletID(ctx, volumeID, dropletIDI)\t\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = d.waitForAction(ctx, volumeID, action)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func TestVolumeExistAttach(t *testing.T) {\n\tclientset := test.New(3)\n\n\tos.Setenv(k8sutil.PodNamespaceEnvVar, \"rook-system\")\n\tdefer os.Unsetenv(k8sutil.PodNamespaceEnvVar)\n\n\tos.Setenv(k8sutil.NodeNameEnvVar, \"node1\")\n\tdefer os.Unsetenv(k8sutil.NodeNameEnvVar)\n\n\tcontext := &clusterd.Context{\n\t\tClientset: clientset,\n\t\tRookClientset: rookclient.NewSimpleClientset(),\n\t}\n\n\topts := AttachOptions{\n\t\tImage: \"image123\",\n\t\tPool: \"testpool\",\n\t\tClusterNamespace: \"testCluster\",\n\t\tMountDir: \"/test/pods/pod123/volumes/rook.io~rook/pvc-123\",\n\t\tVolumeName: \"pvc-123\",\n\t\tPod: \"myPod\",\n\t\tPodNamespace: \"Default\",\n\t\tRW: \"rw\",\n\t}\n\n\texistingCRD := &rookalpha.Volume{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"pvc-123\",\n\t\t\tNamespace: \"rook-system\",\n\t\t},\n\t\tAttachments: []rookalpha.Attachment{\n\t\t\t{\n\t\t\t\tNode: \"node1\",\n\t\t\t\tPodNamespace: \"Default\",\n\t\t\t\tPodName: \"myPod\",\n\t\t\t\tMountDir: \"/test/pods/pod123/volumes/rook.io~rook/pvc-123\",\n\t\t\t\tReadOnly: false,\n\t\t\t},\n\t\t},\n\t}\n\tvolumeAttachment, err := context.RookClientset.RookV1alpha2().Volumes(\"rook-system\").Create(existingCRD)\n\tassert.Nil(t, err)\n\tassert.NotNil(t, volumeAttachment)\n\n\tatt, err := attachment.New(context)\n\tassert.Nil(t, err)\n\n\tdevicePath := \"\"\n\tcontroller := &Controller{\n\t\tcontext: context,\n\t\tvolumeAttachment: att,\n\t\tvolumeManager: &manager.FakeVolumeManager{},\n\t}\n\n\terr = controller.Attach(opts, &devicePath)\n\tassert.Nil(t, err)\n\n\tnewAttach, err := context.RookClientset.RookV1alpha2().Volumes(\"rook-system\").Get(\"pvc-123\", metav1.GetOptions{})\n\tassert.Nil(t, err)\n\tassert.NotNil(t, newAttach)\n\t// TODO: Check that the volume attach was not updated (can't use ResourceVersion in the fake testing)\n}", "func MountBlock(vol *apis.LVMVolume, mountinfo *MountInfo, podLVInfo *PodLVInfo) error {\n\ttarget := mountinfo.MountPath\n\tvolume := vol.Spec.VolGroup + \"/\" + vol.Name\n\tdevicePath := DevPath + volume\n\n\tmountopt := []string{\"bind\"}\n\n\tmounter := &mount.SafeFormatAndMount{Interface: mount.New(\"\"), Exec: utilexec.New()}\n\n\t// Create the mount point as a file since bind mount device node requires it to be a file\n\terr := makeFile(target)\n\tif err != nil {\n\t\treturn status.Errorf(codes.Internal, \"Could not create target file %q: %v\", target, err)\n\t}\n\n\t// do the bind mount of the device at the target path\n\tif err := mounter.Mount(devicePath, target, \"\", mountopt); err != nil {\n\t\tif removeErr := os.Remove(target); removeErr != nil {\n\t\t\treturn status.Errorf(codes.Internal, \"Could not remove mount target %q: %v\", target, removeErr)\n\t\t}\n\t\treturn status.Errorf(codes.Internal, \"mount failed at %v err : %v\", target, err)\n\t}\n\n\tklog.Infof(\"NodePublishVolume mounted block device %s at %s\", devicePath, target)\n\n\tif ioLimitsEnabled && podLVInfo != nil {\n\t\tif err := setIOLimits(vol, podLVInfo, devicePath); err != nil {\n\t\t\tklog.Warningf(\": error setting io limits for podUid %s, device %s, err=%v\", podLVInfo.UID, devicePath, err)\n\t\t} else {\n\t\t\tklog.Infof(\"lvm: io limits set for podUid %s, device %s\", podLVInfo.UID, devicePath)\n\t\t}\n\t}\n\treturn nil\n}", "func IsAttachableVolume(volumeSpec *volume.Spec, volumePluginMgr *volume.VolumePluginMgr) bool {\n\tattachableVolumePlugin, _ := volumePluginMgr.FindAttachablePluginBySpec(volumeSpec)\n\tif attachableVolumePlugin != nil {\n\t\tvolumeAttacher, err := attachableVolumePlugin.NewAttacher()\n\t\tif err == nil && volumeAttacher != nil {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "func (z *zpoolctl) Attach(ctx context.Context, name string, force bool, properties map[string]string, dev, newDev string) *execute {\n\targs := []string{\"attach\"}\n\tif force {\n\t\targs = append(args, \"-f\")\n\t}\n\tif properties != nil {\n\t\tkv := \"-o \"\n\t\tfor k, v := range properties {\n\t\t\tkv += fmt.Sprintf(\"%s=%s,\", k, v)\n\t\t}\n\t\tkv = strings.TrimSuffix(kv, \",\")\n\t\targs = append(args, kv)\n\t}\n\targs = append(args, name, dev, newDev)\n\treturn &execute{ctx: ctx, name: z.cmd, args: args}\n}", "func (d *Domain) AttachDevice(x string, flags libvirt.DomainDeviceModifyFlags) error {\n\treq := libvirt.RemoteDomainAttachDeviceFlagsReq{\n\t\tDomain: d.RemoteDomain,\n\t\tXml: x,\n\t\tFlags: uint32(flags)}\n\n\tbuf, err := encode(&req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tresp, err := d.l.send(libvirt.RemoteProcDomainAttachDeviceFlags, 0, libvirt.MessageTypeCall, libvirt.RemoteProgram, libvirt.MessageStatusOK, &buf)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tr := <-resp\n\tif r.Header.Status != libvirt.MessageStatusOK {\n\t\treturn decodeError(r.Payload)\n\t}\n\n\treturn nil\n}", "func addVolumeMount(pod corev1.Pod) (patch []patchOperation) {\n\n\tcontainers := pod.Spec.Containers\n\n\tvolumeMount := corev1.VolumeMount{\n\t\tName: \"secrets\",\n\t\tMountPath: \"/secrets\",\n\t}\n\n\tmodifiedContainers := []corev1.Container{}\n\n\tfor _, container := range containers {\n\t\tcontainer.VolumeMounts = appendVolumeMountIfMissing(container.VolumeMounts, volumeMount)\n\t\tmodifiedContainers = append(modifiedContainers, container)\n\t}\n\n\tpatch = append(patch, patchOperation{\n\t\tOp: \"replace\",\n\t\tPath: \"/spec/containers\",\n\t\tValue: modifiedContainers,\n\t})\n\n\treturn\n}", "func (v *VolumeManager) AddVolume(n string) error {\n\tv.mutex.Lock()\n\tdefer v.mutex.Unlock()\n\n\tif _, exists := v.volumes[n]; exists {\n\t\treturn nil\n\t}\n\n\tvol := v.NewVolume(n)\n\n\t//ws.Println(\"Found volume\", n)\n\n\t// Ensure its not mounted - ignore the error\n\t_ = vol.Umount()\n\n\t// Mount the mount point\n\terr := vol.Mount(true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Finally add to available volume set\n\tv.volumes[n] = vol\n\n\tvar st unix.Statfs_t\n\terr = vol.Statfs(&st)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (daemon *Daemon) ContainerAttach(prefixOrName string, c *backend.ContainerAttachConfig) error {\n\tkeys := []byte{}\n\tvar err error\n\tif c.DetachKeys != \"\" {\n\t\tkeys, err = term.ToBytes(c.DetachKeys)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Invalid escape keys (%s) provided\", c.DetachKeys)\n\t\t}\n\t}\n\n\tcontainer, err := daemon.GetContainer(prefixOrName)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif container.IsPaused() {\n\t\terr := fmt.Errorf(\"Container %s is paused. Unpause the container before attach\", prefixOrName)\n\t\treturn errors.NewRequestConflictError(err)\n\t}\n\n\tinStream, outStream, errStream, err := c.GetStreams()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer inStream.Close()\n\n\tif !container.Config.Tty && c.MuxStreams {\n\t\terrStream = stdcopy.NewStdWriter(errStream, stdcopy.Stderr)\n\t\toutStream = stdcopy.NewStdWriter(outStream, stdcopy.Stdout)\n\t}\n\n\tvar cfg containerAttachConfig\n\n\tif c.UseStdin {\n\t\tcfg.stdin = inStream\n\t}\n\tif c.UseStdout {\n\t\tcfg.stdout = outStream\n\t}\n\tif c.UseStderr {\n\t\tcfg.stderr = errStream\n\t}\n\n\tcfg.showHistory = c.Logs\n\tcfg.stream = c.Stream\n\tcfg.detachKeys = keys\n\n\tif err := daemon.containerAttach(container, &cfg); err != nil {\n\t\tfmt.Fprintf(outStream, \"Error attaching: %s\\n\", err)\n\t}\n\treturn nil\n}", "func AddSecretVolume(secretName, volumeName, mountPath string, spec *corev1.PodSpec) {\n\tv := &spec.Volumes\n\n\tif _, index := findSecretInVolume(spec, volumeName); index < 0 {\n\t\t*v = append(*v, corev1.Volume{Name: volumeName,\n\t\t\tVolumeSource: corev1.VolumeSource{\n\t\t\t\tSecret: &corev1.SecretVolumeSource{\n\t\t\t\t\tSecretName: secretName,\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\t}\n\n\tvolumeMount := corev1.VolumeMount{\n\t\tName: volumeName,\n\t\tMountPath: mountPath,\n\t}\n\n\tindex := -1\n\tvolumeMounts := &spec.Containers[0].VolumeMounts\n\tfor i, vm := range *volumeMounts {\n\t\tif vm.Name == volumeName {\n\t\t\tindex = i\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif index < 0 {\n\t\t*volumeMounts = append(*volumeMounts, volumeMount)\n\t} else {\n\t\t(*volumeMounts)[index] = volumeMount\n\t}\n}", "func (p *EtcdClientV3) AddVolume(vol *storage.Volume) error {\n\tvolExternal := vol.ConstructExternal()\n\tvolJSON, err := json.Marshal(volExternal)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = p.Create(config.VolumeURL+\"/\"+vol.Config.Name, string(volJSON))\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (c *Container) Attach(noStdin bool, keys string, attached chan<- bool) error {\n\tif err := c.syncContainer(); err != nil {\n\t\treturn err\n\t}\n\n\tif c.state.State != ContainerStateCreated &&\n\t\tc.state.State != ContainerStateRunning {\n\t\treturn errors.Wrapf(ErrCtrStateInvalid, \"can only attach to created or running containers\")\n\t}\n\n\t// Check the validity of the provided keys first\n\tvar err error\n\tdetachKeys := []byte{}\n\tif len(keys) > 0 {\n\t\tdetachKeys, err = term.ToBytes(keys)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"invalid detach keys\")\n\t\t}\n\t}\n\n\tresize := make(chan remotecommand.TerminalSize)\n\tdefer close(resize)\n\n\terr = c.attachContainerSocket(resize, noStdin, detachKeys, attached)\n\treturn err\n}", "func attachLoopDevice(ctx context.Context, loopFile string) (string, error) {\n\tLogc(ctx).WithField(\"loopFile\", loopFile).Debug(\">>>> bof.attachLoopDevice\")\n\tdefer Logc(ctx).Debug(\"<<<< bof.attachLoopDevice\")\n\n\tout, err := command.ExecuteWithTimeout(ctx, \"losetup\", 10*time.Second, true, \"--find\", \"--show\", \"--direct-io\",\n\t\t\"--nooverlap\",\n\t\tloopFile)\n\tif err != nil {\n\t\tLogc(ctx).WithError(err).Error(\"Failed to attach loop file.\")\n\t\treturn \"\", fmt.Errorf(\"failed to attach loop file: %v\", err)\n\t}\n\n\tdevice := strings.TrimSpace(string(out))\n\tif deviceRegex.MatchString(device) {\n\t\treturn device, nil\n\t}\n\n\treturn \"\", fmt.Errorf(\"losetup returned an invalid value (%s)\", device)\n}", "func (r *remoteRuntimeService) Attach(ctx context.Context, req *runtimeapi.AttachRequest) (*runtimeapi.AttachResponse, error) {\n\tklog.V(10).InfoS(\"[RemoteRuntimeService] Attach\", \"containerID\", req.ContainerId, \"timeout\", r.timeout)\n\tctx, cancel := context.WithTimeout(ctx, r.timeout)\n\tdefer cancel()\n\n\treturn r.attachV1(ctx, req)\n}", "func (s *System) Attach(w *world.World) error {\n\ts.save = w.Save\n\treturn nil\n}", "func (c *Vrouter) AddSecretVolumesToIntendedDS(ds *appsv1.DaemonSet, volumeConfigMapMap map[string]string) {\n\tAddSecretVolumesToIntendedDS(ds, volumeConfigMapMap)\n}", "func (endpoint *HNSEndpoint) ContainerAttach(containerID string, compartmentID uint16) error {\n\toperation := \"ContainerAttach\"\n\ttitle := \"hcsshim::HNSEndpoint::\" + operation\n\tlogrus.Debugf(title+\" id=%s\", endpoint.Id)\n\n\trequestMessage := &EndpointAttachDetachRequest{\n\t\tContainerID: containerID,\n\t\tCompartmentID: compartmentID,\n\t\tSystemType: ContainerType,\n\t}\n\tresponse := &EndpointResquestResponse{}\n\tjsonString, err := json.Marshal(requestMessage)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn hnsCall(\"POST\", \"/endpoints/\"+endpoint.Id+\"/attach\", string(jsonString), &response)\n}", "func (d *lvm) BackupVolume(vol Volume, tarWriter *instancewriter.InstanceTarWriter, _ bool, snapshots []string, op *operations.Operation) error {\n\treturn genericVFSBackupVolume(d, vol, tarWriter, snapshots, op)\n}", "func (s *Session) AttachTagToVm(ctx context.Context, tagName string, tagCatName string, vmRef mo.Reference) error {\n\trestClient := s.Client.RestClient()\n\tmanager := tags.NewManager(restClient)\n\ttag, err := manager.GetTagForCategory(ctx, tagName, tagCatName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn manager.AttachTag(ctx, tag.ID, vmRef)\n}", "func (b *Buffer) Attach(buffer []byte) {\n b.AttachBytes(buffer, 0, len(buffer))\n}", "func applyRegularVolume(vmParam *volumeMountParam, volume *types.VolumeWrapper, pod *types.Pod) {\n\tvolumeName := volume.Volume.VolumeMeta.Name\n\tvolumeMount := &types.VolumeMount{\n\t\tMountPath: \"/\" + volumeName,\n\t\tStore: volumeName,\n\t}\n\n\tappendVolumeMountToContainer(vmParam.ContainerName, volumeMount, pod)\n\tpod.Volumes = append(pod.Volumes, volume.Volume)\n}", "func attachContainerToNetwork(ctx context.Context, cli *client.Client, containerID string, networkID string) error {\n\tctx, cancel := context.WithTimeout(ctx, 10*time.Second)\n\tdefer cancel()\n\treturn cli.NetworkConnect(ctx, networkID, containerID, nil)\n}", "func (d *MinioDriver) mountVolume(volume *minioVolume) error {\n\n\tminioPath := fmt.Sprintf(\"%s/%s\", d.server, volume.bucketName)\n\n\t//NOTE: make this adjustable in the future for https if secure is passed.\n\tcmd := fmt.Sprintf(\"mount -t minfs http://%s %s\", minioPath, volume.mountpoint)\n\tif err := provisionConfig(d); err != nil {\n\t\treturn err\n\t}\n\n\tout, err := exec.Command(\"sh\", \"-c\", cmd).Output()\n\tif err != nil {\n\t\tglog.Warningf(\"Error while executing mount command (%s): %s\", cmd, err)\n\t\tglog.V(1).Infof(\"Dump output of command: %#v\", out)\n\t\treturn err\n\t}\n\treturn nil\n}", "func (device *BlockDevice) Attach(ctx context.Context, devReceiver api.DeviceReceiver) (err error) {\n\tskip, err := device.bumpAttachCount(true)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif skip {\n\t\treturn nil\n\t}\n\n\t// Increment the block index for the sandbox. This is used to determine the name\n\t// for the block device in the case where the block device is used as container\n\t// rootfs and the predicted block device name needs to be provided to the agent.\n\tindex, err := devReceiver.GetAndSetSandboxBlockIndex()\n\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tdevReceiver.UnsetSandboxBlockIndex(index)\n\t\t\tdevice.bumpAttachCount(false)\n\t\t}\n\t}()\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\thypervisorType := devReceiver.GetHypervisorType()\n\tif hypervisorType == \"acrn\" {\n\t\tdeviceLogger().Debug(\"Special casing for ACRN to increment BlockIndex\")\n\t\tindex = index + 1\n\t}\n\n\tdrive := &config.BlockDrive{\n\t\tFile: device.DeviceInfo.HostPath,\n\t\tFormat: \"raw\",\n\t\tID: utils.MakeNameID(\"drive\", device.DeviceInfo.ID, maxDevIDSize),\n\t\tIndex: index,\n\t\tPmem: device.DeviceInfo.Pmem,\n\t\tReadOnly: device.DeviceInfo.ReadOnly,\n\t}\n\n\tif fs, ok := device.DeviceInfo.DriverOptions[config.FsTypeOpt]; ok {\n\t\tdrive.Format = fs\n\t}\n\n\tcustomOptions := device.DeviceInfo.DriverOptions\n\tif customOptions == nil ||\n\t\tcustomOptions[config.BlockDriverOpt] == config.VirtioSCSI {\n\t\t// User has not chosen a specific block device type\n\t\t// Default to SCSI\n\t\tscsiAddr, err := utils.GetSCSIAddress(index)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tdrive.SCSIAddr = scsiAddr\n\t} else if customOptions[config.BlockDriverOpt] != config.Nvdimm {\n\t\tvar globalIdx int\n\n\t\tswitch customOptions[config.BlockDriverOpt] {\n\t\tcase config.VirtioBlock:\n\t\t\tglobalIdx = index\n\t\tcase config.VirtioBlockCCW:\n\t\t\tglobalIdx = index\n\t\tcase config.VirtioMmio:\n\t\t\t//With firecracker the rootfs for the VM itself\n\t\t\t//sits at /dev/vda and consumes the first index.\n\t\t\t//Longer term block based VM rootfs should be added\n\t\t\t//as a regular block device which eliminates the\n\t\t\t//offset.\n\t\t\t//https://github.com/kata-containers/runtime/issues/1061\n\t\t\tglobalIdx = index + 1\n\t\t}\n\n\t\tdriveName, err := utils.GetVirtDriveName(globalIdx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tdrive.VirtPath = filepath.Join(\"/dev\", driveName)\n\t}\n\n\tdeviceLogger().WithField(\"device\", device.DeviceInfo.HostPath).WithField(\"VirtPath\", drive.VirtPath).Infof(\"Attaching %s device\", customOptions[config.BlockDriverOpt])\n\tdevice.BlockDrive = drive\n\tif err = devReceiver.HotplugAddDevice(ctx, device, config.DeviceBlock); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (c *Controller) Mount(mountRequest k8sresources.FlexVolumeMountRequest) k8sresources.FlexVolumeResponse {\n\tc.logger.Println(\"controller-mount-start\")\n\tdefer c.logger.Println(\"controller-mount-end\")\n\tc.logger.Println(fmt.Sprintf(\"mountRequest [%#v]\", mountRequest))\n\tvar lnPath string\n\tattachRequest := resources.AttachRequest{Name: mountRequest.MountDevice, Host: getHost()}\n\tmountedPath, err := c.Client.Attach(attachRequest)\n\n\tif err != nil {\n\t\tmsg := fmt.Sprintf(\"Failed to mount volume [%s], Error: %#v\", mountRequest.MountDevice, err)\n\t\tc.logger.Println(msg)\n\t\treturn k8sresources.FlexVolumeResponse{\n\t\t\tStatus: \"Failure\",\n\t\t\tMessage: msg,\n\t\t}\n\t}\n\tif mountRequest.Version == k8sresources.KubernetesVersion_1_5 {\n\t\t//For k8s 1.5, by the time we do the attach/mount, the mountDir (MountPath) is not created trying to do mount and ln will fail because the dir is not found, so we need to create the directory before continuing\n\t\tdir := filepath.Dir(mountRequest.MountPath)\n\t\tc.logger.Printf(\"mountrequest.MountPath %s\", mountRequest.MountPath)\n\t\tlnPath = mountRequest.MountPath\n\t\tk8sRequiredMountPoint := path.Join(mountRequest.MountPath, mountRequest.MountDevice)\n\t\tif _, err = os.Stat(k8sRequiredMountPoint); err != nil {\n\t\t\tif os.IsNotExist(err) {\n\n\t\t\t\tc.logger.Printf(\"creating volume directory %s\", dir)\n\t\t\t\terr = os.MkdirAll(dir, 0777)\n\t\t\t\tif err != nil && !os.IsExist(err) {\n\t\t\t\t\tmsg := fmt.Sprintf(\"Failed creating volume directory %#v\", err)\n\t\t\t\t\tc.logger.Println(msg)\n\n\t\t\t\t\treturn k8sresources.FlexVolumeResponse{\n\t\t\t\t\t\tStatus: \"Failure\",\n\t\t\t\t\t\tMessage: msg,\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// For k8s 1.6 and later kubelet creates a folder as the MountPath, including the volume name, whenwe try to create the symlink this will fail because the same name exists. This is why we need to remove it before continuing.\n\t} else {\n\t\tubiquityMountPrefix := fmt.Sprintf(resources.PathToMountUbiquityBlockDevices, \"\")\n\t\tif strings.HasPrefix(mountedPath, ubiquityMountPrefix) {\n\t\t\tlnPath = mountRequest.MountPath\n\t\t} else {\n\t\t\tlnPath, _ = path.Split(mountRequest.MountPath)\n\t\t}\n\t\tc.logger.Printf(\"removing folder %s\", mountRequest.MountPath)\n\n\t\terr = os.Remove(mountRequest.MountPath)\n\t\tif err != nil && !os.IsExist(err) {\n\t\t\tmsg := fmt.Sprintf(\"Failed removing existing volume directory %#v\", err)\n\t\t\tc.logger.Println(msg)\n\n\t\t\treturn k8sresources.FlexVolumeResponse{\n\t\t\t\tStatus: \"Failure\",\n\t\t\t\tMessage: msg,\n\t\t\t}\n\n\t\t}\n\n\t}\n\tsymLinkCommand := \"/bin/ln\"\n\targs := []string{\"-s\", mountedPath, lnPath}\n\tc.logger.Printf(fmt.Sprintf(\"creating slink from %s -> %s\", mountedPath, lnPath))\n\n\tvar stderr bytes.Buffer\n\tcmd := exec.Command(symLinkCommand, args...)\n\tcmd.Stderr = &stderr\n\n\terr = cmd.Run()\n\tif err != nil {\n\t\tmsg := fmt.Sprintf(\"Controller: mount failed to symlink %#v\", stderr.String())\n\t\tc.logger.Println(msg)\n\t\treturn k8sresources.FlexVolumeResponse{\n\t\t\tStatus: \"Failure\",\n\t\t\tMessage: msg,\n\t\t}\n\n\t}\n\tmsg := fmt.Sprintf(\"Volume mounted successfully to %s\", mountedPath)\n\tc.logger.Println(msg)\n\n\treturn k8sresources.FlexVolumeResponse{\n\t\tStatus: \"Success\",\n\t\tMessage: msg,\n\t}\n}", "func (endpoint *VirtualEndpoint) HotAttach(h hypervisor) error {\n\tnetworkLogger().Info(\"Hot attaching virtual endpoint\")\n\tif err := xconnectVMNetwork(endpoint, true, h.hypervisorConfig().NumVCPUs, h.hypervisorConfig().DisableVhostNet); err != nil {\n\t\tnetworkLogger().WithError(err).Error(\"Error bridging virtual ep\")\n\t\treturn err\n\t}\n\n\tif _, err := h.hotplugAddDevice(endpoint, netDev); err != nil {\n\t\tnetworkLogger().WithError(err).Error(\"Error attach virtual ep\")\n\t\treturn err\n\t}\n\treturn nil\n}", "func (vm *ContainerVM) overlayMount() error {\n\tvm.effectivePath = filepath.Join(vm.instancePath, \"fs\")\n\tworkPath := filepath.Join(vm.instancePath, \"fs_work\")\n\n\terr := os.MkdirAll(vm.effectivePath, 0755)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = os.MkdirAll(workPath, 0755)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// create the overlay mountpoint\n\targs := []string{\n\t\t\"mount\",\n\t\t\"-t\",\n\t\t\"overlay\",\n\t\tfmt.Sprintf(\"megamount_%v\", vm.ID),\n\t\t\"-o\",\n\t\tfmt.Sprintf(\"lowerdir=%v,upperdir=%v,workdir=%v\", vm.FSPath, vm.effectivePath, workPath),\n\t\tvm.effectivePath,\n\t}\n\tlog.Debug(\"mounting overlay: %v\", args)\n\tout, err := processWrapper(args...)\n\tif err != nil {\n\t\tlog.Error(\"overlay mount: %v %v\", err, out)\n\t\treturn err\n\t}\n\treturn nil\n}", "func (d *VolumeDriver) Mount(r volume.MountRequest) volume.Response {\n\tlog.WithFields(log.Fields{\"name\": r.Name}).Info(\"Mounting volume \")\n\n\t// lock the state\n\td.refCounts.StateMtx.Lock()\n\tdefer d.refCounts.StateMtx.Unlock()\n\n\tlog.Errorf(\"VolumeDriver Mount to be implemented\")\n\treturn volume.Response{Err: \"\"}\n}", "func (attacher *azureDiskAttacher) MountDevice(spec *volume.Spec, devicePath string, deviceMountPath string) error {\n\tmounter := attacher.host.GetMounter()\n\tnotMnt, err := mounter.IsLikelyNotMountPoint(deviceMountPath)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\tif err := os.MkdirAll(deviceMountPath, 0750); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tnotMnt = true\n\t\t} else {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tvolumeSource, err := getVolumeSource(spec)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\toptions := []string{}\n\tif spec.ReadOnly {\n\t\toptions = append(options, \"ro\")\n\t}\n\tif notMnt {\n\t\tdiskMounter := &mount.SafeFormatAndMount{Interface: mounter, Runner: exec.New()}\n\t\tmountOptions := volume.MountOptionFromSpec(spec, options...)\n\t\terr = diskMounter.FormatAndMount(devicePath, deviceMountPath, *volumeSource.FSType, mountOptions)\n\t\tif err != nil {\n\t\t\tos.Remove(deviceMountPath)\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (r *vdm) Mount(\n\tvolumeName, volumeID string,\n\toverwriteFs bool, newFsType string, preempt bool) (string, error) {\n\tfor _, d := range r.drivers {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"moduleName\": r.rexray.Context,\n\t\t\t\"driverName\": d.Name(),\n\t\t\t\"volumeName\": volumeName,\n\t\t\t\"volumeID\": volumeID,\n\t\t\t\"overwriteFs\": overwriteFs,\n\t\t\t\"newFsType\": newFsType,\n\t\t\t\"preempt\": preempt}).Info(\"vdm.Mount\")\n\n\t\tif !preempt {\n\t\t\tpreempt = r.preempt()\n\t\t}\n\n\t\tmp, err := d.Mount(volumeName, volumeID, overwriteFs, newFsType, preempt)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tr.countUse(volumeName)\n\n\t\treturn mp, nil\n\t}\n\treturn \"\", errors.ErrNoVolumesDetected\n}", "func StartAttachCtr(ctx context.Context, ctr *libpod.Container, stdout, stderr, stdin *os.File, detachKeys string, sigProxy bool, startContainer bool) error { //nolint: interfacer\n\tresize := make(chan resize.TerminalSize)\n\n\thaveTerminal := term.IsTerminal(int(os.Stdin.Fd()))\n\n\t// Check if we are attached to a terminal. If we are, generate resize\n\t// events, and set the terminal to raw mode\n\n\tif haveTerminal && ctr.Terminal() {\n\t\tcancel, oldTermState, err := handleTerminalAttach(ctx, resize)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer func() {\n\t\t\tif err := restoreTerminal(oldTermState); err != nil {\n\t\t\t\tlogrus.Errorf(\"Unable to restore terminal: %q\", err)\n\t\t\t}\n\t\t}()\n\t\tdefer cancel()\n\t}\n\n\tstreams := new(define.AttachStreams)\n\tstreams.OutputStream = stdout\n\tstreams.ErrorStream = stderr\n\tstreams.InputStream = bufio.NewReader(stdin)\n\tstreams.AttachOutput = true\n\tstreams.AttachError = true\n\tstreams.AttachInput = true\n\n\tif stdout == nil {\n\t\tlogrus.Debugf(\"Not attaching to stdout\")\n\t\tstreams.AttachOutput = false\n\t}\n\tif stderr == nil {\n\t\tlogrus.Debugf(\"Not attaching to stderr\")\n\t\tstreams.AttachError = false\n\t}\n\tif stdin == nil {\n\t\tlogrus.Debugf(\"Not attaching to stdin\")\n\t\tstreams.AttachInput = false\n\t}\n\n\tif sigProxy {\n\t\t// To prevent a race condition, install the signal handler\n\t\t// before starting/attaching to the container.\n\t\tProxySignals(ctr)\n\t}\n\n\tif !startContainer {\n\t\treturn ctr.Attach(streams, detachKeys, resize)\n\t}\n\n\tattachChan, err := ctr.StartAndAttach(ctx, streams, detachKeys, resize, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif stdout == nil && stderr == nil {\n\t\tfmt.Printf(\"%s\\n\", ctr.ID())\n\t}\n\n\terr = <-attachChan\n\tif err != nil {\n\t\treturn fmt.Errorf(\"attaching to container %s: %w\", ctr.ID(), err)\n\t}\n\n\treturn nil\n}", "func NewVolumeAttachment(ctx *pulumi.Context,\n\tname string, args *VolumeAttachmentArgs, opts ...pulumi.ResourceOption) (*VolumeAttachment, error) {\n\tif args == nil || args.DeviceName == nil {\n\t\treturn nil, errors.New(\"missing required argument 'DeviceName'\")\n\t}\n\tif args == nil || args.InstanceId == nil {\n\t\treturn nil, errors.New(\"missing required argument 'InstanceId'\")\n\t}\n\tif args == nil || args.VolumeId == nil {\n\t\treturn nil, errors.New(\"missing required argument 'VolumeId'\")\n\t}\n\tif args == nil {\n\t\targs = &VolumeAttachmentArgs{}\n\t}\n\tvar resource VolumeAttachment\n\terr := ctx.RegisterResource(\"aws:ec2/volumeAttachment:VolumeAttachment\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (ds *dockerService) Attach(req *runtimeapi.AttachRequest) (*runtimeapi.AttachResponse, error) {\n\tif ds.streamingServer == nil {\n\t\treturn nil, streaming.ErrorStreamingDisabled(\"attach\")\n\t}\n\t_, err := checkContainerStatus(ds.client, req.GetContainerId())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ds.streamingServer.GetAttach(req)\n}", "func (m *Mixer) AttachToMixer(mixer *Mixer) error {\n\tif !bool(C.al_attach_mixer_to_mixer((*C.ALLEGRO_MIXER)(m), (*C.ALLEGRO_MIXER)(mixer))) {\n\t\treturn errors.New(\"failed to attach mixer to mixer\")\n\t}\n\treturn nil\n}", "func bindMount(source, dest string) error {\n\treturn syscall.Mount(source, dest, \"\", syscall.MS_BIND, \"\")\n}", "func (fs *FS) BindMount(\n\tctx context.Context,\n\tsource, target string,\n\toptions ...string) error {\n\n\tif options == nil {\n\t\toptions = []string{\"bind\"}\n\t} else {\n\t\toptions = append(options, \"bind\")\n\t}\n\treturn fs.mount(ctx, source, target, \"\", options...)\n}", "func ActivateVolumeWithRecoveryKey(volumeName, sourceDevicePath string, authRequestor AuthRequestor, options *ActivateVolumeOptions) error {\n\tif authRequestor == nil {\n\t\treturn errors.New(\"nil authRequestor\")\n\t}\n\tif options.RecoveryKeyTries < 0 {\n\t\treturn errors.New(\"invalid RecoveryKeyTries\")\n\t}\n\n\treturn activateWithRecoveryKey(volumeName, sourceDevicePath, authRequestor, options.RecoveryKeyTries, options.KeyringPrefix)\n}", "func (d *DefaultDriver) DetachVolume(volumeID string) error {\n\treturn &errors.ErrNotSupported{\n\t\tType: \"Function\",\n\t\tOperation: \"DetachVolume()\",\n\t}\n}", "func (proxy *remoteDriverProxy) Mount(name, id string) (string, error) {\n\tvar req = remoteVolumeMountReq{\n\t\tName: name,\n\t\tID: id,\n\t}\n\n\tvar resp remoteVolumeMountResp\n\n\tif err := proxy.client.CallService(remoteVolumeMountService, &req, &resp, true); err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif resp.Err != \"\" {\n\t\treturn \"\", errors.New(resp.Err)\n\t}\n\n\treturn resp.Mountpoint, nil\n}", "func (d *DirDriver) Mount(req *volume.MountRequest) (*volume.MountResponse, error) {\n\td.lock.Lock()\n\tdefer d.lock.Unlock()\n\n\tlogrus.Infof(\"Hit Mount() endpoint\")\n\n\tvol, exists := d.volumes[req.Name]\n\tif !exists {\n\t\tlogrus.Debugf(\"Cannot locate volume %s\", req.Name)\n\t\treturn nil, fmt.Errorf(\"no volume with name %s found\", req.Name)\n\t}\n\n\tvol.mounts[req.ID] = true\n\n\treturn &volume.MountResponse{\n\t\tMountpoint: vol.path,\n\t}, nil\n}", "func (cli *DockerCli) CmdAttach(args ...string) error {\n\tcmd := Cli.Subcmd(\"attach\", []string{\"CONTAINER\"}, Cli.DockerCommands[\"attach\"].Description, true)\n\tnoStdin := cmd.Bool([]string{\"#nostdin\", \"-no-stdin\"}, false, \"Do not attach STDIN\")\n\tproxy := cmd.Bool([]string{\"#sig-proxy\", \"-sig-proxy\"}, true, \"Proxy all received signals to the process\")\n\n\tcmd.Require(flag.Exact, 1)\n\n\tcmd.ParseFlags(args, true)\n\n\tserverResp, err := cli.call(\"GET\", \"/containers/\"+cmd.Arg(0)+\"/json\", nil, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer serverResp.body.Close()\n\n\tvar c types.ContainerJSON\n\tif err := json.NewDecoder(serverResp.body).Decode(&c); err != nil {\n\t\treturn err\n\t}\n\n\tif !c.State.Running {\n\t\treturn fmt.Errorf(\"You cannot attach to a stopped container, start it first\")\n\t}\n\n\tif err := cli.CheckTtyInput(!*noStdin, c.Config.Tty); err != nil {\n\t\treturn err\n\t}\n\n\tif c.Config.Tty && cli.isTerminalOut {\n\t\tif err := cli.monitorTtySize(cmd.Arg(0), false); err != nil {\n\t\t\tlogrus.Debugf(\"Error monitoring TTY size: %s\", err)\n\t\t}\n\t}\n\n\tvar in io.ReadCloser\n\n\tv := url.Values{}\n\tv.Set(\"stream\", \"1\")\n\tif !*noStdin && c.Config.OpenStdin {\n\t\tv.Set(\"stdin\", \"1\")\n\t\tin = cli.in\n\t}\n\n\tv.Set(\"stdout\", \"1\")\n\tv.Set(\"stderr\", \"1\")\n\n\tif *proxy && !c.Config.Tty {\n\t\tsigc := cli.forwardAllSignals(cmd.Arg(0))\n\t\tdefer signal.StopCatch(sigc)\n\t}\n\n\tif err := cli.hijack(\"POST\", \"/containers/\"+cmd.Arg(0)+\"/attach?\"+v.Encode(), c.Config.Tty, in, cli.out, cli.err, nil, nil); err != nil {\n\t\treturn err\n\t}\n\n\t_, status, err := getExitCode(cli, cmd.Arg(0))\n\tif err != nil {\n\t\treturn err\n\t}\n\tif status != 0 {\n\t\treturn Cli.StatusError{StatusCode: status}\n\t}\n\n\treturn nil\n}", "func ActivateSnapshot(vm *api.VM) (devicePath string, err error) {\n\tdevice := vm.PrefixedID()\n\tdevicePath = vm.SnapshotDev()\n\n\t// Return if the snapshot is already setup\n\tif util.FileExists(devicePath) {\n\t\treturn\n\t}\n\n\t// Get the image UID from the VM\n\timageUID, err := lookup.ImageUIDForVM(vm, providers.Client)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// NOTE: Multiple ignite processes trying to create loop devices at the\n\t// same time results in race condition. When multiple processes request for\n\t// a free loop device at the same time, they may get the same device ID and\n\t// try to create the same device multiple times.\n\t// Serialize this operation by creating a global lock file when creating a\n\t// loop device and release the lock after setting up device mapper using the\n\t// loop device.\n\t// Also, concurrent interactions with device mapper results in the error:\n\t// Device or resource busy\n\t// Serializing the interaction with device mapper helps avoid issues due to\n\t// race conditions.\n\n\t// Global lock path.\n\tglpath := filepath.Join(os.TempDir(), snapshotLockFileName)\n\n\t// Create a lockfile and obtain a lock.\n\tlock, err := lockfile.New(glpath)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"failed to create lockfile: %w\", err)\n\t\treturn\n\t}\n\tif err = obtainLock(lock); err != nil {\n\t\treturn\n\t}\n\t// Release the lock at the end.\n\tdefer util.DeferErr(&err, lock.Unlock)\n\n\t// Setup loop device for the image\n\timageLoop, err := newLoopDev(path.Join(constants.IMAGE_DIR, imageUID.String(), constants.IMAGE_FS), true)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// Make sure the all directories above the snapshot directory exists\n\tif err = os.MkdirAll(path.Dir(vm.OverlayFile()), 0755); err != nil {\n\t\treturn\n\t}\n\n\t// Setup loop device for the VM overlay\n\toverlayLoop, err := newLoopDev(vm.OverlayFile(), false)\n\tif err != nil {\n\t\treturn\n\t}\n\n\timageLoopSize, err := imageLoop.Size512K()\n\tif err != nil {\n\t\treturn\n\t}\n\n\toverlayLoopSize, err := overlayLoop.Size512K()\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// If the overlay is larger than the base image, we need to set up an additional dm device\n\t// which will contain the image and additional zero space (which reads zeros and discards writes).\n\t// This is fine, because all writes will target the overlay snapshot and not the read-only image.\n\t// The newly generated larger device will then be used for creating the snapshot (which is always\n\t// as large as the device backing it).\n\n\tbasePath := imageLoop.Path()\n\tif overlayLoopSize > imageLoopSize {\n\t\t// \"0 8388608 linear /dev/loop0 0\"\n\t\t// \"8388608 12582912 zero\"\n\t\tdmBaseTable := []byte(fmt.Sprintf(\"0 %d linear %s 0\\n%d %d zero\", imageLoopSize, imageLoop.Path(), imageLoopSize, overlayLoopSize))\n\n\t\tbaseDevice := fmt.Sprintf(\"%s-base\", device)\n\t\tif err = runDMSetup(baseDevice, dmBaseTable); err != nil {\n\t\t\treturn\n\t\t}\n\n\t\tbasePath = fmt.Sprintf(\"/dev/mapper/%s\", baseDevice)\n\t}\n\n\t// \"0 8388608 snapshot /dev/{loop0,mapper/ignite-<uid>-base} /dev/loop1 P 8\"\n\tdmTable := []byte(fmt.Sprintf(\"0 %d snapshot %s %s P 8\", overlayLoopSize, basePath, overlayLoop.Path()))\n\n\t// setup the main boot device\n\tif err = runDMSetup(device, dmTable); err != nil {\n\t\treturn\n\t}\n\n\t// Repair the filesystem in case it has errors\n\t// e2fsck throws an error if the filesystem gets repaired, so just ignore it\n\t_, _ = util.ExecuteCommand(\"e2fsck\", \"-p\", \"-f\", devicePath)\n\n\t// If the overlay is larger than the image, call resize2fs to make the filesystem fill the overlay\n\tif overlayLoopSize > imageLoopSize {\n\t\tif _, err = util.ExecuteCommand(\"resize2fs\", devicePath); err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\t// By detaching the loop devices after setting up the snapshot\n\t// they get automatically removed when the snapshot is removed.\n\tif err = imageLoop.Detach(); err != nil {\n\t\treturn\n\t}\n\n\terr = overlayLoop.Detach()\n\n\treturn\n}", "func (endpoint *VhostUserEndpoint) Attach(h hypervisor) error {\n\tnetworkLogger().WithField(\"endpoint-type\", \"vhostuser\").Info(\"Attaching endpoint\")\n\n\t// Generate a unique ID to be used for hypervisor commandline fields\n\trandBytes, err := utils.GenerateRandomBytes(8)\n\tif err != nil {\n\t\treturn err\n\t}\n\tid := hex.EncodeToString(randBytes)\n\n\td := config.VhostUserDeviceAttrs{\n\t\tDevID: id,\n\t\tSocketPath: endpoint.SocketPath,\n\t\tMacAddress: endpoint.HardAddr,\n\t\tType: config.VhostUserNet,\n\t}\n\n\treturn h.addDevice(d, vhostuserDev)\n}", "func (ds *dockerService) Attach(req *runtimeapi.AttachRequest) (*runtimeapi.AttachResponse, error) {\n\tif ds.streamingServer == nil {\n\t\treturn nil, streaming.ErrorStreamingDisabled(\"attach\")\n\t}\n\t_, err := checkContainerStatus(ds.client, req.ContainerId)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ds.streamingServer.GetAttach(req)\n}", "func (vpcIks *IksVpcSession) WaitForAttachVolume(volumeAttachmentRequest provider.VolumeAttachmentRequest) (*provider.VolumeAttachmentResponse, error) {\n\tvpcIks.Logger.Debug(\"Entry of IksVpcSession.WaitForAttachVolume method...\")\n\tdefer vpcIks.Logger.Debug(\"Exit from IksVpcSession.WaitForAttachVolume method...\")\n\treturn vpcIks.IksSession.WaitForAttachVolume(volumeAttachmentRequest)\n}" ]
[ "0.79338837", "0.74369246", "0.7349009", "0.7257526", "0.7245221", "0.72197264", "0.7091472", "0.70435685", "0.6913593", "0.6882627", "0.68524945", "0.6845347", "0.6842911", "0.6782078", "0.67246205", "0.6514863", "0.64255875", "0.6423693", "0.6378083", "0.6334428", "0.6219479", "0.60813886", "0.6062371", "0.60565835", "0.6018668", "0.5965501", "0.5838882", "0.5828648", "0.58037204", "0.5745504", "0.5673255", "0.5671087", "0.56362", "0.5630521", "0.560499", "0.5544531", "0.55022013", "0.54903615", "0.548129", "0.54759896", "0.5424901", "0.5400922", "0.53807265", "0.5378311", "0.53656304", "0.5349261", "0.5347046", "0.5345142", "0.5344707", "0.5312603", "0.5309395", "0.5260913", "0.5254964", "0.5254619", "0.5225989", "0.52144325", "0.52036464", "0.5192457", "0.51818913", "0.5139498", "0.5136152", "0.5116038", "0.5111441", "0.50953865", "0.50916594", "0.50896645", "0.5088982", "0.5087813", "0.5085646", "0.507811", "0.5070353", "0.5065602", "0.50615066", "0.5060856", "0.50607514", "0.50605637", "0.5048295", "0.5047804", "0.50394636", "0.5036532", "0.5033657", "0.5016131", "0.49939528", "0.49924928", "0.49891633", "0.4986136", "0.4974657", "0.49688736", "0.49669144", "0.49588016", "0.49528065", "0.4952152", "0.4945931", "0.49351948", "0.4934401", "0.4917885", "0.4911333", "0.49041584", "0.4895067", "0.48945993" ]
0.8086307
0
DetachVolume detaches the given volume from the given droplet
func (d DobsClient) DetachVolume(ctx Context, volumeID string, dropletID string) (error) { dropletIDI, err := strconv.Atoi(dropletID) if err != nil { return err } action, _, err := d.GodoClient.StorageActions.DetachByDropletID(ctx, volumeID, dropletIDI) if err != nil { return err } err = d.waitForAction(ctx, volumeID, action) if err != nil { return err } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (util *PortworxVolumeUtil) DetachVolume(u *portworxVolumeUnmounter) error {\n\tdriver, err := util.getPortworxDriver(u.plugin.host, true /*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.Detach(u.volName)\n\tif err != nil {\n\t\tglog.Errorf(\"Error detaching Portworx Volume (%v): %v\", u.volName, err)\n\t\treturn err\n\t}\n\treturn nil\n}", "func (digitalocean DigitalOcean) DetachVolume(volumeID string) error {\n\tdoc, err := DigitalOceanClient()\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t_, err = doc.client.Storage.DeleteVolume(doc.context, volumeID)\n\n\treturn err\n}", "func (cl *Client) VolumeDetach(ctx context.Context, vda *csp.VolumeDetachArgs) (*csp.Volume, error) {\n\tsvc, vid, _ := VolumeIdentifierParse(vda.VolumeIdentifier)\n\tswitch svc {\n\tcase ServiceGCE:\n\t\treturn cl.gceVolumeDetach(ctx, vda, vid)\n\t}\n\treturn nil, fmt.Errorf(\"storage type currently unsupported\")\n}", "func (srv *VolumeService) Detach(volumename string, vmname string) error {\n\tvol, err := srv.Get(volumename)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"No volume found with name or id '%s'\", volumename)\n\t}\n\n\t// Get VM ID\n\tvmService := NewVMService(srv.provider)\n\tvm, err := vmService.Get(vmname)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"No VM found with name or id '%s'\", vmname)\n\t}\n\n\tvolatt, err := srv.provider.GetVolumeAttachment(vm.ID, vol.ID)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error getting volume attachment: %s\", err)\n\t}\n\n\tsshConfig, err := srv.provider.GetSSHConfig(vm.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tserver, err := nfs.NewServer(sshConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = server.UnmountBlockDevice(volatt.Device)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Finaly delete the attachment\n\treturn srv.provider.DeleteVolumeAttachment(vm.ID, vol.ID)\n}", "func (driver *Driver) Detach(volumeName, instanceID string) error {\n\tvolume, err := driver.sdm.GetVolume(\"\", volumeName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn driver.sdm.DetachVolume(true, volume[0].VolumeID, instanceID)\n}", "func (s *VolumeListener) Detach(inctx context.Context, in *protocol.VolumeDetachmentRequest) (empty *googleprotobuf.Empty, err error) {\n\tdefer fail.OnExitConvertToGRPCStatus(inctx, &err)\n\tdefer fail.OnExitWrapError(inctx, &err, \"cannot detach volume\")\n\n\tempty = &googleprotobuf.Empty{}\n\tif s == nil {\n\t\treturn empty, fail.InvalidInstanceError()\n\t}\n\tif in == nil {\n\t\treturn empty, fail.InvalidParameterCannotBeNilError(\"in\")\n\t}\n\tif inctx == nil {\n\t\treturn empty, fail.InvalidParameterCannotBeNilError(\"inctx\")\n\t}\n\n\tvolumeRef, volumeRefLabel := srvutils.GetReference(in.GetVolume())\n\tif volumeRef == \"\" {\n\t\treturn empty, fail.InvalidRequestError(\"neither name nor id given as reference for volume\")\n\t}\n\thostRef, hostRefLabel := srvutils.GetReference(in.GetHost())\n\tif hostRef == \"\" {\n\t\treturn empty, fail.InvalidRequestError(\"neither name nor id given as reference for host\")\n\t}\n\n\tjob, xerr := PrepareJob(inctx, in.GetVolume().GetTenantId(), fmt.Sprintf(\"/volume/%s/host/%s/detach\", volumeRef, hostRef))\n\tif xerr != nil {\n\t\treturn nil, xerr\n\t}\n\tdefer job.Close()\n\n\thandler := VolumeHandler(job)\n\tif xerr = handler.Detach(volumeRef, hostRef); xerr != nil {\n\t\treturn empty, xerr\n\t}\n\n\tlogrus.WithContext(job.Context()).Infof(\"Volume %s successfully detached from %s.\", volumeRefLabel, hostRefLabel)\n\treturn empty, nil\n}", "func (a *AWS) DetachVolume(ctx *lepton.Context, instanceName, name string) error {\n\tvol, err := a.findVolumeByName(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tinstance, err := a.findInstanceByName(instanceName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tinput := &ec2.DetachVolumeInput{\n\t\tInstanceId: aws.String(*instance.InstanceId),\n\t\tVolumeId: aws.String(*vol.VolumeId),\n\t}\n\n\t_, err = a.ec2.DetachVolume(input)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (c *Core) DetachVolume(id types.VolumeID, extra map[string]string) (*types.Volume, error) {\n\tc.lock.Lock(id.Name)\n\tdefer c.lock.Unlock(id.Name)\n\n\tv, dv, err := c.getVolumeDriver(id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tctx := driver.Contexts()\n\n\t// merge extra to volume spec extra.\n\tfor key, value := range extra {\n\t\tv.Spec.Extra[key] = value\n\t}\n\n\t// if volume has referance, skip to detach volume.\n\tref := v.Option(types.OptionRef)\n\tif d, ok := dv.(driver.AttachDetach); ok && ref == \"\" {\n\t\tif err := d.Detach(ctx, v); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// update meta info.\n\tif err := c.store.Put(v); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn v, nil\n}", "func (d *DefaultDriver) DetachVolume(volumeID string) error {\n\treturn &errors.ErrNotSupported{\n\t\tType: \"Function\",\n\t\tOperation: \"DetachVolume()\",\n\t}\n}", "func (p *Tmpfs) Detach(ctx driver.Context, v *types.Volume) error {\n\tctx.Log.Debugf(\"Tmpfs detach volume: %s\", v.Name)\n\tmountPath := v.Path()\n\treqID := v.Option(\"reqID\")\n\tids := v.Option(\"ids\")\n\n\tarr := strings.Split(ids, \",\")\n\tnewIDs := []string{}\n\tfor _, id := range arr {\n\t\tif id != reqID {\n\t\t\tnewIDs = append(newIDs, reqID)\n\t\t}\n\t}\n\n\tif len(newIDs) == 0 && utils.IsMountpoint(mountPath) {\n\t\tif err := syscall.Unmount(mountPath, 0); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to umount %q, err: %v\", mountPath, err)\n\t\t}\n\n\t\tif err := os.Remove(mountPath); err != nil && !os.IsNotExist(err) {\n\t\t\treturn fmt.Errorf(\"remove %q directory failed, err: %v\", mountPath, err)\n\t\t}\n\n\t\tv.SetOption(\"freeTime\", strconv.FormatInt(time.Now().Unix(), 10))\n\t}\n\n\tv.SetOption(\"ids\", strings.Join(newIDs, \",\"))\n\n\treturn nil\n}", "func (util *PortworxVolumeUtil) UnmountVolume(u *portworxVolumeUnmounter, mountPath string) error {\n\tdriver, err := util.getPortworxDriver(u.plugin.host, true /*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.Unmount(u.volName, mountPath)\n\tif err != nil {\n\t\tglog.Errorf(\"Error unmounting Portworx Volume (%v) on Path (%v): %v\", u.volName, mountPath, err)\n\t\treturn err\n\t}\n\treturn nil\n}", "func (vpcIks *IksVpcSession) DetachVolume(volumeAttachmentRequest provider.VolumeAttachmentRequest) (*http.Response, error) {\n\tvpcIks.IksSession.Logger.Debug(\"Entry of IksVpcSession.DetachVolume method...\")\n\tdefer vpcIks.Logger.Debug(\"Exit from IksVpcSession.DetachVolume method...\")\n\treturn vpcIks.IksSession.DetachVolume(volumeAttachmentRequest)\n}", "func Detach(c *golangsdk.ServiceClient, volumeId string, opts DetachOpts) (*jobs.Job, error) {\n\turl := detachURL(c, opts.ServerId, volumeId)\n\tquery, err := golangsdk.BuildQueryString(opts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\turl += query.String()\n\n\tvar r jobs.Job\n\t_, err = c.DeleteWithBody(url, &r, &golangsdk.RequestOpts{\n\t\tMoreHeaders: requestOpts.MoreHeaders,\n\t})\n\treturn &r, err\n}", "func (a *Amazon) DetachVolume(volumeID string) error {\n\tif err := a.Client.DetachVolume(volumeID); err != nil {\n\t\treturn err\n\t}\n\n\tcheckDetaching := func(currentPercentage int) (machinestate.State, error) {\n\t\tvol, err := a.Client.VolumeByID(volumeID)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\n\t\t// ready!\n\t\tif len(vol.Attachments) == 0 {\n\t\t\treturn machinestate.Stopped, nil\n\t\t}\n\n\t\t// otherwise wait until it's detached\n\t\tif aws.StringValue(vol.Attachments[0].State) != \"detached\" {\n\t\t\treturn machinestate.Pending, nil\n\t\t}\n\n\t\treturn machinestate.Stopped, nil\n\t}\n\n\tws := waitstate.WaitState{\n\t\tStateFunc: checkDetaching,\n\t\tDesiredState: machinestate.Stopped,\n\t}\n\treturn ws.Wait()\n}", "func (d *detacherDefaults) Detach(volumeName string, hostName types.NodeName) error {\n\tklog.Warning(logPrefix(d.plugin.flexVolumePlugin), \"using default Detach for volume \", volumeName, \", host \", hostName)\n\treturn nil\n}", "func (cl *Client) gceVolumeDetach(ctx context.Context, vda *csp.VolumeDetachArgs, vid string) (*csp.Volume, error) {\n\tif vda.Force {\n\t\tcl.csp.dbgF(\"ignoring unsupported force on detach [%s]\", vid)\n\t}\n\tcomputeService, err := cl.getComputeService(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\top, err := computeService.Instances().DetachDisk(cl.projectID, cl.attrs[AttrZone].Value, vda.NodeIdentifier, vid).Context(ctx).Do()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err = cl.waitForOperation(ctx, op); err != nil {\n\t\treturn nil, err\n\t}\n\tvol, err := cl.vr.gceVolumeGet(ctx, vid)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn vol, nil\n}", "func (client *Client) DeleteVolumeAttachment(serverID, id string) error {\n\tva, err := client.GetVolumeAttachment(serverID, id)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error deleting volume attachment %s: %s\", id, ProviderErrorToString(err))\n\t}\n\n\terr = volumeattach.Delete(client.Compute, serverID, id).ExtractErr()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error deleting volume attachment %s: %s\", id, ProviderErrorToString(err))\n\t}\n\n\tmtdVol, err := metadata.LoadVolume(providers.FromClient(client), id)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error deleting volume attachment %s: %s\", id, ProviderErrorToString(err))\n\t}\n\n\terr = mtdVol.Detach(va)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error deleting volume attachment %s: %s\", id, ProviderErrorToString(err))\n\t}\n\n\treturn nil\n}", "func (d *Driver) Unmount(mountDir string) {\n\tDebug(\"findmnt: \" + mountDir)\n\t_, err := RunCommand(\"findmnt\", \"-n\", \"-o\", \"SOURCE\", \"--target\", mountDir)\n\tif err != nil {\n\t\tDebug(err.Error())\n\t}\n\n\tDebug(\"syscall.Unmount: \" + mountDir)\n\tif err := syscall.Unmount(mountDir, 0); err != nil {\n\t\tFailure(err)\n\t}\n\n\tDebug(\"Detach hetzner volume from server\")\n\tvolume := GetVolume(d.client, d.options.PVOrVolumeName)\n\t_, _, errDetach := d.client.Volume.Detach(context.Background(), volume)\n\n\tif errDetach != nil {\n\t\tFailure(errDetach)\n\t}\n\n\t// Delete json file with token in it\n\t//Debug(\"os.Remove\")\n\t//if err := os.Remove(jsonOptionsFile); err != nil {\n\t//\tfailure(err)\n\t//}\n\n\tSuccess()\n}", "func DeactivateVolume(volumeName string) error {\n\treturn luks2Deactivate(volumeName)\n}", "func (d *VolumeDriver) UnmountVolume(name string) error {\n\tlog.Errorf(\"VolumeDriver UnmountVolume to be implemented\")\n\treturn nil\n}", "func (driver *Driver) Unmount(volumeName, volumeID string) error {\n\tif volumeName == \"\" && volumeID == \"\" {\n\t\treturn errors.New(\"Missing volume name or ID\")\n\t}\n\n\tinstances, err := driver.sdm.GetInstance()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tswitch {\n\tcase len(instances) == 0:\n\t\treturn errors.New(\"No instances\")\n\tcase len(instances) > 1:\n\t\treturn errors.New(\"Too many instances returned, limit the storagedrivers\")\n\t}\n\n\tvolumes, err := driver.sdm.GetVolume(volumeID, volumeName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tswitch {\n\tcase len(volumes) == 0:\n\t\treturn errors.New(\"No volumes returned by name\")\n\tcase len(volumes) > 1:\n\t\treturn errors.New(\"Multiple volumes returned by name\")\n\t}\n\n\tvolumeAttachment, err := driver.sdm.GetVolumeAttach(volumes[0].VolumeID, instances[0].InstanceID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(volumeAttachment) == 0 {\n\t\treturn nil\n\t}\n\n\tmounts, err := driver.osdm.GetMounts(volumeAttachment[0].DeviceName, \"\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(mounts) == 0 {\n\t\treturn nil\n\t}\n\n\terr = driver.osdm.Unmount(mounts[0].Mountpoint)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = driver.sdm.DetachVolume(false, volumes[0].VolumeID, \"\")\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n\n}", "func (d *DirDriver) Unmount(req *volume.UnmountRequest) error {\n\td.lock.Lock()\n\tdefer d.lock.Unlock()\n\n\tlogrus.Infof(\"Hit Unmount() endpoint\")\n\n\tvol, exists := d.volumes[req.Name]\n\tif !exists {\n\t\tlogrus.Debugf(\"Cannot locate volume %s\", req.Name)\n\t\treturn fmt.Errorf(\"no volume with name %s found\", req.Name)\n\t}\n\n\tmount := vol.mounts[req.ID]\n\tif !mount {\n\t\tlogrus.Debugf(\"Volume %s is not mounted by %s\", req.Name, req.ID)\n\t\treturn fmt.Errorf(\"volume %s is not mounted by %s\", req.Name, req.ID)\n\t}\n\n\tdelete(vol.mounts, req.ID)\n\n\treturn nil\n}", "func (d *lvm) UnmountVolume(vol Volume, keepBlockDev bool, op *operations.Operation) (bool, error) {\n\tunlock := vol.MountLock()\n\tdefer unlock()\n\n\tvar err error\n\tourUnmount := false\n\tmountPath := vol.MountPath()\n\n\trefCount := vol.MountRefCountDecrement()\n\n\t// Check if already mounted.\n\tif vol.contentType == ContentTypeFS && filesystem.IsMountPoint(mountPath) {\n\t\tif refCount > 0 {\n\t\t\td.logger.Debug(\"Skipping unmount as in use\", logger.Ctx{\"volName\": vol.name, \"refCount\": refCount})\n\t\t\treturn false, ErrInUse\n\t\t}\n\n\t\terr = TryUnmount(mountPath, 0)\n\t\tif err != nil {\n\t\t\treturn false, fmt.Errorf(\"Failed to unmount LVM logical volume: %w\", err)\n\t\t}\n\n\t\td.logger.Debug(\"Unmounted logical volume\", logger.Ctx{\"volName\": vol.name, \"path\": mountPath, \"keepBlockDev\": keepBlockDev})\n\n\t\t// We only deactivate filesystem volumes if an unmount was needed to better align with our\n\t\t// unmount return value indicator.\n\t\tif !keepBlockDev {\n\t\t\t_, err = d.deactivateVolume(vol)\n\t\t\tif err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\t\t}\n\n\t\tourUnmount = true\n\t} else if vol.contentType == ContentTypeBlock {\n\t\t// For VMs, unmount the filesystem volume.\n\t\tif vol.IsVMBlock() {\n\t\t\tfsVol := vol.NewVMBlockFilesystemVolume()\n\t\t\tourUnmount, err = d.UnmountVolume(fsVol, false, op)\n\t\t\tif err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\t\t}\n\n\t\tvolDevPath := d.lvmDevPath(d.config[\"lvm.vg_name\"], vol.volType, vol.contentType, vol.name)\n\t\tif !keepBlockDev && shared.PathExists(volDevPath) {\n\t\t\tif refCount > 0 {\n\t\t\t\td.logger.Debug(\"Skipping unmount as in use\", logger.Ctx{\"volName\": vol.name, \"refCount\": refCount})\n\t\t\t\treturn false, ErrInUse\n\t\t\t}\n\n\t\t\t_, err = d.deactivateVolume(vol)\n\t\t\tif err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\n\t\t\tourUnmount = true\n\t\t}\n\t}\n\n\treturn ourUnmount, nil\n}", "func (d *lvm) DeleteVolume(vol Volume, op *operations.Operation) error {\n\tsnapshots, err := d.VolumeSnapshots(vol, op)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(snapshots) > 0 {\n\t\treturn fmt.Errorf(\"Cannot remove a volume that has snapshots\")\n\t}\n\n\tvolDevPath := d.lvmDevPath(d.config[\"lvm.vg_name\"], vol.volType, vol.contentType, vol.name)\n\tlvExists, err := d.logicalVolumeExists(volDevPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif lvExists {\n\t\tif vol.contentType == ContentTypeFS {\n\t\t\t_, err = d.UnmountVolume(vol, false, op)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Error unmounting LVM logical volume: %w\", err)\n\t\t\t}\n\t\t}\n\n\t\terr = d.removeLogicalVolume(d.lvmDevPath(d.config[\"lvm.vg_name\"], vol.volType, vol.contentType, vol.name))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error removing LVM logical volume: %w\", err)\n\t\t}\n\t}\n\n\tif vol.contentType == ContentTypeFS {\n\t\t// Remove the volume from the storage device.\n\t\tmountPath := vol.MountPath()\n\t\terr = os.RemoveAll(mountPath)\n\t\tif err != nil && !os.IsNotExist(err) {\n\t\t\treturn fmt.Errorf(\"Error removing LVM logical volume mount path %q: %w\", mountPath, err)\n\t\t}\n\n\t\t// Although the volume snapshot directory should already be removed, lets remove it here to just in\n\t\t// case the top-level directory is left.\n\t\terr = deleteParentSnapshotDirIfEmpty(d.name, vol.volType, vol.name)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// For VMs, also delete the filesystem volume.\n\tif vol.IsVMBlock() {\n\t\tfsVol := vol.NewVMBlockFilesystemVolume()\n\t\terr := d.DeleteVolume(fsVol, op)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (c *Controller) Detach(detachRequest k8sresources.FlexVolumeDetachRequest) k8sresources.FlexVolumeResponse {\n\tc.logger.Println(\"controller-detach-start\")\n\tdefer c.logger.Println(\"controller-detach-end\")\n\tif detachRequest.Version == k8sresources.KubernetesVersion_1_5 {\n\t\treturn k8sresources.FlexVolumeResponse{\n\t\t\tStatus: \"Success\",\n\t\t}\n\t}\n\treturn k8sresources.FlexVolumeResponse{\n\t\tStatus: \"Not supported\",\n\t}\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 (d *MinioDriver) unmountVolume(volume *minioVolume) error {\n\treturn exec.Command(\"umount\", volume.mountpoint).Run()\n}", "func (d *driverInfo) Unmount(volume *Volume) error {\n\tif err := volume.CheckMounted(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := d.storage.Unmount(volume); err != nil {\n\t\treturn err\n\t}\n\n\tif err := fs.RemoveDir(volume.MountPath, true); err != nil {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"name\": volume.Name,\n\t\t\t\"mountPath\": volume.MountPath,\n\t\t\t\"error\": err,\n\t\t}).Warning(\"error removing mount path\")\n\t}\n\n\tvolume.MountPath = \"\"\n\treturn nil\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 (proxy *remoteDriverProxy) Unmount(name, id string) error {\n\tvar req = remoteVolumeUnmountReq{\n\t\tName: name,\n\t\tID: id,\n\t}\n\n\tvar resp remoteVolumeUnmountResp\n\n\tif err := proxy.client.CallService(remoteVolumeUnmountService, &req, &resp, true); err != nil {\n\t\treturn err\n\t}\n\n\tif resp.Err != \"\" {\n\t\treturn errors.New(resp.Err)\n\t}\n\n\treturn nil\n}", "func (device *BlockDevice) Detach(ctx context.Context, devReceiver api.DeviceReceiver) error {\n\tskip, err := device.bumpAttachCount(false)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif skip {\n\t\treturn nil\n\t}\n\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tdevice.bumpAttachCount(true)\n\t\t} else {\n\t\t\tdevReceiver.UnsetSandboxBlockIndex(device.BlockDrive.Index)\n\t\t}\n\t}()\n\n\tdeviceLogger().WithField(\"device\", device.DeviceInfo.HostPath).Info(\"Unplugging block device\")\n\n\tif err = devReceiver.HotplugRemoveDevice(ctx, device, config.DeviceBlock); err != nil {\n\t\tdeviceLogger().WithError(err).Error(\"Failed to unplug block device\")\n\t\treturn err\n\t}\n\treturn nil\n}", "func (r *vdm) Detach(volumeName, instanceID string, force bool) error {\n\tfor _, d := range r.drivers {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"moduleName\": r.rexray.Context,\n\t\t\t\"driverName\": d.Name(),\n\t\t\t\"volumeName\": volumeName,\n\t\t\t\"instanceID\": instanceID,\n\t\t\t\"force\": force}).Info(\"vdm.Detach\")\n\t\treturn d.Detach(volumeName, instanceID, force)\n\t}\n\treturn errors.ErrNoVolumesDetected\n}", "func (endpoint *BridgedMacvlanEndpoint) Detach(netNsCreated bool, netNsPath string) error {\n\t// The network namespace would have been deleted at this point\n\t// if it has not been created by virtcontainers.\n\tif !netNsCreated {\n\t\treturn nil\n\t}\n\n\tnetworkLogger().Info(\"Detaching virtual endpoint\")\n\n\treturn doNetNS(netNsPath, func(_ ns.NetNS) error {\n\t\t//return xconnectVMNetwork(&(endpoint.NetPair), false, 0, false, endpoint.EndpointType)\n\t\treturn xconnectVMNetwork(endpoint, false, 0, false)\n\t})\n}", "func (m *Mixer) Detach() error {\n\tif !bool(C.al_detach_mixer((*C.ALLEGRO_MIXER)(m))) {\n\t\treturn errors.New(\"failed to detach mixer\")\n\t}\n\treturn nil\n}", "func (p *VolumePlugin) UnmountVolume(req *volume.UnmountRequest) error {\n\tif req == nil {\n\t\treturn fmt.Errorf(\"must provide non-nil request to UnmountVolume: %w\", define.ErrInvalidArg)\n\t}\n\n\tif err := p.verifyReachable(); err != nil {\n\t\treturn err\n\t}\n\n\tlogrus.Infof(\"Unmounting volume %s using plugin %s for container %s\", req.Name, p.Name, req.ID)\n\n\tresp, err := p.sendRequest(req, unmountPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\treturn p.handleErrorResponse(resp, unmountPath, req.Name)\n}", "func Unmount(d Driver, vName string) error {\n\tlog.Debugf(\"Entering Unmount: name: %s\", vName)\n\td.GetLock().Lock()\n\tdefer d.GetLock().Unlock()\n\tv, m, err := getVolumeMount(d, vName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif m.GetConnections() <= 1 {\n\t\tcmd := fmt.Sprintf(\"/usr/bin/umount %s\", m.GetPath())\n\t\tif err := d.RunCmd(cmd); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tSetN(0, m, v)\n\t} else {\n\t\tAddN(-1, m, v)\n\t}\n\n\treturn d.SaveConfig()\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 (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 (endpoint *VirtualEndpoint) Detach(netNsCreated bool, netNsPath string) error {\n\t// The network namespace would have been deleted at this point\n\t// if it has not been created by virtcontainers.\n\tif !netNsCreated {\n\t\treturn nil\n\t}\n\n\tnetworkLogger().WithField(\"endpoint-type\", \"virtual\").Info(\"Detaching endpoint\")\n\n\treturn doNetNS(netNsPath, func(_ ns.NetNS) error {\n\t\treturn xconnectVMNetwork(endpoint, false, 0, false)\n\t})\n}", "func (client *Client) UnmapVolume(name, host string) (*Response, *ResponseStatus, error) {\n\tif host == \"\" {\n\t\treturn client.FormattedRequest(\"/unmap/volume/\\\"%s\\\"\", name)\n\t}\n\n\treturn client.FormattedRequest(\"/unmap/volume/host/\\\"%s\\\"/\\\"%s\\\"\", host, name)\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 (d *MinioDriver) Unmount(r volume.UnmountRequest) volume.Response {\n\td.m.Lock()\n\tdefer d.m.Unlock()\n\n\tglog.V(1).Infof(\"Unmount request is: %#v\", r)\n\n\tv, exists := d.volumes[r.Name]\n\tif !exists {\n\t\treturn volumeResp(\"\", \"\", nil, capability, newErrVolNotFound(r.Name).Error())\n\t}\n\n\tif v.connections <= 1 {\n\t\tif err := d.unmountVolume(v); err != nil {\n\t\t\tglog.Warningf(\"Unmounting %s volume failed with: %s\", v, err)\n\t\t\treturn volumeResp(\"\", \"\", nil, capability, err.Error())\n\t\t}\n\t\tv.connections = 0\n\t\treturn volumeResp(\"\", \"\", nil, capability, \"\")\n\t}\n\tv.connections--\n\treturn volumeResp(\"\", \"\", nil, capability, \"\")\n}", "func deleteVolume(vol string) {\n\tclient.RemoveVolume(vol)\n}", "func (_m *OpenStackMock) DetachVolume(instanceID string, volumeID string) error {\n\tret := _m.Called(instanceID, volumeID)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(string, string) error); ok {\n\t\tr0 = rf(instanceID, volumeID)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "func (d *VolumeDriver) Unmount(r volume.UnmountRequest) volume.Response {\n\tlog.WithFields(log.Fields{\"name\": r.Name}).Info(\"Unmounting Volume \")\n\n\t// lock the state\n\td.refCounts.StateMtx.Lock()\n\tdefer d.refCounts.StateMtx.Unlock()\n\n\tif d.refCounts.IsInitialized() != true {\n\t\t// if refcounting hasn't been succesful,\n\t\t// no refcounting, no unmount. All unmounts are delayed\n\t\t// until we succesfully populate the refcount map\n\t\td.refCounts.MarkDirty()\n\t\treturn volume.Response{Err: \"\"}\n\t}\n\n\tlog.Errorf(\"VolumeDriver Unmount to be implemented\")\n\treturn volume.Response{Err: \"\"}\n}", "func (r *ProjectsLocationsInstancesService) DetachLun(instance string, detachlunrequest *DetachLunRequest) *ProjectsLocationsInstancesDetachLunCall {\n\tc := &ProjectsLocationsInstancesDetachLunCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.instance = instance\n\tc.detachlunrequest = detachlunrequest\n\treturn c\n}", "func (detacher *azureDiskDetacher) Detach(diskName string, nodeName types.NodeName) error {\n\tif diskName == \"\" {\n\t\treturn fmt.Errorf(\"invalid disk to detach: %q\", diskName)\n\t}\n\tinstanceid, err := detacher.azureProvider.InstanceID(nodeName)\n\tif err != nil {\n\t\tglog.Warningf(\"no instance id for node %q, skip detaching\", nodeName)\n\t\treturn nil\n\t}\n\tif ind := strings.LastIndex(instanceid, \"/\"); ind >= 0 {\n\t\tinstanceid = instanceid[(ind + 1):]\n\t}\n\n\tglog.V(4).Infof(\"detach %v from node %q\", diskName, nodeName)\n\terr = detacher.azureProvider.DetachDiskByName(diskName, \"\" /* diskURI */, nodeName)\n\tif err != nil {\n\t\tglog.Errorf(\"failed to detach azure disk %q, err %v\", diskName, err)\n\t}\n\n\treturn err\n}", "func (s *StorageActionsServiceOp) Detach(driveID string) (*Action, *Response, error) {\n\trequest := &ActionRequest{\n\t\t\"type\": \"detach\",\n\t}\n\treturn s.doAction(driveID, request)\n}", "func (endpoint *MacvtapEndpoint) Detach(netNsCreated bool, netNsPath string) error {\n\tnetworkLogger().WithField(\"endpoint-type\", \"macvtap\").Info(\"Detaching endpoint\")\n\treturn nil\n}", "func DetachStorage(attachmentID string) error {\n\tclient, err := NewExtPacketClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, e := client.Storages.Detach(attachmentID)\n\treturn e\n}", "func detachLoopDevice(ctx context.Context, loopDeviceName string) error {\n\tLogc(ctx).WithField(\"loopDeviceName\", loopDeviceName).Debug(\">>>> bof.DetachLoopDevice\")\n\tdefer Logc(ctx).Debug(\"<<<< bof.DetachLoopDevice\")\n\n\t_, err := command.ExecuteWithTimeout(ctx, \"losetup\", 10*time.Second, true, \"--detach\", loopDeviceName)\n\tif err != nil {\n\t\tLogc(ctx).WithError(err).Error(\"Failed to detach loop device\")\n\t\treturn fmt.Errorf(\"failed to detach loop device '%s': %v\", loopDeviceName, err)\n\t}\n\n\treturn nil\n}", "func (d ImagefsDriver) Unmount(r *volume.UnmountRequest) error {\n\tfmt.Printf(\"-> Unmount %+v\\n\", r)\n\tcontainerID, err := d.FindVolumeContainer(r.Name)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unexpected error: %s\", err)\n\t}\n\n\ttimeout := time.Second * 5\n\terr = d.cli.ContainerStop(\n\t\tcontext.Background(),\n\t\tcontainerID,\n\t\t&timeout,\n\t)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unexpected error: %s\", err)\n\t}\n\tfmt.Printf(\"<- OK\\n\")\n\treturn nil\n}", "func (b *Broker) Detach(s *Subscriber) {\n\tb.slock.Lock()\n\tdefer b.slock.Unlock()\n\ts.destroy()\n\tb.Unsubscribe(s, s.GetTopics()...)\n}", "func (endpoint *HNSEndpoint) ContainerDetach(containerID string) error {\n\toperation := \"ContainerDetach\"\n\ttitle := \"hcsshim::HNSEndpoint::\" + operation\n\tlogrus.Debugf(title+\" id=%s\", endpoint.Id)\n\n\trequestMessage := &EndpointAttachDetachRequest{\n\t\tContainerID: containerID,\n\t\tSystemType: ContainerType,\n\t}\n\tresponse := &EndpointResquestResponse{}\n\n\tjsonString, err := json.Marshal(requestMessage)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn hnsCall(\"POST\", \"/endpoints/\"+endpoint.Id+\"/detach\", string(jsonString), &response)\n}", "func (detacher *azureDiskDetacher) UnmountDevice(deviceMountPath string) error {\n\tvolume := path.Base(deviceMountPath)\n\tif err := util.UnmountPath(deviceMountPath, detacher.mounter); err != nil {\n\t\tglog.Errorf(\"Error unmounting %q: %v\", volume, err)\n\t\treturn err\n\t} else {\n\t\treturn nil\n\t}\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 (d *DefaultDriver) CleanupVolume(name string) error {\n\treturn &errors.ErrNotSupported{\n\t\tType: \"Function\",\n\t\tOperation: \"CleanupVolume()\",\n\t}\n}", "func Unmount(out io.Writer, logger log.FieldLogger) (err error) {\n\tdisk, err := queryPhysicalVolume(logger)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\tif disk == \"\" {\n\t\tlogger.Info(\"No physical volumes found.\")\n\t\treturn nil\n\t}\n\tlogger.Infof(\"Found physical volume on disk %v.\", disk)\n\tconfig := &config{\n\t\tFieldLogger: logger,\n\t\tdisk: disk,\n\t\tout: out,\n\t}\n\tif err = config.removeLingeringDevices(); err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\tif err = config.removeLogicalVolume(); err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\tif err = config.removeVolumeGroup(); err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\tif err = config.removePhysicalVolume(); err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\treturn nil\n}", "func (d *Driver) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error) {\n\tvolumeID := req.GetVolumeId()\n\tif volumeID == \"\" {\n\t\treturn nil, status.Error(codes.InvalidArgument, \"volume id is empty\")\n\t}\n\tsmbVol, err := getSmbVolFromID(volumeID)\n\tif err != nil {\n\t\t// An invalid ID should be treated as doesn't exist\n\t\tklog.Warningf(\"failed to get smb volume for volume id %v deletion: %v\", volumeID, err)\n\t\treturn &csi.DeleteVolumeResponse{}, nil\n\t}\n\n\tvar volCap *csi.VolumeCapability\n\tmountOptions := getMountOptions(req.GetSecrets())\n\tif mountOptions != \"\" {\n\t\tklog.V(2).Infof(\"DeleteVolume: found mountOptions(%v) for volume(%s)\", mountOptions, volumeID)\n\t\tvolCap = &csi.VolumeCapability{\n\t\t\tAccessType: &csi.VolumeCapability_Mount{\n\t\t\t\tMount: &csi.VolumeCapability_MountVolume{\n\t\t\t\t\tMountFlags: []string{mountOptions},\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t}\n\n\tsecrets := req.GetSecrets()\n\tdeleteSubDir := len(secrets) > 0\n\tif !deleteSubDir {\n\t\toptions := strings.Split(mountOptions, \",\")\n\t\tif hasGuestMountOptions(options) {\n\t\t\tklog.V(2).Infof(\"guest mount option(%v) is provided, delete subdirectory\", options)\n\t\t\tdeleteSubDir = true\n\t\t}\n\t}\n\n\tif deleteSubDir {\n\t\t// Mount smb base share so we can delete the subdirectory\n\t\tif err = d.internalMount(ctx, smbVol, volCap, secrets); err != nil {\n\t\t\treturn nil, status.Errorf(codes.Internal, \"failed to mount smb server: %v\", err.Error())\n\t\t}\n\t\tdefer func() {\n\t\t\tif err = d.internalUnmount(ctx, smbVol); err != nil {\n\t\t\t\tklog.Warningf(\"failed to unmount smb server: %v\", err.Error())\n\t\t\t}\n\t\t}()\n\n\t\t// Delete subdirectory under base-dir\n\t\tinternalVolumePath := getInternalVolumePath(d.workingMountDir, smbVol)\n\t\tklog.V(2).Infof(\"Removing subdirectory at %v\", internalVolumePath)\n\t\tif err = os.RemoveAll(internalVolumePath); err != nil {\n\t\t\treturn nil, status.Errorf(codes.Internal, \"failed to delete subdirectory: %v\", err.Error())\n\t\t}\n\t} else {\n\t\tklog.V(2).Infof(\"DeleteVolume(%s) does not delete subdirectory\", volumeID)\n\t}\n\n\treturn &csi.DeleteVolumeResponse{}, nil\n}", "func (d *lvm) UnmountVolumeSnapshot(snapVol Volume, op *operations.Operation) (bool, error) {\n\tunlock := snapVol.MountLock()\n\tdefer unlock()\n\n\tvar err error\n\tourUnmount := false\n\tmountPath := snapVol.MountPath()\n\n\trefCount := snapVol.MountRefCountDecrement()\n\n\t// Check if already mounted.\n\tif snapVol.contentType == ContentTypeFS && filesystem.IsMountPoint(mountPath) {\n\t\tif refCount > 0 {\n\t\t\td.logger.Debug(\"Skipping unmount as in use\", logger.Ctx{\"volName\": snapVol.name, \"refCount\": refCount})\n\t\t\treturn false, ErrInUse\n\t\t}\n\n\t\terr = TryUnmount(mountPath, 0)\n\t\tif err != nil {\n\t\t\treturn false, fmt.Errorf(\"Failed to unmount LVM snapshot volume: %w\", err)\n\t\t}\n\n\t\td.logger.Debug(\"Unmounted logical volume snapshot\", logger.Ctx{\"path\": mountPath})\n\n\t\t// Check if a temporary snapshot exists, and if so remove it.\n\t\ttmpVolName := fmt.Sprintf(\"%s%s\", snapVol.name, tmpVolSuffix)\n\t\ttmpVolDevPath := d.lvmDevPath(d.config[\"lvm.vg_name\"], snapVol.volType, snapVol.contentType, tmpVolName)\n\t\texists, err := d.logicalVolumeExists(tmpVolDevPath)\n\t\tif err != nil {\n\t\t\treturn true, fmt.Errorf(\"Failed to check existence of temporary LVM snapshot volume %q: %w\", tmpVolDevPath, err)\n\t\t}\n\n\t\tif exists {\n\t\t\terr = d.removeLogicalVolume(tmpVolDevPath)\n\t\t\tif err != nil {\n\t\t\t\treturn true, fmt.Errorf(\"Failed to remove temporary LVM snapshot volume %q: %w\", tmpVolDevPath, err)\n\t\t\t}\n\t\t}\n\n\t\t// We only deactivate filesystem volumes if an unmount was needed to better align with our\n\t\t// unmount return value indicator.\n\t\t_, err = d.deactivateVolume(snapVol)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\n\t\tourUnmount = true\n\t} else if snapVol.contentType == ContentTypeBlock {\n\t\t// For VMs, unmount the filesystem volume.\n\t\tif snapVol.IsVMBlock() {\n\t\t\tfsVol := snapVol.NewVMBlockFilesystemVolume()\n\t\t\tourUnmount, err = d.UnmountVolumeSnapshot(fsVol, op)\n\t\t\tif err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\t\t}\n\n\t\tvolDevPath := d.lvmDevPath(d.config[\"lvm.vg_name\"], snapVol.volType, snapVol.contentType, snapVol.name)\n\t\tif shared.PathExists(volDevPath) {\n\t\t\tif refCount > 0 {\n\t\t\t\td.logger.Debug(\"Skipping unmount as in use\", logger.Ctx{\"volName\": snapVol.name, \"refCount\": refCount})\n\t\t\t\treturn false, ErrInUse\n\t\t\t}\n\n\t\t\t_, err = d.deactivateVolume(snapVol)\n\t\t\tif err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\n\t\t\tourUnmount = true\n\t\t}\n\t}\n\n\treturn ourUnmount, nil\n}", "func (endpoint *VirtualEndpoint) HotDetach(h hypervisor, netNsCreated bool, netNsPath string) error {\n\tif !netNsCreated {\n\t\treturn nil\n\t}\n\tnetworkLogger().Info(\"Hot detaching virtual endpoint\")\n\tif err := doNetNS(netNsPath, func(_ ns.NetNS) error {\n\t\treturn xconnectVMNetwork(endpoint, false, 0, h.hypervisorConfig().DisableVhostNet)\n\t}); err != nil {\n\t\tnetworkLogger().WithError(err).Warn(\"Error un-bridging virtual ep\")\n\t}\n\n\tif _, err := h.hotplugRemoveDevice(endpoint, netDev); err != nil {\n\t\tnetworkLogger().WithError(err).Error(\"Error detach virtual ep\")\n\t\treturn err\n\t}\n\treturn nil\n}", "func (r *vdm) Unmount(volumeName, volumeID string) error {\n\tfor _, d := range r.drivers {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"moduleName\": r.rexray.Context,\n\t\t\t\"driverName\": d.Name(),\n\t\t\t\"volumeName\": volumeName,\n\t\t\t\"volumeID\": volumeID}).Info(\"vdm.Unmount\")\n\n\t\tif r.ignoreUsedCount() || r.countReset(volumeName) || !r.countExists(volumeName) {\n\t\t\tr.countInit(volumeName)\n\t\t\treturn d.Unmount(volumeName, volumeID)\n\t\t} else {\n\t\t\tr.countRelease(volumeName)\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn errors.ErrNoVolumesDetected\n}", "func (f *Pub) Detach(rm Publisher) {\n\tf.enders.Disable(rm)\n\tf.branches.Disable(rm)\n}", "func (d *lvm) RestoreVolume(vol Volume, snapshotName string, op *operations.Operation) error {\n\t// Instantiate snapshot volume from snapshot name.\n\tsnapVol, err := vol.NewSnapshot(snapshotName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trevert := revert.New()\n\tdefer revert.Fail()\n\n\t// If the pool uses thinpools, then the process for restoring a snapshot is as follows:\n\t// 1. Rename the original volume to a temporary name (so we can revert later if needed).\n\t// 2. Create a writable snapshot with the original name from the snapshot being restored.\n\t// 3. Delete the renamed original volume.\n\tif d.usesThinpool() {\n\t\t_, err = d.UnmountVolume(vol, false, op)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error unmounting LVM logical volume: %w\", err)\n\t\t}\n\n\t\toriginalVolDevPath := d.lvmDevPath(d.config[\"lvm.vg_name\"], vol.volType, vol.contentType, vol.name)\n\t\ttmpVolName := fmt.Sprintf(\"%s%s\", vol.name, tmpVolSuffix)\n\t\ttmpVolDevPath := d.lvmDevPath(d.config[\"lvm.vg_name\"], vol.volType, vol.contentType, tmpVolName)\n\n\t\t// Rename original logical volume to temporary new name so we can revert if needed.\n\t\terr = d.renameLogicalVolume(originalVolDevPath, tmpVolDevPath)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error temporarily renaming original LVM logical volume: %w\", err)\n\t\t}\n\n\t\trevert.Add(func() {\n\t\t\t// Rename the original volume back to the original name.\n\t\t\t_ = d.renameLogicalVolume(tmpVolDevPath, originalVolDevPath)\n\t\t})\n\n\t\t// Create writable snapshot from source snapshot named as target volume.\n\t\t_, err = d.createLogicalVolumeSnapshot(d.config[\"lvm.vg_name\"], snapVol, vol, false, true)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error restoring LVM logical volume snapshot: %w\", err)\n\t\t}\n\n\t\tvolDevPath := d.lvmDevPath(d.config[\"lvm.vg_name\"], vol.volType, vol.contentType, vol.name)\n\n\t\trevert.Add(func() {\n\t\t\t_ = d.removeLogicalVolume(volDevPath)\n\t\t})\n\n\t\t// If the volume's filesystem needs to have its UUID regenerated to allow mount then do so now.\n\t\tif vol.contentType == ContentTypeFS && renegerateFilesystemUUIDNeeded(vol.ConfigBlockFilesystem()) {\n\t\t\t_, err = d.activateVolume(vol)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\td.logger.Debug(\"Regenerating filesystem UUID\", logger.Ctx{\"dev\": volDevPath, \"fs\": vol.ConfigBlockFilesystem()})\n\t\t\terr = regenerateFilesystemUUID(vol.ConfigBlockFilesystem(), volDevPath)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\t// Finally remove the original logical volume. Should always be the last step to allow revert.\n\t\terr = d.removeLogicalVolume(d.lvmDevPath(d.config[\"lvm.vg_name\"], vol.volType, vol.contentType, tmpVolName))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Error removing original LVM logical volume: %w\", err)\n\t\t}\n\n\t\trevert.Success()\n\t\treturn nil\n\t}\n\n\t// If the pool uses classic logical volumes, then the process for restoring a snapshot is as follows:\n\t// 1. Ensure snapshot volumes have sufficient CoW capacity to allow restoration.\n\t// 2. Mount source and target.\n\t// 3. Copy (rsync or dd) source to target.\n\t// 4. Unmount source and target.\n\n\t// Ensure that the snapshot volumes have sufficient CoW capacity to allow restoration.\n\t// In the past we set snapshot sizes by specifying the same size as the origin volume. Unfortunately due to\n\t// the way that LVM extents work, this means that the snapshot CoW capacity can be just a little bit too\n\t// small to allow the entire snapshot to be restored to the origin. If this happens then we can end up\n\t// invalidating the snapshot meaning it cannot be used anymore!\n\t// Nowadays we use the \"100%ORIGIN\" size when creating snapshots, which lets LVM figure out what the number\n\t// of extents is required to restore the whole snapshot, but we need to support resizing older snapshots\n\t// taken before this change. So we use lvresize here to grow the snapshot volume to the size of the origin.\n\t// The use of \"+100%ORIGIN\" here rather than just \"100%ORIGIN\" like we use when taking new snapshots, is\n\t// rather counter intuitive. However there seems to be a bug in lvresize/lvextend so that when specifying\n\t// \"100%ORIGIN\", it fails to extend sufficiently, saying that the number of extents in the snapshot matches\n\t// that of the origin (which they do). However if we take take that at face value then the restore will\n\t// end up invalidating the snapshot. Instead if we specify a much larger value (such as adding 100% of\n\t// the origin to the snapshot size) then LVM is able to extend the snapshot a little bit more, and LVM\n\t// limits the new size to the maximum CoW size that the snapshot can be (which happens to be the same size\n\t// as newer snapshots are taken at using the \"100%ORIGIN\" size). Confusing isn't it.\n\tif snapVol.IsVMBlock() || snapVol.contentType == ContentTypeFS {\n\t\tsnapLVPath := d.lvmDevPath(d.config[\"lvm.vg_name\"], snapVol.volType, ContentTypeFS, snapVol.name)\n\t\t_, err = shared.TryRunCommand(\"lvresize\", \"-l\", \"+100%ORIGIN\", \"-f\", snapLVPath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif snapVol.IsVMBlock() || (snapVol.contentType == ContentTypeBlock && snapVol.volType == VolumeTypeCustom) {\n\t\tsnapLVPath := d.lvmDevPath(d.config[\"lvm.vg_name\"], snapVol.volType, ContentTypeBlock, snapVol.name)\n\t\t_, err = shared.TryRunCommand(\"lvresize\", \"-l\", \"+100%ORIGIN\", \"-f\", snapLVPath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Mount source and target, copy, then unmount.\n\terr = vol.MountTask(func(mountPath string, op *operations.Operation) error {\n\t\t// Copy source to destination (mounting each volume if needed).\n\t\terr = snapVol.MountTask(func(srcMountPath string, op *operations.Operation) error {\n\t\t\tif snapVol.IsVMBlock() || snapVol.contentType == ContentTypeFS {\n\t\t\t\tbwlimit := d.config[\"rsync.bwlimit\"]\n\t\t\t\td.Logger().Debug(\"Copying fileystem volume\", logger.Ctx{\"sourcePath\": srcMountPath, \"targetPath\": mountPath, \"bwlimit\": bwlimit})\n\t\t\t\t_, err := rsync.LocalCopy(srcMountPath, mountPath, bwlimit, true)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif snapVol.IsVMBlock() || (snapVol.contentType == ContentTypeBlock && snapVol.volType == VolumeTypeCustom) {\n\t\t\t\tsrcDevPath, err := d.GetVolumeDiskPath(snapVol)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\ttargetDevPath, err := d.GetVolumeDiskPath(vol)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\td.Logger().Debug(\"Copying block volume\", logger.Ctx{\"srcDevPath\": srcDevPath, \"targetPath\": targetDevPath})\n\t\t\t\terr = copyDevice(srcDevPath, targetDevPath)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn nil\n\t\t}, op)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Run EnsureMountPath after mounting and syncing to ensure the mounted directory has the\n\t\t// correct permissions set.\n\t\terr = vol.EnsureMountPath()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t}, op)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error restoring LVM logical volume snapshot: %w\", err)\n\t}\n\n\trevert.Success()\n\treturn nil\n}", "func (d *fsStorage) Unmount(volume *Volume) error {\n\treturn nil\n}", "func (vpcIks *IksVpcSession) WaitForDetachVolume(volumeAttachmentRequest provider.VolumeAttachmentRequest) error {\n\tvpcIks.Logger.Debug(\"Entry of IksVpcSession.WaitForDetachVolume method...\")\n\tdefer vpcIks.Logger.Debug(\"Exit from IksVpcSession.WaitForDetachVolume method...\")\n\treturn vpcIks.IksSession.WaitForDetachVolume(volumeAttachmentRequest)\n}", "func (endpoint *VhostUserEndpoint) Detach(netNsCreated bool, netNsPath string) error {\n\tnetworkLogger().WithField(\"endpoint-type\", \"vhostuser\").Info(\"Detaching endpoint\")\n\treturn nil\n}", "func (m *KMount) Close() error {\n\tvar umntErr error\n\tfor i := 0; i < 4; i++ {\n\t\tif umntErr = syscall.Unmount(m.mntPoint, syscall.MNT_DETACH); umntErr != nil {\n\t\t\ttime.Sleep(250 * time.Millisecond)\n\t\t\tcontinue\n\t\t}\n\t\tbreak\n\t}\n\tif umntErr != nil {\n\t\treturn fmt.Errorf(\"unmount failed: %v\", umntErr)\n\t}\n\n\tif err := m.loop.Detach(); err != nil {\n\t\treturn fmt.Errorf(\"loopback detach failed: %v\", err)\n\t}\n\tif m.mntPoint != \"\" {\n\t\treturn os.Remove(m.mntPoint)\n\t}\n\treturn nil\n}", "func UmountVolume(vol *apis.LVMVolume, targetPath string,\n) error {\n\tmounter := &mount.SafeFormatAndMount{Interface: mount.New(\"\"), Exec: utilexec.New()}\n\n\tdev, ref, err := mount.GetDeviceNameFromMount(mounter, targetPath)\n\tif err != nil {\n\t\tklog.Errorf(\n\t\t\t\"lvm: umount volume: failed to get device from mnt: %s\\nError: %v\",\n\t\t\ttargetPath, err,\n\t\t)\n\t\treturn err\n\t}\n\n\t// device has already been un-mounted, return successful\n\tif len(dev) == 0 || ref == 0 {\n\t\tklog.Warningf(\n\t\t\t\"Warning: Unmount skipped because volume %s not mounted: %v\",\n\t\t\tvol.Name, targetPath,\n\t\t)\n\t\treturn nil\n\t}\n\n\tif pathExists, pathErr := mount.PathExists(targetPath); pathErr != nil {\n\t\treturn fmt.Errorf(\"error checking if path exists: %v\", pathErr)\n\t} else if !pathExists {\n\t\tklog.Warningf(\n\t\t\t\"Warning: Unmount skipped because path does not exist: %v\",\n\t\t\ttargetPath,\n\t\t)\n\t\treturn nil\n\t}\n\n\tif err = mounter.Unmount(targetPath); err != nil {\n\t\tklog.Errorf(\n\t\t\t\"lvm: failed to unmount %s: path %s err: %v\",\n\t\t\tvol.Name, targetPath, err,\n\t\t)\n\t\treturn err\n\t}\n\n\tif err := os.Remove(targetPath); err != nil {\n\t\tklog.Errorf(\"lvm: failed to remove mount path vol %s err : %v\", vol.Name, err)\n\t}\n\n\tklog.Infof(\"umount done %s path %v\", vol.Name, targetPath)\n\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 (d DobsClient) AttachVolume(ctx Context, volumeID string, dropletID string) (error) {\n\tdropletIDI, err := strconv.Atoi(dropletID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvol, _, err := d.GodoClient.Storage.GetVolume(ctx, volumeID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(vol.DropletIDs) > 0 {\n\t\totherDropletID := vol.DropletIDs[0]\n\t\tif otherDropletID == dropletIDI {\n\t\t\tlog.Printf(\"Volume %s already attached to this droplet, skipping attach\\n\", volumeID)\n\t\t\treturn nil\n\t\t}\n\t\t\n\t\treturn fmt.Errorf(\"Volume %s already attached to different droplet %d\", volumeID, otherDropletID)\n\t}\n\n\taction, _, err := d.GodoClient.StorageActions.Attach(ctx, volumeID, dropletIDI)\t\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = d.waitForAction(ctx, volumeID, action)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func Unmount(h hostRunner, target string) error {\n\tout, err := h.RunSSHCommand(fmt.Sprintf(\"findmnt -T %s && sudo umount %s || true\", target, target))\n\tif err != nil {\n\t\treturn errors.Wrap(err, out)\n\t}\n\treturn 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 (s *Session) DetachTagFromVm(ctx context.Context, tagName string, tagCatName string, vmRef mo.Reference) error {\n\trestClient := s.Client.RestClient()\n\tmanager := tags.NewManager(restClient)\n\ttag, err := manager.GetTagForCategory(ctx, tagName, tagCatName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn manager.DetachTag(ctx, tag.ID, vmRef)\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 (c *Client) VolumeRemove(volumeID string) (err error) {\n\turl := fmt.Sprintf(\"/admin/volumes/%s\", volumeID)\n\tif _, err = c.httpDelete(url, nil); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (d *detacherDefaults) UnmountDevice(deviceMountPath string) error {\n\tklog.Warning(logPrefix(d.plugin.flexVolumePlugin), \"using default UnmountDevice for device mount path \", deviceMountPath)\n\treturn mount.CleanupMountPoint(deviceMountPath, d.plugin.host.GetMounter(d.plugin.GetPluginName()), false)\n}", "func RemoveVolume(c *check.C, name string) error {\n\tpath := \"/volumes/\" + name\n\tresp, err := request.Delete(path)\n\tdefer resp.Body.Close()\n\n\tc.Assert(err, check.IsNil)\n\tCheckRespStatus(c, resp, 204)\n\n\treturn err\n}", "func UnmapBlockVolume(\n\tblkUtil volumepathhandler.BlockVolumePathHandler,\n\tglobalUnmapPath,\n\tpodDeviceUnmapPath,\n\tvolumeMapName string,\n\tpodUID utypes.UID,\n) error {\n\t// Release file descriptor lock.\n\terr := blkUtil.DetachFileDevice(filepath.Join(globalUnmapPath, string(podUID)))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"blkUtil.DetachFileDevice failed. globalUnmapPath:%s, podUID: %s: %v\",\n\t\t\tglobalUnmapPath, string(podUID), err)\n\t}\n\n\t// unmap devicePath from pod volume path\n\tunmapDeviceErr := blkUtil.UnmapDevice(podDeviceUnmapPath, volumeMapName, false /* bindMount */)\n\tif unmapDeviceErr != nil {\n\t\treturn fmt.Errorf(\"blkUtil.DetachFileDevice failed. podDeviceUnmapPath:%s, volumeMapName: %s, bindMount: %v: %v\",\n\t\t\tpodDeviceUnmapPath, volumeMapName, false, unmapDeviceErr)\n\t}\n\n\t// unmap devicePath from global node path\n\tunmapDeviceErr = blkUtil.UnmapDevice(globalUnmapPath, string(podUID), true /* bindMount */)\n\tif unmapDeviceErr != nil {\n\t\treturn fmt.Errorf(\"blkUtil.DetachFileDevice failed. globalUnmapPath:%s, podUID: %s, bindMount: %v: %v\",\n\t\t\tglobalUnmapPath, string(podUID), true, unmapDeviceErr)\n\t}\n\treturn nil\n}", "func Detach(c *deis.Client, name string, domain string) error {\n\turl := fmt.Sprintf(\"/v2/certs/%s/domain/%s\", name, domain)\n\tres, err := c.Request(\"DELETE\", url, nil)\n\tif err == nil {\n\t\tres.Body.Close()\n\t}\n\treturn err\n}", "func detachContainerFromNetwork(ctx context.Context, cli *client.Client, containerID string, networkID string) error {\n\tctx, cancel := context.WithTimeout(ctx, 10*time.Second)\n\tdefer cancel()\n\treturn cli.NetworkDisconnect(ctx, networkID, containerID, true)\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 (c *NVMeConnector) DisconnectVolume(ctx context.Context, info NVMeVolumeInfo) error {\n\tdefer tracer.TraceFuncCall(ctx, \"NVMeConnector.DisconnectVolume\")()\n\tif err := c.limiter.Acquire(ctx, 1); err != nil {\n\t\treturn errors.New(\"too many parallel operations. try later\")\n\t}\n\tdefer c.limiter.Release(1)\n\taddDefaultNVMePortToVolumeInfoPortals(&info)\n\treturn c.cleanConnection(ctx, false, info)\n}", "func (z *zpoolctl) Detach(ctx context.Context, name, dev string) *execute {\n\targs := []string{\"attach\", name, dev}\n\treturn &execute{ctx: ctx, name: z.cmd, args: args}\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 Unmount(dir string) error {\n\tvar emsgs []string\n\t// Stop the listener.\n\tcomps := strings.Split(dir, \"/\")\n\tif len(comps) < 6 {\n\t\tsErr := fmt.Sprintf(\"Failure to notify nodeagent dir %v\", dir)\n\t\treturn failure(\"unmount\", dir, sErr)\n\t}\n\n\tuid := comps[5]\n\t// TBD: Check if uid is the correct format.\n\tnaInp := &pb.WorkloadInfo{\n\t\tAttrs: &pb.WorkloadInfo_WorkloadAttributes{Uid: uid},\n\t\tWorkloadpath: uid,\n\t}\n\tif configuration.UseGrpc == true {\n\t\tif err := sendWorkloadDeleted(naInp); err != nil {\n\t\t\tsErr := \"Failure to notify nodeagent: \" + err.Error()\n\t\t\treturn failure(\"unmount\", dir, sErr)\n\t\t}\n\t} else if err := removeCredentialFile(naInp); err != nil {\n\t\t// Go ahead and finish the unmount; no need to hold up kubelet.\n\t\temsgs = append(emsgs, \"Failure to delete credentials file: \"+err.Error())\n\t}\n\n\t// unmount the bind mount\n\tif err := getExecCmd(\"/bin/umount\", filepath.Join(dir, \"nodeagent\")).Run(); err != nil {\n\t\temsgs = append(emsgs, fmt.Sprintf(\"unmount of %s failed\", filepath.Join(dir, \"nodeagent\")))\n\t}\n\n\t// unmount the tmpfs\n\tif err := getExecCmd(\"/bin/umount\", dir).Run(); err != nil {\n\t\temsgs = append(emsgs, fmt.Sprintf(\"unmount of %s failed\", dir))\n\t}\n\n\t// delete the directory that was created.\n\tdelDir := filepath.Join(configuration.NodeAgentWorkloadHomeDir, uid)\n\terr := os.Remove(delDir)\n\tif err != nil {\n\t\temsgs = append(emsgs, fmt.Sprintf(\"unmount del failure %s: %s\", delDir, err.Error()))\n\t\t// go head and return ok.\n\t}\n\n\tif len(emsgs) == 0 {\n\t\temsgs = append(emsgs, \"Unmount Ok\")\n\t}\n\n\treturn genericSuccess(\"unmount\", dir, strings.Join(emsgs, \",\"))\n}", "func DeleteVolume(id string, name string) error {\n\treturn xms.DeleteVolumes(id, name)\n}", "func (r Virtual_Guest) DetachDiskImage(imageId *int) (resp datatypes.Provisioning_Version1_Transaction, err error) {\n\tparams := []interface{}{\n\t\timageId,\n\t}\n\terr = r.Session.DoRequest(\"SoftLayer_Virtual_Guest\", \"detachDiskImage\", params, &r.Options, &resp)\n\treturn\n}", "func (c *Controller) Unmount(unmountRequest k8sresources.FlexVolumeUnmountRequest) k8sresources.FlexVolumeResponse {\n\tc.logger.Println(\"Controller: unmount start\")\n\tdefer c.logger.Println(\"Controller: unmount end\")\n\tc.logger.Printf(\"unmountRequest %#v\", unmountRequest)\n\tvar detachRequest resources.DetachRequest\n\tvar pvName string\n\n\t// Validate that the mountpoint is a symlink as ubiquity expect it to be\n\trealMountPoint, err := c.exec.EvalSymlinks(unmountRequest.MountPath)\n\tif err != nil {\n\t\tmsg := fmt.Sprintf(\"Cannot execute umount because the mountPath [%s] is not a symlink as expected. Error: %#v\", unmountRequest.MountPath, err)\n\t\tc.logger.Println(msg)\n\t\treturn k8sresources.FlexVolumeResponse{Status: \"Failure\", Message: msg, Device: \"\"}\n\t}\n\tubiquityMountPrefix := fmt.Sprintf(resources.PathToMountUbiquityBlockDevices, \"\")\n\tif strings.HasPrefix(realMountPoint, ubiquityMountPrefix) {\n\t\t// SCBE backend flow\n\t\tpvName = path.Base(unmountRequest.MountPath)\n\n\t\tdetachRequest = resources.DetachRequest{Name: pvName, Host: getHost()}\n\t\terr = c.Client.Detach(detachRequest)\n\t\tif err != nil {\n\t\t\tmsg := fmt.Sprintf(\n\t\t\t\t\"Failed to unmount volume [%s] on mountpoint [%s]. Error: %#v\",\n\t\t\t\tpvName,\n\t\t\t\tunmountRequest.MountPath,\n\t\t\t\terr)\n\t\t\tc.logger.Println(msg)\n\t\t\treturn k8sresources.FlexVolumeResponse{Status: \"Failure\", Message: msg, Device: \"\"}\n\t\t}\n\n\t\tc.logger.Println(fmt.Sprintf(\"Removing the slink [%s] to the real mountpoint [%s]\", unmountRequest.MountPath, realMountPoint))\n\t\terr := c.exec.Remove(unmountRequest.MountPath)\n\t\tif err != nil {\n\t\t\tmsg := fmt.Sprintf(\"fail to remove slink %s. Error %#v\", unmountRequest.MountPath, err)\n\t\t\tc.logger.Println(msg)\n\t\t\treturn k8sresources.FlexVolumeResponse{Status: \"Failure\", Message: msg, Device: \"\"}\n\t\t}\n\n\t} else {\n\n\t\tlistVolumeRequest := resources.ListVolumesRequest{}\n\t\tvolumes, err := c.Client.ListVolumes(listVolumeRequest)\n\t\tif err != nil {\n\t\t\tmsg := fmt.Sprintf(\"Error getting the volume list from ubiquity server %#v\", err)\n\t\t\tc.logger.Println(msg)\n\t\t\treturn k8sresources.FlexVolumeResponse{\n\t\t\t\tStatus: \"Failure\",\n\t\t\t\tMessage: msg,\n\t\t\t}\n\t\t}\n\n\t\tvolume, err := getVolumeForMountpoint(unmountRequest.MountPath, volumes)\n\t\tif err != nil {\n\t\t\tmsg := fmt.Sprintf(\n\t\t\t\t\"Error finding the volume with mountpoint [%s] from the list of ubiquity volumes %#v. Error is : %#v\",\n\t\t\t\tunmountRequest.MountPath,\n\t\t\t\tvolumes,\n\t\t\t\terr)\n\t\t\tc.logger.Println(msg)\n\t\t\treturn k8sresources.FlexVolumeResponse{\n\t\t\t\tStatus: \"Failure\",\n\t\t\t\tMessage: msg,\n\t\t\t}\n\t\t}\n\n\t\tdetachRequest = resources.DetachRequest{Name: volume.Name}\n\t\terr = c.Client.Detach(detachRequest)\n\t\tif err != nil && err.Error() != \"fileset not linked\" {\n\t\t\tmsg := fmt.Sprintf(\n\t\t\t\t\"Failed to unmount volume [%s] on mountpoint [%s]. Error: %#v\",\n\t\t\t\tvolume.Name,\n\t\t\t\tunmountRequest.MountPath,\n\t\t\t\terr)\n\t\t\tc.logger.Println(msg)\n\n\t\t\treturn k8sresources.FlexVolumeResponse{\n\t\t\t\tStatus: \"Failure\",\n\t\t\t\tMessage: msg,\n\t\t\t}\n\t\t}\n\n\t\tpvName = volume.Name\n\t}\n\n\tmsg := fmt.Sprintf(\n\t\t\"Succeeded to umount volume [%s] on mountpoint [%s]\",\n\t\tpvName,\n\t\tunmountRequest.MountPath,\n\t)\n\tc.logger.Println(msg)\n\n\treturn k8sresources.FlexVolumeResponse{\n\t\tStatus: \"Success\",\n\t\tMessage: \"Volume unmounted successfully\",\n\t}\n}", "func (p *PodmanTestIntegration) CleanupVolume() {\n\t// TODO\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 (v *VolumeService) VolumeRemove(ctx context.Context, volumeID string, force bool) error {\n\t// verify a volume was provided\n\tif len(volumeID) == 0 {\n\t\treturn errors.New(\"no volume provided\")\n\t}\n\n\treturn nil\n}", "func (r DetachVolumeRequest) Send(ctx context.Context) (*DetachVolumeResponse, error) {\n\tr.Request.SetContext(ctx)\n\terr := r.Request.Send()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp := &DetachVolumeResponse{\n\t\tDetachVolumeOutput: r.Request.Data.(*DetachVolumeOutput),\n\t\tresponse: &aws.Response{Request: r.Request},\n\t}\n\n\treturn resp, nil\n}", "func Detach(deviceNode string, flags ...detachFlag) error {\n\tcmd := exec.Command(hdiutilPath, \"detach\", deviceNode)\n\tif len(flags) > 0 {\n\t\tfor _, flag := range flags {\n\t\t\tcmd.Args = append(cmd.Args, flag.detachFlag()...)\n\t\t}\n\t}\n\n\terr := cmd.Run()\n\tif err != nil {\n\t\treturn err\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 (s *Module) VolumeDelete(name string) error {\n\tlog.Info().Msgf(\"Deleting volume %v\", name)\n\n\tfor _, pool := range s.ssds {\n\t\tif _, err := pool.Mounted(); err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tvolumes, err := pool.Volumes()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfor _, vol := range volumes {\n\t\t\tif vol.Name() != name {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tlog.Debug().Msgf(\"Removing filesystem %v in volume %v\", vol.Name(), pool.Name())\n\t\t\terr = pool.RemoveVolume(vol.Name())\n\t\t\tif err != nil {\n\t\t\t\tlog.Err(err).Msgf(\"Error removing volume %s\", vol.Name())\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t// if there is only 1 volume, unmount and shutdown pool\n\t\t\tif len(volumes) == 1 {\n\t\t\t\terr = pool.UnMount()\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Err(err).Msgf(\"Error unmounting pool %s\", pool.Name())\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\terr = pool.Shutdown()\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Err(err).Msgf(\"Error shutting down pool %s\", pool.Name())\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn nil\n\t\t}\n\t}\n\n\tlog.Warn().Msgf(\"Could not find filesystem %v\", name)\n\treturn nil\n}", "func (p Provisioner) Destroy(id instance.ID) error {\n\n\t// TODO(chungers) -- Need to query about the status of the volume to make\n\t// sure it's ok to destroy.\n\tvolID := string(id)\n\tinput := ec2.DeleteVolumeInput{\n\t\tVolumeId: &volID,\n\t}\n\t_, err := p.Client.DeleteVolume(&input)\n\treturn err\n}", "func volCleanup(t *testing.T, volName string) {\n\t// Delete Volume\n\ttest.PxTestDeleteVolume(t, volName)\n}", "func SubvolumeDestroy(path string) {\n\tnestedvol, err := exec.Command(\"btrfs\", \"subvolume\", \"list\", \"-o\", path).Output()\n\tlog.Check(log.DebugLevel, \"Getting nested subvolumes in \"+path, err)\n\n\tscanner := bufio.NewScanner(bytes.NewReader(nestedvol))\n\tfor scanner.Scan() {\n\t\tif line := strings.Fields(scanner.Text()); len(line) > 8 {\n\t\t\tSubvolumeDestroy(GetBtrfsRoot() + line[8])\n\t\t}\n\t}\n\tqgroupDestroy(id(path))\n\n\tout, err := exec.Command(\"btrfs\", \"subvolume\", \"delete\", path).CombinedOutput()\n\tlog.Check(log.DebugLevel, \"Destroying subvolume \"+path+\": \"+string(out), err)\n}" ]
[ "0.76146585", "0.74866414", "0.72976756", "0.7266766", "0.72249514", "0.7102953", "0.7085514", "0.69899", "0.6961994", "0.6932519", "0.6575907", "0.65721023", "0.6565214", "0.6548106", "0.634469", "0.63302886", "0.63302267", "0.62540436", "0.624271", "0.6139831", "0.61269796", "0.6089647", "0.60143614", "0.5975489", "0.59312505", "0.5919571", "0.5905435", "0.5901592", "0.58694315", "0.5862776", "0.58616024", "0.5791569", "0.5786729", "0.57145387", "0.5703088", "0.5676253", "0.5646823", "0.56440544", "0.56371933", "0.56239784", "0.55708337", "0.5563046", "0.55359656", "0.55345434", "0.5533688", "0.5530497", "0.55284715", "0.55161583", "0.5511571", "0.55104107", "0.54813623", "0.5480047", "0.5471463", "0.54605865", "0.5451896", "0.5405655", "0.5368266", "0.53632855", "0.53594995", "0.534944", "0.5348708", "0.5319518", "0.5308697", "0.52945", "0.5287573", "0.5275736", "0.52740276", "0.5265203", "0.5255839", "0.52558285", "0.523935", "0.52221", "0.52059126", "0.5197161", "0.51912445", "0.5189425", "0.518566", "0.51767445", "0.51676446", "0.516262", "0.515918", "0.51503325", "0.51489675", "0.51391095", "0.51291317", "0.51291317", "0.51244915", "0.5111489", "0.510757", "0.51050353", "0.5093611", "0.5086376", "0.50793153", "0.5064445", "0.50610113", "0.5058723", "0.5045956", "0.5043386", "0.50337213", "0.5030424" ]
0.8145586
0
WaitFor waits for a lambda to complete or aborts after a specified amount of time. If the function fails to complete in the specified amount of time then the second return value is a boolean false. Otherwise the possible error of the provided lambda is returned.
func WaitFor( f func() (error), timeout time.Duration) (bool, error) { var ( err error fc = make(chan bool, 1) ) go func() { err = f() fc <- true }() tc := time.After(timeout) select { case <-fc: return true, err case <-tc: return false, nil } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func InputFunctionTimeout(t *testing.T) {\n\terr := WaitFor(twoMillisecond, oneMillisecond, func() (bool, error) {\n\t\ttime.Sleep(fiveMillisecond)\n\t\treturn true, nil\n\t})\n\tassert.NotEqual(t, err, nil)\n\tassert.Equal(t, 0, strings.Compare(err.Error(), timeoutErrMsg))\n}", "func WaitFor(timeout time.Duration, period time.Duration, f func() (bool, error)) error {\n\ttimeoutChan := time.After(timeout)\n\tvar (\n\t\twait bool = true\n\t\terr error\n\t)\n\tfor wait {\n\t\tselect {\n\t\tcase <-timeoutChan:\n\t\t\treturn status.Errorf(codes.DeadlineExceeded, \"Timed out\")\n\t\tdefault:\n\t\t\twait, err = f()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\ttime.Sleep(period)\n\t\t}\n\t}\n\n\treturn nil\n}", "func waitFor(cond func() bool) error {\n\tdone := make(chan bool)\n\n\tgo func() {\n\t\tfor {\n\t\t\tif cond() {\n\t\t\t\tdone <- true\n\t\t\t\tbreak\n\t\t\t}\n\t\t\ttime.Sleep(100 * time.Millisecond)\n\t\t}\n\t}()\n\n\tselect {\n\tcase <-done:\n\t\treturn nil\n\tcase <-time.After(5 * time.Second):\n\t\treturn errors.New(\"timed out waiting for condition\")\n\t}\n}", "func Timeout(t cbtest.T, after time.Duration, fn func()) {\n\tt.Helper()\n\n\tdone := make(chan struct{})\n\n\tgo func() {\n\t\tfn()\n\t\tdone <- struct{}{}\n\t}()\n\n\tselect {\n\tcase <-time.After(after):\n\t\tt.Error(\"Operation timed out\")\n\tcase <-done:\n\t}\n}", "func WaitForCondition(d time.Duration, testFn func() bool) bool {\n\tif d < time.Second {\n\t\tpanic(\"WaitForCondition: test duration to small\")\n\t}\n\n\ttest := time.Tick(500 * time.Millisecond)\n\ttimeout := time.Tick(d)\n\n\tcheck := make(chan struct{}, 1)\n\tdone := make(chan struct{}, 1)\n\tdefer close(check)\n\tdefer close(done)\n\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-done:\n\t\t\t\treturn\n\t\t\tcase <-test:\n\t\t\t\tif testFn() {\n\t\t\t\t\tcheck <- struct{}{}\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\n\tfor {\n\t\tselect {\n\t\tcase <-check:\n\t\t\treturn true\n\t\tcase <-timeout:\n\t\t\tdone <- struct{}{}\n\t\t\treturn false\n\t\t}\n\t}\n}", "func waitForState(stateCheckFunc func() error) (time.Duration, error) {\n\ttimeout := defaultSleepTime\n\talarm := time.After(timeout)\n\tticker := time.Tick(250 * time.Millisecond)\n\n\tfor {\n\t\tselect {\n\t\tcase <-alarm:\n\t\t\treturn timeout, fmt.Errorf(\"Failed to fetch states within %v\", timeout)\n\t\tcase <-ticker:\n\t\t\terr := stateCheckFunc()\n\t\t\tif err == nil {\n\t\t\t\treturn timeout, nil\n\t\t\t}\n\t\t\tlog.Debugf(\"Retrying assertion of states. err: %v\", err)\n\t\t}\n\t}\n}", "func (c *CLI) WaitForCondition(\n\tt testing.TB,\n\tpredicate func() (bool, string),\n\ttimeout time.Duration,\n\tdelay time.Duration,\n) {\n\tt.Helper()\n\tcheckStopped := func(logt poll.LogT) poll.Result {\n\t\tpass, description := predicate()\n\t\tif !pass {\n\t\t\treturn poll.Continue(\"Condition not met: %q\", description)\n\t\t}\n\t\treturn poll.Success()\n\t}\n\tpoll.WaitOn(t, checkStopped, poll.WithDelay(delay), poll.WithTimeout(timeout))\n}", "func (rt *RestTester) WaitForCondition(successFunc func() bool) error {\n\treturn rt.WaitForConditionWithOptions(successFunc, 200, 100)\n}", "func WaitFor(interval time.Duration, timeout time.Duration, callback func() bool) bool {\n\terr := wait.PollImmediate(interval, timeout, func() (bool, error) {\n\t\treturn callback(), nil\n\t})\n\n\treturn err == nil\n}", "func (s stdlib) Timeout(time.Duration) {}", "func TimeoutFunc(stop chan struct{}, callback func() error, timeout time.Duration) error {\n\t//optional with ttl\n\tttl := make(<-chan time.Time, 1) // placeholder for timer, 0 run forever\n\tif timeout > 0 {\n\t\tttl = time.After(timeout)\n\t}\n\n\tfor {\n\t\tselect {\n\t\tcase <-stop:\n\t\t\treturn nil\n\t\tcase <-ttl:\n\t\t\treturn nil\n\t\tcase <-time.After(1 * time.Second):\n\t\t\tif err := callback(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n}", "func (t *simpleToken) WaitTimeout(_ time.Duration) bool {\n\treturn true\n}", "func (th *TestHelper) WaitFor(description string, condition func() bool) {\n\tth.Log(\"Started waiting for %s\", description)\n\n\tfor {\n\t\tselect {\n\t\tcase <-th.Done:\n\t\t\tth.Assert(false, \"WaitFor '%s' failed.\", description)\n\t\tcase <-time.After(20 * time.Millisecond):\n\t\t}\n\n\t\tif condition() {\n\t\t\tth.Log(\"Finished waiting for %s\", description)\n\t\t\treturn\n\t\t}\n\t\tth.Log(\"Condition not satisfied\")\n\t}\n}", "func InputFunctionReturnsTrueAndNil(t *testing.T) {\n\terr := WaitFor(fiveMillisecond, oneMillisecond, func() (bool, error) {\n\t\ttime.Sleep(twoMillisecond)\n\t\treturn true, nil\n\t})\n\tassert.NotEqual(t, err, nil)\n\tassert.Equal(t, 0, strings.Compare(err.Error(), timeoutErrMsg))\n}", "func WaitSomething(nRetry int, waitTime time.Duration, fn func() bool) bool {\n\tfor i := 0; i < nRetry-1; i++ {\n\t\tif fn() {\n\t\t\treturn true\n\t\t}\n\n\t\ttime.Sleep(waitTime)\n\t}\n\treturn fn()\n}", "func PollExpecting(desc string, toHold func() bool, within time.Duration) bool {\n\tsleep := time.Millisecond * 20\n\ttries := int(1 + int64(within)/20e6)\n\t//fmt.Printf(\"tries = %d\\n\", tries)\n\tt0 := time.Now()\n\tfor i := 0; i < tries; i++ {\n\t\tif toHold() {\n\t\t\tfmt.Printf(\"Expect verified that '%s' on try %d; after %v\\n\", desc, i, time.Since(t0))\n\t\t\treturn true\n\t\t}\n\t\ttime.Sleep(sleep)\n\t}\n\tpanic(fmt.Errorf(\"did not hold: '%s', within %d tries of %v each (total ~ %v)\", desc, tries, sleep, within))\n\treturn false\n}", "func succeedsSoon(t *testing.T, fn func() error) {\n\tt.Helper()\n\ttBegin := timeutil.Now()\n\tdeadline := tBegin.Add(5 * time.Second)\n\tvar lastErr error\n\tfor wait := time.Duration(1); timeutil.Now().Before(deadline); wait *= 2 {\n\t\tlastErr = fn()\n\t\tif lastErr == nil {\n\t\t\treturn\n\t\t}\n\t\tif wait > time.Second {\n\t\t\twait = time.Second\n\t\t}\n\t\tif timeutil.Since(tBegin) > 3*time.Second {\n\t\t\tInfofDepth(context.Background(), 2, \"SucceedsSoon: %+v\", lastErr)\n\t\t}\n\t\ttime.Sleep(wait)\n\t}\n\tif lastErr != nil {\n\t\tt.Fatalf(\"condition failed to evalute: %+v\", lastErr)\n\t}\n}", "func WaitTimeout(timeout time.Duration, condition func() bool) bool {\n\tch := make(chan bool, 1)\n\n\tticker := time.NewTicker(500 * time.Millisecond)\n\tdefer ticker.Stop()\n\n\tdone := make(chan bool)\n\tgo func() {\n\t\ttime.Sleep(timeout)\n\t\tdone <- true\n\t}()\n\n\tfor {\n\t\tselect {\n\t\tcase <-ch:\n\t\t\treturn true\n\t\tcase <-done:\n\t\t\tfmt.Printf(\"condition failed to return true within %f seconds.\\n\", timeout.Seconds())\n\t\t\treturn false\n\t\tcase <-ticker.C:\n\t\t\tif condition() == true {\n\t\t\t\tch <- true\n\t\t\t}\n\t\t}\n\t}\n}", "func (w *FuncWaiter) WaitForCompletion() error {\n\tfor i := 0; ; i++ {\n\t\tlog.Infof(\"Waiting for completion ... attempted %v times, %v total\", i, w.MaxAttempts)\n\n\t\tif i >= w.MaxAttempts {\n\t\t\treturn errors.New(\"maximum attempts are reached\")\n\t\t}\n\n\t\tif ok, err := w.Checker(); ok || (!w.IgnoreError && err != nil) {\n\t\t\treturn err\n\t\t}\n\n\t\tselect {\n\t\tcase <-time.After(w.Interval):\n\t\t\tcontinue\n\t\tcase <-w.cancel:\n\t\t\tbreak\n\t\t}\n\t}\n}", "func timeout(ms time.Duration) <-chan bool {\n\tch := make(chan bool, 1)\n\tgo func() {\n\t\ttime.Sleep(ms * time.Millisecond)\n\t\tch <- true\n\t}()\n\treturn ch\n}", "func waitTimeout(wg *sync.WaitGroup, timeout time.Duration) bool {\n\tc := make(chan struct{})\n\tgo func() {\n\t\tdefer close(c)\n\t\twg.Wait()\n\t}()\n\tselect {\n\tcase <-c:\n\t\treturn false // completed normally\n\tcase <-time.After(timeout):\n\t\treturn true // timed out\n\t}\n}", "func waitTimeout(wg *sync.WaitGroup, timeout time.Duration) bool {\n\tc := make(chan struct{})\n\tgo func() {\n\t\tdefer close(c)\n\t\twg.Wait()\n\t}()\n\tselect {\n\tcase <-c:\n\t\treturn false // completed normally\n\tcase <-time.After(timeout):\n\t\treturn true // timed out\n\t}\n}", "func waitTimeout(wg *sync.WaitGroup, timeout time.Duration) bool {\n\tc := make(chan struct{})\n\tgo func() {\n\t\tdefer close(c)\n\t\twg.Wait()\n\t}()\n\tselect {\n\tcase <-c:\n\t\treturn false // completed normally\n\tcase <-time.After(timeout):\n\t\treturn true // timed out\n\t}\n}", "func waitTimeout(wg *sync.WaitGroup, timeout time.Duration) bool {\n\tc := make(chan struct{})\n\tgo func() {\n\t\tdefer close(c)\n\t\twg.Wait()\n\t}()\n\tselect {\n\tcase <-c:\n\t\treturn false // completed normally\n\tcase <-time.After(timeout):\n\t\treturn true // timed out\n\t}\n}", "func waitTimeout(wg *sync.WaitGroup, timeout time.Duration) bool {\n\tc := make(chan struct{})\n\n\tgo func() {\n\t\tdefer close(c)\n\t\twg.Wait()\n\t}()\n\n\tselect {\n\tcase <-c:\n\t\treturn false // completed normally\n\tcase <-time.After(timeout):\n\t\treturn true // timed out\n\t}\n}", "func WaitFor(namespace, display string, timeout time.Duration, condition func() (bool, error)) error {\n\tGetLogger(namespace).Infof(\"Wait %s for %s\", timeout.String(), display)\n\n\ttimeoutChan := time.After(timeout)\n\ttick := time.NewTicker(timeout / 60)\n\tdefer tick.Stop()\n\n\tfor {\n\t\tselect {\n\t\tcase <-timeoutChan:\n\t\t\treturn fmt.Errorf(\"Timeout waiting for %s\", display)\n\t\tcase <-tick.C:\n\t\t\trunning, err := condition()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif running {\n\t\t\t\tGetLogger(namespace).Infof(\"'%s' is successful\", display)\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t}\n}", "func WaitForConditionFunc(mcpName string, conditionType machineconfigv1.MachineConfigPoolConditionType, conditionStatus corev1.ConditionStatus, mcpCondGetter func(mcpName string, conditionType machineconfigv1.MachineConfigPoolConditionType) corev1.ConditionStatus) {\n\n\tvar cnfNodes []corev1.Node\n\trunningOnSingleNode, err := cluster.IsSingleNode()\n\tExpectWithOffset(1, err).ToNot(HaveOccurred())\n\t// checking in eventually as in case of single node cluster the only node may\n\t// be rebooting\n\tEventuallyWithOffset(1, func() error {\n\t\tmcp, err := GetByName(mcpName)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"Failed getting MCP by name\")\n\t\t}\n\n\t\tnodeLabels := mcp.Spec.NodeSelector.MatchLabels\n\t\tkey, _ := components.GetFirstKeyAndValue(nodeLabels)\n\t\treq, err := labels.NewRequirement(key, selection.Exists, []string{})\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"Failed creating node selector\")\n\t\t}\n\n\t\tselector := labels.NewSelector()\n\t\tselector = selector.Add(*req)\n\t\tcnfNodes, err = nodes.GetBySelector(selector)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"Failed getting nodes by selector\")\n\t\t}\n\n\t\ttestlog.Infof(\"MCP %q is targeting %v node(s): %s\", mcp.Name, len(cnfNodes), strings.Join(nodeNames(cnfNodes), \",\"))\n\t\treturn nil\n\t}, cluster.ComputeTestTimeout(10*time.Minute, runningOnSingleNode), 5*time.Second).ShouldNot(HaveOccurred(), \"Failed to find CNF nodes by MCP %q\", mcpName)\n\n\t// timeout should be based on the number of worker-cnf nodes\n\ttimeout := time.Duration(len(cnfNodes)*mcpUpdateTimeoutPerNode) * time.Minute\n\tif len(cnfNodes) == 0 {\n\t\ttimeout = 2 * time.Minute\n\t}\n\n\tEventuallyWithOffset(1, func() corev1.ConditionStatus {\n\t\treturn mcpCondGetter(mcpName, conditionType)\n\t}, cluster.ComputeTestTimeout(timeout, runningOnSingleNode), 30*time.Second).Should(Equal(conditionStatus), \"Failed to find condition status by MCP %q\", mcpName)\n}", "func TestSucceedsAfterTimeout(t *testing.T){\n breaker := NewBreaker(2 * time.Second, 2, 2)\n\n breaker.halfOpen()\n\n _, err := breaker.Run(alwaysSucceedsFunc)\n\n evaluateCondition(t, err == nil, \"TestSucceedsAfterTimeout\")\n}", "func runWithTimeout(f func() error, timeout time.Duration) error {\n\terrChan := make(chan error, 1)\n\tgo func() {\n\t\tdefer close(errChan)\n\t\terrChan <- f()\n\t}()\n\n\tselect {\n\tcase err := <-errChan:\n\t\treturn err\n\tcase <-time.After(timeout):\n\t\treturn errTimeout\n\t}\n}", "func requireWaitForEvent(\n\tt *testing.T, keptnAPI *KeptnAPI, waitFor time.Duration, tick time.Duration, keptnContext *models.EventContext,\n\teventType string, eventValidator func(c *models.KeptnContextExtendedCE) bool, source string,\n) {\n\trequireWaitForFilteredEvent(t,\n\t\tkeptnAPI,\n\t\twaitFor,\n\t\ttick,\n\t\t&api.EventFilter{\n\t\t\tKeptnContext: *keptnContext.KeptnContext,\n\t\t\tEventType: eventType,\n\t\t},\n\t\teventValidator,\n\t\tsource,\n\t)\n}", "func waitTimeout(wg *sync.WaitGroup, timeout time.Duration) bool {\n\tc := make(chan struct{})\n\tgo func() {\n\t\tdefer close(c)\n\t\twg.Wait()\n\t}()\n\tselect {\n\tcase <-c:\n\t\treturn false // wait succeeded\n\tcase <-time.After(timeout):\n\t\treturn true // wait timed out\n\t}\n}", "func RunSuccessAtLeast(dur time.Duration, f func() error) func() error {\n\treturn func() (err error) {\n\t\tbegin := time.Now()\n\t\terr = f()\n\t\tif d := time.Now().Sub(begin); err == nil && d <= dur {\n\t\t\ttime.Sleep(dur - d)\n\t\t}\n\t\treturn\n\t}\n}", "func wait(condition func() bool, timeout time.Duration) bool {\n\tkill := make(chan bool)\n\tevent := make(chan bool)\n\tgo func() {\n\t\tstop := false\n\t\tfor !stop {\n\t\t\tselect {\n\t\t\tcase <-kill:\n\t\t\t\tstop = true\n\t\t\tcase <-time.After(10 * time.Millisecond):\n\t\t\t\tif condition() {\n\t\t\t\t\tevent <- true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\tdefer func() { kill <- true }()\n\n\tselect {\n\tcase <-event:\n\t\treturn true\n\tcase <-time.After(timeout):\n\t\treturn false\n\t}\n\n\treturn false\n}", "func (m mockProc) WaitForClose(timeout time.Duration) error {\n\t// Do nothing as our processor doesn't require resource cleanup.\n\treturn nil\n}", "func IsTimeout(err error) bool", "func InputFunctionReturnsFalseAndNil(t *testing.T) {\n\terr := WaitFor(fiveMillisecond, oneMillisecond, func() (bool, error) {\n\t\ttime.Sleep(twoMillisecond)\n\t\treturn false, nil\n\t})\n\tassert.Equal(t, err, nil)\n}", "func WaitTill(condition func() bool, timeoutInSeconds int) error {\n\n\twaitTill := time.Now().Add(time.Duration(timeoutInSeconds) * time.Second)\n\n\tfor !condition() {\n\t\tif time.Now().After(waitTill) {\n\t\t\treturn errors.New(ErrTimeout)\n\t\t}\n\t\ttime.Sleep(10 * time.Millisecond)\n\t}\n\n\treturn nil\n}", "func DoThenWaitFor(f func(), er events.EventEmitter, t interface{}) {\n\tblock := make(chan struct{}, 1)\n\n\tvar once sync.Once\n\n\ter.AddListener(on(t, func(e events.Event) {\n\t\tonce.Do(func() {\n\t\t\tblock <- struct{}{}\n\t\t})\n\t}))\n\n\tf()\n\n\t// wait for first occurence of the event, close thereafter\n\t<-block\n\tclose(block)\n}", "func (td *OsmTestData) WaitForSuccessAfterInitialFailure(f SuccessFunction, minItForSuccess int, maxWaitTime time.Duration) bool {\n\titerations := 0\n\tstartTime := time.Now()\n\tsuccessHasStarted := false\n\n\tBy(fmt.Sprintf(\"[WaitForSuccessAfterFailureBuffer] waiting %v for %d iterations to succeed\", maxWaitTime, minItForSuccess))\n\tfor time.Since(startTime) < maxWaitTime {\n\t\tif f() {\n\t\t\tsuccessHasStarted = true\n\t\t\titerations++\n\t\t\tif iterations >= minItForSuccess {\n\t\t\t\treturn true\n\t\t\t}\n\t\t} else if successHasStarted {\n\t\t\treturn false\n\t\t}\n\t\ttime.Sleep(time.Second)\n\t}\n\treturn false\n}", "func waitTimeout(wg *sync.WaitGroup, timeout time.Duration) bool {\n\tc := make(chan struct{})\n\tgo func() {\n\t\tdefer close(c)\n\t\twg.Wait()\n\t}()\n\n\tselect {\n\tcase <-c:\n\t\treturn false\n\tcase <-time.After(timeout):\n\t\treturn true\n\t}\n}", "func RunFailedAtLeast(dur time.Duration, f func() error) func() error {\n\treturn func() (err error) {\n\t\tbegin := time.Now()\n\t\terr = f()\n\t\tif d := time.Now().Sub(begin); err != nil && d <= dur {\n\t\t\ttime.Sleep(dur - d)\n\t\t}\n\t\treturn\n\t}\n}", "func Try(a func() error, max time.Duration, extra ...interface{}) {\n\tx, y := 0, 1\n\tfor {\n\t\terr := actual(a, extra...)\n\t\tif err == nil {\n\t\t\treturn\n\t\t}\n\t\tt := time.Duration(x) * time.Second\n\t\tif t < max {\n\t\t\tx, y = y, x+y\n\t\t}\n\t\ttime.Sleep(t)\n\t}\n}", "func waitForCompletion(done chan bool) bool {\n\ttimer := time.NewTimer(totalWaitTime)\n\tdefer timer.Stop()\n\tselect {\n\tcase <-done:\n\t\treturn true\n\tcase <-timer.C:\n\t\treturn false\n\t}\n}", "func WaitTimeout(wg *sync.WaitGroup, timeout time.Duration) bool {\n\tc := make(chan struct{})\n\tgo func() {\n\t\tdefer close(c)\n\t\twg.Wait()\n\t}()\n\tselect {\n\tcase <-c:\n\t\treturn false // completed normally\n\tcase <-time.After(timeout):\n\t\treturn true // timed out\n\t}\n}", "func WaitTimeout(wg *sync.WaitGroup, timeout time.Duration) bool {\n\tc := make(chan struct{})\n\tgo func() {\n\t\tdefer close(c)\n\t\twg.Wait()\n\t}()\n\tselect {\n\tcase <-c:\n\t\treturn false // completed normally\n\tcase <-time.After(timeout):\n\t\treturn true // timed out\n\t}\n}", "func WaitForClusterSizeFuncWithUnready(ctx context.Context, c clientset.Interface, sizeFunc func(int) bool, timeout time.Duration, expectedUnready int) error {\n\tfor start := time.Now(); time.Since(start) < timeout && ctx.Err() == nil; time.Sleep(20 * time.Second) {\n\t\tnodes, err := c.CoreV1().Nodes().List(ctx, metav1.ListOptions{FieldSelector: fields.Set{\n\t\t\t\"spec.unschedulable\": \"false\",\n\t\t}.AsSelector().String()})\n\t\tif err != nil {\n\t\t\tklog.Warningf(\"Failed to list nodes: %v\", err)\n\t\t\tcontinue\n\t\t}\n\t\tnumNodes := len(nodes.Items)\n\n\t\t// Filter out not-ready nodes.\n\t\te2enode.Filter(nodes, func(node v1.Node) bool {\n\t\t\treturn e2enode.IsConditionSetAsExpected(&node, v1.NodeReady, true)\n\t\t})\n\t\tnumReady := len(nodes.Items)\n\n\t\tif numNodes == numReady+expectedUnready && sizeFunc(numNodes) {\n\t\t\tklog.Infof(\"Cluster has reached the desired size\")\n\t\t\treturn nil\n\t\t}\n\t\tklog.Infof(\"Waiting for cluster with func, current size %d, not ready nodes %d\", numNodes, numNodes-numReady)\n\t}\n\treturn fmt.Errorf(\"timeout waiting %v for appropriate cluster size\", timeout)\n}", "func waitForBlockNtfn(t *testing.T, ntfns <-chan interface{},\n\texpectedHeight int32, connected bool) chainhash.Hash {\n\n\ttimer := time.NewTimer(2 * time.Second)\n\tfor {\n\t\tselect {\n\t\tcase nftn := <-ntfns:\n\t\t\tswitch ntfnType := nftn.(type) {\n\t\t\tcase BlockConnected:\n\t\t\t\tif !connected {\n\t\t\t\t\tfmt.Println(\"???\")\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tif ntfnType.Height < expectedHeight {\n\t\t\t\t\tcontinue\n\t\t\t\t} else if ntfnType.Height != expectedHeight {\n\t\t\t\t\tt.Fatalf(\"expected notification for \"+\n\t\t\t\t\t\t\"height %d, got height %d\",\n\t\t\t\t\t\texpectedHeight, ntfnType.Height)\n\t\t\t\t}\n\n\t\t\t\treturn ntfnType.Hash\n\n\t\t\tcase BlockDisconnected:\n\t\t\t\tif connected {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tif ntfnType.Height > expectedHeight {\n\t\t\t\t\tcontinue\n\t\t\t\t} else if ntfnType.Height != expectedHeight {\n\t\t\t\t\tt.Fatalf(\"expected notification for \"+\n\t\t\t\t\t\t\"height %d, got height %d\",\n\t\t\t\t\t\texpectedHeight, ntfnType.Height)\n\t\t\t\t}\n\n\t\t\t\treturn ntfnType.Hash\n\n\t\t\tdefault:\n\t\t\t}\n\n\t\tcase <-timer.C:\n\t\t\tt.Fatalf(\"timed out waiting for block notification\")\n\t\t}\n\t}\n}", "func Run(fn func() error, timeout time.Duration) error {\n\tc := make(chan error, 1)\n\tgo func() {\n\t\tc <- fn()\n\t\tclose(c)\n\t}()\n\tt := time.NewTimer(timeout)\n\tdefer t.Stop()\n\n\tselect {\n\tcase err := <-c:\n\t\treturn err\n\tcase <-t.C:\n\t\treturn ErrTimedOut\n\t}\n}", "func (async *async) waitOrTimeout(duration time.Duration) error {\n\ttimer := time.NewTimer(duration)\n\tdefer timer.Stop()\n\tselect {\n\tcase <-timer.C:\n\t\treturn errors.New(\"operation cancelled\")\n\tcase <-async.done:\n\t\treturn nil\n\t}\n}", "func Timeout(check Check, timeout time.Duration) Check {\n\treturn func() error {\n\t\tc := make(chan error, 1)\n\t\tgo func() { c <- check() }()\n\t\tselect {\n\t\tcase err := <-c:\n\t\t\treturn err\n\t\tcase <-time.After(timeout):\n\t\t\treturn timeoutError(timeout)\n\t\t}\n\t}\n}", "func WaitForClusterSizeFunc(ctx context.Context, c clientset.Interface, sizeFunc func(int) bool, timeout time.Duration) error {\n\treturn WaitForClusterSizeFuncWithUnready(ctx, c, sizeFunc, timeout, 0)\n}", "func (m *MonitorImpl) Lambda() float64 {\n\tm.mutex.RLock()\n\tdefer m.mutex.RUnlock()\n\treturn m.lambda\n}", "func testWithTimeout(timeout time.Duration, run func() error) error {\n\ttimer := time.NewTimer(timeout)\n\tdefer timer.Stop()\n\n\tfor {\n\t\tif err := run(); err != nil {\n\t\t\tselect {\n\t\t\tcase <-timer.C:\n\t\t\t\treturn err\n\t\t\tdefault:\n\t\t\t\ttime.Sleep(time.Millisecond * 5)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t}\n}", "func (s *projectorSuite) waitTimeout(wg *sync.WaitGroup, timeout time.Duration) bool {\n\tc := make(chan struct{})\n\tgo func() {\n\t\tdefer close(c)\n\t\twg.Wait()\n\t}()\n\tselect {\n\tcase <-c:\n\t\treturn false // completed normally\n\tcase <-time.After(timeout):\n\t\treturn true // timed out\n\t}\n}", "func Delay(f func() interface{}) *Promise {\n\treturn &Promise{f: f}\n}", "func (p *Pod) WaitUntil(timeout TimeoutFunc, onFunc MsgFunc) error {\n\tp.onFuncLock.Lock()\n\terrChan := make(chan error)\n\n\tp.setOnFunc(func(msg Message) error {\n\t\tif err := onFunc(msg); err != nil {\n\t\t\tif err == ErrMsgNotWanted {\n\t\t\t\treturn nil // don't do anything\n\t\t\t}\n\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\terrChan <- nil\n\t\t}\n\n\t\treturn nil\n\t})\n\n\tp.onFuncLock.Unlock() // can't stay locked here or the onFunc will never be called\n\n\tvar onFuncErr error\n\tif timeout == nil {\n\t\ttimeout = Timeout(-1)\n\t}\n\n\tselect {\n\tcase err := <-errChan:\n\t\tonFuncErr = err\n\tcase <-timeout():\n\t\tonFuncErr = ErrWaitTimeout\n\t}\n\n\tp.onFuncLock.Lock()\n\tdefer p.onFuncLock.Unlock()\n\n\tp.setOnFunc(nil)\n\n\treturn onFuncErr\n}", "func (c *Client) WaitForNode(name string, timeout time.Duration, condition v1.NodeConditionType, statii ...v1.ConditionStatus) (map[v1.NodeConditionType]v1.ConditionStatus, error) {\n\tif c.ApplyDryRun {\n\t\treturn nil, nil\n\t}\n\tstart := time.Now()\n\tfor {\n\t\tconditions, err := c.GetConditionsForNode(name)\n\t\tif start.Add(timeout).Before(time.Now()) {\n\t\t\treturn conditions, fmt.Errorf(\"timeout exceeded waiting for %s is %s, error: %v\", name, conditions, err)\n\t\t}\n\n\t\tfor _, status := range statii {\n\t\t\tif conditions[condition] == status {\n\t\t\t\treturn conditions, nil\n\t\t\t}\n\t\t}\n\t\ttime.Sleep(2 * time.Second)\n\t}\n}", "func waitTimeout(wg *sync.WaitGroup, timeout time.Duration) bool {\n\tc := make(chan struct{})\n\n\t// Wait for all wait groups are closed\n\t// and then, close channel\n\tgo func() {\n\t\tdefer close(c)\n\t\twg.Wait()\n\t}()\n\n\t// Select either channel closed or timeout\n\tselect {\n\tcase <-c:\n\t\treturn false // completed normally\n\tcase <-time.After(timeout):\n\t\treturn true // timed out\n\t}\n}", "func TimelimitCapture(routine func(), timeout time.Duration) bool {\n\n\twg := sync.WaitGroup{}\n\twg.Add(1)\n\n\tgo func() {\n\t\tdefer wg.Done()\n\t\troutine()\n\t}()\n\n\tc := make(chan struct{})\n\tgo func() {\n\t\tdefer close(c)\n\t\twg.Wait()\n\t}()\n\tselect {\n\tcase <-c:\n\t\treturn true\n\tcase <-time.After(timeout):\n\t\tlogrus.Warnf(\"Routine exceed timelimit of %d sec\", timeout/1000000000)\n\t\treturn false\n\t}\n\n}", "func waitFor(fns ...func()) {\n\tvar wg sync.WaitGroup\n\n\tfor _, fn1 := range fns {\n\t\twg.Add(1)\n\t\tgo func(fn2 func()) {\n\t\t\tfn2()\n\t\t\twg.Done()\n\t\t}(fn1)\n\t}\n\n\twg.Wait()\n}", "func goTimeout(t *testing.T, d time.Duration, f func()) {\n\tch := make(chan bool, 2)\n\ttimer := time.AfterFunc(d, func() {\n\t\tt.Errorf(\"Timeout expired after %v\", d)\n\t\tch <- true\n\t})\n\tdefer timer.Stop()\n\tgo func() {\n\t\tdefer func() { ch <- true }()\n\t\tf()\n\t}()\n\t<-ch\n}", "func testPreemptionAfterSyscall(t *testing.T, syscallDuration time.Duration) {\n\tif runtime.GOARCH == \"wasm\" {\n\t\tt.Skip(\"no preemption on wasm yet\")\n\t}\n\n\tdefer runtime.GOMAXPROCS(runtime.GOMAXPROCS(2))\n\n\tinterations := 10\n\tif testing.Short() {\n\t\tinterations = 1\n\t}\n\tconst (\n\t\tmaxDuration = 5 * time.Second\n\t\tnroutines = 8\n\t)\n\n\tfor i := 0; i < interations; i++ {\n\t\tc := make(chan bool, nroutines)\n\t\tstop := uint32(0)\n\n\t\tstart := time.Now()\n\t\tfor g := 0; g < nroutines; g++ {\n\t\t\tgo func(stop *uint32) {\n\t\t\t\tc <- true\n\t\t\t\tfor atomic.LoadUint32(stop) == 0 {\n\t\t\t\t\tfakeSyscall(syscallDuration)\n\t\t\t\t}\n\t\t\t\tc <- true\n\t\t\t}(&stop)\n\t\t}\n\t\t// wait until all goroutines have started.\n\t\tfor g := 0; g < nroutines; g++ {\n\t\t\t<-c\n\t\t}\n\t\tatomic.StoreUint32(&stop, 1)\n\t\t// wait until all goroutines have finished.\n\t\tfor g := 0; g < nroutines; g++ {\n\t\t\t<-c\n\t\t}\n\t\tduration := time.Since(start)\n\n\t\tif duration > maxDuration {\n\t\t\tt.Errorf(\"timeout exceeded: %v (%v)\", duration, maxDuration)\n\t\t}\n\t}\n}", "func MakeWaitForInterval(interval time.Duration) NextWaitInterval {\n\tif interval == 0 {\n\t\tpanic(\"must specify non-zero ready interval\")\n\t}\n\n\treturn func(now time.Time, metadata JobMetadata) time.Duration {\n\t\tsinceLastFinished := now.Sub(metadata.LastFinished)\n\t\tif sinceLastFinished < interval {\n\t\t\treturn interval - sinceLastFinished\n\t\t}\n\n\t\treturn 0\n\t}\n}", "func WaitForFuncOnFakeAppScaling(t *testing.T, client framework.FrameworkClient, namespace, name, fakeAppName string, f func(dd *datadoghqv1alpha1.WatermarkPodAutoscaler, fakeApp *v1.Deployment) (bool, error), retryInterval, timeout time.Duration) error {\n\treturn wait.Poll(retryInterval, timeout, func() (bool, error) {\n\t\tobjKey := dynclient.ObjectKey{\n\t\t\tNamespace: namespace,\n\t\t\tName: name,\n\t\t}\n\t\twatermarkPodAutoscaler := &datadoghqv1alpha1.WatermarkPodAutoscaler{}\n\t\terr := client.Get(context.TODO(), objKey, watermarkPodAutoscaler)\n\t\tif err != nil {\n\t\t\tif apierrors.IsNotFound(err) {\n\t\t\t\tt.Logf(\"Waiting for availability of %s WatermarkPodAutoscaler\\n\", name)\n\t\t\t\treturn false, nil\n\t\t\t}\n\t\t\treturn false, err\n\t\t}\n\n\t\tobjKey = dynclient.ObjectKey{\n\t\t\tNamespace: namespace,\n\t\t\tName: fakeAppName,\n\t\t}\n\t\tfakeApp := &v1.Deployment{}\n\t\terr = client.Get(context.TODO(), objKey, fakeApp)\n\t\tif err != nil {\n\t\t\tif apierrors.IsNotFound(err) {\n\t\t\t\tt.Logf(\"Waiting for availability of %s FakeAppDeployment\\n\", name)\n\t\t\t\treturn false, nil\n\t\t\t}\n\t\t\treturn false, err\n\t\t}\n\n\t\tok, err := f(watermarkPodAutoscaler, fakeApp)\n\t\tt.Logf(\"Waiting for condition function to be true ok for %s WatermarkPodAutoscaler (%t/%v)\\n\", name, ok, err)\n\t\tt.Logf(\"Waiting for condition function to be true ok for %s FakeAppDeployment (%t/%v)\\n\", fakeAppName, ok, err)\n\t\treturn ok, err\n\t})\n}", "func delayedRevoke(key string, f func() bool) bool {\n\tif cacheKey(key) {\n\t\treturn true\n\t}\n\n\t// trigger a delayed revocation in background\n\tvar replyP *storageproto.PutReply\n\tvar err error\n\tputCh := make(chan bool)\n\tdoneCh := make(chan bool)\n\tgo func() {\n\t\t// put key1 again to trigger a revoke\n\t\treplyP, err = st.Put(key, \"new-value\")\n\t\tputCh <- true\n\t}()\n\t// ensure Put has gotten to server\n\ttime.Sleep(100 * time.Millisecond)\n\n\t// run rest of function in go routine to allow for timeouts\n\tgo func() {\n\t\t// run rest of test function\n\t\tret := f()\n\t\t// wait for put to complete\n\t\t<-putCh\n\t\t// check for failures\n\t\tif ret {\n\t\t\tdoneCh <- true\n\t\t\treturn\n\t\t}\n\t\tif checkErrorStatus(err, replyP.Status, storageproto.OK) {\n\t\t\tdoneCh <- true\n\t\t\treturn\n\t\t}\n\t\tdoneCh <- false\n\t}()\n\n\t// wait for test completion or timeout\n\tselect {\n\tcase ret := <-doneCh:\n\t\treturn ret\n\tcase <-time.After((storageproto.LEASE_SECONDS + storageproto.LEASE_GUARD_SECONDS + 1) * time.Second):\n\t\tbreak\n\t}\n\tfmt.Fprintln(output, \"FAIL: timeout, may erroneously increase test count\")\n\tfailCount++\n\treturn true\n}", "func tryUntilSucceeds(f func() error, desc string) error {\n\treturn tryUntilSucceedsN(f, desc, 5)\n}", "func (t *TestProcessor) WaitForClose(timeout time.Duration) error {\n\tprintln(\"Waiting for close\")\n\treturn nil\n}", "func Try(actionFunc func() error, n int, delay time.Duration, conditionFunc func(e error) bool) (int, error) {\n\tvar err error\n\ti := 0\n\tfor i < n {\n\t\ti++\n\t\terr = actionFunc()\n\t\tif conditionFunc(err) {\n\t\t\ttime.Sleep(delay)\n\t\t\tcontinue\n\t\t}\n\t\tbreak\n\t}\n\treturn i, err\n}", "func waitWithTimeout(ctx context.Context, resChan chan error,\n\ttimeout time.Duration, cancel context.CancelFunc) error {\n\tfor {\n\t\tselect {\n\t\tcase <-time.After(timeout):\n\t\t\tcancel()\n\t\t\treturn ErrorTimeOut\n\t\tcase <-ctx.Done():\n\t\t\treturn nil\n\t\tcase err := <-resChan:\n\t\t\tif err != nil {\n\t\t\t\tcancel()\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n}", "func RunAtLeast(dur time.Duration, f func() error) func() error {\n\treturn func() (err error) {\n\t\tbegin := time.Now()\n\t\terr = f()\n\t\tif d := time.Now().Sub(begin); d <= dur {\n\t\t\ttime.Sleep(dur - d)\n\t\t}\n\t\treturn\n\t}\n}", "func WaitForNodeReachability(nodeName string, timeout time.Duration, expectedReachabilityStatus bool) {\n\tisCurrentlyReachable := false\n\n\tfor start := time.Now(); time.Since(start) < timeout; {\n\t\tisCurrentlyReachable = IsNodeReachable(nodeName)\n\n\t\tif isCurrentlyReachable == expectedReachabilityStatus {\n\t\t\tbreak\n\t\t}\n\t\tif isCurrentlyReachable {\n\t\t\tlogrus.Printf(\"The node %s is reachable via ping\", nodeName)\n\t\t} else {\n\t\t\tlogrus.Printf(\"The node %s is unreachable via ping\", nodeName)\n\t\t}\n\t\ttime.Sleep(time.Second)\n\t}\n\tif expectedReachabilityStatus {\n\t\tlogrus.Printf(\"The node %s is reachable via ping\", nodeName)\n\t} else {\n\t\tlogrus.Printf(\"The node %s is unreachable via ping\", nodeName)\n\t}\n}", "func WaitFor(ctx context.Context, diff time.Duration) {\n\ttimer := time.NewTimer(diff)\n\tdefer timer.Stop()\n\n\tselect {\n\tcase <-timer.C:\n\t\treturn\n\tcase <-ctx.Done():\n\t\treturn\n\t}\n}", "func timeout(c chan int, t int) {\n\tgo func() {\n\t\ttime.Sleep(time.Second * time.Duration(t))\n\t\tc <- 1\n\t}()\n}", "func (e *PermissionDeniedError) Timeout() bool { return false }", "func WaitForWithContext(\n\tctx context.Context,\n\tminTimeout, maxTimeout, defaultTimeout time.Duration,\n\tperiod time.Duration,\n\tf func() (bool, error),\n) error {\n\tvar timeout time.Duration\n\n\t// Check if the caller provided a deadline\n\td, ok := ctx.Deadline()\n\tif !ok {\n\t\ttimeout = defaultTimeout\n\t} else {\n\t\ttimeout = d.Sub(time.Now())\n\n\t\t// Determine if it is too short or too long\n\t\tif timeout < minTimeout || timeout > maxTimeout {\n\t\t\treturn status.Errorf(codes.InvalidArgument,\n\t\t\t\t\"Deadline must be between %v and %v; was: %v\", minTimeout, maxTimeout, timeout)\n\t\t}\n\t}\n\n\treturn WaitFor(timeout, period, f)\n}", "func WaitUntil(c *check.C, f CheckFunc) {\n\tc.Log(\"wait start\")\n\tfor i := 0; i < waitMaxRetry; i++ {\n\t\tif f(c) {\n\t\t\treturn\n\t\t}\n\t\ttime.Sleep(waitRetrySleep)\n\t}\n\tc.Fatal(\"wait timeout\")\n}", "func waitForOK(service *Service, url string, timeout time.Duration) (int, error) {\n\treq, err := http.NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tokFunc := func(status int, response []byte) (bool, error) {\n\t\tok, err := isOK(status)\n\t\tif err != nil {\n\t\t\treturn false, fmt.Errorf(\"failed to query %s at %s: %w\", service.Description(), url, err)\n\t\t}\n\t\treturn ok, err\n\t}\n\treturn wait(service, okFunc, func() *http.Request { return req }, timeout)\n}", "func (r *Retry) WaitForClose(timeout time.Duration) error {\n\tselect {\n\tcase <-r.closedChan:\n\tcase <-time.After(timeout):\n\t\treturn types.ErrTimeout\n\t}\n\treturn nil\n}", "func LockOrTimeout(f func() error) chan error {\n\tfc := make(chan struct{})\n\ttc := make(chan struct{})\n\terrc := make(chan error)\n\tvar err error\n\tgo func() {\n\t\terr = f()\n\t\tclose(fc)\n\t}()\n\tgo func() {\n\t\ttime.Sleep(100 * time.Millisecond)\n\t\tclose(tc)\n\t}()\n\tgo func() {\n\t\tselect {\n\t\tcase <-fc:\n\t\t\terrc <- err\n\t\tcase <-tc:\n\t\t\terrc <- ErrTimeout\n\t\t}\n\t}()\n\treturn errc\n}", "func waitForMachineState(api *cloudapi.Client, id, state string, timeout time.Duration) error {\n\treturn waitFor(\n\t\tfunc() (bool, error) {\n\t\t\tcurrentState, err := readMachineState(api, id)\n\t\t\treturn currentState == state, err\n\t\t},\n\t\tmachineStateChangeCheckInterval,\n\t\tmachineStateChangeTimeout,\n\t)\n}", "func retryFunc(timeout time.Duration, f func() error) error {\n\tfinish := time.After(timeout)\n\tfor {\n\t\terr := f()\n\t\tif err == nil {\n\t\t\treturn nil\n\t\t}\n\t\tlog.Printf(\"Retryable error: %v\", err)\n\n\t\tselect {\n\t\tcase <-finish:\n\t\t\treturn err\n\t\tcase <-time.After(3 * time.Second):\n\t\t}\n\t}\n}", "func waitForStatus(t *testing.T, path string, statusCode int) <-chan error {\n\t// give our process 2 seconds to respond with the correct status\n\t// this should be ample.\n\tctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)\n\n\tsig := make(chan error, 1)\n\tgo func() {\n\t\tvar res *http.Response\n\t\tdefer cancel() // ensure we cancel the context to stop memory leaks\n\t\tdefer func() { close(sig) }() // ensure the channel is closed too.\n\n\t\t// while we have no response or the status code doesnt match\n\t\tfor res == nil || res.StatusCode != statusCode {\n\t\t\t// continue to perform HTTP requests against our local server\n\t\t\t// until we either receive a HTTP OK or a context timeout.\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\tsig <- ctx.Err()\n\t\t\t\treturn\n\t\t\tdefault:\n\t\t\t\treq := newRequest(t, path)\n\t\t\t\tres, _ = http.DefaultClient.Do(req.WithContext(ctx))\n\t\t\t}\n\t\t}\n\n\t\tsig <- nil\n\t}()\n\n\treturn sig\n}", "func WaitTimeout(cond *sync.Cond, timeoutMs uint64) {\n\tdone := make(chan struct{})\n\tgo func() {\n\t\tcond.Wait()\n\t\tcond.L.Unlock()\n\t\tclose(done)\n\t}()\n\tselect {\n\tcase <-time.After(time.Duration(timeoutMs) * time.Millisecond):\n\t\t// timed out\n\t\tcond.L.Lock()\n\t\treturn\n\tcase <-done:\n\t\t// Wait returned\n\t\tcond.L.Lock()\n\t\treturn\n\t}\n}", "func (reb *Manager) waitQuiesce(md *globArgs, maxWait time.Duration, cb func() bool) (\n\taborted bool, timedout bool) {\n\tcmn.Assert(maxWait > 0)\n\tsleep := md.config.Timeout.CplaneOperation\n\tmaxQuiet := int(maxWait/sleep) + 1\n\tquiescent := 0\n\n\taborted = reb.xreb.Aborted()\n\tfor quiescent < maxQuiet && !aborted {\n\t\tif !reb.laterx.CAS(true, false) {\n\t\t\tquiescent++\n\t\t} else {\n\t\t\tquiescent = 0\n\t\t}\n\t\tif cb != nil && cb() {\n\t\t\tbreak\n\t\t}\n\t\taborted = reb.xreb.AbortedAfter(sleep)\n\t}\n\n\treturn aborted, quiescent >= maxQuiet\n}", "func (filterdev *NetworkTap) Timeout() (*syscall.Timeval, error) {\n\tvar tv syscall.Timeval\n\t_, _, err := syscall.Syscall(syscall.SYS_IOCTL, uintptr(filterdev.device.Fd()), syscall.BIOCGRTIMEOUT, uintptr(unsafe.Pointer(&tv)))\n\tif err != 0 {\n\t\treturn nil, syscall.Errno(err)\n\t}\n\treturn &tv, nil\n}", "func waitCondWithTimeout(dur time.Duration, cond *sync.Cond) bool {\n\tctx, cancelF := context.WithTimeout(context.Background(), dur)\n\tdefer cancelF()\n\tdone := make(chan struct{})\n\tgo func() {\n\t\tcond.Wait()\n\t\tdone <- struct{}{}\n\t}()\n\tselect {\n\tcase <-done:\n\t\treturn true\n\tcase <-ctx.Done():\n\t}\n\treturn false\n}", "func waitForEvent(t *testing.T, wsc *client.WSClient, eventid string, dieOnTimeout bool, f func(), check func(string, interface{}) error) {\n\t// go routine to wait for webscoket msg\n\tgoodCh := make(chan interface{})\n\terrCh := make(chan error)\n\n\t// Read message\n\tgo func() {\n\t\tvar err error\n\tLOOP:\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase r := <-wsc.ResultsCh:\n\t\t\t\tresult := new(ctypes.TMResult)\n\t\t\t\twire.ReadJSONPtr(result, r, &err)\n\t\t\t\tif err != nil {\n\t\t\t\t\terrCh <- err\n\t\t\t\t\tbreak LOOP\n\t\t\t\t}\n\t\t\t\tevent, ok := (*result).(*ctypes.ResultEvent)\n\t\t\t\tif ok && event.Name == eventid {\n\t\t\t\t\tgoodCh <- event.Data\n\t\t\t\t\tbreak LOOP\n\t\t\t\t}\n\t\t\tcase err := <-wsc.ErrorsCh:\n\t\t\t\terrCh <- err\n\t\t\t\tbreak LOOP\n\t\t\tcase <-wsc.Quit:\n\t\t\t\tbreak LOOP\n\t\t\t}\n\t\t}\n\t}()\n\n\t// do stuff (transactions)\n\tf()\n\n\t// wait for an event or timeout\n\ttimeout := time.NewTimer(10 * time.Second)\n\tselect {\n\tcase <-timeout.C:\n\t\tif dieOnTimeout {\n\t\t\twsc.Stop()\n\t\t\tpanic(Fmt(\"%s event was not received in time\", eventid))\n\t\t}\n\t\t// else that's great, we didn't hear the event\n\t\t// and we shouldn't have\n\tcase eventData := <-goodCh:\n\t\tif dieOnTimeout {\n\t\t\t// message was received and expected\n\t\t\t// run the check\n\t\t\tif err := check(eventid, eventData); err != nil {\n\t\t\t\tpanic(err) // Show the stack trace.\n\t\t\t}\n\t\t} else {\n\t\t\twsc.Stop()\n\t\t\tpanic(Fmt(\"%s event was not expected\", eventid))\n\t\t}\n\tcase err := <-errCh:\n\t\tpanic(err) // Show the stack trace.\n\n\t}\n}", "func WaitForWithRetryable(backoff wait.Backoff, condition wait.ConditionFunc, retryableErrors ...string) error {\n\tvar errToReturn error\n\twaitErr := wait.ExponentialBackoff(backoff, func() (bool, error) {\n\t\t// clear errToReturn value from previous iteration\n\t\terrToReturn = nil\n\n\t\tok, err := condition()\n\t\tif ok {\n\t\t\t// All done!\n\t\t\treturn true, nil\n\t\t}\n\t\tif err == nil {\n\t\t\t// Not done, but no error, so keep waiting.\n\t\t\treturn false, nil\n\t\t}\n\n\t\t// If the returned error isn't empty, check if the error is a retryable one,\n\t\t// or return immediately.\n\t\tcode, ok := awserrors.Code(errors.Cause(err))\n\t\tif !ok {\n\t\t\treturn false, err\n\t\t}\n\n\t\tfor _, r := range retryableErrors {\n\t\t\tif code == r {\n\t\t\t\t// We should retry.\n\t\t\t\terrToReturn = err\n\t\t\t\treturn false, nil\n\t\t\t}\n\t\t}\n\n\t\t// Got an error that we can't retry, so return it.\n\t\treturn false, err\n\t})\n\n\t// If the waitError is not a timeout error (nil or a non-retryable error), return it\n\tif !errors.Is(waitErr, wait.ErrWaitTimeout) {\n\t\treturn waitErr\n\t}\n\n\t// A retryable error occurred, return the actual error\n\tif errToReturn != nil {\n\t\treturn errToReturn\n\t}\n\n\t// The error was timeout error\n\treturn waitErr\n}", "func failAfter(threshold int) Circuit {\n\tcount := 0\n\n\t// Service function. Fails after 5 tries.\n\treturn func(ctx context.Context) (string, error) {\n\t\tcount++\n\n\t\tif count > threshold {\n\t\t\treturn \"\", errors.New(\"INTENTIONAL FAIL!\")\n\t\t}\n\n\t\treturn \"Success\", nil\n\t}\n}", "func (e *ErrWaitServiceStableTimeout) Timeout() bool {\n\treturn true\n}", "func (k *Kafka) WaitForClose(timeout time.Duration) error {\n\tselect {\n\tcase <-k.closedChan:\n\tcase <-time.After(timeout):\n\t\treturn types.ErrTimeout\n\t}\n\treturn nil\n}", "func (a API) VerifyChainWait(cmd *btcjson.VerifyChainCmd) (out *bool, e error) {\n\tRPCHandlers[\"verifychain\"].Call <-API{a.Ch, cmd, nil}\n\tselect {\n\tcase <-time.After(time.Second*5):\n\t\tbreak\n\tcase o := <-a.Ch.(chan VerifyChainRes):\n\t\tout, e = o.Res, o.Err\n\t}\n\treturn\n}", "func (t *ElapsedTimeout) Wait(context.Context) error { return nil }", "func (c *changeCache) waitForSequence(ctx context.Context, sequence uint64, maxWaitTime time.Duration) error {\n\tstartTime := time.Now()\n\n\tworker := func() (bool, error, interface{}) {\n\t\tif c.getNextSequence() >= sequence+1 {\n\t\t\tbase.DebugfCtx(ctx, base.KeyCache, \"waitForSequence(%d) took %v\", sequence, time.Since(startTime))\n\t\t\treturn false, nil, nil\n\t\t}\n\t\t// retry\n\t\treturn true, nil, nil\n\t}\n\n\tctx, cancel := context.WithDeadline(ctx, startTime.Add(maxWaitTime))\n\tsleeper := base.SleeperFuncCtx(base.CreateMaxDoublingSleeperFunc(math.MaxInt64, 1, 100), ctx)\n\terr, _ := base.RetryLoop(fmt.Sprintf(\"waitForSequence(%d)\", sequence), worker, sleeper)\n\tcancel()\n\treturn err\n}", "func (m *MockConfig) Timeout() time.Duration {\n\targs := m.Called()\n\treturn args.Get(0).(time.Duration)\n}", "func WaitForFile(\n\tpath string,\n\tretryCountLimit int,\n\tverifyFileExistsFunc VerifyFileExistsFunc,\n) error {\n\tif verifyFileExistsFunc == nil {\n\t\tverifyFileExistsFunc = defaultVerifyFileExistsFunc\n\t}\n\n\tlimitedBackOff := NewLimitedBackOff(\n\t\ttime.Second,\n\t\tretryCountLimit,\n\t)\n\n\terr := backoff.Retry(func() error {\n\t\tif limitedBackOff.RetryCount() > 0 {\n\t\t\tlog.Debug(log.CAKC051, path)\n\t\t}\n\n\t\treturn verifyFileExistsFunc(path)\n\t}, limitedBackOff)\n\n\tif err != nil {\n\t\treturn log.RecordedError(log.CAKC033, retryCountLimit, path)\n\t}\n\n\treturn nil\n}", "func waitTimeout(\n\tterminateCh <-chan ChildNotification,\n) func(Shutdown) (bool, error) {\n\treturn func(shutdown Shutdown) (bool, error) {\n\t\tswitch shutdown.tag {\n\t\tcase indefinitelyT:\n\t\t\t// We wait forever for the result\n\t\t\tchildNotification, ok := <-terminateCh\n\t\t\tif !ok {\n\t\t\t\treturn false, nil\n\t\t\t}\n\t\t\t// A child may have terminated with an error\n\t\t\treturn true, childNotification.Unwrap()\n\t\tcase timeoutT:\n\t\t\t// we wait until some duration\n\t\t\tselect {\n\t\t\tcase childNotification, ok := <-terminateCh:\n\t\t\t\tif !ok {\n\t\t\t\t\treturn false, nil\n\t\t\t\t}\n\t\t\t\t// A child may have terminated with an error\n\t\t\t\treturn true, childNotification.Unwrap()\n\t\t\tcase <-time.After(shutdown.duration):\n\t\t\t\treturn true, errors.New(\"child shutdown timeout\")\n\t\t\t}\n\t\tdefault:\n\t\t\t// This should never happen if we use the already defined Shutdown types\n\t\t\tpanic(\"invalid shutdown value received; check waitTimeout implementation\")\n\t\t}\n\t}\n}", "func (tg *TimeoutGroup) WaitTimeout(timeout time.Duration) bool {\n\ttimed, _ := tg.WaitTimeoutWithStop(timeout, nil)\n\treturn timed\n}", "func (tg *TimeoutGroup) WaitTimeout(timeout time.Duration) bool {\n\ttimed, _ := tg.WaitTimeoutWithStop(timeout, nil)\n\treturn timed\n}", "func WaitWithTimeout(waitGroup *sync.WaitGroup, timeout time.Duration) bool {\n\tdone := make(chan interface{}, 0)\n\tgo func() {\n\t\twaitGroup.Wait()\n\t\tdone <- nil\n\t}()\n\n\ttimer := time.After(timeout)\n\tfor {\n\t\tselect {\n\t\tcase <-timer:\n\t\t\treturn false\n\t\tcase <-done:\n\t\t\treturn true\n\t\t}\n\t}\n}" ]
[ "0.5989081", "0.56573313", "0.561649", "0.55629176", "0.54726297", "0.5344843", "0.5203858", "0.5197848", "0.5181893", "0.5180577", "0.51102966", "0.5080883", "0.50661504", "0.50367236", "0.5016914", "0.4992581", "0.49451867", "0.48951468", "0.4809788", "0.47896603", "0.47890595", "0.47890595", "0.47890595", "0.47890595", "0.47888014", "0.47701323", "0.47617868", "0.47585523", "0.47521016", "0.4748703", "0.47032616", "0.4700514", "0.46929163", "0.46770853", "0.46535686", "0.46526572", "0.46277046", "0.46263772", "0.461472", "0.46065098", "0.45994267", "0.45895296", "0.4585705", "0.45809793", "0.45809793", "0.45800957", "0.4575577", "0.45667416", "0.4554429", "0.45539474", "0.4537462", "0.4535604", "0.45263836", "0.45221096", "0.4481248", "0.44647703", "0.44647366", "0.44579715", "0.44575518", "0.44575036", "0.4454841", "0.44520286", "0.44497773", "0.44277266", "0.44170034", "0.44139248", "0.44102114", "0.43882483", "0.4386803", "0.43850964", "0.43657777", "0.43603945", "0.43591702", "0.4355897", "0.4355647", "0.43528128", "0.43484855", "0.4334282", "0.43342426", "0.43337932", "0.43326107", "0.4322737", "0.4284529", "0.42808756", "0.42730764", "0.4267132", "0.42619866", "0.42551473", "0.4251744", "0.42408156", "0.42406332", "0.4235497", "0.42322254", "0.42291722", "0.42240348", "0.42206436", "0.4217468", "0.4211204", "0.4211204", "0.4208063" ]
0.6214525
0
/ Graph g(5); // Total 5 vertices in graph g.addEdge(1, 0); g.addEdge(0, 2); g.addEdge(2, 1); g.addEdge(0, 3); g.addEdge(1, 4);
func testDFS() { g := NewGraph(4) g.AddEdge(0, 1) g.AddEdge(0, 2) g.AddEdge(1, 2) g.AddEdge(2, 0) g.AddEdge(2, 3) g.AddEdge(3, 3) log.Printf("Graph %v", g.String()) g.RecursiveDFS(0) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func main15() {\n\tgph := new(Graph)\n\tgph.Init(5)\n gph.AddDirectedEdge(0, 1, 3)\n gph.AddDirectedEdge(0, 4, 2)\n gph.AddDirectedEdge(1, 2, 1)\n gph.AddDirectedEdge(2, 3, 1)\n gph.AddDirectedEdge(4, 1, -2)\n gph.AddDirectedEdge(4, 3, 1)\n gph.BellmanFordShortestPath(0)\n}", "func testgraph() *Graph {\n\tg := New()\n\n\tg.Link(0, 1)\n\tg.Link(0, 4)\n\tg.Link(1, 2)\n\tg.Link(1, 3)\n\tg.Link(2, 1)\n\tg.Link(3, 3)\n\tg.Link(4, 3)\n\tg.Link(4, 0)\n\tg.Link(5, 6)\n\tg.Link(5, 0)\n\tg.Link(5, 2)\n\tg.Link(6, 2)\n\tg.Link(6, 7)\n\tg.Link(7, 5)\n\n\treturn g\n}", "func New() Graph {\n\tva := &Vertex{Name: \"A\", Visited: false}\n\tvb := &Vertex{Name: \"B\", Visited: false}\n\tvc := &Vertex{Name: \"C\", Visited: false}\n\tvd := &Vertex{Name: \"D\", Visited: false}\n\tve := &Vertex{Name: \"E\", Visited: false}\n\tvf := &Vertex{Name: \"F\", Visited: false}\n\tvg := &Vertex{Name: \"G\", Visited: false}\n\n\tg := Graph{Vertices: []*Vertex{va, vb, vc, vd, ve, vf, vg}}\n\n\tg.AddEdge(va, vb, 2)\n\tg.AddEdge(va, vc, 3)\n\tg.AddEdge(va, vd, 3)\n\tg.AddEdge(vb, vc, 4)\n\tg.AddEdge(vb, ve, 3)\n\tg.AddEdge(vc, vd, 5)\n\tg.AddEdge(vc, ve, 1)\n\tg.AddEdge(vd, vf, 7)\n\tg.AddEdge(ve, vf, 8)\n\tg.AddEdge(vf, vg, 9)\n\n\treturn g\n}", "func main() {\n\n nodes := []graph.Node{}\n router := Router{ \"routerA\",1 }\n router2 := Router{ \"routerB\",2 }\n subnet := Subnet{ \"subnet1\", 10}\n nodes = append(nodes, router)\n// nodes = append(nodes, subnet)\n g := graph.NewGraph(nodes)\n g.AddNode(subnet)\n g.AddNode(router2)\n\n\n g.SetEdge(router, subnet)\n g.SetEdge(router2, subnet)\n\n g.Dump()\n\n// weight := float64(40)\n// edge := g.NewWeightedEdge(router, subnet, weight)\n// g.SetWeightedEdge(edge)\n\n// fmt.Printf(\"%v\\n\", g)\n// g.Dump()\n\n/*\n self := 0.0 // the cost of self connection\n absent := 10.0 // the wieght returned for absent edges\n\n graph := simple.NewWeightedUndirectedGraph(self, absent)\n fmt.Printf(\"%v\\n\", graph)\n\n var id int64\n //var node simple.Node\n\n id = 0\n from := simple.Node(id)\n graph.AddNode(from)\n\n id = 1\n to := simple.Node(id)\n graph.AddNode(to)\n\n id = 2\n from2 := simple.Node(id)\n graph.AddNode(from2)\n\n id = 3\n to2 := simple.Node(id)\n graph.AddNode(to2)\n\n\n nodeA := graph.Node(int64(2))\n\n\n\n fmt.Printf(\"%v\\n\", graph)\n\n nodes := graph.Nodes()\n fmt.Printf(\"%v\\n\", nodes)\n fmt.Printf(\"%v\\n\", nodeA)\n\n weight := float64(40)\n edge := graph.NewWeightedEdge(from, to, weight)\n graph.SetWeightedEdge(edge)\n\n edge2 := graph.NewWeightedEdge(from2, to2, weight)\n graph.SetWeightedEdge(edge2)\n\n fmt.Printf(\"%v\\n\", graph)\n edges := graph.Edges()\n fmt.Printf(\"%v\\n\", edges)\n\n edge_ := graph.Edge(int64(0) ,int64(1))\n fmt.Printf(\"%v\\n\", edge_)\n*/\n}", "func (g *DenseGraph) AddVertex(neighbours []int) {\n\toldSize := (g.NumberOfVertices * (g.NumberOfVertices - 1)) / 2\n\tnewSize := oldSize + g.NumberOfVertices\n\tif cap(g.Edges) >= newSize {\n\t\tg.Edges = g.Edges[:newSize]\n\t\tfor i := oldSize; i < newSize; i++ {\n\t\t\tg.Edges[i] = 0\n\t\t}\n\t} else {\n\t\ttmp := make([]byte, newSize)\n\t\tcopy(tmp, g.Edges)\n\t\tg.Edges = tmp\n\t}\n\tfor _, v := range neighbours {\n\t\tg.Edges[oldSize+v] = 1\n\t\tg.DegreeSequence[v]++\n\t}\n\tg.DegreeSequence = append(g.DegreeSequence, len(neighbours))\n\tg.NumberOfVertices++\n\tg.NumberOfEdges += len(neighbours)\n}", "func (graph *DirGraph) showTopFiveStrongConnections() {\n\tvar aMap map[int]int\n\taMap = make(map[int]int)\n\tvar node *GraphNode\n\tfor _, node = range graph.graphNodes {\n\t\tif node.ID == -1 {\n\t\t\tpanic(fmt.Sprintf(\"Error - Expected ID to be set (> -1), actual value is %d.\", node.ID))\n\t\t}\n\t\taMap[node.ID]++\n\t}\n\n\tvar id int\n\tvar j int\n\tj = 0\n\tfor id, _ = range aMap {\n\t\tfmt.Print(id, \" \")\n\t\tj = j + 1\n\t\tif j > 4 {\n\t\t\tbreak\n\t\t}\n\t}\n\tfmt.Println()\n}", "func NewGraph(n int) Graph {\n\tadj := make([][]int, n)\n\tfor v := 0; v < n; v++ {\n\t\tadj[v] = make([]int, 0, n)\n\t}\n\treturn &graph{v: n, e: 0, adj: adj}\n}", "func main() {\n\ta := &Node{Id: 1}\n\tb := &Node{Id: 2}\n\tc := &Node{Id: 3}\n\td := &Node{Id: 4}\n\te := &Node{Id: 5}\n\tf := &Node{Id: 6}\n\tg := &Node{Id: 7}\n\n\tgraph := &Graph{}\n\tgraph.AddEdge(a, c, 2)\n\tgraph.AddEdge(a, b, 5)\n\tgraph.AddEdge(c, b, 1)\n\tgraph.AddEdge(c, d, 9)\n\tgraph.AddEdge(b, d, 4)\n\tgraph.AddEdge(d, e, 2)\n\tgraph.AddEdge(d, g, 30)\n\tgraph.AddEdge(d, f, 10)\n\tgraph.AddEdge(f, g, 1)\n\n\tres := dijkstra(graph, a)\n\n\tfor _, r := range res {\n\t\tfmt.Println(r.toString())\n\t}\n}", "func constructGraph(v int) *list.List {\n\tdegree = make([]int,v)\n\tMasterList := list.New()\n\tfor i := 0; i < v; i++ {\n\t\tvar l = list.New()\n\t\tl.PushBack(i)\n\t\tMasterList.PushBack(l)\n\t}\n\treturn MasterList\n}", "func simpleGraph() (*Graph, []interface{}) {\n\n\t// Some sequence of probabilities. (rows correspond to states.)\n\tscores := [][]float64{\n\t\t{0.1, 0.1, 0.2, 0.4, 0.11, 0.11, 0.12, 0.14},\n\t\t{0.4, 0.1, 0.3, 0.5, 0.21, 0.01, 0.12, 0.08},\n\t\t{0.2, 0.2, 0.4, 0.5, 0.09, 0.11, 0.32, 0.444},\n\t}\n\n\t// Convert to log scores.\n\tvar n []interface{}\n\tfor i, v := range scores {\n\t\tfor j, _ := range v {\n\t\t\tscores[i][j] = math.Log(scores[i][j])\n\t\t}\n\t\tn = append(n, i)\n\t}\n\t// Define score functions to return state probabilities.\n\tvar s1Func = func(n interface{}) float64 {\n\t\treturn scores[0][n.(int)]\n\t}\n\tvar s2Func = func(n interface{}) float64 {\n\t\treturn scores[1][n.(int)]\n\t}\n\tvar s3Func = func(n interface{}) float64 {\n\t\treturn scores[2][n.(int)]\n\t}\n\tvar s5Func = func(n interface{}) float64 {\n\t\treturn scores[2][n.(int)]\n\t}\n\tvar finalFunc = func(n interface{}) float64 {\n\t\treturn 0\n\t}\n\n\t// Creates a new graph.\n\tg := New()\n\n\t// Create some nodes and assign values.\n\tg.Set(\"s0\", vvalue{null: true}) // initial state\n\tg.Set(\"s1\", vvalue{f: s1Func})\n\tg.Set(\"s2\", vvalue{f: s2Func})\n\tg.Set(\"s3\", vvalue{f: s3Func})\n\tg.Set(\"s5\", vvalue{f: s5Func})\n\tg.Set(\"s4\", vvalue{f: finalFunc, null: true}) // final state\n\n\t// Make connections.\n\tg.Connect(\"s0\", \"s1\", 1)\n\tg.Connect(\"s1\", \"s1\", 0.4)\n\tg.Connect(\"s1\", \"s2\", 0.5)\n\tg.Connect(\"s1\", \"s3\", 0.1)\n\tg.Connect(\"s2\", \"s2\", 0.5)\n\tg.Connect(\"s2\", \"s3\", 0.4)\n\tg.Connect(\"s2\", \"s5\", 0.1)\n\tg.Connect(\"s5\", \"s5\", 0.7)\n\tg.Connect(\"s5\", \"s1\", 0.3)\n\tg.Connect(\"s3\", \"s3\", 0.6)\n\tg.Connect(\"s3\", \"s4\", 0.4)\n\n\t// Convert transition probabilities to log.\n\tg.ConvertToLogProbs()\n\treturn g, n\n}", "func createGraph() *Graph {\n var g = Graph{}\n g.adjList = make(map[int]set)\n return &g\n}", "func (g *Graph) Size() int { return len(g.nodes) }", "func NewGraph() *Graph {\n\tg := &Graph{}\n\tfmt.Println(\"Please input the number of node and edge(n e)\")\n\tfmt.Scanf(\"%d %d\\n\", &g.n, &g.e)\n\tfmt.Println(\"Please input the edge(x y w)\")\n\tg.edge = make([]int, g.n*g.n)\n\tEdges = make([]edges, g.e)\n\n\tfor i := 0; i < g.e; i++ {\n\t\tvar x, y, w int\n\t\tfmt.Scanf(\"%d %d %d\\n\", &x, &y, &w)\n\n\t\tEdges[i].begin = x\n\t\tEdges[i].end = y\n\t\tEdges[i].cost = w\n\t\tEdges[i].inHeap = false // -false is not in heap\n\n\t\tg.edge[x*g.n+y] = w\n\t}\n\treturn g\n}", "func main() {\n graph := createGraph()\n graph.addEdge(1, 2)\n graph.addEdge(2, 3)\n graph.addEdge(2, 4)\n graph.addEdge(3, 4)\n graph.addEdge(1, 5)\n graph.addEdge(5, 6)\n graph.addEdge(5, 7)\n\n visited := make(set)\n\n dfs(graph, 1, visited, func(node int) {\n fmt.Print(node, \" \")\n })\n}", "func makerectangle(i int, j int, g *Graph) error {\n\tnodes := i * j //number of vertices\n\n\tif g.numvert < nodes {\n\t\t_, err := g.addVertices(nodes - g.numvert)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n\tif g.numvert > nodes {\n\t\tlog.Fatal(\"Too many vertices\")\n\t}\n\n\tfrom := 1\n\tto := 2\n\trun := false\n\tdone := false\n\tfor !done {\n\t\ta := Vertex{vert: from}\n\t\tb := Vertex{vert: to}\n\t\tg.addEdge(a, b)\n\t\tfrom++\n\t\tto++\n\t\tif from%j == 0 && !run {\n\t\t\tfrom++\n\t\t\tto++\n\t\t}\n\t\tif run && to > nodes {\n\t\t\tdone = true\n\t\t}\n\t\tif to > nodes {\n\t\t\tfrom = 1\n\t\t\tto = 1 + j\n\t\t\trun = true\n\t\t}\n\t}\n\treturn nil\n}", "func NewGraph(size int) *Graph {\n\tgraph := &Graph{\n\t\tnodes: make([]Node, size),\n\t}\n\n\tfor i := 0; i < size; i++ {\n\t\tgraph.nodes[i].id = i\n\t}\n\n\treturn graph\n}", "func (g *Graph) AddVertex() {\n\tg.VertexNumber++\n}", "func (g *Graph) init(numVertex int) {\n if g.vertex == nil {\n g.vertex = make([]*NodeG, numVertex+1)\n }\n}", "func BuildGraph(size int, edges []Edge) *Graph {\n\tgraph := NewGraph(size)\n\n\tfor _, edge := range edges {\n\t\tgraph.AddEdge(edge.src, edge.dest, edge.weight)\n\t}\n\n\treturn graph\n}", "func makewall(i int, g *Graph) error {\n\tnodes := 2 * i * i\n\tedges := i*(2*i-2) + i*i\n\n\tif g.numvert < nodes {\n\t\t_, err := g.addVertices(nodes - g.numvert)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n\tif g.numvert > nodes {\n\t\tlog.Fatal(\"Too many vertices\")\n\t}\n\n\tfrom := 1\n\tto := 2\n\tfor edges > 0 {\n\t\ta := Vertex{vert: from}\n\t\tb := Vertex{vert: to}\n\t\tg.addEdge(a, b)\n\t\tedges--\n\n\t\t//add the vertical edges in the wall graph\n\t\t//only if the index isn't outside of the graph\n\t\tlower := (from + 2*i + 1)\n\t\tif from%2 == 1 && lower <= nodes {\n\t\t\tb = Vertex{vert: lower}\n\t\t\tg.addEdge(a, b)\n\t\t\tedges--\n\t\t}\n\n\t\tfrom++\n\t\tto++\n\t\tif from%(2*i) == 0 {\n\t\t\tfrom++\n\t\t\tto++\n\t\t}\n\n\t}\n\n\treturn nil\n}", "func main() {\n //Leemos el archivo\n data, err := ioutil.ReadFile(\"g.txt\")\n if err != nil {\n fmt.Println(\"File reading error\", err)\n return\n }\n rows := strings.Split(string(data), \"\\n\")\n //Inicializamos los vertices\n numOfVertexes, _ := strconv.Atoi(rows[0])\n vertexesG := make([]Vertex, numOfVertexes)\n count := 0;\n for count < numOfVertexes {\n vertexesG[count] = Vertex{count, 0.1, 0.2}\n count = count + 1\n }\n\n //Inicializamos las aristas con los valores del archivo\n numOfEdges := len(rows)-2\n edgesG := make([]Edge, numOfEdges)\n count = 0;\n for count < numOfEdges {\n vertIndx := strings.Split(rows[count+1], \",\") \n vertex1, _ := strconv.Atoi(vertIndx[0])\n vertex2, _ := strconv.Atoi(vertIndx[1])\n edgesG[count] = Edge{vertex1,vertex2,1}\n count = count + 1\n }\n\n //De lo anterior tenemos el conjuinto de vertices vertexesG y el conjunto de aristas edgesG\n //El apuntador a estos dos conjuntos se les pasara a todas las hormigas para que los compartan\n //Y todas tengan los mismos conjuntos\n\n\n //VARIABLE QUE NOS DIRA CUANTAS VECES SE HA ENCONTRADO UNA SOLUCION CON EL MISMO TAMAÑO DE MANERA CONSECUTIVA \n numSinCambios := 0\n //Variable que nos dice el numero de veces que si se encuentra la solcucion con el mismo tamaño se detendra el algoritmo\n numIteracionSeguidasParaParar := 200\n //Defefine el numero de hormigas que tendremos\n numberOfAnts := 20\n //Calculamos la cantidad de aristas que debe de tener la greafica comompleta dada la cantidad de vertices que tenemos\n numOfEdgesFull := (numOfVertexes*(numOfVertexes-1))/2\n\n //VARIABLES QUE DEFINE LOS PARAMETROS DEL ALGORITMO\n q := 0.5\n evaporation_rate := 0.2\n pheromone_adjust := 0.12\n //beta := 1\n //VARIABLES QUE DEFINE LOS PARAMETROS DEL ALGORITMO\n\n //Semilla para la funcion de numeros aleatorios\n randomSeed := 1\n //La funcion para generar los numeros aletarios que usaremos\n randomFun := rand.New(rand.NewSource(int64(randomSeed)))\n min_sol := make([]int, numOfVertexes)\n \n //Inicializamos un slice de hormigas con la cantida de hormigas definida\n ants := make([]Ant, numberOfAnts)\n\n antCount := 0\n //Para cada hormiga le vamos a crear su slice de edgesFull, una grafica con el apuntaos a los vertifces\n //el aputnador a las aristas y sus aristas que rempresentaran a la grafica completa\n //Depues vamos a crear ala hormiga con los parametros\n //La grafica que le creamos, un slice de enteros para sus soluciones, la funcion aleatorio y los parametros \n for antCount < numberOfAnts {\n edgesFull := make([]Edge, numOfEdgesFull)\n graphG := Graph{&vertexesG,&edgesG,&edgesFull}\n slice := make([]int, 0)\n ants[antCount] = Ant{antCount,&graphG,randomFun, &slice,q,evaporation_rate,pheromone_adjust}\n antCount = antCount +1\n }\n \n ///////////////////////////////////\n //////////ALGORITMO ACO////////////\n ///////////////////////////////////\n //Mientras no se tengan numIteracionSeguidasParaParar sin cambios en la solucion\n //Ejecutaremos el siguiente ciclo\n\n////////////////////////CICLO////////////////////////////\n for numSinCambios <= numIteracionSeguidasParaParar{\n\n //fmt.Printf(\"Sin cambios: %d\\n\", numSinCambios)\n\n //Inicializamos a cada una de las hormigas estos es \n //Inicializar la grafica full\n //Inicialar el slice de soluciones\n //no necesitamos poner a la hormiga en un vertice arbitratio en un principio por que desde todos los vertices tenemos conexion a todos por ser grafica\n //a todos por ser grafica completa\n antCount = 0\n for antCount < numberOfAnts {\n (*ants[antCount].graph).initFull()\n ants[antCount].BorraSolucion()\n antCount = antCount +1\n } \n \n //Mientras alguno de las hormigas pueda dar un paso\n sePuedeDarPaso := true\n for sePuedeDarPaso != false {\n\n otroPaso := false\n antCount = 0\n //Verificamos si alguna de las hormigas todavia puede dar un paso\n for antCount < numberOfAnts {\n if ants[antCount].PuedeDarUnPaso(){\n otroPaso = true\n }\n antCount = antCount +1\n }\n \n //Si alguna hormiga todavia puede dar un paso\n sePuedeDarPaso = otroPaso\n if sePuedeDarPaso{\n antCount = 0\n for antCount < numberOfAnts {\n //Verificamos si la hormiga con index antCount puede dar un paso y si es asi\n //Esta damos el paso con esta hormiga\n if ants[antCount].PuedeDarUnPaso(){\n\n////////////////////////PASO//////////////////////////// (VER EL LA FUNCION)\n ants[antCount].Paso() \n }\n antCount = antCount +1\n }\n }\n }\n\n///////////TODAS LAS HORMIGAS COMPLETAN SU TRAYECTO/////\n //Una vez que ya se dieron todos los pasos posibles debemo encontrar la mejor solucion guardarla y actualziar la feromona\n antCount = 0\n //El tamaño de la solucion minima\n minSolLen := -1\n //El indice de la hormiga que tiene la solucion minima\n minSolIndex := -1\n //Buscamos la solucion minima entre todas las hormigas\n for antCount < numberOfAnts {\n solLen := len((*ants[antCount].solution))\n if minSolLen > solLen || minSolLen < 0{\n minSolLen = solLen\n minSolIndex = antCount\n }\n antCount = antCount +1\n }\n ants[minSolIndex].PrintSolution()\n\n //Verificamos que la solucioon mejor encontrada en este ciclo sea mejor que minima solucion actual\n if len(min_sol) >= len((*ants[minSolIndex].solution)){\n //Si la solucion tiene el mismo tamaño entonces sumaos 1 al contador de ciclos sin con el mismo \n //Tamaño de solucion\n if len(min_sol) == len((*ants[minSolIndex].solution)){\n numSinCambios = numSinCambios+1\n //Si la solucion es mas pequeña regreamos el contador a 0 \n }else{\n numSinCambios = 0\n }\n\n //Borramos la mejor solucion anterior\n min_sol = make([]int, len((*ants[minSolIndex].solution)))\n countSolIndex := 0\n //Copiamos la nueva solucion minima\n for countSolIndex < len(min_sol){\n min_sol[countSolIndex] = (*ants[minSolIndex].solution)[countSolIndex]\n countSolIndex = countSolIndex +1\n }\n }\n\n countSolIndex := 0\n //Imprimimos la mejor solucion hasta el momento\n fmt.Printf(\"MejorSolucion: \")\n for countSolIndex < len(min_sol){\n fmt.Printf(\"%d \", min_sol[countSolIndex])\n countSolIndex = countSolIndex +1\n }\n fmt.Printf(\"\\n\")\n\n////////////////////////ACTUALIZACION GLOBAL////////////////////////////\n //Por ultimo vamos a hacer la actualizacion de la feromona de manera GLOBAL\n countVertexIndex := 0\n //Para cada uno de los vertices calculamos el nuevo valor de la hormona considerando la evaporacion\n for countVertexIndex < len(vertexesG){\n vertexIndex := vertexesG[countVertexIndex].index\n vertexPheromone := vertexesG[countVertexIndex].pheromone\n newPheromoneValue := (1-evaporation_rate)*vertexPheromone\n addedPheromone := 0.0\n countSolIndex := 0\n //Si el vertice es parte de la solucion minima actual entonces tambien calculamos la feromona extra que se le sumara\n for countSolIndex < len(min_sol){\n if vertexIndex == min_sol[countSolIndex]{\n addedPheromone = evaporation_rate*(1.0/float64((len(min_sol))))\n //fmt.Printf(\"AddedPhero %f\\n\",addedPheromone)\n }\n countSolIndex = countSolIndex +1\n } \n //Actualizamos el valor de la feromona\n vertexesG[countVertexIndex].pheromone = newPheromoneValue + addedPheromone\n countVertexIndex = countVertexIndex +1\n }\n\n }\n\n}", "func main() {\n\tg := getGraph()\n\tfmt.Println(components(g))\n}", "func (g *Graph) VertexCount() int {\n\treturn len(g.adjList)\n}", "func (g DenseGraph) N() int {\n\treturn g.NumberOfVertices\n}", "func (g *Graph) adj(v int) []int {\n if g.vertex[v] == nil {\n return []int{}\n } else {\n adjNodes := make([]int, 0)\n n := g.vertex[v]\n //fmt.Println(\"adj\", n)\n for {\n adjNodes = append(adjNodes, (*n).val)\n n = n.next\n if n == nil {\n break\n } else if n.next == nil {\n adjNodes = append(adjNodes, (*n).val)\n break\n }\n }\n return adjNodes\n }\n}", "func (g Graph) Print() {\n count := 0;\n for count < len(*g.vertexes) {\n (*g.vertexes)[count].Print()\n count = count + 1\n }\n count = 0;\n for count < len(*g.edges) {\n (*g.edges)[count].Print()\n count = count + 1\n }\n}", "func createGraph3() *NodeG {\n n1 := NodeG{1, nil}\n n2 := NodeG{2, nil}\n n3 := NodeG{3, nil}\n n1.neighbors = append(n1.neighbors, &n2)\n n2.neighbors = append(n2.neighbors, &n3)\n\n return &n1\n}", "func setup(f func(int) Grapher, n int) (graph Grapher) {\n\tgraph = f(n)\n\trandom := rand.New(rand.NewSource(time.Now().UnixNano()))\n\tfor count := 0; count < n; {\n\t\ta := random.Intn(n)\n\t\tb := random.Intn(n)\n\t\tif !graph.HasEdge(a, b) {\n\t\t\tgraph.Add(a, b)\n\t\t\tcount++\n\t\t}\n\t}\n\treturn\n}", "func (g *Digraph) NumofVertices() int {\n\treturn g.nodes\n}", "func (g UndirectWeighted) Nodes() Nodes { return g.G.Nodes() }", "func MakeGraph(matrix [9][9]int) int {\n\tgraph := implementDS.Graph{}\n\tnodes := make(map[string]*implementDS.Node)\n\tfor i := 0; i < 9; i++ {\n\t\tfor j := 0; j < 9; j++ {\n\t\t\tif matrix[i][j] == 1 {\n\t\t\t\tname := strconv.Itoa(i) + strconv.Itoa(j)\n\t\t\t\tnodes[name] = &implementDS.Node{Name: name}\n\t\t\t}\n\t\t}\n\t}\n\tfor i := 0; i < 9; i++ {\n\t\tfor j := 0; j < 9; j++ {\n\t\t\tif matrix[i][j] == 1 {\n\t\t\t\tif i+1 < 9 && matrix[i+1][j] == 1 {\n\t\t\t\t\tname := strconv.Itoa(i) + strconv.Itoa(j)\n\t\t\t\t\tname2 := strconv.Itoa(i+1) + strconv.Itoa(j)\n\t\t\t\t\tgraph.AddEdge(nodes[name], nodes[name2], 1)\n\t\t\t\t}\n\t\t\t\tif i-1 >= 0 && matrix[i-1][j] == 1 {\n\t\t\t\t\tname := strconv.Itoa(i) + strconv.Itoa(j)\n\t\t\t\t\tname2 := strconv.Itoa(i-1) + strconv.Itoa(j)\n\t\t\t\t\tgraph.AddEdge(nodes[name], nodes[name2], 1)\n\t\t\t\t}\n\t\t\t\tif j-1 >= 0 && matrix[i][j-1] == 1 {\n\t\t\t\t\tname := strconv.Itoa(i) + strconv.Itoa(j)\n\t\t\t\t\tname2 := strconv.Itoa(i) + strconv.Itoa(j-1)\n\t\t\t\t\tgraph.AddEdge(nodes[name], nodes[name2], 1)\n\t\t\t\t}\n\t\t\t\tif j+1 < 9 && matrix[i][j+1] == 1 {\n\t\t\t\t\tname := strconv.Itoa(i) + strconv.Itoa(j)\n\t\t\t\t\tname2 := strconv.Itoa(i) + strconv.Itoa(j+1)\n\t\t\t\t\tgraph.AddEdge(nodes[name], nodes[name2], 1)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\t//fmt.Println(graph.Dijkstra(nodes[\"80\"], nodes[\"08\"]))\n\tdijkstra := graph.Dijkstra(nodes[\"80\"], nodes[\"08\"])\n\treturn dijkstra\n}", "func (g *Graph) Edges() int {\n\treturn g.edges\n}", "func (g *Graph) addVertices(vertices int) ([]Vertex, error) {\n\ti := 1\n\tvar arr []Vertex\n\tarr = make([]Vertex, vertices)\n\n\tfor i <= vertices {\n\t\tv, err := g.addVertex()\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tarr[i-1] = v\n\t\ti++\n\t}\n\n\treturn nil, nil\n}", "func (g *Graph) AddVertex(label int) {\n\t// v := vertex{label}\n\t// g.vertices = append(g.vertices, v)\n\tg.Vertices++\n}", "func (g *Graph) Connect(src int, dst ...int) {\n\tif src <= g.minVertex {\n\t\tg.minVertex = src\n\t}\n\tif src >= g.maxVertex {\n\t\tg.maxVertex = src\n\t}\n\tg.vertices[src] = true\n\tfor _, vertex := range dst {\n\t\tg.vertices[vertex] = true\n\t}\n\tg.adjList.Connect(src, dst...)\n}", "func NewDigraph(vertices int, arr []rune) *Digraph {\n\tvar digraph Digraph\n\tdigraph.nodes = vertices\n\tdigraph.edges = make([]*Bag, vertices)\n\tfor _, v := range arr {\n\t\tdigraph.edges[v] = NewBag() // arr[0] = bag{1,2,3}; arr[1] = bag{0,5};\n\t}\n\treturn &digraph\n}", "func main() {\n\tg, nodesMap := graphLineByLine()\n\n\tstart := nodesMap[\"shiny gold\"]\n\tcount := 0\n\tgraph.BFS(g, start, func(v, w int, _ int64) {\n\t\t//fmt.Println(v, \"to\", w)\n\t\tcount++\n\n\t})\n\n\tfmt.Println(count)\n}", "func (g *Graph) init(numVertex int) {\n if g.vertex == nil {\n g.vertex = make([]*NodeG, numVertex)\n }\n}", "func makegrid(i int, g *Graph) error {\n\n\tnodes := i * i //number of vertices\n\tedges := i * (2*i - 2) //number of edges\n\n\tif g.numvert < nodes {\n\t\t_, err := g.addVertices(nodes - g.numvert)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n\tif g.numvert > nodes {\n\t\tlog.Fatal(\"Too many vertices\")\n\t}\n\n\tfrom := 1\n\tto := 2\n\trun := 0\n\tfor edges > 0 {\n\t\ta := Vertex{vert: from}\n\t\tb := Vertex{vert: to}\n\t\tg.addEdge(a, b)\n\t\tedges--\n\t\tfrom++\n\t\tto++\n\t\tif from%i == 0 && run == 0 {\n\t\t\tfrom++\n\t\t\tto++\n\t\t}\n\t\tif to > nodes {\n\t\t\tfrom = 1\n\t\t\tto = 1 + i\n\t\t\trun = 1\n\t\t}\n\n\t}\n\n\treturn nil\n}", "func (g *Graph) adj(v int) []int {\n if g.vertex[v] == nil {\n return nil\n } else {\n adjNodes := make([]int, 0)\n n := g.vertex[v]\n for {\n adjNodes = append(adjNodes, (*n).val)\n n = n.next\n if n.next == nil {\n adjNodes = append(adjNodes, (*n).val)\n break\n }\n }\n return adjNodes\n }\n}", "func main() {\n\tfmt.Println(\"main\")\n\trows, err := readCSV()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Printf(\"# Rows = %d\\n\", len(rows))\n\tfmt.Printf(\"%+v\\n\", rows[0])\n\tedges := EdgeList{}\n\tfor _, r := range rows {\n\t\tedges = append(edges, Edge{\n\t\t\tSource: Vertex(r.FromID),\n\t\t\tDestination: Vertex(r.ToID),\n\t\t\tWeight: r.Time,\n\t\t})\n\t}\n\n\tfmt.Printf(\"# Vertices (Edg List)= %d\\n\", len(edges.Vertices()))\n\tfmt.Printf(\"# Edges (Edg List)= %d\\n\", len(edges.Edges()))\n\n\tal := convertEdgeListToAdjacencyList(edges)\n\tfmt.Printf(\"# Vertices (Adj List) = %d\\n\", len(al.Vertices()))\n\tfmt.Printf(\"# Edges (Adj List) = %d\\n\", len(al.Edges()))\n\n\t// 1 step path\n\t// (-122.4067318,37.6552092) => (-122.4066705,37.6554806)\n\tfmt.Println(\"\")\n\tp, err := Dijkstra(al, 32927063, 2262036212)\n\tif err != nil {\n\t\tfmt.Println(\"Dijkstra error: \", err.Error())\n\t}\n\tfmt.Println(\"Path Steps = \", len(p))\n\tfmt.Println(\"Path Weight = \", getPathWeight(p))\n\tfmt.Printf(\"Path = %+v\\n\", p)\n\tfmt.Println(\"\")\n\n\t// Unknown path\n\t// => (-122.3956858,37.6666107)\n\t// https://www.google.com/maps/place/37%C2%B039'59.8%22N+122%C2%B023'44.5%22W/@37.6897163,-122.4155747,11.42z/data=!4m5!3m4!1s0x0:0x0!8m2!3d37.6666107!4d-122.3956858\n\tfmt.Println(\"\")\n\n\tp, err = Dijkstra(al, 32927063, 1096003072)\n\tif err != nil {\n\t\tfmt.Println(\"Dijkstra error: \", err.Error())\n\t}\n\tfmt.Println(\"Path Steps = \", len(p))\n\tfmt.Println(\"Path Weight = \", getPathWeight(p))\n\tfmt.Printf(\"Path = %+v\\n\", p)\n\tfmt.Println(\"\")\n\n\t// South SF => Oakland\n\t// => (-122.2796971,37.8012714)\n\t// https://www.google.com/maps/place/37%C2%B039'59.8%22N+122%C2%B023'44.5%22W/@37.6897163,-122.4155747,11.42z/data=!4m5!3m4!1s0x0:0x0!8m2!3d37.6666107!4d-122.3956858\n\t// result...\n\t// Path Steps = 626\n\t// Path Weight = 1504.4395644354097\n\n\t// Route in Google Maps:\n\t// https://www.google.com/maps/dir/'37.6552092,-122.4067318'/'37.8012714,-122.2796971'/@37.7412534,-122.4084235,12z/data=!3m1!4b1!4m10!4m9!1m3!2m2!1d-122.4067318!2d37.6552092!1m3!2m2!1d-122.2796971!2d37.8012714!3e0\n\tfmt.Println(\"\")\n\n\tp, err = Dijkstra(al, 32927063, 30373973)\n\tif err != nil {\n\t\tfmt.Println(\"Dijkstra error: \", err.Error())\n\t}\n\tfmt.Println(\"Path Steps = \", len(p))\n\tfmt.Println(\"Path Weight = \", getPathWeight(p))\n\tfmt.Printf(\"Path = %+v\\n\", p)\n\tfmt.Println(\"\")\n\n}", "func (this Graph) getNeighboursOfVertex(vertex graph.VertexInterface) graph.VerticesInterface {\n if this.IsDirected() {\n return vertex.GetOutgoingNeighbours()\n }\n return vertex.GetNeighbours()\n}", "func (g *graph) showConnections() {\n\tfor _, v := range g.adjacentList {\n\t\tfmt.Println(\"vertex\", v.value, \"edges connect with vertices:\", v.edge.connections)\n\t}\n}", "func degree(G Graph, v int) int {\n\tdegree := 0\n\tfor _ = range G.Adj(v) {\n\t\tdegree++\n\t}\n\treturn degree\n}", "func Graph6Encode(g Graph) string {\n\tvar s []byte\n\tn := g.N()\n\tif n <= 1 {\n\t\treturn string(rune(n + 63))\n\t} else if n <= 62 {\n\t\ts = make([]byte, 1, 1+((n*(n-1))/2+5)/6)\n\t\ts[0] = byte(n + 63)\n\t} else if n <= 258047 {\n\t\ts = make([]byte, 4, 4+((n*(n-1))/2+5)/6)\n\t\ts[0] = 126\n\t\ts[1] = byte((n>>12)&63) + 63\n\t\ts[2] = byte((n>>6)&63) + 63\n\t\ts[3] = byte(n&63) + 63\n\t} else if n <= 68719476735 {\n\t\ts = make([]byte, 8, 8+((n*(n-1))/2+5)/6)\n\t\ts[0] = 126\n\t\ts[1] = 126\n\t\ts[2] = byte((n>>30)&63) + 63\n\t\ts[3] = byte((n>>24)&63) + 63\n\t\ts[4] = byte((n>>18)&63) + 63\n\t\ts[5] = byte((n>>12)&63) + 63\n\t\ts[6] = byte((n>>6)&63) + 63\n\t\ts[7] = byte(n&63) + 63\n\t} else {\n\t\tpanic(\"Graph too large\")\n\t}\n\n\tvar b byte\n\tbIndex := 0\n\tfor i := 1; i < n; i++ {\n\t\tfor j := 0; j < i; j++ {\n\t\t\tif g.IsEdge(i, j) {\n\t\t\t\tb += 1 << uint(5-bIndex)\n\t\t\t}\n\t\t\tbIndex++\n\t\t\tif bIndex == 6 {\n\t\t\t\ts = append(s, b+63)\n\t\t\t\tbIndex = 0\n\t\t\t\tb = 0\n\t\t\t}\n\t\t}\n\t}\n\n\tif bIndex != 0 {\n\t\ts = append(s, b+63)\n\t}\n\n\treturn string(s)\n}", "func (e Edge) GetVertex1() int {\n return e.v1_index\n}", "func g2() *Graph {\n\ttf := &testFactory{}\n\tn := [20]*Node{}\n\tfor i := 0; i < 20; i++ {\n\t\tm := fmt.Sprintf(\"g2n%d\", i)\n\t\tp, _ := tf.Make(job.NewIdWithRequestId(m, m, m, \"reqId1\"))\n\t\tn[i] = &Node{\n\t\t\tDatum: p,\n\t\t\tNext: map[string]*Node{},\n\t\t\tPrev: map[string]*Node{},\n\t\t}\n\t}\n\n\t// yeah good luck following this\n\tn[0].Next[\"g2n1\"] = n[1]\n\tn[1].Next[\"g2n2\"] = n[2]\n\tn[1].Next[\"g2n5\"] = n[5]\n\tn[1].Next[\"g2n6\"] = n[6]\n\tn[2].Next[\"g2n3\"] = n[3]\n\tn[2].Next[\"g2n4\"] = n[4]\n\tn[3].Next[\"g2n7\"] = n[7]\n\tn[4].Next[\"g2n8\"] = n[8]\n\tn[7].Next[\"g2n8\"] = n[8]\n\tn[8].Next[\"g2n13\"] = n[13]\n\tn[13].Next[\"g2n14\"] = n[14]\n\tn[5].Next[\"g2n9\"] = n[9]\n\tn[9].Next[\"g2n12\"] = n[12]\n\tn[12].Next[\"g2n14\"] = n[14]\n\tn[6].Next[\"g2n10\"] = n[10]\n\tn[10].Next[\"g2n11\"] = n[11]\n\tn[10].Next[\"g2n19\"] = n[19]\n\tn[11].Next[\"g2n12\"] = n[12]\n\tn[19].Next[\"g2n16\"] = n[16]\n\tn[16].Next[\"g2n15\"] = n[15]\n\tn[16].Next[\"g2n17\"] = n[17]\n\tn[15].Next[\"g2n18\"] = n[18]\n\tn[17].Next[\"g2n18\"] = n[18]\n\tn[18].Next[\"g2n14\"] = n[14]\n\tn[1].Prev[\"g2n0\"] = n[0]\n\tn[2].Prev[\"g2n1\"] = n[1]\n\tn[3].Prev[\"g2n2\"] = n[2]\n\tn[4].Prev[\"g2n2\"] = n[2]\n\tn[5].Prev[\"g2n1\"] = n[1]\n\tn[6].Prev[\"g2n1\"] = n[1]\n\tn[7].Prev[\"g2n3\"] = n[3]\n\tn[8].Prev[\"g2n4\"] = n[4]\n\tn[8].Prev[\"g2n7\"] = n[7]\n\tn[9].Prev[\"g2n5\"] = n[5]\n\tn[10].Prev[\"g2n6\"] = n[6]\n\tn[11].Prev[\"g2n10\"] = n[10]\n\tn[12].Prev[\"g2n9\"] = n[9]\n\tn[12].Prev[\"g2n11\"] = n[11]\n\tn[13].Prev[\"g2n8\"] = n[8]\n\tn[14].Prev[\"g2n12\"] = n[12]\n\tn[14].Prev[\"g2n13\"] = n[13]\n\tn[14].Prev[\"g2n18\"] = n[18]\n\tn[15].Prev[\"g2n16\"] = n[16]\n\tn[16].Prev[\"g2n19\"] = n[19]\n\tn[17].Prev[\"g2n16\"] = n[16]\n\tn[18].Prev[\"g2n15\"] = n[15]\n\tn[18].Prev[\"g2n17\"] = n[17]\n\tn[19].Prev[\"g2n10\"] = n[10]\n\n\treturn &Graph{\n\t\tName: \"g2\",\n\t\tFirst: n[0],\n\t\tLast: n[14],\n\t\tVertices: map[string]*Node{\n\t\t\t\"g2n0\": n[0],\n\t\t\t\"g2n1\": n[1],\n\t\t\t\"g2n2\": n[2],\n\t\t\t\"g2n3\": n[3],\n\t\t\t\"g2n4\": n[4],\n\t\t\t\"g2n5\": n[5],\n\t\t\t\"g2n6\": n[6],\n\t\t\t\"g2n7\": n[7],\n\t\t\t\"g2n8\": n[8],\n\t\t\t\"g2n9\": n[9],\n\t\t\t\"g2n10\": n[10],\n\t\t\t\"g2n11\": n[11],\n\t\t\t\"g2n12\": n[12],\n\t\t\t\"g2n13\": n[13],\n\t\t\t\"g2n14\": n[14],\n\t\t\t\"g2n15\": n[15],\n\t\t\t\"g2n16\": n[16],\n\t\t\t\"g2n17\": n[17],\n\t\t\t\"g2n18\": n[18],\n\t\t\t\"g2n19\": n[19],\n\t\t},\n\t\tEdges: map[string][]string{\n\t\t\t\"g2n0\": []string{\"g2n1\"},\n\t\t\t\"g2n1\": []string{\"g2n2\", \"g2n5\", \"g2n6\"},\n\t\t\t\"g2n2\": []string{\"g2n3\", \"g2n4\"},\n\t\t\t\"g2n3\": []string{\"g2n7\"},\n\t\t\t\"g2n4\": []string{\"g2n8\"},\n\t\t\t\"g2n5\": []string{\"g2n9\"},\n\t\t\t\"g2n6\": []string{\"g2n10\"},\n\t\t\t\"g2n7\": []string{\"g2n8\"},\n\t\t\t\"g2n8\": []string{\"g2n13\"},\n\t\t\t\"g2n9\": []string{\"g2n12\"},\n\t\t\t\"g2n10\": []string{\"g2n11\", \"g2n19\"},\n\t\t\t\"g2n11\": []string{\"g2n12\"},\n\t\t\t\"g2n12\": []string{\"g2n14\"},\n\t\t\t\"g2n13\": []string{\"g2n14\"},\n\t\t\t\"g2n15\": []string{\"g2n18\"},\n\t\t\t\"g2n16\": []string{\"g2n15\", \"g2n17\"},\n\t\t\t\"g2n17\": []string{\"g2n18\"},\n\t\t\t\"g2n18\": []string{\"g2n14\"},\n\t\t\t\"g2n19\": []string{\"g2n16\"},\n\t\t},\n\t}\n}", "func explore(u *graphs.Vertex) {\n\tgtime++\n\tu.TI = gtime\n\tu.C = 1\n\n\tfor i := 0; i < len(u.Adj); i++ {\n\t\tif u.Adj[i] == nil {\n\t\t\tcontinue\n\t\t}\n\t\tif u.Adj[i].C == 0 {\n\t\t\tu.Adj[i].P = u\n\t\t\tu.Adj[i].CC = cc\n\t\t\tu.C = 1\n\t\t\texplore(u.Adj[i])\n\t\t}\n\t}\n\n\tu.C = 2\n\tgtime++\n\tu.TF = gtime\n\n\tga = ga.LlPush(u)\n}", "func main() {\n\tg, nodesMap := graphLineByLine()\n\n\tstart := nodesMap[\"shiny gold\"]\n\tnodeWeight(g, start)\n\tfmt.Println(weights[start])\n\t//fmt.Println(g, nodesMap)\n}", "func newDirectedGraph(nodes []string, edges []edge) (*directedGraph, error) {\n\tg := &directedGraph{\n\t\tnodes: make([]string, 0, len(nodes)),\n\t\tincomingNodes: make(map[string]int),\n\t\toutgoingNodes: make(map[string]map[string]int),\n\t}\n\n\tfor _, node := range nodes {\n\t\tg.nodes = append(g.nodes, node)\n\t\tif _, ok := g.outgoingNodes[node]; ok {\n\t\t\treturn nil, errors.New(fmt.Sprintf(\"node %s already added to graph\", node))\n\t\t}\n\t\tg.outgoingNodes[node] = make(map[string]int)\n\t\tg.incomingNodes[node] = 0\n\t}\n\n\tfor _, edge := range edges {\n\t\tnode, ok := g.outgoingNodes[edge.from]\n\t\tif !ok {\n\t\t\treturn nil, errors.New(fmt.Sprintf(\"no node %s exists in graph\", edge.from))\n\t\t}\n\n\t\tnode[edge.to] = len(node) + 1\n\t\tg.incomingNodes[edge.to]++\n\t}\n\treturn g, nil\n}", "func (g *Graph[V]) Add(edge Edge[V]) {\n\tfrom, to := edge.From, edge.To\n\tif _, ok := g.vertices[from]; !ok {\n\t\tg.vertices[from] = make(neighbors[V])\n\t}\n\tif _, ok := g.vertices[to]; !ok {\n\t\tg.vertices[to] = make(neighbors[V])\n\t}\n\tif _, ok := g.inDegrees[from]; !ok {\n\t\tg.inDegrees[from] = 0\n\t}\n\tif _, ok := g.inDegrees[to]; !ok {\n\t\tg.inDegrees[to] = 0\n\t}\n\n\tg.vertices[from][to] = true\n\tg.inDegrees[to] += 1\n}", "func Marshal(g *graph.DirectedGraph) ([]byte, error) {\n\tvar b bytes.Buffer\n\n\t// Static graph configuration attributes\n\n\tb.WriteString(\"strict digraph bridge {\\n\")\n\tb.WriteByte('\\n')\n\tb.WriteString(\"graph [\\n\")\n\tb.WriteString(\" rankdir=LR\\n\")\n\tb.WriteString(\"]\\n\")\n\tb.WriteByte('\\n')\n\tb.WriteString(\"node [\\n\")\n\tb.WriteString(\" fontname=\\\"Helvetica\\\"\\n\")\n\tb.WriteString(\" shape=plain\\n\")\n\tb.WriteString(\"]\\n\")\n\tb.WriteByte('\\n')\n\n\t// Vertices\n\n\t// Index of vertices already converted to node, for faster access\n\t// during sorting of edges.\n\t// The keys used in the map are also the ones used in the graph.DirectedGraph\n\tvertIndex := make(map[interface{}]*node)\n\n\tsortedNodes := make(nodeList, 0, len(g.Vertices()))\n\tfor k, v := range g.Vertices() {\n\t\tn := graphVertexToNode(v)\n\t\tvertIndex[k] = n\n\n\t\tsortedNodes = append(sortedNodes, n)\n\t\tsort.Sort(sortedNodes)\n\t}\n\n\tfor _, n := range sortedNodes {\n\t\tdotN, err := n.marshalDOT()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"marshaling node to DOT: %w\", err)\n\t\t}\n\t\tb.Write(dotN)\n\t}\n\n\tb.WriteByte('\\n')\n\n\t// Edges\n\n\tsortedDownEdges := make(downEdgesList, 0, len(g.DownEdges()))\n\tfor tailVertKey, headVerts := range g.DownEdges() {\n\t\ttailNode := vertIndex[tailVertKey]\n\n\t\tsortedHeadNodes := make(nodeList, 0, len(headVerts))\n\t\tfor headVertKey := range headVerts {\n\t\t\tsortedHeadNodes = append(sortedHeadNodes, vertIndex[headVertKey])\n\t\t}\n\t\tsort.Sort(sortedHeadNodes)\n\n\t\tsortedDownEdges = append(sortedDownEdges, downEdges{\n\t\t\ttail: tailNode,\n\t\t\theads: sortedHeadNodes,\n\t\t})\n\t}\n\tsort.Sort(sortedDownEdges)\n\n\tfor _, e := range sortedDownEdges {\n\t\tb.WriteString(e.tail.id() + \" -> {\")\n\t\tfor _, h := range e.heads {\n\t\t\tb.WriteByte(' ')\n\t\t\tb.WriteString(h.id())\n\t\t}\n\t\tb.WriteString(\" }\\n\")\n\t}\n\n\tb.WriteByte('\\n')\n\n\tb.WriteString(\"}\\n\")\n\n\treturn b.Bytes(), nil\n}", "func GetGraph(edges []Edge, undirected bool) (ug *Graph) {\n\tvar weight float64\n\n\tug = &Graph{\n\t\tRawEdges: edges,\n\t\tVertices: make(map[uint64]bool),\n\t\tVertexEdges: make(map[uint64]map[uint64]float64),\n\t\tUndirected: undirected,\n\t\tNegEdges: false,\n\t}\n\n\tfor _, edge := range edges {\n\t\tweight = edge.Weight\n\t\tif weight < 0 {\n\t\t\tug.NegEdges = true\n\t\t}\n\t\tug.Vertices[edge.From] = true\n\t\tug.Vertices[edge.To] = true\n\t\tif _, ok := ug.VertexEdges[edge.From]; ok {\n\t\t\tug.VertexEdges[edge.From][edge.To] = weight\n\t\t} else {\n\t\t\tug.VertexEdges[edge.From] = map[uint64]float64{edge.To: weight}\n\t\t}\n\t\tif undirected {\n\t\t\tif _, ok := ug.VertexEdges[edge.To]; ok {\n\t\t\t\tug.VertexEdges[edge.To][edge.From] = weight\n\t\t\t} else {\n\t\t\t\tug.VertexEdges[edge.To] = map[uint64]float64{edge.From: weight}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn\n}", "func (this Graph) getEdgesOfVertex(vertex graph.VertexInterface) graph.EdgesInterface {\n if this.IsDirected() {\n return vertex.GetOutgoingEdges()\n }\n return vertex.GetEdges()\n}", "func main18() {\n\tgph := new(Graph)\n\tgph.Init(5)\n\tgph.AddDirectedEdge(0, 1, 1)\n\tgph.AddDirectedEdge(1, 2, 1)\n\tgph.AddDirectedEdge(2, 0, 1)\n\tgph.AddDirectedEdge(0, 4, 1)\n\tgph.AddDirectedEdge(4, 3, 1)\n\tgph.AddDirectedEdge(3, 0, 1)\n\tfmt.Println(gph.isEulerianCycle())\n}", "func (g Graph) SetEdge(v1 int, v2 int, value float64){\n count := 0;\n for count < len(*g.full) {\n v1temp := (*g.full)[count].v1_index\n v2temp := (*g.full)[count].v2_index\n if (v1 == v1temp && v2 == v2temp){\n //fmt.Printf(\"%d ---- %d\\n\", v1temp, v2temp)\n (*g.full)[count].weight = value\n }\n\n if (v2 == v1temp && v1 == v2temp){\n //fmt.Printf(\"%d ---- %d\\n\", v2temp, v1temp)\n (*g.full)[count].weight = value\n }\n count = count + 1\n }\n}", "func expandgraph(g *Graph) error {\n\n\tnewedges := make(map[Edge]bool)\n\n\tfor e := range g.edges {\n\t\tfrom := e.from\n\t\tto := e.to\n\n\t\tv1, err := g.addVertex()\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tv2, err := g.addVertex()\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\te1 := Edge{\n\t\t\tfrom: from,\n\t\t\tto: v1,\n\t\t}\n\t\te2 := Edge{\n\t\t\tfrom: v1,\n\t\t\tto: v2,\n\t\t}\n\t\te3 := Edge{\n\t\t\tfrom: v2,\n\t\t\tto: to,\n\t\t}\n\n\t\tnewedges[e1] = true\n\t\tnewedges[e2] = true\n\t\tnewedges[e3] = true\n\n\t\terr = g.removeEdge(e)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t}\n\n\tg.edges = newedges\n\n\treturn nil\n}", "func (m Matrix) Graph(reuse []int) [][]int {\n\tn := m.n\n\tret := make([][]int, n)\n\tslice := m.set.Slice(reuse)\n\tvar start, index int\n\tfor i, val := range slice {\n\t\te := val / n\n\t\tslice[i] = val % n\n\t\tif e > index {\n\t\t\tret[index] = slice[start:i]\n\t\t\tstart = i\n\t\t\tindex = e\n\t\t}\n\t}\n\tret[index] = slice[start:]\n\treturn ret\n}", "func (g *Graph) addVertex() (Vertex, error) {\n\tv := Vertex{\n\t\tvert: g.numvert + 1,\n\t}\n\tg.vertices[v] = true\n\tg.numvert++\n\treturn v, nil\n}", "func (g *Graph) Print() {\n for _, v := range g.vertices {\n fmt.Printf(\"\\nVertex %v : \", v.key)\n for _,v := range v.adjacent {\n fmt.Printf(\" %v \", v.key)\n }\n }\n fmt.Println()\n}", "func (DrugAllergy) Edges() []ent.Edge {\n return []ent.Edge{\n edge. From(\"doctor\",Doctor.Type).Ref(\"Doctor_DrugAllergy\").Unique(),\n edge. From(\"patient\",Patient.Type).Ref(\"Patient_DrugAllergy\").Unique(),\n edge. From(\"medicine\",Medicine.Type).Ref(\"Medicine_DrugAllergy\").Unique(),\n edge. From(\"manner\",Manner.Type).Ref(\"Manner_DrugAllergy\").Unique(),\n }\n }", "func (g *DirectedGraph) addEdge(u, v int) {\n\tif l := len(g.List); u >= l || v >= l {\n\t\tpanic(fmt.Sprintf(\"Edge (%v, %v) does not fit in a graph with list of length %v\", u, v, l))\n\t}\n\tg.List[u] = append(g.List[u], v)\n}", "func (w *WeightGraph) V() int {\n\treturn len(w.adj)\n}", "func (g *EdgeWeightedDigraph) V() int {\n\treturn g.v\n}", "func (g *graph) addVertex(value int) bool {\n\tnewVertex := &vertex{\n\t\tvalue: value,\n\t\tedge: &edge{\n\t\t\tconnections: [][]int{},\n\t\t},\n\t}\n\n\tif _, ok := g.adjacentList[value]; !ok {\n\t\tg.adjacentList[value] = newVertex\n\t\tg.graphSize++\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (g *DenseGraph) RemoveVertex(v int) {\n\tif v >= g.NumberOfVertices {\n\t\tpanic(\"No such vertex\")\n\t}\n\n\t//Update the degree sequences and number of edges.\n\tg.NumberOfEdges -= g.DegreeSequence[v]\n\ttmp := (v * (v - 1)) / 2\n\tfor i := 0; i < v; i++ {\n\t\tindex := tmp + i\n\t\tif g.Edges[index] > 0 {\n\t\t\tg.DegreeSequence[i]--\n\t\t}\n\t}\n\n\tfor i := v + 1; i < g.N(); i++ {\n\t\tindex := (i*(i-1))/2 + v\n\t\tif g.Edges[index] > 0 {\n\t\t\tg.DegreeSequence[i]--\n\t\t}\n\t}\n\tcopy(g.DegreeSequence[v:], g.DegreeSequence[v+1:])\n\tg.DegreeSequence = g.DegreeSequence[:len(g.DegreeSequence)-1]\n\n\t//Update the backing array.\n\toldIndex := (v*(v+1))/2 - 1\n\tnewIndex := (v * (v - 1)) / 2\n\n\tfor j := v + 1; j < g.NumberOfVertices; j++ {\n\t\ttmp := (j*(j-1))/2 + v\n\t\tnewIndex += copy(g.Edges[newIndex:], g.Edges[oldIndex+1:tmp])\n\t\toldIndex = tmp\n\t}\n\tcopy(g.Edges[newIndex:], g.Edges[oldIndex+1:])\n\tg.NumberOfVertices--\n\tg.Edges = g.Edges[:(g.NumberOfVertices*(g.NumberOfVertices-1))/2]\n}", "func testgraphs() {\n\tg, err := buildGraph(false)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\terr = makegrid(2, &g)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\terr = expandgraph(&g)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\terr = g.printGraph()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "func (this *Graph) Cluster() []*Graph {\n /*\n\n Algorithm synopsis:\n\n Loop over the Starters, for each unvisited Starter,\n define an empty sub-graph and, put it into the toVisit set\n\n Loop over the toVisit node set, for each node in it, \n skip if already visited\n add the node to the sub-graph\n remove the nodes into the hasVisited node set\n put all its incoming and outgoing edge into the the toWalk set while\n stop at the hub nodes (edges from the hub nodes are not put in the toWalk set)\n then iterate through the toWalk edge set \n skip if already walked\n add the edge to the sub-graph\n put its connected nodes into the toVisit node set\n remove the edge from the toWalk edge set into the hasWalked edge set\n\n */\n \n // sub-graph index\n sgNdx := -1\n sgRet := make([]*Graph,0)\n\n toVisit := make(nodeSet); hasVisited := make(nodeSet)\n toWalk := make(edgeSet); hasWalked := make(edgeSet)\n\n for starter := range *this.Starters() {\n // define an empty sub-graph and, put it into the toVisit set\n sgRet = append(sgRet, NewGraph(gographviz.NewGraph())); sgNdx++; \n sgRet[sgNdx].Attrs = this.Attrs\n sgRet[sgNdx].SetDir(this.Directed)\n graphName := fmt.Sprintf(\"%s_%03d\\n\", this.Name, sgNdx);\n sgRet[sgNdx].SetName(graphName)\n toVisit.Add(starter)\n hubVisited := make(nodeSet)\n for len(toVisit) > 0 { for nodep := range toVisit {\n toVisit.Del(nodep); //print(\"O \")\n if this.IsHub(nodep) && hasVisited.Has(nodep) && !hubVisited.Has(nodep) { \n // add the already-visited but not-in-this-graph hub node to the sub-graph\n sgRet[sgNdx].AddNode(nodep)\n hubVisited.Add(nodep)\n continue \n }\n if hasVisited.Has(nodep) { continue }\n //spew.Dump(\"toVisit\", nodep)\n // add the node to the sub-graph\n sgRet[sgNdx].AddNode(nodep)\n // remove the nodes into the hasVisited node set\n hasVisited.Add(nodep)\n // stop at the hub nodes\n if this.IsHub(nodep) { continue }\n // put all its incoming and outgoing edge into the the toWalk set\n noden := nodep.Name\n for _, ep := range this.EdgesToParents(noden) {\n toWalk.Add(ep)\n }\n for _, ep := range this.EdgesToChildren(noden) {\n toWalk.Add(ep)\n }\n for edgep := range toWalk {\n toWalk.Del(edgep); //print(\"- \")\n if hasWalked.Has(edgep) { continue }\n //spew.Dump(\"toWalk\", edgep)\n sgRet[sgNdx].Edges.Add(edgep)\n // put its connected nodes into the toVisit node set\n toVisit.Add(this.Lookup(edgep.Src))\n toVisit.Add(this.Lookup(edgep.Dst))\n // remove the edge into the hasWalked edge set\n hasWalked.Add(edgep)\n }\n }}\n //spew.Dump(sgNdx)\n }\n return sgRet\n}", "func (g Graph) String() string {\n\tb := strings.Builder{}\n\tfor vertex, edges := range g {\n\t\t// vertex;edge\n\t\tb.WriteString(fmt.Sprintf(\"%[1]s%[3]s%[2]s\\n\", vertex, edges, majorSep))\n\t}\n\treturn b.String()\n}", "func (c *Calculator) AddVertex(id string) {\n\tc.g.AddVertex(id, nil)\n}", "func (g Graph) initFull(){\n numVertex := len(*g.vertexes)\n count := 0\n i := 0\n for i < numVertex{\n j := i+1\n for j < numVertex{\n if g.ExisteEnEdges(i,j){\n (*g.full)[count] = Edge{i,j,1}\n }else{\n (*g.full)[count] = Edge{i,j,0}\n }\n count = count +1\n j = j +1\n }\n i = i +1\n }\n}", "func main15() {\n\tgph := NewGraph(5)\n\tgph.AddDirectedEdge(0, 1, 1)\n\tgph.AddDirectedEdge(1, 2, 1)\n\tgph.AddDirectedEdge(2, 0, 1)\n\tgph.AddDirectedEdge(0, 4, 1)\n\tgph.AddDirectedEdge(4, 3, 1)\n\tgph.AddDirectedEdge(3, 0, 1)\n\tfmt.Println(gph.IsEulerianCycle())\n}", "func sumOfDistancesInTree(N int, edges [][]int) []int {\n \n}", "func NewGraph(base Base) {\n\n}", "func (ma *GraphDB) VertexCollection(session *mgo.Session, graph string) *mgo.Collection {\n\treturn session.DB(ma.database).C(fmt.Sprintf(\"%s_vertices\", graph))\n}", "func (g *Graph) AddVertex(x Node) {\n\tg.neighbors[x] = []Node{}\n\tg.costs[x] = map[Node]float32{}\n}", "func (l *Lista) GraphNodes(i int) string{\n\tAux := l.Inicio\n\tnodos := \"\"\n\tj := 0\n\tfor Aux != nil{\n\t\tnodos = nodos + \"a\" + strconv.Itoa(i) + \"Node\" + strconv.Itoa(j) + \" [label=\\\"\"+ Aux.Dato.Nombre +\"\\\"]\\n\"\n\t\tj++\n\t\tAux = Aux.Siguiente\n\t}\n\tk := 0\n\tnodos = nodos + \"struct:f\" + strconv.Itoa(i)\n\tAux = l.Inicio\n\tfor Aux != nil{\n\t\tnodos = nodos + \" -> a\" + strconv.Itoa(i) + \"Node\" + strconv.Itoa(k)\n\t\tk++\n\t\tAux = Aux.Siguiente\n\t}\n\tnodos = nodos + \";\\n\"\n\treturn nodos\n}", "func InitGraph(numVerticies int) *Graph {\n\tg := &Graph{\n\t\tverticies: numVerticies,\n\t\tedges: make([]*EdgeHelper, numVerticies),\n\t\tgInfo: make(map[int]interface{}),\n\t}\n\n\tfor i := 0; i < numVerticies; i++ {\n\t\tg.edges[i] = InitEdgeHelper()\n\t}\n\treturn g\n}", "func (g *Graph) Vertices() int {\n\treturn g.vertices\n}", "func (graph *DirGraph) createStrongConnections() {\n\tvar l int\n\tl = 0\n\tvar nodes []*GraphNode\n\tnodes = graph.setFinishingOrder()\n\tgraph.reset()\n\tvar i int\n\tfor i = len(nodes) - 1; i >= 0; i-- {\n\t\tvar node *GraphNode\n\t\tnode = nodes[i]\n\t\tif node.visited == false {\n\t\t\tvar m int\n\t\t\tm = l\n\t\t\tl++\n\t\t\tMarkStrongConnections(node, graph, m)\n\t\t}\n\t}\n}", "func (g *graph) String() string{\n\ts := \"Graph: \\n\"\n\tfor i,list := range g.nodes {\n\t\ts += \"Node \" + strconv.Itoa(i) + \":\\t\"\n\t\tfor n := range list.Iter() {\n\t\t\ts += strconv.Itoa(n.(int)) + \"\\t\"\n\t\t}\n\t\ts += \"\\n\"\n\t}\n\treturn s\n}", "func makehex(radius int, g *Graph) error {\n\tnodes := radius * radius * 6 //number of vertices\n\n\tif g.numvert < nodes {\n\t\t_, err := g.addVertices(nodes - g.numvert)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n\tif g.numvert > nodes {\n\t\tlog.Fatal(\"Too many vertices\")\n\t}\n\n\ti := 1\n\t//vertices, err := g.getVertices()\n\t//if err != nil {\n\t//\tlog.Fatal(err)\n\t//}\n\n\tfor i <= radius {\n\t\t//draw a circle for each radius\n\t\tcurrad := i * i * 6 //circumference of the current circle\n\t\tstartcirc := ((i - 1) * (i - 1) * 6) + 1 //start value of the current circle\n\t\tj := startcirc\n\n\t\tfor j < currad {\n\t\t\ta := Vertex{vert: j}\n\t\t\tb := Vertex{vert: j + 1}\n\t\t\tg.addEdge(a, b)\n\t\t\tfmt.Println(j)\n\t\t\tj++\n\t\t}\n\t\ta := Vertex{vert: currad}\n\t\tb := Vertex{vert: startcirc}\n\t\tg.addEdge(a, b)\n\n\t\t//Connect the current circle with the one before\n\t\tif i > 1 {\n\t\t\tinnerpos := (i-2)*(i-2)*6 + 1 //Start value of the inner circle\n\t\t\tinnercirc := (i - 1) * (i - 1) * 6 //circumference of the inner circle\n\t\t\touterpos := ((i - 1) * (i - 1) * 6) + 1 //start value of the outer circle\n\n\t\t\tfor innerpos <= innercirc {\n\t\t\t\t//if innerpos%2 == 0 {\n\n\t\t\t\tv := Vertex{vert: innerpos}\n\t\t\t\tdeg, err := g.degree(v)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Fatal(err)\n\t\t\t\t}\n\n\t\t\t\t/*In a hexagonal grid, all inner vertices have degree 3,\n\t\t\t\tso if a vertex of the inner circle does not have this\n\t\t\t\tdegree, it lacks connection to the outer circle*/\n\t\t\t\tif deg != 3 {\n\t\t\t\t\ta := Vertex{vert: innerpos}\n\t\t\t\t\tb := Vertex{vert: 4 + 3*innerpos}\n\t\t\t\t\t/*Funktioniert so bisher nur bei Kreisen mit Radius 1 und 2*/\n\t\t\t\t\tg.addEdge(a, b)\n\t\t\t\t\touterpos += 3\n\t\t\t\t}\n\t\t\t\tinnerpos++\n\t\t\t}\n\t\t}\n\n\t\ti++\n\t}\n\n\treturn nil\n}", "func ALGraphInit(size int) *ALGraph {\n\tif size < 1 {\n\t\treturn nil\n\t}\n\tvar a ALGraph\n\n\ta.adjacencyList = make([]set.Set, size)\n\tfor i := 0; i < size; i++ {\n\t\ta.adjacencyList[i] = set.Init()\n\t}\n\treturn &a\n}", "func (dg DenseGraph) VertexNum() int {\n\treturn dg.vertexNum\n}", "func addEdge(nodes []*node, from, to int) {\n\tnodes[from].neighbors = append(nodes[from].neighbors, nodes[to])\n\tnodes[to].neighbors = append(nodes[to].neighbors, nodes[from])\n}", "func CollectVerticesAdjacentTo(v Vertex, g AdjacencyEnumerator) (vertices []Vertex) {\n\tif c, ok := g.(DegreeChecker); ok {\n\t\t// If possible, size the slice based on the number of adjacent vertices the graph reports\n\t\tdeg, _ := c.DegreeOf(v)\n\t\tvertices = make([]Vertex, 0, deg)\n\t} else {\n\t\t// Otherwise just pick something...reasonable?\n\t\tvertices = make([]Vertex, 0, 8)\n\t}\n\n\tg.AdjacentTo(v, func(v Vertex) (terminate bool) {\n\t\tvertices = append(vertices, v)\n\t\treturn\n\t})\n\n\treturn vertices\n}", "func (g *Graph) addEdge(s, d int) bool {\n if s >=0 && s< len(g.vertex) && d >= 0 && d < len(g.vertex) {\n if g.vertex[s] == nil {\n g.vertex[s] = &NodeG{nil, d}\n } else {\n for c := g.vertex[s] ; c != nil ; c = (*c).next {\n if (*c).next == nil {\n (*c).next = &NodeG{nil, d}\n break\n }\n }\n }\n\n return true\n } else {\n return false\n }\n}", "func (graphList *GraphList) AddEdgeInGraphList(i int, j int, weight int) {\n\tcheckGraphList(graphList)\n\tif i < 0 || i >= len(graphList.Veriexs) || j >= len(graphList.Veriexs) || j < 0 {\n\t\tpanic(\"顶点索引不合法\")\n\t}\n\tedge := &EdgeNode{\n\t\tIndex: j,\n\t\tWeight: weight,\n\t\tNext: nil}\n\tfor i1, v := range graphList.Veriexs {\n\t\tif i1 == i {\n\t\t\tif v.FirstEdge != nil {\n\t\t\t\tvar node = v.FirstEdge\n\t\t\t\tfor node.Next != nil {\n\t\t\t\t\tnode = node.Next\n\t\t\t\t}\n\t\t\t\tnode.Next = edge\n\t\t\t} else {\n\t\t\t\tv.FirstEdge = edge\n\t\t\t}\n\t\t}\n\t}\n}", "func (g *graph) AddEdge(v, w int) {\n\tg.adj[v] = append(g.adj[v], w)\n\tg.adj[w] = append(g.adj[w], v)\n\tg.e++\n}", "func (g *graph) addEdge(v1, v2 *vertex, weight *int) error {\n\n\t_, ok1 := g.adjacentList[v1.value]\n\t_, ok2 := g.adjacentList[v2.value]\n\n\tif !ok1 || !ok2 {\n\t\treturn errors.New(\"invalid vertex provided, does not exist in the graph\")\n\t}\n\n\tg.appendEdge(v1.value, v2.value, weight)\n\tg.appendEdge(v2.value, v1.value, weight)\n\n\treturn nil\n}", "func (g *Graph) Iterate() [][]int{\n\titems := make([][]int, g.V)\n\tfor i := 0; i < g.V; i++ {\n\t\titems[i] = make([]int, g.adj[i].Size())\t\t\n\t}\n\n\tfor i := 0; i < g.V; i++ {\n\t\t\titems[i] = g.adj[i].Iterate()\n\t}\n\treturn items\n}", "func Kruskal(edges []WeightedEdge, numVertices int) []WeightedEdge {\n\tsort.Slice(edges, func(i, j int) bool {\n\t\treturn edges[i].Weight < edges[j].Weight\n\t})\n\n\tmst := []WeightedEdge{} // output\n\n\t// For Kruskal's algorithm we need to keep track of which vertices are\n\t// connected. We do this by having a map where each vertice can point to\n\t// another vertice (their \"parent\") as away to say to say they are\n\t// connected to it.\n\tparents := make([]int, numVertices)\n\tfor i, _ := range parents {\n\t\tparents[i] = i\n\t}\n\n\tfor _, edge := range edges {\n\t\tparentU := findParent(parents, edge.U)\n\t\tparentV := findParent(parents, edge.V)\n\n\t\t// If the two vertices have the same parent, then they are connected\n\t\t// already, so we do not want to add them to our mst.\n\t\tif parentU == parentV {\n\t\t\tcontinue\n\t\t}\n\n\t\tmst = append(mst, edge) // Edge is good\n\t\tparents[parentU] = parentV // Connect the vertices\n\t}\n\n\treturn mst\n}", "func (g *Graph) AddEdge(v int, w int) {\n\tg.E++\n\tg.adj[v].Add(w)\n\tg.adj[w].Add(v)\n}", "func newGraphFromAdjacencyList(adjacencyList []diagnosisv1.Node) (*simple.DirectedGraph, error) {\n\tgraph := simple.NewDirectedGraph()\n\tfor id, node := range adjacencyList {\n\t\tif graph.Node(int64(id)) == nil {\n\t\t\tgraph.AddNode(simple.Node(id))\n\t\t}\n\t\tfor _, to := range node.To {\n\t\t\tgraph.SetEdge(graph.NewEdge(simple.Node(id), simple.Node(to)))\n\t\t}\n\t}\n\n\treturn graph, nil\n}", "func createGraph1() *NodeG {\n n1 := NodeG{2, nil}\n n2 := NodeG{4, nil}\n n1.neighbors = append(n1.neighbors, &n2)\n n1.neighbors = append(n1.neighbors, &n1)\n n2.neighbors = append(n2.neighbors, &n1)\n\n // fmt.Println(\">>>>>>1\")\n // fmt.Println(n1)\n // fmt.Println(n2)\n // fmt.Println(\">>>>>>2\")\n\n return &n1\n}", "func (g Graph) FullWeightOfVertex(v int) float64 {\n count := 0;\n weight := 0.0\n for count < len(*g.full) {\n v1temp := (*g.full)[count].v1_index\n v2temp := (*g.full)[count].v2_index\n if (v == v1temp || v == v2temp){\n weight = weight + (*g.full)[count].weight\n }\n \n count = count + 1\n }\n return weight\n}", "func (g *UndirectedGraph) AddEdge(a, b, w int) {\n\tg.mtx.Lock()\n\tdefer g.mtx.Unlock()\n\tif a >= len(g.vertices) || b >= len(g.vertices) || a < 0 || b < 0 {\n\t\treturn\n\t}\n\tif g.vertices[a] == nil || g.vertices[b] == nil {\n\t\treturn\n\t}\n\tif a == b {\n\t\treturn\n\t}\n\ta2bexists, b2aexists := false, false\n\tvar e *edge\n\te = g.vertices[a].edges\n\tfor e != nil {\n\t\tif e.to == b {\n\t\t\te.weight = w\n\t\t\ta2bexists = true\n\t\t\tbreak\n\t\t}\n\t\te = e.next\n\t}\n\tif !a2bexists {\n\t\ta2b := &edge{\n\t\t\tto: b,\n\t\t\tweight: w,\n\t\t\tnext: g.vertices[a].edges,\n\t\t}\n\t\tg.vertices[a].edges = a2b\n\t}\n\te = g.vertices[b].edges\n\tfor e != nil {\n\t\tif e.to == a {\n\t\t\te.weight = w\n\t\t\tb2aexists = true\n\t\t\tbreak\n\t\t}\n\t\te = e.next\n\t}\n\tif !b2aexists {\n\t\tb2a := &edge{\n\t\t\tto: a,\n\t\t\tweight: w,\n\t\t\tnext: g.vertices[b].edges,\n\t\t}\n\t\tg.vertices[b].edges = b2a\n\t}\n}", "func (s *LikesConnection) Nodes() []Likes {\n var nodes []Likes\n for _, edge := range s.Edges {\n nodes = append(nodes, edge.Node)\n }\n return nodes\n }", "func (g *Graph) Edges() []Edge {\n\tne := g.Size()\n\tfmt.Println(\"ne = \", ne)\n\tedgelist := make([]Edge, ne)\n\tedgesAdded := 0\n\tfor c := range g.mx.Colptr[:len(g.mx.Colptr)-1] {\n\t\tuc := uint32(c)\n\t\trrange := g.mx.GetRange(uc)\n\t\tfor _, r := range rrange {\n\t\t\tif r <= uc {\n\t\t\t\tfmt.Printf(\"Adding edge %d, %d\\n\", r, uc)\n\t\t\t\tedgelist[edgesAdded] = Edge{r, uc}\n\t\t\t\tedgesAdded++\n\t\t\t}\n\t\t}\n\t}\n\treturn edgelist\n}", "func (g *EWgraph) V() int {\n\treturn g.v\n}" ]
[ "0.6561579", "0.6405082", "0.6109975", "0.60692537", "0.5931995", "0.5926246", "0.5880468", "0.58749384", "0.5866759", "0.5829543", "0.58137655", "0.5795716", "0.5783142", "0.57733124", "0.57608294", "0.5705206", "0.5688596", "0.56556255", "0.56484413", "0.5638089", "0.56376994", "0.5631963", "0.55833733", "0.5582998", "0.5575126", "0.5565991", "0.55648166", "0.5553481", "0.55412954", "0.5530673", "0.55222654", "0.5504577", "0.54992014", "0.546582", "0.5423619", "0.5421852", "0.5393349", "0.5393287", "0.53882116", "0.5379501", "0.5375454", "0.53360367", "0.53283185", "0.53277713", "0.53265077", "0.53232634", "0.5322484", "0.53115255", "0.5309766", "0.5308521", "0.5308501", "0.53001726", "0.52731204", "0.5244768", "0.5241487", "0.5239201", "0.5237484", "0.5231338", "0.5226983", "0.5216113", "0.52104825", "0.5196778", "0.51904047", "0.5189654", "0.5189382", "0.518545", "0.51846516", "0.5181903", "0.5174407", "0.5167322", "0.51584035", "0.5150894", "0.5150444", "0.5147161", "0.51335144", "0.51281726", "0.5123919", "0.5114408", "0.5113983", "0.5113332", "0.5110695", "0.5106174", "0.50990283", "0.5089683", "0.5079083", "0.50746965", "0.50486535", "0.50467163", "0.5044542", "0.50410485", "0.5035752", "0.50354964", "0.50223434", "0.502156", "0.5021376", "0.5021284", "0.5019278", "0.5014419", "0.50074023", "0.50023043" ]
0.5065191
86
/ Depth First Search (DFS) The DFS algorithm is a recursive algorithm that uses the idea of backtracking. It involves exhaustive searches of all the nodes by going ahead, if possible, else by backtracking. Here, the word backtrack means that when you are moving forward and there are no more nodes along the current path, you move backwards on the same path to find nodes to traverse. All the nodes will be visited on the current path till all the unvisited nodes have been traversed after which the next path will be selected. This recursive nature of DFS can be implemented using stacks. The basic idea is as follows: Pick a starting node and push all its adjacent nodes into a stack. Pop a node from stack to select the next node to visit and push all its adjacent nodes into a stack. Repeat this process until the stack is empty. However, ensure that the nodes that are visited are marked. This will prevent you from visiting the same node more than once. If you do not mark the nodes that are visited and you visit the same node more than once, you may end up in an infinite loop. DFSiterative (G, s): //Where G is graph and s is source vertex let S be stack S.push( s ) //Inserting s in stack mark s as visited. while ( S is not empty): Pop a vertex from stack to visit next v = S.top( ) S.pop( ) Push all the neighbours of v in stack that are not visited for all neighbours w of v in Graph G: if w is not visited : S.push( w ) mark w as visited DFSrecursive(G, s): mark s as visited for all neighbours w of s in Graph G: if w is not visited: DFSrecursive(G, w)
func (g *Graph) RecursiveDFS(i int) { log.Printf("RecursiveDFS - visit %v", g.Lists[i].Node.V) g.Lists[i].Node.visited = true for _, adj := range g.Lists[i].Adjacent { if !g.Lists[adj].Node.visited { g.RecursiveDFS(adj) } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (G *Graph) DFS(cb func(n *Node)) {\r\n\t// initialize a map to keep track of the visited nodes\r\n\tvisited := make(map[*Node]bool)\r\n\t// initialize a ref variable to the root of the graph\r\n\tnode := G.nodes[0]\r\n\t// traverse graph recursively\r\n\tG.TraverseDFS(node, visited, cb)\r\n}", "func (g *Graph) DFS(s int, t int) {\n\tprev := make([]int, g.v)\n\tfor i := range prev {\n\t\tprev[i] = -1\n\t}\n\tvisited := make([]bool, g.v)\n\tvisited[s] = true\n\tisFound := false\n\tg.recurse(s, t, prev, visited, isFound)\n\tprintPrev(prev, s, t)\n}", "func (search DFS) DepthFirstSearch(g *graphs.Graph, s int) {\n\tsearch.marked = make([]bool, g.NoOfV())\n\tsearch.dfs(g, s)\n}", "func DFS(vertices []*adj.Node) {\n\n\tvisited := make(map[*adj.Node]bool)\n\n\tfor _, v := range vertices {\n\t\tif _, ok := visited[v]; !ok {\n\t\t\tDFSVisit(v, visited)\n\t\t}\n\t}\n}", "func dfs(g *Graph, current int, visited set, visitFunction func(int)) {\n if _, seen := visited[current]; seen {\n return\n }\n\n visited[current] = true\n visitFunction(current)\n\n for neighbour := range g.adjList[current] {\n dfs(g, neighbour, visited, visitFunction)\n }\n}", "func (gph *Graph) DFSStack(source int, target int) bool {\n\tcount := gph.count\n\tvisited := make([]bool, count)\n\tvar curr int\n\tstk := stack.New()\n\tpath := []int{}\n\tvisited[source] = true\n\tstk.Push(source)\n\n\tfor stk.Len() != 0 {\n\t\tcurr = stk.Pop().(int)\n\t\tpath = append(path,curr)\n\t\thead := gph.Edges[curr]\n\t\tfor head != nil {\n\t\t\tif visited[head.destination] == false {\n\t\t\t\tvisited[head.destination] = true\n\t\t\t\tstk.Push(head.destination)\n\t\t\t}\n\t\t\thead = head.next\n\t\t}\n\t}\n\tfmt.Println(\"DFS Path is : \", path)\n return visited[target]\n}", "func testDFS() {\n\tg := NewGraph(4)\n\tg.AddEdge(0, 1)\n\tg.AddEdge(0, 2)\n\tg.AddEdge(1, 2)\n\tg.AddEdge(2, 0)\n\tg.AddEdge(2, 3)\n\tg.AddEdge(3, 3)\n\tlog.Printf(\"Graph %v\", g.String())\n\tg.RecursiveDFS(0)\n}", "func (gph *Graph) DFSStack(source int, target int) bool {\n\tcount := gph.count\n\tvisited := make([]bool, count)\n\tvar curr int\n\tstk := new(Stack)\n\tpath := []int{}\n\tvisited[source] = true\n\tstk.Push(source)\n\n\tfor stk.Len() != 0 {\n\t\tcurr = stk.Pop().(int)\n\t\tpath = append(path, curr)\n\t\thead := gph.Edges[curr]\n\t\tfor head != nil {\n\t\t\tif !visited[head.dest] {\n\t\t\t\tvisited[head.dest] = true\n\t\t\t\tstk.Push(head.dest)\n\t\t\t}\n\t\t\thead = head.next\n\t\t}\n\t}\n\tfmt.Println(\"DFS Path is: \", path)\n\treturn visited[target]\n}", "func DFS(path string) (node *Node) {\n\trootFile, err := os.Stat(path)\n\tif err != nil {\n\t\tlog.Println(\"Path : \", path, \" doesn't exist. \")\n\t\tos.Exit(0)\n\t}\n\trootfile := ToFile(rootFile, path)\n\tstack := []*Node{rootfile}\n\tfor len(stack) > 0 {\n\t\tfile := stack[len(stack)-1]\n\t\tstack = stack[:len(stack)-1]\n\t\tchildren, _ := ioutil.ReadDir(file.Path)\n\t\tfor _, chld := range children {\n\t\t\tchild := ToFile(chld, filepath.Join(file.Path, chld.Name()))\n\t\t\tfile.Children = append(file.Children, child)\n\t\t\tstack = append(stack, child)\n\t\t}\n\t}\n\treturn rootfile\n}", "func DFS(g Graph, id ID) []ID {\n\tif _, err := g.GetNode(id); err != nil {\n\t\treturn nil\n\t}\n\n\ts := []ID{id}\n\tvisited := make(map[ID]bool)\n\trs := []ID{}\n\n\t// while S is not empty:\n\tfor len(s) != 0 {\n\n\t\tu := s[len(s)-1]\n\t\ts = s[:len(s)-1 : len(s)-1]\n\n\t\t// if u is not visited yet:\n\t\tif _, ok := visited[u]; !ok {\n\t\t\t// label u as visited\n\t\t\tvisited[u] = true\n\n\t\t\trs = append(rs, u)\n\n\t\t\t// for each vertex w adjacent to u:\n\t\t\tcmap, _ := g.GetTargets(u)\n\t\t\tfor _, w := range cmap {\n\t\t\t\t// if w is not visited yet:\n\t\t\t\tif _, ok := visited[w.ID()]; !ok {\n\t\t\t\t\ts = append(s, w.ID()) // S.push(w)\n\t\t\t\t}\n\t\t\t}\n\t\t\tpmap, _ := g.GetSources(u)\n\t\t\tfor _, w := range pmap {\n\t\t\t\t// if w is not visited yet:\n\t\t\t\tif _, ok := visited[w.ID()]; !ok {\n\t\t\t\t\ts = append(s, w.ID()) // S.push(w)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rs\n}", "func (n *Node) DFS(fn func(shard *dynamodbstreams.Shard) bool) {\n\tif n == nil {\n\t\treturn\n\t}\n\n\tif n.Shard != nil {\n\t\tif ok := fn(n.Shard); !ok {\n\t\t\treturn\n\t\t}\n\t}\n\n\tfor _, child := range n.Children {\n\t\tchild.DFS(fn)\n\t}\n}", "func main() {\n graph := createGraph()\n graph.addEdge(1, 2)\n graph.addEdge(2, 3)\n graph.addEdge(2, 4)\n graph.addEdge(3, 4)\n graph.addEdge(1, 5)\n graph.addEdge(5, 6)\n graph.addEdge(5, 7)\n\n visited := make(set)\n\n dfs(graph, 1, visited, func(node int) {\n fmt.Print(node, \" \")\n })\n}", "func DepthFirstSearch(g *graph.Graph, start, end *graph.Vertex) (*list.List, *list.List) {\n\tn := g.Vertices()\n\tvisited := make(map[*graph.Vertex]bool)\n\tprev := make(map[*graph.Vertex]*graph.Vertex)\n\tstack, trace := list.New(), list.New()\n\n\tfor i := 0; i < n; i++ {\n\t\tprev[g.Vertex(i)] = nil\n\t}\n\n\tstack.PushFront(start)\n\n\tfor stack.Len() > 0 {\n\t\tu := stack.Remove(stack.Front()).(*graph.Vertex)\n\t\ttrace.PushBack(u)\n\t\tvisited[u] = true\n\t\tif u == end {\n\t\t\tbreak\n\t\t}\n\t\tfor _, e := range g.Edges(u) {\n\t\t\tv := e.V\n\t\t\tif _, ok := visited[v]; !ok {\n\t\t\t\tvisited[v] = true\n\t\t\t\tprev[v] = u\n\t\t\t\tstack.PushFront(v)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn trace, reconstructPath(prev, end)\n}", "func DFSVisit(v *adj.Node, visited map[*adj.Node]bool) {\n\tfmt.Println(v.Data)\n\tvisited[v] = true\n\tfor _, temp := range v.Neighbors {\n\t\tif _, ok := visited[temp]; !ok {\n\t\t\tDFSVisit(temp, visited)\n\t\t}\n\t}\n}", "func DFS(g *Graph, start ID) map[ID]bool {\n\tvisited := make(map[ID]bool)\n\tdfsRecursive(g, start, visited)\n\treturn visited\n}", "func (s *defaultSearcher) dfs(args searchArgs) {\n\toutEdges := args.nodeToOutEdges[args.root]\n\tif args.statusMap[args.root] == onstack {\n\t\tlog.Warn(\"The input call graph contains a cycle. This can't be represented in a \" +\n\t\t\t\"flame graph, so this path will be ignored. For your record, the ignored path \" +\n\t\t\t\"is:\\n\" + strings.TrimSpace(s.pathStringer.pathAsString(args.path, args.nameToNodes)))\n\t\treturn\n\t}\n\tif len(outEdges) == 0 {\n\t\targs.buffer.WriteString(s.pathStringer.pathAsString(args.path, args.nameToNodes))\n\t\targs.statusMap[args.root] = discovered\n\t\treturn\n\t}\n\targs.statusMap[args.root] = onstack\n\tfor _, edge := range outEdges {\n\t\ts.dfs(searchArgs{\n\t\t\troot: edge.Dst,\n\t\t\tpath: append(args.path, *edge),\n\t\t\tnodeToOutEdges: args.nodeToOutEdges,\n\t\t\tnameToNodes: args.nameToNodes,\n\t\t\tbuffer: args.buffer,\n\t\t\tstatusMap: args.statusMap,\n\t\t})\n\t}\n\targs.statusMap[args.root] = discovered\n}", "func DFS(graph map[int]*Vertex, i *Vertex, pass int) {\n\n\ti.Explored = true\n\n\tif pass == 2 {\n\t\ts.AddMember(i.ID)\n\t}\n\n\tfor _, v := range i.Edges {\n\n\t\tvertex := graph[v]\n\n\t\tif !vertex.Explored {\n\t\t\tDFS(graph, vertex, pass)\n\t\t}\n\t}\n\n\tif pass == 1 {\n\t\tt++\n\t\tmagicalOrderMap[t] = i.ID\n\t}\n\n}", "func DFS(root *Node, i int) *Node {\n\n\tif root == nil {\n\t\treturn nil\n\t}\n\n\tif root.Val == i {\n\t\treturn root\n\t}\n\n\troot.Visit()\n\n\tfor _, n := range root.Children {\n\n\t\tif n.Visited {\n\t\t\tcontinue\n\t\t}\n\n\t\tn.Visit()\n\n\t\tresNode := DFS(n, i)\n\t\tif resNode.Val == i {\n\t\t\treturn resNode\n\t\t}\n\n\t}\n\n\treturn root\n}", "func (gph *Graph)isCyclePresentDFS(index int, visited[] int , marked[] int ) bool {\n\tvisited[index] = 1\n\tmarked[index] = 1\n\thead := gph.Edges[index]\n\tfor head != nil {\n\t\tdest := head.destination\n\t\tif (marked[dest] == 1) {\n\t\t\treturn true\n\t\t}\n\n\t\tif (visited[dest] == 0) {\n\t\t\tif (gph.isCyclePresentDFS(dest, visited, marked)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\thead = head.next\n\t}\n\tmarked[index] = 0\n\treturn false\n}", "func (t *Tree) DFSStack(f func(n *Node) bool) {\n\tif t.root == nil {\n\t\treturn\n\t}\n\n\tt.dfsStack(f)\n}", "func dfs(nodes []node, target string, currNodeIndex, depth int) int {\n\tcurrNode := nodes[currNodeIndex]\n\tif currNode.name == target {\n\t\treturn depth\n\t}\n\tfor _, child := range nodes[currNodeIndex].children {\n\t\tresult := dfs(nodes, target, getNodeIndex(nodes, child), depth+1)\n\t\tif result != -1 {\n\t\t\treturn result\n\t\t}\n\t}\n\treturn -1\n}", "func depthFirstSearch(nodes []node, startNode, target string) int {\n\treturn dfs(nodes, target, getNodeIndex(nodes, startNode), 0)\n}", "func DFSRecursion(g Graph, id ID) []ID {\n\tif _, err := g.GetNode(id); err != nil {\n\t\treturn nil\n\t}\n\n\tvisited := make(map[ID]bool)\n\trs := []ID{}\n\n\tdfsRecursion(g, id, visited, &rs)\n\n\treturn rs\n}", "func printGraphDFS(adjMatrix [7][7]int, StartVertex int) {\n\tv := len(adjMatrix)\n\tvisited := make([]bool, v)\n\t//This loop is to check edge like 5-6\n\tfor i := 0; i < v; i++ {\n\t\tif visited[i] == false {\n\t\t\tprintDfsHelper(adjMatrix, visited, StartVertex)\n\t\t}\n\t}\n\n}", "func DFS(mapGame []string, positions []Position) {\n\tplayerPos := positions[0]\n\tgoalPos := append(positions[:0], positions[1:]...)\n\texecuteDFS(playerPos, mapGame, goalPos)\n}", "func dfs(start, cur string, stack []string, adj map[string]map[string][]*gographviz.Edge) map[string]bool {\n\t// Check for cycle or cross.\n\tif in(stack, cur) {\n\t\tif cur == start {\n\t\t\treturn set(stack) // Found a cycle, return the current stack as a set.\n\t\t}\n\t\treturn nil // Found a cross, just return.\n\t}\n\n\tr := map[string]bool{}\n\tchildStack := append(stack, cur)\n\t// Loop over all possible destinations of cur.\n\tfor dst := range adj[cur] {\n\t\t// Add all nodes that are in a cycle as found by the recursive call\n\t\t// to dfs.\n\t\tunion(r, dfs(start, dst, childStack, adj))\n\t}\n\treturn r\n}", "func DFS(traversalType string) []int {\n\tvar data []int\n\tif traversalType == \"pre\" {\n\t\tdata = traversePre(data, 0)\n\t} else if traversalType == \"in\" {\n\t\tdata = traverseIn(data, 0)\n\t} else if traversalType == \"pos\" {\n\t\tdata = traversePos(data, 0)\n\t}\n\treturn data\n}", "func (g LabeledAdjacencyList) DepthFirst(start NI, visit func(NI)) {\n\tv := bits.New(len(g))\n\tvar f func(NI)\n\tf = func(n NI) {\n\t\tvisit(n)\n\t\tv.SetBit(int(n), 1)\n\t\tfor _, to := range g[n] {\n\t\t\tif v.Bit(int(to.To)) == 0 {\n\t\t\t\tf(to.To)\n\t\t\t}\n\t\t}\n\t}\n\tf(start)\n}", "func (t *Thrift) DepthFirstSearch() chan *Thrift {\n\tres := make(chan *Thrift)\n\tset := make(map[string]bool)\n\tgo dfs(t, t, res, set)\n\treturn res\n}", "func DFS(dir []*Node, dirname string) *Node {\n var ret *Node\n \n if dir == nil {\n return nil\n }\n\n for _, subdir := range dir {\n if subdir.Name == dirname {\n ret = subdir\n break\n }\n DFS(subdir.Children, dirname)\n }\n return ret // is returned nil most of the time\n}", "func dfs(node string, visited map[string]int, symphony *Symphony, path []string) (bool, []string) {\n\tif visited[node] == 1 {\n\t\treturn true, path // cyclic dependent\n\t}\n\tif visited[node] == 2 {\n\t\treturn false, path\n\t}\n\t// 1 = temporarily visited\n\tvisited[node] = 1\n\tpath = append(path, node)\n\tdeps := symphony.tasks[node].Deps\n\tfor _, dep := range deps {\n\t\tif cyclic, path := dfs(dep, visited, symphony, path); cyclic {\n\t\t\treturn true, path\n\t\t}\n\t}\n\t// 2 = permanently visited\n\tvisited[node] = 2\n\n\treturn false, path\n}", "func SolutionDFS(root *BinaryTreeNode) []*list.List {\n\tresult := []*list.List{}\n\n\tvar dfs func(*BinaryTreeNode, int)\n\n\tdfs = func(root *BinaryTreeNode, level int) {\n\t\tif root == nil {\n\t\t\treturn\n\t\t}\n\n\t\t// found new level\n\t\tif level == len(result) {\n\t\t\tresult = append(result, list.New())\n\t\t}\n\t\tresult[level].PushBack(root.Value)\n\t\tdfs(root.Left, level+1)\n\t\tdfs(root.Right, level+1)\n\n\t}\n\n\tdfs(root, 0)\n\n\treturn result\n}", "func (gph *Graph) isCyclePresentDFS(index int, visited []int, marked []int) bool {\n\tvisited[index] = 1\n\tmarked[index] = 1\n\thead := gph.Edges[index]\n\tfor head != nil {\n\t\tdest := head.dest\n\t\tif marked[dest] == 1 {\n\t\t\treturn true\n\t\t}\n\n\t\tif visited[dest] == 0 {\n\t\t\tif gph.isCyclePresentDFS(dest, visited, marked) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\thead = head.next\n\t}\n\tmarked[index] = 0\n\treturn false\n}", "func (g *Graph) Bfs(root string, goal string, maxDepth int) (bool, *Vertex) {\n\n\t// Preconditions\n\tif len(root) == 0 {\n\t\tlog.Fatal(\"Root vertex is empty\")\n\t}\n\n\tif len(goal) == 0 {\n\t\tlog.Fatal(\"Goal vertex is empty\")\n\t}\n\n\tif maxDepth < 0 {\n\t\tlog.Fatalf(\"Maximum depth is invalid: %v\\n\", maxDepth)\n\t}\n\n\t// Set of the identifiers of discovered vertices\n\tdiscovered := set.New()\n\tdiscovered.Insert(root)\n\n\t// Queue to hold the vertices to visit\n\tq := queue.New()\n\tq.Enqueue(NewVertex(root, 0))\n\n\t// While there are vertices in the queue to check\n\tfor q.Len() > 0 {\n\n\t\t// Take a vertex from the queue\n\t\tv := q.Dequeue().(Vertex)\n\n\t\t// If the vertex is the goal, then return\n\t\tif v.Identifier == goal {\n\t\t\treturn true, &v\n\t\t}\n\n\t\t// Depth of any vertices adjacent to v\n\t\tnewDepth := v.Depth + 1\n\n\t\t// If the adjacent vertices are within the range\n\t\tif newDepth <= maxDepth {\n\n\t\t\t// Get a list of the adjacent vertices\n\t\t\tw := g.AdjacentTo(v.Identifier)\n\n\t\t\t// Walk through each of the adjacent vertices\n\t\t\tfor _, adjIdentifier := range w {\n\n\t\t\t\t// If the vertex hasn't been seen before\n\t\t\t\tif !discovered.Has(adjIdentifier) {\n\n\t\t\t\t\t// Add the identifier to the set of discovered identifiers\n\t\t\t\t\tdiscovered.Insert(adjIdentifier)\n\n\t\t\t\t\t// Put the vertex on the queue\n\t\t\t\t\tnewVertex := NewVertex(adjIdentifier, newDepth)\n\t\t\t\t\tnewVertex.Parent = &v\n\t\t\t\t\tq.Enqueue(newVertex)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// The goal was not found\n\treturn false, nil\n}", "func dfs(grid [][]int, row, col int) {\n\t// check if out of bound and cell is an unvisited islan\n\tif row < 0 || col < 0 || row >= len(grid) || col >= len(grid[0]) || grid[row][col] != 1 {\n\t\treturn\n\t}\n\n\t// mark cell as visited\n\tgrid[row][col] = 2\n\n\t// check neighbors\n\tdfs(grid, row+1, col)\n\tdfs(grid, row-1, col)\n\tdfs(grid, row, col+1)\n\tdfs(grid, row, col-1)\n}", "func DFS(root *tree.Node, target int) bool {\n\tif root == nil {\n\t\treturn false\n\t}\n\t// check then recur on children of our current node\n\t// order of traversal is pre-order; we could do dfs in-order also\n\t// this could be done through recurring on left then check value of root then recur on right\n\tif root.Value == target {\n\t\treturn true\n\t}\n\tif DFS(root.Left, target) || DFS(root.Right, target) {\n\t\treturn true\n\t}\n\treturn false\n}", "func DFS(currentNode *BasicBlock, nodes []*UnionFindNode, number map[*BasicBlock]int, last []int, current int) int {\n\tnodes[current].Init(currentNode, current)\n\tnumber[currentNode] = current\n\n\tlastid := current\n\tfor ll := currentNode.OutEdges().Front(); ll != nil; ll = ll.Next() {\n\t\tif target := ll.Value.(*BasicBlock); number[target] == unvisited {\n\t\t\tlastid = DFS(target, nodes, number, last, lastid+1)\n\t\t}\n\t}\n\tlast[number[currentNode]] = lastid\n\treturn lastid\n}", "func (g AdjacencyList) DepthFirst(start NI, options ...TraverseOption) {\n\tcf := &config{start: start}\n\tfor _, o := range options {\n\t\to(cf)\n\t}\n\tb := cf.visBits\n\tif b == nil {\n\t\tn := bits.New(len(g))\n\t\tb = &n\n\t} else if b.Bit(int(cf.start)) != 0 {\n\t\treturn\n\t}\n\tif cf.pathBits != nil {\n\t\tcf.pathBits.ClearAll()\n\t}\n\tvar df func(NI) bool\n\tdf = func(n NI) bool {\n\t\tb.SetBit(int(n), 1)\n\t\tif cf.pathBits != nil {\n\t\t\tcf.pathBits.SetBit(int(n), 1)\n\t\t}\n\n\t\tif cf.nodeVisitor != nil {\n\t\t\tcf.nodeVisitor(n)\n\t\t}\n\t\tif cf.okNodeVisitor != nil {\n\t\t\tif !cf.okNodeVisitor(n) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\n\t\tif cf.rand == nil {\n\t\t\tfor x, to := range g[n] {\n\t\t\t\tif cf.arcVisitor != nil {\n\t\t\t\t\tcf.arcVisitor(n, x)\n\t\t\t\t}\n\t\t\t\tif cf.okArcVisitor != nil {\n\t\t\t\t\tif !cf.okArcVisitor(n, x) {\n\t\t\t\t\t\treturn false\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif b.Bit(int(to)) != 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif !df(to) {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tto := g[n]\n\t\t\tfor _, x := range cf.rand.Perm(len(to)) {\n\t\t\t\tif cf.arcVisitor != nil {\n\t\t\t\t\tcf.arcVisitor(n, x)\n\t\t\t\t}\n\t\t\t\tif cf.okArcVisitor != nil {\n\t\t\t\t\tif !cf.okArcVisitor(n, x) {\n\t\t\t\t\t\treturn false\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif b.Bit(int(to[x])) != 0 {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif !df(to[x]) {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif cf.pathBits != nil {\n\t\t\tcf.pathBits.SetBit(int(n), 0)\n\t\t}\n\t\treturn true\n\t}\n\tdf(cf.start)\n}", "func (n *node) dfs(iter func(parent func(int) *node, node *node)) {\n\tparentStack := []*node{n}\n\tfullIter(n.children, func(_ string, child *node) {\n\t\tchild.dfsInner(&parentStack, iter)\n\t})\n}", "func (g *Graph) dfsrevisit(visited map[int64]bool, v *Vertex, f func(*Vertex)()) (map[int64]bool) {\n visited[v.Identifier()] = true;\n dfs(visited, v.EdgeIter(), f);\n return visited;\n}", "func (g *Graph) BFS(start int) {\n\tQ := NewQueue()\n\tQ.Enqueue(start)\n\tg.Lists[start].Node.visited = true\n\n\tfor !Q.IsEmpty() {\n\t\tv := Q.Dequeue().(int)\n\t\tlog.Printf(\"DFS - visit %v\", g.Lists[v].Node.V)\n\t\t//processing all the neighbours of v\n\t\tfor _, adj := range g.Lists[v].Adjacent {\n\t\t\tif !g.Lists[adj].Node.visited {\n\t\t\t\tQ.Enqueue(adj)\n\t\t\t\tg.Lists[adj].Node.visited = true\n\t\t\t}\n\t\t}\n\t}\n\n}", "func (m *Maze) dfs_traverse(cp *Point, tr *traverser, path []*Point) ([]*Point, error) {\n // we made it to the destination! return the path and get out!\n if cp.IsDestination {\n return path, nil\n }\n // nothing more to visit and there was no destination\n if tr.isVisitComplete() {\n return []*Point{}, errors.New(\"destination unreachable\")\n }\n\n // change the current point - DFS pops the last node, as a stack\n cp = tr.popLastNode()\n // next point has already been visited\n if tr.isNodeVisited(cp) {\n return m.dfs_traverse(cp, tr, path)\n }\n tr.enqueueNodes(m.getLegalNextMoves(cp))\n tr.visitNode(cp)\n newPath := append(path, cp)\n return m.dfs_traverse(cp, tr, newPath)\n}", "func dfs(grid [][]byte, M int, N int, x int, y int) {\n\tif x < 0 || x >= M || y < 0 || y >= N {\n\t\t// Out of bound, do nothing.\n\t\treturn\n\t}\n\n\tif grid[y][x] == '0' {\n\t\t// Visited already, do nothing.\n\t\treturn\n\t}\n\tgrid[y][x] = '0'\n\n\tdfs(grid, M, N, x-1, y) // Go left\n\tdfs(grid, M, N, x, y-1) // Go up\n\tdfs(grid, M, N, x+1, y) // Go right\n\tdfs(grid, M, N, x, y+1) // Go down\n}", "func (gph *Graph)isCyclePresentUndirectedDFS(index int, parentIndex int, visited[] bool) bool {\n\tvisited[index] = true\n\tvar dest int \n\thead := gph.Edges[index]\n\tfor head != nil {\n\t\tdest = head.destination\t\t\n\t\tif (visited[dest] == false) {\n\t\t\tif (gph.isCyclePresentUndirectedDFS(dest, index, visited)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t} else if (parentIndex != dest) {\n\t\t\treturn true\n\t\t}\n\t\thead = head.next\n\t}\n\treturn false\n}", "func (dfs *DFS) search(g Graph, v int) {\n\tdfs.marked[v] = true\n\tfor _, w := range g.Adj(v) {\n\t\tif !dfs.marked[w] {\n\t\t\tdfs.edgeTo[w] = v\n\t\t\tdfs.search(g, w)\n\t\t}\n\t}\n\n}", "func NewDFS(g Graph, source int) DFS {\n\t// create the object\n\td := DFS{}\n\td.marked = make([]bool, g.V())\n\td.edgeTo = make([]int, g.V())\n\td.source = source\n\n\t// execute the search\n\td.search(g, source)\n\n\t// return the completed object\n\treturn d\n}", "func (g Graph) BFS(fromId string) map[string]*Vertex {\n\tstartVertex := g.Vertices[fromId]\n\t// Mark all the vertices as not visited(By default\n\t// set as false)\n\tvisited := make(map[string]*Vertex)\n\n\t// Create a queue for BFS\n\tqueue := list.New()\n\tqueue.PushBack(startVertex)\n\n\t// Mark the current node as visited and enqueue it\n\tvisited[fromId] = startVertex\n\tfor queue.Len() > 0 {\n\t\t// Dequeue a vertex from queue and print it\n\t\tqnode := queue.Front()\n\n\t\t// iterate through all of its friends\n\t\t// mark the visited nodes; enqueue the non-visted\n\t\tfor id, vertex := range qnode.Value.(*Vertex).Friends {\n\t\t\tif _, ok := visited[id]; !ok {\n\t\t\t\tvisited[id] = qnode.Value.(*Vertex)\n\t\t\t\tqueue.PushBack(vertex)\n\t\t\t}\n\t\t}\n\t\tqueue.Remove(qnode)\n\t}\n\treturn visited\n}", "func (this *FindElements) Dfs(root *TreeNode, val int) {\n\t// base case\n\tif root == nil {\n\t\treturn\n\t}\n\n\t// add to seen\n\tthis.seen[val] = true\n\n\t// go left, right\n\tthis.Dfs(root.Left, 2*val+1)\n\tthis.Dfs(root.Right, 2*val+2)\n}", "func Bfs(g *Graph, starter int) {\n\tif g.eNum == 0 {\n\t\treturn\n\t}\n\tfmt.Printf(\"BFS begin with node %d\\n\", starter)\n\tisVisited := make(map[int]bool, g.vNum)\n\tdistance := make(map[int]int, g.vNum)\n\tisVisited[starter] = true\n\tdistance[starter] = 0\n\tvar queue []Vertex\n\tqueue = append(queue, g.adjacencyList[starter])\n\tfor len(queue) > 0 {\n\t\tcurrentNode := queue[0]\n\t\tqueue = queue[1:len(queue)]\n\t\tcurrentDis := distance[currentNode.value]\n\t\tfmt.Printf(\"node %d from %d (starter)'s distance is: %d\\n\", currentNode.value, starter, currentDis)\n\t\tadjNode := currentNode.edgeList.Front()\n\t\tfor adjNode != nil {\n\t\t\tadjNodeVal := adjNode.Value.(int)\n\t\t\tif is, ok := isVisited[adjNodeVal]; !is || !ok {\n\t\t\t\tqueue = append(queue, g.adjacencyList[adjNodeVal])\n\t\t\t\tisVisited[adjNodeVal] = true\n\t\t\t\tdistance[adjNodeVal] = currentDis + 1\n\t\t\t}\n\t\t\tadjNode = adjNode.Next()\n\t\t}\n\t}\n}", "func dfs(nodes *[]int, u *TreeNode) {\r\n\t// base\r\n\tif u == nil {\r\n\t\treturn\r\n\t}\r\n\t// recursion\r\n\tif u.Left != nil && u.Right != nil {\r\n\t\tdfs(nodes, u.Left)\r\n\t\tdfs(nodes, u.Right)\r\n\t\treturn\r\n\t}\r\n\tif u.Left != nil {\r\n\t\t*nodes = append(*nodes, u.Left.Val)\r\n\t\tdfs(nodes, u.Left)\r\n\t}\r\n\tif u.Right != nil {\r\n\t\t*nodes = append(*nodes, u.Right.Val)\r\n\t\tdfs(nodes, u.Right)\r\n\t}\r\n}", "func (gph *Graph) isCyclePresentUndirectedDFS(index int, parentIndex int, visited []bool) bool {\n\tvisited[index] = true\n\tvar dest int\n\thead := gph.Edges[index]\n\tfor head != nil {\n\t\tdest = head.dest\n\t\tif !visited[dest] {\n\t\t\tif gph.isCyclePresentUndirectedDFS(dest, index, visited) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t} else if parentIndex != dest {\n\t\t\treturn true\n\t\t}\n\t\thead = head.next\n\t}\n\treturn false\n}", "func dfs(G [][]int, y, x int) int {\r\n\t// base\r\n\tif y < 0 || y >= len(G) || x < 0 || x >= len(G[0]) || G[y][x] == 1 {\r\n\t\treturn 0\r\n\t}\r\n\tG[y][x] = 1\r\n\t// recursion\r\n\tcnt := 1\r\n\tcnt += dfs(G, y-1, x) + dfs(G, y+1, x)\r\n\tcnt += dfs(G, y, x-1) + dfs(G, y, x+1)\r\n\treturn cnt\r\n}", "func (gph *Graph)bfsLevelNode(source int) {\n\tcount := gph.count\n\tvisited := make([]bool, count)\n\tlevel := make([]int, count)\n\tvisited[source] = true\n\tque := queue.New()\n\n\tque.Enqueue(source)\n\tlevel[source] = 0\n\tfmt.Println(\"\\nNode - Level\")\n\n\tfor que.Len() > 0 {\n\t\tcurr := que.Dequeue().(int)\n\t\tdepth := level[curr]\n\t\thead := gph.Edges[curr]\n\t\tfmt.Println(curr ,\" - \" , depth)\n\t\tfor head != nil {\n\t\t\tif (visited[head.destination] == false) {\n\t\t\t\tvisited[head.destination] = true\n\t\t\t\tque.Enqueue(head.destination)\n\t\t\t\tlevel[head.destination] = depth + 1\n\t\t\t}\n\t\t\thead = head.next\n\t\t}\n\t}\n}", "func dfs(curr string, prev string, depth int, orbits map[string][]string) int {\n\tsum := 0\n\tfor _, neighbor := range orbits[curr] {\n\t\tif neighbor == prev {\n\t\t\tcontinue\n\t\t}\n\t\tif neighbor == \"SAN\" {\n\t\t\treturn depth\n\t\t}\n\t\tsum += dfs(neighbor, curr, depth+1, orbits)\n\t}\n\treturn sum\n}", "func BFS(mat [][]int, startPos Position, state State, searchVal, maxDepth int) BFSResult {\n\tres := BFSResult{foodDepth: maxDepth, nearestSnakeDepth: maxDepth}\n\tqueue := list.New()\n\tqueue.PushBack(BFSNode{startPos, 1})\n\tmatrix := duplicateMatrix(mat)\n\t//fmt.Println(matrix)\n\tfor queue.Len() > 0 {\n\t\t// Get next element\n\t\tcurr := queue.Front()\n\t\tnode := curr.Value.(BFSNode)\n\t\tpos := node.pos\n\t\tqueue.Remove(curr)\n\n\t\t// Max depth reached\n\t\tif node.depth > maxDepth { break }\n\n\t\t// Test for in bounds\n\t\tif !isPositionInBounds(pos, state) { continue }\n\n\t\t// Don't look at the same value\n\t\tif matrix[pos.y][pos.x] == 1 { continue }\n\n\t\t// Test if we found closest enemy position\n\t\tif res.nearestSnakeDepth == maxDepth {\n\t\t\tif matrix[pos.y][pos.x] == 2 {\n\t\t\t\tres.nearestSnakeDepth = int(math.Abs(float64(pos.x) - float64(startPos.x)))\n\t\t\t\tres.nearestSnakeDepth = int(math.Abs(float64(pos.y) - float64(startPos.y)))\n\t\t\t}\n\t\t}\n\n\t\tif !isValidPosition(pos, state) { continue }\n\n\t\t// Test if we found the closes food position\n\t\tif res.foodDepth == maxDepth {\n\t\t\tif matrix[pos.y][pos.x] == 3 {\n\t\t\t\tres.foodDepth = int(math.Abs(float64(pos.x) - float64(startPos.x)))\n\t\t\t\tres.foodDepth += int(math.Abs(float64(pos.y) - float64(startPos.y)))\n\t\t\t}\n\t\t}\n\n\t\t// Mark as visited\n\t\tmatrix[pos.y][pos.x] = 1\n\n\t\t// Add next elements to queue\n\t\taddPositionsToQueue(queue, matrix, pos, state, node.depth + 1)\n\n\t\t// Update max depth\n\t\tif node.depth + 1 > res.emptySpaceDepth {\n\t\t\tres.emptySpaceDepth = node.depth + 1\n\t\t}\n\t}\n\n\treturn res\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 searchDiagnosisPaths(graph *simple.DirectedGraph, nodeCount int) ([][]int64, error) {\n\tvar queue NodeQueue\n\tvisited := make([]bool, nodeCount)\n\tnodePathCache := make([][][]int64, nodeCount)\n\tsinkNodes := make([]int64, 0)\n\n\t// Validate the graph contains start node with id of 0.\n\tstart := graph.Node(0)\n\tif start == nil {\n\t\treturn nil, fmt.Errorf(\"start node not found in graph\")\n\t}\n\n\t// Set start node as visited and enqueue all nodes that can reach directly from it.\n\tvisited[start.ID()] = true\n\tfromNodes := graph.From(start.ID())\n\tfor fromNodes.Next() {\n\t\tfromNode := fromNodes.Node()\n\t\tqueue.Enqueue(fromNode)\n\t}\n\n\t// Initialize node path cache with start node.\n\tnodePaths := make([][]int64, 0)\n\tnodePaths = append(nodePaths, []int64{start.ID()})\n\tnodePathCache[start.ID()] = nodePaths\n\n\tfor queue.Len() != 0 {\n\t\t// Dequeue a node from queue and retrieve all nodes that can reach directly to or from current node.\n\t\tcurrent := queue.Dequeue()\n\t\ttoNodes := graph.To(current.ID())\n\t\tfromNodes := graph.From(current.ID())\n\n\t\t// Skip current node if it has already been visited.\n\t\tif visited[current.ID()] {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Set current node as visited if all nodes that can reach directly to current node are visited.\n\t\t// Otherwise, enqueue current node.\n\t\tvisited[current.ID()] = true\n\t\tfor toNodes.Next() {\n\t\t\ttoNode := toNodes.Node()\n\t\t\tif !visited[toNode.ID()] {\n\t\t\t\tvisited[current.ID()] = false\n\t\t\t\tqueue.Enqueue(current)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif visited[current.ID()] {\n\t\t\t// Update node path of current node with visited node that can reach directly to current node.\n\t\t\ttoNodes.Reset()\n\t\t\tfor toNodes.Next() {\n\t\t\t\ttoNode := toNodes.Node()\n\t\t\t\tnodePaths := nodePathCache[current.ID()]\n\t\t\t\tif nodePaths == nil {\n\t\t\t\t\tnodePaths = make([][]int64, 0)\n\t\t\t\t}\n\t\t\t\ttoNodePaths := nodePathCache[toNode.ID()]\n\t\t\t\tfor _, toNodePath := range toNodePaths {\n\t\t\t\t\tnodePath := make([]int64, len(toNodePath))\n\t\t\t\t\tcopy(nodePath, toNodePath)\n\t\t\t\t\tnodePath = append(nodePath, current.ID())\n\t\t\t\t\tnodePaths = append(nodePaths, nodePath)\n\t\t\t\t}\n\t\t\t\t// Node path appended by current node is updated as node path of current node.\n\t\t\t\tnodePathCache[current.ID()] = nodePaths\n\t\t\t}\n\n\t\t\t// Enqueue all nodes that can reach directly from current node if current node is visited.\n\t\t\tsink := true\n\t\t\tfor fromNodes.Next() {\n\t\t\t\tsink = false\n\t\t\t\tfromNode := fromNodes.Node()\n\t\t\t\tqueue.Enqueue(fromNode)\n\t\t\t}\n\t\t\t// Set current node as sink if its outdegree is 0.\n\t\t\tif sink {\n\t\t\t\tsinkNodes = append(sinkNodes, current.ID())\n\t\t\t}\n\t\t}\n\t}\n\n\t// Set diagnosis paths with all node paths of nodes which has outdegree of 0.\n\tdiagnosisPaths := make([][]int64, 0)\n\tfor _, id := range sinkNodes {\n\t\tpaths := nodePathCache[id]\n\t\tdiagnosisPaths = append(diagnosisPaths, paths...)\n\t}\n\n\treturn diagnosisPaths, nil\n}", "func BenchmarkDFSPathTo(bench *testing.B) {\n\tfname := \"../data/graph-003.data\"\n\tg, _ := graph.LoadFromFile(fname)\n\tsource_vertex := int32(0)\n\n\tbfs_path := DFSPath(g, source_vertex)\n\tbench.ResetTimer()\n\n\tfor i := 0; i < bench.N; i++ {\n\t\tfor v := int32(0); v < g.V(); v++ {\n\t\t\t_, _ = bfs_path.PathTo(v)\n\t\t}\n\t}\n}", "func BFS(g *Graph, start *Vertex) map[int]*Vertex { //\n\n\tfor _, v := range g.Vertices {\n\t\tv.Parent, v.Distance, v.InQueue = nil, 0, false\n\t}\n\n\tq := &queue{}\n\tvisited := map[int]*Vertex{}\n\tcurrent := start\n\n\tfor {\n\n\t\tvisited[current.Key] = current\n\n\t\tfor _, v := range current.Vertices {\n\t\t\tif _, ok := visited[v.Key]; ok || v.InQueue {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tq.enqueue(v)\n\t\t\tv.InQueue = true\n\t\t\tv.Parent = current\n\t\t\tv.Distance = current.Distance + 1\n\t\t}\n\n\t\tcurrent = q.dequeue()\n\t\tif current == nil {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn visited\n}", "func BFS(g *Graph, startVertex *Vertex) map[int]*Vertex { //\n\n\tq := &queue{}\n\tvisited := map[int]*Vertex{}\n\tcurrent := startVertex\n\n\tfor {\n\n\t\tvisited[current.Key] = current\n\n\t\tfor _, v := range current.Vertices {\n\t\t\tif _, ok := visited[v.Key]; !ok {\n\t\t\t\tq.enqueue(v)\n\t\t\t}\n\t\t}\n\n\t\tcurrent = q.dequeue()\n\t\tif current == nil {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn visited\n}", "func Dijkstra(g Graph, src uint32, weightFn func(uint32, uint32) float32, withPreds bool) DijkstraState {\n\tnv := g.NumVertices()\n\tvertLevel := make([]uint32, nv)\n\tfor i := u0; i < nv; i++ {\n\t\tvertLevel[i] = unvisited\n\t}\n\tcurLevel := make([]uint32, 0, nv)\n\tnextLevel := make([]uint32, 0, nv)\n\tnLevel := uint32(2)\n\tparents := make([]uint32, nv)\n\tpathcounts := make([]uint32, nv)\n\tdists := make([]float32, nv)\n\n\tpreds := make([][]uint32, 0)\n\tif withPreds {\n\t\tpreds = make([][]uint32, nv)\n\t}\n\n\tfor i := range dists {\n\t\tdists[i] = maxDist\n\t}\n\n\tvertLevel[src] = 0\n\tdists[src] = 0\n\tparents[src] = src\n\tpathcounts[src] = 1\n\tcurLevel = append(curLevel, src)\n\tfor len(curLevel) > 0 {\n\t\tfor _, u := range curLevel {\n\t\t\tfor _, v := range g.OutNeighbors(u) {\n\t\t\t\talt := min(maxDist, dists[u]+weightFn(u, v))\n\t\t\t\tif vertLevel[v] == unvisited { // if not visited\n\t\t\t\t\tdists[v] = alt\n\t\t\t\t\tparents[v] = u\n\t\t\t\t\tpathcounts[v] += pathcounts[u]\n\t\t\t\t\tif withPreds {\n\t\t\t\t\t\tpreds[v] = append(preds[v], u)\n\t\t\t\t\t}\n\t\t\t\t\tnextLevel = append(nextLevel, v)\n\t\t\t\t\tvertLevel[v] = nLevel\n\t\t\t\t} else {\n\t\t\t\t\tif alt < dists[v] {\n\t\t\t\t\t\tdists[v] = alt\n\t\t\t\t\t\tparents[v] = u\n\t\t\t\t\t\tpathcounts[v] = 0\n\t\t\t\t\t\tif withPreds {\n\t\t\t\t\t\t\tpreds[v] = preds[v][:0]\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif alt == dists[v] {\n\t\t\t\t\t\tpathcounts[v] += pathcounts[u]\n\t\t\t\t\t\tif withPreds {\n\t\t\t\t\t\t\tpreds[v] = append(preds[v], u)\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\tfmt.Printf(\"completed level %d, size = %d\\n\", nLevel-1, len(nextLevel))\n\t\tnLevel++\n\t\tcurLevel = curLevel[:0]\n\t\tcurLevel, nextLevel = nextLevel, curLevel\n\t\tzuint32.SortBYOB(curLevel, nextLevel[:nv])\n\t}\n\tpathcounts[src] = 1\n\tparents[src] = 0\n\tif withPreds {\n\t\tpreds[src] = preds[src][:0]\n\t}\n\tds := DijkstraState{\n\t\tParents: parents,\n\t\tDists: dists,\n\t\tPathcounts: pathcounts,\n\t\tPredecessors: preds,\n\t}\n\treturn ds\n}", "func (gph *Graph) BfsLevelNode(source int) {\n\tcount := gph.count\n\tvisited := make([]bool, count)\n\tlevel := make([]int, count)\n\tvisited[source] = true\n\tque := new(Queue)\n\tque.Add(source)\n\tlevel[source] = 0\n\tfmt.Println(\"\\nNode - Level\")\n\tfor que.Len() > 0 {\n\t\tcurr := que.Remove().(int)\n\t\tdepth := level[curr]\n\t\thead := gph.Edges[curr]\n\t\tfmt.Println(curr, \" - \", depth)\n\t\tfor head != nil {\n\t\t\tif !visited[head.dest] {\n\t\t\t\tvisited[head.dest] = true\n\t\t\t\tque.Add(head.dest)\n\t\t\t\tlevel[head.dest] = depth + 1\n\t\t\t}\n\t\t\thead = head.next\n\t\t}\n\t}\n}", "func dfs(root1, root2 *TreeNode) bool {\n\tif root1 == nil && root2 == nil {\n\t\treturn true\n\t} else if root1 == nil {\n\t\treturn false\n\t} else if root2 == nil {\n\t\treturn false\n\t} else {\n\t\tif root1.Val == root2.Val {\n\t\t\treturn dfs(root1.Right, root2.Left) && dfs(root1.Left, root2.Right)\n\t\t}\n\t\treturn false\n\t}\n}", "func (g *Graph) BFS(s int, t int) {\n\t// todo\n\tif s == t {\n\t\treturn\n\t}\n\tpre := make([]int, g.v)\n\tfor i := range pre {\n\t\tpre[i] = -1\n\t}\n\tvar queue []int\n\tvisited := make([]bool, g.v)\n\tqueue = append(queue, s)\n\tvisited[s] = true\n\tisFound := false\n\tfor len(queue) > 0 && !isFound {\n\t\ttop := queue[0]\n\t\tqueue = queue[1:]\n\t\tlinkedlist := g.adj[top]\n\t\tfor e := linkedlist.Front(); e != nil; e = e.Next() {\n\t\t\tk := e.Value.(int)\n\t\t\tif !visited[k] {\n\t\t\t\tpre[k] = top\n\t\t\t\tif k == t {\n\t\t\t\t\tisFound = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tqueue = append(queue, k)\n\t\t\t\tvisited[k] = true\n\t\t\t}\n\t\t}\n\t}\n\tif isFound {\n\t\tprintPrev(pre, s, t)\n\t} else {\n\t\tfmt.Printf(\"no path found from %d to %d\\n\", s, t)\n\t}\n}", "func DepthFirstSearchUtil(forest []int, visited map[int]bool, count int) int {\n\tfor key, val := range forest {\n\t\tif !visited[key] {\n\t\t\tvisited[key] = true\n\t\t\treturn count + DepthFirstSearchUtil(forest, visited, val)\n\t\t}\n\t}\n}", "func dfs(candidates []int, target int, s int, solution []int, sum int, ans *[][]int) {\n\tif sum == target {\n\t\ts := make([]int, len(solution))\n\t\tcopy(s, solution)\n\t\t*ans = append(*ans, s)\n\t\treturn\n\t}\n\n\tfor i := s; i < len(candidates); i++ {\n\t\tif sum+candidates[i] > target {\n\t\t\t// Stop further iterations if sum+candidates[i]\n\t\t\t// has already exceeded the value of target.\n\t\t\t// (We've sorted candidates already.)\n\t\t\treturn\n\t\t}\n\n\t\tsolution = append(solution, candidates[i]) // Push\n\t\t// Different from pure combination problem,\n\t\t// we can use current candidate repeatedly,\n\t\t// thus pass 'i' instead of 'i+1' to next DFS.\n\t\tdfs(candidates, target, i, solution, sum+candidates[i], ans)\n\t\tsolution = solution[:len(solution)-1] // Pop\n\t}\n}", "func (g *Graph) DijkstraSearch(start Node) []Path {\n\tif start.node == nil || g.nodes[start.node.index] != start.node {\n\t\treturn nil\n\t}\n\tpaths := make([]Path, len(g.nodes))\n\n\tnodesBase := nodeSlice(make([]*node, len(g.nodes)))\n\tcopy(nodesBase, g.nodes)\n\tfor i := range nodesBase {\n\t\tnodesBase[i].state = 1<<31 - 1\n\t\tnodesBase[i].data = i\n\t\tnodesBase[i].parent = nil\n\t}\n\tstart.node.state = 0 // make it so 'start' sorts to the top of the heap\n\tnodes := &nodesBase\n\tnodes.heapInit()\n\n\tfor len(*nodes) > 0 {\n\t\tcurNode := nodes.pop()\n\t\tfor _, edge := range curNode.edges {\n\t\t\tnewWeight := curNode.state + edge.weight\n\t\t\tif newWeight < curNode.state { // negative edge length\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tv := edge.end\n\t\t\tif nodes.heapContains(v) && newWeight < v.state {\n\t\t\t\tv.parent = curNode\n\t\t\t\tnodes.update(v.data, newWeight)\n\t\t\t}\n\t\t}\n\n\t\t// build path to this node\n\t\tif curNode.parent != nil {\n\t\t\tnewPath := Path{Weight: curNode.state}\n\t\t\tnewPath.Path = make([]Edge, len(paths[curNode.parent.index].Path)+1)\n\t\t\tcopy(newPath.Path, paths[curNode.parent.index].Path)\n\t\t\tnewPath.Path[len(newPath.Path)-1] = Edge{Weight: curNode.state - curNode.parent.state,\n\t\t\t\tStart: curNode.parent.container, End: curNode.container}\n\t\t\tpaths[curNode.index] = newPath\n\t\t} else {\n\t\t\tpaths[curNode.index] = Path{Weight: curNode.state, Path: []Edge{}}\n\t\t}\n\t}\n\treturn paths\n}", "func bfs(adj [][]bool, begin, end point) int {\n\tfr := new(frontier)\n\tvisited := make(map[point]bool)\n\theap.Push(fr, step{begin, 0})\n\tfor fr.Len() != 0 {\n\t\tnext := heap.Pop(fr).(step)\n\t\tif next.point == end {\n\t\t\treturn next.steps\n\t\t}\n\t\tfor _, p := range neighbors(adj, next.point) {\n\t\t\tif !visited[p] {\n\t\t\t\theap.Push(fr, step{p, next.steps + 1})\n\t\t\t\tvisited[p] = true\n\t\t\t}\n\t\t}\n\t}\n\treturn -1\n}", "func dfs(cur, parent int, adjs [][]int) (int, int) {\n\tnodes, cuts := 1, 0\n\tfor _, adj := range adjs[cur] {\n\t\tif adj == parent {\n\t\t\tcontinue\n\t\t}\n\t\tadjNodes, adjCuts := dfs(adj, cur, adjs)\n\t\tnodes += adjNodes\n\t\tcuts += adjCuts\n\t\tif adjNodes%2 == 0 {\n\t\t\tcuts++\n\t\t}\n\t}\n\treturn nodes, cuts\n}", "func BFS(g *adjacencylist.AdjacencyList, s *adjacencylist.AdjListVertex) {\n\t// set up adjacency-list for this algorithm\n\tfor _, v := range g.Adj {\n\t\tfor _, e := range v {\n\t\t\te.Color = white // all vertices start white\n\t\t\te.D = -1 // distance from source initialized to -1 as a null value\n\t\t}\n\t}\n\t// set properties on s and add it to the queue\n\ts.Color = gray // nodes are gray if in the queue\n\ts.D = 0 // distance from s to s is 0\n\tQ := []*adjacencylist.AdjListVertex{s}\n\n\t// perform BFS\n\tfor len(Q) > 0 {\n\t\t// process first vertex in the queue\n\t\tv := Q[0]\n\t\tQ = Q[1:]\n\t\t// add properties to nodes connected to v, and add them to the queue for processing on the next round\n\t\tfor _, e := range g.Adj[v] {\n\t\t\tif e.Color == white {\n\t\t\t\te.P = v\n\t\t\t\te.D = v.D + 1\n\t\t\t\te.Color = gray\n\t\t\t\tQ = append(Q, e)\n\t\t\t}\n\t\t}\n\t\tv.Color = black\n\t}\n}", "func dfSUtil(v int, visited []bool, adj_list [][]int, conn map[int]int) {\n\n\tvisited[v] = true\n\n\tconn[v] = v\n\n\tadj := adj_list[v-1]\n\n\tfor i := 0; i < len(adj); i++ {\n\t\tif !visited[adj[i]] {\n\t\t\tdfSUtil(adj[i], visited, adj_list, conn)\n\t\t}\n\t}\n}", "func BFS(g Graph, id ID) []ID {\n\tif _, err := g.GetNode(id); err != nil {\n\t\treturn nil\n\t}\n\n\tq := []ID{id}\n\tvisited := make(map[ID]bool)\n\tvisited[id] = true\n\trs := []ID{id}\n\n\t// while Q is not empty:\n\tfor len(q) != 0 {\n\n\t\tu := q[0]\n\t\tq = q[1:len(q):len(q)]\n\n\t\t// for each vertex w adjacent to u:\n\t\tcmap, _ := g.GetTargets(u)\n\t\tfor _, w := range cmap {\n\t\t\t// if w is not visited yet:\n\t\t\tif _, ok := visited[w.ID()]; !ok {\n\t\t\t\tq = append(q, w.ID()) // Q.push(w)\n\t\t\t\tvisited[w.ID()] = true // label w as visited\n\n\t\t\t\trs = append(rs, w)\n\t\t\t}\n\t\t}\n\t\tpmap, _ := g.GetSources(u)\n\t\tfor _, w := range pmap {\n\t\t\t// if w is not visited yet:\n\t\t\tif _, ok := visited[w.ID()]; !ok {\n\t\t\t\tq = append(q, w.ID()) // Q.push(w)\n\t\t\t\tvisited[w.ID()] = true // label w as visited\n\n\t\t\t\trs = append(rs, w.ID())\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rs\n}", "func (level *Level) bfsearch(start Pos) {\n\tedge := make([]Pos, 0, 8)\n\tedge = append(edge, start)\n\tvisited := make(map[Pos]bool)\n\tvisited[start] = true\n\tlevel.Debug = visited\n\n\tfor len(edge) > 0 {\n\t\tcurrent := edge[0]\n\t\tedge = edge[1:]\n\t\tfor _, next := range getNeighbours(level, current) {\n\t\t\tif !visited[next] {\n\t\t\t\tedge = append(edge, next)\n\t\t\t\tvisited[next] = true\n\t\t\t}\n\t\t}\n\t}\n}", "func (g *Graph) AllPaths(root string, goal string, maxDepth int) []*TreeNode {\n\n\t// Preconditions\n\tif len(root) == 0 {\n\t\tlog.Fatal(\"Root vertex is empty\")\n\t}\n\n\tif len(goal) == 0 {\n\t\tlog.Fatal(\"Goal vertex is empty\")\n\t}\n\n\tif maxDepth < 0 {\n\t\tlog.Fatalf(\"Maximum depth is invalid: %v\\n\", maxDepth)\n\t}\n\n\t// Number of steps traversed from the root vertex\n\tnumSteps := 0\n\n\t// If the goal is the root, then return without traversing the graph\n\ttreeNode := makeTreeNode(root, root == goal)\n\tif treeNode.marked {\n\t\treturn []*TreeNode{treeNode}\n\t}\n\n\t// Nodes to 'spider' from\n\tqCurrent := queue.New()\n\tqCurrent.Enqueue(treeNode)\n\n\t// Nodes to 'spider' from on the next iteration\n\tqNext := queue.New()\n\n\t// List of complete nodes (where goal has been found)\n\tcomplete := []*TreeNode{}\n\n\tfor numSteps < maxDepth {\n\n\t\tfor qCurrent.Len() > 0 {\n\n\t\t\t// Take a tree node from the queue representing a vertex\n\t\t\tnode := qCurrent.Dequeue().(*TreeNode)\n\n\t\t\tif node.marked {\n\t\t\t\tlog.Fatal(\"Trying to traverse from a marked node\")\n\t\t\t}\n\n\t\t\t// Get a list of the adjacent vertices\n\t\t\tw := g.AdjacentTo(node.name)\n\n\t\t\t// Walk through each of the adjacent vertices\n\t\t\tfor _, adjIdentifier := range w {\n\n\t\t\t\tif !node.containsVertex(adjIdentifier) {\n\n\t\t\t\t\tmarked := adjIdentifier == goal\n\t\t\t\t\tchild := node.makeChild(adjIdentifier, marked)\n\n\t\t\t\t\tif marked {\n\t\t\t\t\t\tcomplete = append(complete, child)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tqNext.Enqueue(child)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\t\tqCurrent = qNext\n\t\tqNext = queue.New()\n\t\tnumSteps++\n\n\t}\n\n\treturn complete\n}", "func printGraphBFS(adjMatrix [7][7]int) {\n\tv := len(adjMatrix)\n\tvisited := make([]bool, v)\n\t//This loop ensures working on edge between vertices 5-6\n\tfor i := 0; i < v; i++ {\n\t\tif visited[i] == false {\n\t\t\tprintBfsHelper(adjMatrix, visited, i)\n\t\t}\n\t}\n}", "func ReDepthFirstSearch(root string, currentBuildNode NodeState, modifiedFiles map[string]bool, nodeMap map[string]NodeState) 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\t// checks if current build is directly associated with any modified files\n\tfor file := range currentNodeData.Files {\n\t\tdependentFiles = append(dependentFiles, currentNodeData.Location+file)\n\t\t_, foundModifiedFiles := modifiedFiles[currentNodeData.Location+file]\n\n\t\tif currentBuildNode.FilesModified == false && foundModifiedFiles == true {\n\t\t\tcurrentBuildNode.FilesModified = true\n\t\t}\n\t}\n\n\tfor dependencyName := range currentNodeData.Dependency {\n\n\t\tdependencyNode, FoundDependency := nodeMap[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 errors.New(err)\n\t\t\t} else if dependencyNode.Executed == false {\n\t\t\t\tdelete(nodeMap, dependencyName)\n\t\t\t\terr := ReDepthFirstSearch(root, dependencyNode, modifiedFiles, nodeMap)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t// checks if current build is indirectly associated with any modified files\n\t\t\t\tif currentBuildNode.FilesModified == false && nodeMap[dependencyName].FilesModified == true {\n\t\t\t\t\tcurrentBuildNode.FilesModified = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Executes a build command realted to a Build if it's assocaited with modified files directly or indirectly\n\tif currentBuildNode.FilesModified == true {\n\t\tcmd := exec.Command(\"bash\", \"-c\", currentBuildNode.NodeData.Command)\n\t\tcmd.Dir = root + currentBuildNode.NodeData.Location\n\t\t_, err := cmd.Output()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\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 nil\n}", "func bfs(root, target *node) *vector.Vector {\n\tqueue := &nodeQueue{vector.Vector{}}\n\troot.num = 0\n\theap.Push(queue, root)\n\n\tfor queue.Len() > 0 {\n\t\tn := heap.Pop(queue).(*node)\n\t\tn.visited = true\n\n\t\tfmt.Printf(\"Visited %v\\n\", n.name)\n\n\t\tif n == target {\n\t\t\tpath := vector.Vector{}\n\t\t\tpath.Push(n)\n\t\t\tfor n.prev != nil {\n\t\t\t\tn = n.prev\n\t\t\t\tpath.Push(n)\n\t\t\t}\n\t\t\treturn &path\n\t\t}\n\t\tfor ei := range n.edges.Iter() {\n\t\t\te := ei.(*edge)\n\t\t\tif !e.to.visited {\n\t\t\t\te.to.prev = n\n\t\t\t\te.to.num = n.num + 1\n\t\t\t\theap.Push(queue, e.to)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil // never reached\n}", "func BFS(s string) {\n\tvar ll linklist.LL\n\n\tv := graphs.Gmap[s]\n\n\tv.C = 1\n\n\tll = ll.LlStart()\n\tll = ll.LlEnqueue(v)\n\n\tfor !ll.LlEmpty() {\n\t\tu := ll.LlPop()\n\t\tw := u.(*graphs.Vertex)\n\t\tt := w.Adj\n\n\t\tif t != nil {\n\t\t\tfor i := 0; i < len(t); i++ {\n\t\t\t\tif t[i].C == 0 {\n\t\t\t\t\tt[i].C = 1\n\t\t\t\t\tt[i].TI = w.TI + 1\n\t\t\t\t\tt[i].P = w\n\t\t\t\t\tll = ll.LlEnqueue(t[i])\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n}", "func (f *Func) dfsOrig(entry *Block, succFn linkedBlocks, semi, vertex, label, parent []ID) ID {\n\tn := ID(0)\n\ts := make([]*Block, 0, 256)\n\ts = append(s, entry)\n\n\tfor len(s) > 0 {\n\t\tv := s[len(s)-1]\n\t\ts = s[:len(s)-1]\n\t\t// recursing on v\n\n\t\tif semi[v.ID] != 0 {\n\t\t\tcontinue // already visited\n\t\t}\n\t\tn++\n\t\tsemi[v.ID] = n\n\t\tvertex[n] = v.ID\n\t\tlabel[v.ID] = v.ID\n\t\t// ancestor[v] already zero\n\t\tfor _, e := range succFn(v) {\n\t\t\tw := e.b\n\t\t\t// if it has a dfnum, we've already visited it\n\t\t\tif semi[w.ID] == 0 {\n\t\t\t\t// yes, w can be pushed multiple times.\n\t\t\t\ts = append(s, w)\n\t\t\t\tparent[w.ID] = v.ID // keep overwriting this till it is visited.\n\t\t\t}\n\t\t}\n\t}\n\treturn n\n}", "func (g AdjacencyList) BreadthFirst(start NI, opt ...TraverseOption) {\n\tcf := &config{start: start}\n\tfor _, o := range opt {\n\t\to(cf)\n\t}\n\tf := cf.fromList\n\tswitch {\n\tcase f == nil:\n\t\te := NewFromList(len(g))\n\t\tf = &e\n\tcase f.Paths == nil:\n\t\t*f = NewFromList(len(g))\n\t}\n\trp := f.Paths\n\t// the frontier consists of nodes all at the same level\n\tfrontier := []NI{cf.start}\n\tlevel := 1\n\t// assign path when node is put on frontier\n\trp[cf.start] = PathEnd{Len: level, From: -1}\n\tfor {\n\t\tf.MaxLen = level\n\t\tlevel++\n\t\tvar next []NI\n\t\tif cf.rand == nil {\n\t\t\tfor _, n := range frontier {\n\t\t\t\t// visit nodes as they come off frontier\n\t\t\t\tif cf.nodeVisitor != nil {\n\t\t\t\t\tcf.nodeVisitor(n)\n\t\t\t\t}\n\t\t\t\tif cf.okNodeVisitor != nil {\n\t\t\t\t\tif !cf.okNodeVisitor(n) {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor _, nb := range g[n] {\n\t\t\t\t\tif rp[nb].Len == 0 {\n\t\t\t\t\t\tnext = append(next, nb)\n\t\t\t\t\t\trp[nb] = PathEnd{From: n, Len: level}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else { // take nodes off frontier at random\n\t\t\tfor _, i := range cf.rand.Perm(len(frontier)) {\n\t\t\t\tn := frontier[i]\n\t\t\t\t// remainder of block same as above\n\t\t\t\tif cf.nodeVisitor != nil {\n\t\t\t\t\tcf.nodeVisitor(n)\n\t\t\t\t}\n\t\t\t\tif cf.okNodeVisitor != nil {\n\t\t\t\t\tif !cf.okNodeVisitor(n) {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor _, nb := range g[n] {\n\t\t\t\t\tif rp[nb].Len == 0 {\n\t\t\t\t\t\tnext = append(next, nb)\n\t\t\t\t\t\trp[nb] = PathEnd{From: n, Len: level}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif len(next) == 0 {\n\t\t\tbreak\n\t\t}\n\t\tfrontier = next\n\t}\n}", "func NewDFSPaths(g Graph, s int) Paths {\n\tpaths := &dfsPaths{\n\t\tmarked: make([]bool, g.V()),\n\t\tedgeTo: make([]int, g.V()),\n\t\ts: s,\n\t}\n\tpaths.dfs(g, s)\n\n\treturn paths\n}", "func (G *Graph) BFS(cb func(*Node)) {\r\n\r\n\t// initialize a queue and add the graph's root node to it\r\n\tq := []*Node{G.nodes[0]}\r\n\r\n\t// initialize a map to keep track of the visited nodes\r\n\t// a map is an unordered collection of key/value pairs\r\n\tvisited := make(map[*Node]bool)\r\n\r\n\tfor {\r\n\t\t// loop until the queue is empty\r\n\t\tif len(q) == 0 {\r\n\t\t\tbreak\r\n\t\t}\r\n\r\n\t\t// set ref variable to the next node in the queue\r\n\t\tnode := q[0]\r\n\t\t// remove that node from the queue - aka dequeue\r\n\t\tq = q[1:]\r\n\t\t// set ref variable for the current node's edges (connections)\r\n\t\tnear := G.edges[*node]\r\n\r\n\t\t// loop through each edge\r\n\t\tfor i := 0; i < len(near); i++ {\r\n\t\t\tj := near[i]\r\n\t\t\t// if this edge node has not yet been visited...\r\n\t\t\tif !visited[j] {\r\n\t\t\t\t// ...add it to the queue\r\n\t\t\t\tq = append(q, j)\r\n\t\t\t\tvisited[j] = true\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif cb != nil {\r\n\t\t\tcb(node)\r\n\t\t}\r\n\t}\r\n}", "func (this *Graph) Cluster() []*Graph {\n /*\n\n Algorithm synopsis:\n\n Loop over the Starters, for each unvisited Starter,\n define an empty sub-graph and, put it into the toVisit set\n\n Loop over the toVisit node set, for each node in it, \n skip if already visited\n add the node to the sub-graph\n remove the nodes into the hasVisited node set\n put all its incoming and outgoing edge into the the toWalk set while\n stop at the hub nodes (edges from the hub nodes are not put in the toWalk set)\n then iterate through the toWalk edge set \n skip if already walked\n add the edge to the sub-graph\n put its connected nodes into the toVisit node set\n remove the edge from the toWalk edge set into the hasWalked edge set\n\n */\n \n // sub-graph index\n sgNdx := -1\n sgRet := make([]*Graph,0)\n\n toVisit := make(nodeSet); hasVisited := make(nodeSet)\n toWalk := make(edgeSet); hasWalked := make(edgeSet)\n\n for starter := range *this.Starters() {\n // define an empty sub-graph and, put it into the toVisit set\n sgRet = append(sgRet, NewGraph(gographviz.NewGraph())); sgNdx++; \n sgRet[sgNdx].Attrs = this.Attrs\n sgRet[sgNdx].SetDir(this.Directed)\n graphName := fmt.Sprintf(\"%s_%03d\\n\", this.Name, sgNdx);\n sgRet[sgNdx].SetName(graphName)\n toVisit.Add(starter)\n hubVisited := make(nodeSet)\n for len(toVisit) > 0 { for nodep := range toVisit {\n toVisit.Del(nodep); //print(\"O \")\n if this.IsHub(nodep) && hasVisited.Has(nodep) && !hubVisited.Has(nodep) { \n // add the already-visited but not-in-this-graph hub node to the sub-graph\n sgRet[sgNdx].AddNode(nodep)\n hubVisited.Add(nodep)\n continue \n }\n if hasVisited.Has(nodep) { continue }\n //spew.Dump(\"toVisit\", nodep)\n // add the node to the sub-graph\n sgRet[sgNdx].AddNode(nodep)\n // remove the nodes into the hasVisited node set\n hasVisited.Add(nodep)\n // stop at the hub nodes\n if this.IsHub(nodep) { continue }\n // put all its incoming and outgoing edge into the the toWalk set\n noden := nodep.Name\n for _, ep := range this.EdgesToParents(noden) {\n toWalk.Add(ep)\n }\n for _, ep := range this.EdgesToChildren(noden) {\n toWalk.Add(ep)\n }\n for edgep := range toWalk {\n toWalk.Del(edgep); //print(\"- \")\n if hasWalked.Has(edgep) { continue }\n //spew.Dump(\"toWalk\", edgep)\n sgRet[sgNdx].Edges.Add(edgep)\n // put its connected nodes into the toVisit node set\n toVisit.Add(this.Lookup(edgep.Src))\n toVisit.Add(this.Lookup(edgep.Dst))\n // remove the edge into the hasWalked edge set\n hasWalked.Add(edgep)\n }\n }}\n //spew.Dump(sgNdx)\n }\n return sgRet\n}", "func (node *TreeNode) MaxDepthIterativeDfs() int {\n\tif node == nil {\n\t\treturn 0\n\t}\n\n\ttype Item struct {\n\t\tnode *TreeNode\n\t\tdepth int\n\t}\n\n\tstack := []Item{{node: node, depth: 1}}\n\n\tdepth := 0\n\n\tfor len(stack) > 0 {\n\t\titem := stack[len(stack)-1]\n\t\tstack = stack[:len(stack)-1]\n\n\t\tif item.depth > depth {\n\t\t\tdepth = item.depth\n\t\t}\n\n\t\tif item.node.Left != nil {\n\t\t\tstack = append(stack, Item{node: item.node.Left, depth: depth + 1})\n\t\t}\n\n\t\tif item.node.Right != nil {\n\t\t\tstack = append(stack, Item{node: item.node.Right, depth: depth + 1})\n\t\t}\n\t}\n\n\treturn depth\n}", "func (search DFS) IsConnected(g *graphs.Graph) bool {\n\tsearch.marked = make([]bool, g.NoOfV())\n\tsearch.dfs(g, 0)\n\treturn search.count == g.NoOfV()\n}", "func CheckReachability(deviceA, deviceB string, ig InputGraph) (bool, []Node, error) {\n\tlog.L.Debugf(\"[inputgraph] Looking for a path from %v to %v\", deviceA, deviceB)\n\n\t//check and make sure that both of the devices are actually a part of the graph\n\n\tif _, ok := ig.DeviceMap[deviceA]; !ok {\n\t\tmsg := fmt.Sprintf(\"[inputgraph] Device %v is not part of the graph\", deviceA)\n\n\t\tlog.L.Error(color.HiRedString(msg))\n\n\t\treturn false, []Node{}, errors.New(msg)\n\t}\n\n\tif _, ok := ig.DeviceMap[deviceB]; !ok {\n\t\tmsg := fmt.Sprintf(\"[inputgraph] Device %v is not part of the graph\", deviceA)\n\n\t\tlog.L.Error(color.HiRedString(msg))\n\n\t\treturn false, []Node{}, errors.New(msg)\n\t}\n\n\t//now we need to check to see if we can get from a to b. We're gonna use a BFS\n\tfrontier := make(chan string, len(ig.Nodes))\n\tvisited := make(map[string]bool)\n\tpath := make(map[string]string)\n\n\t//put in our first state\n\tfrontier <- deviceA\n\n\tvisited[deviceA] = true\n\n\tfor {\n\t\tselect {\n\t\tcase cur := <-frontier:\n\t\t\tlog.L.Debugf(\"[inputgraph] Evaluating %v\", cur)\n\t\t\tif cur == deviceB {\n\t\t\t\tlog.L.Debugf(\"[inputgraph] DestinationDevice reached.\")\n\t\t\t\tdev := cur\n\n\t\t\t\ttoReturn := []Node{}\n\t\t\t\ttoReturn = append(toReturn, *ig.DeviceMap[dev])\n\t\t\t\tlog.L.Debugf(\"[inputgraph] First Hop: %v -> %v\", dev, path[dev])\n\t\t\t\tdev, ok := path[dev]\n\n\t\t\t\tcount := 0\n\t\t\t\tfor ok {\n\t\t\t\t\tif count > len(path) {\n\t\t\t\t\t\tmsg := \"[inputgraph] Circular path detected: returnin\"\n\t\t\t\t\t\tlog.L.Error(color.HiRedString(msg))\n\n\t\t\t\t\t\treturn false, []Node{}, errors.New(msg)\n\t\t\t\t\t}\n\t\t\t\t\tlog.L.Debugf(\"[inputgraph] Next hop: %v -> %v\", dev, path[dev])\n\n\t\t\t\t\ttoReturn = append(toReturn, *ig.DeviceMap[dev])\n\n\t\t\t\t\tdev, ok = path[dev]\n\t\t\t\t\tcount++\n\n\t\t\t\t}\n\t\t\t\t//get our path and return it\n\t\t\t\treturn true, toReturn, nil\n\t\t\t}\n\n\t\t\tfor _, next := range ig.AdjacencyMap[cur] {\n\t\t\t\tif _, ok := path[next]; ok || next == deviceA {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tpath[next] = cur\n\n\t\t\t\tlog.L.Debugf(\"[inputgraph] Path from %v to %v, adding %v to frontier\", cur, next, next)\n\t\t\t\tlog.L.Debugf(\"[inputgraph] Path as it stands is: \")\n\n\t\t\t\tcurDev := next\n\t\t\t\tdev, ok := path[curDev]\n\t\t\t\tfor ok {\n\t\t\t\t\tlog.L.Debugf(\"[inputgraph] %v -> %v\", curDev, dev)\n\t\t\t\t\tcurDev = dev\n\t\t\t\t\tdev, ok = path[curDev]\n\t\t\t\t}\n\t\t\t\tfrontier <- next\n\t\t\t}\n\t\tdefault:\n\t\t\tlog.L.Debugf(\"[inputgraph] No path found\")\n\t\t\treturn false, []Node{}, nil\n\t\t}\n\t}\n}", "func (al *AdjacencyList) BFS(v int) {\n\tal.Visited[v] = true\n\tqueue := al.List[v]\n\tal.TraversalPath = append(al.TraversalPath, v)\n\n\tfor len(queue) > 0 {\n\t\tal.TraversalPath = append(al.TraversalPath, queue[0])\n\t\tal.Visited[queue[0]] = true\n\n\t\tfor _, v := range al.List[queue[0]] {\n\t\t\tif _, ok := al.Visited[v]; ok {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif queue[len(queue)-1] == v {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tqueue = append(queue, v)\n\t\t}\n\n\t\tqueue = queue[1:]\n\t}\n}", "func Int2dArrayDepthFirstSearch(rowsAndCols [][]int, startAt Point, canTraverse func(grid [][]int, point Point) bool, searchDirections []Direction) []Point {\n\tvisited := ds.NewSet[Point]()\n\treachablePoints := ds.NewSet[Point]()\n\tqueue := ds.NewQueue[Point](len(rowsAndCols) * len(rowsAndCols[0])) // safe assumption for now\n\tqueue.Enqueue(startAt)\n\tfor !queue.IsEmpty() {\n\t\tpoint := queue.Dequeue()\n\t\tneighbors := Int2dArrayFindNeighbors(rowsAndCols, point.X, point.Y, searchDirections)\n\t\tfor _, neighbor := range neighbors {\n\t\t\tneighborPoint := *NewPoint(neighbor.Row, neighbor.Col)\n\t\t\tcanTraverse := !visited.Has(neighborPoint) && canTraverse(rowsAndCols, neighborPoint)\n\t\t\tif canTraverse {\n\t\t\t\treachablePoints.Put(neighborPoint)\n\t\t\t\tqueue.Enqueue(neighborPoint) // continue DFS\n\t\t\t} else {\n\t\t\t\tvisited.Put(neighborPoint)\n\t\t\t}\n\t\t}\n\t\tvisited.Put(point) // mark current as visited\n\t}\n\tkeys := reachablePoints.Keys()\n\treturn keys\n}", "func (attr *Attribute) DFS(callback func(attr *Attribute)) {\n\tcallback(attr)\n\tfor _, each := range attr.subAttributes {\n\t\teach.DFS(callback)\n\t}\n}", "func dfs(grid [][]byte, rowIdx int, colIdx int, maxRows int, maxCols int) {\n\tif (rowIdx < 0) || (colIdx < 0) || (rowIdx >= maxRows) || (colIdx >= maxCols) || string(grid[rowIdx][colIdx]) == \"0\" {\n\t\treturn\n\t}\n\n\tgrid[rowIdx][colIdx] = []byte(\"0\")[0]\n\n\tdfs(grid, rowIdx - 1, colIdx, maxRows, maxCols)\n\tdfs(grid, rowIdx + 1, colIdx, maxRows, maxCols)\n\tdfs(grid, rowIdx, colIdx - 1, maxRows, maxCols)\n\tdfs(grid, rowIdx, colIdx + 1, maxRows, maxCols)\n}", "func Example_usage() {\n\t// Create the graph\n\tg := graph.New(7)\n\tg.Connect(0, 1)\n\tg.Connect(1, 2)\n\tg.Connect(2, 3)\n\tg.Connect(3, 4)\n\tg.Connect(3, 5)\n\n\t// Create the depth first search algo structure for g and source node #2\n\td := dfs.New(g, 0)\n\n\t// Get the path between #0 (source) and #2\n\tfmt.Println(\"Path 0->5:\", d.Path(5))\n\tfmt.Println(\"Order:\", d.Order())\n\tfmt.Println(\"Reachable #4 #6:\", d.Reachable(4), d.Reachable(6))\n\n\t// Output:\n\t// Path 0->5: [0 1 2 3 5]\n\t// Order: [0 1 2 3 5 4]\n\t// Reachable #4 #6: true false\n}", "func dijkstra(origin *Vertex, destination *Vertex, v []*Vertex, e []*Edge) []string {\r\n\t// Forcing our vertices to start at distance 0 (in case of the algorithm running multiple times on the same data)\r\n\tfor _, vertex := range v {\r\n\t\tvertex.Distance = 0\r\n\t}\r\n\r\n\t// Initialisation of various Queues\r\n\tqueue := VertexQueue{Elements: []*Vertex{origin}}\r\n\tvisited := VertexQueue{Elements: []*Vertex{}}\r\n\tnode, err := &Vertex{}, errors.New(\"\")\r\n\r\n\t// Iterate over all of the elements of the queue until there are no more vertices (max O(len(v)))\r\n\tfor queue.Size() > 0 {\r\n\t\t// Always work on what is closest to the current vertex in the queue.\r\n\t\tnode, err = queue.Pop()\r\n\t\tif err != nil {\r\n\t\t\tfmt.Println(errors.New(\"no nodes in queue\"))\r\n\t\t\tos.Exit(3)\r\n\t\t}\r\n\r\n\t\t// Avoid repetitions\r\n\t\tvisited.Append(node)\r\n\r\n\t\t// Filtering out the edges that are linked to the current node\r\n\t\tfilteredEdges := make([]*Edge, 0, len(e))\r\n\t\tfor _, edge := range e {\r\n\t\t\tif edge.Start.Label == node.Label || edge.End.Label == node.Label {\r\n\t\t\t\tfilteredEdges = append(filteredEdges, edge)\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Sorting the edges by distance\r\n\t\tsort.Slice(filteredEdges, func(i, j int) bool {\r\n\t\t\treturn filteredEdges[i].Value > filteredEdges[j].Value\r\n\t\t})\r\n\r\n\t\t// If the vertex is a well\r\n\t\tif len(filteredEdges) == 1 &&\r\n\t\t\t(filteredEdges[0].Start != origin && filteredEdges[0].End != destination &&\r\n\t\t\t\tfilteredEdges[0].Start != destination && filteredEdges[0].End != origin) {\r\n\t\t\t// Set the node to be unreachable by the backtrace\r\n\t\t\tfor _, edge := range e {\r\n\t\t\t\tif edge.Start == filteredEdges[0].Start || edge.End == filteredEdges[0].Start {\r\n\t\t\t\t\tfilteredEdges[0].Start.Distance = math.MaxInt32\r\n\t\t\t\t\tbreak\r\n\t\t\t\t} else if edge.End == filteredEdges[0].End || edge.Start == filteredEdges[0].End {\r\n\t\t\t\t\tfilteredEdges[0].End.Distance = math.MaxInt32\r\n\t\t\t\t\tbreak\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t// Iterate on all available edges.\r\n\t\t\tfor _, edge := range filteredEdges {\r\n\t\t\t\t// Determine the actual direction of the edge.\r\n\t\t\t\tstart, end := &Vertex{}, &Vertex{}\r\n\t\t\t\tif edge.Start.Label == node.Label {\r\n\t\t\t\t\tstart = edge.Start\r\n\t\t\t\t\tend = edge.End\r\n\t\t\t\t} else {\r\n\t\t\t\t\tstart = edge.End\r\n\t\t\t\t\tend = edge.Start\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// If end distance not yet set.\r\n\t\t\t\tif end.Label != origin.Label && ((end.Distance == 0 && end.Distance < start.Distance+edge.Value) || (end.Distance > start.Distance+edge.Value)) {\r\n\t\t\t\t\tend.Distance = start.Distance + edge.Value\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// If arrival at destination, empty queue.\r\n\t\t\t\tif node.Label == destination.Label {\r\n\t\t\t\t\tqueue.DequeueWhere(func(v Vertex) bool { return true })\r\n\t\t\t\t\t// Otherwise append all further nodes to the queue.\r\n\t\t\t\t} else if !visited.Contains(*end) && ((queue.Contains(*end) && queue.FilterWhere(func(v Vertex) bool { return v.Label == end.Label })[0].Distance > end.Distance) || !queue.Contains(*end)) {\r\n\t\t\t\t\tqueue.Append(end)\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tsort.Slice(queue.Elements, func(i, j int) bool {\r\n\t\t\treturn queue.Elements[i].Distance > queue.Elements[j].Distance\r\n\t\t})\r\n\t}\r\n\r\n\t// Path of labels for the trace.\r\n\tpath := []*Vertex{destination}\r\n\tqueue = VertexQueue{Elements: []*Vertex{destination}}\r\n\tvisited = VertexQueue{Elements: []*Vertex{}}\r\n\tnode = &Vertex{}\r\n\r\n\t// Backtrace\r\n\tfor queue.Size() > 0 {\r\n\t\tnode, err = queue.Pop()\r\n\t\tif err != nil {\r\n\t\t\tfmt.Println(errors.New(\"no nodes in queue\"))\r\n\t\t\tos.Exit(3)\r\n\t\t}\r\n\t\tvisited.Append(node)\r\n\t\tfilteredEdges := make([]*Edge, 0, len(e))\r\n\t\tfor _, edge := range e {\r\n\t\t\tif (edge.Start.Label == node.Label || edge.End.Label == node.Label) && edge.Value != math.MaxInt32 {\r\n\t\t\t\tfilteredEdges = append(filteredEdges, edge)\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tsort.Slice(filteredEdges, func(i, j int) bool {\r\n\t\t\treturn filteredEdges[i].Value > filteredEdges[j].Value\r\n\t\t})\r\n\r\n\t\tfor _, edge := range filteredEdges {\r\n\t\t\tstart, end := &Vertex{}, &Vertex{}\r\n\t\t\tif edge.Start.Label == node.Label {\r\n\t\t\t\tstart = edge.Start\r\n\t\t\t\tend = edge.End\r\n\t\t\t} else {\r\n\t\t\t\tstart = edge.End\r\n\t\t\t\tend = edge.Start\r\n\t\t\t}\r\n\r\n\t\t\tif node.Label == origin.Label {\r\n\t\t\t\tqueue.DequeueWhere(func(_ Vertex) bool { return true })\r\n\t\t\t} else if !visited.Contains(*end) && !queue.Contains(*end) && start.Distance-end.Distance == edge.Value {\r\n\t\t\t\t// If the node hasn't been visited and isn't planned for visit yet, and that the edge value corresponds to the delta of the distance from the start.\r\n\t\t\t\tqueue.Append(end)\r\n\t\t\t\tpath = append(path, end)\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tsort.Slice(queue.Elements, func(i, j int) bool {\r\n\t\t\treturn queue.Elements[i].Distance > queue.Elements[j].Distance\r\n\t\t})\r\n\t}\r\n\r\n\t// Reverse the path to obtain the path in the right direction.\r\n\tfor i, j := 0, len(path)-1; i < j; i, j = i+1, j-1 {\r\n\t\tpath[i], path[j] = path[j], path[i]\r\n\t}\r\n\r\n\t// Format to string\r\n\tresult := []string{}\r\n\tfor _, vertex := range path {\r\n\t\tresult = append(result, vertex.Label)\r\n\t}\r\n\treturn result\r\n}", "func traversalBFS(current []Node, filterFn func(node Node) (gotoNextLayer bool), processFn func(node Node) (gotoNextLayer bool), isRoot bool) (gotoNextLayer bool) {\n\tif len(current) == 0 {\n\t\treturn false\n\t}\n\t// Step 1: brothers layer\n\tnextBrothers := []Node{}\n\tfor _, node := range current {\n\t\t// filter root\n\t\tif isRoot {\n\t\t\tif !filterFn(node) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\tif !processFn(node) {\n\t\t\treturn false\n\t\t}\n\t\t// filter brothers\n\t\tnextBrothers = append(nextBrothers, node)\n\t}\n\n\t// Step 2: children layer\n\tnextChildren := []Node{}\n\t// filter children\n\tfor _, node := range nextBrothers {\n\t\t// Scan node for nodes to include.\n\t\tnextChildren = append(nextChildren, filterChildren(node, node.LeftNodes(), filterFn)...)\n\t\tnextChildren = append(nextChildren, filterChildren(node, node.MiddleNodes(), filterFn)...)\n\t\tnextChildren = append(nextChildren, filterChildren(node, node.RightNodes(), filterFn)...)\n\t}\n\ttraversalBFS(nextChildren, filterFn, processFn, false)\n\treturn true\n}", "func (node *AStarNode) Depth() int {\n\tscore := 0\n\ttmpNode := node\n\tfor tmpNode != nil {\n\t\tscore++\n\t\ttmpNode = tmpNode.previous\n\t}\n\treturn score\n}", "func searchPath(nodes vector.Vector, from, to int) {\n\tpath := bfs(nodes[from].(*node), nodes[to].(*node))\n\n\tfor path.Len() > 0 {\n\t\tfmt.Printf(\"-> %v \", path.Pop().(*node).name)\n\t}\n\tfmt.Printf(\"\\n -- Done --\\nCleaning up..\\n\")\n\tclearNodes(nodes)\n}", "func (t *Tree) Depth() int {\n\tvar d int\n\tt.BFS(func(n *Node) {\n\t\tdep := n.Depth()\n\t\tif dep > d {\n\t\t\td = dep\n\t\t}\n\t})\n\treturn d\n}", "func (d *Dijkstra) Search() {\n\td.frontier[d.source] = graphEdge{From: d.source, To: d.source} // source node is special\n\td.cost[d.source] = 0\n\tpq := NewIndexedPriorityQueueMin(d.cost)\n\tpq.Insert(d.source)\n\n\tfor !pq.IsEmpty() {\n\t\tidx, err := pq.Pop()\n\t\tif err != nil {\n\t\t\td.err = err\n\t\t\treturn\n\t\t}\n\n\t\tedge := d.frontier[idx]\n\t\td.spt[idx] = edge\n\t\ti := edge.To\n\n\t\tif i == d.target {\n\t\t\treturn\n\t\t}\n\n\t\tfor _, e := range d.graph.edges[i] {\n\t\t\tnewCost := d.cost[i] + e.Cost\n\t\t\tt := e.To\n\t\t\tif _, ok := d.frontier[t]; !ok {\n\t\t\t\td.frontier[t] = e\n\t\t\t\td.cost[t] = newCost\n\t\t\t\tpq.Insert(t)\n\t\t\t} else if newCost < d.cost[t] {\n\t\t\t\tif _, ok := d.spt[t]; !ok {\n\t\t\t\t\td.frontier[t] = e\n\t\t\t\t\td.cost[t] = newCost\n\t\t\t\t\tpq.ChangePriority(t)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "func floodFill(image [][]int, sr int, sc int, newColor int) [][]int {\n\tif len(image) < 1 || len(image[0]) < 1 {\n\t\treturn image\n\t}\n\n\tm, n := len(image), len(image[0])\n\tvisited := make([][]bool, m)\n\tfor i := 0; i < m; i++ {\n\t\tvisited[i] = make([]bool, n)\n\t}\n\n\toldColor := image[sr][sc]\n\tfloodFillDFS(image, sr, sc, oldColor, newColor, visited)\n\n\treturn image\n}", "func (node *TreeNode) MaxDepthIterativeBfs() int {\n\tif node == nil {\n\t\treturn 0\n\t}\n\n\ttype Item struct {\n\t\tnode *TreeNode\n\t\tdepth int\n\t}\n\n\tqueue := []Item{{node: node, depth: 1}}\n\n\tdepth := 0\n\n\tfor len(queue) > 0 {\n\t\titem := queue[0]\n\t\tqueue = queue[1:]\n\n\t\tif item.depth > depth {\n\t\t\tdepth = item.depth\n\t\t}\n\n\t\tif item.node.Left != nil {\n\t\t\tqueue = append(queue, Item{node: item.node.Left, depth: depth + 1})\n\t\t}\n\n\t\tif item.node.Right != nil {\n\t\t\tqueue = append(queue, Item{node: item.node.Right, depth: depth + 1})\n\t\t}\n\t}\n\n\treturn depth\n}", "func (b *BFS) Search(start int) {\n\tqueue := make([]int, 0)\n\tqueue = append(queue, start)\n\tb.discovered[start] = true\n\n\tfor len(queue) != 0 {\n\t\tv := queue[0]\n\t\tqueue = queue[1:]\n\t\tif !b.processed[v] {\n\t\t\tb.t.ProcessVertexEarly(v)\n\t\t\tb.processed[v] = true\n\t\t}\n\n\t\tp := b.g.edges[v]\n\t\tfor p != nil {\n\t\t\ty := p.y\n\t\t\tif b.processed[y] || b.g.directed {\n\t\t\t\tb.t.ProcessEdge(v, y)\n\t\t\t}\n\t\t\tif !b.discovered[y] {\n\t\t\t\tqueue = append(queue, y)\n\t\t\t\tb.discovered[y] = true\n\t\t\t}\n\t\t\tp = p.next\n\t\t}\n\t\tb.t.ProcessVertexLate(v)\n\t}\n}" ]
[ "0.7593979", "0.75133604", "0.7414026", "0.7401565", "0.72685266", "0.71811664", "0.705523", "0.7046336", "0.6803631", "0.67728686", "0.67686695", "0.67599857", "0.6756332", "0.67451745", "0.66636795", "0.6581642", "0.6556061", "0.6529665", "0.6523646", "0.6491768", "0.6457776", "0.64558804", "0.64506876", "0.64179397", "0.64169294", "0.6411644", "0.63836634", "0.6383084", "0.63568753", "0.6269179", "0.62582207", "0.6247365", "0.6246708", "0.6190282", "0.6186573", "0.61756104", "0.6175128", "0.61630666", "0.61456525", "0.6096593", "0.60095805", "0.59781945", "0.5946746", "0.5866546", "0.5864039", "0.58589655", "0.5844862", "0.58395964", "0.5755651", "0.57463634", "0.5739138", "0.5734621", "0.5678092", "0.5618572", "0.5594728", "0.5574138", "0.55639356", "0.5526706", "0.5526643", "0.55158174", "0.5501311", "0.54198265", "0.5414036", "0.5411546", "0.54048944", "0.538798", "0.536645", "0.53612167", "0.5357297", "0.5351906", "0.5342517", "0.5332352", "0.5311912", "0.529696", "0.5282925", "0.5282367", "0.526897", "0.52542704", "0.5246368", "0.5242322", "0.52238566", "0.5205035", "0.5201162", "0.5189682", "0.5186128", "0.51622975", "0.51589763", "0.5145093", "0.51441", "0.5142958", "0.51429456", "0.50886273", "0.5087834", "0.50700074", "0.5069074", "0.50670576", "0.5058305", "0.50112474", "0.5003753", "0.49850357" ]
0.67208195
14
/ Breadth First Search (BFS) There are many ways to traverse graphs. BFS is the most commonly used approach. BFS is a traversing algorithm where you should start traversing from a selected node (source or starting node) and traverse the graph layerwise thus exploring the neighbour nodes (nodes which are directly connected to source node). You must then move towards the nextlevel neighbour nodes. As the name BFS suggests, you are required to traverse the graph breadthwise as follows: 1. First move horizontally and visit all the nodes of the current layer 2. Move to the next layer FS (G, s) //Where G is the graph and s is the source node let Q be queue. Q.enqueue( s ) //Inserting s in queue until all its neighbour vertices are marked. mark s as visited. while ( Q is not empty) Removing that vertex from queue,whose neighbour will be visited now v = Q.dequeue( ) processing all the neighbours of v for all neighbours w of v in Graph G if w is not visited Q.enqueue( w ) //Stores w in Q to further visit its neighbour mark w as visited.
func (g *Graph) BFS(start int) { Q := NewQueue() Q.Enqueue(start) g.Lists[start].Node.visited = true for !Q.IsEmpty() { v := Q.Dequeue().(int) log.Printf("DFS - visit %v", g.Lists[v].Node.V) //processing all the neighbours of v for _, adj := range g.Lists[v].Adjacent { if !g.Lists[adj].Node.visited { Q.Enqueue(adj) g.Lists[adj].Node.visited = true } } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func BFS(g *adjacencylist.AdjacencyList, s *adjacencylist.AdjListVertex) {\n\t// set up adjacency-list for this algorithm\n\tfor _, v := range g.Adj {\n\t\tfor _, e := range v {\n\t\t\te.Color = white // all vertices start white\n\t\t\te.D = -1 // distance from source initialized to -1 as a null value\n\t\t}\n\t}\n\t// set properties on s and add it to the queue\n\ts.Color = gray // nodes are gray if in the queue\n\ts.D = 0 // distance from s to s is 0\n\tQ := []*adjacencylist.AdjListVertex{s}\n\n\t// perform BFS\n\tfor len(Q) > 0 {\n\t\t// process first vertex in the queue\n\t\tv := Q[0]\n\t\tQ = Q[1:]\n\t\t// add properties to nodes connected to v, and add them to the queue for processing on the next round\n\t\tfor _, e := range g.Adj[v] {\n\t\t\tif e.Color == white {\n\t\t\t\te.P = v\n\t\t\t\te.D = v.D + 1\n\t\t\t\te.Color = gray\n\t\t\t\tQ = append(Q, e)\n\t\t\t}\n\t\t}\n\t\tv.Color = black\n\t}\n}", "func Bfs(g *Graph, starter int) {\n\tif g.eNum == 0 {\n\t\treturn\n\t}\n\tfmt.Printf(\"BFS begin with node %d\\n\", starter)\n\tisVisited := make(map[int]bool, g.vNum)\n\tdistance := make(map[int]int, g.vNum)\n\tisVisited[starter] = true\n\tdistance[starter] = 0\n\tvar queue []Vertex\n\tqueue = append(queue, g.adjacencyList[starter])\n\tfor len(queue) > 0 {\n\t\tcurrentNode := queue[0]\n\t\tqueue = queue[1:len(queue)]\n\t\tcurrentDis := distance[currentNode.value]\n\t\tfmt.Printf(\"node %d from %d (starter)'s distance is: %d\\n\", currentNode.value, starter, currentDis)\n\t\tadjNode := currentNode.edgeList.Front()\n\t\tfor adjNode != nil {\n\t\t\tadjNodeVal := adjNode.Value.(int)\n\t\t\tif is, ok := isVisited[adjNodeVal]; !is || !ok {\n\t\t\t\tqueue = append(queue, g.adjacencyList[adjNodeVal])\n\t\t\t\tisVisited[adjNodeVal] = true\n\t\t\t\tdistance[adjNodeVal] = currentDis + 1\n\t\t\t}\n\t\t\tadjNode = adjNode.Next()\n\t\t}\n\t}\n}", "func (G *Graph) BFS(cb func(*Node)) {\r\n\r\n\t// initialize a queue and add the graph's root node to it\r\n\tq := []*Node{G.nodes[0]}\r\n\r\n\t// initialize a map to keep track of the visited nodes\r\n\t// a map is an unordered collection of key/value pairs\r\n\tvisited := make(map[*Node]bool)\r\n\r\n\tfor {\r\n\t\t// loop until the queue is empty\r\n\t\tif len(q) == 0 {\r\n\t\t\tbreak\r\n\t\t}\r\n\r\n\t\t// set ref variable to the next node in the queue\r\n\t\tnode := q[0]\r\n\t\t// remove that node from the queue - aka dequeue\r\n\t\tq = q[1:]\r\n\t\t// set ref variable for the current node's edges (connections)\r\n\t\tnear := G.edges[*node]\r\n\r\n\t\t// loop through each edge\r\n\t\tfor i := 0; i < len(near); i++ {\r\n\t\t\tj := near[i]\r\n\t\t\t// if this edge node has not yet been visited...\r\n\t\t\tif !visited[j] {\r\n\t\t\t\t// ...add it to the queue\r\n\t\t\t\tq = append(q, j)\r\n\t\t\t\tvisited[j] = true\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif cb != nil {\r\n\t\t\tcb(node)\r\n\t\t}\r\n\t}\r\n}", "func BFS(g *Graph, start *Vertex) map[int]*Vertex { //\n\n\tfor _, v := range g.Vertices {\n\t\tv.Parent, v.Distance, v.InQueue = nil, 0, false\n\t}\n\n\tq := &queue{}\n\tvisited := map[int]*Vertex{}\n\tcurrent := start\n\n\tfor {\n\n\t\tvisited[current.Key] = current\n\n\t\tfor _, v := range current.Vertices {\n\t\t\tif _, ok := visited[v.Key]; ok || v.InQueue {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tq.enqueue(v)\n\t\t\tv.InQueue = true\n\t\t\tv.Parent = current\n\t\t\tv.Distance = current.Distance + 1\n\t\t}\n\n\t\tcurrent = q.dequeue()\n\t\tif current == nil {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn visited\n}", "func (g Graph) BFS(fromId string) map[string]*Vertex {\n\tstartVertex := g.Vertices[fromId]\n\t// Mark all the vertices as not visited(By default\n\t// set as false)\n\tvisited := make(map[string]*Vertex)\n\n\t// Create a queue for BFS\n\tqueue := list.New()\n\tqueue.PushBack(startVertex)\n\n\t// Mark the current node as visited and enqueue it\n\tvisited[fromId] = startVertex\n\tfor queue.Len() > 0 {\n\t\t// Dequeue a vertex from queue and print it\n\t\tqnode := queue.Front()\n\n\t\t// iterate through all of its friends\n\t\t// mark the visited nodes; enqueue the non-visted\n\t\tfor id, vertex := range qnode.Value.(*Vertex).Friends {\n\t\t\tif _, ok := visited[id]; !ok {\n\t\t\t\tvisited[id] = qnode.Value.(*Vertex)\n\t\t\t\tqueue.PushBack(vertex)\n\t\t\t}\n\t\t}\n\t\tqueue.Remove(qnode)\n\t}\n\treturn visited\n}", "func BFS(mat [][]int, startPos Position, state State, searchVal, maxDepth int) BFSResult {\n\tres := BFSResult{foodDepth: maxDepth, nearestSnakeDepth: maxDepth}\n\tqueue := list.New()\n\tqueue.PushBack(BFSNode{startPos, 1})\n\tmatrix := duplicateMatrix(mat)\n\t//fmt.Println(matrix)\n\tfor queue.Len() > 0 {\n\t\t// Get next element\n\t\tcurr := queue.Front()\n\t\tnode := curr.Value.(BFSNode)\n\t\tpos := node.pos\n\t\tqueue.Remove(curr)\n\n\t\t// Max depth reached\n\t\tif node.depth > maxDepth { break }\n\n\t\t// Test for in bounds\n\t\tif !isPositionInBounds(pos, state) { continue }\n\n\t\t// Don't look at the same value\n\t\tif matrix[pos.y][pos.x] == 1 { continue }\n\n\t\t// Test if we found closest enemy position\n\t\tif res.nearestSnakeDepth == maxDepth {\n\t\t\tif matrix[pos.y][pos.x] == 2 {\n\t\t\t\tres.nearestSnakeDepth = int(math.Abs(float64(pos.x) - float64(startPos.x)))\n\t\t\t\tres.nearestSnakeDepth = int(math.Abs(float64(pos.y) - float64(startPos.y)))\n\t\t\t}\n\t\t}\n\n\t\tif !isValidPosition(pos, state) { continue }\n\n\t\t// Test if we found the closes food position\n\t\tif res.foodDepth == maxDepth {\n\t\t\tif matrix[pos.y][pos.x] == 3 {\n\t\t\t\tres.foodDepth = int(math.Abs(float64(pos.x) - float64(startPos.x)))\n\t\t\t\tres.foodDepth += int(math.Abs(float64(pos.y) - float64(startPos.y)))\n\t\t\t}\n\t\t}\n\n\t\t// Mark as visited\n\t\tmatrix[pos.y][pos.x] = 1\n\n\t\t// Add next elements to queue\n\t\taddPositionsToQueue(queue, matrix, pos, state, node.depth + 1)\n\n\t\t// Update max depth\n\t\tif node.depth + 1 > res.emptySpaceDepth {\n\t\t\tres.emptySpaceDepth = node.depth + 1\n\t\t}\n\t}\n\n\treturn res\n}", "func BFS(s string) {\n\tvar ll linklist.LL\n\n\tv := graphs.Gmap[s]\n\n\tv.C = 1\n\n\tll = ll.LlStart()\n\tll = ll.LlEnqueue(v)\n\n\tfor !ll.LlEmpty() {\n\t\tu := ll.LlPop()\n\t\tw := u.(*graphs.Vertex)\n\t\tt := w.Adj\n\n\t\tif t != nil {\n\t\t\tfor i := 0; i < len(t); i++ {\n\t\t\t\tif t[i].C == 0 {\n\t\t\t\t\tt[i].C = 1\n\t\t\t\t\tt[i].TI = w.TI + 1\n\t\t\t\t\tt[i].P = w\n\t\t\t\t\tll = ll.LlEnqueue(t[i])\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n}", "func BFS(g *Graph, startVertex *Vertex) map[int]*Vertex { //\n\n\tq := &queue{}\n\tvisited := map[int]*Vertex{}\n\tcurrent := startVertex\n\n\tfor {\n\n\t\tvisited[current.Key] = current\n\n\t\tfor _, v := range current.Vertices {\n\t\t\tif _, ok := visited[v.Key]; !ok {\n\t\t\t\tq.enqueue(v)\n\t\t\t}\n\t\t}\n\n\t\tcurrent = q.dequeue()\n\t\tif current == nil {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn visited\n}", "func (g *Graph) BFS(s int, t int) {\n\t// todo\n\tif s == t {\n\t\treturn\n\t}\n\tpre := make([]int, g.v)\n\tfor i := range pre {\n\t\tpre[i] = -1\n\t}\n\tvar queue []int\n\tvisited := make([]bool, g.v)\n\tqueue = append(queue, s)\n\tvisited[s] = true\n\tisFound := false\n\tfor len(queue) > 0 && !isFound {\n\t\ttop := queue[0]\n\t\tqueue = queue[1:]\n\t\tlinkedlist := g.adj[top]\n\t\tfor e := linkedlist.Front(); e != nil; e = e.Next() {\n\t\t\tk := e.Value.(int)\n\t\t\tif !visited[k] {\n\t\t\t\tpre[k] = top\n\t\t\t\tif k == t {\n\t\t\t\t\tisFound = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tqueue = append(queue, k)\n\t\t\t\tvisited[k] = true\n\t\t\t}\n\t\t}\n\t}\n\tif isFound {\n\t\tprintPrev(pre, s, t)\n\t} else {\n\t\tfmt.Printf(\"no path found from %d to %d\\n\", s, t)\n\t}\n}", "func (g *Graph) Bfs(root string, goal string, maxDepth int) (bool, *Vertex) {\n\n\t// Preconditions\n\tif len(root) == 0 {\n\t\tlog.Fatal(\"Root vertex is empty\")\n\t}\n\n\tif len(goal) == 0 {\n\t\tlog.Fatal(\"Goal vertex is empty\")\n\t}\n\n\tif maxDepth < 0 {\n\t\tlog.Fatalf(\"Maximum depth is invalid: %v\\n\", maxDepth)\n\t}\n\n\t// Set of the identifiers of discovered vertices\n\tdiscovered := set.New()\n\tdiscovered.Insert(root)\n\n\t// Queue to hold the vertices to visit\n\tq := queue.New()\n\tq.Enqueue(NewVertex(root, 0))\n\n\t// While there are vertices in the queue to check\n\tfor q.Len() > 0 {\n\n\t\t// Take a vertex from the queue\n\t\tv := q.Dequeue().(Vertex)\n\n\t\t// If the vertex is the goal, then return\n\t\tif v.Identifier == goal {\n\t\t\treturn true, &v\n\t\t}\n\n\t\t// Depth of any vertices adjacent to v\n\t\tnewDepth := v.Depth + 1\n\n\t\t// If the adjacent vertices are within the range\n\t\tif newDepth <= maxDepth {\n\n\t\t\t// Get a list of the adjacent vertices\n\t\t\tw := g.AdjacentTo(v.Identifier)\n\n\t\t\t// Walk through each of the adjacent vertices\n\t\t\tfor _, adjIdentifier := range w {\n\n\t\t\t\t// If the vertex hasn't been seen before\n\t\t\t\tif !discovered.Has(adjIdentifier) {\n\n\t\t\t\t\t// Add the identifier to the set of discovered identifiers\n\t\t\t\t\tdiscovered.Insert(adjIdentifier)\n\n\t\t\t\t\t// Put the vertex on the queue\n\t\t\t\t\tnewVertex := NewVertex(adjIdentifier, newDepth)\n\t\t\t\t\tnewVertex.Parent = &v\n\t\t\t\t\tq.Enqueue(newVertex)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// The goal was not found\n\treturn false, nil\n}", "func (al *AdjacencyList) BFS(v int) {\n\tal.Visited[v] = true\n\tqueue := al.List[v]\n\tal.TraversalPath = append(al.TraversalPath, v)\n\n\tfor len(queue) > 0 {\n\t\tal.TraversalPath = append(al.TraversalPath, queue[0])\n\t\tal.Visited[queue[0]] = true\n\n\t\tfor _, v := range al.List[queue[0]] {\n\t\t\tif _, ok := al.Visited[v]; ok {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif queue[len(queue)-1] == v {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tqueue = append(queue, v)\n\t\t}\n\n\t\tqueue = queue[1:]\n\t}\n}", "func wBfs(startNode *node) *node {\n\tvar bfsQueue []*node\n\tbfsQueue = append(bfsQueue, startNode)\n\tcurrNode := startNode\n\tvar endNode *node\n\tfor currNode.nodeType != \"end\" {\n\t\tcurrNode.visited = true\n\t\t//Sorting the weight array of the current node se the cheapest nodes are scanned first\n\t\tstart := 0\n\t\tfor i := 0; i < len(currNode.weights); i++ {\n\t\t\tmin := currNode.weights[start]\n\t\t\tminPos := start\n\t\t\tfor i := start; i < len(currNode.weights); i++ {\n\t\t\t\tnewMin := currNode.weights[i]\n\t\t\t\tif newMin < min {\n\t\t\t\t\tmin = newMin\n\t\t\t\t\tminPos = i\n\t\t\t\t}\n\t\t\t}\n\t\t\t//Swap the min and start in weight and adjacentNodes arrays\n\t\t\tcurrNode.weights[minPos] = currNode.weights[start]\n\t\t\tcurrNode.weights[start] = min\n\n\t\t\thelper := currNode.adjacentNodes[minPos]\n\t\t\tcurrNode.adjacentNodes[minPos] = currNode.adjacentNodes[start]\n\t\t\tcurrNode.adjacentNodes[start] = helper\n\n\t\t\tstart++\n\t\t}\n\t\tfor i := 0; i < len(currNode.adjacentNodes); i++ {\n\t\t\tif !currNode.adjacentNodes[i].visited {\n\t\t\t\tbfsQueue = append(bfsQueue, currNode.adjacentNodes[i])\n\t\t\t\tcurrNode.adjacentNodes[i].parrent = currNode\n\t\t\t}\n\t\t}\n\t\tcurrNode = bfsQueue[1]\n\t\tbfsQueue = bfsQueue[1:]\n\n\t\tif currNode.nodeType == \"end\" {\n\t\t\tendNode = currNode\n\t\t\tbreak\n\t\t}\n\t}\n\treturn endNode\n}", "func bfs(root, target *node) *vector.Vector {\n\tqueue := &nodeQueue{vector.Vector{}}\n\troot.num = 0\n\theap.Push(queue, root)\n\n\tfor queue.Len() > 0 {\n\t\tn := heap.Pop(queue).(*node)\n\t\tn.visited = true\n\n\t\tfmt.Printf(\"Visited %v\\n\", n.name)\n\n\t\tif n == target {\n\t\t\tpath := vector.Vector{}\n\t\t\tpath.Push(n)\n\t\t\tfor n.prev != nil {\n\t\t\t\tn = n.prev\n\t\t\t\tpath.Push(n)\n\t\t\t}\n\t\t\treturn &path\n\t\t}\n\t\tfor ei := range n.edges.Iter() {\n\t\t\te := ei.(*edge)\n\t\t\tif !e.to.visited {\n\t\t\t\te.to.prev = n\n\t\t\t\te.to.num = n.num + 1\n\t\t\t\theap.Push(queue, e.to)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil // never reached\n}", "func BFS(g Graph, id ID) []ID {\n\tif _, err := g.GetNode(id); err != nil {\n\t\treturn nil\n\t}\n\n\tq := []ID{id}\n\tvisited := make(map[ID]bool)\n\tvisited[id] = true\n\trs := []ID{id}\n\n\t// while Q is not empty:\n\tfor len(q) != 0 {\n\n\t\tu := q[0]\n\t\tq = q[1:len(q):len(q)]\n\n\t\t// for each vertex w adjacent to u:\n\t\tcmap, _ := g.GetTargets(u)\n\t\tfor _, w := range cmap {\n\t\t\t// if w is not visited yet:\n\t\t\tif _, ok := visited[w.ID()]; !ok {\n\t\t\t\tq = append(q, w.ID()) // Q.push(w)\n\t\t\t\tvisited[w.ID()] = true // label w as visited\n\n\t\t\t\trs = append(rs, w)\n\t\t\t}\n\t\t}\n\t\tpmap, _ := g.GetSources(u)\n\t\tfor _, w := range pmap {\n\t\t\t// if w is not visited yet:\n\t\t\tif _, ok := visited[w.ID()]; !ok {\n\t\t\t\tq = append(q, w.ID()) // Q.push(w)\n\t\t\t\tvisited[w.ID()] = true // label w as visited\n\n\t\t\t\trs = append(rs, w.ID())\n\t\t\t}\n\t\t}\n\t}\n\n\treturn rs\n}", "func (g *bfs) BFStraverse(n *graph.Node) {\n\t// Create a queue for BFS\n\tqueue := make([]*graph.Node, 0, len(g.Nodes))\n\n\tqueue = append(queue, n)\n\tvisited := make(map[*graph.Node]bool)\n\n\tfor len(queue) > 0 {\n\t\tnode := queue[0]\n\t\t//print and the pop out the Node from the queue\n\t\tfmt.Println(node)\n\t\tqueue = queue[1:]\n\t\t// add the Node to visited map, ensuring that it will not be added again to the queue\n\t\t// this prevents to loop endlesssly through the nodes\n\t\tvisited[node] = true\n\n\t\t//edges are the links to other Nodes of the searching Node\n\t\tfor _, edge := range g.Edges[node] {\n\t\t\tif !visited[edge.ToNode] {\n\t\t\t\tnewNode := edge.ToNode\n\t\t\t\tqueue = append(queue, newNode)\n\t\t\t\tvisited[newNode] = true\n\t\t\t}\n\n\t\t}\n\n\t}\n}", "func printGraphBFS(adjMatrix [7][7]int) {\n\tv := len(adjMatrix)\n\tvisited := make([]bool, v)\n\t//This loop ensures working on edge between vertices 5-6\n\tfor i := 0; i < v; i++ {\n\t\tif visited[i] == false {\n\t\t\tprintBfsHelper(adjMatrix, visited, i)\n\t\t}\n\t}\n}", "func bfs(adj [][]bool, begin, end point) int {\n\tfr := new(frontier)\n\tvisited := make(map[point]bool)\n\theap.Push(fr, step{begin, 0})\n\tfor fr.Len() != 0 {\n\t\tnext := heap.Pop(fr).(step)\n\t\tif next.point == end {\n\t\t\treturn next.steps\n\t\t}\n\t\tfor _, p := range neighbors(adj, next.point) {\n\t\t\tif !visited[p] {\n\t\t\t\theap.Push(fr, step{p, next.steps + 1})\n\t\t\t\tvisited[p] = true\n\t\t\t}\n\t\t}\n\t}\n\treturn -1\n}", "func BreadthFirstSearch() {\n\ttree := buildBinaryTree()\n\tqueue := &NodeQueue{}\n\n\tqueue.Enqueue(tree.Head)\n\n\tfor queue.Depth() > 0 {\n\t\tlevel := queue.Depth()\n\n\t\tfor level > 0 {\n\t\t\tnode := queue.Dequeue()\n\t\t\tfmt.Printf(\"%d \", node.Value)\n\n\t\t\tif node.Left != nil {\n\t\t\t\tqueue.Enqueue(node.Left)\n\t\t\t}\n\n\t\t\tif node.Right != nil {\n\t\t\t\tqueue.Enqueue(node.Right)\n\t\t\t}\n\n\t\t\tlevel--\n\t\t}\n\n\t\tfmt.Println(\"\")\n\t}\n}", "func (gph *Graph)bfsLevelNode(source int) {\n\tcount := gph.count\n\tvisited := make([]bool, count)\n\tlevel := make([]int, count)\n\tvisited[source] = true\n\tque := queue.New()\n\n\tque.Enqueue(source)\n\tlevel[source] = 0\n\tfmt.Println(\"\\nNode - Level\")\n\n\tfor que.Len() > 0 {\n\t\tcurr := que.Dequeue().(int)\n\t\tdepth := level[curr]\n\t\thead := gph.Edges[curr]\n\t\tfmt.Println(curr ,\" - \" , depth)\n\t\tfor head != nil {\n\t\t\tif (visited[head.destination] == false) {\n\t\t\t\tvisited[head.destination] = true\n\t\t\t\tque.Enqueue(head.destination)\n\t\t\t\tlevel[head.destination] = depth + 1\n\t\t\t}\n\t\t\thead = head.next\n\t\t}\n\t}\n}", "func (g *MatrixGraph) BFS(source string, target string) ([]string, error) {\n\tres := g.bfs(source, target)\n\titerate := true\n\tchain := make([]string, 0)\n\tparent := target\n\tchain = append(chain, target)\n\tfor iterate {\n\t\tchild, ok := res[parent]\n\t\tif ok {\n\t\t\tchain = append(chain, child)\n\t\t\tparent = child\n\t\t} else {\n\t\t\titerate = false\n\t\t}\n\t}\n\tif len(chain) < 2 {\n\t\treturn nil, fmt.Errorf(\"Did not find chain\")\n\t}\n\t// reverse chain\n\tfor i := len(chain)/2 - 1; i >= 0; i-- {\n\t\topp := len(chain) - 1 - i\n\t\tchain[i], chain[opp] = chain[opp], chain[i]\n\t}\n\treturn chain, nil\n}", "func BFS(T *RTree, function func(*node)) {\n\tQ := make([]*node, 0)\n\tQ = append(Q, T.Root)\n\n\tfor len(Q) > 0 {\n\t\tn := Q[0]\n\t\tQ = Q[1:]\n\n\t\tif n == nil {\n\t\t\tcontinue\n\t\t}\n\t\tif n.Children != nil {\n\t\t\tQ = append(Q, n.Children)\n\t\t}\n\t\tif n.Next != nil {\n\t\t\tQ = append(Q, n.Next)\n\t\t}\n\t\tfunction(n)\n\t}\n}", "func traversalBFS(current []Node, filterFn func(node Node) (gotoNextLayer bool), processFn func(node Node) (gotoNextLayer bool), isRoot bool) (gotoNextLayer bool) {\n\tif len(current) == 0 {\n\t\treturn false\n\t}\n\t// Step 1: brothers layer\n\tnextBrothers := []Node{}\n\tfor _, node := range current {\n\t\t// filter root\n\t\tif isRoot {\n\t\t\tif !filterFn(node) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t\tif !processFn(node) {\n\t\t\treturn false\n\t\t}\n\t\t// filter brothers\n\t\tnextBrothers = append(nextBrothers, node)\n\t}\n\n\t// Step 2: children layer\n\tnextChildren := []Node{}\n\t// filter children\n\tfor _, node := range nextBrothers {\n\t\t// Scan node for nodes to include.\n\t\tnextChildren = append(nextChildren, filterChildren(node, node.LeftNodes(), filterFn)...)\n\t\tnextChildren = append(nextChildren, filterChildren(node, node.MiddleNodes(), filterFn)...)\n\t\tnextChildren = append(nextChildren, filterChildren(node, node.RightNodes(), filterFn)...)\n\t}\n\ttraversalBFS(nextChildren, filterFn, processFn, false)\n\treturn true\n}", "func printBFS(root *Node) {\n if root != nil {\n var qCurrent *NodeQ\n var qNext *NodeQ\n var nCurrent *Node\n\n qCurrent = enqueue(root, qCurrent)\n\n // overall\n for {\n // current row\n for {\n // exit condition\n if qCurrent == nil {\n break\n }\n\n // current item\n nCurrent, qCurrent = dequeue(qCurrent)\n\n // print the item.\n fmt.Println(\"> BST >\", (*nCurrent).val)\n\n // enqueue the children. if not nil\n if (*nCurrent).left != nil {\n qNext = enqueue((*nCurrent).left, qNext)\n }\n if (*nCurrent).right != nil {\n qNext = enqueue((*nCurrent).right, qNext)\n }\n }\n\n // check the next queue.\n if qNext == nil {\n break\n } else {\n qCurrent = qNext\n qNext = nil\n fmt.Println(\"\")\n }\n }\n }\n}", "func (n *Node) BFS(fn func(*Node)) {\n\tl := list.New()\n\tl.PushBack(n)\n\tfor e := l.Front(); e != nil; e = e.Next() {\n\t\tele := e.Value.(*Node)\n\t\tfn(ele)\n\t\tfor _, c := range ele.Children {\n\t\t\tl.PushBack(c)\n\t\t}\n\t}\n}", "func BTreeBFS(root *TreeNode) (ret []int) {\n\t// 用数组模拟队列\n\tque := []*TreeNode{}\n\tque = append(que, root)\n\n\tfor len(que) > 0 {\n\t\ts := len(que) // 用来控制每一层的遍历\n\t\tfor i := 0; i < s; i++ {\n\t\t\tcur := que[i]\n\t\t\tret = append(ret, cur.Val)\n\n\t\t\tif cur.Left != nil {\n\t\t\t\tque = append(que, cur.Left)\n\t\t\t}\n\n\t\t\tif cur.Right != nil {\n\t\t\t\tque = append(que, cur.Right)\n\t\t\t}\n\t\t}\n\n\t\tque = que[s:] // 弹出已经取出的节点\n\t}\n\n\treturn ret\n}", "func (g AdjacencyList) BreadthFirst(start NI, opt ...TraverseOption) {\n\tcf := &config{start: start}\n\tfor _, o := range opt {\n\t\to(cf)\n\t}\n\tf := cf.fromList\n\tswitch {\n\tcase f == nil:\n\t\te := NewFromList(len(g))\n\t\tf = &e\n\tcase f.Paths == nil:\n\t\t*f = NewFromList(len(g))\n\t}\n\trp := f.Paths\n\t// the frontier consists of nodes all at the same level\n\tfrontier := []NI{cf.start}\n\tlevel := 1\n\t// assign path when node is put on frontier\n\trp[cf.start] = PathEnd{Len: level, From: -1}\n\tfor {\n\t\tf.MaxLen = level\n\t\tlevel++\n\t\tvar next []NI\n\t\tif cf.rand == nil {\n\t\t\tfor _, n := range frontier {\n\t\t\t\t// visit nodes as they come off frontier\n\t\t\t\tif cf.nodeVisitor != nil {\n\t\t\t\t\tcf.nodeVisitor(n)\n\t\t\t\t}\n\t\t\t\tif cf.okNodeVisitor != nil {\n\t\t\t\t\tif !cf.okNodeVisitor(n) {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor _, nb := range g[n] {\n\t\t\t\t\tif rp[nb].Len == 0 {\n\t\t\t\t\t\tnext = append(next, nb)\n\t\t\t\t\t\trp[nb] = PathEnd{From: n, Len: level}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else { // take nodes off frontier at random\n\t\t\tfor _, i := range cf.rand.Perm(len(frontier)) {\n\t\t\t\tn := frontier[i]\n\t\t\t\t// remainder of block same as above\n\t\t\t\tif cf.nodeVisitor != nil {\n\t\t\t\t\tcf.nodeVisitor(n)\n\t\t\t\t}\n\t\t\t\tif cf.okNodeVisitor != nil {\n\t\t\t\t\tif !cf.okNodeVisitor(n) {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor _, nb := range g[n] {\n\t\t\t\t\tif rp[nb].Len == 0 {\n\t\t\t\t\t\tnext = append(next, nb)\n\t\t\t\t\t\trp[nb] = PathEnd{From: n, Len: level}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif len(next) == 0 {\n\t\t\tbreak\n\t\t}\n\t\tfrontier = next\n\t}\n}", "func (level *Level) bfsearch(start Pos) {\n\tedge := make([]Pos, 0, 8)\n\tedge = append(edge, start)\n\tvisited := make(map[Pos]bool)\n\tvisited[start] = true\n\tlevel.Debug = visited\n\n\tfor len(edge) > 0 {\n\t\tcurrent := edge[0]\n\t\tedge = edge[1:]\n\t\tfor _, next := range getNeighbours(level, current) {\n\t\t\tif !visited[next] {\n\t\t\t\tedge = append(edge, next)\n\t\t\t\tvisited[next] = true\n\t\t\t}\n\t\t}\n\t}\n}", "func (t *Tree) BreadthFirstSearch() []interface{} {\n\tvar nodes []interface{}\n\n\t// queue to store visited nodes\n\tq := queue.New(binarytrees.Node{})\n\n\tcurrentNode := *t.Root\n\tq.Enqueue(currentNode)\n\n\tfor !q.Empty() {\n\t\tcurrentNode = q.Dequeue().(binarytrees.Node)\n\t\tnodes = append(nodes, currentNode.Value.Key())\n\t\tif currentNode.Left != nil {\n\t\t\tq.Enqueue(*currentNode.Left)\n\t\t}\n\t\tif currentNode.Right != nil {\n\t\t\tq.Enqueue(*currentNode.Right)\n\t\t}\n\t}\n\treturn nodes\n}", "func (bst *BinarySearchTree) breadthFirstSearch() (list []int) {\n\tqueue := []*Node{}\n\tcurrNode := bst.root\n\n\tqueue = append(queue, currNode)\n\n\tfor len(queue) > 0 {\n\t\tcurrNode, queue = queue[0], queue[1:]\n\t\tlist = append(list, currNode.value)\n\n\t\tif currNode.left != nil {\n\t\t\tqueue = append(queue, currNode.left)\n\t\t}\n\n\t\tif currNode.right != nil {\n\t\t\tqueue = append(queue, currNode.right)\n\t\t}\n\t}\n\n\treturn\n}", "func (t *Tree) BFS(f func(n *Node) bool) {\n\tif t.root == nil {\n\t\treturn\n\t}\n\n\tsearchQ := queue.New()\n\tsearchQ.EnQueue(t.root)\n\n\tfor !searchQ.IsEmpty() {\n\t\tnode := searchQ.DeQueue().(*Node)\n\t\tif node.Left != nil {\n\t\t\tsearchQ.EnQueue(node.Left)\n\t\t}\n\n\t\tif node.Right != nil {\n\t\t\tsearchQ.EnQueue(node.Right)\n\t\t}\n\n\t\tif node == nil || f(node) {\n\t\t\tbreak\n\t\t}\n\t}\n}", "func (t *Tree) BFS(fn func(*Node)) {\n\tt.Root.BFS(fn)\n}", "func (gph *Graph) BfsLevelNode(source int) {\n\tcount := gph.count\n\tvisited := make([]bool, count)\n\tlevel := make([]int, count)\n\tvisited[source] = true\n\tque := new(Queue)\n\tque.Add(source)\n\tlevel[source] = 0\n\tfmt.Println(\"\\nNode - Level\")\n\tfor que.Len() > 0 {\n\t\tcurr := que.Remove().(int)\n\t\tdepth := level[curr]\n\t\thead := gph.Edges[curr]\n\t\tfmt.Println(curr, \" - \", depth)\n\t\tfor head != nil {\n\t\t\tif !visited[head.dest] {\n\t\t\t\tvisited[head.dest] = true\n\t\t\t\tque.Add(head.dest)\n\t\t\t\tlevel[head.dest] = depth + 1\n\t\t\t}\n\t\t\thead = head.next\n\t\t}\n\t}\n}", "func totalBFS(data set, root int) int64 {\n\tn := int64(1) // node count\n\tr := int64(0) // repeated connections\n\n\tvar Q []int\n\tvar u, v int\n\n\tQ = append(Q, root)\n\tfor len(Q) > 0 {\n\t\tQ, u = Q[1:], Q[0] // dequeue\n\n\t\tfor i := 0; i < len(data[u].adj); i++ {\n\t\t\tv = data[u].adj[i]\n\n\t\t\tif data[v].color == 0 {\n\t\t\t\tdata[v].color = 1\n\n\t\t\t\tQ = append(Q, v) // enqueue\n\n\t\t\t\tn++ // new node\n\t\t\t} else if data[v].color == 1 {\n\t\t\t\tr++ // count repeated connection\n\t\t\t}\n\t\t}\n\n\t\tdata[u].color = 2\n\t}\n\n\t//fmt.Printf(\"%d, %d\\n\", n, r)\n\n\t// calculate the total\n\ttotal := ((n - 1) * n * (n + 1)) / 3\n\ttotal += n * (n - 1) * r\n\n\treturn total\n}", "func (g *bridges) BFStraverse(n *graph.Node) int {\n\t// Create a queue for BFS\n\tqueue := make([]*graph.Node, 0, len(g.Nodes))\n\n\tqueue = append(queue, n)\n\tvisited := make(map[*graph.Node]bool)\n\n\tfor len(queue) > 0 {\n\t\tnode := queue[0]\n\t\t//pop out the Node from the queue\n\t\tqueue = queue[1:]\n\t\t// add the Node to visited map, ensuring that it will not be added again to the queue\n\t\t// this prevents to loop endlesssly through the nodes\n\t\tvisited[node] = true\n\n\t\t//edges are the links to other Nodes of the searching Node\n\t\tfor _, edge := range g.Edges[node] {\n\t\t\tif !visited[edge.ToNode] {\n\t\t\t\tnewNode := edge.ToNode\n\t\t\t\tqueue = append(queue, newNode)\n\t\t\t\tvisited[newNode] = true\n\t\t\t}\n\n\t\t}\n\n\t}\n\treturn len(visited)\n}", "func (g *Graph) BFS() map[int]int {\n\tdist := make(map[int]int)\n\tnodes := make([]int, 0, len(g.Nodes))\n\n\tdist[g.Root] = 0\n\tnodes = append(nodes, g.Root)\n\n\t// We go through nodes while adding node.\n\tfor i := 0; i < len(nodes); i++ {\n\t\tnode := nodes[i]\n\t\tfor _, neighbor := range g.Nodes[node] {\n\t\t\t_, ok := dist[neighbor]\n\t\t\tif !ok {\n\t\t\t\tdist[neighbor] = dist[node] + 1 // Can add edge weight if using a weighted graph\n\t\t\t\tnodes = append(nodes, neighbor)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn dist\n}", "func (m *Map) Bfs(loc Location, obj Item) LocDir {\n\tisGoal := func(curLoc Location) bool {\n\t\tif m.Item(curLoc) == obj {\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t}\n\t//ret acts as the default return when either nothing is found\n\t//or the goal state is the cell.\n\tret := LocDir{loc, NoMovement}\n\tret.Loc = -1\n\tret.Dir = NoMovement\n\n\tvar depth int\n\tfrontier := new(Queue) // make this Queue a type of LocDir\n\tvar inFrontier = make(map[Location]bool)\n\tvar explored = make(map[Location]bool) // the keys are only locations\n\n\tif isGoal(loc) {\n\t\treturn ret\n\t}\n\n\tfrontier.Push(ret) // frontier is queue of LocDir\n\tinFrontier[loc] = true // keys to inFrontier are simply locations\n\t// I'm not sure whether I should set the keys to frontier to be a LocDir\n\t// as well.\n\n\tfor {\n\t\tif frontier.Len() == 0 || depth > 10 {\n\t\t\treturn ret\n\t\t}\n\n\t\tcurLoc := frontier.Pop().(LocDir)\n\t\tinFrontier[curLoc.Loc] = false\n\t\texplored[curLoc.Loc] = true\n\n\t\t// Loop over adjacent Locations, action is a LocDir structure\n\t\tfor _, action := range m.Adjacent(curLoc.Loc) {\n\t\t\t//if child not in explored or frontier\n\t\t\tif !explored[action.Loc] || !inFrontier[action.Loc] {\n\t\t\t\tif isGoal(action.Loc) {\n\t\t\t\t\treturn action\n\t\t\t\t}\n\t\t\t\tfrontier.Push(action)\n\t\t\t\tinFrontier[action.Loc] = true\n\t\t\t}\n\t\t}\n\t\tdepth++\n\t}\n\treturn ret\n}", "func (g LabeledAdjacencyList) BreadthFirst(start NI, visit func(NI)) {\n\tv := bits.New(len(g))\n\tv.SetBit(int(start), 1)\n\tvisit(start)\n\tvar next []NI\n\tfor frontier := []NI{start}; len(frontier) > 0; {\n\t\tfor _, n := range frontier {\n\t\t\tfor _, nb := range g[n] {\n\t\t\t\tif v.Bit(int(nb.To)) == 0 {\n\t\t\t\t\tv.SetBit(int(nb.To), 1)\n\t\t\t\t\tvisit(nb.To)\n\t\t\t\t\tnext = append(next, nb.To)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfrontier, next = next, frontier[:0]\n\t}\n}", "func (h *BSTHandler) BFSTraversal() []int {\n\th.queue.Enqeue(h.node)\n\t// hh := h.height(h.node)\n\tfor !h.queue.Empty() {\n\t\tfor h.queue.Len() > 0 {\n\t\t\tnode := h.queue.Deqeue().(*Node)\n\t\t\tif node.left != nil {\n\t\t\t\th.queue.Enqeue(node.left)\n\t\t\t}\n\t\t\tif h.node.right != nil {\n\t\t\t\th.queue.Enqeue(node.right)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn h.levelOrderSet\n}", "func (pr *PathRange) BreadthFirstMap(nb Pather, sources []gruid.Point, maxCost int) []Node {\n\tmax := pr.Rg.Size()\n\tw, h := max.X, max.Y\n\tif pr.BfMap == nil {\n\t\tpr.BfMap = make([]int, w*h)\n\t\tpr.BfQueue = make([]Node, w*h)\n\t} else {\n\t\tfor i := range pr.BfMap {\n\t\t\tpr.BfMap[i] = 0\n\t\t}\n\t}\n\tvar qstart, qend int\n\tpr.BfUnreachable = maxCost + 1\n\tfor _, p := range sources {\n\t\tif !p.In(pr.Rg) {\n\t\t\tcontinue\n\t\t}\n\t\tpr.BfMap[pr.idx(p)] = 1\n\t\tpr.BfQueue[qend] = Node{P: p, Cost: 0}\n\t\tqend++\n\t}\n\tfor qstart < qend {\n\t\tn := pr.BfQueue[qstart]\n\t\tqstart++\n\t\tif n.Cost >= maxCost {\n\t\t\tcontinue\n\t\t}\n\t\tcidx := pr.idx(n.P)\n\t\tcost := pr.BfMap[cidx]\n\t\tfor _, q := range nb.Neighbors(n.P) {\n\t\t\tif !q.In(pr.Rg) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tnidx := pr.idx(q)\n\t\t\tif pr.BfMap[nidx] == 0 {\n\t\t\t\tpr.BfMap[nidx] = cost + 1\n\t\t\t\tpr.BfQueue[qend] = Node{P: q, Cost: cost}\n\t\t\t\tqend++\n\t\t\t}\n\t\t}\n\t}\n\treturn pr.BfQueue[0:qend]\n}", "func dijkstra(origin *Vertex, destination *Vertex, v []*Vertex, e []*Edge) []string {\r\n\t// Forcing our vertices to start at distance 0 (in case of the algorithm running multiple times on the same data)\r\n\tfor _, vertex := range v {\r\n\t\tvertex.Distance = 0\r\n\t}\r\n\r\n\t// Initialisation of various Queues\r\n\tqueue := VertexQueue{Elements: []*Vertex{origin}}\r\n\tvisited := VertexQueue{Elements: []*Vertex{}}\r\n\tnode, err := &Vertex{}, errors.New(\"\")\r\n\r\n\t// Iterate over all of the elements of the queue until there are no more vertices (max O(len(v)))\r\n\tfor queue.Size() > 0 {\r\n\t\t// Always work on what is closest to the current vertex in the queue.\r\n\t\tnode, err = queue.Pop()\r\n\t\tif err != nil {\r\n\t\t\tfmt.Println(errors.New(\"no nodes in queue\"))\r\n\t\t\tos.Exit(3)\r\n\t\t}\r\n\r\n\t\t// Avoid repetitions\r\n\t\tvisited.Append(node)\r\n\r\n\t\t// Filtering out the edges that are linked to the current node\r\n\t\tfilteredEdges := make([]*Edge, 0, len(e))\r\n\t\tfor _, edge := range e {\r\n\t\t\tif edge.Start.Label == node.Label || edge.End.Label == node.Label {\r\n\t\t\t\tfilteredEdges = append(filteredEdges, edge)\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Sorting the edges by distance\r\n\t\tsort.Slice(filteredEdges, func(i, j int) bool {\r\n\t\t\treturn filteredEdges[i].Value > filteredEdges[j].Value\r\n\t\t})\r\n\r\n\t\t// If the vertex is a well\r\n\t\tif len(filteredEdges) == 1 &&\r\n\t\t\t(filteredEdges[0].Start != origin && filteredEdges[0].End != destination &&\r\n\t\t\t\tfilteredEdges[0].Start != destination && filteredEdges[0].End != origin) {\r\n\t\t\t// Set the node to be unreachable by the backtrace\r\n\t\t\tfor _, edge := range e {\r\n\t\t\t\tif edge.Start == filteredEdges[0].Start || edge.End == filteredEdges[0].Start {\r\n\t\t\t\t\tfilteredEdges[0].Start.Distance = math.MaxInt32\r\n\t\t\t\t\tbreak\r\n\t\t\t\t} else if edge.End == filteredEdges[0].End || edge.Start == filteredEdges[0].End {\r\n\t\t\t\t\tfilteredEdges[0].End.Distance = math.MaxInt32\r\n\t\t\t\t\tbreak\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\t// Iterate on all available edges.\r\n\t\t\tfor _, edge := range filteredEdges {\r\n\t\t\t\t// Determine the actual direction of the edge.\r\n\t\t\t\tstart, end := &Vertex{}, &Vertex{}\r\n\t\t\t\tif edge.Start.Label == node.Label {\r\n\t\t\t\t\tstart = edge.Start\r\n\t\t\t\t\tend = edge.End\r\n\t\t\t\t} else {\r\n\t\t\t\t\tstart = edge.End\r\n\t\t\t\t\tend = edge.Start\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// If end distance not yet set.\r\n\t\t\t\tif end.Label != origin.Label && ((end.Distance == 0 && end.Distance < start.Distance+edge.Value) || (end.Distance > start.Distance+edge.Value)) {\r\n\t\t\t\t\tend.Distance = start.Distance + edge.Value\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// If arrival at destination, empty queue.\r\n\t\t\t\tif node.Label == destination.Label {\r\n\t\t\t\t\tqueue.DequeueWhere(func(v Vertex) bool { return true })\r\n\t\t\t\t\t// Otherwise append all further nodes to the queue.\r\n\t\t\t\t} else if !visited.Contains(*end) && ((queue.Contains(*end) && queue.FilterWhere(func(v Vertex) bool { return v.Label == end.Label })[0].Distance > end.Distance) || !queue.Contains(*end)) {\r\n\t\t\t\t\tqueue.Append(end)\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tsort.Slice(queue.Elements, func(i, j int) bool {\r\n\t\t\treturn queue.Elements[i].Distance > queue.Elements[j].Distance\r\n\t\t})\r\n\t}\r\n\r\n\t// Path of labels for the trace.\r\n\tpath := []*Vertex{destination}\r\n\tqueue = VertexQueue{Elements: []*Vertex{destination}}\r\n\tvisited = VertexQueue{Elements: []*Vertex{}}\r\n\tnode = &Vertex{}\r\n\r\n\t// Backtrace\r\n\tfor queue.Size() > 0 {\r\n\t\tnode, err = queue.Pop()\r\n\t\tif err != nil {\r\n\t\t\tfmt.Println(errors.New(\"no nodes in queue\"))\r\n\t\t\tos.Exit(3)\r\n\t\t}\r\n\t\tvisited.Append(node)\r\n\t\tfilteredEdges := make([]*Edge, 0, len(e))\r\n\t\tfor _, edge := range e {\r\n\t\t\tif (edge.Start.Label == node.Label || edge.End.Label == node.Label) && edge.Value != math.MaxInt32 {\r\n\t\t\t\tfilteredEdges = append(filteredEdges, edge)\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tsort.Slice(filteredEdges, func(i, j int) bool {\r\n\t\t\treturn filteredEdges[i].Value > filteredEdges[j].Value\r\n\t\t})\r\n\r\n\t\tfor _, edge := range filteredEdges {\r\n\t\t\tstart, end := &Vertex{}, &Vertex{}\r\n\t\t\tif edge.Start.Label == node.Label {\r\n\t\t\t\tstart = edge.Start\r\n\t\t\t\tend = edge.End\r\n\t\t\t} else {\r\n\t\t\t\tstart = edge.End\r\n\t\t\t\tend = edge.Start\r\n\t\t\t}\r\n\r\n\t\t\tif node.Label == origin.Label {\r\n\t\t\t\tqueue.DequeueWhere(func(_ Vertex) bool { return true })\r\n\t\t\t} else if !visited.Contains(*end) && !queue.Contains(*end) && start.Distance-end.Distance == edge.Value {\r\n\t\t\t\t// If the node hasn't been visited and isn't planned for visit yet, and that the edge value corresponds to the delta of the distance from the start.\r\n\t\t\t\tqueue.Append(end)\r\n\t\t\t\tpath = append(path, end)\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tsort.Slice(queue.Elements, func(i, j int) bool {\r\n\t\t\treturn queue.Elements[i].Distance > queue.Elements[j].Distance\r\n\t\t})\r\n\t}\r\n\r\n\t// Reverse the path to obtain the path in the right direction.\r\n\tfor i, j := 0, len(path)-1; i < j; i, j = i+1, j-1 {\r\n\t\tpath[i], path[j] = path[j], path[i]\r\n\t}\r\n\r\n\t// Format to string\r\n\tresult := []string{}\r\n\tfor _, vertex := range path {\r\n\t\tresult = append(result, vertex.Label)\r\n\t}\r\n\treturn result\r\n}", "func (b *BFS) Search(start int) {\n\tqueue := make([]int, 0)\n\tqueue = append(queue, start)\n\tb.discovered[start] = true\n\n\tfor len(queue) != 0 {\n\t\tv := queue[0]\n\t\tqueue = queue[1:]\n\t\tif !b.processed[v] {\n\t\t\tb.t.ProcessVertexEarly(v)\n\t\t\tb.processed[v] = true\n\t\t}\n\n\t\tp := b.g.edges[v]\n\t\tfor p != nil {\n\t\t\ty := p.y\n\t\t\tif b.processed[y] || b.g.directed {\n\t\t\t\tb.t.ProcessEdge(v, y)\n\t\t\t}\n\t\t\tif !b.discovered[y] {\n\t\t\t\tqueue = append(queue, y)\n\t\t\t\tb.discovered[y] = true\n\t\t\t}\n\t\t\tp = p.next\n\t\t}\n\t\tb.t.ProcessVertexLate(v)\n\t}\n}", "func BFS(root *Node, i int) *Node {\n\n\tif root == nil {\n\t\treturn nil\n\t}\n\n\tif root.Val == i {\n\t\treturn root\n\t}\n\n\troot.Visit()\n\n\tq := Queue{}\n\tq.Enqueue(root)\n\n\tfor !q.IsEmpty() {\n\n\t\tn := q.Dequeue()\n\t\tn.Visit()\n\n\t\tfor _, child := range n.Children {\n\n\t\t\tif child.Visited {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif child.Val == i {\n\t\t\t\treturn child\n\t\t\t}\n\n\t\t\tchild.Visit()\n\t\t\tq.Enqueue(child)\n\t\t}\n\t}\n\n\treturn nil\n}", "func dfs(g *Graph, current int, visited set, visitFunction func(int)) {\n if _, seen := visited[current]; seen {\n return\n }\n\n visited[current] = true\n visitFunction(current)\n\n for neighbour := range g.adjList[current] {\n dfs(g, neighbour, visited, visitFunction)\n }\n}", "func SPBF(g *gs.Graph, src, dst *gs.Vertex) (string, bool) {\n\tsrc.StampD = 0\n\n\t// for each vertex u ∈ g.V\n\tvertices := g.GetVertices()\n\tfor _, vtx := range *vertices {\n\t\tif vtx == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\t// relax\n\t\tedges := g.GetEdges()\n\t\tfor _, edge := range *edges {\n\t\t\tif edge == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\ta := edge.(*gs.Edge).Dst.StampD\n\t\t\tb := edge.(*gs.Edge).Src.StampD\n\t\t\tc := edge.(*gs.Edge).Weight\n\n\t\t\tif a > b+int64(c) {\n\t\t\t\tedge.(*gs.Edge).Dst.StampD = b + int64(c)\n\t\t\t}\n\n\t\t\t// Update Prev\n\t\t\tif edge.(*gs.Edge).Dst.Prev.Len() == 0 {\n\t\t\t\tedge.(*gs.Edge).Dst.Prev.PushBack(edge.(*gs.Edge).Src)\n\t\t\t} else {\n\t\t\t\tex := false\n\t\t\t\tpvs := edge.(*gs.Edge).Dst.Prev\n\t\t\t\tfor _, v := range *pvs {\n\t\t\t\t\tif v == nil {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\t// if fmt.Sprintf(\"%v\", v.(*gs.Vertex).ID) == fmt.Sprintf(\"%v\", edge.(*gs.Edge).Src.ID) {\n\t\t\t\t\tif v.(*gs.Vertex) == edge.(*gs.Edge).Src {\n\t\t\t\t\t\tex = true\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ex == false {\n\t\t\t\t\tedge.(*gs.Edge).Dst.Prev.PushBack(edge.(*gs.Edge).Src)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tedges := g.GetEdges()\n\tfor _, edge := range *edges {\n\t\tif edge == nil {\n\t\t\tcontinue\n\t\t}\n\t\ta := edge.(*gs.Edge).Dst.StampD\n\t\tb := edge.(*gs.Edge).Src.StampD\n\t\tc := edge.(*gs.Edge).Weight\n\n\t\tif a > b+int64(c) {\n\t\t\treturn \"There is negative weighted cycle (No Shortest Path)\", false\n\t\t}\n\t}\n\tresult := slice.NewSequence()\n\tTrackSPBF(g, src, dst, dst, result)\n\n\tvar rs string\n\tfor _, v := range *result {\n\t\tif v == nil {\n\t\t\tcontinue\n\t\t}\n\t\trs += fmt.Sprintf(\"%v(=%v) → \", v.(*gs.Vertex).ID, v.(*gs.Vertex).StampD)\n\t}\n\n\treturn rs[:len(rs)-5], true\n}", "func (t *TrieNode) BFS(r *[]string, amount int) {\n\tq := make([]*TrieNode, 0)\n\tq = append(q, t)\n\tfor len(q) != 0 {\n\t\t// pop first element from the queue\n\t\tn := q[0]\n\t\tq = q[1:]\n\n\t\t// add all next nodes to the queue\n\t\tfor _, m := range n.next {\n\t\t\tif m != nil {\n\t\t\t\tq = append(q, m)\n\t\t\t}\n\t\t}\n\n\t\t// don't add results smaller than 3 chars\n\t\tif n.prev == nil || n.prev.prev == nil || n.prev.prev.prev == nil {\n\t\t\tcontinue\n\t\t}\n\t\tif len(n.scenes) == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\t// add string to the result\n\t\t*r = append(*r, n.String())\n\t\tamount--\n\t\tif amount == 0 {\n\t\t\treturn\n\t\t}\n\t}\n}", "func NewBFS(g Graph, source int) BFS {\n\t// create the object\n\tbfs := BFS{}\n\tbfs.marked = make([]bool, g.V())\n\tbfs.edgeTo = make([]int, g.V())\n\tbfs.source = source\n\t// execute the search\n\tbfs.search(g, source)\n\t// return the completed object\n\treturn bfs\n}", "func searchPath(nodes vector.Vector, from, to int) {\n\tpath := bfs(nodes[from].(*node), nodes[to].(*node))\n\n\tfor path.Len() > 0 {\n\t\tfmt.Printf(\"-> %v \", path.Pop().(*node).name)\n\t}\n\tfmt.Printf(\"\\n -- Done --\\nCleaning up..\\n\")\n\tclearNodes(nodes)\n}", "func BFS() []int {\n\tvar data []int\n\tfor i := range bt {\n\t\tif bt[i] != nil {\n\n\t\t\tdata = append(data, bt[i].value)\n\t\t}\n\t}\n\treturn data\n}", "func bfsPush(root *node, indexes [][]int32) {\n\tif len(indexes) == 0 || root == nil {\n\t\treturn\n\t}\n\tqueue := []*node{root}\n\tfor _, curNodeValues := range indexes {\n\t\tleftValue, rightValue := curNodeValues[0], curNodeValues[1]\n\t\tif leftValue != -1 {\n\t\t\troot.left = &node{leftValue, nil, nil}\n\t\t\tqueue = append(queue, root.left)\n\t\t}\n\t\tif rightValue != -1 {\n\t\t\troot.right = &node{rightValue, nil, nil}\n\t\t\tqueue = append(queue, root.right)\n\t\t}\n\t\tqueue = queue[1:]\n\t\tif len(queue) == 0 {\n\t\t\treturn\n\t\t}\n\t\troot = queue[0]\n\t}\n}", "func (t *treeNode) BreadthFirstTraversal() []int {\n\tif t == nil {\n\t\treturn nil\n\t}\n\tvar queue []*treeNode\n\tqueue = append(queue, t)\n\tvar res []int\n\tres = levelOrder(queue, res)\n\tfmt.Println(res)\n\treturn res\n}", "func bfsBlizzardWalk(bz blizzards, start, end int) (blizzards, int) {\n\tsteps := []int{0, -bz.w, bz.w, -1, 1} // wait, up, down, left, right\n\tstack := map[int]struct{}{start: {}}\n\tfor t := 0; ; t++ {\n\t\tbz = bz.next()\n\t\tnewStack := make(map[int]struct{})\n\t\tfor p := range stack {\n\t\t\tfor _, step := range steps {\n\t\t\t\tnp := p + step\n\t\t\t\tif np >= 0 && np < len(bz.valley) && bz.valley[np] == clear {\n\t\t\t\t\tif np == end {\n\t\t\t\t\t\treturn bz, t + 1\n\t\t\t\t\t}\n\t\t\t\t\tnewStack[np] = struct{}{}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tstack = newStack\n\t}\n}", "func main() {\n\tg, nodesMap := graphLineByLine()\n\n\tstart := nodesMap[\"shiny gold\"]\n\tcount := 0\n\tgraph.BFS(g, start, func(v, w int, _ int64) {\n\t\t//fmt.Println(v, \"to\", w)\n\t\tcount++\n\n\t})\n\n\tfmt.Println(count)\n}", "func BFS(f func(item string) []string, worklist []string) {\n\tseen := make(map[string]bool)\n\tconst timeout = 1 * time.Minute\n\tdeadline := time.Now().Add(timeout)\n\tfor len(worklist) > 0 && time.Now().Before(deadline) {\n\t\titems := worklist\n\t\tworklist = nil\n\t\tfor _, item := range items {\n\t\t\tif !seen[item] {\n\t\t\t\tseen[item] = true\n\t\t\t\tworklist = append(worklist, f(item)...)\n\t\t\t}\n\t\t}\n\t}\n}", "func TraversalBFS(ele interface{}, filterFn func(ele interface{}, depth int) (gotoNextLayer bool), processFn func(ele interface{}, depth int) (gotoNextLayer bool)) {\n\ttraversalBFS([]Node{{\n\t\tele: ele,\n\t}}, func(node Node) (gotoNextLayer bool) {\n\t\tif filterFn == nil {\n\t\t\t// traversal every node\n\t\t\treturn true\n\t\t}\n\t\treturn filterFn(node.ele, node.depth)\n\t}, func(node Node) (gotoNextLayer bool) {\n\t\tif processFn == nil {\n\t\t\t// traversal no node\n\t\t\treturn false\n\t\t}\n\t\treturn processFn(node.ele, node.depth)\n\t}, true)\n}", "func printGraphDFS(adjMatrix [7][7]int, StartVertex int) {\n\tv := len(adjMatrix)\n\tvisited := make([]bool, v)\n\t//This loop is to check edge like 5-6\n\tfor i := 0; i < v; i++ {\n\t\tif visited[i] == false {\n\t\t\tprintDfsHelper(adjMatrix, visited, StartVertex)\n\t\t}\n\t}\n\n}", "func main() {\n graph := createGraph()\n graph.addEdge(1, 2)\n graph.addEdge(2, 3)\n graph.addEdge(2, 4)\n graph.addEdge(3, 4)\n graph.addEdge(1, 5)\n graph.addEdge(5, 6)\n graph.addEdge(5, 7)\n\n visited := make(set)\n\n dfs(graph, 1, visited, func(node int) {\n fmt.Print(node, \" \")\n })\n}", "func BenchmarkBreadthFirstSearch(bench *testing.B) {\n\tgraph_fname := \"../data/graph-003.data\"\n\tg, _ := graph.LoadFromFile(graph_fname)\n\n\tfor i := 0; i < bench.N; i++ {\n\t\tfor v := int32(0); v < g.V(); v++ {\n\t\t\ttmp := New(g, v)\n\t\t\tif tmp.Count() == 0 {\n\t\t\t\tpanic(\"Ooops\")\n\t\t\t}\n\t\t}\n\t}\n}", "func spfa(s int, t int)(bool){\n\tgPre = make([]int, nodeNum) // initialize gPre\n\tfor i:=0; i<len(gPre); i ++ {\n\t\tgPre[i] = -1 // default -1\n\t}\n\n\tgPath = make([]int, nodeNum) // initialize gPath\n\tfor i:=0; i<len(gPath); i ++ {\n\t\tgPath[i] = -1 // default -1\n\t}\n\n\tgDist = make([]int, nodeNum) // initialize gDist\n\tfor i:=0; i<len(gDist); i ++ {\n\t\tgDist[i] = int(^uint(0) >> 1) // default INT_MAX\n\t}\n\n\tgDist[s] = 0\n\tQ := list.New() // Q is the loose queue, it record all node , from which the min cost to another node may change\n\tQ.PushBack(s)\n\tfor Q.Len() > 0 {\n\t\tu_element := Q.Front()\n\t\tQ.Remove(u_element)\n\t\tu, err := u_element.Value.(int)\n\t\tif(!err){\n\t\t\tpanic(err)\n\t\t}\n\t\tfor e := gHead[u]; e != -1; e = gEdges[e].next { // visit all edges has node u as their src node\n\t\t\tv := gEdges[e].to\n\t\t\tif gEdges[e].vol > 0 && gDist[u]+gEdges[e].cost < gDist[v] { // if edge e has availiable capacity and node v's current min cost is more than that from node u to v\n\t\t\t\tgDist[v] = gDist[u] + gEdges[e].cost // update node v's min cost\n\t\t\t\tgPre[v] = u\n\t\t\t\tgPath[v] = e\n\t\t\t\tQ.PushBack(v) // because v's min cost has changed, so we need to check if the nodes that node v can reach can change its min cost\n\t\t\t}\n\t\t}\n\t}\n\n\tif gPre[t] == -1 {\n\t\treturn false\n\t}\n\treturn true\n\n}", "func searchDiagnosisPaths(graph *simple.DirectedGraph, nodeCount int) ([][]int64, error) {\n\tvar queue NodeQueue\n\tvisited := make([]bool, nodeCount)\n\tnodePathCache := make([][][]int64, nodeCount)\n\tsinkNodes := make([]int64, 0)\n\n\t// Validate the graph contains start node with id of 0.\n\tstart := graph.Node(0)\n\tif start == nil {\n\t\treturn nil, fmt.Errorf(\"start node not found in graph\")\n\t}\n\n\t// Set start node as visited and enqueue all nodes that can reach directly from it.\n\tvisited[start.ID()] = true\n\tfromNodes := graph.From(start.ID())\n\tfor fromNodes.Next() {\n\t\tfromNode := fromNodes.Node()\n\t\tqueue.Enqueue(fromNode)\n\t}\n\n\t// Initialize node path cache with start node.\n\tnodePaths := make([][]int64, 0)\n\tnodePaths = append(nodePaths, []int64{start.ID()})\n\tnodePathCache[start.ID()] = nodePaths\n\n\tfor queue.Len() != 0 {\n\t\t// Dequeue a node from queue and retrieve all nodes that can reach directly to or from current node.\n\t\tcurrent := queue.Dequeue()\n\t\ttoNodes := graph.To(current.ID())\n\t\tfromNodes := graph.From(current.ID())\n\n\t\t// Skip current node if it has already been visited.\n\t\tif visited[current.ID()] {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Set current node as visited if all nodes that can reach directly to current node are visited.\n\t\t// Otherwise, enqueue current node.\n\t\tvisited[current.ID()] = true\n\t\tfor toNodes.Next() {\n\t\t\ttoNode := toNodes.Node()\n\t\t\tif !visited[toNode.ID()] {\n\t\t\t\tvisited[current.ID()] = false\n\t\t\t\tqueue.Enqueue(current)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif visited[current.ID()] {\n\t\t\t// Update node path of current node with visited node that can reach directly to current node.\n\t\t\ttoNodes.Reset()\n\t\t\tfor toNodes.Next() {\n\t\t\t\ttoNode := toNodes.Node()\n\t\t\t\tnodePaths := nodePathCache[current.ID()]\n\t\t\t\tif nodePaths == nil {\n\t\t\t\t\tnodePaths = make([][]int64, 0)\n\t\t\t\t}\n\t\t\t\ttoNodePaths := nodePathCache[toNode.ID()]\n\t\t\t\tfor _, toNodePath := range toNodePaths {\n\t\t\t\t\tnodePath := make([]int64, len(toNodePath))\n\t\t\t\t\tcopy(nodePath, toNodePath)\n\t\t\t\t\tnodePath = append(nodePath, current.ID())\n\t\t\t\t\tnodePaths = append(nodePaths, nodePath)\n\t\t\t\t}\n\t\t\t\t// Node path appended by current node is updated as node path of current node.\n\t\t\t\tnodePathCache[current.ID()] = nodePaths\n\t\t\t}\n\n\t\t\t// Enqueue all nodes that can reach directly from current node if current node is visited.\n\t\t\tsink := true\n\t\t\tfor fromNodes.Next() {\n\t\t\t\tsink = false\n\t\t\t\tfromNode := fromNodes.Node()\n\t\t\t\tqueue.Enqueue(fromNode)\n\t\t\t}\n\t\t\t// Set current node as sink if its outdegree is 0.\n\t\t\tif sink {\n\t\t\t\tsinkNodes = append(sinkNodes, current.ID())\n\t\t\t}\n\t\t}\n\t}\n\n\t// Set diagnosis paths with all node paths of nodes which has outdegree of 0.\n\tdiagnosisPaths := make([][]int64, 0)\n\tfor _, id := range sinkNodes {\n\t\tpaths := nodePathCache[id]\n\t\tdiagnosisPaths = append(diagnosisPaths, paths...)\n\t}\n\n\treturn diagnosisPaths, nil\n}", "func (m *Map) BfsUpdate(loc Location, fn uFunc) LocDir {\n\n\t//ret acts as the default return when either nothing is found\n\t//or the goal state is the cell.\n\tret := LocDir{loc, NoMovement}\n\tret.Loc = -1\n\tret.Dir = NoMovement\n\n\tvar depth int\n\tfrontier := new(Queue) // make this Queue a type of LocDir\n\tvar inFrontier = make(map[Location]bool)\n\tvar explored = make(map[Location]bool) // the keys are only locations\n\n\tfrontier.Push(ret) // frontier is queue of LocDir\n\tinFrontier[loc] = true // keys to inFrontier are simply locations\n\t// I'm not sure whether I should set the keys to frontier to be a LocDir\n\t// as well.\n\n\tfor {\n\t\t// Depth should be the viewRadius, but I'm not sure how to get this at\n\t\t// runtime yet.\n\t\tif frontier.Len() == 0 || depth > 7 {\n\t\t\treturn ret\n\t\t}\n\n\t\tcurLoc := frontier.Pop().(LocDir)\n\t\tinFrontier[curLoc.Loc] = false\n\t\texplored[curLoc.Loc] = true\n\n\t\tfn(curLoc.Loc, depth, m) //update function call\n\n\t\t// Loop over adjacent Locations, action is a LocDir structure\n\t\tfor _, action := range m.Adjacent(curLoc.Loc) {\n\t\t\t//if child not in explored or frontier\n\t\t\tif !explored[action.Loc] || !inFrontier[action.Loc] {\n\t\t\t\tfrontier.Push(action)\n\t\t\t\tinFrontier[action.Loc] = true\n\t\t\t}\n\t\t}\n\t\tdepth++\n\t}\n\treturn ret\n}", "func CheckReachability(deviceA, deviceB string, ig InputGraph) (bool, []Node, error) {\n\tlog.L.Debugf(\"[inputgraph] Looking for a path from %v to %v\", deviceA, deviceB)\n\n\t//check and make sure that both of the devices are actually a part of the graph\n\n\tif _, ok := ig.DeviceMap[deviceA]; !ok {\n\t\tmsg := fmt.Sprintf(\"[inputgraph] Device %v is not part of the graph\", deviceA)\n\n\t\tlog.L.Error(color.HiRedString(msg))\n\n\t\treturn false, []Node{}, errors.New(msg)\n\t}\n\n\tif _, ok := ig.DeviceMap[deviceB]; !ok {\n\t\tmsg := fmt.Sprintf(\"[inputgraph] Device %v is not part of the graph\", deviceA)\n\n\t\tlog.L.Error(color.HiRedString(msg))\n\n\t\treturn false, []Node{}, errors.New(msg)\n\t}\n\n\t//now we need to check to see if we can get from a to b. We're gonna use a BFS\n\tfrontier := make(chan string, len(ig.Nodes))\n\tvisited := make(map[string]bool)\n\tpath := make(map[string]string)\n\n\t//put in our first state\n\tfrontier <- deviceA\n\n\tvisited[deviceA] = true\n\n\tfor {\n\t\tselect {\n\t\tcase cur := <-frontier:\n\t\t\tlog.L.Debugf(\"[inputgraph] Evaluating %v\", cur)\n\t\t\tif cur == deviceB {\n\t\t\t\tlog.L.Debugf(\"[inputgraph] DestinationDevice reached.\")\n\t\t\t\tdev := cur\n\n\t\t\t\ttoReturn := []Node{}\n\t\t\t\ttoReturn = append(toReturn, *ig.DeviceMap[dev])\n\t\t\t\tlog.L.Debugf(\"[inputgraph] First Hop: %v -> %v\", dev, path[dev])\n\t\t\t\tdev, ok := path[dev]\n\n\t\t\t\tcount := 0\n\t\t\t\tfor ok {\n\t\t\t\t\tif count > len(path) {\n\t\t\t\t\t\tmsg := \"[inputgraph] Circular path detected: returnin\"\n\t\t\t\t\t\tlog.L.Error(color.HiRedString(msg))\n\n\t\t\t\t\t\treturn false, []Node{}, errors.New(msg)\n\t\t\t\t\t}\n\t\t\t\t\tlog.L.Debugf(\"[inputgraph] Next hop: %v -> %v\", dev, path[dev])\n\n\t\t\t\t\ttoReturn = append(toReturn, *ig.DeviceMap[dev])\n\n\t\t\t\t\tdev, ok = path[dev]\n\t\t\t\t\tcount++\n\n\t\t\t\t}\n\t\t\t\t//get our path and return it\n\t\t\t\treturn true, toReturn, nil\n\t\t\t}\n\n\t\t\tfor _, next := range ig.AdjacencyMap[cur] {\n\t\t\t\tif _, ok := path[next]; ok || next == deviceA {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tpath[next] = cur\n\n\t\t\t\tlog.L.Debugf(\"[inputgraph] Path from %v to %v, adding %v to frontier\", cur, next, next)\n\t\t\t\tlog.L.Debugf(\"[inputgraph] Path as it stands is: \")\n\n\t\t\t\tcurDev := next\n\t\t\t\tdev, ok := path[curDev]\n\t\t\t\tfor ok {\n\t\t\t\t\tlog.L.Debugf(\"[inputgraph] %v -> %v\", curDev, dev)\n\t\t\t\t\tcurDev = dev\n\t\t\t\t\tdev, ok = path[curDev]\n\t\t\t\t}\n\t\t\t\tfrontier <- next\n\t\t\t}\n\t\tdefault:\n\t\t\tlog.L.Debugf(\"[inputgraph] No path found\")\n\t\t\treturn false, []Node{}, nil\n\t\t}\n\t}\n}", "func (dfs *DFS) search(g Graph, v int) {\n\tdfs.marked[v] = true\n\tfor _, w := range g.Adj(v) {\n\t\tif !dfs.marked[w] {\n\t\t\tdfs.edgeTo[w] = v\n\t\t\tdfs.search(g, w)\n\t\t}\n\t}\n\n}", "func dfs(grid [][]int, row, col int) {\n\t// check if out of bound and cell is an unvisited islan\n\tif row < 0 || col < 0 || row >= len(grid) || col >= len(grid[0]) || grid[row][col] != 1 {\n\t\treturn\n\t}\n\n\t// mark cell as visited\n\tgrid[row][col] = 2\n\n\t// check neighbors\n\tdfs(grid, row+1, col)\n\tdfs(grid, row-1, col)\n\tdfs(grid, row, col+1)\n\tdfs(grid, row, col-1)\n}", "func (d *Dijkstra) Search() {\n\td.frontier[d.source] = graphEdge{From: d.source, To: d.source} // source node is special\n\td.cost[d.source] = 0\n\tpq := NewIndexedPriorityQueueMin(d.cost)\n\tpq.Insert(d.source)\n\n\tfor !pq.IsEmpty() {\n\t\tidx, err := pq.Pop()\n\t\tif err != nil {\n\t\t\td.err = err\n\t\t\treturn\n\t\t}\n\n\t\tedge := d.frontier[idx]\n\t\td.spt[idx] = edge\n\t\ti := edge.To\n\n\t\tif i == d.target {\n\t\t\treturn\n\t\t}\n\n\t\tfor _, e := range d.graph.edges[i] {\n\t\t\tnewCost := d.cost[i] + e.Cost\n\t\t\tt := e.To\n\t\t\tif _, ok := d.frontier[t]; !ok {\n\t\t\t\td.frontier[t] = e\n\t\t\t\td.cost[t] = newCost\n\t\t\t\tpq.Insert(t)\n\t\t\t} else if newCost < d.cost[t] {\n\t\t\t\tif _, ok := d.spt[t]; !ok {\n\t\t\t\t\td.frontier[t] = e\n\t\t\t\t\td.cost[t] = newCost\n\t\t\t\t\tpq.ChangePriority(t)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "func (g *Graph) HasPath (startS, endS string) (bool) {\n var q Queue\n\n // add start node\n // the biggie is that you can't create this.\n // you have to take it from the graph...\n //fmt.Println(startV)\n q.Add(g.FindVertex(startS))\n //fmt.Println(\">>>\",g.FindVertex(startS))\n\n curV := q.Remove()\n //fmt.Println(curV)\n for ; curV.name != \"\" ; curV = q.Remove() {\n // has this as val before.\n // this was wrong. should be the graph node.\n // and here too...\n if curV.name == endS {\n return true\n } \n for i :=0 ; i<len(curV.children) ; i++ {\n v := g.FindVertex(curV.children[i].name)\n //fmt.Println(\">\", v)\n q.Add(v)\n }\n }\n\n // nothing found...\n return false\n}", "func BenchmarkBFSPathTo(bench *testing.B) {\n\tfname := \"../data/graph-003.data\"\n\tg, _ := graph.LoadFromFile(fname)\n\tsource_vertex := int32(0)\n\n\tbfs_path := BFSPath(g, source_vertex)\n\tbench.ResetTimer()\n\n\tfor i := 0; i < bench.N; i++ {\n\t\tfor v := int32(0); v < g.V(); v++ {\n\t\t\t_, _ = bfs_path.PathTo(v)\n\t\t}\n\t}\n}", "func SliceOfBFS(t Tree) []float64 {\n\tslice := []float64{}\n\n\tif t.root() == nil {\n\t\treturn slice\n\t}\n\n\tcurr := t.root()\n\tq := queue.New()\n\tq.Enqueue(curr)\n\n\tfor q.First() != nil {\n\t\tcurr := q.Dequeue().(*treeNode)\n\t\tv := curr.Value\n\t\tslice = append(slice, v)\n\t\tif curr.Left != nil {\n\t\t\tq.Enqueue(curr.Left)\n\t\t}\n\t\tif curr.Right != nil {\n\t\t\tq.Enqueue(curr.Right)\n\t\t}\n\t}\n\treturn slice\n}", "func search(graph []*node, from int) []int {\n\t// fmt.Printf(\"starting at node %d in a graph of size %d\\n\", from, len(graph))\n\tvar queue []*node\n\tqueue = append(queue, graph[from])\n\tfor len(queue) > 0 {\n\t\tcurrent := queue[0]\n\t\tqueue = queue[1:]\n\t\tfor _, neigh := range current.neighbors {\n\t\t\tif neigh.dist == 0 {\n\t\t\t\tneigh.dist = 6 + current.dist\n\t\t\t\tqueue = append(queue, neigh)\n\t\t\t}\n\n\t\t}\n\t}\n\tvar result []int\n\tfor _, n := range graph {\n\t\tif n.id == from {\n\t\t\tcontinue\n\t\t}\n\t\tresult = append(result, n.dist)\n\t}\n\treturn result\n}", "func (g *Graph) DijkstraSearch(start Node) []Path {\n\tif start.node == nil || g.nodes[start.node.index] != start.node {\n\t\treturn nil\n\t}\n\tpaths := make([]Path, len(g.nodes))\n\n\tnodesBase := nodeSlice(make([]*node, len(g.nodes)))\n\tcopy(nodesBase, g.nodes)\n\tfor i := range nodesBase {\n\t\tnodesBase[i].state = 1<<31 - 1\n\t\tnodesBase[i].data = i\n\t\tnodesBase[i].parent = nil\n\t}\n\tstart.node.state = 0 // make it so 'start' sorts to the top of the heap\n\tnodes := &nodesBase\n\tnodes.heapInit()\n\n\tfor len(*nodes) > 0 {\n\t\tcurNode := nodes.pop()\n\t\tfor _, edge := range curNode.edges {\n\t\t\tnewWeight := curNode.state + edge.weight\n\t\t\tif newWeight < curNode.state { // negative edge length\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tv := edge.end\n\t\t\tif nodes.heapContains(v) && newWeight < v.state {\n\t\t\t\tv.parent = curNode\n\t\t\t\tnodes.update(v.data, newWeight)\n\t\t\t}\n\t\t}\n\n\t\t// build path to this node\n\t\tif curNode.parent != nil {\n\t\t\tnewPath := Path{Weight: curNode.state}\n\t\t\tnewPath.Path = make([]Edge, len(paths[curNode.parent.index].Path)+1)\n\t\t\tcopy(newPath.Path, paths[curNode.parent.index].Path)\n\t\t\tnewPath.Path[len(newPath.Path)-1] = Edge{Weight: curNode.state - curNode.parent.state,\n\t\t\t\tStart: curNode.parent.container, End: curNode.container}\n\t\t\tpaths[curNode.index] = newPath\n\t\t} else {\n\t\t\tpaths[curNode.index] = Path{Weight: curNode.state, Path: []Edge{}}\n\t\t}\n\t}\n\treturn paths\n}", "func (gph *Graph)isCyclePresentDFS(index int, visited[] int , marked[] int ) bool {\n\tvisited[index] = 1\n\tmarked[index] = 1\n\thead := gph.Edges[index]\n\tfor head != nil {\n\t\tdest := head.destination\n\t\tif (marked[dest] == 1) {\n\t\t\treturn true\n\t\t}\n\n\t\tif (visited[dest] == 0) {\n\t\t\tif (gph.isCyclePresentDFS(dest, visited, marked)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\thead = head.next\n\t}\n\tmarked[index] = 0\n\treturn false\n}", "func breadthFirth(f func(string) []string, worklist []string, breadth uint) {\n\tseen := make(map[string]bool)\n\n\t// invaraiant: item in worklist are to be visited\n\tfor i:= uint(0); len(worklist) > 0 && i < breadth ; i++ {\n\t\titems := worklist\n\t\tworklist = nil\n\t\tfor _ ,item := range items{\n\t\t\tif !seen[item] {\n\t\t\t\tseen[item] = true\n\t\t\t\tworklist = append(worklist, f(item)...)\n\t\t\t}\n\t\t}\n\t}\n\n}", "func breadthFirstSearch(spansPtr *model.SpanForTraceDetails, targetId string) (*model.SpanForTraceDetails, error) {\n\tqueue := []*model.SpanForTraceDetails{spansPtr}\n\tvisited := make(map[string]bool)\n\n\tfor len(queue) > 0 {\n\t\tcurrent := queue[0]\n\t\tvisited[current.SpanID] = true\n\t\tqueue = queue[1:]\n\t\tif current.SpanID == targetId {\n\t\t\treturn current, nil\n\t\t}\n\n\t\tfor _, child := range current.Children {\n\t\t\tif ok, _ := visited[child.SpanID]; !ok {\n\t\t\t\tqueue = append(queue, child)\n\t\t\t}\n\t\t}\n\t}\n\treturn nil, nil\n}", "func (gph *Graph) DFSStack(source int, target int) bool {\n\tcount := gph.count\n\tvisited := make([]bool, count)\n\tvar curr int\n\tstk := stack.New()\n\tpath := []int{}\n\tvisited[source] = true\n\tstk.Push(source)\n\n\tfor stk.Len() != 0 {\n\t\tcurr = stk.Pop().(int)\n\t\tpath = append(path,curr)\n\t\thead := gph.Edges[curr]\n\t\tfor head != nil {\n\t\t\tif visited[head.destination] == false {\n\t\t\t\tvisited[head.destination] = true\n\t\t\t\tstk.Push(head.destination)\n\t\t\t}\n\t\t\thead = head.next\n\t\t}\n\t}\n\tfmt.Println(\"DFS Path is : \", path)\n return visited[target]\n}", "func Dijkstra(g Graph, src uint32, weightFn func(uint32, uint32) float32, withPreds bool) DijkstraState {\n\tnv := g.NumVertices()\n\tvertLevel := make([]uint32, nv)\n\tfor i := u0; i < nv; i++ {\n\t\tvertLevel[i] = unvisited\n\t}\n\tcurLevel := make([]uint32, 0, nv)\n\tnextLevel := make([]uint32, 0, nv)\n\tnLevel := uint32(2)\n\tparents := make([]uint32, nv)\n\tpathcounts := make([]uint32, nv)\n\tdists := make([]float32, nv)\n\n\tpreds := make([][]uint32, 0)\n\tif withPreds {\n\t\tpreds = make([][]uint32, nv)\n\t}\n\n\tfor i := range dists {\n\t\tdists[i] = maxDist\n\t}\n\n\tvertLevel[src] = 0\n\tdists[src] = 0\n\tparents[src] = src\n\tpathcounts[src] = 1\n\tcurLevel = append(curLevel, src)\n\tfor len(curLevel) > 0 {\n\t\tfor _, u := range curLevel {\n\t\t\tfor _, v := range g.OutNeighbors(u) {\n\t\t\t\talt := min(maxDist, dists[u]+weightFn(u, v))\n\t\t\t\tif vertLevel[v] == unvisited { // if not visited\n\t\t\t\t\tdists[v] = alt\n\t\t\t\t\tparents[v] = u\n\t\t\t\t\tpathcounts[v] += pathcounts[u]\n\t\t\t\t\tif withPreds {\n\t\t\t\t\t\tpreds[v] = append(preds[v], u)\n\t\t\t\t\t}\n\t\t\t\t\tnextLevel = append(nextLevel, v)\n\t\t\t\t\tvertLevel[v] = nLevel\n\t\t\t\t} else {\n\t\t\t\t\tif alt < dists[v] {\n\t\t\t\t\t\tdists[v] = alt\n\t\t\t\t\t\tparents[v] = u\n\t\t\t\t\t\tpathcounts[v] = 0\n\t\t\t\t\t\tif withPreds {\n\t\t\t\t\t\t\tpreds[v] = preds[v][:0]\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif alt == dists[v] {\n\t\t\t\t\t\tpathcounts[v] += pathcounts[u]\n\t\t\t\t\t\tif withPreds {\n\t\t\t\t\t\t\tpreds[v] = append(preds[v], u)\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\tfmt.Printf(\"completed level %d, size = %d\\n\", nLevel-1, len(nextLevel))\n\t\tnLevel++\n\t\tcurLevel = curLevel[:0]\n\t\tcurLevel, nextLevel = nextLevel, curLevel\n\t\tzuint32.SortBYOB(curLevel, nextLevel[:nv])\n\t}\n\tpathcounts[src] = 1\n\tparents[src] = 0\n\tif withPreds {\n\t\tpreds[src] = preds[src][:0]\n\t}\n\tds := DijkstraState{\n\t\tParents: parents,\n\t\tDists: dists,\n\t\tPathcounts: pathcounts,\n\t\tPredecessors: preds,\n\t}\n\treturn ds\n}", "func brandes(g graph.Graph, accumulate func(s graph.Node, stack linear.NodeStack, p map[int64][]graph.Node, delta, sigma map[int64]float64)) {\n\tvar (\n\t\tnodes = graph.NodesOf(g.Nodes())\n\t\tstack linear.NodeStack\n\t\tp = make(map[int64][]graph.Node, len(nodes))\n\t\tsigma = make(map[int64]float64, len(nodes))\n\t\td = make(map[int64]int, len(nodes))\n\t\tdelta = make(map[int64]float64, len(nodes))\n\t\tqueue linear.NodeQueue\n\t)\n\tfor _, s := range nodes {\n\t\tstack = stack[:0]\n\n\t\tfor _, w := range nodes {\n\t\t\tp[w.ID()] = p[w.ID()][:0]\n\t\t}\n\n\t\tfor _, t := range nodes {\n\t\t\tsigma[t.ID()] = 0\n\t\t\td[t.ID()] = -1\n\t\t}\n\t\tsigma[s.ID()] = 1\n\t\td[s.ID()] = 0\n\n\t\tqueue.Enqueue(s)\n\t\tfor queue.Len() != 0 {\n\t\t\tv := queue.Dequeue()\n\t\t\tvid := v.ID()\n\t\t\tstack.Push(v)\n\t\t\tto := g.From(vid)\n\t\t\tfor to.Next() {\n\t\t\t\tw := to.Node()\n\t\t\t\twid := w.ID()\n\t\t\t\t// w found for the first time?\n\t\t\t\tif d[wid] < 0 {\n\t\t\t\t\tqueue.Enqueue(w)\n\t\t\t\t\td[wid] = d[vid] + 1\n\t\t\t\t}\n\t\t\t\t// shortest path to w via v?\n\t\t\t\tif d[wid] == d[vid]+1 {\n\t\t\t\t\tsigma[wid] += sigma[vid]\n\t\t\t\t\tp[wid] = append(p[wid], v)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor _, v := range nodes {\n\t\t\tdelta[v.ID()] = 0\n\t\t}\n\n\t\t// S returns vertices in order of non-increasing distance from s\n\t\taccumulate(s, stack, p, delta, sigma)\n\t}\n}", "func breadthFirst(f func(item string, domain string) []string, worklist []string, domain string) {\n\tseen := make(map[string]bool)\n\tfor len(worklist) > 0 {\n\t\titems := worklist\n\t\tworklist = nil\n\t\tfor _, item := range items {\n\t\t\tif !seen[item] {\n\t\t\t\tseen[item] = true\n\t\t\t\tworklist = append(worklist, f(item, domain)...)\n\t\t\t}\n\t\t}\n\t}\n}", "func dfs(grid [][]byte, M int, N int, x int, y int) {\n\tif x < 0 || x >= M || y < 0 || y >= N {\n\t\t// Out of bound, do nothing.\n\t\treturn\n\t}\n\n\tif grid[y][x] == '0' {\n\t\t// Visited already, do nothing.\n\t\treturn\n\t}\n\tgrid[y][x] = '0'\n\n\tdfs(grid, M, N, x-1, y) // Go left\n\tdfs(grid, M, N, x, y-1) // Go up\n\tdfs(grid, M, N, x+1, y) // Go right\n\tdfs(grid, M, N, x, y+1) // Go down\n}", "func pacificAtlanticBFS(mat [][]int) [][]int {\n\tres := [][]int{}\n\tif len(mat) == 0 || len(mat[0]) == 0 {\n\t\treturn res\n\t}\n\n\tm, n := len(mat), len(mat[0])\n\n\t// p[i][j] 表示,[i][j] 可以让水流到 Pacific 的点\n\t// a[i][j] 表示,[i][j] 可以让水流到 Atlantic 的点\n\tp, a := make([][]bool, m), make([][]bool, m)\n\tfor i := 0; i < m; i++ {\n\t\tp[i] = make([]bool, n)\n\t\ta[i] = make([]bool, n)\n\t}\n\t// pQueue 是所有能够让水流到 Pacific 的点的队列\n\t// aQueue 是所有能够让水流到 Atlantic 的点的队列\n\t// 初始化 pQueue 和 aQueue\n\tpQueue := [][]int{}\n\taQueue := [][]int{}\n\t// 左边可进pQueue,右边进aQueue\n\tfor i := 0; i < m; i++ {\n\t\tp[i][0] = true\n\t\tpQueue = append(pQueue, []int{i, 0})\n\t\ta[i][n-1] = true\n\t\taQueue = append(aQueue, []int{i, n - 1})\n\t}\n\t// 上边进pQueue,下边进aQueue\n\tfor j := 0; j < n; j++ {\n\t\tp[0][j] = true\n\t\tpQueue = append(pQueue, []int{0, j})\n\t\ta[m-1][j] = true\n\t\taQueue = append(aQueue, []int{m - 1, j})\n\t}\n\n\tds := [][]int{{-1, 0}, {1, 0}, {0, -1}, {0, 1}}\n\tbfs := func(queue [][]int, rec [][]bool) {\n\t\tfor len(queue) > 0 {\n\t\t\tc := queue[0]\n\t\t\tqueue = queue[1:]\n\t\t\tfor _, d := range ds {\n\t\t\t\ti, j := c[0]+d[0], c[1]+d[1]\n\t\t\t\tif 0 <= i && i < m &&\n\t\t\t\t\t0 <= j && j < n &&\n\t\t\t\t\t!rec[i][j] &&\n\t\t\t\t\tmat[c[0]][c[1]] <= mat[i][j] { // i,j可达是流动方向则进队列且\n\t\t\t\t\trec[i][j] = true\n\t\t\t\t\tqueue = append(queue, []int{i, j})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tbfs(pQueue, p)\n\tbfs(aQueue, a)\n\tfor i := 0; i < m; i++ {\n\t\tfor j := 0; j < n; j++ {\n\t\t\tif p[i][j] && a[i][j] {\n\t\t\t\tres = append(res, []int{i, j})\n\t\t\t}\n\t\t}\n\t}\n\n\treturn res\n}", "func breadthFirst(f func(item string) []string, worklist []string) {\n\tseen := make(map[string]bool)\n\tfor len(worklist) > 0 {\n\t\titems := worklist\n\t\tworklist = nil\n\t\tfor _, item := range items {\n\t\t\tif !seen[item] {\n\t\t\t\tseen[item] = true\n\t\t\t\tworklist = append(worklist, f(item)...)\n\t\t\t}\n\t\t}\n\t}\n}", "func breadthFirst(f func(item, baseUrl string) []string, baseURL string) {\n\tworklist := []string{baseURL}\n\tseen := make(map[string]bool)\n\tfor len(worklist) > 0 {\n\t\titems := worklist\n\t\tworklist = nil\n\t\tfor _, item := range items {\n\t\t\tif !seen[item] {\n\t\t\t\tseen[item] = true\n\t\t\t\tworklist = append(worklist, f(item, baseURL)...)\n\t\t\t}\n\t\t}\n\t}\n}", "func testDFS() {\n\tg := NewGraph(4)\n\tg.AddEdge(0, 1)\n\tg.AddEdge(0, 2)\n\tg.AddEdge(1, 2)\n\tg.AddEdge(2, 0)\n\tg.AddEdge(2, 3)\n\tg.AddEdge(3, 3)\n\tlog.Printf(\"Graph %v\", g.String())\n\tg.RecursiveDFS(0)\n}", "func DFS(vertices []*adj.Node) {\n\n\tvisited := make(map[*adj.Node]bool)\n\n\tfor _, v := range vertices {\n\t\tif _, ok := visited[v]; !ok {\n\t\t\tDFSVisit(v, visited)\n\t\t}\n\t}\n}", "func (a *DepthFirst) findGoal(e environments.Environment) (environments.Node, error) {\n\t// if nothing in queue/frontier, then it is impossible\n\t// to find the goal node\n\tfor a.queue.Len() > 0 {\n\t\ta.iterations++\n\t\tcurrentNode := heap.Pop(a.queue).(environments.Node)\n\n\t\tif e.IsGoalNode(currentNode) {\n\t\t\treturn currentNode, nil\n\t\t}\n\n\t\tfor _, child := range currentNode.Children() {\n\t\t\tchildIdx, inQueue := a.queue.NodeIndexes[child.Name()]\n\t\t\tprevDepth, seenPrev := a.depth[child.Name()]\n\t\t\tcurrDepth := a.depth[currentNode.Name()] + 1\n\n\t\t\tif seenPrev && prevDepth < currDepth {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif !inQueue {\n\t\t\t\ta.depth[child.Name()] = currDepth\n\t\t\t\t// new node, just add it\n\t\t\t\theap.Push(a.queue, child)\n\t\t\t} else {\n\t\t\t\ta.depth[child.Name()] = currDepth\n\t\t\t\t// we found a new route to the node. let's\n\t\t\t\t// update the depth and fix its placement in the\n\t\t\t\t// queue\n\t\t\t\ta.queue.Frontier[childIdx] = child\n\t\t\t\theap.Fix(a.queue, childIdx)\n\t\t\t}\n\t\t}\n\n\t}\n\treturn nil, fmt.Errorf(\"frontier is empty; searched entire space, but could not find goal state\")\n}", "func (G *Graph) DFS(cb func(n *Node)) {\r\n\t// initialize a map to keep track of the visited nodes\r\n\tvisited := make(map[*Node]bool)\r\n\t// initialize a ref variable to the root of the graph\r\n\tnode := G.nodes[0]\r\n\t// traverse graph recursively\r\n\tG.TraverseDFS(node, visited, cb)\r\n}", "func (this *Graph) Cluster() []*Graph {\n /*\n\n Algorithm synopsis:\n\n Loop over the Starters, for each unvisited Starter,\n define an empty sub-graph and, put it into the toVisit set\n\n Loop over the toVisit node set, for each node in it, \n skip if already visited\n add the node to the sub-graph\n remove the nodes into the hasVisited node set\n put all its incoming and outgoing edge into the the toWalk set while\n stop at the hub nodes (edges from the hub nodes are not put in the toWalk set)\n then iterate through the toWalk edge set \n skip if already walked\n add the edge to the sub-graph\n put its connected nodes into the toVisit node set\n remove the edge from the toWalk edge set into the hasWalked edge set\n\n */\n \n // sub-graph index\n sgNdx := -1\n sgRet := make([]*Graph,0)\n\n toVisit := make(nodeSet); hasVisited := make(nodeSet)\n toWalk := make(edgeSet); hasWalked := make(edgeSet)\n\n for starter := range *this.Starters() {\n // define an empty sub-graph and, put it into the toVisit set\n sgRet = append(sgRet, NewGraph(gographviz.NewGraph())); sgNdx++; \n sgRet[sgNdx].Attrs = this.Attrs\n sgRet[sgNdx].SetDir(this.Directed)\n graphName := fmt.Sprintf(\"%s_%03d\\n\", this.Name, sgNdx);\n sgRet[sgNdx].SetName(graphName)\n toVisit.Add(starter)\n hubVisited := make(nodeSet)\n for len(toVisit) > 0 { for nodep := range toVisit {\n toVisit.Del(nodep); //print(\"O \")\n if this.IsHub(nodep) && hasVisited.Has(nodep) && !hubVisited.Has(nodep) { \n // add the already-visited but not-in-this-graph hub node to the sub-graph\n sgRet[sgNdx].AddNode(nodep)\n hubVisited.Add(nodep)\n continue \n }\n if hasVisited.Has(nodep) { continue }\n //spew.Dump(\"toVisit\", nodep)\n // add the node to the sub-graph\n sgRet[sgNdx].AddNode(nodep)\n // remove the nodes into the hasVisited node set\n hasVisited.Add(nodep)\n // stop at the hub nodes\n if this.IsHub(nodep) { continue }\n // put all its incoming and outgoing edge into the the toWalk set\n noden := nodep.Name\n for _, ep := range this.EdgesToParents(noden) {\n toWalk.Add(ep)\n }\n for _, ep := range this.EdgesToChildren(noden) {\n toWalk.Add(ep)\n }\n for edgep := range toWalk {\n toWalk.Del(edgep); //print(\"- \")\n if hasWalked.Has(edgep) { continue }\n //spew.Dump(\"toWalk\", edgep)\n sgRet[sgNdx].Edges.Add(edgep)\n // put its connected nodes into the toVisit node set\n toVisit.Add(this.Lookup(edgep.Src))\n toVisit.Add(this.Lookup(edgep.Dst))\n // remove the edge into the hasWalked edge set\n hasWalked.Add(edgep)\n }\n }}\n //spew.Dump(sgNdx)\n }\n return sgRet\n}", "func DepthFirstSearch(g *graph.Graph, start, end *graph.Vertex) (*list.List, *list.List) {\n\tn := g.Vertices()\n\tvisited := make(map[*graph.Vertex]bool)\n\tprev := make(map[*graph.Vertex]*graph.Vertex)\n\tstack, trace := list.New(), list.New()\n\n\tfor i := 0; i < n; i++ {\n\t\tprev[g.Vertex(i)] = nil\n\t}\n\n\tstack.PushFront(start)\n\n\tfor stack.Len() > 0 {\n\t\tu := stack.Remove(stack.Front()).(*graph.Vertex)\n\t\ttrace.PushBack(u)\n\t\tvisited[u] = true\n\t\tif u == end {\n\t\t\tbreak\n\t\t}\n\t\tfor _, e := range g.Edges(u) {\n\t\t\tv := e.V\n\t\t\tif _, ok := visited[v]; !ok {\n\t\t\t\tvisited[v] = true\n\t\t\t\tprev[v] = u\n\t\t\t\tstack.PushFront(v)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn trace, reconstructPath(prev, end)\n}", "func (search DFS) DepthFirstSearch(g *graphs.Graph, s int) {\n\tsearch.marked = make([]bool, g.NoOfV())\n\tsearch.dfs(g, s)\n}", "func (g *Graph) AllPaths(root string, goal string, maxDepth int) []*TreeNode {\n\n\t// Preconditions\n\tif len(root) == 0 {\n\t\tlog.Fatal(\"Root vertex is empty\")\n\t}\n\n\tif len(goal) == 0 {\n\t\tlog.Fatal(\"Goal vertex is empty\")\n\t}\n\n\tif maxDepth < 0 {\n\t\tlog.Fatalf(\"Maximum depth is invalid: %v\\n\", maxDepth)\n\t}\n\n\t// Number of steps traversed from the root vertex\n\tnumSteps := 0\n\n\t// If the goal is the root, then return without traversing the graph\n\ttreeNode := makeTreeNode(root, root == goal)\n\tif treeNode.marked {\n\t\treturn []*TreeNode{treeNode}\n\t}\n\n\t// Nodes to 'spider' from\n\tqCurrent := queue.New()\n\tqCurrent.Enqueue(treeNode)\n\n\t// Nodes to 'spider' from on the next iteration\n\tqNext := queue.New()\n\n\t// List of complete nodes (where goal has been found)\n\tcomplete := []*TreeNode{}\n\n\tfor numSteps < maxDepth {\n\n\t\tfor qCurrent.Len() > 0 {\n\n\t\t\t// Take a tree node from the queue representing a vertex\n\t\t\tnode := qCurrent.Dequeue().(*TreeNode)\n\n\t\t\tif node.marked {\n\t\t\t\tlog.Fatal(\"Trying to traverse from a marked node\")\n\t\t\t}\n\n\t\t\t// Get a list of the adjacent vertices\n\t\t\tw := g.AdjacentTo(node.name)\n\n\t\t\t// Walk through each of the adjacent vertices\n\t\t\tfor _, adjIdentifier := range w {\n\n\t\t\t\tif !node.containsVertex(adjIdentifier) {\n\n\t\t\t\t\tmarked := adjIdentifier == goal\n\t\t\t\t\tchild := node.makeChild(adjIdentifier, marked)\n\n\t\t\t\t\tif marked {\n\t\t\t\t\t\tcomplete = append(complete, child)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tqNext.Enqueue(child)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\n\t\tqCurrent = qNext\n\t\tqNext = queue.New()\n\t\tnumSteps++\n\n\t}\n\n\treturn complete\n}", "func (g Graph) ShortestPath(orig Place, by Accessor) PathMap {\n\n\tinf := math.Inf(1)\n\tnone := Place{} // zero val\n\tvar d pdata // temp var for data\n\n\t// 1. mark all nodes unvisitied. create a set of all unvisited nodes\n\t// call the unvisited set\n\t// 2. assign to every node a tentative distance value: zero for initial node\n\t// and infinity (\"unvisited\") for all others. Set initial node as current.\n\tnodes := make(PathMap, len(g))\n\tfor k := range g {\n\t\tnodes[k] = pdata{Dist: inf}\n\t}\n\n\tcurrent := orig\n\td = nodes[current]\n\td.Dist = 0\n\tnodes[current] = d\n\n\tfound := false // aka done\n\n\tfor !found {\n\t\t// fmt.Println(\"current\", current, nodes[current])\n\t\tif current == none {\n\t\t\treturn nil\n\t\t}\n\n\t\t// 3. for the current node, consider all its unvisited neighbors and\n\t\t// calculate their tentative distances through the current node. Compare\n\t\t// the newly calculated tentative distance to the currently assigned value\n\t\t// and assign the smaller value.\n\t\tfor n, w := range g[current] {\n\t\t\tif !nodes[n].visited { // n in unvisited set\n\t\t\t\ttentative := nodes[current].Dist + by(w)\n\t\t\t\td = nodes[n]\n\t\t\t\tif d.Dist > tentative {\n\t\t\t\t\td.Dist = tentative\n\t\t\t\t\td.parent = current\n\t\t\t\t\td.Hops = nodes[d.parent].Hops + 1\n\t\t\t\t\tnodes[n] = d\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// 4. when we are done considering all the unvisited neighbors of the\n\t\t// current node, mark the current node as visited and remove it from the\n\t\t// unvisited set. A visited node will never be checked again.\n\t\td = nodes[current]\n\t\td.visited = true\n\t\tnodes[current] = d\n\n\t\t// 5. A) if all nodes are marked visited (unvisited set is empty)\n\t\t// OR B) if the smallest tentative distance among nodes in the unvisited set\n\t\t// is infinity (no path possible)\n\t\t// The algorithm is finished.\n\t\t// TODO: termination case B\n\t\tunvisitedcount := 0\n\t\tfor _, d := range nodes {\n\t\t\tif !d.visited {\n\t\t\t\tunvisitedcount++\n\t\t\t}\n\t\t}\n\n\t\tfound = unvisitedcount == 0\n\t\tif found {\n\t\t\tcontinue\n\t\t}\n\n\t\t// 6. Otherwise, select the unvisited node that is marked with the smallest\n\t\t// tentative value, set it as the \"current\" and go back to step 3.\n\t\tminDist := inf // pos infinity\n\t\tminPlace := Place{}\n\t\tfor node, d := range nodes {\n\t\t\tif !d.visited && d.Dist < minDist {\n\t\t\t\tminDist = d.Dist\n\t\t\t\tminPlace = node\n\t\t\t}\n\t\t}\n\t\tcurrent = minPlace\n\t\tfound = minDist == inf // termination case 5B above\n\t}\n\n\treturn nodes\n}", "func (s *defaultSearcher) dfs(args searchArgs) {\n\toutEdges := args.nodeToOutEdges[args.root]\n\tif args.statusMap[args.root] == onstack {\n\t\tlog.Warn(\"The input call graph contains a cycle. This can't be represented in a \" +\n\t\t\t\"flame graph, so this path will be ignored. For your record, the ignored path \" +\n\t\t\t\"is:\\n\" + strings.TrimSpace(s.pathStringer.pathAsString(args.path, args.nameToNodes)))\n\t\treturn\n\t}\n\tif len(outEdges) == 0 {\n\t\targs.buffer.WriteString(s.pathStringer.pathAsString(args.path, args.nameToNodes))\n\t\targs.statusMap[args.root] = discovered\n\t\treturn\n\t}\n\targs.statusMap[args.root] = onstack\n\tfor _, edge := range outEdges {\n\t\ts.dfs(searchArgs{\n\t\t\troot: edge.Dst,\n\t\t\tpath: append(args.path, *edge),\n\t\t\tnodeToOutEdges: args.nodeToOutEdges,\n\t\t\tnameToNodes: args.nameToNodes,\n\t\t\tbuffer: args.buffer,\n\t\t\tstatusMap: args.statusMap,\n\t\t})\n\t}\n\targs.statusMap[args.root] = discovered\n}", "func (gph *Graph) Dijkstra(source int) {\n\tcount := gph.count\n\tprevious := make([]int, count)\n\tdist := make([]int, count)\n\tvisited := make([]bool, count)\n\n\tfor i := 0; i < gph.count; i++ {\n\t\tprevious[i] = -1\n\t\tdist[i] = math.MaxInt32 // infinite\n\t\tvisited[i] = false\n\t}\n\n\tdist[source] = 0\n\tprevious[source] = -1\n\n\ttype Item struct {\n\t\tindex int\n\t\tpriority int\n\t}\n\n\tcmp := func(a, b interface{}) bool {\n\t\treturn a.(Item).priority > b.(Item).priority\n\t}\n\n\thp := NewHeap(cmp)\n\theap.Push(hp, Item{source, 0})\n\n\tfor hp.Len() != 0 {\n\t\tsource := heap.Pop(hp).(Item).index\n\n\t\tif visited[source] == true {\n\t\t\tcontinue\n\t\t}\n\t\tvisited[source] = true\n\n\t\tfor dest := 0; dest < gph.count; dest++ {\n\t\t\tcost := gph.adj[source][dest]\n\t\t\tif cost != 0 {\n\t\t\t\talt := cost + dist[source]\n\t\t\t\tif dist[dest] > alt && visited[dest] == false {\n\t\t\t\t\tdist[dest] = alt\n\t\t\t\t\tprevious[dest] = source\n\t\t\t\t\theap.Push(hp, Item{dest, alt})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfor i := 0; i < count; i++ {\n\t\tif dist[i] == math.MaxInt32 {\n\t\t\tfmt.Println(\" node id \", i, \" prev \", previous[i], \" distance : Unreachable\")\n\t\t} else {\n\t\t\tfmt.Println(\" node id \", i, \" prev \", previous[i], \" distance : \", dist[i])\n\t\t}\n\t}\n}", "func dijstra(g adjList, n int, s int, e int) ([]int, []int) {\n\t// g - adjacency list of a weighted graph\n\t// n - the number of nodes in the graph\n\t// s - the index of the starting node ( 0 <= s < n )\n\t// e - the index of the end node ( 0 <= e < n )\n\tvisited := make([]bool, n)\n\tdistance := make([]int, n)\n\n\t// keep track of the previous node we took\n\t// to get to the current node\n\tprevious := make([]int, n)\n\n\tfor i := range visited {\n\t\tvisited[i] = false\n\t}\n\n\tfor i := range distance {\n\t\tdistance[i] = math.MaxInt64\n\t}\n\n\tdistance[s] = 0\n\t// Set Min option to true for minheap\n\tminheap := pqueue.NewHeap(pqueue.Options{\n\t\tMin: true,\n\t})\n\n\tminheap.InsertPriority(string(s), 0)\n\n\tfor minheap.Length() != 0 {\n\n\t\tstringAtIndex, min := minheap.Poll()\n\t\tintegerAtIndex, _ := strconv.Atoi(stringAtIndex)\n\n\t\t// current node is integerAtIndex\n\t\tvisited[integerAtIndex] = true\n\n\t\t// optimization to ignore stale index\n\t\t// (index, min_dis) pair\n\t\tif distance[integerAtIndex] < min {\n\t\t\tcontinue\n\t\t}\n\n\t\t// loop through all the neighbours of\n\t\t// the current node\n\t\tcn := g[integerAtIndex].head\n\t\tfor cn != nil {\n\n\t\t\tif visited[cn.vertex] {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tnewdist := distance[integerAtIndex] + cn.weight\n\t\t\tif newdist < distance[cn.vertex] {\n\t\t\t\tprevious[cn.vertex] = integerAtIndex\n\t\t\t\tdistance[cn.vertex] = newdist\n\t\t\t\tminheap.InsertPriority(strconv.Itoa(cn.vertex), newdist)\n\t\t\t}\n\n\t\t\tif cn.next == nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcn = cn.next\n\t\t}\n\n\t\t// Optimise here to stop early.\n\t\tif integerAtIndex == e {\n\t\t\treturn distance, previous\n\t\t}\n\n\t}\n\treturn distance, previous\n}", "func main() {\n\n nodes := []graph.Node{}\n router := Router{ \"routerA\",1 }\n router2 := Router{ \"routerB\",2 }\n subnet := Subnet{ \"subnet1\", 10}\n nodes = append(nodes, router)\n// nodes = append(nodes, subnet)\n g := graph.NewGraph(nodes)\n g.AddNode(subnet)\n g.AddNode(router2)\n\n\n g.SetEdge(router, subnet)\n g.SetEdge(router2, subnet)\n\n g.Dump()\n\n// weight := float64(40)\n// edge := g.NewWeightedEdge(router, subnet, weight)\n// g.SetWeightedEdge(edge)\n\n// fmt.Printf(\"%v\\n\", g)\n// g.Dump()\n\n/*\n self := 0.0 // the cost of self connection\n absent := 10.0 // the wieght returned for absent edges\n\n graph := simple.NewWeightedUndirectedGraph(self, absent)\n fmt.Printf(\"%v\\n\", graph)\n\n var id int64\n //var node simple.Node\n\n id = 0\n from := simple.Node(id)\n graph.AddNode(from)\n\n id = 1\n to := simple.Node(id)\n graph.AddNode(to)\n\n id = 2\n from2 := simple.Node(id)\n graph.AddNode(from2)\n\n id = 3\n to2 := simple.Node(id)\n graph.AddNode(to2)\n\n\n nodeA := graph.Node(int64(2))\n\n\n\n fmt.Printf(\"%v\\n\", graph)\n\n nodes := graph.Nodes()\n fmt.Printf(\"%v\\n\", nodes)\n fmt.Printf(\"%v\\n\", nodeA)\n\n weight := float64(40)\n edge := graph.NewWeightedEdge(from, to, weight)\n graph.SetWeightedEdge(edge)\n\n edge2 := graph.NewWeightedEdge(from2, to2, weight)\n graph.SetWeightedEdge(edge2)\n\n fmt.Printf(\"%v\\n\", graph)\n edges := graph.Edges()\n fmt.Printf(\"%v\\n\", edges)\n\n edge_ := graph.Edge(int64(0) ,int64(1))\n fmt.Printf(\"%v\\n\", edge_)\n*/\n}", "func restoreGraph() ([]string, map[string]bool) {\n\tg := gographviz.NewGraph()\n\tfileLine := file_mng.ReadFileByLine(service.GetParameters().GetInputRestoreFile())\n\n\tseparator := 0\n\tfor i, line := range fileLine {\n\t\tif line == \"-------------\" {\n\t\t\tseparator = i\n\t\t}\n\t}\n\n\t// Get array of lines containing only the graph (first line: diagraph <name> { , last line: })\n\tgraphArray := fileLine[0:separator]\n\t// Graph array to string\n\tgraphString := strings.Join(graphArray, \"\")\n\n\t// Get queue array from file\n\tqueueString := fileLine[separator+1 : len(fileLine)]\n\n\t// Import the graph string\n\tg, _ = gographviz.Read([]byte(graphString))\n\n\t// Create the result start for BFS visit (by getting all graph node)\n\tstartResult := make(map[string]bool)\n\t// Getting all graph node\n\tfor _, value := range g.Nodes.Nodes {\n\t\t// Remove \" char from node name\n\t\tnode := value.Name[1 : len(value.Name)-1]\n\t\tstartResult[node] = true\n\t}\n\t// Set the graph name\n\tservice.SetGraphName(g.Name[1 : len(g.Name)-1])\n\tservice.SetIsFinish(false)\n\tservice.GetParameters().SetUrlDomain(g.Name[1 : len(g.Name)-1])\n\t// Getting the edges from graphArray (by removing graph name and } char)\n\tgraphEdgeString := graphArray[1 : len(graphArray)-1]\n\tservice.CreateGraphFromString(strings.Join(graphEdgeString, \"\\n\"))\n\n\treturn queueString, startResult\n}", "func (d *DStarLite) update(u *dStarLiteNode) {\n\t/*\n\t procedure UpdateVertex(u)\n\t {07”} if (g(u) != rhs(u) AND u ∈ U) U.Update(u,CalculateKey(u));\n\t {08”} else if (g(u) != rhs(u) AND u /∈ U) U.Insert(u,CalculateKey(u));\n\t {09”} else if (g(u) = rhs(u) AND u ∈ U) U.Remove(u);\n\t*/\n\tinQueue := u.inQueue()\n\tswitch {\n\tcase inQueue && u.g != u.rhs:\n\t\td.queue.update(u, d.keyFor(u))\n\tcase !inQueue && u.g != u.rhs:\n\t\td.queue.insert(u, d.keyFor(u))\n\tcase inQueue && u.g == u.rhs:\n\t\td.queue.remove(u)\n\t}\n}", "func dfs(start, cur string, stack []string, adj map[string]map[string][]*gographviz.Edge) map[string]bool {\n\t// Check for cycle or cross.\n\tif in(stack, cur) {\n\t\tif cur == start {\n\t\t\treturn set(stack) // Found a cycle, return the current stack as a set.\n\t\t}\n\t\treturn nil // Found a cross, just return.\n\t}\n\n\tr := map[string]bool{}\n\tchildStack := append(stack, cur)\n\t// Loop over all possible destinations of cur.\n\tfor dst := range adj[cur] {\n\t\t// Add all nodes that are in a cycle as found by the recursive call\n\t\t// to dfs.\n\t\tunion(r, dfs(start, dst, childStack, adj))\n\t}\n\treturn r\n}", "func main15() {\n\tgph := new(Graph)\n\tgph.Init(5)\n gph.AddDirectedEdge(0, 1, 3)\n gph.AddDirectedEdge(0, 4, 2)\n gph.AddDirectedEdge(1, 2, 1)\n gph.AddDirectedEdge(2, 3, 1)\n gph.AddDirectedEdge(4, 1, -2)\n gph.AddDirectedEdge(4, 3, 1)\n gph.BellmanFordShortestPath(0)\n}", "func (gph *Graph) DFSStack(source int, target int) bool {\n\tcount := gph.count\n\tvisited := make([]bool, count)\n\tvar curr int\n\tstk := new(Stack)\n\tpath := []int{}\n\tvisited[source] = true\n\tstk.Push(source)\n\n\tfor stk.Len() != 0 {\n\t\tcurr = stk.Pop().(int)\n\t\tpath = append(path, curr)\n\t\thead := gph.Edges[curr]\n\t\tfor head != nil {\n\t\t\tif !visited[head.dest] {\n\t\t\t\tvisited[head.dest] = true\n\t\t\t\tstk.Push(head.dest)\n\t\t\t}\n\t\t\thead = head.next\n\t\t}\n\t}\n\tfmt.Println(\"DFS Path is: \", path)\n\treturn visited[target]\n}", "func dfs(node string, visited map[string]int, symphony *Symphony, path []string) (bool, []string) {\n\tif visited[node] == 1 {\n\t\treturn true, path // cyclic dependent\n\t}\n\tif visited[node] == 2 {\n\t\treturn false, path\n\t}\n\t// 1 = temporarily visited\n\tvisited[node] = 1\n\tpath = append(path, node)\n\tdeps := symphony.tasks[node].Deps\n\tfor _, dep := range deps {\n\t\tif cyclic, path := dfs(dep, visited, symphony, path); cyclic {\n\t\t\treturn true, path\n\t\t}\n\t}\n\t// 2 = permanently visited\n\tvisited[node] = 2\n\n\treturn false, path\n}", "func search(start *node, end *node , sp [676]wordlists, ep [676]wordlists) (*node){\n if start.name == end.name {\n return start\n }\n\n var st_index, en_index uint16\n var _arr_st_index, _arr_en_index []uint16\n var wlen uint8\n\n var cur [110000]node\n var child node\n var ndC uint64\n ndC = 0\n ftr := []node{}\n exp := []node{}\n depth := 0\n\n ftr = append(ftr, *start)\n\n for len(ftr) != 0 {\n cur[ndC], ftr = ftr[0], ftr[1:len(ftr)]\n\n if in_queue(cur[ndC], exp) {\n continue\n }\n\n child.parent = &cur[ndC]\n child.cost = cur[ndC].cost+1\n\n st_index = 26*(uint16(cur[ndC].name[0])-'a') + (uint16(cur[ndC].name[1])-'a')\n if !in_index_arr(st_index, _arr_st_index) {\n _arr_st_index = append(_arr_st_index, st_index)\n\n child.end = false\n for i:=0; i<len(ep[st_index].word); i++ {\n child.name = ep[st_index].word[i]\n if child.name == end.name {\n return &child\n }\n ftr = append(ftr, child)\n } \n } \n\n wlen = uint8(len(cur[ndC].name))\n en_index = 26*(uint16(cur[ndC].name[wlen-2])-'a') + (uint16(cur[ndC].name[wlen-1])-'a')\n if !in_index_arr(en_index, _arr_en_index) {\n _arr_en_index = append(_arr_en_index, en_index)\n\n child.end = true\n for i:=0; i<len(sp[en_index].word); i++ {\n child.name = sp[en_index].word[i]\n if child.name == end.name {\n return &child\n }\n ftr = append(ftr, child)\n } \n }\n if cur[ndC].cost != depth {\n depth = cur[ndC].cost\n }\n exp = append(exp, cur[ndC])\n ndC++\n }\n\n child.name = \"\"\n return &child\n}" ]
[ "0.7874898", "0.76811457", "0.76155746", "0.74700826", "0.74689317", "0.7461378", "0.74535835", "0.74162644", "0.73300844", "0.7210336", "0.71919674", "0.7101111", "0.7042041", "0.7029699", "0.6970232", "0.6891763", "0.68570316", "0.6821026", "0.6818031", "0.6743345", "0.6714822", "0.6704323", "0.6673643", "0.6606357", "0.6523699", "0.6519307", "0.65102506", "0.6504644", "0.6437472", "0.6416777", "0.6381311", "0.6380065", "0.6374627", "0.63456225", "0.6301495", "0.6300113", "0.6275411", "0.62223196", "0.61483854", "0.61134434", "0.6090553", "0.60787904", "0.60636", "0.60398906", "0.6023504", "0.6021662", "0.5988784", "0.59660167", "0.59438455", "0.5934615", "0.5909729", "0.58536506", "0.580136", "0.5791736", "0.57723635", "0.5752614", "0.573837", "0.5701816", "0.5682128", "0.5681941", "0.56695974", "0.5626085", "0.5607855", "0.55668813", "0.55617553", "0.55520254", "0.5543315", "0.55281657", "0.5526455", "0.55250967", "0.5497272", "0.54901475", "0.545771", "0.5452805", "0.5431819", "0.54315203", "0.5416643", "0.5390809", "0.53867793", "0.5384086", "0.53756815", "0.5334609", "0.5334554", "0.5313716", "0.52788705", "0.5267966", "0.52527744", "0.5251125", "0.5249046", "0.5242179", "0.5193882", "0.5193628", "0.51932037", "0.51670474", "0.5162047", "0.5158884", "0.5147313", "0.5141643", "0.51347804", "0.5126974" ]
0.7894941
0
GetTrack gets a track
func (c *Client) GetTrack(id string, options *Options) (FullTrack, error) { var track FullTrack url := constructURL(options, c.baseURL, "tracks", id) err := c.get(url, &track) if err != nil { return FullTrack{}, err } return track, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GetTrack(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tid := vars[\"short_id\"]\n\n\ttrack, err := database.GetTrackByShortID(id)\n\tif err != nil {\n\t\tutils.RespondWithJSON(w, http.StatusInternalServerError, \"error\", nil)\n\t\treturn\n\t}\n\n\tutils.RespondWithJSON(w, http.StatusOK, \"success\", track)\n\treturn\n}", "func (c *gitTracks) Get(name string, options v1.GetOptions) (result *v1alpha1.GitTrack, err error) {\n\tresult = &v1alpha1.GitTrack{}\n\terr = c.client.Get().\n\t\tNamespace(c.ns).\n\t\tResource(\"gittracks\").\n\t\tName(name).\n\t\tVersionedParams(&options, scheme.ParameterCodec).\n\t\tDo().\n\t\tInto(result)\n\treturn\n}", "func (s *KSession) GetTrack(id int64) (results Track, err error) {\n\tresults = Track{}\n\tres, err := s.request(\"GET\", EndpointLyricsTrack(id), nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\terr = json.Unmarshal(res, &results)\n\treturn\n}", "func SpotifyGetTrack(trackID spotify.ID) *spotify.FullTrack {\n\tresults, err := client.GetTrack(trackID)\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn results\n}", "func (c *Client) GetTrack(ctx context.Context, trackPageURL string) (*Track, error) {\n\tif !strings.HasPrefix(trackPageURL, c.baseURL) {\n\t\treturn nil, fmt.Errorf(\"%s is an invalid URL: must start with %s\", trackPageURL, c.baseURL)\n\t}\n\n\tdocument, err := c.getTrackPageDocument(ctx, trackPageURL)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get track page document: %w\", err)\n\t}\n\n\ttrack, err := c.parseTrack(document)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to download track: %w\", err)\n\t}\n\n\treturn track, nil\n}", "func (t *Track) Get() error {\n\n\tif err := db.Where(&t).First(&t).Error; err != nil {\n\t\tlogrus.Warn(err)\n\t\treturn err\n\t}\n\n\tlogrus.Infof(\"icii retrieved information for track #%x\", t.ID)\n\n\treturn nil\n\n}", "func TrackGET(w http.ResponseWriter, _ *http.Request) {\n\t// Get all tracks from the database\n\tvar all = trackDB.GetAll()\n\t// Create a bson.ObjectID slice\n\tvar ids []bson.ObjectId\n\n\t// Loop through all tracks\n\tfor _, track := range all {\n\t\t// Append the track ID to the ID-slice\n\t\tids = append(ids, track.Id)\n\t}\n\n\t// Set header content-type to JSON\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\t// Encode and displays all the track-ID's\n\tjson.NewEncoder(w).Encode(ids)\n}", "func (a *UtilsApiService) GetFeatureTrackUsingGet(ctx context.Context, featureTrackId string) (FeatureTrack, *http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Get\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t\tlocalVarReturnValue FeatureTrack\n\t)\n\n\t// create path and map variables\n\ta.client = NewAPIClient(&Configuration{\n\t\tBasePath: ctx.Value(\"BasePath\").(string),\n\t\tDefaultHeader: make(map[string]string),\n\t\tUserAgent: \"Swagger-Codegen/1.0.0/go\",\n\t})\n\tlocalVarPath := a.client.cfg.BasePath + \"/nucleus/v1/feature_track/{feature_track_id}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"feature_track_id\"+\"}\", fmt.Sprintf(\"%v\", featureTrackId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\"*/*\"}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHttpResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHttpResponse == nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tlocalVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)\n\tlocalVarHttpResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tif localVarHttpResponse.StatusCode < 300 {\n\t\t// If we succeed, return the data, otherwise pass on to decode error.\n\t\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\treturn localVarReturnValue, localVarHttpResponse, err\n\t}\n\n\tif localVarHttpResponse.StatusCode >= 300 {\n\t\tnewErr := GenericSwaggerError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHttpResponse.Status,\n\t\t}\n\n\t\tif localVarHttpResponse.StatusCode == 200 {\n\t\t\tvar v FeatureTrack\n\t\t\terr = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get(\"Content-Type\"))\n\t\t\tif err != nil {\n\t\t\t\tnewErr.error = err.Error()\n\t\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t\t}\n\t\t\tnewErr.model = v\n\t\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t\t}\n\n\t\treturn localVarReturnValue, localVarHttpResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHttpResponse, nil\n}", "func (o *SmsTracking) GetTrack() string {\n\tif o == nil || o.Track == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Track\n}", "func (s *Server) GetCurrentTrack(ctx context.Context, in *GetTrackRequest) (*Track, error) {\n\tif in.ZoneId == \"\" && in.SpeakerId == \"\" {\n\t\treturn &Track{}, nil\n\t}\n\tif in.ZoneId != \"\" {\n\t\tt, err := s.service.GetTrackForZone(in.ZoneId)\n\t\tif err != nil {\n\t\t\treturn &Track{}, nil\n\t\t}\n\t\treturn &Track{Artist: t.Artist, Album: t.Album, Title: t.Title, Artwork: t.Artwork}, nil\n\t} else {\n\t\tt, err := s.service.GetTrackForSpeaker(in.SpeakerId)\n\t\tif err != nil {\n\t\t\treturn &Track{}, nil\n\t\t}\n\t\treturn &Track{Artist: t.Artist, Album: t.Album, Title: t.Title, Artwork: t.Artwork}, nil\n\t}\n}", "func (c *Client) GetTrackInfo(trackID string) (*jamsonic.Track, error) {\n\tpanic(\"should not be called.\")\n}", "func (p *Player) loadTrack(uri string) (*spotify.Track, error) {\n\tlog.Infof(\"Load Track: %s\", uri)\n\n\t// ParsePrintln the track URI\n\tlog.Debug(\"Parse link:\", uri)\n\tlink, err := p.session.ParseLink(uri)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Get track link\n\tlog.Debug(\"Get Track Link\")\n\ttrack, err := link.Track()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Block until the track is loaded\n\tlog.Debug(\"Wait for Track\")\n\ttrack.Wait()\n\n\treturn track, nil\n}", "func SingleTrackFieldGET(w http.ResponseWriter, r *http.Request) {\n\t// Get the parameters with mux\n\tparams := mux.Vars(r)\n\n\t// Get the <id> parameter\n\tid := params[\"id\"]\n\n\t// Get the track from the database\n\ttrack, found := trackDB.Get(id)\n\n\t// Check if the track was not found\n\tif found != true {\n\t\t// Show an 404, Not Found error\n\t\thttp.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)\n\t\treturn\n\t}\n\n\t// Get the <field> parameter\n\tfield := params[\"field\"]\n\n\t// Get the field from the track\n\tresponse := track.GetField(field)\n\n\t// Set header content-type to plain text\n\tw.Header().Set(\"Content-Type\", \"text/plain\")\n\n\t// Display the field-value\n\tfmt.Fprintf(w, \"%s\", response)\n}", "func GetTracks() *[]models.Track {\n\tvar tracks []models.Track\n\tvar track models.Track\n\tvar skip string // Skip the keyp value\n\n\tdb, err := open()\n\tdefer db.Close()\n\tutil.CheckErr(\"GetTracks\", err, true)\n\n\trows, err := db.Query(\"SELECT * FROM tracks\")\n\n\tfor rows.Next() {\n\t\terr = rows.Scan(&track.Id,\n\t\t\t&track.TrackNumber,\n\t\t\t&track.Name,\n\t\t\t&track.AlbumId,\n\t\t\t&track.ArtistId,\n\t\t\t&track.DiscNumber,\n\t\t\t&track.Genre,\n\t\t\t&skip,\n\t\t\t&track.Path)\n\t\tutil.CheckErr(\"GetTracks\", err, true)\n\t\ttracks = append(tracks, track)\n\t}\n\n\treturn &tracks\n}", "func (s *Client) GetUserSavedTracks(ctx context.Context, token *oauth2.Token, q *QParams) (*models.UserSavedTracks, error) {\n\tvar endpoint *url.URL = s.API.UserSavedTracksURL\n\t//in go structs containing primitive types are copied by value\n\t//https://stackoverflow.com/questions/51635766/how-do-i-copy-a-struct-in-golang\n\tlog.Println(\"SAME ADDRESS ?????\")\n\tlog.Println(&endpoint == &s.API.UserSavedTracksURL)\n\tif q != nil {\n\t\tparams := url.Values{}\n\t\tif q.Limit != nil {\n\t\t\tvar l int = *(q).Limit\n\t\t\tvalid := (l >= 1) && (l <= 50)\n\t\t\tif valid {\n\t\t\t\tparams.Set(\"limit\", strconv.Itoa(l))\n\t\t\t}\n\t\t}\n\t\tif q.Offset != nil {\n\t\t\tvar offset int = *(q).Offset\n\t\t\tif offset > 0 {\n\t\t\t\tparams.Set(\"offset\", strconv.Itoa(offset))\n\t\t\t}\n\t\t}\n\t\tif q.Market != nil {\n\t\t\tvar m string = *(q).Market\n\t\t\tif validMarketOpt(m) {\n\t\t\t\tparams.Set(\"market\", *(q).Market)\n\t\t\t}\n\t\t}\n\n\t\tendpoint.RawQuery = params.Encode()\n\t}\n\turl := endpoint.String()\n\tlog.Println(url)\n\tlog.Printf(\"User saved tracks url: %v\\n\", url)\n\n\ttracks := &models.UserSavedTracks{}\n\n\thttpClient := s.Config.Client(ctx, token)\n\tresp, err := httpClient.Get(url)\n\tif resp.StatusCode >= http.StatusBadRequest {\n\t\tlog.Println(\"status code todo:return err\")\n\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\tif err := json.NewDecoder(resp.Body).Decode(tracks); err != nil {\n\t\tlog.Printf(\"Could not decode body: %v\\n\", err)\n\t\treturn nil, err\n\t}\n\n\treturn tracks, nil\n\n}", "func (sc *SoundCloud) GetTracks(url string, submitter *gumble.User) ([]interfaces.Track, error) {\n\tvar (\n\t\tapiURL string\n\t\terr error\n\t\tresp *http.Response\n\t\tv *jason.Object\n\t\ttrack bot.Track\n\t\ttracks []interfaces.Track\n\t)\n\n\turlSplit := strings.Split(url, \"#t=\")\n\n\tapiURL = \"http://api.soundcloud.com/resolve?url=%s&client_id=%s\"\n\n\tif sc.isPlaylist(url) {\n\t\t// Submitter has added a playlist!\n\t\tresp, err = http.Get(fmt.Sprintf(apiURL, urlSplit[0], viper.GetString(\"api_keys.soundcloud\")))\n\t\tdefer resp.Body.Close()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tv, err = jason.NewObjectFromReader(resp.Body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\ttitle, _ := v.GetString(\"title\")\n\t\tpermalink, _ := v.GetString(\"permalink_url\")\n\t\tplaylist := &bot.Playlist{\n\t\t\tID: permalink,\n\t\t\tTitle: title,\n\t\t\tSubmitter: submitter.Name,\n\t\t\tService: sc.ReadableName,\n\t\t}\n\n\t\tvar scTracks []*jason.Object\n\t\tscTracks, err = v.GetObjectArray(\"tracks\")\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tdummyOffset, _ := time.ParseDuration(\"0s\")\n\t\tfor _, t := range scTracks {\n\t\t\ttrack, err = sc.getTrack(t, dummyOffset, submitter)\n\t\t\tif err != nil {\n\t\t\t\t// Skip this track.\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\ttrack.Playlist = playlist\n\t\t\ttracks = append(tracks, track)\n\t\t}\n\n\t\tif len(tracks) == 0 {\n\t\t\treturn nil, errors.New(\"Invalid playlist. No tracks were added\")\n\t\t}\n\t\treturn tracks, nil\n\t}\n\n\t// Submitter has added a track!\n\n\toffset := 0\n\t// Calculate track offset if needed\n\tif len(urlSplit) == 2 {\n\t\ttimeSplit := strings.Split(urlSplit[1], \":\")\n\t\tmultiplier := 1\n\t\tfor i := len(timeSplit) - 1; i >= 0; i-- {\n\t\t\ttime, _ := strconv.Atoi(timeSplit[i])\n\t\t\toffset += time * multiplier\n\t\t\tmultiplier *= 60\n\t\t}\n\t}\n\tplaybackOffset, _ := time.ParseDuration(fmt.Sprintf(\"%ds\", offset))\n\n\tresp, err = http.Get(fmt.Sprintf(apiURL, urlSplit[0], viper.GetString(\"api_keys.soundcloud\")))\n\tdefer resp.Body.Close()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tv, err = jason.NewObjectFromReader(resp.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ttrack, err = sc.getTrack(v, playbackOffset, submitter)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttracks = append(tracks, track)\n\treturn tracks, nil\n}", "func downloadTrack(tr tidal.Track, q string) {\n\tdirs := clean(tr.Artists[0].Name) + \"/\" + clean(tr.Album.Title)\n\tpath := dirs + \"/\" + clean(tr.Artists[0].Name) + \" - \" + clean(tr.Title)\n\tcurrent = path\n\ttq <- fmt.Sprintf(\"=[ (%d/%d) %s ]=\", done, todo, current)\n\tos.MkdirAll(dirs, os.ModePerm)\n\tf, err := os.Create(path)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tu, err := t.GetStreamURL(tr.ID.String(), q)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tres, err := http.Get(u)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tr := newProxy(res.Body, int(res.ContentLength))\n\tio.Copy(f, r)\n\tres.Body.Close()\n\tf.Close()\n\tr.Close()\n\n\terr = enc(path, tr.Title, tr.Artists[0].Name, tr.Album.Title, tr.TrackNumber.String())\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tos.Remove(path)\n}", "func (c *Spotify) Get() {\n\tif sdbus == nil {\n\t\tsdbus = connDbus()\n\t}\n\n\tsong := Metadata()\n\tpstatus := Status()\n\n\t// TODO buggy spotify only sends a single artist\n\tsongData := song.Value().(map[string]dbus.Variant)\n\tc.Artist = songData[\"xesam:artist\"].Value().([]string)[0]\n\tc.Title = songData[\"xesam:title\"].Value().(string)\n\tc.Rating = int(songData[\"xesam:autoRating\"].Value().(float64) * 100)\n\tc.Status = pstatus.Value().(string)\n\tc.Url = songData[\"xesam:url\"].Value().(string)\n\tc.ArtUrl = songData[\"mpris:artUrl\"].Value().(string)\n\n\tidx := strings.LastIndex(c.ArtUrl, \"/\")\n\tc.ArtFile = c.ArtUrl[idx+1:]\n}", "func (s *Samples) Track(track uint8) error {\n\treturn s.Play(int(track), nil)\n}", "func (c *Cache) TrackingGet(key string) TrackedItem {\n\titem := c.Get(key)\n\tif item == nil {\n\t\treturn NilTracked\n\t}\n\titem.track()\n\treturn item\n}", "func SpotifySearchTrack(query string, limit int32) *spotify.SearchResult {\n\tresults, err := client.SearchOpt(query, spotify.SearchTypeTrack|spotify.SearchTypeArtist, &spotify.Options{Limit: createInt(limit)})\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn results\n}", "func getTracks(c *gin.Context) {\n\tartists := database.GetArtists()\n\talbums := database.GetAlbums()\n\ttracks := database.GetTracks()\n\tfull := fullJson{artists, albums, tracks}\n\n c.JSON(200, full)\n}", "func (c Client) Track(e *Event) (success bool, err error) {\n\te.SetToken(c.token)\n\tvalues := url.Values{}\n\tvalues.Set(\"data\", base64.StdEncoding.EncodeToString([]byte(e.JSON())))\n\treq := url.URL{\n\t\tScheme: Protocol,\n\t\tHost: Host,\n\t\tPath: TrackingPath,\n\t\tRawQuery: values.Encode(),\n\t}\n\tresp, err := http.Get(req.String())\n\tif success = err == nil; !success {\n\t\treturn\n\t}\n\tdefer func() {\n\t\terr = resp.Body.Close()\n\t}()\n\trespBody, err := ioutil.ReadAll(resp.Body)\n\tif success = err == nil; !success {\n\t\treturn\n\t}\n\tsuccess = string(respBody) == \"1\"\n\treturn\n}", "func (s *TrackerService) Get(trackerName string, id int) (*Ticket, *Response, error) {\n\trel := path.Join(s.client.Project, trackerName, strconv.Itoa(id))\n\n\treq, err := s.client.NewRequest(\"GET\", rel, nil)\n\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tticketResponse := new(TicketResponse)\n\tresp, err := s.client.Do(req, ticketResponse)\n\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn &ticketResponse.Ticket, resp, err\n}", "func (o *SmsTracking) GetTrackOk() (*string, bool) {\n\tif o == nil || o.Track == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Track, true\n}", "func GetListTracks(w http.ResponseWriter, r *http.Request) {\n\tresponse := make(map[string]interface{})\n\tqueuedTracks := context.tq.list()\n\n\tresponse[\"queue\"] = queuedTracks\n\tresponse[\"now_playing\"] = map[string]interface{}{\n\t\t\"track\": context.np.current,\n\t\t\"time_remaining\": context.np.timeRemaining,\n\t}\n\n\tjresponse, _ := json.Marshal(response)\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Write(jresponse)\n}", "func (c *Client) PlayTrack(guildID string, track Track, options ...play.Option) error {\n\treturn c.Play(guildID, track.ID, options...)\n}", "func (ar AlbumDbRepository) Get(id int) (entity domain.Album, err error) {\n\tobject, err := ar.AppContext.DB.Get(domain.Album{}, id)\n\tif err == nil && object != nil {\n\t\tentity = *object.(*domain.Album)\n\t\tar.populateTracks(&entity)\n\t} else {\n\t\terr = errors.New(\"no album found\")\n\t}\n\n\treturn\n}", "func (api *AfterShipApiV4Impl) GetTrackings(params apiV4.GetTrackingsParams) (apiV4.TrackingsData, apiV4.AfterShipApiError) {\n\tvar trackingsEnvelope apiV4.TrackingsEnvelope\n\turl := apiV4.TRACKINGS_ENDPOINT\n\tqueryStringObj, err := query.Values(params)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tqueryString := queryStringObj.Encode()\n\tif queryString != \"\" {\n\t\turl += \"?\" + queryString\n\t}\n\terror := api.request(\"GET\", url, &trackingsEnvelope, nil)\n\treturn trackingsEnvelope.Data, error\n}", "func (api *AfterShipApiV4Impl) GetTracking(id apiV4.TrackingId, fields string, lang string) (apiV4.Tracking, apiV4.AfterShipApiError) {\n\tvar trackingEnvelope apiV4.TrackingEnvelope\n\tvar url string\n\tif id.Id != \"\" {\n\t\turl = apiV4.TRACKINGS_ENDPOINT + \"/\" + id.Id\n\t} else if id.Slug != \"\" && id.TrackingNumber != \"\" {\n\t\turl = apiV4.TRACKINGS_ENDPOINT + \"/\" + id.Slug + \"/\" + id.TrackingNumber\n\t}\n\tfieldsAdded := false\n\tif fields != \"\" {\n\t\turl += \"?fields=\" + fields\n\t\tfieldsAdded = true\n\t}\n\tif lang != \"\" {\n\t\tif fieldsAdded {\n\t\t\turl += \"&\"\n\t\t} else {\n\t\t\turl += \"?\"\n\t\t}\n\t\turl += \"lang=\" + lang\n\t}\n\terr := api.request(\"GET\", url, &trackingEnvelope, nil)\n\treturn trackingEnvelope.Data.Tracking, err\n}", "func (ah *AdminHandler) GetTrackCount(req *router.Request) {\n\ttCnt, err := ah.db.Count(mdb.TRACKS)\n\tif err != nil {\n\t\treq.SendError(&router.Error{StatusCode: http.StatusInternalServerError, Message: \"Internal database error\"})\n\t\treturn\n\t}\n\treq.SendText(strconv.FormatInt(tCnt, 10), http.StatusOK)\n}", "func TestGetTracks(t *testing.T) {\n\tfmt.Println(\"Running test TestGetTracks\")\n\n\tvar response []int\n\n\tif err := sendGetRequest(\"/api/igc\", &response, true); err != nil {\n\t\tt.Fatalf(err.Error())\n\t}\n\n\tif len(response) != 2 {\n\t\tt.Fatalf(\"Expected length of track IDs array to be 2\")\n\t}\n}", "func (search *TrackToSearch) HostSpotifySearchTrack() (*types.SingleTrack, error) {\n\tpayload := url.QueryEscape(fmt.Sprintf(\"track:%s artist:%s\", search.Title, search.Artiste))\n\tsearchURL := fmt.Sprintf(\"%s/v1/search?q=%s&type=track\", os.Getenv(\"SPOTIFY_API_BASE\"), payload)\n\toutput := &types.HostSpotifySearchTrack{}\n\ttoken, err := GetSpotifyAuthToken()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = MakeSpotifyRequest(searchURL, token.AccessToken, output)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// log.Printf(\"\\nOUTPUT HERE: %#v\\n\\n\", output.Tracks)\n\tif len(output.Tracks.Items) > 0 {\n\n\t\tif len(output.Tracks.Items[0].Artists) > 0 {\n\t\t\tbase := output.Tracks.Items[0]\n\t\t\tartistes := []string{}\n\t\t\tfor i := range output.Tracks.Items[0].Artists {\n\t\t\t\tartistes = append(artistes, output.Tracks.Items[0].Artists[i].Name)\n\t\t\t}\n\t\t\ttrack := &types.SingleTrack{\n\t\t\t\tCover: base.Album.Images[0].URL,\n\t\t\t\tDuration: base.DurationMs,\n\t\t\t\tExplicit: base.Explicit,\n\t\t\t\tID: base.ID,\n\t\t\t\tPlatform: util.HostSpotify,\n\t\t\t\tPreview: base.PreviewURL,\n\t\t\t\tReleaseDate: base.Album.ReleaseDate,\n\t\t\t\tTitle: base.Name,\n\t\t\t\tURL: base.ExternalUrls.Spotify,\n\t\t\t\tArtistes: artistes,\n\t\t\t}\n\t\t\treturn track, nil\n\t\t}\n\t}\n\treturn nil, errors.NotFound\n}", "func HostSpotifyGetSingleTrack(spotifyID string, pool *redis.Pool) (*types.SingleTrack, error) {\n\tconn := pool.Get()\n\tdefer conn.Close()\n\tkey := fmt.Sprintf(\"%s-%s\", \"spotify\", spotifyID)\n\tvalues, err := redis.String(conn.Do(\"GET\", key))\n\tif err != nil {\n\t\t// log.Println(\"Error getting single track\")\n\t\tif err == redis.ErrNil {\n\t\t\ttokens, err := GetSpotifyAuthToken()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tsptf := &types.HostSpotifyTrack{}\n\t\t\terr = MakeSpotifyRequest(fmt.Sprintf(\"%s/v1/tracks/%s\", os.Getenv(\"SPOTIFY_API_BASE\"), spotifyID), tokens.AccessToken, sptf)\n\t\t\tsingle := &types.SingleTrack{\n\t\t\t\tCover: sptf.Album.Images[0].URL,\n\t\t\t\tDuration: sptf.DurationMs,\n\t\t\t\tExplicit: sptf.Explicit,\n\t\t\t\tID: sptf.ID,\n\t\t\t\tPlatform: util.HostSpotify,\n\t\t\t\tPreview: sptf.PreviewURL,\n\t\t\t\tReleaseDate: sptf.Album.ReleaseDate,\n\t\t\t\tTitle: sptf.Name,\n\t\t\t\tURL: sptf.ExternalUrls.Spotify,\n\t\t\t\tAlbum: sptf.Album.Name,\n\t\t\t}\n\t\t\tfor _, elem := range sptf.Artists {\n\t\t\t\tsingle.Artistes = append(single.Artistes, elem.Name)\n\t\t\t}\n\n\t\t\tserialize, err := json.Marshal(single)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\t_, err = redis.String(conn.Do(\"SET\", key, string(serialize)))\n\t\t\tif err != nil {\n\t\t\t\t// just log. not handling this error as its none crucial. users dont care it doesnt impact them\n\t\t\t\tlog.Println(\"Error inserting into redis\")\n\t\t\t\tlog.Println(err)\n\t\t\t}\n\t\t\treturn single, err\n\t\t}\n\t}\n\n\tsingle := &types.SingleTrack{}\n\terr = json.Unmarshal([]byte(values), single)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn single, nil\n}", "func (c *Client) TrackList() ([]Track, error) {\n\tres, err := c.Exec(\"get_property\", \"track-list\")\n\tif res == nil {\n\t\treturn nil, err\n\t}\n\t//log.Errorf(\"Data %s\", string(res.Data))\n\tvar ta []Track\n\tif err = json.Unmarshal([]byte(res.Data), &ta); err != nil {\n\t\treturn nil, fmt.Errorf(\"data %s, err %v\", res.Data, err)\n\t}\n\treturn ta, nil\n}", "func (t *SpotifyDevice) PrevTrack() {\n\tif t.client == nil {\n\t\treturn\n\t}\n\tlog.Println(\"Previous track on Spotify device\")\n\tif err := t.client.PreviousOpt(t.playOpts); err != nil {\n\t\tlog.Println(err)\n\t}\n}", "func (e *Event) Track() string {\n\treturn e.track\n}", "func (t *ProgressTracker) Track(src Source) Source {\n\treturn &trackedSource{src, t}\n}", "func GetCurrentTrack() (string, error) {\n\ttrack, err := Mpc(\"current\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn string(track), nil\n}", "func GetTracks(s statefulsort.StatefulSort) []*Track {\n\telements := s.Elements()\n\ttracks := make([]*Track, len(elements))\n\tfor i, e := range elements {\n\t\tt, ok := e.(*Track)\n\t\tif !ok {\n\t\t\tlog.Fatal(\"could not convert interface to *Track\")\n\t\t}\n\t\ttracks[i] = t\n\t}\n\treturn tracks\n}", "func Track_() HTML {\n return Track(nil)\n}", "func ExampleAssetTrackOperationResultsClient_Get() {\n\tcred, err := azidentity.NewDefaultAzureCredential(nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to obtain a credential: %v\", err)\n\t}\n\tctx := context.Background()\n\tclientFactory, err := armmediaservices.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.NewAssetTrackOperationResultsClient().Get(ctx, \"contoso\", \"contosomedia\", \"ClimbingMountRainer\", \"text1\", \"e78f8d40-7aaa-4f2f-8ae6-73987e7c5a08\", 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.AssetTrack = armmediaservices.AssetTrack{\n\t// \tName: to.Ptr(\"text1\"),\n\t// \tType: to.Ptr(\"Microsoft.Media/mediaservices/assets/tracks/operationResults\"),\n\t// \tID: to.Ptr(\"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso/providers/Microsoft.Media/mediaservices/contosomedia/assets/ClimbingMountRainer/tracks/text1/operationResults/e78f8d40-7aaa-4f2f-8ae6-73987e7c5a08\"),\n\t// \tProperties: &armmediaservices.AssetTrackProperties{\n\t// \t\tProvisioningState: to.Ptr(armmediaservices.ProvisioningStateSucceeded),\n\t// \t\tTrack: &armmediaservices.TextTrack{\n\t// \t\t\tODataType: to.Ptr(\"#Microsoft.Media.TextTrack\"),\n\t// \t\t\tDisplayName: to.Ptr(\"Auto generated\"),\n\t// \t\t\tLanguageCode: to.Ptr(\"en-us\"),\n\t// \t\t\tPlayerVisibility: to.Ptr(armmediaservices.VisibilityVisible),\n\t// \t\t},\n\t// \t},\n\t// }\n}", "func getMultipleTracks(store Datastore, w http.ResponseWriter, r *http.Request) {\n\ttracks, totalPages, err := queryMultipleTracks(store , r)\n\tvar result SearchResult\n\tresult.Tracks = tracks\n\tresult.TotalPages = totalPages\n\twriteJSONResponse(w, result, err)\n}", "func GetTrackSettings(cmd *cobra.Command) (int, time.Duration) {\n\tmaxPollRetries, _ := cmd.Flags().GetInt(maxPollRetriesFlag)\n\tpollFrequency, _ := cmd.Flags().GetDuration(pollFrequencyFlag)\n\treturn maxPollRetries, pollFrequency\n}", "func trackHandler(w http.ResponseWriter, r *http.Request, id uuid.UUID) {\n\ttrack, ok := tracks.getTrack(id)\n\n\tif !ok {\n\t\thttp.NotFound(w, r)\n\t\treturn\n\t}\n\n\tjs, err := json.Marshal(track)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Write(js)\n}", "func (s *TickerService) Get(pair string) (*Tick, error) {\n\tpair = strings.ToUpper(pair)\n\treq, err := s.client.newRequest(\"GET\", \"pubticker/\"+pair, nil)\n\n\tif err != nil {\n\t\treturn nil, &ErrorHandler{FuncWhere: \"Ticker Get\", FuncWhat:\"newRequest\", FuncError: err.Error()}\n\t}\n\n\tv := &Tick{}\n\t_, err = s.client.do(req, v)\n\n\tif err != nil {\n\t\treturn nil, &ErrorHandler{FuncWhere: \"Ticker Get\", FuncWhat:\"do\", FuncError: err.Error()}\n\t}\n\n\treturn v, nil\n}", "func (p *Pattern) readTrack() {\n\tif p.lastErr != nil {\n\t\treturn\n\t}\n\n\ttrack := Track{}\n\n\tp.read(&track.ID)\n\n\t// Name's length\n\tvar length uint32\n\tp.read(&length)\n\n\t// Track's name\n\tname := make([]byte, length)\n\tp.read(name)\n\ttrack.Name = string(name)\n\n\t// Track's steps\n\tsteps := make([]byte, trackSteps)\n\tp.read(steps)\n\tcopy(track.Steps[:], steps)\n\n\tp.Tracks = append(p.Tracks, track)\n}", "func NewTrack(distance int) Track {\n\tpanic(\"Please implement the NewTrack function\")\n}", "func (s *Server) GetLyrics(ctx context.Context, track *api.TracksInfo) (*api.LyricsInfo, error) {\n\turi, err := s.GeniusClient.GetSongURL(ctx, track.GetArtist(), track.GetName())\n\tif err != nil {\n\t\tlog.Printf(\"Error geting uri from genius.com: %s\", err)\n\t\turi = \"\"\n\t}\n\n\tlyrics, err := s.GeniusClient.GetSongLyrics(ctx, uri)\n\tif err != nil {\n\t\tlog.Printf(\"Error geting lyrics from genius.com: %s\", err)\n\t\tlyrics = \"\"\n\t}\n\n\tresult := &api.LyricsInfo{\n\t\tGeniusURI: uri,\n\t\tLyrics: lyrics,\n\t}\n\treturn result, nil\n}", "func Track(attrs []htmlgo.Attribute) HTML {\n\treturn &htmlgo.Tree{Tag: \"track\", Attributes: attrs, SelfClosing: true}\n}", "func (p *Store) Get(ctx context.Context, round uint64) (*chain.Beacon, error) {\n\treturn p.get(ctx, round, true)\n}", "func (s *LocalSampleTrack) Kind() webrtc.RTPCodecType { return s.rtpTrack.Kind() }", "func (s MockedRepository) Get(ctx context.Context, albumId string) (*Album, error) {\n\treturn s.GetFn(ctx, albumId)\n}", "func TimeTrack(start time.Time) int64 {\n\telapsed := time.Since(start)\n\treturn elapsed.Nanoseconds() / 1000\n}", "func decodeTrack(r *bytes.Buffer) (*Track, error) {\n\tt := &Track{}\n\n\t// Read track header\n\tth := trackHeader{}\n\terr := binary.Read(r, binary.BigEndian, &th)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tt.Instrument.ID = th.ID\n\terr = t.Instrument.decodeName(r, int(th.NameLen))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Read beats\n\tt.Steps = make([]Step, SpliceTrackLength)\n\tfor i := range t.Steps {\n\t\tc, err := r.ReadByte()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tt.Steps[i] = Step(c)\n\t}\n\treturn t, nil\n}", "func (t *SpotifyDevice) NextTrack() {\n\tif t.client == nil {\n\t\treturn\n\t}\n\tlog.Println(\"Next track on Spotify device\")\n\tif err := t.client.NextOpt(t.playOpts); err != nil {\n\t\tlog.Println(err)\n\t}\n}", "func (o *SmsTracking) SetTrack(v string) {\n\to.Track = &v\n}", "func (t Track) Play() {\n\tpanic(\"implement me\")\n}", "func getPlayer(params martini.Params, w http.ResponseWriter, r *http.Request) {\n\tid := params[\"id\"]\n\tplayer := models.NewPlayer(id)\n\tskue.Read(view, player, nil, w, r)\n}", "func (c *Core) GetTrackLyrics(ctx context.Context, eid string) (edb.Lyrics, error) {\n\ttrackID, err := edb.DecodeEID(eid)\n\tif err != nil {\n\t\treturn edb.Lyrics{}, err\n\t}\n\n\tlyrics, err := edb.GetTrackLyrics(c.DB, trackID)\n\tif err == nil {\n\t\treturn lyrics, nil\n\t} else if !gorm.IsRecordNotFoundError(err) {\n\t\treturn edb.Lyrics{}, err\n\t}\n\n\tvar track edb.Track\n\tif err := c.DB.Preload(\"Artist\").Take(&track).Error; err != nil {\n\t\treturn edb.Lyrics{}, err\n\t}\n\n\tif lyrics, ok := findLyrics(ctx, c.LyricsSearcher, track); ok {\n\t\terr := c.DB.Create(&lyrics).Error\n\t\treturn lyrics, err\n\t}\n\n\treturn edb.Lyrics{}, ErrLyricsNotFound\n}", "func (r *artistResource) get(c *gin.Context) {\n\tid, err := strconv.Atoi(c.Param(\"artistID\"))\n\tif err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": \"ID do artista é inválido\"})\n\t\treturn\n\t}\n\n\tresponse, err := r.service.Get(c, uint(id))\n\tif err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err})\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusFound, gin.H{\n\t\t\"id\": response.ID,\n\t\t\"error\": \"\",\n\t\t\"message\": response,\n\t})\n}", "func Track(props *TrackProps, children ...Element) *TrackElem {\n\trProps := &_TrackProps{\n\t\tBasicHTMLElement: newBasicHTMLElement(),\n\t}\n\n\tif props != nil {\n\t\tprops.assign(rProps)\n\t}\n\n\treturn &TrackElem{\n\t\tElement: createElement(\"track\", rProps, children...),\n\t}\n}", "func (p *Player) play(t *perceptor.Track) error {\n\t// Reset Pause State\n\tPAUSE_DURATION = 0\n\tPAUSE_START = time.Time{}\n\n\t// Get the track\n\ttrack, err := p.loadTrack(t.Uri)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Load the Track\n\tlog.Info(\"Load Track into Player\")\n\tif err := p.player.Load(track); err != nil {\n\t\treturn err\n\t}\n\n\t// Defer unloading the track until we exit this func\n\tdefer p.player.Unload()\n\n\t// Send play event to perspector - go routine so we don't block\n\tgo func() {\n\t\tp.pcptr.Play(t, time.Now().UTC())\n\t\treturn\n\t}()\n\n\t// Play the track\n\tlog.Println(fmt.Sprintf(\"Playing: %s\", t.Uri))\n\tp.player.Play() // This does NOT block, we must block ourselves\n\n\t// Go routine to listen for end of track updates from the player, once we get one\n\t// send a message to our own StopTrack channel\n\tgo func() {\n\t\t<-p.session.EndOfTrackUpdates() // Blocks\n\t\tlog.Debug(\"End of Track Updates\")\n\t\tp.channels.Stop <- true\n\t\treturn\n\t}()\n\n\t<-p.channels.Stop // Blocks\n\tlog.Infof(fmt.Sprintf(\"Track stopped: %s\", t.Uri))\n\n\treturn nil\n}", "func Get(pushURL string) config.Tart {\n\tif config.All().Tarts == nil {\n\t\treturn config.Tart{}\n\t}\n\treturn config.All().Tarts[pushURL]\n}", "func (p *Pattern) FindTrack(name string) *Track {\n\tfor _, t := range p.Tracks {\n\t\tif t.Name == name {\n\t\t\treturn t\n\t\t}\n\t}\n\treturn nil\n}", "func (s *LocalSampleTrack) ID() string { return s.rtpTrack.ID() }", "func Get(exchange string, p currency.Pair, a asset.Item) (*Base, error) {\n\treturn service.Retrieve(exchange, p, a)\n}", "func (o OpenSignal) TrackOpen(notificationID string, track Track) (Response, error) {\n\n\tstrResponse := Response{}\n\n\tURL := f(trackOpen, notificationID)\n\tres, body, errs := o.Client.Put(URL).\n\t\tSet(\"Authorization\", \"Basic \"+o.APIKey).\n\t\tSend(track).\n\t\tEndStruct(&strResponse)\n\terr := catch(res, body)\n\tif err == nil {\n\t\tfor _, e := range errs {\n\t\t\tif e != nil {\n\t\t\t\terr = e\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\treturn strResponse, err\n}", "func (t *itlTrack) GetTime(name string) time.Time {\n\tswitch name {\n\tcase \"DateAdded\":\n\t\treturn t.DateAdded\n\tcase \"DateModified\":\n\t\treturn t.DateModified\n\t}\n\tpanic(fmt.Sprintf(\"field '%v' is not a time value\", name))\n}", "func (r *Room) CurrentTrack() *Track {\n\treturn r.currentTrack\n}", "func (avi *AviSession) Get(uri string) (interface{}, error) {\n\treturn avi.rest_request_interface_response(\"GET\", uri, nil)\n}", "func (s *Server) Get(ctx context.Context, req *pb.GetTweetRequest) (*pb.GetTweetResponse, error) {\n\t// get user infos from context\n\tuserInfos, err := auth.GetUserInfosFromContext(ctx)\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.InvalidArgument, err.Error())\n\t}\n\n\tid := req.GetId()\n\ttweet, err := s.tweetStore.Get(ctx, userInfos.ID, id)\n\tif err != nil {\n\t\treturn nil, status.Errorf(codes.Internal, \"Could not get tweet: %v\", err)\n\t}\n\tres := &pb.GetTweetResponse{\n\t\tTweet: tweet,\n\t}\n\treturn res, nil\n}", "func getSong(w http.ResponseWriter, req *http.Request) {\n\t// params is a map from route paramete\n\tparams := mux.Vars(req)\n\n\t// result store the record that satisfies the condition from Query\n\tresult, err := db.Query(\"SELECT * FROM songs WHERE id = ?\", params[\"id\"])\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tdefer result.Close()\n\n\t// convert the song ID into an int\n\tid, err := strconv.Atoi(params[\"id\"])\n\tif err != nil {\n\t\t// 400 indicates server was unable to process the request sent by the client due to invalid syntax\n\t\tw.WriteHeader(400)\n\t\tw.Write([]byte(\"ID could not be converted to int\"))\n\t\treturn\n\t}\n\n\t// checking if id exists in my DB\n\tif (id > lenSong) || (id < 1) {\n\t\t// 404 indicates page not found\n\t\tw.WriteHeader(404)\n\t\tw.Write([]byte(\"No song found with specified ID\"))\n\t\treturn\n\t}\n\n\tvar song Song\n\n\t// Scan copies the columns in the current row into the values pointed\n\t// at by dest. The number of values in dest must be the same as the\n\t// number of columns in Rows.\n\tfor result.Next() {\n\t\terr := result.Scan(&song.ID, &song.Title, &song.Duration, &song.Singer)\n\t\tif err != nil {\n\t\t\tpanic(err.Error())\n\t\t}\n\t}\n\n\tw.Header().Set(\"Content-type\", \"application/json\")\n\tjson.NewEncoder(w).Encode(song)\n}", "func (c *LastFM) GetSimilarTracks(artist, track string) (*sources.CacheableSimilarTracks, error) {\n\tsongs, err := c.api.Track.GetSimilar(lfm.P{\"artist\": artist, \"track\": track, \"limit\": c.c.MaxTopSimTracks})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to GetSimilarTracks for %s - %s, error: %v\", artist, track, err)\n\t}\n\n\tvar st []string\n\tfor _, tracks := range songs.Tracks {\n\t\tst = append(st, fmt.Sprintf(\"%s by %s\", tracks.Name, tracks.Artist.Name))\n\t}\n\treturn &sources.CacheableSimilarTracks{SimilarTracks: st}, nil\n}", "func (d *DiskStore) Get(hash string) (stream.Blob, shared.BlobTrace, error) {\n\tstart := time.Now()\n\terr := d.initOnce()\n\tif err != nil {\n\t\treturn nil, shared.NewBlobTrace(time.Since(start), d.Name()), err\n\t}\n\n\tblob, err := os.ReadFile(d.path(hash))\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn nil, shared.NewBlobTrace(time.Since(start), d.Name()), errors.Err(ErrBlobNotFound)\n\t\t}\n\t\treturn nil, shared.NewBlobTrace(time.Since(start), d.Name()), errors.Err(err)\n\t}\n\treturn blob, shared.NewBlobTrace(time.Since(start), d.Name()), nil\n}", "func HostSpotifyGetSingleTrackChan(spotifyID string, pool *redis.Pool, ch chan *types.SingleTrack) {\n\tconn := pool.Get()\n\tdefer conn.Close()\n\tkey := fmt.Sprintf(\"%s-%s\", \"spotify\", spotifyID)\n\tvalues, err := redis.String(conn.Do(\"GET\", key))\n\tif err != nil {\n\t\t// log.Println(\"Error getting single track\")\n\t\tif err == redis.ErrNil {\n\t\t\ttokens, err := GetSpotifyAuthToken()\n\t\t\tif err != nil {\n\t\t\t\t// return nil, err\n\t\t\t\tch <- nil\n\t\t\t}\n\n\t\t\tsptf := &types.HostSpotifyTrack{}\n\t\t\terr = MakeSpotifyRequest(fmt.Sprintf(\"%s/v1/tracks/%s\", os.Getenv(\"spotifyApiBase\"), spotifyID), tokens.AccessToken, sptf)\n\n\t\t\tsingle := &types.SingleTrack{\n\t\t\t\tCover: sptf.Album.Images[0].URL,\n\t\t\t\tDuration: sptf.DurationMs,\n\t\t\t\tExplicit: sptf.Explicit,\n\t\t\t\tID: sptf.ID,\n\t\t\t\tPlatform: util.HostSpotify,\n\t\t\t\tPreview: sptf.PreviewURL,\n\t\t\t\tReleaseDate: sptf.Album.ReleaseDate,\n\t\t\t\tTitle: sptf.Name,\n\t\t\t\tURL: sptf.ExternalUrls.Spotify,\n\t\t\t}\n\t\t\tfor _, elem := range sptf.Artists {\n\t\t\t\tsingle.Artistes = append(single.Artistes, elem.Name)\n\t\t\t}\n\n\t\t\tserialize, err := json.Marshal(single)\n\t\t\tif err != nil {\n\t\t\t\t// return nil, err\n\t\t\t\tch <- nil\n\t\t\t}\n\t\t\t_, err = redis.String(conn.Do(\"SET\", key, string(serialize)))\n\t\t\tif err != nil {\n\t\t\t\t// just log. not handling this error as its none crucial. users dont care it doesnt impact them\n\t\t\t\tlog.Println(\"Error inserting into redis\")\n\t\t\t\tlog.Println(err)\n\t\t\t}\n\t\t\t// return single, err\n\t\t\tch <- single\n\t\t\treturn\n\t\t}\n\t}\n\n\tsingle := &types.SingleTrack{}\n\terr = json.Unmarshal([]byte(values), single)\n\tif err != nil {\n\t\t// return nil, err\n\t\tch <- nil\n\t\treturn\n\t}\n\n\tch <- single\n}", "func (s Song) GetSamplesForTick(tickIndex int) (string, []string) {\n var trackNames []string\n var samplePaths []string\n\n for _, currentTrack := range s.TrackList {\n if currentTrack.ShouldSountAt(tickIndex) {\n trackNames = append(trackNames, currentTrack.Name)\n samplePaths = append(samplePaths, currentTrack.PathToSample)\n }\n }\n if len(trackNames) < 1 {\n return \"-\", nil\n }\n //Join the name of all the samples\n return strings.Join(trackNames, \"+\"), samplePaths\n}", "func (hc *Actions) Get(name string) (*release.Release, error) {\n\tactGet := action.NewGet(hc.Config)\n\treturn actGet.Run(name)\n}", "func (t *FakeObjectTracker) Get(gvr schema.GroupVersionResource, ns, name string) (runtime.Object, error) {\n\tvar err error\n\tif t.fakingOptions.failAll != nil {\n\t\terr = t.fakingOptions.failAll.RunFakeInvocations()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif t.fakingOptions.failAt != nil {\n\t\tif gvr.Resource == \"nodes\" {\n\t\t\terr = t.fakingOptions.failAt.Node.Get.RunFakeInvocations()\n\t\t} else if gvr.Resource == \"machines\" {\n\t\t\terr = t.fakingOptions.failAt.Machine.Get.RunFakeInvocations()\n\t\t} else if gvr.Resource == \"machinesets\" {\n\t\t\terr = t.fakingOptions.failAt.MachineSet.Get.RunFakeInvocations()\n\t\t} else if gvr.Resource == \"machinedeployments\" {\n\t\t\terr = t.fakingOptions.failAt.MachineDeployment.Get.RunFakeInvocations()\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn t.delegatee.Get(gvr, ns, name)\n}", "func getTracksDay(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tif _, err := conf.DS.GetRadiostationID(vars[\"station\"]); err != nil {\n\t\tlog.Printf(\"getTracksDay Handler: GetRadiostationID(%s): %s\\n\", vars[\"station\"], err.Error())\n\t\thandleError(w, http.StatusBadRequest, \"Bad request\")\n\t\treturn\n\t}\n\n\tt, err := time.Parse(\"2006-01-02\", vars[\"date\"])\n\tif err != nil {\n\t\tlog.Printf(\"getTracksDay Handler: time.Parse(%s): %s\\n\", vars[\"date\"], err.Error())\n\t\thandleError(w, http.StatusBadRequest, \"Bad request\")\n\t\treturn\n\t}\n\n\tloc, _ := time.LoadLocation(\"Europe/Vienna\")\n\tsince := time.Date(\n\t\tt.Year(),\n\t\tt.Month(),\n\t\tt.Day(),\n\t\t0, 0, 0, 0,\n\t\tloc,\n\t)\n\tuntil := time.Date(\n\t\tt.Year(),\n\t\tt.Month(),\n\t\tt.Day(),\n\t\t23, 59, 59, 0,\n\t\tloc,\n\t)\n\n\tvar tracks []model.Track\n\tif vars[\"filter\"] == \"top\" {\n\t\ttracks, err = conf.DS.GetTopTracks(vars[\"station\"], since, until)\n\t} else {\n\t\ttracks, err = conf.DS.GetAllTracks(vars[\"station\"], since, until)\n\t}\n\tif err != nil {\n\t\tlog.Printf(\"getTracksDay Handler: GetTopTracks/GetAllTracks(%s, %q, %q): %s\\n\", vars[\"station\"],\n\t\t\tsince, until, err.Error())\n\t\thandleError(w, http.StatusInternalServerError, \"Internal server error\")\n\t\treturn\n\t}\n\n\ttype response struct {\n\t\tStation string `json:\"station\"`\n\t\tDate string `json:\"date\"`\n\t\tPlays []model.Track `json:\"plays\"`\n\t}\n\n\tresp := response{vars[\"station\"], vars[\"date\"], tracks}\n\tj, err := jsonMarshal(resp)\n\tif err != nil {\n\t\tlog.Printf(\"getTracksDay Handler: %s\\n\", err.Error())\n\t\thandleError(w, http.StatusInternalServerError, \"Internal server error\")\n\t\treturn\n\t}\n\twriteJSONResponse(w, j)\n}", "func GetProduceTracking(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tvar Avalbytes []byte\n\tproducetrackinginfo := ProduceInfo{}\n\tproduce, presult := QueryProduceAssetInfo(stub, args)\n\n\tif presult == true {\n\t\tproducetrackinginfo.ProduceID = produce.ProduceID\n\t\tvarietycount := len(produce.ProduceQuantities)\n\t\tlogger.Infof(\"GetProduceTracking: Total variety fount is %d : \", varietycount)\n\t\tif varietycount == 0 {\n\t\t\tlogger.Errorf(\"GetProduceTracking : No variety found in Ledger for produceId id as %s\", args[0])\n\t\t\treturn shim.Error(fmt.Sprintf(\"GetProduceTracking : No variety found in Ledger for produceId id as %s\", args[0]))\n\t\t} //Variety count end loop\n\t\tvar verityInfoList []VerityInfo\n\t\t//Variety parsing loop start\n\t\tfor vid := 0; vid < varietycount; vid++ {\n\t\t\tlogger.Infof(\"GetProduceTracking: Total variety Name is %s : \", produce.ProduceQuantities[vid].VarietyType)\n\t\t\tvar veritykey []string\n\t\t\tverityinfo := VerityInfo{}\n\t\t\tverityinfo.Name = produce.ProduceQuantities[vid].VarietyType\n\t\t\tveritykey = append(veritykey, produce.ProduceID, produce.ProduceQuantities[vid].VarietyType)\n\n\t\t\tverityinfo.OrderInfos = ProduceOrderList(stub, veritykey)\n\t\t\tlogger.Infof(\"GetProduceTracking: verityinfo with order details is %+v : \", verityinfo)\n\t\t\tverityInfoList = append(verityInfoList, verityinfo)\n\t\t\tlogger.Infof(\"verityInfoList is %v\", verityInfoList)\n\t\t}\n\t\tproducetrackinginfo.Varieties = verityInfoList\n\t\tlogger.Infof(\"producetrackinginfo is %v\", producetrackinginfo)\n\n\t} else {\n\t\tlogger.Errorf(\"GetProduceTracking : No Produce found in Ledger with id as %s\", args[0])\n\t\treturn shim.Error(fmt.Sprintf(\"GetProduceTracking : No Produce found in Ledger with id as %s\", args[0]))\n\t}\n\tAvalbytes, _ = json.Marshal(&producetrackinginfo)\n\n\treturn shim.Success([]byte(Avalbytes))\n}", "func Get(client *gophercloud.ServiceClient, id string) (r GetResult) {\n\tresp, err := client.Get(getURL(client, id), &r.Body, nil)\n\t_, r.Header, r.Err = gophercloud.ParseResponse(resp, err)\n\treturn\n}", "func Get(client *gophercloud.ServiceClient, id string) (r GetResult) {\n\tresp, err := client.Get(getURL(client, id), &r.Body, nil)\n\t_, r.Header, r.Err = gophercloud.ParseResponse(resp, err)\n\treturn\n}", "func Get(client *gophercloud.ServiceClient, id string) (r GetResult) {\n\tresp, err := client.Get(getURL(client, id), &r.Body, nil)\n\t_, r.Header, r.Err = gophercloud.ParseResponse(resp, err)\n\treturn\n}", "func Get(client *gophercloud.ServiceClient, id string) (r GetResult) {\n\tresp, err := client.Get(getURL(client, id), &r.Body, &gophercloud.RequestOpts{OkCodes: []int{200}})\n\t_, r.Header, r.Err = gophercloud.ParseResponse(resp, err)\n\treturn\n}", "func (p *tubePool) get() (tube, error) {\n\tctx := context.Background()\n\tif p.timeout > 0 {\n\t\tvar cancelFn func()\n\t\tctx, cancelFn = context.WithTimeout(ctx, p.timeout)\n\t\tdefer cancelFn()\n\t}\n\treturn p.getWithContext(ctx, false, RequestOptions{})\n}", "func Get(client *gophercloud.ServiceClient, id string) (r GetResult) {\r\n\t_, r.Err = client.Get(getURL(client, id), &r.Body, nil)\r\n\treturn\r\n}", "func Get(client *gophercloud.ServiceClient, id string) (r GetResult) {\n\tresp, err := client.Get(getURL(client, id), &r.Body, &gophercloud.RequestOpts{\n\t\tOkCodes: []int{200, 203},\n\t})\n\t_, r.Header, r.Err = gophercloud.ParseResponse(resp, err)\n\treturn\n}", "func (p *Pvr) GetTrackURL(appname string) (string, error) {\n\tappManifest, err := p.GetApplicationManifest(appname)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif appManifest.DockerName == \"\" {\n\t\treturn \"\", err\n\t}\n\n\ttrackURL := appManifest.DockerName\n\tif appManifest.DockerTag != \"\" {\n\t\ttrackURL += fmt.Sprintf(\":%s\", appManifest.DockerTag)\n\t}\n\treturn trackURL, nil\n}", "func (sr *StoredRecording) Get(key *ari.Key) *ari.StoredRecordingHandle {\n\treturn ari.NewStoredRecordingHandle(key, sr, nil)\n}", "func (cli *OpsGenieTeamClient) Get(req team.GetTeamRequest) (*team.GetTeamResponse, error) {\n\treq.APIKey = cli.apiKey\n\tresp, err := cli.sendRequest(cli.buildGetRequest(teamURL, req))\n\n\tif resp == nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tvar getTeamResp team.GetTeamResponse\n\n\tif err = resp.Body.FromJsonTo(&getTeamResp); err != nil {\n\t\tmessage := \"Server response can not be parsed, \" + err.Error()\n\t\tlogging.Logger().Warn(message)\n\t\treturn nil, errors.New(message)\n\t}\n\treturn &getTeamResp, nil\n}", "func (t *Track) Echo(c echo.Context) error {\n\n\ti := c.Param(\"track\")\n\n\tid, err := strconv.Atoi(i)\n\tif err != nil {\n\t\tlogrus.Warn(err)\n\t\treturn err\n\t}\n\n\ts := c.Param(\"station\")\n\tsid, err := strconv.Atoi(s)\n\tif err != nil {\n\t\tlogrus.Warn(err)\n\t\treturn err\n\t}\n\n\tt.ID = uint(id)\n\tt.StationID = uint(sid)\n\n\treturn t.Get()\n\n}", "func Get(c *gophercloud.ServiceClient, id string) (r GetResult) {\n\tresp, err := c.Get(getURL(c, id), &r.Body, nil)\n\t_, r.Header, r.Err = gophercloud.ParseResponse(resp, err)\n\treturn\n}", "func Get(c *gophercloud.ServiceClient, id string) (r GetResult) {\n\tresp, err := c.Get(getURL(c, id), &r.Body, nil)\n\t_, r.Header, r.Err = gophercloud.ParseResponse(resp, err)\n\treturn\n}", "func (r *YoutubeRepository) GetSongByNameArtist(name string, artist string) (filePath string, err error) {\n\tfileName := fmt.Sprintf(\"/tmp/%s_%s\", name, artist)\n\tfilePath = fileName + \".mp3\"\n\n\tcmd := exec.Command(\"youtube-dl\", \"--extract-audio\", \"--audio-format\", \"mp3\",\n\t\t\"--ignore-errors\", \"--output\", fileName+\".%(ext)s\",\n\t\tfmt.Sprintf(\"ytsearch1: %s %s\", name, artist))\n\terr = cmd.Run()\n\tif err != nil {\n\t\terr = errors.Wrapf(err, \"run cmd:%s failed\", cmd.String())\n\t\treturn\n\t}\n\treturn\n}", "func (cs *CoverService) Get(id int, opts ...Option) (*Cover, error) {\n\tif id < 0 {\n\t\treturn nil, ErrNegativeID\n\t}\n\n\tvar cov []*Cover\n\n\topts = append(opts, SetFilter(\"id\", OpEquals, strconv.Itoa(id)))\n\terr := cs.client.post(cs.end, &cov, opts...)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"cannot get Cover with ID %v\", id)\n\t}\n\n\treturn cov[0], nil\n}", "func (c *TrialController) Get(w http.ResponseWriter, r *http.Request,\n\tp httprouter.Params) {\n\n\tstudy, trial := p.ByName(\"study\"), p.ByName(\"trial\")\n\tid := fmt.Sprintf(\"/studies/%s/trials/%s\", study, trial)\n\tdata, err := c.studies.Get([]byte(id))\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), 500)\n\t\treturn\n\t}\n\tif data == nil {\n\t\thttp.Error(w, id+\" not found\", http.StatusNoContent)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Write(data)\n}", "func (search *TrackToSearch) HostSpotifySearchTrackChan(ch chan *types.SingleTrack) {\n\tpayload := url.QueryEscape(fmt.Sprintf(\"track:%s artist:%s\", search.Title, search.Artiste))\n\tsearchURL := fmt.Sprintf(\"%s/v1/search?q=%s&type=track\", os.Getenv(\"SPOTIFY_API_BASE\"), payload)\n\toutput := &types.HostSpotifySearchTrack{}\n\ttoken, err := GetSpotifyAuthToken()\n\tif err != nil {\n\t\t// return nil, err\n\t\tch <- nil\n\t}\n\n\terr = MakeSpotifyRequest(searchURL, token.AccessToken, output)\n\tif err != nil {\n\t\t// return nil, err\n\t\tch <- nil\n\t}\n\t// log.Printf(\"\\nOUTPUT HERE: %#v\\n\\n\", output.Tracks)\n\tif len(output.Tracks.Items) > 0 {\n\n\t\tif len(output.Tracks.Items[0].Artists) > 0 {\n\t\t\tbase := output.Tracks.Items[0]\n\t\t\tartistes := []string{}\n\t\t\tfor i := range output.Tracks.Items[0].Artists {\n\t\t\t\tartistes = append(artistes, output.Tracks.Items[0].Artists[i].Name)\n\t\t\t}\n\t\t\ttrack := &types.SingleTrack{\n\t\t\t\tCover: base.Album.Images[0].URL,\n\t\t\t\tDuration: base.DurationMs,\n\t\t\t\tExplicit: base.Explicit,\n\t\t\t\tID: base.ID,\n\t\t\t\tPlatform: util.HostSpotify,\n\t\t\t\tPreview: base.PreviewURL,\n\t\t\t\tReleaseDate: base.Album.ReleaseDate,\n\t\t\t\tTitle: base.Name,\n\t\t\t\tURL: base.ExternalUrls.Spotify,\n\t\t\t\tArtistes: artistes,\n\t\t\t}\n\t\t\t// return track, nil\n\t\t\tch <- track\n\t\t\t// log.Printf(\"TITLE OF TRACK ON SPOTIFY IS: %s\", track.Title)\n\t\t\treturn\n\t\t}\n\t}\n\t// return nil, errors.NotFound\n\tch <- nil\n}", "func (c *gitTracks) Create(gitTrack *v1alpha1.GitTrack) (result *v1alpha1.GitTrack, err error) {\n\tresult = &v1alpha1.GitTrack{}\n\terr = c.client.Post().\n\t\tNamespace(c.ns).\n\t\tResource(\"gittracks\").\n\t\tBody(gitTrack).\n\t\tDo().\n\t\tInto(result)\n\treturn\n}", "func Get(c *gophercloud.ServiceClient, alias string) (r GetResult) {\n\t_, r.Err = c.Get(ExtensionURL(c, alias), &r.Body, nil)\n\treturn\n}" ]
[ "0.78237474", "0.7451286", "0.73531646", "0.7224465", "0.70328", "0.69326556", "0.6618564", "0.64577234", "0.6433826", "0.62471545", "0.6206292", "0.61804134", "0.6076547", "0.59384924", "0.5868577", "0.58488387", "0.5775144", "0.57390493", "0.56116", "0.5512071", "0.5480633", "0.5465473", "0.53986025", "0.5394939", "0.53926355", "0.53727424", "0.5364487", "0.53625387", "0.5361823", "0.5350867", "0.5345292", "0.5344545", "0.5336928", "0.52897435", "0.52876997", "0.52773935", "0.5263804", "0.5250127", "0.5230676", "0.52183616", "0.5212864", "0.5205239", "0.5160747", "0.51590353", "0.5132859", "0.51040393", "0.5098498", "0.50811946", "0.50621504", "0.50433135", "0.50296164", "0.50264543", "0.5020994", "0.50128376", "0.49895775", "0.49866763", "0.49811122", "0.49742445", "0.49692544", "0.49621516", "0.49596778", "0.49400526", "0.4939348", "0.49342948", "0.49253976", "0.49095848", "0.48863482", "0.48843566", "0.48767218", "0.4868526", "0.48639485", "0.48492402", "0.48442262", "0.48256695", "0.48219913", "0.48069605", "0.4805895", "0.47936553", "0.47904325", "0.477219", "0.47608277", "0.47575924", "0.47575924", "0.47575924", "0.47552624", "0.47547957", "0.47517323", "0.47506285", "0.4741244", "0.47398818", "0.47358465", "0.4733988", "0.47303686", "0.47303686", "0.47281978", "0.47280324", "0.47209176", "0.4715843", "0.4702589", "0.4702134" ]
0.71738195
4
GetFullWorkshop returns a full presentation, with the speaker populated.
func GetFullWorkshop(id int) (Workshop, error) { var p Workshop pl, err := GetWorkshop(id) if err != nil { return p, err } p.Workshop = pl for _, s := range pl.Speakers { id, err := getID(s) if err != nil { fmt.Println(err, id, s) continue } sp, err := GetSpeaker(id) if err != nil { fmt.Println(err) continue } p.Speakers = append(p.Speakers, sp) } return p, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func GetWorkshop(user *User) (Workshop, error) {\n\tworkshop := Workshop{}\n\tif shared.GetDb().Set(\"gorm:auto_preload\", true).Where(\"user_id = ?\", user.ID).First(&workshop).RecordNotFound() {\n\t\treturn workshop, errors.New(\"No se encontro el este usuario como taller\")\n\t}\n\treturn workshop, nil\n}", "func (m *TeamworkActivePeripherals) GetSpeaker()(TeamworkPeripheralable) {\n val, err := m.GetBackingStore().Get(\"speaker\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(TeamworkPeripheralable)\n }\n return nil\n}", "func GetWorkshopByID(workShopID int64) (Workshop, error) {\n\tworkshop := Workshop{}\n\tif shared.GetDb().Set(\"gorm:auto_preload\", true).Where(\"id = ?\", workShopID).First(&workshop).RecordNotFound() {\n\t\treturn workshop, errors.New(\"No se encontro un taller\")\n\t}\n\treturn workshop, nil\n}", "func (f *Firework) Firework() item.Firework {\n\treturn f.firework\n}", "func TeamSpecializationPEducationStaff() *TeamSpecialization {\n\tv := TeamSpecializationVEducationStaff\n\treturn &v\n}", "func (mc *ModelCatalog) WorksetTextFull(dn, wsn string, isAllLang bool, preferredLang []language.Tag) (*db.WorksetPub, bool, error) {\r\n\r\n\t// if model digest-or-name or workset name is empty then return empty results\r\n\tif dn == \"\" {\r\n\t\tomppLog.Log(\"Warning: invalid (empty) model digest and name\")\r\n\t\treturn &db.WorksetPub{}, false, nil\r\n\t}\r\n\tif wsn == \"\" {\r\n\t\tomppLog.Log(\"Warning: invalid (empty) workset name\")\r\n\t\treturn &db.WorksetPub{}, false, nil\r\n\t}\r\n\r\n\t// get model metadata and database connection\r\n\tmeta, dbConn, ok := mc.modelMeta(dn)\r\n\tif !ok {\r\n\t\tomppLog.Log(\"Warning: model digest or name not found: \", dn)\r\n\t\treturn &db.WorksetPub{}, false, nil // return empty result: model not found or error\r\n\t}\r\n\r\n\t// get workset_lst db row by name\r\n\tw, err := db.GetWorksetByName(dbConn, meta.Model.ModelId, wsn)\r\n\tif err != nil {\r\n\t\tomppLog.Log(\"Error at get workset status: \", dn, \": \", wsn, \": \", err.Error())\r\n\t\treturn &db.WorksetPub{}, false, err // return empty result: workset select error\r\n\t}\r\n\tif w == nil {\r\n\t\t// omppLog.Log(\"Warning workset status not found: \", dn, \": \", wsn)\r\n\t\treturn &db.WorksetPub{}, false, nil // return empty result: workset_lst row not found\r\n\t}\r\n\r\n\t// get full workset metadata using matched preferred language or in all languages\r\n\tlc := \"\"\r\n\tif !isAllLang {\r\n\r\n\t\tlc = mc.languageTagMatch(dn, preferredLang)\r\n\t\tif lc == \"\" {\r\n\t\t\tomppLog.Log(\"Error: invalid (empty) model default language: \", dn, \": \", w.Name)\r\n\t\t\treturn &db.WorksetPub{}, false, err // return empty result: workset select error\r\n\t\t}\r\n\t}\r\n\r\n\twm, err := db.GetWorksetFull(dbConn, w, lc)\r\n\tif err != nil {\r\n\t\tomppLog.Log(\"Error at get workset metadata: \", dn, \": \", w.Name, \": \", err.Error())\r\n\t\treturn &db.WorksetPub{}, false, err // return empty result: workset select error\r\n\t}\r\n\r\n\t// convert to \"public\" model workset format\r\n\twp, err := wm.ToPublic(dbConn, meta)\r\n\tif err != nil {\r\n\t\tomppLog.Log(\"Error at workset conversion: \", dn, \": \", w.Name, \": \", err.Error())\r\n\t\treturn &db.WorksetPub{}, false, err // return empty result: conversion error\r\n\t}\r\n\r\n\treturn wp, true, nil\r\n}", "func (c *Country) Full() string {\n\treturn c.full\n}", "func (m *TeamworkActivePeripherals) GetCommunicationSpeaker()(TeamworkPeripheralable) {\n val, err := m.GetBackingStore().Get(\"communicationSpeaker\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(TeamworkPeripheralable)\n }\n return nil\n}", "func (c Client) GetShop(shopName string) {\n\tendpoint := fmt.Sprintf(\"shops?shop_name=%s\", shopName)\n\tc.makeGetRequest(endpoint)\n}", "func ShopGet(c *fiber.Ctx) {\n\tshopID := c.Params(\"shop_id\")\n\n\tvar SQLResponse SQLGetShop\n\tvar response ShopPointerGet\n\n\tshopResultsError := sq.Select(\n\t\t\"shop.shop_id\",\n\t\t\"shop.shop_name\",\n\t\t\"shop.address\",\n\t\t\"shop.phone\",\n\t\t\"shop.phone2\",\n\t\t\"shop.description\",\n\t\t\"shop.cover_image\",\n\t\t\"shop.accept_card\",\n\t\t\"shop.list_cards\",\n\t\t\"shop.lat\",\n\t\t\"shop.lon\",\n\t\t\"shop.score_shop\",\n\t\t\"shop.status\",\n\t\t\"shop.logo\",\n\t\t\"shop.service_type_id\",\n\t\t\"shop.sub_service_type_id\",\n\t\t\"shop_schedules.LUN\",\n\t\t\"shop_schedules.MAR\",\n\t\t\"shop_schedules.MIE\",\n\t\t\"shop_schedules.JUE\",\n\t\t\"shop_schedules.VIE\",\n\t\t\"shop_schedules.SAB\",\n\t\t\"shop_schedules.DOM\",\n\t\t\"usersk.user_id\",\n\t\t\"GROUP_CONCAT(coalesce(images_shop.url_image, '')) AS images\",\n\t).\n\t\tFrom(\"shop\").\n\t\tLeftJoin(\"images_shop on images_shop.shop_id = shop.shop_id\").\n\t\tLeftJoin(\"shop_schedules on shop_schedules.shop_id = shop.shop_id\").\n\t\tLeftJoin(\"usersk on usersk.user_id = shop.user_id\").\n\t\tWhere(\"shop.shop_id = ?\", shopID).\n\t\tGroupBy(\n\t\t\t\"shop.shop_id\",\n\t\t\t\"shop.shop_name\",\n\t\t\t\"shop.address\",\n\t\t\t\"shop.phone\",\n\t\t\t\"shop.phone2\",\n\t\t\t\"shop.description\",\n\t\t\t\"shop.cover_image\",\n\t\t\t\"shop.accept_card\",\n\t\t\t\"shop.list_cards\",\n\t\t\t\"shop.lat\",\n\t\t\t\"shop.lon\",\n\t\t\t\"shop.score_shop\",\n\t\t\t\"shop.status\",\n\t\t\t\"shop.logo\",\n\t\t\t\"shop.service_type_id\",\n\t\t\t\"shop.sub_service_type_id\",\n\t\t\t\"shop_schedules.LUN\",\n\t\t\t\"shop_schedules.MAR\",\n\t\t\t\"shop_schedules.MIE\",\n\t\t\t\"shop_schedules.JUE\",\n\t\t\t\"shop_schedules.VIE\",\n\t\t\t\"shop_schedules.SAB\",\n\t\t\t\"shop_schedules.DOM\",\n\t\t\t\"usersk.user_id\",\n\t\t).\n\t\tRunWith(database).\n\t\tQueryRow().\n\t\tScan(\n\t\t\t&SQLResponse.ShopID,\n\t\t\t&SQLResponse.ShopName,\n\t\t\t&SQLResponse.Address,\n\t\t\t&SQLResponse.Phone,\n\t\t\t&SQLResponse.Phone2,\n\t\t\t&SQLResponse.Description,\n\t\t\t&SQLResponse.CoverImage,\n\t\t\t&SQLResponse.AcceptCard,\n\t\t\t&SQLResponse.ListCards,\n\t\t\t&SQLResponse.Lat,\n\t\t\t&SQLResponse.Lon,\n\t\t\t&SQLResponse.ScoreShop,\n\t\t\t&SQLResponse.Status,\n\t\t\t&SQLResponse.Logo,\n\t\t\t&SQLResponse.ServiceTypeID,\n\t\t\t&SQLResponse.SubServiceTypeID,\n\t\t\t&SQLResponse.LUN,\n\t\t\t&SQLResponse.MAR,\n\t\t\t&SQLResponse.MIE,\n\t\t\t&SQLResponse.JUE,\n\t\t\t&SQLResponse.VIE,\n\t\t\t&SQLResponse.SAB,\n\t\t\t&SQLResponse.DOM,\n\t\t\t&SQLResponse.UserID,\n\t\t\t&SQLResponse.Images,\n\t\t)\n\n\tif shopResultsError != nil {\n\t\tfmt.Println(shopResultsError, \"Error get Shops\")\n\t\tc.JSON(ErrorResponse{MESSAGE: \"Problem with get shops\"})\n\t\tc.SendStatus(400)\n\t\treturn\n\t}\n\n\tresponse.ShopID = &SQLResponse.ShopID.String\n\tresponse.ShopName = &SQLResponse.ShopName.String\n\tresponse.Address = &SQLResponse.Address.String\n\tresponse.Phone = &SQLResponse.Phone.String\n\tresponse.Phone2 = &SQLResponse.Phone2.String\n\tresponse.Description = &SQLResponse.Description.String\n\tresponse.CoverImage = &SQLResponse.CoverImage.String\n\tresponse.AcceptCard = &SQLResponse.AcceptCard.String\n\tresponse.Lat = &SQLResponse.Lat.String\n\tresponse.Lon = &SQLResponse.Lon.String\n\tresponse.ScoreShop = &SQLResponse.ScoreShop.String\n\tresponse.Status = &SQLResponse.Status.String\n\tresponse.Logo = &SQLResponse.Logo.String\n\tresponse.ServiceTypeID = &SQLResponse.ServiceTypeID.String\n\tresponse.SubServiceTypeID = &SQLResponse.SubServiceTypeID.String\n\tresponse.LUN = &SQLResponse.LUN.String\n\tresponse.MAR = &SQLResponse.MAR.String\n\tresponse.MIE = &SQLResponse.MIE.String\n\tresponse.JUE = &SQLResponse.JUE.String\n\tresponse.VIE = &SQLResponse.VIE.String\n\tresponse.SAB = &SQLResponse.SAB.String\n\tresponse.DOM = &SQLResponse.DOM.String\n\tresponse.UserID = &SQLResponse.UserID.String\n\n\tListCardsConverter := &SQLResponse.ListCards.String\n\tListCardsSimple := strings.Replace(*ListCardsConverter, \"[\", \"\", -1)\n\tListCardsSimple = strings.Replace(ListCardsSimple, \"]\", \"\", -1)\n\tListCardsSimple = strings.Replace(ListCardsSimple, \"\\\"\", \"\", -1)\n\tListCardsSimple = strings.Replace(ListCardsSimple, \"]\", \"\", -1)\n\tListCards := strings.Split(ListCardsSimple, \",\")\n\n\tfor i := 0; i < len(ListCards); i++ {\n\t\tresponse.ListCards = append(response.ListCards, ListCards[i])\n\t}\n\n\tListImagesConverter := &SQLResponse.Images.String\n\tImages := strings.Split(*ListImagesConverter, \",\")\n\n\tfor i := 0; i < len(Images); i++ {\n\t\tresponse.Images = append(response.Images, Images[i])\n\t}\n\n\tc.JSON(response)\n}", "func (c *CoWIdler) Full() *idling.Idler {\n\tif c.newStatus == nil {\n\t\treturn c.original\n\t}\n\n\tcopiedIdler := c.original.DeepCopy()\n\tcopiedIdler.Status = *c.newStatus\n\n\tc.newStatus = nil\n\tc.original = copiedIdler\n\n\treturn c.original\n}", "func (o *Command) GetPresentation(rw io.Writer, req io.Reader) command.Error {\n\tvar request IDArg\n\n\terr := json.NewDecoder(req).Decode(&request)\n\tif err != nil {\n\t\tlogutil.LogInfo(logger, CommandName, GetPresentationCommandMethod, err.Error())\n\t\treturn command.NewValidationError(InvalidRequestErrorCode, fmt.Errorf(\"request decode : %w\", err))\n\t}\n\n\tif request.ID == \"\" {\n\t\tlogutil.LogDebug(logger, CommandName, GetPresentationCommandMethod, errEmptyPresentationID)\n\t\treturn command.NewValidationError(InvalidRequestErrorCode, fmt.Errorf(errEmptyPresentationID))\n\t}\n\n\tvp, err := o.verifiableStore.GetPresentation(request.ID)\n\tif err != nil {\n\t\tlogutil.LogError(logger, CommandName, GetPresentationCommandMethod, \"get vp : \"+err.Error(),\n\t\t\tlogutil.CreateKeyValueString(vpID, request.ID))\n\n\t\treturn command.NewValidationError(GetPresentationErrorCode, fmt.Errorf(\"get vp : %w\", err))\n\t}\n\n\tvpBytes, err := vp.MarshalJSON()\n\tif err != nil {\n\t\tlogutil.LogError(logger, CommandName, GetPresentationCommandMethod, \"marshal vp : \"+err.Error(),\n\t\t\tlogutil.CreateKeyValueString(vpID, request.ID))\n\n\t\treturn command.NewValidationError(GetPresentationErrorCode, fmt.Errorf(\"marshal vp : %w\", err))\n\t}\n\n\tcommand.WriteNillableResponse(rw, &Presentation{\n\t\tVerifiablePresentation: vpBytes,\n\t}, logger)\n\n\tlogutil.LogDebug(logger, CommandName, GetPresentationCommandMethod, \"success\",\n\t\tlogutil.CreateKeyValueString(vpID, request.ID))\n\n\treturn nil\n}", "func (c *Client) Get(ctx context.Context, p *GetPayload) (res *StationFull, err error) {\n\tvar ires interface{}\n\tires, err = c.GetEndpoint(ctx, p)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn ires.(*StationFull), nil\n}", "func (m *WorkforceIntegration) GetDisplayName()(*string) {\n return m.displayName\n}", "func CurrentSpeakerChyron(store *projector.SlideStore) {\n\tstore.RegisterSliderFunc(\"current_speaker_chyron\", func(ctx context.Context, fetch *datastore.Fetcher, p7on *projector.Projection) (encoded []byte, err error) {\n\t\tlosID, projectorID, err := getLosID(ctx, p7on.ContentObjectID, fetch)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error in getLosID: %w\", err)\n\t\t}\n\t\tmeetingID, err := strconv.Atoi(strings.Split(p7on.ContentObjectID, \"/\")[1])\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error in Atoi with ContentObjectID: %w\", err)\n\t\t}\n\n\t\tprojector := &dbChyronProjector{}\n\t\tif projectorID > 0 {\n\t\t\tdata := fetch.Object(ctx, fmt.Sprintf(\"projector/%d\", projectorID), \"chyron_background_color\", \"chyron_font_color\")\n\t\t\tprojector, err = chyronProjectorFromMap(data)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"error in get chyron projector: %w\", err)\n\t\t\t}\n\t\t}\n\n\t\tvar shortName, structureLevel string\n\t\tif losID > 0 {\n\t\t\tshortName, structureLevel, err = getCurrentSpeakerData(ctx, fetch, losID, meetingID)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"get CurrentSpeakerData: %w\", err)\n\t\t\t}\n\t\t\tif err := fetch.Err(); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\n\t\tout := struct {\n\t\t\tBackgroundColor string `json:\"background_color\"`\n\t\t\tFontColor string `json:\"font_color\"`\n\t\t\tCurrentSpeakerName string `json:\"current_speaker_name\"`\n\t\t\tCurrentSpeakerLevel string `json:\"current_speaker_level\"`\n\t\t}{\n\t\t\tprojector.ChyronBackgroundColor,\n\t\t\tprojector.ChyronFontColor,\n\t\t\tshortName,\n\t\t\tstructureLevel,\n\t\t}\n\n\t\tresponseValue, err := json.Marshal(out)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"encoding response slide current_speaker_chyron: %w\", err)\n\t\t}\n\t\treturn responseValue, nil\n\t})\n}", "func GetAllWorkshop(search string) ([]Workshop, error) {\n\tworkshop := []Workshop{}\n\tsearchByName := \"\"\n\n\tif search != \"\" {\n\t\tsearchByName = \"name LIKE '%\" + search + \"%'\"\n\t}\n\n\tif shared.GetDb().Set(\"gorm:auto_preload\", true).Where(searchByName).Find(&workshop).RecordNotFound() {\n\t\treturn workshop, errors.New(\"No se encontro el este usuario como taller\")\n\t}\n\n\treturn workshop, nil\n}", "func (m *OnlineMeetingInfo) GetQuickDial()(*string) {\n val, err := m.GetBackingStore().Get(\"quickDial\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func ShopFullName(name string) string {\n\tname = strings.TrimSpace(name)\n\tname = strings.Trim(name, \".\")\n\tif strings.Contains(name, \"myshopify.com\") {\n\t\treturn name\n\t}\n\treturn name + \".myshopify.com\"\n}", "func (s *playlistService) GetMain(ctx context.Context) (*models.Playlist, error) {\n\tmainID := s.events.DefaultPlaylistID(ctx)\n\tif mainID == 0 {\n\t\treturn nil, ErrNoCurrentEvent\n\t}\n\tpl, err := s.Get(ctx, mainID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif pl != nil {\n\t\tpl.IsMain = true\n\t}\n\treturn pl, nil\n}", "func SockShopWorkload() *pb.WorkloadSpec {\n\treturn &pb.WorkloadSpec{\n\t\tName: \"px-sock-shop\",\n\t\tDeploySteps: []*pb.DeployStep{\n\t\t\t{\n\t\t\t\tDeployType: &pb.DeployStep_Px{\n\t\t\t\t\tPx: &pb.PxCLIDeploy{\n\t\t\t\t\t\tArgs: []string{\n\t\t\t\t\t\t\t\"demo\",\n\t\t\t\t\t\t\t\"deploy\",\n\t\t\t\t\t\t\t\"px-sock-shop\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\tNamespaces: []string{\n\t\t\t\t\t\t\t\"px-sock-shop\",\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\tHealthchecks: HTTPHealthChecks(\"px-sock-shop\", true),\n\t}\n}", "func (o SubscriptionOutput) Workload() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Subscription) pulumi.StringPtrOutput { return v.Workload }).(pulumi.StringPtrOutput)\n}", "func (m *MailboxSettings) GetWorkingHours()(WorkingHoursable) {\n val, err := m.GetBackingStore().Get(\"workingHours\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(WorkingHoursable)\n }\n return nil\n}", "func (r *Resolver) Presentation() generated.PresentationResolver { return &presentationResolver{r} }", "func (c *WorkExperienceClient) Get(ctx context.Context, id int) (*WorkExperience, error) {\n\treturn c.Query().Where(workexperience.ID(id)).Only(ctx)\n}", "func (ws *WorkflowStore) GetWorkflow(ctx context.Context, name string) (*domain.Workflow, error) {\n\tif _, exists := ws.items[name]; exists {\n\t\treturn ws.items[name], nil\n\t}\n\treturn nil, domain.ErrWorkflowNotFound\n}", "func GetWorkteam(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *WorkteamState, opts ...pulumi.ResourceOption) (*Workteam, error) {\n\tvar resource Workteam\n\terr := ctx.ReadResource(\"aws-native:sagemaker:Workteam\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (o *AudioStreamPlayer) GetStreamPlayback() AudioStreamPlaybackImplementer {\n\t//log.Println(\"Calling AudioStreamPlayer.GetStreamPlayback()\")\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(\"AudioStreamPlayer\", \"get_stream_playback\")\n\n\t// Call the parent method.\n\t// AudioStreamPlayback\n\tretPtr := gdnative.NewEmptyObject()\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 := newAudioStreamPlaybackFromPointer(retPtr)\n\n\t// Check to see if we already have an instance of this object in our Go instance registry.\n\tif instance, ok := InstanceRegistry.Get(ret.GetBaseObject().ID()); ok {\n\t\treturn instance.(AudioStreamPlaybackImplementer)\n\t}\n\n\t// Check to see what kind of class this is and create it. This is generally used with\n\t// GetNode().\n\tclassName := ret.GetClass()\n\tif className != \"AudioStreamPlayback\" {\n\t\tactualRet := getActualClass(className, ret.GetBaseObject())\n\t\treturn actualRet.(AudioStreamPlaybackImplementer)\n\t}\n\n\treturn &ret\n}", "func FullStory(ctx context.Context, client streamexp.ReadMyStoryServiceClient) error {\n\n}", "func (svc Svc) GetAppointment(id string) (*domaintype.Appointment, error) {\n\n\tvar apptmt domaintype.Appointment\n\tresult := svc.db.Preload(\"Location\").Where(&domaintype.Appointment{ID: id}).First(&apptmt)\n\tif result.RowsAffected == 0 {\n\t\treturn nil, errors.New(\"appointments not found\")\n\t}\n\treturn &apptmt, nil\n}", "func (o *Command) GetPresentations(rw io.Writer, req io.Reader) command.Error {\n\tvpRecords, err := o.verifiableStore.GetPresentations()\n\tif err != nil {\n\t\tlogutil.LogError(logger, CommandName, GetPresentationsCommandMethod, \"get presentation records : \"+err.Error())\n\n\t\treturn command.NewValidationError(GetPresentationsErrorCode, fmt.Errorf(\"get presentation records : %w\", err))\n\t}\n\n\tcommand.WriteNillableResponse(rw, &RecordResult{\n\t\tResult: vpRecords,\n\t}, logger)\n\n\tlogutil.LogDebug(logger, CommandName, GetPresentationsCommandMethod, \"success\")\n\n\treturn nil\n}", "func (t *TeamEvent) GetInstallation() *Installation {\n\tif t == nil {\n\t\treturn nil\n\t}\n\treturn t.Installation\n}", "func GetContender(appName string, rels []*shipper.Release) (*shipper.Release, error) {\n\tif len(rels) == 0 {\n\t\treturn nil, errors.NewContenderNotFoundError(appName)\n\t}\n\treturn rels[0], nil\n}", "func (s Stack) Full() string {\n\treturn s.fullStack.String()\n}", "func getStoredSteamDeals() structs.Deals {\n\t// Checks if it exists a stored response\n\tif database.StoredSteamDeals.SteamDeals.Deals == nil {\n\t\treturn structs.Deals{}\n\t}\n\n\t// Calculates timestamp and duration stored in database\n\tdatabase.StoredSteamDeals.StoreRefresh -= time.Since(database.StoredSteamDeals.StoreTime).Seconds()\n\tdatabase.StoredSteamDeals.StoreTime = time.Now()\n\n\t// Updates new timestamp and duration to Firestore object\n\tdatabase.UpdateTimeFirestore(database.StoredSteamDeals.FirestoreID, database.StoredSteamDeals.StoreTime, database.StoredSteamDeals.StoreRefresh)\n\n\t// If the object storage timer is timed out the object is deleted and then renewed when the next command is called\n\tif database.StoredSteamDeals.StoreRefresh <= 0 {\n\t\tdatabase.DeleteObjectFromFirestore(database.StoredSteamDeals.FirestoreID)\n\t\treturn structs.Deals{}\n\t}\n\treturn database.StoredSteamDeals.SteamDeals\n}", "func GetShow(c client.Client, id int, t string) (*Show, error) {\n\tvar show *Show\n\n\tswitch t {\n\tcase store.MovieType:\n\t\tmovie, err := c.GetMovie(id)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"get show with id %d and type %q failed: %w\", id, t, err)\n\t\t}\n\t\tshow = movieToShow(movie)\n\tcase store.TvShowType:\n\t\ttv, err := c.GetTvShow(id)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"get show with id %d and type %q failed: %w\", id, t, err)\n\t\t}\n\t\tshow = tvToShow(tv)\n\tdefault:\n\t\tpanic(\"invalid show type\")\n\t}\n\n\treturn show, nil\n}", "func (m *MailTips) GetMailboxFull()(*bool) {\n val, err := m.GetBackingStore().Get(\"mailboxFull\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*bool)\n }\n return nil\n}", "func (s *WorkoutServiceServer) GetWorkout(ctx context.Context, in *pb.WorkoutRequest) (*pb.Workout, error) {\n\tlog.Printf(\"Retrieving workout %s ...\\n\", in)\n\n\tresult, err := GetDynamoDB().GetItem(&dynamodb.GetItemInput{\n\t\tTableName: aws.String(\"OTF-Workouts\"),\n\t\tKey: map[string]*dynamodb.AttributeValue{\n\t\t\t\"otf-workout-id\": {\n\t\t\t\tS: aws.String(in.GetWorkoutId()),\n\t\t\t},\n\t\t},\n\t})\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\titem := &Item{}\n\n\terr = dynamodbattribute.UnmarshalMap(result.Item, &item)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif item.OTFWorkoutID == \"\" {\n\t\treturn nil, errors.New(\"OTF workout not found\")\n\t}\n\n\treturn &pb.Workout{}, nil\n}", "func (a API) Full(p string) string {\n\treturn fmt.Sprintf(\"%s?%s\", a, p)\n}", "func (pod *PodDetails) GetFullName() string {\n\treturn pod.Namespace + \"/\" + pod.Name\n}", "func (c *Controller) getPract(id string, pract *store.Practitioner) error {\n\tp, err := c.Sc.GetPractitioner(id)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpract.SCFHSRegistrationNumber = &p.Response.Info.Profile.RegistrationNumber\n\tpract.PractitionerID = pract.HealthID\n\tpract.IDNumber = &id\n\n\tpract.FirstNameAr = &p.Response.Info.Profile.Ar.FirstName\n\tpract.SecondNameAr = &p.Response.Info.Profile.Ar.SecondName\n\tpract.LastNameAr = &p.Response.Info.Profile.Ar.LastName\n\n\tpract.FirstNameEn = &p.Response.Info.Profile.En.FirstName\n\tpract.SecondNameEn = &p.Response.Info.Profile.En.SecondName\n\tpract.LastNameEn = &p.Response.Info.Profile.En.LastName\n\n\tpract.Gender_code = &p.Response.Info.Profile.Gender.Code\n\tpract.Gender_ar = &p.Response.Info.Profile.Gender.NameAr\n\tpract.Gender_en = &p.Response.Info.Profile.Gender.NameEn\n\n\tpract.SCFHSCategoryCode = &p.Response.Info.Professionality.Category.Code\n\tpract.SCFHSCategoryAr = &p.Response.Info.Professionality.Category.NameAr\n\tpract.SCFHSCategoryEn = &p.Response.Info.Professionality.Category.NameEn\n\n\tpract.SCFHSSpecialityCode = &p.Response.Info.Professionality.Specialty.Code\n\tpract.SCFHSSpecialityAr = &p.Response.Info.Professionality.Specialty.NameAr\n\tpract.SCFHSSpecialityEn = &p.Response.Info.Professionality.Specialty.NameEn\n\n\tpract.SCFHSPractitionerStatus = &p.Response.Info.Status.Code\n\tpract.SCFHSPractitionerStatusCode = &p.Response.Info.Status.DescAr\n\n\tpract.SCFHSRegistrationIssueDate = &p.Response.Info.Status.License.IssuedDate\n\tpract.SCFHSRegistrationExpiryDate = &p.Response.Info.Status.License.ExpiryDate\n\n\t// @TODO: change this\n\tpq := PatientQuery{ID: id}\n\tswitch pq.Kind() {\n\tcase KindCitizen:\n\t\tty := \"NationalId\"\n\t\tpract.IDType = &ty\n\tcase KindExpat:\n\t\tty := \"Iqama\"\n\t\tpract.IDType = &ty\n\t}\n\treturn nil\n}", "func (p *PushEventRepository) GetFullName() string {\n\tif p == nil || p.FullName == nil {\n\t\treturn \"\"\n\t}\n\treturn *p.FullName\n}", "func (m *User) GetTeamwork()(UserTeamworkable) {\n return m.teamwork\n}", "func (wbs *impl) Sales() sales.Interface { return wbs.sle }", "func GetTeamFull(id int64) (Team, error) {\n\tt, err := GetTeam(id)\n\tif t.Venue.ID != 0 && err == nil {\n\t\tt.Venue, err = GetVenue(t.Venue.ID)\n\t}\n\treturn t, err\n}", "func (v *Kounta) GetStaff(token string, company string) (Staffs, error) {\n\tclient := &http.Client{}\n\tclient.CheckRedirect = checkRedirectFunc\n\n\tu, _ := url.ParseRequestURI(baseURL)\n\tu.Path = fmt.Sprintf(staffURL, company)\n\turlStr := fmt.Sprintf(\"%v\", u)\n\n\tr, err := http.NewRequest(\"GET\", urlStr, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tr.Header = http.Header(make(map[string][]string))\n\tr.Header.Set(\"Accept\", \"application/json\")\n\tr.Header.Set(\"Authorization\", \"Bearer \"+token)\n\n\tres, err := client.Do(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trawResBody, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfmt.Println(\"GetStaff Body\", string(rawResBody))\n\n\tif res.StatusCode == 200 {\n\t\tvar resp Staffs\n\n\t\terr = json.Unmarshal(rawResBody, &resp)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn resp, nil\n\t}\n\treturn nil, fmt.Errorf(\"Failed to get Kounta Staff %s\", res.Status)\n\n}", "func ShowEmpSucursalOft(w http.ResponseWriter, r *http.Request) {\n\tc := appengine.NewContext(r)\n\temsucs := model.GetEmpSucursales(c, r.FormValue(\"idemp\"))\n\tofsucs, _ := model.GetOfertaSucursales(c, r.FormValue(\"idoft\"))\n\twssucs := make([]WsSucursal, len(*emsucs), cap(*emsucs))\n\tfor i,es:= range *emsucs {\n\t\tfor _,os:= range *ofsucs {\n\t\t\tif os.IdSuc == es.IdSuc {\n\t\t\t\twssucs[i].IdOft = os.IdOft\n\t\t\t}\n\t\t}\n\t\twssucs[i].IdSuc = es.IdSuc\n\t\twssucs[i].IdEmp = es.IdEmp\n\t\twssucs[i].Sucursal = es.Nombre\n\t\twssucs[i].FechaHora = es.FechaHora\n\t}\n\tsortutil.AscByField(wssucs, \"Sucursal\")\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tb, _ := json.Marshal(wssucs)\n\tw.Write(b)\n}", "func ProfileShop(c *fiber.Ctx) {\n\tuserID := userIDF(c.Get(\"token\"))\n\n\tvar myShops MyShops\n\tMyShopUnStructured := []MyShops{}\n\tvar finalMyShops MyShopsPoints\n\tlistReponse := []MyShopsPoints{}\n\n\tPagination := new(Paginations)\n\tif err := c.QueryParser(Pagination); err != nil {\n\t\tfmt.Println(err, \"Error parsing shops\")\n\t}\n\n\tpage, _ := strconv.Atoi(Pagination.Page)\n\tlimit, _ := strconv.Atoi(Pagination.Limit)\n\toffset := limit * page\n\n\tshops, err := sq.Select(\n\t\t\"shop.shop_id\",\n\t\t\"shop.shop_name\",\n\t\t\"shop.address\",\n\t\t\"shop.phone\",\n\t\t\"shop.phone2\",\n\t\t\"shop.description\",\n\t\t\"shop.cover_image\",\n\t\t\"shop.accept_card\",\n\t\t\"shop.list_cards\",\n\t\t\"lat\",\n\t\t\"lon\",\n\t\t\"score_shop\",\n\t\t\"shop.status\",\n\t\t\"lock_shop\",\n\t\t\"canceled\",\n\t\t\"service_name\",\n\t\t\"sub_service_name\",\n\t\t\"shop_schedules.LUN\",\n\t\t\"shop_schedules.MAR\",\n\t\t\"shop_schedules.MIE\",\n\t\t\"shop_schedules.JUE\",\n\t\t\"shop_schedules.VIE\",\n\t\t\"shop_schedules.SAB\",\n\t\t\"shop_schedules.DOM\",\n\t\t\"usersk.user_id\",\n\t\t\"GROUP_CONCAT(coalesce(images_shop.url_image, '')) AS images\",\n\t\t\"date_init\",\n\t\t\"date_finish\",\n\t\t\"type_charge\",\n\t).\n\t\tFrom(\"shop\").\n\t\tLeftJoin(\"images_shop on images_shop.shop_id = shop.shop_id\").\n\t\tLeftJoin(\"service_type on service_type.service_type_id = shop.service_type_id\").\n\t\tLeftJoin(\"sub_service_type on sub_service_type.sub_service_type_id = shop.sub_service_type_id\").\n\t\tLeftJoin(\"shop_schedules on shop_schedules.shop_id = shop.shop_id\").\n\t\tLeftJoin(\"plans_pay on plans_pay.shop_id = shop.shop_id\").\n\t\tLeftJoin(\"usersk on usersk.user_id = shop.user_id\").\n\t\tWhere(\"shop.user_id = ? AND (plans_pay.expired = ? OR plans_pay.expired IS NULL)\", userID, 0).\n\t\tOrderBy(\"shop_id DESC\").\n\t\tGroupBy(\"shop.shop_id, shop_schedules.LUN, shop_schedules.MAR, shop_schedules.MAR, shop_schedules.MIE, shop_schedules.JUE, shop_schedules.VIE, shop_schedules.SAB, shop_schedules.DOM, plans_pay.date_init, plans_pay.date_finish, plans_pay.type_charge\").\n\t\tLimit(uint64(limit)).\n\t\tOffset(uint64(offset)).\n\t\tRunWith(database).\n\t\tQuery()\n\n\tif err != nil {\n\t\tfmt.Println(err, \"Error to get shops\")\n\t\tErrorProfile := ErrorResponse{MESSAGE: \"Error to get shops\"}\n\t\tc.JSON(ErrorProfile)\n\t\tc.Status(400)\n\t\treturn\n\t}\n\n\tfor shops.Next() {\n\t\t_ = shops.Scan(\n\t\t\t&myShops.ShopID,\n\t\t\t&myShops.ShopName,\n\t\t\t&myShops.Address,\n\t\t\t&myShops.Phone,\n\t\t\t&myShops.Phone2,\n\t\t\t&myShops.Description,\n\t\t\t&myShops.CoverImage,\n\t\t\t&myShops.AcceptCard,\n\t\t\t&myShops.ListCards,\n\t\t\t&myShops.Lat,\n\t\t\t&myShops.Lon,\n\t\t\t&myShops.ScoreShop,\n\t\t\t&myShops.Status,\n\t\t\t&myShops.LockShop,\n\t\t\t&myShops.Canceled,\n\t\t\t&myShops.ServiceName,\n\t\t\t&myShops.SubServiceName,\n\t\t\t&myShops.LUN,\n\t\t\t&myShops.MAR,\n\t\t\t&myShops.MIE,\n\t\t\t&myShops.JUE,\n\t\t\t&myShops.VIE,\n\t\t\t&myShops.SAB,\n\t\t\t&myShops.DOM,\n\t\t\t&myShops.UserID,\n\t\t\t&myShops.Images,\n\t\t\t&myShops.DateInit,\n\t\t\t&myShops.DateFinish,\n\t\t\t&myShops.TypeCharge,\n\t\t)\n\n\t\tMyShopUnStructured = append(MyShopUnStructured, myShops)\n\t}\n\n\tfor i := 0; i < len(MyShopUnStructured); i++ {\n\t\tfinalMyShops.ShopID = &MyShopUnStructured[i].ShopID.String\n\t\tfinalMyShops.ShopName = &MyShopUnStructured[i].ShopName.String\n\t\tfinalMyShops.Address = &MyShopUnStructured[i].Address.String\n\t\tfinalMyShops.Phone = &MyShopUnStructured[i].Phone.String\n\t\tfinalMyShops.Phone2 = &MyShopUnStructured[i].Phone2.String\n\t\tfinalMyShops.Description = &MyShopUnStructured[i].Description.String\n\t\tfinalMyShops.CoverImage = &MyShopUnStructured[i].CoverImage.String\n\t\tfinalMyShops.AcceptCard = &MyShopUnStructured[i].AcceptCard.String\n\t\tfinalMyShops.ListCards = &MyShopUnStructured[i].ListCards.String\n\t\tfinalMyShops.Lat = &MyShopUnStructured[i].Lat.String\n\t\tfinalMyShops.Lon = &MyShopUnStructured[i].Lon.String\n\t\tfinalMyShops.ScoreShop = &MyShopUnStructured[i].ScoreShop.String\n\t\tfinalMyShops.Status = &MyShopUnStructured[i].Status.String\n\t\tfinalMyShops.LockShop = &MyShopUnStructured[i].LockShop.String\n\t\tfinalMyShops.Canceled = &MyShopUnStructured[i].Canceled.String\n\t\tfinalMyShops.ServiceName = &MyShopUnStructured[i].ServiceName.String\n\t\tfinalMyShops.SubServiceName = &MyShopUnStructured[i].SubServiceName.String\n\t\tfinalMyShops.LUN = &MyShopUnStructured[i].LUN.String\n\t\tfinalMyShops.MAR = &MyShopUnStructured[i].MAR.String\n\t\tfinalMyShops.MIE = &MyShopUnStructured[i].MIE.String\n\t\tfinalMyShops.JUE = &MyShopUnStructured[i].JUE.String\n\t\tfinalMyShops.VIE = &MyShopUnStructured[i].VIE.String\n\t\tfinalMyShops.SAB = &MyShopUnStructured[i].SAB.String\n\t\tfinalMyShops.DOM = &MyShopUnStructured[i].DOM.String\n\t\tfinalMyShops.UserID = &MyShopUnStructured[i].UserID.String\n\t\tfinalMyShops.Images = strings.Split(MyShopUnStructured[i].Images.String, \",\")\n\t\tfinalMyShops.DateInit = &MyShopUnStructured[i].DateInit.String\n\t\tfinalMyShops.DateFinish = &MyShopUnStructured[i].DateFinish.String\n\t\tfinalMyShops.TypeCharge = &MyShopUnStructured[i].TypeCharge.String\n\n\t\tlistReponse = append(listReponse, finalMyShops)\n\t}\n\n\tc.JSON(ResponseResult{Result: listReponse})\n}", "func (w *windowImpl) getScreenOvlp() *oswin.Screen {\n\treturn w.app.screens[0]\n}", "func (m *EducationAssignment) GetDisplayName()(*string) {\n return m.displayName\n}", "func (w *WatchEvent) GetInstallation() *Installation {\n\tif w == nil {\n\t\treturn nil\n\t}\n\treturn w.Installation\n}", "func WelcomeScreenMeetingInformationPShowOrganizerAndTimeOnly() *WelcomeScreenMeetingInformation {\n\tv := WelcomeScreenMeetingInformationVShowOrganizerAndTimeOnly\n\treturn &v\n}", "func (document *OpenScreenplay) FromFountain(screenplay *fountain.Fountain) {\n\tif screenplay.TitlePage != nil {\n\t\t// Build the Info section\n\t\tif document.Info == nil {\n\t\t\tdocument.Info = new(Info)\n\t\t}\n\t\t// Populate the TitlePage\n\t\tif document.TitlePage == nil {\n\t\t\tdocument.TitlePage = new(TitlePage)\n\t\t}\n\n\t\t// NOTE: build a map of elements that will belong to Info.\n\t\tfor _, elem := range screenplay.TitlePage {\n\t\t\tswitch strings.ToLower(elem.Name) {\n\t\t\tcase \"title\":\n\t\t\t\tdocument.Info.Title = elem.Content\n\t\t\t\tpara := new(Para)\n\t\t\t\tpara.Bookmark = \"Title\"\n\t\t\t\tpara.Text = StringToTextArray(elem.Content)\n\t\t\t\tdocument.TitlePage.Para = append(document.TitlePage.Para, para)\n\t\t\tcase \"credit\":\n\t\t\t\tdocument.Info.WrittenBy = elem.Content\n\t\t\t\tpara := new(Para)\n\t\t\t\tpara.Bookmark = \"Credits\"\n\t\t\t\tpara.Text = StringToTextArray(elem.Content)\n\t\t\t\tdocument.TitlePage.Para = append(document.TitlePage.Para, para)\n\t\t\tcase \"author\":\n\t\t\t\tdocument.Info.WrittenBy = elem.Content\n\t\t\t\tpara := new(Para)\n\t\t\t\tpara.Bookmark = \"Author\"\n\t\t\t\tpara.Text = StringToTextArray(elem.Content)\n\t\t\t\tdocument.TitlePage.Para = append(document.TitlePage.Para, para)\n\t\t\tcase \"copyright\":\n\t\t\t\tdocument.Info.Copyright = elem.Content\n\t\t\t\tpara := new(Para)\n\t\t\t\tpara.Bookmark = \"Copyright\"\n\t\t\t\tpara.Text = StringToTextArray(elem.Content)\n\t\t\t\tdocument.TitlePage.Para = append(document.TitlePage.Para, para)\n\t\t\tcase \"draft date\":\n\t\t\t\tdocument.Info.Drafts = elem.Content\n\t\t\t\tpara := new(Para)\n\t\t\t\tpara.Bookmark = \"Drafts\"\n\t\t\t\tpara.Text = StringToTextArray(elem.Content)\n\t\t\t\tdocument.TitlePage.Para = append(document.TitlePage.Para, para)\n\t\t\tcase \"contact\":\n\t\t\t\tdocument.Info.Contact = elem.Content\n\t\t\t\tpara := new(Para)\n\t\t\t\tpara.Bookmark = \"Contact\"\n\t\t\t\tpara.Text = StringToTextArray(elem.Content)\n\t\t\t\tdocument.TitlePage.Para = append(document.TitlePage.Para, para)\n\t\t\tcase \"source\":\n\t\t\t\tpara := new(Para)\n\t\t\t\tpara.Bookmark = \"Source\"\n\t\t\t\tpara.Text = StringToTextArray(elem.Content)\n\t\t\t\tdocument.TitlePage.Para = append(document.TitlePage.Para, para)\n\t\t\tcase \"story by\":\n\t\t\t\tpara := new(Para)\n\t\t\t\tpara.Bookmark = \"Story By\"\n\t\t\t\tpara.Text = StringToTextArray(elem.Content)\n\t\t\t\tdocument.TitlePage.Para = append(document.TitlePage.Para, para)\n\t\t\tcase \"uuid\":\n\t\t\t\tdocument.Info.UUID = elem.Content\n\t\t\tcase \"page_count\":\n\t\t\t\tdocument.Info.PageCount = elem.Content\n\t\t\tcase \"title_format\":\n\t\t\t\tdocument.Info.TitleFormat = elem.Content\n\t\t\t}\n\t\t}\n\t}\n\n\tif screenplay.Elements != nil {\n\t\t// Populate the Paragraphs array\n\t\tif document.Paragraphs == nil {\n\t\t\tdocument.Paragraphs = new(Paragraphs)\n\t\t}\n\t\tfor _, elem := range screenplay.Elements {\n\t\t\tpara := new(Para)\n\t\t\tpara.Bookmark = elem.TypeName()\n\t\t\tpara.Text = StringToTextArray(elem.Content)\n\t\t\tdocument.Paragraphs.Para = append(document.Paragraphs.Para, para)\n\t\t}\n\t}\n}", "func (me *FgClient) WsGet(prop string){\n\tme.WsSendCommand( WsCommand{\"get\", prop} )\n}", "func (c *FComponent) GetFlashComponent() *FComponent {\n\treturn c\n}", "func (c *MessagesChatFull) GetFullChat() (value ChatFullClass) {\n\tif c == nil {\n\t\treturn\n\t}\n\treturn c.FullChat\n}", "func (o *AudioStreamPlayer) GetStream() AudioStreamImplementer {\n\t//log.Println(\"Calling AudioStreamPlayer.GetStream()\")\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(\"AudioStreamPlayer\", \"get_stream\")\n\n\t// Call the parent method.\n\t// AudioStream\n\tretPtr := gdnative.NewEmptyObject()\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 := newAudioStreamFromPointer(retPtr)\n\n\t// Check to see if we already have an instance of this object in our Go instance registry.\n\tif instance, ok := InstanceRegistry.Get(ret.GetBaseObject().ID()); ok {\n\t\treturn instance.(AudioStreamImplementer)\n\t}\n\n\t// Check to see what kind of class this is and create it. This is generally used with\n\t// GetNode().\n\tclassName := ret.GetClass()\n\tif className != \"AudioStream\" {\n\t\tactualRet := getActualClass(className, ret.GetBaseObject())\n\t\treturn actualRet.(AudioStreamImplementer)\n\t}\n\n\treturn &ret\n}", "func (poi *PlayerOperationsImpl) GetPlayer() *Player {\n\treturn poi.Player\n}", "func GetScorer(home bool, game responses.FantasyGame) *Scorer {\n\tif home {\n\t\treturn &Scorer{\n\t\t\tTeam: game.Home,\n\t\t\tScore: game.HomeScore.Score.Value,\n\t\t}\n\t}\n\n\treturn &Scorer{\n\t\tTeam: game.Away,\n\t\tScore: game.AwayScore.Score.Value,\n\t}\n}", "func (p *PublicEvent) GetInstallation() *Installation {\n\tif p == nil {\n\t\treturn nil\n\t}\n\treturn p.Installation\n}", "func ListOfSpeaker(store *projector.SlideStore) {\n\tstore.RegisterSliderFunc(\"list_of_speakers\", func(ctx context.Context, fetch *datastore.Fetcher, p7on *projector.Projection) (encoded []byte, err error) {\n\t\treturn renderListOfSpeakers(ctx, fetch, p7on.ContentObjectID, p7on.MeetingID, store)\n\t})\n}", "func (o *Platform) GetOverview() string {\n\tif o == nil || o.Overview == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Overview\n}", "func Full() string {\n\treturn fmt.Sprintf(\"%s-%s\", OLMVersion, GitCommit)\n}", "func (o *BasicBot) GetFullName() interface{} {\n\tif o == nil {\n\t\tvar ret interface{}\n\t\treturn ret\n\t}\n\treturn o.FullName\n}", "func (o *OrganizationEvent) GetInstallation() *Installation {\n\tif o == nil {\n\t\treturn nil\n\t}\n\treturn o.Installation\n}", "func SavePresentation(p Provider) presentproof.Middleware {\n\tvdr := p.VDRegistry()\n\tstore := p.VerifiableStore()\n\tdocumentLoader := p.JSONLDDocumentLoader()\n\n\treturn func(next presentproof.Handler) presentproof.Handler {\n\t\treturn presentproof.HandlerFunc(func(metadata presentproof.Metadata) error {\n\t\t\tif metadata.StateName() != stateNamePresentationReceived {\n\t\t\t\treturn next.Handle(metadata)\n\t\t\t}\n\n\t\t\tpresentation := presentproof.Presentation{}\n\t\t\tif err := metadata.Message().Decode(&presentation); err != nil {\n\t\t\t\treturn fmt.Errorf(\"decode: %w\", err)\n\t\t\t}\n\n\t\t\tpresentations, err := toVerifiablePresentation(vdr, presentation.PresentationsAttach, documentLoader)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"to verifiable presentation: %w\", err)\n\t\t\t}\n\n\t\t\tif len(presentations) == 0 {\n\t\t\t\treturn errors.New(\"presentations were not provided\")\n\t\t\t}\n\n\t\t\tvar names []string\n\t\t\tproperties := metadata.Properties()\n\n\t\t\t// nolint: errcheck\n\t\t\tmyDID, _ := properties[myDIDKey].(string)\n\t\t\t// nolint: errcheck\n\t\t\ttheirDID, _ := properties[theirDIDKey].(string)\n\t\t\tif myDID == \"\" || theirDID == \"\" {\n\t\t\t\treturn errors.New(\"myDID or theirDID is absent\")\n\t\t\t}\n\n\t\t\tfor i, presentation := range presentations {\n\t\t\t\tnames = append(names, getName(i, presentation.ID, metadata))\n\n\t\t\t\terr := store.SavePresentation(names[i], presentation,\n\t\t\t\t\tstoreverifiable.WithMyDID(myDID),\n\t\t\t\t\tstoreverifiable.WithTheirDID(theirDID),\n\t\t\t\t)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"save presentation: %w\", err)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tproperties[namesKey] = names\n\n\t\t\treturn next.Handle(metadata)\n\t\t})\n\t}\n}", "func (f *FileSystemPlayerStore) GetLeague() League {\n\tf.database.Seek(0, 0)\n\tleague, _ := NewLeague(f.database)\n\treturn league\n}", "func (m *PrinterLocation) GetBuilding()(*string) {\n val, err := m.GetBackingStore().Get(\"building\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func (m *MeetingParticipants) GetOrganizer()(MeetingParticipantInfoable) {\n return m.organizer\n}", "func LookupWorkstation(ctx *pulumi.Context, args *LookupWorkstationArgs, opts ...pulumi.InvokeOption) (*LookupWorkstationResult, error) {\n\topts = internal.PkgInvokeDefaultOpts(opts)\n\tvar rv LookupWorkstationResult\n\terr := ctx.Invoke(\"google-native:workstations/v1beta:getWorkstation\", args, &rv, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &rv, nil\n}", "func shop(s salesman) {\n\tfmt.Println(s)\n\ts.sell()\n\ts.show()\n}", "func (db *DB) GetSelf() (*feed.Pub, error) {\n\treturn db.e.GetSelf()\n}", "func (w *GlfwWindow) FullScreen() bool {\n\n\treturn w.fullscreen\n}", "func (database *Database) GetShowsEmbed() (string, string, error) {\n\ttx, err := database.db.Begin(false)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\n\tchannelID, err := tx.Get(ShowsEmbedChannel)\n\tmessageID, err := tx.Get(ShowsEmbedMessage)\n\n\terr = tx.Rollback()\n\n\treturn channelID, messageID, err\n}", "func (p *ProjectEvent) GetInstallation() *Installation {\n\tif p == nil {\n\t\treturn nil\n\t}\n\treturn p.Installation\n}", "func (s *Service) FullShort(c context.Context, pn, ps int64, source string) (res []*webmdl.Mi, err error) {\n\tvar (\n\t\taids []int64\n\t\tip = metadata.String(c, metadata.RemoteIP)\n\t\tm = make(map[int64]string)\n\t)\n\tif aids, err = s.aids(c, pn, ps); err != nil {\n\t\treturn\n\t}\n\tif res, err = s.archiveWithTag(c, aids, ip, m, source); err != nil {\n\t\tlog.Error(\"s.archiveWithTag error(%v)\", err)\n\t}\n\treturn\n}", "func (db *Database) Get(params *GetParams) (*Workouts, error) {\n\t// Create variables to hold the query fields\n\t// being filtered on their values.\n\tvar queryFields string\n\tvar queryValues []interface{}\n\n\t// Handle ID field.\n\tif params.ID != nil {\n\t\tif queryFields == \"\" {\n\t\t\tqueryFields = \"WHERE id=?\"\n\t\t} else {\n\t\t\tqueryFields += \" AND id=?\"\n\t\t}\n\n\t\tqueryValues = append(queryValues, *params.ID)\n\t}\n\t// Handle SessionID field.\n\tif params.SessionID != nil {\n\t\tif queryFields == \"\" {\n\t\t\tqueryFields = \"WHERE session_id=?\"\n\t\t} else {\n\t\t\tqueryFields += \" AND session_id=?\"\n\t\t}\n\t\tqueryValues = append(queryValues, *params.SessionID)\n\t}\n\t// Handle ExerciseID field.\n\tif params.ExerciseID != nil {\n\t\tif queryFields == \"\" {\n\t\t\tqueryFields = \"WHERE exercise_id=?\"\n\t\t} else {\n\t\t\tqueryFields += \" AND exercise_id=?\"\n\t\t}\n\t\tqueryValues = append(queryValues, *params.ExerciseID)\n\t}\n\t// Build the full query.\n\tquery := fmt.Sprintf(stmtSelect, queryFields, params.Offset, params.Limit)\n\t// Create a new Workouts.\n\tworkouts := &Workouts{\n\t\tWorkouts: []*Workout{},\n\t}\n\n\t// Execute the query.\n\trows, err := db.db.Query(query, queryValues...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\n\t// Loop though the workout rows.\n\tfor rows.Next() {\n\t\t// Create a new Workout.\n\t\tworkout := &Workout{}\n\n\t\t// Scan ros values into workout struct.\n\t\tif err := rows.Scan(&workout.ID, &workout.SessionID, &workout.ExerciseID, &workout.Weight, &workout.Reps, &workout.Sets); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// Add to workouts set\n\t\tworkouts.Workouts = append(workouts.Workouts, workout)\n\n\t}\n\tif err = rows.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Build the total count query.\n\tqueryCount := fmt.Sprintf(stmtSelectCount, queryFields)\n\n\t// Get total count.\n\tvar total int\n\tif err = db.db.QueryRow(queryCount, queryValues...).Scan(&total); err != nil {\n\t\treturn nil, err\n\t}\n\n\tworkouts.Total = total\n\n\treturn workouts, nil\n\n}", "func NewShop() *Shop {\n\treturn &Shop{}\n}", "func (c *CheckSuiteEvent) GetCheckSuite() *CheckSuite {\n\tif c == nil {\n\t\treturn nil\n\t}\n\treturn c.CheckSuite\n}", "func (r *GroupPolicyPresentationRequest) Get(ctx context.Context) (resObj *GroupPolicyPresentation, err error) {\n\tvar query string\n\tif r.query != nil {\n\t\tquery = \"?\" + r.query.Encode()\n\t}\n\terr = r.JSONRequest(ctx, \"GET\", query, nil, &resObj)\n\treturn\n}", "func (c *Client) GetWork() (*HashesResponse, error) {\n\trequest := c.newRequest(EthGetWork)\n\n\tresponse := &HashesResponse{}\n\n\treturn response, c.send(request, response)\n}", "func (r *RepositoryEvent) GetInstallation() *Installation {\n\tif r == nil {\n\t\treturn nil\n\t}\n\treturn r.Installation\n}", "func (c *Cache) GetWorkload(meta *api.ObjectMeta) *defs.VCHubWorkload {\n\t// checking for ok will prevent nil type conversion errors\n\tpObj, _ := c.pCache.Get(workloadKind, meta).(*defs.VCHubWorkload)\n\n\tvar smObj *ctkit.Workload\n\tif obj, err := c.stateMgr.Controller().FindObject(workloadKind, meta); err == nil {\n\t\tsmObj = obj.(*ctkit.Workload)\n\t}\n\tret, _ := mergeWorkload(pObj, smObj).(*defs.VCHubWorkload)\n\treturn ret\n}", "func (self *SinglePad) Game() *Game{\n return &Game{self.Object.Get(\"game\")}\n}", "func (d DB) GetWorkflow(ctx context.Context, id string) (db.Workflow, error) {\n\treturn db.Workflow{}, nil\n}", "func (m *MembershipEvent) GetInstallation() *Installation {\n\tif m == nil {\n\t\treturn nil\n\t}\n\treturn m.Installation\n}", "func (fe FoodEstablishment) AsCreativeWork() (*CreativeWork, bool) {\n\treturn nil, false\n}", "func (wc *workflowClient) GetWorkflow(ctx context.Context, workflowID string, runID string) WorkflowRun {\n\n\titerFn := func(fnCtx context.Context, fnRunID string) HistoryEventIterator {\n\t\treturn wc.GetWorkflowHistory(fnCtx, workflowID, fnRunID, true, s.HistoryEventFilterTypeCloseEvent)\n\t}\n\n\treturn &workflowRunImpl{\n\t\tworkflowID: workflowID,\n\t\tfirstRunID: runID,\n\t\tcurrentRunID: runID,\n\t\titerFn: iterFn,\n\t\tdataConverter: wc.dataConverter,\n\t\tregistry: wc.registry,\n\t}\n}", "func getWorkorderFulfillmentByID(id int64) (m *model.WorkorderFulfillment, err error) {\n\tmx := new(model.WorkorderFulfillment)\n\to := orm.NewOrm()\n\n\tif err = o.QueryTable(mx).Filter(\"id\", id).Filter(\"is_deleted\", 0).RelatedSel().Limit(1).One(mx); err == nil {\n\t\to.LoadRelated(mx, \"WorkorderFulFillmentItems\", 3)\n\t\treturn mx, nil\n\t}\n\treturn nil, err\n}", "func (o *Service) GetHw() string {\n\tif o == nil || o.Hw == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Hw\n}", "func (s *StatusEvent) GetInstallation() *Installation {\n\tif s == nil {\n\t\treturn nil\n\t}\n\treturn s.Installation\n}", "func (i *InstallationEvent) GetInstallation() *Installation {\n\tif i == nil {\n\t\treturn nil\n\t}\n\treturn i.Installation\n}", "func (b *OGame) GetCelestial(v any) (Celestial, error) {\n\treturn b.WithPriority(taskRunner.Normal).GetCelestial(v)\n}", "func (m *MemberEvent) GetInstallation() *Installation {\n\tif m == nil {\n\t\treturn nil\n\t}\n\treturn m.Installation\n}", "func (p *ProjectCardEvent) GetInstallation() *Installation {\n\tif p == nil {\n\t\treturn nil\n\t}\n\treturn p.Installation\n}", "func GetPromotion(c *server.Context) error {\n\tvar (\n\t\terr error\n\t\tres []ware.BriefInfo\n\t)\n\n\tconn, err := mysql.Pool.Get()\n\tdefer mysql.Pool.Release(conn)\n\tif err != nil {\n\t\tlogger.Error(err)\n\t\treturn core.WriteStatusAndDataJSON(c, constants.ErrMysql, nil)\n\t}\n\n\tres, err = ware.Service.GetPromotionList(conn)\n\tif err != nil {\n\t\tlogger.Error(err)\n\t\treturn core.WriteStatusAndDataJSON(c, constants.ErrMysql, nil)\n\t}\n\n\treturn core.WriteStatusAndDataJSON(c, constants.ErrSucceed, res)\n}", "func (c *Client) Fullscreen() (bool, error) {\n\treturn c.GetBoolProperty(\"fullscreen\")\n}", "func (c *Client) GetProof(r *onet.Roster, id skipchain.SkipBlockID, key []byte) (*GetProofResponse, error) {\n\treply := &GetProofResponse{}\n\terr := c.SendProtobuf(r.List[0], &GetProof{\n\t\tVersion: CurrentVersion,\n\t\tID: id,\n\t\tKey: key,\n\t}, reply)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn reply, nil\n}", "func NewShop(width, height int) *Map {\n\tm := NewMap(width, height)\n\n\t// Grass with road surroundings\n\tg := m.Layer(\"Ground\")\n\tg.fill(grass)\n\tg.rectangle(rect{0, 0, g.Width, g.Height}, road, false)\n\t// Shop floor\n\tg.rectangle(rect{2, 2, g.Width - 4, g.Height - 5}, room, true)\n\n\ts := m.Layer(\"Structures\")\n\t// Shop walls\n\t// Leave one row along bottom as buffer for lawn/board\n\ts.rectangle(rect{1, 1, g.Width - 2, g.Height - 3}, wall, false)\n\t// Entrance - connect with road/floor, replace wall with door, add sign\n\tentranceX := m.Width / 2\n\tg.setTile(entranceX, g.Height-2, road)\n\tg.setTile(entranceX, g.Height-3, room)\n\tdoorY := s.Height - 3\n\ts.setTile(entranceX, doorY, door)\n\ts.setTile(entranceX+1, s.Height-2, sign)\n\n\tf := m.Layer(\"Furniture\")\n\t// Items on walls - windows, candles/shelves inside, shop sign\n\tf.rectangle(rect{2, 1, f.Width - 4, 1}, hanging, false)\n\tf.setTile(entranceX-1, f.Height-3, sign)\n\t// Front wall elements must have 1 tile gap\n\ty := f.Height - 3\n\tfor x := 3; x < f.Width-3; x = x + 2 {\n\t\t// Make sure that the area is clear of signs or doors\n\t\tif f.isClear(x-1, y, 3, 1) &&\n\t\t\ts.getTile(x-1, y) != door &&\n\t\t\ts.getTile(x, y) != door &&\n\t\t\ts.getTile(x+1, y) != door {\n\t\t\tf.setTile(x, y, window)\n\t\t}\n\t}\n\n\t// Counter - place opposite the door, random width (at least 2)\n\tcounterW := rand.Intn(f.Width-4-2) + 2\n\tcounterX := entranceX - counterW/2\n\tcounterY := 3\n\tfor x := counterX; x < counterX+counterW; x++ {\n\t\tf.setTile(x, counterY, counter)\n\t}\n\tc := m.Layer(\"Characters\")\n\t// Shopkeep, opposite door\n\tc.setTile(entranceX, 2, shopkeeper)\n\n\t// Shelf area - to the right, at least 3 wide\n\t// Note: use two rands to get a distribution near the middle\n\tshelfX := rand.Intn(f.Width-7)/2 + (rand.Intn(f.Width-7)+1)/2 + 2\n\tshelfW := f.Width - 2 - shelfX\n\t// If wider than 5, leave at least 3 free to the left for rest area\n\tif shelfW > 5 && shelfX < 5 {\n\t\tshelfX = 5\n\t\tshelfW = f.Width - 2 - shelfX\n\t}\n\t// Place rows of shelves\n\tv := m.Layer(\"Inventory\")\n\tvar shelfClear = func(x, y int) bool {\n\t\tfor x1 := x - 1; x1 <= x+1; x1++ {\n\t\t\tfor y1 := y - 1; y1 <= y+1; y1++ {\n\t\t\t\tftile := f.getTile(x1, y1)\n\t\t\t\tif ftile != nothing && ftile != shelf {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn true\n\t}\n\tfor y := 3; y < f.Height-4; y = y + 2 {\n\t\trowCounter := 0\n\t\tfor x := shelfX; x < f.Width-3; x++ {\n\t\t\tif shelfClear(x, y) && rowCounter < 3 && x != entranceX {\n\t\t\t\tf.setTile(x, y, shelf)\n\t\t\t\t// Randomly place items on them\n\t\t\t\tif rand.Intn(3) < 2 {\n\t\t\t\t\tv.setTile(x, y, stock)\n\t\t\t\t}\n\t\t\t\trowCounter++\n\t\t\t} else {\n\t\t\t\trowCounter = 0\n\t\t\t}\n\t\t}\n\t}\n\n\t// Rest area\n\tif shelfX >= 5 {\n\t\trestRect := rect{2, 2, shelfX - 2, f.Height - 5}\n\t\t// Rug, in front of counter\n\t\ts.rectangle(rect{restRect.x, restRect.y + 2, restRect.w, restRect.h - 2},\n\t\t\trug, true)\n\n\t\t// Randomly place tables from the wall to shelfX\n\t\trestArea := restRect.w * restRect.h\n\t\tfor i := 0; i < 2*restArea; i++ {\n\t\t\tx := rand.Intn(restRect.w) + 2\n\t\t\ty := rand.Intn(restRect.h) + 2\n\t\t\t// Don't place in path of entrance\n\t\t\tif x == entranceX {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// Check that radius 1 is free of furniture\n\t\t\tif f.isClear(x-1, y-1, 3, 3) {\n\t\t\t\tf.setTile(x, y, table)\n\t\t\t\t// Place chairs as well, as long as the tiles behind it are free\n\t\t\t\tif x-1 >= 2 && f.isClear(x-2, y-1, 1, 3) {\n\t\t\t\t\tf.setTile(x-1, y, chair)\n\t\t\t\t}\n\t\t\t\tif x+1 < shelfX && f.isClear(x+2, y-1, 1, 3) {\n\t\t\t\t\tf.setTile(x+1, y, chair)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Items against walls - pots\n\tfor i := 0; i < (f.Width+f.Height)*4; i++ {\n\t\tx := rand.Intn(f.Width-4) + 2\n\t\ty := rand.Intn(f.Height-5) + 2\n\t\tif x != 2 && x != f.Width-3 && y != 2 && y != f.Height-4 {\n\t\t\tcontinue\n\t\t}\n\t\t// Check that the 1 radius around is free of furniture that is not pots or\n\t\t// counters or hangings, and shopkeepers\n\t\tclear := c.isClear(x-1, y-1, 3, 3)\n\t\tfor x1 := x - 1; x1 <= x+1 && clear; x1++ {\n\t\t\tfor y1 := y - 1; y1 <= y+1 && clear; y1++ {\n\t\t\t\tfurniture := f.getTile(x1, y1)\n\t\t\t\tif furniture != nothing && furniture != pot && furniture != counter &&\n\t\t\t\t\tfurniture != hanging {\n\t\t\t\t\tclear = false\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif clear {\n\t\t\tf.setTile(x, y, pot)\n\t\t}\n\t}\n\n\t// Shop assistants\n\tfor i := 0; i < c.Width*c.Height/100-1; i++ {\n\t\t// Place assistants in the shop, in front of the counter\n\t\tfor {\n\t\t\tx := rand.Intn(f.Width-4) + 2\n\t\t\ty := rand.Intn(f.Height-7) + 4\n\t\t\tif f.isClear(x, y, 1, 1) {\n\t\t\t\tc.setTile(x, y, assistant)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\t// patrons - place anywhere except behind the counter\n\tfor i := 0; i < c.Width*c.Height/36; i++ {\n\t\tfor {\n\t\t\tx := rand.Intn(f.Width)\n\t\t\ty := rand.Intn(f.Height)\n\t\t\tif !(y == 2 && x >= counterX && x < counterX+counterW) &&\n\t\t\t\t// Allow patrons on rug\n\t\t\t\t(s.isClear(x, y, 1, 1) || s.getTile(x, y) == rug) &&\n\t\t\t\t// Allow patrons on chairs\n\t\t\t\t(f.isClear(x, y, 1, 1) || f.getTile(x, y) == chair) &&\n\t\t\t\tc.isClear(x, y, 1, 1) {\n\t\t\t\tc.setTile(x, y, player)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\treturn m\n}", "func (o *OrgBlockEvent) GetInstallation() *Installation {\n\tif o == nil {\n\t\treturn nil\n\t}\n\treturn o.Installation\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}" ]
[ "0.5617385", "0.49448717", "0.48865545", "0.46346137", "0.46180716", "0.4546673", "0.4520725", "0.44981894", "0.4473279", "0.44688192", "0.44370797", "0.4383674", "0.43667433", "0.43574375", "0.43501434", "0.4348958", "0.43374476", "0.43007717", "0.4293506", "0.42214704", "0.42135358", "0.42119366", "0.4183976", "0.4150396", "0.4136827", "0.4135283", "0.4120979", "0.4116766", "0.40797484", "0.40754852", "0.40669993", "0.4065561", "0.40617272", "0.40597668", "0.4055387", "0.4051063", "0.4034777", "0.4030457", "0.40233463", "0.4019068", "0.40015167", "0.3989547", "0.39887106", "0.39853618", "0.39777476", "0.3975277", "0.39621532", "0.39566484", "0.39511573", "0.39404702", "0.39107037", "0.39081594", "0.39079788", "0.39068028", "0.39048934", "0.39005297", "0.3890152", "0.38844705", "0.38827434", "0.38804358", "0.38723361", "0.38701454", "0.38623032", "0.3862231", "0.3855636", "0.3853346", "0.38532054", "0.3849498", "0.38453907", "0.38445002", "0.3841841", "0.38387278", "0.3831901", "0.3829787", "0.38271278", "0.38092646", "0.38013494", "0.37982255", "0.37940398", "0.37918773", "0.37827718", "0.37816203", "0.37741086", "0.3772174", "0.3770195", "0.37701285", "0.3768606", "0.3768457", "0.37583464", "0.3757271", "0.3755072", "0.3752102", "0.37503392", "0.37497237", "0.37465852", "0.37428033", "0.37427682", "0.3735814", "0.3733455", "0.37308457" ]
0.7809537
0
MarshalJSON transforms a duration into JSON.
func (d *Duration) MarshalJSON() ([]byte, error) { return json.Marshal(d.String()) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (d Duration) MarshalJSON() ([]byte, error) {\n\tms := int64(math.Round(d.Milliseconds()))\n\treturn json.Marshal(ms)\n}", "func (d Duration) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(fmt.Sprintf(\"%v\", d.Duration))\n}", "func (d Duration) MarshalJSON() ([]byte, error) {\n\treturn []byte(`\"` + d.Duration.String() + `\"`), nil\n}", "func (d Duration) MarshalJSON() ([]byte, error) {\n\treturn []byte(`\"` + time.Duration(d).String() + `\"`), nil\n}", "func (d Duration) MarshalJSON() ([]byte, error) {\r\n\treturn json.Marshal(d.String())\r\n}", "func (d Duration) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(d.String())\n}", "func (d Duration) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(d.String())\n}", "func (d Duration) MarshalJSON() (b []byte, err error) {\n\treturn []byte(fmt.Sprintf(`\"%s\"`, d.String())), nil\n}", "func (d Duration) MarshalJSON() ([]byte, error) {\n\treturn []byte(`\"` + d.String() + `\"`), nil\n}", "func (d Duration) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(int64(d / 1e6))\n}", "func (d Duration) MarshalJSON() ([]byte, error) {\n\treturn []byte(`\"` + d.D().String() + `\"`), nil\n}", "func (d Duration) MarshalJSON() (buf []byte, err error) {\n\tbuf = []byte(\"\\\"\" + d.String() + \"\\\"\")\n\treturn\n}", "func (j JSONTimeDuration) MarshalJSON() ([]byte, error) {\n\tbuf := new(bytes.Buffer)\n\tif _, err := fmt.Fprintf(buf, \"%q\", time.Duration(j).String()); err != nil {\n\t\treturn nil, err\n\t}\n\treturn buf.Bytes(), nil\n}", "func (d Duration) MarshalJSON() ([]byte, error) {\n\tvar b bytes.Buffer\n\tb.WriteByte('\"')\n\tfor _, d := range d.Values {\n\t\tb.WriteString(strconv.Itoa(int(d.Magnitude)))\n\t\tb.WriteString(d.Unit)\n\t}\n\tb.WriteByte('\"')\n\n\treturn b.Bytes(), nil\n}", "func (d Duration) MarshalJSON() ([]byte, error) {\n\tvar b bytes.Buffer\n\tb.WriteByte('\"')\n\tfor _, d := range d.Values {\n\t\tb.WriteString(strconv.Itoa(int(d.Magnitude)))\n\t\tb.WriteString(d.Unit)\n\t}\n\tb.WriteByte('\"')\n\n\treturn b.Bytes(), nil\n}", "func MarshalDuration(s *jsonplugin.MarshalState, v *durationpb.Duration) {\n\tif v == nil {\n\t\ts.WriteNil()\n\t\treturn\n\t}\n\ts.WriteDuration(v.AsDuration())\n}", "func (rd *requestDuration) MarshalJSON() ([]byte, error) {\n\tstamp := fmt.Sprint(rd)\n\treturn []byte(stamp), nil\n}", "func (t Time) MarshalJSON() ([]byte, error) {}", "func (val Time) MarshalJSON() ([]byte, error) {\n\tsec := int64(val) / 1000000\n\tusec := int64(val) % 1000000\n\treturn []byte(fmt.Sprintf(\"%d.%06d\", sec, usec)), nil\n}", "func (wd *WaitDelay) MarshalJSON() ([]byte, error) {\n\tadditionalParams := make(map[string]interface{})\n\tadditionalParams[\"Seconds\"] = wd.delay.Seconds()\n\treturn wd.marshalStateJSON(\"Wait\", additionalParams)\n}", "func (c *AverageDuration) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(struct {\n\t\tCount int64 `json:\"total\"`\n\t\tAverage int64 `json:\"average\"`\n\t}{\n\t\tc.Count(),\n\t\tc.Average(),\n\t})\n}", "func (a *JSONAttachment) MarshalJSON() ([]byte, error) {\n\ttype EmbeddedJSONAttachment JSONAttachment\n\treturn json.Marshal(&struct {\n\t\tDuration float64 `json:\"duration_in_seconds,omitempty\"`\n\t\t*EmbeddedJSONAttachment\n\t}{\n\t\tEmbeddedJSONAttachment: (*EmbeddedJSONAttachment)(a),\n\t\tDuration: a.Duration.Seconds(),\n\t})\n}", "func (t JSONTime) MarshalJSON() ([]byte, error) { \r\n\tformatted := fmt.Sprintf(\"\\\"%s\\\"\", t.Format(YYYYMMDDHHMISS)) \r\n\treturn []byte(formatted), nil \r\n}", "func (t JSONTime) MarshalJSON() ([]byte, error) {\n\tformatted := fmt.Sprintf(\"\\\"%s\\\"\", t.Format(\"2006-01-02 15:04:05\"))\n\treturn []byte(formatted), nil\n}", "func (t JSONTime) MarshalJSON() ([]byte, error) {\n\tformatted := fmt.Sprintf(\"\\\"%s\\\"\", t.Format(\"2006-01-02 15:04:05\"))\n\treturn []byte(formatted), nil\n}", "func (v RxDelay) MarshalJSON() ([]byte, error) {\n\t// NOTE: This marshals as a number, contrary to protobuf spec.\n\treturn json.Marshal(int32(v))\n}", "func (t Time) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(t.String())\n}", "func (t *Time) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(t.Unix())\n}", "func (t *Timeframe) ToJSON() ([]byte, error) {\n\treturn json.Marshal(t)\n}", "func (m TimeUnit) MarshalJSON() ([]byte, error) {\n\tbuffer := bytes.NewBufferString(`\"`)\n\tbuffer.WriteString(m.String())\n\tbuffer.WriteString(`\"`)\n\treturn buffer.Bytes(), nil\n}", "func (t JSONTime) MarshalJSON() ([]byte, error) {\n\tstamp := fmt.Sprintf(\"\\\"%s\\\"\", t.Format(timeFormat))\n\treturn []byte(stamp), nil\n}", "func (ct Time) MarshalJSON() ([]byte, error) {\n\treturn []byte(ct.String()), nil\n}", "func (t *JSONTime) MarshalJSON() ([]byte, error) {\n\t//do your serializing here\n\tstamp := fmt.Sprintf(\"\\\"%s\\\"\", t.Time.Format(\"2006-01-02 15:04\"))\n\treturn []byte(stamp), nil\n}", "func (t Time) MarshalJSON() ([]byte, error) {\n\treturn []byte(fmt.Sprintf(\"\\\"%s\\\"\", t.RFC3339Format())), nil\n}", "func (e ExportTimePeriod) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulateTimeRFC3339(objectMap, \"from\", e.From)\n\tpopulateTimeRFC3339(objectMap, \"to\", e.To)\n\treturn json.Marshal(objectMap)\n}", "func EncodeDuration(d time.Duration) string {\n\treturn d.String()\n}", "func (t Time) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(time.Time(t).UTC().Format(TsLayout))\n}", "func (v PointInTime) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson390b7126EncodeGithubComChancedPicker51(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (t Time) MarshalJSON() ([]byte, error) {\n\treturn t.MarshalText()\n}", "func (d Duration) MarshalYAML() (interface{}, error) {\n\treturn d.Duration.String(), nil\n}", "func (t *Time) MarshalJSON() ([]byte, error) {\n\n\tif t == nil || *t == 0 {\n\t\treturn ekaenc.NULL_JSON_BYTES_SLICE, nil\n\t}\n\n\tb := make([]byte, 10)\n\t_ = t.AppendTo(b[1:1:10], ':')\n\n\tb[0] = '\"'\n\tb[9] = '\"'\n\n\treturn b, nil\n}", "func (v RxDelayValue) MarshalJSON() ([]byte, error) {\n\treturn v.Value.MarshalJSON()\n}", "func (p PresentationTimeRange) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"endTimestamp\", p.EndTimestamp)\n\tpopulate(objectMap, \"forceEndTimestamp\", p.ForceEndTimestamp)\n\tpopulate(objectMap, \"liveBackoffDuration\", p.LiveBackoffDuration)\n\tpopulate(objectMap, \"presentationWindowDuration\", p.PresentationWindowDuration)\n\tpopulate(objectMap, \"startTimestamp\", p.StartTimestamp)\n\tpopulate(objectMap, \"timescale\", p.Timescale)\n\treturn json.Marshal(objectMap)\n}", "func (q QueryTimePeriod) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulateTimeRFC3339(objectMap, \"from\", q.From)\n\tpopulateTimeRFC3339(objectMap, \"to\", q.To)\n\treturn json.Marshal(objectMap)\n}", "func (d Duration) MarshalYAML() (interface{}, error) {\n\treturn d.String(), nil\n}", "func SerializeDuration(this time.Duration) (interface{}, error) {\n\t// Seriously questioning my life choices.\n\ts := \"P\"\n\tif this < 0 {\n\t\ts = \"-P\"\n\t\tthis = -1 * this\n\t}\n\tvar tally time.Duration\n\t// Assume 8760 Hours per 365 days, cannot account for leap years in xsd:duration. :(\n\tif years := this.Hours() / 8760.0; years >= 1 {\n\t\tnYears := int64(math.Floor(years))\n\t\ttally += time.Duration(nYears) * 8760 * time.Hour\n\t\ts = fmt.Sprintf(\"%s%dY\", s, nYears)\n\t}\n\t// Assume 30 days per month, cannot account for months lasting 31, 30, 29, or 28 days in xsd:duration. :(\n\tif months := (this.Hours() - tally.Hours()) / 720.0; months >= 1 {\n\t\tnMonths := int64(math.Floor(months))\n\t\ttally += time.Duration(nMonths) * 720 * time.Hour\n\t\ts = fmt.Sprintf(\"%s%dM\", s, nMonths)\n\t}\n\tif days := (this.Hours() - tally.Hours()) / 24.0; days >= 1 {\n\t\tnDays := int64(math.Floor(days))\n\t\ttally += time.Duration(nDays) * 24 * time.Hour\n\t\ts = fmt.Sprintf(\"%s%dD\", s, nDays)\n\t}\n\tif tally < this {\n\t\ts = fmt.Sprintf(\"%sT\", s)\n\t\tif hours := this.Hours() - tally.Hours(); hours >= 1 {\n\t\t\tnHours := int64(math.Floor(hours))\n\t\t\ttally += time.Duration(nHours) * time.Hour\n\t\t\ts = fmt.Sprintf(\"%s%dH\", s, nHours)\n\t\t}\n\t\tif minutes := this.Minutes() - tally.Minutes(); minutes >= 1 {\n\t\t\tnMinutes := int64(math.Floor(minutes))\n\t\t\ttally += time.Duration(nMinutes) * time.Minute\n\t\t\ts = fmt.Sprintf(\"%s%dM\", s, nMinutes)\n\t\t}\n\t\tif seconds := this.Seconds() - tally.Seconds(); seconds >= 1 {\n\t\t\tnSeconds := int64(math.Floor(seconds))\n\t\t\ttally += time.Duration(nSeconds) * time.Second\n\t\t\ts = fmt.Sprintf(\"%s%dS\", s, nSeconds)\n\t\t}\n\t}\n\treturn s, nil\n}", "func (x *Time) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(x.Value())\n}", "func (t Timestamp) MarshalJSON() ([]byte, error) {\n\t// Per Node.js epochs, we need milliseconds\n\treturn []byte(strconv.FormatInt(t.JSEpoch(), 10)), nil\n}", "func (t Timespan) Marshal() string {\n\tconst (\n\t\tday = 24 * time.Hour\n\t)\n\n\tif !t.Valid {\n\t\treturn \"00:00:00\"\n\t}\n\n\t// val is used to track the duration value as we move our parts of our time into our string format.\n\t// For example, after we write to our string the number of days that value had, we remove those days\n\t// from the duration. We continue doing this until val only holds values < 10 millionth of a second (tick)\n\t// as that is the lowest precision in our string representation.\n\tval := t.Value\n\n\tsb := strings.Builder{}\n\n\t// Add a - sign if we have a negative value. Convert our value to positive for easier processing.\n\tif t.Value < 0 {\n\t\tsb.WriteString(\"-\")\n\t\tval = val * -1\n\t}\n\n\t// Only include the day if the duration is 1+ days.\n\tdays := val / day\n\tval = val - (days * day)\n\tif days > 0 {\n\t\tsb.WriteString(fmt.Sprintf(\"%d.\", int(days)))\n\t}\n\n\t// Add our hours:minutes:seconds section.\n\thours := val / time.Hour\n\tval = val - (hours * time.Hour)\n\tminutes := val / time.Minute\n\tval = val - (minutes * time.Minute)\n\tseconds := val / time.Second\n\tval = val - (seconds * time.Second)\n\tsb.WriteString(fmt.Sprintf(\"%02d:%02d:%02d\", int(hours), int(minutes), int(seconds)))\n\n\t// Add our sub-second string representation that is proceeded with a \".\".\n\tmilliseconds := val / time.Millisecond\n\tval = val - (milliseconds * time.Millisecond)\n\tticks := val / tick\n\tif milliseconds > 0 || ticks > 0 {\n\t\tsb.WriteString(fmt.Sprintf(\".%03d%d\", milliseconds, ticks))\n\t}\n\n\t// Remove any trailing 0's.\n\tstr := strings.TrimRight(sb.String(), \"0\")\n\tif strings.HasSuffix(str, \":\") {\n\t\tstr = str + \"00\"\n\t}\n\n\treturn str\n}", "func (s *Stopwatch) MarshalJSON() ([]byte, error) {\n\treturn []byte(s.String()), nil\n}", "func (s Server) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(struct {\n\t\tDuration int64 `json:\"duration,omitempty\"` // Measures the duration of the inbound HTTP request in ms\n\t}{\n\t\ts.Duration.Milliseconds(),\n\t})\n}", "func (e ExportRecurrencePeriod) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]interface{})\n\tpopulateTimeRFC3339(objectMap, \"from\", e.From)\n\tpopulateTimeRFC3339(objectMap, \"to\", e.To)\n\treturn json.Marshal(objectMap)\n}", "func (d duration) MarshalZerologObject(e *zerolog.Event) {\n\te.Dur(\"duration\", time.Duration(d))\n}", "func (f Fade) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"duration\", f.Duration)\n\tpopulate(objectMap, \"fadeColor\", f.FadeColor)\n\tpopulate(objectMap, \"start\", f.Start)\n\treturn json.Marshal(objectMap)\n}", "func (t Time) MarshalJSON() ([]byte, error) {\n\tif t.IsZero() {\n\t\treturn []byte(`\"\"`), nil\n\t}\n\n\treturn []byte(`\"` + t.Format(time.RFC3339) + `\"`), nil\n}", "func (s Duration) MarshalFields(e protocol.FieldEncoder) error {\n\tif len(s.Unit) > 0 {\n\t\tv := s.Unit\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"unit\", protocol.QuotedValue{ValueMarshaler: v}, metadata)\n\t}\n\tif s.Value != nil {\n\t\tv := *s.Value\n\n\t\tmetadata := protocol.Metadata{}\n\t\te.SetValue(protocol.BodyTarget, \"value\", protocol.Int64Value(v), metadata)\n\t}\n\treturn nil\n}", "func (d *Duration) UnmarshalJSON(data []byte) error {\n\tvar ms int64\n\tif e := json.Unmarshal(data, &ms); e != nil {\n\t\treturn e\n\t}\n\t*d = Duration(ms * 1e6)\n\treturn nil\n}", "func (t *Time) MarshalJSON() ([]byte, error) {\n\treturn []byte(t.Format(`\"` + DeisDatetimeFormat + `\"`)), nil\n}", "func (t Time) MarshalJSON() ([]byte, error) {\n\tif t.Time.IsZero() {\n\t\treturn null, nil\n\t}\n\treturn t.Time.MarshalJSON()\n}", "func (t Time) MarshalJSON() ([]byte, error) {\n\tif y := t.Year(); y < 0 || y >= 10000 {\n\t\treturn nil, errors.New(\"Time.MarshalJSON: year outside of range [0,9999]\")\n\t}\n\tif t.IsZero() {\n\t\treturn []byte(\"null\"), nil\n\t}\n\n\tb := make([]byte, 0, len(time.RFC3339)+2)\n\tb = append(b, '\"')\n\tb = t.In(time.UTC).AppendFormat(b, time.RFC3339)\n\tb = append(b, '\"')\n\treturn b, nil\n}", "func (t JSONTime) MarshalJSON() ([]byte, error) {\n\ttimeVal := time.Time(t)\n\tif timeVal.IsZero() {\n\t\treturn []byte(`\"\"`), nil\n\t}\n\n\treturn []byte(`\"` + timeVal.Format(time.RFC3339Nano) + `\"`), nil\n}", "func (t StTimestamp) MarshalJSON() ([]byte, error) {\n\treturn []byte(fmt.Sprintf(`\"%s\"`, t.Format(\"2006-01-02 15:04:05\"))), nil\n}", "func (u UTCClipTime) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tobjectMap[\"@odata.type\"] = \"#Microsoft.Media.UtcClipTime\"\n\tpopulateTimeRFC3339(objectMap, \"time\", u.Time)\n\treturn json.Marshal(objectMap)\n}", "func (t *Timestamp) MarshalJSON() ([]byte, error) {\n\tif t != nil {\n\t\tts := time.Time(*t)\n\t\treturn []byte(fmt.Sprintf(`\"%d\"`, ts.UnixNano()/int64(time.Millisecond))), nil\n\t}\n\treturn nil, nil\n}", "func (i Interval) MarshalJSON() ([]byte, error) {\n\ttest := struct {\n\t\tTimestamps *Timestamps `json:\",omitempty\"`\n\t\tID string `json:\"id,omitempty\"`\n\t\tName string `json:\"name,omitempty\"` // non-database identifier for a schedule (*must be quitue)\n\t\tStart string `json:\"start,omitempty\"` // Start time i ISO 8601 format YYYYMMDD'T'HHmmss\n\t\tEnd string `json:\"end,omitempty\"` // Start time i ISO 8601 format YYYYMMDD'T'HHmmss\n\t\tFrequency string `json:\"frequency,omitempty\"` // how frequently should the event occur\n\t\tCron string `json:\"cron,omitempty\"` // cron styled regular expression indicating how often the action under schedule should occur. Use either runOnce, frequency or cron and not all.\n\t\tRunOnce bool `json:\"runOnce,omitempty\"` // boolean indicating that this interval runs one time - at the time indicated by the start\n\t}{\n\t\tTimestamps: &i.Timestamps,\n\t\tID: i.ID,\n\t\tName: i.Name,\n\t\tStart: i.Start,\n\t\tEnd: i.End,\n\t\tFrequency: i.Frequency,\n\t\tCron: i.Cron,\n\t\tRunOnce: i.RunOnce,\n\t}\n\n\tif reflect.DeepEqual(i.Timestamps, Timestamps{}) {\n\t\ttest.Timestamps = nil\n\t}\n\n\treturn json.Marshal(test)\n}", "func (t *Time) MarshalJSON() ([]byte, error) {\n\tif t.IsZero() {\n\t\treturn []byte(\"null\"), nil\n\t}\n\n\treturn json.Marshal(t.Time)\n}", "func (t *Timestamp) MarshalJSON() ([]byte, error) {\n\treturn []byte(t.String()), nil\n}", "func (s StreamingEntityScaleUnit) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"scaleUnit\", s.ScaleUnit)\n\treturn json.Marshal(objectMap)\n}", "func (nt Time) MarshalJSON() ([]byte, error) {\n\tif !nt.Valid() {\n\t\treturn json.Marshal(nil)\n\t}\n\treturn json.Marshal(nt.Time)\n}", "func (v TimeEntryActivity) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjson44273644EncodeGithubComSomniSomGoRedmine1(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (d Duration) MarshalText() (text []byte, err error) {\n\treturn []byte(d.String()), nil\n}", "func (d Duration) MarshalText() (text []byte, err error) {\n\treturn []byte(d.String()), nil\n}", "func (d DateTime) MarshalJSON() (json []byte, err error) {\n\treturn d.Time.MarshalJSON()\n}", "func (t Timestamp) MarshalJSON() ([]byte, error) {\n\t// write seconds.\n\ttt := time.Time(t)\n\tb := make([]byte, 0, 20)\n\tb = strconv.AppendInt(b, tt.Unix(), 10)\n\tb = append(b, '.')\n\n\t// write microsecond\n\tm := (time.Duration(tt.Nanosecond()) + 500*time.Nanosecond) / time.Microsecond\n\tswitch {\n\tcase m < 10:\n\t\tb = append(b, '0', '0', '0', '0', '0')\n\tcase m < 100:\n\t\tb = append(b, '0', '0', '0', '0')\n\tcase m < 1000:\n\t\tb = append(b, '0', '0', '0')\n\tcase m < 10000:\n\t\tb = append(b, '0', '0')\n\tcase m < 100000:\n\t\tb = append(b, '0')\n\t}\n\tb = strconv.AppendInt(b, int64(m), 10)\n\treturn b, nil\n}", "func (v Metric) MarshalJSON() ([]byte, error) {\n\tw := jwriter.Writer{}\n\teasyjsonC5a4559bEncodeGithubComChromedpCdprotoPerformance(&w, v)\n\treturn w.Buffer.BuildBytes(), w.Error\n}", "func (t *Timestamp) MarshalJSON() ([]byte, error) {\n\tts := time.Time(*t).Unix()\n\tstamp := fmt.Sprint(ts)\n\n\treturn []byte(stamp), nil\n}", "func (t *Timestamp) MarshalJSON() ([]byte, error) {\n\tts := time.Time(*t).Unix()\n\tstamp := fmt.Sprint(ts)\n\n\treturn []byte(stamp), nil\n}", "func (td *jsonDuration) Duration() time.Duration {\r\n\treturn time.Duration(*td)\r\n}", "func (t Timestamp) MarshalJSON() ([]byte, error) {\n\tbuf := make([]byte, 0, 20)\n\tbuf = strconv.AppendInt(buf, int64(t), 10)\n\treturn buf, nil\n}", "func (t *timestamp) MarshalJSON() ([]byte, error) {\n\tts := time.Time(*t).Unix()\n\tstamp := fmt.Sprint(ts)\n\treturn []byte(stamp), nil\n}", "func (t Unix) MarshalJSON() ([]byte, error) {\n\tsecs := time.Time(t).Unix()\n\treturn []byte(strconv.FormatInt(secs, 10)), nil\n}", "func (ts *TimeStats) JSON() string {\n\tout, _ := json.Marshal(ts)\n\tts.Total = 0\n\tts.Earliest = time.Time{}\n\tts.Latest = time.Time{}\n\treturn string(out)\n\n}", "func (t LegendTime) MarshalJSON() ([]byte, error) {\n\t//do your serializing here\n\tstamp := fmt.Sprintf(\"\\\"%s\\\"\", t.Format(\"Mon Jan _2\"))\n\treturn []byte(stamp), nil\n}", "func (t UnixTime) MarshalJSON() ([]byte, error) {\n\treturn []byte(fmt.Sprintf(\"%d\", time.Time(t).Unix())), nil\n}", "func (s Client) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(struct {\n\t\tDuration int64 `json:\"duration,omitempty\"` // Measures the duration of the inbound HTTP request in ms\n\t}{\n\t\ts.Duration.Milliseconds(),\n\t})\n}", "func durationTo8601Seconds(duration time.Duration) string {\n\treturn fmt.Sprintf(\"PT%dS\", duration/time.Second)\n}", "func (c *TimeseriesEntry) MarshalJSON() ([]byte, error) {\n\tvalue, err := c.Value.Int64()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn json.Marshal(struct {\n\t\tTime int64 `json:\"time\"`\n\t\tValue int64 `json:\"value\"`\n\t}{\n\t\tTime: c.Time.Unix(),\n\t\tValue: value,\n\t})\n}", "func (t Timestamp) MarshalJSON() ([]byte, error) {\n\t// Always send back in UTC with nanoseconds\n\ts := t.Time().UTC().Format(time.RFC3339Nano)\n\treturn []byte(`\"` + s + `\"`), nil\n}", "func (c *Counter) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(c.value)\n}", "func (t iso8601Datetime) MarshalJSON() ([]byte, error) {\n\ts := t.Time.Format(iso8601Layout)\n\treturn json.Marshal(s)\n}", "func (ri RepeatingInterval) MarshalJSON() ([]byte, error) {\n\treturn []byte(fmt.Sprintf(\"%q\", ri.String())), nil\n}", "func (d *Duration) UnmarshalJSON(b []byte) error {\n\tvar v interface{}\n\tif err := json.Unmarshal(b, &v); err != nil {\n\t\treturn errors.Wrap(err, \"failed to parse duration\")\n\t}\n\tswitch value := v.(type) {\n\tcase float64:\n\t\td.Duration = time.Duration(value*365*24) * time.Hour\n\tdefault:\n\t\treturn errors.New(\"invalid duration\")\n\t}\n\n\treturn nil\n}", "func (s Sampling) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(s.String())\n}", "func (t Timestamp) MarshalJSON() ([]byte, error) {\n\tts := t.Time().Unix()\n\tstamp := fmt.Sprint(ts)\n\n\treturn []byte(stamp), nil\n}", "func (l LiveOutputProperties) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tpopulate(objectMap, \"archiveWindowLength\", l.ArchiveWindowLength)\n\tpopulate(objectMap, \"assetName\", l.AssetName)\n\tpopulateTimeRFC3339(objectMap, \"created\", l.Created)\n\tpopulate(objectMap, \"description\", l.Description)\n\tpopulate(objectMap, \"hls\", l.Hls)\n\tpopulateTimeRFC3339(objectMap, \"lastModified\", l.LastModified)\n\tpopulate(objectMap, \"manifestName\", l.ManifestName)\n\tpopulate(objectMap, \"outputSnapTime\", l.OutputSnapTime)\n\tpopulate(objectMap, \"provisioningState\", l.ProvisioningState)\n\tpopulate(objectMap, \"resourceState\", l.ResourceState)\n\tpopulate(objectMap, \"rewindWindowLength\", l.RewindWindowLength)\n\treturn json.Marshal(objectMap)\n}", "func (t *Time) MarshalJSON() ([]byte, error) {\n\tif time.Time(*t).IsZero() {\n\t\treturn []byte(`\"\"`), nil\n\t}\n\treturn []byte(`\"` + time.Time(*t).Format(\"2006-01-02 15:04:05\") + `\"`), nil\n}", "func (t *Time) MarshalJSON() ([]byte, error) {\n\tbuf := bytes.NewBuffer([]byte{'\"'})\n\tif _, err := buf.WriteString(t.String()); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := buf.WriteByte('\"'); err != nil {\n\t\treturn nil, err\n\t}\n\treturn buf.Bytes(), nil\n}", "func (a AbsoluteClipTime) MarshalJSON() ([]byte, error) {\n\tobjectMap := make(map[string]any)\n\tobjectMap[\"@odata.type\"] = \"#Microsoft.Media.AbsoluteClipTime\"\n\tpopulate(objectMap, \"time\", a.Time)\n\treturn json.Marshal(objectMap)\n}", "func (d *Duration) UnmarshalJSON(b []byte) error {\n\tvar str string\n\terr := json.Unmarshal(b, &str)\n\td.Duration, err = time.ParseDuration(str)\n\treturn err\n}", "func (t *Time) MarshalJSON() ([]byte, error) {\n\tstr := t.Format(fmt.Sprintf(`\"%s\"`, time.RFC1123Z))\n\treturn []byte(str), nil\n}" ]
[ "0.8067823", "0.78377986", "0.7688869", "0.7682062", "0.766996", "0.7667882", "0.7667882", "0.7661535", "0.76569986", "0.7606787", "0.7586018", "0.7584973", "0.75164276", "0.737047", "0.737047", "0.7274038", "0.7076739", "0.6471667", "0.633626", "0.63229567", "0.62663954", "0.6185362", "0.61526614", "0.6121444", "0.6121444", "0.60605043", "0.60477555", "0.60388094", "0.5986897", "0.5943545", "0.5915474", "0.5912213", "0.587784", "0.58400416", "0.58381385", "0.5833792", "0.5831552", "0.5819181", "0.58163327", "0.58131284", "0.58079964", "0.57931453", "0.57920194", "0.5739213", "0.57390106", "0.5724765", "0.5722846", "0.5710026", "0.56992745", "0.56860775", "0.56821996", "0.567614", "0.5676001", "0.56747776", "0.5642574", "0.56423736", "0.5637905", "0.56311023", "0.5612797", "0.560927", "0.560824", "0.5602847", "0.5600537", "0.55987495", "0.55932164", "0.55832994", "0.55713934", "0.55707675", "0.5564629", "0.556203", "0.5560144", "0.5560144", "0.5558315", "0.5545063", "0.5538001", "0.5524784", "0.5524784", "0.55235", "0.55217445", "0.5518062", "0.5517596", "0.5509319", "0.54880744", "0.5486348", "0.54832613", "0.54748297", "0.54739344", "0.54717183", "0.54658675", "0.5444912", "0.5431982", "0.5423377", "0.54197174", "0.54134625", "0.5412447", "0.5407358", "0.5401078", "0.53891915", "0.5386421", "0.53816485" ]
0.75790226
12
UnmarshalJSON transform JSON into a Duration.
func (d *Duration) UnmarshalJSON(b []byte) error { var str string err := json.Unmarshal(b, &str) d.Duration, err = time.ParseDuration(str) return err }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (d *Duration) UnmarshalJSON(data []byte) error {\n\tvar ms int64\n\tif e := json.Unmarshal(data, &ms); e != nil {\n\t\treturn e\n\t}\n\t*d = Duration(ms * 1e6)\n\treturn nil\n}", "func (d *Duration) UnmarshalJSON(data []byte) error {\n\t//support old int seconds data\n\tif intRe.Match(data) {\n\t\t//convert to \"<int>s\"\n\t\tdata = []byte(`\"` + string(data) + `s\"`)\n\t}\n\t//\n\tvar s string\n\tif err := json.Unmarshal(data, &s); err != nil {\n\t\treturn err\n\t}\n\ttmp, err := time.ParseDuration(s)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*d = Duration(tmp)\n\treturn nil\n}", "func (d *Duration) UnmarshalJSON(raw []byte) error {\n\tvar v interface{}\n\terr := json.Unmarshal(raw, &v)\n\tif err != nil {\n\t\treturn err\n\t}\n\td.Duration, err = durationFromInterface(v)\n\treturn err\n}", "func (d *Duration) UnmarshalJSON(b []byte) error {\n\tvar v interface{}\n\tif err := json.Unmarshal(b, &v); err != nil {\n\t\treturn err\n\t}\n\tswitch value := v.(type) {\n\tcase float64:\n\t\td.Duration = time.Duration(value)\n\t\treturn nil\n\tcase string:\n\t\tvar err error\n\t\td.Duration, err = time.ParseDuration(value)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\tdefault:\n\t\treturn errors.New(\"invalid duration\")\n\t}\n}", "func (d *Duration) UnmarshalJSON(b []byte) error {\n\tif err := json.Unmarshal(b, &d.Duration); err == nil {\n\t\t// b was an integer number of nanoseconds.\n\t\treturn nil\n\t}\n\t// b was not an integer. Assume that it is a duration string.\n\n\tvar str string\n\terr := json.Unmarshal(b, &str)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpd, err := time.ParseDuration(str)\n\tif err != nil {\n\t\treturn err\n\t}\n\td.Duration = &pd\n\treturn nil\n}", "func (d *Duration) UnmarshalJSON(data []byte) error {\r\n\tvar err error\r\n\tvar v interface{}\r\n\tif err = json.Unmarshal(data, &v); err != nil {\r\n\t\treturn err\r\n\t}\r\n\tswitch value := v.(type) {\r\n\tcase float64:\r\n\t\td.Duration = time.Duration(value)\r\n\tcase string:\r\n\t\td.Duration, err = time.ParseDuration(value)\r\n\t\tif err != nil {\r\n\t\t\treturn err\r\n\t\t}\r\n\tdefault:\r\n\t\treturn errors.Errorf(\"invalid duration: `%s`\", string(data))\r\n\t}\r\n\r\n\treturn nil\r\n}", "func (d *Duration) UnmarshalJSON(b []byte) error {\n\tvar v interface{}\n\tif err := json.Unmarshal(b, &v); err != nil {\n\t\treturn errors.Wrap(err, \"failed to parse duration\")\n\t}\n\tswitch value := v.(type) {\n\tcase float64:\n\t\td.Duration = time.Duration(value*365*24) * time.Hour\n\tdefault:\n\t\treturn errors.New(\"invalid duration\")\n\t}\n\n\treturn nil\n}", "func (d *Duration) UnmarshalJSON(b []byte) error {\n\tdur, err := parseDuration(string(b[1 : len(b)-1]))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*d = Duration{Values: dur}\n\n\treturn nil\n}", "func (d *Duration) UnmarshalJSON(data []byte) error {\n\tif len(data) == 0 {\n\t\treturn nil\n\t}\n\tvar stringVar string\n\tif err := json.Unmarshal(data, &stringVar); err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\tout, err := time.ParseDuration(stringVar)\n\tif err != nil {\n\t\treturn trace.BadParameter(err.Error())\n\t}\n\td.Duration = out\n\treturn nil\n}", "func (d *Duration) UnmarshalJSON(b []byte) error {\n\tdur, err := parser.ParseDuration(string(b[1 : len(b)-1]))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*d = *(*Duration)(dur)\n\n\treturn nil\n}", "func (d *Duration) UnmarshalJSON(data []byte) error {\n\tif len(data) < 2 {\n\t\treturn errors.New(\"invalid duration string\")\n\t}\n\tdata = data[1 : len(data)-1]\n\n\tdu, err := time.ParseDuration(string(data))\n\tif err != nil {\n\t\treturn err\n\t}\n\t*d = Duration(du)\n\treturn nil\n}", "func (d *Duration) UnmarshalJSON(buf []byte) (err error) {\n\tvar td time.Duration\n\ttd, err = time.ParseDuration(string(buf[1 : len(buf)-1]))\n\tif err == nil {\n\t\t*d = Duration(td)\n\t}\n\treturn\n}", "func (d *Duration) UnmarshalJSON(b []byte) (err error) {\n\td.Duration, err = time.ParseDuration(strings.Trim(string(b), `\"`))\n\treturn\n}", "func (d *Duration) UnmarshalJSON(data []byte) error {\n\tif data[0] == '\"' {\n\t\tunwrappedDuration, err := time.ParseDuration(string(data[1 : len(data)-1]))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t*d = Duration(unwrappedDuration)\n\t} else {\n\t\tnanos, err := strconv.ParseInt(string(data), 10, 64)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t*d = Duration(nanos)\n\t}\n\n\treturn nil\n}", "func (t *Timeout) UnmarshalJSON(b []byte) error {\n\tvar (\n\t\ttimeout time.Duration\n\t\tstr string\n\t\terr error\n\t)\n\n\tif err = json.Unmarshal(b, &str); err != nil {\n\t\treturn errors.New(`Error interpreting timeout as string`)\n\t}\n\n\tif timeout, err = time.ParseDuration(str); err != nil {\n\t\treturn errors.New(`Error interpreting timeout as duration`)\n\t}\n\tconverted := Timeout(timeout)\n\tt = &converted\n\n\treturn nil\n}", "func (d *Delay) UnmarshalJSON(data []byte) error {\n\tdelay := struct {\n\t\tName string `json:\"name\"`\n\t\tDuration float32 `json:\"duration\"`\n\t}{}\n\tif err := json.Unmarshal(data, &delay); err != nil {\n\t\treturn err\n\t}\n\td.Name = delay.Name\n\td.Duration = time.Duration(delay.Duration*1000) * time.Millisecond\n\treturn nil\n}", "func (d *UnixDuration) UnmarshalJSON(raw []byte) error {\n\tvar s string\n\tif err := json.Unmarshal(raw, &s); err == nil {\n\t\tdur, err := time.ParseDuration(s)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"invalid duration string: %s\", err)\n\t\t}\n\t\t*d = AsUnixDuration(dur)\n\t\treturn nil\n\t}\n\n\tvar n int32\n\tif err := json.Unmarshal(raw, &n); err != nil {\n\t\treturn err\n\t}\n\t*d = UnixDuration(n)\n\treturn nil\n}", "func (t *Time) UnmarshalJSON(data []byte) error {\n\tmillis, err := strconv.ParseInt(string(data), 10, 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*t = Time(time.Unix(0, millis*int64(time.Millisecond)))\n\treturn nil\n}", "func (t *Time) UnmarshalJSON(data []byte) error {\n\tvar s int64\n\tif err := json.Unmarshal(data, &s); err != nil {\n\t\treturn fmt.Errorf(\"data should be number, got %s\", data)\n\t}\n\t*t = Time{time.Unix(s, 0)}\n\treturn nil\n}", "func (t *Time) UnmarshalJSON(data []byte) error {}", "func (m *TimeUnit) UnmarshalJSON(b []byte) error {\n\tvar j string\n\terr := json.Unmarshal(b, &j)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Note that if the string cannot be found then it will be set to the zero value, 'Created' in this case.\n\t*m = toTimeUnitID[j]\n\treturn nil\n}", "func (s *Client) UnmarshalJSON(data []byte) error {\n\tstr := struct {\n\t\tDuration int64 `json:\"duration,omitempty\"` // Measures the duration of the inbound HTTP request in ms\n\t}{}\n\n\tif err := json.Unmarshal(data, &str); err != nil {\n\t\treturn err\n\t}\n\ts.Duration = time.Millisecond * time.Duration(str.Duration)\n\treturn nil\n}", "func (s *Server) UnmarshalJSON(data []byte) error {\n\tstr := struct {\n\t\tDuration int64 `json:\"duration,omitempty\"` // Measures the duration of the inbound HTTP request in ms\n\t}{}\n\n\tif err := json.Unmarshal(data, &str); err != nil {\n\t\treturn err\n\t}\n\ts.Duration = time.Millisecond * time.Duration(str.Duration)\n\treturn nil\n}", "func (c *config) UnmarshalJSON(data []byte) error {\n\ttype Alias config\n\taux := &struct {\n\t\tZ string `json:\"z\"`\n\t\tX string `json:\"x\"`\n\t\t*Alias\n\t}{\n\t\tAlias: (*Alias)(c),\n\t}\n\tif err := json.Unmarshal(data, &aux); err != nil {\n\t\treturn err\n\t}\n\n\tif aux.Data != nil {\n\t\terr := checkData(aux.Data)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tzd, _ := time.ParseDuration(aux.Z)\n\tc.Z = duration{zd}\n\treturn nil\n}", "func (a *JSONAttachment) UnmarshalJSON(data []byte) error {\n\ttype EmbeddedJSONAttachment JSONAttachment\n\tvar raw struct {\n\t\tDuration float64 `json:\"duration_in_seconds,omitempty\"`\n\t\t*EmbeddedJSONAttachment\n\t}\n\traw.EmbeddedJSONAttachment = (*EmbeddedJSONAttachment)(a)\n\n\terr := json.Unmarshal(data, &raw)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif raw.Duration > 0 {\n\t\tnsec := int64(raw.Duration * float64(time.Second))\n\t\traw.EmbeddedJSONAttachment.Duration = time.Duration(nsec)\n\t}\n\n\treturn nil\n}", "func (i *Event) UnmarshalJSON(b []byte) error {\n\ttype Mask Event\n\n\tp := struct {\n\t\t*Mask\n\t\tCreated *parseabletime.ParseableTime `json:\"created\"`\n\t\tTimeRemaining json.RawMessage `json:\"time_remaining\"`\n\t}{\n\t\tMask: (*Mask)(i),\n\t}\n\n\tif err := json.Unmarshal(b, &p); err != nil {\n\t\treturn err\n\t}\n\n\ti.Created = (*time.Time)(p.Created)\n\ti.TimeRemaining = duration.UnmarshalTimeRemaining(p.TimeRemaining)\n\n\treturn nil\n}", "func UnmarshalDuration(s *jsonplugin.UnmarshalState) *durationpb.Duration {\n\tif s.ReadNil() {\n\t\treturn nil\n\t}\n\td := s.ReadDuration()\n\tif s.Err() != nil {\n\t\treturn nil\n\t}\n\treturn durationpb.New(*d)\n}", "func (f *Fade) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", f, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"duration\":\n\t\t\terr = unpopulate(val, \"Duration\", &f.Duration)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"fadeColor\":\n\t\t\terr = unpopulate(val, \"FadeColor\", &f.FadeColor)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"start\":\n\t\t\terr = unpopulate(val, \"Start\", &f.Start)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", f, err)\n\t\t}\n\t}\n\treturn nil\n}", "func (v *RxDelay) UnmarshalJSON(b []byte) error {\n\tif bt, ok := unmarshalJSONString(b); ok {\n\t\treturn v.UnmarshalText(bt)\n\t}\n\ti, err := unmarshalEnumFromNumber(\"RxDelay\", RxDelay_name, b)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*v = RxDelay(i)\n\treturn nil\n}", "func (m *Meter) UnmarshalJSON(b []byte) error {\n\tvar j string\n\terr := json.Unmarshal(b, &j)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Note that if the string cannot be found then it will be set to the zero value, 'Created' in this case.\n\t*m = toMeterID[j]\n\treturn nil\n}", "func (val *Time) UnmarshalJSON(data []byte) error {\n\tstr := string(data)\n\tidx := strings.IndexByte(str, '.')\n\tif idx == -1 {\n\t\tsec, err := strconv.ParseInt(str, 10, 64)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t*val = Time(sec * 1000000)\n\t\treturn nil\n\t}\n\tsec, err := strconv.ParseInt(str[:idx], 10, 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\tusec, err := strconv.ParseInt(str[idx+1:], 10, 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*val = Time(sec*1000000 + usec)\n\treturn nil\n}", "func (t *ResponseTime) UnmarshalJSON(b []byte) error {\n\t//Assume number\n\tepoch, err := strconv.Atoi(string(b))\n\tif err != nil {\n\t\t// Fallback to Error time parsing if parse failure.\n\t\tvar errTime errorTime\n\t\tif err := json.Unmarshal(b, &errTime); err != nil {\n\t\t\treturn err\n\t\t}\n\t\t*t = ResponseTime(errTime)\n\t\treturn nil\n\t}\n\t*t = ResponseTime(time.Unix(int64(epoch), 0))\n\treturn nil\n}", "func (t *Time) UnmarshalJSON(data []byte) error {\n\treturn t.UnmarshalText(data)\n}", "func (t *JSONTime) UnmarshalJSON(data []byte) error { \r\n// Ignore null, like in the main JSON package. \r\n\tif string(data) == \"null\" { \r\n\t\treturn nil \r\n\t} \r\n\t// Fractional seconds are handled implicitly by Parse. \r\n\tvar err error \r\n\t(*t).Time, err = time.ParseInLocation(`\"`+YYYYMMDDHHMISS+`\"`, string(data), time.Local) \r\n\treturn err \r\n}", "func (t *JSONTime) UnmarshalJSON(data []byte) error {\n\tvar s string\n\tif err := json.Unmarshal(data, &s); err != nil {\n\t\treturn err\n\t}\n\ttm, err := time.Parse(\"2006-01-02 15:04:05\", s)\n\tt.Time = tm\n\treturn err\n}", "func (t *Time) UnmarshalJSON(p []byte) (err error) {\n\tif bytes.Compare(p, null) == 0 {\n\t\tt.Time = time.Time{}\n\t\treturn nil\n\t}\n\tif err = t.Time.UnmarshalJSON(p); err == nil {\n\t\treturn nil\n\t}\n\tn, e := strconv.ParseInt(string(bytes.Trim(p, `\"`)), 10, 64)\n\tif e != nil {\n\t\treturn err\n\t}\n\tt.Time = time.Unix(n, 0)\n\treturn nil\n}", "func (tt *TimeWithSecond) UnmarshalJSON(data []byte) error {\n\tt, err := time.Parse(\"\\\"2006-01-02T15:04:05\\\"\", string(data))\n\t*tt = TimeWithSecond{&t}\n\treturn err\n}", "func (v *RxDelayValue) UnmarshalJSON(b []byte) error {\n\tvar vv RxDelay\n\tif err := vv.UnmarshalJSON(b); err != nil {\n\t\treturn err\n\t}\n\t*v = RxDelayValue{\n\t\tValue: vv,\n\t}\n\treturn nil\n}", "func (t *Time) UnmarshalJSON(data []byte) error {\n\tdecoded, err := NewTimeFromString(string(data[1 : len(data)-1]))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*t = decoded\n\treturn nil\n}", "func (v *Value)UnmarshalJSON(data []byte) error {\n\tvar raw []interface{}\n\terr := json.Unmarshal(data,&raw)\n\tif err != nil {\n\t\tlog.Errorln(\"Unmarshal error:\", err.Error())\n\t}\n\tfloatValue, ok:=raw[0].(float64)\n\tif !ok {\n\t\tlog.Errorln(\"Unmarshal error:\", err.Error())\n\t}\n\tstringValue,ok:=raw[1].(string)\n\tif !ok {\n\t\tlog.Errorln(\"Unmarshal error:\", err.Error())\n\t}\n\tv.time = floatValue\n\tv.value = stringValue\n\treturn nil\n}", "func (w *Window) UnmarshalJSONObject(dec *gojay.Decoder, k string) error {\n\n\tswitch k {\n\tcase \"duration\":\n\t\treturn dec.String(&w.Duration)\n\n\tcase \"start\":\n\t\treturn dec.Int64(&w.Start)\n\n\tcase \"end\":\n\t\treturn dec.Int64(&w.End)\n\n\t}\n\treturn nil\n}", "func (t *JSONTime) UnmarshalJSON(buf []byte) error {\n\ttt, err := time.Parse(\"2006-01-02 15:04\", strings.Trim(string(buf), `\"`))\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.Time = tt\n\treturn nil\n}", "func (td *jsonDuration) Duration() time.Duration {\r\n\treturn time.Duration(*td)\r\n}", "func (t *Time) UnmarshalJSON(b []byte) error {\n\tval, err := time.Parse(`\"2006-01-02T15:04:05\"`, string(b))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*t = Time(val)\n\n\treturn nil\n}", "func (ct *Time) UnmarshalJSON(b []byte) (err error) {\n\ts := strings.Trim(string(b), `\"`)\n\tnt, err := time.Parse(ctLayout, s)\n\t*ct = Time(nt)\n\treturn\n}", "func (m *SubMessage) UnmarshalJSONObject(dec *gojay.Decoder, k string) error {\n\n\tswitch k {\n\tcase \"Id\":\n\t\treturn dec.Int(&m.Id)\n\n\tcase \"Description\":\n\t\treturn dec.String(&m.Description)\n\n\tcase \"StartTime\":\n\t\tvar format = time.RFC3339\n\t\tvar value = time.Time{}\n\t\terr := dec.Time(&value, format)\n\t\tif err == nil {\n\t\t\tm.StartTime = value\n\t\t}\n\t\treturn err\n\n\tcase \"EndTime\":\n\t\tvar format = time.RFC3339\n\t\tvar value = &time.Time{}\n\t\terr := dec.Time(value, format)\n\t\tif err == nil {\n\t\t\tm.EndTime = value\n\t\t}\n\t\treturn err\n\n\t}\n\treturn nil\n}", "func (r *Measure) UnmarshalJSON(b []byte) error {\n\tvar measuresSlice []interface{}\n\terr := json.Unmarshal(b, &measuresSlice)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// We need to check that a measure contains all needed data.\n\tif len(measuresSlice) != 3 {\n\t\terrMsg := fmt.Sprintf(\"got an invalid measure: %v\", measuresSlice)\n\t\treturn fmt.Errorf(errMsg)\n\t}\n\n\ttype tmp Measure\n\tvar s struct {\n\t\ttmp\n\t}\n\t*r = Measure(s.tmp)\n\n\t// Populate a measure's timestamp.\n\tvar timeStamp string\n\tvar ok bool\n\tif timeStamp, ok = measuresSlice[0].(string); !ok {\n\t\terrMsg := fmt.Sprintf(\"got an invalid timestamp of a measure %v: %v\", measuresSlice, measuresSlice[0])\n\t\treturn fmt.Errorf(errMsg)\n\t}\n\tr.Timestamp, err = time.Parse(gnocchi.RFC3339NanoTimezone, timeStamp)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Populate a measure's granularity.\n\tif r.Granularity, ok = measuresSlice[1].(float64); !ok {\n\t\terrMsg := fmt.Sprintf(\"got an invalid granularity of a measure %v: %v\", measuresSlice, measuresSlice[1])\n\t\treturn fmt.Errorf(errMsg)\n\t}\n\n\t// Populate a measure's value.\n\tif r.Value = measuresSlice[2].(float64); !ok {\n\t\terrMsg := fmt.Sprintf(\"got an invalid value of a measure %v: %v\", measuresSlice, measuresSlice[2])\n\t\treturn fmt.Errorf(errMsg)\n\t}\n\n\treturn nil\n}", "func (t *Time) UnmarshalJSON(data []byte) error {\n\tval := string(data)\n\tif val == `\"\"` {\n\t\treturn nil\n\t}\n\tnow, err := time.ParseInLocation(`\"2006-01-02 15:04:05\"`, val, time.Local)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*t = Time(now)\n\treturn nil\n}", "func (d *DateTime) UnmarshalJSON(data []byte) (err error) {\n\treturn d.Time.UnmarshalJSON(data)\n}", "func (t *Time) UnmarshalJSON(data []byte) error {\n\tt.Present = true\n\n\tif bytes.Equal(data, null) {\n\t\treturn nil\n\t}\n\n\tif err := json.Unmarshal(data, &t.Value); err != nil {\n\t\treturn err\n\t}\n\n\tt.Valid = true\n\treturn nil\n}", "func (s *StreamingEntityScaleUnit) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", s, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"scaleUnit\":\n\t\t\terr = unpopulate(val, \"ScaleUnit\", &s.ScaleUnit)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", s, err)\n\t\t}\n\t}\n\treturn nil\n}", "func (b *LegendTime) UnmarshalJSON(src []byte) (err error) {\n\tstr := string(src[1 : len(src)-1])\n\n\tif str == \"ul\" {\n\t\treturn\n\t}\n\n\tb.Time, err = time.Parse(\"2006-01-02T15:04:05\", str)\n\n\tif err != nil {\n\t\t// Try again with another time format\n\t\tb.Time, err = time.Parse(\"Mon Jan _2\", str)\n\t}\n\treturn\n}", "func (c *JSONElement) AsDuration(def string) (value time.Duration) {\n\tif v, err := c.Json.String(); err == nil {\n\t\tif value, err := time.ParseDuration(v); err == nil {\n\t\t\treturn value\n\t\t}\n\t}\n\n\t// use the default - if it doesn't parse then return 0 duration\n\tvalue, err := time.ParseDuration(def)\n\tif err != nil {\n\t\tlog.Errorf(\"[Config] Failed to parse default duration value: %s\", def)\n\t}\n\n\treturn value\n}", "func (p *PresentationTimeRange) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"endTimestamp\":\n\t\t\terr = unpopulate(val, \"EndTimestamp\", &p.EndTimestamp)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"forceEndTimestamp\":\n\t\t\terr = unpopulate(val, \"ForceEndTimestamp\", &p.ForceEndTimestamp)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"liveBackoffDuration\":\n\t\t\terr = unpopulate(val, \"LiveBackoffDuration\", &p.LiveBackoffDuration)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"presentationWindowDuration\":\n\t\t\terr = unpopulate(val, \"PresentationWindowDuration\", &p.PresentationWindowDuration)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"startTimestamp\":\n\t\t\terr = unpopulate(val, \"StartTimestamp\", &p.StartTimestamp)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"timescale\":\n\t\t\terr = unpopulate(val, \"Timescale\", &p.Timescale)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", p, err)\n\t\t}\n\t}\n\treturn nil\n}", "func (t *Time) UnmarshalJSON(data []byte) error {\n\t// Fractional seconds are handled implicitly by Parse.\n\ttt, err := time.Parse(`\"`+time.RFC3339+`\"`, string(data))\n\tif _, ok := err.(*time.ParseError); ok {\n\t\ttt, err = time.Parse(`\"`+DeisDatetimeFormat+`\"`, string(data))\n\t\tif _, ok := err.(*time.ParseError); ok {\n\t\t\ttt, err = time.Parse(`\"`+PyOpenSSLTimeDateTimeFormat+`\"`, string(data))\n\t\t}\n\t}\n\t*t = Time{&tt}\n\treturn err\n}", "func (q *QueryTimePeriod) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"from\":\n\t\t\terr = unpopulateTimeRFC3339(val, &q.From)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"to\":\n\t\t\terr = unpopulateTimeRFC3339(val, &q.To)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (e *ExportTimePeriod) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"from\":\n\t\t\terr = unpopulateTimeRFC3339(val, &e.From)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"to\":\n\t\t\terr = unpopulateTimeRFC3339(val, &e.To)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (t *Time) UnmarshalJSON(b []byte) error {\n\t// TODO Set Location dynamically (get it from HW?)\n\tloc, err := time.LoadLocation(\"Local\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.Time, err = time.ParseInLocation(`\"2006-01-02 15:04\"`, string(b), loc)\n\treturn err\n}", "func (t *Time) UnmarshalJSON(data []byte) error {\n\tvar ts time.Time\n\tif err := ts.UnmarshalJSON(data); err != nil {\n\t\treturn err\n\t}\n\n\tt.Time = ts\n\treturn nil\n}", "func (d *Timestamp) UnmarshalJSON(b []byte) error {\n\tts, err := strconv.ParseInt(string(b), 10, 64)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\td.Time = time.Unix(ts/1000, (ts%1000)*1000000)\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Cannot unmarshal Timestamp value: %v\", err)\n\t}\n\n\treturn nil\n}", "func (v *TimeEntryActivity) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson44273644DecodeGithubComSomniSomGoRedmine1(&r, v)\n\treturn r.Error()\n}", "func (v *Timestamp) UnmarshalJSON(data []byte) error {\n\tif len(data) == 0 {\n\t\treturn nil\n\t}\n\tvar in interface{}\n\tif err := json.Unmarshal(data, &in); err != nil {\n\t\treturn err\n\t}\n\treturn v.Scan(in)\n}", "func (t *JSONTime) UnmarshalJSON(b []byte) error {\n\n\ts := strings.Trim(string(b), \"`'\\\" \")\n\n\tvar timeVal = time.Time{}\n\tvar err error\n\tif s != \"\" && s != \"null\" {\n\t\ttimeVal, err = time.Parse(time.RFC3339Nano, s)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t*t = JSONTime(timeVal)\n\treturn nil\n}", "func (t *Time) UnmarshalJSON(b []byte) error {\n\n\tif ekaenc.IsNullJSON(b) {\n\t\tif t != nil {\n\t\t\t*t = 0\n\t\t}\n\t\treturn nil\n\t}\n\n\tswitch l := len(b); {\n\n\tcase !(l >= 6 && l <= 8) && l != 10:\n\t\t// The length must be:\n\t\t// - 6: \"hhmm\",\n\t\t// - 7: \"hh:mm\",\n\t\t// - 8: \"hhmmss\"\n\t\t// - 10: \"hh:mm:ss\"\n\t\treturn _ERR_NOT_ISO8601_TIME\n\n\tcase b[0] != '\"' || b[l-1] != '\"':\n\t\t// Forgotten quotes? Incorrect JSON?\n\t\treturn _ERR_BAD_JSON_TIME_QUO\n\n\tdefault:\n\t\treturn t.ParseFrom(b[1:l-1])\n\t}\n}", "func (t *Unix) UnmarshalJSON(in []byte) (err error) {\n\tsecs, err := strconv.ParseInt(string(in), 10, 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*t = Unix(time.Unix(secs, 0))\n\treturn nil\n}", "func (tt *EventTime) UnmarshalJSON(data []byte) error {\n\tt, err := time.Parse(\"\\\"2006-01-02T15:04:05.9Z\\\"\", string(data))\n\t*tt = EventTime{&t}\n\treturn err\n}", "func (t *Timestamp) UnmarshalJSON(payload []byte) (err error) {\n\t// First get rid of the surrounding double quotes\n\tunquoted := strings.Replace(string(payload), `\"`, ``, -1)\n\tvalue, err := strconv.ParseInt(unquoted, 10, 64)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Per Node.js epochs, value will be in milliseconds\n\t*t = TimestampFromJSEpoch(value)\n\treturn\n}", "func (c *Counter) UnmarshalJSON(b []byte) error {\n\tvar val int64\n\tif err := json.Unmarshal(b, &val); err != nil {\n\t\treturn err\n\t}\n\tc.value = val\n\treturn nil\n}", "func (dt *DateTime) UnmarshalJSON(data []byte) error {\n\treturn dt.src.UnmarshalJSON(data)\n}", "func (t *Timeframe) FromJSON(b []byte) error {\n\tvar res Timeframe\n\tif err := json.Unmarshal(b, &res); err != nil {\n\t\treturn err\n\t}\n\t*t = res\n\treturn nil\n}", "func (ri *RepeatingInterval) UnmarshalJSON(data []byte) error {\n\tvar s string\n\tif err := json.Unmarshal(data, &s); err != nil {\n\t\treturn err\n\t}\n\tparsed, err := ParseRepeatingInterval(s)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*ri = parsed\n\treturn nil\n}", "func (t *timestamp) UnmarshalJSON(b []byte) error {\n\tts, err := strconv.Atoi(string(b))\n\tif err != nil {\n\t\treturn err\n\t}\n\t*t = timestamp(time.Unix(int64(ts), 0))\n\treturn nil\n}", "func (nt *Time) UnmarshalJSON(data []byte) error {\n\tvar t time.Time\n\tif data != nil {\n\t\tif err := json.Unmarshal(data, &t); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tnt.Time = t\n\treturn nil\n}", "func (v *Clock) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson3e8ab7adDecodeGithubComAlpacahqAlpacaTradeApiGoV3Alpaca16(&r, v)\n\treturn r.Error()\n}", "func (t *Time) UnmarshalJSON(b []byte) (err error) {\n\ts := strings.Trim(string(b), \"\\\"\")\n\tif s == \"null\" {\n\t\tt.Time = time.Time{}\n\t\treturn\n\t}\n\tif strings.HasSuffix(s, \"Z\") {\n\t\ts = s[:len(s)-1]\n\t}\n\n\tt.Time, err = time.Parse(dateFormat, s)\n\treturn\n}", "func (t *Time) UnmarshalJSON(data []byte) (err error) {\n\tif data[0] != []byte(`\"`)[0] || data[len(data)-1] != []byte(`\"`)[0] {\n\t\treturn errors.New(\"Not quoted\")\n\t}\n\t*t, err = ParseTime(string(data[1 : len(data)-1]))\n\treturn\n}", "func (v *WidgetLiveSpan) UnmarshalJSON(src []byte) error {\n\tvar value string\n\terr := json.Unmarshal(src, &value)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*v = WidgetLiveSpan(value)\n\treturn nil\n}", "func (tt *TickerTime) UnmarshalJSON(data []byte) error {\n\tt, err := time.Parse(\"2006-01-02T15:04:05.9\", string(data))\n\t*tt = TickerTime{&t}\n\treturn err\n}", "func (v *Metric) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjsonC5a4559bDecodeGithubComChromedpCdprotoPerformance(&r, v)\n\treturn r.Error()\n}", "func TestDuration_MarshalUnmarshal(t *testing.T) {\n\ttestCases := []struct {\n\t\tjson string\n\t\ttd time.Duration\n\t\tunmarshalErr error\n\t\tnoMarshal bool\n\t}{\n\t\t// Basic values.\n\t\t{json: `\"1s\"`, td: time.Second},\n\t\t{json: `\"-100.700s\"`, td: -100*time.Second - 700*time.Millisecond},\n\t\t{json: `\".050s\"`, td: 50 * time.Millisecond, noMarshal: true},\n\t\t{json: `\"-.001s\"`, td: -1 * time.Millisecond, noMarshal: true},\n\t\t{json: `\"-0.200s\"`, td: -200 * time.Millisecond},\n\t\t// Positive near / out of bounds.\n\t\t{json: `\"9223372036s\"`, td: 9223372036 * time.Second},\n\t\t{json: `\"9223372037s\"`, td: math.MaxInt64, noMarshal: true},\n\t\t{json: `\"9223372036.854775807s\"`, td: math.MaxInt64},\n\t\t{json: `\"9223372036.854775808s\"`, td: math.MaxInt64, noMarshal: true},\n\t\t{json: `\"315576000000s\"`, td: math.MaxInt64, noMarshal: true},\n\t\t{json: `\"315576000001s\"`, unmarshalErr: fmt.Errorf(\"out of range\")},\n\t\t// Negative near / out of bounds.\n\t\t{json: `\"-9223372036s\"`, td: -9223372036 * time.Second},\n\t\t{json: `\"-9223372037s\"`, td: math.MinInt64, noMarshal: true},\n\t\t{json: `\"-9223372036.854775808s\"`, td: math.MinInt64},\n\t\t{json: `\"-9223372036.854775809s\"`, td: math.MinInt64, noMarshal: true},\n\t\t{json: `\"-315576000000s\"`, td: math.MinInt64, noMarshal: true},\n\t\t{json: `\"-315576000001s\"`, unmarshalErr: fmt.Errorf(\"out of range\")},\n\t\t// Parse errors.\n\t\t{json: `123s`, unmarshalErr: fmt.Errorf(\"invalid character\")},\n\t\t{json: `\"5m\"`, unmarshalErr: fmt.Errorf(\"malformed duration\")},\n\t\t{json: `\"5.3.2s\"`, unmarshalErr: fmt.Errorf(\"malformed duration\")},\n\t\t{json: `\"x.3s\"`, unmarshalErr: fmt.Errorf(\"malformed duration\")},\n\t\t{json: `\"3.xs\"`, unmarshalErr: fmt.Errorf(\"malformed duration\")},\n\t\t{json: `\"3.1234567890s\"`, unmarshalErr: fmt.Errorf(\"malformed duration\")},\n\t\t{json: `\".s\"`, unmarshalErr: fmt.Errorf(\"malformed duration\")},\n\t\t{json: `\"s\"`, unmarshalErr: fmt.Errorf(\"malformed duration\")},\n\t}\n\tfor _, tc := range testCases {\n\t\t// Seed `got` with a random value to ensure we properly reset it in all\n\t\t// non-error cases.\n\t\tgot := Duration(grpcrand.Uint64())\n\t\terr := got.UnmarshalJSON([]byte(tc.json))\n\t\tif (err == nil && time.Duration(got) != tc.td) ||\n\t\t\t(err != nil) != (tc.unmarshalErr != nil) || !strings.Contains(fmt.Sprint(err), fmt.Sprint(tc.unmarshalErr)) {\n\t\t\tt.Errorf(\"UnmarshalJSON of %v = %v, %v; want %v, %v\", tc.json, time.Duration(got), err, tc.td, tc.unmarshalErr)\n\t\t}\n\n\t\tif tc.unmarshalErr == nil && !tc.noMarshal {\n\t\t\td := Duration(tc.td)\n\t\t\tgot, err := d.MarshalJSON()\n\t\t\tif string(got) != tc.json || err != nil {\n\t\t\t\tt.Errorf(\"MarshalJSON of %v = %v, %v; want %v, nil\", d, string(got), err, tc.json)\n\t\t\t}\n\t\t}\n\t}\n}", "func (t *Time) UnmarshalJSON(data []byte) error {\n\tif data == nil {\n\t\treturn nil\n\t}\n\tstr := string(data)\n\tif len(strings.Trim(str, \" \")) == 0 {\n\t\treturn nil\n\t}\n\tstr = strings.Trim(str, \" \\\"\")\n\ttime, err := time.Parse(\"02-01-2006\", str)\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.Time = time\n\treturn nil\n}", "func (v *PointInTime) UnmarshalJSON(data []byte) error {\n\tr := jlexer.Lexer{Data: data}\n\teasyjson390b7126DecodeGithubComChancedPicker51(&r, v)\n\treturn r.Error()\n}", "func (u *UTCClipTime) 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\", u, err)\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"@odata.type\":\n\t\t\terr = unpopulate(val, \"ODataType\", &u.ODataType)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"time\":\n\t\t\terr = unpopulateTimeRFC3339(val, \"Time\", &u.Time)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unmarshalling type %T: %v\", u, err)\n\t\t}\n\t}\n\treturn nil\n}", "func (v *Value) UnmarshalJSON(data []byte) error {\n\tvar i interface{}\n\tif err := json.Unmarshal(data, &i); err != nil {\n\t\treturn err\n\t}\n\n\t// JSON encodes numbers as floats\n\tf, ok := i.(float64)\n\tif ok && intRe.Match(data) {\n\t\ti = int64(f)\n\t}\n\n\t// TODO: Time\n\treturn v.SetValue(i)\n}", "func (t *SessionTime) UnmarshalJSON(data []byte) error {\n\t// Fractional seconds are handled implicitly by Parse\n\tval, err := time.Parse(sessionFmt, string(data))\n\t*t = SessionTime(val)\n\treturn err\n}", "func (mp *MealPlan) UnmarshalJSON(text []byte) (err error) {\n\tvar mpj mealPlanJSON\n\terr = json.Unmarshal(text, &mpj)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmp.ID = mpj.ID\n\tmp.Notes = mpj.Notes\n\n\tmp.StartDate, err = time.Parse(JSONDateFormat, mpj.StartDate)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmp.EndDate, err = time.Parse(JSONDateFormat, mpj.EndDate)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (v *WidgetEventSize) UnmarshalJSON(src []byte) error {\n\tvar value string\n\terr := json.Unmarshal(src, &value)\n\tif err != nil {\n\t\treturn err\n\t}\n\t*v = WidgetEventSize(value)\n\treturn nil\n}", "func (s *Sampling) UnmarshalJSON(raw []byte) error {\n\tvar obj interface{}\n\tif err := json.Unmarshal(raw, &obj); err != nil {\n\t\treturn instrumentationError(\"failed to unmarshal Sampling value: %v\", err)\n\t}\n\tswitch v := obj.(type) {\n\tcase string:\n\t\tif err := s.Parse(v); err != nil {\n\t\t\treturn err\n\t\t}\n\tcase float64:\n\t\t*s = Sampling(v)\n\tdefault:\n\t\treturn instrumentationError(\"invalid Sampling value of type %T: %v\", obj, obj)\n\t}\n\treturn nil\n}", "func (o *OwnerWrapper) UnmarshalJSON(data []byte) error {\n\ttype Alias OwnerWrapper\n\taux := &struct {\n\t\tT string\n\t\t*Alias\n\t}{\n\t\tAlias: (*Alias)(o),\n\t}\n\tif err := json.Unmarshal(data, &aux); err != nil {\n\t\treturn err\n\t}\n\tif d, err := time.ParseDuration(aux.T); err != nil {\n\t\treturn err\n\t} else {\n\t\to.T = d\n\t}\n\treturn nil\n}", "func (d *Distance) UnmarshalJSON(buf []byte) (err error) {\n\tvar match []string\n\tvar str string\n\tvar val float64\n\n\tstr = string(buf)[1 : len(buf)-1]\n\tmatch = reDistance.FindStringSubmatch(str)\n\tif match != nil {\n\t\tval, err = strconv.ParseFloat(match[1], 64)\n\t\tif err == nil {\n\t\t\t// Default is inches; regular expression catches any spurious units\n\t\t\tswitch match[2] {\n\t\t\tcase \"m\":\n\t\t\t\tval *= 39.3701\n\t\t\tcase \"mm\":\n\t\t\t\tval *= 0.0393701\n\t\t\tcase \"cm\":\n\t\t\t\tval *= 0.393701\n\t\t\tcase \"ft\", \"foot\", \"'\":\n\t\t\t\tval *= 12\n\t\t\t}\n\t\t}\n\t} else {\n\t\terr = errf(\"unrecognized distance \\\"%s\\\"\", str)\n\t}\n\tif err == nil {\n\t\t*d = Distance(val)\n\t}\n\treturn\n}", "func (s *Serving) UnmarshalJSON(text []byte) (err error) {\n\tvar sj servingJSON\n\terr = json.Unmarshal(text, &sj)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ts.MealPlanID = sj.MealPlanID\n\ts.MealID = sj.MealID\n\n\ts.Date, err = time.Parse(JSONDateFormat, sj.Date)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func DeserializeDuration(this interface{}) (time.Duration, error) {\n\t// Maybe this time it will be easier.\n\tif s, ok := this.(string); ok {\n\t\tisNeg := false\n\t\tif s[0] == '-' {\n\t\t\tisNeg = true\n\t\t\ts = s[1:]\n\t\t}\n\t\tif s[0] != 'P' {\n\t\t\treturn 0, fmt.Errorf(\"%s malformed: missing 'P' for xsd:duration\", s)\n\t\t}\n\t\tre := regexp.MustCompile(`P(\\d*Y)?(\\d*M)?(\\d*D)?(T(\\d*H)?(\\d*M)?(\\d*S)?)?`)\n\t\tres := re.FindStringSubmatch(s)\n\t\tvar dur time.Duration\n\t\tnYear := res[1]\n\t\tif len(nYear) > 0 {\n\t\t\tnYear = nYear[:len(nYear)-1]\n\t\t\tvYear, err := strconv.ParseInt(nYear, 10, 64)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t\t// Assume 8760 Hours per 365 days, cannot account for leap years in xsd:duration. :(\n\t\t\tdur += time.Duration(vYear) * time.Hour * 8760\n\t\t}\n\t\tnMonth := res[2]\n\t\tif len(nMonth) > 0 {\n\t\t\tnMonth = nMonth[:len(nMonth)-1]\n\t\t\tvMonth, err := strconv.ParseInt(nMonth, 10, 64)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t\t// Assume 30 days per month, cannot account for months lasting 31, 30, 29, or 28 days in xsd:duration. :(\n\t\t\tdur += time.Duration(vMonth) * time.Hour * 720\n\t\t}\n\t\tnDay := res[3]\n\t\tif len(nDay) > 0 {\n\t\t\tnDay = nDay[:len(nDay)-1]\n\t\t\tvDay, err := strconv.ParseInt(nDay, 10, 64)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t\tdur += time.Duration(vDay) * time.Hour * 24\n\t\t}\n\t\tnHour := res[5]\n\t\tif len(nHour) > 0 {\n\t\t\tnHour = nHour[:len(nHour)-1]\n\t\t\tvHour, err := strconv.ParseInt(nHour, 10, 64)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t\tdur += time.Duration(vHour) * time.Hour\n\t\t}\n\t\tnMinute := res[6]\n\t\tif len(nMinute) > 0 {\n\t\t\tnMinute = nMinute[:len(nMinute)-1]\n\t\t\tvMinute, err := strconv.ParseInt(nMinute, 10, 64)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t\tdur += time.Duration(vMinute) * time.Minute\n\t\t}\n\t\tnSecond := res[7]\n\t\tif len(nSecond) > 0 {\n\t\t\tnSecond = nSecond[:len(nSecond)-1]\n\t\t\tvSecond, err := strconv.ParseInt(nSecond, 10, 64)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t\tdur += time.Duration(vSecond) * time.Second\n\t\t}\n\t\tif isNeg {\n\t\t\tdur *= -1\n\t\t}\n\t\treturn dur, nil\n\t} else {\n\t\treturn 0, fmt.Errorf(\"%v cannot be interpreted as a string for xsd:duration\", this)\n\t}\n}", "func (d *Duration) UnmarshalText(text []byte) error {\n\ttmp, err := time.ParseDuration(string(text))\n\tif err == nil {\n\t\t*d = Duration(tmp)\n\t}\n\treturn err\n}", "func (t *NumericDate) UnmarshalJSON(data []byte) error {\n\tvar value json.Number\n\tif err := json.Unmarshal(data, &value); err != nil {\n\t\treturn err\n\t}\n\tf, err := value.Float64()\n\tif err != nil {\n\t\treturn err\n\t}\n\tsec, dec := math.Modf(f)\n\tts := time.Unix(int64(sec), int64(dec*1e9))\n\t*t = NumericDate{ts}\n\treturn nil\n}", "func (t *CodeBuildTime) UnmarshalJSON(data []byte) error {\n\tvar s string\n\tif err := json.Unmarshal(data, &s); err != nil {\n\t\treturn err\n\t}\n\n\tts, err := time.Parse(codeBuildTimeFormat, s)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*t = CodeBuildTime(ts)\n\treturn nil\n}", "func (e *ExportRecurrencePeriod) UnmarshalJSON(data []byte) error {\n\tvar rawMsg map[string]json.RawMessage\n\tif err := json.Unmarshal(data, &rawMsg); err != nil {\n\t\treturn err\n\t}\n\tfor key, val := range rawMsg {\n\t\tvar err error\n\t\tswitch key {\n\t\tcase \"from\":\n\t\t\terr = unpopulateTimeRFC3339(val, &e.From)\n\t\t\tdelete(rawMsg, key)\n\t\tcase \"to\":\n\t\t\terr = unpopulateTimeRFC3339(val, &e.To)\n\t\t\tdelete(rawMsg, key)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (c *Cycle) UnmarshalJSON(b []byte) error {\n\tvar s string\n\tif err := json.Unmarshal(b, &s); err != nil {\n\t\treturn err\n\t}\n\n\ttmp, _ := ParseCycle(s)\n\n\t*c = tmp\n\n\treturn nil\n}", "func (t *Timestamp) UnmarshalJSON(b []byte) error {\n\n\t// CoinCap timestamp is unix milliseconds\n\tm, err := strconv.ParseInt(string(b), 10, 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Convert from milliseconds to nanoseconds\n\tt.Time = time.Unix(0, m*1e6)\n\treturn nil\n}", "func (tt *Time) UnmarshalJSON(input []byte) error {\n\tloc, err := time.LoadLocation(\"Europe/Amsterdam\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t// don't parse on empty dates\n\tif string(input) == `\"\"` {\n\t\treturn nil\n\t}\n\tnewTime, err := time.ParseInLocation(`\"2006-01-02 15:04:05\"`, string(input), loc)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttt.Time = newTime\n\treturn nil\n}", "func (t *Timestamp) UnmarshalJSON(b []byte) error {\n\tts, err := strconv.Atoi(string(b))\n\tif err != nil {\n\t\treturn err\n\t}\n\t*t = Timestamp(time.Unix(int64(ts), 0))\n\treturn nil\n}" ]
[ "0.81817263", "0.81407964", "0.8027016", "0.8015166", "0.7967937", "0.7960933", "0.7949784", "0.79346853", "0.7913854", "0.7855133", "0.7828767", "0.7802894", "0.77814907", "0.7734756", "0.72648734", "0.7244558", "0.70034724", "0.66487646", "0.6577933", "0.65745497", "0.652159", "0.6458577", "0.6449357", "0.6445572", "0.64447975", "0.6367157", "0.63272274", "0.62948644", "0.6271551", "0.6265017", "0.6250085", "0.62469196", "0.62226945", "0.6215216", "0.6158025", "0.6131663", "0.6081404", "0.604747", "0.60355085", "0.6031916", "0.60280985", "0.601679", "0.60134417", "0.59997773", "0.5959397", "0.5942113", "0.59383386", "0.5924517", "0.58991635", "0.5878975", "0.58686596", "0.58569956", "0.58395785", "0.5826508", "0.5818012", "0.5813184", "0.5811627", "0.58078235", "0.58031774", "0.5796641", "0.57953656", "0.57947093", "0.57810557", "0.5771015", "0.5760926", "0.5751692", "0.5750075", "0.5745509", "0.5743456", "0.5740103", "0.57311845", "0.5718514", "0.5715899", "0.5711602", "0.57086027", "0.5708349", "0.5688852", "0.5685407", "0.5685203", "0.5682145", "0.5680656", "0.5677786", "0.56553364", "0.56506157", "0.56442475", "0.564324", "0.5641436", "0.5636263", "0.56328124", "0.5632455", "0.5630109", "0.5618516", "0.5618319", "0.5617059", "0.5596291", "0.5594017", "0.5592376", "0.5583867", "0.5583011", "0.55816007" ]
0.8108312
2
Open is a shortcut to open a file, read it, and generate a Config. It supports relative and absolute paths. Given "", it returns DefaultConfig.
func Open(path string) (*Config, error) { if path == "" { return &DefaultConfig, nil } f, err := os.Open(os.ExpandEnv(path)) if err != nil { return nil, err } defer f.Close() conf, err := Decode(f) if err != nil { return nil, err } return conf, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Open(rootDir string) (*Config, error) {\n\tf := functionOpen\n\n\tconfigFileName := filepath.Join(rootDir, \"config\", \"config.json\")\n\n\tbytearray, err := ioutil.ReadFile(configFileName)\n\tif err != nil {\n\t\tf.Dump(\"could not read config file\")\n\t\treturn nil, err\n\t}\n\n\tvar configFile ConfigFile\n\terr = json.Unmarshal(bytearray, &configFile)\n\tif err != nil {\n\t\tf.Dump(\"could not Unmarshal configuration\")\n\t\treturn nil, err\n\t}\n\n\treturn configFile.toConfig()\n}", "func (c *ConfigComponent) Open(_ *config.Config) error {\n\tconfigFilename, err := config.Filename(c.path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tconf, err := serialize.Load(configFilename)\n\tif err != nil {\n\t\treturn err\n\t}\n\tc.config = conf\n\treturn nil\n}", "func openConfig() Config {\n\n\tconf := config.NewConfig()\n\t// Load json config file\n\tconf.Load(file.NewSource(file.WithPath(\"config.json\")))\n\n\t//Create a new Config instanace\n\tsettings := Config{}\n\n\t//Load settings into struct\n\tconf.Scan(&settings)\n\treturn settings\n\n}", "func OpenConfig() *Config {\n\tvar config = NewConfig()\n\tvar configPath, _ = config.getStringFromEnv(ConfigPath)\n\tbytes, err := ioutil.ReadFile(configPath)\n\tif err != nil {\n\t\treturn config\n\t}\n\tvar values = map[string]string{}\n\tif err := json.Unmarshal(bytes, &values); err != nil {\n\t\treturn nil\n\t}\n\tconfig.values = values\n\tconfig.Decorator = initDecorator(config)\n\treturn config\n}", "func (cf *ConfigFile) Open() (io.Reader, error) {\n\t_, err := os.Stat(cf.location)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn os.Open(cf.location)\n}", "func (c *Conf) Open(name string) (http.File, error) {\n\tif filepath.Separator != '/' && strings.IndexRune(name, filepath.Separator) >= 0 {\n\t\treturn nil, errors.New(\"http: invalid character in file path\")\n\t}\n\tdir := c.Static\n\tif dir == \"\" {\n\t\tdir = \".\"\n\t}\n\tf, err := os.Open(filepath.Join(dir, filepath.FromSlash(path.Clean(\"/\"+name))))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn f, nil\n}", "func Open(c *cli.Context) error {\n\tcfg, err := config.Get()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdir, err := cfg.AbsoluteTasksPath()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcmd.Open(dir, \"default\")\n\treturn nil\n}", "func openConfigFile(configFilePath string) {\n\tjsonFile, e := os.Open(configFilePath)\n\tif e != nil {\n\t\tif configJSON.Verbose > 0 {\n\t\t\tlog.Printf(\"Config File not found at %s, error: %s\\n\", configFilePath, e)\n\t\t} else {\n\t\t\tfmt.Printf(\"Config File Missing at %s. Using Defaults\\n\", configFilePath)\n\t\t}\n\t\treturn\n\t}\n\tdefer jsonFile.Close()\n\tdecoder := json.NewDecoder(jsonFile)\n\terr := decoder.Decode(&configJSON)\n\tif err != nil {\n\t\tlog.Printf(\"Config JSON File can't be loaded, error: %s\", err)\n\t\treturn\n\t} else if configJSON.Verbose > 0 {\n\t\tlog.Printf(\"Load config from %s\\n\", configFilePath)\n\t}\n}", "func (c *Config) OpenFile() (io.ReadWriteCloser, error) {\n\tconfigFile, err := os.Open(c.Filepath)\n\tif err != nil {\n\t\tmsg := fmt.Sprintf(\"Cannot open config file [%s]\", c.Filepath)\n\t\treturn nil, errors.Wrap(err, msg)\n\t}\n\treturn configFile, nil\n}", "func (m *Meta) Config() (*os.File, error) {\n\tif !fs.IsFile(m.configName()) {\n\t\treturn nil, nil\n\t}\n\n\treturn os.Open(m.configName())\n}", "func (r *AferoRepo) openConfig() error {\n\tconfigFilename, err := config.Filename(r.path)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"get config filename\")\n\t}\n\tconf, err := Load(r.fs, configFilename)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"load config\")\n\t}\n\tr.config = conf\n\treturn nil\n}", "func (m *InMemoryConfigWriter) Open(name string) (fs.File, error) {\n\treturn nil, trace.NotImplemented(\"Open is not implemented for InMemoryConfigWriter\")\n}", "func Load(filename string) (*Configfile, error) {\n\tb, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tabs, err := filepath.Abs(filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcfg, err := Parse(b)\n\tif err != nil {\n\t\treturn cfg, err\n\t}\n\tcfg.filename = abs\n\tif cfg.Repos.Dir == \"\" {\n\t\tcfg.Repos.Dir = filepath.Join(filepath.Dir(abs), \"cache\")\n\t}\n\n\tif cfg.Workspace == nil {\n\t\tcfg.Workspace = &Workspace{}\n\t}\n\n\tif cfg.Workspace.Dir == \"\" {\n\t\tcfg.Workspace.Dir = filepath.Join(filepath.Dir(abs), \"workspace\")\n\t}\n\n\treturn cfg, nil\n}", "func OpenFile(filename string) ([]byte, error) {\n\tdata, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable read configuration file\")\n\t}\n\treturn data, nil\n}", "func OpenConfigFile(configFile string) (io.ReadCloser, error) {\n\tglog.V(1).Infof(\"Reading configuration file %q\", configFile)\n\n\tcf, err := os.Open(configFile)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to open config file %q: %v\", configFile, err)\n\t}\n\treturn cf, nil\n}", "func ReadFromFile() (*Config, error) {\n\t// usr, err := user.Current()\n\t// if err != nil {\n\t// \tlog.Fatal(err)\n\t// }\n\n\t// configPath := path.Join(usr.HomeDir, `.matic-jagar/config/`)\n\t// log.Printf(\"Config Path : %s\", configPath)\n\n\tv := viper.New()\n\tv.AddConfigPath(\".\")\n\t// v.AddConfigPath(configPath)\n\tv.SetConfigName(\"config\")\n\tif err := v.ReadInConfig(); err != nil {\n\t\tlog.Fatalf(\"error while reading config.toml: %v\", err)\n\t}\n\n\tvar cfg Config\n\tif err := v.Unmarshal(&cfg); err != nil {\n\t\tlog.Fatalf(\"error unmarshaling config.toml to application config: %v\", err)\n\t}\n\n\tif err := cfg.Validate(); err != nil {\n\t\tlog.Fatalf(\"error occurred in config validation: %v\", err)\n\t}\n\n\treturn &cfg, nil\n}", "func OpenFile(path string) (*Environment, error) {\n\tif _, err := os.Stat(path); os.IsNotExist(err) {\n\t\treturn nil, fmt.Errorf(\"Unable to find file [%s]\", path)\n\t}\n\n\tvar e Environment\n\n\tyamlFile, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error: %v\", err)\n\t}\n\n\terr = yaml.Unmarshal(yamlFile, &e)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error: %v\", err)\n\t}\n\n\treturn &e, nil\n}", "func Get(path ...string) reader.Value {\n\treturn DefaultConfig.Get(normalizePath(path...)...)\n}", "func Load(location string) (conf Config, err error) {\n\tvar reader io.Reader\n\n\t// check for http prefix\n\tif strings.HasPrefix(location, \"http\") {\n\t\tlog.Infof(\"loading remote config (%v)\", location)\n\n\t\t// setup http client with a timeout\n\t\tvar httpClient = &http.Client{\n\t\t\tTimeout: time.Second * 10,\n\t\t}\n\n\t\t// make the http request\n\t\tres, err := httpClient.Get(location)\n\t\tif err != nil {\n\t\t\treturn conf, fmt.Errorf(\"error fetching remote config file (%v): %v \", location, err)\n\t\t}\n\n\t\t// set the reader to the response body\n\t\treader = res.Body\n\t} else if location == \"-\" {\n\t\tlog.Infof(\"loading local config from stdin\")\n\t\treader = os.Stdin\n\t} else {\n\t\tlog.Infof(\"loading local config (%v)\", location)\n\n\t\t// check the conf file exists\n\t\tif _, err := os.Stat(location); os.IsNotExist(err) {\n\t\t\treturn conf, fmt.Errorf(\"config file at location (%v) not found\", location)\n\t\t}\n\t\t// open the config file\n\t\treader, err = os.Open(location)\n\t\tif err != nil {\n\t\t\treturn conf, fmt.Errorf(\"error opening local config file (%v): %v \", location, err)\n\t\t}\n\t}\n\n\treturn Parse(reader, location)\n}", "func Load() error {\n\tif configPathRaw == \"\" {\n\t\treturn errors.New(\"No configuration file path defined! See '-h'!\")\n\t}\n\n\tlog.Println(\"Loading configuration from file:\", configPathRaw)\n\n\t// Replace home directory if \"~\" was specified.\n\tif strings.Contains(configPathRaw, \"~\") {\n\t\tu, err := user.Current()\n\t\tif err != nil {\n\t\t\t// Well, I don't know how to test this.\n\t\t\treturn errors.New(\"Failed to get current user's data: \" + err.Error())\n\t\t}\n\n\t\tconfigPathRaw = strings.Replace(configPathRaw, \"~\", u.HomeDir, 1)\n\t}\n\n\t// Get absolute path to configuration file.\n\tconfigPath, err := filepath.Abs(configPathRaw)\n\tif err != nil {\n\t\t// Can't think of situation when it's testable.\n\t\treturn errors.New(\"Failed to get real configuration file path:\" + err.Error())\n\t}\n\n\t// Read it.\n\tconfigFileData, err := ioutil.ReadFile(configPath)\n\tif err != nil {\n\t\treturn errors.New(\"Failed to load configuration file data:\" + err.Error())\n\t}\n\n\t// Parse it.\n\terr1 := yaml.Unmarshal(configFileData, Cfg)\n\tif err1 != nil {\n\t\treturn errors.New(\"Failed to parse configuration file:\" + err1.Error())\n\t}\n\n\tlog.Printf(\"Configuration file parsed: %+v\\n\", Cfg)\n\treturn nil\n}", "func Load(file string) error {\n\n\tif file == \"\" {\n\t\tlog.Warn(\"Using default config\")\n\t\treturn nil\n\t}\n\n\tabsFile, _ := filepath.Abs(file)\n\t_, err := os.Stat(absFile)\n\tfileNotExists := os.IsNotExist(err)\n\n\tif fileNotExists {\n\t\treturn errors.New(\"Error reading configuration. File \" + file + \" does not exist.\")\n\t}\n\n\tlog.Printf(\"Configuration file: %s\", absFile)\n\n\t// read file into env values\n\terr = godotenv.Load(absFile)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func New(configPathRel string) *Config {\n\tdir, err := os.Getwd()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tc := &Config{}\n\tc.workinkDir = dir\n\n\tconfigPathAbs := path.Join(dir, configPathRel)\n\n\tfile, err := ioutil.ReadFile(configPathAbs)\n\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"Config not found in path: %s\", configPathAbs))\n\t}\n\n\te := json.Unmarshal(file, c)\n\n\tif e != nil {\n\t\tpanic(fmt.Errorf(\"Cannot read config: %s\", err))\n\t}\n\n\treturn c\n}", "func Load() (cfg *Config, err error) {\n\tfile, err := Location()\n\tif err != nil {\n\t\treturn\n\t}\n\t_, err = os.Stat(file)\n\tif os.IsNotExist(err) {\n\t\tcfg = &Config{}\n\t\terr = nil\n\t\treturn\n\t}\n\tif err != nil {\n\t\terr = fmt.Errorf(\"can't check if config file '%s' exists: %v\", file, err)\n\t\treturn\n\t}\n\t// #nosec G304\n\tdata, err := os.ReadFile(file)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"can't read config file '%s': %v\", file, err)\n\t\treturn\n\t}\n\tcfg = &Config{}\n\tif len(data) == 0 {\n\t\treturn\n\t}\n\terr = json.Unmarshal(data, cfg)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"can't parse config file '%s': %v\", file, err)\n\t\treturn\n\t}\n\treturn\n}", "func Load(path string) (*File, error) {\n\tcfg, err := goconfig.LoadConfigFile(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tf := new(File)\n\tf.configFile = cfg\n\n\treturn f, nil\n}", "func Open(path string) (file *File, err error) {\n\tf, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfile, err = New(f)\n\tif err != nil {\n\t\tf.Close()\n\t\treturn nil, err\n\t}\n\tfile.Closer = f\n\treturn file, nil\n}", "func (fs defaultFS) Open(name string) (File, error) { return os.Open(name) }", "func (c *Config) Open() (connector.Connector, error) {\n\tif c.Host == \"\" {\n\t\treturn nil, errors.New(\"missing host parameter\")\n\t}\n\tif c.BindDN == \"\" {\n\t\treturn nil, errors.New(\"missing bindDN paramater\")\n\t}\n\treturn &ldapConnector{*c}, nil\n}", "func Load(configFile string) (*Config, error) {\n\t// User explicitly specified a config file\n\tif configFile != \"\" {\n\t\treturn ParseConfigFile(configFile)\n\t}\n\n\t// There is a config in the current directory\n\tif fi, err := os.Stat(defaultConfigFile); err == nil {\n\t\treturn ParseConfigFile(fi.Name())\n\t}\n\n\t// Use default values\n\tlog.Println(\"Running dev mode with default settings, consult config when you're ready to run in production\")\n\treturn defaultConfig(), nil\n}", "func Load(path string) (*Config, error) {\n\tb, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn load(b)\n}", "func Open(p string) (*File, error) {\n\tpath, _ := filepath.Abs(p)\n\th := &File{\n\t\tCheckInterval: 0,\n\t\tlastModified: time.Unix(0, 0),\n\t\tlastSize: 0,\n\t\tmutex: sync.Mutex{},\n\t\tpath: path,\n\t\tusers: make(map[string]string),\n\t}\n\n\th.mutex.Lock()\n\tdefer h.mutex.Unlock()\n\n\terr := h.readFile()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn h, nil\n}", "func Load(f string) (*configapi.Config, error) {\n\tr, err := os.Open(f)\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\tdefer r.Close()\n\n\tdata, err := ioutil.ReadAll(r)\n\tif err != nil {\n\t\treturn nil, errors.Trace(err)\n\t}\n\n\tconfig := &configapi.Config{}\n\treturn config, yaml.Unmarshal(data, config)\n}", "func Load() *Configuration {\n\t// Todo - better way to work out where the config.yml file is?\n\t// Do we have a sensible default for this?\n\treturn LoadFrom(\n\t\t[]string{\".\", \"../\", \"../config\", \"./config\"},\n\t\t\"config\",\n\t)\n}", "func Open(path string) (*File, error) {\n\tfile := &File{path: path}\n\terr := file.reload()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn file, nil\n}", "func Read(filename string) error {\n\treturn cfg.Read(filename)\n}", "func Load() Configuration {\n\tif cfg.APIAiToken != \"\" {\n\t\treturn cfg\n\t}\n\tconf, err := os.Open(\"config/config.json\")\n\n\tif err != nil {\n\t\tlog.Fatal(\"config:Load error : \", err)\n\t}\n\n\tdecoder := json.NewDecoder(conf)\n\terr = decoder.Decode(&cfg)\n\tif err != nil {\n\t\tlog.Fatal(\"config:Load error : \", err)\n\t}\n\n\treturn cfg\n}", "func (f File) Open(ctx context.Context) (io.ReadCloser, error) {\n\topener, ok := ctx.Value(contextKeyFileOpener).(Opener)\n\tif !ok {\n\t\treturn nil, errors.New(\"opener missing from context\")\n\t}\n\treturn opener(ctx, f)\n}", "func Load(p string) (cfg *Config, err error) {\n\tvar d []byte\n\td, err = ioutil.ReadFile(p)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcfg = new(Config)\n\tif err = yaml.Unmarshal(d, cfg); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif cfg.ConfigPath != p {\n\t\tcfg.ConfigPath = p\n\t}\n\tcfg.ConfigPath, err = filepath.Abs(p)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn cfg, nil\n}", "func New(file ...string) *Config {\n\tname := DefaultConfigFile\n\tif len(file) > 0 {\n\t\tname = file[0]\n\t} else {\n\t\t// Custom default configuration file name from command line or environment.\n\t\tif customFile := gcmd.GetOptWithEnv(commandEnvKeyForFile).String(); customFile != \"\" {\n\t\t\tname = customFile\n\t\t}\n\t}\n\tc := &Config{\n\t\tdefaultName: name,\n\t\tsearchPaths: garray.NewStrArray(true),\n\t\tjsonMap: gmap.NewStrAnyMap(true),\n\t}\n\t// Customized dir path from env/cmd.\n\tif customPath := gcmd.GetOptWithEnv(commandEnvKeyForPath).String(); customPath != \"\" {\n\t\tif gfile.Exists(customPath) {\n\t\t\t_ = c.SetPath(customPath)\n\t\t} else {\n\t\t\tif errorPrint() {\n\t\t\t\tglog.Errorf(\"[gcfg] Configuration directory path does not exist: %s\", customPath)\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// Dir path of working dir.\n\t\tif err := c.AddPath(gfile.Pwd()); err != nil {\n\t\t\tintlog.Error(context.TODO(), err)\n\t\t}\n\n\t\t// Dir path of main package.\n\t\tif mainPath := gfile.MainPkgPath(); mainPath != \"\" && gfile.Exists(mainPath) {\n\t\t\tif err := c.AddPath(mainPath); err != nil {\n\t\t\t\tintlog.Error(context.TODO(), err)\n\t\t\t}\n\t\t}\n\n\t\t// Dir path of binary.\n\t\tif selfPath := gfile.SelfDir(); selfPath != \"\" && gfile.Exists(selfPath) {\n\t\t\tif err := c.AddPath(selfPath); err != nil {\n\t\t\t\tintlog.Error(context.TODO(), err)\n\t\t\t}\n\t\t}\n\t}\n\treturn c\n}", "func (h *fs) Open(filename string) (io.ReadCloser, error) {\n\treturn os.Open(filename)\n}", "func Config() *ini.File {\n\tif cfg == nil {\n\t\treturn ini.Empty()\n\t}\n\treturn cfg\n}", "func Load(filename string) (c *Config, err error) {\n\tcontent, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"config load: %w\", err)\n\t}\n\n\treturn Parse(content, filename)\n}", "func Load(configFile string) (*Config, error) {\n\tlog.Printf(\"[config][Load] Reading configuration from configFile=%s\", configFile)\n\tcfg, err := readConfigurationFile(configFile)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn nil, ErrConfigFileNotFound\n\t\t}\n\t\treturn nil, err\n\t}\n\tcfg.filePath = configFile\n\tcfg.UpdateLastFileModTime()\n\treturn cfg, nil\n}", "func New(opts map[string]interface{}, confPath string, resolve bool) (Config, error) {\n\n\t// read the config file\n\tbuf, err := os.ReadFile(confPath)\n\tif err != nil {\n\t\treturn Config{}, fmt.Errorf(\"could not read config file: %v\", err)\n\t}\n\n\t// initialize a config object\n\tconf := Config{}\n\n\t// store the config path\n\tconf.Path = confPath\n\n\t// unmarshal the yaml\n\terr = yaml.UnmarshalStrict(buf, &conf)\n\tif err != nil {\n\t\treturn Config{}, fmt.Errorf(\"could not unmarshal yaml: %v\", err)\n\t}\n\n\t// if a .cheat directory exists locally, append it to the cheatpaths\n\tcwd, err := os.Getwd()\n\tif err != nil {\n\t\treturn Config{}, fmt.Errorf(\"failed to get cwd: %v\", err)\n\t}\n\n\tlocal := filepath.Join(cwd, \".cheat\")\n\tif _, err := os.Stat(local); err == nil {\n\t\tpath := cp.Cheatpath{\n\t\t\tName: \"cwd\",\n\t\t\tPath: local,\n\t\t\tReadOnly: false,\n\t\t\tTags: []string{},\n\t\t}\n\n\t\tconf.Cheatpaths = append(conf.Cheatpaths, path)\n\t}\n\n\t// process cheatpaths\n\tfor i, cheatpath := range conf.Cheatpaths {\n\n\t\t// expand ~ in config paths\n\t\texpanded, err := homedir.Expand(cheatpath.Path)\n\t\tif err != nil {\n\t\t\treturn Config{}, fmt.Errorf(\"failed to expand ~: %v\", err)\n\t\t}\n\n\t\t// follow symlinks\n\t\t//\n\t\t// NB: `resolve` is an ugly kludge that exists for the sake of unit-tests.\n\t\t// It's necessary because `EvalSymlinks` will error if the symlink points\n\t\t// to a non-existent location on the filesystem. When unit-testing,\n\t\t// however, we don't want to have dependencies on the filesystem. As such,\n\t\t// `resolve` is a switch that allows us to turn off symlink resolution when\n\t\t// running the config tests.\n\t\tif resolve {\n\t\t\tevaled, err := filepath.EvalSymlinks(expanded)\n\t\t\tif err != nil {\n\t\t\t\treturn Config{}, fmt.Errorf(\n\t\t\t\t\t\"failed to resolve symlink: %s: %v\",\n\t\t\t\t\texpanded,\n\t\t\t\t\terr,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\texpanded = evaled\n\t\t}\n\n\t\tconf.Cheatpaths[i].Path = expanded\n\t}\n\n\t// if an editor was not provided in the configs, attempt to choose one\n\t// that's appropriate for the environment\n\tif conf.Editor == \"\" {\n\t\tif conf.Editor, err = Editor(); err != nil {\n\t\t\treturn Config{}, err\n\t\t}\n\t}\n\n\t// if a chroma style was not provided, set a default\n\tif conf.Style == \"\" {\n\t\tconf.Style = \"bw\"\n\t}\n\n\t// if a chroma formatter was not provided, set a default\n\tif conf.Formatter == \"\" {\n\t\tconf.Formatter = \"terminal\"\n\t}\n\n\t// load the pager\n\tconf.Pager = strings.TrimSpace(conf.Pager)\n\n\treturn conf, nil\n}", "func (config *Configuration) OpenConfig() error {\n Log.LogFunctionName()\n var error error\n\n // Set up logging --\n\n Log.LogLevel = config.LogLevel\n Log.SetFilename(config.LogFilename)\n Log.LogTeeStderr = config.LogTeeStderr\n\n Log.Startf(\"%s version %s pid %d compiled %s.\",\n config.ServiceName,\n Util.CompileVersion(),\n os.Getpid(),\n Util.CompileTime(),\n )\n Log.Debugf(\"Configuration: %+v.\", config)\n\n // Set our pid file --\n\n if error = config.CreatePIDFile(); error != nil {\n return error\n }\n\n // Set our path --\n\n if error = os.Chdir(config.ServiceFilePath); error != nil {\n Log.Errorf(\"Error setting the home path '%s': %v.\", config.ServiceFilePath, error)\n return error\n } else {\n config.ServiceFilePath, _ = os.Getwd()\n Log.Debugf(\"Working directory: '%s'\", config.ServiceFilePath)\n }\n\n // Load localized strings --\n\n if len(config.LocalizationFile) > 0 {\n\n Log.Infof(\"Loading localized strings from %s.\", config.LocalizationFile)\n\n error = config.LoadLocalizedStrings()\n if error != nil {\n error = fmt.Errorf(\"Can't open localization file: %v.\", error)\n return error\n }\n }\n\n // Load templates --\n\n if len(config.TemplatesPath) > 0 {\n\n Log.Infof(\"Loading templates from %s.\", config.TemplatesPath)\n\n path := config.TemplatesPath+\"/*\"\n\n config.Template = template.New(\"Base\")\n config.Template = config.Template.Funcs(template.FuncMap{\n \"UnescapeHTMLString\": unescapeHTMLString,\n \"EscapeHTMLString\": escapeHTMLString,\n \"BoolPtr\": boolPtr,\n \"StringPtr\": stringPtr,\n \"MonthYearString\": MonthYearStringFromEpochPtr,\n })\n config.Template, error = config.Template.ParseGlob(path)\n if error != nil || config.Template == nil {\n if error == nil { error = fmt.Errorf(\"No files.\") }\n error = fmt.Errorf(\"Can't parse template files: %v.\", error)\n return error\n }\n }\n\n // Open the database --\n\n if error = config.ConnectDatabase(); error != nil {\n return error\n }\n\n return nil\n}", "func (cfg *Configuration) Load() error {\n\tcfg.locker.Lock()\n\tdefer cfg.locker.Unlock()\n\tif cfg.FilePath == \"\" {\n\t\treturn errors.New(\"Configuration.FilePath was not set\")\n\t}\n\treturn gonfig.Read(cfg)\n}", "func Load(fileName string) (Config, error) {\n\tcfg := DefaultConfig\n\tif fileName == \"\" {\n\t\treturn cfg, nil\n\t}\n\tconfigBytes, err := ioutil.ReadFile(fileName)\n\tif err != nil {\n\t\treturn DefaultConfig, err\n\t}\n\treturn LoadBytes(configBytes)\n}", "func readConfig() Configuration {\n\tfmt.Println(\"Reading configuration file\")\n\n\tdir, _ := filepath.Abs(filepath.Dir(os.Args[0]))\n\tfilepath := []string{dir, \"config.json\"}\n\n\tfile, _ := os.Open(strings.Join(filepath, \"\\\\\"))\n\tdecoder := json.NewDecoder(file)\n\tconfiguration := Configuration{}\n\terr := decoder.Decode(&configuration)\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn configuration\n}", "func Get() Configuration {\n\tvar cfg Configuration\n\n\t// Parse any arguments that may have been passed\n\tconfigPath, verbose, debug, checkonly := parseArguments()\n\n\t// Read the config file\n\tconfigFile, err := ioutil.ReadFile(configPath)\n\tif err != nil {\n\t\tfmt.Println(\"Unable to read configuration file: \", err)\n\t\tos.Exit(1)\n\t}\n\n\t// Parse the config into a struct\n\terr = yaml.Unmarshal(configFile, &cfg)\n\tif err != nil {\n\t\tfmt.Println(\"Unable to parse yaml configuration: \", err)\n\t\tos.Exit(1)\n\t}\n\n\t// If Manifest wasnt provided, exit\n\tif cfg.Manifest == \"\" {\n\t\tfmt.Println(\"Invalid configuration - Manifest: \", err)\n\t\tos.Exit(1)\n\t}\n\n\t// If URL wasnt provided, exit\n\tif cfg.URL == \"\" {\n\t\tfmt.Println(\"Invalid configuration - URL: \", err)\n\t\tos.Exit(1)\n\t}\n\n\t// If URLPackages wasn't provided, use the repo URL\n\tif cfg.URLPackages == \"\" {\n\t\tcfg.URLPackages = cfg.URL\n\t}\n\n\t// If AppDataPath wasn't provided, configure a default\n\tif cfg.AppDataPath == \"\" {\n\t\tcfg.AppDataPath = filepath.Join(os.Getenv(\"ProgramData\"), \"gorilla/\")\n\t} else {\n\t\tcfg.AppDataPath = filepath.Clean(cfg.AppDataPath)\n\t}\n\n\t// Set the verbosity\n\tif verbose && !cfg.Verbose {\n\t\tcfg.Verbose = true\n\t}\n\n\t// Set the debug and verbose\n\tif debug && !cfg.Debug {\n\t\tcfg.Debug = true\n\t\tcfg.Verbose = true\n\t}\n\n\tif checkonly && !cfg.CheckOnly {\n\t\tcfg.CheckOnly = true\n\t}\n\n\t// Set the cache path\n\tcfg.CachePath = filepath.Join(cfg.AppDataPath, \"cache\")\n\n\t// Add to GorillaReport\n\treport.Items[\"Manifest\"] = cfg.Manifest\n\treport.Items[\"Catalog\"] = cfg.Catalogs\n\n\treturn cfg\n}", "func (f ConfigFile) Get() (string, error) {\n\tc, err := ioutil.ReadFile(string(f))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(c), nil\n}", "func (conf *BuildConfig) Read(path string) error {\n\tf, err := os.Open(filepath.Clean(path))\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tcloseErr := f.Close()\n\t\tif closeErr != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t}()\n\tval, err := ioutil.ReadAll(f)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = json.Unmarshal(val, &conf.Config)\n\treturn err\n}", "func (c *ConfigBridge) openConfigPath() {\n\tgui.QDesktopServices_OpenUrl(core.QUrl_FromLocalFile(c.configPath))\n}", "func (c *Config) Read(path string) error {\n\tdata, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\treturn errors.New(\"reading config \" + path + \", \" + err.Error())\n\t}\n\n\terr = json.Unmarshal(data, c)\n\tif err != nil {\n\t\treturn errors.New(\"parsing config \" + path + \", \" + err.Error())\n\t}\n\n\tabsolutePath, err := filepath.Abs(path)\n\tif err != nil {\n\t\treturn errors.New(\"error in get absolute path\")\n\t}\n\n\tparentDir := filepath.Dir(absolutePath)\n\tc.DeploymentTemplatePath = parentDir + \"/\" + c.DeploymentTemplatePath\n\n\tdata, err = ioutil.ReadFile(c.DeploymentTemplatePath)\n\tif err != nil {\n\t\treturn errors.New(\"reading deployment template \" + c.DeploymentTemplatePath + \", \" + err.Error())\n\t}\n\tc.DeploymentTemplate = string(data)\n\t//TODO validate\n\tlogger.Infof(\"config listing\")\n\tlogger.Infof(\"deployment template path: %s\", c.DeploymentTemplatePath)\n\tlogger.Infof(\"wait for creating timeout: %d\", c.WaitForCreatingTimeout)\n\tlogger.Infof(\"pod lifetime %d\", c.PodLifetime)\n\tlogger.Infof(\"listen: %s\", c.Listen)\n\tlogger.Infof(\"namespace: %s\", c.Namespace)\n\treturn nil\n}", "func Open(relpath string) (*os.File, error) {\n\terr := validate(relpath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpath := filepath.Join(rootPath, relpath)\n\treturn os.Open(path)\n}", "func Load(configFile string, p Parser) {\n\tvar err error\n\tvar absPath string\n\tvar input = io.ReadCloser(os.Stdin)\n\tif absPath, err = filepath.Abs(configFile); err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\tif input, err = os.Open(absPath); err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\t// Read the config file\n\tjsonBytes, err := ioutil.ReadAll(input)\n\tinput.Close()\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\t// Parse the config\n\tif err := p.ParseJSON(jsonBytes); err != nil {\n\t\tlog.Fatalln(\"Could not parse %q: %v\", configFile, err)\n\t}\n}", "func (c *Configuration) Load() {\n\t// TODO:change this to log to stderr, actuall all logs to stderr?\n\t//log.Printf(\"Using configuration at %s\\n\", configFile)\n\n\tif _, err := toml.DecodeFile(configFile, &c); err != nil {\n\t\tlog.Fatalln(\"Failed to open file\", err)\n\t\treturn\n\t}\n\n\t//TODO: check if empty after loading, else initalize\n\tif c.RedirectUri == \"\" {\n\t\tc.RedirectUri = redirectUrl\n\t}\n\tif c.Scope == \"\" {\n\t\tc.Scope = scope\n\t}\n\tif c.BaseUrl == \"\" {\n\t\tc.BaseUrl = baseUrl\n\t}\n}", "func Load() Config {\n\tif config != nil {\n\t\treturn *config\n\t}\n\tfile, e := ioutil.ReadFile(getFilename())\n\tif e != nil {\n\t\tlog.Fatalf(\"Error while reading config file: %v\\n\", e)\n\t}\n\tconfig = &Config{}\n\tif json.Unmarshal(file, config) != nil {\n\t\tlog.Fatalf(\"Error while parsing config file: %v\\n\", e)\n\t}\n\treturn *config\n}", "func (c *FileConfig) Get() (*Raw, error) {\n\t_, err := os.Stat(c.file)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tr, err := ioutil.ReadFile(c.file)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Raw{r}, nil\n}", "func Load(filename string) Config {\n\tfile, err := os.Open(filename)\n\tif err != nil {\n\t\tlog.WithField(`error`, err).Fatal(`Opening config file`)\n\t}\n\n\tdec := json.NewDecoder(file)\n\tconf := Config{}\n\tif err = dec.Decode(&conf); err != nil {\n\t\tlog.WithField(`error`, err).Fatal(`Parsing config file`)\n\t}\n\n\treturn conf\n}", "func Load(path string) (*Config, error) {\n\tcfg := new(Config)\n\n\tswitch path {\n\tcase \"\":\n\t\tcfg.path = configFilePath()\n\tdefault:\n\t\tcfg.path = path\n\t}\n\n\tswitch exists, err := configFileExists(cfg.path); {\n\tcase err != nil:\n\t\treturn nil, errors.Wrap(err, \"failed to stat config file\")\n\tcase !exists:\n\t\tcfg.setDefaults()\n\t\treturn cfg, cfg.Write()\n\tdefault:\n\t\tfh, err := os.Open(cfg.path)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"failed to open config file\")\n\t\t}\n\t\tdefer fh.Close()\n\n\t\tbuf, err := ioutil.ReadAll(fh)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"failed to read file\")\n\t\t}\n\n\t\treturn cfg, yaml.Unmarshal(buf, &cfg)\n\t}\n}", "func (p *Path) Open() ([]byte, error) {\n\tbuf, err := ioutil.ReadFile(p.Path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn buf, nil\n}", "func Load(configFilename string) (*Config, error) {\n\n\t// Try to load the configuration from STDIN...\n\tfi, err := os.Stdin.Stat()\n\tif err != nil {\n\t\terr = fmt.Errorf(\"unable to load configuration from STDIN: %s\", err.Error())\n\t\treturn nil, err\n\t}\n\tif fi.Mode()&os.ModeNamedPipe != 0 && fi.Size() > 0 {\n\t\tdata, err := ioutil.ReadAll(os.Stdin)\n\t\tif err != nil {\n\t\t\terr = fmt.Errorf(\"unable to load configuration from STDIN: %s\", err.Error())\n\t\t\treturn nil, err\n\t\t}\n\t\treturn newConfig(data)\n\t}\n\n\t// Try to load configuration from file...\n\tdata, err := ioutil.ReadFile(configFilename)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"unable to load configuration from file (%s): %s\", configFilename, err.Error())\n\t\treturn nil, err\n\t}\n\treturn newConfig(data)\n}", "func New(configFile string) *Config {\n\tc, err := ioutil.ReadFile(configFile)\n\tif err != nil {\n\t\tlog.Panicf(\"Read config file %s failed: %s\", configFile, err.Error())\n\t}\n\tcfg := &Config{}\n\tif err := yaml.Unmarshal(c, cfg); err != nil {\n\t\tlog.Panicf(\"yaml.Unmarshal config file %s failed: %s\", configFile, err.Error())\n\t}\n\treturn cfg\n}", "func Load(path string) (*Config, error) {\n\tdata, err := ioutil.ReadFile(path)\n\tconfig := new(Config)\n\tif err != nil {\n\t\treturn config, err\n\t}\n\n\terr = json.Unmarshal(data, config)\n\tif err != nil {\n\t\treturn config, err\n\t}\n\n\treturn config, nil\n}", "func (d *Driver) Open(ctx context.Context, cfg interface{}) (db.DEXArchivist, error) {\n\tswitch c := cfg.(type) {\n\tcase *Config:\n\t\treturn NewArchiver(ctx, c)\n\tcase Config:\n\t\treturn NewArchiver(ctx, &c)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"invalid config type %t\", cfg)\n\t}\n}", "func (fs osFsEval) Open(path string) (*os.File, error) {\n\treturn os.Open(path)\n}", "func (f LocalFS) Open(name string) (fs.File, error) {\n\tcleanPath, err := util.CleanRelativePath(name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif kv, exists := f.m[filepath.Join(f.basePath, cleanPath)]; exists {\n\t\tif kv.f != nil {\n\t\t\treturn kv.f, nil\n\t\t}\n\t\tfile, err := os.Open(kv.path)\n\t\tif err != nil {\n\t\t\tif errors.Is(err, fs.ErrNotExist) {\n\t\t\t\treturn nil, ErrFileNotExist\n\t\t\t}\n\t\t\treturn nil, ErrPluginFileRead\n\t\t}\n\t\treturn file, nil\n\t}\n\treturn nil, ErrFileNotExist\n}", "func configLoad(cfgfile string) (*ini.File, error) {\n\tcfg, err := ini.Load(cfgfile)\n\treturn cfg, err\n}", "func Load(path string) (*Config, error) {\n\tconfigFile, err := os.Open(path)\n\tdefer configFile.Close()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar config Config\n\tjsonParser := json.NewDecoder(configFile)\n\tparseErr := jsonParser.Decode(&config)\n\n\tif parseErr != nil {\n\t\treturn nil, parseErr\n\t}\n\tconfig.fillFlags()\n\treturn &config, nil\n}", "func Read() Config {\n\tfile, err := os.Open(\"config.json\")\n\tif err != nil {\n\t\tlog.Fatalf(\"Could not read config: %v\", err)\n\t}\n\tdefer file.Close()\n\tdecoder := json.NewDecoder(file)\n\tconfig := Config{}\n\terr = decoder.Decode(&config)\n\tif err != nil {\n\t\tlog.Fatalf(\"Could not read config: %v\", err)\n\t}\n\treturn config\n}", "func (f *FS) Open(path string) (contents interface{}, err error) {\n\tloader := f.Loader\n\n\tif f.Loader == nil {\n\t\tloader = nilLoader\n\t}\n\tfullpath := filepath.Join(f.Root, path)\n\n\tfile, err := os.Open(fullpath)\n\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer file.Close()\n\n\treturn loader(path, file)\n}", "func Open(path string, opt *Options) (Reader, error) {\n\tst, err := os.Stat(path)\n\to := checkOpt(opt)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar f *os.File\n\tif st.IsDir() {\n\t\t// Will try dir formats\n\t\tif !o.AllowDir {\n\t\t\treturn nil, ErrNoDirsAllowed\n\t\t}\n\t\to.Name = path\n\t} else {\n\t\t// Otherwise file formats\n\t\tif f, err = os.Open(path); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\to.Name = path\n\t\to.Size = st.Size()\n\t}\n\n\t// CAVEAT: interface nil workaround, dir format wants it\n\tvar ior io.Reader\n\tif f != nil {\n\t\tior = f\n\t}\n\n\tr, err := NewReaderOpt(ior, &o)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif r == nil {\n\t\treturn nil, ErrFormatUnknown\n\t}\n\n\t// Wrap the result in outer closer, so that Close() call will\n\t// nuke our file as well.\n\treturn &fileCloser{r, f}, nil\n}", "func Load(filePath string) error {\n\treturn config.Load(filePath, &cfg)\n}", "func Open(name string) (*os.File, error)", "func Config(path string) (conf []byte, err error) {\n\tconf, err = ioutil.ReadFile(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn conf, nil\n}", "func Config(fileName string) func(opa *OPA) error {\n\treturn func(opa *OPA) error {\n\t\tbs, err := ioutil.ReadFile(fileName)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\topa.configBytes = bs\n\t\treturn nil\n\t}\n}", "func (c *ConfigFile) Load() error {\n\trw, err := NewConfigReadWriter(c.version)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfilename := rw.Filename(c)\n\tif _, err := os.Stat(filename); err != nil {\n\t\treturn err\n\t}\n\tfile, err := os.Open(filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = rw.LoadFromReader(file, c)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer file.Close()\n\treturn nil\n}", "func getConfigFile() (*os.File, error) {\n\treturn os.Open(env.WorkDir() + \"/configs/config.json\")\n}", "func (o *OS) Open(path string) (ReadSeekCloser, error) {\n\treturn os.Open(path)\n}", "func Load(configFile string) (*Config, error) {\n\t// User explicitly specified a config file\n\tif configFile != \"\" {\n\t\treturn ParseConfigFile(configFile)\n\t}\n\n\t// There is a config in the current directory\n\tif fi, err := os.Stat(defaultConfigFile); err == nil {\n\t\treturn ParseConfigFile(fi.Name())\n\t}\n\n\t// Use default values\n\tlog.Println(\"Running dev mode with default settings, consult config when you're ready to run in production\")\n\tcfg := defaultConfig()\n\treturn cfg, envOverride(cfg)\n}", "func (conf *Configuration) Read(path string) error {\n\tif _, err := toml.DecodeFile(path, conf); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func Open(filePath string) *os.File {\n\tfile, err := os.Open(filePath)\n\tif err != nil {\n\t\tfmt.Println(\"Unable to open '\" + filePath + \"', aborting\")\n\t\tpanic(err)\n\t}\n\n\treturn file\n}", "func Open(path string) (io.ReadCloser, error) {\n\tif path == \"\" {\n\t\treturn os.Stdin, nil\n\t}\n\n\treturn os.Open(path)\n}", "func Read(path string) error {\n\tStore = Config{}\n\n\tdat, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\tfmt.Printf(\"Error reading config parameters: %v\\n\", err)\n\t\treturn err\n\t}\n\n\terr = yaml.Unmarshal(dat, &Store)\n\tif err != nil {\n\t\tfmt.Printf(\"Error parsing config parameters: %v\\n\", err)\n\t\treturn err\n\t}\n\n\t// Default the missing parameters\n\tsetDefaults()\n\n\treturn nil\n}", "func Read(file string) (*Config, error) {\n\treturn readKNFFile(file)\n}", "func Open(name string) (File, error) {\n\treturn os.Open(name)\n}", "func (config *Config) Load(path string) {\n\tif dat, err := ioutil.ReadFile(path); err == nil {\n\t\tif err := json.Unmarshal(dat, config); err != nil {\n\t\t\tlog.Printf(\"%v\", err)\n\t\t}\n\t} else {\n\t\tlog.Printf(\"Configfile %s doesn't exist\", path)\n\t}\n}", "func (fOpenCfg FileOpenConfig) New(fOpenType FileOpenType, fOpenModes ...FileOpenMode) (FileOpenConfig, error) {\n\n ePrefix := \"FileOpenConfig.New() \"\n\n err := fOpenType.IsValid()\n\n if err != nil {\n return FileOpenConfig{},\n fmt.Errorf(ePrefix+\"Error: Input parameter 'fOpenType' is INVALID! fOpenType='%v' \", err.Error())\n }\n resultFOpenStatus := FileOpenConfig{}\n\n resultFOpenStatus.fileOpenType = fOpenType\n\n resultFOpenStatus.fileOpenModes = make([]FileOpenMode, 0)\n\n if len(fOpenModes) == 0 {\n\n resultFOpenStatus.fileOpenModes = append(resultFOpenStatus.fileOpenModes, FOpenMode.ModeNone())\n\n resultFOpenStatus.isInitialized = true\n\n return resultFOpenStatus, nil\n }\n\n for idx, mode := range fOpenModes {\n\n err = mode.IsValid()\n\n if err != nil {\n return FileOpenConfig{},\n fmt.Errorf(ePrefix+\n \"Error: Input parameter 'fOpenModes' contains an invalid FileOpenMode. Index='%v' \", idx)\n }\n\n resultFOpenStatus.fileOpenModes = append(resultFOpenStatus.fileOpenModes, mode)\n\n }\n\n resultFOpenStatus.isInitialized = true\n\n return resultFOpenStatus, nil\n}", "func (c *Configurations) ReadFrom(path string) error {\n\tc.Init()\n\n\tdata, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = yaml.Unmarshal(data, &GlobalConfigurations)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif GlobalConfigurations.Version != Version {\n\t\treturn fmt.Errorf(\"The version of base file is different with the config file\")\n\t}\n\treturn nil\n}", "func loadFileConfig() (*os.File, error) {\n\n\tfile, err := os.Open(configFile)\n\tif err != nil {\n\t\tfile, err = os.Open(path)\n\t\treturn file, err\n\t}\n\n\treturn file, nil\n}", "func Load(path string, cfg *Config) error {\n\tf, err := os.Open(path)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"faild to open configuration file\")\n\t}\n\n\terr = yaml.NewDecoder(f).Decode(cfg)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"faild to decode\")\n\t}\n\n\treturn nil\n}", "func Open(capsule string) {\n\tFile, _ := ioutil.ReadFile(capsule)\n\tsource = string(File)\n\tload()\n}", "func (fos *fakeOS) Open(name string) (io.ReadCloser, error) {\n\tr, ok := fos.readFiles[name]\n\tif !ok {\n\t\tpanic(fmt.Sprintf(\"fakeOS: file not found (%s); not implemented.\", name))\n\t}\n\treturn ioutil.NopCloser(r), nil\n}", "func Open(path string) (Scanner, error) {\n\tinput, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\treturn nil, errutil.Err(err)\n\t}\n\treturn NewFromBytes(input), nil\n}", "func Load(fileName string) Configuration {\n\tvar config Configuration\n\n\tfile, err := os.Open(fileName)\n\tif err != nil {\n\t\tlog.Fatalf(\"Error opening configuration file from %s: %s\", fileName, err)\n\t}\n\tdefer file.Close()\n\n\tdecoder := json.NewDecoder(file)\n\tif err := decoder.Decode(&config); err != nil {\n\t\tlog.Fatalf(\"Error decoding JSON from %s: %s\", fileName, err)\n\t}\n\n\treturn config\n}", "func (c *Config) Read(path string) error {\n\tfile, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Failed to read file @ \"+path)\n\t}\n\terr = json.Unmarshal(file, c)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Failed to Unmarshal Json\")\n\t}\n\treturn nil\n}", "func ReadFile(filename string) (*Config, error) {\n\tconfig := New()\n\terr := gcfg.ReadFileInto(config, filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn config, nil\n}", "func Read(path string) (*Config, error) {\n\tdat, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar config Config\n\terr = yaml.Unmarshal(dat, &config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &config, nil\n}", "func Load(path string) (*Configuration, error) {\n\tbytes, err := ioutil.ReadFile(path)\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error reading config file, %s\", err)\n\t}\n\tvar cfg = new(Configuration)\n\terr = json.Unmarshal(bytes, cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn cfg, nil\n}", "func New() (*Config, error) {\n\tc := &Config{}\n\tconfigPath := os.Getenv(\"CONFIG_PATH\")\n\tconfigFile := filepath.Join(configPath, ConfigFileName)\n\tfile, err := os.Open(configFile)\n\tdefer file.Close()\n\tif err != nil {\n\t\treturn c, err\n\t}\n\n\tb, err := ioutil.ReadAll(file)\n\tif err != nil {\n\t\treturn c, err\n\t}\n\n\tif len(b) != 0 {\n\t\tyaml.Unmarshal(b, c)\n\t}\n\treturn c, nil\n}", "func Load(configFile string) (*AAAConfig, error) {\n\t// 读取配置文件\n\t// d := defaultStbConfig\n\tm := multiconfig.NewWithPath(configFile) // supports TOML, JSON and YAML\n\tcfg := new(AAAConfig)\n\terr := m.Load(cfg) // Check for error\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tm.MustLoad(cfg) // Panic's if there is any error\n\n\t// mergo.Merge(cfg, d)\n\n\treturn cfg, nil\n}" ]
[ "0.7651419", "0.70217204", "0.69066596", "0.689426", "0.6857632", "0.67921805", "0.6620474", "0.638658", "0.6350482", "0.63354313", "0.63322574", "0.62727463", "0.62643874", "0.6201249", "0.61726046", "0.61330813", "0.6098492", "0.6096205", "0.60506064", "0.6043741", "0.6025951", "0.60041934", "0.59605557", "0.5936174", "0.59234273", "0.5910364", "0.5902371", "0.58876723", "0.58807224", "0.5878637", "0.5863822", "0.58464247", "0.5840381", "0.583511", "0.58245575", "0.582205", "0.5820314", "0.5816994", "0.5816319", "0.5802099", "0.57915366", "0.578897", "0.5778831", "0.57680756", "0.57538337", "0.57537276", "0.57507634", "0.57409817", "0.5733983", "0.5728707", "0.5725074", "0.57179284", "0.5706041", "0.57033384", "0.5692418", "0.5672137", "0.56661874", "0.56602776", "0.5649519", "0.5648478", "0.5642497", "0.5638615", "0.5638112", "0.563622", "0.5632667", "0.562835", "0.56271446", "0.5625219", "0.5619742", "0.5614357", "0.5614292", "0.56131846", "0.56069064", "0.5602841", "0.5596139", "0.5593471", "0.55915153", "0.5589445", "0.5588888", "0.5582855", "0.5582076", "0.558154", "0.5580613", "0.5579618", "0.55786246", "0.55692506", "0.55653", "0.5557111", "0.5550342", "0.5548613", "0.55427974", "0.55406123", "0.5524182", "0.5523794", "0.5522687", "0.5519929", "0.5511981", "0.55099535", "0.54972285", "0.5492591" ]
0.78288484
0
Decode casts an io.Reader into a JSONDecoder and decodes it into a Config.
func Decode(r io.Reader) (*Config, error) { conf := DefaultConfig err := json.NewDecoder(r).Decode(&conf) return &conf, err }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func DecodeConfig(r io.Reader) (*Config, error) {\n\tvar result Config\n\tif err := json.NewDecoder(r).Decode(&result); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &result, nil\n}", "func Decode(data []byte) (*Config, error) {\n\tvar c Config\n\tif err := json.Unmarshal(data, &c); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &c, nil\n}", "func DecodeConfig(r io.Reader) (image.Config, error)", "func DecodeConfig(r io.Reader) (image.Config, error)", "func ReadConfig(input io.Reader) (*specs.Spec, error) {\n\td := json.NewDecoder(input)\n\ts := specs.Spec{}\n\tif err := d.Decode(&s); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &s, nil\n}", "func ConfigFromJSON(data io.Reader) *Config {\n\tvar o *Config\n\tif err := json.NewDecoder(data).Decode(&o); err != nil {\n\t\tmlog.Error(err.Error())\n\t\treturn nil\n\t}\n\treturn o\n}", "func ReadConfig(dest interface{}, filename string) error {\n\tfile, err := os.Open(filename)\n\tif err == nil {\n\t\tdefer file.Close()\n\t\tdecoder := json.NewDecoder(file)\n\t\terr := decoder.Decode(dest)\n\t\treturn err\n\t}\n\treturn err\n}", "func jsonDecode(reader io.ReadCloser, v interface{}) error {\n\tdecoder := json.NewDecoder(reader)\n\terr := decoder.Decode(v)\n\treturn err\n}", "func (c Config) ReadFrom(r io.Reader) (int64, error) {\n\tdata, err := ioutil.ReadAll(r)\n\tif err != nil {\n\t\treturn int64(len(data)), err\n\t}\n\tif err = json.Unmarshal(data, &c); err != nil {\n\t\treturn int64(len(data)), err\n\t}\n\treturn int64(len(data)), nil\n}", "func JSONDecode(r io.Reader, v interface{}) error {\n\treturn json.NewDecoder(r).Decode(v)\n}", "func FromJSON(r io.Reader) (Config, error) {\n\td := json.NewDecoder(r)\n\tm := make(map[string]interface{})\n\terr := d.Decode(&m)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn FromTieredMap(m), nil\n}", "func (l *Loader) LoadReader(in io.Reader) (*config.Values, error) {\n\tobject, err := parseJson(in)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvalues := config.NewValues()\n\tl.loadMapIntoValues(config.Key(nil), values, object)\n\treturn values, nil\n}", "func GetConfigFromJSON(reader io.Reader) (*Config, error) {\n\tvar config Config\n\t// TODO: возможно стоит переделать на работу парсера, чтобы не вычитывать весь файл\n\tbytes, err := ioutil.ReadAll(reader)\n\tif err != nil {\n\t\treturn &config, err\n\t}\n\terr = json.Unmarshal(bytes, &config)\n\tif err != nil {\n\t\treturn &config, err\n\t}\n\treturn &config, nil\n}", "func (e JsonDecoder) Decode(reader io.Reader, v interface{}) error {\n\treturn stderr.Wrap(json.NewDecoder(reader).Decode(v), \"failed to decode json\")\n}", "func DecodeReader(r io.Reader, ptr interface{}) error {\n\treturn json.NewDecoder(r).Decode(ptr)\n}", "func (c *ConfigFile) Decode(r io.Reader) error {\n\treturn gcfg.FatalOnly(gcfg.ReadInto(c, r))\n}", "func ReadJsonConfig(fileRead []byte, o *interface{}) error {\n\terr := json.Unmarshal(fileRead, o)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func Decode(r io.Reader, v any) error {\n\tdecoder := json.NewDecoder(r)\n\n\tfor {\n\t\tif err := decoder.Decode(v); errors.Is(err, io.EOF) {\n\t\t\tbreak\n\t\t} else if err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func DecodeJSON(r *http.Request) (dvid.Config, error) {\n\tc := dvid.NewConfig()\n\tif err := c.SetByJSON(r.Body); err != nil {\n\t\treturn dvid.Config{}, fmt.Errorf(\"Malformed JSON request in body: %v\", err)\n\t}\n\treturn c, nil\n}", "func loadFrom(r io.Reader) (*Config, error) {\n\tc := &Config{}\n\tdec := json.NewDecoder(r)\n\tif err := dec.Decode(c); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := c.General.validate(); err != nil {\n\t\treturn nil, fmt.Errorf(\"config validation error: %v\", err)\n\t}\n\tif err := c.Service.Parameters.validate(); err != nil {\n\t\treturn nil, fmt.Errorf(\"config validation error: %v\", err)\n\t}\n\tif err := c.Service.Input.validate(); err != nil {\n\t\treturn nil, fmt.Errorf(\"config validation error: %v\", err)\n\t}\n\tif err := c.Service.Output.validate(); err != nil {\n\t\treturn nil, fmt.Errorf(\"config validation error: %v\", err)\n\t}\n\treturn c, nil\n}", "func DecodeConfig(r io.Reader) (*SupportedBranchesConfig, error) {\n\tvar rv SupportedBranchesConfig\n\tif err := json.NewDecoder(r).Decode(&rv); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &rv, nil\n}", "func decodeJSON(r io.Reader, v interface{}) error {\n\tdata, err := ioutil.ReadAll(r)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err = json.Unmarshal(data, v); err != nil {\n\t\tlog.Printf(\"Error decoding JSON into %T: %s\", v, err)\n\t\tlog.Println(string(data))\n\t\treturn err\n\t}\n\treturn nil\n}", "func NewDecoder(r io.Reader) *Decoder {\n\tdec := &Decoder{r: reader{r: r}}\n\tdec.dec = json.NewDecoder(&dec.r)\n\treturn dec\n}", "func (c *Config) LoadConfigFromReader(r io.Reader) bool {\n\n\tbyteConfig, err := ioutil.ReadAll(r)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn false\n\t}\n\n\ts := string(byteConfig)\n\tlog.Println(s)\n\n\tjson.Unmarshal(byteConfig, &c)\n\n\tif c.EnableLog {\n\t\tlog.SetLevel(log.DebugLevel)\n\t} else {\n\t\tlog.SetLevel(log.ErrorLevel)\n\t}\n\n\tif c.twitterAPI == nil {\n\t\tc.twitterAPI = &TwitterAPI{Client: &http.Client{}}\n\t}\n\n\tc.BearerToken = c.twitterAPI.GenBearerToken(c.APIKey, c.APISecret)\n\tif c.BearerToken == \"\" {\n\t\treturn false\n\t}\n\n\treturn true\n}", "func DecodeJSON(r io.Reader, v interface{}) error {\n\treturn json.NewDecoder(r).Decode(v)\n}", "func (j JSON) Decode(r io.Reader) (interface{}, error) {\n\ts, err := util.ReadString(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err = json.Unmarshal([]byte(s), &j.V); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn j.V, err\n}", "func DecodeJSON(config *JSONConfiguration, path string) {\n\tfile, _ := os.Open(path)\n\tdefer file.Close()\n\n\tdecoder := json.NewDecoder(file)\n\terr := decoder.Decode(config)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n}", "func readConfig(name string, data interface{}) error {\n\tfile, err := os.Open(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\t_ = file.Close()\n\t}()\n\n\treturn json.NewDecoder(file).Decode(data)\n}", "func NewDecoder(r io.Reader) *Decoder {\n\treturn &Decoder{\n\t\td: json.NewDecoder(r),\n\t}\n}", "func DecodeConfig(r io.ReadSeeker) (cfg audio.Config, err error) {\n\terr = audio.ErrFormat\n\treturn\n}", "func (c *Config) Decode(dst any) error {\n\treturn c.Structure(\"\", dst)\n}", "func ConfigLoadReader(r io.Reader) (*Config, error) {\n\tc := ConfigNew()\n\tif err := json.NewDecoder(r).Decode(c); err != nil && !errors.Is(err, io.EOF) {\n\t\treturn nil, err\n\t}\n\t// verify loaded version is not higher than supported version\n\tif c.Version > 1 {\n\t\treturn c, ErrUnsupportedConfigVersion\n\t}\n\tfor h := range c.Hosts {\n\t\tif c.Hosts[h].Name == \"\" {\n\t\t\tc.Hosts[h].Name = h\n\t\t}\n\t\tif c.Hosts[h].Hostname == \"\" {\n\t\t\tc.Hosts[h].Hostname = h\n\t\t}\n\t\tif c.Hosts[h].TLS == regclient.TLSUndefined {\n\t\t\tc.Hosts[h].TLS = regclient.TLSEnabled\n\t\t}\n\t\tif h == regclient.DockerRegistryDNS || h == regclient.DockerRegistry {\n\t\t\tc.Hosts[h].Name = regclient.DockerRegistry\n\t\t\tif c.Hosts[h].Hostname == h {\n\t\t\t\tc.Hosts[h].Hostname = regclient.DockerRegistryDNS\n\t\t\t}\n\t\t}\n\t\tif c.Hosts[h].Name != h {\n\t\t\tc.Hosts[c.Hosts[h].Name] = c.Hosts[h]\n\t\t\tdelete(c.Hosts, h)\n\t\t}\n\t}\n\treturn c, nil\n}", "func readConfig(configFilePath string) *Config {\n\t// fmt.Println(\"doing readConfig\")\n\tfile, err := os.Open(configFilePath)\n\tdefer file.Close()\n\tdecoder := json.NewDecoder(file)\n\tconfig := new(Config)\n\terr = decoder.Decode(config)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn config\n}", "func ReadConfigJSON(filename string, configType interface{}) (Configuration, error) {\n\treadConfigTypeTemp := reflect.TypeOf(configType)\n\treadConfigType := readConfigTypeTemp.Kind()\n\tbytes, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\treturn readConfigType, err\n\t}\n\tvar config readConfigType\n\terr = json.Unmarshal(bytes, &config)\n\n\tif err != nil {\n\t\treturn readConfigType, err\n\t}\n\treturn config, nil\n}", "func NewDecoder(r io.Reader) *Decoder {\n\treturn NewDecoderFn(r, func(b []byte, v interface{}) error {\n\t\t// Decode the first value, and discard any remaining data.\n\t\treturn json.NewDecoder(bytes.NewReader(b)).Decode(v)\n\t})\n}", "func ReadConfig(r io.Reader) (*Config, error) {\n\tdecoder := json.NewDecoder(r)\n\tconfig := Config{}\n\terr := decoder.Decode(&config)\n\tif err != nil {\n\t\treturn nil, &ConfigError{\n\t\t\tmsg: \"Invalid config file format\",\n\t\t\tinner: err,\n\t\t}\n\t}\n\n\tif config.Certificate != \"\" {\n\t\t_, err = os.Stat(config.Certificate)\n\t\tif err != nil {\n\t\t\treturn nil, &ConfigError{\n\t\t\t\tmsg: \"Cannot access certificate file `\" +\n\t\t\t\t\tconfig.Certificate + \"' \",\n\t\t\t\tinner: err,\n\t\t\t}\n\t\t}\n\t}\n\tif config.PrivateKey != \"\" {\n\t\t_, err = os.Stat(config.PrivateKey)\n\t\tif err != nil {\n\t\t\treturn nil, &ConfigError{\n\t\t\t\tmsg: \"Cannot access private key file `\" +\n\t\t\t\t\tconfig.PrivateKey + \"' \",\n\t\t\t\tinner: err,\n\t\t\t}\n\t\t}\n\t}\n\tif (config.Certificate != \"\" && config.PrivateKey == \"\") ||\n\t\t(config.Certificate == \"\" && config.PrivateKey != \"\") {\n\t\treturn nil, &ConfigError{\n\t\t\tmsg: \"To use https, both certificate and private-key must be specified\",\n\t\t\tinner: nil,\n\t\t}\n\t}\n\n\treturn &config, nil\n}", "func DecodeJSON(r io.Reader, v interface{}) error {\n\tdefer io.Copy(ioutil.Discard, r) //nolint:errcheck\n\treturn json.NewDecoder(r).Decode(v)\n}", "func (cfg frozenConfig) NewDecoder(reader io.Reader) Decoder {\n dec := decoder.NewStreamDecoder(reader)\n dec.SetOptions(cfg.decoderOpts)\n return dec\n}", "func ReadConfig(filename string) (c Config) {\n\tdata, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\terr = json.Unmarshal(data, &c)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn\n}", "func Unmarshal(filename string) (c *Config, err error) {\n\tdat, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\treturn c, err\n\t}\n\tif err = json.Unmarshal(dat, &c); err != nil {\n\t\treturn c, err\n\t}\n\n\treturn c, nil\n}", "func DecodeConfiguration(b []byte) (*Configuration, error) {\n\tconfig := &Configuration{}\n\tdecodeerr := json.Unmarshal(b, config)\n\tif decodeerr != nil {\n\t\treturn nil, decodeerr\n\t}\n\treturn config, nil\n}", "func (c *Config) UnmarshalJSON(b []byte) error {\n\tif err := json.Unmarshal(b, &c.Spec); err != nil {\n\t\treturn err\n\t}\n\tc.Generator = generate.Generator{Config: &c.Spec}\n\treturn nil\n}", "func readConfigJSON(configFile string) error {\n\tconfigByte, err := ioutil.ReadFile(configFile)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := json.Unmarshal(configByte, &config); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (c *Config) Read(path string) error {\n\tfile, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Failed to read file @ \"+path)\n\t}\n\terr = json.Unmarshal(file, c)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Failed to Unmarshal Json\")\n\t}\n\treturn nil\n}", "func (conf *BuildConfig) Read(path string) error {\n\tf, err := os.Open(filepath.Clean(path))\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tcloseErr := f.Close()\n\t\tif closeErr != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t}()\n\tval, err := ioutil.ReadAll(f)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = json.Unmarshal(val, &conf.Config)\n\treturn err\n}", "func loadConfig(r io.Reader) (*whatphone.API, error) {\n\tvar config whatphone.API\n\tvar err error\n\n\terr = json.NewDecoder(r).Decode(&config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &config, nil\n}", "func DecodeConfig(path string) (*Config, error) {\n\tb, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tc, err := unmarshalConfig(b)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tc.ConfigFilePath = path\n\n\treturn c, nil\n}", "func ReadConfig(filename string) Config {\n\tconfig := Config{}\n\tfile, err := os.Open(filename)\n\tdefer file.Close()\n\tif err != nil {\n\t\tlog.Fatal(\"Config Not Found!\")\n\t} else {\n\t\terr = json.NewDecoder(file).Decode(&config)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n\treturn config\n}", "func Read(r io.Reader, c Config) error {\n\tvar content bytes.Buffer\n\tif _, err := content.ReadFrom(r); err != nil {\n\t\treturn err\n\t}\n\tc.Reset()\n\tif err := yaml.Unmarshal(content.Bytes(), c); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func DecodeJson(data []byte, v interface{}) error {\n\treturn json.ConfigCompatibleWithStandardLibrary.Unmarshal(data, v)\n}", "func Read() Config {\n\tfile, err := os.Open(\"config.json\")\n\tif err != nil {\n\t\tlog.Fatalf(\"Could not read config: %v\", err)\n\t}\n\tdefer file.Close()\n\tdecoder := json.NewDecoder(file)\n\tconfig := Config{}\n\terr = decoder.Decode(&config)\n\tif err != nil {\n\t\tlog.Fatalf(\"Could not read config: %v\", err)\n\t}\n\treturn config\n}", "func Unmarshal(conf []byte) (*ServerConfig, error) {\n\tres := &ServerConfig{}\n\tif err := json.Unmarshal(conf, res); err != nil {\n\t\treturn nil, err\n\t}\n\treturn res, nil\n}", "func NewDecoder(f FormatType, r io.Reader) (dec Decoder) {\n\tvar d DecodeProvider = nil\n\n\tswitch f {\n\tcase TomlFormat:\n\t\td = NewTomlDecoder(r)\n\tcase YamlFormat:\n\t\td = NewYamlDecoder(r)\n\tcase JsonFormat:\n\t\td = json.NewDecoder(r)\n\tdefault:\n\t}\n\n\treturn Decoder{Provider: d}\n}", "func (t *DescribeConfigsResource32) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tt.ResourceType, err = d.Int8()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.ResourceName, err = d.String()\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.ConfigurationKeys, err = d.StringArray()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}", "func (d Decoder) Decode(dst interface{}) error {\n\td1 := json.NewDecoder(d.r)\n\n\terr1 := d1.Decode(dst)\n\tif err1 != nil {\n\t\td2 := form.NewDecoder(d.r)\n\n\t\terr2 := d2.Decode(dst)\n\t\tif err2 != nil {\n\t\t\treturn fmt.Errorf(\"%v; %v\", err1, err2)\n\t\t}\n\t}\n\n\treturn nil\n}", "func (c *Config) UnmarshalJSON(data []byte) error {\n\tvar out map[string]interface{}\n\terr := json.Unmarshal(data, &out)\n\tif err != nil {\n\t\treturn err\n\t}\n\tc.Data = out\n\treturn nil\n}", "func (r *JSONConfig) Read(parent interface{}, filePath string) error {\n\tr.filename = filePath\n\tr.parent = parent\n\n\tfile, err := ioutil.ReadFile(filePath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"ReadConfig failed - %v.\", err)\n\t}\n\n\terr = json.Unmarshal(file, parent)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"ReadConfig failed - %v.\", err)\n\t}\n\n\tr.loaded = true\n\n\treturn nil\n}", "func Unmarshal(r io.Reader, v interface{}) error {\n\treturn json.NewDecoder(r).Decode(v)\n}", "func Parse(r io.Reader) (*Config, error) {\n\tout, err := ioutil.ReadAll(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ParseBytes(out)\n}", "func (s *SimpleJsonDeserializer) Deserialize(r io.Reader) error {\n\treturn JsonDecoder{}.Decode(r, s.O)\n}", "func Decode(r BytesReader) (interface{}, error) {\n\treturn decodeValue(r)\n}", "func ReadConfiguration(path string) (*Configuration, error) {\n\n\t// Open configuration file\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\tlog.WithFields(log.Fields{\"err\": err}).Error(\"os.Open\")\n\t\treturn nil, err\n\t}\n\n\t// Create a decoder from the file\n\td := json.NewDecoder(file)\n\tconfig := &Configuration{}\n\tif err = d.Decode(config); err != nil {\n\t\tlog.WithFields(log.Fields{\"err\": err}).Error(\"json.NewDecoder.Decode\")\n\t\treturn nil, err\n\t}\n\n\t// Decode secrets\n\tsecretFields := []string{\n\t\t\"Token\",\n\t\t\"TwitterConsumerKey\",\n\t\t\"TwitterConsumerSecret\",\n\t\t\"TwitterAccessKey\",\n\t\t\"TwitterAccessSecret\",\n\t}\n\n\tfor _, field := range secretFields {\n\t\tv := reflect.ValueOf(*config)\n\t\tenc := v.FieldByName(field).String()\n\t\tdec, err := base64.StdEncoding.DecodeString(enc)\n\t\tif err != nil {\n\t\t\tlog.WithFields(log.Fields{\"err\": err}).Error(\"base64.StdEncoding.DecodeString\")\n\t\t\treturn nil, err\n\t\t}\n\n\t\tconfig.update(field, string(dec))\n\t}\n\treturn config, nil\n}", "func DecodeConfig(name string, input interface{}, output interface{}) error {\n\tconfigDecoder, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{\n\t\tDecodeHook: mapstructure.ComposeDecodeHookFunc(\n\t\t\tmapstructure.StringToTimeDurationHookFunc(),\n\t\t\ttextUnmarshalerDecode,\n\t\t),\n\t\tResult: &output,\n\t\tTagName: \"yaml\",\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = configDecoder.Decode(input)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = envconfig.Process(name, output)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func ReadConfig(data []byte) (Config, error) {\n\tconfig := NewConfig()\n\tif err := json.Unmarshal(data, &config); err != nil {\n\t\tlog.Printf(\"unable to unmarshal application configuration file data, error: %s\\n\", err.Error())\n\t\treturn config, err\n\t}\n\n\tif err := config.Validate(); err != nil {\n\t\treturn config, err\n\t}\n\n\tlog.Printf(\"Configuration loaded. Source type: %s, Destination type: %s\\n\", config.Source.Type, config.Destination.Type)\n\tlog.Printf(\"%v Sync sets found:\\n\", len(config.SyncSets))\n\n\tfor i, syncSet := range config.SyncSets {\n\t\tlog.Printf(\" %v) %s\\n\", i+1, syncSet.Name)\n\t}\n\n\treturn config, nil\n}", "func (c *Configuration) Read(location string, headers []string, timeout time.Duration, encoded bool) error {\n\tr, err := Get(location, headers, timeout)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer r.Close()\n\n\tif encoded {\n\t\treturn json.NewDecoder(base64.NewDecoder(base64.StdEncoding, r)).Decode(c)\n\t}\n\n\treturn json.NewDecoder(r).Decode(c)\n}", "func ReadConfig(fileName string) (*Config, error) {\n\tvar config Config\n\n\tfile, err := os.Open(fileName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdecoder := json.NewDecoder(file)\n\n\terr = decoder.Decode(&config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &config, nil\n}", "func Config(d interface{}) *mapstructure.DecoderConfig {\n\treturn &mapstructure.DecoderConfig{\n\t\tDecodeHook: DecodeHook,\n\t\tResult: d,\n\t\tWeaklyTypedInput: true,\n\t}\n}", "func Deserialize(r io.Reader, dser Deserializer) error {\n\tbufreader := bufio.NewReader(r)\n\tbuf, err := bufreader.Peek(1)\n\tif err != nil && err != io.EOF {\n\t\treturn err\n\t}\n\tif err == io.EOF && len(buf) == 0 {\n\t\treturn nil\n\t}\n\tdec := json.NewDecoder(bufreader)\n\tdec.UseNumber()\n\ttoken := string(buf[0:1])\n\trunning := true\n\tfor running {\n\t\tswitch token {\n\t\tcase \"[\", \"{\":\n\t\t\t{\n\t\t\t\tif token == \"[\" {\n\t\t\t\t\t// advance the array token\n\t\t\t\t\tdec.Token()\n\t\t\t\t}\n\t\t\t\tvar line json.RawMessage\n\t\t\t\tfor dec.More() {\n\t\t\t\t\tif err := dec.Decode(&line); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\tif err := dser(line); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// consume the last token\n\t\t\t\tdec.Token()\n\t\t\t\t// check to see if we have more data in the buffer in case we\n\t\t\t\t// have concatenated streams together\n\t\t\t\trunning = dec.More()\n\t\t\t}\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"invalid json, expected either [ or {\")\n\t\t}\n\t}\n\treturn nil\n}", "func ReadConfig(configFlag string) Configuration {\n\tabsPath, errPath := filepath.Abs(configFlag)\n\tif errPath != nil {\n\t\tlog.Fatalf(\"abspath error %v\", absPath)\n\t\tpanic(errPath)\n\t}\n\tlog.Printf(\"[DEBUG] absPath:: %v \", absPath)\n\tconfigFile, err := ioutil.ReadFile(absPath)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdata := Configuration{}\n\tjsonErr := json.Unmarshal([]byte(configFile), &data)\n\tif jsonErr != nil {\n\t\tpanic(jsonErr)\n\t}\n\treturn data\n}", "func (c *Config) Unmarshal(r io.Reader, values map[string]string) error {\n\ty, err := ioutil.ReadAll(r)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ty, err = c.interpolate(y, values)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := yaml.Unmarshal(y, &c); err != nil {\n\t\treturn err\n\t}\n\n\tif err := yaml.Unmarshal(y, &c.Config); err != nil {\n\t\treturn err\n\t}\n\n\treturn c.loadLocalFiles()\n}", "func ToInterface(reader io.Reader) (interface{}, error) {\n\tvar result interface{}\n\tdecoder := json.NewDecoder(reader)\n\tfor {\n\t\terr := decoder.Decode(&result)\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t} else if err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif result == nil {\n\t\treturn map[string]interface{}{}, nil\n\t}\n\treturn result, nil\n}", "func (m *Config) UnmarshalJSON(b []byte) error {\n\treturn ConfigJSONUnmarshaler.Unmarshal(bytes.NewReader(b), m)\n}", "func UnmarshalFromReader(r io.Reader, v Unmarshaler) error {\n\tdata, err := ioutil.ReadAll(r)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl := jlexer.Lexer{Data: data}\n\tv.UnmarshalTinyJSON(&l)\n\treturn l.Error()\n}", "func GetConfigFromJSON(configFile string) Config {\n\tvar config Config\n\tcontents, _ := ioutil.ReadFile(configFile)\n\tjson.Unmarshal(contents, &config)\n\tcheckSiteConfig(config)\n\treturn config\n}", "func JSONDecoder(d []byte, payload interface{}) error {\n\tif json.Valid(d) {\n\t\treturn json.Unmarshal(d, payload)\n\t}\n\n\terr := errors.New(\"invalid json format\")\n\treturn err\n}", "func FromReader(r io.Reader, f Unmarshaler) Option {\n\treturn func(c Config, m ...OptionMeta) error {\n\t\tbuf, err := ioutil.ReadAll(r)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn f(buf, c)\n\t}\n}", "func DecodeConfig(r io.Reader) (config image.Config, err error) {\n\treturn tiff.DecodeConfig(r)\n}", "func DecodeConfig(filename string) (*Config, error) {\n\tsrc, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfile, diags := hclsyntax.ParseConfig(src, filename, hcl.Pos{Line: 1, Column: 1})\n\tif diags.HasErrors() {\n\t\treturn nil, errors.WithMessage(diags, \"unable to parse configuration\")\n\t}\n\n\tvar config Config\n\n\tdiags = gohcl.DecodeBody(file.Body, nil, &config)\n\tif diags.HasErrors() {\n\t\treturn nil, errors.WithMessage(diags, \"unable to decode configuration\")\n\t}\n\n\treturn &config, nil\n}", "func Decode(r io.Reader) (image.Image, error) {\n\tc, err := DecodeConfig(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif c.ColorModel == color.RGBAModel {\n\t\treturn decodeRGBA(r, c)\n\t}\n\treturn decodePaletted(r, c)\n}", "func (c *configInitializer) parseConfig(configFile string) {\n\tfd, err := os.Open(configFile)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer fd.Close()\n\n\tcfgBytes, err := ioutil.ReadAll(fd)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\terr = json.Unmarshal([]byte(cfgBytes), c)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "func (o *Options) decodeConfig(data []byte) (*componentconfig.CoordinatorConfiguration, error) {\n\tvar config componentconfig.CoordinatorConfiguration\n\tif err := yaml.Unmarshal(data, &config); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &config, nil\n}", "func readJSON(r io.Reader, v interface{}) error {\n\tdecoder := json.NewDecoder(r)\n\terr := decoder.Decode(&v)\n\treturn err\n}", "func Decode(in string, obj interface{}) {\n\tb, err := base64.StdEncoding.DecodeString(in)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\terr = json.Unmarshal(b, obj)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "func Decode(in string, obj interface{}) {\n\tb, err := base64.StdEncoding.DecodeString(in)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\terr = json.Unmarshal(b, obj)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "func SettingDecodeJSON(configPath string) (*Setting, error) {\n\tpa := &Setting{}\n\tfile, err := os.Open(configPath + \"/SsrMicroConfig.json\")\n\tif err != nil {\n\t\treturn &Setting{}, err\n\t}\n\tif json.NewDecoder(file).Decode(&pa) != nil {\n\t\treturn &Setting{}, err\n\t}\n\treturn pa, nil\n}", "func NewConfig(r io.Reader) (*Config, error) {\n\tdec := json.NewDecoder(r)\n\tconfig := &Config{}\n\tif err := dec.Decode(config); err != nil {\n\t\treturn nil, fmt.Errorf(\"error parsing configuration. %v\", err)\n\t}\n\tif config.MQURL == \"\" {\n\t\tconfig.MQURL = \"amqp://guest:guest@localhost:5672/\"\n\t}\n\tif config.RedisURL == \"\" {\n\t\tconfig.RedisURL = \"localhost:6379\"\n\t}\n\treturn config, nil\n}", "func Decode(r io.Reader, val interface{}) error {\n\treturn NewStream(r, 0).Decode(val)\n}", "func DecodeFile(fileName string, object interface{}) error {\n\n\t//Open the config file\n\tfile, err := os.Open(fileName)\n\n\tif err != nil {\n\t\treturn errors.New(\"Could not open file: \" + err.Error())\n\t}\n\n\tjsonParser := json.NewDecoder(file)\n\terr = jsonParser.Decode(object)\n\n\tif err != nil {\n\t\treturn errors.New(\"Could not parse file: \" + err.Error())\n\t} else {\n\t\treturn nil\n\t}\n\n}", "func ReadConfig(configFile string) (*Config, error) {\n\tcontent, err := ioutil.ReadFile(configFile)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar cfg Config\n\terr = json.Unmarshal(content, &cfg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &cfg, nil\n}", "func (t *DescribeConfigsSynonym32) Decode(d *Decoder, version int16) error {\n\tvar err error\n\tif version >= 1 {\n\t\tt.Name, err = d.String()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif version >= 1 {\n\t\tt.Value, err = d.String()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif version >= 1 {\n\t\tt.Source, err = d.Int8()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn err\n}", "func ReadJSONConfig(path string) (*Config, error) {\n\tcontent, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = json.Unmarshal(content, &Settings)\n\treturn &Settings, err\n}", "func ReadConfig(conf *api.ConfigMap) config.Configuration {\n\tif len(conf.Data) == 0 {\n\t\treturn config.NewDefault()\n\t}\n\n\tvar errors []int\n\tvar skipUrls []string\n\tvar whitelist []string\n\n\tif val, ok := conf.Data[customHTTPErrors]; ok {\n\t\tdelete(conf.Data, customHTTPErrors)\n\t\tfor _, i := range strings.Split(val, \",\") {\n\t\t\tj, err := strconv.Atoi(i)\n\t\t\tif err != nil {\n\t\t\t\tglog.Warningf(\"%v is not a valid http code: %v\", i, err)\n\t\t\t} else {\n\t\t\t\terrors = append(errors, j)\n\t\t\t}\n\t\t}\n\t}\n\tif val, ok := conf.Data[skipAccessLogUrls]; ok {\n\t\tdelete(conf.Data, skipAccessLogUrls)\n\t\tskipUrls = strings.Split(val, \",\")\n\t}\n\tif val, ok := conf.Data[whitelistSourceRange]; ok {\n\t\tdelete(conf.Data, whitelistSourceRange)\n\t\twhitelist = append(whitelist, strings.Split(val, \",\")...)\n\t}\n\n\tto := config.Configuration{}\n\tto.Backend = defaults.Backend{\n\t\tCustomHTTPErrors: filterErrors(errors),\n\t\tSkipAccessLogURLs: skipUrls,\n\t\tWhitelistSourceRange: whitelist,\n\t}\n\tdef := config.NewDefault()\n\tif err := mergo.Merge(&to, def); err != nil {\n\t\tglog.Warningf(\"unexpected error merging defaults: %v\", err)\n\t}\n\n\tmetadata := &mapstructure.Metadata{}\n\tdecoder, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{\n\t\tTagName: \"structs\",\n\t\tResult: &to,\n\t\tWeaklyTypedInput: true,\n\t\tMetadata: metadata,\n\t})\n\n\terr = decoder.Decode(conf.Data)\n\tif err != nil {\n\t\tglog.Infof(\"%v\", err)\n\t}\n\treturn to\n}", "func (d *Decoder) DecodeConfig(rd io.Reader) (image.Config, string, error) {\n\timg, format, err := image.DecodeConfig(rd)\n\tif err != nil {\n\t\treturn image.Config{}, \"\", fmt.Errorf(\"imaging: failed to decode image config: %w\", err)\n\t}\n\treturn img, format, nil\n}", "func read(fileName string) (*Configuration, error) {\n\tif fileName == \"\" {\n\t\treturn Config, fmt.Errorf(\"Empty file name\")\n\t}\n\tfile, err := os.Open(fileName)\n\tif err != nil {\n\t\treturn Config, err\n\t}\n\tdecoder := json.NewDecoder(file)\n\terr = decoder.Decode(Config)\n\tif err == nil {\n\t\tlog.Infof(\"Read config: %s\", fileName)\n\t} else {\n\t\tlog.Fatal(\"Cannot read config file:\", fileName, err)\n\t}\n\tif err := Config.postReadAdjustments(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn Config, err\n}", "func (c *configuration) ParseJSON(b []byte) error {\n\treturn json.Unmarshal(b, &c)\n}", "func (c *configuration) ParseJSON(b []byte) error {\n\treturn json.Unmarshal(b, &c)\n}", "func DecodeConfig(cfg config.Provider) (Config, error) {\n\treturn decodeConfig(cfg, nil)\n}", "func readConfig() config {\n\tfile, err := ioutil.ReadFile(\"config.json\")\n\tif err != nil {\n\t\tlog.Fatalln(\"Error Opening Config File: \", err)\n\t}\n\tconfigData := config{}\n\n\terr = json.Unmarshal([]byte(file), &configData)\n\tif err != nil {\n\t\tlog.Fatalln(\"Error Parsing Config File: \", err)\n\t}\n\treturn configData\n}", "func (sc *ScrapeConfigs) UnmarshalJSON(b []byte) error {\n\n\tvar oneConfig ScrapeConfig\n\tif err := json.Unmarshal(b, &oneConfig); err == nil {\n\t\t*sc = ScrapeConfigs{oneConfig}\n\t\treturn nil\n\t}\n\tvar multiConfigs []ScrapeConfig\n\tif err := json.Unmarshal(b, &multiConfigs); err == nil {\n\t\t*sc = multiConfigs\n\t\treturn nil\n\t} else {\n\t\tfmt.Println(err)\n\t\tfmt.Println(\"Badly formatted YAML: Exiting\")\n\t\tos.Exit(1)\n\t}\n\treturn nil\n}", "func Decode(in string, obj interface{}) error {\n\tb, err := base64.StdEncoding.DecodeString(in)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = json.Unmarshal(b, obj)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}" ]
[ "0.75166684", "0.72525275", "0.7091825", "0.7091825", "0.6939722", "0.678688", "0.67070913", "0.6704477", "0.6701318", "0.6683374", "0.6624985", "0.659001", "0.6556962", "0.65211815", "0.64834213", "0.6456152", "0.64005786", "0.6398293", "0.6376402", "0.636369", "0.63567805", "0.63516057", "0.6279525", "0.6270761", "0.62632656", "0.6221661", "0.6199335", "0.61964315", "0.619065", "0.6172122", "0.6155797", "0.61395204", "0.61391145", "0.6111847", "0.61047506", "0.60986406", "0.60953426", "0.6085643", "0.60624355", "0.6036054", "0.60323876", "0.6031507", "0.6002959", "0.60027486", "0.5948125", "0.5929093", "0.59213185", "0.5896992", "0.5896886", "0.58901864", "0.5880313", "0.5876492", "0.5875491", "0.58741915", "0.5829961", "0.5822518", "0.5820268", "0.58005476", "0.57973385", "0.57867295", "0.57804143", "0.5770497", "0.5770213", "0.5768477", "0.57679456", "0.5766991", "0.5759242", "0.5734838", "0.5729056", "0.5722316", "0.570455", "0.5699117", "0.56981033", "0.5692913", "0.5690809", "0.5677783", "0.5675337", "0.5665121", "0.5664605", "0.56487674", "0.5643661", "0.5640479", "0.5634181", "0.5634181", "0.5629615", "0.5629494", "0.5624757", "0.5621932", "0.5618983", "0.5610409", "0.5607489", "0.560695", "0.5603302", "0.55943877", "0.5591487", "0.5591487", "0.55898875", "0.5588134", "0.55878127", "0.5583884" ]
0.79839295
0
error records that an error occurred. It returns only the first error, so that an error caused by an earlier error does not discard information about the earlier error.
func (r *objReader) error(err error) error { if r.err == nil { if err == io.EOF { err = io.ErrUnexpectedEOF } r.err = err } // panic("corrupt") // useful for debugging return r.err }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (cl *Client) getError(err1 error) error {\n\tselect {\n\tcase err0 := <-cl.error:\n\t\treturn err0\n\tdefault:\n\t\treturn err1\n\t}\n}", "func multiError(errs []error) error {\n\tfor _, err := range errs {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (rs ProduceResults) FirstErr() error {\n\tfor _, r := range rs {\n\t\tif r.Err != nil {\n\t\t\treturn r.Err\n\t\t}\n\t}\n\treturn nil\n}", "func First(errors ...error) error {\n\tfor _, err := range errors {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func (api *API) readError(c echo.Context, err error) *echo.HTTPError {\n\tapi.systemMetrics.Inc(metrics.Error, 1)\n\tgm := c.Get(\"gm\") // DO NOT cast .(metrics.Metrics), only use maybeInc()\n\tswitch v := err.(type) {\n\tcase etre.Error:\n\t\tmaybeInc(metrics.ClientError, 1, gm)\n\t\treturn echo.NewHTTPError(v.HTTPStatus, err)\n\tcase entity.ValidationError:\n\t\tmaybeInc(metrics.ClientError, 1, gm)\n\t\tetreError := etre.Error{\n\t\t\tMessage: v.Err.Error(),\n\t\t\tType: v.Type,\n\t\t\tHTTPStatus: http.StatusBadRequest,\n\t\t}\n\t\treturn echo.NewHTTPError(etreError.HTTPStatus, etreError)\n\tcase auth.Error:\n\t\t// Metric incremented by caller\n\t\tetreError := etre.Error{\n\t\t\tMessage: v.Err.Error(),\n\t\t\tType: v.Type,\n\t\t\tHTTPStatus: v.HTTPStatus,\n\t\t}\n\t\treturn echo.NewHTTPError(etreError.HTTPStatus, etreError)\n\tcase entity.DbError:\n\t\tdbErr := err.(entity.DbError)\n\t\tif dbErr.Err == context.DeadlineExceeded {\n\t\t\tmaybeInc(metrics.QueryTimeout, 1, gm)\n\t\t} else {\n\t\t\tlog.Printf(\"DATABASE ERROR: %v\", dbErr)\n\t\t\tmaybeInc(metrics.DbError, 1, gm)\n\t\t}\n\t\tetreError := etre.Error{\n\t\t\tMessage: dbErr.Error(),\n\t\t\tType: dbErr.Type,\n\t\t\tHTTPStatus: http.StatusServiceUnavailable,\n\t\t\tEntityId: dbErr.EntityId,\n\t\t}\n\t\treturn echo.NewHTTPError(etreError.HTTPStatus, etreError)\n\tdefault:\n\t\tlog.Printf(\"API ERROR: %v\", err)\n\t\tmaybeInc(metrics.APIError, 1, gm)\n\t\treturn echo.NewHTTPError(http.StatusInternalServerError, err)\n\t}\n}", "func (l Log) error(path string, file *os.File) (Log, error) {\n\tl.EndTime = time.Now()\n\tl.Status = \"Error\"\n\treturn l, l.saveAndWriteToLog(path, file, \"Error\")\n}", "func (s *Syncer) mostRecentError() (err error) {\n\treturn *((*error)(atomic.LoadPointer(&s.lastError)))\n}", "func (a errorMsgs) Last() *Error {\n\tif length := len(a); length > 0 {\n\t\treturn a[length-1]\n\t}\n\treturn nil\n}", "func (s *spec) error(current Index, signal Signal) (next Index, err error) {\n\tstate, has := s.states[current]\n\tif !has {\n\t\terr = ErrUnknownState{spec: s, Index: current}\n\t\treturn\n\t}\n\n\t_, has = s.signals[signal]\n\tif !has {\n\t\terr = ErrUnknownSignal{Signal: signal, Index: current}\n\t\treturn\n\t}\n\n\tv, has := state.Errors[signal]\n\tif !has {\n\t\terr = ErrUnknownTransition{Signal: signal, State: current}\n\t\treturn\n\t}\n\tnext = v\n\treturn\n}", "func (e Error) Error() (s string) {\n\tif len(e) == 1 {\n\t\tfor _, err := range e {\n\t\t\treturn err.Error()\n\t\t}\n\t}\n\n\tfor name, err := range e {\n\t\ts += fmt.Sprintf(\"\\n%v:\\t%s\", name, err.Error())\n\t}\n\treturn s\n}", "func getError() error{\n\treturn errors.New(\"Something Went Whrong\")\n}", "func (err *apiErr) err() error {\n\tvar msgs strings.Builder\n\n\tfor i := 0; i < len(err.Errors); i++ {\n\t\tmsgs.WriteString(fmt.Sprintf(\"Code: %d, Message: %s; \", err.Errors[i].Code, err.Errors[i].Message))\n\t}\n\n\treturn fmt.Errorf(msgs.String())\n}", "func (F *Frisby) Error() error {\n\treturn F.Errs[len(F.Errs)-1]\n}", "func (cx *Context) getError(filename string) (err error) {\n\terr = cx.err\n\tcx.err = nil\n\treturn err\n}", "func GetErr(key string) (interface{}, error) { return c.GetErr(key) }", "func (r *Result) Error() string {\n return r.data.Error\n}", "func errpair(first, second error) error {\n\tif first == nil || second == nil {\n\t\tif first != nil { // should check the first error first\n\t\t\treturn first\n\t\t}\n\t\treturn second\n\t}\n\treturn &errorpair{first, second}\n}", "func (p List) Error() string {\n\tswitch len(p) {\n\tcase 0:\n\t\treturn \"no errors\"\n\tcase 1:\n\t\treturn p[0].Error()\n\t}\n\treturn fmt.Sprintf(\"%s (and %d more errors)\", p[0], len(p)-1)\n}", "func (o Output) Error() *OutputLine {\n\tfor _, out := range o {\n\t\tif out.Type == ERROR_EXIT {\n\t\t\treturn &out\n\t\t}\n\t}\n\treturn nil\n}", "func (ec *ErrorCollection) addError(err error) {\n\t\n\tif err == nil {\n\t\treturn\n\t}\n\t\n\tif ec.DuplicatationOptions != AllowDuplicates {\n\t\t//Don't append if err is a duplicate\n\t\tfor i, containedErr := range ec.Errors {\n\n\t\t\tvar je1 *JE\n\t\t\tvar je2 *JE\n\n\t\t\ts, ok := err.(JE)\n\t\t\tif ok {\n\t\t\t\tje1 = &s\n\t\t\t} else {\n\t\t\t\ts, ok := err.(*JE)\n\t\t\t\tif ok {\n\t\t\t\t\tje1 = s\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t_, ok = containedErr.(JE)\n\t\t\tif ok {\n\t\t\t\tt := (ec.Errors[i]).(JE)\n\t\t\t\tje2 = &t\n\t\t\t} else {\n\t\t\t\t_, ok := containedErr.(*JE)\n\t\t\t\tif ok {\n\t\t\t\t\tje2 = (ec.Errors[i]).(*JE)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif je1 != nil && je2 != nil {\n\t\t\t\t//Don't use Reflection since both are JE structs\n\t\t\t\tif (*je1).Code == (*je2).Code && (*je1).Domain == (*je2).Domain && (*je1).error == (*je2).error && (*je1).message == (*je2).message {\n\t\t\t\t\tif ec.DuplicatationOptions == RejectDuplicates {\n\t\t\t\t\t\tif (*je1).time.Equal((*je2).time) {\n\t\t\t\t\t\t\t//Both JE structs are 100% identical including timestamp\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t//We don't care about timestamps\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t//Use Reflection\n\t\t\t\tif reflect.DeepEqual(containedErr, err) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tec.Errors = append(ec.Errors, err)\n}", "func (u *multiuploader) geterr() error {\n\tu.m.Lock()\n\tdefer u.m.Unlock()\n\n\treturn u.err\n}", "func (i *ImageInput) LastError() error {\n\tc_str := C.ImageInput_geterror(i.ptr)\n\truntime.KeepAlive(i)\n\tif c_str == nil {\n\t\treturn nil\n\t}\n\terr := C.GoString(c_str)\n\tC.free(unsafe.Pointer(c_str))\n\tif err == \"\" {\n\t\treturn nil\n\t}\n\treturn errors.New(err)\n}", "func (ec *QueryErrorCollector) Error() string {\n\tec.m.RLock()\n\tdefer ec.m.RUnlock()\n\n\tvar sb strings.Builder\n\tif len(ec.errors) > 0 {\n\t\tsb.WriteString(\"Error Collection:\\n\")\n\t\tfor i, e := range ec.errors {\n\t\t\tsb.WriteString(fmt.Sprintf(\"%d) %s\\n\", i, e))\n\t\t}\n\t}\n\tif len(ec.warnings) > 0 {\n\t\tsb.WriteString(\"Warning Collection:\\n\")\n\t\tfor _, w := range ec.warnings {\n\t\t\tsb.WriteString(w.String())\n\t\t}\n\t}\n\n\treturn sb.String()\n}", "func (l *Logger) ERRORok() (LogFunc, bool) { return l.error, l.Does(syslog.LOG_ERROR) }", "func mark_error(){\nhistory= error_message\n}", "func (c *Context) error(status int, err string) {\n\tc.status(status)\n\tc.f.Error(err, status)\n}", "func (e modelerror) Error() string {\n\treturn string(e)\n}", "func (l *lex) error(format string, args ...interface{}) stateFunction {\n\tmsg := fmt.Sprintf(format, args...)\n\tif l.width > 0 {\n\t\tmsg = fmt.Sprintf(\"in position %d got %s\", l.position, msg)\n\t}\n\tl.tokens <- token{\n\t\tTokenType: tokenError,\n\t\tposition: l.start,\n\t\tvalue: msg,\n\t}\n\treturn nil\n}", "func addErr(prev error, err error) error {\n\tif prev == nil {\n\t\treturn err\n\t} else {\n\t\treturn fmt.Errorf(\"%v also\\n%v\", prev, err)\n\t}\n}", "func (c CalculationError) Error() string {\n\treturn fmt.Sprintf(\"%s: %s\", c.ts.Format(time.RFC3339), c.msg)\n}", "func (e IDDuplicateError) Error() string {\n\treturn fmt.Sprintf(\"the id '%s' is already known\", e.id)\n}", "func (ec *EventsCache) error(destinationId, eventId string, errMsg string) {\n\tif eventId == \"\" {\n\t\tlogging.SystemErrorf(\"[EventsCache] Error(): Event id can't be empty. Destination [%s]\", destinationId)\n\t\treturn\n\t}\n\n\terr := ec.storage.UpdateErrorEvent(destinationId, eventId, errMsg)\n\tif err != nil {\n\t\tlogging.SystemErrorf(\"[%s] Error updating error event [%s] in cache: %v\", destinationId, eventId, err)\n\t\treturn\n\t}\n}", "func (a *Archiver) LastErr() error {\n\ta.fatalMtx.RLock()\n\tdefer a.fatalMtx.RUnlock()\n\treturn a.fatalErr\n}", "func (cl *Client) setError(err error) {\n\tdefer cl.Close()\n\tdefer cl.setStatus(StatusError)\n\n\tif len(cl.error) > 0 {\n\t\treturn\n\t}\n\t// If we're in a race between two calls to this function,\n\t// trying to set the \"first\" error, just arbitrarily let one\n\t// of them win.\n\tselect {\n\tcase cl.error <- err:\n\tdefault:\n\t}\n}", "func (l *lexer) errorf(format string, args ...interface{}) stateFn {\n\tl.items <- item{\n\t\ttyp: itemError,\n\t\terr: fmt.Sprintf(format, args...) + fmt.Sprintf(\", pos : %d\", l.pos),\n\t}\n\treturn nil\n}", "func (a *Api) validateError() (err error) {\n\tif a.UserID == 0 {\n\t\treturn a.Errors(ErrorMissingValue, \"user_id\")\n\t}\n\n\tif a.Token == \"\" {\n\t\treturn a.Errors(ErrorMissingValue, \"token\")\n\t}\n\n\treturn\n}", "func (e *HRError) Error() string {\n\treturn e.error.Error()\n}", "func (r *result) Error(url string) {\n\tr.mux.Lock()\n\tr.Errors[url] = true\n\tr.give(url)\n\tr.mux.Unlock()\n}", "func errTop(err error) error {\n\tfor e := err; e != nil; {\n\t\tswitch e.(type) {\n\t\tcase ignore:\n\t\t\treturn nil\n\t\tcase causer:\n\t\t\te = e.(causer).Cause()\n\t\tdefault:\n\t\t\treturn e\n\t\t}\n\t}\n\n\treturn nil\n}", "func duplicateErr(in error, count int) []error {\n\tout := make([]error, count)\n\tfor i := range out {\n\t\tout[i] = in\n\t}\n\treturn out\n}", "func (s *htmlState) err(e error) {\n\ts.errors = append(s.errors, PosError{Err: e, Line: s.line})\n}", "func (err *Err) Error() string {\n\tbuf := bytes.NewBufferString(\"[\" + err.ID.String() + \"] \" +\n\t\thttp.StatusText(err.StatusHTTP) + \" \" +\n\t\terr.Message)\n\tif len(err.Details) > 0 {\n\t\tbuf.WriteString(\": \")\n\t\tbuf.WriteString(strings.Join(err.Details, \"; \"))\n\t}\n\tif len(err.Fields) > 0 {\n\t\tbuf.WriteString(\": \")\n\t\tvar fields []string\n\t\tfor name, value := range err.Fields {\n\t\t\tfields = append(fields, name+\"=\"+strconv.QuoteToASCII(value))\n\t\t}\n\t\tbuf.WriteString(strings.Join(fields, \", \"))\n\t}\n\treturn buf.String()\n}", "func (l *lexer) errorf(format string, args ...interface{}) stateFn {\n\tl.items <- item{itemError, l.start, fmt.Sprintf(format, args...), l.startLine}\n\treturn nil\n}", "func (e *ErrMoreThanOneNodePool) Error() string {\n\treturn fmt.Sprintf(\"the %s field specifies more than one node pool; this is not currently allowed\", e.field)\n}", "func summaryPrintError(summaryError, originalError error) error {\n\tif originalError != nil {\n\t\tif summaryError != nil {\n\t\t\tlog.Error(summaryError)\n\t\t}\n\t\treturn originalError\n\t}\n\treturn summaryError\n}", "func (e *errorMixin) resetError() {\n\te.once = &sync.Once{}\n\te.wg = &sync.WaitGroup{}\n\te.wg.Add(1)\n}", "func (e MyOtherError) Error() string {\n\treturn e.Message\n}", "func (err *BatchError) OrigErr() error {\n\treturn err.Errors\n}", "func (rs *SessionResultSet) Err() error {\n\treturn rs.lastErr\n}", "func (e *withDomain) Error() string { return e.cause.Error() }", "func (imf *ImprFloat) GetLastErr() error {\n\terr := imf.err\n\timf.err = nil\n\treturn err\n}", "func (e *multiErr) errOrNil() error {\n\tif len(e.errs) == 0 {\n\t\treturn nil\n\t}\n\treturn e\n}", "func (e errorString) Error() string {\n\treturn string(e)\n}", "func (e errorString) Error() string {\n\treturn string(e)\n}", "func e(err error) int {\n\tlog.Println(err)\n\tfmt.Println(err)\n\treturn 1\n}", "func (p ErrorList) Err() error {}", "func (e *errorT) Error() string {\n\treturn fmt.Sprintf(\"%v\", e)\n}", "func (t reqInfo) Rerror(format string, args ...interface{}) {\n\tt.session.unhandled = false\n\tif t.session.conn.clearTag(t.tag) {\n\t\tt.session.conn.Rerror(t.tag, format, args...)\n\t}\n}", "func getCodedError() (int, error){\n\treturn 0, errors.New(\"Something Went Whrong\")\n}", "func returnError(a, b int) error {\n\tif a == b {\n\t\terr := errors.New(\"this is the error creating by errors.new\")\n\t\treturn err\n\t} else {\n\t\treturn nil\n\t}\n\n}", "func (e ErrorMessage) Error() string {\n\treturn fmt.Sprintf(\"returned status code => %d\", e.StatusCode)\n}", "func (l *lexer) err(e string) {\n\tl.errors = append(l.errors, e)\n}", "func (e VertexDuplicateError) Error() string {\n\treturn fmt.Sprintf(\"'%v' is already known\", e.v)\n}", "func flusherrors() {\n\tCtxt.Bso.Flush()\n\tif len(errors) == 0 {\n\t\treturn\n\t}\n\tsort.Stable(byPos(errors))\n\tfor i, err := range errors {\n\t\tif i == 0 || err.msg != errors[i-1].msg {\n\t\t\tfmt.Printf(\"%s\", err.msg)\n\t\t}\n\t}\n\terrors = errors[:0]\n}", "func regress1(x error) func() string {\n\treturn x.Error\n}", "func (i *ImageBuf) LastError() error {\n\tc_str := C.ImageBuf_geterror(i.ptr)\n\tif c_str == nil {\n\t\treturn nil\n\t}\n\truntime.KeepAlive(i)\n\terr := C.GoString(c_str)\n\tC.free(unsafe.Pointer(c_str))\n\tif err == \"\" {\n\t\treturn nil\n\t}\n\treturn errors.New(err)\n}", "func (l *lexer) errorf(format string, args ...interface{}) stateFn {\n\tl.items <- item{tokenError, fmt.Sprintf(format, args...), l.start}\n\treturn nil\n}", "func (l *lexer) errorf(format string, args ...interface{}) stateFn {\n\tl.items <- item{itemError, l.start, fmt.Sprintf(format, args...)}\n\treturn nil\n}", "func (l *lexer) errorf(format string, args ...interface{}) stateFn {\n\tl.items <- item{itemError, l.start, fmt.Sprintf(format, args...)}\n\treturn nil\n}", "func (l *lexer) errorf(format string, args ...interface{}) stateFn {\n\tl.items <- item{itemError, l.start, fmt.Sprintf(format, args...)}\n\treturn nil\n}", "func (l *reader) errorf(format string, args ...interface{}) stateFn {\n\tl.items <- item{itemError, fmt.Sprintf(format, args...)}\n\treturn nil\n}", "func lookErr(err error) error {\n\tif err != nil && err != io.EOF {\n\t\tklog.Warning(err)\n\t}\n\treturn err\n}", "func (l *lexer) errorf(format string, args ...interface{}) stateFn {\n\tl.items <- item{itemError, l.pos, fmt.Sprintf(format, args...)}\n\treturn nil\n}", "func (s *scanner) error(c byte, context string) int {\n\ts.step = stateError\n\ts.err = &SyntaxError{\"invalid character \" + quoteChar(c) + \" \" + context, s.bytes}\n\treturn scanError\n}", "func (x Response_Err) Error() string {\n\treturn x.String()\n}", "func (e *Error) Errors() []error {\n\treturn e.errors\n}", "func (p *parser) error(off int, msg string) {\n\tp.err = scanner.Error{\n\t\tPosition: p.file.Position(off),\n\t\tMessage: msg,\n\t}\n\tpanic(bailout{})\n}", "func AddLastErr(source, msg string) {\n\tlastErrorVec.WithLabelValues(source, msg).Set(float64(time.Now().Unix()))\n\tlastErrorCountVec.WithLabelValues(source).Inc()\n\n\tif atomic.AddInt64(&lastErrorCount, int64(1))%MaxLastErrorCount == 0 { // clean\n\t\tResetLastErrors()\n\t}\n}", "func handleError(message string, listOfErrors ...error) error {\n\tvar errSlice []string\n\tfor _, e := range listOfErrors {\n\t\tif e != nil {\n\t\t\terrSlice = append(errSlice, e.Error())\n\t\t}\n\t}\n\treturn fmt.Errorf(\"errors: %s, msg: %s\", strings.Join(errSlice, \", \"), message)\n}", "func (p *Parser) itemError(item Item, details error) {\n\tp.pushError(p.errorCtx(item), details)\n}", "func internalError(err error) *httpRetMsg {\n\tfmt.Fprintf(os.Stderr, \"ERROR: %+v\\n\", err)\n\treturn &httpRetMsg{code: http.StatusInternalServerError}\n}", "func checkError(err error) error {\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"Error \", err.Error())\n\t\treturn err\n\t}\n\treturn nil\n}", "func checkError(err error) error {\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"Error \", err.Error())\n\t\treturn err\n\t}\n\treturn nil\n}", "func checkError(err error) error {\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"Error \", err.Error())\n\t\treturn err\n\t}\n\treturn nil\n}", "func (lex *Lexer) LatestErr() error {\n\treturn lex.scanErr\n}", "func formatError(err error, stdErr string) error {\n\tparts := strings.Split(strings.TrimSuffix(stdErr, \"\\n\"), \"\\n\")\n\tif len(parts) > 1 {\n\t\treturn errors.New(strings.Join(parts[1:], \" \"))\n\t}\n\treturn err\n}", "func (e *multiErr) append(err error) {\n\t// Do not use errors.As here, this should only be flattened one layer. If\n\t// there is a *multiErr several steps down the chain, all the errors above\n\t// it will be discarded if errors.As is used instead.\n\tswitch other := err.(type) {\n\tcase *multiErr:\n\t\t// Flatten err errors into e.\n\t\te.errs = append(e.errs, other.errs...)\n\tdefault:\n\t\te.errs = append(e.errs, err)\n\t}\n}", "func (s *outputs) stderr() *bytes.Buffer {\n\treturn s.err\n}", "func (l *lexer) errorf(format string, args ...interface{}) stateFn {\n\tl.items <- item{itemError, fmt.Sprintf(format, args...)}\n\treturn nil\n}", "func (l *lexer) errorf(format string, args ...interface{}) stateFn {\n\tl.items <- item{itemError, fmt.Sprintf(format, args...)}\n\treturn nil\n}", "func getHTTPErr(err error) *httpErr {\n\tif err == nil {\n\t\treturn nil\n\t}\n\ttype causer interface {\n\t\tCause() error\n\t}\n\tcurErr := err\n\tfor curErr != nil {\n\t\tswitch curErr.(type) {\n\t\tcase *httpErr:\n\t\t\treturn curErr.(*httpErr)\n\t\tcase causer:\n\t\t\tcurErr = curErr.(causer).Cause()\n\t\tdefault:\n\t\t\treturn createHTTPErr(500, ErrUnknown, err.Error())\n\t\t}\n\t}\n\treturn createHTTPErr(500, ErrUnknown, \"nil error\")\n}", "func (e *Error) Error() string {\n\ts := \"[Error\"\n\tif e.Sender != \"\" {\n\t\ts += \" (where: \" + e.Sender + \")\"\n\t}\n\tif e.Filename != \"\" {\n\t\ts += \" in \" + e.Filename\n\t}\n\tif e.Line > 0 {\n\t\ts += fmt.Sprintf(\" | Line %d Col %d\", e.Line, e.Column)\n\t\tif e.Token != nil {\n\t\t\ts += fmt.Sprintf(\" near '%s'\", e.Token.Val)\n\t\t}\n\t}\n\ts += \"] \"\n\ts += e.OrigError.Error()\n\treturn s\n}", "func (e Err) Error() string {\n\treturn fmt.Sprintf(\"%s : %s \", e.Code, e.Message)\n}", "func getErrorText(err error, message string) string {\n\tfor _, err := range err.(validator.ValidationErrors) {\n\t\tmessage += \"Field \" + err.Field() + \" with value \" + fmt.Sprintf(\"%v\", err.Value()) + \" failed \" + err.Tag() + \" tag validation. \"\n\t}\n\treturn message\n}", "func (o LookupJobResultOutput) Error() StatusResponseOutput {\n\treturn o.ApplyT(func(v LookupJobResult) StatusResponse { return v.Error }).(StatusResponseOutput)\n}", "func (a *Api) errorReport(c *gin.Context) {\n\tdecoder := json.NewDecoder(c.Request.Body)\n\tdefer c.Request.Body.Close()\n\tde := &model.DeviceErrorDto{}\n\terr := decoder.Decode(&de)\n\tif err != nil {\n\t\tinternalError(c, \"marshalling error\",\n\t\t\t\"marshalling error \"+err.Error())\n\t}\n\tif err = a.ms.RegisterError(de); err != nil {\n\t\tinternalError(c, \"database error\",\n\t\t\t\"database error \"+err.Error())\n\t}\n\tc.JSON(http.StatusOK, gin.H{\"message\": \"Error registered\"})\n}", "func (c *Computation) Err() error {\n\tc.errMutex.RLock()\n\tdefer c.errMutex.RUnlock()\n\n\treturn c.lastError\n}", "func (l *lexer) errorf(format string, args ...interface{}) stateFn {\n\tl.items <- token{tokenError, l.start, fmt.Sprintf(format, args...)}\n\treturn nil\n}", "func (e Response_LastValidationError) Cause() error { return e.cause }" ]
[ "0.64326537", "0.63776475", "0.6347376", "0.6272243", "0.6184702", "0.6182497", "0.61790156", "0.61504", "0.6087075", "0.6069312", "0.60614616", "0.60270935", "0.60132986", "0.59665596", "0.59606916", "0.59558123", "0.5936287", "0.5876932", "0.5856185", "0.58526677", "0.58375126", "0.5835715", "0.58276933", "0.5766705", "0.57295656", "0.5722798", "0.56839544", "0.56783813", "0.56746185", "0.5664266", "0.5640838", "0.5636882", "0.5617291", "0.5601467", "0.55911577", "0.55842245", "0.55601984", "0.5548924", "0.5547243", "0.55452305", "0.5540372", "0.55333257", "0.55272394", "0.5519163", "0.5513267", "0.5511582", "0.54967684", "0.5491868", "0.54831696", "0.547797", "0.5469822", "0.5461086", "0.5460066", "0.5460066", "0.54595447", "0.5459082", "0.54426134", "0.5442354", "0.5439617", "0.5438793", "0.5437224", "0.5436578", "0.5428913", "0.54253465", "0.5419026", "0.54160666", "0.5414043", "0.54080564", "0.54080564", "0.54080564", "0.5398348", "0.5397817", "0.5397743", "0.53877646", "0.5385998", "0.5384596", "0.5384334", "0.5382244", "0.5380025", "0.5377333", "0.53705245", "0.5367421", "0.5367421", "0.5367421", "0.5358204", "0.53551173", "0.5352255", "0.53517836", "0.5351463", "0.5351463", "0.53476536", "0.5341419", "0.5340868", "0.5338327", "0.53277326", "0.5317786", "0.5317184", "0.53142357", "0.5309423" ]
0.54369754
62
peek returns the next n bytes without advancing the reader.
func (r *objReader) peek(n int) ([]byte, error) { if r.err != nil { return nil, r.err } if r.offset >= r.limit { r.error(io.ErrUnexpectedEOF) return nil, r.err } b, err := r.b.Peek(n) if err != nil { if err != bufio.ErrBufferFull { r.error(err) } } return b, err }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (src *Source) PeekN(n int) []byte {\n\tif n <= len(src.current) {\n\t\treturn src.current[:n]\n\t}\n\tif src.reader == nil {\n\t\treturn src.current\n\t}\n\tsrc.StoreSavepoint()\n\tpeeked := src.ReadN(n)\n\tsrc.RollbackToSavepoint()\n\treturn peeked\n}", "func (r *ObjectsListingXact) peekN(n uint) (result []*cmn.BucketEntry, err error) {\n\tif len(r.buff) >= int(n) && n != 0 {\n\t\treturn r.buff[:n], nil\n\t}\n\n\tfor len(r.buff) < int(n) || n == 0 {\n\t\tres, ok := <-r.resultCh\n\t\tif !ok {\n\t\t\terr = io.EOF\n\t\t\tbreak\n\t\t}\n\t\tif res.err != nil {\n\t\t\terr = res.err\n\t\t\tbreak\n\t\t}\n\t\tr.buff = append(r.buff, res.entry)\n\t}\n\n\tsize := cos.Min(int(n), len(r.buff))\n\tif size == 0 {\n\t\tsize = len(r.buff)\n\t}\n\treturn r.buff[:size], err\n}", "func (s *Scanner) peek(n int) rune {\n\tif len(s.peekRunes) >= n {\n\t\treturn s.peekRunes[n-1]\n\t}\n\n\tp := s.nextRune()\n\ts.peekRunes = append(s.peekRunes, p)\n\n\treturn p\n}", "func (b *defaultByteBuffer) Peek(n int) (buf []byte, err error) {\n\tif b.status&BitReadable == 0 {\n\t\treturn nil, errors.New(\"unreadable buffer, cannot support Peek\")\n\t}\n\tif err = b.readableCheck(n); err != nil {\n\t\treturn nil, err\n\t}\n\treturn b.buff[b.readIdx : b.readIdx+n], nil\n}", "func (q *BytesQueue) peek(index int) ([]byte, int, error) {\n\terr := q.peekCheckErr(index)\n\tif err != nil {\n\t\treturn nil, 0, err\n\t}\n\n\tblockSize, n := binary.Uvarint(q.array[index:])\n\treturn q.array[index+n : index+int(blockSize)], int(blockSize), nil\n}", "func (r *reader) peek() byte {\n\tif r.eof() {\n\t\treturn 0\n\t}\n\treturn r.s[r.p.Offset]\n}", "func (b *QueueBuffer) Next(n int) []byte {\n\tif x := len(*b) - n; x >= 0 {\n\t\tp := make([]byte, n)\n\t\tcopy(p, (*b)[x:])\n\t\t*b = (*b)[:x]\n\t\treturn p\n\t}\n\tp := *b\n\t*b = nil\n\treturn p\n}", "func (d *Decoder) readN(n int) []byte {\n\tif buf, ok := d.r.(*bytes.Buffer); ok {\n\t\tb := buf.Next(n)\n\t\tif len(b) != n {\n\t\t\tpanic(io.ErrUnexpectedEOF)\n\t\t}\n\t\tif d.n += n; d.n > MaxObjectSize {\n\t\t\tbuild.Critical(ErrObjectTooLarge)\n\t\t}\n\t\treturn b\n\t}\n\tb := make([]byte, n)\n\t_, err := io.ReadFull(d, b)\n\tif err != nil {\n\t\tbuild.Critical(err)\n\t}\n\treturn b\n}", "func (b *defaultByteBuffer) Next(n int) (buf []byte, err error) {\n\tif b.status&BitReadable == 0 {\n\t\treturn nil, errors.New(\"unreadable buffer, cannot support Next\")\n\t}\n\tbuf, err = b.Peek(n)\n\tb.readIdx += n\n\treturn buf, err\n}", "func consume(in []byte, n int) (out, data []byte, err error) {\n\tif n < 0 || len(in) < n {\n\t\treturn nil, nil, bufferTooSmall\n\t}\n\treturn in[n:], in[:n], nil\n}", "func (p *Stream) peekSkip() (int, byte) {\n\top := p.readFrame[p.readIndex]\n\tif skip := readSkipArray[op]; skip > 0 && p.CanRead() {\n\t\treturn skip, op\n\t} else if skip < 0 {\n\t\treturn 0, op\n\t} else if p.isSafetyReadNBytesInCurrentFrame(5) {\n\t\tb := p.readFrame[p.readIndex:]\n\t\treturn int(uint32(b[1]) |\n\t\t\t(uint32(b[2]) << 8) |\n\t\t\t(uint32(b[3]) << 16) |\n\t\t\t(uint32(b[4]) << 24)), op\n\t} else if p.hasNBytesToRead(5) {\n\t\tb := p.peekNBytesCrossFrameUnsafe(5)\n\t\treturn int(uint32(b[1]) |\n\t\t\t(uint32(b[2]) << 8) |\n\t\t\t(uint32(b[3]) << 16) |\n\t\t\t(uint32(b[4]) << 24)), op\n\t} else {\n\t\treturn 0, op\n\t}\n}", "func (c *RingBuffer) peek(p []byte) (int, error) {\n\tif c.len == 0 && c.closed {\n\t\treturn 0, io.EOF\n\t}\n\tl := len(p)\n\tif l > c.len {\n\t\tl = c.len\n\t}\n\tn := 0\n\tleftBeforeEnd := len(c.buf) - c.index\n\tif l < leftBeforeEnd {\n\t\tn = copy(p, c.buf[c.index:c.index+l])\n\t} else {\n\t\tn = copy(p, c.buf[c.index:])\n\t\tn += copy(p[n:], c.buf[:l-n])\n\t}\n\treturn n, nil\n}", "func (b *defaultByteBuffer) Skip(n int) (err error) {\n\tif b.status&BitReadable == 0 {\n\t\treturn errors.New(\"unreadable buffer, cannot support Skip\")\n\t}\n\tif err = b.readableCheck(n); err != nil {\n\t\treturn err\n\t}\n\tb.readIdx += n\n\treturn nil\n}", "func (deck *Deck) Peek(n int) []cards.Card {\n\tbaseLength := len(deck.cards)\n\n\tif n < 1 {\n\t\tpanic(cards.ErrDealBadCount)\n\t} else if n > baseLength {\n\t\tpanic(cards.ErrDealNotEnough)\n\t} else {\n\t\tnewLength := baseLength - n\n\t\tsource := deck.cards[newLength:baseLength]\n\t\tresult := make([]cards.Card, len(source))\n\t\tfor index := 0; index < n; index++ {\n\t\t\tresult[index] = source[n-1-index]\n\t\t}\n\t\treturn result\n\t}\n}", "func (conn *Conn) read(n int) ([]byte, error) {\n\tresult, err := conn.brw.Peek(n)\n\n\tif err != nil {\n\t\tfmt.Println(\"Error while peeking read buffer\", err)\n\t\treturn result, err\n\t}\n\n\t_, err = conn.brw.Discard(n)\n\n\tif err != nil {\n\t\tfmt.Println(\"Error while discarding read buffer\", err)\n\t}\n\n\treturn result, err\n}", "func (src *Source) ConsumeN(n int) {\n\tfor {\n\t\tif n <= len(src.current) {\n\t\t\tsrc.current = src.current[n:]\n\t\t\tif len(src.current) == 0 {\n\t\t\t\tsrc.Consume()\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tif src.err != nil {\n\t\t\tif src.err == io.EOF {\n\t\t\t\tsrc.err = io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tn -= len(src.current)\n\t\tsrc.Consume()\n\t}\n}", "func (q *Queue) Peek(n int) (item interface{}) {\n item = q.queue[n]\n return\n}", "func (lex *Lexer) PeekN(n int) scanner.Token {\n\tvar lasts [][]rune\n\tfor 0 < n {\n\t\tlex.Next()\n\t\tlasts = append(lasts, lex.RawText)\n\t\tn--\n\t}\n\ttoken := lex.Token\n\tfor i := len(lasts) - 1; 0 <= i; i-- {\n\t\tlex.UnNextTo(lasts[i])\n\t}\n\treturn token\n}", "func peekNext(in *bufio.Reader) (rune, error) {\n\tif err := skipSpaces(in); err != nil {\n\t\treturn rune(0), err\n\t}\n\tr, _, err := in.ReadRune()\n\tif err != nil {\n\t\treturn rune(0), err\n\t}\n\tin.UnreadRune()\n\treturn r, nil\n}", "func (r *ObjectsListingXact) PeekN(n uint) (result []*cmn.BucketEntry, err error) {\n\tr.mtx.Lock()\n\tdefer r.mtx.Unlock()\n\treturn r.peekN(n)\n}", "func (s *Scanner) peek() byte {\n\tif s.rdOffset < len(s.src) {\n\t\treturn s.src[s.rdOffset]\n\t}\n\treturn 0\n}", "func (r *ChunkReader) Next(n int) (buf []byte, err error) {\n\t// n bytes already in buf\n\tif (r.wp - r.rp) >= n {\n\t\tbuf = r.buf[r.rp : r.rp+n]\n\t\tr.rp += n\n\t\treturn buf, err\n\t}\n\n\t// available space in buf is less than n\n\tif len(r.buf) < n {\n\t\tr.copyBufContents(r.newBuf(n))\n\t}\n\n\t// buf is large enough, but need to shift filled area to start to make enough contiguous space\n\tminReadCount := n - (r.wp - r.rp)\n\tif (len(r.buf) - r.wp) < minReadCount {\n\t\tnewBuf := r.newBuf(n)\n\t\tr.copyBufContents(newBuf)\n\t}\n\n\tif err := r.appendAtLeast(minReadCount); err != nil {\n\t\treturn nil, err\n\t}\n\n\tbuf = r.buf[r.rp : r.rp+n]\n\tr.rp += n\n\treturn buf, nil\n}", "func (b *ByteInputAdapter) Next(n int) ([]byte, error) {\n\tbuf := make([]byte, n)\n\t_, err := b.Read(buf)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn buf, nil\n}", "func (self *bipbuf_t) Peek(size uint32) []byte{\n\tif self.size < self.a_start + size {\n\t\treturn nil\n\t}\n\n\tif self.IsEmpty() {\n\t\treturn nil\n\t}\n\n\treturn self.data[0:self.a_start]\n}", "func (s *Scanner) peek() (byte, error) {\n\tch, err := s.reader.Peek(1)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn ch[0], nil\n}", "func (b *ByteBuffer) Next(n int) ([]byte, error) {\n\tm := len(b.buf) - b.off\n\n\tif n > m {\n\t\treturn nil, io.ErrUnexpectedEOF\n\t}\n\n\tdata := b.buf[b.off : b.off+n]\n\tb.off += n\n\n\treturn data, nil\n}", "func (q *BytesQueue) Peek() ([]byte, error) {\n\tdata, _, err := q.peek(q.head)\n\treturn data, err\n}", "func (b *PeekableReader) Peek() (byte, error) {\n\tif !b.full {\n\t\tbuf := []byte{0}\n\t\tif _, err := b.rd.Read(buf); err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tb.byt = buf[0]\n\t\tb.full = true\n\t}\n\treturn b.byt, nil\n}", "func (r *objReader) skip(n int64) {\n\tif n < 0 {\n\t\tr.error(fmt.Errorf(\"debug/goobj: internal error: misuse of skip\"))\n\t}\n\tif n < int64(len(r.tmp)) {\n\t\t// Since the data is so small, a just reading from the buffered\n\t\t// reader is better than flushing the buffer and seeking.\n\t\tr.readFull(r.tmp[:n])\n\t} else if n <= int64(r.b.Buffered()) {\n\t\t// Even though the data is not small, it has already been read.\n\t\t// Advance the buffer instead of seeking.\n\t\tfor n > int64(len(r.tmp)) {\n\t\t\tr.readFull(r.tmp[:])\n\t\t\tn -= int64(len(r.tmp))\n\t\t}\n\t\tr.readFull(r.tmp[:n])\n\t} else {\n\t\t// Seek, giving up buffered data.\n\t\t_, err := r.f.Seek(r.offset+n, 0)\n\t\tif err != nil {\n\t\t\tr.error(err)\n\t\t}\n\t\tr.offset += n\n\t\tr.b.Reset(r.f)\n\t}\n}", "func (r *objReader) skip(n int64) {\n\tif n < 0 {\n\t\tr.error(fmt.Errorf(\"debug/goobj: internal error: misuse of skip\"))\n\t}\n\tif n < int64(len(r.tmp)) {\n\t\t// Since the data is so small, a just reading from the buffered\n\t\t// reader is better than flushing the buffer and seeking.\n\t\tr.readFull(r.tmp[:n])\n\t} else if n <= int64(r.b.Buffered()) {\n\t\t// Even though the data is not small, it has already been read.\n\t\t// Advance the buffer instead of seeking.\n\t\tfor n > int64(len(r.tmp)) {\n\t\t\tr.readFull(r.tmp[:])\n\t\t\tn -= int64(len(r.tmp))\n\t\t}\n\t\tr.readFull(r.tmp[:n])\n\t} else {\n\t\t// Seek, giving up buffered data.\n\t\tr.b.MustSeek(r.offset+n, os.SEEK_SET)\n\t\tr.offset += n\n\t}\n}", "func (b *Reader) Discard(n int) (discarded int, err error)", "func (bs *ByteScanner) Peek(offset int) (byte, error) {\n\t// [...]\n\treturn 0, io.EOF\n}", "func (c *ByteBuffer) ReadN(n int) (r []byte, err error) {\n\tif n > 0 {\n\t\tif c.Len() >= n { // optimistic branching\n\t\t\tr = make([]byte, n)\n\t\t\t_, _ = c.Read(r)\n\t\t} else {\n\t\t\terr = ErrBufferNotEnoughByteToRead\n\t\t}\n\t}\n\treturn\n}", "func (r *Reader) SkipNBytes(n int) {\n\tread := 0\n\tfor read < n {\n\t\tif r.head == r.tail {\n\t\t\tif !r.loadMore() {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tif read+r.tail-r.head < n {\n\t\t\tread += r.tail - r.head\n\t\t\tr.head = r.tail\n\t\t\tcontinue\n\t\t}\n\n\t\tr.head += n - read\n\t\tread += n - read\n\t}\n}", "func (q *Queue) Peek() ([]byte, error) {\n\tq.RLock()\n\tdefer q.RUnlock()\n\titem, err := q.readItemByID(q.head + 1)\n\treturn item.Value, err\n}", "func (c *RingBuffer) consume(n int) int {\n\tif n > c.len {\n\t\tn = c.len\n\t}\n\tc.index = (c.index + n) % len(c.buf)\n\tc.addLen(-n)\n\treturn n\n}", "func (s *lexStream) peek() byte {\r\n\tif s.c >= len(s.input) {\r\n\t\ts.pos[len(s.pos)-1].line = 0\r\n\t\treturn eof\r\n\t}\r\n\treturn s.input[s.c]\r\n}", "func (p *parametizer) peek() (byte, error) {\n\tif p.pos >= len(p.z) {\n\t\treturn 0, io.EOF\n\t}\n\treturn p.z[p.pos], nil\n}", "func (r *Reader) Discard(n int) (int, error) {\n\tif n <= 0 {\n\t\treturn 0, nil\n\t}\n\tunread := r.Unread()\n\tif n > unread {\n\t\treturn unread, io.ErrUnexpectedEOF\n\t}\n\tr.off += n\n\treturn n, nil\n}", "func (r *Reader) ReadFull(n int) ([]byte, error) {\n\tunreadBytes := r.unreadBytes()\n\tif unreadBytes >= n {\n\t\tresult := r.buf[r.r : r.r+n]\n\t\tr.r += n\n\t\treturn result, nil\n\t}\n\n\tneedToRead := n - unreadBytes\n\tif r.capLeft() >= needToRead {\n\t\t// enough room to Read\n\t\tif err := r.readAtLeast(needToRead); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tresult := r.buf[r.r : r.r+n]\n\t\tr.r += n\n\t\treturn result, nil\n\t}\n\n\t// not enough room\n\t// check if buf is large enough\n\tif n > len(r.buf) {\n\t\tif cap(r.buf) == 0 {\n\t\t\treturn nil, ErrBufReaderAlreadyClosed\n\t\t}\n\n\t\t// make a larger buf\n\t\tnewBuf := slabPool.Alloc(n + 128)\n\t\tr.w = copy(newBuf, r.buf[r.r:r.w])\n\t\tr.r = 0\n\t\tslabPool.Free(r.buf)\n\t\tr.buf = newBuf\n\t} else {\n\t\t// enough room, shift existing data to left\n\t\tr.w = copy(r.buf, r.buf[r.r:r.w])\n\t\tr.r = 0\n\t}\n\n\tif err := r.readAtLeast(needToRead); err != nil {\n\t\treturn nil, err\n\t}\n\n\tresult := r.buf[r.r : r.r+n]\n\tr.r += n\n\treturn result, nil\n}", "func (c *CircBuf) Peek(buf []byte) int {\n\tvar count int\n\tvar tail int = c.tail // Use a local tail variable\n\tvar num int\n\tfor {\n\t\tcount = c.countToEndArg(tail)\n\t\tif len(buf) - num < count {\n\t\t\tcount = len(buf) - num\n\t\t}\n\t\tif count <= 0 {\n\t\t\tbreak\n\t\t}\n\t\tcopy(buf[num : num + count], c.buf[tail : tail + count])\n\t\ttail = (tail + count) & (len(c.buf) - 1)\n\t\tnum += count\n\t}\n\treturn num\n}", "func (b *QueueBuffer) Read(p []byte) (int, error) {\n\tif x := len(*b) - len(p); x >= 0 {\n\t\tn := copy(p, (*b)[x:])\n\t\t*b = (*b)[:x]\n\t\treturn n, nil\n\t}\n\tn := copy(p, *b)\n\t*b = nil\n\treturn n, io.EOF\n}", "func (D DiskIterator) readN(nByte int) ([]byte, error) {\n\n\tcnt := make([]byte, nByte)\n\tn, err := D.filePointer.ReadAt(cnt, D.actualOfset+16)\n\tif err != nil {\n\t\treturn cnt, err\n\t}\n\tif n < nByte {\n\t\treturn cnt, errors.New(\"non tutti i byte sono stati letti\")\n\t}\n\treturn cnt, nil\n}", "func (l *reader) peek() rune {\n\trune := l.next()\n\tl.backup()\n\treturn rune\n}", "func (g *deltaGenerator) readN(n int64) ([]byte, error) {\n\tg.setSkip(true)\n\tbuf := make([]byte, n)\n\t_, err := io.ReadFull(g.tarReader, buf)\n\treturn buf, err\n}", "func (p *Parser) peek(cnt int) *Token {\n\tfor len(p.tokens) < cnt {\n\t\tp.tokens = append(p.tokens, p.lexer.NextToken())\n\t}\n\treturn p.tokens[cnt-1]\n}", "func (c *RingBuffer) Peek(p []byte) (int, error) {\n\tc.mutex.Lock()\n\tdefer c.mutex.Unlock()\n\treturn c.peek(p)\n}", "func (d *Decoder) NRead() int64 {\n\tr := d.dec.Buffered().(*bytes.Reader)\n\treturn d.r.n - int64(r.Len())\n}", "func (hpack *HPACK) peek(n uint64) (hf *HeaderField) {\n\t// TODO: Change peek function key\n\tif n < maxIndex {\n\t\thf = staticTable[n-1]\n\t} else { // search in dynamic table\n\t\tnn := int(n - maxIndex)\n\t\tif nn < len(hpack.dynamic) {\n\t\t\thf = hpack.dynamic[nn]\n\t\t}\n\t}\n\treturn\n}", "func (q *FileQueue) Peek() (int64, []byte, error) {\n\tif q.IsEmpty() {\n\t\treturn -1, nil, nil\n\t}\n\tindex := q.FrontIndex\n\n\tbb, err := q.peek(index)\n\treturn index, bb, err\n}", "func (d *Decoder) consume(n int) {\n\td.in = d.in[n:]\n\tfor len(d.in) > 0 {\n\t\tswitch d.in[0] {\n\t\tcase ' ', '\\n', '\\r', '\\t':\n\t\t\td.in = d.in[1:]\n\t\tdefault:\n\t\t\treturn\n\t\t}\n\t}\n}", "func (c *CircBuf) Consume(nbytes int) int {\n\tvar count int\n\tvar num int\n\tfor {\n\t\tcount = c.countToEnd()\n\t\tif nbytes - num < count {\n\t\t\tcount = nbytes - num\n\t\t}\n\t\tif count <= 0 {\n\t\t\tbreak\n\t\t}\n\t\tc.tail = (c.tail + count) & (len(c.buf) - 1)\n\t\tnum += count\n\t}\n\treturn num\n}", "func (src *Source) CopyN(n int) []byte {\n\tspace := src.ClaimSpace()\n\tfor {\n\t\tif n <= len(src.current) {\n\t\t\tspace = append(space, src.current[:n]...)\n\t\t\tsrc.current = src.current[n:]\n\t\t\tif len(src.current) == 0 {\n\t\t\t\tsrc.Consume()\n\t\t\t}\n\t\t\treturn space\n\t\t}\n\t\tif src.err != nil {\n\t\t\tif src.err == io.EOF {\n\t\t\t\tsrc.err = io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\treturn space\n\t\t}\n\t\tn -= len(src.current)\n\t\tspace = append(space, src.current...)\n\t\tsrc.Consume()\n\t}\n}", "func (r *wrappedReader) PeekBytes(delim byte) (string, error) {\n\tr.bufR = bufio.NewReader(r.r)\n\tb, err := r.bufR.ReadBytes(delim)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tr.buf = b\n\tr.useBuf = true\n\n\treturn string(b[:len(b)-1]), nil\n}", "func (s Stream) Offset(n int) Stream {\n\treturn s.Pipe(func() func(r Record) (Record, error) {\n\t\tvar skipped int\n\n\t\treturn func(r Record) (Record, error) {\n\t\t\tif skipped < n {\n\t\t\t\tskipped++\n\t\t\t\treturn nil, nil\n\t\t\t}\n\n\t\t\treturn r, nil\n\t\t}\n\t})\n}", "func (q *BytesQueue) Get(index int) ([]byte, error) {\n\tdata, _, err := q.peek(index)\n\treturn data, err\n}", "func (s *scanner) peek() rune {\n\tr := s.next()\n\ts.backup()\n\treturn r\n}", "func (rd *Reader) PeekRunes(n int) []rune {\n\tfor len(rd.buffer)-rd.current < n && !rd.haveEOF() {\n\t\tif err := rd.feedBuffer(); err != nil {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tres := make([]rune, 0, n)\n\tfor i := 0; i < n; i++ {\n\t\tif rd.current + i >= len(rd.buffer) {\n\t\t\t// reached end of buffer before reading as much as we wanted\n\t\t\tbreak\n\t\t}\n\t\tr := rd.buffer[rd.current+i]\n\t\tif r == badRune {\n\t\t\tr = utf8.RuneError\n\t\t}\n\t\tres = append(res, r)\n\t\tif r == EOF {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn res\n}", "func (p *Packet) Read(byteCount int) ([]byte, error) {\n\tstartPos := p.readPos\n\tnextPos := startPos + byteCount\n\tif nextPos > len(p.payload) {\n\t\treturn []byte{}, io.EOF\n\t}\n\tp.readPos = nextPos\n\treturn p.payload[startPos:nextPos], nil\n}", "func (cr *ChainReader) Peek() *Record {\n\treturn cr.readers[cr.current].Peek()\n}", "func (r *ObjectsListingXact) nextN(n uint) (result []*cmn.BucketEntry, err error) {\n\tresult, err = r.peekN(n)\n\tr.discardN(uint(len(result)))\n\treturn result, err\n}", "func (b *FixedBuffer) Read(p []byte) (n int, err error) {\n\tif b.r == b.w {\n\t\treturn 0, errReadEmpty\n\t}\n\tn = copy(p, b.buf[b.r:b.w])\n\tb.r += n\n\tif b.r == b.w {\n\t\tb.r = 0\n\t\tb.w = 0\n\t}\n\treturn n, nil\n}", "func (this *MyQueue) Peek() int {\n\tif len(this.outStack) == 0 {\n\t\tthis.inToOut()\n\t}\n\treturn this.outStack[len(this.outStack)-1]\n}", "func (r *testReader) Read(p []byte) (n int, err error) {\n\tfor i := range p {\n\t\tif r.size <= 0 {\n\t\t\treturn n, io.EOF\n\t\t}\n\t\tp[i] = r.c\n\t\tr.c = (r.c + 1) % 253\n\t\tr.size--\n\t\tn++\n\t}\n\treturn\n}", "func (s *BufferedFrameReader) Peek() (*Frame, error) {\n\tif s.Next != nil {\n\t\treturn s.Next, nil\n\t}\n\n\t_, _, err, _ := s.Reader.NextFrame(&s.TmpFrame)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts.Next = &s.TmpFrame\n\treturn s.Next, nil\n}", "func (m *minifier) peek() int {\n\tm.theLookahead = m.get()\n\treturn m.theLookahead\n}", "func (b *Buffer) ReadNFrom(reader io.Reader, n int) (int, error) {\n\t// Loop until we've filled completed the read, run out of storage, or\n\t// encountered a read error.\n\tvar read, result int\n\tvar err error\n\tfor n > 0 && b.used != b.size && err == nil {\n\t\t// Compute the first available contiguous free storage segment.\n\t\tfreeStart := (b.start + b.used) % b.size\n\t\tfree := b.storage[freeStart:min(freeStart+(b.size-b.used), b.size)]\n\n\t\t// If the storage segment is larger than we need, then truncate it.\n\t\tif len(free) > n {\n\t\t\tfree = free[:n]\n\t\t}\n\n\t\t// Perform the read.\n\t\tread, err = reader.Read(free)\n\n\t\t// Update indices and tracking.\n\t\tresult += read\n\t\tb.used += read\n\t\tn -= read\n\t}\n\n\t// If we couldn't complete the read due to a lack of storage, then we need\n\t// to return an error. However, if a read error occurred simultaneously with\n\t// running out of storage, then we don't overwrite it.\n\tif n > 0 && b.used == b.size && err == nil {\n\t\terr = ErrBufferFull\n\t}\n\n\t// If we encountered io.EOF simultaneously with completing the read, then we\n\t// can clear the error.\n\tif err == io.EOF && n == 0 {\n\t\terr = nil\n\t}\n\n\t// Done.\n\treturn result, err\n}", "func (this *MyQueue) Peek() int {\n\tif len(this.outStack) == 0 {\n\t\tthis.in2Out()\n\t}\n\n\treturn this.outStack[len(this.outStack)-1]\n}", "func (d *Decoder) readMore() {\n\tif d.complete {\n\t\treturn\n\t}\n\tn := cap(d.buf) - len(d.buf)\n\tif n < minRead {\n\t\t// We need to grow the buffer. Note that we don't have to copy\n\t\t// the unused part of the buffer (d.buf[:d.r0]).\n\t\t// TODO provide a way to limit the maximum size that\n\t\t// the buffer can grow to.\n\t\tused := len(d.buf) - d.r0\n\t\tn1 := cap(d.buf) * 2\n\t\tif n1-used < minGrow {\n\t\t\tn1 = used + minGrow\n\t\t}\n\t\tbuf1 := make([]byte, used, n1)\n\t\tcopy(buf1, d.buf[d.r0:])\n\t\td.buf = buf1\n\t\td.r1 -= d.r0\n\t\td.r0 = 0\n\t}\n\tn, err := d.rd.Read(d.buf[len(d.buf):cap(d.buf)])\n\td.buf = d.buf[:len(d.buf)+n]\n\tif err == nil {\n\t\treturn\n\t}\n\td.complete = true\n\tif err != io.EOF {\n\t\td.err = err\n\t}\n}", "func Read(r io.Reader, n uint64) ([]byte, error) {\n\tread := make([]byte, n)\n\t_, err := r.Read(read)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not read from reader: %s\", err)\n\t}\n\n\treturn read, nil\n}", "func (this *MyQueue) Peek() int {\n\tif len(this.b) == 0 {\n\t\tfor len(this.a) > 0 {\n\t\t\tthis.b = append(this.b, this.a[len(this.a)-1])\n\t\t\tthis.a = this.a[:len(this.a)-1]\n\t\t}\n\t}\n\treturn this.b[len(this.b)-1]\n}", "func seekToNextRecord(reader *bufio.Reader) (bytes int, err error) {\n\tvar buf []byte\n\tfor {\n\t\tbuf, err = reader.Peek(4)\n\t\tif err != nil {\n\t\t\tbytes += len(buf)\n\t\t\terr = errors.Trace(err)\n\t\t\treturn\n\t\t}\n\n\t\tmagic := binary.LittleEndian.Uint32(buf)\n\t\tif magic == recordMagic {\n\t\t\treturn\n\t\t}\n\n\t\tif _, err = reader.Discard(1); err != nil {\n\t\t\t// If we reach here, we've already successfully called `Peek(4)`\n\t\t\t// and `Discard(1)` should not fail.\n\t\t\tpanic(err)\n\t\t}\n\t\tbytes++\n\t}\n}", "func (s *Scanner) peek() rune {\n\tr := s.next()\n\ts.prev()\n\treturn r\n}", "func (s *Scanner) peek() rune {\n\tpeek, _, err := s.buf.ReadRune()\n\tif err != nil {\n\t\treturn eof\n\t}\n\n\ts.buf.UnreadRune()\n\treturn peek\n}", "func (q *Queue) Peek() (int, error) {\r\n\tif len(q.data) == 0 {\r\n\t\treturn 0, fmt.Errorf(\"Queue is empty\")\r\n\t}\r\n\treturn q.data[0], nil\r\n}", "func (ring *ringBuffer) peek() []byte {\n\tring.mutex.Lock()\n\n\t/* wait for the data-ready variable to make us happy */\n\tfor !ring.dataReady {\n\t\tring.dataReadyCond.Wait()\n\t}\n\tring.mutex.Unlock()\n\t/* find the address we want */\n\taddress := ring.datagrams[ring.datagramSize+ring.baseData:]\n\treturn address\n}", "func (this *MyQueue) Peek() int {\n\tif len(this.out) != 0 {\n\t\treturn this.out[len(this.out)-1]\n\t}\n\tfor len(this.in) > 0 {\n\t\tthis.out.Push(this.in.Pop())\n\t}\n\treturn this.out[len(this.out)-1]\n}", "func (this *MyQueue) Peek() int {\n\treturn this.q[len(this.q)-1]\n}", "func (tr *Reader) Read(b []byte) (n int, err error) {\n\tif tr.nb == 0 {\n\t\t// file consumed\n\t\treturn 0, io.EOF\n\t}\n\n\tif int64(len(b)) > tr.nb {\n\t\tb = b[0:tr.nb]\n\t}\n\tn, err = tr.r.Read(b)\n\ttr.nb -= int64(n)\n\n\tif err == io.EOF && tr.nb > 0 {\n\t\terr = io.ErrUnexpectedEOF\n\t}\n\ttr.err = err\n\treturn\n}", "func (r *RingT[T]) Peek(i int) *T {\n\tlength := (r.head - r.tail) & r.mask\n\tui := uint(i)\n\tif ui >= length {\n\t\treturn nil\n\t}\n\tj := (r.tail + ui) & r.mask\n\treturn r.items[j]\n}", "func (b *ByteBuffer) SkipBytes(n int) error {\n\tm := len(b.buf) - b.off\n\n\tif n > m {\n\t\treturn io.ErrUnexpectedEOF\n\t}\n\n\tb.off += n\n\n\treturn nil\n}", "func (c *RingBuffer) Consume(n int) int {\n\tc.mutex.Lock()\n\tdefer c.mutex.Unlock()\n\treturn c.consume(n)\n}", "func (pb *PageBuffer) Consume(s functional.Stream) (err error) {\n pb.page_no = 0\n pb.idx = 0\n pb.is_end = false\n for err == nil && !pb.isDesiredPageRead() {\n if pb.idx > 0 {\n pb.page_no++\n }\n offset := pb.pageOffset(pb.page_no)\n pb.idx, err = readStreamIntoSlice(\n s, pb.buffer.Slice(offset, offset + pb.pageLen), pb.handler)\n }\n if err == nil {\n anElement := pb.buffer.Index(pb.pageOffset(pb.page_no + 1))\n pb.handler.ensureValid(anElement)\n pb.is_end = s.Next(pb.handler.toInterface(anElement)) == functional.Done\n } else if err == functional.Done {\n pb.is_end = true\n err = nil\n if pb.page_no > 0 && pb.idx == 0 {\n pb.page_no--\n pb.idx = pb.pageLen\n }\n }\n return\n}", "func (r *EncReader) Read(p []byte) (n int, err error) {\n\tif r.err != nil {\n\t\treturn n, r.err\n\t}\n\tif r.firstRead {\n\t\tr.firstRead = false\n\t\tn, err = r.readFragment(p, 0)\n\t\tif err != nil {\n\t\t\treturn n, err\n\t\t}\n\t\tp = p[n:]\n\t}\n\tif r.offset > 0 {\n\t\tnn := copy(p, r.ciphertextBuffer[r.offset:])\n\t\tn += nn\n\t\tif nn == len(p) {\n\t\t\tr.offset += nn\n\t\t\treturn n, nil\n\t\t}\n\t\tp = p[nn:]\n\t\tr.offset = 0\n\t}\n\tif r.closed {\n\t\treturn n, io.EOF\n\t}\n\tnn, err := r.readFragment(p, 1)\n\treturn n + nn, err\n}", "func TestMockReadSeekerReads(t *testing.T) {\n\tvar reader = NewMockReadSeeker(&[]byte{0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07})\n\n\t// Buffer to read into.\n\tvar data []byte = []byte{0x00, 0x00, 0x00}\n\tvar count = 0\n\n\t// Start with empty data buffer\n\tassertBytesEqual(data, []byte{0x00, 0x00, 0x00}, t)\n\n\t// Now read into the 3-length buffer\n\tcount, err := reader.Read(data)\n\tif count != 3 {\n\t\tt.Fatal(\"Count not 3 was \", count)\n\t}\n\n\tif err != nil {\n\t\tt.Fatal(\"Error not nil, was \", err)\n\t}\n\n\tassertBytesEqual(data, []byte{0x01, 0x02, 0x03}, t)\n\n\t// Read into it again to get the next 3\n\tcount, err = reader.Read(data)\n\tif count != 3 {\n\t\tt.Fatal(\"Count not 3 was \", count)\n\t}\n\n\tif err != nil {\n\t\tt.Fatal(\"Error not nil, was \", err)\n\t}\n\tassertBytesEqual(data, []byte{0x04, 0x05, 0x06}, t)\n\n\t// Read again to get the last one.\n\tcount, err = reader.Read(data)\n\tif count != 1 {\n\t\tt.Fatal(\"Count not 1 was \", count)\n\t}\n\n\tif err != nil {\n\t\tt.Fatal(\"Error not nil, was \", err)\n\t}\n\n\t// Data will still have the old data remaining\n\tassertBytesEqual(data, []byte{0x07, 0x05, 0x06}, t)\n\n\t// One more time, should be empty\n\tcount, err = reader.Read(data)\n\tif count != 0 {\n\t\tt.Fatal(\"Count not 0 was \", count)\n\t}\n\n\tif err != nil {\n\t\tt.Fatal(\"Error not nil, was \", err)\n\t}\n}", "func (s *Scanner) unread(n int) {\n\tfor i := 0; i < n; i++ {\n\t\ts.bufi = ((s.bufi + len(s.buf) - 1) % len(s.buf))\n\t\ts.bufn++\n\t}\n}", "func (b *Buffer) Read(out []byte) (n int, err error) {\n\tif b.readCursor >= b.Size() {\n\t\t// we read the entire buffer, let's loop back to the beginning\n\t\tb.readCursor = 0\n\t} else if b.readCursor+int64(len(out)) > b.Size() {\n\t\t// we don't have enough data in our buffer to fill the passed buffer\n\t\t// we need to do multiple passes\n\t\tn := copy(out, b.data[b.offset+b.readCursor:])\n\t\tb.readCursor += int64(n)\n\t\t// TMP check, should remove\n\t\tif b.readCursor != b.Size() {\n\t\t\tpanic(fmt.Sprintf(\"off by one much? %d - %d\", b.readCursor, b.Size()))\n\t\t}\n\t\tn2, _ := b.Read(out[n:])\n\t\tb.readCursor += int64(n2)\n\t\treturn int(n + n2), nil\n\t}\n\tn = copy(out, b.data[b.offset+b.readCursor:])\n\treturn\n}", "func (a *reader) Read(p []byte) (n int, err error) {\n\tif a.err != nil {\n\t\treturn 0, a.err\n\t}\n\t// Swap buffer and maybe return error\n\terr = a.fill()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\t// Copy what we can\n\tn = copy(p, a.cur.buffer())\n\ta.cur.inc(n)\n\n\tif a.cur.isEmpty() {\n\t\t// Return current, so a fetch can start.\n\t\tif a.cur != nil {\n\t\t\t// If at end of buffer, return any error, if present\n\t\t\ta.err = a.cur.err\n\t\t\ta.reuse <- a.cur\n\t\t\ta.cur = nil\n\t\t}\n\t\treturn n, a.err\n\t}\n\treturn n, nil\n}", "func (q *Queue) Peek() int {\n\tif q.start.next != nil {\n\t\t_iteratePeek(q.start)\n\t}\n\treturn q.start.val\n}", "func (t *tube) RecvN(n int) ([]byte, error) {\n\tb := make([]byte, n)\n\trn, err := t.out.Read(b)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn b[:rn], nil\n}", "func readNBytes(n int, f *os.File) ([]byte, error) {\n\tbytesToRead := make([]byte, n)\n\t_, e := f.Read(bytesToRead)\n\treturn bytesToRead, e\n}", "func (p *parser) peek() token {\n\tif p.peekCount > 0 {\n\t\treturn p.token[p.peekCount-1]\n\t}\n\tp.peekCount = 1\n\tp.token[1] = p.token[0]\n\tp.token[0], _ = p.lex.nextToken()\n\treturn p.token[0]\n}", "func (r *bytesReader) Read(b []byte) (n int, err error) {\n\tif r.index >= int64(len(r.bs)) {\n\t\treturn 0, io.EOF\n\t}\n\tn = copy(b, r.bs[r.index:])\n\tr.index += int64(n)\n\treturn\n}", "func (c *RingBuffer) Read(p []byte) (int, error) {\n\tc.mutex.Lock()\n\tdefer c.mutex.Unlock()\n\tn, err := c.peek(p)\n\tif err != nil {\n\t\treturn n, err\n\t}\n\treturn c.consume(n), nil\n}", "func (r *View) Skip(count int64) {\n\tfor count > 0 {\n\t\tif r.cur == nil {\n\t\t\tpanic(errors.New(\"cannot skip past end buffer\"))\n\t\t}\n\n\t\tamount := r.chunkRemaining()\n\t\tif count < int64(amount) {\n\t\t\tamount = int(count)\n\t\t\tr.cidx += amount\n\t\t} else {\n\t\t\t// Finished consuming this chunk, move on to the next.\n\t\t\tr.cur = r.cur.next\n\t\t\tr.cidx = 0\n\t\t}\n\n\t\tcount -= int64(amount)\n\t\tr.consumed += int64(amount)\n\t\tr.size -= int64(amount)\n\t}\n}", "func (this *MyQueue) Peek() int {\n\tif this.sIn.isEmpty() && this.sOut.isEmpty() {\n\t\treturn -1\n\t} else if this.sOut.isEmpty() {\n\t\tthis.inToOut()\n\t}\n\n\treturn this.sOut.top()\n}", "func (p *parser) peek() string {\n\tif p.valid() {\n\t\treturn p.lines[p.idx]\n\t}\n\treturn \"\"\n}", "func (z *Tokenizer) repeek() {\n\tby, err := z.r.Peek(3)\n\tif err != nil && err != io.EOF {\n\t\tpanic(err)\n\t}\n\tcopy(z.peek[:], by)\n\n\t// zero fill on EOF\n\ti := len(by)\n\tfor i < 3 {\n\t\tz.peek[i] = 0\n\t\ti++\n\t}\n}", "func (l *nonEmitingLexer) peek() rune {\n\trune := l.next()\n\tl.backup()\n\treturn rune\n}", "func (r *wrappedReader) Read(p []byte) (n int, err error) {\n\tdefer func() {\n\t\tr.totalBytesRead += n\n\t}()\n\n\tif !r.useBuf {\n\t\tif r.bufR != nil {\n\t\t\treturn r.bufR.Read(p)\n\t\t}\n\t\treturn r.r.Read(p)\n\t}\n\n\tn = copy(p, r.buf)\n\tr.useBuf = false\n\tr.buf = []byte{}\n\n\tif n < len(p) {\n\t\tl := io.LimitReader(r.bufR, int64(len(p)-n))\n\t\tb, err := l.Read(p[n:])\n\t\tn += b\n\t\tif err != nil {\n\t\t\treturn n, err\n\t\t}\n\t}\n\n\treturn n, nil\n}" ]
[ "0.76214916", "0.7172161", "0.7017882", "0.6858129", "0.6745518", "0.6675743", "0.66729033", "0.665246", "0.66081434", "0.6590266", "0.6466442", "0.64454675", "0.642568", "0.6394508", "0.6383311", "0.63791347", "0.62964153", "0.629203", "0.62886363", "0.6285999", "0.62832016", "0.62808067", "0.62431484", "0.62029266", "0.6189646", "0.6186329", "0.6152091", "0.6128009", "0.6099209", "0.6091125", "0.60774237", "0.6060529", "0.60592735", "0.60366076", "0.6032307", "0.60204643", "0.60194534", "0.6009353", "0.59819764", "0.5976965", "0.5827706", "0.5824189", "0.58227986", "0.5820594", "0.5818578", "0.5810366", "0.5808265", "0.5782622", "0.5781868", "0.5761176", "0.57434326", "0.57274646", "0.5681077", "0.5667641", "0.5662862", "0.5636548", "0.5629177", "0.5616272", "0.5570268", "0.55493826", "0.554313", "0.553399", "0.5533815", "0.55301887", "0.5527625", "0.5525417", "0.5523576", "0.5505577", "0.5489327", "0.5487504", "0.5483054", "0.54830277", "0.54756075", "0.5469026", "0.54552376", "0.545157", "0.5447015", "0.5437424", "0.5433303", "0.5415055", "0.5395731", "0.53923845", "0.5390962", "0.5390911", "0.5386515", "0.5380294", "0.53729707", "0.5372234", "0.53690434", "0.53639126", "0.53625333", "0.5358294", "0.53479576", "0.53469455", "0.5306888", "0.5306795", "0.5306283", "0.5300597", "0.5296601", "0.52908" ]
0.7914215
0
readByte reads and returns a byte from the input file. On I/O error or EOF, it records the error but returns byte 0. A sequence of 0 bytes will eventually terminate any parsing state in the object file. In particular, it ends the reading of a varint.
func (r *objReader) readByte() byte { if r.err != nil { return 0 } if r.offset >= r.limit { r.error(io.ErrUnexpectedEOF) return 0 } b, err := r.b.ReadByte() if err != nil { if err == io.EOF { err = io.ErrUnexpectedEOF } r.error(err) b = 0 } else { r.offset++ } return b }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (r *VarintReader) ReadByte() (c byte, err error) {\n\tn, err := r.Read(r.buf[:])\n\tif n > 0 {\n\t\tc = r.buf[0]\n\t\tr.bytesRead++\n\t}\n\treturn\n}", "func (p *Lexer) UnreadByte() {\n\tif p.r <= 0 {\n\t\treturn\n\t}\n\n\tp.r--\n}", "func (s *Stream) readByte() (byte, error) {\n\t// since this is readByte functions, therefore, only willRead a byte each time\n\tif err := s.willRead(1); err != nil {\n\t\treturn 0, err\n\t}\n\n\t// pops out a byte from r and return it\n\tb, err := s.r.ReadByte()\n\tif err == io.EOF {\n\t\terr = io.ErrUnexpectedEOF\n\t}\n\treturn b, err\n}", "func readByte(r io.Reader) (byte, error) {\n\tif r, ok := r.(io.ByteReader); ok {\n\t\treturn r.ReadByte()\n\t}\n\tvar v [1]byte\n\t_, err := io.ReadFull(r, v[:])\n\treturn v[0], err\n}", "func readByte(r io.Reader) (uint8, error) {\n\ttmp := []uint8{0}\n\t_, e := r.Read(tmp)\n\treturn tmp[0], e\n}", "func readByte(r io.Reader) (ret byte, err error) {\n\tvar be [1]byte\n\tvalBytes := be[0:1]\n\n\tif _, err = io.ReadFull(r, valBytes); err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn valBytes[0], nil\n}", "func ReadByte(r io.Reader) (byte, error) {\n\tb := make([]byte, 1)\n\tn, err := r.Read(b)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tif n != 1 {\n\t\treturn 0, fmt.Errorf(\"read invalid amount, exp: 1, n: %d\", n)\n\t}\n\treturn b[0], nil\n}", "func (r *View) ReadByte() (byte, error) {\n\tchunk := r.chunkBytes()\n\tif len(chunk) == 0 {\n\t\treturn 0, io.EOF\n\t}\n\tr.Skip(1)\n\treturn chunk[0], nil\n}", "func ReadByte(r io.Reader) (byte, error) {\n\td := make([]byte, 1, 1)\n\t_, err := io.ReadFull(r, d)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn d[0], nil\n}", "func (r *DecReader) ReadByte() (byte, error) {\n\tif r.err != nil {\n\t\treturn 0, r.err\n\t}\n\tif r.firstRead {\n\t\tr.firstRead = false\n\t\tif _, err := r.readFragment(nil, 0); err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tb := r.plaintextBuffer[0]\n\t\tr.offset = 1\n\t\treturn b, nil\n\t}\n\tif r.offset > 0 && r.offset < len(r.plaintextBuffer) {\n\t\tb := r.plaintextBuffer[r.offset]\n\t\tr.offset++\n\t\treturn b, nil\n\t}\n\tif r.closed {\n\t\treturn 0, io.EOF\n\t}\n\n\tr.offset = 0\n\tif _, err := r.readFragment(nil, 1); err != nil {\n\t\treturn 0, err\n\t}\n\tb := r.plaintextBuffer[0]\n\tr.offset = 1\n\treturn b, nil\n}", "func (r *Reader) ReadByte() (byte, error) {\n\tr.prevRune = -1\n\tif r.i >= int64(len(r.s)) {\n\t\treturn 0, io.EOF\n\t}\n\tb := r.s[r.i]\n\tr.i++\n\treturn b, nil\n}", "func GetByte(r io.Reader) (byte, error) {\n\tt := make([]byte, 1)\n\t_, err := r.Read(t)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn t[0], nil\n}", "func (ch *Chunk) ReadByte() (byte, error) {\n\tif ch.IsFullyRead() {\n\t\treturn 0, io.EOF\n\t}\n\tvar r byte\n\terr := ch.ReadLE(&r)\n\treturn r, err\n}", "func (t *hashReader) ReadByte() (byte, error) {\n\tb := make([]byte, 1)\n\t_, err := t.Read(b)\n\treturn b[0], err\n}", "func (r *readRune) readByte() (b byte, err error) {\n\tif r.pending > 0 {\n\t\tb = r.pendBuf[0]\n\t\tcopy(r.pendBuf[0:], r.pendBuf[1:])\n\t\tr.pending--\n\t\treturn\n\t}\n\tn, err := io.ReadFull(r.reader, r.pendBuf[:1])\n\tif n != 1 {\n\t\treturn 0, err\n\t}\n\treturn r.pendBuf[0], err\n}", "func (r *Reader) UnreadByte() error {\n\tif r.i <= 0 {\n\t\treturn errors.New(\"strings.Reader.UnreadByte: at beginning of string\")\n\t}\n\tr.prevRune = -1\n\tr.i--\n\treturn nil\n}", "func (z *Tokenizer) nextByte() byte {\n\tif z.err == io.EOF {\n\t\treturn 0\n\t}\n\tby, err := z.r.ReadByte()\n\tif err == io.EOF {\n\t\tz.err = io.EOF\n\t\treturn 0\n\t} else if err != nil {\n\t\tpanic(err)\n\t}\n\treturn by\n}", "func (r *Reader) ReadByte() byte {\n\tif len(r.buffer) <= r.index {\n\t\tlog.Panic(\"Error reading byte: buffer is too small!\")\n\t}\n\n\tvar data = r.buffer[r.index]\n\tr.index++\n\n\treturn data\n}", "func (s Stream) ReadByte() (byte, error) {\n\tdata := make([]byte, 1)\n\terr := s.ReadFull(data)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn data[0], nil\n}", "func (cb *Buffer) ReadByte() (byte, error) {\n\tbuf := make([]byte, 1)\n\tn, err := cb.Read(buf)\n\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tif n == 0 {\n\t\treturn 0, fmt.Errorf(\"Buffer is empty\")\n\t}\n\n\treturn buf[0], nil\n}", "func (r *EncReader) ReadByte() (byte, error) {\n\tif r.err != nil {\n\t\treturn 0, r.err\n\t}\n\tif r.firstRead {\n\t\tr.firstRead = false\n\t\tif _, err := r.readFragment(nil, 0); err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tb := r.ciphertextBuffer[0]\n\t\tr.offset = 1\n\t\treturn b, nil\n\t}\n\n\tif r.offset > 0 && r.offset < len(r.ciphertextBuffer) {\n\t\tb := r.ciphertextBuffer[r.offset]\n\t\tr.offset++\n\t\treturn b, nil\n\t}\n\tif r.closed {\n\t\treturn 0, io.EOF\n\t}\n\n\tr.offset = 0\n\tif _, err := r.readFragment(nil, 1); err != nil {\n\t\treturn 0, err\n\t}\n\tb := r.ciphertextBuffer[0]\n\tr.offset = 1\n\treturn b, nil\n}", "func (p *atomReader) ReadUnsignedByte() uint8 {\n\tc, _ := p.r.ReadByte()\n\treturn c\n}", "func (r *MsgBuffer) ReadByte() (b byte, err error) {\r\n\tif r.i == r.l {\r\n\t\treturn 0, io.EOF\r\n\t}\r\n\tb = r.b[r.i]\r\n\tr.i++\r\n\treturn b, err\r\n}", "func (m *Manager) ReadByte() byte {\n\treturn byte(m.readUint(8))\n}", "func (p *Program) ReadByte() (byte, error) {\n\tif int(p.Pc) >= len(p.data) {\n\t\treturn 0, errors.New(\"Program data buffer is empty\")\n\t}\n\n\tval := p.data[p.Pc]\n\tp.Pc++\n\n\treturn val, nil\n}", "func (r *Reader) ReadSByte() int8 {\n\tif len(r.buffer) <= r.index {\n\t\tlog.Panic(\"Error reading sbyte: buffer is too small!\")\n\t}\n\n\tvar data = int8(r.buffer[r.index])\n\tr.index++\n\n\treturn data\n}", "func (br *BinaryReader) ReadOneByte() byte {\n\tif br.Err != nil {\n\t\treturn 0x00\n\t}\n\tvar b byte\n\tbr.ReadLE(&b)\n\tif br.Err != nil {\n\t\treturn 0x00\n\t}\n\treturn b\n}", "func (r *objReader) readInt() int {\n\tvar u uint64\n\n\tfor shift := uint(0); ; shift += 7 {\n\t\tif shift >= 64 {\n\t\t\tr.error(errCorruptObject)\n\t\t\treturn 0\n\t\t}\n\t\tc := r.readByte()\n\t\tu |= uint64(c&0x7F) << shift\n\t\tif c&0x80 == 0 {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tv := int64(u>>1) ^ (int64(u) << 63 >> 63)\n\tif int64(int(v)) != v {\n\t\tr.error(errCorruptObject) // TODO\n\t\treturn 0\n\t}\n\treturn int(v)\n}", "func (p *atomReader) ReadSignedByte() int8 {\n\tc, _ := p.r.ReadByte()\n\treturn int8(c)\n}", "func (dm *dataManager) readByte(address uint) (data Data, err ProcessException) {\n\tdata.DataType = BYTE\n\n\t_data, err := dm.process.ReadBytes(address, 1)\n\tdata.Value = _data[0]\n\treturn\n}", "func (_m *MockIStream) ReadByte() (byte, error) {\n\tret := _m.ctrl.Call(_m, \"ReadByte\")\n\tret0, _ := ret[0].(byte)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "func (b *Buffer) ReadByte() (byte, error) {\n\tb.mux.Lock()\n\tdefer b.mux.Unlock()\n\n\tif b.dataSize == 0 {\n\t\treturn 0, errors.New(\"Read from empty buffer\")\n\t}\n\n\tresult := b.data[b.tail]\n\tb.advance(&b.tail)\n\tb.dataSize--\n\n\treturn result, nil\n}", "func (c *Conn) ReadByte() (byte, error) {\n\tb, err := c.r.ReadByte()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tc.WriteToHash([]byte{b})\n\treturn b, nil\n}", "func (j *JPEG) readByteStuffedByte(r io.Reader) (byte, error) {\n\t// Take the fast path if d.bytes.buf contains at least two bytes.\n\t/*if d.bytes.i+2 <= d.bytes.j {\n\t x = d.bytes.buf[d.bytes.i]\n\t d.bytes.i++\n\t d.bytes.nUnreadable = 1\n\t if x != 0xff {\n\t return x, err\n\t }\n\t if d.bytes.buf[d.bytes.i] != 0x00 {\n\t return 0, errMissingFF00\n\t }\n\t d.bytes.i++\n\t d.bytes.nUnreadable = 2\n\t return 0xff, nil\n\t}*/\n\n\t//d.bytes.nUnreadable = 0\n\n\ttmp := make([]byte, 1, 1)\n\t_, err := r.Read(tmp)\n\tx := tmp[0]\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\t//d.bytes.nUnreadable = 1\n\tif x != 0xff {\n\t\treturn x, nil\n\t}\n\n\t_, err = r.Read(tmp)\n\tx = tmp[0]\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\t//d.bytes.nUnreadable = 2\n\tif x != 0x00 {\n\t\treturn 0, fmt.Errorf(\"missing 0xff00 sequence\")\n\t}\n\treturn 0xff, nil\n}", "func (b *Buffer) ReadByte() (byte, error) {\n\tif b.count == 0 { // no elements exist.\n\t\treturn ' ', errors.New(\"Buffer is empty\")\n\t}\n\tval := b.buf[b.head]\n\tb.count--\n\tb.head++\n\tb.head = b.head % b.size\n\treturn val, nil\n}", "func (c *digisparkI2cConnection) ReadByte() (val byte, err error) {\n\tc.mtx.Lock()\n\tdefer c.mtx.Unlock()\n\n\tbuf := []byte{0}\n\tif err = c.readAndCheckCount(buf); err != nil {\n\t\treturn\n\t}\n\tval = buf[0]\n\treturn\n}", "func (p *Packet) ReadByte() byte {\n\tif p.readIndex+1 > len(p.Payload) {\n\t\tlog.Warning.Println(\"Error parsing packet arguments: { opcode=\" + strconv.Itoa(int(p.Opcode)) + \"; offset=\" + strconv.Itoa(p.readIndex) + \" };\")\n\t\treturn byte(0)\n\t}\n\tdefer func() {\n\t\tp.readIndex++\n\t}()\n\treturn p.Payload[p.readIndex] & 0xFF\n}", "func ReadFileByte(filename string) ([]byte, error) {\r\n\tf, err := os.Open(filename)\r\n\tif err != nil {\r\n\t\treturn nil, err\r\n\t}\r\n\tdefer f.Close()\r\n\r\n\treturn ioutil.ReadAll(f)\r\n}", "func (f *FileObject) Read(p []byte) (n int, err error) {\n\tif f.loc == f.length {\n\t\treturn 0, nil\n\t}\n\treturn f.obj.Read(p)\n}", "func (r *pgwireReader) ReadByte() (byte, error) {\n\tb, err := r.conn.rd.ReadByte()\n\treturn b, err\n}", "func ReadByte() {\n\tfmt.Println(\"----------------> ReadByte\")\n\tbuf := bytes.NewBufferString(\"hello\")\n\tfmt.Println(buf.String())\n\n\t// read one byte assign to b\n\tb, _ := buf.ReadByte()\n\n\t// buf=ello\n\tfmt.Println(buf.String())\n\n\t// b=h\n\tfmt.Println(string(b))\n}", "func MustReadFileByte(path string, doGzip bool) []byte {\n body, err := ReadFileByte(path, doGzip)\n if err != nil {\n panic(err)\n }\n\n return body\n}", "func (f *messageBytePipe) Read(b []byte) (int, error) {\n\tif f.readEOF {\n\t\treturn 0, io.EOF\n\t}\n\tn, err := f.file.Read(b)\n\tif err == io.EOF {\n\t\t// If this was the result of a zero-byte read, then\n\t\t// it is possible that the read was due to a zero-size\n\t\t// message. Since we are simulating CloseWrite with a\n\t\t// zero-byte message, ensure that all future Read calls\n\t\t// also return EOF.\n\t\tf.readEOF = true\n\t} else if err == windows.ERROR_MORE_DATA {\n\t\t// ERROR_MORE_DATA indicates that the pipe's read mode is message mode\n\t\t// and the message still has more bytes. Treat this as a success, since\n\t\t// this package presents all named pipes as byte streams.\n\t\terr = nil\n\t}\n\treturn n, err\n}", "func ReadByte(buffer []byte, offset int) byte {\n return buffer[offset]\n}", "func (this *reader) ioRead(buffer []byte) (n int, err error) {\n\tn, err = this.ioReader.Read(buffer)\n\tif err != nil {\n\t\treturn\n\t}\n\tif n != len(buffer) {\n\t\terr = fmt.Errorf(\"Reading failed. Expected %v bytes but %v was read\",\n\t\t\tlen(buffer), n)\n\t}\n\treturn\n}", "func (s Stream) ReadSignedByte() (int8, error) {\n\tb, err := s.ReadByte()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn int8(b), nil\n}", "func (r *reader) read() error {\n\tn, err := r.r.Read(r.b)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\tif n < 1 {\n\t\treturn trace.BadParameter(\"unexpected error, read 0 bytes\")\n\t}\n\n\tswitch r.b[0] {\n\tcase OKByte:\n\t\treturn nil\n\tcase WarnByte, ErrByte:\n\t\tr.s.Scan()\n\t\tif err := r.s.Err(); err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\treturn trace.BadParameter(r.s.Text())\n\t}\n\treturn trace.BadParameter(\"unrecognized command: %v\", r.b)\n}", "func (s *Scanner) read() byte {\n\tif s.bRead == s.bLen {\n\t\treturn eof\n\t}\n\tb := s.buf[s.bRead]\n\ts.bRead++\n\ts.ch = b\n\tif b == '\\n' {\n\t\ts.line++\n\t\ts.prevLineOffset = s.lineOffset\n\t\ts.lineOffset = 0\n\t} else {\n\t\ts.prevLineOffset = s.lineOffset\n\t\ts.lineOffset++\n\t}\n\treturn b\n}", "func (b *BitStream) ReadByte() (byte, error) {\n\n\tif len(b.stream) == 0 {\n\t\treturn 0, io.EOF\n\t}\n\n\tif b.count == 0 {\n\t\tb.stream = b.stream[1:]\n\n\t\tif len(b.stream) == 0 {\n\t\t\treturn 0, io.EOF\n\t\t}\n\n\t\tb.count = 8\n\t}\n\n\tif b.count == 8 {\n\t\tb.count = 0\n\t\tb.bitsRead += 8\n\t\treturn b.stream[0], nil\n\t\t//b.stream = b.stream[1:]\n\t\t//return byt, nil\n\t}\n\n\tbyt := b.stream[0]\n\tb.stream = b.stream[1:]\n\n\tif len(b.stream) == 0 {\n\t\treturn 0, io.EOF\n\t}\n\n\tbyt |= b.stream[0] >> b.count\n\tb.stream[0] <<= (8 - b.count)\n\n\tb.bitsRead += 8\n\treturn byt, nil\n}", "func (b *i2cBus) ReadByte(addr byte) (byte, error) {\n\tb.mu.Lock()\n\tdefer b.mu.Unlock()\n\n\tif err := b.init(); err != nil {\n\t\treturn 0, err\n\t}\n\n\tif err := b.setAddress(addr); err != nil {\n\t\treturn 0, err\n\t}\n\n\tbytes := make([]byte, 1)\n\tn, _ := b.file.Read(bytes)\n\n\tif n != 1 {\n\t\treturn 0, fmt.Errorf(\"i2c: Unexpected number (%v) of bytes read\", n)\n\t}\n\n\treturn bytes[0], nil\n}", "func (reader MyReader) Read([]byte) (int, error) {\n\tvar b = make([]byte)\n\treturn 0, ErrRead(b)\n}", "func ReadFileAsByte(path string) ([]byte, error) {\n\tbyteArr, err := ioutil.ReadFile(path)\n\treturn byteArr, err\n}", "func (f *File) Read(b []byte) (n int, err error) {\n\treturn 0, errUnsupported\n}", "func (d *Decoder) Byte() byte {\n\tb, err := d.buf.ReadByte()\n\tif err != nil {\n\t\tpanic(\"unmarshalByte\")\n\t}\n\treturn b\n}", "func TestReadByByte(t *testing.T) {\n\trun.skipIfNoFUSE(t)\n\n\tvar data = []byte(\"hellohello\")\n\trun.createFile(t, \"testfile\", string(data))\n\trun.checkDir(t, \"testfile 10\")\n\n\tfor i := 0; i < len(data); i++ {\n\t\tfd, err := os.Open(run.path(\"testfile\"))\n\t\tassert.NoError(t, err)\n\t\tfor j := 0; j < i; j++ {\n\t\t\tbuf := make([]byte, 1)\n\t\t\tn, err := io.ReadFull(fd, buf)\n\t\t\tassert.NoError(t, err)\n\t\t\tassert.Equal(t, 1, n)\n\t\t\tassert.Equal(t, buf[0], data[j])\n\t\t}\n\t\terr = fd.Close()\n\t\tassert.NoError(t, err)\n\t}\n\n\trun.rm(t, \"testfile\")\n}", "func (s *Scanner) read() rune {\n\tch, _, err := s.reader.ReadRune()\n\tif err != nil {\n\t\treturn eof\n\t}\n\treturn ch\n}", "func (jbobject *JavaIoInputStream) Read() (int, error) {\n\tjret, err := jbobject.CallMethod(javabind.GetEnv(), \"read\", javabind.Int)\n\tif err != nil {\n\t\tvar zero int\n\t\treturn zero, err\n\t}\n\treturn jret.(int), nil\n}", "func (obj *BitFieldReader) Read(p []byte) (int, error) {\n\treturn obj.r.Read(p)\n}", "func (r *RingBuffer) ReadByte() (b byte, err error) {\n\tr.mu.Lock()\n\tdefer r.mu.Unlock()\n\n\tif r.wPos == r.rPos && !r.isFull {\n\t\treturn 0, ErrRingBufEmpty\n\t}\n\n\tb = r.buf[r.rPos]\n\tr.rPos++\n\tif r.rPos == r.size {\n\t\tr.rPos = 0\n\t}\n\n\tr.isFull = false\n\treturn b, nil\n}", "func (s *Scanner) read() rune {\n\tch, _, err := s.r.ReadRune()\n\tif err != nil {\n\t\treturn eof\n\t}\n\treturn ch\n}", "func (s *Scanner) read() rune {\n\tch, _, err := s.r.ReadRune()\n\tif err != nil {\n\t\treturn eof\n\t}\n\treturn ch\n}", "func ReadFileAsByte(path string) ([]byte, error) {\n\texists, err := PathExists(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, fmt.Errorf(\"path not exist %v\", path)\n\t}\n\tdata, err := os.ReadFile(path)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"path: %s read err: %v\", path, err)\n\t}\n\n\treturn data, nil\n}", "func (l *Lexer) read() (b byte) {\n\tb = 0\n\tif l.pos < len(l.s) {\n\t\tb = l.s[l.pos]\n\t\tl.pos++\n\t}\n\treturn b\n}", "func (l *Lexer) read() (b byte) {\n\tb = 0\n\tif l.pos < len(l.s) {\n\t\tb = l.s[l.pos]\n\t\tl.pos++\n\t}\n\treturn b\n}", "func (jbobject *JavaIoInputStream) Read3(a []byte, b int, c int) (int, error) {\n\tjret, err := jbobject.CallMethod(javabind.GetEnv(), \"read\", javabind.Int, a, b, c)\n\tif err != nil {\n\t\tvar zero int\n\t\treturn zero, err\n\t}\n\treturn jret.(int), nil\n}", "func TestReadOneByte(t *testing.T) {\n\tf, err := os.Open(dev)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdefer f.Close()\n\tbytes, err := ioutil.ReadAll(iotest.OneByteReader(f))\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\thave := string(bytes)\n\tif have != want {\n\t\tt.Fatalf(\"read %v: got %q, want %q\", dev, have, want)\n\t}\n}", "func (jbobject *JavaNioCharBuffer) Read(a JavaNioCharBufferInterface) (int, error) {\n\tconv_a := javabind.NewGoToJavaCallable()\n\tif err := conv_a.Convert(a); err != nil {\n\t\tpanic(err)\n\t}\n\tjret, err := jbobject.CallMethod(javabind.GetEnv(), \"read\", javabind.Int, conv_a.Value().Cast(\"java/nio/CharBuffer\"))\n\tif err != nil {\n\t\tvar zero int\n\t\treturn zero, err\n\t}\n\tconv_a.CleanUp()\n\treturn jret.(int), nil\n}", "func (c *DecoderReadCloser) Read(b []byte) (int, error) {\n\treturn c.d.Read(b)\n}", "func (p *Packet) ReadSByte() int8 {\n\tif p.readIndex+1 > len(p.Payload) {\n\t\tlog.Warning.Println(\"Error parsing packet arguments: { opcode=\" + strconv.Itoa(int(p.Opcode)) + \"; offset=\" + strconv.Itoa(p.readIndex) + \" };\")\n\t\treturn int8(0)\n\t}\n\tdefer func() {\n\t\tp.readIndex++\n\t}()\n\treturn int8(p.Payload[p.readIndex])\n}", "func FileRead(f *os.File, b []byte) (int, error)", "func (r byteAtATimeReader) Read(out []byte) (int, error) {\n\treturn r.Reader.Read(out[:1])\n}", "func (d *Decoder) readb(num int, bs []byte) {\r\n\tn, err := io.ReadAtLeast(d.r, bs, num)\r\n\tif err != nil {\r\n\t\t// propagage io.EOF upwards (it's special, and must be returned AS IS)\r\n\t\tif err == io.EOF {\r\n\t\t\tpanic(err)\r\n\t\t} else {\r\n\t\t\td.err(\"Error: %v\", err)\r\n\t\t}\r\n\t} else if n != num {\r\n\t\td.err(\"read: Incorrect num bytes read. Expecting: %d, Received: %d\", num, n)\r\n\t}\r\n}", "func TestReadEmptyAtEOF(t *testing.T) {\n\tb := new(Builder)\n\tslice := make([]byte, 0)\n\tn, err := b.Read(slice)\n\tif err != nil {\n\t\tt.Errorf(\"read error: %v\", err)\n\t}\n\tif n != 0 {\n\t\tt.Errorf(\"wrong count; got %d want 0\", n)\n\t}\n}", "func (l *Lexer) readChar() {\n\t// either we haven't read anything or it is the end of file (EOF).\n\tif l.readPosition >= len(l.input) {\n\t\t// sets char to 0, which is the ASCII code for the \"NUL\".\n\t\tl.char = 0\n\t} else {\n\t\tl.char = l.input[l.readPosition]\n\t}\n\n\t// set the current position of the character.\n\tl.position = l.readPosition\n\n\t// proceed to the next character.\n\tl.readPosition++\n}", "func Read(b []byte) { Reader.Read(b) }", "func (l *Lexer) read() rune {\n\tl.Reset()\n\n\tl.length, _ = l.reader.Read(l.buffer)\n\n\tif l.length == 0 {\n\t\treturn EOF\n\t}\n\n\treturn l.Next()\n}", "func (r *Reader) ReadVarInt() (int, error) {\n\tm := 1\n\tv := 0\n\tfor {\n\t\tb, err := r.ReadByte()\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\terr = io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\treturn 0, err\n\t\t}\n\t\tv += int(b&0x7f) * m\n\t\tif (b & 0x80) == 0 {\n\t\t\treturn v, nil\n\t\t}\n\t\tm *= 0x80\n\t\tif m > 0x200000 {\n\t\t\treturn 0, errors.New(\"malformed compressed int\")\n\t\t}\n\t}\n}", "func (Int8Codec) Read(data []byte, ptr unsafe.Pointer, wt WireType) (n int, err error) {\n\ti, n := ReadVarInt(data)\n\tif n < 0 {\n\t\treturn 0, fmt.Errorf(\"corrupt var int\")\n\t}\n\n\t*(*int8)(ptr) = int8(i)\n\treturn n, nil\n}", "func (s *Ssd1306) Read() byte {\n\treturn 0x00\n}", "func (d *Decoder) Read(p []byte) (int, error) {\n\tn, err := d.r.Read(p)\n\t// enforce an absolute maximum size limit\n\tif d.n += n; d.n > MaxObjectSize {\n\t\tbuild.Critical(ErrObjectTooLarge)\n\t}\n\treturn n, err\n}", "func (rb *fieldReadBuf) readVarintField() int64 {\n\trb.remaining--\n\treturn rb.defaultBuf.Varint64()\n}", "func (d *Reader) readVariable() uint64 {\n\tvar val uint64\n\tvar i uint = 0\n\tfor {\n\t\tb, err := d.src.ReadByte()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tval |= uint64(b&127) << (i * 7)\n\t\tif b < 128 {\n\t\t\tbreak\n\t\t}\n\t\ti += 1\n\t}\n\treturn val\n}", "func (tr *Reader) Read(b []byte) (n int, err error) {\n\tif tr.nb == 0 {\n\t\t// file consumed\n\t\treturn 0, io.EOF\n\t}\n\n\tif int64(len(b)) > tr.nb {\n\t\tb = b[0:tr.nb]\n\t}\n\tn, err = tr.r.Read(b)\n\ttr.nb -= int64(n)\n\n\tif err == io.EOF && tr.nb > 0 {\n\t\terr = io.ErrUnexpectedEOF\n\t}\n\ttr.err = err\n\treturn\n}", "func (r Raw) Read(b []byte) (n int64, err error) {\r\n\tpanic(\"this value cannot be read. use WriteTo() instead\")\r\n}", "func (r MyReader) Read(b []byte) (n int, err error) {\n\tb[0] = 'A'\n\treturn 1, nil\n}", "func (d *Decoder) Read(b []byte) (int, error) {\n\treturn d.r.Read(b)\n}", "func readObject(r io.ByteReader) *Object {\n\to := &Object{}\n\to.Address = readUvarint(r)\n\to.TypeAddress = readUvarint(r)\n\to.kind = readUvarint(r)\n\to.Content = readString(r)\n\to.Size = len(o.Content)\n\tif o.TypeAddress != 0 {\n\t\to.Type = typeList[o.TypeAddress]\n\t}\n\treturn o\n}", "func (r *Reader) Read(bs []byte) (int, error) {\n\treturn r.R(0).Read(bs)\n}", "func (r *ErrorReader) Read([]byte) (int, error) {\n\treturn 0, r.Error\n}", "func (r *Reader) Read(buf []byte) (int, error) {\n\tdefer func() {\n\t\tr.offset = r.h.Offset()\n\t\tr.frameInfo = r.h.FrameInfo()\n\n\t\tf := r.h.MetaCheck()\n\t\tswitch {\n\t\tcase f&MetaNewID3 != 0:\n\t\t\tid3v2, err := r.h.MetaID3()\n\t\t\tif id3v2 != nil && err == nil {\n\t\t\t\tr.meta.ID3v2 = id3v2\n\t\t\t}\n\t\t}\n\n\t}()\n\tif r.nextOffset > r.totalRead {\n\t\tn, err := io.CopyN(ioutil.Discard, r.input, r.nextOffset-r.totalRead)\n\t\tr.totalRead += n\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\tfor r.bytesSinceOk < r.maxBadBytes {\n\t\tvar feed []byte\n\t\tif r.needMore {\n\t\t\tr.needMore = false\n\t\t\tfeedLen, err := r.input.Read(r.feedBuf)\n\t\t\tr.totalRead += int64(feedLen)\n\t\t\tr.nextOffset = r.totalRead\n\t\t\tif feedLen == 0 && err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t\tfeed = r.feedBuf[:feedLen]\n\t\t\tr.bytesSinceOk += feedLen\n\t\t}\n\n\t\tswitch n, err := r.h.Decode(feed, buf); err {\n\t\tcase ErrNewFormat:\n\t\t\tr.outputFormat = r.h.OutputFormat()\n\t\t\tr.bytesSinceOk = 0\n\t\t\tif len(buf) == 0 {\n\t\t\t\treturn n, nil\n\t\t\t}\n\t\tcase ErrNeedMore:\n\t\t\tr.needMore = true\n\t\t\tif n > 0 {\n\t\t\t\tr.bytesSinceOk = 0\n\t\t\t\treturn n, nil\n\t\t\t}\n\t\tcase ErrDone:\n\t\t\treturn n, io.EOF\n\t\tdefault:\n\t\t\tr.bytesSinceOk = 0\n\t\t\treturn n, nil\n\n\t\t}\n\n\t}\n\tr.bytesSinceOk = 0\n\treturn 0, errors.New(\"No valid data found\")\n}", "func (m MyReader) Read(b []byte) (int, error) {\n\tb[0] = 'A'\n\treturn 1, nil\n}", "func (Command) Read(b []byte) (n int, err error) {\r\n\tpanic(\"this value cannot be read. use WriteTo() instead\")\r\n}", "func (reader *embedFileReader) Read(b []byte) (int, error) {\n\trest := reader.length - reader.offset\n\tif rest <= 0 {\n\t\treturn 0, io.EOF\n\t}\n\n\tn, err := reader.source.ReadAt(b, reader.start+reader.offset)\n\n\tif rest < int64(n) {\n\t\treader.offset += int64(rest)\n\t\treturn int(rest), err\n\t} else {\n\t\treader.offset += int64(n)\n\t\treturn n, err\n\t}\n}", "func (r *trackingreader) Read(b []byte) (int, error) {\n\tn, err := r.Reader.Read(b)\n\tr.pos += int64(n)\n\treturn n, err\n}", "func (f *ioFile) get() {\n\tif f.eof {\n\t\tpanic(fmt.Errorf(\"get called at eof: %s\", f.name))\n\t}\n\n\tf.eol = false\n\tif _, err := io.ReadFull(f.in, f.component[:f.componentSize]); err != nil {\n\t\tf.eof = true\n\t\tf.erstat = 1\n\t\tf.in.Close()\n\t}\n}", "func (b *Bucket) GetObjectByte(path string) ([]byte, error) {\n\tr, err := b.getObject(path)\n\tif err != nil {\n\t\treturn []byte{}, err\n\t}\n\tbuf := new(bytes.Buffer)\n\tbuf.ReadFrom(r)\n\treturn buf.Bytes(), err\n}", "func (c *Cursor) GetByte() byte {\n\treturn (*c).bytes[(*c).Index]\n}", "func (self *FCSFile) readBytes(f *os.File, byteSize int64, offset int64) string {\n\n\treadBytes := make([]byte, byteSize)\n\tf.ReadAt(readBytes, offset)\n\tbyteValue := strings.TrimSpace(string(readBytes)) //Bytes into string conversion\n\n\treturn byteValue\n\n}", "func (r *bytesReader) Read(b []byte) (n int, err error) {\n\tif r.index >= int64(len(r.bs)) {\n\t\treturn 0, io.EOF\n\t}\n\tn = copy(b, r.bs[r.index:])\n\tr.index += int64(n)\n\treturn\n}" ]
[ "0.670014", "0.637479", "0.63174605", "0.6298273", "0.627505", "0.6224188", "0.6190873", "0.6185186", "0.61139536", "0.59915936", "0.5979535", "0.59451914", "0.5936696", "0.5928542", "0.5913766", "0.5911215", "0.59038806", "0.58568925", "0.58029735", "0.580062", "0.57047933", "0.5697294", "0.56057006", "0.5574297", "0.55732095", "0.5547978", "0.55367124", "0.55315", "0.5527376", "0.55231214", "0.5496454", "0.54855144", "0.544535", "0.5441913", "0.5434072", "0.54223067", "0.5421038", "0.5405791", "0.54000825", "0.5394255", "0.5387951", "0.53815544", "0.53574806", "0.530548", "0.5263363", "0.5234886", "0.52343786", "0.5230187", "0.522996", "0.52285546", "0.52216935", "0.52090377", "0.52021897", "0.5177133", "0.51755464", "0.5147868", "0.51440424", "0.5128889", "0.5116358", "0.5114615", "0.5114615", "0.50874984", "0.5078204", "0.5078204", "0.5072353", "0.50703984", "0.5061765", "0.50548476", "0.50539225", "0.50408465", "0.50333035", "0.50302655", "0.50105566", "0.5006487", "0.49779406", "0.49760234", "0.49730387", "0.49610344", "0.4932437", "0.4920478", "0.49204382", "0.49076733", "0.49011165", "0.48785695", "0.48733035", "0.48729706", "0.48688924", "0.4868564", "0.48648626", "0.4861944", "0.4856923", "0.4855434", "0.4855022", "0.48484498", "0.4841927", "0.48212802", "0.48183683", "0.48163295", "0.4794149" ]
0.6822982
1
read reads exactly len(b) bytes from the input file. If an error occurs, read returns the error but also records it, so it is safe for callers to ignore the result as long as delaying the report is not a problem.
func (r *objReader) readFull(b []byte) error { if r.err != nil { return r.err } if r.offset+int64(len(b)) > r.limit { return r.error(io.ErrUnexpectedEOF) } n, err := io.ReadFull(r.b, b) r.offset += int64(n) if err != nil { return r.error(err) } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (b *buffer) read(rd io.Reader) (err error) {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\terr = fmt.Errorf(\"panic reading: %v\", r)\n\t\t\tb.err = err\n\t\t}\n\t}()\n\n\tvar n int\n\tbuf := b.buf[0:b.size]\n\tfor n < b.size {\n\t\tn2, err := rd.Read(buf)\n\t\tn += n2\n\t\tif err != nil {\n\t\t\tb.err = err\n\t\t\tbreak\n\t\t}\n\t\tbuf = buf[n2:]\n\t}\n\tb.buf = b.buf[0:n]\n\tb.offset = 0\n\treturn b.err\n}", "func (tr *Reader) Read(b []byte) (n int, err error) {\n\tif tr.nb == 0 {\n\t\t// file consumed\n\t\treturn 0, io.EOF\n\t}\n\n\tif int64(len(b)) > tr.nb {\n\t\tb = b[0:tr.nb]\n\t}\n\tn, err = tr.r.Read(b)\n\ttr.nb -= int64(n)\n\n\tif err == io.EOF && tr.nb > 0 {\n\t\terr = io.ErrUnexpectedEOF\n\t}\n\ttr.err = err\n\treturn\n}", "func (r *reader) read() error {\n\tn, err := r.r.Read(r.b)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\tif n < 1 {\n\t\treturn trace.BadParameter(\"unexpected error, read 0 bytes\")\n\t}\n\n\tswitch r.b[0] {\n\tcase OKByte:\n\t\treturn nil\n\tcase WarnByte, ErrByte:\n\t\tr.s.Scan()\n\t\tif err := r.s.Err(); err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\treturn trace.BadParameter(r.s.Text())\n\t}\n\treturn trace.BadParameter(\"unrecognized command: %v\", r.b)\n}", "func (s *stream) read(b []byte) (int, error) {\n\ts.log(logTypeStream, \"Reading from stream %v requested len = %v current chunks=%v\", s.id, len(b), len(s.recv.chunks))\n\n\tread := 0\n\n\tfor len(b) > 0 {\n\t\tif len(s.recv.chunks) == 0 {\n\t\t\tbreak\n\t\t}\n\n\t\tchunk := s.recv.chunks[0]\n\n\t\t// We have a gap.\n\t\tif chunk.offset > s.recv.offset {\n\t\t\tbreak\n\t\t}\n\n\t\t// Remove leading bytes\n\t\tremove := s.recv.offset - chunk.offset\n\t\tif remove > uint64(len(chunk.data)) {\n\t\t\t// Nothing left.\n\t\t\ts.recv.chunks = s.recv.chunks[1:]\n\t\t\tcontinue\n\t\t}\n\n\t\tchunk.offset += remove\n\t\tchunk.data = chunk.data[remove:]\n\n\t\t// Now figure out how much we can read\n\t\tn := copy(b, chunk.data)\n\t\tchunk.data = chunk.data[n:]\n\t\tchunk.offset += uint64(n)\n\t\ts.recv.offset += uint64(n)\n\t\tb = b[n:]\n\t\tread += n\n\n\t\t// This chunk is empty.\n\t\tif len(chunk.data) == 0 {\n\t\t\ts.recv.chunks = s.recv.chunks[1:]\n\t\t\tif chunk.last {\n\t\t\t\ts.closeRecv()\n\t\t\t}\n\t\t}\n\t}\n\n\t// If we have read no data, say we would have blocked.\n\tif read == 0 {\n\t\tif s.recv.closed {\n\t\t\treturn 0, ErrorStreamIsClosed\n\t\t}\n\t\treturn 0, ErrorWouldBlock\n\t}\n\treturn read, nil\n}", "func (d *Decoder) readb(num int, bs []byte) {\r\n\tn, err := io.ReadAtLeast(d.r, bs, num)\r\n\tif err != nil {\r\n\t\t// propagage io.EOF upwards (it's special, and must be returned AS IS)\r\n\t\tif err == io.EOF {\r\n\t\t\tpanic(err)\r\n\t\t} else {\r\n\t\t\td.err(\"Error: %v\", err)\r\n\t\t}\r\n\t} else if n != num {\r\n\t\td.err(\"read: Incorrect num bytes read. Expecting: %d, Received: %d\", num, n)\r\n\t}\r\n}", "func FileRead(f *os.File, b []byte) (int, error)", "func (b brokenReader) Read(p []byte) (n int, err error) {\n\treturn 0, errors.New(\"brokenReader is always broken.\")\n}", "func (p *pipe) read(b []byte) (int, error) {\n\t// Short circuit if the output was already closed\n\tselect {\n\tcase <-p.outQuit:\n\t\treturn 0, ErrClosedPipe\n\tdefault:\n\t}\n\t// Wait until some data becomes available\n\tsafeFree, err := p.outputWait()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\t// Retrieve as much as available\n\tlimit := p.outPos + p.size - safeFree\n\tif limit > p.size {\n\t\tlimit = p.size\n\t}\n\tif limit > p.outPos+int32(len(b)) {\n\t\tlimit = p.outPos + int32(len(b))\n\t}\n\twritten := copy(b, p.buffer[p.outPos:limit])\n\n\t// Update the pipe output state and return\n\tp.outputAdvance(written)\n\treturn written, nil\n}", "func (t *File) Read(b []byte) (int, error) {\n\t// Don't return 0, nil\n\tfor t.ring.Readable == 0 && !t.closed {\n\t\ttime.Sleep(PollIntervalFast) // Maybe swap this out for a notification at some point, but tbh, this works\n\t}\n\n\tif t.closed == true {\n\t\treturn 0, io.EOF\n\t}\n\n\t// Check for any waiting errors\n\tselect {\n\tcase err := <-t.errc:\n\t\tif err != nil { // Just in case XD\n\t\t\treturn 0, err\n\t\t}\n\tdefault:\n\t}\n\n\treturn t.ring.Read(b)\n}", "func (f *File) Read(b []byte) (n int, err error) {\n\treturn 0, errUnsupported\n}", "func (this *reader) ioRead(buffer []byte) (n int, err error) {\n\tn, err = this.ioReader.Read(buffer)\n\tif err != nil {\n\t\treturn\n\t}\n\tif n != len(buffer) {\n\t\terr = fmt.Errorf(\"Reading failed. Expected %v bytes but %v was read\",\n\t\t\tlen(buffer), n)\n\t}\n\treturn\n}", "func (c *TestConnection) Read(b []byte) (n int, err error) {\n toRet := 0\n if b == nil {\n return 0, errors.New(\"b cannot be nil\")\n }\n\n if c.ReadError != nil && c.TimesReadCalled == c.ThrowReadErrorAfter {\n return 0, c.ReadError\n }\n\n if len(c.ToRead) == 0 {\n return 0, nil\n } \n \n dataToRet := c.ToRead[0]\n buffLength := len(b)\n \n // b is big enough to hold dataToRet\n if buffLength >= len(dataToRet) {\n copy(b, []byte(dataToRet))\n c.ToRead = append(c.ToRead[:0], c.ToRead[1:]...) // remove the first element \n toRet = len(dataToRet)\n } else {\n // need to only return the maximum we can\n remains := dataToRet[buffLength:len(dataToRet)]\n c.ToRead[0] = remains // keep the remainder of the data\n copy(b, dataToRet[0:buffLength])\n toRet = buffLength\n }\n \n c.TimesReadCalled++\n return toRet, nil\n}", "func Read(b []byte) (n int, err error) {\n\treturn io.ReadFull(r, b)\n}", "func (body *Body) Read(b []byte) (n int, err error) {\n\tif !body.IsOpen() {\n\t\treturn 0, fmt.Errorf(\"ERROR: Body has been closed\\n\")\n\t}\n\tif len(body.b) == 0 {\n\t\treturn 0, io.EOF\n\t}\n\tn = copy(b, body.b)\n\tbody.b = body.b[n:]\n\treturn n, nil\n}", "func (r *ChannelReader) Read(b []byte) (sz int, err error) {\n\tif len(b) == 0 {\n\t\treturn 0, io.ErrShortBuffer\n\t}\n\n\tfor {\n\t\tif len(r.buf) > 0 {\n\t\t\tif len(r.buf) <= len(b) {\n\t\t\t\tsz = len(r.buf)\n\t\t\t\tcopy(b, r.buf)\n\t\t\t\tr.buf = nil\n\t\t\t} else {\n\t\t\t\tcopy(b, r.buf)\n\t\t\t\tr.buf = r.buf[len(b):]\n\t\t\t\tsz = len(b)\n\t\t\t}\n\t\t\treturn sz, nil\n\t\t}\n\n\t\tvar ok bool\n\t\tif r.deadline.IsZero() {\n\t\t\tr.buf, ok = <-r.c\n\t\t} else {\n\t\t\ttimer := time.NewTimer(r.deadline.Sub(time.Now()))\n\t\t\tdefer timer.Stop()\n\n\t\t\tselect {\n\t\t\tcase r.buf, ok = <-r.c:\n\t\t\tcase <-timer.C:\n\t\t\t\treturn 0, context.DeadlineExceeded\n\t\t\t}\n\t\t}\n\t\tif len(r.buf) == 0 && !ok {\n\t\t\treturn 0, io.EOF\n\t\t}\n\t}\n}", "func (c *Conn) Read(b []byte) (n int, err error) {\n\tif len(b) == 0 {\n\t\treturn 0, nil\n\t}\n\terr = tryAgain\n\tfor err == tryAgain {\n\t\tn, errcb := c.read(b)\n\t\terr = c.handleError(errcb)\n\t\tif err == nil {\n\t\t\tgo c.flushOutputBuffer()\n\t\t\treturn n, nil\n\t\t}\n\t\tif err == io.ErrUnexpectedEOF {\n\t\t\terr = io.EOF\n\t\t}\n\t}\n\treturn 0, err\n}", "func (r *bytesReader) Read(b []byte) (n int, err error) {\n\tif r.index >= int64(len(r.bs)) {\n\t\treturn 0, io.EOF\n\t}\n\tn = copy(b, r.bs[r.index:])\n\tr.index += int64(n)\n\treturn\n}", "func (r *timeoutReadCloser) Read(b []byte) (int, error) {\n\ttimer := time.NewTimer(r.duration)\n\tc := make(chan readResult, 1)\n\n\tgo func() {\n\t\tn, err := r.reader.Read(b)\n\t\ttimer.Stop()\n\t\tc <- readResult{n: n, err: err}\n\t}()\n\n\tselect {\n\tcase data := <-c:\n\t\treturn data.n, data.err\n\tcase <-timer.C:\n\t\treturn 0, &ResponseTimeoutError{TimeoutDur: r.duration}\n\t}\n}", "func (f *FailingReader) Read(p []byte) (n int, err error) {\n\treturn 0, errors.New(\"Simulated read error\")\n}", "func (f *messageBytePipe) Read(b []byte) (int, error) {\n\tif f.readEOF {\n\t\treturn 0, io.EOF\n\t}\n\tn, err := f.file.Read(b)\n\tif err == io.EOF {\n\t\t// If this was the result of a zero-byte read, then\n\t\t// it is possible that the read was due to a zero-size\n\t\t// message. Since we are simulating CloseWrite with a\n\t\t// zero-byte message, ensure that all future Read calls\n\t\t// also return EOF.\n\t\tf.readEOF = true\n\t} else if err == windows.ERROR_MORE_DATA {\n\t\t// ERROR_MORE_DATA indicates that the pipe's read mode is message mode\n\t\t// and the message still has more bytes. Treat this as a success, since\n\t\t// this package presents all named pipes as byte streams.\n\t\terr = nil\n\t}\n\treturn n, err\n}", "func (e errorConnection) Read(b []byte) (n int, err error) {\n\treturn 0, e.err\n}", "func (p *Bare) Read(b []byte) (n int, err error) {\n\tsizeMsg := fmt.Sprintln(\"e:buf too small, expecting\", defaultSize, \"bytes.\")\n\tif len(b) < len(sizeMsg) {\n\t\treturn\n\t}\n\tif len(b) < defaultSize {\n\t\tn = copy(b, sizeMsg)\n\t\treturn\n\t}\n\tp.b = b\n\t// fill intermediate read buffer for pack encoding\n\tn, err = p.in.Read(b) // use b as intermediate buffer to avoid allocation\n\t// p.syncBuffer can contain unprocessed bytes from last call.\n\tp.syncBuffer = append(p.syncBuffer, b[:n]...) // merge with leftovers\n\tn = 0\n\tif nil != err && io.EOF != err {\n\t\treturn\n\t}\n\t// Even err could be io.EOF some valid data possibly in p.syncBuffer.\n\t// In case of file input (JLINK usage) a plug off is not detectable here.\n\tfor {\n\t\tif len(p.syncBuffer) < 4 {\n\t\t\treturn // wait\n\t\t}\n\t\tp.bc = 4\n\t\thead := int(p.readU32(p.syncBuffer[0:4]))\n\t\tif 0x89abcdef == uint(head) { // sync trice\n\t\t\tp.rub(4)\n\t\t\tcontinue\n\t\t}\n\t\ttriceID := head >> 16 // 2 msb bytes are the ID\n\t\tp.payload = append(p.payload, 0xffff&head) // next 2 bytes are payload\n\t\tif 8 < len(p.payload) {\n\t\t\tp.payload = p.payload[:0]\n\t\t\treturn p.outOfSync(fmt.Sprintf(\"too much payload data %d\", len(p.payload)))\n\t\t}\n\t\tif 0 == triceID {\n\t\t\tp.rub(4)\n\t\t\tcontinue\n\t\t}\n\t\tvar ok bool\n\t\tp.trice, ok = p.lut[triceID] // check lookup table\n\t\tif !ok {\n\t\t\tp.payload = p.payload[:0]\n\t\t\treturn p.outOfSync(fmt.Sprintf(\"unknown triceID %5d\", triceID))\n\t\t}\n\t\tif !p.payloadLenOk() {\n\t\t\tp.payload = p.payload[:0]\n\t\t\treturn p.outOfSync(fmt.Sprintf(\"unecpected payload len %d\", p.expectedPayloadLen()))\n\t\t}\n\t\tp.rub(4)\n\t\t// ID and count are ok\n\t\treturn p.sprintTrice()\n\t}\n}", "func (r *trackingreader) Read(b []byte) (int, error) {\n\tn, err := r.Reader.Read(b)\n\tr.pos += int64(n)\n\treturn n, err\n}", "func (p *ProgressReader) Read(b []byte) (n int, err error) {\n\tn, err = p.r.Read(b)\n\tp.updateProgress(int64(n))\n\treturn\n}", "func (t *TarReader) Read(b []byte) (int, error) {\n\tif !t.doneHeader {\n\t\thdr, err := Validate(t.r)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tt.size = hdr.Size\n\t\tt.doneHeader = true\n\t}\n\n\tif t.offset == t.size {\n\t\treturn 0, io.EOF\n\t}\n\n\tif int64(len(b)) > (t.size - t.offset) {\n\t\tb = make([]byte, t.size)\n\t}\n\n\ti, err := t.r.Read(b)\n\tt.offset += int64(i)\n\treturn i, err\n}", "func (r Raw) Read(b []byte) (n int64, err error) {\r\n\tpanic(\"this value cannot be read. use WriteTo() instead\")\r\n}", "func (dc *Conn) Read(b []byte) (n int, err error) {\n\tif !dc.inState(stateInitial) {\n\t\treturn dc.followUpRead(b)\n\t}\n\t// state will always be settled after first read, safe to clear buffer at end of it\n\tdefer dc.resetLocalBuffer()\n\tstart := time.Now()\n\tif !dc.readDeadline.IsZero() && dc.readDeadline.Sub(start) < 2*TimeoutToDetour {\n\t\tlog.Tracef(\"no time left to test %s, read %s\", dc.addr, statesDesc[stateDirect])\n\t\tdc.setState(stateDirect)\n\t\treturn dc.countedRead(b)\n\t}\n\t// wait for at most TimeoutToDetour to read\n\tdc.getConn().SetReadDeadline(start.Add(TimeoutToDetour))\n\tn, err = dc.countedRead(b)\n\tdc.getConn().SetReadDeadline(dc.readDeadline)\n\n\tdetector := blockDetector.Load().(*Detector)\n\tif err != nil {\n\t\tlog.Debugf(\"Error while read from %s %s: %s\", dc.addr, dc.stateDesc(), err)\n\t\tif detector.TamperingSuspected(err) {\n\t\t\t// to avoid double submitting, we only resend Idempotent requests\n\t\t\t// but return error directly to application for other requests.\n\t\t\tif dc.isIdempotentRequest() {\n\t\t\t\tlog.Debugf(\"Detour HTTP GET request to %s\", dc.addr)\n\t\t\t\treturn dc.detour(b)\n\t\t\t} else {\n\t\t\t\tlog.Debugf(\"Not HTTP GET request, add to whitelist\")\n\t\t\t\tAddToWl(dc.addr, false)\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\t// Hijacked content is usualy encapsulated in one IP packet,\n\t// so just check it in one read rather than consecutive reads.\n\tif detector.FakeResponse(b) {\n\t\tlog.Tracef(\"Read %d bytes from %s %s, response is hijacked, detour\", n, dc.addr, dc.stateDesc())\n\t\treturn dc.detour(b)\n\t}\n\tlog.Tracef(\"Read %d bytes from %s %s, set state to direct\", n, dc.addr, dc.stateDesc())\n\tdc.setState(stateDirect)\n\treturn\n}", "func read(r io.Reader) ([]byte, error) {\n\tvar data []byte\n\t// defer r.Close()\n\tbufSize := 1024 * 10\n\tbuf := make([]byte, bufSize) //一次读取多少个字节\n\tbfRd := bufio.NewReader(r)\n\tfor {\n\t\tn, err := bfRd.Read(buf)\n\t\tdata = append(data, buf[:n]...)\n\t\tif err != nil { //遇到任何错误立即返回,并忽略EOF错误信息\n\t\t\tif err == io.EOF {\n\t\t\t\treturn data, nil\n\t\t\t}\n\t\t\treturn data, err\n\t\t}\n\t}\n\treturn data, nil\n}", "func (fr *FormatReaders) read(buf []byte) (int, error) {\n\treturn io.ReadFull(fr.TopReader(), buf)\n}", "func (p *Esc) Read(b []byte) (n int, err error) {\n\tsizeMsg := fmt.Sprintln(\"e:buf too small, expecting\", defaultSize, \"bytes.\")\n\tif len(b) < len(sizeMsg) {\n\t\treturn\n\t}\n\tif len(b) < defaultSize {\n\t\tn = copy(b, sizeMsg)\n\t\treturn\n\t}\n\n\t// use b as intermediate read buffer to avoid allocation\n\tn, err = p.in.Read(b)\n\t// p.syncBuffer can contain unprocessed bytes from last call.\n\tp.syncBuffer = append(p.syncBuffer, b[:n]...) // merge with leftovers\n\tn = 0\n\tif nil != err && io.EOF != err {\n\t\tn = copy(b, fmt.Sprintln(\"error:internal reader error \", err))\n\t\treturn\n\t}\n\n\t// Even err could be io.EOF some valid data possibly in p.syncBuffer.\n\t// In case of file input (JLINK usage) a plug off is not detectable here.\n\n\tp.bc = len(p.syncBuffer) // intermediade assingment for better error tracking\n\tif p.bc < 4 {\n\t\treturn // wait\n\t}\n\tp.b = b\n\tif 0xec != p.syncBuffer[0] { // 0xec == 236\n\t\treturn p.outOfSync(\"start byte is not 0xEC\")\n\t}\n\tlengthCode := p.syncBuffer[1]\n\tif 0xde == lengthCode { // 0xde == 222\n\t\treturn p.outOfSync(\"0xEC is followed by 0xDE, so no start byte\")\n\t}\n\ttriceID := int(binary.BigEndian.Uint16(p.syncBuffer[2:4]))\n\tvar ok bool\n\tp.trice, ok = p.lut[triceID]\n\tif !ok { // unknown id\n\t\treturn p.outOfSync(fmt.Sprint(\"unknown ID \", triceID))\n\t}\n\tp.bc = p.bytesCount(lengthCode) // payload plus header\n\tif p.expectedByteCount() != p.bc {\n\t\treturn p.outOfSync(fmt.Sprint(\"trice.Type \", p.trice.Type, \" with not matching length code \", lengthCode))\n\t}\n\tif len(p.syncBuffer) < 4+p.bc { // header plus payload\n\t\treturn // wait\n\t}\n\t// ID and count are ok\n\treturn p.sprintTrice()\n}", "func (p *Pipe) Read(b []byte) (n int, err error) {\n\tp.c.L.Lock()\n\tdefer p.c.L.Unlock()\n\tfor p.b.Len() == 0 {\n\t\tif p.err != nil {\n\t\t\treturn 0, p.err\n\t\t}\n\t\tp.c.Wait()\n\t}\n\tn, err = p.b.Read(b)\n\treturn\n}", "func (mCn mockConn) Read(b []byte) (n int, err error) {\n\tfmt.Printf(\"reading: %d of %d.\\n\", *mCn.readCount, len(mockConnOutpBytes))\n\tif *mCn.readCount < len(mockConnOutpBytes) {\n\t\tcopy(b, mockConnOutpBytes[*mCn.readCount])\n\t\t*mCn.readCount = *mCn.readCount + 1\n\t}\n\treturn len(b), nil\n}", "func (l *LeechedReadCloser) Read(b []byte) (n int, err error) {\n\tspaceLeft := l.maxBodyLogSize - l.loggedBytesCount\n\tif spaceLeft > 0 {\n\t\t// Let's read the request into our Logger (not all of it maybe), but also let's make sure that\n\t\t// we'll be able to to copy all the content we read in l.data into b\n\t\tn, err := l.originalReadCloser.Read(l.data[l.loggedBytesCount : l.loggedBytesCount+min(int64(len(b)), spaceLeft)])\n\n\t\t// And copy what was read into the original slice\n\t\tcopy(b, l.data[l.loggedBytesCount:l.loggedBytesCount+int64(n)])\n\n\t\t// Let's not forget to increment the pointer on the currently logged amount of bytes\n\t\tl.loggedBytesCount += int64(n)\n\n\t\t// And return what the Read() call we did on the original ReadCloser just returned, shhhhh\n\t\treturn n, err\n\t}\n\n\t// Our leecher is full ? Nevermind, let's just call read on the original Reader. Apart from an\n\t// additional level in the call stack and an if statement, we have no overhead for large bodies :)\n\treturn l.originalReadCloser.Read(b)\n}", "func (pt *PassThru) Read(p []byte) (int, error) {\n\tn, err := pt.Reader.Read(p)\n\tif n > 0 {\n\t\tpt.total += int64(n)\n\t\tfmt.Fprintf(os.Stderr, \"\\b\\b\\b\\b\\b\\b\\b\\b\\b\\b\\b\\b\\b\\b\\b\\b\\b\\b\\b\\b\\b\\b\\b\")\n\t\tfmt.Fprintf(os.Stderr, \"%s/%s\", ByteSize(pt.total), ByteSize(pt.length))\n\t}\n\tif n <= 0 || pt.length == pt.total {\n\t\tfmt.Fprintf(os.Stderr, \"\\n\")\n\t}\n\n\treturn n, err\n}", "func (d *BodyReader) Read(b []byte) (n int, err error) {\n\tmax := len(b)\n\n\tif d.done {\n\t\tremain := d.n - d.pos\n\t\tif remain > 0 {\n\t\t\tif remain > max {\n\t\t\t\tremain = max\n\t\t\t}\n\t\t\tread := copy(b, d.buf[d.pos:d.pos+remain])\n\t\t\td.pos += read\n\t\t\treturn read, nil\n\t\t}\n\n\t\treturn d.r.Read(b)\n\t}\n\n\tn, e := d.r.Read(d.buf[d.n:])\n\td.n += n\n\tif len(d.buf)-10 <= d.n {\n\t\t// Grow\n\t\td.buf = append(d.buf, make([]byte, DefaultBufSize)...)\n\t}\n\n\tif idx := bytes.Index(d.buf, SEP); idx != -1 {\n\t\td.done = true\n\t\tfrom := idx + len(SEP)\n\t\tto := d.n - from\n\t\tif to > max {\n\t\t\tto = max\n\t\t}\n\t\tif len(d.buf) < d.n {\n\t\t\tpanic(fmt.Errorf(\"Buf smaller than positions?? %d/%d (pos=%d)\", len(d.buf), d.n, from))\n\t\t}\n\n\t\tread := copy(b, d.buf[from:from+to])\n\t\td.pos = from + read\n\t\treturn read, e\n\t}\n\n\t// No end of header yet so return nothing\n\treturn 0, e\n}", "func (dc *Conn) followUpRead(b []byte) (n int, err error) {\n\tdetector := blockDetector.Load().(*Detector)\n\tif n, err = dc.countedRead(b); err != nil {\n\t\tif err == io.EOF {\n\t\t\tlog.Tracef(\"Read %d bytes from %s %s, EOF\", n, dc.addr, dc.stateDesc())\n\t\t\treturn\n\t\t}\n\t\tlog.Tracef(\"Read from %s %s failed: %s\", dc.addr, dc.stateDesc(), err)\n\t\tswitch {\n\t\tcase dc.inState(stateDirect) && detector.TamperingSuspected(err):\n\t\t\t// to prevent a slow or unstable site from been treated as blocked,\n\t\t\t// we only check first 4K bytes, which roughly equals to the payload of 3 full packets on Ethernet\n\t\t\tif atomic.LoadInt64(&dc.readBytes) <= 4096 {\n\t\t\t\tlog.Tracef(\"Seems %s still blocked, add to whitelist so will try detour next time\", dc.addr)\n\t\t\t\tAddToWl(dc.addr, false)\n\t\t\t}\n\t\tcase dc.inState(stateDetour) && wlTemporarily(dc.addr):\n\t\t\tlog.Tracef(\"Detoured route is not reliable for %s, not whitelist it\", dc.addr)\n\t\t\tRemoveFromWl(dc.addr)\n\t\t}\n\t\treturn\n\t}\n\t// Hijacked content is usualy encapsulated in one IP packet,\n\t// so just check it in one read rather than consecutive reads.\n\tif dc.inState(stateDirect) && detector.FakeResponse(b) {\n\t\tlog.Tracef(\"%s still content hijacked, add to whitelist so will try detour next time\", dc.addr)\n\t\tAddToWl(dc.addr, false)\n\t\treturn\n\t}\n\tlog.Tracef(\"Read %d bytes from %s %s\", n, dc.addr, dc.stateDesc())\n\treturn\n}", "func (s *Stream) Read(b []byte) (int, error) {\n\tlogf(logTypeConnection, \"Reading from stream %v\", s.Id())\n\tif len(s.in) == 0 {\n\t\treturn 0, ErrorWouldBlock\n\t}\n\tif s.in[0].offset > s.readOffset {\n\t\treturn 0, ErrorWouldBlock\n\t}\n\tn := copy(b, s.in[0].data)\n\tif n == len(s.in[0].data) {\n\t\ts.in = s.in[1:]\n\t}\n\ts.readOffset += uint64(n)\n\treturn n, nil\n}", "func (c *conn) Read(b []byte) (int, error) {\n\tc.ronce.Do(c.sleepLatency)\n\n\tn, err := c.rb.FillThrottle(func(remaining int64) (int64, error) {\n\t\tmax := remaining\n\t\tif l := int64(len(b)); max > l {\n\t\t\tmax = l\n\t\t}\n\n\t\tn, err := c.Conn.Read(b[:max])\n\t\treturn int64(n), err\n\t})\n\tif err != nil && err != io.EOF {\n\t\tlog.Errorf(\"trafficshape: error on throttled read: %v\", err)\n\t}\n\n\treturn int(n), err\n}", "func (r *copyReader) Read(b []byte) (int, error) {\n\tif r.rerr != nil {\n\t\treturn 0, r.rerr\n\t}\n\n\tr.once.Do(r.init)\n\treturn r.rbuf.Read(b)\n}", "func (a *file_asset) Read(b []byte) (n int, err error) {\n\treturn a.f.Read(b)\n}", "func Read(b []byte) { Reader.Read(b) }", "func (dev *Device) read(contxt context.Context, waitResponse bool) ([]byte, error) {\n\n\tcountError := 0\n\tlastEvent := time.Now()\n\t//TODO timeoutRead?\n\tfuncerr := func(err error) error {\n\t\tif err == nil {\n\t\t\treturn nil\n\t\t}\n\t\tlog.Printf(\"funcread err: %s\", err)\n\t\tswitch {\n\t\tcase errors.Is(err, os.ErrClosed):\n\t\t\treturn err\n\t\tcase errors.Is(err, io.ErrClosedPipe):\n\t\t\treturn err\n\t\tcase errors.Is(err, io.EOF):\n\t\t\tif time.Since(lastEvent) < 10*time.Microsecond {\n\t\t\t\tif countError > 3 {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tcountError++\n\t\t\t}\n\n\t\t\tlastEvent = time.Now()\n\t\t}\n\n\t\treturn nil\n\n\t}\n\n\t//TODO: limit to read\n\tbb := make([]byte, 0)\n\tindxb := 0\n\tlendata := uint32(0)\n\tfor {\n\n\t\tselect {\n\t\tcase <-contxt.Done():\n\t\t\treturn nil, fmt.Errorf(\"timeout error, %w\", smartcard.ErrComm)\n\t\tdefault:\n\t\t}\n\t\ttempb := make([]byte, 2048)\n\n\t\t// fmt.Println(\"execute read\")\n\n\t\tn, err := dev.port.Read(tempb)\n\t\tif err != nil && n <= 0 {\n\t\t\tif err := funcerr(err); err != nil {\n\t\t\t\t// log.Printf(\"0, err: %s\", err)\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\t// fmt.Printf(\"len: %v, [% X]\\n\", len(tempb[:n]), tempb[:n])\n\n\t\t// prepareBuffer := make([]byte, len(tempb[:n]))\n\n\t\t// copy(prepareBuffer, tempb[:n])\n\n\t\tbf := bytes.NewBuffer(tempb[:n])\n\t\t// fmt.Printf(\"len: %v, %v, %v, %v\\n\", len(prepareBuffer), cap(prepareBuffer), bf.Cap(), bf.Len())\n\n\t\tb := func() []byte {\n\t\t\tvar result []byte\n\n\t\t\tfor {\n\t\t\t\tselect {\n\t\t\t\tcase <-contxt.Done():\n\t\t\t\t\treturn nil\n\t\t\t\tdefault:\n\t\t\t\t}\n\n\t\t\t\tlast, err := bf.ReadByte()\n\t\t\t\tif err == nil {\n\t\t\t\t\tif indxb <= 0 && last != '\\x02' {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tindxb++\n\t\t\t\t\tbb = append(bb, last)\n\t\t\t\t} else {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\t// fmt.Printf(\"len: %v, last: %X, [% X]\\n\", len(bb), last, bb[:])\n\t\t\t\t// log.Println(\"2\")\n\t\t\t\tif len(bb) == 6 {\n\n\t\t\t\t\tlendata = binary.LittleEndian.Uint32(bb[2:6])\n\t\t\t\t\t// fmt.Printf(\"len data: %d\\n\", lendata)\n\t\t\t\t}\n\t\t\t\tif last == '\\x03' && len(bb) == 4 && bb[1] == bb[2] {\n\t\t\t\t\tresult = make([]byte, len(bb))\n\t\t\t\t\tcopy(result, bb[:])\n\t\t\t\t\tbb = make([]byte, 0)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif last == '\\x03' && len(bb) >= int(lendata)+1+10+1+1 {\n\t\t\t\t\t// fmt.Printf(\"tempb final: [% X]\\n\", bb[:])\n\n\t\t\t\t\tresult = make([]byte, len(bb))\n\t\t\t\t\tcopy(result, bb[:])\n\t\t\t\t\tbb = make([]byte, 0)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn result\n\t\t}()\n\n\t\tif waitResponse {\n\t\t\tif len(b) <= 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif len(b) == 4 && b[1] == b[2] && b[1] == 0x00 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif len(b) == 13 && bytes.Equal(b, FRAME_NACK) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif b[len(b)-1] != 0x03 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\t// fmt.Printf(\"resul final: [% X]\\n\", b[:])\n\n\t\t// if indxb <= 0 {\n\t\t// \tif b == '\\x02' {\n\t\t// \t\ttempb[0] = b\n\t\t// \t\tindxb = 1\n\t\t// \t}\n\t\t// \tcontinue\n\t\t// }\n\n\t\t// tempb[indxb] = b\n\t\t// indxb++\n\t\t// fmt.Printf(\"len: %v, [% X]\\n\", indxb, tempb[:indxb])\n\t\t// // log.Println(\"2\")\n\t\t// if indxb == 6 {\n\t\t// \tlendata = binary.LittleEndian.Uint32(tempb[2:6])\n\t\t// }\n\t\t// if b == '\\x03' && indxb == 4 && tempb[1] == tempb[2] {\n\t\t// \tdest := make([]byte, indxb)\n\t\t// \tcopy(dest, tempb[:indxb])\n\t\t// \treturn dest, nil\n\t\t// }\n\t\t// if b == '\\x03' && indxb >= int(lendata)+1+10+1+1 {\n\t\t// \t// fmt.Printf(\"tempb final: [% X]\\n\", tempb[:indxb])\n\n\t\t// \tdest := make([]byte, indxb)\n\t\t// \tcopy(dest, tempb[:indxb])\n\t\t// \treturn dest, nil\n\t\t// }\n\t\tdest := make([]byte, len(b))\n\t\tcopy(dest, b[:])\n\t\tfmt.Printf(\"recv data: %v, [% X]\\n\", len(b), b[:])\n\t\treturn dest, nil\n\n\t}\n}", "func (w *Reader) Read(b []byte) (n int, err error) {\n\treturn w.OnRead(b)\n}", "func (p *Device) Read(b []byte) (int, error) {\n\treturn p.tempLogFileHandle.Read(b)\n}", "func (Header) Read(b []byte) (n int, err error) {\r\n\tpanic(\"this value cannot be read. use WriteTo instead\")\r\n}", "func (p *pipe) Read(b []byte) (int, error) {\n\tif p.msgRemainder != nil {\n\t\tn := copy(b, p.msgRemainder)\n\t\tif len(p.msgRemainder) > n {\n\t\t\ttmpBuf := make([]byte, len(p.msgRemainder)-n)\n\t\t\tcopy(tmpBuf, p.msgRemainder[n:])\n\t\t\tp.msgRemainder = tmpBuf\n\t\t} else {\n\t\t\tp.msgRemainder = nil\n\t\t}\n\n\t\treturn n, nil\n\t}\n\n\tselect {\n\tcase msg := <-p.ch:\n\t\tif msg.err == io.EOF {\n\t\t\treturn 0, msg.err\n\t\t}\n\n\t\tn := copy(b, msg.data)\n\n\t\t// Store the remainder of the message for next Read.\n\t\tif len(msg.data) > n {\n\t\t\tp.msgRemainder = make([]byte, len(msg.data)-n)\n\t\t\tcopy(p.msgRemainder, msg.data[n:])\n\t\t} else {\n\t\t\tp.msgRemainder = nil\n\t\t}\n\n\t\treturn n, msg.err\n\tcase <-p.ctx.Done():\n\t\treturn 0, p.ctx.Err()\n\t}\n}", "func (p *port) Read(b []byte) (n int, err error) {\n\tvar rfds syscall.FdSet\n\n\tfd := int(p.file.Fd())\n\tfdSet(fd, &rfds)\n\n\tvar tv *syscall.Timeval\n\tif p.timeout > 0 {\n\t\ttimeout := syscall.NsecToTimeval(p.timeout.Nanoseconds())\n\t\ttv = &timeout\n\t}\n\tif _, err = syscall.Select(fd+1, &rfds, nil, nil, tv); err != nil {\n\t\terr = fmt.Errorf(\"serial: could not select: %v\", err)\n\t\treturn\n\t}\n\tif !fdIsSet(fd, &rfds) {\n\t\t// Timeout\n\t\terr = ErrTimeout\n\t\treturn\n\t}\n\tn, err = p.file.Read(b)\n\treturn\n}", "func (c *conn) Read(b []byte) (n int, err error) {\n\tvar data []byte\n\n\tif c.rdata != nil {\n\t\tdata = c.rdata\n\t} else {\n\t\tdata = <-c.readCh\n\t}\n\n\tif data == nil {\n\t\treturn 0, io.EOF\n\t}\n\n\tif len(data) > len(b) {\n\t\tcopy(b, data[:len(b)])\n\t\tc.rdata = data[len(b):]\n\t\treturn len(b), nil\n\t}\n\n\tc.rdata = nil\n\tcopy(b, data)\n\n\treturn len(data), nil\n}", "func (r *ErrorReader) Read([]byte) (int, error) {\n\treturn 0, r.Error\n}", "func (z zipReader) Read(b []byte) (int, error) {\n\tif z.b.Len() >= len(b) || z.b.Len() >= bufferSize {\n\t\treturn z.b.Read(b)\n\t}\n\tmsg, err := z.s.Recv()\n\tif err != nil {\n\t\tif err == io.EOF {\n\t\t\treturn z.b.Read(b)\n\t\t}\n\t\treturn 0, err\n\t}\n\tif _, err := z.b.Write(msg.GetData()); err != nil {\n\t\treturn 0, err\n\t}\n\treturn z.b.Read(b)\n}", "func (p *progress) Read(b []byte) (n int, err error) {\n\tn, err = p.rc.Read(b)\n\tif err != nil && err != io.EOF {\n\t\treturn\n\t}\n\tp.offset += int64(n)\n\t// Invokes the user's callback method to report progress\n\tp.pr(p.offset)\n\treturn\n}", "func (r *Reader) Read(b []byte) (n int, err error) {\n\tif r.i >= int64(len(r.s)) {\n\t\treturn 0, io.EOF\n\t}\n\tr.prevRune = -1\n\tn = copy(b, r.s[r.i:])\n\tr.i += int64(n)\n\treturn\n}", "func readFull(r io.Reader, buf []byte) (n int, err error) {\n\tfor n < len(buf) && err == nil {\n\t\tvar nn int\n\t\tnn, err = r.Read(buf[n:])\n\t\tn += nn\n\t}\n\tif n == len(buf) {\n\t\terr = nil\n\t}\n\treturn\n}", "func (f stdioFileHandle) Read(b []byte) (n int, err error) {\n\tif len(b) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tsize := buffered()\n\tfor size == 0 {\n\t\tgosched()\n\t\tsize = buffered()\n\t}\n\n\tif size > len(b) {\n\t\tsize = len(b)\n\t}\n\tfor i := 0; i < size; i++ {\n\t\tb[i] = getchar()\n\t}\n\treturn size, nil\n}", "func (r *devReader) Read(b []byte) (n int, err error) {\n\t// if atomic.CompareAndSwapInt32(&r.used, 0, 1) {\n\t// \t// First use of randomness. Start timer to warn about\n\t// \t// being blocked on entropy not being available.\n\t// \tt := time.AfterFunc(60*time.Second, warnBlocked)\n\t// \tdefer t.Stop()\n\t// }\n\t// if altGetRandom != nil && r.name == urandomDevice && altGetRandom(b) {\n\t// \treturn len(b), nil\n\t// }\n\n\tr.mu.Lock()\n\tdefer r.mu.Unlock()\n\n\tif r.f == nil {\n\t\tf, err := os.Open(r.name)\n\t\tif f == nil {\n\t\t\treturn 0, err\n\t\t}\n\n\t\tif runtime.GOOS == \"plan9\" {\n\t\t\tr.f = f\n\t\t} else {\n\t\t\tr.f = bufio.NewReader(hideAgainReader{f})\n\t\t}\n\t}\n\n\treturn r.f.Read(b)\n}", "func (v *HVsockConn) read(buf []byte) (int, error) {\n\tvar b syscall.WSABuf\n\tvar f uint32\n\n\tb.Len = uint32(len(buf))\n\tb.Buf = &buf[0]\n\n\tc, err := v.prepareIo()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tif v.readDeadline.timedout.isSet() {\n\t\treturn 0, ErrTimeout\n\t}\n\n\tvar bytes uint32\n\terr = syscall.WSARecv(v.fd, &b, 1, &bytes, &f, &c.o, nil)\n\tn, err := v.asyncIo(c, &v.readDeadline, bytes, err)\n\truntime.KeepAlive(buf)\n\n\t// Handle EOF conditions.\n\tif err == nil && n == 0 && len(buf) != 0 {\n\t\treturn 0, io.EOF\n\t} else if err == syscall.ERROR_BROKEN_PIPE {\n\t\treturn 0, io.EOF\n\t} else {\n\t\treturn n, err\n\t}\n}", "func (reader MyReader) Read([]byte) (int, error) {\n\tvar b = make([]byte)\n\treturn 0, ErrRead(b)\n}", "func readFull(r io.Reader, buf []byte) (int, error) {\n\tvar n int\n\tvar err error\n\tfor n < len(buf) && err == nil {\n\t\tvar nn int\n\t\tnn, err = r.Read(buf[n:])\n\t\tn += nn\n\t}\n\tif n == len(buf) {\n\t\treturn n, nil\n\t}\n\tif err == io.EOF {\n\t\treturn n, io.ErrUnexpectedEOF\n\t}\n\treturn n, err\n}", "func (q *queue) read(ctx context.Context, dst usermem.IOSequence, l *lineDiscipline) (int64, bool, error) {\n\tq.mu.Lock()\n\tdefer q.mu.Unlock()\n\tif !q.readable {\n\t\treturn 0, false, syserror.ErrWouldBlock\n\t}\n\n\t// Read out from the read buffer.\n\tn := canonMaxBytes\n\tif n > int(dst.NumBytes()) {\n\t\tn = int(dst.NumBytes())\n\t}\n\tif n > q.readBuf.Len() {\n\t\tn = q.readBuf.Len()\n\t}\n\tn, err := dst.Writer(ctx).Write(q.readBuf.Bytes()[:n])\n\tif err != nil {\n\t\treturn 0, false, err\n\t}\n\t// Discard bytes read out.\n\tq.readBuf.Next(n)\n\n\t// If we read everything, this queue is no longer readable.\n\tif q.readBuf.Len() == 0 {\n\t\tq.readable = false\n\t}\n\n\t// Move data from the queue's wait buffer to its read buffer.\n\tnPushed := q.pushWaitBufLocked(l)\n\n\treturn int64(n), nPushed > 0, nil\n}", "func (r *Reader) Read(buf []byte) (int, error) {\n\tdefer func() {\n\t\tr.offset = r.h.Offset()\n\t\tr.frameInfo = r.h.FrameInfo()\n\n\t\tf := r.h.MetaCheck()\n\t\tswitch {\n\t\tcase f&MetaNewID3 != 0:\n\t\t\tid3v2, err := r.h.MetaID3()\n\t\t\tif id3v2 != nil && err == nil {\n\t\t\t\tr.meta.ID3v2 = id3v2\n\t\t\t}\n\t\t}\n\n\t}()\n\tif r.nextOffset > r.totalRead {\n\t\tn, err := io.CopyN(ioutil.Discard, r.input, r.nextOffset-r.totalRead)\n\t\tr.totalRead += n\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\tfor r.bytesSinceOk < r.maxBadBytes {\n\t\tvar feed []byte\n\t\tif r.needMore {\n\t\t\tr.needMore = false\n\t\t\tfeedLen, err := r.input.Read(r.feedBuf)\n\t\t\tr.totalRead += int64(feedLen)\n\t\t\tr.nextOffset = r.totalRead\n\t\t\tif feedLen == 0 && err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t\tfeed = r.feedBuf[:feedLen]\n\t\t\tr.bytesSinceOk += feedLen\n\t\t}\n\n\t\tswitch n, err := r.h.Decode(feed, buf); err {\n\t\tcase ErrNewFormat:\n\t\t\tr.outputFormat = r.h.OutputFormat()\n\t\t\tr.bytesSinceOk = 0\n\t\t\tif len(buf) == 0 {\n\t\t\t\treturn n, nil\n\t\t\t}\n\t\tcase ErrNeedMore:\n\t\t\tr.needMore = true\n\t\t\tif n > 0 {\n\t\t\t\tr.bytesSinceOk = 0\n\t\t\t\treturn n, nil\n\t\t\t}\n\t\tcase ErrDone:\n\t\t\treturn n, io.EOF\n\t\tdefault:\n\t\t\tr.bytesSinceOk = 0\n\t\t\treturn n, nil\n\n\t\t}\n\n\t}\n\tr.bytesSinceOk = 0\n\treturn 0, errors.New(\"No valid data found\")\n}", "func (mc *MockConn) Read(b []byte) (int, error) {\n\tif mc.closed {\n\t\treturn 0, errors.New(\"Connection closed.\")\n\t}\n\n\ti := 0\n\tfor i < len(b) {\n\t\tif mc.outMessage == nil {\n\t\t\tselect {\n\t\t\tcase <-mc.done:\n\t\t\t\treturn 0, errors.New(\"Connection closed.\")\n\t\t\tcase mc.outMessage = <-mc.receiveChan:\n\t\t\t}\n\t\t\tmc.outPlace = 0\n\t\t}\n\n\t\tfor mc.outPlace < len(mc.outMessage) && i < len(b) {\n\t\t\tb[i] = mc.outMessage[mc.outPlace]\n\t\t\tmc.outPlace++\n\t\t\ti++\n\t\t}\n\n\t\tif mc.outPlace == len(mc.outMessage) {\n\t\t\tmc.outMessage = nil\n\t\t}\n\t}\n\n\treturn i, nil\n}", "func (pipe *slimPipe) Read(buffer []byte) (int, error) {\n\terrChannel := make(chan error)\n\tcountChannel := make(chan int)\n\tgo func() {\n\t\treadBytes, err := io.ReadAtLeast(pipe.reader, buffer, 1)\n\t\tif err != nil {\n\t\t\terrChannel <- err\n\t\t} else {\n\t\t\tcountChannel <- readBytes\n\t\t}\n\t\tclose(errChannel)\n\t\tclose(countChannel)\n\t}()\n\tselect {\n\tcase count := <-countChannel:\n\t\treturn count, nil\n\tcase err := <-errChannel:\n\t\treturn 0, err\n\tcase <-time.After(pipe.timeout):\n\t\treturn 0, fmt.Errorf(\"Timeout (%v)\", pipe.timeout)\n\t}\n}", "func (d *Decoder) Read(b []byte) (int, error) {\n\treturn d.r.Read(b)\n}", "func (c *DecoderReadCloser) Read(b []byte) (int, error) {\n\treturn c.d.Read(b)\n}", "func (reader *embedFileReader) Read(b []byte) (int, error) {\n\trest := reader.length - reader.offset\n\tif rest <= 0 {\n\t\treturn 0, io.EOF\n\t}\n\n\tn, err := reader.source.ReadAt(b, reader.start+reader.offset)\n\n\tif rest < int64(n) {\n\t\treader.offset += int64(rest)\n\t\treturn int(rest), err\n\t} else {\n\t\treader.offset += int64(n)\n\t\treturn n, err\n\t}\n}", "func (i Intermediate) Read(r io.Reader, b *bin.Buffer) error {\n\tif err := readIntermediate(r, b, false); err != nil {\n\t\treturn errors.Wrap(err, \"read intermediate\")\n\t}\n\n\treturn checkProtocolError(b)\n}", "func (conn *Conn) read(n int) ([]byte, error) {\n\tresult, err := conn.brw.Peek(n)\n\n\tif err != nil {\n\t\tfmt.Println(\"Error while peeking read buffer\", err)\n\t\treturn result, err\n\t}\n\n\t_, err = conn.brw.Discard(n)\n\n\tif err != nil {\n\t\tfmt.Println(\"Error while discarding read buffer\", err)\n\t}\n\n\treturn result, err\n}", "func (r *fakeRandReader) Read(p []byte) (int, error) {\n\tn := r.n\n\tif n > len(p) {\n\t\tn = len(p)\n\t}\n\treturn n, r.err\n}", "func (lf *logFile) read(buf []byte, offset int64) error {\n\tnbr, err := lf.fd.ReadAt(buf, offset)\n\ty.NumReads.Add(1)\n\ty.NumBytesRead.Add(int64(nbr))\n\treturn err\n}", "func read(conn *net.TCPConn, size int, data *bytes.Buffer) error {\n\tconn.SetReadDeadline(time.Now().Add(time.Second * 15))\n\n\tn, err := io.CopyN(data, conn, int64(size))\n\tif err != nil || n != int64(size) {\n\t\treturn errors.New(\"read error\")\n\t}\n\treturn nil\n}", "func (bb *BytesBuffer) Read(p []byte) (n int, err error) {\n\treturn bb.reader.Read(p)\n}", "func (b *Buffer) Read(reader io.Reader) (error) {\n\tif b.isCompacted {\n\t\tb.isCompacted = false\n\n\t\t// we want to read into the buffer from where it last was,\n\t\tvar slice = b.internal[b.index:]\n\t\tvar length, err = reader.Read(slice)\n\t\tb.index = 0 // start the index over, so reading starts from beginning again\n\t\tb.length += uint32(length) // increment the number of bytes read\n\t\treturn err\n\t}\n\tvar length, err = reader.Read(b.internal)\n\tb.index = 0\n\tb.length = uint32(length)\n\treturn err\n}", "func FileReadAt(f *os.File, b []byte, off int64) (int, error)", "func ConnRead(c *tls.Conn, b []byte) (int, error)", "func (r *Reader) Read(p []byte) (int, error) {\n\tn, err := r.src.Read(p)\n\tr.readN += int64(n)\n\tr.md5.Write(p[:n])\n\n\tif err == io.EOF && len(r.checksum) != 0 {\n\t\tif etag := r.ETag(); !Equal(etag, r.checksum) {\n\t\t\treturn n, VerifyError{\n\t\t\t\tExpected: r.checksum,\n\t\t\t\tComputed: etag,\n\t\t\t}\n\t\t}\n\t}\n\treturn n, err\n}", "func (p *Conn) Read(b []byte) (int, error) {\n\tp.checkProxyHeaderOnce()\n\tif p.headerErr != nil {\n\t\treturn 0, p.headerErr\n\t}\n\treturn p.bufReader.Read(b)\n}", "func (c *Conn) Read(b []byte) (int, error) {\n\tif c.readTimeout > 0 {\n\t\tif err := c.Conn.SetReadDeadline(time.Now().Add(c.readTimeout)); err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\tn, err := c.Conn.Read(b)\n\tif err == nil && c.Stats != nil {\n\t\tc.Stats.ReadTotal.Add(uint64(n))\n\t}\n\tc.incBytesIn(n)\n\treturn n, err\n}", "func (p *Conn) Read(b []byte) (int, error) {\n\tvar err error\n\tp.once.Do(func() { err = p.checkPrefix() })\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn p.bufReader.Read(b)\n}", "func (c *Conn) Read(b []byte) (n int, err error) {\n\treturn syscall.Read(c.fd, b)\n}", "func (fpc *FakePacketConn) Read(b []byte) (int, error) {\n\tn, _, err := fpc.ReadFrom(b)\n\treturn n, err\n}", "func (c *UDPConn) Read(b []byte) (n int, err error) {\n\tvar buffer [2000]byte\n\tfor {\n\t\tn, err = c.nconn.Read(buffer[0:])\n\t\tif dropIt(readDropPercent(c)) {\n\t\t\tif isLoggingEnabled() {\n\t\t\t\tlog.Printf(\"DROPPING read packet of length %d\\n\", n)\n\t\t\t}\n\t\t} else {\n\t\t\tcopy(b, buffer[0:])\n\t\t\tbreak\n\t\t}\n\t}\n\treturn n, err\n}", "func (p *pipe) write(b []byte) (read int, failure error) {\n\t// Short circuit if the input was already closed\n\tselect {\n\tcase <-p.inQuit:\n\t\treturn 0, ErrClosedPipe\n\tdefault:\n\t}\n\n\tfor len(b) > 0 {\n\t\t// Wait until some space frees up\n\t\tsafeFree, err := p.inputWait()\n\t\tif err != nil {\n\t\t\treturn read, err\n\t\t}\n\t\t// Try to fill the buffer either till the reader position, or the end\n\t\tlimit := p.inPos + safeFree\n\t\tif limit > p.size {\n\t\t\tlimit = p.size\n\t\t}\n\t\tif limit > p.inPos+int32(len(b)) {\n\t\t\tlimit = p.inPos + int32(len(b))\n\t\t}\n\t\tnr := copy(p.buffer[p.inPos:limit], b[:limit-p.inPos])\n\t\tb = b[nr:]\n\t\tread += int(nr)\n\n\t\t// Update the pipe input state and continue\n\t\tp.inputAdvance(nr)\n\t}\n\treturn\n}", "func (d *Decoder) Read(p []byte) (int, error) {\n\tvar n int\n\tfor {\n\t\tif len(d.current.b) > 0 {\n\t\t\tfilled := copy(p, d.current.b)\n\t\t\tp = p[filled:]\n\t\t\td.current.b = d.current.b[filled:]\n\t\t\tn += filled\n\t\t}\n\t\tif len(p) == 0 {\n\t\t\tbreak\n\t\t}\n\t\tif len(d.current.b) == 0 {\n\t\t\t// We have an error and no more data\n\t\t\tif d.current.err != nil {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif !d.nextBlock(n == 0) {\n\t\t\t\treturn n, d.current.err\n\t\t\t}\n\t\t}\n\t}\n\tif len(d.current.b) > 0 {\n\t\tif debugDecoder {\n\t\t\tprintln(\"returning\", n, \"still bytes left:\", len(d.current.b))\n\t\t}\n\t\t// Only return error at end of block\n\t\treturn n, nil\n\t}\n\tif d.current.err != nil {\n\t\td.drainOutput()\n\t}\n\tif debugDecoder {\n\t\tprintln(\"returning\", n, d.current.err, len(d.decoders))\n\t}\n\treturn n, d.current.err\n}", "func (p *conn) Read(b []byte) (int, error) {\n\tvar err error\n\tp.once.Do(func() { err = p.checkPrefix() })\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn p.bufReader.Read(b)\n}", "func (r *MockReadWriteCloser) Read(p []byte) (n int, err error) {\n\n\tif err = r.ReadErr; err == nil {\n\t\tr.BytesRead = p\n\t\tn = len(p)\n\t}\n\treturn\n}", "func (f *realFile) Read(p []byte) (n int, err error) { return f.file.Read(p) }", "func (e *Encoder) Read(b []byte) (int, error) {\n\treturn e.buf.Read(b)\n}", "func (c *Conn) Read(b []byte) (int, error) {\n\tif !c.ok() {\n\t\treturn 0, syscall.EINVAL\n\t}\n\tif len(c.recvRest) > 0 {\n\t\tl := copy(b, c.recvRest)\n\t\tc.recvRest = c.recvRest[l:]\n\t\treturn l, nil\n\t}\n\tp, err := c.recvBuf.Pop()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tl := copy(b, p)\n\tc.recvRest = p[l:]\n\treturn l, nil\n}", "func (p *pipe) readFrom(r io.Reader) (read int64, failure error) {\n\tfor {\n\t\t// Wait until some space frees up\n\t\tsafeFree, err := p.inputWait()\n\t\tif err != nil {\n\t\t\treturn read, err\n\t\t}\n\t\t// Try to fill the buffer either till the reader position, or the end\n\t\tlimit := p.inPos + safeFree\n\t\tif limit > p.size {\n\t\t\tlimit = p.size\n\t\t}\n\t\tnr, err := r.Read(p.buffer[p.inPos:limit])\n\t\tread += int64(nr)\n\n\t\t// Update the pipe input state and handle any occurred errors\n\t\tp.inputAdvance(nr)\n\t\tif err == io.EOF {\n\t\t\treturn read, nil\n\t\t}\n\t\tif err != nil {\n\t\t\treturn read, err\n\t\t}\n\t}\n}", "func (bc BufConn) Read(b []byte) (int, error) {\n\tif bc.IgnoreRead {\n\t\treturn len(b), nil\n\t}\n\tif bc.OnRead != nil {\n\t\treadBytes := bc.OnRead()\n\t\tcopy(b, readBytes)\n\t\treturn len(b), nil\n\t}\n\treturn bc.Buf.Read(b)\n}", "func (c *connection) read() (data []byte, err error) {\n\tif !c.available() {\n\t\terr = ErrCannotRead\n\t\treturn\n\t}\n\tc.setReadDeadline()\n\tvar count int\n\t// TODO error conditions http://golang.org/pkg/io/#ReadFull, like EOF conditions\n\tif count, err = io.ReadFull(c.conn, c.sizeBuf); err == nil && count == 4 {\n\t\tmessageLength := binary.BigEndian.Uint32(c.sizeBuf)\n\t\t// TODO: investigate using a bytes.Buffer on c instead of\n\t\t// always making a new byte slice, more in-line with Node.js client\n\t\tdata = make([]byte, messageLength)\n\t\tc.setReadDeadline()\n\t\t// TODO error conditions http://golang.org/pkg/io/#ReadFull, like EOF conditions\n\t\tcount, err = io.ReadFull(c.conn, data)\n\t\tif err != nil && err == syscall.EPIPE {\n\t\t\tc.close()\n\t\t} else if uint32(count) != messageLength {\n\t\t\terr = fmt.Errorf(\"[Connection] message length: %d, only read: %d\", messageLength, count)\n\t\t}\n\t}\n\tif err != nil {\n\t\t// TODO why not close() ?\n\t\tc.state = connInactive\n\t\tdata = nil\n\t}\n\treturn\n}", "func (p *stdio) Read(b []byte) (n int, err error) {\n\tn, err = p.buf.Read(b)\n\tif err == io.EOF {\n\t\treturn n, nil\n\t}\n\treturn n, err\n}", "func (d *Device) Read(b []byte) (n int, err error) {\n\t// TODO Check threading iomplication here\n\tfor !d.DataAvailable {\n\t\ttime.Sleep(3 * time.Millisecond)\n\t}\n\td.readLock.Lock()\n\n\tll := d.ReadLength\n\t//\tfmt.Printf(\"RL - %d\\n\", d.ReadLength)\n\tfor i := 0; i < d.ReadLength; i++ {\n\t\tb[i] = d.ReadBuffer[d.ReadPosition]\n\t\td.ReadPosition++\n\t\tif d.ReadPosition >= 1024 {\n\t\t\td.ReadPosition = 0\n\t\t}\n\t}\n\td.ReadLength = 0\n\td.DataAvailable = false\n\td.readLock.Unlock()\n\treturn ll, nil\n\n}", "func (w *WatchBuffer) Read(p []byte) (n int, err error) {\n\tif w.closed {\n\t\treturn 0, io.EOF\n\t}\n\tw.read <- p\n\tret := <-w.retc\n\treturn ret.n, ret.e\n}", "func (h *ReOpen) Read(p []byte) (n int, err error) {\n\th.mu.Lock()\n\tdefer h.mu.Unlock()\n\tif h.err != nil {\n\t\t// return a previous error if there is one\n\t\treturn n, h.err\n\t}\n\tn, err = h.rc.Read(p)\n\tif err != nil {\n\t\th.err = err\n\t}\n\th.read += int64(n)\n\tif err != nil && err != io.EOF && !fserrors.IsNoLowLevelRetryError(err) {\n\t\t// close underlying stream\n\t\th.opened = false\n\t\t_ = h.rc.Close()\n\t\t// reopen stream, clearing error if successful\n\t\tfs.Debugf(h.src, \"Reopening on read failure after %d bytes: retry %d/%d: %v\", h.read, h.tries, h.maxTries, err)\n\t\tif h.open() == nil {\n\t\t\terr = nil\n\t\t}\n\t}\n\treturn n, err\n}", "func (sb *SeekableBuffer) Read(p []byte) (n int, err error) {\n\tdefer func() {\n\t\tif state := recover(); state != nil {\n\t\t\terr = state.(error)\n\t\t}\n\t}()\n\n\tif sb.position >= len64(sb.data) {\n\t\treturn 0, io.EOF\n\t}\n\n\tn = copy(p, sb.data[sb.position:])\n\tsb.position += int64(n)\n\n\treturn n, nil\n\n}", "func (m *Memory) Read(b []byte) (n int, err error) {\n\tvar dbg = false\n\tif m == nil {\n \t\treturn 0, os.ErrInvalid\n\t}\n\t//fmt.Printf(\"Memory.Read: len(b)=%d, len(m.buf)=%d, cap(m.buf)=%d\\n\", len(b), len(m.buf), cap(m.buf))\n if len(m.buf) == 0 {\n\t\t//fmt.Printf(\"Memory.Read: EOF\\n\")\n \treturn 0, io.EOF\n }\n if len(b) > len(m.buf) {\n \tn = len(m.buf)\n } else {\n \tn = len(b)\n }\n//\tfmt.Printf(\"Memory.Read: B len(m.buf)=%d, cap(m.buf)=%d\\n\", len(m.buf), cap(m.buf))\n\tif (dbg) {\n\t\tfmt.Printf(\"|\")\n\t}\n\tfor i := 0; i < n; i++ {\n\t\tb[i] = m.buf[i]\n\t\tif (dbg) {\n\t\t\tfmt.Printf(\"%d, \", b[i])\n\t\t}\n\t}\n\tif (dbg) {\n\t\tfmt.Printf(\"|\")\n\t}\n// b = m.buf[0:n]\n m.buf = m.buf[n:]\n\t//fmt.Printf(\"Memory.Read: A len(m.buf)=%d, cap(m.buf)=%d\\n\", len(m.buf), cap(m.buf))\n return n, nil\n}", "func (r *msgReader) readBytes(countI32 int32) []byte {\n\tif r.err != nil {\n\t\treturn nil\n\t}\n\n\tcount := int(countI32)\n\n\tif len(r.msgBody)-r.rp < count {\n\t\tr.fatal(errors.New(\"read past end of message\"))\n\t\treturn nil\n\t}\n\n\tb := r.msgBody[r.rp : r.rp+count]\n\tr.rp += count\n\n\tr.cr.KeepLast()\n\n\tif r.shouldLog(LogLevelTrace) {\n\t\tr.log(LogLevelTrace, \"msgReader.readBytes\", \"value\", b, r.msgType, \"rp\", r.rp)\n\t}\n\n\treturn b\n}", "func (r *binaryReader) readBuf(len int) ([]byte, error) {\n\tb := r.buf[:len]\n\tn, err := r.Read(b)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif n != len {\n\t\treturn nil, errors.New(\"TODO failed to read enough bytes\")\n\t}\n\treturn b, nil\n}", "func checkRead(t *testing.T, testname string, b *Builder, s string) {\n\tbytes := b.Bytes()\n\tstr := b.String()\n\tif b.Len() != len(str) {\n\t\tt.Errorf(\"%s: b.Len() == %d, len(b.String()) == %d\", testname, b.Len(), len(str))\n\t}\n\tif string(bytes) != s {\n\t\tt.Errorf(\"%s: string(b.Bytes()) == %q, s == %q\", testname, string(bytes), s)\n\t}\n}", "func (sdr *DirReader) Read(b []byte) (int, error) {\n\treturn sdr.f.Read(b)\n}" ]
[ "0.71849316", "0.6805037", "0.6718099", "0.66883546", "0.65971196", "0.6501606", "0.64997715", "0.64519423", "0.64109707", "0.63906854", "0.6385387", "0.63122624", "0.62944454", "0.62513477", "0.6247249", "0.62450665", "0.6211432", "0.6193819", "0.6186946", "0.61413604", "0.6130887", "0.6116984", "0.6094095", "0.60345566", "0.60325116", "0.60239017", "0.60221756", "0.60006064", "0.59959835", "0.59851927", "0.59810764", "0.59275764", "0.5927162", "0.59168375", "0.5901704", "0.5878157", "0.58602124", "0.58598346", "0.5848488", "0.5847848", "0.58436626", "0.5818364", "0.5805445", "0.5803761", "0.5801414", "0.58004296", "0.579718", "0.579607", "0.57761776", "0.57746917", "0.57653695", "0.57598996", "0.57593876", "0.5743097", "0.5736907", "0.57284576", "0.5723722", "0.5721482", "0.5718339", "0.5717019", "0.5706429", "0.5694076", "0.5693756", "0.5691947", "0.5688644", "0.568618", "0.56786835", "0.5674065", "0.5671514", "0.565599", "0.5651703", "0.5644841", "0.56441337", "0.5628098", "0.5624843", "0.5611476", "0.56091505", "0.5606669", "0.56039035", "0.5599232", "0.5599037", "0.5595554", "0.5594099", "0.55937207", "0.5592222", "0.5589806", "0.5577209", "0.5575287", "0.5567939", "0.55623883", "0.55580014", "0.55559707", "0.5555653", "0.55436796", "0.55345005", "0.55342335", "0.55326355", "0.55316097", "0.5515378", "0.5512675", "0.5509862" ]
0.0
-1
skip skips n bytes in the input.
func (r *objReader) skip(n int64) { if n < 0 { r.error(fmt.Errorf("debug/goobj: internal error: misuse of skip")) } if n < int64(len(r.tmp)) { // Since the data is so small, a just reading from the buffered // reader is better than flushing the buffer and seeking. r.readFull(r.tmp[:n]) } else if n <= int64(r.b.Buffered()) { // Even though the data is not small, it has already been read. // Advance the buffer instead of seeking. for n > int64(len(r.tmp)) { r.readFull(r.tmp[:]) n -= int64(len(r.tmp)) } r.readFull(r.tmp[:n]) } else { // Seek, giving up buffered data. r.b.MustSeek(r.offset+n, os.SEEK_SET) r.offset += n } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (r *Reader) SkipNBytes(n int) {\n\tread := 0\n\tfor read < n {\n\t\tif r.head == r.tail {\n\t\t\tif !r.loadMore() {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tif read+r.tail-r.head < n {\n\t\t\tread += r.tail - r.head\n\t\t\tr.head = r.tail\n\t\t\tcontinue\n\t\t}\n\n\t\tr.head += n - read\n\t\tread += n - read\n\t}\n}", "func (b *defaultByteBuffer) Skip(n int) (err error) {\n\tif b.status&BitReadable == 0 {\n\t\treturn errors.New(\"unreadable buffer, cannot support Skip\")\n\t}\n\tif err = b.readableCheck(n); err != nil {\n\t\treturn err\n\t}\n\tb.readIdx += n\n\treturn nil\n}", "func (b *ByteInputAdapter) SkipBytes(n int) error {\n\t_, err := b.Next(n)\n\n\treturn err\n}", "func (b *ByteBuffer) SkipBytes(n int) error {\n\tm := len(b.buf) - b.off\n\n\tif n > m {\n\t\treturn io.ErrUnexpectedEOF\n\t}\n\n\tb.off += n\n\n\treturn nil\n}", "func (r *objReader) skip(n int64) {\n\tif n < 0 {\n\t\tr.error(fmt.Errorf(\"debug/goobj: internal error: misuse of skip\"))\n\t}\n\tif n < int64(len(r.tmp)) {\n\t\t// Since the data is so small, a just reading from the buffered\n\t\t// reader is better than flushing the buffer and seeking.\n\t\tr.readFull(r.tmp[:n])\n\t} else if n <= int64(r.b.Buffered()) {\n\t\t// Even though the data is not small, it has already been read.\n\t\t// Advance the buffer instead of seeking.\n\t\tfor n > int64(len(r.tmp)) {\n\t\t\tr.readFull(r.tmp[:])\n\t\t\tn -= int64(len(r.tmp))\n\t\t}\n\t\tr.readFull(r.tmp[:n])\n\t} else {\n\t\t// Seek, giving up buffered data.\n\t\t_, err := r.f.Seek(r.offset+n, 0)\n\t\tif err != nil {\n\t\t\tr.error(err)\n\t\t}\n\t\tr.offset += n\n\t\tr.b.Reset(r.f)\n\t}\n}", "func (l *lexer) skipN(n int) {\n\tl.pos += Pos(n)\n\tl.ignore()\n}", "func (r *Reader) SkipBytes() {\n\tsize := r.ReadLong()\n\tif size <= 0 {\n\t\treturn\n\t}\n\tr.SkipNBytes(int(size))\n}", "func (sr *SequentialReader) Skip(n int64) {\n\t_, err := sr.reader.Seek(n, io.SeekCurrent)\n\texc.ThrowOnError(err)\n}", "func (r *View) Skip(count int64) {\n\tfor count > 0 {\n\t\tif r.cur == nil {\n\t\t\tpanic(errors.New(\"cannot skip past end buffer\"))\n\t\t}\n\n\t\tamount := r.chunkRemaining()\n\t\tif count < int64(amount) {\n\t\t\tamount = int(count)\n\t\t\tr.cidx += amount\n\t\t} else {\n\t\t\t// Finished consuming this chunk, move on to the next.\n\t\t\tr.cur = r.cur.next\n\t\t\tr.cidx = 0\n\t\t}\n\n\t\tcount -= int64(amount)\n\t\tr.consumed += int64(amount)\n\t\tr.size -= int64(amount)\n\t}\n}", "func skipData(reader *bytes.Reader, numBytes uint64) error {\n\tmax := uint64(math.MaxInt32)\n\n\t/*\n\t * Check if we can seek this far.\n\t */\n\tif numBytes > max {\n\t\treturn fmt.Errorf(\"Cannot skip more than %d bytes.\", max)\n\t} else {\n\t\tsignedBytes := int64(numBytes)\n\t\tmode := io.SeekCurrent\n\t\treader.Seek(signedBytes, mode)\n\t\treturn nil\n\t}\n\n}", "func (me *BitStream) SkipBits(n int) {\n\tme.Index += n\n}", "func (iter *Iterator) Skip(n uint64) bool { return iter.impl.Skip(n) }", "func (l *LexInner) Skip(n int) int {\n\ti := 0\n\tfor i = 0; i < n; i++ {\n\t\tif l.Next() == Eof {\n\t\t\treturn i\n\t\t}\n\t}\n\treturn i\n}", "func (jbobject *JavaIoInputStream) Skip(a int64) (int64, error) {\n\tjret, err := jbobject.CallMethod(javabind.GetEnv(), \"skip\", javabind.Long, a)\n\tif err != nil {\n\t\tvar zero int64\n\t\treturn zero, err\n\t}\n\treturn jret.(int64), nil\n}", "func (r *Reader) SkipInt() {\n\tvar offset int8\n\tfor r.Error == nil {\n\t\tif offset == maxIntBufSize {\n\t\t\treturn\n\t\t}\n\n\t\tb := r.readByte()\n\t\tif b&0x80 == 0 {\n\t\t\tbreak\n\t\t}\n\t\toffset++\n\t}\n}", "func (d *Decoder) Skip() error {\n\tc, err := d.readCode()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif msgpcode.IsFixedNum(c) {\n\t\treturn nil\n\t}\n\tif msgpcode.IsFixedMap(c) {\n\t\treturn d.skipMap(c)\n\t}\n\tif msgpcode.IsFixedArray(c) {\n\t\treturn d.skipSlice(c)\n\t}\n\tif msgpcode.IsFixedString(c) {\n\t\treturn d.skipBytes(c)\n\t}\n\n\tswitch c {\n\tcase msgpcode.Nil, msgpcode.False, msgpcode.True:\n\t\treturn nil\n\tcase msgpcode.Uint8, msgpcode.Int8:\n\t\treturn d.skipN(1)\n\tcase msgpcode.Uint16, msgpcode.Int16:\n\t\treturn d.skipN(2)\n\tcase msgpcode.Uint32, msgpcode.Int32, msgpcode.Float:\n\t\treturn d.skipN(4)\n\tcase msgpcode.Uint64, msgpcode.Int64, msgpcode.Double:\n\t\treturn d.skipN(8)\n\tcase msgpcode.Bin8, msgpcode.Bin16, msgpcode.Bin32:\n\t\treturn d.skipBytes(c)\n\tcase msgpcode.Str8, msgpcode.Str16, msgpcode.Str32:\n\t\treturn d.skipBytes(c)\n\tcase msgpcode.Array16, msgpcode.Array32:\n\t\treturn d.skipSlice(c)\n\tcase msgpcode.Map16, msgpcode.Map32:\n\t\treturn d.skipMap(c)\n\tcase msgpcode.FixExt1, msgpcode.FixExt2, msgpcode.FixExt4, msgpcode.FixExt8, msgpcode.FixExt16,\n\t\tmsgpcode.Ext8, msgpcode.Ext16, msgpcode.Ext32:\n\t\treturn d.skipExt(c)\n\t}\n\n\treturn fmt.Errorf(\"msgpack: unknown code %x\", c)\n}", "func (s *Scanner) Skip(offset int) {\n\ts.offset += offset\n}", "func (it *iterator) skipToNextByte() error {\n\tremainingBitsInByte := it.stream.RemainingBitsInCurrentByte()\n\tfor remainingBitsInByte > 0 {\n\t\t_, err := it.stream.ReadBit()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tremainingBitsInByte--\n\t}\n\n\treturn nil\n}", "func (fr *FileReader) Skip(skipBytes uint64) uint64 {\n\toldOff, err := fr.Seek(0, os.SEEK_CUR)\n\tif err != nil {\n\t\tpanic(\"Failed to seek\")\n\t}\n\tremain := fr.size - oldOff\n\tif int64(skipBytes) > remain {\n\t\tskipBytes = uint64(remain)\n\t}\n\tnewOff, err := fr.Seek(int64(skipBytes), os.SEEK_CUR)\n\tif err != nil {\n\t\tpanic(\"Failed to seek\")\n\t}\n\tskipped := newOff - oldOff\n\tif skipped < 0 {\n\t\tpanic(\"\")\n\t}\n\treturn uint64(skipped)\n}", "func (tr *Reader) skipUnread() {\n\tnr := tr.nb + tr.pad // number of bytes to skip\n\ttr.nb, tr.pad = 0, 0\n\tif sr, ok := tr.r.(io.Seeker); ok {\n\t\tif _, err := sr.Seek(nr, os.SEEK_CUR); err == nil {\n\t\t\treturn\n\t\t}\n\t}\n\t_, tr.err = io.CopyN(ioutil.Discard, tr.r, nr)\n}", "func (reader *Reader) SetSkip(n int) {\n\treader.Skip = n\n}", "func (l *Lexer) Skip() {\n\t// We're at a point where we know we have completely read a\n\t// token. If we've read 90% of an l.buf's capacity, shift the\n\t// unread content to the start of the buffer. Otherwise just\n\t// move l.start to the current position.\n\tn := cap(l.buf)\n\tr := n - l.pos\n\tif n/10 >= r {\n\t\tl.buf, l.start, l.pos = append(l.buf[0:0], l.buf[l.pos:]...), 0, 0\n\t} else {\n\t\tl.start = l.pos\n\t}\n}", "func (q *Query) Skip(n int) *Query {\n\tq.q = q.q.Skip(n)\n\treturn q\n}", "func (self *BytecodeReader) SkipPadding() {\n\tfor self.pc%4 != 0 {\n\t\tself.ReadUint8()\n\t}\n}", "func (r *nvPairReader) skipToAlign() {\n\tvar alignment int\n\tswitch r.nvlist.encoding {\n\tcase EncodingNative:\n\t\talignment = 8\n\tcase EncodingXDR:\n\t\talignment = 4\n\tdefault:\n\t\tpanic(\"Invalid encoding inside parser\")\n\t}\n\tif (r.currentByte-r.startByte)%alignment != 0 {\n\t\tr.currentByte += alignment - ((r.currentByte - r.startByte) % alignment)\n\t}\n}", "func (p *Stream) peekSkip() (int, byte) {\n\top := p.readFrame[p.readIndex]\n\tif skip := readSkipArray[op]; skip > 0 && p.CanRead() {\n\t\treturn skip, op\n\t} else if skip < 0 {\n\t\treturn 0, op\n\t} else if p.isSafetyReadNBytesInCurrentFrame(5) {\n\t\tb := p.readFrame[p.readIndex:]\n\t\treturn int(uint32(b[1]) |\n\t\t\t(uint32(b[2]) << 8) |\n\t\t\t(uint32(b[3]) << 16) |\n\t\t\t(uint32(b[4]) << 24)), op\n\t} else if p.hasNBytesToRead(5) {\n\t\tb := p.peekNBytesCrossFrameUnsafe(5)\n\t\treturn int(uint32(b[1]) |\n\t\t\t(uint32(b[2]) << 8) |\n\t\t\t(uint32(b[3]) << 16) |\n\t\t\t(uint32(b[4]) << 24)), op\n\t} else {\n\t\treturn 0, op\n\t}\n}", "func (s *DownloadStream) Skip(skip int64) (int64, error) {\n\treturn s.Seek(skip, io.SeekCurrent)\n}", "func skip(r *bufio.Reader, delim rune) error {\n\tfor {\n\t\tr1, err := readRune(r)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif r1 == delim {\n\t\t\treturn nil\n\t\t}\n\t}\n}", "func (src *Source) CopyN(n int) []byte {\n\tspace := src.ClaimSpace()\n\tfor {\n\t\tif n <= len(src.current) {\n\t\t\tspace = append(space, src.current[:n]...)\n\t\t\tsrc.current = src.current[n:]\n\t\t\tif len(src.current) == 0 {\n\t\t\t\tsrc.Consume()\n\t\t\t}\n\t\t\treturn space\n\t\t}\n\t\tif src.err != nil {\n\t\t\tif src.err == io.EOF {\n\t\t\t\tsrc.err = io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\treturn space\n\t\t}\n\t\tn -= len(src.current)\n\t\tspace = append(space, src.current...)\n\t\tsrc.Consume()\n\t}\n}", "func (r *Reader) SkipString() {\n\tsize := r.ReadLong()\n\tif size <= 0 {\n\t\treturn\n\t}\n\tr.SkipNBytes(int(size))\n}", "func (r *Reader) skip(delim rune) error {\n\tfor {\n\t\tr1, err := r.readRune()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif r1 == delim {\n\t\t\treturn nil\n\t\t}\n\t}\n\tpanic(\"unreachable\")\n}", "func (p *ProgressMeter) Skip(size int64) {\n\tatomic.AddInt64(&p.skippedFiles, 1)\n\tatomic.AddInt64(&p.skippedBytes, size)\n}", "func (r *Reader) SkipSpace() byte {\n\tfor r.p < len(r.v) {\n\t\tif libbytes.IsSpace(r.v[r.p]) {\n\t\t\tr.p++\n\t\t\tcontinue\n\t\t}\n\t\tbreak\n\t}\n\tif r.p == len(r.v) {\n\t\treturn 0\n\t}\n\treturn r.v[r.p]\n}", "func (q *Query) Skip(n int64) QueryI {\n\tnewQ := q\n\tnewQ.skip = &n\n\treturn newQ\n}", "func SkipTags(b *kbin.Reader) {\n\tfor num := b.Uvarint(); num > 0; num-- {\n\t\t_, size := b.Uvarint(), b.Uvarint()\n\t\tb.Span(int(size))\n\t}\n}", "func (d *Decoder) Skip() error {\n\treturn errTODO\n}", "func (r *textprotoReader) skipSpace() int {\n\tn := 0\n\tfor {\n\t\tc, err := r.R.ReadByte()\n\t\tif err != nil {\n\t\t\t// Bufio will keep err until next read.\n\t\t\tbreak\n\t\t}\n\t\tif c != ' ' && c != '\\t' {\n\t\t\tr.R.UnreadByte()\n\t\t\tbreak\n\t\t}\n\t\tn++\n\t}\n\treturn n\n}", "func (r *Reader) skipSpace() int {\n\tn := 0\n\tfor {\n\t\tc, err := r.R.ReadByte()\n\t\tif err != nil {\n\t\t\t// Bufio will keep err until next read.\n\t\t\tbreak\n\t\t}\n\t\tif c != ' ' && c != '\\t' {\n\t\t\tr.R.UnreadByte()\n\t\t\tbreak\n\t\t}\n\t\tn++\n\t}\n\treturn n\n}", "func (t *Decoder) Skip() (boundary int, err error) {\n\t// var i int\n\tfor {\n\t\tif len(t.window) < t.minimum {\n\t\t\t// try to refill the buffer when window gets small\n\t\t\tif err = t.fillBuffer(); err != nil {\n\t\t\t\tif err == io.EOF {\n\t\t\t\t\treturn 0, nil // swallow io.EOF\n\t\t\t\t}\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t}\n\n\t\t// try to detect a boundary and keep going if you do\n\t\ti := 0\n\t\tfor ; i < len(t.window); i++ {\n\t\t\tif t.window[i] == telomereMarkByte {\n\t\t\t\tboundary++\n\t\t\t\tif boundary > t.maximum {\n\t\t\t\t\tt.window = t.window[i:]\n\t\t\t\t\treturn 0, errors.New(\"maximum telomere length exceeded\")\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tt.window = t.window[i:]\n\t\t\t\treturn boundary, nil\n\t\t\t}\n\t\t}\n\t\tt.window = t.window[i:]\n\t}\n}", "func (g *deltaGenerator) copyN(n int64) error {\n\tg.setSkip(false)\n\t_, err := io.CopyN(ioutil.Discard, g.tarReader, int64(n))\n\treturn err\n}", "func (cb *Buffer) Omit(n int) error {\n\tif n < 1 {\n\t\treturn fmt.Errorf(\"Positive number required\")\n\t}\n\n\tif cb.ReadAvailability() < n {\n\t\treturn fmt.Errorf(\"Not enough unread data\")\n\t}\n\n\tif cb.rpos <= n {\n\t\tcb.rpos = len(cb.buffer) - n + cb.rpos\n\t} else {\n\t\tcb.rpos -= n\n\t}\n\n\tcb.full = false\n\treturn nil\n}", "func (p *ProgressMeter) Skip(size int64) {\n\tatomic.AddInt64(&p.skippedFiles, 1)\n\tatomic.AddInt64(&p.skippedBytes, size)\n\t// Reduce bytes and files so progress easier to parse\n\tatomic.AddInt32(&p.estimatedFiles, -1)\n\tatomic.AddInt64(&p.estimatedBytes, -size)\n}", "func (m *Matcher) ShiftBytes(sw *util.SlidingWindow, n uint8) error {\n\tif sw == nil {\n\t\treturn matcher.ErrEmptyBuffer\n\t}\n\n\tif n == 0 {\n\t\t// nothing to read\n\t\treturn nil\n\t}\n\n\t// fmt.Println(\"Before shifting..\", sw.LookAhead.Stats())\n\n\tfor i := 0; i < int(n) && i < int(sw.LookAhead.GetSize()); i++ {\n\t\tdatum, err := sw.LookAhead.Dequeue()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\terr = sw.Search.Enqueue(datum)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "func (r *Request) Skip(value int64) *Request {\n\treturn r.WithParam(common.ModifierSkip, strconv.FormatInt(value, 10))\n}", "func (s Stream) Offset(n int) Stream {\n\treturn s.Pipe(func() func(r Record) (Record, error) {\n\t\tvar skipped int\n\n\t\treturn func(r Record) (Record, error) {\n\t\t\tif skipped < n {\n\t\t\t\tskipped++\n\t\t\t\treturn nil, nil\n\t\t\t}\n\n\t\t\treturn r, nil\n\t\t}\n\t})\n}", "func skipToChunk(reader *bytes.Reader, chunkId uint32) error {\n\tabort := false\n\n\t/*\n\t * Skip over chunks until we find the one we expect.\n\t */\n\tfor !abort {\n\t\thdrChunk, err := lookaheadChunk(reader)\n\n\t\t/*\n\t\t * Check if lookahead was successful.\n\t\t */\n\t\tif err != nil {\n\t\t\treturn err\n\t\t} else {\n\t\t\tid := hdrChunk.ChunkID\n\n\t\t\t/*\n\t\t\t * If we found the right chunk, abort, otherwise skip over it.\n\t\t\t */\n\t\t\tif id == chunkId {\n\t\t\t\tabort = true\n\t\t\t} else {\n\t\t\t\tsize := hdrChunk.ChunkSize\n\t\t\t\tsizeLSB := size % 2\n\n\t\t\t\t/*\n\t\t\t\t * If chunk size is not even, we have to read one\n\t\t\t\t * additional byte of padding.\n\t\t\t\t */\n\t\t\t\tif sizeLSB != 0 {\n\t\t\t\t\tsize += 1\n\t\t\t\t}\n\n\t\t\t\tamount := uint64(size) + MIN_CHUNK_HEADER_SIZE\n\t\t\t\terr = skipData(reader, amount)\n\n\t\t\t\t/*\n\t\t\t\t * Check if skipping failed.\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}\n\n\t\t}\n\n\t}\n\n\treturn nil\n}", "func (b *Reader) Discard(n int) (discarded int, err error)", "func (ctx *Context) shift(n int) {\n\tbuf := ctx.buf[ctx.off : ctx.off+n]\n\tfor i := range buf {\n\t\tbuf[i] = 0\n\t}\n\tctx.off += n\n}", "func discardInput(r io.Reader, n uint32) {\n\tmaxSize := uint32(10 * 1024) // 10k at a time\n\tnumReads := n / maxSize\n\tbytesRemaining := n % maxSize\n\tif n > 0 {\n\t\tbuf := make([]byte, maxSize)\n\t\tfor i := uint32(0); i < numReads; i++ {\n\t\t\tio.ReadFull(r, buf)\n\t\t}\n\t}\n\tif bytesRemaining > 0 {\n\t\tbuf := make([]byte, bytesRemaining)\n\t\tio.ReadFull(r, buf)\n\t}\n}", "func discardInput(r io.Reader, n uint32) {\n\tmaxSize := uint32(10 * 1024) // 10k at a time\n\tnumReads := n / maxSize\n\tbytesRemaining := n % maxSize\n\tif n > 0 {\n\t\tbuf := make([]byte, maxSize)\n\t\tfor i := uint32(0); i < numReads; i++ {\n\t\t\tio.ReadFull(r, buf)\n\t\t}\n\t}\n\tif bytesRemaining > 0 {\n\t\tbuf := make([]byte, bytesRemaining)\n\t\tio.ReadFull(r, buf)\n\t}\n}", "func (c *T) Skip(args ...interface{})", "func (g *deltaGenerator) readN(n int64) ([]byte, error) {\n\tg.setSkip(true)\n\tbuf := make([]byte, n)\n\t_, err := io.ReadFull(g.tarReader, buf)\n\treturn buf, err\n}", "func (reader *Reader) SkipLines() (e error) {\n\tfor i := 0; i < reader.Skip; i++ {\n\t\t_, e = reader.ReadLine()\n\n\t\tif nil != e {\n\t\t\tlog.Print(\"dsv: \", e)\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}", "func (f *AnonymousFile) Skip(ctx context.Context, diff int64) error {\n\tif diff < 0 || int64(f.position)+diff > int64(len(f.contents)) {\n\t\treturn io.EOF\n\t}\n\n\tf.position += int(diff)\n\treturn nil\n}", "func (r ApiGetIqnpoolBlockListRequest) Skip(skip int32) ApiGetIqnpoolBlockListRequest {\n\tr.skip = &skip\n\treturn r\n}", "func (q *FileQueue) Skip(count int64) error {\n\tif q.IsEmpty() {\n\t\treturn nil\n\t}\n\n\tfor i := 0; i < int(count); i++ {\n\t\t// check and update queue front index info\n\t\t_, err := q.updateQueueFrontIndex()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif q.IsEmpty() {\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn nil\n}", "func (r ApiGetBulkResultListRequest) Skip(skip int32) ApiGetBulkResultListRequest {\n\tr.skip = &skip\n\treturn r\n}", "func Skip(skip int) Parameter {\n\treturn func(pa Parameterizable) {\n\t\tpa.SetParameter(\"skip\", skip)\n\t}\n}", "func TestBufferSkipBits(t *testing.T) {\n\tt.Run(\"Negative\", func(t *testing.T) {\n\t\tt.Run(\"OutOfRange\", func(t *testing.T) {\n\t\t\tb := BufferedMSB()\n\t\t\t// make space for the 4 bytes\n\t\t\tb.expandIfNeeded(4)\n\n\t\t\t// assuming that there are 2 bytes and 2 bits\n\t\t\tb.byteIndex = 2\n\t\t\tb.bitIndex = 2\n\t\t\t// the index should be at position:\n\t\t\t// 00000000 00000000 00000000 00000000\n\t\t\t// ^\n\t\t\t// in order to get out of the range the function should skip:\n\t\t\t// -((2 * 8) + 2 + 1) bits\n\t\t\tskip := -(2*8 + 2 + 1)\n\t\t\terr := b.SkipBits(skip)\n\t\t\tassert.Error(t, err, \"%v\", b)\n\t\t})\n\n\t\tt.Run(\"WithinSingleByte\", func(t *testing.T) {\n\t\t\tb := BufferedMSB()\n\t\t\t// make space for the 4 bytes.\n\t\t\tb.expandIfNeeded(4)\n\n\t\t\t// assumming that there are 2 bytes and 5 bits\n\t\t\tb.byteIndex = 2\n\t\t\tb.bitIndex = 5\n\n\t\t\t// the index should be at position:\n\t\t\t// 00000000 00000000 00000000 00000000\n\t\t\t// ^\n\t\t\t// skipping -3 bits\n\t\t\terr := b.SkipBits(-3)\n\t\t\trequire.NoError(t, err)\n\n\t\t\tassert.Equal(t, uint8(2), b.bitIndex)\n\t\t\tassert.Equal(t, 2, b.byteIndex)\n\t\t})\n\n\t\tt.Run(\"ToFirstByte\", func(t *testing.T) {\n\t\t\tb := BufferedMSB()\n\t\t\t// make space for the 4 bytes.\n\t\t\tb.expandIfNeeded(4)\n\n\t\t\t// assumming that there are 2 bytes and 5 bits\n\t\t\tb.byteIndex = 2\n\t\t\tb.bitIndex = 5\n\n\t\t\t// the index should be at position:\n\t\t\t// 00000000 00000000 00000000 00000000\n\t\t\t// ^\n\t\t\t// skipping -17 bits\n\t\t\terr := b.SkipBits(-17)\n\t\t\trequire.NoError(t, err)\n\n\t\t\t// should result in indexes\n\t\t\t// 00000000 00000000 00000000 00000000\n\t\t\t// ^\n\t\t\tassert.Equal(t, uint8(4), b.bitIndex)\n\t\t\tassert.Equal(t, 0, b.byteIndex)\n\t\t})\n\t})\n\n\tt.Run(\"Positive\", func(t *testing.T) {\n\t\tt.Run(\"Overflow\", func(t *testing.T) {\n\t\t\tb := BufferedMSB()\n\n\t\t\t// empty buffer should be expanded for the number of full bytes to write.\n\t\t\t// i.e. skipping 20 bits should result with a least 3 bytes length data.\n\t\t\terr := b.SkipBits(20)\n\t\t\trequire.NoError(t, err)\n\n\t\t\t// there must be 3 empty bytes\n\t\t\tassert.Len(t, b.data, 3, \"%v\", b.data)\n\t\t\t// and the bit index should be at the '3' position.\n\t\t\tassert.Equal(t, uint8(4), b.bitIndex)\n\t\t\tassert.Equal(t, 2, b.byteIndex)\n\t\t})\n\n\t\tt.Run(\"WithinSingleByte\", func(t *testing.T) {\n\t\t\tb := BufferedMSB()\n\n\t\t\tb.expandIfNeeded(1)\n\n\t\t\tb.bitIndex = 3\n\t\t\terr := b.SkipBits(2)\n\t\t\trequire.NoError(t, err)\n\n\t\t\t// the byte index should not change.\n\t\t\tassert.Equal(t, 0, b.byteIndex)\n\t\t\t// the bit index should be moved forward by the nubmer of skipped bits = 3 + 2 = 5\n\t\t\tassert.Equal(t, uint8(3+2), b.bitIndex)\n\t\t})\n\n\t\tt.Run(\"NoUnnecesaryExpand\", func(t *testing.T) {\n\t\t\tb := BufferedMSB()\n\n\t\t\t// lets create three bytes space.\n\t\t\tb.expandIfNeeded(3)\n\t\t\t// the data should now look like: []byte{0x00,0x00,0x00}\n\t\t\trequire.Equal(t, []byte{0x00, 0x00, 0x00}, b.data)\n\n\t\t\t// let's assume that the byte index is at the '1' position\n\t\t\tb.byteIndex = 1\n\n\t\t\t// by skipping the bits by one full byte - 8\n\t\t\t// the byte index should be equal to 2 and bitIndex = 0\n\t\t\t// In this case the data slice should still contains only three bytes -> should not be expanded.\n\t\t\terr := b.SkipBits(8)\n\t\t\trequire.NoError(t, err)\n\n\t\t\tassert.Equal(t, 2, b.byteIndex)\n\t\t\tassert.Equal(t, uint8(0), b.bitIndex)\n\t\t\tassert.Equal(t, []byte{0x00, 0x00, 0x00}, b.data)\n\t\t})\n\t})\n}", "func (r *Reader) SkipDouble() {\n\tr.SkipNBytes(8)\n}", "func Skip() error {\n\treturn errSkipped\n}", "func (r ApiGetBulkRequestListRequest) Skip(skip int32) ApiGetBulkRequestListRequest {\n\tr.skip = &skip\n\treturn r\n}", "func (r *Reader) SkipUntil(seps []byte) {\n\tfor r.p < len(r.v) {\n\t\tfor x := 0; x < len(seps); x++ {\n\t\t\tif r.v[r.p] == seps[x] {\n\t\t\t\tr.p++\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tr.p++\n\t}\n}", "func (r ApiGetHyperflexEncryptionListRequest) Skip(skip int32) ApiGetHyperflexEncryptionListRequest {\n\tr.skip = &skip\n\treturn r\n}", "func (r *Reader) SkipLong() {\n\tvar offset int8\n\tfor r.Error == nil {\n\t\tif offset == maxLongBufSize {\n\t\t\treturn\n\t\t}\n\n\t\tb := r.readByte()\n\t\tif b&0x80 == 0 {\n\t\t\tbreak\n\t\t}\n\t\toffset++\n\t}\n}", "func (r ApiGetBulkExportedItemListRequest) Skip(skip int32) ApiGetBulkExportedItemListRequest {\n\tr.skip = &skip\n\treturn r\n}", "func (r ApiGetHyperflexDataProtectionPeerListRequest) Skip(skip int32) ApiGetHyperflexDataProtectionPeerListRequest {\n\tr.skip = &skip\n\treturn r\n}", "func (d *Decoder) readN(n int) []byte {\n\tif buf, ok := d.r.(*bytes.Buffer); ok {\n\t\tb := buf.Next(n)\n\t\tif len(b) != n {\n\t\t\tpanic(io.ErrUnexpectedEOF)\n\t\t}\n\t\tif d.n += n; d.n > MaxObjectSize {\n\t\t\tbuild.Critical(ErrObjectTooLarge)\n\t\t}\n\t\treturn b\n\t}\n\tb := make([]byte, n)\n\t_, err := io.ReadFull(d, b)\n\tif err != nil {\n\t\tbuild.Critical(err)\n\t}\n\treturn b\n}", "func (r ApiGetBulkMoDeepClonerListRequest) Skip(skip int32) ApiGetBulkMoDeepClonerListRequest {\n\tr.skip = &skip\n\treturn r\n}", "func (D DiskIterator) readN(nByte int) ([]byte, error) {\n\n\tcnt := make([]byte, nByte)\n\tn, err := D.filePointer.ReadAt(cnt, D.actualOfset+16)\n\tif err != nil {\n\t\treturn cnt, err\n\t}\n\tif n < nByte {\n\t\treturn cnt, errors.New(\"non tutti i byte sono stati letti\")\n\t}\n\treturn cnt, nil\n}", "func (d *ResourceHandler) Skip(bytesToSkip int64, bytesSkipped *int64, callback *ResourceSkipCallback) int32 {\n\treturn lookupResourceHandlerProxy(d.Base()).Skip(d, bytesToSkip, bytesSkipped, callback)\n}", "func (r ApiGetHyperflexVmBackupInfoListRequest) Skip(skip int32) ApiGetHyperflexVmBackupInfoListRequest {\n\tr.skip = &skip\n\treturn r\n}", "func (r ApiGetEtherNetworkPortListRequest) Skip(skip int32) ApiGetEtherNetworkPortListRequest {\n\tr.skip = &skip\n\treturn r\n}", "func (r ApiGetEtherPhysicalPortListRequest) Skip(skip int32) ApiGetEtherPhysicalPortListRequest {\n\tr.skip = &skip\n\treturn r\n}", "func (f *Font) LineSkip() int { return int(C.TTF_FontLineSkip(f.f)) }", "func (r ApiGetHyperflexDriveListRequest) Skip(skip int32) ApiGetHyperflexDriveListRequest {\n\tr.skip = &skip\n\treturn r\n}", "func skipWhitespace(buf []byte, i int) int {\n\tfor {\n\t\tif i >= len(buf) {\n\t\t\treturn i\n\t\t}\n\n\t\tif buf[i] == '\\\\' {\n\t\t\ti += 2\n\t\t\tcontinue\n\t\t}\n\t\tif buf[i] == ' ' || buf[i] == '\\t' {\n\t\t\ti++\n\t\t\tcontinue\n\t\t}\n\t\tbreak\n\t}\n\treturn i\n}", "func (r ApiGetHyperflexIscsiNetworkListRequest) Skip(skip int32) ApiGetHyperflexIscsiNetworkListRequest {\n\tr.skip = &skip\n\treturn r\n}", "func (image *JPGImage) skipVariable(buffer []byte) {\n\t// Get the marker parameter length\n\tlength := image.getUint16(buffer)\n\timage.index += 2\n\n\tif length < 2 {\n\t\tlog.Fatal(\"Length includes itself, so must be at least 2.\")\n\t}\n\tlength -= 2\n\n\t// Skip over the remaining bytes\n\tfor length > 0 {\n\t\timage.index++\n\t\tlength--\n\t}\n}", "func (b *ByteInputAdapter) Next(n int) ([]byte, error) {\n\tbuf := make([]byte, n)\n\t_, err := b.Read(buf)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn buf, nil\n}", "func ExtractSkip(request *restful.Request) (int, error) {\n\tif len(strings.TrimSpace(request.QueryParameter(\"skip\"))) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tskip, err := strconv.Atoi(request.QueryParameter(\"skip\"))\n\n\tif err != nil {\n\t\treturn 0, errors.New(\"skip parameter should be of type integer\")\n\t}\n\n\tif skip < 0 {\n\t\treturn 0, errors.New(\"skip parameter should be 0 or more\")\n\t}\n\n\treturn skip, nil\n}", "func (r ApiGetHyperflexKeyEncryptionKeyListRequest) Skip(skip int32) ApiGetHyperflexKeyEncryptionKeyListRequest {\n\tr.skip = &skip\n\treturn r\n}", "func (r ApiGetHyperflexVolumeListRequest) Skip(skip int32) ApiGetHyperflexVolumeListRequest {\n\tr.skip = &skip\n\treturn r\n}", "func (c *B) Skip(args ...interface{})", "func (r ApiGetResourcepoolPoolListRequest) Skip(skip int32) ApiGetResourcepoolPoolListRequest {\n\tr.skip = &skip\n\treturn r\n}", "func (r ApiGetHyperflexHealthCheckPackageChecksumListRequest) Skip(skip int32) ApiGetHyperflexHealthCheckPackageChecksumListRequest {\n\tr.skip = &skip\n\treturn r\n}", "func (r ApiGetEtherPortChannelListRequest) Skip(skip int32) ApiGetEtherPortChannelListRequest {\n\tr.skip = &skip\n\treturn r\n}", "func (obj *IEnumTfProperties) Skip(count uint32) error {\n\treturn result(call1(\n\t\tuintptr(obj.IEnumTfProperties().Skip),\n\t\tuintptr(unsafe.Pointer(obj)),\n\t\tuintptr(count),\n\t))\n}", "func skip(*lex.Scanner, *machines.Match) (interface{}, error) {\n\treturn nil, nil\n}", "func skip(*lex.Scanner, *machines.Match) (interface{}, error) {\n\treturn nil, nil\n}", "func (r *Reader) Discard(n int) (int, error) {\n\tif n <= 0 {\n\t\treturn 0, nil\n\t}\n\tunread := r.Unread()\n\tif n > unread {\n\t\treturn unread, io.ErrUnexpectedEOF\n\t}\n\tr.off += n\n\treturn n, nil\n}", "func (r ApiGetBulkSubRequestObjListRequest) Skip(skip int32) ApiGetBulkSubRequestObjListRequest {\n\tr.skip = &skip\n\treturn r\n}", "func (b *Backend) Skip() {\n\tatomic.StoreInt32(&b.skipCounter, 7)\n}", "func (r ApiGetBulkExportListRequest) Skip(skip int32) ApiGetBulkExportListRequest {\n\tr.skip = &skip\n\treturn r\n}", "func (r *Request) Skip(value int64) *Request {\n\tr.UnderlyingRequest.Skip(value)\n\treturn r\n}", "func (r *Reader) SkipFloat() {\n\tr.SkipNBytes(4)\n}", "func (src *Source) ConsumeN(n int) {\n\tfor {\n\t\tif n <= len(src.current) {\n\t\t\tsrc.current = src.current[n:]\n\t\t\tif len(src.current) == 0 {\n\t\t\t\tsrc.Consume()\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tif src.err != nil {\n\t\t\tif src.err == io.EOF {\n\t\t\t\tsrc.err = io.ErrUnexpectedEOF\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tn -= len(src.current)\n\t\tsrc.Consume()\n\t}\n}", "func (r ApiGetHyperflexNodeListRequest) Skip(skip int32) ApiGetHyperflexNodeListRequest {\n\tr.skip = &skip\n\treturn r\n}", "func (r *Reader) SkipUntilNewline() {\n\tfor r.p < len(r.v) {\n\t\tif r.v[r.p] == '\\n' {\n\t\t\tr.p++\n\t\t\treturn\n\t\t}\n\t\tr.p++\n\t}\n}", "func skipForward(startFrom int, r *csv.Reader, filename string) {\n\t//skip forward if startFrom is non-zero\n\tfor i := 0; i < startFrom; i++ {\n\t\trecord, err := r.Read()\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Fatal error skipping forward in %s: %s\\n\", filename, err)\n\t\t}\n\t\tlog.Printf(\"skipped %s\\n\", record)\n\t}\n}" ]
[ "0.79792297", "0.7669542", "0.76570153", "0.754006", "0.74798805", "0.7271252", "0.7208619", "0.71694493", "0.69296575", "0.68162125", "0.6745872", "0.67376053", "0.65019435", "0.6481005", "0.64311546", "0.642394", "0.6419111", "0.6374015", "0.6332166", "0.631633", "0.63009816", "0.6274632", "0.6195206", "0.6179174", "0.6173908", "0.6173536", "0.616591", "0.6154699", "0.6105858", "0.6103852", "0.6088942", "0.6087032", "0.6066418", "0.606149", "0.6033143", "0.6027089", "0.6016947", "0.60051006", "0.597508", "0.5956757", "0.5953803", "0.5945127", "0.59432566", "0.5925993", "0.5905556", "0.5894983", "0.5884556", "0.58800066", "0.58532417", "0.58532417", "0.58356774", "0.58008885", "0.57938635", "0.5791504", "0.5766291", "0.5750227", "0.57297194", "0.57202005", "0.57146174", "0.57094264", "0.56986046", "0.56812805", "0.5678347", "0.5655571", "0.56468624", "0.5626118", "0.5625905", "0.56172323", "0.55818963", "0.557886", "0.55761385", "0.55742687", "0.55705905", "0.5559984", "0.5559315", "0.5558681", "0.5552184", "0.55466324", "0.5533733", "0.5532359", "0.55311406", "0.5525741", "0.55133903", "0.55118257", "0.550277", "0.55020964", "0.549252", "0.54747856", "0.5465982", "0.5465982", "0.54425937", "0.5436444", "0.5426878", "0.5416684", "0.54102564", "0.5382387", "0.53819084", "0.5374917", "0.53678745", "0.53676605" ]
0.7560769
3
New writes to f to make a new archive.
func New(f *os.File) (*Archive, error) { _, err := f.Write(archiveHeader) if err != nil { return nil, err } return &Archive{f: f}, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func newWriter(config *config.Stream, fs afs.Service, rotationURL string, index int, created time.Time, emitter *emitter.Service) (*writer, error) {\n\twriterCloser, err := fs.NewWriter(context.Background(), config.URL, file.DefaultFileOsMode)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresult := &writer{\n\t\tfs: fs,\n\t\tindex: index,\n\t\tdestURL: config.URL,\n\t\trotationURL: rotationURL,\n\t\tcloser: writerCloser,\n\t\tcreated: created,\n\t}\n\tresult.config = config\n\n\tif rotation := config.Rotation; rotation != nil {\n\t\tinitRotation(result, rotation, created, emitter)\n\t}\n\tif config.IsGzip() {\n\t\tgzWriter := gzip.NewWriter(writerCloser)\n\t\tresult.writer = gzWriter\n\t\tresult.flusher = gzWriter\n\n\t} else {\n\t\twriter := bufio.NewWriter(writerCloser)\n\t\tresult.writer = writer\n\t\tresult.flusher = writer\n\t}\n\treturn result, nil\n}", "func newFile(datadir, what, uuid string) (*File, error) {\n\ttimestamp := time.Now().UTC()\n\tdir := path.Join(datadir, what, timestamp.Format(\"2006/01/02\"))\n\terr := os.MkdirAll(dir, 0755)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tname := dir + \"/ndt7-\" + what + \"-\" + timestamp.Format(\"20060102T150405.000000000Z\") + \".\" + uuid + \".jsonl.gz\"\n\t// My assumption here is that we have nanosecond precision and hence it's\n\t// unlikely to have conflicts. If I'm wrong, O_EXCL will let us know.\n\tfp, err := os.OpenFile(name, os.O_WRONLY|os.O_CREATE|os.O_EXCL, 0644)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\twriter, err := gzip.NewWriterLevel(fp, gzip.BestSpeed)\n\tif err != nil {\n\t\tfp.Close()\n\t\treturn nil, err\n\t}\n\treturn &File{\n\t\tWriter: writer,\n\t\tFp: fp,\n\t}, nil\n}", "func writeToArchive(work <-chan t, done <-chan struct{}) chan t {\n\tout := make(chan t)\n\tgo func() {\n\t\tdefer close(out)\n\t\tfanout := make([]<-chan t, *concurrency) // HL\n\t\tfor j := 0; j < *concurrency; j++ {\n\t\t\tfanout[j] = doWrite(work, done) // HL\n\t\t}\n\n\t\tfor merged := range merge(fanout, done) { // HL\n\t\t\tselect {\n\t\t\tcase out <- merged:\n\t\t\tcase <-done:\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t}()\n\treturn out\n}", "func newZipFile(fName string) (*zipFile, error) {\n\tf, err := os.Create(fName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &zipFile{\n\t\tf,\n\t\tzip.NewWriter(f),\n\t}, nil\n}", "func createFileOldFormat(ctx context.Context, store storage.Storer, f *fEntry) (swarm.Address, error) {\n\t// set up splitter to process the metadata\n\ts := splitter.NewSimpleSplitter(store, storage.ModePutUpload)\n\n\tfdata := make([]byte, f.size)\n\t_, err := rand.Read(fdata)\n\tif err != nil {\n\t\treturn swarm.ZeroAddress, err\n\t}\n\tfileBuf := bytes.NewBuffer(fdata)\n\tfileBytesReader := io.LimitReader(fileBuf, int64(len(fdata)))\n\tfileBytesReadCloser := ioutil.NopCloser(fileBytesReader)\n\tfileBytesAddr, err := s.Split(ctx, fileBytesReadCloser, int64(len(fdata)), false)\n\tif err != nil {\n\t\treturn swarm.ZeroAddress, err\n\t}\n\n\tmetadata := entry.NewMetadata(f.filename)\n\tmetadata.MimeType = f.contentType\n\n\t// serialize metadata and send it to splitter\n\tmetadataBytes, err := json.Marshal(metadata)\n\tif err != nil {\n\t\treturn swarm.ZeroAddress, err\n\t}\n\t// logger.Debugf(\"metadata contents: %s\", metadataBytes)\n\n\t// first add metadata\n\tmetadataBuf := bytes.NewBuffer(metadataBytes)\n\tmetadataReader := io.LimitReader(metadataBuf, int64(len(metadataBytes)))\n\tmetadataReadCloser := ioutil.NopCloser(metadataReader)\n\tmetadataAddr, err := s.Split(ctx, metadataReadCloser, int64(len(metadataBytes)), false)\n\tif err != nil {\n\t\treturn swarm.ZeroAddress, err\n\t}\n\n\t// create entry from given reference and metadata,\n\t// serialize and send to splitter\n\tfileEntry := entry.New(fileBytesAddr, metadataAddr)\n\tfileEntryBytes, err := fileEntry.MarshalBinary()\n\tif err != nil {\n\t\treturn swarm.ZeroAddress, err\n\t}\n\tfileEntryBuf := bytes.NewBuffer(fileEntryBytes)\n\tfileEntryReader := io.LimitReader(fileEntryBuf, int64(len(fileEntryBytes)))\n\tfileEntryReadCloser := ioutil.NopCloser(fileEntryReader)\n\tfileEntryAddr, err := s.Split(ctx, fileEntryReadCloser, int64(len(fileEntryBytes)), false)\n\tif err != nil {\n\t\treturn swarm.ZeroAddress, err\n\t}\n\n\tf.reference = fileBytesAddr\n\treturn fileEntryAddr, nil\n}", "func (file *File) Archive() {\n\tfile.history.Archive(file.content, file.location)\n}", "func (w *RotateWriter) open() error {\n\tinfo, err := os.Stat(w.filename)\n\tif os.IsNotExist(err) {\n\t\tw.fp, err = os.Create(w.filename)\n\t\tw.fsize = int64(0)\n\t\treturn err\n\t}\n\tw.fp, err = os.OpenFile(w.filename, os.O_APPEND|os.O_WRONLY, 0644)\n\tif err != nil {\n\t\treturn err\n\t}\n\tw.fsize = info.Size()\n\treturn nil\n}", "func NewArchive(event Event) {\n\tif archive.Len() >= archiveSize {\n\t\tarchive.Remove(archive.Front())\n\t}\n\tarchive.PushBack(event)\n}", "func NewWriter(w io.Writer) *zip.Writer", "func (c *Client) Archive(name, version, path string, out io.Writer) error {\n\tw := zip.NewWriter(out)\n\tdefer w.Close()\n\terr := c.read(name, version, func(name string, contents io.Reader) error {\n\t\tfilepath := strings.TrimPrefix(name, \"package/\")\n\t\tif !strings.HasPrefix(filepath, path) {\n\t\t\treturn nil\n\t\t}\n\t\tfilepath = strings.TrimPrefix(filepath, path)\n\t\tf, err := w.Create(filepath)\n\t\tif err != nil {\n\t\t\treturn xerrors.Errorf(\"create file: %w\", err)\n\t\t}\n\t\t_, err = io.Copy(f, contents)\n\t\tif err != nil {\n\t\t\treturn xerrors.Errorf(\"copy file contents: %w\", err)\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn xerrors.Errorf(\"read package contents: %w\", err)\n\t}\n\treturn nil\n}", "func NewArchive(stream io.Reader, closer func()) *Archive {\n\treturn &Archive{stream: stream, closer: closer}\n}", "func addToArchive(filename string, zw *zip.Writer) error {\n\t// Open the given file to archive into a zip file.\n\tfile, err := os.Open(filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer file.Close()\n\t// Create adds a file to the zip file using the given name/\n\t// Create returns a io.Writer to which the file contents should be written.\n\twr, err := zw.Create(filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Write the file contents to the zip file.\n\tif _, err := io.Copy(wr, file); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (h *Hook) openNew(fileLoc string) {\n\tif h.CurrentFileSize(fileLoc) == -1 || h.file == nil {\n\t\tif h.file != nil {\n\t\t\th.file.Close()\n\t\t}\n\t\tf, err := os.OpenFile(fileLoc, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0755)\n\t\tif err != nil {\n\t\t\th.Println(err)\n\t\t} else {\n\t\t\th.file = f\n\t\t}\n\t}\n\t//defer mutex.Unlock()\n}", "func (a *TarArchiver) Archive(ctx context.Context, path string, rep Reporter, fn func(k string, r io.ReadSeeker, nbytes int64) error) (err error) {\n\terr = checkValidDir(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar totalToTar int64\n\tif err = a.indexFS(path, func(p string, fi os.FileInfo, err error) error {\n\t\tif !fi.Mode().IsRegular() {\n\t\t\treturn nil //nothing to write for dirs or symlinks\n\t\t}\n\n\t\ttotalToTar += fi.Size()\n\t\treturn nil\n\t}); err != nil {\n\t\treturn errors.Wrap(err, \"failed to index filesystem\")\n\t}\n\n\tif totalToTar > a.sizeLimit {\n\t\treturn errors.Errorf(ErrDatasetTooLarge, humanize.Bytes(uint64(a.sizeLimit)))\n\t}\n\n\ttmpf, clean, err := a.tempFile()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer clean()\n\tinc := rep.StartArchivingProgress(tmpf.Name(), totalToTar)\n\n\ttw := tar.NewWriter(tmpf)\n\tdefer tw.Close()\n\n\tif err = a.indexFS(path, func(p string, fi os.FileInfo, err error) error {\n\t\trel, err := filepath.Rel(path, p)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to determine relative path\")\n\t\t}\n\n\t\t//write header with a filename that standardizes the Separator\n\t\tpath := strings.Split(rel, string(filepath.Separator))\n\t\thdr, err := tar.FileInfoHeader(fi, \"\") //@TODO find out how we handle symlinks\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to convert file info to tar header\")\n\t\t}\n\n\t\thdr.Name = strings.Join(path, TarArchiverPathSeparator)\n\t\tif err = tw.WriteHeader(hdr); err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to write tar header\")\n\t\t}\n\n\t\tif !fi.Mode().IsRegular() {\n\t\t\treturn nil //nothing to write for dirs or symlinks\n\t\t}\n\n\t\t// open files for taring\n\t\tf, err := os.Open(p)\n\t\tdefer f.Close()\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to open file for archiving\")\n\t\t}\n\n\t\t// copy file data into tar writer\n\t\tvar n int64\n\t\tif n, err = Copy(ctx, tw, f); err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to copy file content to archive\")\n\t\t}\n\n\t\tinc(n)\n\t\treturn nil\n\t}); err != nil {\n\t\treturn errors.Wrap(err, \"failed to perform filesystem walk\")\n\t}\n\terr = tw.Flush()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to flush tar writer to disk\")\n\t}\n\n\t_, err = tmpf.Seek(0, 0)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to seek to beginning of file\")\n\t}\n\n\t//stop progress reporting, we're done\n\trep.StopArchivingProgress()\n\tfi, err := tmpf.Stat()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to stat the temporary file\")\n\t}\n\n\treturn fn(slashpath.Join(a.keyPrefix, TarArchiverKey), tmpf, fi.Size())\n}", "func newFile(filename string, size uint64) error {\n\tconst blength int = 1024\n\tburval := make([]byte,blength)\n\tvar base [blength]byte\n\tvar counter, index uint64\n\t//Fill up the base array with random printable characters\n\trand.Seed(time.Now().UnixNano())\n\tfor x:=0; x<len(base); x++ {\n\t\tbase[x]=byte(rand.Intn(95) + 32) //ASCII 32 to 126\n\t}\n\tf,err := os.Create(filename)\n\tdefer f.Close()\n\tif err != nil {\n\t\tlog.Printf(\"newFile(): Error creating file: %s\",filename)\n\t\treturn err\n\t}\n\tburval = base[:]\n\tfor i:=uint64(0); i<size; i++ {\n\t\tcounter += i + uint64(base[i%uint64(blength)])\n\t\tindex = counter%uint64(len(base))\n\t\tburval[i%uint64(len(base))]=base[index]\n\t\tif i%uint64(blength) == 0 {\n\t\t\t_,err = f.Write(burval)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"newFile(): Error writing to file: %s\",filename)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tcounter = uint64(rand.Intn(blength))\n\t\t}\n\t}\n\treturn nil\n}", "func newFileOutput(path string) *fileOutput {\n\tfo := &fileOutput{path: path}\n\n\tf, err := os.Open(path)\n\tif err != nil {\n\t\tfo.err = err\n\t\treturn fo\n\t}\n\tdefer func() {\n\t\t_ = f.Close()\n\t}()\n\n\tgzr, err := gzip.NewReader(f)\n\tif err != nil {\n\t\tfo.err = err\n\t\treturn fo\n\t}\n\tdefer func() {\n\t\t_ = gzr.Close()\n\t}()\n\n\tdata, err := ioutil.ReadAll(gzr)\n\tif err != nil {\n\t\tfo.err = err\n\t\treturn fo\n\t}\n\n\tfo.data = string(data)\n\n\treturn fo\n}", "func (c *Context) Archive() {\n\ttarget := path.Join(c.AppDir(), fmt.Sprintf(\"%v.%v\", c.Tournament.Name, fileExtension))\n\tf, err := os.Create(target)\n\tif err != nil {\n\t\tc.Log.Error(err.Error())\n\t\treturn\n\t}\n\tdefer f.Close()\n\t// Create a buffer to write our archive to.\n\tbuf := bufio.NewWriter(f)\n\n\t// Create a new zip archive.\n\tw := zip.NewWriter(buf)\n\tdefer w.Close()\n\n\t// Add some files to the archive.\n\tvar files = []string{\n\t\t\"config.yml\",\n\t}\n\tfor _, fileName := range c.Songs.FileNames() {\n\t\tfiles = append(files, fmt.Sprintf(\"media/%v\", fileName))\n\t}\n\tfor _, file := range files {\n\t\tzf, err := w.Create(file)\n\t\tif err != nil {\n\t\t\tc.Log.Error(err.Error())\n\t\t}\n\t\tp := path.Join(c.StorageDir(), file)\n\t\tdata, _ := ioutil.ReadFile(p)\n\t\t_, err = zf.Write([]byte(data))\n\t\tif err != nil {\n\t\t\tc.Log.Error(err.Error())\n\t\t}\n\t}\n}", "func (l *FileWriter) openNew() error {\n\terr := os.MkdirAll(l.dir(), 0744)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can't make directories for new logfile: %s\", err)\n\t}\n\n\tname := l.filename()\n\tmode := os.FileMode(0644)\n\tinfo, err := os_Stat(name)\n\tif err == nil {\n\t\t// Copy the mode off the old logfile.\n\t\tmode = info.Mode()\n\t\t// move the existing file\n\t\tnewname := l.backupName(name)\n\t\tif err := os.Rename(name, newname); err != nil {\n\t\t\treturn fmt.Errorf(\"can't rename log file: %s\", err)\n\t\t}\n\n\t\t// this is a no-op anywhere but linux\n\t\tif err := chown(name, info); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// we use truncate here because this should only get called when we've moved\n\t// the file ourselves. if someone else creates the file in the meantime,\n\t// just wipe out the contents.\n\tf, err := os.OpenFile(name, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, mode)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can't open new logfile: %s\", err)\n\t}\n\tl.file = f\n\tl.size = 0\n\treturn nil\n}", "func (m *MutableMap) CommitWithPacker(packer PackerFunc) error {\n\tif m.autosync {\n\t\tfor k, mk := range m.mutkeys {\n\t\t\tif !mk.synced {\n\t\t\t\tmk.Sync()\n\t\t\t}\n\t\t\tdelete(m.mutkeys, k)\n\t\t}\n\n\t\tif len(m.dirty) == 0 {\n\t\t\t// nothing to write!\n\t\t\treturn nil\n\t\t}\n\t}\n\n\tif m.Map.f != nil {\n\t\tm.Map.f.Close()\n\t\tm.Map.f = nil\n\t}\n\n\toldf, err := os.Open(m.Map.filename)\n\tif err != nil {\n\t\tif !os.IsNotExist(err) {\n\t\t\treturn err\n\t\t}\n\t}\n\tif err == nil {\n\t\tdefer oldf.Close()\n\t}\n\n\tvar newf *os.File\n\tisTemp := true\n\tif m.newFilename == \"\" {\n\t\tdir, base := filepath.Split(m.Map.filename)\n\t\tnewf, err = ioutil.TempFile(dir, base)\n\t} else {\n\t\tisTemp = false\n\t\tnewf, err = os.Create(m.newFilename)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer newf.Close()\n\n\t// if a shiftkey is in use, we'd have to scan the current file for offsets\n\tif m.Map.shiftkey > 0 {\n\t\treturn fmt.Errorf(\"not implemented\")\n\t}\n\n\tx := uint32(MAGIC)\n\terr = binary.Write(newf, binary.LittleEndian, x)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// overflow is possible, but if it happens WTF\n\tx = uint32(len(m.Map.Data))\n\terr = binary.Write(newf, binary.LittleEndian, x)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif x != 0 {\n\t\t_, err = newf.Write(m.Map.Data)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t/////\n\tkeys := make([]uint64, 0, len(m.Map.offsets)+len(m.dirty))\n\tfor k := range m.Map.offsets {\n\t\tkeys = append(keys, k)\n\t}\n\tfor k := range m.dirty {\n\t\tif _, ok := m.Map.offsets[k]; !ok {\n\t\t\tkeys = append(keys, k)\n\t\t}\n\t}\n\tsort.Slice(keys, func(i, j int) bool { return keys[i] < keys[j] })\n\n\ttotalKeys := uint64(len(keys))\n\terr = binary.Write(newf, binary.LittleEndian, totalKeys)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tnewoffsets := make(map[uint64]int64, len(keys))\n\n\t// start writing keys and offsets\n\tfor _, k := range keys {\n\t\t// write out the key\n\t\terr = binary.Write(newf, binary.LittleEndian, k)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// placeholder for offset\n\t\terr = binary.Write(newf, binary.LittleEndian, k)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tnewoffsets[k] = 0\n\t}\n\n\toffs, err := newf.Seek(0, os.SEEK_CUR)\n\tw := bufio.NewWriterSize(newf, 50000000) //50mb buffer\n\n\t////////\n\tfor _, k := range keys {\n\t\tnewoffsets[k] = offs\n\n\t\tvar caplen uint64\n\t\tif newvals, ok := m.dirty[k]; ok {\n\t\t\tcaplen = uint64(len(newvals))\n\n\t\t\textraCount, extraData := packer(k, uint32(len(newvals)))\n\t\t\tcaplen |= (caplen + uint64(extraCount)) << 32\n\n\t\t\terr = binary.Write(w, binary.LittleEndian, caplen)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\terr = binary.Write(w, binary.LittleEndian, newvals)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\toffs += int64(8 + 8*len(newvals) + 8*extraCount)\n\t\t\tif extraCount > 0 {\n\t\t\t\terr = binary.Write(w, binary.LittleEndian, extraData)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcontinue\n\t\t}\n\n\t\t_, err = oldf.Seek(m.Map.offsets[k], os.SEEK_SET)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\terr = binary.Read(oldf, binary.LittleEndian, &caplen)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// shift+downcast to get capacity\n\t\tvals := make([]uint64, uint32(caplen>>32))\n\t\terr = binary.Read(oldf, binary.LittleEndian, &vals)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// truncate to values only\n\t\tvals = vals[:uint32(caplen)]\n\t\tcaplen = uint64(len(vals))\n\t\textraCount, extraData := packer(k, uint32(len(vals)))\n\t\tcaplen |= (caplen + uint64(extraCount)) << 32\n\n\t\t//\tcopy caplen + values to new file\n\t\terr = binary.Write(w, binary.LittleEndian, caplen)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\terr = binary.Write(w, binary.LittleEndian, vals)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\toffs += int64(8 + 8*len(vals) + 8*extraCount)\n\t\tif extraCount > 0 {\n\t\t\terr = binary.Write(w, binary.LittleEndian, extraData)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// not used anymore after this\n\tw.Flush()\n\n\t// jump back to the top offset table\n\t_, err = newf.Seek(int64(16+len(m.Map.Data)), os.SEEK_SET)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// now write correct offsets\n\tfor _, k := range keys {\n\t\t// write out the key (again)\n\t\terr = binary.Write(newf, binary.LittleEndian, k)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// now write the real offset\n\t\terr = binary.Write(newf, binary.LittleEndian, newoffsets[k])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t////////\n\n\ttmpName := newf.Name()\n\terr = newf.Close()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif isTemp {\n\t\tif oldf != nil {\n\t\t\terr = os.Rename(m.Map.filename, m.Map.filename+\".old\")\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\terr = os.Rename(tmpName, m.Map.filename)\n\t\tif err != nil {\n\t\t\tstart := time.Now()\n\t\t\tvar a, b *os.File\n\t\t\t// i get a cross-device link error when i try to move across partitions\n\t\t\t// so let's address that\n\t\t\ta, err = os.Open(tmpName)\n\t\t\tif err == nil {\n\t\t\t\tb, err = os.Create(m.Map.filename)\n\t\t\t\tif err == nil {\n\t\t\t\t\t_, err = io.Copy(b, a)\n\t\t\t\t\tb.Close()\n\t\t\t\t}\n\t\t\t\ta.Close()\n\t\t\t}\n\t\t\telap := time.Now().Sub(start)\n\t\t\tlog.Println(\"took\", elap, \"to copy across partitions\")\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif oldf != nil {\n\t\t\terr = os.Remove(m.Map.filename + \".old\")\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t}\n\t\t}\n\t}\n\n\t// move new data into m.Map so it can be used immediately,\n\t// and clear out dirty list to be reused...\n\tm.Map.offsets = newoffsets\n\tfor k, v := range m.dirty {\n\t\tm.Map.cache.Add(k, v)\n\t\tdelete(m.dirty, k)\n\t}\n\tm.Map.start = 16 + len(m.Map.Data)\n\treturn nil\n}", "func (f *File) Marshal(v interface{}) error {\n\tw, err := ioutil.TempFile(filepath.Dir(f.prefix), filepath.Base(f.prefix)+\".write\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := json.NewEncoder(w).Encode(v); err != nil {\n\t\tw.Close()\n\t\treturn err\n\t}\n\tif err := w.Close(); err != nil {\n\t\treturn err\n\t}\n\tos.Remove(f.prefix + \".bak\")\n\tos.Link(f.prefix+\".json\", f.prefix+\".bak\")\n\treturn os.Rename(w.Name(), f.prefix+\".json\")\n}", "func NewArchive(t *Transfer, size uint64) *Archive {\n\treturn &Archive{\n\t\tarchive: &filesystem.Archive{\n\t\t\tBasePath: t.Server.Filesystem().Path(),\n\t\t\tProgress: progress.NewProgress(size),\n\t\t},\n\t}\n}", "func (l *Logger) createNew() {\n\tpath := filepath.Join(l.dir, fmt.Sprintf(\"%s-current.log\", l.filePrefix))\n\tif err := os.MkdirAll(l.dir, 0744); err != nil {\n\t\tglog.WithError(err).Fatal(\"Unable to create directory.\")\n\t}\n\tf, err := os.OpenFile(path, os.O_CREATE|os.O_WRONLY|os.O_TRUNC,\n\t\tos.FileMode(0644))\n\tif err != nil {\n\t\tglog.WithError(err).Fatal(\"Unable to create a new file.\")\n\t}\n\tl.cf = new(CurFile)\n\tl.cf.f = f\n\tcache := new(Cache)\n\tcreateAndUpdateBloomFilter(cache)\n\tatomic.StorePointer(&l.cf.cch, unsafe.Pointer(cache))\n}", "func (f *File) addFile(fh *zip.FileHeader, r io.Reader, crc uint32) error {\n\tf.align(fh)\n\tfh.Flags = 0 // we're not writing a data descriptor after the file\n\tcomp := func(w io.Writer) (io.WriteCloser, error) { return nopCloser{w}, nil }\n\tfh.SetModTime(modTime)\n\tfw, err := f.w.CreateHeaderWithCompressor(fh, comp, fixedCrc32{value: crc})\n\tif err == nil {\n\t\t_, err = io.CopyN(fw, r, int64(fh.CompressedSize64))\n\t}\n\treturn err\n}", "func WriterCreate(w *zip.Writer, name string) (io.Writer, error)", "func Archive(ctx context.Context, body io.Reader, location string, rename Renamer) error {\n\textractor := Extractor{\n\t\tFS: fs{},\n\t}\n\n\treturn extractor.Archive(ctx, body, location, rename)\n}", "func WriteNew(fname string) error {\n\tf, err := os.Create(fname)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = f.WriteString(Gen().Encode())\n\tf.Close()\n\tif err == nil {\n\t\tInvalidateCache()\n\t}\n\treturn err\n}", "func New(fpath string, fns ...Option) (*FileWriter, error) {\n\topt := defaultOption\n\tfor _, fn := range fns {\n\t\tfn(&opt)\n\t}\n\n\tfname := filepath.Base(fpath)\n\tif fname == \"\" {\n\t\treturn nil, fmt.Errorf(\"filename can't empty\")\n\t}\n\tdir := filepath.Dir(fpath)\n\tfi, err := os.Stat(dir)\n\tif err == nil && !fi.IsDir() {\n\t\treturn nil, fmt.Errorf(\"%s already exists and not a directory\", dir)\n\t}\n\tif os.IsNotExist(err) {\n\t\tif err = os.MkdirAll(dir, 0755); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"create dir %s error: %s\", dir, err.Error())\n\t\t}\n\t}\n\n\tcurrent, err := newWrapFile(fpath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tstdlog := log.New(os.Stderr, \"flog \", log.LstdFlags)\n\tch := make(chan *bytes.Buffer, opt.ChanSize)\n\n\tfiles, err := parseRotateItem(dir, fname, opt.RotateFormat)\n\tif err != nil {\n\t\t// set files a empty list\n\t\tfiles = list.New()\n\t\tstdlog.Printf(\"parseRotateItem error: %s\", err)\n\t}\n\n\tlastRotateFormat := time.Now().Format(opt.RotateFormat)\n\tvar lastSplitNum int\n\tif files.Len() > 0 {\n\t\trt := files.Front().Value.(rotateItem)\n\t\t// check contains is mush esay than compared with timestamp\n\t\tif strings.Contains(rt.fname, lastRotateFormat) {\n\t\t\tlastSplitNum = rt.rotateNum\n\t\t}\n\t}\n\n\tfw := &FileWriter{\n\t\topt: opt,\n\t\tdir: dir,\n\t\tfname: fname,\n\t\tstdlog: stdlog,\n\t\tch: ch,\n\t\tpool: &sync.Pool{New: func() interface{} { return new(bytes.Buffer) }},\n\n\t\tlastSplitNum: lastSplitNum,\n\t\tlastRotateFormat: lastRotateFormat,\n\n\t\tfiles: files,\n\t\tcurrent: current,\n\t}\n\n\tfw.wg.Add(1)\n\tgo fw.daemon()\n\n\treturn fw, nil\n}", "func (c *carver) newWriterCloser(fp string) (io.WriteCloser, error) {\n\tif c.dryRun {\n\t\treturn noopCloser{w: io.Discard}, nil\n\t}\n\tif c.w != nil {\n\t\treturn noopCloser{w: c.w}, nil\n\t}\n\treturn os.Create(fp)\n}", "func (z *ZipFile) Add(name string, file []byte) error {\n\n\tiow, err := z.Writer.Create(name)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = iow.Write(file)\n\treturn err\n}", "func rewrite(t *LIBTYPE, f *pasFile, componentSize int, name, mode string) {\n\tname = strings.TrimRight(name, \" \")\n\tif !strings.Contains(mode, modeNoIOPanic) {\n\t\tpanic(fmt.Errorf(\"unsupported file mode: %q\", mode))\n\t}\n\n\tf.close()\n\tf.ioFile = nil\n\tif name == stdioDev {\n\t\tif isMain {\n\t\t\tf.ioFile = &ioFile{\n\t\t\t\teof: true,\n\t\t\t\terstat: 0,\n\t\t\t\tcomponentSize: componentSize,\n\t\t\t\tname: os.Stdout.Name(),\n\t\t\t\tout: os.Stdout, //TODO bufio\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tf.ioFile = &ioFile{\n\t\t\teof: true,\n\t\t\terstat: 0,\n\t\t\tcomponentSize: componentSize,\n\t\t\tname: os.Stdout.Name(),\n\t\t\tout: t.stdout,\n\t\t}\n\t\treturn\n\t}\n\n\tg, err := os.Create(name)\n\tif err != nil {\n\t\tf.ioFile = &ioFile{\n\t\t\teof: false,\n\t\t\terstat: 1,\n\t\t\tcomponentSize: componentSize,\n\t\t\tname: name,\n\t\t}\n\t\treturn\n\t}\n\n\tf.ioFile = &ioFile{\n\t\teof: true,\n\t\terstat: 0,\n\t\tcomponentSize: componentSize,\n\t\tname: name,\n\t\tout: g, //TODO bufio\n\t}\n}", "func (vs *versionSet) createManifest(\n\tdirname string, fileNum, nextFileNum fileNum,\n) (err error) {\n\tvar (\n\t\tfilename = makeFilename(vs.fs, dirname, fileTypeManifest, fileNum)\n\t\tmanifestFile vfs.File\n\t\tmanifest *writer\n\t)\n\tdefer func() {\n\t\tif manifest != nil {\n\t\t\terr = firstError(err, manifest.close())\n\t\t}\n\t\tif manifestFile != nil {\n\t\t\terr = firstError(err, manifestFile.Close())\n\t\t}\n\t\tif err != nil {\n\t\t\terr = firstError(err, vs.fs.Remove(filename))\n\t\t}\n\t}()\n\tmanifestFile, err = vs.fs.Create(filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\tmanifest = newWriter(manifestFile)\n\n\tsnapshot := versionEdit{}\n\tcv := vs.currentVersion()\n\tfor _, meta := range cv.files {\n\t\tsnapshot.newFiles = append(snapshot.newFiles, newFileEntry{\n\t\t\tmeta: meta,\n\t\t})\n\t}\n\n\t// When creating a version snapshot for an existing DB, this snapshot VersionEdit will be\n\t// immediately followed by another VersionEdit (being written in logAndApply()). That\n\t// VersionEdit always contains a LastSeqNum, so we don't need to include that in the snapshot.\n\t// But it does not necessarily include MinUnflushedLogNum, NextFileNum, so we initialize those\n\t// using the corresponding fields in the versionSet (which came from the latest preceding\n\t// VersionEdit that had those fields).\n\tsnapshot.nextFileNum = nextFileNum\n\n\tw, err1 := manifest.next()\n\tif err1 != nil {\n\t\treturn err1\n\t}\n\tif err := snapshot.encode(w); err != nil {\n\t\treturn err\n\t}\n\n\tif vs.manifest != nil {\n\t\tif err := vs.manifest.close(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tvs.manifest = nil\n\t}\n\tif vs.manifestFile != nil {\n\t\tif err := vs.manifestFile.Close(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tvs.manifestFile = nil\n\t}\n\n\tvs.manifest, manifest = manifest, nil\n\tvs.manifestFile, manifestFile = manifestFile, nil\n\treturn nil\n}", "func applyToArchive(tarFile io.Reader, f func(tr *tar.Reader, hdr *tar.Header) error) error {\n\ttr := tar.NewReader(tarFile)\n\tfor {\n\t\thdr, err := tr.Next()\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif err := f(tr, hdr); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func generateArchive(files map[string][]byte) (io.Reader, error) {\n\tr, w := io.Pipe()\n\ttw := tar.NewWriter(w)\n\n\tgo func() {\n\t\tfor p, c := range files {\n\t\t\tlog.Infof(\"Copying file %v in container for verification..\", p)\n\t\t\thdr := &tar.Header{\n\t\t\t\tName: p,\n\t\t\t\tMode: 0644,\n\t\t\t\tSize: int64(len(c)),\n\t\t\t}\n\n\t\t\ttw.WriteHeader(hdr)\n\t\t\ttw.Write(c)\n\t\t}\n\t\tw.Close()\n\t}()\n\n\treturn r, nil\n}", "func (h *HAProxyManager) write(b []byte) error {\n\tf, err := os.OpenFile(h.filename(), os.O_CREATE|os.O_RDWR|os.O_TRUNC, 0644)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\n\t_, err = f.Write(b)\n\treturn err\n}", "func newWriter(filename string, verbose bool, out io.Writer) (io.Writer, error) {\n\twriters := make([]io.Writer, 0)\n\tif len(filename) > 0 || !verbose {\n\t\tfile, err := os.OpenFile(filename, os.O_RDWR|os.O_APPEND|os.O_CREATE, 0660)\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\twriters = append(writers, file)\n\t}\n\n\tif verbose {\n\t\twriters = append(writers, out)\n\t}\n\n\treturn io.MultiWriter(writers...), nil\n}", "func NewWriter(w io.Writer, key []byte, metadata map[string]string) (WriteCloser, error) {\n\tif metadata == nil {\n\t\tmetadata = make(map[string]string)\n\t}\n\tfor k := range metadata {\n\t\tif strings.HasPrefix(k, \"_\") {\n\t\t\treturn nil, ErrMetadataInvalid\n\t\t}\n\t}\n\n\t// Create our HMAC function.\n\th := hmac.New(sha256.New, key)\n\tmw := io.MultiWriter(w, h)\n\n\t// First, write the header.\n\tif _, err := mw.Write(magicHeader); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Generate a timestamp, for convenience only.\n\tmetadata[\"_timestamp\"] = time.Now().UTC().String()\n\tdefer delete(metadata, \"_timestamp\")\n\n\t// Save compression state\n\tcompression, err := CompressionLevelFromMetadata(metadata)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Write the metadata.\n\tb, err := json.Marshal(metadata)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(b) > maxMetadataSize {\n\t\treturn nil, ErrInvalidMetadataLength\n\t}\n\n\t// Metadata length.\n\tif err := writeMetadataLen(mw, uint64(len(b))); err != nil {\n\t\treturn nil, err\n\t}\n\t// Metadata bytes; io.MultiWriter will return a short write error if\n\t// any of the writers returns < n.\n\tif _, err := mw.Write(b); err != nil {\n\t\treturn nil, err\n\t}\n\t// Write the current hash.\n\tcur := h.Sum(nil)\n\tfor done := 0; done < len(cur); {\n\t\tn, err := mw.Write(cur[done:])\n\t\tdone += n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// Wrap in compression. When using \"best compression\" mode, there is usually\n\t// only a little gain in file size reduction, which translate to even smaller\n\t// gain in restore latency reduction, while inccuring much more CPU usage at\n\t// save time.\n\tif compression == CompressionLevelFlateBestSpeed {\n\t\treturn compressio.NewWriter(w, key, compressionChunkSize, flate.BestSpeed)\n\t}\n\n\treturn compressio.NewSimpleWriter(w, key)\n}", "func rewriteArchive(r *build.Rule) error {\n\tif !hasMirror(r) {\n\t\tif err := mirrorArchive(r); err != nil {\n\t\t\tlog.Printf(\"failed to mirror %s: %v\", r.Name(), err)\n\t\t}\n\t}\n\treturn hashArchive(r)\n}", "func NewArchiver() *Archiver {\n\treturn &Archiver{\n\t\tBeforeCopyCallback: func(path string, info os.FileInfo) {},\n\t\tAfterCopyCallback: func(path string, info os.FileInfo) {},\n\t}\n}", "func (r *Reader) Archive(ctx context.Context, name string, rd io.Reader, p *restic.Progress) (*restic.Snapshot, restic.ID, error) {\n\tif name == \"\" {\n\t\treturn nil, restic.ID{}, errors.New(\"no filename given\")\n\t}\n\n\tdebug.Log(\"start archiving %s\", name)\n\tsn, err := restic.NewSnapshot([]string{name}, r.Tags, r.Hostname, time.Now())\n\tif err != nil {\n\t\treturn nil, restic.ID{}, err\n\t}\n\n\tp.Start()\n\tdefer p.Done()\n\n\trepo := r.Repository\n\tchnker := chunker.New(rd, repo.Config().ChunkerPolynomial)\n\n\tids := restic.IDs{}\n\tvar fileSize uint64\n\n\tfor {\n\t\tchunk, err := chnker.Next(getBuf())\n\t\tif errors.Cause(err) == io.EOF {\n\t\t\tbreak\n\t\t}\n\n\t\tif err != nil {\n\t\t\treturn nil, restic.ID{}, errors.Wrap(err, \"chunker.Next()\")\n\t\t}\n\n\t\tid := restic.Hash(chunk.Data)\n\n\t\tif !repo.Index().Has(id, restic.DataBlob) {\n\t\t\t_, err := repo.SaveBlob(ctx, restic.DataBlob, chunk.Data, id)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, restic.ID{}, err\n\t\t\t}\n\t\t\tdebug.Log(\"saved blob %v (%d bytes)\\n\", id.Str(), chunk.Length)\n\t\t} else {\n\t\t\tdebug.Log(\"blob %v already saved in the repo\\n\", id.Str())\n\t\t}\n\n\t\tfreeBuf(chunk.Data)\n\n\t\tids = append(ids, id)\n\n\t\tp.Report(restic.Stat{Bytes: uint64(chunk.Length)})\n\t\tfileSize += uint64(chunk.Length)\n\t}\n\n\ttree := &restic.Tree{\n\t\tNodes: []*restic.Node{\n\t\t\t{\n\t\t\t\tName: name,\n\t\t\t\tAccessTime: time.Now(),\n\t\t\t\tModTime: time.Now(),\n\t\t\t\tType: \"file\",\n\t\t\t\tMode: 0644,\n\t\t\t\tSize: fileSize,\n\t\t\t\tUID: sn.UID,\n\t\t\t\tGID: sn.GID,\n\t\t\t\tUser: sn.Username,\n\t\t\t\tContent: ids,\n\t\t\t},\n\t\t},\n\t}\n\n\ttreeID, err := repo.SaveTree(ctx, tree)\n\tif err != nil {\n\t\treturn nil, restic.ID{}, err\n\t}\n\tsn.Tree = &treeID\n\tdebug.Log(\"tree saved as %v\", treeID.Str())\n\n\tid, err := repo.SaveJSONUnpacked(ctx, restic.SnapshotFile, sn)\n\tif err != nil {\n\t\treturn nil, restic.ID{}, err\n\t}\n\n\tdebug.Log(\"snapshot saved as %v\", id.Str())\n\n\terr = repo.Flush()\n\tif err != nil {\n\t\treturn nil, restic.ID{}, err\n\t}\n\n\terr = repo.SaveIndex(ctx)\n\tif err != nil {\n\t\treturn nil, restic.ID{}, err\n\t}\n\n\treturn sn, id, nil\n}", "func As(ar *txtar.Archive) fs.FS {\n\tm := make(mapfs.MapFS, len(ar.Files))\n\tfor _, f := range ar.Files {\n\t\tm[f.Name] = &mapfs.MapFile{\n\t\t\tData: f.Data,\n\t\t\t// TODO: maybe ModTime: time.Now(),\n\t\t\tSys: f,\n\t\t}\n\t}\n\tm.ChmodAll(0666)\n\treturn m\n}", "func (m *Mover) Archive(action dmplugin.Action) error {\n\tdebug.Printf(\"%s id:%d archive %s %s\", m.name, action.ID(), action.PrimaryPath(), action.FileID())\n\trate.Mark(1)\n\tstart := time.Now()\n\n\tsrc, err := os.Open(action.PrimaryPath())\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"%s: open failed\", action.PrimaryPath())\n\t}\n\tdefer src.Close()\n\n\tfi, err := src.Stat()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"stat failed\")\n\t}\n\n\tfileID := newFileID()\n\tfileKey := m.destination(fileID)\n\tsize := fi.Size()\n\tprogressFunc := func(offset, length uint64) error {\n\t\treturn action.Update(offset, length, uint64(size))\n\t}\n\tprogressReader := progress.NewReader(src, updateInterval, progressFunc)\n\tdefer progressReader.StopUpdates()\n\n\tuploader := m.newUploader()\n\tout, err := uploader.Upload(&s3manager.UploadInput{\n\t\tBody: progressReader,\n\t\tBucket: aws.String(m.bucket),\n\t\tKey: aws.String(fileKey),\n\t\tContentType: aws.String(\"application/octet-stream\"),\n\t})\n\tif err != nil {\n\t\tif multierr, ok := err.(s3manager.MultiUploadFailure); ok {\n\t\t\talert.Warn(\"Upload error:\", multierr.Code(), multierr.Message(), multierr.UploadID())\n\t\t}\n\t\treturn errors.Wrap(err, \"upload failed\")\n\t}\n\n\tdebug.Printf(\"%s id:%d Archived %d bytes in %v from %s to %s\", m.name, action.ID(), fi.Size(),\n\t\ttime.Since(start),\n\t\taction.PrimaryPath(),\n\t\tout.Location)\n\n\tu := url.URL{\n\t\tScheme: \"s3\",\n\t\tHost: m.bucket,\n\t\tPath: fileKey,\n\t}\n\n\taction.SetFileID([]byte(u.String()))\n\taction.SetActualLength(uint64(fi.Size()))\n\treturn nil\n}", "func serialize(gnarkObject io.WriterTo, fileName string) {\n\tf, err := os.Create(fileName)\n\tassertNoError(err)\n\n\t_, err = gnarkObject.WriteTo(f)\n\tassertNoError(err)\n}", "func (a *Archive) Stream(ctx context.Context, w io.Writer) error {\n\treturn a.archive.Stream(ctx, w)\n}", "func (f *FileRotator) createFile() error {\n\tlogFileName := filepath.Join(f.path, fmt.Sprintf(\"%s.%d\", f.baseFileName, f.logFileIdx))\n\tcFile, err := os.OpenFile(logFileName, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0644)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tf.currentFile = cFile\n\tfi, err := f.currentFile.Stat()\n\tif err != nil {\n\t\treturn err\n\t}\n\tf.currentWr = fi.Size()\n\tf.createOrResetBuffer()\n\treturn nil\n}", "func newCompressor(format CompressEncodingType) (compressor, error) {\n\tvar (\n\t\twriter encoder\n\t\terr error\n\t)\n\n\tswitch format {\n\tcase GZIPCompression:\n\t\twriter = gzip.NewWriter(io.Discard)\n\tcase DeflateCompression:\n\t\twriter, err = flate.NewWriter(io.Discard, flate.BestSpeed)\n\t\tif err != nil {\n\t\t\treturn compressor{}, err\n\t\t}\n\tcase NoCompression:\n\t\twriter = nil\n\tdefault:\n\t\treturn compressor{}, fmt.Errorf(\"invalid format: %s\", format)\n\t}\n\n\treturn compressor{\n\t\tformat: format,\n\t\twriter: writer,\n\t}, nil\n}", "func NewWriter(fname string, bufferLength int) *Writer {\n\tw := &Writer{\n\t\trec: make(chan []byte, bufferLength),\n\t\trot: make(chan bool),\n\t\tfilename: fname,\n\t\trotate: true,\n\t}\n\n\t// open the file for the first time\n\tif err := w._Rotate(); err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"Writer(%q): %s\\n\", w.filename, err)\n\t\treturn nil\n\t}\n\n\tgo func() {\n\t\tdefer func() {\n\t\t\tif w.file != nil {\n\t\t\t\tw.file.Close()\n\t\t\t}\n\t\t}()\n\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-w.rot:\n\t\t\t\tif err := w._Rotate(); err != nil {\n\t\t\t\t\tfmt.Fprintf(os.Stderr, \"Writer(%q): %s\\n\", w.filename, err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\tcase rec, ok := <-w.rec:\n\t\t\t\tif !ok {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tnow := time.Now()\n\t\t\t\tif (w.maxsize > 0 && w.maxsize_cursize >= w.maxsize) ||\n\t\t\t\t\t(w.daily && now.Day() != w.daily_opendate) {\n\t\t\t\t\tif err := w._Rotate(); err != nil {\n\t\t\t\t\t\tfmt.Fprintf(os.Stderr, \"Writer(%q): %s\\n\", w.filename, err)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Perform the write\n\t\t\t\tn, err := w.file.Write(rec)\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Fprintf(os.Stderr, \"Writer(%q): %s\\n\", w.filename, err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// Update the counts\n\t\t\t\tw.maxsize_cursize += n\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn w\n}", "func create(\n\tlogDir *DirName, prefix string, t time.Time, lastRotation int64,\n) (f *os.File, updatedRotation int64, filename string, err error) {\n\tdir, err := logDir.get()\n\tif err != nil {\n\t\treturn nil, lastRotation, \"\", err\n\t}\n\n\t// Ensure that the timestamp of the new file name is greater than\n\t// the timestamp of the previous generated file name.\n\tunix := t.Unix()\n\tif unix <= lastRotation {\n\t\tunix = lastRotation + 1\n\t}\n\tupdatedRotation = unix\n\tt = timeutil.Unix(unix, 0)\n\n\t// Generate the file name.\n\tname, link := logName(prefix, t)\n\tfname := filepath.Join(dir, name)\n\t// Open the file os.O_APPEND|os.O_CREATE rather than use os.Create.\n\t// Append is almost always more efficient than O_RDRW on most modern file systems.\n\tf, err = os.OpenFile(fname, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0664)\n\tif err == nil {\n\t\tsymlink := filepath.Join(dir, link)\n\n\t\t// Symlinks are best-effort.\n\n\t\tif err := os.Remove(symlink); err != nil && !os.IsNotExist(err) {\n\t\t\tfmt.Fprintf(OrigStderr, \"log: failed to remove symlink %s: %s\", symlink, err)\n\t\t}\n\t\tif err := os.Symlink(filepath.Base(fname), symlink); err != nil {\n\t\t\t// On Windows, this will be the common case, as symlink creation\n\t\t\t// requires special privileges.\n\t\t\t// See: https://docs.microsoft.com/en-us/windows/device-security/security-policy-settings/create-symbolic-links\n\t\t\tif runtime.GOOS != \"windows\" {\n\t\t\t\tfmt.Fprintf(OrigStderr, \"log: failed to create symlink %s: %s\", symlink, err)\n\t\t\t}\n\t\t}\n\t}\n\treturn f, updatedRotation, fname, errors.Wrapf(err, \"log: cannot create log\")\n}", "func Write(opts *Opts) error {\n\t// Write base archive.\n\tif opts.BaseArchive != nil {\n\t\ttransform := cpio.MakeReproducible\n\n\t\t// Rename init to inito if user doesn't want the existing init.\n\t\tif !opts.UseExistingInit && opts.Contains(\"init\") {\n\t\t\ttransform = func(r cpio.Record) cpio.Record {\n\t\t\t\tif r.Name == \"init\" {\n\t\t\t\t\tr.Name = \"inito\"\n\t\t\t\t}\n\t\t\t\treturn cpio.MakeReproducible(r)\n\t\t\t}\n\t\t}\n\t\t// If user wants the base archive init, but specified another\n\t\t// init, make the other one inito.\n\t\tif opts.UseExistingInit && opts.Contains(\"init\") {\n\t\t\topts.Rename(\"init\", \"inito\")\n\t\t}\n\n\t\tfor {\n\t\t\tf, err := opts.BaseArchive.ReadRecord()\n\t\t\tif err == io.EOF {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t// TODO: ignore only the error where it already exists\n\t\t\t// in archive.\n\t\t\topts.Files.AddRecord(transform(f))\n\t\t}\n\t}\n\n\tif err := opts.Files.WriteTo(opts.OutputFile); err != nil {\n\t\treturn err\n\t}\n\treturn opts.OutputFile.Finish()\n}", "func (f *File) Write(writer io.Writer) error {\n\twrap := func(err error) error {\n\t\treturn fmt.Errorf(\"File.Write: %w\", err)\n\t}\n\tzipWriter := zip.NewWriter(writer)\n\terr := f.MarshallParts(zipWriter)\n\tif err != nil {\n\t\treturn wrap(err)\n\t}\n\terr = zipWriter.Close()\n\tif err != nil {\n\t\treturn wrap(err)\n\t}\n\treturn nil\n}", "func New(base fsio.ReadSeekerAt) (*FS, error) {\n\tsize, err := fsio.GetSize(base)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tzr, err := zip.NewReader(base, size)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &FS{zr}, nil\n}", "func writeNewFile(filename string, data []byte, perm os.FileMode) error {\n\tf, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_EXCL, perm)\n\tif err != nil {\n\t\treturn err\n\t}\n\tn, err := f.Write(data)\n\tif err == nil && n < len(data) {\n\t\terr = io.ErrShortWrite\n\t}\n\tif err1 := f.Close(); err == nil {\n\t\terr = err1\n\t}\n\treturn err\n}", "func (f *Finder) Serialize(outFilename string) error {\n\t// Set up a temp file to store the serialization so we aren't writing to a\n\t// file which may have valid data in it already\n\tvar tmpfile, err = fileutil.TempFile(\"\", \"finder-serialize-\", \"\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer os.Remove(tmpfile.Name())\n\n\t// Register all the error types\n\tgob.Register(&apperr.BaseError{})\n\tgob.Register(&schema.IssueError{})\n\tgob.Register(&schema.DuplicateIssueError{})\n\n\t// Attempt to encode to said file, returning the error if that doesn't work\n\tvar enc = gob.NewEncoder(tmpfile)\n\terr = enc.Encode(f.cachedFinder())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Continue the paranoia: if the file exists, we make a backup instead of\n\t// just overwriting it\n\tvar backup string\n\tif fileutil.Exists(outFilename) {\n\t\tbackup = tmpfile.Name() + \"-bak\"\n\t\terr = fileutil.CopyFile(outFilename, backup)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to backup original file %#v: %w\", outFilename, err)\n\t\t}\n\t}\n\n\t// Create/overwrite the real file\n\terr = fileutil.CopyFile(tmpfile.Name(), outFilename)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to copy temp file to %q: %w\", outFilename, err)\n\t}\n\n\t// Attempt to remove the backup, though we ignore any errors if it doesn't\n\t// work; we don't want to fail the whole operation because a backup file got\n\t// left behind, do we?\n\tif backup != \"\" {\n\t\tos.Remove(backup)\n\t}\n\treturn nil\n}", "func (t *MonthArchiveTemplate) Write(w io.Writer) error {\n\t_, err := w.Write([]byte(t.string()))\n\treturn err\n}", "func Save(path string, v interface{}, opts Options) (err error) {\n\tvar (\n\t\tzw *lz4.Writer\n\t\tencoder *jsoniter.Encoder\n\t\th hash.Hash\n\t\tmw io.Writer\n\t\tprefix [prefLen]byte\n\t\toff, l int\n\t\tfile *os.File\n\t\ttmp = path + \".tmp.\" + cmn.GenTie()\n\t)\n\tif file, err = cmn.CreateFile(tmp); err != nil {\n\t\treturn\n\t}\n\tdefer func() {\n\t\t_ = file.Close()\n\t\tif err != nil {\n\t\t\tos.Remove(tmp)\n\t\t}\n\t}()\n\tif opts.Signature {\n\t\toff = prefLen\n\t}\n\tif opts.Checksum {\n\t\th = xxhash.New64()\n\t\toff += h.Size()\n\t}\n\tif off > 0 {\n\t\tif _, err = file.Seek(int64(off), io.SeekStart); err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\tif opts.Compression {\n\t\tif opts.Checksum {\n\t\t\tmw = io.MultiWriter(h, file)\n\t\t\tzw = lz4.NewWriter(mw)\n\t\t} else {\n\t\t\tzw = lz4.NewWriter(file)\n\t\t}\n\t\tencoder = jsoniter.NewEncoder(zw)\n\t} else {\n\t\tif opts.Checksum {\n\t\t\tmw = io.MultiWriter(h, file)\n\t\t\tencoder = jsoniter.NewEncoder(mw)\n\t\t} else {\n\t\t\tencoder = jsoniter.NewEncoder(file)\n\t\t}\n\t}\n\tencoder.SetIndent(\"\", \" \")\n\tif err = encoder.Encode(v); err != nil {\n\t\treturn\n\t}\n\tif opts.Compression {\n\t\t_ = zw.Close()\n\t}\n\tif opts.Signature {\n\t\tif _, err = file.Seek(0, io.SeekStart); err != nil {\n\t\t\treturn\n\t\t}\n\t\t// 1st 64-bit word\n\t\tcopy(prefix[:], signature)\n\t\tl = len(signature)\n\t\tcmn.Assert(l < prefLen/2)\n\t\tprefix[l] = version\n\n\t\t// 2nd 64-bit word as of version == 1\n\t\tvar packingInfo uint64\n\t\tif opts.Compression {\n\t\t\tpackingInfo |= 1 << 0\n\t\t}\n\t\tif opts.Checksum {\n\t\t\tpackingInfo |= 1 << 1\n\t\t}\n\t\tbinary.BigEndian.PutUint64(prefix[cmn.SizeofI64:], packingInfo)\n\n\t\t// write prefix\n\t\tfile.Write(prefix[:])\n\t}\n\tif opts.Checksum {\n\t\tif !opts.Signature {\n\t\t\tif _, err = file.Seek(0, io.SeekStart); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tfile.Write(h.Sum(nil))\n\t}\n\tif err = file.Close(); err != nil {\n\t\treturn\n\t}\n\terr = os.Rename(tmp, path)\n\treturn\n}", "func (l *Log) writer() {\n\t// Open as O_RDWR (which should get lock) and O_DIRECT.\n\tf, err := os.OpenFile(l.filename, os.O_WRONLY|os.O_APPEND, 0660)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer f.Close()\n\tenc := json.NewEncoder(f)\n\tfor {\n\t\tr, ok := <-l.in\n\t\tif !ok {\n\t\t\treturn\n\t\t}\n\t\tif r.m == nil {\n\t\t\tr.err <- fmt.Errorf(\"cannot write nil to wal\")\n\t\t\treturn\n\t\t}\n\t\t// serialize mutation and write to disk\n\t\tif err := enc.Encode(r.m); err != nil {\n\t\t\tr.err <- fmt.Errorf(\"wal encoding: %s\", err.Error())\n\t\t\treturn\n\t\t}\n\t\t// sync\n\t\tif err := f.Sync(); err != nil {\n\t\t\tr.err <- fmt.Errorf(\"wal sync: %s\", err.Error())\n\t\t\treturn\n\t\t}\n\t\tr.err <- nil\n\t\t// send to reader\n\t\tif l.closed {\n\t\t\treturn\n\t\t}\n\t}\n}", "func NewWriter(f File, o *db.Options) *Writer {\n\tw := &Writer{\n\t\tcloser: f,\n\t\tblockRestartInterval: o.GetBlockRestartInterval(),\n\t\tblockSize: o.GetBlockSize(),\n\t\tcmp: o.GetComparer(),\n\t\tcompression: o.GetCompression(),\n\t\tprevKey: make([]byte, 0, 256),\n\t\trestarts: make([]uint32, 0, 256),\n\t}\n\tif f == nil {\n\t\tw.err = errors.New(\"leveldb/table: nil file\")\n\t\treturn w\n\t}\n\t// If f does not have a Flush method, do our own buffering.\n\ttype flusher interface {\n\t\tFlush() error\n\t}\n\tif _, ok := f.(flusher); ok {\n\t\tw.writer = f\n\t} else {\n\t\tw.bufWriter = bufio.NewWriter(f)\n\t\tw.writer = w.bufWriter\n\t}\n\treturn w\n}", "func newFileRotatedEntry(config *FileRotatedOutputConfig, outputFormatter logrus.Formatter) *logrus.Entry {\n\n\tlogger := logrus.New()\n\tlogger.Out = &lumberjack.Logger{\n\t\tFilename: config.FullPath,\n\t\tMaxSize: config.MaxFileSizeMB,\n\t\tMaxBackups: config.MaxNumFiles,\n\t}\n\n\t// default formatter is JSON\n\tif outputFormatter == nil {\n\t\toutputFormatter = &formatter.Json{}\n\t}\n\n\tlogger.Formatter = outputFormatter\n\n\treturn logrus.NewEntry(logger)\n}", "func FountainToFadeIn(in io.Reader, outFName string) error {\n\tsrc, err := ioutil.ReadAll(in)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdocument, err := fountain.Parse(src)\n\tif err != nil {\n\t\treturn err\n\t}\n\tnewDoc := fountainToOSF(document)\n\tsrc, err = newDoc.ToXML()\n\tif err != nil {\n\t\treturn err\n\t}\n\tbuf := new(bytes.Buffer)\n\tw := zip.NewWriter(buf)\n\tf, err := w.Create(\"document.xml\")\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = f.Write(src)\n\tif err != nil {\n\t\treturn err\n\t}\n\tw.Close()\n\t//NOTE: How do we set the Zipfile's name by write our\n\t// buf out to disc.\n\terr = ioutil.WriteFile(outFName, buf.Bytes(), 0664)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (index *ind) writeIndexFile() {\n\tif _, err := os.Stat(index.name); os.IsNotExist(err) {\n\t\tindexFile, err := os.Create(index.name)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t}\n\t\tindexFile.Close()\n\t}\n\n\tb := new(bytes.Buffer)\n\te := gob.NewEncoder(b)\n\n\terr := e.Encode(index)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tioutil.WriteFile(index.name, b.Bytes(), 7777)\n}", "func Archive(filename string) (Store, error) {\n\tf, err := os.Open(filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tz, err := gzip.NewReader(f)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn archive{\n\t\tf: f,\n\t\tz: z,\n\t\tr: tar.NewReader(z),\n\t}, nil\n}", "func (logger *FileLogger) openNew() error {\n\terr := os.MkdirAll(logger.dir(), 0755)\n\tfmt.Println(logger.dir())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can't make directories for new logfile: %q\", err)\n\t}\n\n\t// We use truncate here because this should only get called when we've closed\n\t// the renamed (by logrotate) file ourselves. If someone else creates the file\n\t// in the meantime, just wipe out the contents.\n\tfmt.Println(logger.Filename)\n\tf, err := os.OpenFile(logger.Filename, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, os.FileMode(0644))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"can't open new logfile: %s\", err)\n\t}\n\tlogger.file = f\n\treturn nil\n}", "func (f *File) align(h *zip.FileHeader) {\n\tif f.Align != 0 && h.Method == zip.Store {\n\t\t// We have to allow space for writing the header, so we predict what the offset will be after it.\n\t\tfileStart := f.w.Offset() + fileHeaderLen + len(h.Name) + len(h.Extra)\n\t\tif overlap := fileStart % f.Align; overlap != 0 {\n\t\t\tif err := f.w.WriteRaw(bytes.Repeat([]byte{0}, f.Align-overlap)); err != nil {\n\t\t\t\tlog.Error(\"Failed to pad file: %s\", err)\n\t\t\t}\n\t\t}\n\t}\n}", "func NewArchiver(idMappings *idtools.IDMappings) *archive.Archiver {\n\tarchiver := archive.NewArchiver(idMappings)\n\tarchiver.Untar = Untar\n\treturn archiver\n}", "func AddToZip(zip *zip.Writer, zipQ chan FetchedStream) error {\n\tfetched := <-zipQ\n\tif fetched.Err != nil {\n\t\tfmt.Printf(\"Error in fetching stream , stream name %s, err %s\", fetched.Name, fetched.Err.Error())\n\t\treturn fetched.Err\n\t}\n\tdefer fetched.Stream.Close()\n\turlEntry, err := zip.Create(fetched.Name)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfmt.Printf(\"Adding stream entry to zip %s\\n\", fetched.Name)\n\tdefer fetched.Stream.Close()\n\tio.Copy(urlEntry, fetched.Stream)\n\treturn nil\n}", "func WithFormat(f FormatterFunc) Option {\n\treturn func(a *Archiver) {\n\t\ta.format = f\n\t}\n}", "func NewWriter(writer io.Writer, params ...interface{}) (*Archive, error) {\n\tarchive := &Archive{\n\t\tSizeLimit: -1,\n\t\tFileLimit: -1,\n\t\twriter: writer,\n\t}\n\n\tswitch Extension(params[0].(string)) {\n\tcase \".tar.gz\":\n\t\twriter = gzip.NewWriter(writer)\n\t\tarchive.writer = writer\n\t\tfallthrough\n\tcase \".tar\":\n\t\tarchive.action = &tarActor{\n\t\t\twriter: tar.NewWriter(writer),\n\t\t\tmode: FileMode,\n\t\t}\n\tcase \".zip\":\n\t\tvar compressed bool\n\t\tif len(params) > 1 {\n\t\t\tcompressed = params[1].(bool)\n\t\t}\n\t\tarchive.action = &zipActor{\n\t\t\twriter: zip.NewWriter(writer),\n\t\t\tcompressed: compressed,\n\t\t}\n\t}\n\n\treturn archive, nil\n}", "func FileWrite(f *os.File, b []byte) (int, error)", "func (w *RotateWriter) rotate() (err error) {\n\t// Close existing file if open.\n\tif w.fp != nil {\n\t\terr = w.fp.Close()\n\t\tw.fp = nil\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Rename dest file if it already exists.\n\t_, err = os.Stat(w.filename)\n\tif err == nil {\n\t\trot := w.filename + \".\" + time.Now().Format(TimeFmt)\n\t\terr = os.Rename(w.filename, rot)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif w.Compress {\n\t\t\terr = w.compress(rot) // TODO: async\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// Clean up old.\n\tw.drain()\n\n\t// Create new.\n\treturn w.open()\n}", "func (d *Directory) File(name string, modTime time.Time, mode uint16, xattrs []Xattr) (io.WriteCloser, error) {\n\toff, err := d.w.w.Seek(0, io.SeekCurrent)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// zlib.BestSpeed results in only a 2x slow-down over no compression\n\t// (compared to >4x slow-down with DefaultCompression), but generates\n\t// results which are in the same ball park (10% larger).\n\tzw, err := zlib.NewWriterLevel(nil, zlib.BestSpeed)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\txattrRef := uint32(invalidXattr)\n\tif len(xattrs) > 0 {\n\t\txattrRef = uint32(len(d.w.xattrs))\n\t\td.w.xattrs = append(d.w.xattrs, xattrs[0]) // TODO: support multiple\n\t\tsize := len(xattrs[0].FullName) + len(xattrs[0].Value)\n\t\td.w.xattrIds = append(d.w.xattrIds, xattrId{\n\t\t\t// Xattr is populated in writeXattrTables\n\t\t\tCount: 1, // TODO: support multiple\n\t\t\tSize: uint32(size),\n\t\t})\n\t}\n\treturn &file{\n\t\tw: d.w,\n\t\td: d,\n\t\toff: off,\n\t\tname: name,\n\t\tmodTime: modTime,\n\t\tmode: mode,\n\t\tcompBuf: bytes.NewBuffer(make([]byte, dataBlockSize)),\n\t\tzlibWriter: zw,\n\t\txattrRef: xattrRef,\n\t}, nil\n}", "func (a *TarArchiver) Unarchive(ctx context.Context, path string, rep Reporter, fn func(k string, w io.WriterAt) error) error {\n\t// We need to check the target directory first to avoid downloading data if there is a problem\n\terr := a.checkTargetDir(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttmpf, clean, err := a.tempFile()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer clean()\n\n\terr = fn(slashpath.Join(a.keyPrefix, TarArchiverKey), tmpf)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to download to temporary file\")\n\t}\n\n\t_, err = tmpf.Seek(0, 0)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to seek to the beginning of file\")\n\t}\n\n\tfi, err := tmpf.Stat()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to stat temporary file\")\n\t}\n\n\tpr := rep.StartUnarchivingProgress(tmpf.Name(), fi.Size(), tmpf)\n\tdefer rep.StopUnarchivingProgress()\n\n\ttr := tar.NewReader(pr)\n\tfor {\n\t\thdr, err := tr.Next()\n\t\tswitch {\n\t\tcase err == io.EOF:\n\t\t\treturn nil //EOF we're done here\n\t\tcase err != nil:\n\t\t\treturn errors.Wrap(err, \"failed to read next header\")\n\t\tcase hdr == nil:\n\t\t\tcontinue\n\t\t}\n\n\t\t// the target location where the dir/file should be created\n\t\tparts := []string{path}\n\t\tparts = append(parts, strings.Split(hdr.Name, TarArchiverPathSeparator)...)\n\t\ttarget := filepath.Join(parts...)\n\n\t\tswitch hdr.Typeflag {\n\t\tcase tar.TypeDir: //if its a dir and it doesn't exist create it, no-op if it exists already\n\t\t\terr = os.MkdirAll(target, hdr.FileInfo().Mode())\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, \"failed to create directory for entry found in tar file\")\n\t\t\t}\n\n\t\tcase tar.TypeReg: //regular file is written, must not exist yet\n\t\t\tif err = func() (err error) {\n\t\t\t\tf, err := os.OpenFile(target, os.O_WRONLY|os.O_CREATE|os.O_EXCL, hdr.FileInfo().Mode())\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn errors.Wrap(err, \"failed to open new file for tar entry \")\n\t\t\t\t}\n\n\t\t\t\tdefer f.Close()\n\t\t\t\tif _, err := io.Copy(f, tr); err != nil {\n\t\t\t\t\treturn errors.Wrap(err, \"failed to copy archived file content\")\n\t\t\t\t}\n\n\t\t\t\treturn nil\n\t\t\t}(); err != nil {\n\t\t\t\treturn errors.Wrap(err, \"failed to extract file\")\n\t\t\t}\n\t\t}\n\t}\n}", "func writeFileMapRolling(bs blobserver.StatReceiver, file *Builder, r io.Reader) (blob.Ref, error) {\n\tn, spans, err := writeFileChunks(bs, file, r)\n\tif err != nil {\n\t\treturn blob.Ref{}, err\n\t}\n\t// The top-level content parts\n\treturn uploadBytes(bs, file, n, spans).Get()\n}", "func NewFzArchive() *FzArchive {\n\treturn (*FzArchive)(allocFzArchiveMemory(1))\n}", "func (rl *RotateLogs) Write(p []byte) (n int, err error) {\n\t// Guard against concurrent writes\n\trl.mutex.Lock()\n\tdefer rl.mutex.Unlock()\n\n\t// This filename contains the name of the \"NEW\" filename\n\t// to log to, which may be newer than rl.currentFilename\n\tfilename := rl.genFilename()\n\n\tvar out *os.File\n\tif filename == rl.curFn { // Match!\n\t\tout = rl.outFh // use old one\n\t}\n\n\tvar isNew bool\n\n\tif out == nil {\n\t\tisNew = true\n\n\t\t_, err := os.Stat(filename)\n\t\tif err == nil {\n\t\t\tif rl.linkName != \"\" {\n\t\t\t\t_, err = os.Lstat(rl.linkName)\n\t\t\t\tif err == nil {\n\t\t\t\t\tisNew = false\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfh, err := os.OpenFile(filename, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0644)\n\t\tif err != nil {\n\t\t\treturn 0, fmt.Errorf(\"error: Failed to open file %s: %s\", rl.pattern, err)\n\t\t}\n\n\t\tout = fh\n\t\tif isNew {\n\t\t\tif err := rl.rotate(filename); err != nil {\n\t\t\t\t// Failure to rotate is a problem, but it's really not a great\n\t\t\t\t// idea to stop your application just because you couldn't rename\n\t\t\t\t// your log. For now, we're just going to punt it and write to\n\t\t\t\t// os.Stderr\n\t\t\t\tfmt.Fprintf(os.Stderr, \"failed to rotate: %s\\n\", err)\n\t\t\t}\n\t\t}\n\t}\n\n\tn, err = out.Write(p)\n\n\tif rl.outFh == nil {\n\t\trl.outFh = out\n\t} else if isNew {\n\t\trl.outFh.Close()\n\t\trl.outFh = out\n\t}\n\trl.curFn = filename\n\n\treturn n, err\n}", "func (vs *versionSet) create(dirname string, opt *Options, dir vfs.File,\n\tmu *sync.Mutex) error {\n\tvs.init(dirname, opt, mu)\n\tnewVersion := &version{}\n\tvs.append(newVersion)\n\n\t// Note that a \"snapshot\" version edit is written to the manifest when it is\n\t// created.\n\tvs.manifestFileNum = vs.getNextFileNum()\n\tif err := vs.createManifest(vs.dirname, vs.manifestFileNum, vs.nextFileNum); err != nil {\n\t\treturn err\n\t}\n\tif err := vs.manifest.flush(); err != nil {\n\t\treturn err\n\t}\n\tif err := vs.manifestFile.Sync(); err != nil {\n\t\treturn err\n\t}\n\tif err := setCurrentFile(vs.dirname, vs.fs, vs.manifestFileNum); err != nil {\n\t\treturn err\n\t}\n\treturn dir.Sync()\n}", "func (f File) Copy() File {\n\tout := File{f.Path, f.Time, f.Deleted, f.Counter, MakePairVec(f.Creation.GetSlice()), MakePairVec(f.Version.GetSlice()), MakePairVec(f.Sync.GetSlice())}\n\treturn out\n}", "func newFileWAL(filename string) (*fileWAL, error) {\n\t// Attempt to open WAL file.\n\tf, err := os.Create(filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &fileWAL{\n\t\tf: f,\n\t\tfname: filename,\n\t}, nil\n}", "func makeNewFileVersion(writer http.ResponseWriter,\n\tfileMainPath string,\n\tfilename string,\n\tversion int) error {\n\n\tdirExists, err := exists(fileMainPath)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !dirExists {\n\t\terr := os.MkdirAll(fileMainPath, 0777)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\thttp.Error(writer, \"Could not write new directory\", 500)\n\t\t\treturn err\n\t\t}\n\t}\n\n\tfileExists, _ := exists(fmt.Sprintf(\"%s/%s\", fileMainPath, filename))\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !fileExists {\n\t\tlog.Println(\"about to make new file:\")\n\t\tlog.Println(fmt.Sprintf(\"%s/%s\", fileMainPath, filename))\n\t\tf, err := os.Create(fmt.Sprintf(\"%s/%s\", fileMainPath, filename))\n\t\tif err != nil {\n\t\t\tlog.Print(err)\n\t\t\thttp.Error(writer, \"Could not create new file\", 500)\n\t\t\treturn err\n\t\t}\n\t\t_, err = f.WriteString(fmt.Sprintf(\"%d\\n\", version))\n\t\tif err != nil {\n\t\t\tlog.Print(err)\n\t\t\thttp.Error(writer, \"Could not write to file\", 500)\n\t\t\treturn err\n\t\t}\n\t\tf.Close()\n\n\t}\n\treturn nil\n}", "func addFile(w *zip.Writer, path string, name string) {\n\t// reads the data from\n\tdat, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\t// write files to the zip archive\n\tf, err := w.Create(name)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\t_, err = f.Write(dat)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n}", "func (f *File) Write(b []byte) (int, error) {\n\tf.l.Lock()\n\tdefer f.l.Unlock()\n\tif f.closed {\n\t\treturn 0, ErrClosedAlready\n\t}\n\tif f.f == nil {\n\t\to, err := os.OpenFile(f.name, os.O_RDWR|os.O_APPEND|os.O_CREATE, 0666)\n\t\tif err != nil {\n\t\t\treturn 0, fmt.Errorf(\"failed to reopen file: %s\", err)\n\t\t}\n\t\tf.f = o\n\t}\n\treturn f.f.Write(b)\n}", "func newWriter(w io.Writer) (*orc.Writer, error) {\n\tschema, err := orc.ParseSchema(entrySchema)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn orc.NewWriter(w, orc.SetSchema(schema))\n}", "func compress(src []byte, dest io.Writer, level int) {\n\tcompressor, _ := flate.NewWriter(dest, level)\n\tcompressor.Write(src)\n\tcompressor.Close()\n}", "func (f *ioFile) put() {\n\tif !f.eof {\n\t\tpanic(fmt.Errorf(\"put called not at eof: %s\", f.name))\n\t}\n\n\tif _, err := f.out.Write(f.component[:f.componentSize]); err != nil {\n\t\tpanic(fmt.Errorf(\"put I/O error: %v (%q)\", err, f.name))\n\t}\n}", "func writeFileMapOld(bs blobserver.StatReceiver, file *Builder, r io.Reader) (blob.Ref, error) {\n\tparts, size := []BytesPart{}, int64(0)\n\n\tvar buf bytes.Buffer\n\tfor {\n\t\tbuf.Reset()\n\t\tn, err := io.Copy(&buf, io.LimitReader(r, maxBlobSize))\n\t\tif err != nil {\n\t\t\treturn blob.Ref{}, err\n\t\t}\n\t\tif n == 0 {\n\t\t\tbreak\n\t\t}\n\n\t\thash := blob.NewHash()\n\t\tio.Copy(hash, bytes.NewReader(buf.Bytes()))\n\t\tbr := blob.RefFromHash(hash)\n\t\thasBlob, err := serverHasBlob(bs, br)\n\t\tif err != nil {\n\t\t\treturn blob.Ref{}, err\n\t\t}\n\t\tif !hasBlob {\n\t\t\tsb, err := bs.ReceiveBlob(br, &buf)\n\t\t\tif err != nil {\n\t\t\t\treturn blob.Ref{}, err\n\t\t\t}\n\t\t\tif want := (blob.SizedRef{br, uint32(n)}); sb != want {\n\t\t\t\treturn blob.Ref{}, fmt.Errorf(\"schema/filewriter: wrote %s, expect %s\", sb, want)\n\t\t\t}\n\t\t}\n\n\t\tsize += n\n\t\tparts = append(parts, BytesPart{\n\t\t\tBlobRef: br,\n\t\t\tSize: uint64(n),\n\t\t\tOffset: 0, // into BlobRef to read from (not of dest)\n\t\t})\n\t}\n\n\terr := file.PopulateParts(size, parts)\n\tif err != nil {\n\t\treturn blob.Ref{}, err\n\t}\n\n\tjson := file.Blob().JSON()\n\tif err != nil {\n\t\treturn blob.Ref{}, err\n\t}\n\tbr := blob.SHA1FromString(json)\n\tsb, err := bs.ReceiveBlob(br, strings.NewReader(json))\n\tif err != nil {\n\t\treturn blob.Ref{}, err\n\t}\n\tif expect := (blob.SizedRef{br, uint32(len(json))}); expect != sb {\n\t\treturn blob.Ref{}, fmt.Errorf(\"schema/filewriter: wrote %s bytes, got %s ack'd\", expect, sb)\n\t}\n\n\treturn br, nil\n}", "func (f *Fs) putCompress(in io.Reader, src fs.ObjectInfo, options []fs.OpenOption, put putFn, mimeType string, verifyCompressedObject bool) (fs.Object, *ObjectMetadata, error) {\n\t// Unwrap reader accounting\n\tin, wrap := accounting.UnWrap(in)\n\n\t// Add the metadata hasher\n\tmetaHasher := md5.New()\n\tin = io.TeeReader(in, metaHasher)\n\n\t// Compress the file\n\tvar wrappedIn io.Reader\n\tpipeReader, pipeWriter := io.Pipe()\n\tcompressionResult := make(chan blockDataAndError)\n\tgo func() {\n\t\tblockData, err := f.c.CompressFileReturningBlockData(in, pipeWriter)\n\t\tcloseErr := pipeWriter.Close()\n\t\tif closeErr != nil {\n\t\t\tfs.Errorf(nil, \"Failed to close compression pipe: %v\", err)\n\t\t\tif err == nil {\n\t\t\t\terr = closeErr\n\t\t\t}\n\t\t}\n\t\tcompressionResult <- blockDataAndError{err: err, blockData: blockData}\n\t}()\n\twrappedIn = wrap(bufio.NewReaderSize(pipeReader, bufferSize)) // Bufio required for multithreading\n\n\t// If verifyCompressedObject is on, find a hash the destination supports to compute a hash of\n\t// the compressed data.\n\tht := f.Fs.Hashes().GetOne()\n\tvar hasher *hash.MultiHasher\n\tvar err error\n\tif ht != hash.None && verifyCompressedObject {\n\t\t// unwrap the accounting again\n\t\twrappedIn, wrap = accounting.UnWrap(wrappedIn)\n\t\thasher, err = hash.NewMultiHasherTypes(hash.NewHashSet(ht))\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\t// add the hasher and re-wrap the accounting\n\t\twrappedIn = io.TeeReader(wrappedIn, hasher)\n\t\twrappedIn = wrap(wrappedIn)\n\t}\n\n\t// Transfer the data\n\t//\to, err := put(wrappedIn, f.renameObjectInfo(src, f.c.generateDataName(src.Remote(), src.Size(), true), -1), options...)\n\to, err := operations.Rcat(f.Fs, f.c.generateDataName(src.Remote(), src.Size(), true), ioutil.NopCloser(wrappedIn), src.ModTime())\n\tif err != nil {\n\t\tif o != nil {\n\t\t\tremoveErr := o.Remove()\n\t\t\tif removeErr != nil {\n\t\t\t\tfs.Errorf(o, \"Failed to remove partially transferred object: %v\", err)\n\t\t\t}\n\t\t}\n\t\treturn nil, nil, err\n\t}\n\n\t// Check whether we got an error during compression\n\tresult := <-compressionResult\n\terr = result.err\n\tif err != nil {\n\t\tif o != nil {\n\t\t\tremoveErr := o.Remove()\n\t\t\tif removeErr != nil {\n\t\t\t\tfs.Errorf(o, \"Failed to remove partially compressed object: %v\", err)\n\t\t\t}\n\t\t}\n\t\treturn nil, nil, err\n\t}\n\n\t// Generate metadata\n\tblockData := result.blockData\n\t_, _, decompressedSize := parseBlockData(blockData, f.c.BlockSize)\n\tmeta := newMetadata(decompressedSize, f.c.CompressionMode, blockData, metaHasher.Sum([]byte{}), mimeType)\n\n\t// Check the hashes of the compressed data if we were comparing them\n\tif ht != hash.None && hasher != nil {\n\t\terr := f.verifyObjectHash(o, hasher, ht)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t}\n\n\treturn o, meta, nil\n}", "func New(logger log.Logger, root string, skipSymlinks bool) *Archive {\n\treturn &Archive{logger, root, skipSymlinks}\n}", "func newFile(t *testing.T, text string) (*os.File, error) {\n\treturn newFileWithPrefix(t, \"woke-\", text)\n}", "func (l *FileWriter) rotate() error {\n\tif err := l.close(); err != nil {\n\t\treturn err\n\t}\n\tif err := l.openNew(); err != nil {\n\t\treturn err\n\t}\n\tl.mill()\n\treturn nil\n}", "func Write(filename string, contentWriter func(io.Writer) error) (err error) {\n\tdefer func() {\n\t\tif err != nil {\n\t\t\terr = fmt.Errorf(\"error writing to %s atomically: %w\", filename, err)\n\t\t}\n\t}()\n\tdir := filepath.Dir(filename)\n\tif err := os.MkdirAll(dir, defaultDirPerms); err != nil {\n\t\treturn err\n\t}\n\ttf, err := ioutil.TempFile(dir, \".mflg-atomic-write\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tname := tf.Name()\n\tif err = contentWriter(tf); err != nil {\n\t\tos.Remove(name)\n\t\ttf.Close()\n\t\treturn err\n\t}\n\t// Keep existing file's permissions, when possible. This may race with a chmod() on the file.\n\tperms := defaultPerms\n\tif info, err := os.Stat(filename); err == nil {\n\t\tperms = info.Mode()\n\t}\n\t// It's better to save a file with the default TempFile permissions than not save at all, so if this fails we just carry on.\n\ttf.Chmod(perms)\n\tif err = tf.Close(); err != nil {\n\t\tos.Remove(name)\n\t\treturn err\n\t}\n\tif err = os.Rename(name, filename); err != nil {\n\t\tos.Remove(name)\n\t\treturn err\n\t}\n\treturn nil\n}", "func (d *keyData) writeToFileAtomic(dest string) error {\n\tf, err := osutil.NewAtomicFile(dest, 0600, 0, sys.UserID(osutil.NoChown), sys.GroupID(osutil.NoChown))\n\tif err != nil {\n\t\treturn xerrors.Errorf(\"cannot create new atomic file: %w\", err)\n\t}\n\tdefer f.Cancel()\n\n\tif err := d.write(f); err != nil {\n\t\treturn xerrors.Errorf(\"cannot write to temporary file: %w\", err)\n\t}\n\n\tif err := f.Commit(); err != nil {\n\t\treturn xerrors.Errorf(\"cannot atomically replace file: %w\", err)\n\t}\n\n\treturn nil\n}", "func openWriterAndBackup(filename string) io.WriteCloser {\n\tfile, err := os.Create(temporaryName(filename))\n\tif err != nil {\n\t\tlog.Panicf(\"Failed to create temporary save file '%s': %v\", temporaryName(filename), err)\n\t}\n\treturn file\n}", "func (m *Mangler) NewFile(name string, contents []byte) error {\n\tdeflate := len(contents) != 0\n\t_, err := m.outz.NewFile(name, nil, contents, &m.newcontents, time.Now(), deflate, true)\n\treturn err\n}", "func WriterFlush(w *zip.Writer,) error", "func put(fs filesystem.FileSystem, src, dst string) {\n\ttarget, err := fs.OpenFile(dst, os.O_CREATE|os.O_RDWR)\n\tif err != nil {\n\t\tlog.Fatalf(\"fs.OpenFile(%q): %v\", dst, err)\n\t}\n\tsource, err := os.Open(src)\n\tif err != nil {\n\t\tlog.Fatalf(\"os.Open(%q): %v\", src, err)\n\t}\n\tdefer source.Close()\n\t// If this is streamed (e.g. using io.Copy) it exposes a bug in diskfs, so do it in one go.\n\tdata, err := ioutil.ReadAll(source)\n\tif err != nil {\n\t\tlog.Fatalf(\"Reading %q: %v\", src, err)\n\t}\n\tif _, err := target.Write(data); err != nil {\n\t\tfmt.Printf(\"writing file %q: %v\", dst, err)\n\t\tos.Exit(1)\n\t}\n}", "func outToTGZ(basepath, extension string, tarFile *Archive) projectResourceWriterCloserFactory {\n\treturn func(project, resource string) (io.Writer, io.Closer, error) {\n\t\tprojectPath := filepath.Join(basepath, \"projects\", project)\n\t\twriter := tarFile.GetWriterToFile(filepath.Join(projectPath, resource+\".\"+extension))\n\t\treturn writer, writer, nil\n\t}\n}", "func createZipFile(t *testing.T) []byte {\n\t// Create a buffer to write our archive to.\n\tbuf := new(bytes.Buffer)\n\n\t// Create a new zip archive.\n\tw := zip.NewWriter(buf)\n\n\t// Add some files to the archive.\n\tfor _, file := range files {\n\t\tf, err := w.Create(file.Name)\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Unexpected error %v\", err)\n\t\t}\n\t\t_, err = f.Write([]byte(file.Body))\n\t\tif err != nil {\n\t\t\tt.Errorf(\"Unexpected error %v\", err)\n\t\t}\n\t}\n\n\t// Make sure to check the error on Close.\n\terr := w.Close()\n\tif err != nil {\n\t\tt.Errorf(\"Unexpected error %v\", err)\n\t}\n\treturn buf.Bytes()\n}", "func writeToFile(metadata shared.Metadata, f *os.File) {\n\tmetadataBytes, err := yaml.Marshal(metadata)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t_, err = f.WriteAt(metadataBytes, 0)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n}", "func write(read io.ReadCloser, filename string) error {\n\tw, err := os.Create(filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer w.Close()\n\tdefer read.Close()\n\n\tif _, err := io.Copy(w, read); err != nil {\n\t\treturn fmt.Errorf(\"Error copying %v: %v\", filename, err)\n\t}\n\treturn nil\n}", "func (f FileLocation) construct() FileLocationClass { return &f }", "func Archive(rel, target string) (string, error) {\n\tfi, err := os.Lstat(rel)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tf, err := ioutil.TempFile(\"\", \"box-copy.\")\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\ttw := tar.NewWriter(f)\n\n\tif fi.IsDir() {\n\t\terr := filepath.Walk(rel, func(path string, fi 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\tlog.CopyPath(path, filepath.Join(target, path))\n\n\t\t\theader, err := tar.FileInfoHeader(fi, filepath.Join(target, path))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\theader.Linkname = filepath.Join(target, path)\n\t\t\theader.Name = filepath.Join(target, path)\n\n\t\t\tif err := tw.WriteHeader(header); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tp, err := os.Open(path)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif header.Typeflag == tar.TypeReg {\n\t\t\t\t_, err = io.Copy(tw, p)\n\t\t\t\tif err != nil && err != io.EOF {\n\t\t\t\t\tp.Close()\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tp.Close()\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t} else if !fi.IsDir() {\n\t\theader, err := tar.FileInfoHeader(fi, target)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\theader.Name = target\n\t\theader.Linkname = target\n\n\t\tif err := tw.WriteHeader(header); err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\n\t\tp, err := os.Open(rel)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\t_, err = io.Copy(tw, p)\n\t\tif err != nil && err != io.EOF {\n\t\t\tp.Close()\n\t\t\treturn \"\", err\n\t\t}\n\t\tp.Close()\n\t}\n\n\ttw.Close()\n\tf.Close()\n\n\treturn f.Name(), nil\n}", "func (ij *isolatedFile) writeJSONFile(opener openFiler) error {\n\tf, err := opener.OpenFile(ij.path, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = io.Copy(f, bytes.NewBuffer(ij.json))\n\terr2 := f.Close()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err2\n}" ]
[ "0.59275", "0.5846826", "0.5577524", "0.5502205", "0.53983545", "0.5303724", "0.5257405", "0.5239097", "0.5229019", "0.5223447", "0.52163035", "0.5165119", "0.51520085", "0.5102067", "0.5099295", "0.5070243", "0.5068347", "0.50521445", "0.5051546", "0.50308967", "0.5024991", "0.5015661", "0.501218", "0.5006509", "0.49914637", "0.49836168", "0.49637982", "0.49539807", "0.49390844", "0.49287093", "0.49280405", "0.49246725", "0.49142197", "0.49139145", "0.49110147", "0.49095997", "0.4906349", "0.4904339", "0.4888909", "0.48720357", "0.48508233", "0.48398829", "0.48326597", "0.48303875", "0.48223993", "0.48189974", "0.4815502", "0.48137522", "0.4803906", "0.48023066", "0.4798578", "0.47906524", "0.4777155", "0.47716412", "0.47541854", "0.4739128", "0.47372207", "0.4721766", "0.47090915", "0.47059688", "0.47055742", "0.4704605", "0.46976626", "0.4694072", "0.46882117", "0.46878797", "0.4683316", "0.46796668", "0.46775815", "0.46740228", "0.46740106", "0.46717522", "0.4661627", "0.46596062", "0.46510088", "0.4648785", "0.46478033", "0.4641614", "0.46386573", "0.4637497", "0.4635558", "0.4632209", "0.46306103", "0.46215054", "0.46210563", "0.46071777", "0.46033433", "0.46004698", "0.45983088", "0.4591725", "0.45893908", "0.45859998", "0.45848995", "0.45779997", "0.45715314", "0.45714277", "0.45644197", "0.4563086", "0.45590097", "0.4557469" ]
0.6304523
0
Parse parses an object file or archive from f.
func Parse(f *os.File, verbose bool) (*Archive, error) { var r objReader r.init(f) t, err := r.peek(8) if err != nil { if err == io.EOF { err = io.ErrUnexpectedEOF } return nil, err } switch { default: return nil, errNotObject case bytes.Equal(t, archiveHeader): if err := r.parseArchive(verbose); err != nil { return nil, err } case bytes.Equal(t, goobjHeader): off := r.offset o := &GoObj{} if err := r.parseObject(o, r.limit-off); err != nil { return nil, err } r.a.Entries = []Entry{{ Name: f.Name(), Type: EntryGoObj, Data: Data{off, r.limit - off}, Obj: o, }} } return r.a, nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func parseFile(t *testing.T, f string, s interface{}) {\n\tread, err := os.Open(f)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\terr = json.NewDecoder(read).Decode(&s)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\terr = read.Close()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n}", "func (p *Parser) Parse() (*ast.File, error) {\n\tf := &ast.File{}\n\tvar err, scerr error\n\tp.sc.Error = func(pos token.Pos, msg string) {\n\t\tscerr = &PosError{Pos: pos, Err: errors.New(msg)}\n\t}\n\n\tf.Node, err = p.objectList(false)\n\tif scerr != nil {\n\t\treturn nil, scerr\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tf.Comments = p.comments\n\treturn f, nil\n}", "func Parse(r io.ReaderAt) (*Info, error) {\n\tmachoFiles := []*macho.File{}\n\tmachoFatFile, err := macho.NewFatFile(r)\n\tif err != nil {\n\t\tif err != macho.ErrNotFat {\n\t\t\treturn nil, err\n\t\t}\n\t\tmachoFile, err := macho.NewFile(r)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tmachoFiles = append(machoFiles, machoFile)\n\t} else {\n\t\tfor _, arch := range machoFatFile.Arches {\n\t\t\tmachoFiles = append(machoFiles, arch.File)\n\t\t}\n\t}\n\n\tarchitectures := make([]*Architecture, len(machoFiles))\n\tfor i, machoFile := range machoFiles {\n\t\tarch, err := parse(machoFile)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tarchitectures[i] = arch\n\t}\n\treturn &Info{\n\t\tArchitectures: architectures,\n\t}, nil\n}", "func (r *objReader) parseArchive() error {\n\tfor r.offset < r.limit {\n\t\tif err := r.readFull(r.tmp[:60]); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdata := r.tmp[:60]\n\n\t\t// Each file is preceded by this text header (slice indices in first column):\n\t\t//\t 0:16\tname\n\t\t//\t16:28 date\n\t\t//\t28:34 uid\n\t\t//\t34:40 gid\n\t\t//\t40:48 mode\n\t\t//\t48:58 size\n\t\t//\t58:60 magic - `\\n\n\t\t// We only care about name, size, and magic.\n\t\t// The fields are space-padded on the right.\n\t\t// The size is in decimal.\n\t\t// The file data - size bytes - follows the header.\n\t\t// Headers are 2-byte aligned, so if size is odd, an extra padding\n\t\t// byte sits between the file data and the next header.\n\t\t// The file data that follows is padded to an even number of bytes:\n\t\t// if size is odd, an extra padding byte is inserted betw the next header.\n\t\tif len(data) < 60 {\n\t\t\treturn errTruncatedArchive\n\t\t}\n\t\tif !bytes.Equal(data[58:60], archiveMagic) {\n\t\t\treturn errCorruptArchive\n\t\t}\n\t\tname := trimSpace(data[0:16])\n\t\tsize, err := strconv.ParseInt(trimSpace(data[48:58]), 10, 64)\n\t\tif err != nil {\n\t\t\treturn errCorruptArchive\n\t\t}\n\t\tdata = data[60:]\n\t\tfsize := size + size&1\n\t\tif fsize < 0 || fsize < size {\n\t\t\treturn errCorruptArchive\n\t\t}\n\t\tswitch name {\n\t\tcase \"__.SYMDEF\", \"__.GOSYMDEF\", \"__.PKGDEF\":\n\t\t\tr.skip(size)\n\t\tdefault:\n\t\t\toldLimit := r.limit\n\t\t\tr.limit = r.offset + size\n\t\t\tif err := r.parseObject(nil); err != nil {\n\t\t\t\treturn fmt.Errorf(\"parsing archive member %q: %v\", name, err)\n\t\t\t}\n\t\t\tr.skip(r.limit - r.offset)\n\t\t\tr.limit = oldLimit\n\t\t}\n\t\tif size&1 != 0 {\n\t\t\tr.skip(1)\n\t\t}\n\t}\n\treturn nil\n}", "func (fp *FileParser) Parse(in string, sto Store) error {\n\tf, err := os.Open(in)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\tr := bufio.NewReader(f)\n\tfor {\n\t\ts, err := r.ReadString('\\n')\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t\terr = fp.parseLine(s)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif err != nil && err != io.EOF {\n\t\treturn err\n\t}\n\treturn nil\n}", "func Decode(r io.Reader) (*OBJFile, error) {\n\tlineno := 1\n\n\t// init min/max values\n\tobj := OBJFile{aabb: NewAABB()}\n\n\tscanner := bufio.NewScanner(r)\n\tfor scanner.Scan() {\n\t\ttext := spaceRegexp.ReplaceAllString(scanner.Text(), \" \")\n\n\t\tline := strings.Split(text, \" \")\n\t\tkw, vals := line[0], line[1:]\n\n\t\tswitch kw {\n\n\t\tcase \"v\":\n\t\t\terr := obj.parseVertex(kw, vals)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"error parsing vertex at line %d,\\\"%v\\\": %s\", lineno, vals, err)\n\n\t\t\t}\n\n\t\tcase \"f\":\n\t\t\terr := obj.parseFace(kw, vals)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"error parsing face at line %d,\\\"%v\\\": %s\", lineno, vals, err)\n\t\t\t}\n\n\t\tdefault:\n\t\t\t// ignore everything else\n\t\t}\n\n\t\tlineno++\n\t}\n\tif err := scanner.Err(); err != nil {\n\t\treturn nil, fmt.Errorf(\"error parsing file: %v\", err)\n\t}\n\n\treturn &obj, nil\n}", "func parseObjects(f *os.File, cfg *rest.Config) (*yamlutil.YAMLOrJSONDecoder, meta.RESTMapper, error) {\n\tdata, err := os.ReadFile(f.Name())\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tdataReader := bytes.NewReader(data)\n\tdecoder := yamlutil.NewYAMLOrJSONDecoder(dataReader, 100)\n\tmapper, err := apiutil.NewDiscoveryRESTMapper(cfg)\n\n\treturn decoder, mapper, err\n}", "func Parse(r io.ReaderAt) (*File, error) {\n\tfor _, format := range formats {\n\t\tbuf := make([]byte, len(format.magic))\n\t\tif n, err := r.ReadAt(buf, 0); err != nil {\n\t\t\tif errors.Cause(err) == io.EOF && n < len(format.magic) {\n\t\t\t\twarn.Printf(\"skip %q format (read %d of %d bytes required for magic identification)\", format.name, n, len(format.magic))\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn nil, errors.WithStack(err)\n\t\t}\n\t\tif match(format.magic, buf) {\n\t\t\treturn format.parse(r)\n\t\t}\n\t}\n\treturn nil, errors.New(\"unknown binary executable format;\\ntip: remember to register a file format (e.g. import _ \\\".../bin/pe\\\")\\n\\ttip: try loading as raw binary executable\")\n}", "func Parse(filename string, b []byte, opts ...Option) (interface{}, error) {\n\treturn newParser(filename, b, opts...).parse(g)\n}", "func Parse(filename string, b []byte, opts ...Option) (interface{}, error) {\n\treturn newParser(filename, b, opts...).parse(g)\n}", "func Parse(filename string, b []byte, opts ...Option) (interface{}, error) {\n\treturn newParser(filename, b, opts...).parse(g)\n}", "func (r *objReader) parseArchive(verbose bool) error {\n\tr.readFull(r.tmp[:8]) // consume header (already checked)\n\tfor r.offset < r.limit {\n\t\tif err := r.readFull(r.tmp[:60]); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdata := r.tmp[:60]\n\n\t\t// Each file is preceded by this text header (slice indices in first column):\n\t\t//\t 0:16\tname\n\t\t//\t16:28 date\n\t\t//\t28:34 uid\n\t\t//\t34:40 gid\n\t\t//\t40:48 mode\n\t\t//\t48:58 size\n\t\t//\t58:60 magic - `\\n\n\t\t// We only care about name, size, and magic, unless in verbose mode.\n\t\t// The fields are space-padded on the right.\n\t\t// The size is in decimal.\n\t\t// The file data - size bytes - follows the header.\n\t\t// Headers are 2-byte aligned, so if size is odd, an extra padding\n\t\t// byte sits between the file data and the next header.\n\t\t// The file data that follows is padded to an even number of bytes:\n\t\t// if size is odd, an extra padding byte is inserted betw the next header.\n\t\tif len(data) < 60 {\n\t\t\treturn errTruncatedArchive\n\t\t}\n\t\tif !bytes.Equal(data[58:60], archiveMagic) {\n\t\t\treturn errCorruptArchive\n\t\t}\n\t\tname := trimSpace(data[0:16])\n\t\tvar err error\n\t\tget := func(start, end, base, bitsize int) int64 {\n\t\t\tif err != nil {\n\t\t\t\treturn 0\n\t\t\t}\n\t\t\tvar v int64\n\t\t\tv, err = strconv.ParseInt(trimSpace(data[start:end]), base, bitsize)\n\t\t\treturn v\n\t\t}\n\t\tsize := get(48, 58, 10, 64)\n\t\tvar (\n\t\t\tmtime int64\n\t\t\tuid, gid int\n\t\t\tmode os.FileMode\n\t\t)\n\t\tif verbose {\n\t\t\tmtime = get(16, 28, 10, 64)\n\t\t\tuid = int(get(28, 34, 10, 32))\n\t\t\tgid = int(get(34, 40, 10, 32))\n\t\t\tmode = os.FileMode(get(40, 48, 8, 32))\n\t\t}\n\t\tif err != nil {\n\t\t\treturn errCorruptArchive\n\t\t}\n\t\tdata = data[60:]\n\t\tfsize := size + size&1\n\t\tif fsize < 0 || fsize < size {\n\t\t\treturn errCorruptArchive\n\t\t}\n\t\tswitch name {\n\t\tcase \"__.PKGDEF\":\n\t\t\tr.a.Entries = append(r.a.Entries, Entry{\n\t\t\t\tName: name,\n\t\t\t\tType: EntryPkgDef,\n\t\t\t\tMtime: mtime,\n\t\t\t\tUid: uid,\n\t\t\t\tGid: gid,\n\t\t\t\tMode: mode,\n\t\t\t\tData: Data{r.offset, size},\n\t\t\t})\n\t\t\tr.skip(size)\n\t\tdefault:\n\t\t\tvar typ EntryType\n\t\t\tvar o *GoObj\n\t\t\toffset := r.offset\n\t\t\tp, err := r.peek(8)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif bytes.Equal(p, goobjHeader) {\n\t\t\t\ttyp = EntryGoObj\n\t\t\t\to = &GoObj{}\n\t\t\t\tr.parseObject(o, size)\n\t\t\t} else {\n\t\t\t\ttyp = EntryNativeObj\n\t\t\t\tr.skip(size)\n\t\t\t}\n\t\t\tr.a.Entries = append(r.a.Entries, Entry{\n\t\t\t\tName: name,\n\t\t\t\tType: typ,\n\t\t\t\tMtime: mtime,\n\t\t\t\tUid: uid,\n\t\t\t\tGid: gid,\n\t\t\t\tMode: mode,\n\t\t\t\tData: Data{offset, size},\n\t\t\t\tObj: o,\n\t\t\t})\n\t\t}\n\t\tif size&1 != 0 {\n\t\t\tr.skip(1)\n\t\t}\n\t}\n\treturn nil\n}", "func parse(filename string, src interface{}) (*ast.File, error) {\n\tif *verbose {\n\t\tfmt.Println(filename)\n\t}\n\tfile, err := parser.ParseFile(fset, filename, src, parserMode) // ok to access fset concurrently\n\tif *printAST {\n\t\tast.Print(fset, file)\n\t}\n\treturn file, err\n}", "func Parse(filename string, b []byte, opts ...Option) (any, error) {\n\treturn newParser(filename, b, opts...).parse(g)\n}", "func Parse(filename string, b []byte, opts ...Option) (any, error) {\n\treturn newParser(filename, b, opts...).parse(g)\n}", "func Parse(r io.Reader) (*ast.File, error) {\n\tbuf, err := io.ReadAll(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ParseBytes(buf)\n}", "func (r *wavefrontSceneReader) parse(res *asset.Resource) error {\n\tvar lineNum int = 0\n\tvar err error\n\n\t// The main obj file may include (call) several other object files. Each\n\t// object file contains 1-based indices (when they are positive). By\n\t// tracking the current vertex/uv/normal offsets we can apply them\n\t// while parsing faces to select the correct coordinates.\n\trelVertexOffset := len(r.vertexList)\n\trelUvOffset := len(r.uvList)\n\trelNormalOffset := len(r.normalList)\n\n\tscanner := bufio.NewScanner(res)\n\tfor scanner.Scan() {\n\t\tlineNum++\n\t\tlineTokens := strings.Fields(scanner.Text())\n\t\tif len(lineTokens) == 0 || strings.HasPrefix(lineTokens[0], \"#\") {\n\t\t\tcontinue\n\t\t}\n\n\t\tswitch lineTokens[0] {\n\t\tcase \"call\", \"mtllib\":\n\t\t\tif len(lineTokens) != 2 {\n\t\t\t\treturn r.emitError(res.Path(), lineNum, `unsupported syntax for \"%s\"; expected 1 argument; got %d`, lineTokens[0], len(lineTokens)-1)\n\t\t\t}\n\n\t\t\tr.pushFrame(fmt.Sprintf(\"referenced from %s:%d [%s]\", res.Path(), lineNum, lineTokens[0]))\n\n\t\t\tincRes, err := asset.NewResource(lineTokens[1], res)\n\t\t\tif err != nil {\n\t\t\t\treturn r.emitError(res.Path(), lineNum, err.Error())\n\t\t\t}\n\t\t\tdefer incRes.Close()\n\n\t\t\tswitch lineTokens[0] {\n\t\t\tcase \"call\":\n\t\t\t\terr = r.parse(incRes)\n\t\t\tcase \"mtllib\":\n\t\t\t\terr = r.parseMaterials(incRes)\n\t\t\t}\n\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tr.popFrame()\n\t\tcase \"usemtl\":\n\t\t\tif len(lineTokens) != 2 {\n\t\t\t\treturn r.emitError(res.Path(), lineNum, `unsupported syntax for 'usemtl'; expected 1 argument; got %d`, len(lineTokens)-1)\n\t\t\t}\n\n\t\t\t// Lookup material\n\t\t\tmatName := lineTokens[1]\n\t\t\tmatIndex, exists := r.matNameToIndex[matName]\n\t\t\tif !exists {\n\t\t\t\treturn r.emitError(res.Path(), lineNum, `undefined material with name \"%s\"`, matName)\n\t\t\t}\n\n\t\t\t// Activate material\n\t\t\tr.curMaterial = r.materials[matIndex]\n\t\tcase \"v\":\n\t\t\tv, err := parseVec3(lineTokens)\n\t\t\tif err != nil {\n\t\t\t\treturn r.emitError(res.Path(), lineNum, err.Error())\n\t\t\t}\n\t\t\tr.vertexList = append(r.vertexList, v)\n\t\tcase \"vn\":\n\t\t\tv, err := parseVec3(lineTokens)\n\t\t\tif err != nil {\n\t\t\t\treturn r.emitError(res.Path(), lineNum, err.Error())\n\t\t\t}\n\t\t\tr.normalList = append(r.normalList, v)\n\t\tcase \"vt\":\n\t\t\tv, err := parseVec2(lineTokens)\n\t\t\tif err != nil {\n\t\t\t\treturn r.emitError(res.Path(), lineNum, err.Error())\n\t\t\t}\n\t\t\tr.uvList = append(r.uvList, v)\n\t\tcase \"g\", \"o\":\n\t\t\tif len(lineTokens) < 2 {\n\t\t\t\treturn r.emitError(res.Path(), lineNum, `unsupported syntax for \"%s\"; expected 1 argument for object name; got %d`, lineTokens[0], len(lineTokens)-1)\n\t\t\t}\n\n\t\t\tr.verifyLastParsedMesh()\n\t\t\tr.rawScene.Meshes = append(r.rawScene.Meshes, input.NewMesh(lineTokens[1]))\n\t\tcase \"f\":\n\t\t\tprimList, err := r.parseFace(lineTokens, relVertexOffset, relUvOffset, relNormalOffset)\n\t\t\tif err != nil {\n\t\t\t\treturn r.emitError(res.Path(), lineNum, err.Error())\n\t\t\t}\n\n\t\t\t// If no object has been defined create a default one\n\t\t\tif len(r.rawScene.Meshes) == 0 {\n\t\t\t\tr.rawScene.Meshes = append(r.rawScene.Meshes, input.NewMesh(\"default\"))\n\t\t\t}\n\n\t\t\t// Append primitive\n\t\t\tmeshIndex := len(r.rawScene.Meshes) - 1\n\t\t\tr.rawScene.Meshes[meshIndex].MarkBBoxDirty()\n\t\t\tr.rawScene.Meshes[meshIndex].Primitives = append(r.rawScene.Meshes[meshIndex].Primitives, primList...)\n\t\tcase \"camera_fov\":\n\t\t\tr.rawScene.Camera.FOV, err = parseFloat32(lineTokens)\n\t\t\tif err != nil {\n\t\t\t\treturn r.emitError(res.Path(), lineNum, err.Error())\n\t\t\t}\n\t\tcase \"camera_eye\":\n\t\t\tr.rawScene.Camera.Eye, err = parseVec3(lineTokens)\n\t\t\tif err != nil {\n\t\t\t\treturn r.emitError(res.Path(), lineNum, err.Error())\n\t\t\t}\n\t\tcase \"camera_look\":\n\t\t\tr.rawScene.Camera.Look, err = parseVec3(lineTokens)\n\t\t\tif err != nil {\n\t\t\t\treturn r.emitError(res.Path(), lineNum, err.Error())\n\t\t\t}\n\t\tcase \"camera_up\":\n\t\t\tr.rawScene.Camera.Up, err = parseVec3(lineTokens)\n\t\t\tif err != nil {\n\t\t\t\treturn r.emitError(res.Path(), lineNum, err.Error())\n\t\t\t}\n\t\tcase \"instance\":\n\t\t\tinstance, err := r.parseMeshInstance(lineTokens)\n\t\t\tif err != nil {\n\t\t\t\treturn r.emitError(res.Path(), lineNum, err.Error())\n\t\t\t}\n\t\t\tr.rawScene.MeshInstances = append(r.rawScene.MeshInstances, instance)\n\t\t}\n\t}\n\n\tr.verifyLastParsedMesh()\n\treturn nil\n}", "func ParseOBJFile(path string) (model *Model, err error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn\n\t}\n\treader := bufio.NewReader(file)\n\tmodel, err = ParseOBJ(reader)\n\treturn\n}", "func Parse(r io.ReadSeeker, pkgpath string) (*Package, error) {\n\tif pkgpath == \"\" {\n\t\tpkgpath = `\"\"`\n\t}\n\tp := new(Package)\n\tp.ImportPath = pkgpath\n\n\tvar rd objReader\n\trd.init(r, p)\n\terr := rd.readFull(rd.tmp[:8])\n\tif err != nil {\n\t\tif err == io.EOF {\n\t\t\terr = io.ErrUnexpectedEOF\n\t\t}\n\t\treturn nil, err\n\t}\n\n\tswitch {\n\tdefault:\n\t\treturn nil, errNotObject\n\n\tcase bytes.Equal(rd.tmp[:8], archiveHeader):\n\t\tif err := rd.parseArchive(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\tcase bytes.Equal(rd.tmp[:8], goobjHeader):\n\t\tif err := rd.parseObject(goobjHeader); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn p, nil\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 (s *Service) ParseFile(c context.Context, content []byte) (file *bfs.FileInfo, err error) {\n\tfType := http.DetectContentType(content)\n\t// file md5\n\tmd5hash := md5.New()\n\tif _, err = io.Copy(md5hash, bytes.NewReader(content)); err != nil {\n\t\tlog.Error(\"resource uploadFile.Copy error(%v)\", err)\n\t\treturn\n\t}\n\tmd5 := md5hash.Sum(nil)\n\tfMd5 := hex.EncodeToString(md5[:])\n\tfile = &bfs.FileInfo{\n\t\tMd5: fMd5,\n\t\tType: fType,\n\t\tSize: int64(len(content)),\n\t}\n\treturn\n}", "func Parse(fs any, args []string, options ...Option) error {\n\tswitch reified := fs.(type) {\n\tcase Flags:\n\t\treturn parseFlags(reified, args, options...)\n\tcase *flag.FlagSet:\n\t\treturn parseFlags(NewStdFlags(reified), args, options...)\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupported flag set %T\", fs)\n\t}\n}", "func (descriptor *Descriptor) Parse(file *os.File) {\n\n\tdescriptor.UnicodeString = fmtbytes.ParseUnicodeString(file)\n\n\tclassIDLength := fmtbytes.ReadBytesLong(file)\n\n\tif classIDLength == 0 {\n\t\tdescriptor.ClassID = fmtbytes.ReadBytesString(file, 4)\n\t} else {\n\t\tdescriptor.ClassID = fmtbytes.ReadBytesString(file, int(classIDLength))\n\t}\n\tdescriptor.ItemCount = fmtbytes.ReadBytesLong(file)\n\n\tvar i uint32\n\tfor i = 0; i < descriptor.ItemCount; i++ {\n\t\tdescriptor.parseDescriptorItem(file)\n\t}\n\n}", "func (r *RuleSet) Parse(file string, leakChan chan Leak) {\n\tfd, err := os.Open(file)\n\tif err != nil {\n\t\tlog.Trace().\n\t\t\tStr(\"file\", file).\n\t\t\tErr(err).\n\t\t\tMsg(\"Failed to read\")\n\t\treturn\n\t}\n\tdefer fd.Close()\n\n\t_, err = archiver.ByExtension(file)\n\tif r.Compressed && err == nil {\n\t\t// Parse archives\n\t\tr.parseArchive(fd, leakChan)\n\t} else {\n\t\tr.parseRegular(fd, file, leakChan)\n\t}\n}", "func (file *File) Parse() error {\n\t// Parse DOS header.\n\terr := file.parseDOSHeader()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Parse COFF file header.\n\terr = file.parseFileHeader()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Parse optional header.\n\tif file.fileHdr.OptHdrSize > 0 {\n\t\terr = file.parseOptHeader()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Parse section headers.\n\terr = file.parseSectHeaders()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Parse sections.\n\n\t//// Parse data directories.\n\t//for _, dataDir := range file.OptHdr.DataDirs {\n\t//\tif dataDir.Size == 0 {\n\t//\t\tcontinue\n\t//\t}\n\t//\t// TODO(u): Parse the data directories.\n\t//}\n\n\treturn nil\n}", "func (m *Model) ParseFile(data []byte, parsedData interface{}) {\n\tswitch m.FileType {\n\tcase Types.JSON:\n\t\tjson.Unmarshal(data, parsedData)\n\tcase Types.YAML:\n\t\tyaml.Unmarshal(data, parsedData)\n\t}\n}", "func (f *fileinfo) parse(filename string) {\n\tvar err error\n\tbn := filepath.Base(filename)\n\tfields := strings.Split(bn, \"-\")\n\tnSamples := strings.Split(fields[len(fields)-1], \".\")[0]\n\n\tf.rng = fields[0]\n\tif f.seed, err = strconv.ParseUint(fields[1], 10, 64); err != nil {\n\t\tpanic(err)\n\t}\n\tf.function = fields[2]\n\tif f.start, err = strconv.ParseUint(fields[3], 10, 64); err != nil {\n\t\tpanic(err)\n\t}\n\tif f.numSamples, err = strconv.ParseUint(nSamples, 10, 64); err != nil {\n\t\tpanic(err)\n\t}\n\tf.filename = filename\n}", "func Parse(r Reader) (AbcFile, error) {\n\tp := parser{r}\n\treturn p.Parse()\n}", "func (r *objReader) parseObject(prefix []byte) error {\n\t// TODO(rsc): Maybe use prefix and the initial input to\n\t// record the header line from the file, which would\n\t// give the architecture and other version information.\n\n\tr.p.MaxVersion++\n\tvar c1, c2, c3 byte\n\tfor {\n\t\tc1, c2, c3 = c2, c3, r.readByte()\n\t\tif c3 == 0 { // NUL or EOF, either is bad\n\t\t\treturn errCorruptObject\n\t\t}\n\t\tif c1 == '\\n' && c2 == '!' && c3 == '\\n' {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tr.readFull(r.tmp[:8])\n\tif !bytes.Equal(r.tmp[:8], []byte(\"\\x00\\x00go13ld\")) {\n\t\treturn r.error(errCorruptObject)\n\t}\n\n\tb := r.readByte()\n\tif b != 1 {\n\t\treturn r.error(errCorruptObject)\n\t}\n\n\t// Direct package dependencies.\n\tfor {\n\t\ts := r.readString()\n\t\tif s == \"\" {\n\t\t\tbreak\n\t\t}\n\t\tr.p.Imports = append(r.p.Imports, s)\n\t}\n\n\t// Symbols.\n\tfor {\n\t\tif b := r.readByte(); b != 0xfe {\n\t\t\tif b != 0xff {\n\t\t\t\treturn r.error(errCorruptObject)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\n\t\ttyp := r.readInt()\n\t\ts := &Sym{SymID: r.readSymID()}\n\t\tr.p.Syms = append(r.p.Syms, s)\n\t\ts.Kind = SymKind(typ)\n\t\tflags := r.readInt()\n\t\ts.DupOK = flags&1 != 0\n\t\ts.Size = r.readInt()\n\t\ts.Type = r.readSymID()\n\t\ts.Data = r.readData()\n\t\ts.Reloc = make([]Reloc, r.readInt())\n\t\tfor i := range s.Reloc {\n\t\t\trel := &s.Reloc[i]\n\t\t\trel.Offset = r.readInt()\n\t\t\trel.Size = r.readInt()\n\t\t\trel.Type = r.readInt()\n\t\t\trel.Add = r.readInt()\n\t\t\tr.readInt() // Xadd - ignored\n\t\t\trel.Sym = r.readSymID()\n\t\t\tr.readSymID() // Xsym - ignored\n\t\t}\n\n\t\tif s.Kind == STEXT {\n\t\t\tf := new(Func)\n\t\t\ts.Func = f\n\t\t\tf.Args = r.readInt()\n\t\t\tf.Frame = r.readInt()\n\t\t\tflags := r.readInt()\n\t\t\tf.Leaf = flags&1 != 0\n\t\t\tf.NoSplit = r.readInt() != 0\n\t\t\tf.Var = make([]Var, r.readInt())\n\t\t\tfor i := range f.Var {\n\t\t\t\tv := &f.Var[i]\n\t\t\t\tv.Name = r.readSymID().Name\n\t\t\t\tv.Offset = r.readInt()\n\t\t\t\tv.Kind = r.readInt()\n\t\t\t\tv.Type = r.readSymID()\n\t\t\t}\n\n\t\t\tf.PCSP = r.readData()\n\t\t\tf.PCFile = r.readData()\n\t\t\tf.PCLine = r.readData()\n\t\t\tf.PCData = make([]Data, r.readInt())\n\t\t\tfor i := range f.PCData {\n\t\t\t\tf.PCData[i] = r.readData()\n\t\t\t}\n\t\t\tf.FuncData = make([]FuncData, r.readInt())\n\t\t\tfor i := range f.FuncData {\n\t\t\t\tf.FuncData[i].Sym = r.readSymID()\n\t\t\t}\n\t\t\tfor i := range f.FuncData {\n\t\t\t\tf.FuncData[i].Offset = int64(r.readInt()) // TODO\n\t\t\t}\n\t\t\tf.File = make([]string, r.readInt())\n\t\t\tfor i := range f.File {\n\t\t\t\tf.File[i] = r.readSymID().Name\n\t\t\t}\n\t\t}\n\t}\n\n\tr.readFull(r.tmp[:7])\n\tif !bytes.Equal(r.tmp[:7], []byte(\"\\xffgo13ld\")) {\n\t\treturn r.error(errCorruptObject)\n\t}\n\n\treturn nil\n}", "func Parse(f *os.File) (Source, error) {\n\tvar s scanner.Scanner\n\tvar src Source\n\ts.Init(f)\n\tfor tok := s.Scan(); tok != scanner.EOF; tok = s.Scan() {\n\t\tswitch s.TokenText() {\n\t\tcase \"!\": // macros have completely unpredictable structure, so we need\n\t\t\t// to zip past them for sanity.\n\t\t\tcollapseMacro(&s)\n\t\tcase \"#\": // attribute\n\t\t\tattName := \"#\"\n\t\t\tfor {\n\t\t\t\tc := s.Next()\n\t\t\t\tattName += string(c)\n\t\t\t\tif c == ']' {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tswitch attName {\n\t\t\tcase \"#[cfg(test)]\":\n\t\t\t\tsrc.TestBlock = s.Pos().Line\n\t\t\tcase \"#[test]\":\n\t\t\t\tt := capTest(&s)\n\t\t\t\tsrc.Tests = append(src.Tests, t)\n\t\t\tdefault:\n\t\t\t\tcontinue\n\t\t\t}\n\t\t// Detect trait and impl first because they can encapsulate other blocks\n\t\tcase \"trait\":\n\t\t\tsrc.Traits = append(src.Traits, capTrait(&s))\n\t\tcase \"impl\":\n\t\t\tcapImpl(&src, &s)\n\t\tcase \"enum\":\n\t\t\tsrc.Enums = append(src.Enums, capEnum(&s))\n\t\tcase \"struct\":\n\t\t\tsrc.RsStructs = append(src.RsStructs, capStruct(&s))\n\t\tcase \"fn\":\n\t\t\tfn, ubs := capFn(&s)\n\t\t\tsrc.Funcs = append(src.Funcs, fn)\n\t\t\tif len(ubs) > 0 {\n\t\t\t\tsrc.UB = append(src.UB, ubs...)\n\t\t\t}\n\t\tcase \"unsafe\":\n\t\t\tsrc.UB = append(src.UB, capUB(&s))\n\t\tdefault:\n\t\t\tcontinue\n\t\t}\n\t}\n\treturn src, nil\n}", "func (d *Definition) Parse(s interface{}, sw *Doc) {\n\tif d.TypeName == \"\" {\n\t\td.TypeName = constObject\n\t}\n\n\tif d.Properties == nil {\n\t\td.Properties = make(MapProperty)\n\t}\n\n\tTypes := reflect.TypeOf(s)\n\tValues := reflect.ValueOf(s)\n\n\t// Walk through all the fields of the structure\n\tfor j := 0; j < Types.NumField(); j++ {\n\t\tvar name string\n\n\t\ttag, ok := Types.Field(j).Tag.Lookup(\"json\")\n\t\tif !ok {\n\t\t\tname = Types.Field(j).Name\n\t\t} else {\n\t\t\tname = strings.Split(tag, \",\")[0]\n\t\t}\n\n\t\t// skip hided fields\n\t\tif name == \"-\" {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Parse swagtype for overriding\n\t\tswagType, _ := Types.Field(j).Tag.Lookup(\"swagtype\")\n\n\t\t// Parse enumeration\n\t\tvar swagEnumArray []interface{}\n\t\tif swagEnum, ok := Types.Field(j).Tag.Lookup(\"swagenum\"); ok {\n\t\t\tenumArray := strings.Split(swagEnum, \",\")\n\t\t\tif len(enumArray) > 0 {\n\t\t\t\tswagEnumArray = make([]interface{}, 0, len(enumArray))\n\t\t\t\tfor _, item := range enumArray {\n\t\t\t\t\tswagEnumArray = append(swagEnumArray, item)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif Types.Field(j).Anonymous {\n\t\t\td.Parse(Values.Field(j).Interface(), sw)\n\t\t} else {\n\t\t\td.Properties[name] = parseStructField(Types.Field(j).Type, Values.Field(j), sw, swagType, swagEnumArray)\n\t\t}\n\t}\n}", "func Parse(f *os.File) (*Code, error) {\n\tlanguage, err := detectLanguage(f)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error detecting language: %v\", err)\n\t}\n\tparserMap := map[string]Parser{\n\t\tgolang: &GoParser{},\n\t}\n\treturn parserMap[language].Parse(f)\n}", "func ParseFile(filename string, src interface{}) (f interface{}, err error) {\n\tvar bsrc []byte\n\tswitch x := src.(type) {\n\tcase nil:\n\t\tif bsrc, err = ioutil.ReadFile(filename); err != nil {\n\t\t\treturn\n\t\t}\n\tcase string:\n\t\tbsrc = []byte(x)\n\tcase []byte:\n\t\tbsrc = x\n\tcase io.Reader:\n\t\tvar buf bytes.Buffer\n\t\tif _, err := io.Copy(&buf, x); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tbsrc = buf.Bytes()\n\t}\n\n\tlx := lx{\n\t\tScanner: scanner.New(bsrc),\n\t}\n\tlx.Scanner.Fname = filename\n\tif yyParse(&lx) != 0 {\n\t\terr = lx.Errors[0]\n\t}\n\treturn\n}", "func Deserialize(f io.Reader) (*Unit, error) {\n\tlexer, lexchan, errchan := NewLexer(f)\n\n\tgo lexer.Lex()\n\n\tunit := Unit{}\n\n\tfor ld := range lexchan {\n\t\tswitch ld.Type {\n\t\tcase optionKind:\n\t\t\tif ld.Option != nil {\n\t\t\t\tif len(unit.Sections) == 0 {\n\t\t\t\t\treturn nil, fmt.Errorf(\"Unit file misparse: option before section\")\n\t\t\t\t}\n\n\t\t\t\ts := len(unit.Sections) - 1\n\t\t\t\tunit.Sections[s].Options = append(unit.Sections[s].Options, ld.Option)\n\t\t\t}\n\t\tcase sectionKind:\n\t\t\tif ld.Section != nil {\n\t\t\t\tunit.Sections = append(unit.Sections, ld.Section)\n\t\t\t}\n\t\t}\n\t}\n\n\terr := <-errchan\n\n\treturn &unit, err\n}", "func (b *bundleParser) Parse(root fs.FS) (*Bundle, error) {\n\tif root == nil {\n\t\treturn nil, fmt.Errorf(\"filesystem is nil\")\n\t}\n\n\tbundle := &Bundle{}\n\tmanifests, err := fs.Sub(root, \"manifests\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error opening manifests directory: %s\", err)\n\t}\n\tif err := b.addManifests(manifests, bundle); err != nil {\n\t\treturn nil, err\n\t}\n\n\tmetadata, err := fs.Sub(root, \"metadata\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error opening metadata directory: %s\", err)\n\t}\n\tif err := b.addMetadata(metadata, bundle); err != nil {\n\t\treturn nil, err\n\t}\n\n\tderived, err := b.derivedProperties(bundle)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to derive properties: %s\", err)\n\t}\n\n\tbundle.Properties = propertySet(append(bundle.Properties, derived...))\n\n\treturn bundle, nil\n}", "func ParseFile(filename string) []interface{} {\n content, _ := ioutil.ReadFile(filename)\n return ParseText(content)\n}", "func Parser(r io.Reader) osm.Parser {\r\n\treturn &Pbf{r}\r\n}", "func Parse(r io.Reader) (*ParsedFile, error) {\n\treturn newParser(lexer.New(r)).parse()\n}", "func (g *Group) ParseFile(p string, dst string) error {\n\t// Create the file\n\tfile, err := NewFile(p)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg.files = append(g.files, file)\n\treturn nil\n}", "func FromFile(path string, x interface{}) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\tlog.Fatalf(\"[common] error opening file %s: %v\", path, err)\n\t}\n\tdefer file.Close()\n\n\t// read file as byte array\n\tbytes, _ := ioutil.ReadAll(file)\n\tif err := json.Unmarshal(bytes, x); err != nil {\n\t\tlog.Fatalf(\n\t\t\t\"[common] error unmarshaling json to output struct %T: %v (%s)\",\n\t\t\tx,\n\t\t\terr,\n\t\t\tpath,\n\t\t)\n\t}\n}", "func parseObjects(inFile io.Reader) ([]*Object, error) {\n\tvar objects []*Object\n\n\tin := bufio.NewReader(inFile)\n\tvar lineNo int\n\n\t// Discard anything prior to the license block.\n\tfor line, eof := getLine(in, &lineNo); !eof; line, eof = getLine(in, &lineNo) {\n\t\tif strings.Contains(line, \"This Source Code\") {\n\t\t\tbreak\n\t\t}\n\t}\n\t// Now collect the license block.\n\t// certdata.txt from hg.mozilla.org no longer contains CVS_ID.\n\tfor line, eof := getLine(in, &lineNo); !eof; line, eof = getLine(in, &lineNo) {\n\t\tif strings.Contains(line, \"CVS_ID\") || len(line) == 0 {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tvar currentObject *Object\n\tvar beginData bool\n\n\tfor line, eof := getLine(in, &lineNo); !eof; line, eof = getLine(in, &lineNo) {\n\t\tif len(line) == 0 || line[0] == '#' {\n\t\t\tcontinue\n\t\t}\n\n\t\tif strings.HasPrefix(line, \"CVS_ID \") {\n\t\t\tcontinue\n\t\t}\n\t\tif line == \"BEGINDATA\" {\n\t\t\tbeginData = true\n\t\t\tcontinue\n\t\t}\n\n\t\twords := strings.Fields(line)\n\t\tvar value []byte\n\t\tif len(words) == 2 && words[1] == \"MULTILINE_OCTAL\" {\n\t\t\tstartingLine := lineNo\n\t\t\tvar ok bool\n\t\t\tvalue, ok = readMultilineOctal(in, &lineNo)\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"Failed to read octal value starting at line %d\", startingLine)\n\t\t\t}\n\t\t} else if len(words) < 3 {\n\t\t\treturn nil, fmt.Errorf(\"Expected three or more values on line %d, but found %d\", lineNo, len(words))\n\t\t} else {\n\t\t\tvalue = []byte(strings.Join(words[2:], \" \"))\n\t\t}\n\n\t\tif words[0] == \"CKA_CLASS\" {\n\t\t\t// Start of a new object.\n\t\t\tif currentObject != nil {\n\t\t\t\tobjects = append(objects, currentObject)\n\t\t\t}\n\t\t\tcurrentObject = new(Object)\n\t\t\tcurrentObject.attrs = make(map[string]Attribute)\n\t\t\tcurrentObject.startingLine = lineNo\n\t\t}\n\t\tif currentObject == nil {\n\t\t\treturn nil, fmt.Errorf(\"Found attribute on line %d which appears to be outside of an object\", lineNo)\n\t\t}\n\t\tcurrentObject.attrs[words[0]] = Attribute{\n\t\t\tattrType: words[1],\n\t\t\tvalue: value,\n\t\t}\n\t}\n\n\tif !beginData {\n\t\treturn nil, fmt.Errorf(\"Read whole input and failed to find BEGINDATA\")\n\t}\n\n\tif currentObject != nil {\n\t\tobjects = append(objects, currentObject)\n\t}\n\n\treturn objects, nil\n}", "func parseFile(file string) (data *ParseData, err error) {\n\t// Open the post file\n\tinput, openError := os.Open(file)\n\tif openError != nil {\n\t\treturn nil, openError\n\t}\n\tdefer input.Close()\n\n\t// Scan all input lines\n\tinputScanner := bufio.NewScanner(input)\n\tinputScanner.Split(bufio.ScanLines)\n\n\theader, body, headerIndex := \"\", \"\", 0\n\tfor inputScanner.Scan() {\n\t\tline := inputScanner.Text()\n\t\tswitch headerIndex {\n\t\tcase 0:\n\t\t\tif line == \"---\" {\n\t\t\t\theaderIndex = 1\n\t\t\t}\n\t\tcase 1:\n\t\t\tif line == \"---\" {\n\t\t\t\theaderIndex = 2\n\t\t\t} else {\n\t\t\t\theader += line + \"\\n\"\n\t\t\t}\n\t\tcase 2:\n\t\t\tbody += line + \"\\n\"\n\t\t}\n\t}\n\n\tdata = new(ParseData)\n\tdata.SetContent(body)\n\n\t// Decode JSON header\n\tif err := yaml.Unmarshal([]byte(header), &data); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Generate slug from file name if needed\n\tif len(data.Slug) == 0 {\n\t\tdata.Slug = strings.TrimSuffix(filepath.Base(file), filepath.Ext(file))\n\t}\n\tdata.Slug = strings.ToLower(data.Slug)\n\treturn data, nil\n}", "func ParseFile(filename string, opts ...Option) (i interface{}, err error) {\n\tf, err := os.Open(filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer func() {\n\t\tif closeErr := f.Close(); closeErr != nil {\n\t\t\terr = closeErr\n\t\t}\n\t}()\n\treturn ParseReader(filename, f, opts...)\n}", "func ParseFile(filename string, opts ...Option) (i interface{}, err error) {\n\tf, err := os.Open(filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer func() {\n\t\tif closeErr := f.Close(); closeErr != nil {\n\t\t\terr = closeErr\n\t\t}\n\t}()\n\treturn ParseReader(filename, f, opts...)\n}", "func parseFile(file multipart.File) Day {\n\n\tscanner := bufio.NewScanner(file)\n\tcurline := 0\n\tday := Day{}\n\tfor scanner.Scan() {\n\t\tif curline == 0 {\n\t\t\tday.Date = scanner.Text()\n\t\t} else {\n\t\t\tvalue := stringTo32Float(scanner.Text())\n\t\t\tswitch curline {\n\t\t\tcase 1: day.ElevenAM = value\n\t\t\tcase 2: day.Noon = value\n\t\t\tcase 3: day.OnePM = value\n\t\t\tcase 4: day.TwoPM = value\n\t\t\tcase 5: day.ThreePM = value\n\t\t\tcase 6: day.FourPM = value\n\t\t\tcase 7: day.FivePM = value\n\t\t\tcase 8: day.SixPM = value\n\t\t\tcase 9: day.SevenPM = value\n\t\t\tcase 10: day.EightPM = value\n\t\t\tcase 11: day.NinePM = value\n\t\t\tcase 12: day.TenPM = value\n\t\t\tcase 13: day.ElevenPM = value\n\t\t\tcase 14: day.Total = value\n\t\t\t}\n\t\t}\n\n\t\tfmt.Println(scanner.Text())\n\t\tcurline += 1\n\t}\n\treturn day\n}", "func (r *objReader) parseObject(o *GoObj, size int64) error {\n\th := make([]byte, 0, 256)\n\tvar c1, c2, c3 byte\n\tfor {\n\t\tc1, c2, c3 = c2, c3, r.readByte()\n\t\th = append(h, c3)\n\t\t// The new export format can contain 0 bytes.\n\t\t// Don't consider them errors, only look for r.err != nil.\n\t\tif r.err != nil {\n\t\t\treturn errCorruptObject\n\t\t}\n\t\tif c1 == '\\n' && c2 == '!' && c3 == '\\n' {\n\t\t\tbreak\n\t\t}\n\t}\n\to.TextHeader = h\n\ths := strings.Fields(string(h))\n\tif len(hs) >= 4 {\n\t\to.Arch = hs[3]\n\t}\n\to.Offset = r.offset\n\to.Size = size - int64(len(h))\n\n\tp, err := r.peek(8)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !bytes.Equal(p, []byte(goobj.Magic)) {\n\t\tif bytes.HasPrefix(p, []byte(\"\\x00go1\")) && bytes.HasSuffix(p, []byte(\"ld\")) {\n\t\t\treturn r.error(ErrGoObjOtherVersion{p[1:]}) // strip the \\x00 byte\n\t\t}\n\t\treturn r.error(errCorruptObject)\n\t}\n\tr.skip(o.Size)\n\treturn nil\n}", "func (p *Parser) parse(prefix string, s *ast.StructType) {\n\t// stop recursion for nested structs\n\tif s == nil {\n\t\treturn\n\t}\n\n\tfor _, f := range s.Fields.List {\n\t\terr := &ErrSyntax{line: p.file.Line(f.Pos())}\n\n\t\tvar (\n\t\t\ttag = err.append(p.parseTag(f)).(*types.Tag)\n\t\t\tname = prefix + err.append(p.parseName(f)).(string)\n\t\t\ttypeID = err.append(p.parseType(f)).(string)\n\t\t)\n\n\t\tswitch {\n\t\tcase err.errs != nil:\n\t\t\tp.errors = append(p.errors, err)\n\t\tcase tag == nil:\n\t\t\tp.parse(name+\".\", p.parseSubType(f))\n\t\tdefault:\n\t\t\tif tag.EnvVar == \"\" {\n\t\t\t\ttag.EnvVar = strings.ToUpper(strings.ReplaceAll(name, \".\", \"_\"))\n\t\t\t}\n\n\t\t\t// because names unique (because of prefix) we can omit checks like \"Did we find already?\"\n\t\t\tp.fields[name] = &types.Field{\n\t\t\t\tName: name,\n\t\t\t\tType: typeID,\n\t\t\t\tEnvVar: tag.EnvVar,\n\t\t\t\tAction: tag.Action,\n\t\t\t}\n\t\t}\n\t}\n}", "func ParseOBJ(reader *bufio.Reader) (model *Model, err error) {\n\tmodel = new(Model)\n\tmodel.Shader = &shaders.DiffuseShader{} // TODO\n\tfor {\n\t\tline, err := reader.ReadString('\\n')\n\t\tline = strings.TrimSuffix(line, \"\\n\")\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t\tif strings.HasPrefix(line, \"v \") {\n\t\t\tparseVertex(line, model)\n\t\t}\n\t\tif strings.HasPrefix(line, \"f \") {\n\t\t\tparseFace(line, model)\n\t\t}\n\t}\n\treturn model, nil\n}", "func ParseFile(name string, conf interface{}) (fsLabel string, err error) {\n\tf := NewFile(name, \"\", \"\")\n\terr = f.Parse(conf)\n\treturn f.Label, err\n}", "func ParseFile(filename string) (interface{}, error) {\n\tvar (\n\t\tbytes []byte\n\t\terr error\n\t)\n\tif bytes, err = ioutil.ReadFile(filename); err != nil {\n\t\treturn nil, err\n\t}\n\treturn Parse(bytes)\n}", "func (p *Parser) Parse() (err error) {\n\t// for safe method usage\n\tif p == nil {\n\t\treturn errors.New(\"parser not initialized\")\n\t}\n\n\tfs := token.NewFileSet()\n\n\tp.asTree, err = parser.ParseFile(fs, p.filename, nil, 0)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"parse file error: %w\", err)\n\t}\n\n\t// because we have only one file and use start position\n\tp.file = fs.File(1)\n\n\tast.Walk(p, p.asTree) // syntax errors\n\n\tif len(p.fields) == 0 {\n\t\treturn fmt.Errorf(\"target %q not found in file %q\", p.target, p.filename)\n\t}\n\n\tp.checkConsistency() // consistence errors\n\n\tif len(p.errors) != 0 {\n\t\treturn p.errors\n\t}\n\n\treturn\n}", "func Parse(r io.Reader) (File, error) {\n\tvar msgs []Message\n\tvar scan = newScanner(r)\n\tfor scan.nextmsg() {\n\t\t// NOTE: the source code order of these fields is important.\n\t\tvar msg = Message{\n\t\t\tComment: Comment{\n\t\t\t\tTranslatorComments: scan.mul(\"# \"),\n\t\t\t\tExtractedComments: scan.mul(\"#.\"),\n\t\t\t\tReferences: scan.spc(\"#:\"),\n\t\t\t\tFlags: scan.spc(\"#,\"),\n\t\t\t\tPrevCtxt: scan.one(\"#| msgctxt\"),\n\t\t\t\tPrevId: scan.one(\"#| msgid\"),\n\t\t\t\tPrevIdPlural: scan.one(\"#| msgid_plural\"),\n\t\t\t},\n\t\t\tCtxt: scan.quo(\"msgctxt\"),\n\t\t\tId: scan.quo(\"msgid\"),\n\t\t\tIdPlural: scan.quo(\"msgid_plural\"),\n\t\t\tStr: scan.msgstr(),\n\t\t}\n\t\tmsgs = append(msgs, msg)\n\t}\n\tif scan.Err() != nil {\n\t\treturn File{}, scan.Err()\n\t}\n\n\tif len(msgs) == 0 {\n\t\treturn File{}, nil\n\t}\n\n\tvar header textproto.MIMEHeader\n\tif msgs[0].Id == \"\" && len(msgs[0].Str) == 1 {\n\t\tvar err error\n\t\theader, err = textproto.NewReader(bufio.NewReader(strings.NewReader(msgs[0].Str[0]))).\n\t\t\tReadMIMEHeader()\n\t\tif err != nil && err != io.EOF {\n\t\t\treturn File{}, err\n\t\t}\n\t\tmsgs = msgs[1:]\n\t}\n\n\tvar pluralize PluralSelector\n\tif pluralForms := header.Get(\"Plural-Forms\"); pluralForms != \"\" {\n\t\tpluralize = lookupPluralSelector(pluralForms)\n\t\tif pluralize == nil {\n\t\t\treturn File{}, fmt.Errorf(\"unrecognized plural form selector: %v\", pluralForms)\n\t\t}\n\t}\n\tif pluralize == nil {\n\t\tpluralize = PluralSelectorForLanguage(header.Get(\"Language\"))\n\t}\n\n\treturn File{header, msgs, pluralize}, nil\n}", "func Parse(src []byte) (*ast.File, error) {\n\t// normalize all line endings\n\t// since the scanner and output only work with \"\\n\" line endings, we may\n\t// end up with dangling \"\\r\" characters in the parsed data.\n\tsrc = bytes.Replace(src, []byte(\"\\r\\n\"), []byte(\"\\n\"), -1)\n\n\tp := newParser(src)\n\treturn p.Parse()\n}", "func Parse(r io.Reader, name string, mode Mode) (File, error) {\n\tp := &parser{\n\t\tbr: bufio.NewReader(r),\n\t\tfile: File{\n\t\t\tName: name,\n\t\t},\n\t\tmode: mode,\n\t\tnpos: Pos{\n\t\t\tLine: 1,\n\t\t\tColumn: 1,\n\t\t},\n\t}\n\tp.next()\n\tp.file.Stmts = p.stmts()\n\treturn p.file, p.err\n}", "func FileParse(c *gin.Context) {\n\tvar m models.PubSubMessage\n\n\ttimeNow := time.Now().In(utils.ConvertUTCtoIST())\n\n\tbody, err := ioutil.ReadAll(c.Request.Body)\n\tif err != nil {\n\t\tLogResponceEvent(\"Ede1: Reading data error: \"+err.Error(), http.StatusBadRequest, 0, timeNow)\n\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t}\n\n\tif err := json.Unmarshal(body, &m); err != nil {\n\t\tLogResponceEvent(\"Ede1: Error while UnMarshaling error:\"+err.Error(), http.StatusBadRequest, 0, timeNow)\n\t\tc.AbortWithStatus(http.StatusBadRequest)\n\t}\n\n\terr = parsers.Worker(m)\n\tif err != nil {\n\t\tc.JSON(http.StatusOK, \"\")\n\t} else {\n\t\tc.JSON(http.StatusOK, \"done\")\n\t}\n}", "func Parse(encoded string) *Meta {\n\tencoded = strings.Replace(encoded, \".json\", \"\", 1)\n\tencoded = strings.Replace(encoded, shared.PathElementSeparator, \"/\", strings.Count(encoded, shared.PathElementSeparator))\n\tresult := &Meta{\n\t\tMode: shared.StepModeTail,\n\t\tAction: shared.StepModeNop,\n\t}\n\n\tif strings.HasSuffix(encoded, shared.StepModeDispach) {\n\t\tresult.Mode = shared.StepModeDispach\n\t}\n\telements := strings.Split(encoded, \"/\")\n\tif len(elements) < 2 {\n\t\tresult.DestTable = strings.Join(elements[:len(elements)-1], shared.PathElementSeparator)\n\t\tresult.EventID = fmt.Sprintf(\"%v\", time.Now().Nanosecond()%10000)\n\t} else {\n\t\teventOffset := len(elements) - 2\n\t\teventElements := strings.Split(elements[eventOffset], \"_\")\n\t\tresult.DestTable = strings.Join(elements[:eventOffset], shared.PathElementSeparator)\n\n\t\tresult.EventID = eventElements[0]\n\t\tif len(eventElements) > 2 {\n\t\t\tresult.EventID = eventElements[0]\n\t\t\tresult.Step = toolbox.AsInt(eventElements[1])\n\t\t\tresult.Action = eventElements[2]\n\t\t}\n\t}\n\tresult.Async = strings.HasSuffix(result.Mode, shared.StepModeDispach)\n\treturn result\n}", "func main() {\n\tparse(read_file(\"test.txt\"))\n\n}", "func (objectcoff ObjectCoff) ParseObj(file string) (bi pstruct.BinaryInfo) {\n\tb, err := pe.Open(file)\n\tif err != nil {\n\t\tpanic(\"file open error\")\n\t}\n\tdefer b.Close()\n\n\t// Read the image base for load\n\tvar imageBase int\n\tswitch oh := b.OptionalHeader.(type) {\n\tcase *pe.OptionalHeader32:\n\t\timageBase = int(oh.ImageBase)\n\tcase *pe.OptionalHeader64:\n\t\timageBase = int(oh.ImageBase)\n\t}\n\n\ts := b.Sections\n\tnsct := len(s)\n\tif nsct == 0 {\n\t\tfmt.Printf(\"file %v is empty\", file)\n\t} else {\n\t\tmaxbyteslen := 0\n\t\tfor _, is := range s {\n\t\t\tbyteslen := int(is.Offset)\n\t\t\tb, err := is.Data()\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t} else {\n\t\t\t\tbyteslen += len(b)\n\t\t\t}\n\t\t\tif byteslen > maxbyteslen {\n\t\t\t\tmaxbyteslen = byteslen\n\t\t\t}\n\t\t}\n\t\tbi.Sections.Data = make([]uint8, maxbyteslen)\n\t\tbi.ProgramHeaders = make([]pstruct.ProgramHeader, 0)\n\t\toffset := 0\n\t\tmaxReach := 0\n\t\tfor _, is := range s {\n\t\t\tif imageBase != 0 || is.VirtualAddress != 0 {\n\t\t\t\t// obj files does not have virtual addresses\n\t\t\t\tbi.ProgramHeaders = append(bi.ProgramHeaders,\n\t\t\t\t\tpstruct.ProgramHeader{\n\t\t\t\t\t\tPAddr: int(is.Offset),\n\t\t\t\t\t\tVAddr: imageBase + int(is.VirtualAddress),\n\t\t\t\t\t})\n\t\t\t}\n\t\t\tbi.Sections.Name = append(bi.Sections.Name, is.Name)\n\t\t\tbi.Sections.Offset = append(bi.Sections.Offset, int(is.Offset))\n\t\t\tnoffset := int(is.Offset)\n\t\t\tif maxReach > offset {\n\t\t\t\toffset = maxReach\n\t\t\t}\n\t\t\tfor j := offset; j < noffset; j++ {\n\t\t\t\t// Fill differences with NOP (0x90)\n\t\t\t\tbi.Sections.Data[j] = 0x90\n\t\t\t}\n\t\t\toffset = noffset\n\t\t\tdata, err := is.Data()\n\t\t\tif err != nil {\n\t\t\t\tnoffset = offset\n\t\t\t} else {\n\t\t\t\tnoffset = offset + len(data)\n\t\t\t}\n\n\t\t\tif noffset > maxReach {\n\t\t\t\tmaxReach = noffset\n\t\t\t}\n\t\t\tfor j := offset; j < noffset; j++ {\n\t\t\t\tbi.Sections.Data[j] = data[j-offset]\n\t\t\t}\n\t\t\toffset = noffset\n\t\t}\n\t}\n\treturn\n}", "func main () {\n\tfName := \"test.txt\"\n\tformat := \"\\t{}: {},\\n\"\n\tsep := \",\"\n\n\tfile, err := os.Open(fName)\n\tcheck(err)\n\n\tdefer file.Close() //make sure file is closed afterwords\n\n\tpText, err := parse(file, format, sep)\n\tcheck(err)\n\n\tfileName := strings.Split(fName, \".\")\n\terr = ioutil.WriteFile(strings.Join(fileName, \"_parsed.\"), pText, 0666)\n\tcheck(err)\n\n}", "func (s *Subtitle) Parse(i io.Reader) error {\n\n}", "func ParseFile(path string) (Result, error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn Result{}, err\n\t}\n\tdefer file.Close()\n\treturn Parse(file)\n}", "func Parse(f io.Reader) (Sections, error) {\n\ttree, err := ParseAST(f)\n\tif err != nil {\n\t\treturn Sections{}, err\n\t}\n\n\tv := NewDefaultVisitor()\n\tif err = Walk(tree, v); err != nil {\n\t\treturn Sections{}, err\n\t}\n\n\treturn v.Sections, nil\n}", "func Parse(f io.Reader) (Sections, error) {\n\ttree, err := ParseAST(f)\n\tif err != nil {\n\t\treturn Sections{}, err\n\t}\n\n\tv := NewDefaultVisitor()\n\tif err = Walk(tree, v); err != nil {\n\t\treturn Sections{}, err\n\t}\n\n\treturn v.Sections, nil\n}", "func (forget *FuseForgetIn) ParseBinary(bcontent []byte) error {\n\terr := common.ParseBinary(bcontent, forget)\n\n\treturn err\n}", "func (p *parser) parseFile() *tree.File {\n\treturn &tree.File{\n\t\tInfo: p.file,\n\t\tBody: p.parseBlock(),\n\t\tEOFToken: p.tokenNext(),\n\t}\n}", "func Parse(rawFIN io.Reader) (d Document, err error) {\n\tfin := bufio.NewReader(rawFIN)\n\n\td, err = lexMetadata(fin)\n\tif err != nil {\n\t\treturn\n\t}\n\n\ttext := []DocumentElement{}\n\tfor {\n\t\tes := []DocumentElement{}\n\t\tes, err = lexParagraphOrDirective(fin)\n\n\t\tif err == io.EOF {\n\t\t\ttext = append(text, es...)\n\t\t\terr = nil\n\n\t\t\td.Parts = parseText(text)\n\t\t\treturn\n\t\t}\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\n\t\ttext = append(text, es...)\n\t}\n\n\treturn\n}", "func Parse(r io.Reader) (*ClassFile, error) {\n\tc := &ClassFile{}\n\n\tvar err error\n\n\tfor _, f := range initFuncs {\n\t\terr = f(c, r)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn c, nil\n}", "func (p *Parse) ParseFiles() (e error) {\n\tvar wg sync.WaitGroup\n\tfor _, fname := range p.Files {\n\t\twg.Add(1)\n\t\tgo func(fname string) {\n\t\t\tdefer wg.Done()\n\t\t\tfset := token.NewFileSet() // positions are relative to fset\n\n\t\t\t// Parse the file given in arguments\n\t\t\tf, err := parser.ParseFile(fset, fname, nil, parser.ParseComments)\n\t\t\tif err != nil {\n\t\t\t\te = err\n\t\t\t\treturn\n\t\t\t}\n\t\t\tbs, err := ioutil.ReadFile(fname)\n\t\t\tif err != nil {\n\t\t\t\te = err\n\t\t\t\treturn\n\t\t\t}\n\t\t\tstructMap, baseMap := p.parseTypes(f)\n\t\t\t// Parse structs\n\t\t\tstructKeys := make([]string, 0, len(structMap))\n\t\t\tfor k := range structMap {\n\t\t\t\tstructKeys = append(structKeys, k)\n\t\t\t}\n\t\t\tsort.Strings(structKeys)\n\t\t\tp.Lock()\n\t\t\tfor _, structName := range structKeys {\n\t\t\t\tp.mappings[structName] = p.parseStruct(structMap[structName], structName, bs)\n\t\t\t}\n\t\t\tp.Unlock()\n\t\t\tbaseKeys := make([]string, 0, len(baseMap))\n\t\t\tfor k := range baseMap {\n\t\t\t\tbaseKeys = append(baseKeys, k)\n\t\t\t}\n\t\t\tsort.Strings(baseKeys)\n\t\t\tp.Lock()\n\t\t\tfor _, baseName := range baseKeys {\n\t\t\t\tp.baseMappings[baseName] = field{\n\t\t\t\t\ttyp: baseMap[baseName],\n\t\t\t\t\tname: baseName,\n\t\t\t\t}\n\t\t\t}\n\t\t\tp.Unlock()\n\t\t}(fname)\n\t}\n\twg.Wait()\n\treturn nil\n}", "func ParseFile(fset *token.FileSet, filename string, src interface{}, mode Mode) (f *ast.File, err error) {\n\treturn ParseFSFile(fset, local, filename, src, mode)\n}", "func (ri *Interpreter) Parse(r io.ReadSeeker, scriptIdentifer string) (*parser.File, error) {\n\tfile := parser.NewFile(scriptIdentifer, ri.job)\n\tif err := file.Parse(r); err != nil {\n\t\treturn nil, err\n\t}\n\tif ri.job.RunOptions.Debug == ui.DebugAll {\n\t\tri.job.UI.Logf(\"***Parsing finished: %d table(s) found\\n\", file.TableCount())\n\t\tfor i, t := range file.Tables() {\n\t\t\tri.job.UI.Logf(\"****Contents of table %d\\n%v\\n\", i+1, t)\n\t\t}\n\t}\n\treturn file, nil\n}", "func (parser *PdfParser) parseObject() (PdfObject, error) {\n\tcommon.Log.Trace(\"Read direct object\")\n\tparser.skipSpaces()\n\tfor {\n\t\tbb, err := parser.reader.Peek(2)\n\t\tif err != nil {\n\t\t\t// If EOFs after 1 byte then should still try to continue parsing.\n\t\t\tif err != io.EOF || len(bb) == 0 {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tif len(bb) == 1 {\n\t\t\t\t// Add space as code below is expecting 2 bytes.\n\t\t\t\tbb = append(bb, ' ')\n\t\t\t}\n\t\t}\n\n\t\tcommon.Log.Trace(\"Peek string: %s\", string(bb))\n\t\t// Determine type.\n\t\tif bb[0] == '/' {\n\t\t\tname, err := parser.parseName()\n\t\t\tcommon.Log.Trace(\"->Name: '%s'\", name)\n\t\t\treturn &name, err\n\t\t} else if bb[0] == '(' {\n\t\t\tcommon.Log.Trace(\"->String!\")\n\t\t\tstr, err := parser.parseString()\n\t\t\treturn str, err\n\t\t} else if bb[0] == '[' {\n\t\t\tcommon.Log.Trace(\"->Array!\")\n\t\t\tarr, err := parser.parseArray()\n\t\t\treturn arr, err\n\t\t} else if (bb[0] == '<') && (bb[1] == '<') {\n\t\t\tcommon.Log.Trace(\"->Dict!\")\n\t\t\tdict, err := parser.ParseDict()\n\t\t\treturn dict, err\n\t\t} else if bb[0] == '<' {\n\t\t\tcommon.Log.Trace(\"->Hex string!\")\n\t\t\tstr, err := parser.parseHexString()\n\t\t\treturn str, err\n\t\t} else if bb[0] == '%' {\n\t\t\tparser.readComment()\n\t\t\tparser.skipSpaces()\n\t\t} else {\n\t\t\tcommon.Log.Trace(\"->Number or ref?\")\n\t\t\t// Reference or number?\n\t\t\t// Let's peek farther to find out.\n\t\t\tbb, _ = parser.reader.Peek(15)\n\t\t\tpeekStr := string(bb)\n\t\t\tcommon.Log.Trace(\"Peek str: %s\", peekStr)\n\n\t\t\tif (len(peekStr) > 3) && (peekStr[:4] == \"null\") {\n\t\t\t\tnull, err := parser.parseNull()\n\t\t\t\treturn &null, err\n\t\t\t} else if (len(peekStr) > 4) && (peekStr[:5] == \"false\") {\n\t\t\t\tb, err := parser.parseBool()\n\t\t\t\treturn &b, err\n\t\t\t} else if (len(peekStr) > 3) && (peekStr[:4] == \"true\") {\n\t\t\t\tb, err := parser.parseBool()\n\t\t\t\treturn &b, err\n\t\t\t}\n\n\t\t\t// Match reference.\n\t\t\tresult1 := reReference.FindStringSubmatch(string(peekStr))\n\t\t\tif len(result1) > 1 {\n\t\t\t\tbb, _ = parser.reader.ReadBytes('R')\n\t\t\t\tcommon.Log.Trace(\"-> !Ref: '%s'\", string(bb[:]))\n\t\t\t\tref, err := parseReference(string(bb))\n\t\t\t\tref.parser = parser\n\t\t\t\treturn &ref, err\n\t\t\t}\n\n\t\t\tresult2 := reNumeric.FindStringSubmatch(string(peekStr))\n\t\t\tif len(result2) > 1 {\n\t\t\t\t// Number object.\n\t\t\t\tcommon.Log.Trace(\"-> Number!\")\n\t\t\t\tnum, err := parser.parseNumber()\n\t\t\t\treturn num, err\n\t\t\t}\n\n\t\t\tresult2 = reExponential.FindStringSubmatch(string(peekStr))\n\t\t\tif len(result2) > 1 {\n\t\t\t\t// Number object (exponential)\n\t\t\t\tcommon.Log.Trace(\"-> Exponential Number!\")\n\t\t\t\tcommon.Log.Trace(\"% s\", result2)\n\t\t\t\tnum, err := parser.parseNumber()\n\t\t\t\treturn num, err\n\t\t\t}\n\n\t\t\tcommon.Log.Debug(\"ERROR Unknown (peek \\\"%s\\\")\", peekStr)\n\t\t\treturn nil, errors.New(\"object parsing error - unexpected pattern\")\n\t\t}\n\t}\n}", "func (s *Sphere) Parse(obj objects.ObjectConfig) (objects.Object, error) {\n\tif s == nil {\n\t\ts = &Sphere{}\n\t}\n\ts.position, s.R, s.color = obj.Position, obj.R, obj.Color\n\treturn s, nil\n}", "func ParseFile(path string) (*Spec, error) {\n\tpath, err := filepath.Abs(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tf, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer f.Close()\n\n\treturn Parse(f)\n}", "func Parse(r io.Reader) (stream *Stream, err error) {\n\t// Verify FLAC signature and parse the StreamInfo metadata block.\n\tbr := bufio.NewReader(r)\n\tstream = &Stream{r: br}\n\tisLast, err := stream.parseStreamInfo()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Parse the remaining metadata blocks.\n\tfor !isLast {\n\t\tblock, err := meta.Parse(br)\n\t\tif err != nil {\n\t\t\tif err != meta.ErrReservedType {\n\t\t\t\treturn stream, err\n\t\t\t}\n\t\t\t// Skip the body of unknown (reserved) metadata blocks, as stated by\n\t\t\t// the specification.\n\t\t\t//\n\t\t\t// ref: https://www.xiph.org/flac/format.html#format_overview\n\t\t\tif err = block.Skip(); err != nil {\n\t\t\t\treturn stream, err\n\t\t\t}\n\t\t}\n\t\tstream.Blocks = append(stream.Blocks, block)\n\t\tisLast = block.IsLast\n\t}\n\n\treturn stream, nil\n}", "func (p *Plan) Parse(obj objects.ObjectConfig) (objects.Object, error) {\n\tif p == nil {\n\t\tp = &Plan{}\n\t}\n\tp.position = obj.Position\n\tp.color = obj.Color\n\treturn p, nil\n}", "func Parse(input string) (*ast.File, error) {\n\tswitch lexMode(input) {\n\tcase lexModeHcl:\n\t\treturn hclParser.Parse([]byte(input))\n\tcase lexModeJson:\n\t\treturn jsonParser.Parse([]byte(input))\n\t}\n\n\treturn nil, fmt.Errorf(\"unknown config format\")\n}", "func (p *Parser) Parse(path string) error {\n\treturn p.parseFile(path, PosInfo{Name: path}, true)\n}", "func ParseFile(filename string, src interface{}) (f *tree.File, err error) {\n\ttext, err := readSource(filename, src)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tinfo := token.NewFile(filename)\n\tvar p parser\n\tdefer func() {\n\t\tif e := recover(); e != nil {\n\t\t\tif _, ok := e.(bailout); !ok {\n\t\t\t\tpanic(e)\n\t\t\t}\n\t\t}\n\n\t\tif f == nil {\n\t\t\tf = &tree.File{Info: info}\n\t\t}\n\n\t\terr = p.err\n\t}()\n\n\tp.init(info, text)\n\tf = p.parseFile()\n\treturn f, err\n}", "func (p *Parser) Parse() (*Entry, error) {\n\tentry := NewEntry()\n\tlineByte, err := ioutil.ReadAll(p.s.r)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tline := string(lineByte)\n\tif line[0] == '#' {\n\t\tentry.comment = line\n\t\tentry.suffix = PathSufix(None)\n\t\treturn entry, nil\n\t}\n\n\tparts := strings.Fields(line)\n\n\tif len(parts) < 2 {\n\t\tif isValidOwner(parts[0]) {\n\t\t\treturn nil, errors.New(\"Missing path for entry\")\n\t\t}\n\t\treturn nil, errors.New(\"Invalid entry\")\n\t}\n\n\tpath := parts[0]\n\n\tif path[0] == '/' {\n\t\tpath = path[1:]\n\t}\n\n\tentry.path = path\n\tentry.suffix = DetermineSuffix(entry.path)\n\n\tfor i, p := range parts[1:] {\n\t\tif p[0] == '#' {\n\t\t\tentry.comment = strings.Join(parts[i+1:], \" \")\n\t\t\treturn entry, nil\n\t\t}\n\t\tif isValidOwner(p) == false {\n\t\t\treturn nil, fmt.Errorf(\"(%s) is an invalid owner\", p)\n\t\t}\n\t\tentry.owners = append(entry.owners, p)\n\t}\n\treturn entry, nil\n}", "func (header *FuseInHeader) ParseBinary(bcontent []byte) error {\n\terr := common.ParseBinary(bcontent, header)\n\n\treturn err\n}", "func (fc *FileControl) Parse(record string) {\n\tif utf8.RuneCountInString(record) < 65 {\n\t\treturn\n\t}\n\t// Character position 1-2, Always \"99\"\n\tfc.setRecordType()\n\t// 03-08\n\tfc.CashLetterCount = fc.parseNumField(record[2:8])\n\t// 09-16\n\tfc.TotalRecordCount = fc.parseNumField(record[8:16])\n\t// 17-24\n\tfc.TotalItemCount = fc.parseNumField(record[16:24])\n\t// 25-40\n\tfc.FileTotalAmount = fc.parseNumField(record[24:40])\n\t// 41-54\n\tfc.ImmediateOriginContactName = fc.parseStringField(record[40:54])\n\t// 55-64\n\tfc.ImmediateOriginContactPhoneNumber = fc.parseStringField(record[54:64])\n\t// 65-65\n\tfc.CreditTotalIndicator = fc.parseNumField(record[64:65])\n\t// 66-80 reserved - Leave blank\n\tfc.reserved = \" \"\n}", "func ParseObject(data []byte) (*Object, error) {\n\treturn parseObject(data, false, false)\n}", "func (server *Server) parse(ctx context.Context, r *types.Reference) (*types.Package, error) {\n\tnode, err := server.api.Unixfs().Get(ctx, r.Path())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfile := files.ToFile(node)\n\topts := ld.NewJsonLdOptions(r.Resource)\n\tinput, err := ld.NewJsonLdProcessor().FromRDF(file, opts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpkg, err := server.framePackage(r.Resource, input)\n\tpkg.ID = r.ID\n\treturn pkg, err\n}", "func (pi *PorcInfo) parseTrackedFile(s *bufio.Scanner) error {\n\t// uses the word based scanner from ParseLine\n\tvar index int\n\tvar err error\n\tfor s.Scan() {\n\t\tswitch index {\n\t\tcase 0: // xy\n\t\t\terr = pi.parseXY(s.Text())\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"error parsing XY: %q: %v\", s.Text(), err)\n\t\t\t}\n\t\tdefault:\n\t\t\tcontinue\n\t\t\t// case 1: // sub\n\t\t\t// \tif s.Text() != \"N...\" {\n\t\t\t// \t\tlog.Println(\"is submodule!!!\")\n\t\t\t// \t}\n\t\t\t// case 2: // mH - octal file mode in HEAD\n\t\t\t// \tlog.Println(index, s.Text())\n\t\t\t// case 3: // mI - octal file mode in index\n\t\t\t// \tlog.Println(index, s.Text())\n\t\t\t// case 4: // mW - octal file mode in worktree\n\t\t\t// \tlog.Println(index, s.Text())\n\t\t\t// case 5: // hH - object name in HEAD\n\t\t\t// \tlog.Println(index, s.Text())\n\t\t\t// case 6: // hI - object name in index\n\t\t\t// \tlog.Println(index, s.Text())\n\t\t\t// case 7: // path\n\t\t\t// \tlog.Println(index, s.Text())\n\t\t}\n\t\tindex++\n\t}\n\treturn nil\n}", "func (r *PAFFile) ParseRecords() {\n\tr.Records = []PAFRecord{}\n\tfh := mustOpen(r.PafFile)\n\n\tlog.Noticef(\"Parse paffile `%s`\", r.PafFile)\n\treader := bufio.NewReader(fh)\n\tvar rec PAFRecord\n\n\tfor {\n\t\trow, err := reader.ReadString('\\n')\n\t\trow = strings.TrimSpace(row)\n\t\tif row == \"\" && err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\twords := strings.Split(row, \"\\t\")\n\t\tif len(words) < 12 || len(words[4]) < 1 {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Parse the first 12 columns\n\t\trec.Query = words[0]\n\t\trec.QueryLength, _ = strconv.Atoi(words[1])\n\t\trec.QueryStart, _ = strconv.Atoi(words[2])\n\t\trec.QueryEnd, _ = strconv.Atoi(words[3])\n\t\trec.RelativeStrand = words[4][0]\n\t\trec.Target = words[5]\n\t\trec.TargetLength, _ = strconv.Atoi(words[6])\n\t\trec.TargetStart, _ = strconv.Atoi(words[7])\n\t\trec.TargetEnd, _ = strconv.Atoi(words[8])\n\t\trec.NumMatches, _ = strconv.Atoi(words[9])\n\t\trec.AlignmentLength, _ = strconv.Atoi(words[10])\n\t\tmappingQuality, _ := strconv.Atoi(words[11])\n\t\trec.MappingQuality = uint8(mappingQuality)\n\t\trec.Tags = map[string]Tag{}\n\t\tvar tag Tag\n\n\t\t// Parse columns 12+\n\t\tfor i := 12; i < len(words); i++ {\n\t\t\ttokens := strings.Split(words[i], \":\")\n\t\t\tif len(tokens) < 3 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\ttagName := tokens[0]\n\t\t\tvalue := tokens[2]\n\t\t\tswitch tokens[1] {\n\t\t\tcase \"i\":\n\t\t\t\ttag, _ = strconv.Atoi(value)\n\t\t\tcase \"f\":\n\t\t\t\ttag, _ = strconv.ParseFloat(value, 32)\n\t\t\tdefault:\n\t\t\t\ttag = value\n\t\t\t}\n\t\t\trec.Tags[tagName] = tag\n\t\t}\n\n\t\tr.Records = append(r.Records, rec)\n\t}\n}", "func deserialize(gnarkObject io.ReaderFrom, fileName string) {\n\tf, err := os.Open(fileName)\n\tassertNoError(err)\n\n\t_, err = gnarkObject.ReadFrom(f)\n\tassertNoError(err)\n}", "func (p *Parser) Parse() ([]*unstructured.Unstructured, error) {\n\tvar result []*unstructured.Unstructured // nolint:prealloc\n\tfor _, s := range p.Streams {\n\t\tu, err := parseStream(s)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"cannot parse stream\")\n\t\t}\n\t\tresult = append(result, u...)\n\t}\n\tfor _, p := range p.FilePaths {\n\t\tf, err := os.Open(p)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"cannot open file in %s\", p)\n\t\t}\n\t\tu, err := parseStream(f)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"cannot parse file stream\")\n\t\t}\n\t\tresult = append(result, u...)\n\t}\n\treturn result, nil\n}", "func ParseFiles(log logr.Logger, files map[string]string) ([]*unstructured.Unstructured, error) {\n\tobjects := make([]*unstructured.Unstructured, 0)\n\tfor name, content := range files {\n\t\tif _, file := filepath.Split(name); file == \"NOTES.txt\" {\n\t\t\tcontinue\n\t\t}\n\t\tdecodedObjects, err := DecodeObjects(log, name, []byte(content))\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to decode files for %q: %w\", name, err)\n\t\t}\n\t\tobjects = append(objects, decodedObjects...)\n\t}\n\treturn objects, nil\n}", "func Parse(content []byte) (resources []*Node, err error) {\n\tobj, err := hcl.ParseBytes(content)\n\tif err != nil {\n\t\treturn resources, err\n\t}\n\n\tast.Walk(obj.Node, func(n ast.Node) (ast.Node, bool) {\n\t\tbaseItem, ok := n.(*ast.ObjectItem)\n\t\tif !ok {\n\t\t\treturn n, true\n\t\t}\n\n\t\titem := NewNode(baseItem)\n\n\t\tif itemErr := item.Validate(); itemErr != nil {\n\t\t\terr = multierror.Append(err, itemErr)\n\t\t\treturn n, false\n\t\t}\n\n\t\tresources = append(resources, item)\n\n\t\treturn n, false\n\t})\n\n\treturn resources, err\n}", "func FileParser(file string) (osm.Parser, io.Closer, error) {\r\n\tfh, err := os.Open(file)\r\n\tif err != nil {\r\n\t\treturn nil, nil, err\r\n\t}\r\n\treturn Parser(fh), fh, nil\r\n}", "func (m *Metadata) Parse() error {\n\tif _, err := m.file.Seek(-id3v1Block, io.SeekEnd); err != nil {\n\t\treturn fmt.Errorf(\"could not seek last %d bytes : %w\", id3v1Block, err)\n\t}\n\n\tdata := make([]byte, id3v1Block)\n\t_, err := io.ReadFull(m.file, data)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not read last %d bytes : %w\", id3v1Block, err)\n\t}\n\n\tm.tags[\"TIT2\"] = string(data[3:33]) //TITLE\n\tm.tags[\"TPE1\"] = string(data[33:63]) //ARTIST\n\tm.tags[\"TALB\"] = string(data[63:93]) //ALBUM\n\tm.tags[\"TYER\"] = string(data[93:97]) //YEAR\n\tm.tags[\"COMM\"] = string(data[97:127]) //COMMENTS\n\tif int(data[127]) < len(genres) {\n\t\tm.tags[\"TCON\"] = genres[int(data[127])] //GENRE\n\t}\n\n\treturn nil\n}", "func (fallocate *FuseFallocateIn) ParseBinary(bcontent []byte) error {\n\n\tlength := len(bcontent)\n\n\tif length < 32 {\n\t\treturn ErrDataLen\n\t}\n\n\terr := common.ParseBinary(bcontent, fallocate)\n\n\treturn err\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 (p *Pbf) Parse(handler osm.OSMReader) (o *osm.OSM, err error) {\r\n\t//tagsToKeep := []string{\"maxspeed\", \"highway\"}\r\n\r\n\td := osmpbf.NewDecoder(p.r)\r\n\r\n\t//err = d.Start(runtime.GOMAXPROCS(-1))\r\n\terr = d.Start(runtime.GOMAXPROCS(1))\r\n\tif err != nil {\r\n\t\treturn\r\n\t}\r\n\r\n\to = osm.NewOSM(handler)\r\n\to.Users = make(map[uint32]*user.User)\r\n\to.Timestamps = make(map[string]time.Time)\r\n\tvar v interface{}\r\n\r\n\tlowerlat := math.MaxFloat32\r\n\tlowerlon := math.MaxFloat32\r\n\tupperlat := -math.MaxFloat32\r\n\tupperlon := -math.MaxFloat32\r\n\tcounter := 0\r\n\tprevtime := time.Now()\r\n\tfor {\r\n\t\tif v, err = d.Decode(); err == io.EOF {\r\n\t\t\terr = nil\r\n\t\t\tbreak\r\n\t\t} else if err != nil {\r\n\t\t\treturn\r\n\t\t} else {\r\n\r\n\t\t\tcounter++\r\n\t\t\tif counter%1000000 == 0 {\r\n\t\t\t\tdebug.FreeOSMemory()\r\n\t\t\t\tos.Stderr.WriteString(fmt.Sprintf(\"freeosmem %5.1f s\\n\", time.Now().Sub(prevtime).Seconds()))\r\n\t\t\t\tprevtime = time.Now()\r\n\t\t\t}\r\n\r\n\t\t\tswitch v := v.(type) {\r\n\t\t\tcase *osmpbf.Node:\r\n\r\n\t\t\t\tt := tags.Tags(v.Tags)\r\n\t\t\t\t// UserInfo\r\n\r\n\t\t\t\tnewnode := &node.Node{\r\n\t\t\t\t\tId_: v.ID,\r\n\t\t\t\t\tUser_: user.New(uint32(v.Info.Uid), v.Info.User), //o.Users[uint32(v.Info.Uid)],\r\n\t\t\t\t\tPosition_: point.New(v.Lat, v.Lon),\r\n\t\t\t\t\tTimestamp_: v.Info.Timestamp, //o.Timestamps[sTimestamp],\r\n\t\t\t\t\tChangeset_: v.Info.Changeset,\r\n\t\t\t\t\tVersion_: uint16(v.Info.Version),\r\n\t\t\t\t\tVisible_: v.Info.Visible,\r\n\t\t\t\t\tTags_: &t,\r\n\t\t\t\t}\r\n\r\n\t\t\t\tlowerlat = math.Min(lowerlat, newnode.Position_.Lat)\r\n\t\t\t\tupperlat = math.Max(upperlat, newnode.Position_.Lat)\r\n\t\t\t\tlowerlon = math.Min(lowerlon, newnode.Position_.Lon)\r\n\t\t\t\tupperlon = math.Max(upperlon, newnode.Position_.Lon)\r\n\r\n\t\t\t\tif o.Handler != nil {\r\n\t\t\t\t\tif o.Handler.ReadNode(newnode) == false {\r\n\t\t\t\t\t\treturn\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\r\n\t\t\t\t\tif _, ok := o.Users[uint32(v.Info.Uid)]; !ok {\r\n\t\t\t\t\t\to.Users[uint32(v.Info.Uid)] = user.New(uint32(v.Info.Uid), v.Info.User)\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t//Timestamps\r\n\t\t\t\t\tsTimestamp := fmt.Sprintf(\"%s\", v.Info.Timestamp)\r\n\t\t\t\t\tif _, ok := o.Timestamps[sTimestamp]; !ok {\r\n\t\t\t\t\t\to.Timestamps[sTimestamp] = v.Info.Timestamp\r\n\t\t\t\t\t}\r\n\t\t\t\t\to.Nodes[v.ID] = newnode\r\n\t\t\t\t}\r\n\t\t\tcase *osmpbf.Way:\r\n\t\t\t\tt := tags.Tags(v.Tags)\r\n\t\t\t\tw := &way.Way{\r\n\t\t\t\t\tId_: v.ID,\r\n\t\t\t\t\tUser_: user.New(uint32(v.Info.Uid), v.Info.User),\r\n\t\t\t\t\tTimestamp_: v.Info.Timestamp,\r\n\t\t\t\t\tChangeset_: v.Info.Changeset,\r\n\t\t\t\t\tVersion_: uint16(v.Info.Version),\r\n\t\t\t\t\tVisible_: v.Info.Visible,\r\n\t\t\t\t\tTags_: &t,\r\n\t\t\t\t\tNodeIDs: v.NodeIDs,\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif o.Handler != nil {\r\n\t\t\t\t\tif o.Handler.ReadWay(w) == false {\r\n\t\t\t\t\t\treturn\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tvar nd []*node.Node\r\n\t\t\t\t\tfor _, id := range v.NodeIDs {\r\n\t\t\t\t\t\tn := o.Nodes[id]\r\n\t\t\t\t\t\tif n == nil {\r\n\t\t\t\t\t\t\terr = errors.New(fmt.Sprintf(\"Missing node #%d in way #%d\", id, v.ID))\r\n\t\t\t\t\t\t\to = nil\r\n\t\t\t\t\t\t\treturn\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tnd = append(nd, n)\r\n\t\t\t\t\t}\r\n\t\t\t\t\tw.Nodes_ = nd\r\n\t\t\t\t\to.Ways[v.ID] = w\r\n\t\t\t\t}\r\n\t\t\tcase *osmpbf.Relation:\r\n\t\t\t\tt := tags.Tags(v.Tags)\r\n\r\n\t\t\t\tr := &relation.Relation{\r\n\t\t\t\t\tId_: v.ID,\r\n\t\t\t\t\tUser_: user.New(uint32(v.Info.Uid), v.Info.User),\r\n\t\t\t\t\tTimestamp_: v.Info.Timestamp,\r\n\t\t\t\t\tChangeset_: v.Info.Changeset,\r\n\t\t\t\t\tVersion_: uint16(v.Info.Version),\r\n\t\t\t\t\tVisible_: v.Info.Visible,\r\n\t\t\t\t\tTags_: &t,\r\n\t\t\t\t}\r\n\t\t\t\tvar members []*relation.Member\r\n\t\t\t\tfor _, m := range v.Members {\r\n\t\t\t\t\tmember := &relation.Member{Role: m.Role, Id_: m.ID}\r\n\t\t\t\t\tswitch m.Type {\r\n\t\t\t\t\tcase osmpbf.NodeType:\r\n\t\t\t\t\t\tmember.Type_ = item.TypeNode\r\n\t\t\t\t\t\tmember.Ref = o.GetNode(m.ID)\r\n\t\t\t\t\tcase osmpbf.WayType:\r\n\t\t\t\t\t\tmember.Type_ = item.TypeWay\r\n\t\t\t\t\t\tmember.Ref = o.GetWay(m.ID)\r\n\t\t\t\t\tcase osmpbf.RelationType:\r\n\t\t\t\t\t\tmember.Type_ = item.TypeRelation\r\n\t\t\t\t\t\tmember.Ref = o.GetRelation(m.ID)\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif member.Ref == nil {\r\n\t\t\t\t\t\terr = errors.New(fmt.Sprintf(\"Missing member #%d (%s) in way #%d\", m.ID, member.Type(), v.ID))\r\n\t\t\t\t\t\to = nil\r\n\t\t\t\t\t\tpanic(\"mannekes toch, dit mag niet he!\")\r\n\t\t\t\t\t\treturn\r\n\t\t\t\t\t}\r\n\t\t\t\t\tmembers = append(members, member)\r\n\t\t\t\t}\r\n\t\t\t\tr.Members_ = members\r\n\t\t\t\tif o.Handler != nil {\r\n\t\t\t\t\tif o.Handler.ReadRelation(r) == false {\r\n\t\t\t\t\t\treturn\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\to.Relations[v.ID] = r\r\n\t\t\t\t}\r\n\r\n\t\t\tdefault:\r\n\t\t\t\tlog.Printf(\"ERROR: unknown type %T\\n\", v)\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tif o.Handler != nil {\r\n\t\tif o.Handler.ReadBounds(&bbox.BBox{\r\n\t\t\tLowerLeft: point.New(lowerlat, lowerlon),\r\n\t\t\tUpperRight: point.New(upperlat, upperlon),\r\n\t\t}) == false {\r\n\t\t\treturn\r\n\t\t}\r\n\t}\r\n\treturn\r\n}", "func (lookup *FuseLookupIn) ParseBinary(bcontent []byte) error {\n\tlength := len(bcontent)\n\n\tif length > 0 {\n\t\t// avoid '\\0'\n\t\tlookup.Name = string(bcontent[:length-1])\n\t}\n\n\treturn nil\n}", "func ParseFile(path string) (stream *Stream, err error) {\n\tf, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tstream, err = Parse(f)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tstream.c = f\n\treturn stream, err\n}", "func parseFile(path string, data []byte) []*resource {\n\tchunks := bytes.Split(data, []byte(\"\\n---\\n\"))\n\tresources := make([]*resource, 0, len(chunks))\n\tfor i, chunk := range chunks {\n\t\tchunk = bytes.TrimSpace(chunk)\n\t\tif len(chunk) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tr, err := ParseChunk(chunk)\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Error processing %s[%d]: %v\", path, i, err)\n\t\t\tcontinue\n\t\t}\n\t\tif r == nil {\n\t\t\tcontinue\n\t\t}\n\t\tresources = append(resources, &resource{BackEndResource: r, sha: sha1.Sum(chunk)})\n\t}\n\treturn resources\n}", "func ParseStream(r io.Reader) ([]runtime.Object, error) {\n\tvar current bytes.Buffer\n\treader := io.TeeReader(bufio.NewReader(r), &current)\n\n\tobjDecoder := yaml.NewDecoder(&current)\n\tobjDecoder.KnownFields(true)\n\n\ttypeDecoder := yaml.NewDecoder(reader)\n\tresult := []runtime.Object{}\n\tfor {\n\t\ttm := api.TypeMeta{}\n\t\tif err := typeDecoder.Decode(&tm); err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\n\t\tobj, err := determineObj(tm)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif err := objDecoder.Decode(obj); err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\treturn nil, errors.Wrapf(err, \"decoding %s\", tm)\n\t\t}\n\n\t\tresult = append(result, obj)\n\t}\n\treturn result, nil\n}", "func ParseFile(filename string, opts ...Option) (interface{}, error) {\n\tf, err := os.Open(filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer f.Close()\n\treturn ParseReader(filename, f, opts...)\n}", "func Parse(file string) error {\n\tonce.Do(func() {\n\t\t// Reading the flags\n\t\tdata, err := ioutil.ReadFile(file)\n\t\tif err != nil {\n\t\t\tlog.Println(\"Error in ReadFile:\", err)\n\t\t}\n\t\tif err := json.Unmarshal(data, &Cfg); err != nil {\n\t\t\tlog.Println(\"Error in Unmarshal:\", err)\n\t\t}\n\t})\n\treturn nil\n}" ]
[ "0.6592514", "0.642801", "0.61599255", "0.6001348", "0.5983683", "0.5953106", "0.59519404", "0.5934381", "0.589993", "0.589993", "0.589993", "0.5853034", "0.5766805", "0.57610464", "0.57610464", "0.57085884", "0.56536347", "0.562116", "0.55948865", "0.55861425", "0.5574172", "0.5563031", "0.55318487", "0.55305535", "0.552875", "0.54885906", "0.5483441", "0.5479122", "0.54606736", "0.5457428", "0.5443788", "0.5422997", "0.5418619", "0.5418454", "0.53928137", "0.5364961", "0.5357419", "0.5350371", "0.53438634", "0.5336657", "0.5334558", "0.533182", "0.5328251", "0.5328251", "0.53275955", "0.5327124", "0.5322065", "0.5307192", "0.52908784", "0.5256955", "0.5249113", "0.52461636", "0.52453375", "0.5232765", "0.5219563", "0.5215061", "0.52140707", "0.5204389", "0.51910585", "0.51808393", "0.5180685", "0.5178827", "0.5178827", "0.5176989", "0.51599425", "0.5158439", "0.5156419", "0.51555824", "0.51548964", "0.5145401", "0.51335776", "0.51324403", "0.5128", "0.5126168", "0.51139104", "0.51108336", "0.51069576", "0.50898975", "0.5082072", "0.507934", "0.5074991", "0.5073551", "0.50717676", "0.5069116", "0.50683415", "0.50677085", "0.50602734", "0.5059382", "0.505478", "0.5043443", "0.50369", "0.5036634", "0.5030385", "0.50298536", "0.50294", "0.5023132", "0.502265", "0.50222087", "0.5021341", "0.501745" ]
0.7769743
0
trimSpace removes trailing spaces from b and returns the corresponding string. This effectively parses the form used in archive headers.
func trimSpace(b []byte) string { return string(bytes.TrimRight(b, " ")) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func trim(s []byte) []byte {\n\ti := 0\n\tfor i < len(s) && (s[i] == ' ' || s[i] == '\\t') {\n\t\ti++\n\t}\n\tn := len(s)\n\tfor n > i && (s[n-1] == ' ' || s[n-1] == '\\t') {\n\t\tn--\n\t}\n\treturn s[i:n]\n}", "func trim(s []byte) []byte {\n\ti := 0\n\tfor i < len(s) && (s[i] == ' ' || s[i] == '\\t') {\n\t\ti++\n\t}\n\tn := len(s)\n\tfor n > i && (s[n-1] == ' ' || s[n-1] == '\\t') {\n\t\tn--\n\t}\n\treturn s[i:n]\n}", "func TrimLeadingSpaces(p []byte) []byte {\n\tfor i := 0; i < len(p); i++ {\n\t\tif p[i] != 0x20 && p[i] != '\\t' {\n\t\t\treturn p[i:]\n\t\t}\n\t}\n\t// it was all spaces\n\treturn p[:0]\n}", "func TrimTrailingSpaces(p []byte) []byte {\n\tfor i := len(p) - 1; i >= 0; i-- {\n\t\tif p[i] != 0x20 && p[i] != '\\n' && p[i] != '\\t' {\n\t\t\treturn p[:i+1]\n\t\t}\n\t}\n\t// it was all spaces\n\treturn p[:0]\n}", "func trimTrailingWhiteSpace(s []byte) []byte {\n\tfor (len(s) > 0) && ((s[len(s)-1] == ' ') || (s[len(s)-1] == '\\t')) {\n\t\ts = s[:len(s)-1]\n\t}\n\treturn s\n}", "func TrimSpace(operand string) string { return strings.TrimSpace(operand) }", "func trimLeadingWhiteSpace(s []byte) []byte {\n\tfor (len(s) > 0) && ((s[0] == ' ') || (s[0] == '\\t')) {\n\t\ts = s[1:]\n\t}\n\treturn s\n}", "func TrimSpace(ctx context.Context, t *mold.Transformer, v reflect.Value) error {\n\tv.Set(reflect.ValueOf(strings.TrimSpace(v.String())))\n\treturn nil\n}", "func trimTrailingWhitespace(details string) string {\n\treturn strings.TrimSuffix(details, \" \")\n}", "func (a Topic) TrimSpace() Topic {\n\treturn Topic(strings.TrimSpace(string(a)))\n}", "func trimLeadingWhiteSpace(buf string) string {\n\treturn strings.TrimLeft(buf, \" \")\n}", "func trim(s string) string {\n\tfor len(s) > 0 {\n\t\tif s[0] <= ' ' {\n\t\t\ts = s[1:]\n\t\t\tcontinue\n\t\t}\n\t\tbreak\n\t}\n\tfor len(s) > 0 {\n\t\tif s[len(s)-1] <= ' ' {\n\t\t\ts = s[:len(s)-1]\n\t\t\tcontinue\n\t\t}\n\t\tbreak\n\t}\n\treturn s\n}", "func trimWhitespaces(value string) string {\n\treturn strings.Trim(value, \"\")\n}", "func stripTrailingSpace(str string) string {\n\tbuf := bytes.NewBuffer(nil)\n\n\tscan := bufio.NewScanner(strings.NewReader(str))\n\tfor scan.Scan() {\n\t\tbuf.WriteString(strings.TrimRight(scan.Text(), \" \\t\\r\\n\"))\n\t\tbuf.WriteString(\"\\n\")\n\t}\n\treturn buf.String()\n}", "func ensureHeaderBoundary(b []byte) []byte {\n\tslice := bytes.SplitAfter(b, []byte{'\\r', '\\n'})\n\tdest := make([]byte, 0, len(b)+2)\n\theaders := true\n\tfor _, v := range slice {\n\t\tif headers && (bytes.Contains(v, []byte{':'}) || bytes.HasPrefix(v, []byte{' '}) || bytes.HasPrefix(v, []byte{'\\t'})) {\n\t\t\tdest = append(dest, v...)\n\t\t\tcontinue\n\t\t}\n\t\tif headers {\n\t\t\theaders = false\n\t\t\tif !bytes.Equal(v, []byte{'\\r', '\\n'}) {\n\t\t\t\tdest = append(dest, append([]byte{'\\r', '\\n'}, v...)...)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tdest = append(dest, v...)\n\t}\n\n\treturn dest\n}", "func trim(name string) string {\n\treturn strings.TrimPrefix(name, Prefix)\n}", "func (a ReplyTo) TrimSpace() ReplyTo {\n\treturn ReplyTo(strings.TrimSpace(string(a)))\n}", "func trim(strn string) string {\n\treturn strings.Trim(strn, \" \\t\\n\\r\")\n}", "func removeExtraSpaces(val string) string {\n\treturn strings.Join(strings.Fields(val), \" \")\n}", "func StripHeader(b []byte) []byte {\n\tif !bytes.HasPrefix(b, frontMatterDash) {\n\t\treturn b\n\t}\n\tb = b[len(frontMatterDash):]\n\tend := bytes.Index(b, frontMatterDash)\n\tif end == -1 {\n\t\treturn b\n\t}\n\treturn b[end+len(frontMatterDash):]\n}", "func trimEOL(b []byte) []byte {\n lns := len(b)\n if lns > 0 && b[lns-1] == '\\n' {\n lns--\n if lns > 0 && b[lns-1] == '\\r' {\n lns--\n }\n }\n return b[:lns]\n}", "func TrimLineSpaces(str string) string {\n\treturn TrimLineSpaces2(str, \"\")\n}", "func filterTrim(ctx stick.Context, val stick.Value, args ...stick.Value) stick.Value {\n\treturn strings.TrimSpace(stick.CoerceString(val))\n}", "func trimmed(bs []byte) []byte {\n\tfor i, b := range bs {\n\t\tif b == 0x00 {\n\t\t\treturn bs[:i]\n\t\t}\n\t}\n\treturn bs\n}", "func (e EmbeddedString) Trim() string {\n\ts := string(e)\n\tif strings.HasPrefix(s, \"// Copyright \") {\n\t\tif i := strings.Index(s, \"\\n\\n\"); i >= 0 {\n\t\t\ts = s[i+2:]\n\t\t}\n\t}\n\treturn s\n}", "func TrimExtraSpaces(s string) string {\n\tspace := regexp.MustCompile(`\\s+`)\n\ts = space.ReplaceAllString(s, \" \")\n\ts = strings.TrimPrefix(s, \" \")\n\ts = strings.TrimSuffix(s, \" \")\n\treturn s\n}", "func (c *Config) TrimSpace() {\n\tc.Cloud = strings.TrimSpace(c.Cloud)\n\tc.TenantID = strings.TrimSpace(c.TenantID)\n\tc.SubscriptionID = strings.TrimSpace(c.SubscriptionID)\n\tc.ResourceGroup = strings.TrimSpace(c.ResourceGroup)\n\tc.VMType = strings.TrimSpace(c.VMType)\n\tc.AADClientID = strings.TrimSpace(c.AADClientID)\n\tc.AADClientSecret = strings.TrimSpace(c.AADClientSecret)\n\tc.AADClientCertPath = strings.TrimSpace(c.AADClientCertPath)\n\tc.AADClientCertPassword = strings.TrimSpace(c.AADClientCertPassword)\n\tc.Deployment = strings.TrimSpace(c.Deployment)\n\tc.ClusterName = strings.TrimSpace(c.ClusterName)\n\tc.NodeResourceGroup = strings.TrimSpace(c.NodeResourceGroup)\n}", "func TrimTrailingSpaces(text string) string {\n\tparts := strings.Split(text, \"\\n\")\n\tfor i := range parts {\n\t\tparts[i] = strings.TrimRightFunc(parts[i], func(r rune) bool {\n\t\t\treturn unicode.IsSpace(r)\n\t\t})\n\n\t}\n\n\treturn strings.Join(parts, \"\\n\")\n}", "func trimLeadingWhiteSpaceAndNewLines(s []byte) []byte {\n\tfor (len(s) > 0) && ((s[0] == ' ') || (s[0] == '\\t') || (s[0] == '\\n')) {\n\t\ts = s[1:]\n\t}\n\treturn s\n}", "func Trim(text string) string {\n\treturn trimRx.FindStringSubmatch(text)[1]\n}", "func (s *Stringish) TrimPrefixSpaces() *Stringish {\n\treturn s.TrimPrefix(\" \")\n}", "func (s *Str) TrimSpaces() *Str {\n\ts.val = strings.TrimSpace(s.val)\n\treturn s\n}", "func trimAdjacentSpaces(bs []byte) []byte {\n\tout := bs[:0] // A new output slice based upon the original.\n\trunes := bytes.Runes(bs) // Turning the byte slice into runes guarantees things will work with any characters (e.g. emojis).\n\tindex := 0 // Keep a running index so we know exactly how many characters we've inserted.\n\n\tfor _, char := range runes {\n\t\tif unicode.IsSpace(char) {\n\t\t\tif index > 0 && unicode.IsSpace(runes[index-1]) {\n\t\t\t\t// We're in multiple spaces here, so we don't need to append anything.\n\t\t\t\tcontinue\n\t\t\t} else {\n\t\t\t\tout = append(out, ' ') // Append a single space to the output instead of multiple.\n\t\t\t\tindex++\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\t// Here we turn the rune into a string, and then the string into a byte slice so we can append it to the output.\n\t\tfor _, b := range []byte(string(char)) {\n\t\t\tout = append(out, b)\n\t\t\tindex++\n\t\t}\n\t}\n\n\treturn out[:index]\n}", "func (t *StringDataType) TrimSpace() *StringDataType {\n\treturn t.Formatter(func(s string) string {\n\t\treturn strings.TrimSpace(s)\n\t})\n}", "func TrimSpaceNewline(str string) string {\n\tstr = strings.TrimSpace(str)\n\treturn strings.Trim(str, \"\\r\\n\")\n}", "func (s *Stringish) TrimSpaces() *Stringish {\n\ts.str = strings.TrimSpace(s.str)\n\treturn s\n}", "func Trim(chars string, operand string) string { return strings.Trim(operand, chars) }", "func (p *Parser) Trim(input string) string {\n\tt := strings.Replace(strings.Replace(input, \"<output>\", \"\", -1), \"</output>\", \"\", -1)\n\tt1 := strings.Replace(strings.Replace(t, \"<configuration-information>\", \"\", -1), \"</configuration-information>\", \"\", -1)\n\treturn strings.Replace(strings.Replace(t1, \"<configuration-output>\", \"\", -1), \"</configuration-output>\", \"\", -1)\n}", "func SquashSpaces(bb []byte) []byte {\n\ti := 0\n\tfor i < len(bb) {\n\t\tif unicode.IsSpace(rune(bb[i])) && (i != len(bb)-1) {\n\t\t\tif unicode.IsSpace(rune(bb[i+1])) {\n\t\t\t\tcopy(bb[i:], bb[i+1:])\n\t\t\t\tbb = bb[:len(bb)-1]\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\ti++\n\t}\n\treturn bb\n}", "func removeExtraSpaces(s string) string {\n\tnewString := \"\"\n\tvar prev byte\n\tfor i, v := range s {\n\t\tif v == ' ' && prev == ' ' {\n\t\t\tprev = s[i]\n\t\t\tcontinue\n\t\t}\n\t\tprev = s[i]\n\t\tif v == '\\t' {\n\t\t\tcontinue\n\t\t}\n\t\t// If the value is \\n then we need to add \\n> to keep the formatting\n\t\t// of the spark message the same.\n\t\tif v == '\\n' {\n\t\t\tnewString += \"\\n> \"\n\t\t}\n\t\tnewString += string(v)\n\t}\n\tif len(newString) > 1000 {\n\t\tsubstring := newString[:999]\n\t\tsubstring += \"...\"\n\t\treturn substring\n\t}\n\treturn newString\n}", "func TrimAllSpaceAndNewline(input string) string {\n\toutput := input\n\tfor _, f := range []string{\"\\n\", \"\\t\", \" \"} {\n\t\toutput = strings.Replace(output, f, \"\", -1)\n\t}\n\n\treturn output\n}", "func removeSpaces(val string) string {\n\treturn strings.Join(strings.Fields(val), \"_\")\n}", "func execTrimBytes(_ int, p *gop.Context) {\n\targs := p.GetArgs(1)\n\tret := textproto.TrimBytes(args[0].([]byte))\n\tp.Ret(1, ret)\n}", "func signV4TrimAll(input string) string {\n\t// Compress adjacent spaces (a space is determined by\n\t// unicode.IsSpace() internally here) to one space and return\n\treturn strings.Join(strings.Fields(input), \" \")\n}", "func (s *Stringish) TrimSuffixSpaces() *Stringish {\n\treturn s.TrimSuffix(\" \")\n}", "func trimS(s string) string {\r\n\treturn strings.TrimSpace(s)\r\n}", "func b2s(b []byte) string {\n\treturn strings.TrimSpace(string(b))\n}", "func trim(s string, n int) string {\n\tif len(s) > n {\n\t\treturn s[:n]\n\t}\n\treturn s\n}", "func trim(s string, n int) string {\n\tif len(s) > n {\n\t\treturn s[:n]\n\t}\n\treturn s\n}", "func (t *Text) TrimSpace() *Text {\n\tleft := 0\n\toutput := strings.TrimLeftFunc(t.output, func(r rune) bool {\n\t\tif unicode.IsSpace(r) {\n\t\t\tleft++\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t})\n\n\toutput = strings.TrimRightFunc(output, unicode.IsSpace)\n\tt.lines[t.textLines] = output\n\treturn t\n}", "func stripBearer(tok string) (string, error) {\n\tif len(tok) > 6 && strings.ToLower(tok[0:7]) == \"bearer \" {\n\t\treturn tok[7:], nil\n\t}\n\treturn tok, nil\n}", "func execTrimString(_ int, p *gop.Context) {\n\targs := p.GetArgs(1)\n\tret := textproto.TrimString(args[0].(string))\n\tp.Ret(1, ret)\n}", "func skipSpace(s string) (rest string) {\r\n\ti := 0\r\n\tfor ; i < len(s); i++ {\r\n\t\tif b := s[i]; b != ' ' && b != '\\t' {\r\n\t\t\tbreak\r\n\t\t}\r\n\t}\r\n\treturn s[i:]\r\n}", "func Trim(str string) string {\n\treturn strings.Trim(str, \" \")\n}", "func RemoveSpaces(in []byte) (out []byte) {\n\tvar c byte\n\tout = make([]byte, 0, len(in))\n\tfor _, c = range in {\n\t\tif ascii.IsSpace(c) {\n\t\t\tcontinue\n\t\t}\n\t\tout = append(out, c)\n\t}\n\treturn out\n}", "func trimDot(s string) string {\n\treturn strings.Trim(s, \".\")\n}", "func (b *Bar) TrimLeftSpace() *Bar {\n\tif isClosed(b.done) {\n\t\treturn b\n\t}\n\tb.trimLeftCh <- true\n\treturn b\n}", "func stripWhiteSpace(str string) string {\n\treturn strings.ReplaceAll(str, \" \", \"\")\n}", "func Trim(str string) string {\n\treturn strings.TrimSpace(str)\n}", "func (l Line) StringTrimmed() string {\n\ttrimmedString := l.BytesTrimmed()\n\treturn *(*string)(unsafe.Pointer(&trimmedString))\n}", "func TrimPrefix(prefix, operand string) string { return strings.TrimPrefix(operand, prefix) }", "func removeWhiteSpace(input string) string {\n\tif runtime.GOOS == \"windows\" {\n\t\tinput = strings.TrimRight(input, \"\\r\\n\")\n\t} else {\n\t\tinput = strings.TrimRight(input, \"\\n\")\n\t}\n\treturn input\n}", "func ToTrimmedString(in interface{}) string {\n\tif str, ok := in.(string); ok {\n\t\treturn strings.TrimSpace(str)\n\t}\n\treturn \"\"\n}", "func TrimSpaceAndQuotes(answer string) string {\n\ttext := strings.TrimSpace(answer)\n\tfor _, q := range quotes {\n\t\tif strings.HasPrefix(text, q) && strings.HasSuffix(text, q) {\n\t\t\treturn strings.TrimPrefix(strings.TrimSuffix(text, q), q)\n\t\t}\n\t}\n\treturn text\n}", "func SpaceFilter(input string) string {\n\treturn strings.TrimSpace(input)\n}", "func trimRight(s string) string {\n\treturn strings.TrimRightFunc(s, unicode.IsSpace)\n}", "func (g *GraphiteProvider) trimQuery(query string) string {\n\tspace := regexp.MustCompile(`\\s+`)\n\treturn space.ReplaceAllString(query, \" \")\n}", "func splitTrim(s string, sep string) []string {\n\tsplitItems := strings.Split(s, sep)\n\ttrimItems := make([]string, 0, len(splitItems))\n\tfor _, item := range splitItems {\n\t\tif item = strings.TrimSpace(item); item != \"\" {\n\t\t\ttrimItems = append(trimItems, item)\n\t\t}\n\t}\n\treturn trimItems\n}", "func StrTrim(s string) string {\n\treturn strings.TrimSpace(s)\n}", "func TestTrim(t *testing.T) {\n\ttext := \"Hola Mundo TDA\"\n\tt.Logf(\"text:[%s]\", text)\n\tt.Logf(\"trim:[%s]\", utl.Trim(text))\n}", "func TrimDate(d string) string {\r\n\tif len(d) >= 10 {\r\n\t\treturn d[:10]\r\n\t}\r\n\treturn d\r\n}", "func removeSpaces(s string) string {\n\tvar ss = regSpaces.ReplaceAllString(s, \" \")\n\treturn strings.Trim(ss, \" \")\n}", "func TrimSuffix(suffix, operand string) string { return strings.TrimSuffix(operand, suffix) }", "func TrimAll(s string) string {\n\treturn strings.Join(strings.Fields(s), \" \")\n}", "func TrimRedundantSpaces(text string) string {\n\ttext = spaceRegex.ReplaceAllString(text, \" \")\n\treturn strings.TrimSpace(text)\n}", "func trimIncompleteRune(b []byte) []byte {\n\ti := len(b) - utf8.UTFMax\n\tif i < 0 {\n\t\ti = 0\n\t}\n\tlastStart := len(b)\n\tfor ; i < len(b); i++ {\n\t\tif r, n := utf8.DecodeRune(b[i:]); r != utf8.RuneError || n > 1 {\n\t\t\tlastStart = len(b)\n\t\t\tcontinue\n\t\t}\n\t\tif utf8.RuneStart(b[i]) {\n\t\t\tlastStart = i\n\t\t}\n\t}\n\treturn b[0:lastStart]\n}", "func Parse(b []byte) ([]byte, []byte) {\n\tif len(b) == 0 { // that's not java - it's safe for nil\n\t\treturn nil, nil\n\t}\n\tif i := bytes.Index(b, crlfcrlf); i >= 0 {\n\t\tif i == 0 {\n\t\t\t//if start from crlfcrlf - read crlfcrlf\n\t\t\treturn b[i+len(crlfcrlf):], nil\n\t\t}\n\n\t\theaders := bytes.Split(b[:i+len(crlfcrlf)], crlf)\n\t\tcntlen := 0\n\t\tfor _, header := range headers {\n\t\t\t//fmt.Printf(\"header:%+v\\n\", string(header))\n\t\t\tif bytes.HasPrefix(header, contentlen) {\n\t\t\t\tfields := bytes.Split(header, space)\n\t\t\t\tlen, err := strconv.Atoi(string(fields[len(fields)-1]))\n\t\t\t\tif err == nil && len > 0 {\n\t\t\t\t\tcntlen = len\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t//println(\"l1\", len(b), \"l2\", (i + len(crlfcrlf) + cntlen))\n\t\t//fmt.Printf(\"%+v''\\n\", (string(b[i+len(crlfcrlf):])))\n\t\tif len(b) < (i + len(crlfcrlf) + cntlen) {\n\t\t\treturn b, nil\n\t\t}\n\t\treturn b[(i + len(crlfcrlf) + cntlen):], b[:(i + len(crlfcrlf) + cntlen)]\n\n\t}\n\treturn b, nil\n}", "func RemoveMiddleSpaces(s string) string {\n\treturn strings.Join(Tokenize(s), \" \")\n}", "func removeWhitespaces(value string) string {\n\treturn strings.ReplaceAll(value, \" \", \"\")\n}", "func TrimSP(name string) (string, string, string) {\n\tif strings.HasSuffix(name, bbs) {\n\t\ts := strings.TrimSuffix(name, bbs)\n\t\ts = strings.ReplaceAll(s, \" \", \"\")\n\t\ts = Format(s)\n\t\tx, y, z := s+bbs, s+\"s\"+bbs, s+\"z\"+bbs\n\t\treturn x, y, z\n\t}\n\tif strings.HasSuffix(name, ftp) {\n\t\ts := strings.TrimSuffix(name, ftp)\n\t\ts = strings.ReplaceAll(s, \" \", \"\")\n\t\ts = Format(s)\n\t\tx, y, z := s+ftp, s+\"s\"+ftp, s+\"z\"+ftp\n\t\treturn x, y, z\n\t}\n\ts := strings.ReplaceAll(name, \" \", \"\")\n\ts = Format(s)\n\tx, y, z := s, s+\"s\", s+\"z\"\n\treturn x, y, z\n}", "func stripSpaces(str string) string {\n\treturn strings.Map(func(r rune) rune {\n\t\tif unicode.IsSpace(r) {\n\t\t\treturn -1\n\t\t}\n\t\treturn r\n\t}, str)\n}", "func trimQuotes(buf string) string {\n\tbuflen := len(buf)\n\tif buflen == 0 {\n\t\treturn buf\n\t}\n\tif buf[0:1] == \"\\\"\" && buf[buflen-1:buflen] == \"\\\"\" {\n\t\treturn buf[1 : buflen-1]\n\t}\n\treturn buf\n}", "func (t *Tree)trimTree(a,b int){\n\tt.root = trimTree(t.root,a,b)\n}", "func trimBuffer(buf *bytes.Buffer) error {\n\ttemp := new(bytes.Buffer)\n\t_, err := temp.ReadFrom(buf)\n\tif err != nil {\n\t\treturn err\n\t}\n\tbuf.Reset()\n\t_, err = buf.ReadFrom(temp)\n\treturn err\n}", "func (b *Bar) TrimRightSpace() *Bar {\n\tif isClosed(b.done) {\n\t\treturn b\n\t}\n\tb.trimRightCh <- true\n\treturn b\n}", "func stripNewLineEnding(b []byte) []byte {\n\tif len(b) == 0 {\n\t\treturn b\n\t}\n\n\tif b[len(b)-1] == '\\n' {\n\t\tb = b[:len(b)-1]\n\t}\n\n\treturn b\n}", "func trimChar(s string, r byte) string {\n\tsz := len(s)\n\n\tif sz > 0 && s[sz-1] == r {\n\t\ts = s[:sz-1]\n\t}\n\tsz = len(s)\n\tif sz > 0 && s[0] == r {\n\t\ts = s[1:sz]\n\t}\n\treturn s\n}", "func trimChar(s string, r byte) string {\n\tsz := len(s)\n\n\tif sz > 0 && s[sz-1] == r {\n\t\ts = s[:sz-1]\n\t}\n\tsz = len(s)\n\tif sz > 0 && s[0] == r {\n\t\ts = s[1:sz]\n\t}\n\treturn s\n}", "func normalizeWhitespace(x string) string {\n\tx = strings.Join(strings.Fields(x), \" \")\n\tx = strings.Replace(x, \"( \", \"(\", -1)\n\tx = strings.Replace(x, \" )\", \")\", -1)\n\tx = strings.Replace(x, \")->\", \") ->\", -1)\n\treturn x\n}", "func trimLast(text string) string {\n\ttextLen := len(text)\n\tif textLen == 0 {\n\t\treturn text\n\t}\n\treturn text[:textLen-1]\n}", "func Trim(p projection) *trimFunc {\n\treturn &trimFunc{\n\t\tsubject: p.(element),\n\t\tsel: p.from(),\n\t\tlocation: TRIM_BOTH,\n\t}\n}", "func removeSpaces(stringWithSpaces string) string {\n\t// First version: Split on spaces and join on nothing. It's simple to read, but may not benchmark well.\n\t// Using ReplaceAll is more straightforward but won't strip non-space whitespace characters\n\treturn strings.Replace(stringWithSpaces, \" \", \"\", -1)\n}", "func stripField(name string) string {\n\tif strings.HasSuffix(name, \".f\") {\n\t\treturn name[:len(name)-2]\n\t}\n\treturn name\n}", "func trimHash(l string) string {\n\tif strings.Contains(l, \"#\") {\n\t\tvar index int\n\t\tfor n, str := range l {\n\t\t\tif strconv.QuoteRune(str) == \"'#'\" {\n\t\t\t\tindex = n\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\treturn l[:index]\n\t}\n\treturn l\n}", "func leadingWhitespace(s string) string {\n\tfor i, r := range s {\n\t\tif !unicode.IsSpace(r) {\n\t\t\treturn s[:i]\n\t\t}\n\t}\n\treturn s\n}", "func trimLWS(in []byte) []byte {\n\tfirstNonWS := 0\n\tfor ; firstNonWS < len(in) && isWS(in[firstNonWS]); firstNonWS++ {\n\t}\n\n\treturn in[firstNonWS:]\n}", "func ScanlineTrim() string {\n\treturn strings.TrimSpace(Scanline())\n}", "func squashSpace(bytes []byte) []byte {\n\tout := bytes[:0]\n\tvar last rune\n\n\tfor i := 0; i < len(bytes); {\n\t\tr, rune_size := utf8.DecodeRune(bytes[i:]) // rune and its size\n\n\t\t// check if the rune is a space character in Unicode\n\t\tif !unicode.IsSpace(r) {\n\t\t\tout = append(out, bytes[i:i+rune_size]...) // adding the bytes we want which not containing space\n\t\t} else if unicode.IsSpace(r) && !unicode.IsSpace(last) { // if found space but there are non space in the end - add the space\n\t\t\tout = append(out, ' ')\n\t\t}\n\t\tlast = r // the remaining rune\n\t\ti += rune_size // go to the next rune\n\t}\n\treturn out\n}", "func trimUrl(url string) string {\n\tsplitted := strings.Split(url, \"query\")\n\tprimary := trimString(strings.TrimPrefix(splitted[1], \"=\"))\n\n\treturn primary\n}" ]
[ "0.60074353", "0.60074353", "0.6000086", "0.599408", "0.58405334", "0.5814441", "0.57873714", "0.57268393", "0.56490695", "0.56149316", "0.5585467", "0.55808645", "0.5569028", "0.55490065", "0.5543645", "0.55314946", "0.5510685", "0.55082124", "0.54975235", "0.5440023", "0.5437848", "0.5396855", "0.5362448", "0.5348372", "0.53075856", "0.5265192", "0.52643573", "0.52546626", "0.5252089", "0.5231262", "0.52098596", "0.52020556", "0.5194618", "0.51856905", "0.51817906", "0.51671857", "0.5165696", "0.5147063", "0.51349837", "0.511523", "0.5097004", "0.5076466", "0.50689125", "0.50490034", "0.5043892", "0.50431365", "0.5036943", "0.5029788", "0.5029788", "0.50287575", "0.49574596", "0.4953759", "0.49489483", "0.49358535", "0.49054834", "0.489705", "0.48894545", "0.4853447", "0.48497343", "0.4844698", "0.48432618", "0.48135084", "0.4813072", "0.47968924", "0.4787091", "0.4787002", "0.47677785", "0.47627556", "0.47582182", "0.4756988", "0.47457522", "0.47456434", "0.47367632", "0.47255513", "0.47196293", "0.4718568", "0.47152683", "0.4713154", "0.4701872", "0.4688475", "0.46838027", "0.4671903", "0.4671157", "0.4665513", "0.46555468", "0.46533728", "0.4649225", "0.4649225", "0.46483007", "0.46436837", "0.46415603", "0.46315545", "0.4623782", "0.46208405", "0.4614384", "0.46135518", "0.4600441", "0.45962435", "0.4594651" ]
0.7598023
1
parseArchive parses a Unix archive of Go object files.
func (r *objReader) parseArchive(verbose bool) error { r.readFull(r.tmp[:8]) // consume header (already checked) for r.offset < r.limit { if err := r.readFull(r.tmp[:60]); err != nil { return err } data := r.tmp[:60] // Each file is preceded by this text header (slice indices in first column): // 0:16 name // 16:28 date // 28:34 uid // 34:40 gid // 40:48 mode // 48:58 size // 58:60 magic - `\n // We only care about name, size, and magic, unless in verbose mode. // The fields are space-padded on the right. // The size is in decimal. // The file data - size bytes - follows the header. // Headers are 2-byte aligned, so if size is odd, an extra padding // byte sits between the file data and the next header. // The file data that follows is padded to an even number of bytes: // if size is odd, an extra padding byte is inserted betw the next header. if len(data) < 60 { return errTruncatedArchive } if !bytes.Equal(data[58:60], archiveMagic) { return errCorruptArchive } name := trimSpace(data[0:16]) var err error get := func(start, end, base, bitsize int) int64 { if err != nil { return 0 } var v int64 v, err = strconv.ParseInt(trimSpace(data[start:end]), base, bitsize) return v } size := get(48, 58, 10, 64) var ( mtime int64 uid, gid int mode os.FileMode ) if verbose { mtime = get(16, 28, 10, 64) uid = int(get(28, 34, 10, 32)) gid = int(get(34, 40, 10, 32)) mode = os.FileMode(get(40, 48, 8, 32)) } if err != nil { return errCorruptArchive } data = data[60:] fsize := size + size&1 if fsize < 0 || fsize < size { return errCorruptArchive } switch name { case "__.PKGDEF": r.a.Entries = append(r.a.Entries, Entry{ Name: name, Type: EntryPkgDef, Mtime: mtime, Uid: uid, Gid: gid, Mode: mode, Data: Data{r.offset, size}, }) r.skip(size) default: var typ EntryType var o *GoObj offset := r.offset p, err := r.peek(8) if err != nil { return err } if bytes.Equal(p, goobjHeader) { typ = EntryGoObj o = &GoObj{} r.parseObject(o, size) } else { typ = EntryNativeObj r.skip(size) } r.a.Entries = append(r.a.Entries, Entry{ Name: name, Type: typ, Mtime: mtime, Uid: uid, Gid: gid, Mode: mode, Data: Data{offset, size}, Obj: o, }) } if size&1 != 0 { r.skip(1) } } return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (r *objReader) parseArchive() error {\n\tfor r.offset < r.limit {\n\t\tif err := r.readFull(r.tmp[:60]); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdata := r.tmp[:60]\n\n\t\t// Each file is preceded by this text header (slice indices in first column):\n\t\t//\t 0:16\tname\n\t\t//\t16:28 date\n\t\t//\t28:34 uid\n\t\t//\t34:40 gid\n\t\t//\t40:48 mode\n\t\t//\t48:58 size\n\t\t//\t58:60 magic - `\\n\n\t\t// We only care about name, size, and magic.\n\t\t// The fields are space-padded on the right.\n\t\t// The size is in decimal.\n\t\t// The file data - size bytes - follows the header.\n\t\t// Headers are 2-byte aligned, so if size is odd, an extra padding\n\t\t// byte sits between the file data and the next header.\n\t\t// The file data that follows is padded to an even number of bytes:\n\t\t// if size is odd, an extra padding byte is inserted betw the next header.\n\t\tif len(data) < 60 {\n\t\t\treturn errTruncatedArchive\n\t\t}\n\t\tif !bytes.Equal(data[58:60], archiveMagic) {\n\t\t\treturn errCorruptArchive\n\t\t}\n\t\tname := trimSpace(data[0:16])\n\t\tsize, err := strconv.ParseInt(trimSpace(data[48:58]), 10, 64)\n\t\tif err != nil {\n\t\t\treturn errCorruptArchive\n\t\t}\n\t\tdata = data[60:]\n\t\tfsize := size + size&1\n\t\tif fsize < 0 || fsize < size {\n\t\t\treturn errCorruptArchive\n\t\t}\n\t\tswitch name {\n\t\tcase \"__.SYMDEF\", \"__.GOSYMDEF\", \"__.PKGDEF\":\n\t\t\tr.skip(size)\n\t\tdefault:\n\t\t\toldLimit := r.limit\n\t\t\tr.limit = r.offset + size\n\t\t\tif err := r.parseObject(nil); err != nil {\n\t\t\t\treturn fmt.Errorf(\"parsing archive member %q: %v\", name, err)\n\t\t\t}\n\t\t\tr.skip(r.limit - r.offset)\n\t\t\tr.limit = oldLimit\n\t\t}\n\t\tif size&1 != 0 {\n\t\t\tr.skip(1)\n\t\t}\n\t}\n\treturn nil\n}", "func processArchive(db *Database, archivePath string) error {\n\n\t// Read the Debian archive file\n\tf, err := os.Open(archivePath)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\treader := ar.NewReader(f)\n\n\t// Skip debian-binary\n\treader.Next()\n\n\t// control.tar\n\treader.Next()\n\tvar bufControl bytes.Buffer\n\tio.Copy(&bufControl, reader)\n\n\tpkg, err := parseControl(db, bufControl)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Add the new package in the database\n\tdb.Packages = append(db.Packages, pkg)\n\tdb.Sync()\n\n\t// data.tar\n\treader.Next()\n\tvar bufData bytes.Buffer\n\tio.Copy(&bufData, reader)\n\n\tfmt.Printf(\"Preparing to unpack %s ...\\n\", filepath.Base(archivePath))\n\n\tif err := pkg.Unpack(bufData); err != nil {\n\t\treturn err\n\t}\n\tif err := pkg.Configure(); err != nil {\n\t\treturn err\n\t}\n\n\tdb.Sync()\n\n\treturn nil\n}", "func Parse(f *os.File, verbose bool) (*Archive, error) {\n\tvar r objReader\n\tr.init(f)\n\tt, err := r.peek(8)\n\tif err != nil {\n\t\tif err == io.EOF {\n\t\t\terr = io.ErrUnexpectedEOF\n\t\t}\n\t\treturn nil, err\n\t}\n\n\tswitch {\n\tdefault:\n\t\treturn nil, errNotObject\n\n\tcase bytes.Equal(t, archiveHeader):\n\t\tif err := r.parseArchive(verbose); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\tcase bytes.Equal(t, goobjHeader):\n\t\toff := r.offset\n\t\to := &GoObj{}\n\t\tif err := r.parseObject(o, r.limit-off); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tr.a.Entries = []Entry{{\n\t\t\tName: f.Name(),\n\t\t\tType: EntryGoObj,\n\t\t\tData: Data{off, r.limit - off},\n\t\t\tObj: o,\n\t\t}}\n\t}\n\n\treturn r.a, nil\n}", "func handleArchive(ea ExtractionArgs) (success bool) {\n\t// List bitcode files to link\n\tvar bcFiles []string\n\tvar artifactFiles []string\n\n\tinputFile, _ := filepath.Abs(ea.InputFile)\n\n\tLogInfo(\"handleArchive: ExtractionArgs = %v\\n\", ea)\n\n\t// Create tmp dir\n\ttmpDirName, err := os.MkdirTemp(\"\", \"gllvm\")\n\tif err != nil {\n\t\tLogError(\"The temporary directory in which to extract object files could not be created.\")\n\t\treturn\n\t}\n\n\tdefer CheckDefer(func() error { return os.RemoveAll(tmpDirName) })\n\n\thomeDir, err := os.Getwd()\n\tif err != nil {\n\t\tLogError(\"Could not ascertain our whereabouts: %v\", err)\n\t\treturn\n\t}\n\n\terr = os.Chdir(tmpDirName)\n\tif err != nil {\n\t\tLogError(\"Could not cd to %v because: %v\", tmpDirName, err)\n\t\treturn\n\t}\n\n\t//1. fetch the Table of Contents (TOC)\n\ttoc := fetchTOC(ea, inputFile)\n\n\tLogDebug(\"Table of Contents of %v:\\n%v\\n\", inputFile, toc)\n\n\t//2. extract the files from the TOC\n\tsuccess, artifactFiles, bcFiles = extractFiles(ea, inputFile, toc)\n\t//extractFiles has already complained\n\tif !success {\n\t\treturn\n\t}\n\n\terr = os.Chdir(homeDir)\n\tif err != nil {\n\t\tLogError(\"Could not cd to %v because: %v\", homeDir, err)\n\t\treturn\n\t}\n\n\tLogDebug(\"handleArchive: walked %v\\nartifactFiles:\\n%v\\nbcFiles:\\n%v\\n\", tmpDirName, artifactFiles, bcFiles)\n\n\t//3. link or archive those puppies\n\tif len(bcFiles) > 0 {\n\n\t\t// Sort the bitcode files\n\t\tif ea.SortBitcodeFiles {\n\t\t\tLogWarning(\"Sorting bitcode files.\")\n\t\t\tsort.Strings(bcFiles)\n\t\t\tsort.Strings(artifactFiles)\n\t\t}\n\n\t\t// Build archive\n\t\tif ea.BuildBitcodeModule {\n\t\t\tsuccess = linkBitcodeFiles(ea, bcFiles)\n\t\t} else {\n\t\t\tsuccess = archiveBcFiles(ea, bcFiles)\n\t\t}\n\n\t\tif !success {\n\t\t\t//hopefully the failure has already been reported...\n\t\t\treturn\n\t\t}\n\n\t\t// Write manifest\n\t\tif ea.WriteManifest {\n\t\t\tsuccess = writeManifest(ea, bcFiles, artifactFiles)\n\t\t}\n\t} else {\n\t\tLogError(\"No bitcode files found\\n\")\n\t\treturn\n\t}\n\treturn\n}", "func WalkArchive(data []byte, format ArchiveFormat, f WalkArchiveFunc) error {\n\tif format == ArchiveFormatZip {\n\t\treturn walkArchiveZip(bytes.NewReader(data), int64(len(data)), f)\n\t}\n\t// r will read bytes in tar format.\n\tvar r io.Reader = bytes.NewReader(data)\n\tswitch format {\n\tcase ArchiveFormatTar:\n\t\t// Already in tar format, do nothing.\n\tcase ArchiveFormatTarBz2, ArchiveFormatTbz2:\n\t\t// Decompress with bzip2.\n\t\tr = bzip2.NewReader(r)\n\tcase ArchiveFormatTarGz, ArchiveFormatTgz:\n\t\t// Decompress with gzip.\n\t\tvar err error\n\t\tr, err = gzip.NewReader(r)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\tcase ArchiveFormatTarXz, ArchiveFormatTxz:\n\t\t// Decompress with xz.\n\t\tvar err error\n\t\tr, err = xz.NewReader(r)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\tcase ArchiveFormatTarZst:\n\t\t// Decompress with zstd.\n\t\tvar err error\n\t\tr, err = zstd.NewReader(r)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\tdefault:\n\t\treturn UnknownArchiveFormatError(format)\n\t}\n\treturn walkArchiveTar(r, f)\n}", "func openArchive(u string) (ar Archive, err error) {\n\treadCloser, err := openReader(u)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\t_ = readCloser.Close()\n\t\t}\n\t}()\n\n\tct, r, err := detectContentType(readCloser)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tswitch ct {\n\tcase \"application/x-gzip\":\n\t\tr, err = gzip.NewReader(r)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\tcase \"application/zip\":\n\t\treturn newZipArchive(r, readCloser)\n\t}\n\n\treturn &tarArchive{\n\t\tCloser: readCloser,\n\t\ttr: tar.NewReader(r),\n\t}, nil\n}", "func archiveBinary(exe string) ([]byte, *layerMetadata, error) {\n\tf, err := os.Open(exe)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tdefer f.Close()\n\tfi, err := f.Stat()\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\touterDigest, innerDigest := sha256.New(), sha256.New()\n\tbuf := new(bytes.Buffer)\n\tgw := gzip.NewWriter(io.MultiWriter(buf, outerDigest))\n\ttw := tar.NewWriter(io.MultiWriter(gw, innerDigest))\n\tif err := tw.WriteHeader(&tar.Header{\n\t\tName: strings.TrimPrefix(insideContainerPath, \"/\"),\n\t\tMode: 0755,\n\t\tModTime: fi.ModTime(),\n\t\tSize: fi.Size(),\n\t}); err != nil {\n\t\treturn nil, nil, err\n\t}\n\tif _, err := io.Copy(tw, f); err != nil {\n\t\treturn nil, nil, err\n\t}\n\tif err := tw.Close(); err != nil {\n\t\treturn nil, nil, err\n\t}\n\tif err := gw.Close(); err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn buf.Bytes(), &layerMetadata{\n\t\touterDigest: fmt.Sprintf(\"sha256:%x\", outerDigest.Sum(nil)),\n\t\tinnerDigest: fmt.Sprintf(\"sha256:%x\", innerDigest.Sum(nil)),\n\t\touterSize: buf.Len(),\n\t}, nil\n}", "func ParseFiles(params *CmdLineParams) error {\n\n\tvar objs tor.ObjectSet\n\tvar channels []chan tor.ObjectSet\n\tvar group sync.WaitGroup\n\tgroup.Add(len(params.Callbacks))\n\n\t// Create a channel for and invoke all callback functions.\n\tfor _, analysisFunc := range params.Callbacks {\n\t\tchannel := make(chan tor.ObjectSet)\n\t\tchannels = append(channels, channel)\n\n\t\tgo analysisFunc(channel, params, &group)\n\t}\n\n\tif params.Cumulative {\n\t\tlog.Printf(\"Processing \\\"%s\\\" cumulatively.\\n\", params.ArchiveData)\n\t\twalkArchiveData(params.ArchiveData, GatherObjects(&objs, nil, params))\n\n\t\tif objs == nil {\n\t\t\treturn errors.New(\"Gathered object set empty. Are we parsing the right files?\")\n\t\t}\n\n\t\t// Send accumulated object set to all callback functions.\n\t\tfor _, channel := range channels {\n\t\t\tchannel <- objs\n\t\t}\n\t} else {\n\t\tlog.Printf(\"Processing \\\"%s\\\" independently.\\n\", params.ArchiveData)\n\t\twalkArchiveData(params.ArchiveData, GatherObjects(nil, channels, params))\n\t}\n\n\t// Close processing channels and wait for goroutines to finish.\n\tfor _, channel := range channels {\n\t\tclose(channel)\n\t}\n\tgroup.Wait()\n\n\treturn nil\n}", "func (mkdir *FuseMkdirIn) 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[0:4], &mkdir.Mode)\n\tcommon.ParseBinary(bcontent[4:8], &mkdir.Umask)\n\n\tmkdir.Name = string(bcontent[8 : length-1])\n\n\treturn nil\n}", "func processArchive(path string) {\r\n\text := filepath.Ext(path)\r\n\r\n\t// -o:outputpath\r\n\textractpath := strings.TrimSpace(path[:len(path)-len(ext)])\r\n\r\n\tcmd := exec.Command(zipApp, \"x\", \"-o:\"+extractpath, path)\r\n\r\n\texecErr := cmd.Run()\r\n\tif execErr != nil {\r\n\t\tpanic(execErr)\r\n\t}\r\n\r\n\tprocessDirectory(extractpath)\r\n\r\n\tos.RemoveAll(extractpath)\r\n}", "func GitArchive(dir, ref, format string) (io.ReadCloser, error) {\n\t// Build archive using git-archive\n\targs := []string{\"git\", \"archive\", \"--format=\" + format, ref}\n\n\tcmd := exec.Command(args[0], args[1:]...)\n\t// Set directory to repo's\n\tcmd.Dir = dir\n\n\t// Get stream\n\treturn CmdStream(cmd, nil)\n}", "func LoadArchive(r io.Reader) (FileTree, error) {\n\n\tm, err := readArchiveMetadata(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttr := tar.NewReader(r)\n\n\ta := &archiveLoader{\n\t\ttr: tr,\n\t}\n\n\troot, err := a.reconstructArchiveNode(nil, m)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to reconstruct vtree node: %w -- archive corrupt or version incompatible\", err)\n\t}\n\n\tt := &tree{\n\t\troot: root,\n\t}\n\n\tt.closeFunc = archiveCloser(r)\n\n\treturn t, nil\n\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 extractArchive(f *os.File, name, dir, stripPrefix string) (err error) {\n\tif strings.HasSuffix(name, \".zip\") {\n\t\treturn extractZip(f, name, dir, stripPrefix)\n\t}\n\tif strings.HasSuffix(name, \".tar.gz\") {\n\t\tzr, err := gzip.NewReader(f)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"extracting %s: %w\", name, err)\n\t\t}\n\t\tdefer func() {\n\t\t\tif cerr := zr.Close(); err == nil && cerr != nil {\n\t\t\t\terr = cerr\n\t\t\t}\n\t\t}()\n\t\treturn extractTar(zr, name, dir, stripPrefix)\n\t}\n\treturn fmt.Errorf(\"could not determine archive format from extension: %s\", name)\n}", "func UnpackArchive(tarPath string, tempDir string) map[string]string {\n\tremoveExisting()\n\tplanConfig := unpackArchive(tarPath, tempDir)\n\n\tutils.SeparateJavaScript()\n\tutils.RemoveFlowIDs()\n\n\treturn planConfig\n}", "func readArchive(archive string) error {\n\t// Open the zip file specified by name and return a ReadCloser.\n\trc, err := zip.OpenReader(archive)\t\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer rc.Close()\n\t// Iterate through the files in the zip file to read the file contents.\n\tfor _, file := range rc.File {\n\t\tfrc, err := file.Open()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer frc.Close()\n\t\tfmt.Fprintf(os.Stdout, \"Contents of the file %s:\\n\", file.Name)\n\t\t// Write the contents into Stdout\n\t\tcopied, err := io.Copy(os.Stdout, frc)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// Check the size of the file.\n\t\tif uint64(copied) != file.UncompressedSize64 {\n\t\t\treturn fmt.Errorf(\"Length of the file contents doesn't match with the file %s\", file.Name)\n\t\t}\n\t\tfmt.Println()\n\t}\n\treturn nil\n}", "func loadTestArchive(path string) (*testArchive, error) {\n\t// test case name -> test case\n\tindex := make(map[string]*testFile)\n\n\t// Retrieves test cases by name, adding to the map if needed.\n\tgetTestFile := func(name string) *testFile {\n\t\ttf := index[name]\n\t\tif tf == nil {\n\t\t\ttf = &testFile{Name: name}\n\t\t\tindex[name] = tf\n\t\t}\n\t\treturn tf\n\t}\n\n\tarchive, err := txtar.ParseFile(path)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to open %q: %v\", path, err)\n\t}\n\n\t// Rather than reproducing the entire contents of the txtar, we only\n\t// want the patches and input files. The contents of the output files\n\t// are needed in-memory.\n\n\tvar patches []string // names of patch files\n\n\tnewFiles := archive.Files[:0] // zero-alloc filtering\n\tfor _, f := range archive.Files {\n\t\tswitch {\n\t\tcase strings.HasSuffix(f.Name, _patch):\n\t\t\tpatches = append(patches, f.Name)\n\n\t\tcase strings.HasSuffix(f.Name, _in):\n\t\t\tname := strings.TrimSuffix(f.Name, _in) // foo.in.go => foo\n\n\t\t\t// Replace the .in.go suffix with just .go so that\n\t\t\t// test cases have more control over the name of the\n\t\t\t// file when it affects the behavior of `go list`\n\t\t\t// (test files, for example).\n\t\t\tf.Name = name + _go // foo.in.go => foo.go\n\t\t\tf.Data = singleTrailingNewline(f.Data)\n\n\t\t\tgetTestFile(name).Give = f.Name\n\t\tcase strings.HasSuffix(f.Name, _out):\n\t\t\tname := strings.TrimSuffix(f.Name, _out) // foo.out.go => foo\n\t\t\tgetTestFile(name).Want = singleTrailingNewline(f.Data)\n\n\t\t\t// Don't include this file in the list of files\n\t\t\t// reproduced by the archive.\n\t\t\tcontinue\n\t\tdefault:\n\t\t\terr = multierr.Append(err,\n\t\t\t\tfmt.Errorf(\"unknown file %q found in %q\", f.Name, path))\n\t\t}\n\n\t\tnewFiles = append(newFiles, f)\n\t}\n\tarchive.Files = newFiles\n\n\tif len(patches) == 0 {\n\t\terr = multierr.Append(err, fmt.Errorf(\"no patches found in %q\", path))\n\t}\n\n\tif len(index) == 0 {\n\t\terr = multierr.Append(err, fmt.Errorf(\"no Go files found in %q\", path))\n\t}\n\n\tfiles := make([]*testFile, 0, len(index))\n\tfor _, tt := range index {\n\t\tif len(tt.Give) == 0 {\n\t\t\terr = multierr.Append(err, fmt.Errorf(\n\t\t\t\t\"test %q of %q does not have an input file\", tt.Name, path))\n\t\t}\n\t\tif len(tt.Want) == 0 {\n\t\t\terr = multierr.Append(err, fmt.Errorf(\n\t\t\t\t\"test %q of %q does not have an output file\", tt.Name, path))\n\t\t}\n\t\tfiles = append(files, tt)\n\t}\n\tsort.Slice(files, func(i, j int) bool {\n\t\treturn files[i].Name < files[j].Name\n\t})\n\n\treturn &testArchive{\n\t\tArchive: archive,\n\t\tPatches: patches,\n\t\tFiles: files,\n\t}, nil\n}", "func (c *Client) DecodeLatexArchive(resp *http.Response) (*LatexArchive, error) {\n\tvar decoded LatexArchive\n\terr := c.Decoder.Decode(&decoded, resp.Body, resp.Header.Get(\"Content-Type\"))\n\treturn &decoded, err\n}", "func (rename *FuseRenameIn) 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[:8], &rename.NewDir)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tarray := bytes.Split(bcontent[8:], []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 Parse(payload *zip.File, folder, extractPattern string) (bool, string, error) {\n\n\t// This is the FAST path that execs the 'aa' binary if found on macOS\n\tif aaPath, err := execabs.LookPath(\"aa\"); err == nil {\n\t\t// make tmp folder\n\t\tdir, err := os.MkdirTemp(\"\", \"ota_\"+filepath.Base(payload.Name))\n\t\tif err != nil {\n\t\t\treturn false, \"\", fmt.Errorf(\"failed to create tmp folder: %v\", err)\n\t\t}\n\t\tdefer os.RemoveAll(dir)\n\n\t\trc, err := payload.Open()\n\t\tif err != nil {\n\t\t\treturn false, \"\", fmt.Errorf(\"failed to open file in zip %s: %v\", payload.Name, err)\n\t\t}\n\t\tdefer rc.Close()\n\n\t\tvar errb bytes.Buffer\n\t\tcmd := execabs.Command(aaPath, \"extract\", \"-d\", dir, \"-include-regex\", extractPattern)\n\t\tcmd.Stdin = rc\n\t\terr = cmd.Run()\n\t\tif err != nil && errb.Len() != 0 {\n\t\t\terr = errors.New(strings.TrimRight(errb.String(), \"\\r\\n\"))\n\t\t\treturn false, \"\", err\n\t\t}\n\n\t\t// Is folder empty\n\t\tff, err := os.ReadDir(dir)\n\t\tif err != nil {\n\t\t\treturn false, \"\", fmt.Errorf(\"failed to create tmp folder: %v\", err)\n\t\t}\n\t\tif len(ff) == 0 {\n\t\t\treturn false, \"\", nil\n\t\t}\n\n\t\tvar fname string\n\t\terr = filepath.Walk(dir, func(path string, f os.FileInfo, err error) error {\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif !f.IsDir() {\n\t\t\t\tfname = filepath.Join(folder, filepath.Clean(strings.TrimPrefix(path, dir)))\n\t\t\t\tif err := os.MkdirAll(filepath.Dir(fname), 0750); err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"failed to create dir %s: %v\", filepath.Dir(fname), err)\n\t\t\t\t}\n\t\t\t\tutils.Indent(log.Info, 2)(fmt.Sprintf(\"Extracting %s\\t%s\\t%s\", f.Mode(), humanize.Bytes(uint64(f.Size())), fname))\n\t\t\t\tif err := os.Rename(path, fname); err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"failed to mv file %s to %s: %v\", strings.TrimPrefix(path, dir), fname, err)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t\tif err != nil {\n\t\t\treturn false, \"\", fmt.Errorf(\"failed to read files in tmp folder: %v\", err)\n\t\t}\n\n\t\treturn true, fname, nil\n\t}\n\n\tpData := make([]byte, payload.UncompressedSize64)\n\n\trc, err := payload.Open()\n\tif err != nil {\n\t\treturn false, \"\", errors.Wrapf(err, \"failed to open file in zip: %s\", payload.Name)\n\t}\n\n\tio.ReadFull(rc, pData)\n\trc.Close()\n\n\tpr := bytes.NewReader(pData)\n\n\tvar pbzx pbzxHeader\n\tif err := binary.Read(pr, binary.BigEndian, &pbzx); err != nil {\n\t\treturn false, \"\", err\n\t}\n\n\tif pbzx.Magic != pbzxMagic {\n\t\treturn false, \"\", errors.New(\"src not a pbzx stream\")\n\t}\n\n\txzBuf := new(bytes.Buffer)\n\n\tfor {\n\t\tvar xzTag xzHeader\n\t\tif err := binary.Read(pr, binary.BigEndian, &xzTag); err != nil {\n\t\t\treturn false, \"\", err\n\t\t}\n\n\t\txzChunkBuf := make([]byte, xzTag.Size)\n\t\tif err := binary.Read(pr, binary.BigEndian, &xzChunkBuf); err != nil {\n\t\t\treturn false, \"\", err\n\t\t}\n\n\t\t// xr, err := xz.NewReader(bytes.NewReader(xzChunkBuf))\n\t\t// xr, err := xz.NewReader(bytes.NewReader(xzChunkBuf), 0)\n\t\txr, err := NewXZReader(bytes.NewReader(xzChunkBuf))\n\t\tif err != nil {\n\t\t\treturn false, \"\", err\n\t\t}\n\t\tdefer xr.Close()\n\n\t\tio.Copy(xzBuf, xr)\n\n\t\tif (xzTag.Flags & hasMoreChunks) == 0 {\n\t\t\tbreak\n\t\t}\n\t}\n\n\trr := bytes.NewReader(xzBuf.Bytes())\n\n\tvar magic uint32\n\tvar headerSize uint16\n\n\tfor {\n\t\tvar ent *Entry\n\n\t\terr := binary.Read(rr, binary.LittleEndian, &magic)\n\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\n\t\tif err != nil {\n\t\t\treturn false, \"\", err\n\t\t}\n\n\t\tif magic == yaa1Header || magic == aa01Header { // NEW iOS 14.x OTA payload format\n\t\t\tif err := binary.Read(rr, binary.LittleEndian, &headerSize); err != nil {\n\t\t\t\treturn false, \"\", err\n\t\t\t}\n\t\t\theader := make([]byte, headerSize-uint16(binary.Size(magic))-uint16(binary.Size(headerSize)))\n\t\t\tif err := binary.Read(rr, binary.LittleEndian, &header); err != nil {\n\t\t\t\treturn false, \"\", err\n\t\t\t}\n\n\t\t\tent, err = yaaDecodeHeader(bytes.NewReader(header))\n\t\t\tif err != nil {\n\t\t\t\t// dump header if in Verbose mode\n\t\t\t\tutils.Indent(log.Debug, 2)(hex.Dump(header))\n\t\t\t\treturn false, \"\", err\n\t\t\t}\n\n\t\t} else { // pre iOS14.x OTA file\n\t\t\tvar e entry\n\t\t\tif err := binary.Read(rr, binary.BigEndian, &e); err != nil {\n\t\t\t\tif err == io.EOF {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\treturn false, \"\", err\n\t\t\t}\n\n\t\t\t// 0x10030000 seem to be framworks and other important platform binaries (or symlinks?)\n\t\t\tif e.Usually_0x210Or_0x110 != 0x10010000 && e.Usually_0x210Or_0x110 != 0x10020000 && e.Usually_0x210Or_0x110 != 0x10030000 {\n\t\t\t\t// if e.Usually_0x210Or_0x110 != 0 {\n\t\t\t\t// \tlog.Warnf(\"found unknown entry flag: 0x%x\", e.Usually_0x210Or_0x110)\n\t\t\t\t// }\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tfileName := make([]byte, e.NameLen)\n\t\t\tif err := binary.Read(rr, binary.BigEndian, &fileName); err != nil {\n\t\t\t\tif err == io.EOF {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\treturn false, \"\", err\n\t\t\t}\n\n\t\t\t// if e.Usually_0x20 != 0x20 {\n\t\t\t// \tfmt.Printf(\"%s: %#v\\n\", fileName, e)\n\t\t\t// }\n\n\t\t\t// if e.Usually_0x00_00 != 0 {\n\t\t\t// \tfmt.Printf(\"%s: %#v\\n\", fileName, e)\n\t\t\t// }\n\n\t\t\tif e.Usually_0x210Or_0x110 == 0x10030000 {\n\t\t\t\tfmt.Printf(\"%s (%s): %#v\\n\", fileName, os.FileMode(e.Perms), e)\n\t\t\t}\n\n\t\t\tent.Mod = os.FileMode(e.Perms)\n\t\t\tent.Path = string(fileName)\n\t\t\tent.Size = e.FileSize\n\t\t}\n\n\t\tif len(extractPattern) > 0 {\n\t\t\tmatch, _ := regexp.MatchString(extractPattern, ent.Path)\n\t\t\tif match || strings.Contains(strings.ToLower(string(ent.Path)), strings.ToLower(extractPattern)) {\n\t\t\t\tfileBytes := make([]byte, ent.Size)\n\t\t\t\tif err := binary.Read(rr, binary.LittleEndian, &fileBytes); err != nil {\n\t\t\t\t\tif err == io.EOF {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\treturn false, \"\", err\n\t\t\t\t}\n\n\t\t\t\tif err := os.MkdirAll(folder, 0750); err != nil {\n\t\t\t\t\treturn false, \"\", fmt.Errorf(\"failed to create folder: %s\", folder)\n\t\t\t\t}\n\t\t\t\tfname := filepath.Join(folder, filepath.Clean(ent.Path))\n\t\t\t\tutils.Indent(log.Info, 2)(fmt.Sprintf(\"Extracting %s uid=%d, gid=%d, %s, %s\", ent.Mod, ent.Uid, ent.Gid, humanize.Bytes(uint64(ent.Size)), fname))\n\t\t\t\tif err := os.WriteFile(fname, fileBytes, 0660); err != nil {\n\t\t\t\t\treturn false, \"\", err\n\t\t\t\t}\n\n\t\t\t\treturn true, fname, nil\n\t\t\t}\n\t\t}\n\n\t\trr.Seek(int64(ent.Size), io.SeekCurrent)\n\t}\n\n\treturn false, \"\", nil\n}", "func (unlink *FuseUnlinkIn) ParseBinary(bcontent []byte) error {\n\n\tlength := len(bcontent)\n\tunlink.Path = string(bcontent[:length-1])\n\treturn nil\n}", "func parseObjects(f *os.File, cfg *rest.Config) (*yamlutil.YAMLOrJSONDecoder, meta.RESTMapper, error) {\n\tdata, err := os.ReadFile(f.Name())\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tdataReader := bytes.NewReader(data)\n\tdecoder := yamlutil.NewYAMLOrJSONDecoder(dataReader, 100)\n\tmapper, err := apiutil.NewDiscoveryRESTMapper(cfg)\n\n\treturn decoder, mapper, err\n}", "func ParseFiles(log logr.Logger, files map[string]string) ([]*unstructured.Unstructured, error) {\n\tobjects := make([]*unstructured.Unstructured, 0)\n\tfor name, content := range files {\n\t\tif _, file := filepath.Split(name); file == \"NOTES.txt\" {\n\t\t\tcontinue\n\t\t}\n\t\tdecodedObjects, err := DecodeObjects(log, name, []byte(content))\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unable to decode files for %q: %w\", name, err)\n\t\t}\n\t\tobjects = append(objects, decodedObjects...)\n\t}\n\treturn objects, nil\n}", "func unzipArchive(zippedArchive, dstPath string) (*unzippedContents, error) {\n\n\tuz := unzip.New(zippedArchive, dstPath+\"/\"+\"new_build/\")\n\terr := uz.Extract()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t_, fileExt := getUserOS()\n\n\tcontents := &unzippedContents{\n\t\tnewMollyBinaryPath: dstPath + \"/\" + \"new_build/mollywallet\" + fileExt,\n\t\tupdateBinaryPath: dstPath + \"/\" + \"new_build/update\" + fileExt,\n\t}\n\n\treturn contents, err\n}", "func WalkArchive(startpath string) ([]string, error) {\n\tfiles := make([]string, 0)\n\terr := filepath.Walk(startpath, func(path string, info os.FileInfo, err error) error {\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tpcapErr := pcap.IsPcap(path)\n\t\t// If a file inside the archive isn't a pcap, skip it silently\n\t\tif pcapErr == nil {\n\t\t\tfiles = append(files, path)\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tfmt.Println(\"Problem walking archive recursively\", err)\n\t}\n\treturn files, err\n}", "func walkArchiveData(path string, callback func(string, os.FileInfo, io.Reader) error) error {\n\n\tif strings.HasSuffix(path, \".tar.xz\") {\n\t\treturn walkTarXZFile(path, callback)\n\t} else {\n\t\treturn walkPath(path, callback)\n\t}\n}", "func ReadArchive(rr RecordReader) (*Archive, error) {\n\ta := &Archive{\n\t\tFiles: make(map[string]Record),\n\t}\n\terr := ForEachRecord(rr, func(r Record) error {\n\t\treturn a.WriteRecord(r)\n\t})\n\treturn a, err\n}", "func ReadArchive(rr RecordReader) (*Archive, error) {\n\ta := &Archive{\n\t\tFiles: make(map[string]Record),\n\t}\n\terr := ForEachRecord(rr, func(r Record) error {\n\t\treturn a.WriteRecord(r)\n\t})\n\treturn a, err\n}", "func unarchive(rd io.Reader, update *Package) error {\n\tfmap := update.getFileMap()\n\tretVal := reflect.ValueOf(update).Elem()\n\n\tgzf, err := gzip.NewReader(io.LimitReader(rd, MaxFileSize))\n\tif err != nil {\n\t\treturn chkitErrors.Wrap(ErrUnpack, err)\n\t}\n\tdefer gzf.Close()\n\n\ttarf := tar.NewReader(gzf)\n\n\tfor {\n\t\theader, nextErr := tarf.Next()\n\t\tif nextErr == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tif nextErr != nil {\n\t\t\treturn chkitErrors.Wrap(ErrUnpack, nextErr)\n\t\t}\n\n\t\tif header.Typeflag == tar.TypeReg {\n\t\t\tfield, updateFile := fmap[strings.TrimPrefix(header.Name, \"./\")]\n\t\t\tif updateFile {\n\t\t\t\t// this is our file, unpack it\n\t\t\t\tbuf := bytes.NewBuffer([]byte{})\n\t\t\t\tif _, copyErr := io.Copy(buf, tarf); copyErr != nil {\n\t\t\t\t\treturn chkitErrors.Wrap(ErrUnpack, copyErr)\n\t\t\t\t}\n\n\t\t\t\tretVal.Field(field).Set(reflect.ValueOf(io.Reader(buf)))\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "func (cp *OCIConveyorPacker) extractArchive(src string, dst string) error {\n\tf, err := os.Open(src)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\n\tr := bufio.NewReader(f)\n\theader, err := r.Peek(10) //read a few bytes without consuming\n\tif err != nil {\n\t\treturn err\n\t}\n\tgzipped := strings.Contains(http.DetectContentType(header), \"x-gzip\")\n\n\tif gzipped {\n\t\tr, err := gzip.NewReader(f)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer r.Close()\n\t}\n\n\ttr := tar.NewReader(r)\n\n\tfor {\n\t\theader, err := tr.Next()\n\n\t\tswitch {\n\n\t\t// if no more files are found return\n\t\tcase err == io.EOF:\n\t\t\treturn nil\n\n\t\t// return any other error\n\t\tcase err != nil:\n\t\t\treturn err\n\n\t\t// if the header is nil, just skip it (not sure how this happens)\n\t\tcase header == nil:\n\t\t\tcontinue\n\t\t}\n\n\t\t// ZipSlip protection - don't escape from dst\n\t\ttarget := filepath.Join(dst, header.Name)\n\t\tif !strings.HasPrefix(target, filepath.Clean(dst)+string(os.PathSeparator)) {\n\t\t\treturn fmt.Errorf(\"%s: illegal extraction path\", target)\n\t\t}\n\n\t\t// check the file type\n\t\tswitch header.Typeflag {\n\t\t// if its a dir and it doesn't exist create it\n\t\tcase tar.TypeDir:\n\t\t\tif _, err := os.Stat(target); err != nil {\n\t\t\t\tif err := os.MkdirAll(target, 0755); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t// if it's a file create it\n\t\tcase tar.TypeReg:\n\t\t\tf, err := os.OpenFile(target, os.O_CREATE|os.O_RDWR, os.FileMode(header.Mode))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tdefer f.Close()\n\n\t\t\t// copy over contents\n\t\t\tif _, err := io.Copy(f, tr); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n}", "func (forget *FuseForgetIn) ParseBinary(bcontent []byte) error {\n\terr := common.ParseBinary(bcontent, forget)\n\n\treturn err\n}", "func Parse(r io.ReaderAt) (*Info, error) {\n\tmachoFiles := []*macho.File{}\n\tmachoFatFile, err := macho.NewFatFile(r)\n\tif err != nil {\n\t\tif err != macho.ErrNotFat {\n\t\t\treturn nil, err\n\t\t}\n\t\tmachoFile, err := macho.NewFile(r)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tmachoFiles = append(machoFiles, machoFile)\n\t} else {\n\t\tfor _, arch := range machoFatFile.Arches {\n\t\t\tmachoFiles = append(machoFiles, arch.File)\n\t\t}\n\t}\n\n\tarchitectures := make([]*Architecture, len(machoFiles))\n\tfor i, machoFile := range machoFiles {\n\t\tarch, err := parse(machoFile)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tarchitectures[i] = arch\n\t}\n\treturn &Info{\n\t\tArchitectures: architectures,\n\t}, nil\n}", "func Archive(filename string) (Store, error) {\n\tf, err := os.Open(filename)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tz, err := gzip.NewReader(f)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn archive{\n\t\tf: f,\n\t\tz: z,\n\t\tr: tar.NewReader(z),\n\t}, nil\n}", "func (header *FuseInHeader) ParseBinary(bcontent []byte) error {\n\terr := common.ParseBinary(bcontent, header)\n\n\treturn err\n}", "func Decode(r io.Reader) (Archive, string, error) {\n\tb, _ := ioutil.ReadAll(r)\n\tf := sniff(bytes.NewReader(b))\n\tif f.decode == nil {\n\t\treturn nil, \"\", ErrFormat\n\t}\n\tm := f.decode(bytes.NewReader(b))\n\treturn m, f.name, nil\n}", "func (open *FuseOpenIn) 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, open)\n\n\treturn err\n}", "func extractTarArchive(r io.Reader) (map[string][]byte, error) {\n\tentries := make(map[string][]byte)\n\tgzr, err := gzip.NewReader(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttr := tar.NewReader(gzr)\n\tfor {\n\t\theader, err := tr.Next()\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfileContents, err := io.ReadAll(tr)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tentries[header.Name] = fileContents\n\t}\n\n\tif err := gzr.Close(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn entries, nil\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 readArchive(work <-chan t, done <-chan struct{}) chan t {\n\tout := make(chan t, 50) // Oo, I learned from Guido that there's a bug in this code\n\tgo func(input <-chan t, output chan<- t, done <-chan struct{}) {\n\t\tdefer close(out)\n\t\tfor item := range input {\n\t\t\titem = process(item, \"archive\") // HL\n\t\t\tselect {\n\t\t\tcase output <- item: // HL\n\t\t\tcase <-done: // HL\n\t\t\t\treturn // HL\n\t\t\t}\n\t\t}\n\t}(work, out, done)\n\treturn out\n}", "func (access *FuseAccessIn) 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, access)\n\n\treturn nil\n}", "func newConverterManager(archive string, ignoreEmpty bool) (*ConverterManager, error) {\n\t// build dir path values\n\tpwd, err := os.Getwd()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tt := time.Now()\n\toRoot := filepath.Join(\n\t\tpwd,\n\t\tfmt.Sprintf(\"medium-to-hugo_%d%02d%02d_%02d%02d\", t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute()))\n\toIn := filepath.Join(oRoot, \"in\")\n\toOut := filepath.Join(oRoot, \"out\")\n\n\t// create the directories\n\t// 1. root and output directories\n\terr = os.MkdirAll(oRoot, os.ModePerm)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = os.MkdirAll(oOut, os.ModePerm)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpostsPath := filepath.Join(oOut, HContentType)\n\timagesPath := filepath.Join(postsPath, HImagesDirName)\n\n\t// 2. input dir, unzip will create and extract contents\n\tfiles, err := unzipFile(archive, oIn)\n\tif err != nil || len(files) == 0 {\n\t\treturn nil, fmt.Errorf(\"couldn't extract archive: %s => %s\", archive, err)\n\t}\n\n\tmediumPosts := filepath.Join(oIn, \"posts\")\n\texists, _ := fileExists(mediumPosts)\n\tif !exists {\n\t\treturn nil, fmt.Errorf(\"couldn't find posts content in the medium extract archive: %s\", oIn)\n\t}\n\n\t// create a markdown converter\n\top := md.Options{\n\t\tCodeBlockStyle: \"fenced\",\n\t}\n\tconverter := md.NewConverter(\"\", true, &op)\n\t// don't remove br tags\n\tconverter.Keep(\"br\")\n\tconverter.AddRules(ruleOverrides...)\n\n\tmgr := &ConverterManager{\n\t\tInPath: oIn,\n\t\tMediumPostsPath: mediumPosts,\n\t\tOutputPath: oOut,\n\t\tPostsPath: postsPath,\n\t\tImagesPath: imagesPath,\n\t\tIgnoreEmpty: ignoreEmpty,\n\t\tMDConverter: converter,\n\t}\n\n\treturn mgr, nil\n}", "func (rmdir *FuseRmdirIn) ParseBinary(bcontent []byte) error {\n\n\tlength := len(bcontent)\n\trmdir.Path = string(bcontent[:length-1])\n\treturn nil\n}", "func (symlink *FuseSymlinkIn) ParseBinary(bcontent []byte) error {\n\n\tarray := bytes.Split(bcontent, []byte{0})\n\n\tif len(array) < 2 {\n\t\treturn ErrDataLen\n\t}\n\n\tsymlink.Name = string(array[0])\n\tsymlink.LinkName = string(array[1])\n\n\treturn nil\n}", "func Archive(ctx context.Context, body io.Reader, location string, rename Renamer) error {\n\textractor := Extractor{\n\t\tFS: fs{},\n\t}\n\n\treturn extractor.Archive(ctx, body, location, rename)\n}", "func parseObjectStream(osd *types.ObjectStreamDict) error {\n\n\tlog.Read.Printf(\"parseObjectStream begin: decoding %d objects.\\n\", osd.ObjCount)\n\n\tdecodedContent := osd.Content\n\tprolog := decodedContent[:osd.FirstObjOffset]\n\n\t// The separator used in the prolog shall be white space\n\t// but some PDF writers use 0x00.\n\tprolog = bytes.ReplaceAll(prolog, []byte{0x00}, []byte{0x20})\n\n\tobjs := strings.Fields(string(prolog))\n\tif len(objs)%2 > 0 {\n\t\treturn errors.New(\"pdfcpu: parseObjectStream: corrupt object stream dict\")\n\t}\n\n\t// e.g., 10 0 11 25 = 2 Objects: #10 @ offset 0, #11 @ offset 25\n\n\tvar objArray types.Array\n\n\tvar offsetOld int\n\n\tfor i := 0; i < len(objs); i += 2 {\n\n\t\toffset, err := strconv.Atoi(objs[i+1])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\toffset += osd.FirstObjOffset\n\n\t\tif i > 0 {\n\t\t\tdstr := string(decodedContent[offsetOld:offset])\n\t\t\tlog.Read.Printf(\"parseObjectStream: objString = %s\\n\", dstr)\n\t\t\to, err := compressedObject(dstr)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tlog.Read.Printf(\"parseObjectStream: [%d] = obj %s:\\n%s\\n\", i/2-1, objs[i-2], o)\n\t\t\tobjArray = append(objArray, o)\n\t\t}\n\n\t\tif i == len(objs)-2 {\n\t\t\tdstr := string(decodedContent[offset:])\n\t\t\tlog.Read.Printf(\"parseObjectStream: objString = %s\\n\", dstr)\n\t\t\to, err := compressedObject(dstr)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tlog.Read.Printf(\"parseObjectStream: [%d] = obj %s:\\n%s\\n\", i/2, objs[i], o)\n\t\t\tobjArray = append(objArray, o)\n\t\t}\n\n\t\toffsetOld = offset\n\t}\n\n\tosd.ObjArray = objArray\n\n\tlog.Read.Println(\"parseObjectStream end\")\n\n\treturn nil\n}", "func (r *objReader) parseObject(prefix []byte) error {\n\t// TODO(rsc): Maybe use prefix and the initial input to\n\t// record the header line from the file, which would\n\t// give the architecture and other version information.\n\n\tr.p.MaxVersion++\n\tvar c1, c2, c3 byte\n\tfor {\n\t\tc1, c2, c3 = c2, c3, r.readByte()\n\t\tif c3 == 0 { // NUL or EOF, either is bad\n\t\t\treturn errCorruptObject\n\t\t}\n\t\tif c1 == '\\n' && c2 == '!' && c3 == '\\n' {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tr.readFull(r.tmp[:8])\n\tif !bytes.Equal(r.tmp[:8], []byte(\"\\x00\\x00go13ld\")) {\n\t\treturn r.error(errCorruptObject)\n\t}\n\n\tb := r.readByte()\n\tif b != 1 {\n\t\treturn r.error(errCorruptObject)\n\t}\n\n\t// Direct package dependencies.\n\tfor {\n\t\ts := r.readString()\n\t\tif s == \"\" {\n\t\t\tbreak\n\t\t}\n\t\tr.p.Imports = append(r.p.Imports, s)\n\t}\n\n\t// Symbols.\n\tfor {\n\t\tif b := r.readByte(); b != 0xfe {\n\t\t\tif b != 0xff {\n\t\t\t\treturn r.error(errCorruptObject)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\n\t\ttyp := r.readInt()\n\t\ts := &Sym{SymID: r.readSymID()}\n\t\tr.p.Syms = append(r.p.Syms, s)\n\t\ts.Kind = SymKind(typ)\n\t\tflags := r.readInt()\n\t\ts.DupOK = flags&1 != 0\n\t\ts.Size = r.readInt()\n\t\ts.Type = r.readSymID()\n\t\ts.Data = r.readData()\n\t\ts.Reloc = make([]Reloc, r.readInt())\n\t\tfor i := range s.Reloc {\n\t\t\trel := &s.Reloc[i]\n\t\t\trel.Offset = r.readInt()\n\t\t\trel.Size = r.readInt()\n\t\t\trel.Type = r.readInt()\n\t\t\trel.Add = r.readInt()\n\t\t\tr.readInt() // Xadd - ignored\n\t\t\trel.Sym = r.readSymID()\n\t\t\tr.readSymID() // Xsym - ignored\n\t\t}\n\n\t\tif s.Kind == STEXT {\n\t\t\tf := new(Func)\n\t\t\ts.Func = f\n\t\t\tf.Args = r.readInt()\n\t\t\tf.Frame = r.readInt()\n\t\t\tflags := r.readInt()\n\t\t\tf.Leaf = flags&1 != 0\n\t\t\tf.NoSplit = r.readInt() != 0\n\t\t\tf.Var = make([]Var, r.readInt())\n\t\t\tfor i := range f.Var {\n\t\t\t\tv := &f.Var[i]\n\t\t\t\tv.Name = r.readSymID().Name\n\t\t\t\tv.Offset = r.readInt()\n\t\t\t\tv.Kind = r.readInt()\n\t\t\t\tv.Type = r.readSymID()\n\t\t\t}\n\n\t\t\tf.PCSP = r.readData()\n\t\t\tf.PCFile = r.readData()\n\t\t\tf.PCLine = r.readData()\n\t\t\tf.PCData = make([]Data, r.readInt())\n\t\t\tfor i := range f.PCData {\n\t\t\t\tf.PCData[i] = r.readData()\n\t\t\t}\n\t\t\tf.FuncData = make([]FuncData, r.readInt())\n\t\t\tfor i := range f.FuncData {\n\t\t\t\tf.FuncData[i].Sym = r.readSymID()\n\t\t\t}\n\t\t\tfor i := range f.FuncData {\n\t\t\t\tf.FuncData[i].Offset = int64(r.readInt()) // TODO\n\t\t\t}\n\t\t\tf.File = make([]string, r.readInt())\n\t\t\tfor i := range f.File {\n\t\t\t\tf.File[i] = r.readSymID().Name\n\t\t\t}\n\t\t}\n\t}\n\n\tr.readFull(r.tmp[:7])\n\tif !bytes.Equal(r.tmp[:7], []byte(\"\\xffgo13ld\")) {\n\t\treturn r.error(errCorruptObject)\n\t}\n\n\treturn nil\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 listObjectsV2InArchive(ctx context.Context, objectAPI ObjectLayer, bucket, prefix, token, delimiter string, maxKeys int, fetchOwner bool, startAfter string) (ListObjectsV2Info, error) {\n\tzipPath, _, err := splitZipExtensionPath(prefix)\n\tif err != nil {\n\t\t// Return empty listing\n\t\treturn ListObjectsV2Info{}, nil\n\t}\n\n\tzipObjInfo, err := objectAPI.GetObjectInfo(ctx, bucket, zipPath, ObjectOptions{})\n\tif err != nil {\n\t\t// Return empty listing\n\t\treturn ListObjectsV2Info{}, nil\n\t}\n\n\tvar zipInfo []byte\n\n\tif z, ok := zipObjInfo.UserDefined[archiveInfoMetadataKey]; ok {\n\t\tzipInfo = []byte(z)\n\t} else {\n\t\t// Always update the latest version\n\t\tzipInfo, err = updateObjectMetadataWithZipInfo(ctx, objectAPI, bucket, zipPath, ObjectOptions{})\n\t}\n\n\tif err != nil {\n\t\treturn ListObjectsV2Info{}, err\n\t}\n\n\tfiles, err := zipindex.DeserializeFiles(zipInfo)\n\tif err != nil {\n\t\treturn ListObjectsV2Info{}, err\n\t}\n\n\tsort.Slice(files, func(i, j int) bool {\n\t\treturn files[i].Name < files[j].Name\n\t})\n\n\tvar (\n\t\tcount int\n\t\tisTruncated bool\n\t\tnextToken string\n\t\tlistObjectsInfo ListObjectsV2Info\n\t)\n\n\t// Always set this\n\tlistObjectsInfo.ContinuationToken = token\n\n\t// Open and iterate through the files in the archive.\n\tfor _, file := range files {\n\t\tobjName := zipObjInfo.Name + archiveSeparator + file.Name\n\t\tif objName <= startAfter || objName <= token {\n\t\t\tcontinue\n\t\t}\n\t\tif strings.HasPrefix(objName, prefix) {\n\t\t\tif count == maxKeys {\n\t\t\t\tisTruncated = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif delimiter != \"\" {\n\t\t\t\ti := strings.Index(objName[len(prefix):], delimiter)\n\t\t\t\tif i >= 0 {\n\t\t\t\t\tcommonPrefix := objName[:len(prefix)+i+1]\n\t\t\t\t\tif len(listObjectsInfo.Prefixes) == 0 || commonPrefix != listObjectsInfo.Prefixes[len(listObjectsInfo.Prefixes)-1] {\n\t\t\t\t\t\tlistObjectsInfo.Prefixes = append(listObjectsInfo.Prefixes, commonPrefix)\n\t\t\t\t\t\tcount++\n\t\t\t\t\t}\n\t\t\t\t\tgoto next\n\t\t\t\t}\n\t\t\t}\n\t\t\tlistObjectsInfo.Objects = append(listObjectsInfo.Objects, ObjectInfo{\n\t\t\t\tBucket: bucket,\n\t\t\t\tName: objName,\n\t\t\t\tSize: int64(file.UncompressedSize64),\n\t\t\t\tModTime: zipObjInfo.ModTime,\n\t\t\t})\n\t\t\tcount++\n\t\t}\n\tnext:\n\t\tnextToken = objName\n\t}\n\n\tif isTruncated {\n\t\tlistObjectsInfo.IsTruncated = true\n\t\tlistObjectsInfo.NextContinuationToken = nextToken\n\t}\n\n\treturn listObjectsInfo, nil\n}", "func (fsync *FuseFsyncIn) 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, fsync)\n\n\treturn err\n}", "func (r *objReader) parseObject(o *GoObj, size int64) error {\n\th := make([]byte, 0, 256)\n\tvar c1, c2, c3 byte\n\tfor {\n\t\tc1, c2, c3 = c2, c3, r.readByte()\n\t\th = append(h, c3)\n\t\t// The new export format can contain 0 bytes.\n\t\t// Don't consider them errors, only look for r.err != nil.\n\t\tif r.err != nil {\n\t\t\treturn errCorruptObject\n\t\t}\n\t\tif c1 == '\\n' && c2 == '!' && c3 == '\\n' {\n\t\t\tbreak\n\t\t}\n\t}\n\to.TextHeader = h\n\ths := strings.Fields(string(h))\n\tif len(hs) >= 4 {\n\t\to.Arch = hs[3]\n\t}\n\to.Offset = r.offset\n\to.Size = size - int64(len(h))\n\n\tp, err := r.peek(8)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !bytes.Equal(p, []byte(goobj.Magic)) {\n\t\tif bytes.HasPrefix(p, []byte(\"\\x00go1\")) && bytes.HasSuffix(p, []byte(\"ld\")) {\n\t\t\treturn r.error(ErrGoObjOtherVersion{p[1:]}) // strip the \\x00 byte\n\t\t}\n\t\treturn r.error(errCorruptObject)\n\t}\n\tr.skip(o.Size)\n\treturn nil\n}", "func (t *Tgz) Unarchive(r io.Reader, handler FileHandler) error {\n\tif r == nil {\n\t\treturn errors.New(\"gzip reader is nil\")\n\t}\n\n\tgzReader, err := gzip.NewReader(r)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttarReader := tar.NewReader(gzReader)\n\n\tfor {\n\t\theader, err := tarReader.Next()\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tname := header.Name\n\n\t\tswitch header.Typeflag {\n\t\tcase tar.TypeReg:\n\t\t\ttf := &File{\n\t\t\t\tName: name,\n\t\t\t\tReader: tarReader,\n\t\t\t}\n\n\t\t\tif err = handler(tf); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tdefault:\n\t\t\t// noop\n\t\t}\n\t}\n\treturn nil\n}", "func (link *FuseLinkIn) 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[:8], &link.OldNodeid)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlink.NewName = string(bcontent[8 : length-1])\n\n\treturn nil\n}", "func CmdArchive(defaultAuthOpts auth.Options) *subcommands.Command {\n\treturn &subcommands.Command{\n\t\tUsageLine: \"archive <options>\",\n\t\tShortDesc: \"parses a .isolate file and uploads all referenced files to a CAS server\",\n\t\tLongDesc: \"All the files referenced from .isolate are put in the CAS server cache.\",\n\t\tCommandRun: func() subcommands.CommandRun {\n\t\t\tc := archiveRun{}\n\t\t\tc.commonServerFlags.Init(defaultAuthOpts)\n\t\t\tc.isolateFlags.Init(&c.Flags)\n\t\t\tc.casFlags.Init(&c.Flags)\n\t\t\tc.Flags.StringVar(&c.dumpJSON, \"dump-json\", \"\",\n\t\t\t\t\"Write isolated digests of archived trees to this file as JSON\")\n\t\t\treturn &c\n\t\t},\n\t}\n}", "func parseMetadata(dir string) (*PostMetadata, error) {\n\tfileList, err := ioutil.ReadDir(dir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Look for metadata files, there should be exactly one\n\tmetaFiles := make([]string, 0)\n\tfor _, file := range fileList {\n\t\tif isMetadataFile(file.Name()) {\n\t\t\tmetaFiles = append(metaFiles, file.Name())\n\t\t}\n\t}\n\n\tif len(metaFiles) > 1 {\n\t\treturn nil, fmt.Errorf(\"Found multiple metadata files in '%v'\", dir)\n\t} else if len(metaFiles) == 0 {\n\t\treturn nil, fmt.Errorf(\"No metadata files found in '%v'\", dir)\n\t}\n\n\tmetaFile := metaFiles[0]\n\tfileExt := filepath.Ext(metaFile)\n\n\tfullPath := filepath.Join(dir, metaFile)\n\tdata, err := ioutil.ReadFile(fullPath)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trawMetadata := &rawPostMetadata{}\n\tif fileExt == \".json\" {\n\t\terr = json.Unmarshal(data, rawMetadata)\n\t} else if fileExt == \".yaml\" || fileExt == \".yml\" {\n\t\terr = yaml.Unmarshal(data, rawMetadata)\n\t} else {\n\t\tlog.Fatalf(\"Got unknown metadata file extension '%v'\", fileExt)\n\t}\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to parse metadata '%v': \"+err.Error(), fullPath)\n\t}\n\n\tmetadata, err := processRawMetadata(rawMetadata)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to parse metadata '%v': \"+err.Error(), fullPath)\n\t}\n\n\treturn metadata, nil\n}", "func (init *FuseInitIn) ParseBinary(bcontent []byte) error {\n\terr := common.ParseBinary(bcontent, init)\n\n\treturn err\n}", "func Unpack(r io.Reader) ([]File, error) {\n\tb, err := io.ReadAll(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tswitch {\n\tcase match(zipMagic, b[:len(zipMagic)]):\n\t\treturn unpackZip(b)\n\tcase match(tarMagic, b[:len(tarMagic)]):\n\t\treturn unpackTar(b)\n\tdefault:\n\t\treturn nil, errors.New(\"unsupport file format\")\n\t}\n}", "func parseObjects(inFile io.Reader) ([]*Object, error) {\n\tvar objects []*Object\n\n\tin := bufio.NewReader(inFile)\n\tvar lineNo int\n\n\t// Discard anything prior to the license block.\n\tfor line, eof := getLine(in, &lineNo); !eof; line, eof = getLine(in, &lineNo) {\n\t\tif strings.Contains(line, \"This Source Code\") {\n\t\t\tbreak\n\t\t}\n\t}\n\t// Now collect the license block.\n\t// certdata.txt from hg.mozilla.org no longer contains CVS_ID.\n\tfor line, eof := getLine(in, &lineNo); !eof; line, eof = getLine(in, &lineNo) {\n\t\tif strings.Contains(line, \"CVS_ID\") || len(line) == 0 {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tvar currentObject *Object\n\tvar beginData bool\n\n\tfor line, eof := getLine(in, &lineNo); !eof; line, eof = getLine(in, &lineNo) {\n\t\tif len(line) == 0 || line[0] == '#' {\n\t\t\tcontinue\n\t\t}\n\n\t\tif strings.HasPrefix(line, \"CVS_ID \") {\n\t\t\tcontinue\n\t\t}\n\t\tif line == \"BEGINDATA\" {\n\t\t\tbeginData = true\n\t\t\tcontinue\n\t\t}\n\n\t\twords := strings.Fields(line)\n\t\tvar value []byte\n\t\tif len(words) == 2 && words[1] == \"MULTILINE_OCTAL\" {\n\t\t\tstartingLine := lineNo\n\t\t\tvar ok bool\n\t\t\tvalue, ok = readMultilineOctal(in, &lineNo)\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"Failed to read octal value starting at line %d\", startingLine)\n\t\t\t}\n\t\t} else if len(words) < 3 {\n\t\t\treturn nil, fmt.Errorf(\"Expected three or more values on line %d, but found %d\", lineNo, len(words))\n\t\t} else {\n\t\t\tvalue = []byte(strings.Join(words[2:], \" \"))\n\t\t}\n\n\t\tif words[0] == \"CKA_CLASS\" {\n\t\t\t// Start of a new object.\n\t\t\tif currentObject != nil {\n\t\t\t\tobjects = append(objects, currentObject)\n\t\t\t}\n\t\t\tcurrentObject = new(Object)\n\t\t\tcurrentObject.attrs = make(map[string]Attribute)\n\t\t\tcurrentObject.startingLine = lineNo\n\t\t}\n\t\tif currentObject == nil {\n\t\t\treturn nil, fmt.Errorf(\"Found attribute on line %d which appears to be outside of an object\", lineNo)\n\t\t}\n\t\tcurrentObject.attrs[words[0]] = Attribute{\n\t\t\tattrType: words[1],\n\t\t\tvalue: value,\n\t\t}\n\t}\n\n\tif !beginData {\n\t\treturn nil, fmt.Errorf(\"Read whole input and failed to find BEGINDATA\")\n\t}\n\n\tif currentObject != nil {\n\t\tobjects = append(objects, currentObject)\n\t}\n\n\treturn objects, nil\n}", "func (lookup *FuseLookupIn) ParseBinary(bcontent []byte) error {\n\tlength := len(bcontent)\n\n\tif length > 0 {\n\t\t// avoid '\\0'\n\t\tlookup.Name = string(bcontent[:length-1])\n\t}\n\n\treturn nil\n}", "func ImportArchive(zipPath, modName string) (err error) {\n\terr = archiver.Unarchive(zipPath, filepath.Join(instance.WadDir, modName))\n\treturn\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 parseControl(db *Database, buf bytes.Buffer) (*PackageInfo, error) {\n\n\t// The control.tar archive contains the most important files\n\t// we need to install the package.\n\t// We need to extract metadata from the control file, determine\n\t// if the package contains conffiles and maintainer scripts.\n\n\tpkg := PackageInfo{\n\t\tMaintainerScripts: make(map[string]string),\n\t\tStatus: \"not-installed\",\n\t\tStatusDirty: true,\n\t}\n\n\ttr := tar.NewReader(&buf)\n\n\tfor {\n\t\thdr, err := tr.Next()\n\t\tif err == io.EOF {\n\t\t\tbreak // End of archive\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// Read the file content\n\t\tvar buf bytes.Buffer\n\t\tif _, err := io.Copy(&buf, tr); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tswitch filepath.Base(hdr.Name) {\n\t\tcase \"control\":\n\t\t\tparser, _ := deb822.NewParser(strings.NewReader(buf.String()))\n\t\t\tdocument, _ := parser.Parse()\n\t\t\tcontrolParagraph := document.Paragraphs[0]\n\n\t\t\t// Copy control fields and add the Status field in second position\n\t\t\tpkg.Paragraph = deb822.Paragraph{\n\t\t\t\tValues: make(map[string]string),\n\t\t\t}\n\n\t\t\t// Make sure the field \"Package' comes first, then \"Status\",\n\t\t\t// then remaining fields.\n\t\t\tpkg.Paragraph.Order = append(\n\t\t\t\tpkg.Paragraph.Order, \"Package\", \"Status\")\n\t\t\tpkg.Paragraph.Values[\"Package\"] = controlParagraph.Value(\"Package\")\n\t\t\tpkg.Paragraph.Values[\"Status\"] = \"install ok non-installed\"\n\t\t\tfor _, field := range controlParagraph.Order {\n\t\t\t\tif field == \"Package\" {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tpkg.Paragraph.Order = append(pkg.Paragraph.Order, field)\n\t\t\t\tpkg.Paragraph.Values[field] = controlParagraph.Value(field)\n\t\t\t}\n\t\tcase \"conffiles\":\n\t\t\tpkg.Conffiles = SplitLines(buf.String())\n\t\tcase \"prerm\":\n\t\t\tfallthrough\n\t\tcase \"preinst\":\n\t\t\tfallthrough\n\t\tcase \"postinst\":\n\t\t\tfallthrough\n\t\tcase \"postrm\":\n\t\t\tpkg.MaintainerScripts[filepath.Base(hdr.Name)] = buf.String()\n\t\t}\n\t}\n\n\treturn &pkg, nil\n}", "func Unarchive(reader io.ReaderAt, readerSize int64, outFilePath string, progress ProgressFunc) (err error) {\n\tvar zipReader *zip.Reader\n\tvar j int\n\n\tzipReader, err = zip.NewReader(reader, readerSize)\n\tif err == nil {\n\t\tfor j = 0; j < len(zipReader.File) && err == nil; j++ {\n\t\t\terr = unarchiveFile(zipReader.File[j], outFilePath, progress)\n\t\t}\n\n\t}\n\treturn\n}", "func unarch(afile, target string) error {\n\tlog.WithFields(log.Fields{\"func\": \"restore.unarch\"}).Debug(fmt.Sprintf(\"Unpacking %s into %s\", afile, target))\n\terr := zip.UnarchiveFile(afile, target, func(apath string) {\n\t\tlog.WithFields(log.Fields{\"func\": \"restore.unarch\"}).Debug(fmt.Sprintf(\"%s\", apath))\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Can't unpack archive: %s\", err)\n\t}\n\treturn nil\n}", "func untarHandler(tarArchive io.Reader, dest string, options *archive.TarOptions, decompress bool, root string) error {\n\tif tarArchive == nil {\n\t\treturn fmt.Errorf(\"empty archive\")\n\t}\n\tif options == nil {\n\t\toptions = &archive.TarOptions{}\n\t\toptions.InUserNS = unshare.IsRootless()\n\t}\n\tif options.ExcludePatterns == nil {\n\t\toptions.ExcludePatterns = []string{}\n\t}\n\n\tidMappings := idtools.NewIDMappingsFromMaps(options.UIDMaps, options.GIDMaps)\n\trootIDs := idMappings.RootPair()\n\n\tdest = filepath.Clean(dest)\n\tif _, err := os.Stat(dest); os.IsNotExist(err) {\n\t\tif err := idtools.MkdirAllAndChownNew(dest, 0o755, rootIDs); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tr := tarArchive\n\tif decompress {\n\t\tdecompressedArchive, err := archive.DecompressStream(tarArchive)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer decompressedArchive.Close()\n\t\tr = decompressedArchive\n\t}\n\n\treturn invokeUnpack(r, dest, options, root)\n}", "func untar(path string, stream io.Reader) {\n\treader := tar.NewReader(stream)\n\tfor {\n\t\theader, err := reader.Next()\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t\tworkResult <- WorkResult{path, header.Name}\n\t}\n}", "func isArchiveFormatRar(archivePath string, password string) error {\n\treadCloser, err := rardecode.OpenReader(archivePath, password)\n\tif err == nil {\n\t\t_ = readCloser.Close()\n\t}\n\treturn err\n}", "func Parse(r io.ReadSeeker, pkgpath string) (*Package, error) {\n\tif pkgpath == \"\" {\n\t\tpkgpath = `\"\"`\n\t}\n\tp := new(Package)\n\tp.ImportPath = pkgpath\n\n\tvar rd objReader\n\trd.init(r, p)\n\terr := rd.readFull(rd.tmp[:8])\n\tif err != nil {\n\t\tif err == io.EOF {\n\t\t\terr = io.ErrUnexpectedEOF\n\t\t}\n\t\treturn nil, err\n\t}\n\n\tswitch {\n\tdefault:\n\t\treturn nil, errNotObject\n\n\tcase bytes.Equal(rd.tmp[:8], archiveHeader):\n\t\tif err := rd.parseArchive(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\tcase bytes.Equal(rd.tmp[:8], goobjHeader):\n\t\tif err := rd.parseObject(goobjHeader); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn p, nil\n}", "func isArchiveFormatZip(archivePath string) error {\n\treadCloser, err := zip.OpenReader(archivePath)\n\tif err == nil {\n\t\t_ = readCloser.Close()\n\t}\n\treturn err\n}", "func Parse(r io.ReaderAt) (*File, error) {\n\tfor _, format := range formats {\n\t\tbuf := make([]byte, len(format.magic))\n\t\tif n, err := r.ReadAt(buf, 0); err != nil {\n\t\t\tif errors.Cause(err) == io.EOF && n < len(format.magic) {\n\t\t\t\twarn.Printf(\"skip %q format (read %d of %d bytes required for magic identification)\", format.name, n, len(format.magic))\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn nil, errors.WithStack(err)\n\t\t}\n\t\tif match(format.magic, buf) {\n\t\t\treturn format.parse(r)\n\t\t}\n\t}\n\treturn nil, errors.New(\"unknown binary executable format;\\ntip: remember to register a file format (e.g. import _ \\\".../bin/pe\\\")\\n\\ttip: try loading as raw binary executable\")\n}", "func parseDirectory(rawjson []byte) ([]byte, error) {\n\tauthz := make(map[string][]string)\n\terr := json.Unmarshal(rawjson, &authz)\n\tif err != nil {\n\t\treturn []byte(\"\"), err\n\t}\n\tvar userauth map[string]string\n\tdirectory := make(map[string]map[string]string)\n\tfor k, v := range authz {\n\t\tuserauth = make(map[string]string)\n\t\tif k != \"aliases\" && k != \"groups\" {\n\t\t\tfor _, authrow := range v {\n\t\t\t\ttrim := strings.TrimSpace(string(authrow))\n\t\t\t\tsplit := strings.SplitN(trim, \"=\", 2)\n\t\t\t\tuserauth[split[0]] = split[1]\n\t\t\t}\n\t\t\tdirectory[k] = userauth\n\t\t}\n\t}\n\tdirectoryjson, err := json.Marshal(directory)\n\tif err != nil {\n\t\treturn []byte(\"\"), err\n\t}\n\treturn directoryjson, nil\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 (t *SomeTar) ParseFlags(call []string, errPipe io.Writer) (error, int) {\n\tflagSet := uggo.NewFlagSetDefault(\"tar\", \"[option...] [FILE...]\", someutils.VERSION)\n\tflagSet.SetOutput(errPipe)\n\tflagSet.AliasedBoolVar(&t.IsCreate, []string{\"c\", \"create\"}, false, \"create a new archive\")\n\tflagSet.AliasedBoolVar(&t.IsAppend, []string{\"r\", \"append\"}, false, \"append files to the end of an archive\")\n\tflagSet.AliasedBoolVar(&t.IsList, []string{\"t\", \"list\"}, false, \"list the contents of an archive\")\n\tflagSet.AliasedBoolVar(&t.IsExtract, []string{\"x\", \"extract\", \"get\"}, false, \"extract files from an archive\")\n\tflagSet.AliasedBoolVar(&t.IsVerbose, []string{\"v\", \"verbose\"}, false, \"verbosely list files processed\")\n\tflagSet.AliasedStringVar(&t.ArchiveFilename, []string{\"f\", \"file\"}, \"\", \"use given archive file or device\")\n\n\terr, code := flagSet.ParsePlus(call[1:])\n\tif err != nil {\n\t\treturn err, code\n\t}\n\n\tif countTrue(t.IsCreate, t.IsAppend, t.IsList, t.IsExtract) != 1 {\n\t\treturn errors.New(\"You must use *one* of -c, -t, -x, -r (create, list, extract or append), plus -f\"), 1\n\t}\n\tt.args = flagSet.Args()\n\n\treturn nil, 0\n}", "func archiveFiles(files []string, archive string) error {\n\tflags := os.O_WRONLY | os.O_CREATE | os.O_TRUNC\n\t// Open the tar file\n\tfile, err := os.OpenFile(archive, flags, 0644)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer file.Close()\n\t// Create zip.Writer that implements a zip file writer.\n\tzw := zip.NewWriter(file)\n\tdefer zw.Close()\n\t// Iterate through the files to write each file into the zip file.\n\tfor _, filename := range files {\n\t\t// Write the file into tar file.\n\t\tif err := addToArchive(filename, zw); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "func Open(r io.ReaderAt) (*Archive, error) {\n\tmagic := make([]byte, MagicLength)\n\tif num, err := r.ReadAt(magic, 0); err != nil {\n\t\treturn nil, err\n\t} else if num < MagicLength || strings.Compare(string(magic), \"KAR\\x00\") != 0 {\n\t\treturn nil, ErrFileFormat\n\t}\n\n\theaderSizeBytes := make([]byte, HeaderSizeNumberLength)\n\tif num, err := r.ReadAt(headerSizeBytes, MagicLength); err != nil {\n\t\treturn nil, err\n\t} else if num < HeaderSizeNumberLength {\n\t\treturn nil, ErrFileFormat\n\t}\n\n\theaderSize, err := binaryToint64(headerSizeBytes)\n\tif err != nil {\n\t\treturn nil, ErrFileFormat\n\t}\n\n\theaderBytes := make([]byte, headerSize)\n\tif num, err := r.ReadAt(headerBytes, MagicLength+HeaderSizeNumberLength); err != nil {\n\t\treturn nil, err\n\t} else if int64(num) < headerSize {\n\t\treturn nil, ErrFileFormat\n\t}\n\n\tvar header Header\n\tif err := gobDecode(&header, headerBytes); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Archive{\n\t\treader: r,\n\t\theader: header,\n\t}, nil\n}", "func apiArchiveCreate(\n\tctx *ApiContext, req *http.Request, params httprouter.Params,\n) *ApiResponse {\n\tcollectionId := params.ByName(\"collection\")\n\tcollection, err := ctx.Repository.Use(collectionId)\n\tif err != nil {\n\t\treturn JsonError(err, 500)\n\t}\n\n\tkey := params.ByName(\"id\") // Routing demands a rename here\n\tif key == \"\" {\n\t\treturn JsonError(\"Missing parameter: key\", 500)\n\t}\n\n\tarchive, err := collection.NextArchive(\"API created archive\")\n\tif err != nil {\n\t\treturn JsonError(err, 500)\n\t}\n\n\t// Retrieve body\n\tbody, err := ioutil.ReadAll(req.Body)\n\tif err != nil {\n\t\treturn JsonError(err, 500)\n\t}\n\n\terr = archive.Put(key, body, \"initial upload\")\n\tif err != nil {\n\t\treturn JsonError(err, 500)\n\t}\n\n\tdocuments, err := archive.Documents()\n\tif err != nil {\n\t\treturn JsonError(err, 500)\n\t}\n\n\treturn JsonSuccess(Archive{\n\t\tId: archive.Id,\n\t\tDocuments: documents,\n\t})\n}", "func isTarArchive(r io.Reader) bool {\n\ttarReader := tar.NewReader(r)\n\t_, err := tarReader.Next()\n\treturn err == nil\n}", "func ParseEPUB(zipReader *zip.Reader) (*EPUB, error) {\n\tbook := new(EPUB)\n\tbook.Files = make(map[string]*zip.File)\n\tbook.RootFiles = make(map[string]*RootFileXml)\n\tfor _, f := range zipReader.File {\n\t\tbook.Files[f.Name] = f\n\t\tif f.Name == \"mimetype\" {\n\t\t\tfmt.Printf(\"Found mimeType\\n\")\n\t\t\tmimeType, err := ReadAllFileFromZip(f)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tbook.MimeType = mimeType\n\t\t} else if f.Name == \"META-INF/container.xml\" {\n\t\t\tct, err := ParseContainerFile(f)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tbook.Container = ct\n\t\t}\n\t}\n\n\tif book.Container != nil {\n\t\tfor _, rootFile := range book.Container.RootFiles.RootFiles {\n\t\t\tfmt.Println(\"Parsing\", rootFile.FullPath)\n\t\t\tfile, ok := book.Files[rootFile.FullPath]\n\t\t\tif ok {\n\t\t\t\trf, err := ParseRootFile(file)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tbook.RootFiles[rootFile.FullPath] = rf\n\t\t\t}\n\t\t}\n\t}\n\treturn book, nil\n}", "func NewArchive(stream io.Reader, closer func()) *Archive {\n\treturn &Archive{stream: stream, closer: closer}\n}", "func Parser(input, output string, unsorted bool) (err error) {\n\tfile, err := ReadFile(input)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\theader, body, err := ReadContent(file)\n\tif err != nil {\n\t\tfmt.Printf(\"fail when reading input file: %v\\n\", err)\n\t\treturn err\n\t}\n\n\tfileName := file.Name()\n\t// Close file to avoid crash when sort file content\n\tfile.Close()\n\n\t// sort content by key\n\tif !unsorted {\n\t\terr = sortInputFile(fileName, header, body)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"fail when sorting input file: %v\\n\", err)\n\t\t\treturn err\n\t\t}\n\t}\n\n\tvar mapList = make(map[string]map[string]string)\n\tfor i := 1; i < len(header); i++ {\n\t\tvar tempMap = make(map[string]string)\n\t\tfor j := 0; j < len(body); j++ {\n\t\t\ttempMap[body[j][0]] = body[j][i]\n\t\t}\n\t\tmapList[header[i]] = tempMap\n\t}\n\n\tfor k, v := range mapList {\n\t\tdata, err := jsonMarshal(v, true)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tvar out bytes.Buffer\n\t\tjson.Indent(&out, data, \"\", \"\\t\")\n\n\t\toutputFile, err := os.Create(path.Join(\"./\", k+\".json\"))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tout.WriteTo(outputFile)\n\t}\n\treturn nil\n}", "func listArchive() {\n files, err := ioutil.ReadDir(settings.PATH_ARCHIVE)\n utils.CheckError(err)\n\n fmt.Printf(\"| %s:\\n\", settings.User.Hash)\n for _, file := range files {\n fmt.Println(\"|\", file.Name())\n }\n}", "func (lseek *FuseLseekIn) 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, lseek)\n\n\treturn err\n}", "func (lk *FuseLkIn) ParseBinary(bcontent []byte) error {\n\n\tlength := len(bcontent)\n\n\tif length < 48 {\n\t\treturn ErrDataLen\n\t}\n\n\tcommon.ParseBinary(bcontent, lk)\n\n\treturn nil\n}", "func (fallocate *FuseFallocateIn) ParseBinary(bcontent []byte) error {\n\n\tlength := len(bcontent)\n\n\tif length < 32 {\n\t\treturn ErrDataLen\n\t}\n\n\terr := common.ParseBinary(bcontent, fallocate)\n\n\treturn err\n}", "func generateArchive(files map[string][]byte) (io.Reader, error) {\n\tr, w := io.Pipe()\n\ttw := tar.NewWriter(w)\n\n\tgo func() {\n\t\tfor p, c := range files {\n\t\t\tlog.Infof(\"Copying file %v in container for verification..\", p)\n\t\t\thdr := &tar.Header{\n\t\t\t\tName: p,\n\t\t\t\tMode: 0644,\n\t\t\t\tSize: int64(len(c)),\n\t\t\t}\n\n\t\t\ttw.WriteHeader(hdr)\n\t\t\ttw.Write(c)\n\t\t}\n\t\tw.Close()\n\t}()\n\n\treturn r, nil\n}", "func parseBinaryBlob(blob []byte) (*Digest, error) {\n\t// Read a single item from the binary stream. Timeout after\n\t// five seconds because it shouldn't take that long to parse\n\t// a blob that is already loaded into memory.\n\tch := parseBinaryStream(bytes.NewReader(blob))\n\tselect {\n\tcase out := <-ch:\n\t\treturn out.Digest, out.Error\n\tcase <-time.After(5 * time.Second):\n\t\treturn nil, errors.New(\"timed out waiting for parser to finish\")\n\t}\n}", "func buildArchive() error {\n\tfiles, err := retreiveFiles()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif compressFiles(files) != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func ConvertPages(r io.Reader) (string, map[string]string, error) {\n\tmeta := make(map[string]string)\n\tvar textBody string\n\n\tb, err := ioutil.ReadAll(io.LimitReader(r, maxBytes))\n\tif err != nil {\n\t\treturn \"\", nil, fmt.Errorf(\"error reading data: %v\", err)\n\t}\n\n\tzr, err := zip.NewReader(bytes.NewReader(b), int64(len(b)))\n\tif err != nil {\n\t\treturn \"\", nil, fmt.Errorf(\"error unzipping data: %v\", err)\n\t}\n\n\tfor _, f := range zr.File {\n\t\tif strings.HasSuffix(f.Name, \"Preview.pdf\") {\n\t\t\t// There is a preview PDF version we can use\n\t\t\tif rc, err := f.Open(); err == nil {\n\t\t\t\treturn ConvertPDF(rc)\n\t\t\t}\n\t\t}\n\t\tif f.Name == \"index.xml\" {\n\t\t\t// There's an XML version we can use\n\t\t\tif rc, err := f.Open(); err == nil {\n\t\t\t\treturn ConvertXML(rc)\n\t\t\t}\n\t\t}\n\t\tif f.Name == \"Index/Document.iwa\" {\n\t\t\trc, _ := f.Open()\n\t\t\tdefer rc.Close()\n\t\t\tbReader := bufio.NewReader(snappy.NewReader(io.MultiReader(strings.NewReader(\"\\xff\\x06\\x00\\x00sNaPpY\"), rc)))\n\n\t\t\t// Ignore error.\n\t\t\t// NOTE: This error was unchecked. Need to revisit this to see if it\n\t\t\t// should be acted on.\n\t\t\tarchiveLength, _ := binary.ReadVarint(bReader)\n\n\t\t\t// Ignore error.\n\t\t\t// NOTE: This error was unchecked. Need to revisit this to see if it\n\t\t\t// should be acted on.\n\t\t\tarchiveInfoData, _ := ioutil.ReadAll(io.LimitReader(bReader, archiveLength))\n\n\t\t\tarchiveInfo := &TSP.ArchiveInfo{}\n\t\t\terr = proto.Unmarshal(archiveInfoData, archiveInfo)\n\t\t\tfmt.Println(\"archiveInfo:\", archiveInfo, err)\n\t\t}\n\t}\n\n\treturn textBody, meta, nil\n}", "func ListArchive(tarFile io.Reader) error {\n\treturn applyToArchive(tarFile, func(tr *tar.Reader, hdr *tar.Header) error {\n\t\tfmt.Println(hdr.Name)\n\t\treturn nil\n\t})\n}", "func (g *Generator) parsePackageDir(directory string) {\n\tlog.Printf(\"Collecting objects in package %s for parsing\", directory)\n\tpkg, err := build.Default.ImportDir(directory, 0)\n\tif err != nil {\n\t\tlog.Fatalf(\"cannot process directory %s: %s\", directory, err)\n\t}\n\tvar names []string\n\tnames = append(names, pkg.GoFiles...)\n\tnames = append(names, pkg.CgoFiles...)\n\t// TODO: Need to think about constants in test files. Maybe write type_string_test.go\n\t// in a separate pass? For later.\n\t// names = append(names, pkg.TestGoFiles...) // These are also in the \"foo\" package.\n\tnames = append(names, pkg.SFiles...)\n\tnames = prefixDirectory(directory, names)\n\tlog.Printf(\"Found object names: %+v\", names)\n\tg.parsePackage(directory, names, nil)\n}", "func parseBinary(s *scanner) ([]byte, error) {\n\tif s.eof() || s.data[s.off] != ':' {\n\t\treturn nil, &UnmarshalError{s.off, ErrInvalidBinaryFormat}\n\t}\n\ts.off++\n\n\tstart := s.off\n\n\tfor !s.eof() {\n\t\tc := s.data[s.off]\n\t\tif c == ':' {\n\t\t\t// base64decode\n\t\t\tdecoded, err := base64.StdEncoding.DecodeString(s.data[start:s.off])\n\t\t\tif err != nil {\n\t\t\t\treturn nil, &UnmarshalError{s.off, err}\n\t\t\t}\n\t\t\ts.off++\n\n\t\t\treturn decoded, nil\n\t\t}\n\n\t\tif !isAlpha(c) && !isDigit(c) && c != '+' && c != '/' && c != '=' {\n\t\t\treturn nil, &UnmarshalError{s.off, ErrInvalidBinaryFormat}\n\t\t}\n\t\ts.off++\n\t}\n\n\treturn nil, &UnmarshalError{s.off, ErrInvalidBinaryFormat}\n}", "func (h *Handler) processZip(zipPath string) {\n\tdefer h.SY.WG.Done()\n\tzr, err := zip.OpenReader(zipPath)\n\tif err != nil {\n\t\th.LOG.E.Printf(\"incorrect zip archive %s\\n\", zipPath)\n\t\th.moveFile(zipPath, err)\n\t\treturn\n\t}\n\tdefer zr.Close()\n\n\tfor _, file := range zr.File {\n\t\th.LOG.D.Print(ZipEntryInfo(file))\n\t\tif filepath.Ext(file.Name) != \".fb2\" {\n\t\t\th.LOG.E.Printf(\"file %s from %s has not FB2 format\\n\", file.Name, filepath.Base(zipPath))\n\t\t\tcontinue\n\t\t}\n\t\tif h.DB.IsInStock(file.Name, file.CRC32) {\n\t\t\th.LOG.I.Printf(\"file %s from %s is in stock already and has been skipped\\n\", file.Name, filepath.Base(zipPath))\n\t\t\tcontinue\n\t\t}\n\t\tif file.UncompressedSize == 0 {\n\t\t\th.LOG.E.Printf(\"file %s from %s has size of zero\\n\", file.Name, filepath.Base(zipPath))\n\t\t\tcontinue\n\t\t}\n\t\tf, _ := file.Open()\n\t\tvar p parser.Parser\n\t\tswitch filepath.Ext(file.Name) {\n\t\tcase \".fb2\":\n\t\t\tp, err = fb2.NewFB2(f)\n\t\t\tif err != nil {\n\t\t\t\th.LOG.I.Printf(\"file %s from %s has error: %s\\n\", file.Name, filepath.Base(zipPath), err.Error())\n\t\t\t\tf.Close()\n\t\t\t\tcontinue\n\t\t\t}\n\t\tdefault:\n\t\t\th.LOG.E.Printf(\"file %s has not supported format \\\"%s\\\"\\n\", file.Name, filepath.Ext(file.Name))\n\t\t}\n\t\th.LOG.D.Println(p)\n\t\tbook := &model.Book{\n\t\t\tFile: file.Name,\n\t\t\tCRC32: file.CRC32,\n\t\t\tArchive: filepath.Base(zipPath),\n\t\t\tSize: int64(file.UncompressedSize),\n\t\t\tFormat: p.GetFormat(),\n\t\t\tTitle: p.GetTitle(),\n\t\t\tSort: p.GetSort(),\n\t\t\tYear: p.GetYear(),\n\t\t\tPlot: p.GetPlot(),\n\t\t\tCover: p.GetCover(),\n\t\t\tLanguage: p.GetLanguage(),\n\t\t\tAuthors: p.GetAuthors(),\n\t\t\tGenres: p.GetGenres(),\n\t\t\tSerie: p.GetSerie(),\n\t\t\tSerieNum: p.GetSerieNumber(),\n\t\t\tUpdated: time.Now().Unix(),\n\t\t}\n\t\tif !h.acceptLanguage(book.Language.Code) {\n\t\t\th.LOG.E.Printf(\"publication language \\\"%s\\\" is not accepted, file %s from %s has been skipped\\n\", book.Language.Code, file.Name, filepath.Base(zipPath))\n\t\t\tcontinue\n\t\t}\n\t\th.adjustGenges(book)\n\t\th.DB.NewBook(book)\n\t\tf.Close()\n\t\th.LOG.I.Printf(\"file %s from %s has been added\\n\", file.Name, filepath.Base(zipPath))\n\n\t\t// runtime.Gosched()\n\t}\n\th.moveFile(zipPath, nil)\n\t<-h.SY.Quota\n}", "func parseDirectoryHeader(b []byte) (*directoryHeader, error) {\n\tif len(b) < dirHeaderSize {\n\t\treturn nil, fmt.Errorf(\"Header was %d bytes, less than minimum %d\", len(b), dirHeaderSize)\n\t}\n\treturn &directoryHeader{\n\t\tcount: binary.LittleEndian.Uint32(b[0:4]) + 1,\n\t\tstartBlock: binary.LittleEndian.Uint32(b[4:8]),\n\t\tinode: binary.LittleEndian.Uint32(b[8:12]),\n\t}, nil\n}", "func getObject(c *cli.Context, bck cmn.Bck, objName, archpath, outFile string, silent, extract bool) (err error) {\n\tvar (\n\t\tgetArgs api.GetArgs\n\t\toah api.ObjAttrs\n\t\tunits string\n\t)\n\tif outFile == fileStdIO && extract {\n\t\treturn errors.New(\"cannot extract archived files to standard output - not implemented yet\")\n\t}\n\tif outFile == discardIO && extract {\n\t\treturn errors.New(\"cannot extract and discard archived files - not implemented yet\")\n\t}\n\tif flagIsSet(c, listArchFlag) && archpath == \"\" {\n\t\tif external, internal := splitPrefixShardBoundary(objName); len(internal) > 0 {\n\t\t\tobjName, archpath = external, internal\n\t\t}\n\t}\n\n\t// just check if a remote object is present (do not GET)\n\tif flagIsSet(c, checkObjCachedFlag) {\n\t\treturn isObjPresent(c, bck, objName)\n\t}\n\n\tvar offset, length int64\n\tunits, err = parseUnitsFlag(c, unitsFlag)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif offset, err = parseSizeFlag(c, offsetFlag, units); err != nil {\n\t\treturn\n\t}\n\tif length, err = parseSizeFlag(c, lengthFlag, units); err != nil {\n\t\treturn\n\t}\n\n\t// where to\n\tif outFile == \"\" {\n\t\t// archive\n\t\tif archpath != \"\" {\n\t\t\toutFile = filepath.Base(archpath)\n\t\t} else {\n\t\t\toutFile = filepath.Base(objName)\n\t\t}\n\t} else if outFile != fileStdIO && outFile != discardIO {\n\t\tfinfo, errEx := os.Stat(outFile)\n\t\tif errEx == nil {\n\t\t\tif !finfo.IsDir() && extract {\n\t\t\t\treturn fmt.Errorf(\"cannot extract archived files - destination %q exists and is not a directory\", outFile)\n\t\t\t}\n\t\t\t// destination is: directory | file (confirm overwrite)\n\t\t\tif finfo.IsDir() {\n\t\t\t\t// archive\n\t\t\t\tif archpath != \"\" {\n\t\t\t\t\toutFile = filepath.Join(outFile, filepath.Base(archpath))\n\t\t\t\t} else {\n\t\t\t\t\toutFile = filepath.Join(outFile, filepath.Base(objName))\n\t\t\t\t}\n\t\t\t\t// TODO: strictly speaking: fstat again and confirm if exists\n\t\t\t} else if finfo.Mode().IsRegular() && !flagIsSet(c, yesFlag) { // `/dev/null` is fine\n\t\t\t\twarn := fmt.Sprintf(\"overwrite existing %q\", outFile)\n\t\t\t\tif ok := confirm(c, warn); !ok {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\thdr := cmn.MakeRangeHdr(offset, length)\n\tif outFile == fileStdIO {\n\t\tgetArgs = api.GetArgs{Writer: os.Stdout, Header: hdr}\n\t\tsilent = true\n\t} else {\n\t\tvar file *os.File\n\t\tif file, err = os.Create(outFile); err != nil {\n\t\t\treturn\n\t\t}\n\t\tdefer func() {\n\t\t\tfile.Close()\n\t\t\tif err != nil {\n\t\t\t\tos.Remove(outFile)\n\t\t\t}\n\t\t}()\n\t\tgetArgs = api.GetArgs{Writer: file, Header: hdr}\n\t}\n\n\tif bck.IsHTTP() {\n\t\turi := c.Args().Get(0)\n\t\tgetArgs.Query = make(url.Values, 2)\n\t\tgetArgs.Query.Set(apc.QparamOrigURL, uri)\n\t}\n\t// TODO: validate\n\tif archpath != \"\" {\n\t\tif getArgs.Query == nil {\n\t\t\tgetArgs.Query = make(url.Values, 1)\n\t\t}\n\t\tgetArgs.Query.Set(apc.QparamArchpath, archpath)\n\t}\n\n\tif flagIsSet(c, cksumFlag) {\n\t\toah, err = api.GetObjectWithValidation(apiBP, bck, objName, &getArgs)\n\t} else {\n\t\toah, err = api.GetObject(apiBP, bck, objName, &getArgs)\n\t}\n\tif err != nil {\n\t\tif cmn.IsStatusNotFound(err) && archpath == \"\" {\n\t\t\terr = fmt.Errorf(\"%q does not exist\", bck.Cname(objName))\n\t\t}\n\t\treturn\n\t}\n\n\tvar (\n\t\tmime string\n\t\tobjLen = oah.Size()\n\t)\n\tif extract {\n\t\tmime, err = doExtract(objName, outFile, objLen)\n\t\tif err != nil {\n\t\t\tif configuredVerbosity() {\n\t\t\t\treturn fmt.Errorf(\"failed to extract %s (from local %q): %v\", bck.Cname(objName), outFile, err)\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"failed to extract %s: %v\", bck.Cname(objName), err)\n\t\t}\n\t}\n\n\tif silent {\n\t\treturn\n\t}\n\n\t//\n\t// print result - variations\n\t//\n\n\tvar (\n\t\tdiscard, out string\n\t\tsz = teb.FmtSize(objLen, units, 2)\n\t\tbn = bck.Cname(\"\")\n\t)\n\tswitch {\n\tcase outFile == discardIO:\n\t\tdiscard = \" (and discard)\"\n\tcase outFile == fileStdIO:\n\t\tout = \" to standard output\"\n\tcase extract:\n\t\tout = \" to \" + outFile\n\t\tif out[len(out)-1] == filepath.Separator {\n\t\t\tout = out[:len(out)-1]\n\t\t}\n\t\tout = strings.TrimSuffix(out, mime) + \"/\"\n\tdefault:\n\t\tout = \" as \" + outFile\n\t\tif out[len(out)-1] == filepath.Separator {\n\t\t\tout = out[:len(out)-1]\n\t\t}\n\t}\n\tswitch {\n\tcase flagIsSet(c, lengthFlag):\n\t\tfmt.Fprintf(c.App.Writer, \"Read%s range (length %s (%dB) at offset %d)%s\\n\", discard, sz, objLen, offset, out)\n\tcase archpath != \"\":\n\t\tfmt.Fprintf(c.App.Writer, \"GET%s %s from %s%s (%s)\\n\", discard, archpath, bck.Cname(objName), out, sz)\n\tcase extract:\n\t\tfmt.Fprintf(c.App.Writer, \"GET %s from %s as %q (%s) and extract%s\\n\", objName, bn, outFile, sz, out)\n\tdefault:\n\t\tfmt.Fprintf(c.App.Writer, \"GET%s %s from %s%s (%s)\\n\", discard, objName, bn, out, sz)\n\t}\n\treturn\n}", "func (read *FuseReadIn) ParseBinary(bcontent []byte) error {\n\n\tlength := len(bcontent)\n\n\tif length < 40 {\n\t\treturn ErrDataLen\n\t}\n\n\terr := common.ParseBinary(bcontent, read)\n\n\treturn err\n}", "func (a *Archive) Stream(processors ...ArchiveProcessor) error {\n\ttarball := tar.NewReader(a.stream)\n\n\t// If we don't eat the rest of the stream Docker 1.9+ seems to choke\n\tdefer func() {\n\t\tio.Copy(ioutil.Discard, a.stream)\n\t}()\n\n\tvar tarfile io.Reader\nEntryLoop:\n\tfor {\n\t\thdr, err := tarball.Next()\n\t\tif err == io.EOF {\n\t\t\t// finished the tar\n\t\t\tbreak\n\t\t}\n\t\t// basic filter, we never care about this entry\n\t\tif hdr.Name == \"./\" {\n\t\t\tcontinue EntryLoop\n\t\t}\n\n\t\ttarfile = tarball\n\t\tfor _, processor := range processors {\n\t\t\thdr, tarfile, err = processor.Process(hdr, tarfile)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t// if hdr is nil, skip this file\n\t\t\tif hdr == nil {\n\t\t\t\tcontinue EntryLoop\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func parseDirectory(virtualAddress uint32, data []byte) []Resource {\n\tentries, err := parseEntries(virtualAddress, \"\", data, data)\n\tif err != nil {\n\t\t// swallow the error and move on\n\t\treturn nil\n\t}\n\treturn entries\n}", "func walkArchiveZip(r io.ReaderAt, size int64, f WalkArchiveFunc) error {\n\tzipReader, err := zip.NewReader(r, size)\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar skippedDirPrefixes []string\n\tseenDirs := newSet[string]()\n\tprocessHeader := func(fileInfo fs.FileInfo, dir string) error {\n\t\tfor _, skippedDirPrefix := range skippedDirPrefixes {\n\t\t\tif strings.HasPrefix(dir, skippedDirPrefix) {\n\t\t\t\treturn fs.SkipDir\n\t\t\t}\n\t\t}\n\t\tif seenDirs.contains(dir) {\n\t\t\treturn nil\n\t\t}\n\t\tseenDirs.add(dir)\n\t\tname := strings.TrimSuffix(dir, \"/\")\n\t\tdirFileInfo := implicitDirHeader(dir, fileInfo.ModTime()).FileInfo()\n\t\tswitch err := f(name, dirFileInfo, nil, \"\"); {\n\t\tcase errors.Is(err, fs.SkipDir):\n\t\t\tskippedDirPrefixes = append(skippedDirPrefixes, dir)\n\t\t\treturn err\n\t\tcase err != nil:\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t}\nFILE:\n\tfor _, zipFile := range zipReader.File {\n\t\tzipFileReader, err := zipFile.Open()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tname := path.Clean(zipFile.Name)\n\t\tif strings.HasPrefix(name, \"../\") || strings.Contains(name, \"/../\") {\n\t\t\treturn fmt.Errorf(\"%s: invalid filename\", zipFile.Name)\n\t\t}\n\n\t\tfor _, skippedDirPrefix := range skippedDirPrefixes {\n\t\t\tif strings.HasPrefix(zipFile.Name, skippedDirPrefix) {\n\t\t\t\tcontinue FILE\n\t\t\t}\n\t\t}\n\n\t\tswitch fileInfo := zipFile.FileInfo(); fileInfo.Mode() & fs.ModeType {\n\t\tcase 0:\n\t\t\tdirs, _ := path.Split(name)\n\t\t\tdirComponents := strings.Split(strings.TrimSuffix(dirs, \"/\"), \"/\")\n\t\t\tfor i := range dirComponents {\n\t\t\t\tdir := strings.Join(dirComponents[0:i+1], \"/\")\n\t\t\t\tif len(dir) > 0 {\n\t\t\t\t\tswitch err := processHeader(fileInfo, dir+\"/\"); {\n\t\t\t\t\tcase errors.Is(err, fs.SkipDir):\n\t\t\t\t\t\tcontinue FILE\n\t\t\t\t\tcase errors.Is(err, fs.SkipAll):\n\t\t\t\t\t\treturn nil\n\t\t\t\t\tcase err != nil:\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\terr = f(name, fileInfo, zipFileReader, \"\")\n\t\tcase fs.ModeDir:\n\t\t\terr = processHeader(fileInfo, name+\"/\")\n\t\tcase fs.ModeSymlink:\n\t\t\tvar linknameBytes []byte\n\t\t\tlinknameBytes, err = io.ReadAll(zipFileReader)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\terr = f(name, fileInfo, nil, string(linknameBytes))\n\t\t}\n\n\t\terr2 := zipFileReader.Close()\n\n\t\tswitch {\n\t\tcase errors.Is(err, fs.SkipDir):\n\t\t\tskippedDirPrefixes = append(skippedDirPrefixes, zipFile.Name+\"/\")\n\t\tcase errors.Is(err, fs.SkipAll):\n\t\t\treturn nil\n\t\tcase err != nil:\n\t\t\treturn err\n\t\t}\n\n\t\tif err2 != nil {\n\t\t\treturn err2\n\t\t}\n\t}\n\treturn nil\n}", "func (mknod *FuseMknodIn) 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[0:4], &mknod.Mode)\n\tcommon.ParseBinary(bcontent[4:8], &mknod.Rdev)\n\tcommon.ParseBinary(bcontent[8:12], &mknod.Umask)\n\tcommon.ParseBinary(bcontent[12:16], &mknod.Padding)\n\n\tmknod.Name = string(bcontent[16 : length-1])\n\n\treturn nil\n}", "func UploadArchive(file string) (string, error) {\n\tf, err := os.Open(file)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer f.Close()\n\n\t// Prepare the file to upload by copying local archive in buffer.\n\tbody := &bytes.Buffer{}\n\twriter := multipart.NewWriter(body)\n\tfilename := filepath.Base(f.Name())\n\tpart, err := writer.CreateFormFile(\"file\", filename)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tio.Copy(part, f)\n\twriter.Close()\n\n\t// Prepare the request (URL, auth, headers)\n\turl := viper.GetString(\"smartFile.url\") + viper.GetString(\"smartFile.api.upload\") + viper.GetString(\"smartFile.folderName\")\n\tr, err := http.NewRequest(\"POST\", url, body)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tr.Close = true\n\tr.SetBasicAuth(viper.GetString(\"smartFile.keys.public\"), viper.GetString(\"smartFile.keys.private\"))\n\tr.Header.Add(\"Content-Type\", writer.FormDataContentType())\n\n\t// Execute the upload\n\tc := &http.Client{Timeout: time.Second * 20}\n\tresp, err := c.Do(r)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer resp.Body.Close()\n\n\t_, err = ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn viper.GetString(\"smartFile.folderName\") + \"/\" + filename, nil\n}", "func ManifestParser(infra dbChaosInfra.ChaosInfra, rootPath string, config *SubscriberConfigurations) ([]byte, error) {\n\tvar (\n\t\tgeneratedYAML []string\n\t\tdefaultState = false\n\t\tInfraNamespace string\n\t\tServiceAccountName string\n\t\tDefaultInfraNamespace = \"litmus\"\n\t\tDefaultServiceAccountName = \"litmus\"\n\t)\n\n\tif infra.InfraNsExists == nil {\n\t\tinfra.InfraNsExists = &defaultState\n\t}\n\tif infra.InfraSaExists == nil {\n\t\tinfra.InfraSaExists = &defaultState\n\t}\n\n\tif infra.InfraNamespace != nil && *infra.InfraNamespace != \"\" {\n\t\tInfraNamespace = *infra.InfraNamespace\n\t} else {\n\t\tInfraNamespace = DefaultInfraNamespace\n\t}\n\n\tif infra.ServiceAccount != nil && *infra.ServiceAccount != \"\" {\n\t\tServiceAccountName = *infra.ServiceAccount\n\t} else {\n\t\tServiceAccountName = DefaultServiceAccountName\n\t}\n\n\tskipSSL := \"false\"\n\tif infra.SkipSSL != nil && *infra.SkipSSL {\n\t\tskipSSL = \"true\"\n\t}\n\n\tvar (\n\t\tnamespaceConfig = \"---\\napiVersion: v1\\nkind: Namespace\\nmetadata:\\n name: \" + InfraNamespace + \"\\n\"\n\t\tserviceAccountStr = \"---\\napiVersion: v1\\nkind: ServiceAccount\\nmetadata:\\n name: \" + ServiceAccountName + \"\\n namespace: \" + InfraNamespace + \"\\n\"\n\t)\n\n\t// Checking if the agent namespace does not exist and its scope of installation is not namespaced\n\tif *infra.InfraNsExists == false && infra.InfraScope != \"namespace\" {\n\t\tgeneratedYAML = append(generatedYAML, fmt.Sprintf(namespaceConfig))\n\t}\n\n\tif *infra.InfraSaExists == false {\n\t\tgeneratedYAML = append(generatedYAML, fmt.Sprintf(serviceAccountStr))\n\t}\n\n\t// File operations\n\tfile, err := os.Open(rootPath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to open the file %v\", err)\n\t}\n\n\tdefer file.Close()\n\n\tlist, err := file.Readdirnames(0) // 0 to read all files and folders\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to read the file %v\", err)\n\t}\n\n\tvar nodeselector string\n\tif infra.NodeSelector != nil {\n\t\tselector := strings.Split(*infra.NodeSelector, \",\")\n\t\tselectorList := make(map[string]string)\n\t\tfor _, el := range selector {\n\t\t\tkv := strings.Split(el, \"=\")\n\t\t\tselectorList[kv[0]] = kv[1]\n\t\t}\n\n\t\tnodeSelector := struct {\n\t\t\tNodeSelector map[string]string `yaml:\"nodeSelector\" json:\"nodeSelector\"`\n\t\t}{\n\t\t\tNodeSelector: selectorList,\n\t\t}\n\n\t\tbyt, err := yaml.Marshal(nodeSelector)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to marshal the node selector %v\", err)\n\t\t}\n\n\t\tnodeselector = string(utils.AddRootIndent(byt, 6))\n\t}\n\n\tvar tolerations string\n\tif infra.Tolerations != nil {\n\t\tbyt, err := yaml.Marshal(struct {\n\t\t\tTolerations []*dbChaosInfra.Toleration `yaml:\"tolerations\" json:\"tolerations\"`\n\t\t}{\n\t\t\tTolerations: infra.Tolerations,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to marshal the tolerations %v\", err)\n\t\t}\n\n\t\ttolerations = string(utils.AddRootIndent(byt, 6))\n\t}\n\n\tfor _, fileName := range list {\n\t\tfileContent, err := ioutil.ReadFile(rootPath + \"/\" + fileName)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to read the file %v\", err)\n\t\t}\n\n\t\tvar newContent = string(fileContent)\n\n\t\tnewContent = strings.Replace(newContent, \"#{TOLERATIONS}\", tolerations, -1)\n\t\tnewContent = strings.Replace(newContent, \"#{INFRA_ID}\", infra.InfraID, -1)\n\t\tnewContent = strings.Replace(newContent, \"#{ACCESS_KEY}\", infra.AccessKey, -1)\n\t\tnewContent = strings.Replace(newContent, \"#{SERVER_ADDR}\", config.ServerEndpoint, -1)\n\t\tnewContent = strings.Replace(newContent, \"#{SUBSCRIBER_IMAGE}\", utils.Config.SubscriberImage, -1)\n\t\tnewContent = strings.Replace(newContent, \"#{EVENT_TRACKER_IMAGE}\", utils.Config.EventTrackerImage, -1)\n\t\tnewContent = strings.Replace(newContent, \"#{INFRA_NAMESPACE}\", InfraNamespace, -1)\n\t\tnewContent = strings.Replace(newContent, \"#{SUBSCRIBER_SERVICE_ACCOUNT}\", ServiceAccountName, -1)\n\t\tnewContent = strings.Replace(newContent, \"#{INFRA_SCOPE}\", infra.InfraScope, -1)\n\t\tnewContent = strings.Replace(newContent, \"#{ARGO_WORKFLOW_CONTROLLER}\", utils.Config.ArgoWorkflowControllerImage, -1)\n\t\tnewContent = strings.Replace(newContent, \"#{LITMUS_CHAOS_OPERATOR}\", utils.Config.LitmusChaosOperatorImage, -1)\n\t\tnewContent = strings.Replace(newContent, \"#{ARGO_WORKFLOW_EXECUTOR}\", utils.Config.ArgoWorkflowExecutorImage, -1)\n\t\tnewContent = strings.Replace(newContent, \"#{LITMUS_CHAOS_RUNNER}\", utils.Config.LitmusChaosRunnerImage, -1)\n\t\tnewContent = strings.Replace(newContent, \"#{LITMUS_CHAOS_EXPORTER}\", utils.Config.LitmusChaosExporterImage, -1)\n\t\tnewContent = strings.Replace(newContent, \"#{ARGO_CONTAINER_RUNTIME_EXECUTOR}\", utils.Config.ContainerRuntimeExecutor, -1)\n\t\tnewContent = strings.Replace(newContent, \"#{INFRA_DEPLOYMENTS}\", utils.Config.InfraDeployments, -1)\n\t\tnewContent = strings.Replace(newContent, \"#{VERSION}\", utils.Config.Version, -1)\n\t\tnewContent = strings.Replace(newContent, \"#{SKIP_SSL_VERIFY}\", skipSSL, -1)\n\t\tnewContent = strings.Replace(newContent, \"#{CUSTOM_TLS_CERT}\", config.TLSCert, -1)\n\n\t\tnewContent = strings.Replace(newContent, \"#{START_TIME}\", \"\\\"\"+infra.StartTime+\"\\\"\", -1)\n\t\tif infra.IsInfraConfirmed == true {\n\t\t\tnewContent = strings.Replace(newContent, \"#{IS_INFRA_CONFIRMED}\", \"\\\"\"+\"true\"+\"\\\"\", -1)\n\t\t} else {\n\t\t\tnewContent = strings.Replace(newContent, \"#{IS_INFRA_CONFIRMED}\", \"\\\"\"+\"false\"+\"\\\"\", -1)\n\t\t}\n\n\t\tif infra.NodeSelector != nil {\n\t\t\tnewContent = strings.Replace(newContent, \"#{NODE_SELECTOR}\", nodeselector, -1)\n\t\t}\n\t\tgeneratedYAML = append(generatedYAML, newContent)\n\t}\n\n\treturn []byte(strings.Join(generatedYAML, \"\\n\")), nil\n}" ]
[ "0.7210482", "0.6454242", "0.6394717", "0.60642916", "0.5732506", "0.5624017", "0.5620826", "0.5582096", "0.5477069", "0.54331523", "0.5370752", "0.5345448", "0.53141415", "0.52013785", "0.51975065", "0.51967037", "0.5148822", "0.51371235", "0.5124646", "0.5113943", "0.5101037", "0.5092893", "0.5088659", "0.50862336", "0.5072959", "0.502449", "0.5011328", "0.5011328", "0.5008999", "0.49976137", "0.49871373", "0.4955632", "0.4951819", "0.49330047", "0.49325362", "0.492754", "0.4920548", "0.49178007", "0.48678786", "0.48456043", "0.4840126", "0.48320663", "0.48306537", "0.48269072", "0.48170054", "0.48125958", "0.4793934", "0.47830132", "0.4771582", "0.47581765", "0.47550046", "0.47497895", "0.4749506", "0.47456026", "0.474024", "0.47398394", "0.47348717", "0.4725046", "0.46856666", "0.46675503", "0.4656178", "0.46370178", "0.46336985", "0.46239403", "0.46231818", "0.46228513", "0.46221077", "0.46136004", "0.46007827", "0.4594944", "0.4589659", "0.4589091", "0.45874915", "0.4584417", "0.4559032", "0.45468912", "0.45370093", "0.45239294", "0.45165914", "0.45135438", "0.4510613", "0.45039234", "0.45035747", "0.44933143", "0.44932932", "0.44931298", "0.44891807", "0.4483338", "0.44826797", "0.44782335", "0.44775572", "0.44664463", "0.44648156", "0.44545534", "0.44360515", "0.44261697", "0.44252142", "0.44239983", "0.44225803", "0.44215494" ]
0.75298697
0
parseObject parses a single Go object file. The object file consists of a textual header ending in "\n!\n" and then the part we want to parse begins. The format of that part is defined in a comment at the top of cmd/internal/goobj/objfile.go.
func (r *objReader) parseObject(o *GoObj, size int64) error { h := make([]byte, 0, 256) var c1, c2, c3 byte for { c1, c2, c3 = c2, c3, r.readByte() h = append(h, c3) // The new export format can contain 0 bytes. // Don't consider them errors, only look for r.err != nil. if r.err != nil { return errCorruptObject } if c1 == '\n' && c2 == '!' && c3 == '\n' { break } } o.TextHeader = h hs := strings.Fields(string(h)) if len(hs) >= 4 { o.Arch = hs[3] } o.Offset = r.offset o.Size = size - int64(len(h)) p, err := r.peek(8) if err != nil { return err } if !bytes.Equal(p, []byte(goobj.Magic)) { if bytes.HasPrefix(p, []byte("\x00go1")) && bytes.HasSuffix(p, []byte("ld")) { return r.error(ErrGoObjOtherVersion{p[1:]}) // strip the \x00 byte } return r.error(errCorruptObject) } r.skip(o.Size) return nil }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (r *objReader) parseObject(prefix []byte) error {\n\t// TODO(rsc): Maybe use prefix and the initial input to\n\t// record the header line from the file, which would\n\t// give the architecture and other version information.\n\n\tr.p.MaxVersion++\n\tvar c1, c2, c3 byte\n\tfor {\n\t\tc1, c2, c3 = c2, c3, r.readByte()\n\t\tif c3 == 0 { // NUL or EOF, either is bad\n\t\t\treturn errCorruptObject\n\t\t}\n\t\tif c1 == '\\n' && c2 == '!' && c3 == '\\n' {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tr.readFull(r.tmp[:8])\n\tif !bytes.Equal(r.tmp[:8], []byte(\"\\x00\\x00go13ld\")) {\n\t\treturn r.error(errCorruptObject)\n\t}\n\n\tb := r.readByte()\n\tif b != 1 {\n\t\treturn r.error(errCorruptObject)\n\t}\n\n\t// Direct package dependencies.\n\tfor {\n\t\ts := r.readString()\n\t\tif s == \"\" {\n\t\t\tbreak\n\t\t}\n\t\tr.p.Imports = append(r.p.Imports, s)\n\t}\n\n\t// Symbols.\n\tfor {\n\t\tif b := r.readByte(); b != 0xfe {\n\t\t\tif b != 0xff {\n\t\t\t\treturn r.error(errCorruptObject)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\n\t\ttyp := r.readInt()\n\t\ts := &Sym{SymID: r.readSymID()}\n\t\tr.p.Syms = append(r.p.Syms, s)\n\t\ts.Kind = SymKind(typ)\n\t\tflags := r.readInt()\n\t\ts.DupOK = flags&1 != 0\n\t\ts.Size = r.readInt()\n\t\ts.Type = r.readSymID()\n\t\ts.Data = r.readData()\n\t\ts.Reloc = make([]Reloc, r.readInt())\n\t\tfor i := range s.Reloc {\n\t\t\trel := &s.Reloc[i]\n\t\t\trel.Offset = r.readInt()\n\t\t\trel.Size = r.readInt()\n\t\t\trel.Type = r.readInt()\n\t\t\trel.Add = r.readInt()\n\t\t\tr.readInt() // Xadd - ignored\n\t\t\trel.Sym = r.readSymID()\n\t\t\tr.readSymID() // Xsym - ignored\n\t\t}\n\n\t\tif s.Kind == STEXT {\n\t\t\tf := new(Func)\n\t\t\ts.Func = f\n\t\t\tf.Args = r.readInt()\n\t\t\tf.Frame = r.readInt()\n\t\t\tflags := r.readInt()\n\t\t\tf.Leaf = flags&1 != 0\n\t\t\tf.NoSplit = r.readInt() != 0\n\t\t\tf.Var = make([]Var, r.readInt())\n\t\t\tfor i := range f.Var {\n\t\t\t\tv := &f.Var[i]\n\t\t\t\tv.Name = r.readSymID().Name\n\t\t\t\tv.Offset = r.readInt()\n\t\t\t\tv.Kind = r.readInt()\n\t\t\t\tv.Type = r.readSymID()\n\t\t\t}\n\n\t\t\tf.PCSP = r.readData()\n\t\t\tf.PCFile = r.readData()\n\t\t\tf.PCLine = r.readData()\n\t\t\tf.PCData = make([]Data, r.readInt())\n\t\t\tfor i := range f.PCData {\n\t\t\t\tf.PCData[i] = r.readData()\n\t\t\t}\n\t\t\tf.FuncData = make([]FuncData, r.readInt())\n\t\t\tfor i := range f.FuncData {\n\t\t\t\tf.FuncData[i].Sym = r.readSymID()\n\t\t\t}\n\t\t\tfor i := range f.FuncData {\n\t\t\t\tf.FuncData[i].Offset = int64(r.readInt()) // TODO\n\t\t\t}\n\t\t\tf.File = make([]string, r.readInt())\n\t\t\tfor i := range f.File {\n\t\t\t\tf.File[i] = r.readSymID().Name\n\t\t\t}\n\t\t}\n\t}\n\n\tr.readFull(r.tmp[:7])\n\tif !bytes.Equal(r.tmp[:7], []byte(\"\\xffgo13ld\")) {\n\t\treturn r.error(errCorruptObject)\n\t}\n\n\treturn nil\n}", "func ParseObject(data []byte) (*Object, error) {\n\treturn parseObject(data, false, false)\n}", "func (objectcoff ObjectCoff) ParseObj(file string) (bi pstruct.BinaryInfo) {\n\tb, err := pe.Open(file)\n\tif err != nil {\n\t\tpanic(\"file open error\")\n\t}\n\tdefer b.Close()\n\n\t// Read the image base for load\n\tvar imageBase int\n\tswitch oh := b.OptionalHeader.(type) {\n\tcase *pe.OptionalHeader32:\n\t\timageBase = int(oh.ImageBase)\n\tcase *pe.OptionalHeader64:\n\t\timageBase = int(oh.ImageBase)\n\t}\n\n\ts := b.Sections\n\tnsct := len(s)\n\tif nsct == 0 {\n\t\tfmt.Printf(\"file %v is empty\", file)\n\t} else {\n\t\tmaxbyteslen := 0\n\t\tfor _, is := range s {\n\t\t\tbyteslen := int(is.Offset)\n\t\t\tb, err := is.Data()\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t} else {\n\t\t\t\tbyteslen += len(b)\n\t\t\t}\n\t\t\tif byteslen > maxbyteslen {\n\t\t\t\tmaxbyteslen = byteslen\n\t\t\t}\n\t\t}\n\t\tbi.Sections.Data = make([]uint8, maxbyteslen)\n\t\tbi.ProgramHeaders = make([]pstruct.ProgramHeader, 0)\n\t\toffset := 0\n\t\tmaxReach := 0\n\t\tfor _, is := range s {\n\t\t\tif imageBase != 0 || is.VirtualAddress != 0 {\n\t\t\t\t// obj files does not have virtual addresses\n\t\t\t\tbi.ProgramHeaders = append(bi.ProgramHeaders,\n\t\t\t\t\tpstruct.ProgramHeader{\n\t\t\t\t\t\tPAddr: int(is.Offset),\n\t\t\t\t\t\tVAddr: imageBase + int(is.VirtualAddress),\n\t\t\t\t\t})\n\t\t\t}\n\t\t\tbi.Sections.Name = append(bi.Sections.Name, is.Name)\n\t\t\tbi.Sections.Offset = append(bi.Sections.Offset, int(is.Offset))\n\t\t\tnoffset := int(is.Offset)\n\t\t\tif maxReach > offset {\n\t\t\t\toffset = maxReach\n\t\t\t}\n\t\t\tfor j := offset; j < noffset; j++ {\n\t\t\t\t// Fill differences with NOP (0x90)\n\t\t\t\tbi.Sections.Data[j] = 0x90\n\t\t\t}\n\t\t\toffset = noffset\n\t\t\tdata, err := is.Data()\n\t\t\tif err != nil {\n\t\t\t\tnoffset = offset\n\t\t\t} else {\n\t\t\t\tnoffset = offset + len(data)\n\t\t\t}\n\n\t\t\tif noffset > maxReach {\n\t\t\t\tmaxReach = noffset\n\t\t\t}\n\t\t\tfor j := offset; j < noffset; j++ {\n\t\t\t\tbi.Sections.Data[j] = data[j-offset]\n\t\t\t}\n\t\t\toffset = noffset\n\t\t}\n\t}\n\treturn\n}", "func parseObjects(inFile io.Reader) ([]*Object, error) {\n\tvar objects []*Object\n\n\tin := bufio.NewReader(inFile)\n\tvar lineNo int\n\n\t// Discard anything prior to the license block.\n\tfor line, eof := getLine(in, &lineNo); !eof; line, eof = getLine(in, &lineNo) {\n\t\tif strings.Contains(line, \"This Source Code\") {\n\t\t\tbreak\n\t\t}\n\t}\n\t// Now collect the license block.\n\t// certdata.txt from hg.mozilla.org no longer contains CVS_ID.\n\tfor line, eof := getLine(in, &lineNo); !eof; line, eof = getLine(in, &lineNo) {\n\t\tif strings.Contains(line, \"CVS_ID\") || len(line) == 0 {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tvar currentObject *Object\n\tvar beginData bool\n\n\tfor line, eof := getLine(in, &lineNo); !eof; line, eof = getLine(in, &lineNo) {\n\t\tif len(line) == 0 || line[0] == '#' {\n\t\t\tcontinue\n\t\t}\n\n\t\tif strings.HasPrefix(line, \"CVS_ID \") {\n\t\t\tcontinue\n\t\t}\n\t\tif line == \"BEGINDATA\" {\n\t\t\tbeginData = true\n\t\t\tcontinue\n\t\t}\n\n\t\twords := strings.Fields(line)\n\t\tvar value []byte\n\t\tif len(words) == 2 && words[1] == \"MULTILINE_OCTAL\" {\n\t\t\tstartingLine := lineNo\n\t\t\tvar ok bool\n\t\t\tvalue, ok = readMultilineOctal(in, &lineNo)\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"Failed to read octal value starting at line %d\", startingLine)\n\t\t\t}\n\t\t} else if len(words) < 3 {\n\t\t\treturn nil, fmt.Errorf(\"Expected three or more values on line %d, but found %d\", lineNo, len(words))\n\t\t} else {\n\t\t\tvalue = []byte(strings.Join(words[2:], \" \"))\n\t\t}\n\n\t\tif words[0] == \"CKA_CLASS\" {\n\t\t\t// Start of a new object.\n\t\t\tif currentObject != nil {\n\t\t\t\tobjects = append(objects, currentObject)\n\t\t\t}\n\t\t\tcurrentObject = new(Object)\n\t\t\tcurrentObject.attrs = make(map[string]Attribute)\n\t\t\tcurrentObject.startingLine = lineNo\n\t\t}\n\t\tif currentObject == nil {\n\t\t\treturn nil, fmt.Errorf(\"Found attribute on line %d which appears to be outside of an object\", lineNo)\n\t\t}\n\t\tcurrentObject.attrs[words[0]] = Attribute{\n\t\t\tattrType: words[1],\n\t\t\tvalue: value,\n\t\t}\n\t}\n\n\tif !beginData {\n\t\treturn nil, fmt.Errorf(\"Read whole input and failed to find BEGINDATA\")\n\t}\n\n\tif currentObject != nil {\n\t\tobjects = append(objects, currentObject)\n\t}\n\n\treturn objects, nil\n}", "func (parser *PdfParser) parseObject() (PdfObject, error) {\n\tcommon.Log.Trace(\"Read direct object\")\n\tparser.skipSpaces()\n\tfor {\n\t\tbb, err := parser.reader.Peek(2)\n\t\tif err != nil {\n\t\t\t// If EOFs after 1 byte then should still try to continue parsing.\n\t\t\tif err != io.EOF || len(bb) == 0 {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tif len(bb) == 1 {\n\t\t\t\t// Add space as code below is expecting 2 bytes.\n\t\t\t\tbb = append(bb, ' ')\n\t\t\t}\n\t\t}\n\n\t\tcommon.Log.Trace(\"Peek string: %s\", string(bb))\n\t\t// Determine type.\n\t\tif bb[0] == '/' {\n\t\t\tname, err := parser.parseName()\n\t\t\tcommon.Log.Trace(\"->Name: '%s'\", name)\n\t\t\treturn &name, err\n\t\t} else if bb[0] == '(' {\n\t\t\tcommon.Log.Trace(\"->String!\")\n\t\t\tstr, err := parser.parseString()\n\t\t\treturn str, err\n\t\t} else if bb[0] == '[' {\n\t\t\tcommon.Log.Trace(\"->Array!\")\n\t\t\tarr, err := parser.parseArray()\n\t\t\treturn arr, err\n\t\t} else if (bb[0] == '<') && (bb[1] == '<') {\n\t\t\tcommon.Log.Trace(\"->Dict!\")\n\t\t\tdict, err := parser.ParseDict()\n\t\t\treturn dict, err\n\t\t} else if bb[0] == '<' {\n\t\t\tcommon.Log.Trace(\"->Hex string!\")\n\t\t\tstr, err := parser.parseHexString()\n\t\t\treturn str, err\n\t\t} else if bb[0] == '%' {\n\t\t\tparser.readComment()\n\t\t\tparser.skipSpaces()\n\t\t} else {\n\t\t\tcommon.Log.Trace(\"->Number or ref?\")\n\t\t\t// Reference or number?\n\t\t\t// Let's peek farther to find out.\n\t\t\tbb, _ = parser.reader.Peek(15)\n\t\t\tpeekStr := string(bb)\n\t\t\tcommon.Log.Trace(\"Peek str: %s\", peekStr)\n\n\t\t\tif (len(peekStr) > 3) && (peekStr[:4] == \"null\") {\n\t\t\t\tnull, err := parser.parseNull()\n\t\t\t\treturn &null, err\n\t\t\t} else if (len(peekStr) > 4) && (peekStr[:5] == \"false\") {\n\t\t\t\tb, err := parser.parseBool()\n\t\t\t\treturn &b, err\n\t\t\t} else if (len(peekStr) > 3) && (peekStr[:4] == \"true\") {\n\t\t\t\tb, err := parser.parseBool()\n\t\t\t\treturn &b, err\n\t\t\t}\n\n\t\t\t// Match reference.\n\t\t\tresult1 := reReference.FindStringSubmatch(string(peekStr))\n\t\t\tif len(result1) > 1 {\n\t\t\t\tbb, _ = parser.reader.ReadBytes('R')\n\t\t\t\tcommon.Log.Trace(\"-> !Ref: '%s'\", string(bb[:]))\n\t\t\t\tref, err := parseReference(string(bb))\n\t\t\t\tref.parser = parser\n\t\t\t\treturn &ref, err\n\t\t\t}\n\n\t\t\tresult2 := reNumeric.FindStringSubmatch(string(peekStr))\n\t\t\tif len(result2) > 1 {\n\t\t\t\t// Number object.\n\t\t\t\tcommon.Log.Trace(\"-> Number!\")\n\t\t\t\tnum, err := parser.parseNumber()\n\t\t\t\treturn num, err\n\t\t\t}\n\n\t\t\tresult2 = reExponential.FindStringSubmatch(string(peekStr))\n\t\t\tif len(result2) > 1 {\n\t\t\t\t// Number object (exponential)\n\t\t\t\tcommon.Log.Trace(\"-> Exponential Number!\")\n\t\t\t\tcommon.Log.Trace(\"% s\", result2)\n\t\t\t\tnum, err := parser.parseNumber()\n\t\t\t\treturn num, err\n\t\t\t}\n\n\t\t\tcommon.Log.Debug(\"ERROR Unknown (peek \\\"%s\\\")\", peekStr)\n\t\t\treturn nil, errors.New(\"object parsing error - unexpected pattern\")\n\t\t}\n\t}\n}", "func ParseObjects(d *drawing.Drawing, line int, data [][2]string) error {\n\treturn nil\n}", "func (parser *PdfParser) ParseIndirectObject() (PdfObject, error) {\n\tindirect := PdfIndirectObject{}\n\tindirect.parser = parser\n\tcommon.Log.Trace(\"-Read indirect obj\")\n\tbb, err := parser.reader.Peek(20)\n\tif err != nil {\n\t\tif err != io.EOF {\n\t\t\tcommon.Log.Debug(\"ERROR: Fail to read indirect obj\")\n\t\t\treturn &indirect, err\n\t\t}\n\t}\n\tcommon.Log.Trace(\"(indirect obj peek \\\"%s\\\"\", string(bb))\n\n\tindices := reIndirectObject.FindStringSubmatchIndex(string(bb))\n\tif len(indices) < 6 {\n\t\tif err == io.EOF {\n\t\t\t// If an EOF error occurred above and the object signature was not found, then return\n\t\t\t// with the EOF error.\n\t\t\treturn nil, err\n\t\t}\n\t\tcommon.Log.Debug(\"ERROR: Unable to find object signature (%s)\", string(bb))\n\t\treturn &indirect, errors.New(\"unable to detect indirect object signature\")\n\t}\n\tparser.reader.Discard(indices[0]) // Take care of any small offset.\n\tcommon.Log.Trace(\"Offsets % d\", indices)\n\n\t// Read the object header.\n\thlen := indices[1] - indices[0]\n\thb := make([]byte, hlen)\n\t_, err = parser.ReadAtLeast(hb, hlen)\n\tif err != nil {\n\t\tcommon.Log.Debug(\"ERROR: unable to read - %s\", err)\n\t\treturn nil, err\n\t}\n\tcommon.Log.Trace(\"textline: %s\", hb)\n\n\tresult := reIndirectObject.FindStringSubmatch(string(hb))\n\tif len(result) < 3 {\n\t\tcommon.Log.Debug(\"ERROR: Unable to find object signature (%s)\", string(hb))\n\t\treturn &indirect, errors.New(\"unable to detect indirect object signature\")\n\t}\n\n\ton, _ := strconv.Atoi(result[1])\n\tgn, _ := strconv.Atoi(result[2])\n\tindirect.ObjectNumber = int64(on)\n\tindirect.GenerationNumber = int64(gn)\n\n\tfor {\n\t\tbb, err := parser.reader.Peek(2)\n\t\tif err != nil {\n\t\t\treturn &indirect, err\n\t\t}\n\t\tcommon.Log.Trace(\"Ind. peek: %s (% x)!\", string(bb), string(bb))\n\n\t\tif IsWhiteSpace(bb[0]) {\n\t\t\tparser.skipSpaces()\n\t\t} else if bb[0] == '%' {\n\t\t\tparser.skipComments()\n\t\t} else if (bb[0] == '<') && (bb[1] == '<') {\n\t\t\tcommon.Log.Trace(\"Call ParseDict\")\n\t\t\tindirect.PdfObject, err = parser.ParseDict()\n\t\t\tcommon.Log.Trace(\"EOF Call ParseDict: %v\", err)\n\t\t\tif err != nil {\n\t\t\t\treturn &indirect, err\n\t\t\t}\n\t\t\tcommon.Log.Trace(\"Parsed dictionary... finished.\")\n\t\t} else if (bb[0] == '/') || (bb[0] == '(') || (bb[0] == '[') || (bb[0] == '<') {\n\t\t\tindirect.PdfObject, err = parser.parseObject()\n\t\t\tif err != nil {\n\t\t\t\treturn &indirect, err\n\t\t\t}\n\t\t\tcommon.Log.Trace(\"Parsed object ... finished.\")\n\t\t} else if bb[0] == ']' {\n\t\t\t// ']' not used as an array object ending marker, or array object\n\t\t\t// terminated multiple times. Discarding the character.\n\t\t\tcommon.Log.Debug(\"WARNING: ']' character not being used as an array ending marker. Skipping.\")\n\t\t\tparser.reader.Discard(1)\n\t\t} else {\n\t\t\tif bb[0] == 'e' {\n\t\t\t\tlineStr, err := parser.readTextLine()\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tif len(lineStr) >= 6 && lineStr[0:6] == \"endobj\" {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t} else if bb[0] == 's' {\n\t\t\t\tbb, _ = parser.reader.Peek(10)\n\t\t\t\tif string(bb[:6]) == \"stream\" {\n\t\t\t\t\tdiscardBytes := 6\n\t\t\t\t\tif len(bb) > 6 {\n\t\t\t\t\t\tif IsWhiteSpace(bb[discardBytes]) && bb[discardBytes] != '\\r' && bb[discardBytes] != '\\n' {\n\t\t\t\t\t\t\t// If any other white space character... should not happen!\n\t\t\t\t\t\t\t// Skip it..\n\t\t\t\t\t\t\tcommon.Log.Debug(\"Non-conformant PDF not ending stream line properly with EOL marker\")\n\t\t\t\t\t\t\tdiscardBytes++\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif bb[discardBytes] == '\\r' {\n\t\t\t\t\t\t\tdiscardBytes++\n\t\t\t\t\t\t\tif bb[discardBytes] == '\\n' {\n\t\t\t\t\t\t\t\tdiscardBytes++\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else if bb[discardBytes] == '\\n' {\n\t\t\t\t\t\t\tdiscardBytes++\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tparser.reader.Discard(discardBytes)\n\n\t\t\t\t\tdict, isDict := indirect.PdfObject.(*PdfObjectDictionary)\n\t\t\t\t\tif !isDict {\n\t\t\t\t\t\treturn nil, errors.New(\"stream object missing dictionary\")\n\t\t\t\t\t}\n\t\t\t\t\tcommon.Log.Trace(\"Stream dict %s\", dict)\n\n\t\t\t\t\t// Special stream length tracing function used to avoid endless recursive looping.\n\t\t\t\t\tslo, err := parser.traceStreamLength(dict.Get(\"Length\"))\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tcommon.Log.Debug(\"Fail to trace stream length: %v\", err)\n\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t}\n\t\t\t\t\tcommon.Log.Trace(\"Stream length? %s\", slo)\n\n\t\t\t\t\tpstreamLength, ok := slo.(*PdfObjectInteger)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, errors.New(\"stream length needs to be an integer\")\n\t\t\t\t\t}\n\t\t\t\t\tstreamLength := *pstreamLength\n\t\t\t\t\tif streamLength < 0 {\n\t\t\t\t\t\treturn nil, errors.New(\"stream needs to be longer than 0\")\n\t\t\t\t\t}\n\n\t\t\t\t\t// Validate the stream length based on the cross references.\n\t\t\t\t\t// Find next object with closest offset to current object and calculate\n\t\t\t\t\t// the expected stream length based on that.\n\t\t\t\t\tstreamStartOffset := parser.GetFileOffset()\n\t\t\t\t\tnextObjectOffset := parser.xrefNextObjectOffset(streamStartOffset)\n\t\t\t\t\tif streamStartOffset+int64(streamLength) > nextObjectOffset && nextObjectOffset > streamStartOffset {\n\t\t\t\t\t\tcommon.Log.Debug(\"Expected ending at %d\", streamStartOffset+int64(streamLength))\n\t\t\t\t\t\tcommon.Log.Debug(\"Next object starting at %d\", nextObjectOffset)\n\t\t\t\t\t\t// endstream + \"\\n\" endobj + \"\\n\" (17)\n\t\t\t\t\t\tnewLength := nextObjectOffset - streamStartOffset - 17\n\t\t\t\t\t\tif newLength < 0 {\n\t\t\t\t\t\t\treturn nil, errors.New(\"invalid stream length, going past boundaries\")\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcommon.Log.Debug(\"Attempting a length correction to %d...\", newLength)\n\t\t\t\t\t\tstreamLength = PdfObjectInteger(newLength)\n\t\t\t\t\t\tdict.Set(\"Length\", MakeInteger(newLength))\n\t\t\t\t\t}\n\n\t\t\t\t\t// Make sure is less than actual file size.\n\t\t\t\t\tif int64(streamLength) > parser.fileSize {\n\t\t\t\t\t\tcommon.Log.Debug(\"ERROR: Stream length cannot be larger than file size\")\n\t\t\t\t\t\treturn nil, errors.New(\"invalid stream length, larger than file size\")\n\t\t\t\t\t}\n\n\t\t\t\t\tstream := make([]byte, streamLength)\n\t\t\t\t\t_, err = parser.ReadAtLeast(stream, int(streamLength))\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tcommon.Log.Debug(\"ERROR stream (%d): %X\", len(stream), stream)\n\t\t\t\t\t\tcommon.Log.Debug(\"ERROR: %v\", err)\n\t\t\t\t\t\treturn nil, err\n\t\t\t\t\t}\n\n\t\t\t\t\tstreamobj := PdfObjectStream{}\n\t\t\t\t\tstreamobj.Stream = stream\n\t\t\t\t\tstreamobj.PdfObjectDictionary = indirect.PdfObject.(*PdfObjectDictionary)\n\t\t\t\t\tstreamobj.ObjectNumber = indirect.ObjectNumber\n\t\t\t\t\tstreamobj.GenerationNumber = indirect.GenerationNumber\n\t\t\t\t\tstreamobj.PdfObjectReference.parser = parser\n\n\t\t\t\t\tparser.skipSpaces()\n\t\t\t\t\tparser.reader.Discard(9) // endstream\n\t\t\t\t\tparser.skipSpaces()\n\t\t\t\t\treturn &streamobj, nil\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tindirect.PdfObject, err = parser.parseObject()\n\t\t\tif indirect.PdfObject == nil {\n\t\t\t\tcommon.Log.Debug(\"INCOMPATIBILITY: Indirect object not containing an object - assuming null object\")\n\t\t\t\tindirect.PdfObject = MakeNull()\n\t\t\t}\n\t\t\treturn &indirect, err\n\t\t}\n\t}\n\tif indirect.PdfObject == nil {\n\t\tcommon.Log.Debug(\"INCOMPATIBILITY: Indirect object not containing an object - assuming null object\")\n\t\tindirect.PdfObject = MakeNull()\n\t}\n\tcommon.Log.Trace(\"Returning indirect!\")\n\treturn &indirect, nil\n}", "func ParseObject(ctx *model.Context, offset int64, objNr, genNr int) (types.Object, error) {\n\n\tlog.Read.Printf(\"ParseObject: begin, obj#%d, offset:%d\\n\", objNr, offset)\n\n\tobj, endInd, streamInd, streamOffset, err := object(ctx, offset, objNr, genNr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tswitch o := obj.(type) {\n\n\tcase types.Dict:\n\t\td, err := dict(ctx, o, objNr, genNr, endInd, streamInd)\n\t\tif err != nil || d != nil {\n\t\t\t// Dict\n\t\t\treturn d, err\n\t\t}\n\t\t// StreamDict.\n\t\treturn streamDictForObject(ctx, o, objNr, streamInd, streamOffset, offset)\n\n\tcase types.Array:\n\t\tif ctx.EncKey != nil {\n\t\t\tif _, err = decryptDeepObject(o, objNr, genNr, ctx.EncKey, ctx.AES4Strings, ctx.E.R); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\treturn o, nil\n\n\tcase types.StringLiteral:\n\t\tif ctx.EncKey != nil {\n\t\t\tbb, err := decryptString(o.Value(), objNr, genNr, ctx.EncKey, ctx.AES4Strings, ctx.E.R)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn types.NewHexLiteral(bb), nil\n\t\t}\n\t\treturn o, nil\n\n\tcase types.HexLiteral:\n\t\tif ctx.EncKey != nil {\n\t\t\tbb, err := decryptHexLiteral(o, objNr, genNr, ctx.EncKey, ctx.AES4Strings, ctx.E.R)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn types.NewHexLiteral(bb), nil\n\t\t}\n\t\treturn o, nil\n\n\tdefault:\n\t\treturn o, nil\n\t}\n}", "func readObject(r io.ByteReader) *Object {\n\to := &Object{}\n\to.Address = readUvarint(r)\n\to.TypeAddress = readUvarint(r)\n\to.kind = readUvarint(r)\n\to.Content = readString(r)\n\to.Size = len(o.Content)\n\tif o.TypeAddress != 0 {\n\t\to.Type = typeList[o.TypeAddress]\n\t}\n\treturn o\n}", "func parseObject(cur *GoJSON, input []byte) ([]byte, error) {\n\tvar child, sibling *GoJSON\n\n\tif len(input) == 0 {\n\t\terrorStr := fmt.Sprintf(\"%s: Byte slice is empty\", funcName())\n\t\treturn []byte{}, errors.New(errorStr)\n\t}\n\n\tif input[0] != '{' {\n\t\terrorStr := fmt.Sprintf(\"%s: Not a valid object\", funcName())\n\t\treturn []byte{}, errors.New(errorStr)\n\t}\n\n\tcur.Jsontype = JSON_OBJECT\n\tinput = nextToken(input[1:])\n\n\tif len(input) == 0 {\n\t\terrorStr := fmt.Sprintf(\"%s: Could not find any valid JSON in input %s\", funcName(), string(input))\n\t\treturn []byte{}, errors.New(errorStr)\n\t}\n\n\t/*\n\t * Check if the object is empty\n\t */\n\tif input[0] == '}' {\n\t\treturn input[1:], nil\n\t}\n\n\t/*\n\t * Allocate memory for the child to\n\t * continue processing\n\t */\n\tcur.Child = new(GoJSON)\n\tchild = cur.Child\n\tinput, err := parseString(child, nextToken(input))\n\n\tif err != nil {\n\t\treturn []byte{}, err\n\t}\n\n\tchild.Key = child.Valstr\n\tchild.Valstr = \"\"\n\n\t/*\n\t * Fetch the location of ':' after the object key\n\t */\n\tinput = nextToken(input)\n\tif len(input) == 0 {\n\t\treturn []byte{}, nil\n\t}\n\n\tif input[0] != ':' {\n\t\terrorStr := fmt.Sprintf(\"%s: Malformed object in input %s\", funcName(), string(input))\n\t\treturn []byte{}, errors.New(errorStr)\n\t}\n\n\tinput, err = parseValue(child, nextToken(input[1:]))\n\n\tif err != nil {\n\t\treturn []byte{}, err\n\t}\n\n\tif input[0] != ',' {\n\t\tinput = nextToken(input)\n\n\t\tif len(input) == 0 {\n\t\t\treturn []byte{}, nil\n\t\t}\n\t}\n\n\t/*\n\t * Continue processing the object and add the\n\t * child entries to this parent GoJSON object\n\t */\n\tfor {\n\t\tif input[0] == ',' {\n\t\t\tsibling = new(GoJSON)\n\t\t\tchild.Next = sibling\n\t\t\tsibling.Prev = child\n\t\t\tchild = sibling\n\n\t\t\tinput, err = parseString(child, nextToken(input[1:]))\n\n\t\t\tif err != nil {\n\t\t\t\treturn []byte{}, err\n\t\t\t}\n\n\t\t\tchild.Key = child.Valstr\n\t\t\tchild.Valstr = \"\"\n\n\t\t\t/*\n\t\t\t * Fetch the location of ':' after the object key\n\t\t\t */\n\t\t\tinput = nextToken(input)\n\t\t\tif len(input) == 0 {\n\t\t\t\treturn []byte{}, nil\n\t\t\t}\n\n\t\t\tif input[0] != ':' {\n\t\t\t\terrorStr := fmt.Sprintf(\"%s: Malformed object in input %s\", funcName(), string(input))\n\t\t\t\treturn []byte{}, errors.New(errorStr)\n\t\t\t}\n\n\t\t\tinput, err = parseValue(child, nextToken(input[1:]))\n\n\t\t\tif err != nil {\n\t\t\t\treturn []byte{}, err\n\t\t\t}\n\n\t\t\tif input[0] != ',' {\n\t\t\t\tinput = nextToken(input)\n\n\t\t\t\tif len(input) == 0 {\n\t\t\t\t\treturn []byte{}, nil\n\t\t\t\t}\n\t\t\t}\n\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif input[0] == '}' {\n\t\treturn input[1:], nil\n\t} else {\n\t\terrorStr := fmt.Sprintf(\"%s: Incomplete/Malformed object in input %s\", funcName(), string(input))\n\t\treturn []byte{}, errors.New(errorStr)\n\t}\n}", "func ParseOBJ(reader *bufio.Reader) (model *Model, err error) {\n\tmodel = new(Model)\n\tmodel.Shader = &shaders.DiffuseShader{} // TODO\n\tfor {\n\t\tline, err := reader.ReadString('\\n')\n\t\tline = strings.TrimSuffix(line, \"\\n\")\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\treturn nil, err\n\t\t}\n\t\tif strings.HasPrefix(line, \"v \") {\n\t\t\tparseVertex(line, model)\n\t\t}\n\t\tif strings.HasPrefix(line, \"f \") {\n\t\t\tparseFace(line, model)\n\t\t}\n\t}\n\treturn model, nil\n}", "func parseObjectStream(osd *types.ObjectStreamDict) error {\n\n\tlog.Read.Printf(\"parseObjectStream begin: decoding %d objects.\\n\", osd.ObjCount)\n\n\tdecodedContent := osd.Content\n\tprolog := decodedContent[:osd.FirstObjOffset]\n\n\t// The separator used in the prolog shall be white space\n\t// but some PDF writers use 0x00.\n\tprolog = bytes.ReplaceAll(prolog, []byte{0x00}, []byte{0x20})\n\n\tobjs := strings.Fields(string(prolog))\n\tif len(objs)%2 > 0 {\n\t\treturn errors.New(\"pdfcpu: parseObjectStream: corrupt object stream dict\")\n\t}\n\n\t// e.g., 10 0 11 25 = 2 Objects: #10 @ offset 0, #11 @ offset 25\n\n\tvar objArray types.Array\n\n\tvar offsetOld int\n\n\tfor i := 0; i < len(objs); i += 2 {\n\n\t\toffset, err := strconv.Atoi(objs[i+1])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\toffset += osd.FirstObjOffset\n\n\t\tif i > 0 {\n\t\t\tdstr := string(decodedContent[offsetOld:offset])\n\t\t\tlog.Read.Printf(\"parseObjectStream: objString = %s\\n\", dstr)\n\t\t\to, err := compressedObject(dstr)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tlog.Read.Printf(\"parseObjectStream: [%d] = obj %s:\\n%s\\n\", i/2-1, objs[i-2], o)\n\t\t\tobjArray = append(objArray, o)\n\t\t}\n\n\t\tif i == len(objs)-2 {\n\t\t\tdstr := string(decodedContent[offset:])\n\t\t\tlog.Read.Printf(\"parseObjectStream: objString = %s\\n\", dstr)\n\t\t\to, err := compressedObject(dstr)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tlog.Read.Printf(\"parseObjectStream: [%d] = obj %s:\\n%s\\n\", i/2, objs[i], o)\n\t\t\tobjArray = append(objArray, o)\n\t\t}\n\n\t\toffsetOld = offset\n\t}\n\n\tosd.ObjArray = objArray\n\n\tlog.Read.Println(\"parseObjectStream end\")\n\n\treturn nil\n}", "func Parse(f *os.File, verbose bool) (*Archive, error) {\n\tvar r objReader\n\tr.init(f)\n\tt, err := r.peek(8)\n\tif err != nil {\n\t\tif err == io.EOF {\n\t\t\terr = io.ErrUnexpectedEOF\n\t\t}\n\t\treturn nil, err\n\t}\n\n\tswitch {\n\tdefault:\n\t\treturn nil, errNotObject\n\n\tcase bytes.Equal(t, archiveHeader):\n\t\tif err := r.parseArchive(verbose); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\tcase bytes.Equal(t, goobjHeader):\n\t\toff := r.offset\n\t\to := &GoObj{}\n\t\tif err := r.parseObject(o, r.limit-off); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tr.a.Entries = []Entry{{\n\t\t\tName: f.Name(),\n\t\t\tType: EntryGoObj,\n\t\t\tData: Data{off, r.limit - off},\n\t\t\tObj: o,\n\t\t}}\n\t}\n\n\treturn r.a, nil\n}", "func ParseOBJFile(path string) (model *Model, err error) {\n\tfile, err := os.Open(path)\n\tif err != nil {\n\t\treturn\n\t}\n\treader := bufio.NewReader(file)\n\tmodel, err = ParseOBJ(reader)\n\treturn\n}", "func ParseObjectSafe(data []byte) (*Object, error) {\n\treturn parseObject(data, false, true)\n}", "func (controller *Controller) parseObjectFromMap(objectData map[string]interface{}) (*object.Object, error) {\n\terrorMessage := \"unable to parse object\"\n\n\tname, err := controller.parseStringFromMap(objectData, \"name\")\n\tif err != nil {\n\t\treturn nil, errors.New(errorMessage)\n\t}\n\n\tcolor, specularReflection, roughness, transmissionReflection, diffuseReflection, err :=\n\t\tcontroller.parseLightCharacteristicsFromMap(objectData)\n\tif err != nil {\n\t\treturn nil, errors.New(errorMessage)\n\t}\n\n\tnormals, err := controller.parseNormalsFromMap(objectData)\n\tif err != nil {\n\t\treturn nil, errors.New(errorMessage)\n\t}\n\n\trepository, err := controller.parseRepositoryFromMap(objectData)\n\tif err != nil {\n\t\treturn nil, errors.New(errorMessage)\n\t}\n\n\ttriangles, err := controller.parseTrianglesFromMap(objectData)\n\tif err != nil {\n\t\treturn nil, errors.New(errorMessage)\n\t}\n\n\tparsedObject, err := object.Init(name, repository, triangles, normals, color, specularReflection, roughness,\n\t\ttransmissionReflection, diffuseReflection)\n\tif err != nil {\n\t\treturn nil, errors.New(errorMessage)\n\t}\n\treturn parsedObject, nil\n}", "func (p *Parser) object() (ast.Node, error) {\n\tdefer un(trace(p, \"ParseType\"))\n\ttok := p.scan()\n\n\tswitch tok.Type {\n\tcase token.NUMBER, token.FLOAT, token.BOOL, token.STRING, token.HEREDOC:\n\t\treturn p.literalType()\n\tcase token.LBRACE:\n\t\treturn p.objectType()\n\tcase token.LBRACK:\n\t\treturn p.listType()\n\tcase token.COMMENT:\n\t\t// implement comment\n\tcase token.EOF:\n\t\treturn nil, errEofToken\n\t}\n\n\treturn nil, &PosError{\n\t\tPos: tok.Pos,\n\t\tErr: fmt.Errorf(\"Unknown token: %+v\", tok),\n\t}\n}", "func stateBeginObject(s *scanner, c byte) int {\n\tif c == '<' {\n\t\ts.step = stateBeginObjectBracket\n\t\treturn scanContinue\n\t}\n\treturn s.error(c, \"looking for beginning of object syntax\")\n}", "func ParseObjectWithParameters(data []byte) (*Object, error) {\n\treturn parseObject(data, true, false)\n}", "func (eh *ElevatorHub) parseObjComplete(obj types.Order) {\n\tfmt.Println(\"\\x1b[32;1m::: Objective complete :::\")\n\tfmt.Printf(\"::: %v :::\\x1b[0m\\n\", obj)\n\teh.newOrders[obj] = true\n\tif obj.ButtonPress != types.BUTTON_INTERNAL {\n\t\tdelete(eh.currNetwork.Orders, obj)\n\t\tobj.ButtonPress = types.BUTTON_INTERNAL\n\t\teh.newOrders[obj] = true\n\t} else {\n\t\teh.mergeOrder(eh.currNetwork, obj, true)\n\t\tnewObj := costFunction(eh.currNetwork)\n\t\tif newObj != nil && newObj.Floor == obj.Floor {\n\t\t\tfmt.Printf(\"\\x1b[32;1m::: %v :::\\x1b[0m\\n\", newObj)\n\t\t\tdelete(eh.currNetwork.Orders, *newObj)\n\t\t\teh.newOrders[*newObj] = true\n\t\t}\n\t}\n\teh.currElevstat.Floor = obj.Floor\n\tfmt.Println()\n}", "func ParseObj(data []byte) (*models.TaskConfig, error) {\n\trun := models.TaskConfig{}\n\tlog.Println(string(data))\n\terr := yaml.Unmarshal(data, &run)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &run, nil\n}", "func (s *BasePlSqlParserListener) EnterObject_as_part(ctx *Object_as_partContext) {}", "func unpackObject(s *store, objs []byte, off int) (typ objType, h Hash, content []byte, encSize int, err error) {\n\tfail := func(err error) (objType, Hash, []byte, int, error) {\n\t\treturn 0, Hash{}, nil, 0, err\n\t}\n\tif off < 0 || off >= len(objs) {\n\t\treturn fail(fmt.Errorf(\"invalid object offset\"))\n\t}\n\n\t// Object starts with varint-encoded type and length n.\n\t// (The length n is the length of the compressed data that follows,\n\t// not the length of the actual object.)\n\tu, size := binary.Uvarint(objs[off:])\n\tif size <= 0 {\n\t\treturn fail(fmt.Errorf(\"invalid object: bad varint header\"))\n\t}\n\ttyp = objType((u >> 4) & 7)\n\tn := int(u&15 | u>>7<<4)\n\n\t// Git often stores objects that differ very little (different revs of a file).\n\t// It can save space by encoding one as \"start with this other object and apply these diffs\".\n\t// There are two ways to specify \"this other object\": an object ref (20-byte SHA1)\n\t// or as a relative offset to an earlier position in the objs slice.\n\t// For either of these, we need to fetch the other object's type and data (deltaTyp and deltaBase).\n\t// The Git docs call this the \"deltified representation\".\n\tvar deltaTyp objType\n\tvar deltaBase []byte\n\tswitch typ {\n\tcase objRefDelta:\n\t\tif len(objs)-(off+size) < 20 {\n\t\t\treturn fail(fmt.Errorf(\"invalid object: bad delta ref\"))\n\t\t}\n\t\t// Base block identified by SHA1 of an already unpacked hash.\n\t\tvar h Hash\n\t\tcopy(h[:], objs[off+size:])\n\t\tsize += 20\n\t\tdeltaTyp, deltaBase = s.object(h)\n\t\tif deltaTyp == 0 {\n\t\t\treturn fail(fmt.Errorf(\"invalid object: unknown delta ref %v\", h))\n\t\t}\n\n\tcase objOfsDelta:\n\t\ti := off + size\n\t\tif len(objs)-i < 20 {\n\t\t\treturn fail(fmt.Errorf(\"invalid object: too short\"))\n\t\t}\n\t\t// Base block identified by relative offset to earlier position in objs,\n\t\t// using a varint-like but not-quite-varint encoding.\n\t\t// Look for \"offset encoding:\" in https://git-scm.com/docs/pack-format.\n\t\td := int64(objs[i] & 0x7f)\n\t\tfor objs[i]&0x80 != 0 {\n\t\t\ti++\n\t\t\tif i-(off+size) > 10 {\n\t\t\t\treturn fail(fmt.Errorf(\"invalid object: malformed delta offset\"))\n\t\t\t}\n\t\t\td = d<<7 | int64(objs[i]&0x7f)\n\t\t\td += 1 << 7\n\t\t}\n\t\ti++\n\t\tsize = i - off\n\n\t\t// Re-unpack the object at the earlier offset to find its type and content.\n\t\tif d == 0 || d > int64(off) {\n\t\t\treturn fail(fmt.Errorf(\"invalid object: bad delta offset\"))\n\t\t}\n\t\tvar err error\n\t\tdeltaTyp, _, deltaBase, _, err = unpackObject(s, objs, off-int(d))\n\t\tif err != nil {\n\t\t\treturn fail(fmt.Errorf(\"invalid object: bad delta offset\"))\n\t\t}\n\t}\n\n\t// The main encoded data is a zlib-compressed stream.\n\tbr := bytes.NewReader(objs[off+size:])\n\tzr, err := zlib.NewReader(br)\n\tif err != nil {\n\t\treturn fail(fmt.Errorf(\"invalid object deflate: %v\", err))\n\t}\n\tdata, err := ioutil.ReadAll(zr)\n\tif err != nil {\n\t\treturn fail(fmt.Errorf(\"invalid object: bad deflate: %v\", err))\n\t}\n\tif len(data) != n {\n\t\treturn fail(fmt.Errorf(\"invalid object: deflate size %d != %d\", len(data), n))\n\t}\n\tencSize = len(objs[off:]) - br.Len()\n\n\t// If we fetched a base object above, the stream is an encoded delta.\n\t// Otherwise it is the raw data.\n\tswitch typ {\n\tdefault:\n\t\treturn fail(fmt.Errorf(\"invalid object: unknown object type\"))\n\tcase objCommit, objTree, objBlob, objTag:\n\t\t// ok\n\tcase objRefDelta, objOfsDelta:\n\t\t// Actual object type is the type of the base object.\n\t\ttyp = deltaTyp\n\n\t\t// Delta encoding starts with size of base object and size of new object.\n\t\tbaseSize, s := binary.Uvarint(data)\n\t\tdata = data[s:]\n\t\tif baseSize != uint64(len(deltaBase)) {\n\t\t\treturn fail(fmt.Errorf(\"invalid object: mismatched delta src size\"))\n\t\t}\n\t\ttargSize, s := binary.Uvarint(data)\n\t\tdata = data[s:]\n\n\t\t// Apply delta to base object, producing new object.\n\t\ttarg := make([]byte, targSize)\n\t\tif err := applyDelta(targ, deltaBase, data); err != nil {\n\t\t\treturn fail(fmt.Errorf(\"invalid object: %v\", err))\n\t\t}\n\t\tdata = targ\n\t}\n\n\th, data = s.add(typ, data)\n\treturn typ, h, data, encSize, nil\n}", "func ParseGetObjectOutput(output *GetObjectOutput) {\n\tParseGetObjectMetadataOutput(&output.GetObjectMetadataOutput)\n\tif ret, ok := output.ResponseHeaders[HEADER_DELETE_MARKER]; ok {\n\t\toutput.DeleteMarker = ret[0] == \"true\"\n\t}\n\tif ret, ok := output.ResponseHeaders[HEADER_CACHE_CONTROL]; ok {\n\t\toutput.CacheControl = ret[0]\n\t}\n\tif ret, ok := output.ResponseHeaders[HEADER_CONTENT_DISPOSITION]; ok {\n\t\toutput.ContentDisposition = ret[0]\n\t}\n\tif ret, ok := output.ResponseHeaders[HEADER_CONTENT_ENCODING]; ok {\n\t\toutput.ContentEncoding = ret[0]\n\t}\n\tif ret, ok := output.ResponseHeaders[HEADER_CONTENT_LANGUAGE]; ok {\n\t\toutput.ContentLanguage = ret[0]\n\t}\n\tif ret, ok := output.ResponseHeaders[HEADER_EXPIRES]; ok {\n\t\toutput.Expires = ret[0]\n\t}\n}", "func (e *Encoder) reformatObject(dst []byte, src RawValue, depth int) ([]byte, RawValue, error) {\n\t// Append object start.\n\tif src[0] != '{' {\n\t\tpanic(\"BUG: reformatObject must be called with a buffer that starts with '{'\")\n\t}\n\tdst, src = append(dst, '{'), src[1:]\n\n\t// Append (possible) object end.\n\tsrc = src[consumeWhitespace(src):]\n\tif len(src) == 0 {\n\t\treturn dst, src, io.ErrUnexpectedEOF\n\t}\n\tif src[0] == '}' {\n\t\tdst, src = append(dst, '}'), src[1:]\n\t\treturn dst, src, nil\n\t}\n\n\tvar err error\n\tvar names *objectNamespace\n\tif !e.options.AllowDuplicateNames {\n\t\te.namespaces.push()\n\t\tdefer e.namespaces.pop()\n\t\tnames = e.namespaces.last()\n\t}\n\tdepth++\n\tfor {\n\t\t// Append optional newline and indentation.\n\t\tif e.options.multiline {\n\t\t\tdst = e.appendIndent(dst, depth)\n\t\t}\n\n\t\t// Append object name.\n\t\tsrc = src[consumeWhitespace(src):]\n\t\tif len(src) == 0 {\n\t\t\treturn dst, src, io.ErrUnexpectedEOF\n\t\t}\n\t\tn0 := len(dst) // offset before calling reformatString\n\t\tn := consumeSimpleString(src)\n\t\tif n > 0 && e.options.EscapeRune == nil {\n\t\t\tdst, src = append(dst, src[:n]...), src[n:] // copy simple strings verbatim\n\t\t} else {\n\t\t\tdst, src, err = reformatString(dst, src, !e.options.AllowInvalidUTF8, e.options.preserveRawStrings, e.options.EscapeRune)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn dst, src, err\n\t\t}\n\t\tif !e.options.AllowDuplicateNames && !names.insertQuoted(dst[n0:], false) {\n\t\t\treturn dst, src, &SyntacticError{str: \"duplicate name \" + string(dst[n0:]) + \" in object\"}\n\t\t}\n\n\t\t// Append colon.\n\t\tsrc = src[consumeWhitespace(src):]\n\t\tif len(src) == 0 {\n\t\t\treturn dst, src, io.ErrUnexpectedEOF\n\t\t}\n\t\tif src[0] != ':' {\n\t\t\treturn dst, src, newInvalidCharacterError(src, \"after object name (expecting ':')\")\n\t\t}\n\t\tdst, src = append(dst, ':'), src[1:]\n\t\tif e.options.multiline {\n\t\t\tdst = append(dst, ' ')\n\t\t}\n\n\t\t// Append object value.\n\t\tsrc = src[consumeWhitespace(src):]\n\t\tif len(src) == 0 {\n\t\t\treturn dst, src, io.ErrUnexpectedEOF\n\t\t}\n\t\tdst, src, err = e.reformatValue(dst, src, depth)\n\t\tif err != nil {\n\t\t\treturn dst, src, err\n\t\t}\n\n\t\t// Append comma or object end.\n\t\tsrc = src[consumeWhitespace(src):]\n\t\tif len(src) == 0 {\n\t\t\treturn dst, src, io.ErrUnexpectedEOF\n\t\t}\n\t\tswitch src[0] {\n\t\tcase ',':\n\t\t\tdst, src = append(dst, ','), src[1:]\n\t\t\tcontinue\n\t\tcase '}':\n\t\t\tif e.options.multiline {\n\t\t\t\tdst = e.appendIndent(dst, depth-1)\n\t\t\t}\n\t\t\tdst, src = append(dst, '}'), src[1:]\n\t\t\treturn dst, src, nil\n\t\tdefault:\n\t\t\treturn dst, src, newInvalidCharacterError(src, \"after object value (expecting ',' or '}')\")\n\t\t}\n\t}\n}", "func (s *BasePlSqlParserListener) EnterObject_under_part(ctx *Object_under_partContext) {}", "func (p *Parser) objectItem() (*ast.ObjectItem, error) {\n\tdefer un(trace(p, \"ParseObjectItem\"))\n\n\tkeys, err := p.objectKey()\n\tif len(keys) > 0 && err == errEofToken {\n\t\t// We ignore eof token here since it is an error if we didn't\n\t\t// receive a value (but we did receive a key) for the item.\n\t\terr = nil\n\t}\n\tif len(keys) > 0 && err != nil && p.tok.Type == token.RBRACE {\n\t\t// This is a strange boolean statement, but what it means is:\n\t\t// We have keys with no value, and we're likely in an object\n\t\t// (since RBrace ends an object). For this, we set err to nil so\n\t\t// we continue and get the error below of having the wrong value\n\t\t// type.\n\t\terr = nil\n\n\t\t// Reset the token type so we don't think it completed fine. See\n\t\t// objectType which uses p.tok.Type to check if we're done with\n\t\t// the object.\n\t\tp.tok.Type = token.EOF\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\to := &ast.ObjectItem{\n\t\tKeys: keys,\n\t}\n\n\tif p.leadComment != nil {\n\t\to.LeadComment = p.leadComment\n\t\tp.leadComment = nil\n\t}\n\n\tswitch p.tok.Type {\n\tcase token.ASSIGN:\n\t\to.Assign = p.tok.Pos\n\t\to.Val, err = p.object()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\tcase token.LBRACE:\n\t\to.Val, err = p.objectType()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\tdefault:\n\t\tkeyStr := make([]string, 0, len(keys))\n\t\tfor _, k := range keys {\n\t\t\tkeyStr = append(keyStr, k.Token.Text)\n\t\t}\n\n\t\treturn nil, &PosError{\n\t\t\tPos: p.tok.Pos,\n\t\t\tErr: fmt.Errorf(\n\t\t\t\t\"key '%s' expected start of object ('{') or assignment ('=')\",\n\t\t\t\tstrings.Join(keyStr, \" \")),\n\t\t}\n\t}\n\n\t// key=#comment\n\t// val\n\tif p.lineComment != nil {\n\t\to.LineComment, p.lineComment = p.lineComment, nil\n\t}\n\n\t// do a look-ahead for line comment\n\tp.scan()\n\tif len(keys) > 0 && o.Val.Pos().Line == keys[0].Pos().Line && p.lineComment != nil {\n\t\to.LineComment = p.lineComment\n\t\tp.lineComment = nil\n\t}\n\tp.unscan()\n\treturn o, nil\n}", "func stateBeginObject1(s *scanner, c byte) int {\n\tif c == ',' {\n\t\ts.step = stateBeginObjectComma\n\t\treturn scanContinue\n\t}\n\treturn s.error(c, \"looking for beginning of object syntax\")\n}", "func adjustedObjEnd(obj types.Object) token.Pos {\n\tnameLen := len(obj.Name())\n\tif pkgName, ok := obj.(*types.PkgName); ok {\n\t\t// An imported Go package has a package-local, unqualified name.\n\t\t// When the name matches the imported package name, there is no\n\t\t// identifier in the import spec with the local package name.\n\t\t//\n\t\t// For example:\n\t\t// \t\timport \"go/ast\" \t// name \"ast\" matches package name\n\t\t// \t\timport a \"go/ast\" \t// name \"a\" does not match package name\n\t\t//\n\t\t// When the identifier does not appear in the source, have the range\n\t\t// of the object be the import path, including quotes.\n\t\tif pkgName.Imported().Name() == pkgName.Name() {\n\t\t\tnameLen = len(pkgName.Imported().Path()) + len(`\"\"`)\n\t\t}\n\t}\n\treturn obj.Pos() + token.Pos(nameLen)\n}", "func Parse(r io.ReadSeeker, pkgpath string) (*Package, error) {\n\tif pkgpath == \"\" {\n\t\tpkgpath = `\"\"`\n\t}\n\tp := new(Package)\n\tp.ImportPath = pkgpath\n\n\tvar rd objReader\n\trd.init(r, p)\n\terr := rd.readFull(rd.tmp[:8])\n\tif err != nil {\n\t\tif err == io.EOF {\n\t\t\terr = io.ErrUnexpectedEOF\n\t\t}\n\t\treturn nil, err\n\t}\n\n\tswitch {\n\tdefault:\n\t\treturn nil, errNotObject\n\n\tcase bytes.Equal(rd.tmp[:8], archiveHeader):\n\t\tif err := rd.parseArchive(); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\tcase bytes.Equal(rd.tmp[:8], goobjHeader):\n\t\tif err := rd.parseObject(goobjHeader); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn p, nil\n}", "func ParseRequestObject(ctx context.Context, authReq *oidc.AuthRequest, storage Storage, issuer string) (*oidc.AuthRequest, error) {\n\trequestObject := new(oidc.RequestObject)\n\tpayload, err := oidc.ParseToken(authReq.RequestParam, requestObject)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif requestObject.ClientID != \"\" && requestObject.ClientID != authReq.ClientID {\n\t\treturn authReq, oidc.ErrInvalidRequest()\n\t}\n\tif requestObject.ResponseType != \"\" && requestObject.ResponseType != authReq.ResponseType {\n\t\treturn authReq, oidc.ErrInvalidRequest()\n\t}\n\tif requestObject.Issuer != requestObject.ClientID {\n\t\treturn authReq, oidc.ErrInvalidRequest()\n\t}\n\tif !str.Contains(requestObject.Audience, issuer) {\n\t\treturn authReq, oidc.ErrInvalidRequest()\n\t}\n\tkeySet := &jwtProfileKeySet{storage, requestObject.Issuer}\n\tif err = oidc.CheckSignature(ctx, authReq.RequestParam, payload, requestObject, nil, keySet); err != nil {\n\t\treturn authReq, err\n\t}\n\tCopyRequestObjectToAuthRequest(authReq, requestObject)\n\treturn authReq, nil\n}", "func Parse(filename, src string) (*astext.Object, error) {\n\ttokens, err := docparser.Lex(filename, src)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"lex jsonnet snippet\")\n\t}\n\n\tnode, err := docparser.Parse(tokens)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"parse jsonnet snippet\")\n\t}\n\n\troot, ok := node.(*astext.Object)\n\tif !ok {\n\t\treturn nil, errors.New(\"root was not an object\")\n\t}\n\n\treturn root, nil\n}", "func ReadObject( object io.Reader) (*bytes.Buffer, error){\n\tbuffer:= make([]byte,32768)\n\tbuf := new(bytes.Buffer)\n\tfor {\n\n\t\tn, err := object.Read(buffer)\n\t\tif err == nil || err == io.EOF {\n\t\t\tbuf.Write(buffer[:n])\n\t\t\tif err == io.EOF {\n\t\t\t\tbuffer = buffer[:0] // clear the buffer fot the GC\n\t\t\t\treturn buf,nil\n\t\t\t}\n\t\t} else {\n\t\t\tbuffer = buffer[:0] // clear the buffer for the GC\n\t\t\treturn buf,err\n\t\t}\n\t}\n}", "func (_BaseLibrary *BaseLibraryFilterer) ParseContentObjectCreated(log types.Log) (*BaseLibraryContentObjectCreated, error) {\n\tevent := new(BaseLibraryContentObjectCreated)\n\tif err := _BaseLibrary.contract.UnpackLog(event, \"ContentObjectCreated\", log); err != nil {\n\t\treturn nil, err\n\t}\n\tevent.Raw = log\n\treturn event, nil\n}", "func parseObjects(f *os.File, cfg *rest.Config) (*yamlutil.YAMLOrJSONDecoder, meta.RESTMapper, error) {\n\tdata, err := os.ReadFile(f.Name())\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tdataReader := bytes.NewReader(data)\n\tdecoder := yamlutil.NewYAMLOrJSONDecoder(dataReader, 100)\n\tmapper, err := apiutil.NewDiscoveryRESTMapper(cfg)\n\n\treturn decoder, mapper, err\n}", "func (o *ObjectNode) headObjectHandler(w http.ResponseWriter, r *http.Request) {\n\tlog.LogInfof(\"headObjectHandler: get object meta, requestID(%v) remote(%v)\", RequestIDFromRequest(r), r.RemoteAddr)\n\n\t// check args\n\t_, _, object, vl, err := o.parseRequestParams(r)\n\tif err != nil {\n\t\tlog.LogErrorf(\"headObjectHandler: parse request parameters fail, requestId(%v) err(%v)\", RequestIDFromRequest(r), err)\n\t\t_ = NoSuchBucket.ServeResponse(w, r)\n\t\treturn\n\t}\n\tlog.LogInfof(\"headObjectHandler: parse request params result in header object handler, object(%v) vl(%v) err(%v)\", object, vl.name, err)\n\n\t// get object meta\n\tfileInfo, err := vl.FileInfo(object)\n\tif err != nil && err == syscall.ENOENT {\n\t\tlog.LogErrorf(\"headObjectHandler: get file meta fail, requestId(%v), err(%v)\", RequestIDFromRequest(r), err)\n\t\t_ = NoSuchKey.ServeResponse(w, r)\n\t\treturn\n\t}\n\tif err != nil {\n\t\tlog.LogErrorf(\"headObjectHandler: get file meta fail, requestId(%v), err(%v)\", RequestIDFromRequest(r), err)\n\t\t_ = InternalError.ServeResponse(w, r)\n\t\treturn\n\t}\n\n\t// set response header\n\tw.Header().Set(HeaderNameETag, fileInfo.ETag)\n\tw.Header().Set(HeaderNameAcceptRange, HeaderValueAcceptRange)\n\tw.Header().Set(HeaderNameContentType, HeaderValueTypeStream)\n\tw.Header().Set(HeaderNameLastModified, formatTimeRFC1123(fileInfo.ModifyTime))\n\tw.Header().Set(HeaderNameContentLength, strconv.Itoa(int(fileInfo.Size)))\n\tw.Header().Set(HeaderNameContentMD5, EmptyContentMD5String)\n\treturn\n}", "func GetObject(oid string) (string, ObjectType, error) {\n\tobjectPath := fmt.Sprintf(\"%s/%s/%s\", UGIT_DIR, OBJECTS_DIR, oid)\n\tdata, err := ioutil.ReadFile(objectPath)\n\tif err != nil {\n\t\treturn \"\", ObjectType(\"\"), err\n\t}\n\tparts := bytes.Split(data, []byte{BYTE_SEPARATOR})\n\t_type := ObjectType(parts[0])\n\tcontent := string(parts[1])\n\treturn content, _type, err\n}", "func (r *ValidationResults) VisitObject(o Object) error {\n\tif !isName(o.Name()) {\n\t\tr.Errors = append(r.Errors, fmt.Sprintf(\"Object name %q is not a valid identifier.\", o.Name()))\n\t}\n\tif len(o.Documentation()) == 0 {\n\t\tr.Warnings = append(r.Warnings, fmt.Sprintf(\"Documentation for object %q does not exist.\", o.Name()))\n\t}\n\tfor _, f := range o.Fields() {\n\t\tif !isIdentifier(f.Name()) {\n\t\t\tr.Errors = append(r.Errors, fmt.Sprintf(\"Object %q, field name %q is not a valid identifier.\", o.Name(), f.Name()))\n\t\t}\n\t\tif !isType(f.Type()) {\n\t\t\tr.Errors = append(r.Errors, fmt.Sprintf(\"Object %q, field name %q, type %q not defined.\", o.Name(), f.Name(), f.Type()))\n\t\t}\n\t\tfor _, p := range f.Precludes() {\n\t\t\tfound := false\n\t\t\tfor _, f := range o.Fields() {\n\t\t\t\tif p == f.Name() {\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\tr.Errors = append(r.Errors, fmt.Sprintf(\"Object %q, field name %q, precludes an unknown field %q.\", o.Name(), f.Name(), p))\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "func fromObj(obj types.Object, fset *token.FileSet, f *ast.File, off int) (string, string, error) {\n\tswitch o := obj.(type) {\n\tcase *types.Builtin:\n\t\treturn \"builtin\", o.Name(), nil\n\tcase *types.PkgName:\n\t\treturn o.Imported().Path(), \"\", nil\n\tcase *types.Const, *types.Func, *types.Nil, *types.TypeName, *types.Var:\n\t\tif obj.Pkg() == nil {\n\t\t\treturn \"builtin\", obj.Name(), nil\n\t\t}\n\t\tif !isImported(fset, f, off) {\n\t\t\timpDir, err := currImportDir()\n\t\t\treturn impDir, obj.Name(), err\n\t\t}\n\t\treturn obj.Pkg().Path(), obj.Name(), nil\n\tdefault:\n\t\treturn \"\", \"\", fmt.Errorf(\"cannot print documentation of %v\\n\", obj)\n\t}\n}", "func (*goEnvParser) Parse(object interface{}) error {\n\tif reflect.TypeOf(object).Kind() != reflect.Ptr {\n\t\treturn errors.New(\"objects passed to env.Parse() must be of kind pointer\")\n\t}\n\n\taddressableCopy := createAddressableCopy(object)\n\n\tfor i := 0; i < addressableCopy.NumField(); i++ {\n\t\tfieldRef := addressableCopy.Field(i)\n\t\tfieldRef = reflect.NewAt(fieldRef.Type(), unsafe.Pointer(fieldRef.UnsafeAddr())).Elem()\n\n\t\tnewValue := getValueForTag(reflect.TypeOf(object).Elem(), i)\n\n\t\tswitch fieldRef.Type().Kind() {\n\t\tcase reflect.Int:\n\t\t\tif newInt, err := strconv.ParseInt(newValue, 10, 32); err == nil {\n\t\t\t\tfieldRef.SetInt(newInt)\n\t\t\t}\n\t\tcase reflect.String:\n\t\t\tfieldRef.SetString(newValue)\n\t\t}\n\t}\n\n\tobject = addressableCopy.Interface()\n\n\treturn nil\n}", "func (r *objReader) parseArchive() error {\n\tfor r.offset < r.limit {\n\t\tif err := r.readFull(r.tmp[:60]); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdata := r.tmp[:60]\n\n\t\t// Each file is preceded by this text header (slice indices in first column):\n\t\t//\t 0:16\tname\n\t\t//\t16:28 date\n\t\t//\t28:34 uid\n\t\t//\t34:40 gid\n\t\t//\t40:48 mode\n\t\t//\t48:58 size\n\t\t//\t58:60 magic - `\\n\n\t\t// We only care about name, size, and magic.\n\t\t// The fields are space-padded on the right.\n\t\t// The size is in decimal.\n\t\t// The file data - size bytes - follows the header.\n\t\t// Headers are 2-byte aligned, so if size is odd, an extra padding\n\t\t// byte sits between the file data and the next header.\n\t\t// The file data that follows is padded to an even number of bytes:\n\t\t// if size is odd, an extra padding byte is inserted betw the next header.\n\t\tif len(data) < 60 {\n\t\t\treturn errTruncatedArchive\n\t\t}\n\t\tif !bytes.Equal(data[58:60], archiveMagic) {\n\t\t\treturn errCorruptArchive\n\t\t}\n\t\tname := trimSpace(data[0:16])\n\t\tsize, err := strconv.ParseInt(trimSpace(data[48:58]), 10, 64)\n\t\tif err != nil {\n\t\t\treturn errCorruptArchive\n\t\t}\n\t\tdata = data[60:]\n\t\tfsize := size + size&1\n\t\tif fsize < 0 || fsize < size {\n\t\t\treturn errCorruptArchive\n\t\t}\n\t\tswitch name {\n\t\tcase \"__.SYMDEF\", \"__.GOSYMDEF\", \"__.PKGDEF\":\n\t\t\tr.skip(size)\n\t\tdefault:\n\t\t\toldLimit := r.limit\n\t\t\tr.limit = r.offset + size\n\t\t\tif err := r.parseObject(nil); err != nil {\n\t\t\t\treturn fmt.Errorf(\"parsing archive member %q: %v\", name, err)\n\t\t\t}\n\t\t\tr.skip(r.limit - r.offset)\n\t\t\tr.limit = oldLimit\n\t\t}\n\t\tif size&1 != 0 {\n\t\t\tr.skip(1)\n\t\t}\n\t}\n\treturn nil\n}", "func ParseEvent(obj types.Object) (Event, error) {\n\t_, ok := obj.Type().Underlying().(*types.Struct)\n\tif !ok {\n\t\treturn Event{}, fmt.Errorf(\"%q is not a struct\", obj.Name())\n\t}\n\n\tevent := Event{\n\t\tName: obj.Name(),\n\t\tPackage: gentypes.PackageRef{\n\t\t\tName: obj.Pkg().Name(),\n\t\t\tPath: obj.Pkg().Path(),\n\t\t},\n\t}\n\n\treturn event, nil\n}", "func parseObjectID(id string, r *repo.Repository) (repo.ObjectID, error) {\n\thead, tail := splitHeadTail(id)\n\tif len(head) == 0 {\n\t\treturn repo.NullObjectID, fmt.Errorf(\"invalid object ID: %v\", id)\n\t}\n\n\toid, err := repo.ParseObjectID(head)\n\tif err != nil {\n\t\treturn repo.NullObjectID, fmt.Errorf(\"can't parse object ID %v: %v\", head, err)\n\t}\n\n\tif tail == \"\" {\n\t\treturn oid, nil\n\t}\n\n\tdir := repofs.Directory(r, oid)\n\tif err != nil {\n\t\treturn repo.NullObjectID, err\n\t}\n\n\treturn parseNestedObjectID(dir, tail)\n}", "func (s *BasePlSqlParserListener) EnterObject_member_spec(ctx *Object_member_specContext) {}", "func (h *handler) readObject(obj interface{}) ( interface{}, error){\n\t\n\tcontentType, _ , _ := mime.ParseMediaType(h.rq.Header.Get(\"Content-Type\"))\n\t\n\t//process JSON Documents only\n\tswitch contentType {\n\t\t\n\tcase \"\", \"application/json\":\n\t\treturn obj, h.readJSONInto(obj)\n\tdefault:\n\t\treturn nil, base.HTTPErrorf(http.StatusUnsupportedMediaType, \"Invalid content type %s\", contentType)\n\t}\n}", "func Parse(content []byte) (resources []*Node, err error) {\n\tobj, err := hcl.ParseBytes(content)\n\tif err != nil {\n\t\treturn resources, err\n\t}\n\n\tast.Walk(obj.Node, func(n ast.Node) (ast.Node, bool) {\n\t\tbaseItem, ok := n.(*ast.ObjectItem)\n\t\tif !ok {\n\t\t\treturn n, true\n\t\t}\n\n\t\titem := NewNode(baseItem)\n\n\t\tif itemErr := item.Validate(); itemErr != nil {\n\t\t\terr = multierror.Append(err, itemErr)\n\t\t\treturn n, false\n\t\t}\n\n\t\tresources = append(resources, item)\n\n\t\treturn n, false\n\t})\n\n\treturn resources, err\n}", "func EndOfObject(b *bytes.Buffer) (int, error) {\n\treturn b.Write([]byte{0x00, 0x00, 0x09})\n}", "func (_BaseContent *BaseContentFilterer) ParseContentObjectCreate(log types.Log) (*BaseContentContentObjectCreate, error) {\n\tevent := new(BaseContentContentObjectCreate)\n\tif err := _BaseContent.contract.UnpackLog(event, \"ContentObjectCreate\", log); err != nil {\n\t\treturn nil, err\n\t}\n\tevent.Raw = log\n\treturn event, nil\n}", "func (r *objReader) parseArchive(verbose bool) error {\n\tr.readFull(r.tmp[:8]) // consume header (already checked)\n\tfor r.offset < r.limit {\n\t\tif err := r.readFull(r.tmp[:60]); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdata := r.tmp[:60]\n\n\t\t// Each file is preceded by this text header (slice indices in first column):\n\t\t//\t 0:16\tname\n\t\t//\t16:28 date\n\t\t//\t28:34 uid\n\t\t//\t34:40 gid\n\t\t//\t40:48 mode\n\t\t//\t48:58 size\n\t\t//\t58:60 magic - `\\n\n\t\t// We only care about name, size, and magic, unless in verbose mode.\n\t\t// The fields are space-padded on the right.\n\t\t// The size is in decimal.\n\t\t// The file data - size bytes - follows the header.\n\t\t// Headers are 2-byte aligned, so if size is odd, an extra padding\n\t\t// byte sits between the file data and the next header.\n\t\t// The file data that follows is padded to an even number of bytes:\n\t\t// if size is odd, an extra padding byte is inserted betw the next header.\n\t\tif len(data) < 60 {\n\t\t\treturn errTruncatedArchive\n\t\t}\n\t\tif !bytes.Equal(data[58:60], archiveMagic) {\n\t\t\treturn errCorruptArchive\n\t\t}\n\t\tname := trimSpace(data[0:16])\n\t\tvar err error\n\t\tget := func(start, end, base, bitsize int) int64 {\n\t\t\tif err != nil {\n\t\t\t\treturn 0\n\t\t\t}\n\t\t\tvar v int64\n\t\t\tv, err = strconv.ParseInt(trimSpace(data[start:end]), base, bitsize)\n\t\t\treturn v\n\t\t}\n\t\tsize := get(48, 58, 10, 64)\n\t\tvar (\n\t\t\tmtime int64\n\t\t\tuid, gid int\n\t\t\tmode os.FileMode\n\t\t)\n\t\tif verbose {\n\t\t\tmtime = get(16, 28, 10, 64)\n\t\t\tuid = int(get(28, 34, 10, 32))\n\t\t\tgid = int(get(34, 40, 10, 32))\n\t\t\tmode = os.FileMode(get(40, 48, 8, 32))\n\t\t}\n\t\tif err != nil {\n\t\t\treturn errCorruptArchive\n\t\t}\n\t\tdata = data[60:]\n\t\tfsize := size + size&1\n\t\tif fsize < 0 || fsize < size {\n\t\t\treturn errCorruptArchive\n\t\t}\n\t\tswitch name {\n\t\tcase \"__.PKGDEF\":\n\t\t\tr.a.Entries = append(r.a.Entries, Entry{\n\t\t\t\tName: name,\n\t\t\t\tType: EntryPkgDef,\n\t\t\t\tMtime: mtime,\n\t\t\t\tUid: uid,\n\t\t\t\tGid: gid,\n\t\t\t\tMode: mode,\n\t\t\t\tData: Data{r.offset, size},\n\t\t\t})\n\t\t\tr.skip(size)\n\t\tdefault:\n\t\t\tvar typ EntryType\n\t\t\tvar o *GoObj\n\t\t\toffset := r.offset\n\t\t\tp, err := r.peek(8)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif bytes.Equal(p, goobjHeader) {\n\t\t\t\ttyp = EntryGoObj\n\t\t\t\to = &GoObj{}\n\t\t\t\tr.parseObject(o, size)\n\t\t\t} else {\n\t\t\t\ttyp = EntryNativeObj\n\t\t\t\tr.skip(size)\n\t\t\t}\n\t\t\tr.a.Entries = append(r.a.Entries, Entry{\n\t\t\t\tName: name,\n\t\t\t\tType: typ,\n\t\t\t\tMtime: mtime,\n\t\t\t\tUid: uid,\n\t\t\t\tGid: gid,\n\t\t\t\tMode: mode,\n\t\t\t\tData: Data{offset, size},\n\t\t\t\tObj: o,\n\t\t\t})\n\t\t}\n\t\tif size&1 != 0 {\n\t\t\tr.skip(1)\n\t\t}\n\t}\n\treturn nil\n}", "func (j *DSGit) ParseHeader(ctx *Ctx, line string) (parsed bool, err error) {\n\tif line == \"\" {\n\t\tj.ParseState = GitParseStateMessage\n\t\tparsed = true\n\t\treturn\n\t}\n\tm := MatchGroups(GitHeaderPattern, line)\n\tif len(m) == 0 {\n\t\terr = fmt.Errorf(\"invalid header format, line %d: '%s'\", j.CurrLine, line)\n\t\treturn\n\t}\n\t// Not too many properties, ES has 1000 fields limit, and each commit can have\n\t// different properties, so value around 300 should(?) be safe\n\tif len(j.Commit) < GitMaxCommitProperties {\n\t\tif m[\"name\"] != \"\" {\n\t\t\tj.Commit[m[\"name\"]] = m[\"value\"]\n\t\t}\n\t}\n\tparsed = true\n\treturn\n}", "func (r *wavefrontSceneReader) parse(res *asset.Resource) error {\n\tvar lineNum int = 0\n\tvar err error\n\n\t// The main obj file may include (call) several other object files. Each\n\t// object file contains 1-based indices (when they are positive). By\n\t// tracking the current vertex/uv/normal offsets we can apply them\n\t// while parsing faces to select the correct coordinates.\n\trelVertexOffset := len(r.vertexList)\n\trelUvOffset := len(r.uvList)\n\trelNormalOffset := len(r.normalList)\n\n\tscanner := bufio.NewScanner(res)\n\tfor scanner.Scan() {\n\t\tlineNum++\n\t\tlineTokens := strings.Fields(scanner.Text())\n\t\tif len(lineTokens) == 0 || strings.HasPrefix(lineTokens[0], \"#\") {\n\t\t\tcontinue\n\t\t}\n\n\t\tswitch lineTokens[0] {\n\t\tcase \"call\", \"mtllib\":\n\t\t\tif len(lineTokens) != 2 {\n\t\t\t\treturn r.emitError(res.Path(), lineNum, `unsupported syntax for \"%s\"; expected 1 argument; got %d`, lineTokens[0], len(lineTokens)-1)\n\t\t\t}\n\n\t\t\tr.pushFrame(fmt.Sprintf(\"referenced from %s:%d [%s]\", res.Path(), lineNum, lineTokens[0]))\n\n\t\t\tincRes, err := asset.NewResource(lineTokens[1], res)\n\t\t\tif err != nil {\n\t\t\t\treturn r.emitError(res.Path(), lineNum, err.Error())\n\t\t\t}\n\t\t\tdefer incRes.Close()\n\n\t\t\tswitch lineTokens[0] {\n\t\t\tcase \"call\":\n\t\t\t\terr = r.parse(incRes)\n\t\t\tcase \"mtllib\":\n\t\t\t\terr = r.parseMaterials(incRes)\n\t\t\t}\n\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tr.popFrame()\n\t\tcase \"usemtl\":\n\t\t\tif len(lineTokens) != 2 {\n\t\t\t\treturn r.emitError(res.Path(), lineNum, `unsupported syntax for 'usemtl'; expected 1 argument; got %d`, len(lineTokens)-1)\n\t\t\t}\n\n\t\t\t// Lookup material\n\t\t\tmatName := lineTokens[1]\n\t\t\tmatIndex, exists := r.matNameToIndex[matName]\n\t\t\tif !exists {\n\t\t\t\treturn r.emitError(res.Path(), lineNum, `undefined material with name \"%s\"`, matName)\n\t\t\t}\n\n\t\t\t// Activate material\n\t\t\tr.curMaterial = r.materials[matIndex]\n\t\tcase \"v\":\n\t\t\tv, err := parseVec3(lineTokens)\n\t\t\tif err != nil {\n\t\t\t\treturn r.emitError(res.Path(), lineNum, err.Error())\n\t\t\t}\n\t\t\tr.vertexList = append(r.vertexList, v)\n\t\tcase \"vn\":\n\t\t\tv, err := parseVec3(lineTokens)\n\t\t\tif err != nil {\n\t\t\t\treturn r.emitError(res.Path(), lineNum, err.Error())\n\t\t\t}\n\t\t\tr.normalList = append(r.normalList, v)\n\t\tcase \"vt\":\n\t\t\tv, err := parseVec2(lineTokens)\n\t\t\tif err != nil {\n\t\t\t\treturn r.emitError(res.Path(), lineNum, err.Error())\n\t\t\t}\n\t\t\tr.uvList = append(r.uvList, v)\n\t\tcase \"g\", \"o\":\n\t\t\tif len(lineTokens) < 2 {\n\t\t\t\treturn r.emitError(res.Path(), lineNum, `unsupported syntax for \"%s\"; expected 1 argument for object name; got %d`, lineTokens[0], len(lineTokens)-1)\n\t\t\t}\n\n\t\t\tr.verifyLastParsedMesh()\n\t\t\tr.rawScene.Meshes = append(r.rawScene.Meshes, input.NewMesh(lineTokens[1]))\n\t\tcase \"f\":\n\t\t\tprimList, err := r.parseFace(lineTokens, relVertexOffset, relUvOffset, relNormalOffset)\n\t\t\tif err != nil {\n\t\t\t\treturn r.emitError(res.Path(), lineNum, err.Error())\n\t\t\t}\n\n\t\t\t// If no object has been defined create a default one\n\t\t\tif len(r.rawScene.Meshes) == 0 {\n\t\t\t\tr.rawScene.Meshes = append(r.rawScene.Meshes, input.NewMesh(\"default\"))\n\t\t\t}\n\n\t\t\t// Append primitive\n\t\t\tmeshIndex := len(r.rawScene.Meshes) - 1\n\t\t\tr.rawScene.Meshes[meshIndex].MarkBBoxDirty()\n\t\t\tr.rawScene.Meshes[meshIndex].Primitives = append(r.rawScene.Meshes[meshIndex].Primitives, primList...)\n\t\tcase \"camera_fov\":\n\t\t\tr.rawScene.Camera.FOV, err = parseFloat32(lineTokens)\n\t\t\tif err != nil {\n\t\t\t\treturn r.emitError(res.Path(), lineNum, err.Error())\n\t\t\t}\n\t\tcase \"camera_eye\":\n\t\t\tr.rawScene.Camera.Eye, err = parseVec3(lineTokens)\n\t\t\tif err != nil {\n\t\t\t\treturn r.emitError(res.Path(), lineNum, err.Error())\n\t\t\t}\n\t\tcase \"camera_look\":\n\t\t\tr.rawScene.Camera.Look, err = parseVec3(lineTokens)\n\t\t\tif err != nil {\n\t\t\t\treturn r.emitError(res.Path(), lineNum, err.Error())\n\t\t\t}\n\t\tcase \"camera_up\":\n\t\t\tr.rawScene.Camera.Up, err = parseVec3(lineTokens)\n\t\t\tif err != nil {\n\t\t\t\treturn r.emitError(res.Path(), lineNum, err.Error())\n\t\t\t}\n\t\tcase \"instance\":\n\t\t\tinstance, err := r.parseMeshInstance(lineTokens)\n\t\t\tif err != nil {\n\t\t\t\treturn r.emitError(res.Path(), lineNum, err.Error())\n\t\t\t}\n\t\t\tr.rawScene.MeshInstances = append(r.rawScene.MeshInstances, instance)\n\t\t}\n\t}\n\n\tr.verifyLastParsedMesh()\n\treturn nil\n}", "func ParsePutObjectOutput(output *PutObjectOutput) {\n\tif ret, ok := output.ResponseHeaders[HEADER_VERSION_ID]; ok {\n\t\toutput.VersionId = ret[0]\n\t}\n\toutput.SseHeader = parseSseHeader(output.ResponseHeaders)\n\tif ret, ok := output.ResponseHeaders[HEADER_STORAGE_CLASS2]; ok {\n\t\toutput.StorageClass = ParseStringToStorageClassType(ret[0])\n\t}\n\tif ret, ok := output.ResponseHeaders[HEADER_ETAG]; ok {\n\t\toutput.ETag = ret[0]\n\t}\n}", "func (bucket Bucket) ProcessObject(objectKey string, process string) (ProcessObjectResult, error) {\n\tvar out ProcessObjectResult\n\tparams := map[string]interface{}{}\n\tparams[\"x-oss-process\"] = nil\n\tprocessData := fmt.Sprintf(\"%v=%v\", \"x-oss-process\", process)\n\tdata := strings.NewReader(processData)\n\tresp, err := bucket.do(\"POST\", objectKey, params, nil, data, nil)\n\tif err != nil {\n\t\treturn out, err\n\t}\n\tdefer resp.Body.Close()\n\n\terr = jsonUnmarshal(resp.Body, &out)\n\treturn out, err\n}", "func (*ObjectHeader) Descriptor() ([]byte, []int) {\n\treturn file_object_proto_rawDescGZIP(), []int{0}\n}", "func (repo *Repository) OpenObject(id SHA1) (Object, error) {\n\tobj, err := repo.openRawObject(id)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif IsStandardObject(obj.otype) {\n\t\treturn parseObject(obj)\n\t}\n\n\t//not a standard object, *must* be a delta object,\n\t// we know of no other types\n\tif !IsDeltaObject(obj.otype) {\n\t\treturn nil, fmt.Errorf(\"git: unsupported object\")\n\t}\n\n\tdelta, err := parseDelta(obj)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tchain, err := buildDeltaChain(delta, repo)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t//TODO: check depth, and especially expected memory usage\n\t// beofre actually patching it\n\n\treturn chain.resolve()\n}", "func _parseObjectSha1(ctx context.Context, gitRepo *Repo, objectType string, objectSha1Chan <-chan string,\n\tobjectProcessorChan chan<- Object, errorChan chan<- error) {\n\n\tdefer close(objectProcessorChan)\n\n\tfor sha1 := range objectSha1Chan {\n\t\t//\t\tlog.Printf(\"Examining git object file %s\", sha1)\n\t\toutput, err := gitRepo.CmdOutput([]string{\"cat-file\", \"-t\", sha1})\n\t\tif err != nil {\n\t\t\terrorChan <- errors.Wrapf(err, \"Getting object type for %s\", sha1)\n\t\t\treturn\n\t\t}\n\t\ttype_ := strings.TrimRight(string(output), \"\\n\")\n\t\tif type_ == objectType {\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn\n\t\t\tdefault:\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tswitch objectType {\n\t\t\tcase \"commit\":\n\t\t\t\tcommit := &Commit{\n\t\t\t\t\tsha1: sha1,\n\t\t\t\t}\n\t\t\t\t//\t\t\t\tlog.Printf(\"Instantiating commit object\")\n\t\t\t\terr = commit.Instantiate(gitRepo)\n\t\t\t\tif err != nil {\n\t\t\t\t\terrorChan <- errors.Wrapf(err, \"Instantiating commit %s\", sha1)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\t// XXX Make this configurable\n\t\t\t\t_, err = commit.InstantiateTree(gitRepo)\n\t\t\t\tif err != nil {\n\t\t\t\t\terrorChan <- errors.Wrapf(err, \"Instantiating tee for commit %s\", sha1)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tobjectProcessorChan <- commit\n\t\t\tcase \"tree\":\n\t\t\t\ttree := &Tree{\n\t\t\t\t\tsha1: sha1,\n\t\t\t\t}\n\t\t\t\t//\t\t\t\tlog.Printf(\"Instantiating tree object\")\n\t\t\t\terr = tree.Instantiate(gitRepo)\n\t\t\t\tif err != nil {\n\t\t\t\t\terrorChan <- errors.Wrapf(err, \"Instantiating tree %s\", sha1)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tobjectProcessorChan <- tree\n\t\t\tcase \"blob\":\n\t\t\t\tblob := &Blob{\n\t\t\t\t\tsha1: sha1,\n\t\t\t\t}\n\t\t\t\t//\t\t\t\tlog.Printf(\"Instantiating blob object\")\n\t\t\t\terr = blob.Instantiate(gitRepo)\n\t\t\t\tif err != nil {\n\t\t\t\t\terrorChan <- errors.Wrapf(err, \"Instantiating blob %s\", sha1)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tobjectProcessorChan <- blob\n\t\t\tdefault:\n\t\t\t\tpanic(fmt.Sprintf(\"obj type %s not yet supported\", objectType))\n\t\t\t}\n\t\t}\n\t}\n}", "func (eh *ElevatorHub) parseNewObj(obj types.Order) {\n\tfmt.Println(\"\\x1b[33;1m::: New Objective :::\")\n\tfmt.Printf(\"::: %v :::\\x1b[0m\\n\\n\", obj)\n\n\teh.currObj = &obj\n\tselect {\n\tcase eh.sendElevObj <- obj:\n\tcase <-eh.sendElevObj:\n\t\teh.sendElevObj <- obj\n\t}\n}", "func parseHeader(r io.Reader, data *libmbd.MCellData) error {\n\n\t// skip first byte - this is a defect in the mcell binary output format\n\tdummy := make([]byte, 1)\n\tif _, err := io.ReadFull(r, dummy); err != nil {\n\t\treturn err\n\t}\n\n\tif err := parseBlockInfo(r, data); err != nil {\n\t\treturn err\n\t}\n\n\tif err := parseBlockNames(r, data); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (dec *Decoder) Object(value UnmarshalerJSONObject) error {\n\tinitialKeysDone := dec.keysDone\n\tinitialChild := dec.child\n\tdec.keysDone = 0\n\tdec.called = 0\n\tdec.child |= 1\n\tnewCursor, err := dec.decodeObject(value)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdec.cursor = newCursor\n\tdec.keysDone = initialKeysDone\n\tdec.child = initialChild\n\tdec.called |= 1\n\treturn nil\n}", "func (header *FuseInHeader) ParseBinary(bcontent []byte) error {\n\terr := common.ParseBinary(bcontent, header)\n\n\treturn err\n}", "func parseHeader(line string, cb *models.CircularBuffer) {\n\tif fieldsRE.MatchString(line) {\n\t\tfields = strings.Split(line, \" \")[1:]\n\t}\n}", "func ScanObject(r io.Reader, mustarray, check bool, style OutStyle) (<-chan ResultOfScan, bool) {\n\n\tvar (\n\t\tchRst = make(chan ResultOfScan)\n\t\tja = true\n\t)\n\n\tgo func() {\n\t\tdefer func() {\n\t\t\tclose(chRst)\n\t\t}()\n\n\t\tconst (\n\t\t\tSCAN_STEP = bufio.MaxScanTokenSize\n\t\t)\n\n\t\tvar (\n\t\t\tlbbChecked = false\n\t\t\tN = 0\n\t\t\trecord = false\n\t\t\tsbObject = &strings.Builder{}\n\t\t\tpartialLong = false\n\t\t\tsbLine = &strings.Builder{}\n\t\t\tscanner = bufio.NewScanner(r)\n\t\t\tscanBuf = make([]byte, SCAN_STEP)\n\t\t)\n\n\t\tfillRst := func(object string) {\n\n\t\t\tobject = sTrimLeft(object, \"[ \\t\")\n\t\t\tobject = sTrimRight(object, \",] \\t\")\n\t\t\trst := ResultOfScan{}\n\n\t\t\t// if invalid json, report to error\n\t\t\tif check && !IsValid(object) {\n\t\t\t\trst.Err = fEf(\"Error JSON @ \\n%v\\n\", object)\n\t\t\t}\n\n\t\t\t// only record valid json\n\t\t\tif rst.Err == nil {\n\t\t\t\tswitch style {\n\t\t\t\tcase OUT_ORI:\n\t\t\t\t\tbreak\n\t\t\t\tcase OUT_FMT:\n\t\t\t\t\tobject = Fmt(object, \" \")\n\t\t\t\tcase OUT_MIN:\n\t\t\t\t\tobject = Minimize(object)\n\t\t\t\t}\n\t\t\t\trst.Obj = object\n\t\t\t}\n\n\t\t\tchRst <- rst\n\t\t}\n\n\t\tlineToRst := func(line string) {\n\n\t\t\t// if partialLong, only inflate sbLine, return\n\t\t\tif partialLong {\n\t\t\t\tsbLine.WriteString(line)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// if not partialLong, and sbLine has content, modify input line\n\t\t\tif sbLine.Len() > 0 {\n\t\t\t\tline = sbLine.String() + line\n\t\t\t\tdefer sbLine.Reset()\n\t\t\t}\n\n\t\t\tL, prevTail, nextHead, objects := analyseJL(line, N)\n\t\t\tdefer func() { N = L }()\n\n\t\t\tif len(prevTail) > 0 {\n\t\t\t\tsbObject.WriteString(prevTail)\n\t\t\t\tfillRst(sbObject.String())\n\t\t\t\tsbObject.Reset()\n\t\t\t}\n\n\t\t\tfor _, object := range objects {\n\t\t\t\tfillRst(object)\n\t\t\t}\n\n\t\t\tif len(nextHead) > 0 {\n\t\t\t\tsbObject.WriteString(nextHead)\n\t\t\t\trecord = true\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// object starts\n\t\t\tif N == 0 && L > 0 {\n\t\t\t\trecord = true\n\t\t\t}\n\n\t\t\tif record {\n\t\t\t\tsbObject.WriteString(line)\n\n\t\t\t\t// object ends\n\t\t\t\tif L == 0 {\n\t\t\t\t\tfillRst(sbObject.String())\n\t\t\t\t\tsbObject.Reset()\n\t\t\t\t\trecord = false\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tsplit := func(data []byte, atEOF bool) (advance int, token []byte, err error) {\n\n\t\t\t// DEBUG++\n\t\t\t// if DEBUG >= 1 {\n\t\t\t// \tfPln(\"why?\")\n\t\t\t// }\n\n\t\t\t////////////////////////////////////////////////////////////////\n\n\t\t\t// if atEOF && len(data) == 0 {\n\t\t\t// \treturn 0, nil, nil\n\t\t\t// }\n\t\t\t// if i := bytes.IndexByte(data, '\\n'); i >= 0 {\n\t\t\t// \t// We have a full newline-terminated line.\n\t\t\t// \treturn i + 1, dropCR(data[0:i]), nil\n\t\t\t// }\n\t\t\t// // If we're at EOF, we have a final, non-terminated line. Return it.\n\t\t\t// if atEOF {\n\t\t\t// \treturn len(data), dropCR(data), nil\n\t\t\t// }\n\t\t\t// // Request more data.\n\t\t\t// return 0, nil, nil\n\n\t\t\t////////////////////////////////////////////////////////////////\n\n\t\t\tpartialLong = false\n\t\t\tadvance = bytes.IndexByte(data, '\\n')\n\n\t\t\tswitch {\n\n\t\t\tcase atEOF && len(data) == 0:\n\t\t\t\treturn 0, nil, nil\n\n\t\t\tcase advance >= 0: // found\n\t\t\t\treturn advance + 1, dropCR(data[:advance]), nil\n\n\t\t\tcase advance == -1 && cap(data) < SCAN_STEP: // didn't find, then expand to max cap\n\t\t\t\treturn 0, nil, nil\n\n\t\t\tcase advance == -1 && len(data) == SCAN_STEP: // didn't find, even if got max cap. ingest all\n\t\t\t\tpartialLong = true\n\t\t\t\treturn SCAN_STEP, dropCR(data), nil\n\n\t\t\tdefault: // case advance == -1 && len(data) < SCAN_STEP: // didn't find, got part when at max cap. ingest & close long line.\n\t\t\t\treturn len(data), dropCR(data), nil\n\t\t\t}\n\t\t}\n\n\t\tscanner.Buffer(scanBuf, SCAN_STEP)\n\t\tscanner.Split(split)\n\n\t\tfor scanner.Scan() {\n\t\t\tline := scanner.Text()\n\t\t\tif !lbbChecked {\n\t\t\t\tif s := sTrim(line, \" \\t\"); len(s) > 0 {\n\t\t\t\t\tif s[0] != '[' {\n\t\t\t\t\t\tja = false\n\t\t\t\t\t\tif mustarray {\n\t\t\t\t\t\t\treturn // if not json array, do not ingest\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tlbbChecked = true\n\t\t\t\t}\n\t\t\t}\n\t\t\tlineToRst(line)\n\t\t}\n\t}()\n\n\ttime.Sleep(5 * time.Millisecond)\n\treturn chRst, ja\n}", "func (a *Analysis) processObject(object *s3.Object) {\n\ta.TotalCount++\n\n\ta.TotalSize = a.TotalSize + *object.Size\n\n\ta.SizePerOwnerID[*object.Owner.ID] += *object.Size\n\n\tif a.LastModified.Before(*object.LastModified) {\n\t\ta.LastModified = *object.LastModified\n\t}\n\n\tobjectString := fmt.Sprintf(\"%s %s %s\",\n\t\t(*object.LastModified).Format(time.RFC3339),\n\t\tbyteCountToHuman(*object.Size),\n\t\t*object.Key)\n\n\ta.Objects = append(a.Objects, objectString) //FIXME: horrible names!\n}", "func ReadObj(filePath string, material Material) []Triangle {\n\tfile, err := os.Open(filePath)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer file.Close()\n\n\tvar verts []Vector3\n\tvar normals []Vector3\n\tvar triangles []Triangle\n\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tline := scanner.Text()\n\t\tswitch {\n\t\tcase strings.HasPrefix(line, \"v \"):\n\t\t\tverts = append(verts, parseVertex(line))\n\t\tcase strings.HasPrefix(line, \"vn \"):\n\t\t\tnormals = append(normals, parseNormal(line))\n\t\tcase strings.HasPrefix(line, \"f \"):\n\t\t\ttriangles = append(triangles, parseFace(line, verts, normals, material))\n\t\t}\n\t}\n\n\tif err := scanner.Err(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfmt.Printf(\"Parsed %s\\n%d triangles\\n\", filePath, len(triangles))\n\n\treturn triangles\n}", "func (parser *PdfParser) parseName() (PdfObjectName, error) {\n\tvar r bytes.Buffer\n\tnameStarted := false\n\tfor {\n\t\tbb, err := parser.reader.Peek(1)\n\t\tif err == io.EOF {\n\t\t\tbreak // Can happen when loading from object stream.\n\t\t}\n\t\tif err != nil {\n\t\t\treturn PdfObjectName(r.String()), err\n\t\t}\n\n\t\tif !nameStarted {\n\t\t\t// Should always start with '/', otherwise not valid.\n\t\t\tif bb[0] == '/' {\n\t\t\t\tnameStarted = true\n\t\t\t\tparser.reader.ReadByte()\n\t\t\t} else if bb[0] == '%' {\n\t\t\t\tparser.readComment()\n\t\t\t\tparser.skipSpaces()\n\t\t\t} else {\n\t\t\t\tcommon.Log.Debug(\"ERROR Name starting with %s (% x)\", bb, bb)\n\t\t\t\treturn PdfObjectName(r.String()), fmt.Errorf(\"invalid name: (%c)\", bb[0])\n\t\t\t}\n\t\t} else {\n\t\t\tif IsWhiteSpace(bb[0]) {\n\t\t\t\tbreak\n\t\t\t} else if (bb[0] == '/') || (bb[0] == '[') || (bb[0] == '(') || (bb[0] == ']') || (bb[0] == '<') || (bb[0] == '>') {\n\t\t\t\tbreak // Looks like start of next statement.\n\t\t\t} else if bb[0] == '#' {\n\t\t\t\thexcode, err := parser.reader.Peek(3)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn PdfObjectName(r.String()), err\n\t\t\t\t}\n\n\t\t\t\tcode, err := hex.DecodeString(string(hexcode[1:3]))\n\t\t\t\tif err != nil {\n\t\t\t\t\tcommon.Log.Debug(\"ERROR: Invalid hex following '#', continuing using literal - Output may be incorrect\")\n\n\t\t\t\t\t// Treat as literal '#' rather than hex code.\n\t\t\t\t\tr.WriteByte('#')\n\n\t\t\t\t\t// Discard just the '#' byte and continue parsing the name.\n\t\t\t\t\tparser.reader.Discard(1)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\t// Hex decoding succeeded. Safe to discard all peeked bytes.\n\t\t\t\tparser.reader.Discard(3)\n\t\t\t\tr.Write(code)\n\t\t\t} else {\n\t\t\t\tb, _ := parser.reader.ReadByte()\n\t\t\t\tr.WriteByte(b)\n\t\t\t}\n\t\t}\n\t}\n\treturn PdfObjectName(r.String()), nil\n}", "func (s *BasePlSqlParserListener) EnterObject_properties(ctx *Object_propertiesContext) {}", "func (parser *PdfParser) parseXrefTable() (*PdfObjectDictionary, error) {\n\tvar trailer *PdfObjectDictionary\n\n\ttxt, err := parser.readTextLine()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tcommon.Log.Trace(\"xref first line: %s\", txt)\n\tcurObjNum := -1\n\tsecObjects := 0\n\tinsideSubsection := false\n\tunmatchedContent := \"\"\n\tfor {\n\t\tparser.skipSpaces()\n\t\t_, err := parser.reader.Peek(1)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\ttxt, err = parser.readTextLine()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tresult1 := reXrefSubsection.FindStringSubmatch(txt)\n\t\tif len(result1) == 0 {\n\t\t\t// Try to match invalid subsection beginning lines from previously\n\t\t\t// read, unidentified lines. Covers cases in which the object number\n\t\t\t// and the number of entries in the subsection are not on the same line.\n\t\t\ttryMatch := len(unmatchedContent) > 0\n\t\t\tunmatchedContent += txt + \"\\n\"\n\t\t\tif tryMatch {\n\t\t\t\tresult1 = reXrefSubsection.FindStringSubmatch(unmatchedContent)\n\t\t\t}\n\t\t}\n\t\tif len(result1) == 3 {\n\t\t\t// Match\n\t\t\tfirst, _ := strconv.Atoi(result1[1])\n\t\t\tsecond, _ := strconv.Atoi(result1[2])\n\t\t\tcurObjNum = first\n\t\t\tsecObjects = second\n\t\t\tinsideSubsection = true\n\t\t\tunmatchedContent = \"\"\n\t\t\tcommon.Log.Trace(\"xref subsection: first object: %d objects: %d\", curObjNum, secObjects)\n\t\t\tcontinue\n\t\t}\n\t\tresult2 := reXrefEntry.FindStringSubmatch(txt)\n\t\tif len(result2) == 4 {\n\t\t\tif insideSubsection == false {\n\t\t\t\tcommon.Log.Debug(\"ERROR Xref invalid format!\\n\")\n\t\t\t\treturn nil, errors.New(\"xref invalid format\")\n\t\t\t}\n\n\t\t\tfirst, _ := strconv.ParseInt(result2[1], 10, 64)\n\t\t\tgen, _ := strconv.Atoi(result2[2])\n\t\t\tthird := result2[3]\n\t\t\tunmatchedContent = \"\"\n\n\t\t\tif strings.ToLower(third) == \"n\" && first > 1 {\n\t\t\t\t// Object in use in the file! Load it.\n\t\t\t\t// Ignore free objects ('f').\n\t\t\t\t//\n\t\t\t\t// Some malformed writers mark the offset as 0 to\n\t\t\t\t// indicate that the object is free, and still mark as 'n'\n\t\t\t\t// Fairly safe to assume is free if offset is 0.\n\t\t\t\t//\n\t\t\t\t// Some malformed writers even seem to have values such as\n\t\t\t\t// 1.. Assume null object for those also. That is referring\n\t\t\t\t// to within the PDF version in the header clearly.\n\t\t\t\t//\n\t\t\t\t// Load if not existing or higher generation number than previous.\n\t\t\t\t// Usually should not happen, lower generation numbers\n\t\t\t\t// would be marked as free. But can still happen!\n\t\t\t\tx, ok := parser.xrefs.ObjectMap[curObjNum]\n\t\t\t\tif !ok || gen > x.Generation {\n\t\t\t\t\tobj := XrefObject{ObjectNumber: curObjNum,\n\t\t\t\t\t\tXType: XrefTypeTableEntry,\n\t\t\t\t\t\tOffset: first, Generation: gen}\n\t\t\t\t\tparser.xrefs.ObjectMap[curObjNum] = obj\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcurObjNum++\n\t\t\tcontinue\n\t\t}\n\n\t\tif (len(txt) > 6) && (txt[:7] == \"trailer\") {\n\t\t\tcommon.Log.Trace(\"Found trailer - %s\", txt)\n\t\t\t// Sometimes get \"trailer << ....\"\n\t\t\t// Need to rewind to end of trailer text.\n\t\t\tif len(txt) > 9 {\n\t\t\t\toffset := parser.GetFileOffset()\n\t\t\t\tparser.SetFileOffset(offset - int64(len(txt)) + 7)\n\t\t\t}\n\n\t\t\tparser.skipSpaces()\n\t\t\tparser.skipComments()\n\t\t\tcommon.Log.Trace(\"Reading trailer dict!\")\n\t\t\tcommon.Log.Trace(\"peek: \\\"%s\\\"\", txt)\n\t\t\ttrailer, err = parser.ParseDict()\n\t\t\tcommon.Log.Trace(\"EOF reading trailer dict!\")\n\t\t\tif err != nil {\n\t\t\t\tcommon.Log.Debug(\"Error parsing trailer dict (%s)\", err)\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\n\t\tif txt == \"%%EOF\" {\n\t\t\tcommon.Log.Debug(\"ERROR: end of file - trailer not found - error!\")\n\t\t\treturn nil, errors.New(\"end of file - trailer not found\")\n\t\t}\n\n\t\tcommon.Log.Trace(\"xref more : %s\", txt)\n\t}\n\tcommon.Log.Trace(\"EOF parsing xref table!\")\n\tif parser.xrefType == nil {\n\t\tt := XrefTypeTableEntry\n\t\tparser.xrefType = &t\n\t}\n\n\treturn trailer, nil\n}", "func GetObject(oid OID) (StoredObject, error) {\n\tvar obj StoredObject\n\tdata, err := ioutil.ReadFile(getObjectPath(oid))\n\tif err != nil {\n\t\treturn obj, err\n\t}\n\tsplit := bytes.SplitN(data, []byte{0}, 2)\n\tif len(split) != 2 {\n\t\treturn obj, ErrInvalidObject\n\t}\n\tobjType, err := Decode(split[0])\n\tif err != nil {\n\t\treturn obj, err\n\t}\n\tobj.Data = split[1]\n\tobj.ObjType = objType\n\treturn obj, nil\n}", "func Decode(r io.Reader) (*OBJFile, error) {\n\tlineno := 1\n\n\t// init min/max values\n\tobj := OBJFile{aabb: NewAABB()}\n\n\tscanner := bufio.NewScanner(r)\n\tfor scanner.Scan() {\n\t\ttext := spaceRegexp.ReplaceAllString(scanner.Text(), \" \")\n\n\t\tline := strings.Split(text, \" \")\n\t\tkw, vals := line[0], line[1:]\n\n\t\tswitch kw {\n\n\t\tcase \"v\":\n\t\t\terr := obj.parseVertex(kw, vals)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"error parsing vertex at line %d,\\\"%v\\\": %s\", lineno, vals, err)\n\n\t\t\t}\n\n\t\tcase \"f\":\n\t\t\terr := obj.parseFace(kw, vals)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"error parsing face at line %d,\\\"%v\\\": %s\", lineno, vals, err)\n\t\t\t}\n\n\t\tdefault:\n\t\t\t// ignore everything else\n\t\t}\n\n\t\tlineno++\n\t}\n\tif err := scanner.Err(); err != nil {\n\t\treturn nil, fmt.Errorf(\"error parsing file: %v\", err)\n\t}\n\n\treturn &obj, nil\n}", "func (dv *DefaultVisitor) visitObject(ctx context.Context, object runtime.Object, handler ObjectHandler, visitDescendants bool) error {\n\tctx, span := trace.StartSpan(ctx, \"visitObject\")\n\tdefer span.End()\n\n\tif object == nil {\n\t\treturn errors.New(\"can't visit a nil object\")\n\t}\n\n\tm, err := runtime.DefaultUnstructuredConverter.ToUnstructured(object)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tu := &unstructured.Unstructured{Object: m}\n\n\tapiVersion := u.GetAPIVersion()\n\tkind := u.GetKind()\n\n\tobjectGVK := schema.FromAPIVersionAndKind(apiVersion, kind)\n\n\ttvMap := make(map[schema.GroupVersionKind]TypedVisitor)\n\tfor _, typedVisitor := range dv.typedVisitors {\n\t\ttvMap[typedVisitor.Supports()] = typedVisitor\n\t}\n\n\ttv, ok := tvMap[objectGVK]\n\tif ok {\n\t\tif err := tv.Visit(ctx, u, handler, dv, visitDescendants); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn dv.defaultHandler.Visit(ctx, u, handler, dv, visitDescendants)\n}", "func NextObject(stream io.Reader) interface{} {\n\n // Each MP3 frame begins with a 4-byte header.\n buffer := make([]byte, 4)\n lastByte := buffer[3:]\n\n // Fill the header buffer.\n if ok := fillBuffer(stream, buffer); !ok {\n return nil\n }\n\n // Scan forward until we find an object or reach the end of the stream.\n for {\n\n // Check for an ID3v1 tag: 'TAG'.\n if buffer[0] == 84 && buffer[1] == 65 && buffer[2] == 71 {\n\n tag := &ID3v1Tag{}\n tag.RawBytes = make([]byte, 128)\n copy(tag.RawBytes, buffer)\n\n if ok := fillBuffer(stream, tag.RawBytes[4:]); !ok {\n return nil\n }\n\n return tag\n }\n\n // Check for an ID3v2 tag: 'ID3'.\n if buffer[0] == 73 && buffer[1] == 68 && buffer[2] == 51 {\n\n // Read the remainder of the 10 byte tag header.\n remainder := make([]byte, 6)\n if ok := fillBuffer(stream, remainder); !ok {\n return nil\n }\n\n // The last 4 bytes of the header indicate the length of the tag.\n // This length does not include the header itself.\n length :=\n (int(remainder[2]) << (7 * 3)) |\n (int(remainder[3]) << (7 * 2)) |\n (int(remainder[4]) << (7 * 1)) |\n (int(remainder[5]) << (7 * 0))\n\n\n tag := &ID3v2Tag{}\n tag.RawBytes = make([]byte, 10 + length)\n copy(tag.RawBytes, buffer)\n copy(tag.RawBytes[4:], remainder)\n\n if ok := fillBuffer(stream, tag.RawBytes[10:]); !ok {\n return nil\n }\n\n return tag\n }\n\n // Check for a frame header, indicated by an 11-bit frame-sync\n // sequence.\n if buffer[0] == 0xFF && (buffer[1] & 0xE0) == 0xE0 {\n\n frame := &MP3Frame{}\n\n if ok := parseHeader(buffer, frame); ok {\n debug(\"NextObject: found frame\")\n\n frame.RawBytes = make([]byte, frame.FrameLength)\n copy(frame.RawBytes, buffer)\n\n if ok := fillBuffer(stream, frame.RawBytes[4:]); !ok {\n return nil\n }\n\n return frame\n }\n }\n\n // Nothing found. Shift the buffer forward by one byte and try again.\n debug(\"NextObject: sync error: skipping byte\")\n buffer[0] = buffer[1]\n buffer[1] = buffer[2]\n buffer[2] = buffer[3]\n n, _ := stream.Read(lastByte)\n if n < 1 {\n return nil\n }\n }\n}", "func (c *Controller) handleObject(obj interface{}) {\n\tvar object metav1.Object\n\tvar ok bool\n\tif object, ok = obj.(metav1.Object); !ok {\n\t\ttombstone, ok := obj.(cache.DeletedFinalStateUnknown)\n\t\tif !ok {\n\t\t\tutilruntime.HandleError(fmt.Errorf(\"error decoding object, invalid type\"))\n\t\t\treturn\n\t\t}\n\t\tobject, ok = tombstone.Obj.(metav1.Object)\n\t\tif !ok {\n\t\t\tutilruntime.HandleError(fmt.Errorf(\"error decoding object tombstone, invalid type\"))\n\t\t\treturn\n\t\t}\n\t\tklog.V(4).Infof(\"Recovered deleted object '%s' from tombstone\", object.GetName())\n\t}\n\tklog.V(4).Infof(\"Processing object: %s\", object.GetName())\n\tif ownerRef := metav1.GetControllerOf(object); ownerRef != nil {\n\t\t// If this object is not owned by a FileSync, we should not do anything more\n\t\t// with it.\n\t\tif ownerRef.Kind != \"FileSync\" {\n\t\t\treturn\n\t\t}\n\n\t\tfsl, err := c.filesyncsLister.FileSyncs(object.GetNamespace()).Get(ownerRef.Name)\n\t\tif err != nil {\n\t\t\tklog.V(4).Infof(\"ignoring orphaned object '%s' of filesync '%s'\", object.GetSelfLink(), ownerRef.Name)\n\t\t\treturn\n\t\t}\n\n\t\tc.enqueueFileSync(fsl)\n\t\treturn\n\t}\n}", "func (xl xlObjects) GetObject(bucket, object string, startOffset int64) (io.ReadCloser, error) {\n\t// Verify if bucket is valid.\n\tif !IsValidBucketName(bucket) {\n\t\treturn nil, BucketNameInvalid{Bucket: bucket}\n\t}\n\t// Verify if object is valid.\n\tif !IsValidObjectName(object) {\n\t\treturn nil, ObjectNameInvalid{Bucket: bucket, Object: object}\n\t}\n\tnsMutex.RLock(bucket, object)\n\tdefer nsMutex.RUnlock(bucket, object)\n\tif !isMultipartObject(xl.storage, bucket, object) {\n\t\t_, err := xl.storage.StatFile(bucket, object)\n\t\tif err == nil {\n\t\t\tvar reader io.ReadCloser\n\t\t\treader, err = xl.storage.ReadFile(bucket, object, startOffset)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, toObjectErr(err, bucket, object)\n\t\t\t}\n\t\t\treturn reader, nil\n\t\t}\n\t\treturn nil, toObjectErr(err, bucket, object)\n\t}\n\tfileReader, fileWriter := io.Pipe()\n\tinfo, err := getMultipartObjectInfo(xl.storage, bucket, object)\n\tif err != nil {\n\t\treturn nil, toObjectErr(err, bucket, object)\n\t}\n\tpartIndex, offset, err := info.GetPartNumberOffset(startOffset)\n\tif err != nil {\n\t\treturn nil, toObjectErr(err, bucket, object)\n\t}\n\n\t// Hold a read lock once more which can be released after the following go-routine ends.\n\t// We hold RLock once more because the current function would return before the go routine below\n\t// executes and hence releasing the read lock (because of defer'ed nsMutex.RUnlock() call).\n\tnsMutex.RLock(bucket, object)\n\tgo func() {\n\t\tdefer nsMutex.RUnlock(bucket, object)\n\t\tfor ; partIndex < len(info.Parts); partIndex++ {\n\t\t\tpart := info.Parts[partIndex]\n\t\t\tr, err := xl.storage.ReadFile(bucket, pathJoin(object, partNumToPartFileName(part.PartNumber)), offset)\n\t\t\tif err != nil {\n\t\t\t\tfileWriter.CloseWithError(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// Reset offset to 0 as it would be non-0 only for the first loop if startOffset is non-0.\n\t\t\toffset = 0\n\t\t\tif _, err = io.Copy(fileWriter, r); err != nil {\n\t\t\t\tswitch reader := r.(type) {\n\t\t\t\tcase *io.PipeReader:\n\t\t\t\t\treader.CloseWithError(err)\n\t\t\t\tcase io.ReadCloser:\n\t\t\t\t\treader.Close()\n\t\t\t\t}\n\t\t\t\tfileWriter.CloseWithError(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// Close the readerCloser that reads multiparts of an object from the xl storage layer.\n\t\t\t// Not closing leaks underlying file descriptors.\n\t\t\tr.Close()\n\t\t}\n\t\tfileWriter.Close()\n\t}()\n\treturn fileReader, nil\n}", "func (s *BasePlSqlParserListener) EnterObject_name(ctx *Object_nameContext) {}", "func fileObject(path string) (fileObj *File) {\n\tbase, root, ext, dirname := fileFields(path)\n\tfileObj = &File{\n\t\tClass: CWLFileType,\n\t\tLocation: path, // stores the full path\n\t\tPath: path,\n\t\tBasename: base,\n\t\tNameRoot: root,\n\t\tNameExt: ext,\n\t\tDirName: dirname,\n\t}\n\treturn fileObj\n}", "func parse(line string, cb *models.CircularBuffer) {\n\tif string(line[0]) == \"#\" {\n\t\tparseHeader(line, cb)\n\t\treturn\n\t}\n\tif fields != nil {\n\t\thit, err := parseToHit(line)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn\n\t\t}\n\t\tcb.HitBy(hit)\n\t}\n}", "func execObjectString(_ int, p *gop.Context) {\n\targs := p.GetArgs(2)\n\tret := types.ObjectString(args[0].(types.Object), args[1].(types.Qualifier))\n\tp.Ret(2, ret)\n}", "func ParseGetObjectMetadataOutput(output *GetObjectMetadataOutput) {\n\toutput.AllowOrigin, output.AllowHeader, output.AllowMethod, output.ExposeHeader, output.MaxAgeSeconds = parseCorsHeader(output.BaseModel)\n\tparseUnCommonHeader(output)\n\tif ret, ok := output.ResponseHeaders[HEADER_STORAGE_CLASS2]; ok {\n\t\toutput.StorageClass = ParseStringToStorageClassType(ret[0])\n\t}\n\tif ret, ok := output.ResponseHeaders[HEADER_ETAG]; ok {\n\t\toutput.ETag = ret[0]\n\t}\n\tif ret, ok := output.ResponseHeaders[HEADER_CONTENT_TYPE]; ok {\n\t\toutput.ContentType = ret[0]\n\t}\n\n\toutput.SseHeader = parseSseHeader(output.ResponseHeaders)\n\tif ret, ok := output.ResponseHeaders[HEADER_LASTMODIFIED]; ok {\n\t\tret, err := time.Parse(time.RFC1123, ret[0])\n\t\tif err == nil {\n\t\t\toutput.LastModified = ret\n\t\t}\n\t}\n\tif ret, ok := output.ResponseHeaders[HEADER_CONTENT_LENGTH]; ok {\n\t\toutput.ContentLength = StringToInt64(ret[0], 0)\n\t}\n\n\toutput.Metadata = make(map[string]string)\n\n\tfor key, value := range output.ResponseHeaders {\n\t\tif strings.HasPrefix(key, PREFIX_META) {\n\t\t\t_key := key[len(PREFIX_META):]\n\t\t\toutput.ResponseHeaders[_key] = value\n\t\t\toutput.Metadata[_key] = value[0]\n\t\t\tdelete(output.ResponseHeaders, key)\n\t\t}\n\t}\n\n}", "func (*Base) Object(p ASTPass, node *ast.Object, ctx Context) {\n\tp.ObjectFields(p, &node.Fields, ctx)\n\tp.Fodder(p, &node.CloseFodder, ctx)\n}", "func (p *Parser) Parse() (*ast.File, error) {\n\tf := &ast.File{}\n\tvar err, scerr error\n\tp.sc.Error = func(pos token.Pos, msg string) {\n\t\tscerr = &PosError{Pos: pos, Err: errors.New(msg)}\n\t}\n\n\tf.Node, err = p.objectList(false)\n\tif scerr != nil {\n\t\treturn nil, scerr\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tf.Comments = p.comments\n\treturn f, nil\n}", "func ParseSnippetFile(inputpath, outputpath string) {\r\n\t// general variables\r\n\tex := regexp.MustCompile(`\\\".*?\\\": {`)\r\n\r\n\tif textFile, err := os.Open(inputpath); err == nil {\r\n\t\tvar txtlines []string\r\n\r\n\t\t// lines to string list\r\n\t\tscanner := bufio.NewScanner(textFile)\r\n\t\tscanner.Split(bufio.ScanLines)\r\n\t\tfor scanner.Scan() {\r\n\t\t\t// Remove struct keys and make it a an array\r\n\t\t\ttxtlines = append(txtlines, ex.ReplaceAllString(scanner.Text(), \"{\"))\r\n\t\t}\r\n\r\n\t\t// Remove conflicting object keys\r\n\t\tif f, err := os.Create(outputpath); err == nil {\r\n\t\t\tfor i, line := range txtlines {\r\n\t\t\t\tif i == 0 {\r\n\t\t\t\t\tf.WriteString(\"[\\n\")\r\n\t\t\t\t} else if i == len(txtlines)-1 {\r\n\t\t\t\t\tf.WriteString(\"]\")\r\n\t\t\t\t} else {\r\n\t\t\t\t\tf.WriteString(line + \"\\n\")\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}", "func stateBeginObjectBracket(s *scanner, c byte) int {\n\tif c == '1' {\n\t\ts.step = stateBeginObject1\n\t\treturn scanContinue\n\t}\n\treturn s.error(c, \"looking for beginning of object syntax\")\n}", "func (*CustomIndex) FromObject(obj interface{}) (bool, []byte, error) {\n\tt, ok := obj.(*TestObject)\n\tif !ok {\n\t\treturn false, nil, fmt.Errorf(\"not a test object\")\n\t}\n\n\t// Prepend a null so we can address an empty Foo field.\n\tout := \"\\x00\" + t.Foo\n\treturn true, []byte(out), nil\n}", "func ParseCopyObjectOutput(output *CopyObjectOutput) {\n\tif ret, ok := output.ResponseHeaders[HEADER_VERSION_ID]; ok {\n\t\toutput.VersionId = ret[0]\n\t}\n\toutput.SseHeader = parseSseHeader(output.ResponseHeaders)\n\tif ret, ok := output.ResponseHeaders[HEADER_COPY_SOURCE_VERSION_ID]; ok {\n\t\toutput.CopySourceVersionId = ret[0]\n\t}\n}", "func (l loader) obj2Strings(file io.ReadCloser) (objs []*objStrings) {\n\tobjs = []*objStrings{}\n\tname := \"\"\n\tvar curr *objStrings\n\treader := bufio.NewReader(file)\n\tline, e1 := reader.ReadString('\\n')\n\tfor ; e1 == nil; line, e1 = reader.ReadString('\\n') {\n\t\tline = strings.TrimSpace(line)\n\t\ttokens := strings.Split(line, \" \")\n\t\tif len(tokens) == 2 && tokens[0] == \"o\" {\n\t\t\tname = strings.TrimSpace(tokens[1])\n\t\t\tcurr = &objStrings{name, []string{}}\n\t\t\tobjs = append(objs, curr)\n\t\t} else if len(name) > 0 {\n\t\t\tcurr.lines = append(curr.lines, strings.TrimSpace(line))\n\t\t}\n\t}\n\treturn\n}", "func (l *Loader) Preload(syms *sym.Symbols, f *bio.Reader, lib *sym.Library, unit *sym.CompilationUnit, length int64, flags int) {\n\troObject, readonly, err := f.Slice(uint64(length))\n\tif err != nil {\n\t\tlog.Fatal(\"cannot read object file:\", err)\n\t}\n\tr := goobj2.NewReaderFromBytes(roObject, readonly)\n\tif r == nil {\n\t\tif len(roObject) >= 8 && bytes.Equal(roObject[:8], []byte(\"\\x00go114ld\")) {\n\t\t\tlog.Fatalf(\"found object file %s in old format, but -go115newobj is true\\nset -go115newobj consistently in all -gcflags, -asmflags, and -ldflags\", f.File().Name())\n\t\t}\n\t\tpanic(\"cannot read object file\")\n\t}\n\tlocalSymVersion := syms.IncVersion()\n\tpkgprefix := objabi.PathToPrefix(lib.Pkg) + \".\"\n\tndef := r.NSym()\n\tnnonpkgdef := r.NNonpkgdef()\n\tor := &oReader{r, unit, localSymVersion, r.Flags(), pkgprefix, make([]Sym, ndef+nnonpkgdef+r.NNonpkgref()), ndef, uint32(len(l.objs))}\n\n\t// Autolib\n\tlib.ImportStrings = append(lib.ImportStrings, r.Autolib()...)\n\n\t// DWARF file table\n\tnfile := r.NDwarfFile()\n\tunit.DWARFFileTable = make([]string, nfile)\n\tfor i := range unit.DWARFFileTable {\n\t\tunit.DWARFFileTable[i] = r.DwarfFile(i)\n\t}\n\n\tl.addObj(lib.Pkg, or)\n\tl.preloadSyms(or, pkgDef)\n\n\t// The caller expects us consuming all the data\n\tf.MustSeek(length, os.SEEK_CUR)\n}", "func NewObjectReader(object *Object, rootPath *string, db *gorm.DB) (io.ReadSeeker, error) {\n\n\tif object == nil {\n\t\treturn nil, ErrInvalidObject\n\t}\n\n\tvar (\n\t\terr error\n\t\tfirstChunk *Chunk\n\t\tchunkReader *os.File\n\t\ttotalChunkNumber int\n\t)\n\n\tif totalChunkNumber, err = object.LastChunkNumber(db); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif totalChunkNumber == 0 {\n\t\treturn nil, ErrObjectNoChunks\n\t}\n\n\tif firstChunk, err = object.ChunkWithNumber(1, db); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif chunkReader, err = firstChunk.Reader(rootPath); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &objectReader{\n\t\tdb: db,\n\t\tobject: object,\n\t\tcurrentChunkReader: chunkReader,\n\t\trootPath: rootPath,\n\t\tcurrentChunkNumber: 1,\n\t\ttotalChunkNumber: totalChunkNumber,\n\t}, nil\n}", "func ReadPointerFromBuffer(buf []byte) (Pointer, error) {\n\tvar p Pointer\n\n\theadString := string(buf)\n\tif !strings.HasPrefix(headString, MetaFileIdentifier) {\n\t\treturn p, ErrMissingPrefix\n\t}\n\n\tsplitLines := strings.Split(headString, \"\\n\")\n\tif len(splitLines) < 3 {\n\t\treturn p, ErrInvalidStructure\n\t}\n\n\toid := strings.TrimPrefix(splitLines[1], MetaFileOidPrefix)\n\tif len(oid) != 64 || !oidPattern.MatchString(oid) {\n\t\treturn p, ErrInvalidOIDFormat\n\t}\n\tsize, err := strconv.ParseInt(strings.TrimPrefix(splitLines[2], \"size \"), 10, 64)\n\tif err != nil {\n\t\treturn p, err\n\t}\n\n\tp.Oid = oid\n\tp.Size = size\n\n\treturn p, nil\n}", "func (c *Controller) handleObject(obj interface{}) {\n\tvar object metav1.Object\n\n\tvar ok bool\n\tif object, ok = obj.(metav1.Object); !ok {\n\t\ttombstone, ok := obj.(cache.DeletedFinalStateUnknown)\n\t\tif !ok {\n\t\t\tutilruntime.HandleError(fmt.Errorf(\"error decoding object, invalid type\"))\n\t\t\treturn\n\t\t}\n\t\tobject, ok = tombstone.Obj.(metav1.Object)\n\t\tif !ok {\n\t\t\tutilruntime.HandleError(fmt.Errorf(\"error decoding object tombstone, invalid type\"))\n\t\t\treturn\n\t\t}\n\t\tklog.V(4).Infof(\"Recovered deleted object '%s' from tombstone\", object.GetName())\n\t}\n\n\tklog.V(4).Infof(\"Processing object: %s\", object.GetName())\n\tif ownerRef := metav1.GetControllerOf(object); ownerRef != nil {\n\t\t// If this object is not owned by a Apimanager, we should not do anything more with it.\n\t\tif ownerRef.Kind != \"APIManager\" {\n\t\t\treturn\n\t\t}\n\n\t\tapimanager, err := c.apimanagerslister.APIManagers(object.GetNamespace()).Get(ownerRef.Name)\n\t\tif err != nil {\n\t\t\tklog.V(4).Infof(\"ignoring orphaned object '%s' of apimanager '%s'\", object.GetSelfLink(), ownerRef.Name)\n\t\t\treturn\n\t\t}\n\n\t\tc.enqueueApimanager(apimanager)\n\t\treturn\n\t}\n}", "func (p *Plan) Parse(obj objects.ObjectConfig) (objects.Object, error) {\n\tif p == nil {\n\t\tp = &Plan{}\n\t}\n\tp.position = obj.Position\n\tp.color = obj.Color\n\treturn p, nil\n}", "func ParseDeleteObjectOutput(output *DeleteObjectOutput) {\n\tif versionID, ok := output.ResponseHeaders[HEADER_VERSION_ID]; ok {\n\t\toutput.VersionId = versionID[0]\n\t}\n\n\tif deleteMarker, ok := output.ResponseHeaders[HEADER_DELETE_MARKER]; ok {\n\t\toutput.DeleteMarker = deleteMarker[0] == \"true\"\n\t}\n}", "func (pm *PipelineManager) handleObject(obj interface{}) {\n\tvar object metav1.Object\n\tvar ok bool\n\tif object, ok = obj.(metav1.Object); !ok {\n\t\ttombstone, ok := obj.(cache.DeletedFinalStateUnknown)\n\t\tif !ok {\n\t\t\tutilruntime.HandleError(fmt.Errorf(\"error decoding object, invalid type\"))\n\t\t\treturn\n\t\t}\n\t\tobject, ok = tombstone.Obj.(metav1.Object)\n\t\tif !ok {\n\t\t\tutilruntime.HandleError(fmt.Errorf(\"error decoding object tombstone, invalid type\"))\n\t\t\treturn\n\t\t}\n\t\tlog.Infof(\"Recovered deleted object '%s' from tombstone\", object.GetName())\n\t}\n\tif ownerRef := metav1.GetControllerOf(object); ownerRef != nil {\n\t\t// If this object is not owned by a Pipeline, we should not do anything more\n\t\t// with it.\n\t\tif ownerRef.Kind != api.PipelineResourceKind {\n\t\t\treturn\n\t\t}\n\n\t\tpipeline, err := pm.pipelinesLister.Pipelines(object.GetNamespace()).Get(ownerRef.Name)\n\t\tif err != nil {\n\t\t\tlog.Infof(\"ignoring orphaned object '%s' of pipeline '%s'\", object.GetSelfLink(), ownerRef.Name)\n\t\t\treturn\n\t\t}\n\n\t\tlog.Infof(\"[PipelineManager.handleObject] enqueue pipeline %s due to %s\", pipeline.Name, object.GetSelfLink())\n\t\tpm.enqueuePipeline(pipeline)\n\t\treturn\n\t}\n}", "func getMultipartObjectInfo(storage StorageAPI, bucket, object string) (info MultipartObjectInfo, err error) {\n\toffset := int64(0)\n\tr, err := storage.ReadFile(bucket, pathJoin(object, multipartMetaFile), offset)\n\tif err != nil {\n\t\treturn MultipartObjectInfo{}, err\n\t}\n\tdecoder := json.NewDecoder(r)\n\terr = decoder.Decode(&info)\n\tif err != nil {\n\t\treturn MultipartObjectInfo{}, err\n\t}\n\treturn info, nil\n}", "func (unlink *FuseUnlinkIn) ParseBinary(bcontent []byte) error {\n\n\tlength := len(bcontent)\n\tunlink.Path = string(bcontent[:length-1])\n\treturn nil\n}", "func (bucket CryptoBucket) ProcessObject(objectKey string, process string, options ...oss.Option) (oss.ProcessObjectResult, error) {\n\tvar out oss.ProcessObjectResult\n\treturn out, fmt.Errorf(\"CryptoBucket doesn't support ProcessObject\")\n}", "func (e *FileEvent) SetObject(o File) {\n\te.File = o\n}", "func (o *TokenResponse) SetObject(v string) {\n\to.Object = v\n}", "func (m *Machine) loadObject(i Word) *object {\n\to := new(object)\n\tif m.Version() <= 3 {\n\t\tbase := m.objectTableAddress() + (31 * 2) + Address((i-1)*9)\n\t\tcopy(o.Attributes[:4], m.memory[base:])\n\t\to.Parent = Word(m.loadByte(base + 4))\n\t\to.Sibling = Word(m.loadByte(base + 5))\n\t\to.Child = Word(m.loadByte(base + 6))\n\t\to.PropertyBase = Address(m.loadWord(base + 7))\n\t} else {\n\t\tbase := m.objectTableAddress() + (63 * 2) + Address((i-1)*14)\n\t\tcopy(o.Attributes[:6], m.memory[base:])\n\t\to.Parent = m.loadWord(base + 6)\n\t\to.Sibling = m.loadWord(base + 8)\n\t\to.Child = m.loadWord(base + 10)\n\t\to.PropertyBase = Address(m.loadWord(base + 12))\n\t}\n\treturn o\n}", "func (cs *Record) ParseHeader(line string) error {\n\tarr := strings.Split(line, \":\")\n\tif len(arr) != 2 {\n\t\treturn ErrInvalidHeader\n\t}\n\n\tcs.Author = arr[0]\n\tcs.ID = arr[1]\n\n\treturn nil\n}", "func (s *BasePlSqlParserListener) EnterPackage_obj_body(ctx *Package_obj_bodyContext) {}" ]
[ "0.73483473", "0.697004", "0.6881234", "0.67872524", "0.66017425", "0.64145845", "0.6197654", "0.61412305", "0.6138999", "0.5959913", "0.5944723", "0.59063154", "0.566305", "0.55772364", "0.5557991", "0.5534291", "0.5483775", "0.5458577", "0.5425335", "0.533449", "0.5321743", "0.5320326", "0.53086936", "0.5279865", "0.52400666", "0.5233387", "0.5209686", "0.52020776", "0.51947653", "0.5173282", "0.5170123", "0.5146075", "0.5139959", "0.5116233", "0.5099469", "0.5096089", "0.5093288", "0.5083997", "0.50718087", "0.5050788", "0.5046262", "0.50414723", "0.5026317", "0.5020158", "0.50051886", "0.4996533", "0.49851453", "0.49737546", "0.4972179", "0.49594423", "0.4934531", "0.49335188", "0.49283868", "0.4915186", "0.4908305", "0.489914", "0.48965466", "0.48900053", "0.48831913", "0.48781064", "0.48740688", "0.48709303", "0.48607346", "0.48387036", "0.478413", "0.47807208", "0.4778836", "0.47645983", "0.47608986", "0.47591856", "0.4758281", "0.47480676", "0.47424975", "0.47322977", "0.47270238", "0.47169185", "0.47152227", "0.4696613", "0.46954474", "0.46938643", "0.4687304", "0.46867666", "0.46847987", "0.46845356", "0.46829113", "0.46819067", "0.46714276", "0.46669346", "0.46533483", "0.4638924", "0.46334937", "0.4604899", "0.46005926", "0.4592545", "0.45902935", "0.45880252", "0.45878914", "0.45865658", "0.4582011", "0.4580451" ]
0.77521014
0
AddEntry adds an entry to the end of a, with the content from r.
func (a *Archive) AddEntry(typ EntryType, name string, mtime int64, uid, gid int, mode os.FileMode, size int64, r io.Reader) { off, err := a.f.Seek(0, os.SEEK_END) if err != nil { log.Fatal(err) } n, err := fmt.Fprintf(a.f, entryHeader, exactly16Bytes(name), mtime, uid, gid, mode, size) if err != nil || n != entryLen { log.Fatal("writing entry header: ", err) } n1, _ := io.CopyN(a.f, r, size) if n1 != size { log.Fatal(err) } if (off+size)&1 != 0 { a.f.Write([]byte{0}) // pad to even byte } a.Entries = append(a.Entries, Entry{ Name: name, Type: typ, Mtime: mtime, Uid: uid, Gid: gid, Mode: mode, Data: Data{off + entryLen, size}, }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (l *RaftLog) addEntry(term uint64, data []byte) {\n\tnewEntry := pb.Entry{\n\t\tIndex: l.LastIndex() + 1,\n\t\tTerm: term,\n\t\tData: data,\n\t}\n\tl.entries = append(l.entries, newEntry)\n\tl.pendingEntries = append(l.pendingEntries, newEntry)\n}", "func (f *Feed) AddEntry(\n\ttitle string,\n\turl string,\n\tid string,\n\tupdatedDate time.Time,\n\tpubDate time.Time,\n\tauthorName string,\n\tauthorURL string,\n\tauthorEmail string,\n\tcontentHTML string) error {\n\n\tf.Entries = append(f.Entries, Entry{\n\t\tTitle: title,\n\t\tLink: Link{\n\t\t\tRel: \"alternate\",\n\t\t\tType: \"text/html\",\n\t\t\tHref: url,\n\t\t},\n\t\tID: id,\n\t\tUpdated: updatedDate,\n\t\tPublished: pubDate,\n\t\tAuthor: Author{\n\t\t\tName: authorName,\n\t\t\tURI: authorURL,\n\t\t\tEmail: authorEmail,\n\t\t},\n\t\tContent: Content{\n\t\t\tType: \"html\",\n\t\t\tText: contentHTML,\n\t\t},\n\t})\n\n\treturn nil\n}", "func (s *storage) appendEntry(e *entry) {\n\tassert(e.index == s.lastLogIndex+1)\n\tw := new(bytes.Buffer)\n\tif err := e.encode(w); err != nil {\n\t\tpanic(bug{fmt.Sprintf(\"entry.encode(%d)\", e.index), err})\n\t}\n\tif err := s.log.Append(w.Bytes()); err != nil {\n\t\tpanic(opError(err, \"Log.Append\"))\n\t}\n\ts.lastLogIndex, s.lastLogTerm = e.index, e.term\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 (s *Service) Add(r *http.Request, args *AddEntryArgs, result *AddResponse) error {\n\tif args.UserID == \"\" {\n\t\tresult.Message = uidMissing\n\t\treturn nil\n\t}\n\tentryType := args.Type\n\tif entryType == \"\" {\n\t\tresult.Message = \"Entry type is missing\"\n\t\treturn nil\n\t} else if (entryType != EntryTypePim) && (entryType != EntryTypeBookmark) && (entryType != EntryTypeOrg) {\n\t\tresult.Message = \"Unknown entry type\"\n\t\treturn nil\n\t}\n\tcontent := args.Content\n\tif content == \"\" {\n\t\tresult.Message = \"Empty content not allowed\"\n\t\treturn nil\n\t}\n\ts.Log.Infof(\"received '%s' entry: '%s'\", entryType, content)\n\n\tcoll := s.Session.DB(MentatDatabase).C(args.UserID)\n\n\tentry := Entry{}\n\tmgoErr := coll.Find(bson.M{\"content\": content}).One(&entry)\n\tif mgoErr != nil {\n\t\tif mgoErr.Error() == MongoNotFound {\n\t\t\tentry.Type = args.Type\n\t\t\tentry.Content = content\n\t\t\ttags := args.Tags\n\t\t\tif len(tags) > 0 {\n\t\t\t\tvar lowerTags []string\n\t\t\t\tfor _, tag := range tags {\n\t\t\t\t\tlowerTags = append(lowerTags, strings.ToLower(tag))\n\t\t\t\t}\n\t\t\t\ttags := lowerTags\n\t\t\t\tentry.Tags = tags\n\t\t\t}\n\t\t\tif args.Scheduled != \"\" {\n\t\t\t\tscheduled, err := time.Parse(DatetimeLayout, args.Scheduled)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tentry.Scheduled = scheduled\n\t\t\t}\n\t\t\tif args.Deadline != \"\" {\n\t\t\t\tdeadline, err := time.Parse(DatetimeLayout, args.Deadline)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tentry.Deadline = deadline\n\t\t\t}\n\n\t\t\tnow := time.Now()\n\t\t\tentry.AddedAt = now\n\t\t\tentry.ModifiedAt = now\n\n\t\t\tif args.Priority != \"\" {\n\t\t\t\trexp, err := regexp.Compile(\"\\\\#[A-Z]$\")\n\t\t\t\tif err != nil {\n\t\t\t\t\tpanic(err) // sentinel, should fail, because such error is predictable\n\t\t\t\t}\n\t\t\t\tif rexp.Match([]byte(args.Priority)) {\n\t\t\t\t\tentry.Priority = args.Priority\n\t\t\t\t} else {\n\t\t\t\t\tresult.Message = \"Malformed priority value\"\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif args.TodoStatus != \"\" {\n\t\t\t\tentry.TodoStatus = strings.ToUpper(args.TodoStatus)\n\t\t\t}\n\n\t\t\tif (PostMetadata{}) != args.Metadata {\n\t\t\t\tentry.Metadata = args.Metadata\n\t\t\t}\n\n\t\t\tentry.UUID = uuid.NewV4().String()\n\t\t\tmgoErr = coll.Insert(&entry)\n\t\t\tif mgoErr != nil {\n\t\t\t\ts.Log.Infof(\"failed to insert entry: %s\", mgoErr.Error())\n\t\t\t\tresult.Message = fmt.Sprintf(\"failed to insert entry: %s\", mgoErr.Error())\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tresult.Message = entry.UUID\n\t\t\treturn nil\n\t\t}\n\t\ts.Log.Infof(\"mgo error: %s\", mgoErr)\n\t\tresult.Message = fmt.Sprintf(\"mgo error: %s\", mgoErr)\n\t\treturn nil\n\t}\n\tresult.Message = \"Already exists, skipping\"\n\treturn nil\n}", "func (s *DnsServer) AddEntry(name string, rr dns.RR) {\n\tc := s.NewControllerForName(dns.CanonicalName(name))\n\tc.AddRecords([]dns.RR{rr})\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 ReplicaServer) AppendEntry(ctx context.Context, req *proto.AppendEntryReq) (*proto.AppendEntryResp, error) {\n\ts.R.mu.Lock()\n\tdefer s.R.mu.Unlock()\n\n\tif req.Term >= s.R.term {\n\t\ts.R.term = req.Term\n\t\ts.R.lastPinged = time.Now()\n\t\ts.R.setLeader(req.Id)\n\t\ts.R.lastCommit = req.LastCommit\n\t\ts.R.execute()\n\n\t\t// Check if preceding entry exists first, unless first entry\n\t\tif req.PreIndex == -1 || (req.PreIndex < int64(len(s.R.log)) && s.R.log[req.PreIndex].Term == req.PreTerm) {\n\t\t\t// Append entries to log\n\t\t\tentries := req.Entries\n\n\t\t\tif len(entries) == 0 {\n\t\t\t\t// Replica up to date\n\t\t\t\treturn &proto.AppendEntryResp{Ok: true}, nil\n\t\t\t}\n\n\t\t\tsort.Slice(entries, func(i, j int) bool { return entries[i].Index < entries[j].Index })\n\n\t\t\tnumNeed := entries[len(entries)-1].Index + 1 - int64(len(s.R.log))\n\t\t\tif numNeed > 0 {\n\t\t\t\ts.R.log = append(s.R.log, make([]*proto.Entry, numNeed)...)\n\t\t\t}\n\t\t\tfor _, e := range entries {\n\t\t\t\ts.R.log[e.Index] = e\n\t\t\t}\n\n\t\t\treturn &proto.AppendEntryResp{Ok: true}, nil\n\t\t}\n\t}\n\treturn &proto.AppendEntryResp{Ok: false}, nil\n}", "func (f *LogFile) appendEntry(e *LogEntry) error {\n\t// Marshal entry to the local buffer.\n\tf.buf = appendLogEntry(f.buf[:0], e)\n\n\t// Save the size of the record.\n\te.Size = len(f.buf)\n\n\t// Write record to file.\n\tn, err := f.w.Write(f.buf)\n\tif err != nil {\n\t\t// Move position backwards over partial entry.\n\t\t// Log should be reopened if seeking cannot be completed.\n\t\tif n > 0 {\n\t\t\tf.w.Reset(f.file)\n\t\t\tif _, err := f.file.Seek(int64(-n), io.SeekCurrent); err != nil {\n\t\t\t\tf.Close()\n\t\t\t}\n\t\t}\n\t\treturn err\n\t}\n\n\t// Update in-memory file size & modification time.\n\tf.size += int64(n)\n\tf.modTime = time.Now()\n\n\treturn nil\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 (r *Raft) AppendEntry(msg string) int {\n\tr.Log = append(r.Log, fmt.Sprintf(\"%d,%s\", r.CurrentTerm, msg))\n\treturn r.GetLastLogIndex()\n}", "func (f *File) Add(entry entry) {\n\tif err := doError(); err != nil {\n\t\tfmt.Println(err)\n\t}\n}", "func (j *Journal) AddEntry(entry entry.Entry) {\n\tj.Entries = append(j.Entries, entry)\n\tj.NumEntries++\n\n\treturn\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 (rf *Raft) AppendEntry(args AppendEntryArgs, reply *AppendEntryReply) {\n\t// Your code here.\n\trf.mu.Lock()\n\tdefer rf.mu.Unlock()\n\n\tif args.Term < rf.currentTerm {\n\t\treply.Success = false\n\t\treply.Term = rf.currentTerm\n\t\treturn\n\t}\n\n\trf.state = FOLLOWER\n\trf.currentTerm = args.Term\n\trf.votedFor = -1\n\treply.Term = args.Term\n\n\tif args.PrevLogIndex >= 0 &&\n\t\t(len(rf.log)-1 < args.PrevLogIndex ||\n\t\t\trf.log[args.PrevLogIndex].Term != args.PrevLogTerm) {\n\t\treply.Success = false\n\t\treply.CommitIndex = min(len(rf.log)-1, args.PrevLogIndex)\n\t\tfor reply.CommitIndex >= 0 &&\n\t\t\trf.log[reply.CommitIndex].Term != args.PrevLogTerm {\n\t\t\treply.CommitIndex--\n\t\t}\n\t} else if args.Entries != nil {\n\t\trf.log = append(rf.log[:args.PrevLogIndex+1], args.Entries...)\n\t\tif len(rf.log) > args.LeaderCommit {\n\t\t\trf.commitIndex = args.LeaderCommit\n\t\t\t//TODO:commitlog\n\t\t\tgo rf.CommitLog()\n\t\t}\n\t\treply.CommitIndex = len(rf.log) - 1\n\t\treply.Success = true\n\t} else {\n\t\tif len(rf.log) > args.LeaderCommit {\n\t\t\trf.commitIndex = args.LeaderCommit\n\t\t\t//TODO:commitlog\n\t\t\tgo rf.CommitLog()\n\t\t}\n\t\treply.CommitIndex = args.PrevLogIndex\n\t\treply.Success = true\n\t}\n\trf.persist()\n\trf.timer.Reset(properTimeDuration(rf.state))\n}", "func (m *Member) AppendEntry(leader string, term uint64, value int64, prevLogID int64) (bool, error) {\n\tlog.Infoln(\"Requesting log entry of\", m.Name, \"Value\", value)\n\tvar conn *grpc.ClientConn\n\tconn, err := grpc.Dial(m.Address(), grpc.WithInsecure())\n\tif err != nil {\n\t\treturn false, NewRaftError(m, err)\n\t}\n\tdefer conn.Close()\n\tapi := raftapi.NewRaftServiceClient(conn)\n\tctx := context.Background()\n\tresponse, err := api.AppendEntry(ctx, &raftapi.AppendEntryRequest{\n\t\tTerm: term,\n\t\tLeader: leader,\n\t\tPrevLogId: prevLogID,\n\t\tPrevLogTerm: term,\n\t\tEntry: &raftapi.LogEntry{\n\t\t\tTerm: term,\n\t\t\tValue: value,\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn false, NewRaftError(m, err)\n\t}\n\n\treturn response.Success, nil\n}", "func (lw *StandardLogWriter) AddEntry(opEntry OperationEntry) {\n\tlw.OpEntries = append(lw.OpEntries, opEntry)\n}", "func (b *Backend) addEntry(s string) error {\n\tfp, err := os.OpenFile(b.config.omwFile, os.O_APPEND|os.O_RDWR|os.O_CREATE, 0644)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"can't open or create %s: %q\", b.config.omwFile, err)\n\t}\n\tdefer fp.Close()\n\tdata := SavedItems{}\n\tentry := SavedEntry{}\n\tentry.ID = uuid.New().String()\n\tentry.End = time.Now()\n\tentry.Task = s\n\tdata.Entries = append(data.Entries, entry)\n\tentriesBytes, err := toml.Marshal(data)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"can't marshal data\")\n\t}\n\ttoSave := string(entriesBytes)\n\tfileLock := flock.New(b.config.omwFile)\n\tlocked, err := fileLock.TryLock()\n\tdefer fileLock.Unlock()\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"unable to get file lock\")\n\t}\n\tif !locked {\n\t\treturn errors.New(\"unable to get file lock\")\n\t}\n\t_, err = fp.WriteString(toSave)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"error saving new data\")\n\t}\n\treturn nil\n}", "func (t *RicTable) Add(c *RicEntry) {\n\tt.Mutex.Lock()\n\tdefer t.Mutex.Unlock()\n\n\tt.Entries[c.Rt] = c\n}", "func (s *RaftServer) AppendEntry(_ context.Context, request *raftapi.AppendEntryRequest) (*raftapi.AppendEntryResponse, error) {\n\tlog.WithFields(s.LogFields()).Debugln(\"Received AppendEntry from\", request.Leader)\n\ts.lastHeartbeat = time.Now()\n\tterm := s.getTerm()\n\tif request.Term < term {\n\t\tlog.WithFields(s.LogFields()).Warnln(\"Term\", request.Term, \"Less than my term\", term)\n\t\treturn &raftapi.AppendEntryResponse{Term: term}, nil\n\t} else if request.Term >= term {\n\t\ts.role = Follower\n\t\tif err := s.setTerm(request.Term); err != nil {\n\t\t\tlog.WithFields(s.LogFields()).Errorln(\"Unable to update my term\")\n\t\t\treturn nil, model.NewRaftError(&s.member, err)\n\t\t}\n\t}\n\ts.leaderID = request.Leader\n\tsize, _ := s.logRepo.LogSize()\n\tread, _ := s.logRepo.Read(request.PrevLogId)\n\tif request.PrevLogId == -1 || uint64(request.PrevLogId) <= size && read.Term == request.PrevLogTerm {\n\t\tif size > 0 {\n\t\t\t_ = s.logRepo.TruncateToEntryNo(request.PrevLogId)\n\t\t}\n\t\tif request.Entry != nil {\n\t\t\t_, _ = s.logRepo.Create(request.Entry.Term, request.Entry.Value)\n\t\t}\n\t\treturn &raftapi.AppendEntryResponse{Term: term, Success: true}, nil\n\t}\n\treturn &raftapi.AppendEntryResponse{Term: term}, nil\n}", "func (h *History) Add(entry string) {\n\th.lock.Lock()\n\tdefer h.lock.Unlock()\n\n\tmax := cap(h.entries)\n\th.head = (h.head + 1) % max\n\th.entries[h.head] = entry\n\tif h.size < max {\n\t\th.size++\n\t}\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 (c *Client) AddEntryToInvestigation(investigationID string, entryData interface{}, format string) (*Entry, error) {\n\tentry := updateEntry{InvestigationID: investigationID, ContentsFormat: format}\n\tcontents, err := json.Marshal(entryData)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tentry.Contents = string(contents)\n\tdata, err := json.Marshal(entry)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tres := &Entry{}\n\terr = c.req(\"POST\", \"entry/formatted\", \"\", bytes.NewBuffer(data), res)\n\treturn res, err\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 (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 (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 (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 (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 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 (c *EntryCache) add(e *Entry) error {\n\thashes, err := allHashes(e, c.hashes)\n\tif err != nil {\n\t\treturn err\n\t}\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\tif _, present := c.entries[e.name]; present {\n\t\t// log or fail...?\n\t\tc.log.Warning(\"[cache] Overwriting cache entry '%s'\", e.name)\n\t} else {\n\t\tc.log.Info(\"[cache] Adding entry for '%s'\", e.name)\n\t}\n\tc.entries[e.name] = e\n\tfor _, h := range hashes {\n\t\tc.lookupMap[h] = e\n\t}\n\treturn nil\n}", "func (b *CompactableBuffer) Add(data []byte) (*EntryAddress, error) {\n\tentry := b.allocateEntry(data)\n\tbytes, err := entry.ToBytes()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Invalid entry size %v\", err)\n\t}\n\tif len(bytes) >= int(entry.entrySize) {\n\t\treturn nil, fmt.Errorf(\"Invalid entry size e:%v,h:%v\", len(bytes), int(entry.entrySize))\n\t}\n\n\twritableBuffer := b.writableBuffer()\n\tposition, err := writableBuffer.acquireAddress(entry)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t_, err = writableBuffer.Write(position, bytes...)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Failed to write data at %v due %v\", position, err)\n\t}\n\tatomic.AddInt64(&b.count, 1)\n\tatomic.AddInt64(&b.entrySize, entry.entrySize)\n\tatomic.AddInt64(&b.dataSize, entry.dataSize)\n\n\tresult := NewEntryAddress(writableBuffer.config.BufferId, position)\n\n\twritableBuffer.addAddress(result)\n\treturn result, nil\n}", "func (service *ProjectService) AddManifestEntry(at int, entry *world.ManifestEntry) error {\n\treturn service.commander.Register(\n\t\tcmd.Named(\"AddManifestEntry\"),\n\t\tcmd.Forward(func(modder world.Modder) error {\n\t\t\treturn service.mod.World().InsertEntry(at, entry)\n\t\t}),\n\t\tcmd.Reverse(func(modder world.Modder) error {\n\t\t\treturn service.mod.World().RemoveEntry(at)\n\t\t}),\n\t)\n}", "func (s *playlistService) AddEntry(ctx context.Context, id uint, entry *models.PlaylistEntry) error {\n\t// Check if the playlist exists\n\t_, err := s.Get(ctx, id)\n\tif err != nil {\n\t\treturn err\n\t}\n\tentry.RequestedBy = strings.TrimSpace(entry.RequestedBy)\n\tif entry.RequestedBy == \"\" {\n\t\treturn MakeErrorWithData(\n\t\t\thttp.StatusBadRequest,\n\t\t\tErrCodeRequiredFieldMissing,\n\t\t\t\"RequestedBy must not be empty\",\n\t\t\tmap[string]string{\n\t\t\t\t\"field\": \"requestedBy\",\n\t\t\t},\n\t\t)\n\t}\n\t// Check if the video exists\n\t_, err = s.videoRepo.GetByID(entry.VideoHash)\n\tif err != nil {\n\t\tif err == repos.ErrEntityNotExisting {\n\t\t\treturn MakeError(\n\t\t\t\thttp.StatusBadRequest,\n\t\t\t\tErrCodeVideoNotFound,\n\t\t\t\t\"The requested video does not exist\",\n\t\t\t)\n\t\t}\n\t\treturn MakeErrorWithData(\n\t\t\thttp.StatusInternalServerError,\n\t\t\tErrCodeRepoError,\n\t\t\t\"Failed to retrieve video information\",\n\t\t\terr,\n\t\t)\n\t}\n\tif err := s.repo.AddEntry(id, entry); err != nil {\n\t\treturn MakeErrorWithData(\n\t\t\thttp.StatusInternalServerError,\n\t\t\tErrCodeRepoError,\n\t\t\tfmt.Sprintf(\"Error while adding entry to playlist #%d\", id),\n\t\t\terr,\n\t\t)\n\t}\n\t// NumRequested++\n\tif err := s.videoRepo.BumpNumRequested(entry.VideoHash); err != nil {\n\t\t// Do not report the error back, but log it!\n\t\ts.logger.WithError(err).WithField(log.FldVideo, entry.VideoHash).Error(\"Failed to update request counter for video\")\n\t}\n\treturn nil\n}", "func (this *RouterTable) AddEntries(entry ...*RouterEntry) (*RouterTable, error) {\n\t//copy the router table\n\trouterTable, err := this.Rebuild()\n\tif err != nil {\n\t\treturn routerTable, err\n\t}\n\n\tentries := make([]*RouterEntry, 0)\n\n\t//build a new entries array with every *except the ones we are adding\n\tfor _, e := range routerTable.Entries {\n\t\t//check if this entry matches any of the entries we are adding.\n\t\tfound := false\n\t\tfor _, en := range entry {\n\t\t\tif e.Id() == en.Id() {\n\t\t\t\tfound = true\n\t\t\t}\n\t\t}\n\t\tif !found {\n\t\t\tentries = append(entries, e)\n\t\t}\n\t}\n\t//now add the new ones\n\tfor _, en := range entry {\n\t\tentries = append(entries, en)\n\t}\n\trouterTable.Entries = entries\n\trouterTable.UpdateRevision()\n\trouterTable, err = routerTable.Rebuild()\n\treturn routerTable, err\n}", "func (log *LogFile) LogFileAddEntry(sym *SymFile, entry LogEntry) error {\n\tstdlog.Printf(\"Adding log entry=%v\\n\", entry)\n\n\t// Wrap case on 1st iteration\n\t// then we would go over the end of the log file\n\t// so start overwriting the beginning of the file\n\tif log.tailOffset <= log.headOffset && log.headOffset+uint64(entry.SizeBytes()) > log.maxSizeBytes {\n\t\tstdlog.Printf(\"Do an internal log wrap\\n\")\n\n\t\t// TODO: need to write some marker at the end of the last record or know we are at EOF\n\t\t// ie. at EOF or have filler space upto EOF\n\t\t// Do we mark last valid record in any way different or just zero data at end?\n\t\t// Note the highest point after valid data.\n\t\tlog.numSizeBytes = log.headOffset\n\n\t\tlog.headOffset = 0\n\t\tlog.wrapNum++\n\t\tlog.setWriteZeroPos()\n\t\tlog.nextLogID.wrap()\n\t} \n\t\n\tif log.wrapNum > 0 && log.headOffset <= log.tailOffset {\n\t\t// If we have wrapped then\n\t\t// we need to update the tail before new record writes over it\n\t\tlog.tailPush(sym, entry.SizeBytes())\n\t}\n\n\t// Now have room for new entry to go at the head and tail is out of way\n\n\tentry.logID = log.nextLogID\n\n\t// write our data to the file\n\t_, err := entry.Write(log.entryWriteFile, log.byteOrder)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlog.NumEntries++\n\tstdlog.Printf(\"len of log write entry: %v, numRecs: %v\\n\", entry.SizeBytes(), log.NumEntries)\n\n\t// update meta file - head points to next spot to write to\n\t// unless it is time to wrap to the start again\n\terr = log.updateHeadTail()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlog.nextLogID.inc()\n\n\tstdlog.Printf(\"log.nextLogID: %v\\n\", log.nextLogID)\n\treturn nil\n}", "func (c *Controller) AddNewURLEntry(urlEntry *URLEntry) {\n\tselect {\n\tcase <-c.ctx.Done():\n\t\treturn\n\tcase c.subTree <- urlEntry:\n\t}\n}", "func (c *EntryCache) AddFromRequest(req *ocsp.Request, upstream []string) ([]byte, error) {\n\te := NewEntry(c.log, c.clk)\n\te.serial = req.SerialNumber\n\tvar err error\n\te.request, err = req.Marshal()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\te.responders = upstream\n\tserialHash := sha256.Sum256(e.serial.Bytes())\n\tkey := sha256.Sum256(append(append(req.IssuerNameHash, req.IssuerKeyHash...), serialHash[:]...))\n\te.name = fmt.Sprintf(\"%X\", key)\n\te.issuer = c.issuers.getFromRequest(req.IssuerNameHash, req.IssuerKeyHash)\n\tif e.issuer == nil {\n\t\treturn nil, errors.New(\"No issuer in cache for request\")\n\t}\n\tctx, cancel := context.WithTimeout(context.Background(), c.requestTimeout)\n\tdefer cancel()\n\terr = e.init(ctx, c.StableBackings, c.client)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tc.addSingle(e, key)\n\treturn e.response, nil\n}", "func (znp *Znp) UtilSrcMatchAddEntry(addrMode AddrMode, address string, panId uint16) (rsp *StatusResponse, err error) {\n\treq := &UtilSrcMatchAddEntry{AddrMode: addrMode, Address: address, PanID: panId}\n\terr = znp.ProcessRequest(unp.C_SREQ, unp.S_UTIL, 0x21, req, &rsp)\n\treturn\n}", "func (h *Hostman) Add(line string) error {\n\tre := regexp.MustCompile(`^([0-9a-f:\\.]{7,39})@(\\S+)$`)\n\tparts := re.FindStringSubmatch(line)\n\n\tif len(parts) < 3 {\n\t\treturn errors.New(\"Invalid host entry format\")\n\t}\n\n\tline = strings.Replace(line, \"@\", \"\\t\", 1)\n\tline = strings.Replace(line, \",\", \"\\x20\", -1)\n\n\tentry, err := h.Parse(line)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif h.AlreadyExists(entry) {\n\t\treturn errors.New(\"Entry is already in hosts file\")\n\t}\n\n\th.entries = append(h.entries, entry)\n\n\treturn h.Write()\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 (c *Controller) AddNewRecordURLEntry(urlEntry *URLEntry) {\n\tselect {\n\tcase <-c.ctx.Done():\n\t\treturn\n\tcase c.record <- urlEntry:\n\t}\n}", "func (s *Set) Add(e *spb.Entry) error {\n\tif e == nil {\n\t\ts.addErrors++\n\t\treturn errors.New(\"entryset: nil entry\")\n\t} else if (e.Target == nil) != (e.EdgeKind == \"\") {\n\t\ts.addErrors++\n\t\treturn fmt.Errorf(\"entryset: invalid entry: target=%v/kind=%v\", e.Target == nil, e.EdgeKind == \"\")\n\t}\n\ts.addCalls++\n\tsrc := s.addVName(e.Source)\n\tif e.Target != nil {\n\t\ts.addEdge(src, edge{\n\t\t\tkind: s.enter(e.EdgeKind),\n\t\t\ttarget: s.addVName(e.Target),\n\t\t})\n\t} else {\n\t\ts.addFact(src, fact{\n\t\t\tname: s.enter(e.FactName),\n\t\t\tvalue: s.enter(string(e.FactValue)),\n\t\t})\n\t}\n\treturn nil\n}", "func (r *RaftNode) AppendEntries(ae AppendEntriesStruct, response *RPCResponse) error {\n\tr.Lock()\n\tdefer r.Unlock()\n\tif r.verbose {\n\t\tlog.Printf(\"AppendEntries(). ae: %s\", ae.String())\n\t\tlog.Printf(\"My log: %s\", r.Log.String())\n\t}\n\n\tresponse.Term = r.CurrentTerm\n\n\tif ae.LeaderID == r.currentLeader {\n\t\tif r.verbose {\n\t\t\tlog.Println(\"AppendEntries from leader - reset tickers\")\n\t\t}\n\t\tr.resetTickers()\n\t}\n\n\t// Reply false if term < currentTerm\n\tif ae.Term < r.CurrentTerm {\n\t\tif r.verbose {\n\t\t\tlog.Println(\"AE from stale term\")\n\t\t}\n\t\tresponse.Term = r.CurrentTerm\n\t\tresponse.Success = false\n\t\treturn nil\n\t}\n\n\t// NOTE - shifting to follower each time might sound misleading, but keeps things uniform\n\tr.shiftToFollower(ae.Term, ae.LeaderID)\n\n\t// Reply false if log doesn't contain an entry at prevLogIndex whose term matches prevLogTerm\n\tif int(ae.PrevLogIndex) >= len(r.Log) || // index out-of-bounds\n\t\tr.Log[ae.PrevLogIndex].Term != ae.PrevLogTerm {\n\t\tif r.verbose {\n\t\t\tlog.Println(\"my PrevLogTerm does not match theirs\")\n\t\t}\n\t\tresponse.Term = r.CurrentTerm\n\t\tresponse.Success = false\n\t\treturn nil\n\t}\n\n\t// If an existing entry conflicts with a new one (same index, but different terms),\n\t// delete the existing entry and all that follow it\n\tif r.verbose {\n\t\tlog.Println(\"Applying entries...\")\n\t}\n\toffset := int(ae.PrevLogIndex) + 1\n\tfor i, entry := range ae.Entries {\n\t\tif i+offset >= len(r.Log) { // We certainly have no conflict\n\t\t\tif r.verbose {\n\t\t\t\tlog.Printf(\"Apply without conflict: index=%d\", i+offset)\n\t\t\t}\n\t\t\tr.append(entry)\n\t\t} else {\n\t\t\tif r.Log[i+offset].Term != ae.Entries[i].Term { // We have conflicting entry\n\t\t\t\tif r.verbose {\n\t\t\t\t\tlog.Printf(\"Conflict - delete suffix! (we have term=%d, they have term=%d). Delete our log from index=%d onwards.\", r.Log[i+offset].Term, ae.Entries[i].Term, i+offset)\n\t\t\t\t}\n\t\t\t\tr.Log = r.Log[:i+offset] // delete the existing entry and all that follow it\n\t\t\t\tr.append(entry) // append the current entry\n\t\t\t\tlog.Printf(\"\\n\\nLog: %s\\n\\n\", stringOneLog(r.Log))\n\t\t\t} else if r.Log[i+offset] != entry {\n\t\t\t\tlog.Printf(\"\\nOURS: %s\\n\\nTHEIRS: %s\", r.Log[i+offset].String(), entry.String())\n\t\t\t\tpanic(\"log safety violation occurred somewhere\")\n\t\t\t}\n\t\t}\n\t}\n\n\tresponse.Success = true\n\tlastIndex := r.getLastLogIndex()\n\n\t// Now we need to decide how to set our local commit index\n\tif ae.LeaderCommit > r.commitIndex {\n\t\tr.commitIndex = min(lastIndex, ae.LeaderCommit)\n\t}\n\tr.executeLog()\n\tr.persistState()\n\treturn nil\n}", "func (p *Resolver) AddExecEntry(entry *model.ProcessCacheEntry) {\n\tp.Lock()\n\tdefer p.Unlock()\n\n\tp.insertExecEntry(entry, model.ProcessCacheEntryFromEvent)\n}", "func writeTarEntry(tf *tar.Writer, path string, r io.Reader, size int64) error {\n\thdr := &tar.Header{\n\t\tMode: 0644,\n\t\tTypeflag: tar.TypeReg,\n\t\tSize: size,\n\t\tName: path,\n\t}\n\tif err := tf.WriteHeader(hdr); err != nil {\n\t\treturn err\n\t}\n\t_, err := io.Copy(tf, r)\n\treturn err\n}", "func (r Row) Add(e Entry) Row {\n\tif e.Size.Size() > r.W*r.H-r.C {\n\t\treturn r\n\t}\n\n\t// Interate over the part of the grid where the entry could be added\n\tfor j := 0; j < r.H-e.Size.H+1; j++ {\n\t\tfor i := 0; i < r.W-e.Size.W+1; i++ {\n\t\t\t// Iterate over the Entry\n\t\t\tif r.Coverage.empty(e.Size.W, e.Size.H, i, j) {\n\t\t\t\tr.Entries = append(r.Entries, e.Pos(i, j))\n\t\t\t\tr.C += e.Size.Size()\n\t\t\t\tr.Coverage.fill(e.Size.W, e.Size.H, i, j)\n\t\t\t\treturn r\n\t\t\t}\n\t\t}\n\t}\n\n\treturn r\n}", "func (o *ordering) newEntry(s string, ces []rawCE) *entry {\n\te := &entry{\n\t\trunes: []rune(s),\n\t\telems: ces,\n\t\tstr: s,\n\t}\n\to.insert(e)\n\treturn e\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 (r *Raft) appendEntries(rpc RPC, a *AppendEntriesRequest) (transition bool) {\n\t// Setup a response\n\tresp := &AppendEntriesResponse{\n\t\tTerm: r.getCurrentTerm(),\n\t\tLastLog: r.getLastLogIndex(),\n\t\tSuccess: false,\n\t}\n\tvar err error\n\tdefer rpc.Respond(resp, err)\n\n\t// Ignore an older term\n\tif a.Term < r.getCurrentTerm() {\n\t\terr = errors.New(\"obsolete term\")\n\t\treturn\n\t}\n\n\t// Increase the term if we see a newer one, also transition to follower\n\t// if we ever get an appendEntries call\n\tif a.Term > r.getCurrentTerm() || r.getState() != Follower {\n\t\tr.currentTerm = a.Term\n\t\tresp.Term = a.Term\n\n\t\t// Ensure transition to follower\n\t\ttransition = true\n\t\tr.setState(Follower)\n\t}\n\n\t// Verify the last log entry\n\tvar prevLog Log\n\tif a.PrevLogEntry > 0 {\n\t\tif err := r.logs.GetLog(a.PrevLogEntry, &prevLog); err != nil {\n\t\t\tr.logW.Printf(\"Failed to get previous log: %d %v\",\n\t\t\t\ta.PrevLogEntry, err)\n\t\t\treturn\n\t\t}\n\t\tif a.PrevLogTerm != prevLog.Term {\n\t\t\tr.logW.Printf(\"Previous log term mis-match: ours: %d remote: %d\",\n\t\t\t\tprevLog.Term, a.PrevLogTerm)\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Add all the entries\n\tfor _, entry := range a.Entries {\n\t\t// Delete any conflicting entries\n\t\tif entry.Index <= r.getLastLogIndex() {\n\t\t\tr.logW.Printf(\"Clearing log suffix from %d to %d\",\n\t\t\t\tentry.Index, r.getLastLogIndex())\n\t\t\tif err := r.logs.DeleteRange(entry.Index, r.getLastLogIndex()); err != nil {\n\t\t\t\tr.logE.Printf(\"Failed to clear log suffix: %w\", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\t// Append the entry\n\t\tif err := r.logs.StoreLog(entry); err != nil {\n\t\t\tr.logE.Printf(\"Failed to append to log: %w\", err)\n\t\t\treturn\n\t\t}\n\n\t\t// Update the lastLog\n\t\tr.setLastLogIndex(entry.Index)\n\t}\n\n\t// Update the commit index\n\tif a.LeaderCommitIndex > 0 && a.LeaderCommitIndex > r.getCommitIndex() {\n\t\tidx := min(a.LeaderCommitIndex, r.getLastLogIndex())\n\t\tr.setCommitIndex(idx)\n\n\t\t// Trigger applying logs locally\n\t\tr.commitCh <- commitTuple{idx, nil}\n\t}\n\n\t// Set success\n\tresp.Success = true\n\treturn\n}", "func appendLogEntry(dst []byte, e *LogEntry) []byte {\n\tvar buf [binary.MaxVarintLen64]byte\n\tstart := len(dst)\n\n\t// Append flag.\n\tdst = append(dst, e.Flag)\n\n\t// Append series id.\n\tn := binary.PutUvarint(buf[:], uint64(e.SeriesID))\n\tdst = append(dst, buf[:n]...)\n\n\t// Append name.\n\tn = binary.PutUvarint(buf[:], uint64(len(e.Name)))\n\tdst = append(dst, buf[:n]...)\n\tdst = append(dst, e.Name...)\n\n\t// Append key.\n\tn = binary.PutUvarint(buf[:], uint64(len(e.Key)))\n\tdst = append(dst, buf[:n]...)\n\tdst = append(dst, e.Key...)\n\n\t// Append value.\n\tn = binary.PutUvarint(buf[:], uint64(len(e.Value)))\n\tdst = append(dst, buf[:n]...)\n\tdst = append(dst, e.Value...)\n\n\t// Calculate checksum.\n\te.Checksum = crc32.ChecksumIEEE(dst[start:])\n\n\t// Append checksum.\n\tbinary.BigEndian.PutUint32(buf[:4], e.Checksum)\n\tdst = append(dst, buf[:4]...)\n\n\treturn dst\n}", "func (r *ExactMatchLookupJobMatchingRowsCollectionRequest) Add(ctx context.Context, reqObj *LookupResultRow) (resObj *LookupResultRow, err error) {\n\terr = r.JSONRequest(ctx, \"POST\", \"\", reqObj, &resObj)\n\treturn\n}", "func (adaType *AdaSuperType) AddSubEntry(name string, from uint16, to uint16) {\n\tvar code [2]byte\n\tcopy(code[:], name)\n\tentry := subSuperEntries{Name: code, From: from, To: to}\n\tadaType.Entries = append(adaType.Entries, entry)\n\tadaType.calcLength()\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 (r Records) Add(a data.Archive) error {\n\treturn r.db.Update(func(tx *bolt.Tx) error {\n\t\tencoded, err := json.Marshal(a)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tb, err := tx.CreateBucketIfNotExists([]byte(\"archive\"))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn b.Put([]byte(a.Timestamp.In(time.UTC).Format(time.RFC3339)), encoded)\n\t})\n}", "func AvAddIndexEntry(st *Stream, pos, t, int64, s, d, f int) int {\n\treturn int(C.av_add_index_entry((*C.struct_AVStream)(st), C.int64_t(pos), C.int64_t(t), C.int(s), C.int(d), C.int(f)))\n}", "func AvAddIndexEntry(st *Stream, pos, t, int64, s, d, f int) int {\n\treturn int(C.av_add_index_entry((*C.struct_AVStream)(st), C.int64_t(pos), C.int64_t(t), C.int(s), C.int(d), C.int(f)))\n}", "func (s *Stream) AmendEntry(entry *stream.StreamEntry, oldTimestamp time.Time) error {\n\t_, err := s.dataTable.Get(oldTimestamp).Replace(entry).RunWrite(s.h.rctx)\n\treturn err\n}", "func (v *invalSet) entry(n fs.Node, entry string) {\n\tv.entries = append(v.entries, inval{n, entry})\n}", "func (s *APAPIServer) AddPortEntry(ctxt context.Context, req *fibcapi.DbPortEntry) (*fibcapi.ApAddPortEntryReply, error) {\n\tif err := s.ctl.AddPortEntry(req); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &fibcapi.ApAddPortEntryReply{}, nil\n}", "func (znp *Znp) UtilBindAddEntry(addrMode AddrMode, dstAddr string, dstEndpoint uint8, clusterIds []uint16) (rsp *UtilBindAddEntryResponse, err error) {\n\treq := &UtilBindAddEntry{AddrMode: addrMode, DstAddr: dstAddr, DstEndpoint: dstEndpoint, ClusterIDs: clusterIds}\n\terr = znp.ProcessRequest(unp.C_SREQ, unp.S_UTIL, 0x4D, req, &rsp)\n\treturn\n}", "func (g *Group) NewEntry() (*Entry, error) {\n\tid, err := uuids.New4(g.db.rand)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\te := &Entry{UUID: id, db: g.db}\n\tg.entries = append(g.entries, e)\n\tg.db.entries = append(g.db.entries, e)\n\treturn e, nil\n}", "func NewEntry(ctx *pulumi.Context,\n\tname string, args *EntryArgs, opts ...pulumi.ResourceOption) (*Entry, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.EntryGroup == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'EntryGroup'\")\n\t}\n\tif args.EntryId == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'EntryId'\")\n\t}\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource Entry\n\terr := ctx.RegisterResource(\"gcp:datacatalog/entry:Entry\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (rf *Raft) AppendEntries(args AppendEntriesArgs, reply *AppendEntriesReply) error {\n\trf.mu.Lock()\n\tdefer rf.mu.Unlock()\n\tif rf.state == Down {\n\t\treturn nil\n\t}\n\n\tlog.Printf(\"[%v] received AppendEntries RPC call: Args%+v\", rf.me, args)\n\tif args.Term > rf.currentTerm {\n\t\tlog.Printf(\"[%v] currentTerm=%d out of date with AppendEntriesArgs.Term=%d\",\n\t\t\trf.me, rf.currentTerm, args.Term)\n\t\trf.toFollower(args.Term)\n\t\trf.leader = args.Leader\n\t}\n\n\treply.Success = false\n\tif args.Term == rf.currentTerm {\n\t\t// two leaders can't coexist. if Raft rfServer receives AppendEntries() RPC, another\n\t\t// leader already exists in this term\n\t\tif rf.state != Follower {\n\t\t\trf.toFollower(args.Term)\n\t\t\trf.leader = args.Leader\n\t\t}\n\t\trf.resetElection = time.Now()\n\n\t\t// does follower log match leader's (-1 is valid)\n\t\tif args.PrevLogIndex == -1 ||\n\t\t\t(args.PrevLogIndex < len(rf.log) && args.PrevLogTerm == rf.log[args.PrevLogIndex].Term) {\n\t\t\treply.Success = true\n\n\t\t\t// merge follower's log with leader's log starting from args.PrevLogTerm\n\t\t\t// skip entries where the term matches where term matches with args.Entries\n\t\t\t// and insert args.Entries from mismatch index\n\t\t\tinsertIdx, appendIdx := args.PrevLogIndex + 1, 0\n\t\t\tfor {\n\t\t\t\tif insertIdx >= len(rf.log) || appendIdx >= len(args.Entries) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tif rf.log[insertIdx].Term != args.Entries[appendIdx].Term {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tinsertIdx++\n\t\t\t\tappendIdx++\n\t\t\t}\n\t\t\t// At the end of this loop:\n\t\t\t// - insertIdx points at the end of the log, or an index where the\n\t\t\t// term mismatches with an entry from the leader\n\t\t\t// - appendIdx points at the end of Entries, or an index where the\n\t\t\t// term mismatches with the corresponding log entry\n\t\t\tif appendIdx < len(args.Entries) {\n\t\t\t\tlog.Printf(\"[%v] append new entries %+v from %d\", rf.me,\n\t\t\t\t\targs.Entries[appendIdx:], insertIdx)\n\t\t\t\trf.log = append(rf.log[:insertIdx], args.Entries[appendIdx:]...)\n\t\t\t\tlog.Printf(\"[%v] new log: %+v\", rf.me, rf.log)\n\t\t\t}\n\n\t\t\t// update rf.commitIndex if the leader considers additional log entries as committed\n\t\t\tif args.LeaderCommit > rf.commitIndex {\n\t\t\t\tif args.LeaderCommit < len(rf.log)-1 {\n\t\t\t\t\trf.commitIndex = args.LeaderCommit\n\t\t\t\t} else {\n\t\t\t\t\trf.commitIndex = len(rf.log)-1\n\t\t\t\t}\n\n\t\t\t\tlog.Printf(\"[%v] updated commitIndex:%d\", rf.me, rf.commitIndex)\n\t\t\t\trf.readyCh <- struct{}{}\n\t\t\t}\n\t\t} else {\n\t\t\t// PrevLogIndex and PrevLogTerm didn't match\n\t\t\t// set ConflictIndex and ConflictTerm to allow leader to send the right entries quickly\n\t\t\tif args.PrevLogIndex >= len(rf.log) {\n\t\t\t\treply.ConflictIndex = len(rf.log)\n\t\t\t\treply.ConflictTerm = -1\n\t\t\t} else {\n\t\t\t\t// PrevLogTerm doesn't match\n\t\t\t\treply.ConflictTerm = rf.log[args.PrevLogIndex].Term\n\t\t\t\tvar idx int\n\t\t\t\tfor idx = args.PrevLogIndex - 1; idx >= 0; idx-- {\n\t\t\t\t\tif rf.log[idx].Term != reply.ConflictTerm {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treply.ConflictIndex = idx + 1\n\t\t\t}\n\t\t}\n\t}\n\n\treply.Term = rf.currentTerm\n\trf.persist()\n\tlog.Printf(\"[%v] AppendEntriesReply sent: %+v\", rf.me, reply)\n\treturn nil\n}", "func (cache *FileCache) Add(key string, length int64, r io.Reader) error {\n\tdata := make([]byte, length)\n\t_, err := io.ReadFull(r, data)\n\tif err != nil && (err == io.EOF || err == io.ErrUnexpectedEOF) {\n\t\treturn io.ErrUnexpectedEOF\n\t}\n\n\tpath := filepath.Join(cache.dir, key)\n\tif _, err := os.Stat(path); err == nil {\n\t\treturn nil\n\t}\n\n\tfile, err := os.Create(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer file.Close()\n\n\tif _, err := file.Write(data); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (p *pool) postEntry(fromName, fromAddr, subject, text, imageExt string) (int, string, error) {\n\tconn := p.Get()\n\tdefer conn.Close()\n\n\tid, err := p.getNewID()\n\tif err != nil {\n\t\treturn 0, \"\", err\n\t}\n\n\t_, err = conn.Do(\n\t\t\"HMSET\",\n\t\tkey(\"entry\", strconv.Itoa(id)),\n\t\t\"from\",\n\t\tfromName,\n\t\t\"mail\",\n\t\tfromAddr,\n\t\t\"subject\",\n\t\tsubject,\n\t\t\"text\",\n\t\ttext,\n\t\t\"fileext\",\n\t\timageExt,\n\t\t\"created\",\n\t\ttime.Now().Format(\"2006-01-02 15:04:05\"),\n\t)\n\tif err != nil {\n\t\treturn 0, \"\", xerrors.Errorf(\"can not post entry: %w\", err)\n\t}\n\n\tif _, err = conn.Do(\"SADD\", key(\"entries\"), id); err != nil {\n\t\treturn 0, \"\", xerrors.Errorf(\"can not save entry id: %s\", err)\n\t}\n\n\ttoken, err := p.createDeleteToken(id)\n\tif err != nil {\n\t\treturn 0, \"\", err\n\t}\n\treturn id, token, nil\n}", "func (c *directClient) PostEntry(ctx context.Context, entry *disc.Entry) error {\n\tc.mx.Lock()\n\tdefer c.mx.Unlock()\n\tc.entries[entry.Static] = entry\n\treturn nil\n}", "func (o *ordering) insert(e *entry) {\n\tif e.logical == noAnchor {\n\t\to.entryMap[e.str] = e\n\t} else {\n\t\t// Use key format as used in UCA rules.\n\t\to.entryMap[fmt.Sprintf(\"[%s]\", e.str)] = e\n\t\t// Also add index entry for XML format.\n\t\to.entryMap[fmt.Sprintf(\"<%s/>\", strings.Replace(e.str, \" \", \"_\", -1))] = e\n\t}\n\to.ordered = append(o.ordered, e)\n}", "func NewEntry(ctx *pulumi.Context,\n\tname string, args *EntryArgs, opts ...pulumi.ResourceOption) (*Entry, error) {\n\tif args == nil || args.EntryGroup == nil {\n\t\treturn nil, errors.New(\"missing required argument 'EntryGroup'\")\n\t}\n\tif args == nil || args.EntryId == nil {\n\t\treturn nil, errors.New(\"missing required argument 'EntryId'\")\n\t}\n\tif args == nil {\n\t\targs = &EntryArgs{}\n\t}\n\tvar resource Entry\n\terr := ctx.RegisterResource(\"gcp:datacatalog/entry:Entry\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "func (u *uploader) uploadEntry(ctx context.Context, proposedEntry models.ProposedEntry) (models.LogEntry, error) {\n\tparams := entries.NewCreateLogEntryParamsWithContext(ctx)\n\tparams.SetProposedEntry(proposedEntry)\n\tlogrus.Debugf(\"Calling Rekor's CreateLogEntry\")\n\tresp, err := u.client.Entries.CreateLogEntry(params)\n\tif err != nil {\n\t\t// In ordinary operation, we should not get duplicate entries, because our payload contains a timestamp,\n\t\t// so it is supposed to be unique; and the default key format, ECDSA p256, also contains a nonce.\n\t\t// But conflicts can fairly easily happen during debugging and experimentation, so it pays to handle this.\n\t\tvar conflictErr *entries.CreateLogEntryConflict\n\t\tif errors.As(err, &conflictErr) && conflictErr.Location != \"\" {\n\t\t\tlocation := conflictErr.Location.String()\n\t\t\tlogrus.Debugf(\"CreateLogEntry reported a conflict, location = %s\", location)\n\t\t\t// We might be able to just GET the returned Location, but let’s use the generated API client.\n\t\t\t// OTOH that requires us to hard-code the URI structure…\n\t\t\tuuidDelimiter := strings.LastIndexByte(location, '/')\n\t\t\tif uuidDelimiter != -1 { // Otherwise the URI is unexpected, and fall through to the bottom\n\t\t\t\tuuid := location[uuidDelimiter+1:]\n\t\t\t\tlogrus.Debugf(\"Calling Rekor's NewGetLogEntryByUUIDParamsWithContext\")\n\t\t\t\tparams2 := entries.NewGetLogEntryByUUIDParamsWithContext(ctx)\n\t\t\t\tparams2.SetEntryUUID(uuid)\n\t\t\t\tresp2, err := u.client.Entries.GetLogEntryByUUID(params2)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"Error re-loading previously-created log entry with UUID %s: %w\", uuid, err)\n\t\t\t\t}\n\t\t\t\treturn resp2.GetPayload(), nil\n\t\t\t}\n\t\t}\n\t\treturn nil, fmt.Errorf(\"Error uploading a log entry: %w\", err)\n\t}\n\treturn resp.GetPayload(), nil\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 NewEntry(e loghttp.Entry) logproto.Entry {\n\treturn logproto.Entry{\n\t\tTimestamp: e.Timestamp,\n\t\tLine: e.Line,\n\t}\n}", "func (r *CompanyGeneralLedgerEntriesCollectionRequest) Add(ctx context.Context, reqObj *GeneralLedgerEntry) (resObj *GeneralLedgerEntry, err error) {\n\terr = r.JSONRequest(ctx, \"POST\", \"\", reqObj, &resObj)\n\treturn\n}", "func (as *Authors) AddFrom(r io.Reader) error {\n\tparsed, err := as.parse(r)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, a := range parsed {\n\t\tas.data = append(as.data, a)\n\t}\n\treturn nil\n}", "func (rbl *RawBytesLog) Append(entry *Entry) error {\n\terr := writeBytesWithLen16(rbl.logFile, entry.Key)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = writeBytesWithLen32(rbl.logFile, entry.Bytes)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn 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 (rf *Raft) AppendEntries(args AppendEntriesArgs, reply *AppendEntriesReply) {\n\trf.mu.Lock()\n\tdefer rf.mu.Unlock()\n\treply.Term = rf.currentTerm\n\tif args.Term < rf.currentTerm {\n\t\t// fmt.Printf(\"APPEND_FAIL0 : %v append with %v, return %v\\n\", rf.me, args.Term, reply.Term)\n\t\treturn\n\t}\n\n\trf.heartbeatChan <- true\n\tif args.Term > rf.currentTerm {\n\t\trf.currentTerm = args.Term\n\t\trf.toFollower()\n\t\trf.persist()\n\t}\n\n\t// fmt.Printf(\"APPEND_TRY : %v append with %v/ %v, %v/ %v\\n\", rf.me, len(rf.log), args.PrevLogIndex, rf.log[args.PrevLogIndex].Term, args.PrevLogTerm)\n\n\tif len(rf.log) <= args.PrevLogIndex {\n\t\treply.Success = false\n\t\treply.LogIndex = len(rf.log)\n\t\t// fmt.Printf(\"APPEND_FAIL1 : %v append with %v, return %v\\n\", rf.me, args.PrevLogIndex, reply.LogIndex)\n\t\treturn\n\t}\n\n\tif rf.log[args.PrevLogIndex].Term != args.PrevLogTerm {\n\t\treply.Success = false\n\t\t// find first one that have same term with entries\n\t\tfor i := args.PrevLogIndex - 1; i > 0; i-- {\n\t\t\tif rf.log[i].Term == args.PrevLogTerm {\n\t\t\t\treply.LogIndex = i\n\t\t\t} else {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif reply.LogIndex < 1 {\n\t\t\treply.LogIndex = 1\n\t\t}\n\t\t// fmt.Printf(\"APPEND_FAIL2 : %v append with %v, %v, return %v\\n\", rf.me, rf.log[args.PrevLogIndex].Term, args.PrevLogTerm, reply.LogIndex)\n\t\treturn\n\t}\n\n\tif len(args.Entries) > 0 {\n\t\t// fmt.Printf(\"APPEND : %v append with %v, %v\\n\", rf.me, args.Entries[0].Term, args.Entries)\n\t}\n\n\trf.log = rf.log[:args.PrevLogIndex+1]\n\tfor _, log := range args.Entries {\n\t\trf.log = append(rf.log, log)\n\t}\n\trf.persist()\n\n\tif args.LeaderCommit > rf.commitIndex {\n\t\trf.commit(args.LeaderCommit)\n\t}\n\treply.LogIndex = len(rf.log)\n}", "func (r *result) Add(url, body string) {\n\tr.mux.Lock()\n\tr.Sites[url] = body\n\tr.give(url)\n\tr.mux.Unlock()\n}", "func (rf *Raft) AppendEntries(args *AppendEntriesArgs, reply *AppendEntriesReply) {\n\trf.mu.Lock()\n\tdefer rf.mu.Unlock()\n\tif args.Term < rf.currentTerm {\n\t\treply.Term = rf.currentTerm\n\t\treturn\n\t}\n\tif args.Term > rf.currentTerm {\n\t\trf.stepDownToFollower(args.Term)\n\t}\n\t// TODO: check, this is a new approach to use goroutine\n\tgo func() {\n\t\trf.heartBeatCh <- true\n\t}()\n\treply.Term = rf.currentTerm\n\treply.Success = true\n\n\tif len(args.LogEntries) > 0 {\n\t\t// validate the log, remove duplicate\n\t\treply.Success, reply.LatestLogEntry = rf.appendEntries(args)\n\t}\n\tif args.LeaderCommit > rf.commitIndex {\n\t\trf.commitIndex = min(args.LeaderCommit, rf.getLastLog().Index)\n\t}\n\treturn\n}", "func (rl *ReferrerList) Add(m manifest.Manifest) error {\n\trlM, ok := rl.Manifest.GetOrig().(v1.Index)\n\tif !ok {\n\t\treturn fmt.Errorf(\"referrer list manifest is not an OCI index for %s\", rl.Subject.CommonName())\n\t}\n\t// if entry already exists, return\n\tmDesc := m.GetDescriptor()\n\tfor _, d := range rlM.Manifests {\n\t\tif d.Digest == mDesc.Digest {\n\t\t\treturn nil\n\t\t}\n\t}\n\t// update descriptor, pulling up artifact type and annotations\n\tswitch mOrig := m.GetOrig().(type) {\n\tcase v1.ArtifactManifest:\n\t\tmDesc.Annotations = mOrig.Annotations\n\t\tmDesc.ArtifactType = mOrig.ArtifactType\n\tcase v1.Manifest:\n\t\tmDesc.Annotations = mOrig.Annotations\n\t\tmDesc.ArtifactType = mOrig.Config.MediaType\n\tdefault:\n\t\t// other types are not supported\n\t\treturn fmt.Errorf(\"invalid manifest for referrer \\\"%t\\\": %w\", m.GetOrig(), types.ErrUnsupportedMediaType)\n\t}\n\t// append descriptor to index\n\trlM.Manifests = append(rlM.Manifests, mDesc)\n\terr := rl.Manifest.SetOrig(rlM)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (g *rungroup) add(r cos.Runner) {\n\tcos.Assert(r.Name() != \"\")\n\t_, exists := g.rs[r.Name()]\n\tcos.Assert(!exists)\n\n\tg.rs[r.Name()] = r\n}", "func (s *dnsTestServer) AddEntryToDNSDatabase(q DNSQuery, a DNSAnswers) {\n\ts.DNSDatabase[q] = append(s.DNSDatabase[q], a...)\n}", "func (r *rope) add(rd *io.SectionReader) error {\n\tvar off int64\n\tfor _, rd := range r.rd {\n\t\toff += rd.Size()\n\t}\n\tr.rd = append(r.rd, rd)\n\tr.off = append(r.off, off)\n\treturn nil\n}", "func (cp *ChangeLog) Add(newEntry LogEntry) {\n\tnewEntry.assertValid()\n\tif len(cp.Entries) == 0 || newEntry.Sequence == cp.Since {\n\t\tcp.Since = newEntry.Sequence - 1\n\t}\n\tcp.Entries = append(cp.Entries, &newEntry)\n}", "func (h *runeHistogram) addRune(r rune) {\n\toldval, ok := h.set[r]\n\tif !ok {\n\t\treturn // not tracking this rune\n\t}\n\th.set[r]++\n\n\t// If the count for r just went from 0 to 1, the histogram might have become\n\t// valid. (But there is no need to check if it is already valid.)\n\tif oldval == 0 && !h.valid {\n\t\th.refreshValidity()\n\t}\n}", "func (m *mEntry) AddErr(err error) Entry {\n\tfor i := range m.es {\n\t\tm.es[i] = m.es[i].AddErr(err)\n\t}\n\treturn m\n}", "func (rf *Raft) createAppendEntriesRequest(start int, stop int, term int) *AppendEntriesArgs {\n\tDPrintf(\"Peer-%d create AppendEntriesRequest with start=%d, stop=%d, term=%d.\", rf.me, start, stop, term)\n\tcurrentLen := len(rf.log)\n\tif start < 0 || stop <= start {\n\t\treturn nil\n\t}\n\tif stop > currentLen {\n\t\tstop = currentLen\n\t}\n\trequest := new(AppendEntriesArgs)\n\trequest.Term = term\n\trequest.LeaderId = rf.me\n\trequest.LeaderCommit = rf.commitIndex\n\tprevLogIndex := start - 1\n\tif prevLogIndex >= 0 && prevLogIndex < currentLen {\n\t\trequest.PrevLogIndex = prevLogIndex\n\t\trequest.PrevLogTerm = rf.log[prevLogIndex].Term\n\t} else {\n\t\trequest.PrevLogIndex = 0\n\t\trequest.PrevLogTerm = 0\n\t}\n\tif start < currentLen && stop >= start {\n\t\tif start == 0 {\n\t\t\tstart = 1\n\t\t}\n\t\trequest.Entries = rf.log[start:stop]\n\t}\n\tDPrintf(\"Peer-%d create an appendRequest: %v\", rf.me, *request)\n\treturn request\n}", "func (dc *DigestCache) Add(hash []byte, text []byte) {\n\tdc.Records[string(hash)] = text\n}", "func (ent Entry) Append(buf []byte, flag Flags) []byte {\n\tfile, line := ent.File, ent.Line\n\tif file == \"\" {\n\t\tfile, line = \"???\", 0\n\t}\n\tbuf = formatHeader(buf, flag, ent.Time, ent.Level, file, line)\n\ts := ent.Msg\n\tif n := len(s); n > 0 && s[n-1] == '\\n' {\n\t\ts = s[:n-1]\n\t}\n\tbuf = append(buf, s...)\n\treturn buf\n}", "func (h *Handler) AddHandler(w http.ResponseWriter, r *http.Request) {\n\tvar p = struct {\n\t\tCredential string `json:\"credential\"`\n\t\tSender string `json:\"sender\"`\n\t}{}\n\n\terr := json.NewDecoder(r.Body).Decode(&p)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t_, err = h.service.AddEntry(p.Credential, p.Sender)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t_, _ = fmt.Fprintf(w, \"ok\")\n}", "func (c *Cache) Add(cr CrawlResult) {\n\tc.mutex.Lock()\n\tc.c[cr.url] = cr\n\tc.mutex.Unlock()\n}", "func (rf *Raft) AppendEntries(args *AppendEntriesArgs, reply *AppendEntriesReply) {\n\trf.mu.Lock()\n\tdefer rf.mu.Unlock()\n\t// Resetting as we received a heart beat.\n\trf.resetElectionTimer()\n\trf.debug( \"AppendEntries: from LEADER %#v \\n\",args)\n\trf.debug(\"My current state: %#v \\n\", rf)\n\t//1. Reply false if term < currentTerm (§5.1)\n\tif args.Term > rf.currentTerm{\n\t\tif rf.currentState != Follower {\n\t\t\trf.transitionToFollower(args.Term)\n\t\t}\n\t}\n\t//2. Reply false if log doesn’t contain an entry at prevLogIndex\n\t//whose term matches prevLogTerm (§5.3)\n\t//3. If an existing entry conflicts with a new one (same index\n\t//but different terms), delete the existing entry and all that\n\t//follow it (§5.3)\n\t//4. Append any new entries not already in the log\n\t//5. If leaderCommit > commitIndex, set commitIndex =\n\t//\tmin(leaderCommit, index of last new entry)\n\t/////////////Pending implementation point 5 above.\n\tif args.Term < rf.currentTerm{\n\t\treply.Success = false\n\t\treply.Term =rf.currentTerm\n\t\treturn\n\t}\n\n\t// Update my term to that of the leaders\n\trf.currentTerm = args.Term\n\trf.debug(\"Dereferencing %d\",len(rf.log)-1)\n\trf.debug(\"Current log contents %v\", rf.log)\n\n\t// Check first whether it is a heartbeat or an actual append entry.\n\t// If it is heartbeat, then just reset the timer and then go back.\n\t//Otherwise, we need to add the entries into the logs of this peer.\n\t// If this is heart beat, then we know that the command is going to be nil.\n\t// Identify this and return.\n\tlastLogEntryIndex := len(rf.log) - 1\n\tif args.LogEntries == nil {\n\t\t//This is heart beat\n\t\treply.Term = rf.currentTerm\n\t\trf.debug(\"Received a HEART BEAT.\")\n\t}else {\n\t\trf.debug(\"Received an APPEND ENTRY. PROCESSING\")\n\t\tlastLogEntry := rf.log[len(rf.log)-1]\n\t\t//1a\n\t\tif lastLogEntryIndex < args.PreviousLogIndex {\n\t\t\treply.Success = false\n\t\t\treply.NextIndex = lastLogEntryIndex\n\t\t\trf.debug(\"1a \\n\")\n\t\t\treturn\n\t\t}\n\t\t//1b\n\t\tif lastLogEntryIndex > args.PreviousLogIndex {\n\t\t\treply.Success = false\n\t\t\trf.debug(\"Last log entry index --> %d, PreviousLogIndex From LEADER -->%d\", lastLogEntryIndex, args.PreviousLogIndex)\n\t\t\trf.log = rf.log[:len(rf.log)-1]\n\t\t\treturn\n\t\t}\n\t\t//3\n\t\tif lastLogEntry.LastLogTerm != args.PreviousLogTerm {\n\t\t\treply.Success = false\n\t\t\t//Reduce size by 1;\n\t\t\trf.debug(\"3 \\n\")\n\t\t\trf.log = rf.log[:len(rf.log)-1]\n\t\t\treturn\n\t\t}\n\n\t\t// 4 We are good to apply the command.\n\t\trf.printSlice(rf.log, \"Before\")\n\t\trf.debug(\"Printing the entry to be added within the handler %v\", args.LogEntries)\n\t\trf.log = append(rf.log, args.LogEntries...)\n\t\trf.printSlice(rf.log, \"After\")\n\t\trf.debug(\"\\n Applied the command to the log. Log size is -->%d \\n\", len(rf.log))\n\t\t//5\n\t}\n\tif args.LeaderCommit >rf.commitIndex {\n\t\trf.debug(\"5 Update commitIndex. LeaderCommit %v rf.commitIndex %v \\n\",args.LeaderCommit,rf.commitIndex )\n\t\t//Check whether all the entries are committed prior to this.\n\t\toldCommitIndex:=rf.commitIndex\n\t\trf.commitIndex = min(args.LeaderCommit,lastLogEntryIndex+1)\n\t\trf.debug(\"moving ci from %v to %v\", oldCommitIndex, rf.commitIndex)\n\t\t//Send all the received entries into the channel\n\t\tj:=0\n\t\tfor i:=oldCommitIndex ;i<args.LeaderCommit;i++ {\n\t\t\trf.debug(\"Committing %v \",i)\n\t\t\tapplyMsg := ApplyMsg{CommandValid: true, Command: rf.log[i].Command, CommandIndex: i}\n\t\t\tj++\n\t\t\trf.debug(\"Sent a response to the end client \")\n\t\t\trf.debug(\"applyMsg %v\",applyMsg)\n\t\t\trf.applyCh <- applyMsg\n\t\t}\n\t}\n\treply.Success = true\n\t//Check at the last. This is because this way the first HB will be sent immediately.\n\t//timer := time.NewTimer(100 * time.Millisecond)\n}", "func (as *aggregatorStage) add(e log.Entry) {\n\tas.queueEntries.PushBack(e)\n}", "func (r *KeyRing) Add(keyReader io.Reader, armored bool) error {\n\tvar entities openpgp.EntityList\n\tvar err error\n\tif armored {\n\t\tentities, err = openpgp.ReadArmoredKeyRing(keyReader)\n\t} else {\n\t\tentities, err = openpgp.ReadKeyRing(keyReader)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tr.entities = append(r.entities, r.removeDuplicates(entities)...)\n\treturn nil\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 (l *log) create(value []byte) *Entry {\n\tentry := &Entry{\n\t\tIndex: len(l.entries),\n\t\tValue: value,\n\t}\n\tl.entries = append(l.entries, entry)\n\treturn entry\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 (b *Buffer) Add(ent entity.Key, body inventoryapi.PostDeltaBody) error {\n\tif _, ok := b.contents[ent]; ok {\n\t\treturn fmt.Errorf(\"entity already added: %q\", ent)\n\t}\n\tbodySize, err := sizeOf(&body)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif b.currentSize+bodySize > b.capacity {\n\t\treturn fmt.Errorf(\"delta for entity %q does not fit into the request limits. \"+\n\t\t\t\"Free space: %d. Delta size: %d\", ent, b.capacity-b.currentSize, bodySize)\n\t}\n\tb.contents[ent] = body\n\tb.currentSize += bodySize\n\treturn nil\n}", "func (e *clfEncoder) EncodeEntry(entry zapcore.Entry, fields []zapcore.Field) (*buffer.Buffer, error) {\n\tfinal := e.clone()\n\n\tbuf := pool.Get()\n\tif entry.Message != \"\" {\n\t\tbuf.AppendString(entry.Message + \"\\n\")\n\t}\n\tif len(fields) == 0 {\n\t\treturn buf, nil\n\t}\n\n\tfor i := range fields {\n\t\tfields[i].AddTo(final)\n\t}\n\n\tbuf.AppendString(final.data[0])\n\tbuf.AppendByte(' ')\n\tbuf.AppendString(final.data[1])\n\tbuf.AppendByte(' ')\n\tbuf.AppendString(final.data[2])\n\tbuf.AppendByte(' ')\n\tbuf.AppendString(final.data[3])\n\tbuf.AppendByte(' ')\n\tbuf.AppendString(final.data[4])\n\tbuf.AppendByte(' ')\n\tbuf.AppendString(final.data[5])\n\tbuf.AppendString(\" \\\"\")\n\tbuf.AppendString(final.data[6])\n\tbuf.AppendByte(' ')\n\tbuf.AppendString(final.data[7])\n\tbuf.AppendByte(' ')\n\tbuf.AppendString(final.data[8])\n\tbuf.AppendString(\"\\\" \")\n\tbuf.AppendString(final.data[9])\n\tbuf.AppendByte(' ')\n\tbuf.AppendString(final.data[10])\n\tbuf.AppendByte('\\n')\n\treturn buf, nil\n}", "func (f *File) addFile(fh *zip.FileHeader, r io.Reader, crc uint32) error {\n\tf.align(fh)\n\tfh.Flags = 0 // we're not writing a data descriptor after the file\n\tcomp := func(w io.Writer) (io.WriteCloser, error) { return nopCloser{w}, nil }\n\tfh.SetModTime(modTime)\n\tfw, err := f.w.CreateHeaderWithCompressor(fh, comp, fixedCrc32{value: crc})\n\tif err == nil {\n\t\t_, err = io.CopyN(fw, r, int64(fh.CompressedSize64))\n\t}\n\treturn err\n}", "func (rf *Raft) AppendEntries(args *AppendEntriesArgs, reply *AppendEntriesReply) {\n\n\trf.mux.Lock() //CS accessing raft DS variables\n\treply.Term = rf.currTerm //default reply values\n\n\tif rf.currTerm <= args.Term {\n\t\trf.logger.Printf(\"received valid heartbeat from leader %v\", args.LeaderId)\n\t\trf.currTerm = args.Term\n\t\treply.Term = rf.currTerm //update terms\n\n\t\t//Acknowledge higher current leader. Reset to follower\n\t\trf.role = Follower\n\t\trf.numVotes = 0\n\t\trf.votedFor = -1\n\t\trf.elecTimer.Reset(time.Duration(rand.Intn(RANGE)+LOWER) * time.Millisecond)\n\t\trf.logger.Printf(\"resetting to follower on getting heartbeat from %v \\n\", args.LeaderId)\n\n\t}\n\trf.mux.Unlock()\n}" ]
[ "0.71296656", "0.65732485", "0.65454036", "0.6428338", "0.6421064", "0.6374888", "0.6358123", "0.63107234", "0.62744737", "0.6237569", "0.6180608", "0.61427706", "0.6097564", "0.60896695", "0.60792357", "0.6009725", "0.59926146", "0.5951478", "0.5894881", "0.5882617", "0.58373606", "0.583637", "0.57896537", "0.5783696", "0.5752554", "0.57341677", "0.5711714", "0.5697021", "0.5696496", "0.566794", "0.56243783", "0.56165844", "0.5587689", "0.553702", "0.5483974", "0.5483404", "0.5451157", "0.5430955", "0.542328", "0.5401831", "0.53415346", "0.53300047", "0.531033", "0.52928257", "0.52901465", "0.5246836", "0.5215942", "0.51963127", "0.5169861", "0.5157469", "0.5152957", "0.51326483", "0.5111535", "0.5108882", "0.509286", "0.509286", "0.50839627", "0.50814503", "0.50780517", "0.5072867", "0.5071865", "0.5071651", "0.5069812", "0.50654924", "0.50638616", "0.5060638", "0.5051106", "0.5046823", "0.50378877", "0.50333023", "0.50213563", "0.5016208", "0.5010581", "0.50045335", "0.4996868", "0.49963462", "0.49905923", "0.49898773", "0.4986163", "0.49858427", "0.49827534", "0.49769682", "0.49757782", "0.49712417", "0.49686965", "0.4950668", "0.49477068", "0.49452835", "0.49422112", "0.4934866", "0.493295", "0.49292356", "0.4922638", "0.4920734", "0.49112743", "0.49029374", "0.48988783", "0.48939398", "0.48912284", "0.48733863" ]
0.75889844
0
exactly16Bytes truncates the string if necessary so it is at most 16 bytes long, then pads the result with spaces to be exactly 16 bytes. Fmt uses runes for its width calculation, but we need bytes in the entry header.
func exactly16Bytes(s string) string { for len(s) > 16 { _, wid := utf8.DecodeLastRuneInString(s) s = s[:len(s)-wid] } const sixteenSpaces = " " s += sixteenSpaces[:16-len(s)] return s }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func Uint16StringSize(v uint16) uint8 {\n\tswitch true {\n\tcase v > 9_999:\n\t\treturn 5\n\tcase v > 999:\n\t\treturn 4\n\tcase v > 99:\n\t\treturn 3\n\tcase v > 9:\n\t\treturn 2\n\tdefault:\n\t\treturn 1\n\t}\n}", "func LeadingZeros16(x uint16) int { return 16 - Len16(x) }", "func LeadingZeros16(x uint16) int { return 16 - Len16(x) }", "func readUint16LengthPrefixed(s *cryptobyte.String, out *[]byte) bool {\n\treturn s.ReadUint16LengthPrefixed((*cryptobyte.String)(out))\n}", "func Stringify16(key []uint16) string {\n\tbytes := make([]byte, len(key)*2, len(key)*2)\n\n\tfor i, n := range key {\n\t\tbinary.LittleEndian.PutUint16(bytes[2*i:], n)\n\t}\n\n\treturn base64.StdEncoding.EncodeToString(bytes)\n}", "func (b *bof) utf16String(buf io.ReadSeeker, count uint32) string {\n\tbts := make([]uint16, count)\n\tbinary.Read(buf, binary.LittleEndian, &bts)\n\trunes := utf16.Decode(bts[:len(bts)-1])\n\treturn string(runes)\n}", "func determineLength16(lengthByte byte, r io.Reader) (uint16, error) {\n\t// \"If the representation is at least 14 bytes long, then L is set to 14, and\n\t// the length field is set to the representation length, encoded as a VarUInt field.\"\n\tif lengthByte != 14 {\n\t\treturn uint16(lengthByte), nil\n\t}\n\treturn readVarUInt16(r)\n}", "func createUTF16String(ptr uintptr, len int) string {\n\tif len == 0 {\n\t\treturn \"\"\n\t}\n\tbytes := (*[1 << 29]uint16)(unsafe.Pointer(ptr))[:len:len]\n\treturn windows.UTF16ToString(bytes)\n}", "func pack16(dst, src []byte) ([]byte, error) {\n\tfor i := 0; i < len(src); i += 2 {\n\t\tif src[i] > 0x0F {\n\t\t\treturn nil, ErrWrongNibble\n\t\t}\n\t\tc := src[i] << 4\n\t\tif i+1 < len(src) {\n\t\t\tc |= src[i+1]\n\t\t}\n\t\tdst = append(dst, c)\n\t}\n\treturn dst, nil\n}", "func Len16(x uint16) (n int) {\n\tif x >= 1<<8 {\n\t\tx >>= 8\n\t\tn = 8\n\t}\n\treturn n + int(len8tab[x])\n}", "func Len16(x uint16) (n int) {\n\tif x >= 1<<8 {\n\t\tx >>= 8\n\t\tn = 8\n\t}\n\treturn n + int(len8tab[x])\n}", "func (str JString) UTF16Len() int {\n\tenv := GoJNIEnv(GetDefaultJNIEnv())\n\treturn str.UTF16LenE(env)\n}", "func fromUtf16(x string) string {\n\trunes := make([]uint16, len(x)/2)\n\t_ = binary.Read(bytes.NewReader([]byte(x)), binary.LittleEndian, runes)\n\treturn string(utf16.Decode(runes))\n}", "func UTF16(data []byte) string {\n\tbuf := bytes.NewBuffer(data)\n\ttransformer := unicode.UTF16(unicode.BigEndian, unicode.IgnoreBOM)\n\tdecoder := transformer.NewDecoder()\n\tr := transform.NewReader(buf, unicode.BOMOverride(decoder))\n\ts, _ := ioutil.ReadAll(r)\n\treturn string(s)\n}", "func FormatUint16(name string) string {\n\treturn formatUintFunction(name, true)\n}", "func F128d16FromStringForced(str string) F128d16 {\n\tf, _ := F128d16FromString(str) //nolint:errcheck\n\treturn f\n}", "func (b *bitWriter) addBits16Clean(value uint16, bits uint8) {\n\tb.bitContainer |= uint64(value) << (b.nBits & 63)\n\tb.nBits += bits\n}", "func (b *Builder) AddUint16LengthPrefixed(f BuilderContinuation) {\n\tb.addLengthPrefixed(2, false, f)\n}", "func StringFillToExact(out string, lineLen int) string {\n\tif len(out) < lineLen {\n\t\tout = out + strings.Repeat(\" \", lineLen - len(out))\n\t} else if len(out) > lineLen {\n\t\tout = out[:lineLen]\n\t}\n\treturn out\n}", "func CBCEncrypt16(input string) []byte {\r\n\r\n\tkey := []byte(\"0123456789012345\")\r\n\tiv := []byte(\"AnimeWasAMistake\")\r\n\r\n\tpreString := \"comment1=cooking%20MCs;userdata=\"\r\n\tpostString := \";comment2=%20like%20a%20pound%20of%20bacon\"\r\n\r\n\tnewString := preString + input + postString\r\n\r\n\tnewBytes := []byte(newString)\r\n\tpaddedBytes := PadPKCS7(newBytes, 16)\r\n\r\n\tenc, err := EncryptCBC(paddedBytes, key, iv)\r\n\tif err != nil {\r\n\t\tpanic(err)\r\n\t}\r\n\r\n\treturn enc\r\n}", "func readString16(reader io.Reader) (s string, err os.Error) {\n\tvar length uint16\n\terr = binary.Read(reader, binary.BigEndian, &length)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tbs := make([]uint16, length)\n\terr = binary.Read(reader, binary.BigEndian, bs)\n\tif err != nil {\n\t\treturn\n\t}\n\n\treturn encodeUtf8(bs), err\n}", "func (arg1 *UConverter) IsFixedWidth(arg2 *UErrorCode) (_swig_ret UBool)", "func appendHexUint16(dst []byte, src uint16) []byte {\n\tdst = append(dst, \"0000\"[1+(bits.Len16(src)-1)/4:]...)\n\tdst = strconv.AppendUint(dst, uint64(src), 16)\n\treturn dst\n}", "func AppendUints16(dst []byte, vals []uint16) []byte {\n\tmajor := majorTypeArray\n\tl := len(vals)\n\tif l == 0 {\n\t\treturn AppendArrayEnd(AppendArrayStart(dst))\n\t}\n\tif l <= additionalMax {\n\t\tlb := byte(l)\n\t\tdst = append(dst, byte(major|lb))\n\t} else {\n\t\tdst = appendCborTypePrefix(dst, major, uint64(l))\n\t}\n\tfor _, v := range vals {\n\t\tdst = AppendUint16(dst, v)\n\t}\n\treturn dst\n}", "func (s Section) LenU16() uint16 {\n\tif s == nil {\n\t\treturn 0\n\t}\n\n\tif len(s) > 0xffff {\n\t\tpanic(\"too many rrs\")\n\t}\n\n\treturn uint16(len(s))\n}", "func (c *LittleEndianDecoder) Utf16(content []byte) (convertedStringToUnicode string) {\n\ttmp := []uint16{}\n\n\tbytesRead := 0\n\tfor {\n\t\ttmp = append(tmp, binary.LittleEndian.Uint16(content[bytesRead:]))\n\t\tbytesRead += 2\n\n\t\tconvertedStringToUnicode = string(utf16.Decode(tmp));\n\n\t\tif (len(content) <= bytesRead) {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn\n}", "func Uint32StringSize(v uint32) uint8 {\n\tswitch true {\n\tcase v <= maxU16:\n\t\treturn Uint16StringSize(uint16(v))\n\tcase v > 999_999_999:\n\t\treturn 10\n\tcase v > 99_999_999:\n\t\treturn 9\n\tcase v > 9_999_999:\n\t\treturn 8\n\tcase v > 999_999:\n\t\treturn 7\n\tcase v > 99_999:\n\t\treturn 6\n\tdefault:\n\t\treturn 5\n\t}\n}", "func (str JString) UTF16LenE(env JNIEnv) int {\n\treturn env.GetStringLength(str)\n}", "func ServiceData16(id uint16, b []byte) Field {\n\treturn func(p *Packet) error {\n\t\tuuid := ble.UUID16(id)\n\t\tif err := p.append(allUUID16, uuid); err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn p.append(serviceData16, append(uuid, b...))\n\t}\n}", "func toUtf16(x string) string {\n\trunes := utf16.Encode([]rune(x))\n\tbuf := bytes.NewBuffer(make([]byte, 0, 2*len(runes)))\n\t_ = binary.Write(buf, binary.LittleEndian, runes)\n\treturn buf.String()\n}", "func StringToUTF16(s string) []uint16 { return utf16.Encode([]rune(s + \"\\x00\")) }", "func (ba *BitArray) Add16(bits uint16) {\n\tn := uint64(bits)\n\tn = n << 48\n\tba.AddVar(n, 16)\n}", "func UTF8ToUTF16Pos(s string, i int) int {\n\tif i > len(s) {\n\t\ti = len(s)\n\t}\n\treturn len(utf16.Encode([]rune(s[:i])))\n}", "func makeEntry(f *FormInfo, c *Char) uint16 {\n\te := uint16(0)\n\tif r := c.codePoint; HangulBase <= r && r < HangulEnd {\n\t\te |= 0x40\n\t}\n\tif f.combinesForward {\n\t\te |= 0x20\n\t}\n\tif f.quickCheck[MDecomposed] == QCNo {\n\t\te |= 0x4\n\t}\n\tswitch f.quickCheck[MComposed] {\n\tcase QCYes:\n\tcase QCNo:\n\t\te |= 0x10\n\tcase QCMaybe:\n\t\te |= 0x18\n\tdefault:\n\t\tlog.Fatalf(\"Illegal quickcheck value %v.\", f.quickCheck[MComposed])\n\t}\n\te |= uint16(c.nTrailingNonStarters)\n\treturn e\n}", "func Parse16(s string) ([]uint16, error) {\n\tvar (\n\t\tbytes []byte\n\t\te error\n\t)\n\n\tif bytes, e = base64.StdEncoding.DecodeString(s); e != nil {\n\t\treturn nil, e\n\t}\n\n\tif len(bytes)%2 != 0 {\n\t\treturn nil, errors.New(\"invalid length\")\n\t}\n\n\tout := make([]uint16, len(bytes)/2, len(bytes)/2)\n\n\tfor i := 0; i < len(out); i++ {\n\t\tout[i] = binary.LittleEndian.Uint16(bytes[2*i:])\n\t}\n\n\treturn out, nil\n}", "func ParseUint16(s string) (uint16, bool) {\n\tn := len(s) - 1\n\tif n < 1 {\n\t\tif n == -1 {\n\t\t\treturn 0, false\n\t\t}\n\n\t\tn, ok := ParseDigit(s[0])\n\t\treturn uint16(n), ok\n\t}\n\n\tvar (\n\t\tovf int\n\t\tr uint16\n\t\tb byte\n\t)\n\n\tif n >= uint16Digits-1 {\n\t\tif n > uint16Digits-1 {\n\t\t\treturn uint16Max, false\n\t\t}\n\n\t\tovf = 1\n\t}\n\n\t_ = s[n-ovf]\n\n\tfor i := 0; i <= n-ovf; i++ {\n\t\tb = s[i] - '0'\n\t\tif b > 9 {\n\t\t\treturn 0, false\n\t\t}\n\n\t\tr = r*10 + uint16(b)\n\t}\n\n\tif ovf == 0 {\n\t\treturn r, true\n\t}\n\n\tb = s[n] - '0'\n\n\t// Max is 65535, last digit can't be > 5 or ADD would overflow.\n\t// Cutoff is 6553 accordingly.\n\tif r > uint16Cutoff || b > 5 {\n\t\tif b > 9 {\n\t\t\treturn 0, false\n\t\t}\n\n\t\treturn uint16Max, false\n\t}\n\n\treturn r*10 + uint16(b), true\n}", "func ConvertWindowsString16(winput []uint16) string {\n\treturn windows.UTF16ToString(winput)\n}", "func utf16Encode(s string) []byte {\n\tb, err := unicode.UTF16(unicode.LittleEndian, unicode.IgnoreBOM).NewEncoder().Bytes([]byte(s))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn append(b, 0x00, 0x00) // null-termination.\n}", "func StringToUTF16Ptr(s string) *uint16 { return &StringToUTF16(s)[0] }", "func parseUTF16String(b []uint16) string {\n\ts := string(utf16.Decode(b))\n\n\t// The following will only return the portion of the string\n\t// that occurs before the first NULL byte.\n\treturn strings.SplitN(s, \"\\x00\", 2)[0]\n}", "func FormatInt16(name string) string {\n\treturn formatIntFunction(name, true)\n}", "func Uints16(k string, v []uint16) Field {\n\treturn Field{Key: k, Value: valf.Uints16(v)}\n}", "func F128d16FromString(str string) (F128d16, error) {\n\tif str == \"\" {\n\t\treturn F128d16{}, errs.New(\"empty string is not valid\")\n\t}\n\tif strings.ContainsAny(str, \"Ee\") {\n\t\t// Given a floating-point value with an exponent, which technically\n\t\t// isn't valid input, but we'll try to convert it anyway.\n\t\tf, err := strconv.ParseFloat(str, 64)\n\t\tif err != nil {\n\t\t\treturn F128d16{}, err\n\t\t}\n\t\treturn F128d16FromFloat64(f), nil\n\t}\n\tparts := strings.SplitN(str, \".\", 2)\n\tvar neg bool\n\tvalue := new(big.Int)\n\tfraction := new(big.Int)\n\tswitch parts[0] {\n\tcase \"\":\n\tcase \"-\", \"-0\":\n\t\tneg = true\n\tdefault:\n\t\tif _, ok := value.SetString(parts[0], 10); !ok {\n\t\t\treturn F128d16{}, errs.Newf(\"invalid value: %s\", str)\n\t\t}\n\t\tif value.Sign() < 0 {\n\t\t\tneg = true\n\t\t\tvalue.Neg(value)\n\t\t}\n\t\tvalue.Mul(value, multiplierF128d16BigInt)\n\t}\n\tif len(parts) > 1 {\n\t\tvar buffer strings.Builder\n\t\tbuffer.WriteString(\"1\")\n\t\tbuffer.WriteString(parts[1])\n\t\tfor buffer.Len() < 16+1 {\n\t\t\tbuffer.WriteString(\"0\")\n\t\t}\n\t\tfrac := buffer.String()\n\t\tif len(frac) > 16+1 {\n\t\t\tfrac = frac[:16+1]\n\t\t}\n\t\tif _, ok := fraction.SetString(frac, 10); !ok {\n\t\t\treturn F128d16{}, errs.Newf(\"invalid value: %s\", str)\n\t\t}\n\t\tvalue.Add(value, fraction).Sub(value, multiplierF128d16BigInt)\n\t}\n\tif neg {\n\t\tvalue.Neg(value)\n\t}\n\treturn F128d16{data: num.Int128FromBigInt(value)}, nil\n}", "func unpack16(dst, src []byte) []byte {\n\tfor _, c := range src {\n\t\tdst = append(dst, c>>4, c&0x0F)\n\t}\n\treturn dst\n}", "func Uint16ToStringEqualFold(v string) predicate.Conversion {\n\treturn predicate.Conversion(func(s *sql.Selector) {\n\t\ts.Where(sql.EqualFold(s.C(FieldUint16ToString), v))\n\t})\n}", "func (a *App) ProcessUTF16be(ctx context.Context, r io.Reader, name, archive string) error {\n\tr = transform.NewReader(r, unicode.UTF16(unicode.BigEndian, unicode.UseBOM).NewDecoder())\n\treturn a.ProcessUTF8(ctx, r, name, archive)\n}", "func F128d16FromFloat64(value float64) F128d16 {\n\tf, _ := F128d16FromString(new(big.Float).SetPrec(128).SetFloat64(value).Text('f', 17)) //nolint:errcheck\n\treturn f\n}", "func (e Entry) Uint16(key string, value uint16) (entry Entry) {\n\te.Uint64(key, uint64(value))\n\treturn e\n}", "func encode16(k16 []byte) ([]byte, error) {\n\tret := append(make([]byte, 0, len(k16)/2+1), byte(len(k16)%2))\n\treturn pack16(ret, k16)\n}", "func ReverseBytes16(x uint16) uint16 {\n\treturn x>>8 | x<<8\n}", "func Hexa16(w io.Writer, key string, colors []color.RGBA, size, lines int) {\n\tcanvas := svg.New(w)\n\tcanvas.Start(size, size)\n\n\tfringeSize := size / lines\n\tdistance := distanceTo3rdPoint(fringeSize)\n\tlines = size / fringeSize\n\toffset := ((fringeSize - distance) * lines) / 2\n\n\tfillTriangle := triangleColors(0, key, colors, lines)\n\ttransparent := fillTransparent()\n\n\tisLeft := func(v int) bool { return (v % 2) == 0 }\n\tisRight := func(v int) bool { return (v % 2) != 0 }\n\n\tfor xL := 0; xL < lines/2; xL++ {\n\t\tfor yL := 0; yL < lines; yL++ {\n\n\t\t\tif isOutsideHexagon(xL, yL, lines) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tvar x1, x2, y1, y2, y3 int\n\t\t\tif (xL % 2) == 0 {\n\t\t\t\tx1, y1, x2, y2, _, y3 = right1stTriangle(xL, yL, fringeSize, distance)\n\t\t\t} else {\n\t\t\t\tx1, y1, x2, y2, _, y3 = left1stTriangle(xL, yL, fringeSize, distance)\n\t\t\t}\n\n\t\t\txs := []int{x2 + offset, x1 + offset, x2 + offset}\n\t\t\tys := []int{y1, y2, y3}\n\n\t\t\tif fill, err := canFill(xL, yL, fillTriangle, isLeft, isRight); err != nil {\n\t\t\t\tcanvas.Polygon(xs, ys, transparent)\n\t\t\t} else {\n\t\t\t\tcanvas.Polygon(xs, ys, fill)\n\t\t\t}\n\n\t\t\txsMirror := mirrorCoordinates(xs, lines, distance, offset*2)\n\t\t\txLMirror := lines - xL - 1\n\t\t\tyLMirror := yL\n\n\t\t\tif fill, err := canFill(xLMirror, yLMirror, fillTriangle, isLeft, isRight); err != nil {\n\t\t\t\tcanvas.Polygon(xsMirror, ys, transparent)\n\t\t\t} else {\n\t\t\t\tcanvas.Polygon(xsMirror, ys, fill)\n\t\t\t}\n\n\t\t\tvar x11, x12, y11, y12, y13 int\n\t\t\tif (xL % 2) == 0 {\n\t\t\t\tx11, y11, x12, y12, _, y13 = left2ndTriangle(xL, yL, fringeSize, distance)\n\n\t\t\t\t// in order to have a perfect hexagon,\n\t\t\t\t// we make sure that the previous triangle and this one touch each other in this point.\n\t\t\t\ty12 = y3\n\t\t\t} else {\n\t\t\t\tx11, y11, x12, y12, _, y13 = right2ndTriangle(xL, yL, fringeSize, distance)\n\n\t\t\t\t// in order to have a perfect hexagon,\n\t\t\t\t// we make sure that the previous triangle and this one touch each other in this point.\n\t\t\t\ty12 = y1 + fringeSize\n\t\t\t}\n\n\t\t\txs1 := []int{x12 + offset, x11 + offset, x12 + offset}\n\t\t\tys1 := []int{y11, y12, y13}\n\n\t\t\t// triangles that go to the right\n\n\t\t\tif fill, err := canFill(xL, yL, fillTriangle, isRight, isLeft); err != nil {\n\t\t\t\tcanvas.Polygon(xs1, ys1, transparent)\n\t\t\t} else {\n\t\t\t\tcanvas.Polygon(xs1, ys1, fill)\n\t\t\t}\n\n\t\t\txs1 = mirrorCoordinates(xs1, lines, distance, offset*2)\n\n\t\t\tif fill, err := canFill(xLMirror, yLMirror, fillTriangle, isRight, isLeft); err != nil {\n\t\t\t\tcanvas.Polygon(xs1, ys1, transparent)\n\t\t\t} else {\n\t\t\t\tcanvas.Polygon(xs1, ys1, fill)\n\t\t\t}\n\t\t}\n\t}\n\tcanvas.End()\n}", "func LeadingZeros16(x uint16) int {\n\t_x := int16(x)\n\tn := int16(0)\n\ty := _x\nL:\n\tif _x < 0 {\n\t\treturn int(n)\n\t}\n\tif y == 0 {\n\t\treturn int(16 - n)\n\t}\n\tn = n + 1\n\tx = x << 1\n\ty = y >> 1\n\tgoto L\n}", "func formatPassword(original string) (string, error) {\n\tutf16 := unicode.UTF16(unicode.LittleEndian, unicode.IgnoreBOM)\n\treturn utf16.NewEncoder().String(\"\\\"\" + original + \"\\\"\")\n}", "func ExpectUint16(t *testing.T, field string, expected uint16, found uint16) {\n\tif expected != found {\n\t\tt.Errorf(\"%s [%d], found '%d'\", field, expected, found)\n\t}\n}", "func getS16BE(buf []byte) int16 {\n\tv := int16(buf[0])<<8 + int16(buf[1])\n\treturn v\n}", "func readUTF16String(r io.Reader) (string, error) {\n\tvar err error\n\n\tb := make([]byte, 2)\n\tout := make([]uint16, 0, 100)\n\n\tfor i := 0; err == nil; i += 2 {\n\t\t_, err = r.Read(b)\n\n\t\tif b[0] == 0 && b[1] == 0 {\n\t\t\tbreak\n\t\t}\n\n\t\tout = append(out, bo.Uint16(b))\n\t}\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn syscall.UTF16ToString(out), nil\n}", "func paddedHumanBytes(bytes uint64) string {\n\treturn fmt.Sprintf(\"%8s\", humanize.Bytes(bytes))\n}", "func readUTF16StringAtPos(r io.ReadSeeker, absPos int64, length uint32) (string, error) {\n\tvalue := make([]uint16, length/2)\n\t_, err := r.Seek(absPos, io.SeekStart)\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\terr = binary.Read(r, bo, value)\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn syscall.UTF16ToString(value), nil\n}", "func byte16FromByteSlice(src []byte) (blk bit128) {\n\t_ = src[15]\n\treturn bit128{binary.BigEndian.Uint64(src[0:8]), binary.BigEndian.Uint64(src[8:16])}\n}", "func (b *Buffer) PrependUint16(x uint16) error {\n\treturn b.prependInteger(x)\n}", "func ByteArray16(slice []byte) [16]byte {\n\tvar arr [16]byte\n\toffset := 16 - len(slice)\n\tfor i := 0; i < len(slice); i++ {\n\t\tarr[i+offset] = slice[i]\n\t}\n\treturn arr\n}", "func New16() Hash {\n\txof, _ := blake2b.NewXOF(BYTESIZE, nil)\n\treturn &hash16{xof: xof}\n}", "func TrailingZeros16(x uint16) int {\n\tif x == 0 {\n\t\treturn 16\n\t}\n\t// see comment in TrailingZeros64\n\treturn int(deBruijn32tab[uint32(x&-x)*deBruijn32>>(32-5)])\n}", "func (rr *Reader) ReadSize16() (size int) {\n\tsize = rr.ReadSizeWithLimit(math.MaxUint16)\n\treturn rr.CheckAvailable(size)\n}", "func ValidBufferLength(l uint16, converted []byte) bool {\n\ttotal := uint16(11) //size of just framing in characters (colon, 2 len chars, 4 addr chars, 2 type chars, 2 checksum chars)\n\tif uint16(l) < total {\n\t\tprint(\"!bad buffer length, can't be smaller than\", total, \":\", l, \"\\n\")\n\t\treturn false\n\t}\n\ttotal += uint16(converted[0]) * 2\n\tif l != total {\n\t\tprint(\"!bad buffer length, expected \", total, \" but got\", l, \" based on \", total*2, \"\\n\")\n\t\treturn false\n\t}\n\treturn true\n}", "func Uint16ToStringHasSuffix(v string) predicate.Conversion {\n\treturn predicate.Conversion(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldUint16ToString), v))\n\t})\n}", "func packUint16(i uint16) []byte { return []byte{byte(i >> 8), byte(i)} }", "func TestStringWidthRandom(t *testing.T) {\n\tmax := 10 * 1024 * 1024\n\tfor i := 0; i < max; i++ {\n\t\tif i%(max/80) == 0 {\n\t\t\tfmt.Print(\".\")\n\t\t}\n\t\tbz := libs.RandBytes(12)\n\t\twidth1 := widthOf(string(bz))\n\t\twidth2 := widthOfSlow(string(bz))\n\t\tif width1 == 0 {\n\t\t\tif isRepeatedWZJ(bz) {\n\t\t\t\t// these bytes encode one or more U+200D WZJ as UTF8.\n\t\t\t} else {\n\t\t\t\trequire.Fail(t, \"unexpected zero width string\")\n\t\t\t}\n\t\t} else {\n\t\t\trequire.True(t, 0 < width1, \"got zero width for bytes %X\", bz)\n\t\t}\n\t\trequire.Equal(t, width2, width1,\n\t\t\t\"want %d but got %d the slow way: %X\",\n\t\t\twidth1, width2, bz)\n\t}\n}", "func Ints16(k string, v []int16) Field {\n\treturn Field{Key: k, Value: valf.Ints16(v)}\n}", "func (f F128d16) MarshalText() ([]byte, error) {\n\treturn []byte(f.String()), nil\n}", "func (gb *GameBoy) a16() uint16 {\n\treturn gb.Fetch16()\n}", "func PutBytesSlice16M(p []byte) bool {\n\tif l := cap(p); l < 16777216 || l >= 33554432 {\n\t\treturn PutBytesSlice(p)\n\t}\n\tp = p[0:16777216]\n\tput16M(internal.Gets(p))\n\treturn true\n}", "func uint16Str(u uint16) string {\n\treturn fmt.Sprint(u)\n}", "func ValidBufferLength(l uint16, converted []byte) bool {\n\ttotal := uint16(11) //size of just framing in characters (colon, 2 len chars, 4 addr chars, 2 type chars, 2 checksum chars)\n\tif uint16(l) < total {\n\t\tprint(\"!bad buffer length, can't be smaller than\", total, \":\", l, \"\\n\")\n\t\treturn false\n\t}\n\ttotal += uint16(converted[0]) * 2\n\tif l != total {\n\t\tprint(\"!bad buffer length, expected\", total, \"but got\", l, \" based on \", converted[0], \"\\n\")\n\t\treturn false\n\t}\n\treturn true\n}", "func (h Hash20) ShortString() string {\n\tl := len(h.Hex())\n\treturn Shorten(h.Hex()[util.Min(2, l):], 10)\n}", "func Int16ToStringHasSuffix(v string) predicate.Conversion {\n\treturn predicate.Conversion(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldInt16ToString), v))\n\t})\n}", "func CBCDecrypt16(input []byte) bool {\r\n\r\n\tkey := []byte(\"0123456789012345\")\r\n\tiv := []byte(\"AnimeWasAMistake\")\r\n\r\n\tdec, err := DecryptCBC(input, key, iv)\r\n\tif err != nil {\r\n\t\treturn false\r\n\t}\r\n\r\n\treturn strings.Contains(string(dec), \";admin=true\")\r\n}", "func Uint16ToStringContainsFold(v string) predicate.Conversion {\n\treturn predicate.Conversion(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldUint16ToString), v))\n\t})\n}", "func appendUint16(buf []byte, v uint16) []byte {\n\treturn append(buf, byte(v>>8), byte(v))\n}", "func testIATBHFVString(t testing.TB) {\n\tvar line = \"5220 FV2123456789012345US123456789 IATTRADEPAYMTCADUSD180621 1231380100000001\"\n\tr := NewReader(strings.NewReader(line))\n\tr.line = line\n\tif err := r.parseIATBatchHeader(); err != nil {\n\t\tt.Errorf(\"%T: %s\", err, err)\n\t}\n\trecord := r.IATCurrentBatch.GetHeader()\n\n\tif v := record.String(); v != line {\n\t\tt.Errorf(\"Strings do not match:\\n v=%q\\nline=%q\", v, line)\n\t}\n}", "func int16Str(u int16) string {\n\treturn fmt.Sprint(u)\n}", "func padID(id string) string {\n\texpectedLen := 0\n\tswitch {\n\tcase len(id) < 16:\n\t\texpectedLen = 16\n\tcase len(id) > 16 && len(id) < 32:\n\t\texpectedLen = 32\n\tdefault:\n\t\treturn id\n\t}\n\n\treturn pads[expectedLen-len(id)] + id\n}", "func UTF16BytesToString(b []byte) (string, int, error) {\n\tif len(b)%2 != 0 {\n\t\treturn \"\", 0, fmt.Errorf(\"slice must have an even length (length=%d)\", len(b))\n\t}\n\n\toffset := -1\n\n\t// Find the null terminator if it exists and re-slice the b.\n\tif nullIndex := indexNullTerminator(b); nullIndex > -1 {\n\t\tif len(b) > nullIndex+2 {\n\t\t\toffset = nullIndex + 2\n\t\t}\n\n\t\tb = b[:nullIndex]\n\t}\n\n\ts := make([]uint16, len(b)/2)\n\tfor i := range s {\n\t\ts[i] = uint16(b[i*2]) + uint16(b[(i*2)+1])<<8\n\t}\n\n\treturn string(utf16.Decode(s)), offset, nil\n}", "func CRC16(dataString string) (string, string) {\n\treturn hjt212CRC(dataString), modbusCRC(dataString)\n}", "func pad4(n uint16) int {\n\treturn -int(n) & 3\n}", "func uint16len(u int) []byte {\n\tdata := make([]byte, 2)\n\tbinary.BigEndian.PutUint16(data, uint16(u))\n\treturn data\n}", "func UTF16ToUTF8Pos(s string, i int) int {\n\tsu := utf16.Encode([]rune(s))\n\tif i > len(su) {\n\t\ti = len(su)\n\t}\n\treturn len(string(utf16.Decode(su[:i])))\n}", "func (h Hash32) ShortString() string {\n\tl := len(h.Hex())\n\treturn Shorten(h.Hex()[util.Min(2, l):], 10)\n}", "func ipFrom16Match(ip IP, a [16]byte) IP {\n\tif ip.Is6() {\n\t\treturn IPv6Raw(a) // doesn't unwrap\n\t}\n\treturn IPFrom16(a)\n}", "func DecodeZAscii16(src []byte) (uint16, error) {\n\tif len(src) != 2+2*2 {\n\t\treturn 0, errors.New(\"bad length for uint16 zephyrascii\")\n\t}\n\tdst, err := DecodeZAscii(src)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tif len(dst) != 2 {\n\t\tpanic(dst)\n\t}\n\treturn binary.BigEndian.Uint16(dst), nil\n}", "func Test_fullJustify(t *testing.T) {\n\ttype args struct {\n\t\twords []string\n\t\tmaxWidth int\n\t}\n\ttests := []struct {\n\t\tname string\n\t\targs args\n\t\twant []string\n\t}{\n\t\t{name: \"test\", args: struct {\n\t\t\twords []string\n\t\t\tmaxWidth int\n\t\t}{words: []string{\"This\", \"is\", \"an\", \"example\", \"of\", \"text\", \"justification.\"}, maxWidth: 16}, want: []string{\n\t\t\t\"This is an\",\n\t\t\t\"example of text\",\n\t\t\t\"justification. \",\n\t\t}},\n\t\t{name: \"test\", args: struct {\n\t\t\twords []string\n\t\t\tmaxWidth int\n\t\t}{words: []string{\"What\", \"must\", \"be\", \"acknowledgment\", \"shall\", \"be\"}, maxWidth: 16}, want: []string{\n\t\t\t\"What must be\",\n\t\t\t\"acknowledgment \",\n\t\t\t\"shall be \",\n\t\t}},\n\t\t{name: \"test\", args: struct {\n\t\t\twords []string\n\t\t\tmaxWidth int\n\t\t}{words: []string{\"a\"}, maxWidth: 16}, want: []string{\n\t\t\t\"a \",\n\t\t}},\n\t}\n\tfor _, tt := range tests {\n\t\tt.Run(tt.name, func(t *testing.T) {\n\t\t\tif got := fullJustify(tt.args.words, tt.args.maxWidth); !reflect.DeepEqual(got, tt.want) {\n\t\t\t\tt.Errorf(\"fullJustify(%v) \\n = %v, \\nwant %v\", tt.args, got, tt.want)\n\t\t\t}\n\t\t})\n\t}\n}", "func Uint16(k string, v uint16) Field {\n\treturn Field{Key: k, Value: valf.Uint16(v)}\n}", "func (h Hex16) MarshalText() ([]byte, error) {\n\treturn []byte(h.String()), nil\n}", "func OnesCount16(x uint16) int {\n\treturn int(pop8tab[x>>8] + pop8tab[x&0xff])\n}", "func (addr *Address) GenerateShortPayloadFormatAddress(hash160HexStr string) (string, error) {\n\thexStr, err := types.ParseHexStr(hash160HexStr)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tpayload := append([]byte{\n\t\tbyte(addrtypes.FormatTypeShort),\n\t\tbyte(addrtypes.CodeHashIndex1)},\n\t\thexStr.Bytes()...)\n\treturn EncodeAddress(addr.Prefix, payload)\n}", "func TestHeader(t *testing.T) {\n\n\thdr := Header{\"MyHdr1\", []byte(\"a string\")}\n\tif hdr.String() != \"MyHdr1=\\\"a string\\\"\" {\n\t\tt.Errorf(\"Unexpected: %s\", hdr.String())\n\t}\n\n\thdr = Header{\"MyHdr2\", []byte(\"a longer string that will be truncated right here <-- so you wont see this part.\")}\n\tif hdr.String() != \"MyHdr2=\\\"a longer string that will be truncated right here \\\"(30 more bytes)\" {\n\t\tt.Errorf(\"Unexpected: %s\", hdr.String())\n\t}\n\n\thdr = Header{\"MyHdr3\", []byte{1, 2, 3, 4}}\n\tif hdr.String() != \"MyHdr3=\\\"\\\\x01\\\\x02\\\\x03\\\\x04\\\"\" {\n\t\tt.Errorf(\"Unexpected: %s\", hdr.String())\n\t}\n\n}", "func Int16(k string, v int16) Field {\n\treturn Field{Key: k, Value: valf.Int16(v)}\n}", "func GenKey16(length int) ([]uint16, error) {\n\tkey := make([]uint16, length, length)\n\tkeyByteLength := length * 2\n\tkeyBytes := make([]byte, keyByteLength, keyByteLength)\n\n\tif _, e := rand.Read(keyBytes); e != nil {\n\t\treturn nil, e\n\t}\n\n\tfor i := 0; i < length; i++ {\n\t\tkey[i] = binary.LittleEndian.Uint16(keyBytes[2*i:])\n\t}\n\n\treturn key, nil\n}", "func MSB16(x uint16) uint16", "func Vfix16_byte(input []float32, inputStride int, output []byte, outputStride int) {\n\tC.vDSP_vfix16((*C.float)(&input[0]), C.vDSP_Stride(inputStride), (*C.short)(unsafe.Pointer(&output[0])), C.vDSP_Stride(outputStride), C.vDSP_Length(len(output)/2/outputStride))\n}" ]
[ "0.597428", "0.564582", "0.564582", "0.5461119", "0.5454665", "0.541108", "0.5381975", "0.53811014", "0.53250897", "0.53203034", "0.53203034", "0.51891947", "0.5026643", "0.5008547", "0.49545696", "0.49398205", "0.49328953", "0.4902345", "0.48529455", "0.48471072", "0.48190337", "0.47935197", "0.47927284", "0.4788202", "0.47668493", "0.4751404", "0.47477034", "0.47371292", "0.47158757", "0.4686703", "0.4682797", "0.467714", "0.46620074", "0.46592417", "0.4650802", "0.4646782", "0.46374667", "0.46135294", "0.4611899", "0.46049112", "0.4587498", "0.45852575", "0.45840573", "0.45815703", "0.457758", "0.4572232", "0.45635092", "0.4559376", "0.45588124", "0.45483187", "0.4540253", "0.45306775", "0.45225555", "0.45187718", "0.451432", "0.45140088", "0.4506078", "0.45053965", "0.4504563", "0.45007825", "0.44962412", "0.44911093", "0.4485638", "0.4479456", "0.4473422", "0.4465849", "0.44477803", "0.4436388", "0.44326904", "0.44325393", "0.44218966", "0.44190404", "0.44153607", "0.44123164", "0.43880847", "0.4379693", "0.43771458", "0.4366407", "0.43634441", "0.43625093", "0.43605953", "0.43572614", "0.43470827", "0.43467882", "0.43456587", "0.43430603", "0.43413997", "0.433972", "0.43315583", "0.43270326", "0.4325884", "0.43242836", "0.43129674", "0.43127847", "0.43049657", "0.43002728", "0.42891467", "0.42869914", "0.42858267", "0.42857268" ]
0.7911634
0
based on bytes.Buffer and Writing into it
func VVByte_to_string(m [][]byte) (*bytes.Buffer, *bytes.Buffer) { lg, b := loghttp.BuffLoggerUniversal(nil, nil) _ = b bRet := new(bytes.Buffer) bMsg := new(bytes.Buffer) //for i,v := range m { for i := 0; i < len(m); i++ { n, err := bRet.Write(m[i]) lg(err) bMsg.WriteString(" lp" + util.Itos(i) + ": writing " + util.Itos(n) + " bytes: \n") } return bRet, bMsg }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (w *Writer) SetBuffer(raw []byte) {\n\tif w.err != nil {\n\t\treturn\n\t}\n\tw.b = w.b[:0]\n\tw.b = append(w.b, raw...)\n}", "func (b *Buffer) Write(bt byte) int {\n\tb.bytes[b.length] = bt\n\tb.length++\n\treturn b.length\n}", "func (w *Writer) Buffer() []byte {\n\tif w.err != nil {\n\t\treturn nil\n\t}\n\treturn append([]byte(nil), w.b...)\n}", "func (b *Buffer) Data() []byte { return b.data }", "func newBuffer(b []byte) *buffer {\n\treturn &buffer{proto.NewBuffer(b), 0}\n}", "func (b *buffer) buffer() []byte {\n\treturn b.buf[b.offset:]\n}", "func (res *ResponseAdapter) Buffer() *bytes.Buffer {\n\tres.bOnce.Do(func() {\n\t\tvar b bytes.Buffer\n\t\tif _, err := io.Copy(&b, res.Response().Body); err != nil {\n\t\t\tpanic(err) // xxx\n\t\t}\n\t\tres.bytes = b.Bytes()\n\t})\n\treturn bytes.NewBuffer(res.bytes)\n}", "func newBuffer(buf []byte) *Buffer {\n\treturn &Buffer{data: buf}\n}", "func (b *Buffer) Bytes() []byte { return b.buf[:b.length] }", "func (b *Buffer) Buf() []byte { return b.buf }", "func (p *Buffer) Bytes() []byte { return p.buf }", "func putBuffer(buf *bytes.Buffer) {\n\tbuf.Reset()\n\tbufferPool.Put(buf)\n}", "func WriteBytes(buffer []byte, offset int, value []byte) {\n copy(buffer[offset:offset + len(value)], value)\n}", "func advanceBuffer(buff *bytes.Buffer, num int) {\n\tbuff.Next(num)\n\t// move buffer from num offset to 0\n\tbytearr := buff.Bytes()\n\tbuff.Reset()\n\tbuff.Write(bytearr)\n}", "func WriteByte(buffer []byte, offset int, value byte) {\n buffer[offset] = value\n}", "func (pk PacketBufferPtr) ToBuffer() buffer.Buffer {\n\tb := pk.buf.Clone()\n\tb.TrimFront(int64(pk.headerOffset()))\n\treturn b\n}", "func (m *Magic) Buffer(data []byte) (string, error) {\n\tif m.ptr == nil {\n\t\treturn \"\", ConnectionError\n\t}\n\n\tptr := unsafe.Pointer(&data)\n\tsz := C.size_t(len(data))\n\tcr := C.magic_buffer(m.ptr, ptr, sz)\n\n\tif cr == nil {\n\t\treturn \"\", m.check()\n\t}\n\n\tr := C.GoString(cr)\n\tC.free(unsafe.Pointer(cr))\n\treturn r, nil\n}", "func (tb *TelemetryBuffer) Write(b []byte) (c int, err error) {\n\tbuf := make([]byte, len(b))\n\tcopy(buf, b)\n\t//nolint:makezero //keeping old code\n\tbuf = append(buf, Delimiter)\n\tw := bufio.NewWriter(tb.client)\n\tc, err = w.Write(buf)\n\tif err == nil {\n\t\terr = w.Flush()\n\t}\n\n\treturn\n}", "func newBuffer(r io.Reader, offset int64) *buffer {\n\treturn &buffer{\n\t\tr: r,\n\t\toffset: offset,\n\t\tbuf: make([]byte, 0, 4096),\n\t\tallowObjptr: true,\n\t\tallowStream: true,\n\t}\n}", "func (src *Source) SetBuffer(buf []byte) {\n\tsrc.buf = buf\n}", "func (driver *S3Driver) CopyBuffer(dst io.Writer, src io.Reader, buf []byte) (written int64, err error) {\r\n\tif buf != nil && len(buf) == 0 {\r\n\t\tpanic(\"empty buffer in io.CopyBuffer\")\r\n\t}\r\n\treturn copyBuffer(dst, src, buf)\r\n}", "func PutBuffer(buf *bytes.Buffer) {\n\tbufPool.Put(buf)\n}", "func WriteBuffer1(lines []string) []byte {\n\t//write to byte buffer\n\tcontent := make([]byte, 0)\n\trecode := \"\\r\\n\"\n\tfor _, line := range lines {\n\t\tcontent = append(content, line...)\n\t\tcontent = append(content, recode...)\n\t}\n\treturn content\n}", "func WriteBuffer2(lines []string) []byte {\n\t//write to byte buffer\n\tcontent := bytes.NewBuffer(make([]byte, 0))\n\trecode := \"\\r\\n\"\n\tfor _, line := range lines {\n\t\tcontent.WriteString(line)\n\t\tcontent.WriteString(recode)\n\t}\n\treturn content.Bytes()\n}", "func (f *FileRotator) writeToBuffer(p []byte) (int, error) {\n\tf.bufLock.Lock()\n\tdefer f.bufLock.Unlock()\n\treturn f.bufw.Write(p)\n}", "func (rw *ReadWrite) PutBuf(s string) *ReadWrite {\n\tlimit(int64(len(s)))\n\trw.w.WriteString(s)\n\treturn rw\n}", "func (bw *BufferedWriterMongo) writeBuffer() (err error) {\n\n\tif len(bw.buffer) == 0 {\n\t\treturn nil\n\t}\n\n\tcoll := bw.client.Database(bw.db).Collection(bw.collection)\n\t_, err = coll.InsertMany(bw.ctx, bw.buffer)\n\treturn err\n}", "func (body *luaBody) buffer() *bytes.Buffer {\n\tvar b bytes.Buffer\n\tif body.Reader == nil {\n\t\treturn &b\n\t}\n\n\tb.ReadFrom(body.Reader)\n\t_, err := body.Reader.(io.Seeker).Seek(0, 0)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn &b\n}", "func (tb *TelemetryBuffer) Write(b []byte) (c int, err error) {\n\tb = append(b, Delimiter)\n\tw := bufio.NewWriter(tb.client)\n\tc, err = w.Write(b)\n\tif err == nil {\n\t\terr = w.Flush()\n\t}\n\n\treturn\n}", "func (tb *TelemetryBuffer) Write(b []byte) (c int, err error) {\n\tb = append(b, Delimiter)\n\tw := bufio.NewWriter(tb.client)\n\tc, err = w.Write(b)\n\tif err == nil {\n\t\terr = w.Flush()\n\t}\n\n\treturn\n}", "func (tb *TelemetryBuffer) Write(b []byte) (c int, err error) {\n\tb = append(b, Delimiter)\n\tw := bufio.NewWriter(tb.client)\n\tc, err = w.Write(b)\n\tif err == nil {\n\t\terr = w.Flush()\n\t}\n\n\treturn\n}", "func (d *pmac) processBuffer() {\n\txor(d.offset[:], d.l[bits.TrailingZeros(d.ctr+1)][:])\n\txor(d.buf[:], d.offset[:])\n\td.ctr++\n\n\td.buf.Encrypt(d.c)\n\txor(d.digest[:], d.buf[:])\n\td.pos = 0\n}", "func (s *Secret) Buffer() []byte {\n\treturn s.buffer.Buffer()\n}", "func (b *Buf) Bytes() []byte { return b.b }", "func (buffer *Buffer) WriteTo(w io.Writer) {\n\tif buffer == nil || buffer.B == nil {\n\t\treturn\n\t}\n\n\tif _, err := w.Write([]byte(buffer.B.String())); err != nil {\n\t\t_, _ = fmt.Fprintf(os.Stderr, \"buffer write error: %v\\n\", err)\n\t\tbuffer.Error = err\n\t}\n}", "func NewBuffer(e []byte) *Buffer {\n\treturn &Buffer{buf: e}\n}", "func (b *defaultByteBuffer) AppendBuffer(buf ByteBuffer) (n int, err error) {\n\tsubBuf := buf.(*defaultByteBuffer)\n\tn = subBuf.writeIdx\n\tb.ensureWritable(n)\n\tcopy(b.buff[b.writeIdx:b.writeIdx+n], subBuf.buff)\n\tb.writeIdx += n\n\tbuf.Release(nil)\n\treturn\n}", "func PutBytesBuffer(b *bytes.Buffer) bool {\n\tif b == nil {\n\t\treturn false\n\t}\n\tsize := b.Cap()\n\tswitch {\n\n\tcase size >= 256 && size < 512:\n\t\tb.Reset()\n\t\tputb256(b)\n\n\tcase size >= 512 && size < 1024:\n\t\tb.Reset()\n\t\tputb512(b)\n\n\tcase size >= 1024 && size < 2048:\n\t\tb.Reset()\n\t\tputb1K(b)\n\n\tcase size >= 2048 && size < 4096:\n\t\tb.Reset()\n\t\tputb2K(b)\n\n\tcase size >= 4096 && size < 8192:\n\t\tb.Reset()\n\t\tputb4K(b)\n\n\tcase size >= 8192 && size < 16384:\n\t\tb.Reset()\n\t\tputb8K(b)\n\n\tcase size >= 16384 && size < 32768:\n\t\tb.Reset()\n\t\tputb16K(b)\n\n\tcase size >= 32768 && size < 65536:\n\t\tb.Reset()\n\t\tputb32K(b)\n\n\tcase size >= 65536 && size < 131072:\n\t\tb.Reset()\n\t\tputb64K(b)\n\n\tcase size >= 131072 && size < 262144:\n\t\tb.Reset()\n\t\tputb128K(b)\n\n\tcase size >= 262144 && size < 524288:\n\t\tb.Reset()\n\t\tputb256K(b)\n\n\tcase size >= 524288 && size < 1048576:\n\t\tb.Reset()\n\t\tputb512K(b)\n\n\tcase size >= 1048576 && size < 2097152:\n\t\tb.Reset()\n\t\tputb1M(b)\n\n\tcase size >= 2097152 && size < 4194304:\n\t\tb.Reset()\n\t\tputb2M(b)\n\n\tcase size >= 4194304 && size < 8388608:\n\t\tb.Reset()\n\t\tputb4M(b)\n\n\tcase size >= 8388608 && size < 16777216:\n\t\tb.Reset()\n\t\tputb8M(b)\n\n\tcase size >= 16777216 && size < 33554432:\n\t\tb.Reset()\n\t\tputb16M(b)\n\n\tdefault:\n\t\treturn false\n\t}\n\treturn true\n}", "func newBuffer(e []byte) *Buffer {\n\tp := buffer_pool.Get().(*Buffer)\n\tp.buf = e\n\treturn p\n}", "func (p *Packet) Buffer() []byte {\n\treturn p.Buf\n}", "func (w *Writer) Buffer() audio.Buffer {\n\treturn w.buf.Clone()\n}", "func (w *Writer) WriteBuffer(b audio.Buffer) (int, error) {\n\t// Resize to max capacity before reading\n\tw.intBuf.Data = w.intBuf.Data[:cap(w.intBuf.Data)]\n\n\tn, err := b.Read(w.intBuf.Data, w.fmt.BitDepth)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\t// Resize to valid length, since encoder.Write doesn't accept number of values to write\n\tw.intBuf.Data = w.intBuf.Data[:n]\n\n\t// Write the buffer to encoder.\n\tif err := w.enc.Write(&w.intBuf); err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn n, nil\n}", "func (s *safeBuffer) Write(p []byte) (int, error) {\n\ts.Lock()\n\tdefer s.Unlock()\n\treturn s.buf.Write(p)\n}", "func (d *decoder) buffer() []byte {\n\tif d.buf == nil {\n\t\td.buf = make([]byte, 8)\n\t}\n\treturn d.buf\n}", "func NewBuffer(e []byte) *Buffer {\n\treturn &Buffer{buf: e, length: len(e)}\n}", "func (b *Buffer) Write(buf []byte) (int, error) {\n\t// Account for total bytes written\n\tn := len(buf)\n\tb.written += int64(n)\n\n\t// If the buffer is larger than ours, then we only care\n\t// about the last size bytes anyways\n\tif int64(n) > b.size {\n\t\tbuf = buf[int64(n)-b.size:]\n\t}\n\n\t// Copy in place\n\tremain := b.size - b.writeCursor\n\tcopy(b.data[b.offset+b.writeCursor:], buf)\n\tif int64(len(buf)) > remain {\n\t\tcopy(b.data[b.offset:], buf[remain:])\n\t}\n\n\t// Update location of the cursor\n\tb.writeCursor = ((b.writeCursor + int64(len(buf))) % b.size)\n\treturn n, nil\n}", "func (b *Buffer) bytes() []byte {\n\treturn b.data\n}", "func (r *Buffer) Put(item []byte) {\n\tatomic.StorePointer(&r.items[atomic.LoadUint32(&r.writeIndex)], unsafe.Pointer(&item))\n\tincrementIndex(&r.writeIndex, len(r.items)-1)\n}", "func (b *Buffer) Attach(buffer []byte) {\n b.AttachBytes(buffer, 0, len(buffer))\n}", "func (rr *responseRecorder) Buffer() *bytes.Buffer {\n\treturn rr.buf\n}", "func (buffer *Buffer) WriteBytes(p []byte) {\n\tif buffer == nil || buffer.B == nil {\n\t\treturn\n\t}\n\n\tif _, err := buffer.B.Write(p); err != nil {\n\t\t_, _ = fmt.Fprintf(os.Stderr, \"buffer write error: %v\\n\", err)\n\t\tbuffer.Error = err\n\t}\n}", "func (s *Stream) pushBytes(p []byte) {\n\ts.bufferLock.Lock()\n\ts.buffer.Write(p)\n\ts.bufferLock.Unlock()\n}", "func (b *Buffer) Write(p []byte) (int, error) {\n\treturn b.Append(p), nil\n}", "func NewBuffer() Buffer {\n\treturn &buffer{}\n}", "func (w *BufferToBytesWriter) Write(mb MultiBuffer) error {\n\tdefer mb.Release()\n\n\tbs := mb.ToNetBuffers()\n\t_, err := bs.WriteTo(w.writer)\n\treturn err\n}", "func SaveBuffer(filename string, filebytes *bytes.Buffer) error {\n\terr := ioutil.WriteFile(filename, filebytes.Bytes(), 0644)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func (b *Buf) Write(bts []byte) {\n\tn := b.grow(len(bts)) // Evaluate, grow slice before copying.\n\tcopy(b.b[n:], bts)\n}", "func TarBuffer(tw *tar.Writer, buf []byte, path string) error {\n\thdr := &tar.Header{\n\t\tName: path,\n\t\tSize: int64(len(buf)),\n\t\tMode: 0666,\n\t}\n\tif err := tw.WriteHeader(hdr); err != nil {\n\t\treturn err\n\t}\n\t_, err := tw.Write(buf)\n\treturn err\n}", "func (r *Relay) copyWithBuffer(dst io.Writer, src io.Reader, buf []byte) (written int64, err error) {\n\tfor {\n\t\tnr, er := src.Read(buf)\n\t\tif nr > 0 {\n\t\t\tnw, ew := dst.Write(buf[0:nr])\n\t\t\tif nw < 0 || nr < nw {\n\t\t\t\tnw = 0\n\t\t\t\tif ew == nil {\n\t\t\t\t\tew = errInvalidWrite\n\t\t\t\t}\n\t\t\t}\n\t\t\twritten += int64(nw)\n\t\t\tif ew != nil {\n\t\t\t\terr = ew\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif nr != nw {\n\t\t\t\terr = io.ErrShortWrite\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif r.metricsTracer != nil {\n\t\t\t\tr.metricsTracer.BytesTransferred(nw)\n\t\t\t}\n\t\t}\n\t\tif er != nil {\n\t\t\tif er != io.EOF {\n\t\t\t\terr = er\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n\treturn written, err\n}", "func newBuffer() *buffer {\n\treturn &buffer{\n\t\tdata: make([]byte, 0),\n\t\tlen: 0,\n\t\tpkg: nil,\n\t\tconn: nil,\n\t\tpkgCh: make(chan *pkg),\n\t\tevCh: make(chan *pkg),\n\t\terrCh: make(chan error, 1),\n\t}\n}", "func NewBuffer(aSlice interface{}) *Buffer {\n return &Buffer{buffer: sliceValue(aSlice, false), handler: valueHandler{}}\n}", "func (s *Buffer) Write(p []byte) (n int, err error) {\n\ts.mutex.Lock()\n\tdefer s.mutex.Unlock()\n\treturn s.buffer.Write(p)\n}", "func (self Source) SetBuffer(buffer Buffer) {\n\tself.Seti(AlBuffer, int32(buffer))\n}", "func (b *buf) Write(p []byte) (n int, err error) {\n\tb.b = b.base[b.i : b.i+len(p)]\n\tcopy(b.b, p)\n\tb.i += len(p)\n\t//fmt.Printf(\"Write: len(b.b)=%d, len(p)=%d, % #X\\n\", len(b.b), len(p), p)\n\t//fmt.Printf(\"b=%#v\\n\", b)\n\treturn len(p), nil\n}", "func createBuffer() *bytes.Buffer {\n\tbuf := bytes.Buffer{}\n\treturn &buf\n}", "func (src *Source) SetNewBuffer() {\n\tsrc.buf = make([]byte, 64)\n}", "func newBuffer() Buffer {\n\treturn &buffer{\n\t\tbytes: make([]byte, 0, 64),\n\t}\n}", "func (d PacketData) MergeBuffer(b *buffer.Buffer) {\n\td.pk.buf.Merge(b)\n}", "func (b *Buffer) AttachBytes(buffer []byte, offset int, size int) {\n if len(buffer) < size {\n panic(\"invalid buffer\")\n }\n if size <= 0 {\n panic(\"invalid size\")\n }\n if offset > size {\n panic(\"invalid offset\")\n }\n\n b.data = buffer\n b.size = size\n b.offset = offset\n}", "func (p *Packet) putBytes(b []byte) {\n\tp.buf = append(p.buf, b...)\n}", "func PutBuffer(buffer *bytes.Buffer) {\n\tif buffer == nil {\n\t\treturn\n\t}\n\n\tbuffer.Reset()\n\tdefaultPool.pool.Put(buffer)\n}", "func (w *ByteWriter) Bytes() []byte { return w.buffer }", "func NewLocalBuffer(b bytes.Buffer) *LocalBuffer { return &LocalBuffer{b: b} }", "func (request *Request) Buffer() ([]byte, error) {\n\treturn json.Marshal(request)\n}", "func (b *QueueBuffer) Write(p []byte) (int, error) {\n\t// io.Writer shouldn't modify the buf it's handed (even temporarily)\n\tcp := make([]byte, len(p))\n\tif n := copy(cp, p); n != len(p) {\n\t\treturn 0, fmt.Errorf(\"failed to make copy of provided buf\")\n\t}\n\t(*b) = append(cp, (*b)...)\n\treturn len(p), nil\n}", "func (b *Buffer) Bytes() []byte {\n\treturn b.buf\n}", "func NewBuffer() *Buffer { return globalPool.NewBuffer() }", "func (p *BufferPool) Put(b []byte) {\n\tp.p.Put(b)\n}", "func NewBuffer(capacity int) Buffer {\n\treturn Buffer{\n\t\tcapacity: capacity,\n\t\tcurrentSize: 0,\n\t\tcontents: map[entity.Key]inventoryapi.PostDeltaBody{},\n\t}\n}", "func (b *defaultByteBuffer) NewBuffer() ByteBuffer {\n\treturn NewWriterBuffer(256)\n}", "func (jbobject *JavaNioCharBuffer) Put3(a string) *JavaNioCharBuffer {\n\tconv_a := javabind.NewGoToJavaString()\n\tif err := conv_a.Convert(a); err != nil {\n\t\tpanic(err)\n\t}\n\tjret, err := jbobject.CallMethod(javabind.GetEnv(), \"put\", \"java/nio/CharBuffer\", conv_a.Value().Cast(\"java/lang/String\"))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tconv_a.CleanUp()\n\tretconv := javabind.NewJavaToGoCallable()\n\tdst := &javabind.Callable{}\n\tretconv.Dest(dst)\n\tif err := retconv.Convert(javabind.ObjectRef(jret)); err != nil {\n\t\tpanic(err)\n\t}\n\tretconv.CleanUp()\n\tunique_x := &JavaNioCharBuffer{}\n\tunique_x.Callable = dst\n\treturn unique_x\n}", "func (bp *bufferPool) putBuffer(b *buffer) {\n\tbp.lock.Lock()\n\tif bp.freeBufNum < 1000 {\n\t\tb.next = bp.freeList\n\t\tbp.freeList = b\n\t\tbp.freeBufNum++\n\t}\n\tbp.lock.Unlock()\n}", "func (d PacketData) ToBuffer() buffer.Buffer {\n\tbuf := d.pk.buf.Clone()\n\toffset := d.pk.dataOffset()\n\tbuf.TrimFront(int64(offset))\n\treturn buf\n}", "func (b *Buffer) Write() error {\n\tvar err error\n\n\t// Check if there were errors:\n\terrors := b.reporter.Errors()\n\tif errors > 0 {\n\t\tif errors > 1 {\n\t\t\terr = fmt.Errorf(\"there were %d errors\", errors)\n\t\t} else {\n\t\t\terr = fmt.Errorf(\"there was 1 error\")\n\t\t}\n\t\treturn err\n\t}\n\n\t// Make sure that the output directory exists:\n\tdir := filepath.Dir(b.output)\n\terr = os.MkdirAll(dir, 0777)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Write the file:\n\tb.reporter.Infof(\"Writing file '%s'\", b.output)\n\tjsonData := b.stream.Buffer()\n\terr = ioutil.WriteFile(b.output, jsonData, 0666)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func NewBuffer(inp []byte) *ByteBuffer {\n\tif inp == nil {\n\t\tinp = make([]byte, 0, 512)\n\t}\n\treturn &ByteBuffer{Buffer: bytes.NewBuffer(inp)}\n}", "func (b *Buffer) Write(p []byte) (n int, err error) {\n\tb.m.Lock()\n\tdefer b.m.Unlock()\n\treturn b.b.Write(p)\n}", "func (r *PacketReadWriter) FeedBuffer(buf *bytes.Buffer) {\n\tr.bodyArena.PutBuffer(buf)\n}", "func (vm *VM) bufferPush(data string) {\n\tnewBuffer := &buffer{\n\t\tprevious: vm.buffer,\n\t\tvalue: data,\n\t}\n\tvm.buffer = newBuffer\n}", "func (out *OutBuffer) Append(p ...byte) {\n\tout.Data = append(out.Data, p...)\n}", "func (b *ByteBuffer) Write(p []byte) (int, error) {\n\tb.B = append(b.B, p...)\n\treturn len(p), nil\n}", "func NewBuffer() *Buffer {\n\treturn &Buffer{Line: []byte{}, Val: make([]byte, 0, 32)}\n}", "func (r *Record) NewBuffer() *bytes.Buffer {\n\tif r.Buffer == nil {\n\t\treturn &bytes.Buffer{}\n\t}\n\n\treturn r.Buffer\n}", "func (b *SafeBuffer) Write(p []byte) (n int, err error) {\n\tb.m.Lock()\n\tdefer b.m.Unlock()\n\treturn b.b.Write(p)\n}", "func copyBuffer(dst io.Writer, src io.Reader, buf []byte) error {\n\tfor {\n\t\tnr, rerr := src.Read(buf)\n\t\tif nr > 0 {\n\t\t\tnw, werr := dst.Write(buf[:nr])\n\t\t\tif werr != nil {\n\t\t\t\treturn werr\n\t\t\t}\n\t\t\tif nr != nw {\n\t\t\t\treturn io.ErrShortWrite\n\t\t\t}\n\t\t}\n\t\tif rerr != nil {\n\t\t\tif rerr == io.EOF {\n\t\t\t\trerr = nil\n\t\t\t}\n\t\t\treturn rerr\n\t\t}\n\t}\n}", "func (jbobject *JavaNioCharBuffer) Put2(a string, b int, c int) *JavaNioCharBuffer {\n\tconv_a := javabind.NewGoToJavaString()\n\tif err := conv_a.Convert(a); err != nil {\n\t\tpanic(err)\n\t}\n\tjret, err := jbobject.CallMethod(javabind.GetEnv(), \"put\", \"java/nio/CharBuffer\", conv_a.Value().Cast(\"java/lang/String\"), b, c)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tconv_a.CleanUp()\n\tretconv := javabind.NewJavaToGoCallable()\n\tdst := &javabind.Callable{}\n\tretconv.Dest(dst)\n\tif err := retconv.Convert(javabind.ObjectRef(jret)); err != nil {\n\t\tpanic(err)\n\t}\n\tretconv.CleanUp()\n\tunique_x := &JavaNioCharBuffer{}\n\tunique_x.Callable = dst\n\treturn unique_x\n}", "func (p *Buffer) SetBuf(s []byte) {\n\tp.buf = s\n\tp.index = 0\n\tp.length = len(s)\n}", "func New(b []byte) *Buffer {\n\treturn &Buffer{b: b}\n}", "func NewBuffer() *Buffer {\n\treturn &Buffer{B: &strings.Builder{}}\n}", "func NewBuffer(data string) Buffer {\n\tif len(data) == 0 {\n\t\treturn nilBuffer\n\t}\n\tvar (\n\t\tidx = 0\n\t\tbuf8 = make([]byte, 0, len(data))\n\t\tbuf16 []uint16\n\t\tbuf32 []rune\n\t)\n\tfor idx < len(data) {\n\t\tr, s := utf8.DecodeRuneInString(data[idx:])\n\t\tidx += s\n\t\tif r < utf8.RuneSelf {\n\t\t\tbuf8 = append(buf8, byte(r))\n\t\t\tcontinue\n\t\t}\n\t\tif r <= 0xffff {\n\t\t\tbuf16 = make([]uint16, len(buf8), len(data))\n\t\t\tfor i, v := range buf8 {\n\t\t\t\tbuf16[i] = uint16(v)\n\t\t\t}\n\t\t\tbuf8 = nil\n\t\t\tbuf16 = append(buf16, uint16(r))\n\t\t\tgoto copy16\n\t\t}\n\t\tbuf32 = make([]rune, len(buf8), len(data))\n\t\tfor i, v := range buf8 {\n\t\t\tbuf32[i] = rune(uint32(v))\n\t\t}\n\t\tbuf8 = nil\n\t\tbuf32 = append(buf32, r)\n\t\tgoto copy32\n\t}\n\treturn &asciiBuffer{\n\t\tarr: buf8,\n\t}\ncopy16:\n\tfor idx < len(data) {\n\t\tr, s := utf8.DecodeRuneInString(data[idx:])\n\t\tidx += s\n\t\tif r <= 0xffff {\n\t\t\tbuf16 = append(buf16, uint16(r))\n\t\t\tcontinue\n\t\t}\n\t\tbuf32 = make([]rune, len(buf16), len(data))\n\t\tfor i, v := range buf16 {\n\t\t\tbuf32[i] = rune(uint32(v))\n\t\t}\n\t\tbuf16 = nil\n\t\tbuf32 = append(buf32, r)\n\t\tgoto copy32\n\t}\n\treturn &basicBuffer{\n\t\tarr: buf16,\n\t}\ncopy32:\n\tfor idx < len(data) {\n\t\tr, s := utf8.DecodeRuneInString(data[idx:])\n\t\tidx += s\n\t\tbuf32 = append(buf32, r)\n\t}\n\treturn &supplementalBuffer{\n\t\tarr: buf32,\n\t}\n}", "func (b *Buffer) String() string {\n\treturn string(b.buf)\n}", "func (c *Client) ExchangeBuffer(inbuf []byte, a string, outbuf []byte) (n int, err error) {\n\tw := new(reply)\n\tw.client = c\n\tw.addr = a\n\tif c.Hijacked == nil {\n\t\tif err = w.Dial(); err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tdefer w.Close()\n\t}\n\tif c.Hijacked != nil {\n\t\tw.conn = c.Hijacked\n\t}\n\tif n, err = w.writeClient(inbuf); err != nil {\n\t\treturn 0, err\n\t}\n\t//Why cant we set the buf here?? TODO(MG)\n\tif n, err = w.readClient(outbuf); err != nil {\n\t\treturn n, err\n\t}\n\treturn n, nil\n}" ]
[ "0.7063872", "0.67161524", "0.67068446", "0.65845394", "0.6562657", "0.6473435", "0.64533865", "0.64407766", "0.6417998", "0.6391375", "0.63892394", "0.6382781", "0.6305501", "0.6249872", "0.6236943", "0.6231833", "0.621024", "0.61901355", "0.61756027", "0.6169001", "0.6159878", "0.61394906", "0.6134106", "0.6119106", "0.6116554", "0.60995305", "0.6099405", "0.6081862", "0.6074269", "0.6074269", "0.6074269", "0.60673565", "0.6059907", "0.6042563", "0.60316974", "0.60232544", "0.601614", "0.600229", "0.59973437", "0.59812814", "0.5976527", "0.59693944", "0.5959214", "0.59570456", "0.59350485", "0.593406", "0.59319514", "0.5922544", "0.5918924", "0.5917176", "0.59126866", "0.5906576", "0.5899546", "0.58967865", "0.5893432", "0.58894795", "0.58743876", "0.5871694", "0.58713907", "0.5862301", "0.5859279", "0.58474123", "0.5842451", "0.5841047", "0.5835326", "0.58301145", "0.5828028", "0.5827619", "0.5824329", "0.58112794", "0.5807126", "0.5803235", "0.579558", "0.5790975", "0.5780513", "0.5772217", "0.5767477", "0.5764225", "0.57631075", "0.5746898", "0.57465094", "0.5745523", "0.5736099", "0.5733089", "0.573279", "0.5729493", "0.57285917", "0.5728396", "0.5710475", "0.5709966", "0.57099247", "0.57043034", "0.5701797", "0.5698358", "0.5690205", "0.56873995", "0.5683029", "0.5680538", "0.5679109", "0.56710964", "0.5666702" ]
0.0
-1
Listen creates a sound file in /var/tmp/loquacious/audio/recorded/ and writes input from the microphone to it then uploads it to Google Speech and logs the transcription
func Listen(timeLimit int) { log.Print("Recording audio from microphone") // TODO: this currently returns filepath of audio -- is it possible to return bytes instead? outputSoundFile := Record(timeLimit) log.Print("Loading sound clip") soundFile := readSoundFile(outputSoundFile) log.Print("Uploading sound clip to Speech client and fetching transcription") uploadSoundClip(soundFile) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func handleAudioUpload(audioURL, title string, duration int, chatID int64) {\n\t// Send status\n\tstopReportChannel := statusReporter(chatID, \"upload_voice\")\n\tdefer close(stopReportChannel)\n\t// Create a temp file\n\taudioFile, err := reddit.DownloadAudio(audioURL)\n\tif err != nil {\n\t\tbot.Send(tgbotapi.NewMessage(chatID, \"Cannot download audio; \"+generateAudioURLMessage(audioURL)))\n\t\treturn\n\t}\n\tdefer func() {\n\t\taudioFile.Close()\n\t\tos.Remove(audioFile.Name())\n\t}()\n\t// Simply upload it to telegram\n\tmsg := tgbotapi.NewAudio(chatID, telegramUploadOsFile{audioFile})\n\tmsg.Caption = title\n\tmsg.Duration = duration\n\t_, err = bot.Send(msg)\n\tif err != nil {\n\t\tbot.Send(tgbotapi.NewMessage(chatID, \"Cannot upload audio; \"+generateAudioURLMessage(audioURL)))\n\t\treturn\n\t}\n}", "func Record(params RecordParams) error {\n\t// Create a canceable context\n\tctx, cancel := context.WithCancel(context.Background())\n\tdefer cancel()\n\n\t// Setup a Ctrl+C handler\n\tsignals := make(chan os.Signal, 1)\n\tsignal.Notify(signals, os.Interrupt, syscall.SIGTERM)\n\tgo func(){\n\t\t<- signals\n\t\tfmt.Println(\"\\r- Ctrl+C pressed in Terminal\")\n\t\tcancel()\n\t\tos.Exit(0)\n\t}()\n\n\t// Start the web server on a different goroutine\n\twebServerOptions := NewWebServerOptions()\n\tgo Serve(webServerOptions)\n\n\t// Create the ffmpeg command\n\tcmd := exec.Command(`ffmpeg`,\n\t\t`-y`,\n\t\t`-framerate`, `60`,\n\t\t`-i`, `pipe:0`,\n\t\t`-c:v`, `libx264`,\n\t\t`-pix_fmt`, `yuv420p`,\n \t`-r`, `60`,\n\t\t`/tmp/out.mp4`,\n\t)\n\n\t// Pipe cmd stderr and stdout to the console\n\tcmd.Stderr = os.Stderr\n\tcmd.Stdout = os.Stdout\n\n\t// Open stdin pipe\n\tstdin, err := cmd.StdinPipe()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Override the provided RecordParams\n\tparams.Writer = StdinWriter{stdin}\n\tparams.URL = fmt.Sprintf(\"http://localhost:%d/handler\", webServerOptions.Port)\n\n\t// Start the ffmpeg command\n\tif err := cmd.Start(); err != nil {\n\t\treturn err\n\t}\n\n\t// Start the recording process\n\tif err := record(ctx, params); err != nil {\n\t\treturn err\n\t}\n\n\t// Close stdin, or ffmpeg will wait forever\n\tif err := stdin.Close(); err != nil {\n\t\treturn err\n\t}\n\n\t// Wait until ffmpeg finishes\n\tif err := cmd.Wait(); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func listen(session *discordgo.Session, voice *discordgo.VoiceConnection, guildId string) {\n\tstream := voice.OpusRecv\n\tcloseChan := contextMap[guildId].CloseChan\n\n\tfor {\n\t\tselect {\n\t\tcase input := <-stream:\n\t\t\tfmt.Printf(\"%b\\n\", input.Opus)\n\t\tcase <-closeChan:\n\t\t\tdisconnect(session, guildId)\n\t\t}\n\t}\n}", "func echo(v *discordgo.VoiceConnection) {\n\n\trecv := make(chan *discordgo.Packet, 2)\n\tgo Decode(v, recv)\n\n\t// v.Speaking(true)\n\t// defer v.Speaking(false)\n\n\t// f, err := os.OpenFile(\"test.raw\", os.O_APPEND|os.O_WRONLY, 0600)\n\t// if err != nil {\n // \tpanic(err)\n\t// }\n\t// defer f.Close()\n\n\tgo retrieveGSRResult()\n\n\tfor {\n\t\tp, ok := <-recv\n\t\tif !ok {\n\t\t\treturn\n\t\t}\n\n\t\tvar (\n\t\t\tsum int16 = 0\n\t\t)\n\n\t\tfor i := 0; i < len(squareSequence); i++ {\n\t\t\tsum -= p.PCM[squareSequence[i]]\n\t\t}\n\n if !evaluating {\n\t\t\treturn\n\t\t\t\n\t\t}\n\n\n\t\tif sum == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\tfmt.Println(\"Buffering...\")\n\n\t\tbuf := make([]byte,channels*sampleSize)\n\n\t\tfor i := 0; i < len(p.PCM); i++ {\n\t\t\tvar h uint8 = uint8(p.PCM[i]>>8)\n\t\t\tbuf[i] = h\n\t\t}\n\n\t\t// _,err := f.Write(buf)\n\t // if err != nil {\n\t // log.Fatal(err)\n\t // }\n\n\t\tif err = stream.Send(&speechpb.StreamingRecognizeRequest{\n\t\t\tStreamingRequest: &speechpb.StreamingRecognizeRequest_AudioContent{\n\t\t\t\tAudioContent: buf,\n\t\t\t},\n\t\t}); err != nil {\n log.Printf(\"Could not send audio: %v\", err)\n }\n\t}\n}", "func speechHandler(w http.ResponseWriter, r *http.Request) {\n\tfw := flushWriter{w: w}\n\tif f, ok := w.(http.Flusher); ok {\n\t\tfw.f = f\n\t}\n\n\t// build speech and encoding commands\n\tvalues := r.URL.Query()\n\tspeak, err := buildSpeechCmd(&values, &w)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tencode, err := buildEncodeCmd(&values, &w)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// pipe synthesizer to encoder\n\tencode.Stdin, _ = speak.StdoutPipe()\n\tencode.Stdout = &fw\n\n\tif err := encode.Start(); err != nil {\n\t\thttp.Error(w, \"Failed to start encoder\", 500)\n\t\treturn\n\t}\n\n\tif err := speak.Run(); err != nil {\n\t\thttp.Error(w, \"Failed to run synthesizer\", 500)\n\t\treturn\n\t}\n\n\tif err := encode.Wait(); err != nil {\n\t\thttp.Error(w, \"Failed to finish encoding: \"+err.Error(), 500)\n\t\treturn\n\t}\n}", "func (vr *VoiceRecorder) RecordAudioFor(cr *chrome.Chrome, fileDuration time.Duration) uiauto.Action {\n\treturn func(ctx context.Context) error {\n\t\t// Button for starting recording and button for stoping recording are identical object.\n\t\t// The share the same id. And there is no text or description to identify them.\n\t\tstartOrStopRecordBtn := vr.app.Device.Object(ui.ID(startOrStopRecordBtnID))\n\t\ttesting.ContextLog(ctx, \"Start to record sound\")\n\t\tif err := uiauto.Combine(\"record sound\",\n\t\t\tapputil.FindAndClick(startOrStopRecordBtn, defaultUITimeout), // First click is for starting recording sound.\n\t\t\tuiauto.Sleep(fileDuration), // For recording sound, sleep for some time after clicking recording button.\n\t\t\tapputil.FindAndClick(startOrStopRecordBtn, defaultUITimeout), // Second click is for stopping recording sound.\n\t\t)(ctx); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\teditFileNameDialog := vr.app.Device.Object(ui.ID(editFileNameDialogID))\n\t\tif err := editFileNameDialog.WaitForExists(ctx, defaultUITimeout); err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to find edit file name\")\n\t\t}\n\t\tname, err := editFileNameDialog.GetText(ctx)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"failed to get the recorded audio file name in app %q\", vr.app.AppName)\n\t\t}\n\t\tname = name + \".mp3\"\n\n\t\ttesting.ContextLogf(ctx, \"Save the file: %s\", name)\n\t\tokBtn := vr.app.Device.Object(ui.Text(\"OK\"))\n\t\tif err := apputil.FindAndClick(okBtn, defaultUITimeout)(ctx); err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to save the audio file\")\n\t\t}\n\n\t\ttesting.ContextLog(ctx, \"Check whether recorded file is in file system\")\n\t\tdownloadsPath, err := cryptohome.DownloadsPath(ctx, cr.NormalizedUser())\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to retrieve users Downloads path\")\n\t\t}\n\n\t\tpath := filepath.Join(downloadsPath, \"Recorders\", name)\n\t\tif _, err := os.Stat(path); err != nil {\n\t\t\tif os.IsNotExist(err) {\n\t\t\t\treturn errors.Wrap(err, \"file is not in file system\")\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\t\tvr.latestRecordDuration = fileDuration\n\t\tvr.latestRecordName = name\n\n\t\treturn nil\n\t}\n}", "func (a *AGI) Record(name string, opts *RecordOptions) error {\n\tif opts == nil {\n\t\topts = &RecordOptions{}\n\t}\n\tif opts.Format == \"\" {\n\t\topts.Format = \"wav\"\n\t}\n\tif opts.EscapeDigits == \"\" {\n\t\topts.EscapeDigits = \"#\"\n\t}\n\tif opts.Timeout == 0 {\n\t\topts.Timeout = 5 * time.Minute\n\t}\n\n\tcmd := strings.Join([]string{\n\t\t\"RECORD FILE \",\n\t\tname,\n\t\topts.Format,\n\t\topts.EscapeDigits,\n\t\ttoMSec(opts.Timeout),\n\t}, \" \")\n\n\tif opts.Offset > 0 {\n\t\tcmd += \" \" + strconv.Itoa(opts.Offset)\n\t}\n\n\tif opts.Beep {\n\t\tcmd += \" BEEP\"\n\t}\n\n\tif opts.Silence > 0 {\n\t\tcmd += \" s=\" + toSec(opts.Silence)\n\t}\n\n\treturn a.Command(cmd).Err()\n}", "func (al *AudioListener) Record(duration time.Duration) []gumble.AudioPacket {\n\tal.setBuffer(int(duration * gumble.AudioSampleRate / time.Second))\n\ttime.Sleep(duration)\n\treturn al.getBuffer()\n}", "func (ss *SaySpeaker) GenerateSpeech(text, fileName string) error {\n\treturn exec.Command(\"say\", \"-v\", ss.VoiceID, text).Run()\n}", "func (ps *PollySpeaker) GenerateSpeech(s string, fileName string) error {\n\tinput := &polly.SynthesizeSpeechInput{OutputFormat: aws.String(\"mp3\"), Text: aws.String(s), VoiceId: ps.VoiceID}\n\toutput, err := ps.SynthesizeSpeech(input)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpath, err := ps.saveAsMP3(fileName, output)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := exec.Command(\"afplay\", path).Run(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := os.Remove(path); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "func Listen(conf *config.Config, speaker twitspeak.TwitterSpeaker, resource database.Resource, logger *logrus.Logger, simLock *simulation.SimLock, simulator simulation.Simulator) {\n\t// check for webhooks id in database\n\twebhooksID, err := resource.GetWebhooksID(context.TODO())\n\tif err != nil {\n\t\tlogger.WithError(err).Panic(\"failed querying database for webhook id\")\n\t}\n\n\t// check twitter for webhooks id\n\twebhooksID, err = speaker.GetWebhook()\n\tif err != nil {\n\t\tlogger.WithError(err).Panic(\"failed querying twitter for webhook id\")\n\t}\n\n\t// autocert manager\n\tmanager := &autocert.Manager{\n\t\tPrompt: autocert.AcceptTOS,\n\t\tHostPolicy: autocert.HostWhitelist(conf.Domains...),\n\t\tCache: autocert.DirCache(\"certs\"),\n\t}\n\n\t// auto cert challenge server\n\tchallengeServer := &http.Server{\n\t\tHandler: manager.HTTPHandler(nil),\n\t\tAddr: \":http\",\n\t}\n\n\t// run challenge server\n\tgo func() {\n\t\tlogger.Info(\"starting autocert challenge server\")\n\t\terr := challengeServer.ListenAndServe()\n\t\tif err != nil {\n\t\t\tlogger.WithError(err).Panic(\"autocert challenge server died\")\n\t\t}\n\t}()\n\n\t// build the twitter webhooks server\n\tdmParser := input.NewDMParser(resource, speaker, logger, simulator)\n\ttwitterHandler := newHandler(conf, logger, dmParser, speaker, simLock)\n\tserver := &http.Server{\n\t\tReadTimeout: 5 * time.Second,\n\t\tWriteTimeout: 5 * time.Second,\n\t\tIdleTimeout: 120 * time.Second,\n\t\tHandler: twitterHandler,\n\t\tAddr: \":https\",\n\t}\n\n\t// start listening on https socket\n\ttlsConf := &tls.Config{\n\t\tGetCertificate: manager.GetCertificate,\n\t}\n\tlistener, err := tls.Listen(\"tcp\", \":https\", tlsConf)\n\tif err != nil {\n\t\tlogger.WithError(err).Panic(\"failed listening on https socket\")\n\t}\n\n\tif webhooksID != \"\" {\n\t\t// trigger a CRC manually\n\t\tgo func() {\n\t\t\terr = speaker.TriggerCRC(webhooksID)\n\t\t\tif err != nil {\n\t\t\t\tlogger.WithError(err).Panic(\"error while triggering crc\")\n\t\t\t}\n\t\t}()\n\t} else {\n\t\t// register the webhook\n\t\tgo func(handler *handler) {\n\t\t\tid, err := speaker.RegisterWebhook()\n\t\t\tif err != nil || id == \"\" {\n\t\t\t\tlogger.WithError(err).Panic(\"error while registering webhooks url\")\n\t\t\t}\n\n\t\t\terr = resource.SetWebhooksID(context.TODO(), webhooksID)\n\t\t\tif err != nil {\n\t\t\t\tlogger.WithError(err).Panic(\"error while setting webhooks id in database\")\n\t\t\t}\n\t\t\thandler.WebhooksID = webhooksID\n\t\t}(twitterHandler.(*handler))\n\t}\n\n\t// start serving on the twitter webhooks listener\n\tlogger.Info(\"starting twitter listener\")\n\terr = server.Serve(listener)\n\tif err != nil {\n\t\tlogger.WithError(err).Panic(\"twitter listener server died\")\n\t}\n}", "func (gn *Gen) GenSpeech(dirIn, dirOut string) {\n\tfiles := gn.LoadFileNamesFromDir(dirIn, \"\")\n\n\tex := \"/Users/rohrlich/gnuspeech_sa-master/build/gnuspeech_sa\"\n\tdata := \"/Users/rohrlich/gnuspeech_sa-master/data/en\"\n\n\tfor _, fn := range files {\n\t\tif fn == \"ls\" {\n\t\t\tcontinue\n\t\t}\n\t\tfp, err := os.Open(dirIn + \"/\" + fn)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t\tdefer fp.Close() // we will be done with the file within this function\n\n\t\tscanner := bufio.NewScanner(fp)\n\t\tscanner.Split(bufio.ScanLines)\n\n\t\tfor scanner.Scan() {\n\t\t\ttx := scanner.Text()\n\t\t\tfout := dirOut + \"/\" + fn + \".wav\"\n\t\t\tcmd := exec.Command(ex, \"-c\", data, \"-p\", \"trm_param_file.txt\", \"-o\", fout, tx)\n\t\t\tcmd.Stdout = os.Stdout\n\t\t\tcmd.Stderr = os.Stderr\n\t\t\terr = cmd.Run()\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\t\t}\n\t}\n}", "func startRecording(c *cli.Context) error {\n\tinitLogger(\"debug\")\n\n\tconf := config.TestConfig()\n\trc, err := service.NewMessageBus(conf)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treq := &livekit.RecordingReservation{\n\t\tId: utils.NewGuid(utils.RecordingPrefix),\n\t\tSubmittedAt: time.Now().UnixNano(),\n\t\tRequest: &livekit.StartRecordingRequest{\n\t\t\tInput: &livekit.RecordingInput{\n\t\t\t\tTemplate: &livekit.RecordingTemplate{\n\t\t\t\t\tLayout: \"speaker-dark\",\n\t\t\t\t\tToken: c.String(\"token\"),\n\t\t\t\t},\n\t\t\t},\n\t\t\tOutput: &livekit.RecordingOutput{\n\t\t\t\tS3Path: c.String(\"s3\"),\n\t\t\t},\n\t\t},\n\t}\n\n\tb, err := proto.Marshal(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tctx := context.Background()\n\tsub, _ := rc.Subscribe(ctx, utils.ReservationResponseChannel(req.Id))\n\tdefer sub.Close()\n\n\tif err = rc.Publish(ctx, utils.ReservationChannel, string(b)); err != nil {\n\t\treturn err\n\t}\n\n\tselect {\n\tcase <-sub.Channel():\n\t\tif err = rc.Publish(ctx, utils.StartRecordingChannel(req.Id), nil); err != nil {\n\t\t\treturn err\n\t\t}\n\tcase <-time.After(utils.RecorderTimeout):\n\t\treturn errors.New(\"no response from recorder service\")\n\t}\n\n\tfmt.Println(\"Recording ID:\", req.Id)\n\treturn nil\n}", "func (c *Client) TextToSpeech(ssml []byte) (file []byte, contentType string, err error) {\n\tvar req *http.Request\n\tif req, err = http.NewRequest(\"POST\", APINewtoneURL+\"/v1/synthesize\", bytes.NewBuffer(ssml)); err == nil {\n\t\t// set HTTP headers\n\t\treq.Header.Set(\"Content-Type\", \"application/xml\")\n\t\treq.Header.Set(\"Authorization\", c.authHeader(authTypeKakaoAK)) // set auth header\n\n\t\tvar res []byte\n\t\tif res, err = c.fetchHTTPResponse(req); err == nil {\n\t\t\treturn res, http.DetectContentType(res), nil\n\t\t}\n\t}\n\n\treturn nil, \"application/octet-stream\", err\n}", "func playSound(s *discordgo.Session, guildID, channelID string) (err_r error) {\n\n\tif playing {\n\t\treturn nil\n\t}\n\n\trand_num := rand.Int()%len(sliceData)\n\tmsg_string := sliceData[rand_num]\n\tfile_name := strconv.Itoa(rand_num)+\".mp3\"\n\tvar err error\n\tos.Setenv(\"GOOGLE_APPLICATION_CREDENTIALS\",\"INSERT YOUR GOOGLE CLOUD CREDENTIALS HERE\")\n\tif Exists(file_name) {\n\t\tlog.Println(\"file found: \", file_name)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error opening mp3 file :\", err)\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tlog.Println(\"file not found: \", file_name)\n\t\tctx := context.Background()\n\n\t\tclient, err := texttospeech.NewClient(ctx)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tdefer client.Close()\n\n\t\t// Perform the text-to-speech request on the text input with the selected\n\t\t// voice parameters and audio file type.\n\t\treq := texttospeechpb.SynthesizeSpeechRequest{\n\t\t\t// Set the text input to be synthesized.\n\t\t\tInput: &texttospeechpb.SynthesisInput{\n\t\t\t\tInputSource: &texttospeechpb.SynthesisInput_Text{Text: msg_string},\n\t\t\t},\n\t\t\t// Build the voice request, select the language code and the SSML\n\t\t\t// voice gender.\n\t\t\tVoice: &texttospeechpb.VoiceSelectionParams{\n\t\t\t\tLanguageCode: \"ru-RU\",\n\t\t\t\tSsmlGender: texttospeechpb.SsmlVoiceGender_MALE,\n\t\t\t\tName: \"ru-RU-Wavenet-D\",\n\t\t\t},\n\t\t\t// Select the type of audio file you want returned.\n\t\t\tAudioConfig: &texttospeechpb.AudioConfig{\n\t\t\t\tAudioEncoding: texttospeechpb.AudioEncoding_MP3,\n\t\t\t},\n\t\t}\n\n\t\tresp, err := client.SynthesizeSpeech(ctx, &req)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\t// The resp's AudioContent is binary.\n\t\tfile_name = strconv.Itoa(rand_num) + \".mp3\"\n\t\terr = ioutil.WriteFile(file_name, resp.AudioContent, 0644)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tfmt.Printf(\"Audio content written to file: %v\\n\", file_name)\n\n\t\tlog.Println(file_name)\n\n\t}\n\n\t//encode mp3 to dca\n\toptions := dca.StdEncodeOptions\n\toptions.RawOutput = true\n\toptions.Bitrate = 128\n\toptions.Application = \"lowdelay\"\n\n\tencodeSession, err := dca.EncodeFile(file_name, options)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer encodeSession.Cleanup()\n\n\n\t// Join the provided voice channel.\n\tvc, err := s.ChannelVoiceJoin(guildID, channelID, false, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\tplaying = true\n\n\t// Sleep for a specified amount of time before playing the sound\n\ttime.Sleep(250 * time.Millisecond)\n\n\t// Start speaking.\n\tvc.Speaking(true)\n\n\tdone := make(chan error)\n\tdca.NewStream(encodeSession, vc, done)\n\terr = <-done\n\tif err != nil && err != io.EOF {\n\t\treturn\n\t}\n\n\t// Stop speaking\n\tvc.Speaking(false)\n\n\t// Sleep for a specified amount of time before ending.\n\ttime.Sleep(250 * time.Millisecond)\n\n\t// Disconnect from the provided voice channel.\n\tvc.Disconnect()\n\n\tplaying = false\n\n\treturn nil\n\n}", "func listen() {\n\t// create handler\n\tvar handler handler\n\n\t// create listener\n\tlistener := pcap.Listener{\n\t\tPacketHandler: &handler,\n\t\tFile: pcapFile,\n\t\tDevice: pcapDevice,\n\t\tPromisc: pcapPromisc,\n\t\tSnaplen: pcapSnaplen,\n\t\tFilter: pcapFilter,\n\t}\n\n\t// start listen loop\n\tlistener.Prepare()\n\tlistener.Loop()\n}", "func main() {\n\t// connect to the server and start reading all tracks\n\tconn, err := gortsplib.DialRead(\"rtsps://touchuyht.com:8554/mystream\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer conn.Close()\n\n\t// find the aac track\n\taacTrack := func() int {\n\t\tfor i, track := range conn.Tracks() {\n\t\t\tif track.IsAAC() {\n\t\t\t\treturn i\n\t\t\t}\n\t\t}\n\t\treturn -1\n\t}()\n\tif aacTrack < 0 {\n\t\tpanic(fmt.Errorf(\"Aac track not found\"))\n\t}\n\tfmt.Printf(\"Aac track is number %d\\n\", aacTrack+1)\n\n\tdec := rtpaac.NewDecoder(16000)\n\tsequenceNumber := uint16(0x44ed)\n\tssrc := uint32(0x9dbb7812)\n\tinitialTs := uint32(0x88776655)\n\tenc := rtpaac.NewEncoder(96, 48000, &sequenceNumber, &ssrc, &initialTs)\n\n\t// read RTP frames\n\terr = conn.ReadFrames(func(trackID int, streamType gortsplib.StreamType, payload []byte) {\n\t\tif streamType == gortsplib.StreamTypeRTP && trackID == aacTrack {\n\t\t\t// convert RTP frames into aac NALUs\n\t\t\tnalus, _, err := dec.Decode(payload)\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// print NALUs\n\t\t\tfor _, nalu := range nalus {\n\t\t\t\tfmt.Printf(\"received Aac NALU of size %d\\n\", len(nalu))\n\t\t\t}\n\n\t\t\t_ , err = enc.Encode(nalus, 2 * time.Millisecond)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t}\n\t\t}\n\t})\n\tpanic(err)\n\n\t// read RTP frames\n\t//err = conn.ReadFrames(func(trackID int, streamType gortsplib.StreamType, payload []byte) {\n\t//\tfmt.Printf(\"frame from track %d, type %v, size %d\\n\", trackID, streamType, len(payload))\n\t//})\n\t//panic(err)\n\n\t// decode RTP to aac-lc\n}", "func PlainText(toSynthesize string, voiceID string) Response {\n\tvar res Response\n\tsess, err := session.NewSession()\n\tif err != nil {\n\t\tres.Error = err\n\t\treturn res\n\t}\n\n\tsvc := polly.New(sess, &aws.Config{Region: aws.String(\"us-east-1\")})\n\n\tparams := &polly.SynthesizeSpeechInput{\n\t\tOutputFormat: aws.String(\"mp3\"),\n\t\tText: aws.String(toSynthesize),\n\t\tVoiceId: aws.String(voiceID),\n\t\tTextType: aws.String(\"text\"),\n\t}\n\tresp, err := svc.SynthesizeSpeech(params)\n\n\tif err != nil {\n\t\tres.Error = err\n\t\treturn res\n\t}\n\n\tb, err := ioutil.ReadAll(resp.AudioStream)\n\tif err != nil {\n\t\tres.Error = err\n\t\treturn res\n\t}\n\t/*if err == nil {\n\t\terr := ioutil.WriteFile(\"./testfiles/test.mp3\", b, 0644)\n\t\tif err != nil {\n\t\t\tlog.Println(err.Error())\n\t\t}\n\t}*/\n\n\tres.Audio = b\n\tres.Error = nil\n\n\treturn res\n}", "func (t *testSystem) listen() {\n\tfor {\n\t\tselect {\n\t\tcase <-t.quit:\n\t\t\treturn\n\t\tcase queuedMessage := <-t.queuedMessage:\n\t\t\ttestLogger.Info(\"consuming a queue message...\")\n\t\t\tfor _, backend := range t.backends {\n\t\t\t\tgo backend.EventMux().Post(queuedMessage)\n\t\t\t}\n\t\t}\n\t}\n}", "func convert(flacFile string, c chan string) {\n\tflac, err := os.Open(flacFile)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// Step 1. Create a wav from flac\n\twav, err := flac2wav(*flac, wavFile)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\t// Everything vanishes once its time has come\n\tdefer cleanup(wav)\n\tlog.Printf(\"wav: %q\\n\", wav)\n\n\t// Step 2. Extract meta tags\n\ttags := metadata(*flac)\n\n\t// Step 2. Create mp3 from wav\n\tmp3, err := wav2mp3(wav, mp3File, tags)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Printf(\"Created file %s\\n\", mp3.Name())\n\tc <- mp3.Name()\n}", "func speechNotify(n notification) error {\n\tvoice := os.Getenv(voiceEnv)\n\tif voice == \"\" {\n\t\tvoice = \"Alex\"\n\t}\n\ttext := fmt.Sprintf(\"%s %s\", n.title, n.message)\n\n\tcmd := exec.Command(\"say\", \"-v\", voice, text)\n\tcmd.Stderr = os.Stderr\n\tif err := cmd.Run(); err != nil {\n\t\treturn fmt.Errorf(\"Speech: %s\", err)\n\t}\n\n\treturn nil\n}", "func (phone *Ph0n3) play(freq float64, duration time.Duration, wg *sync.WaitGroup) {\n\tdefer func() {\n\t\tif wg != nil {\n\t\t\twg.Done()\n\t\t}\n\t}()\n\tp := phone.ctx.NewPlayer()\n\ts := newSineWave(freq, duration, phone.opt.Channel)\n\tif _, err := io.Copy(p, s); err != nil {\n\t\tlog.Printf(\"%v\", err)\n\t\treturn\n\t}\n\tif err := p.Close(); err != nil {\n\t\tlog.Printf(\"%v\", err)\n\t\treturn\n\t}\n\treturn\n}", "func (bot *Bot) scribeListener(message events.EventMessage) {\n\tif !bot.Config.ChatLogging {\n\t\treturn\n\t}\n\tgo func() {\n\t\tlogFileName := fmt.Sprintf(\n\t\t\t\"logs/%s_%s_%s.txt\", message.TransportName, message.Channel, time.Now().Format(\"2006-01-02\"))\n\t\tf, err := os.OpenFile(logFileName, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)\n\t\tif err != nil {\n\t\t\tbot.Log.Errorf(\"Error opening log file: %s\", err)\n\t\t\treturn\n\t\t}\n\t\tdefer f.Close()\n\n\t\tscribe := log.New(f, \"\", log.Ldate|log.Ltime)\n\t\tif message.EventCode == events.EventChatMessage {\n\t\t\tscribe.Println(fmt.Sprintf(\"%s: %s\", message.Nick, message.Message))\n\t\t} else if message.EventCode == events.EventChatNotice {\n\t\t\tscribe.Println(fmt.Sprintf(\"Notice from %s: %s\", message.Nick, message.Message))\n\t\t} else if message.EventCode == events.EventJoinedChannel {\n\t\t\tscribe.Println(fmt.Sprintf(\"* %s joined.\", message.Nick))\n\t\t} else if message.EventCode == events.EventPartChannel {\n\t\t\tscribe.Println(fmt.Sprintf(\"* %s left.\", message.Nick))\n\t\t} else { // Must be channel activity.\n\t\t\tscribe.Println(fmt.Sprintf(\"* %s %s\", message.Nick, message.Message))\n\t\t}\n\t}()\n}", "func main() {\n\treader := bufio.NewReader(os.Stdin)\n\targs := os.Args[1:]\n\n\tvar uploadingFile string\n\tif len(args) == 1 {\n\t\tif args[0] == \"server\" {\n\t\t\tsignalingServer()\n\t\t\treturn\n\t\t} else {\n\t\t\tuploadingFile = args[0]\n\t\t}\n\t}\n\n\tvar f *os.File\n\tif uploadingFile != \"\" {\n\t\tfmt.Printf(\"Uploading %s\\n\", uploadingFile)\n\n\t\tvar err error\n\t\tf, err = os.Open(uploadingFile)\n\t\tcheckError(err)\n\t} else {\n\t\tfor {\n\t\t\tfmt.Printf(\"Save to: \")\n\n\t\t\tfilePath, err := reader.ReadString('\\n')\n\t\t\tcheckError(err)\n\t\t\tf, err = os.Create(strings.Trim(filePath, \"\\n\\r\"))\n\n\t\t\tif err == nil {\n\t\t\t\tbreak\n\t\t\t} else {\n\t\t\t\tfmt.Printf(err.Error())\n\t\t\t}\n\t\t}\n\t}\n\tdefer f.Close()\n\n\tvar connIO io.ReadWriteCloser\n\tif transport == \"tcp\" {\n\t\tuploaderAddr, err := net.ResolveTCPAddr(\"tcp\", \"localhost:8888\")\n\t\tif uploadingFile != \"\" {\n\t\t\ttime.Sleep(2 * time.Second)\n\t\t\tconnIO, err = net.Dial(\"tcp\", uploaderAddr.String())\n\t\t\tcheckError(err)\n\t\t} else {\n\t\t\tlistener, err := net.ListenTCP(\"tcp\", uploaderAddr)\n\t\t\tcheckError(err)\n\t\t\tfmt.Printf(\"Listening tcp....\\n\")\n\t\t\tconn, err := listener.Accept()\n\t\t\tcheckError(err)\n\t\t\tconnIO = conn\n\t\t}\n\t} else if transport == \"udp\" {\n\t\tuploaderAddr, err := net.ResolveUDPAddr(\"udp\", \"localhost:8888\")\n\t\tif uploadingFile != \"\" {\n\t\t\ttime.Sleep(2 * time.Second)\n\t\t\tconnIO, err = net.Dial(\"udp\", uploaderAddr.String())\n\t\t\tcheckError(err)\n\t\t} else {\n\t\t\tlistener, err := net.ListenUDP(\"udp\", uploaderAddr)\n\t\t\tcheckError(err)\n\t\t\tfmt.Printf(\"Listening udp....\\n\")\n\t\t\tcheckError(err)\n\t\t\tconnIO = listener\n\t\t}\n\t} else {\n\t\tstunUrl, err := ice.ParseURL(stun)\n\t\tcandidateSelectionTimeout := 30 * time.Second\n\t\tconnectionTimeout := 5 * time.Second\n\t\tconfig := &ice.AgentConfig{\n\t\t\tUrls: []*ice.URL{stunUrl},\n\t\t\tNetworkTypes: []ice.NetworkType{\n\t\t\t\tice.NetworkTypeUDP4,\n\t\t\t\tice.NetworkTypeTCP4,\n\t\t\t},\n\t\t\tCandidateTypes: []ice.CandidateType{\n\t\t\t\tice.CandidateTypeHost,\n\t\t\t\tice.CandidateTypeServerReflexive,\n\t\t\t\tice.CandidateTypePeerReflexive,\n\t\t\t\tice.CandidateTypeRelay,\n\t\t\t},\n\t\t\tCandidateSelectionTimeout: &candidateSelectionTimeout,\n\t\t\tConnectionTimeout: &connectionTimeout,\n\t\t}\n\n\t\tagent, err := ice.NewAgent(config)\n\t\tcheckError(err)\n\n\t\tdefer agent.Close()\n\n\t\terr = agent.OnConnectionStateChange(func(state ice.ConnectionState) {\n\t\t\tfmt.Printf(\"State Change: %s\\n\", state.String())\n\t\t\tif state == ice.ConnectionStateDisconnected {\n\t\t\t\tif connIO != nil {\n\t\t\t\t\terr := connIO.Close()\n\t\t\t\t\tcheckError(err)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\n\t\tmyCandidates, err := agent.GetLocalCandidates()\n\t\tmyIceCandidates, err := newICECandidatesFromICE(myCandidates)\n\t\tcheckError(err)\n\t\tuflag, pass := agent.GetLocalUserCredentials()\n\n\t\tpartnerData := exchange(ExchangeData{\n\t\t\tCandidates: myIceCandidates,\n\t\t\tUflag: uflag,\n\t\t\tPass: pass,\n\t\t})\n\n\t\tfor _, c := range partnerData.Candidates {\n\t\t\ti, err := c.toICE()\n\t\t\tcheckError(err)\n\n\t\t\terr = agent.AddRemoteCandidate(i)\n\t\t\tcheckError(err)\n\t\t}\n\n\t\tvar conn *ice.Conn\n\t\tif uploadingFile != \"\" {\n\t\t\tconn, err = agent.Accept(context.Background(), partnerData.Uflag, partnerData.Pass)\n\t\t} else {\n\t\t\tconn, err = agent.Dial(context.Background(), partnerData.Uflag, partnerData.Pass)\n\t\t}\n\t\tcheckError(err)\n\t\tdefer conn.Close()\n\n\t\tgo func() {\n\t\t\tif uploadingFile != \"\" {\n\t\t\t\tconn.Write([]byte(\"hello\"))\n\t\t\t} else {\n\t\t\t\tconn.Write([]byte(\"world\"))\n\t\t\t}\n\t\t}()\n\n\t\tbuffer := make([]byte, 32 * 1000)\n\t\tconn.Read(buffer)\n\t\tfmt.Printf(\"Receive msg: %s\\n\", string(buffer))\n\n\n\t\tif transport == \"sctp\" {\n\t\t\tvar association *sctp.Association\n\t\t\tconfig := sctp.Config{\n\t\t\t\tNetConn: conn,\n\t\t\t\tLoggerFactory: logging.NewDefaultLoggerFactory(),\n\t\t\t\tMaxReceiveBufferSize: 10 * 1024 * 1024,\n\t\t\t}\n\t\t\tif uploadingFile != \"\" {\n\t\t\t\tassociation, err = sctp.Client(config)\n\t\t\t} else {\n\t\t\t\tassociation, err = sctp.Server(config)\n\t\t\t}\n\t\t\tcheckError(err)\n\t\t\tdefer association.Close()\n\n\t\t\tvar stream *sctp.Stream\n\t\t\tif uploadingFile != \"\" {\n\t\t\t\tstream, err = association.OpenStream(777, sctp.PayloadTypeWebRTCBinary)\n\t\t\t} else {\n\t\t\t\tstream, err = association.AcceptStream()\n\t\t\t}\n\t\t\tcheckError(err)\n\n\t\t\tdefer stream.Close()\n\n\t\t\tconnIO = stream\n\t\t} else {\n\t\t\tconnIO = conn\n\t\t}\n\t}\n\n\tif uploadingFile != \"\" {\n\t\ttime.Sleep(2 * time.Second)\n\t\tfmt.Printf(\"Uploading....\\n\")\n\t} else {\n\t\tfmt.Printf(\"Downloading....\\n\")\n\t}\n\n\tif uploadingFile != \"\" {\n\t\tvar n int64\n\t\tvar err error\n\t\tif transport == \"ice\" || transport == \"sctp\" {\n\t\t\tn, err = io.CopyBuffer(connIO, f, make([]byte, 5 * 1200))\n\t\t\t//n = copy(connIO, f)\n\t\t} else {\n\t\t\tn, err = io.Copy(connIO, f)\n\t\t\t//n = copy(connIO, f)\n\t\t}\n\t\tcheckError(err)\n\n\t\tfmt.Printf(\"Success %v bytes sent!\\n\", n)\n\t\tconnIO.Close()\n\t} else {\n\t\tn, err := io.Copy(f, connIO)\n\t\tcheckError(err)\n\n\t\t//n := copy(f, connIO)\n\n\t\tfmt.Printf(\"Saved %v bytes!\\n\", n)\n\t\tconnIO.Close()\n\t}\n}", "func HandleRequest(ctx context.Context, event InputEvent) (Response, error) {\n\tqueueURL := aws.String(os.Getenv(\"SQS_URL\"))\n\tbucketName := aws.String(os.Getenv(\"BUCKET_NAME\"))\n\tawsSession := session.New()\n\tpollyClient := polly.New(awsSession)\n\ts3Uploader := s3manager.NewUploader(awsSession)\n\tsqsClinet := sqs.New(awsSession)\n\tid, err := uuid.NewV1()\n\tfailureResponse := Response{}\n\n\tif err != nil {\n\t\t// Error when creating audio file name\n\t\treturn failureResponse, err\n\t}\n\n\toutput, err := synthesizeVoice(pollyClient, &event.Text, &event.Voice)\n\n\tif err != nil {\n\t\t// Failed to synthesize audio file\n\t\treturn failureResponse, err\n\t}\n\n\t_, err = uploadToS3(s3Uploader, bucketName, aws.String(id.String() + \".mp3\"), &output)\n\n\tif err != nil {\n\t\t// Failed to upload audio to S3\n\t\treturn failureResponse, err\n\t}\n\n\t_, err = sqsClinet.SendMessage(&sqs.SendMessageInput{\n\t\tMessageBody: aws.String(id.String() + \".mp3\"),\n\t\tQueueUrl: queueURL,\n\t})\n\n\tif err != nil {\n\t\t// Failed to push message to audio file name to SQS\n\t\treturn failureResponse, err\n\t}\n\n\treturn Response{Success: true, FileName: id.String(), FileType: \"mp3\"}, nil\n}", "func CreateAudioFiles(player *AudioPlayer, strings []string) {\n\tspeech := htgotts.Speech{Folder: player.AudioFolder, Language: player.Language}\n\tfor _, str := range strings {\n\t\tspeech.Speak(str)\n\t}\n}", "func (f *File) Play() error {\n\t// initialize the underlying APIs for audio transmission\n\tportaudio.Initialize()\n\tdefer portaudio.Terminate()\n\n\t// create a buffer for audio to be put into\n\t// hardcode 16-bit sample until i figure out a better way to do this\n\tbufLen := int(BufSize * f.AudioData.NumChannels)\n\tbuf := make([]int16, bufLen)\n\n\t// create the audio stream to write to\n\tstream, err := portaudio.OpenDefaultStream(0, int(f.AudioData.NumChannels), float64(f.AudioData.SampleRate), BufSize, buf)\n\tif err != nil {\n\t\treturn errors.NewFromErrorCodeInfo(errors.AudioFileOutputStreamNotOpened, err.Error())\n\t}\n\tdefer stream.Close()\n\tdefer stream.Stop()\n\tstream.Start()\n\n\t// get audio data (without WAV header)\n\tdata := f.AudioData.AudioData()\n\tstep := bufLen * 2 // *2 since we need twice as many bytes to fill up `bufLen` in16s\n\n\tf.playing = true\n\tdefer func() { f.playing = false }()\n\n\tfor i := 0; i < len(data); i += step {\n\t\t// check if we should stop (user called f.Stop())\n\t\tif f.shouldStop {\n\t\t\tf.shouldStop = false\n\t\t\tbreak\n\t\t}\n\t\t// need to convert each 2-bytes in [i, i+step] to 1 little endian int16\n\t\tfor j := 0; j < bufLen; j++ {\n\t\t\tk := j * 2\n\t\t\tbuf[j] = int16(binary.LittleEndian.Uint16(data[i+k : i+k+2]))\n\t\t}\n\t\t// write the converted data into the stream\n\t\terr := stream.Write()\n\t\tif err != nil {\n\t\t\treturn errors.NewFromErrorCodeInfo(errors.AudioFileNotWritableStream, err.Error())\n\t\t}\n\t}\n\n\treturn nil\n}", "func startListen() {\n\tconfig, err := config.Config()\n\tif err != nil {\n\t\tlog.Log().Error.Println(err)\n\t\tpanic(err)\n\t}\n\tstorage, err := storage.Instance()\n\tif err != nil {\n\t\tlog.Log().Error.Println(err)\n\t}\n\tprefix := config.Prefix\n\tconverter := convert.NewConverter(config.CodeLength, storage)\n\tinternalPort := strconv.Itoa(config.Port)\n\tinternalAddress := \":\" + internalPort\n\tln, err := net.Listen(\"tcp\", internalAddress)\n\tif err != nil {\n\t\tlog.Log().Error.Println(err)\n\t\tpanic(err)\n\t}\n\tdefer ln.Close()\n\tfor {\n\t\tconn, err := ln.Accept()\n\t\tif err != nil {\n\t\t\tlog.Log().Error.Println(err)\n\t\t\treturn\n\t\t}\n\t\tgo handleConnection(conn, converter, prefix)\n\t}\n}", "func RunSound(path string) {\n\tf, err := os.Open(path)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\t// Create a new beep.Decoder\n\tstreamer, format, err := mp3.Decode(f)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\tdefer streamer.Close()\n\t// Create a new beep.Player\n\tspeaker.Init(format.SampleRate, format.SampleRate.N(time.Second/10))\n\n\tdone := make(chan bool)\n\t// Play the stream\n\tspeaker.Play(beep.Seq(streamer, beep.Callback(func() {\n\t\tdone <- true\n\t})))\n\n\t<-done\n}", "func (device *MicrophoneDevice) Start(handler RecordStreamHandler) error {\n\tdevice.WaitGroup.Add(1)\n\tgo device.startRecording(handler)\n\treturn nil\n}", "func startSerialPortRecording(spio *serialPortIO) {\n\t// // Create a new file name\n\t// t := time.Now()\n\t// filePath := *record + \"Raw_\" + t.Format(\"20060102150405\") + \".ens\"\n\t//\n\t// log.Printf(\"Creating file: %s\", filePath)\n\t//\n\t// // Create the file\n\t// file, err := os.Create(filePath)\n\tfile, err := createFile()\n\tif err != nil {\n\t\tlog.Print(\"Error creating file. \" + err.Error())\n\t\treturn\n\t}\n\n\t// Create bufio\n\tbufWriter := bufio.NewWriter(file)\n\n\tlog.Print(\"bufio writer created\")\n\n\t// Create recorder\n\tspio.recorder = &recorderSerialPort{\n\t\tfile: file, // File to write to\n\t\twriter: bufWriter, // bufio to write data to file\n\t\twrite: make(chan []byte), // Write data to recorder\n\t\tisClosing: false, // Set flag\n\t\tfileSize: 0, // Initialize the file size\n\t}\n\tlog.Print(\"recorder set to SPIO\")\n\n\tspio.isRecording = true\n\n\tlog.Print(\"Serial Port recorder started\")\n\tgo spio.recorder.run()\n}", "func main() {\n\t// Client allows to set additional client options\n\tc := &gortsplib.Client{\n\t\t// the stream protocol (UDP or TCP). If nil, it is chosen automatically\n\t\tProtocol: nil,\n\t\t// timeout of read operations\n\t\tReadTimeout: 10 * time.Second,\n\t\t// timeout of write operations\n\t\tWriteTimeout: 10 * time.Second,\n\t}\n\n\t// connect to the server and start reading all tracks\n\tconn, err := c.DialRead(\"rtsp://localhost:8554/mystream\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer conn.Close()\n\n\t// read RTP frames\n\terr = conn.ReadFrames(func(trackID int, streamType gortsplib.StreamType, payload []byte) {\n\t\tfmt.Printf(\"frame from track %d, type %v, size %d\\n\", trackID, streamType, len(payload))\n\t})\n\tpanic(err)\n}", "func (ap *App) LoadTranscription(fpth string) {\n\tseq := new(speech.Sequence)\n\tseq.File = fpth\n\tap.ConfigTableView(ap.SndsTable.View)\n\tap.GUI.Win.UpdateSig()\n\n\tfn := strings.TrimSuffix(seq.File, \".wav\")\n\tif ap.Corpus == \"TIMIT\" {\n\t\tfn := strings.Replace(fn, \"ExpWavs\", \"\", 1) // different directory for timing data\n\t\tfn = strings.Replace(fn, \".WAV\", \"\", 1)\n\t\tfnm := fn + \".PHN.MS\" // PHN is \"Phone\" and MS is milliseconds\n\t\tnames := []string{}\n\t\tvar err error\n\t\tseq.Units, err = timit.LoadTimes(fnm, names, false) // names can be empty for timit, LoadTimes loads names\n\t\tif err != nil {\n\t\t\tfmt.Println(\"LoadTranscription: transcription/timing data file not found.\")\n\t\t\tfmt.Println(\"Use the TimeMode option (a WParam) to analyze and view sections of the audio\")\n\t\t\tseq.Units = append(seq.Units, *new(speech.Unit))\n\t\t\tseq.Units[0].Name = \"unknown\" // name it with non-closure consonant (i.e. bcl -> b, gcl -> g)\n\t\t} else {\n\t\t\tfnm = fn + \".TXT\" // full text transcription\n\t\t\tseq.Text, err = timit.LoadText(fnm)\n\t\t}\n\t} else {\n\t\tfmt.Println(\"NextSound: ap.Corpus no match\")\n\t}\n\n\tap.Sequence = append(ap.Sequence, *seq)\n\tif seq.Units == nil {\n\t\tfmt.Println(\"AdjSeqTimes: SpeechSeq.Units is nil. Some problem with loading file transcription and timing data\")\n\t\treturn\n\t}\n\tap.AdjSeqTimes(seq)\n\n\t// todo: this works for timit - but need a more general solution\n\t//seq.TimeCur = seq.Units[0].AStart\n\tn := len(seq.Units) // find last unit\n\t//if seq.Units[n-1].Name == \"h#\" {\n\t//\tseq.Stop = seq.Units[n-1].AStart\n\t//} else {\n\t//\tfmt.Println(\"last unit of speech sequence not silence\")\n\t//}\n\n\tcurRows := ap.SndsTable.Table.Rows\n\tap.SndsTable.Table.AddRows(len(seq.Units))\n\tfpth, nm := path.Split(fn)\n\ti := strings.LastIndex(nm, \".\")\n\tif i > 0 {\n\t\tnm = nm[0:i]\n\t}\n\n\tfpth = strings.TrimSuffix(fpth, \"/\")\n\tsplits := strings.Split(fpth, \"/\")\n\tn = len(splits)\n\tif n >= 2 {\n\t\tfpth = splits[n-2] + \"/\" + splits[n-1]\n\t} else if n >= 1 {\n\t\tfpth = splits[n-1]\n\t}\n\n\tfor r, s := range seq.Units {\n\t\tr = r + curRows\n\t\tap.SndsTable.Table.SetCellString(\"Sound\", r, s.Name)\n\t\tap.SndsTable.Table.SetCellFloat(\"Start\", r, s.AStart)\n\t\tap.SndsTable.Table.SetCellFloat(\"End\", r, s.AEnd)\n\t\tap.SndsTable.Table.SetCellFloat(\"Duration\", r, s.AEnd-s.AStart)\n\t\tap.SndsTable.Table.SetCellString(\"File\", r, nm)\n\t\tap.SndsTable.Table.SetCellString(\"Dir\", r, fpth)\n\t}\n\tap.SndsTable.View.UpdateTable()\n\tap.GUI.Active = true\n\tap.GUI.UpdateWindow()\n\n\treturn\n}", "func StartListen(request *restful.Request, response *restful.Response) {\n\tportstring := request.PathParameter(\"port-id\")\n\tglog.Info(\"get the port number\", portstring)\n\tportint, err := strconv.Atoi(portstring)\n\tif err != nil {\n\t\tresponse.WriteError(500, err)\n\t\treturn\n\t}\n\tpid, pname, err := lib.Getinfofromport(portint)\n\n\tif pid == -1 {\n\t\tresponse.WriteError(500, errors.New(\"the port is not be listend in this machine ( /proc/net/tcp and /proc/net/tcp6)\"))\n\t\treturn\n\t}\n\n\tif err != nil {\n\t\tresponse.WriteError(500, err)\n\t\treturn\n\n\t}\n\tglog.Info(pname, pid)\n\n\t//create the process instance and get the detail info of specified pid\n\tPdetail := &model.ProcessDetail{\n\t\tProcess: &process.Process{Pid: 22637},\n\t}\n\tcmd, err := Pdetail.Cmdinfo()\n\tif err != nil {\n\t\tglog.Info(err)\n\t}\n\tglog.Info(cmd)\n\t//TODO get more info of this instance\n\n\t//start listen to specific ip:port for 60s and send the data to es\n\ttimesignal := time.After(time.Second * 30)\n\n\t//start collect and check the timesignal every one minutes\n\tgo lib.Startcollect(portint, device, timesignal)\n\n\tresponse.Write([]byte(\"activated\"))\n\n}", "func (c *client) listen() {\n\tc.hub.register <- c\n\n\tgo c.listenWrite()\n\tgo c.listenRead()\n}", "func (c *Client) SpeechToText(bs []byte) (result ResponseSpeechToText, err error) {\n\tvar req *http.Request\n\tif req, err = http.NewRequest(\"POST\", APINewtoneURL+\"/v1/recognize\", bytes.NewBuffer(bs)); err == nil {\n\t\t// set HTTP headers\n\t\treq.Header.Set(\"Content-Type\", \"application/octet-stream\")\n\t\treq.Header.Set(\"Transfer-Encoding\", \"chunked\")\n\t\treq.Header.Set(\"Authorization\", c.authHeader(authTypeKakaoAK)) // set auth header\n\n\t\tvar resp *http.Response\n\t\tresp, err = c.httpClient.Do(req)\n\n\t\tif resp != nil {\n\t\t\tdefer resp.Body.Close()\n\t\t}\n\t\tif err == nil {\n\t\t\tif resp.StatusCode == 200 {\n\t\t\t\tif resp.Header.Get(\"Content-Type\") == \"multipart/form-data\" {\n\t\t\t\t\tvar reader *multipart.Reader\n\t\t\t\t\tif reader, err = resp.Request.MultipartReader(); err == nil {\n\t\t\t\t\t\tfor {\n\t\t\t\t\t\t\tpart, pErr := reader.NextPart()\n\t\t\t\t\t\t\tif pErr == io.EOF { // no more parts\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tvar bs []byte\n\t\t\t\t\t\t\tif _, err = part.Read(bs); err == nil {\n\t\t\t\t\t\t\t\terr = json.Unmarshal(bs, &result)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif err == nil {\n\t\t\t\t\t\t\tif result.Type == \"finalResult\" { // final result\n\t\t\t\t\t\t\t\treturn result, nil\n\t\t\t\t\t\t\t} else if result.Type == \"errorCalled\" { // on error\n\t\t\t\t\t\t\t\treturn result, fmt.Errorf(result.Value)\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\terr = fmt.Errorf(\"did not receive final result\")\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t/*\n\t\t\t\t\t\t* 서버에서 잘못된 응답이 내려옴 (multipart/form-data가 아님):\n\n\t\t\t\t\t\t------newtoneFeldpXiEUcgOlZIe\n\t\t\t\t\t\tContent-Type: application/json; charset=UTF-8\n\n\t\t\t\t\t\t{\"type\":\"beginPointDetection\",\"value\":\"BPD\"}\n\t\t\t\t\t\t------newtoneFeldpXiEUcgOlZIe\n\t\t\t\t\t\tContent-Type: application/json; charset=UTF-8\n\n\t\t\t\t\t\t{\"type\":\"partialResult\",\"value\":\"헤이\"}\n\t\t\t\t\t\t------newtoneFeldpXiEUcgOlZIe\n\t\t\t\t\t\tContent-Type: application/json; charset=UTF-8\n\n\t\t\t\t\t\t{\"type\":\"partialResult\",\"value\":\"헤이 카카오\"}\n\t\t\t\t\t\t------newtoneFeldpXiEUcgOlZIe\n\t\t\t\t\t\tContent-Type: application/json; charset=UTF-8\n\n\t\t\t\t\t\t{\"type\":\"endPointDetection\",\"value\":\"EPD\"}\n\t\t\t\t\t\t------newtoneFeldpXiEUcgOlZIe\n\t\t\t\t\t\tContent-Type: application/json; charset=UTF-8\n\t\t\t\t\t\tSpeech-Length: 6\n\n\t\t\t\t\t\t{\"type\":\"finalResult\",\"value\":\"헤이 카카오\",\"nBest\":[{\"value\":\"헤이 카카오\",\"score\":24}]}\n\t\t\t\t\t\t------newtoneFeldpXiEUcgOlZIe--\n\t\t\t\t\t*/\n\t\t\t\t\tvar body []byte\n\t\t\t\t\tif body, err = ioutil.ReadAll(resp.Body); err == nil {\n\t\t\t\t\t\t// XXX - parse it manually...\n\t\t\t\t\t\tlines := strings.Split(string(body), \"\\n\")\n\t\t\t\t\t\tboundary := strings.TrimSpace(lines[0])\n\n\t\t\t\t\t\tfor _, line := range lines {\n\t\t\t\t\t\t\tline = strings.TrimSpace(line)\n\n\t\t\t\t\t\t\t// skip unneeded lines\n\t\t\t\t\t\t\tif strings.HasPrefix(line, boundary) ||\n\t\t\t\t\t\t\t\tstrings.HasPrefix(line, \"Content-Type\") ||\n\t\t\t\t\t\t\t\tstrings.HasPrefix(line, \"Speech-Length\") ||\n\t\t\t\t\t\t\t\tlen(line) <= 0 {\n\t\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\terr = json.Unmarshal([]byte(line), &result)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif err == nil {\n\t\t\t\t\t\t\tif result.Type == \"finalResult\" { // final result\n\t\t\t\t\t\t\t\treturn result, nil\n\t\t\t\t\t\t\t} else if result.Type == \"errorCalled\" { // on error\n\t\t\t\t\t\t\t\treturn result, fmt.Errorf(result.Value)\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\terr = fmt.Errorf(\"did not receive final result\")\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlog.Printf(\"response is not multipart/forma-data:\\n%s\", string(body))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\terr = fmt.Errorf(\"HTTP status %d\", resp.StatusCode)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn ResponseSpeechToText{}, err\n}", "func (a *AudioIO) Record(done chan struct{}) (<-chan []int32, error) {\n\trecBuff := a.BuffPool.Get().([]int32)\n\t// initialize portaudio and create audio stream\n\tportaudio.Initialize()\n\tstream, err := portaudio.OpenDefaultStream(1, 0, float64(a.sampleRate), buffSize, &recBuff)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"stream init fail: %s\", err.Error())\n\t}\n\tif err := stream.Start(); err != nil {\n\t\treturn nil, fmt.Errorf(\"stream start err: %s\", err.Error())\n\t}\n\t// start routine to read audio data in buffers from the audio stream and serve\n\t// them over `recordStream`\n\trecordStream := make(chan []int32)\n\tgo func() {\n\t\tdefer portaudio.Terminate()\n\t\tdefer stream.Close()\n\t\tdefer stream.Stop()\n\n\t\tvar next []int32 // the next recorded chunks\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-done:\n\t\t\t\tstream.Stop()\n\t\t\t\tclose(recordStream)\n\t\t\t\treturn\n\t\t\tdefault:\n\t\t\t\tstream.Read()\n\t\t\t\tnext = a.BuffPool.Get().([]int32)\n\t\t\t\tcopy(next, recBuff)\n\t\t\t\trecordStream <- next\n\t\t\t}\n\t\t}\n\t}()\n\treturn recordStream, nil\n}", "func (s *GreeterServer) SayRecord(stream pb.Greeter_SayRecordServer) error {\n\tfor {\n\t\tresp, err := stream.Recv()\n\t\tif err == io.EOF {\n\t\t\treturn stream.SendAndClose(&pb.HelloReply{Message: \"client side streaming rpc over\"})\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlog.Printf(\"resp: %v\", resp)\n\t}\n\treturn nil\n}", "func (t *AudioDoppler) Start(a *app.App) {\n\n\t// Create axes helper\n\taxes := helper.NewAxes(1)\n\ta.Scene().Add(axes)\n\n\t// Show grid helper\n\tgrid := helper.NewGrid(100, 1, &math32.Color{0.4, 0.4, 0.4})\n\ta.Scene().Add(grid)\n\n\t// Sets camera position\n\ta.Camera().SetPosition(0, 4, 12)\n\tpos := a.Camera().Position()\n\ta.Camera().UpdateSize(pos.Length())\n\ta.Camera().LookAt(&math32.Vector3{0, 0, 0}, &math32.Vector3{0, 1, 0})\n\n\t// Creates listener and adds it to the current camera\n\tlistener := audio.NewListener()\n\ta.Camera().Add(listener)\n\n\t// Creates player sphere\n\tt.ps1 = NewPlayerSphere(a, \"engine.ogg\", &math32.Color{1, 0, 0})\n\tt.ps1.SetPosition(-3, 0, 50)\n\tt.ps1.speed = -20.00\n\tt.ps1.player.SetRolloffFactor(1)\n\ta.Scene().Add(t.ps1)\n\n\tt.ps2 = NewPlayerSphere(a, \"tone_1khz.wav\", &math32.Color{0, 1, 0})\n\tt.ps2.SetPosition(-2, 0, 50)\n\tt.ps2.speed = -25.00\n\ta.Scene().Add(t.ps2)\n\n\tt.ps3 = NewPlayerSphere(a, \"tone_2khz.wav\", &math32.Color{0, 0, 1})\n\tt.ps3.SetPosition(-1, 0, 50)\n\tt.ps3.speed = -30.00\n\ta.Scene().Add(t.ps3)\n\n\tt.ps4 = NewPlayerSphere(a, \"engine.ogg\", &math32.Color{0, 1, 1})\n\tt.ps4.SetPosition(1, 0, -50)\n\tt.ps4.speed = 20.00\n\ta.Scene().Add(t.ps4)\n\n\tt.ps5 = NewPlayerSphere(a, \"tone_1khz.wav\", &math32.Color{1, 0, 1})\n\tt.ps5.SetPosition(2, 0, -50)\n\tt.ps5.speed = 25.00\n\ta.Scene().Add(t.ps5)\n\n\tt.ps6 = NewPlayerSphere(a, \"tone_2khz.wav\", &math32.Color{1, 1, 1})\n\tt.ps6.SetPosition(2, 0, -50)\n\tt.ps6.speed = 30.00\n\ta.Scene().Add(t.ps6)\n\n\t// Add controls\n\tif a.ControlFolder() == nil {\n\t\treturn\n\t}\n\tg := a.ControlFolder().AddGroup(\"Play sources\")\n\tcb1 := g.AddCheckBox(\"engine -Z\").SetValue(true)\n\tcb1.Subscribe(gui.OnChange, func(evname string, ev interface{}) {\n\t\tt.ps1.Toggle()\n\t})\n\tcb2 := g.AddCheckBox(\"tone_1khz -Z\").SetValue(true)\n\tcb2.Subscribe(gui.OnChange, func(evname string, ev interface{}) {\n\t\tt.ps2.Toggle()\n\t})\n\tcb3 := g.AddCheckBox(\"tone_2khz -Z\").SetValue(true)\n\tcb3.Subscribe(gui.OnChange, func(evname string, ev interface{}) {\n\t\tt.ps3.Toggle()\n\t})\n\tcb4 := g.AddCheckBox(\"engine +Z\").SetValue(true)\n\tcb4.Subscribe(gui.OnChange, func(evname string, ev interface{}) {\n\t\tt.ps4.Toggle()\n\t})\n\tcb5 := g.AddCheckBox(\"tone_1khz +Z\").SetValue(true)\n\tcb5.Subscribe(gui.OnChange, func(evname string, ev interface{}) {\n\t\tt.ps5.Toggle()\n\t})\n\tcb6 := g.AddCheckBox(\"tone_2khz +Z\").SetValue(true)\n\tcb6.Subscribe(gui.OnChange, func(evname string, ev interface{}) {\n\t\tt.ps6.Toggle()\n\t})\n}", "func rtpToTrack(track *webrtc.TrackLocalStaticSample, depacketizer rtp.Depacketizer, sampleRate uint32, port int) {\n\t// Open a UDP Listener for RTP Packets on port 5004\n\tlistener, err := net.ListenUDP(\"udp\", &net.UDPAddr{IP: net.ParseIP(CHANGEME), Port: port})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer func() {\n\t\tif err = listener.Close(); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}()\n\n\tsampleBuffer := samplebuilder.New(10, depacketizer, sampleRate)\n\n\t// Read RTP packets forever and send them to the WebRTC Client\n\tfor {\n\t\tinboundRTPPacket := make([]byte, 1500) // UDP MTU\n\t\tpacket := &rtp.Packet{}\n\n\t\tn, _, err := listener.ReadFrom(inboundRTPPacket)\n\t\tif err != nil {\n\t\t\tpanic(fmt.Sprintf(\"error during read: %s\", err))\n\t\t}\n\n\t\tif err = packet.Unmarshal(inboundRTPPacket[:n]); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tsampleBuffer.Push(packet)\n\t\tfor {\n\t\t\tsample := sampleBuffer.Pop()\n\t\t\tif sample == nil {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tif writeErr := track.WriteSample(*sample); writeErr != nil {\n\t\t\t\tpanic(writeErr)\n\t\t\t}\n\t\t}\n\t}\n}", "func (bird Bird) Speak() {\n\tfmt.Println(bird.sound)\n}", "func (player *musicPlayer) playSingleFile(filename string, trim float64, ch chan error) error {\n\t// Open the input file (with default parameters)\n\tin := sox.OpenRead(filename)\n\tif in == nil {\n\t\terr := errors.New(no_sox_in_msg)\n\t\tif ch != nil {\n\t\t\tch <- err\n\t\t}\n\t\treturn err\n\t}\n\tdefer in.Release()\n\n\t// Open the output device: Specify the output signal characteristics.\n\t// Since we are using only simple effects, they are the same as the\n\t// input file characteristics.\n\t// Using \"alsa\" or \"pulseaudio\" should work for most files on Linux.\n\t// \"coreaudio\" for OSX\n\t// On other systems, other devices have to be used.\n\tout := sox.OpenWrite(\"default\", in.Signal(), nil, \"alsa\")\n\tif out == nil {\n\t\tout = sox.OpenWrite(\"default\", in.Signal(), nil, \"pulseaudio\")\n\t\tif out == nil {\n\t\t\tout = sox.OpenWrite(\"default\", in.Signal(), nil, \"coreaudio\")\n\t\t\tif out == nil {\n\t\t\t\tout = sox.OpenWrite(\"default\", in.Signal(), nil, \"waveaudio\")\n\t\t\t\tif out == nil {\n\t\t\t\t\terr := errors.New(no_sox_out_msg)\n\t\t\t\t\tif ch != nil {\n\t\t\t\t\t\tch <- err\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\t// It's observed that sox crashes at this step sometimes\n\tdefer out.Release()\n\n\tif ch != nil {\n\t\tch <- nil\n\t}\n\n\t// Create an effects chain: Some effects need to know about the\n\t// input or output encoding so we provide that information here.\n\tchain := sox.CreateEffectsChain(in.Encoding(), out.Encoding())\n\tdefer chain.Release()\n\n\t// The first effect in the effect chain must be something that can\n\t// source samples; in this case, we use the built-in handler that\n\t// inputs data from an audio file.\n\te := sox.CreateEffect(sox.FindEffect(\"input\"))\n\te.Options(in)\n\t// This becomes the first \"effect\" in the chain\n\tchain.Add(e, in.Signal(), in.Signal())\n\te.Release()\n\n\tif trim > 0 {\n\t\tinterm_signal := in.Signal().Copy()\n\n\t\te = sox.CreateEffect(sox.FindEffect(\"trim\"))\n\t\te.Options(strconv.FormatFloat(trim, 'f', 2, 64))\n\t\tchain.Add(e, interm_signal, in.Signal())\n\t\te.Release()\n\t}\n\n\t// The last effect in the effect chain must be something that only consumes\n\t// samples; in this case, we use the built-in handler that outputs data.\n\te = sox.CreateEffect(sox.FindEffect(\"output\"))\n\te.Options(out)\n\tchain.Add(e, in.Signal(), in.Signal())\n\te.Release()\n\n\tplayer.Lock()\n\tplayer.state.chain = chain\n\tplayer.state.status = playing\n\tplayer.state.startTime = time.Now()\n\tif trim > 0 {\n\t\tvar milis int64 = int64(-trim * 1000)\n\t\tplayer.state.startTime = player.state.startTime.Add(time.Duration(milis) * time.Millisecond)\n\t}\n\tplayer.Unlock()\n\n\t// Flow samples through the effects processing chain until EOF is reached.\n\t// Flow process is not locked as it must be possible to delete chain effects\n\t// while Flow is being executed\n\t// note: sox crashes at this step sometimes(rarely)\n\tchain.Flow()\n\n\tplayer.Lock()\n\tif player.state.status == playing {\n\t\tplayer.state.status = waiting\n\t}\n\tplayer.Unlock()\n\n\treturn nil\n}", "func main() {\n\ttime.Sleep(50 * time.Second)\n\tconfig := configs.NewConfig()\n\t//_, err := toml.DecodeFile(configPath, config)\n\t//if err != nil {\n\t//\tlogrus.Error(err)\n\t//}\n\n\tmusicDBCon, err := utility.CreatePostgresConnection(config.MusicPostgresBD)\n\tif err != nil {\n\t\tlogrus.Error(err)\n\t}\n\tmusicianskRep := musiciansRepository.NewMusicRepository(musicDBCon)\n\tmusUsecase := musicianUsecase.NewMusicsUsecase(musicianskRep)\n\n\ttracDBCon, err := utility.CreatePostgresConnection(config.MusicPostgresBD)\n\tif err != nil {\n\t\tlogrus.Error(err)\n\t}\n\ttrackRep := trackRepository.NewTracksRepository(tracDBCon)\n\n\ttrackUse := trackUsecase.NewTracksUsecase(trackRep)\n\n\talbumDBCon, err := utility.CreatePostgresConnection(config.MusicPostgresBD)\n\tif err != nil {\n\t\tlogrus.Error(err)\n\t}\n\talbumRep := albumRepository.NewAlbumsRepository(albumDBCon)\n\n\talbumsUse := albumUsecase.NewAlbumcUsecase(albumRep)\n\tplaylistDBCon, err := utility.CreatePostgresConnection(config.MusicPostgresBD)\n\tif err != nil {\n\t\tlogrus.Error(err)\n\t}\n\tplaylistRep := playlistRepository.NewPlaylistRepository(playlistDBCon)\n\tplaylistUse := playlistUsecase.NewPlaylistUsecase(playlistRep)\n\n\tsearhUse := searchUsecase.NewSearchUsecase(trackRep, albumRep, musicianskRep, playlistRep)\n\thandler := musicHttp.NewFinalHandler(config, trackUse, musUsecase,\n\t\talbumsUse, playlistUse, searhUse)\n\tfmt.Println(\"Нормально запустились\")\n\terr = server.Start(config, handler)\n\tif err != nil {\n\t\tfmt.Println(\"fail start server\")\n\t}\n\tfmt.Println(\"Закончили работу\")\n}", "func StartListen(request *restful.Request, response *restful.Response) {\n\tportstring := request.PathParameter(\"port-id\")\n\tglog.Info(\"get the port number\", portstring)\n\tportint, err := strconv.Atoi(portstring)\n\tif err != nil {\n\t\tresponse.WriteError(500, err)\n\t\treturn\n\t}\n\tpid, _, err := lib.Getinfofromport(portint)\n\n\tif pid == -1 {\n\t\tresponse.WriteError(500, errors.New(\"the port is not be listend in this machine ( /proc/net/tcp and /proc/net/tcp6)\"))\n\t\treturn\n\t}\n\tif err != nil {\n\t\tresponse.WriteError(500, err)\n\t\treturn\n\t}\n\t//start listen to specific ip:port for 60s and send the data to es\n\ttimesignal := time.After(time.Second * Defaulttime)\n\t//start collect and check the timesignal every one minutes\n\tif !lib.Activeflag {\n\t\tgo lib.Startcollect(portint, Device, timesignal)\n\t\tlib.Flagmutex.Lock()\n\t\tlib.Activeflag = true\n\t\tresponse.Write([]byte(\"activated\"))\n\t\tlib.Flagmutex.Unlock()\n\t} else {\n\t\tresponse.Write([]byte(\"the server is already been activatied\"))\n\t}\n}", "func ripSound(ripCmd ripCommand) error {\n\tvideoBuf, err := fetchVideoData(ripCmd.url)\n\tif err != nil {\n\t\treturn err\n\t}\n\topusFrames, err := convertToOpusFrames(videoBuf, ripCmd.start, ripCmd.duration)\n\tif err != nil {\n\t\treturn err\n\t}\n\tencodedFrames, err := gobEncodeOpusFrames(opusFrames)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif s3Persistence == \"true\" {\n\t\terr = putSoundS3(encodedFrames, ripCmd.name)\n\t} else {\n\t\terr = putSoundLocal(encodedFrames, ripCmd.name)\n\t}\n\treturn err\n}", "func startServer(addr string) error {\n\t// Accept a connection from a QUIC client\n\tlistener, err := quic.ListenAddr(addr, generateTLSConfig(), config)\n\tif err != nil {\n\t\treturn err\n\t}\n\tsession, err := listener.Accept(context.Background())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ti := 0\n\tfor {\n\t\t// Accept an incomingstream\n\t\tstream, err := session.AcceptStream(context.Background())\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t\n\t\t// Network buffer\n\t\tstride := 1024\n\t\tbuf := make([]byte, stride)\n\n\t\t// Create the file to write to\n\t\tfn := \"pic\" + strconv.Itoa(i) + \".jpg\"\n\t\tfmt.Println(fn, \"DONE\")\n\t\tf, err := os.Create(fn)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error opening file: \", err)\n\t\t\tpanic(err)//return err\n\t\t}\n\n\t\t// Setup Writer\n\t\tw := bufio.NewWriter(f)\n\n\t\t// Read until end of data stream\n\t\tvar n int\n\t\tfor {\n\t\t\tn, err = io.ReadAtLeast(stream, buf, 1)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"ERROR READING DATA: \", err)\n\t\t\t}\n\t\t\tfmt.Println(\"Read bytes: \", n)\n\t\t\tw.Write(buf)\n\t\t\t\n\t\t\tif n < stride {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\t\n\t\t// Cleanup file\n\t\tw.Flush()\n\t\tf.Close()\n\n\t\t// Create a thread that runs the object detection program and reports\n\t\t// the result of execution back to the end-device\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\terr = runObjDetectApp(fn, session)\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t\twg.Done()\n\t\t}()\n\n\t\tstream.Close()\n\t\ti++\n\t}\n\n\treturn err\n}", "func listen(address string) error {\n\taddr, err := net.ResolveUDPAddr(`udp`, address)\n\tif err != nil {\n\t\treturn err\n\t}\n\tconn, err := net.ListenUDP(`udp`, addr)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\tif err = conn.Close(); err != nil {\n\t\t\tlog.WithField(`error`, err).Warn(`Failed closing Hyperion listener`)\n\t\t}\n\t}()\n\n\treturn handleUDP(conn)\n}", "func (w Wrapper) OnUsersRecordingAudioMessage(f UsersRecordingAudioMessageHandler) {\n\tw.longpoll.EventNew(64, func(i []interface{}) error {\n\t\tvar event UsersRecordingAudioMessage\n\t\tif err := event.parse(i); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tf(event)\n\n\t\treturn nil\n\t})\n}", "func New(ctx context.Context, kb *input.KeyboardEventWriter, tconn *chrome.TestConn, a *arc.ARC) (*VoiceRecorder, error) {\n\tapp, err := apputil.NewApp(ctx, kb, tconn, a, \"Voice Recorder\", pkgName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &VoiceRecorder{app: app}, nil\n}", "func saveToStorage(r io.Reader, phone string) error {\n\t// theoretically we could have a risk of overwriting data here, multiple\n\t// calls from the same number at the same time, but low risk and\n\t// since this is not a production system...\n\tid := generateID(phone)\n\tname := id + \"_\" + strconv.FormatInt(time.Now().UnixNano(), 10) + \".wav\"\n\terr := globalStorage.Store(name, r)\n\treturn errgo.Mask(err)\n}", "func main() {\n\tvar h bool\n\tflag.BoolVar(&h,\"h\",false,\"this help\")\n\tvar port = flag.String(\"port\",\"8888\",\"input save port\")\n\tvar path = flag.String(\"path\",\"/tmp\",\"input save path\")\n\tflag.Usage = usage\n\tflag.Parse()\n\tif h{\n\t\tflag.Usage()\n\t\tos.Exit(1)\n\t}\n\tpath_dir := *path\n\tif path_dir[len(*path)-1:] != \"/\"{\n\t\tpath_dir = path_dir+\"/\"\n\t}\n\tlistener, err := net.Listen(\"tcp\", \"0.0.0.0:\"+*port)\n\tif err != nil {\n\t\tfmt.Println(\"error listening:\", err.Error())\n\t\tos.Exit(1)\n\t}\n\tdefer listener.Close()\n\n\tfmt.Printf(\"running ...\\n\")\n\n\tconn_chan := make(chan net.Conn)\n\n\tfor i := 0; i < MAX_CONN_NUM; i++ {\n\t\tgo func() {\n\t\t\tfor conn := range conn_chan {\n\t\t\t\tRecvFile(path_dir,conn)\n\t\t\t}\n\t\t}()\n\t}\n\n\tfor {\n\t\tconn, err := listener.Accept()\n\t\tif err != nil {\n\t\t\tprintln(\"Error accept:\", err.Error())\n\t\t\treturn\n\t\t}\n\t\tconn_chan <- conn\n\t}\n}", "func Speech(text string) {\n\t// Run the speech command\n\tcmd := exec.Command(\"Powershell.exe\", \"/Command\", \"Add-Type -AssemblyName\", \"System.speech;\", \"$speak = New-Object\", \"System.Speech.Synthesis.SpeechSynthesizer;\", \"$speak.Speak('\", text, \"')\")\n\tif err := cmd.Run(); err != nil {\n\t\tfmt.Println(err)\n\t}\n}", "func flac2wav(in os.File, n Namer) (os.File, error) {\n\tout := n(in)\n\tcmd := exec.Command(\"flac\",\n\t\t\"-f\", // overwrite any existing file\n\t\t\"--silent\",\t// output is useless because we are multiplexing goroutines\n\t\t\"-d\", in.Name(), // decode file (input)\n\t\t\"-o\", out.Name()) // output file\n\tcmd.Stderr = os.Stderr\n\tcmd.Stdout = os.Stdout\n\terr := cmd.Run()\n\treturn out, err\n}", "func StartRecordingPOST(w http.ResponseWriter, r *http.Request) {\n}", "func (a *attachUp) AddAudio(p, n string) AttachmentUploader {\n\ta.a = append(a.a, p)\n\tif n == \"\" {\n\t\tn = filepath.Base(p)\n\t}\n\ta.an = append(a.an, n)\n\treturn a\n}", "func CreateAudioPlayer(filename string) *AudioPlayer {\n\taudioPlayerCh := make(chan *AudioPlayer)\n\tsoundCh <- apCreateRequest{filename, audioPlayerCh}\n\treturn <-audioPlayerCh\n}", "func main() {\n\tfProtocalFactory := frugal.NewFProtocolFactory(thrift.NewTBinaryProtocolFactoryDefault())\n\n\t// Send write heartbeats but don't expect heartbeats back due to an\n\t// activemq stomp heartbeat bug\n\tconn, err := stomp.Dial(\"tcp\", \"localhost:61613\", stomp.ConnOpt.HeartBeat(time.Minute, 0))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer conn.Disconnect()\n\n\tsubFactory := frugal.NewFStompSubscriberTransportFactoryBuilder(conn).Build()\n\tprovider := frugal.NewFScopeProvider(nil, subFactory, fProtocalFactory)\n\tsubscriber := music.NewAlbumWinnersSubscriber(provider)\n\n\t// Subscribe to messages\n\tvar wg sync.WaitGroup\n\twg.Add(2)\n\n\tsubscriber.SubscribeWinner(func(ctx frugal.FContext, m *music.Album) {\n\t\tfmt.Printf(\"received %+v : %+v\\n\", ctx, m)\n\t\twg.Done()\n\t})\n\tsubscriber.SubscribeContestStart(func(ctx frugal.FContext, albums []*music.Album) {\n\t\tfmt.Printf(\"received %+v : %+v\\n\", ctx, albums)\n\t\twg.Done()\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Println(\"Subscriber started...\")\n\twg.Wait()\n}", "func listen(buf []byte) error {\n\tn, addr, err := socket.ReadFromUDP(buf)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif n > 0 {\n\t\thandle(buf[0:n], addr)\n\t}\n\n\treturn nil\n}", "func (c *Client) playRaw(bytes []byte) {\n\t// Decode and adjust audio\n\tvolume := MaxVolume - c.Volume()\n\tsamples := make([]int16, len(bytes)/2)\n\tfor i := range samples {\n\t\tsamples[i] = int16(binary.LittleEndian.Uint16(bytes[i*2:i*2+2])) >> volume\n\t}\n\n\t// Play the audio\n\tc.Mumble.SendAudio(samples)\n}", "func (tg *TradesGroup) listen() {\n\tgo func() {\n\t\tfor msg := range tg.bus.dch {\n\t\t\ttg.parseMessage(msg)\n\t\t}\n\t}()\n\tgo func() {\n\t\tfor err := range tg.bus.ech {\n\t\t\tlog.Printf(\"[BITFINEX] Error listen: %+v\", err)\n\t\t\ttg.restart()\n\t\t\treturn\n\t\t}\n\t}()\n}", "func (c *MhistConnector) Listen() {\n\tfor {\n\t\tmessage, err := c.subscriptionStream.Recv()\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Failed to receive message: %v\", err)\n\t\t}\n\t\tgo c.broker.HandleMeasurementMessage(message)\n\t}\n}", "func (cow Cow) Speak() {\n\tfmt.Println(cow.sound)\n}", "func New() *AudioLog { return &AudioLog{} }", "func (a *Ability) storeSamples(text string, samples []int32, sampleRate, significantBits int) (id string, err error) {\n\t// Create id\n\tid = filepath.Join(time.Now().Format(\"2006-01-02\"), xid.New().String())\n\n\t// Store samples wav\n\tif err = a.storeSamplesWav(id, samples, sampleRate, significantBits); err != nil {\n\t\terr = errors.Wrap(err, \"astiunderstanding: storing samples wav failed\")\n\t\treturn\n\t}\n\n\t// Store samples txt\n\tif err = a.storeSamplesTxt(id, text); err != nil {\n\t\terr = errors.Wrap(err, \"astiunderstanding: storing samples txt failed\")\n\t\treturn\n\t}\n\treturn\n}", "func (a *Ability) storeSamplesWav(id string, samples []int32, sampleRate, significantBits int) (err error) {\n\t// Create wav path\n\twavPath := filepath.Join(samplesToBeValidatedDirectory(a.c.SamplesDirectory), id+\".wav\")\n\n\t// Create dir\n\tif err = os.MkdirAll(filepath.Dir(wavPath), 0755); err != nil {\n\t\terr = errors.Wrapf(err, \"astiunderstanding: mkdirall %s failed\", filepath.Dir(wavPath))\n\t\treturn\n\t}\n\n\t// Create wav file\n\tvar f *os.File\n\tif f, err = os.Create(wavPath); err != nil {\n\t\terr = errors.Wrapf(err, \"astiunderstanding: creating %s failed\", wavPath)\n\t\treturn\n\t}\n\tdefer f.Close()\n\n\t// Create wav writer\n\twf := wav.File{\n\t\tChannels: 1,\n\t\tSampleRate: uint32(sampleRate),\n\t\tSignificantBits: uint16(significantBits),\n\t}\n\tvar r *wav.Writer\n\tif r, err = wf.NewWriter(f); err != nil {\n\t\terr = errors.Wrap(err, \"astiunderstanding: creating wav writer failed\")\n\t\treturn\n\t}\n\tdefer r.Close()\n\n\t// Write wav samples\n\tfor _, sample := range samples {\n\t\tif err = r.WriteInt32(sample); err != nil {\n\t\t\terr = errors.Wrap(err, \"astiunderstanding: writing wav sample failed\")\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}", "func main() {\n\t// Check if custom file is required\n\tfileToSave := flag.String(\"f\", \"\", \"Custom log file\")\n\tflag.Parse()\n\n\t// If not create a temp file\n\tif len(*fileToSave) == 0 {\n\t\tos.Chdir(\"/tmp\")\n\t\tf, err := os.Create(\"log_konsoole.txt\")\n\t\tif err != nil || f == nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tfileToOpen = \"log_konsoole.txt\"\n\t\tdefer os.Remove(\"log_konsoole.txt\")\n\t} else {\n\t\t// If yes, use it as log file\n\t\tfileToOpen = *fileToSave\n\t}\n\n\tfmt.Println(\"Konsoole: HTTP Monitor\")\n\n\toutWriter = bufio.NewWriter(os.Stdout)\n\terrWriter = bufio.NewWriter(os.Stderr)\n\t// Initialize the network intefaces and start listening\n\thandleToDevice := Init()\n\t// Use a go routine to initialize the GUI\n\tgo InitGUI()\n\t// Listen forever for packets\n\tfor {\n\t\tpkt := handleToDevice.Next()\n\t\tif pkt != nil {\n\t\t\tpkt.Decode()\n\t\t\tDecodePacket(pkt)\n\t\t}\n\t}\n}", "func (log *DatabaseLog) listen() {\n\terr := log.db.Start()\n\tif err != nil {\n\t\tlog.err <- fmt.Errorf(\"could start database log: %v\", err)\n\t\treturn\n\t}\n\tlog.err <- nil\n\tfor {\n\t\tmsg, ok := <-log.io\n\t\tif !ok {\n\t\t\tbreak\n\t\t}\n\t\tif (uint8(log.level) & uint8(msg.level)) > 0 {\n\t\t\tlog.db.Write(msg.level, msg.message)\n\t\t}\n\t}\n\terr = log.db.Close()\n\tif err != nil {\n\t\tlog.err <- fmt.Errorf(\"could not close database log: %v\", err)\n\t\treturn\n\t}\n\tlog.err <- nil\n}", "func (c *Client) PlayHold(path string) error {\n\tfh, err := os.Open(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer fh.Close()\n\n\tbytes, err := ioutil.ReadAll(fh)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Play the loop in separate threads\n\tch := make(chan int16)\n\tgo c.Mumble.StreamAudio(ch)\n\tgo c.loopRaw(ch, bytes)\n\treturn nil\n}", "func (ps *PocketSphinx) paCallback(input unsafe.Pointer, _ unsafe.Pointer, sampleCount uint,\n\t_ *portaudio.StreamCallbackTimeInfo, _ portaudio.StreamCallbackFlags, _ unsafe.Pointer) int32 {\n\n\tconst (\n\t\tstatusContinue = int32(portaudio.PaContinue)\n\t\tstatusAbort = int32(portaudio.PaAbort)\n\t)\n\n\tin := (*(*[1 << 24]int16)(input))[:int(sampleCount)*ps.channels]\n\t// ProcessRaw with disabled search because callback needs to be relatime\n\t_, ok := ps.decoder.ProcessRaw(in, true, false)\n\tif !ok {\n\t\tps.logger.Error(\"cannot process raw\")\n\t\treturn statusAbort\n\t}\n\n\tif ps.decoder.IsInSpeech() {\n\t\tps.inSpeech = true\n\t\tif !ps.uttStarted {\n\t\t\tps.uttStarted = true\n\t\t}\n\t\treturn statusContinue\n\t}\n\n\tif ps.uttStarted {\n\t\t// speech -> silence transition, time to start new utterance\n\t\tps.decoder.EndUtt()\n\t\tps.uttStarted = false\n\t\thyp, _ := ps.decoder.Hypothesis()\n\t\tif len(hyp) > 0 {\n\t\t\tps.channel <- hyp\n\t\t}\n\t\tif !ps.decoder.StartUtt() {\n\t\t\tps.logger.Fatal(\"Sphinx failed to start utterance\")\n\t\t}\n\t}\n\treturn statusContinue\n}", "func main() {\n\tservice := micro.NewService(\n\t\tmicro.Name(\"go.micro.learning.srv.log\"),\n\t\tmicro.Broker(rabbitmq.NewBroker()),\n\t)\n\n\tservice.Init()\n\n\terr := micro.RegisterSubscriber(\"go.micro.learning.topic.log\", service.Server(), &Sub{})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tif err := service.Run(); err != nil {\n\t\tpanic(err)\n\t}\n}", "func (g *CastDevice) Speak(ctx context.Context, text, lang string) error {\n\turl, err := tts(text, lang)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn g.Play(ctx, url)\n}", "func FetchVoiceIntent(filePath string) (WitMessage, error) {\n\tlog.Println(\"reading file\")\n\tbody, err := ioutil.ReadFile(filePath)\n\tif err != nil {\n\t\tlog.Printf(\"error: %v reading file\", err)\n\t}\n\tif len(body) == 0 {\n\t\treturn WitMessage{}, errors.New(\"no sound in file\")\n\t}\n\n\turl := \"https://api.wit.ai/speech\"\n\tclient := &http.Client{}\n\treq, _ := http.NewRequest(\"POST\", url, bytes.NewReader(body))\n\treq.Header.Add(\"Authorization\", fmt.Sprintf(\"Bearer %s\", config.WitAccessToken))\n\treq.Header.Add(\"Accept\", fmt.Sprintf(\"application/vnd.wit.%s+json\", WIT_VERSION))\n\treq.Header.Add(\"Content-Type\", \"audio/wav\")\n\tlog.Println(\"sending request\")\n\tres, err := client.Do(req)\n\tdefer res.Body.Close()\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Requesting wit's api gave: %v\", err)\n\t}\n\tif res.StatusCode == 401 {\n\t\tlog.Fatalln(\"Access denied, check your wit access token \")\n\t}\n\n\treturn ProcessWitResponse(res.Body), nil\n\n}", "func listen(conn *twitterstream.Connection) {\n\tlog.Printf(\"listening...\")\n\tfor {\n\t\tif tweet, err := conn.Next(); err == nil {\n\t\t\ttweets <- tweet.Text\n\t\t} else {\n\t\t\tlog.Printf(\"Failed decoding tweet: %s\", err)\n\t\t\treturn\n\t\t}\n\t}\n}", "func (e *EventEmitter) listen(listener *Listener) (context.CancelFunc, error) {\n\tctx, cancel := context.WithCancel(context.Background())\n\tresp, err := e.app.client.ListenEvent(ctx, &core.ListenEventRequest{\n\t\tServiceID: e.eventServiceID,\n\t\tEventFilter: e.eventKey,\n\t})\n\tif err != nil {\n\t\treturn cancel, err\n\t}\n\tgo e.readStream(listener, resp)\n\treturn cancel, nil\n}", "func playSound(s *discordgo.Session, guildID, channelID string) (err error) {\n\n\t// Join the provided voice channel.\n\tvc, err := s.ChannelVoiceJoin(guildID, channelID, false, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Sleep for a specified amount of time before playing the sound\n\ttime.Sleep(250 * time.Millisecond)\n\n\t// Start speaking.\n\tvc.Speaking(true)\n\t\n\t// Send the buffer data.\n\tfor _, buff := range buffer {\n\t\tvc.OpusSend <- buff\n\t}\n\n\t// Stop speaking\n\tvc.Speaking(false)\n\n\t// Sleep for a specificed amount of time before ending.\n\ttime.Sleep(250 * time.Millisecond)\n\n\t// Disconnect from the provided voice channel.\n\tvc.Disconnect()\n\n\treturn nil\n}", "func (w *Web) serveDownloadVoice(res http.ResponseWriter, req *http.Request) {\n\ttype downloadRequest struct {\n\t\tName string\n\t}\n\trequest := &downloadRequest{}\n\tw.jsonRequest(request, req)\n\tvar names []string\n\tif len(request.Name) > 0 {\n\t\tnames = append(names, request.Name)\n\t}\n\tDownloadVoiceFiles(w.music, res, names)\n}", "func (s *Session) UploadAudio(path string, gid int) (json.RawMessage, error) {\n\treturn s.upload([]string{path}, nil, getAudioUploader(gid))\n}", "func wav2mp3(in os.File, l Locater, t Tags) (os.File, error) {\n\tout := l(t)\n\t// Make sure out exists\n\tdir := path.Dir(out)\n\tlog.Printf(\"Creating album directory %s\\n\", dir)\n\terr := os.MkdirAll(dir, 0777)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tlog.Printf(\"Using mp3 output location %s\\n\", out)\n\tcmd := exec.Command(\"lame\",\n\t\t\"--noreplaygain\",\t// TODO\n\t\t\"-V\", \"4\",\t\t// high variable bitrate\n\t\t\"--nohist\",\t\t// do not display histogram\n\t \"--silent\",\t\t// output is useless because we are multiplexing goroutines\n\t\t\"--tt\", t[\"title\"],\n\t\t\"--ta\", t[\"artist\"],\n\t\t\"--tl\", t[\"album\"],\n\t\t\"--ty\", t[\"date\"],\n\t\t\"--tn\", t[\"tracknumber\"] + \"/\" + t[\"totaltracks\"],\n\t\t\"--add-id3v2\",\n\t\t\"--id3v2-only\",\n\t\tin.Name(),\t\t// input file\n\t\tout)\t\t\t// output file\n\tcmd.Stderr = os.Stderr\n\tcmd.Stdout = os.Stdout\n\terr = cmd.Run()\n\n\tmp3File, err := os.Open(out)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn *mp3File, err\n}", "func playSound(s *discordgo.Session, guildID, channelID string) (err error) {\n\n\t// Join the provided voice channel.\n\tvc, err := s.ChannelVoiceJoin(guildID, channelID, false, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Sleep for a specified amount of time before playing the sound\n\ttime.Sleep(250 * time.Millisecond)\n\n\t// Start speaking.\n\tvc.Speaking(true)\n\tkey := guildID + \":\" + channelID\n\tstopCh := make(chan int)\n\tstopMutex.Lock()\n\tstop[key] = &stopCh\n\tstopMutex.Unlock()\n\t// Send the buffer data.\n\tfunc() {\n\t\tfor _, buff := range buffer {\n\t\t\tselect {\n\t\t\tcase <-stopCh:\n\t\t\t\treturn\n\t\t\tdefault:\n\t\t\t\tvc.OpusSend <- buff\n\t\t\t}\n\t\t}\n\t}()\n\tclose(stopCh)\n\tdelete(stop, key)\n\n\t// Stop speaking\n\tvc.Speaking(false)\n\n\t// Sleep for a specificed amount of time before ending.\n\ttime.Sleep(250 * time.Millisecond)\n\n\t// Disconnect from the provided voice channel.\n\tvc.Disconnect()\n\n\treturn nil\n}", "func (s *Samples) Track(track uint8) error {\n\treturn s.Play(int(track), nil)\n}", "func (m Message) ReplyAudio(filepath string) {\n\tmessage := &ReplyMessage{}\n\tmsg := tgbotapi.NewAudioUpload(m.Chat.ID, filepath)\n\tmessage.msg = msg\n\tm.replies <- message\n}", "func (s *ChartStreamServer) listen() error {\n\tg := gin.New()\n\n\tg.Use(ginrus.Ginrus(log.StandardLogger(), time.RFC3339, true))\n\n\tg.GET(\"/index.yaml\", s.IndexHandler)\n\tg.GET(\"/chart/:name/*version\", s.DirectLinkHandler)\n\n\treturn g.Run(s.config.ListenAddr)\n}", "func (cg *CandlesGroup) listen() {\n\tgo func() {\n\t\tfor msg := range cg.bus.dch {\n\t\t\tcg.parseMessage(msg)\n\t\t}\n\t}()\n\tgo func() {\n\t\tfor err := range cg.bus.ech {\n\t\t\tlog.Printf(\"[BITFINEX] Error listen: %+v\", err)\n\t\t\tcg.restart()\n\t\t\treturn\n\t\t}\n\t}()\n}", "func send_mp3_file(song_file string, client int) {\n\tdefer syscall.Close(client)\n\tbytes, err := ioutil.ReadFile(\"songs/\" + song_file)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tsyscall.Write(client, bytes)\n}", "func startListenLoop(receiver packetReceiver, ch chan<- receivedPacketInfo) {\n\tgo func() {\n\t\tpayloadBuf := make([]byte, 1<<16)\n\t\tfor {\n\n\t\t\tsize, iface, src, err := receiver.ReadPacket(payloadBuf)\n\t\t\tif err != nil {\n\t\t\t\tch <- receivedPacketInfo{err: err}\n\t\t\t\treturn\n\t\t\t}\n\t\t\tdata := make([]byte, size)\n\t\t\tcopy(data, payloadBuf[:size])\n\t\t\tch <- receivedPacketInfo{\n\t\t\t\tdata: data,\n\t\t\t\tiface: iface,\n\t\t\t\tsrc: src,\n\t\t\t\terr: nil}\n\t\t}\n\t}()\n}", "func (k *Mumble) Command_Audio_List(user string) {\n\tk.Client.Users.Find(user).Send(common.Command_Audio_List(k))\n}", "func main() {\n\n\tf, err := os.Open(\"clientlog.txt\")\n\tdefer f.Close()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tlog.SetOutput(f)\n\n\tif len(os.Args) < 3 {\n\t\tfmt.Println(\"How to run:\\n\\tmjpeg-streamer [camera ID] [host:port]\")\n\t\treturn\n\t}\n\n\t// parse args\n\tdeviceID := os.Args[1]// device id for the webcam, 0 be default\n\tquicServerAddr := os.Args[2]// the server address, in this case 0.0.0.0:4242\n\n\n\t//open webcam\n\twebcam, err = gocv.OpenVideoCapture(deviceID)\n\tif err != nil {\n\t\tfmt.Printf(\"Error opening capture device: %v\\n\", deviceID)\n\t\treturn\n\t}\n\tdefer webcam.Close()\n\n\t//mpquic server\n\tquicConfig := &quic.Config{\n\t\tCreatePaths: true,\n\t}\n\n\tsess, err := quic.DialAddr(quicServerAddr, &tls.Config{InsecureSkipVerify: true}, quicConfig)\n\tHandleError(err)\n\n\tstream, err := sess.OpenStream()\n\tHandleError(err)\n\n\tdefer stream.Close()\n\n\tvar length = 0\n\t\n\t//an infinite loop that generates frames from the webcam and sends to reciever\n\t\n\timg := gocv.NewMat()\n\tdefer img.Close()\n\t\n\tvar image_count = 0\n\n\tfor {\n\t\tif ok := webcam.Read(&img); !ok {\n\t\t\tfmt.Printf(\"Device closed: %v\\n\", deviceID)\n\t\t\treturn\n\t\t}\n\t\tif img.Empty() {\n\t\t\tcontinue\n\t\t}\n\n\t\tbuf, _ := gocv.IMEncode(\".jpg\", img)// encode the imgae into byte[] for transport\n\t\tlength = len(buf)\n\n\t\tbs := make([]byte, 60)\n \tbinary.LittleEndian.PutUint32(bs,uint32(length))//encoding the length(integer) as a byte[] for transport\n\n \tfmt.Println(image_count)\n\n \timage_count = image_count+1\n\n\t\tstream.Write(bs)//sends the length of the frame so that appropriate buffer size can be created in the reciever side\n\n\t\ttime.Sleep(time.Second/100)//time delay of 10 milli second\n\n\t\tstream.Write(buf) //sends the frame\n\t}\n}", "func listen(ctx context.Context, isc ingestionServerConfig, p *pubSubSource) error {\n\tpsc, err := pubsub.NewClient(ctx, isc.PubsubProjectID)\n\tif err != nil {\n\t\treturn skerr.Wrapf(err, \"initializing pubsub client for project %s\", isc.PubsubProjectID)\n\t}\n\n\t// Check that the topic exists. Fail if it does not.\n\tt := psc.Topic(isc.IngestionFilesTopic)\n\tif exists, err := t.Exists(ctx); err != nil {\n\t\treturn skerr.Wrapf(err, \"checking for existing topic %s\", isc.IngestionFilesTopic)\n\t} else if !exists {\n\t\treturn skerr.Fmt(\"Diff work topic %s does not exist in project %s\", isc.IngestionFilesTopic, isc.PubsubProjectID)\n\t}\n\n\t// Check that the subscription exists. Fail if it does not.\n\tsub := psc.Subscription(isc.IngestionSubscription)\n\tif exists, err := sub.Exists(ctx); err != nil {\n\t\treturn skerr.Wrapf(err, \"checking for existing subscription %s\", isc.IngestionSubscription)\n\t} else if !exists {\n\t\treturn skerr.Fmt(\"subscription %s does not exist in project %s\", isc.IngestionSubscription, isc.PubsubProjectID)\n\t}\n\n\t// This is a limit of how many messages to fetch when PubSub has no work. Waiting for PubSub\n\t// to give us messages can take a second or two, so we choose a small, but not too small\n\t// batch size.\n\tif isc.PubSubFetchSize == 0 {\n\t\tsub.ReceiveSettings.MaxOutstandingMessages = 10\n\t} else {\n\t\tsub.ReceiveSettings.MaxOutstandingMessages = isc.PubSubFetchSize\n\t}\n\n\tif isc.FilesProcessedInParallel == 0 {\n\t\tsub.ReceiveSettings.NumGoroutines = 4\n\t} else {\n\t\tsub.ReceiveSettings.NumGoroutines = isc.FilesProcessedInParallel\n\t}\n\n\t// Blocks until context cancels or PubSub fails in a non retryable way.\n\treturn skerr.Wrap(sub.Receive(ctx, p.ingestFromPubSubMessage))\n}", "func (g *CastDevice) Play(ctx context.Context, url *url.URL) error {\n\tconn := castnet.NewConnection()\n\tif err := conn.Connect(ctx, g.AddrV4, g.Port); err != nil {\n\t\treturn err\n\t}\n\tdefer conn.Close()\n\n\tstatus, err := g.client.Receiver().LaunchApp(ctx, cast.AppMedia)\n\tif err != nil {\n\t\treturn err\n\t}\n\tapp := status.GetSessionByAppId(cast.AppMedia)\n\n\tcc := controllers.NewConnectionController(conn, g.client.Events, cast.DefaultSender, *app.TransportId)\n\tif err := cc.Start(ctx); err != nil {\n\t\treturn err\n\t}\n\tmedia := controllers.NewMediaController(conn, g.client.Events, cast.DefaultSender, *app.TransportId)\n\tif err := media.Start(ctx); err != nil {\n\t\treturn err\n\t}\n\n\tmediaItem := controllers.MediaItem{\n\t\tContentId: url.String(),\n\t\tContentType: \"audio/mp3\",\n\t\tStreamType: \"BUFFERED\",\n\t}\n\n\tlog.Printf(\"[INFO] Load media: content_id=%s\", mediaItem.ContentId)\n\t_, err = media.LoadMedia(ctx, mediaItem, 0, true, nil)\n\n\treturn err\n}", "func RegisterAudioServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error {\n\tclient := NewAudioServiceClient(conn)\n\n\tmux.Handle(\"POST\", pattern_AudioService_GetOne_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(ctx)\n\t\tdefer cancel()\n\t\tif cn, ok := w.(http.CloseNotifier); ok {\n\t\t\tgo func(done <-chan struct{}, closed <-chan bool) {\n\t\t\t\tselect {\n\t\t\t\tcase <-done:\n\t\t\t\tcase <-closed:\n\t\t\t\t\tcancel()\n\t\t\t\t}\n\t\t\t}(ctx.Done(), cn.CloseNotify())\n\t\t}\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, outboundMarshaler, w, req, err)\n\t\t}\n\t\tresp, md, err := request_AudioService_GetOne_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_AudioService_GetOne_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_AudioService_GetDetail_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(ctx)\n\t\tdefer cancel()\n\t\tif cn, ok := w.(http.CloseNotifier); ok {\n\t\t\tgo func(done <-chan struct{}, closed <-chan bool) {\n\t\t\t\tselect {\n\t\t\t\tcase <-done:\n\t\t\t\tcase <-closed:\n\t\t\t\t\tcancel()\n\t\t\t\t}\n\t\t\t}(ctx.Done(), cn.CloseNotify())\n\t\t}\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, outboundMarshaler, w, req, err)\n\t\t}\n\t\tresp, md, err := request_AudioService_GetDetail_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_AudioService_GetDetail_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_AudioService_SetDetail_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(ctx)\n\t\tdefer cancel()\n\t\tif cn, ok := w.(http.CloseNotifier); ok {\n\t\t\tgo func(done <-chan struct{}, closed <-chan bool) {\n\t\t\t\tselect {\n\t\t\t\tcase <-done:\n\t\t\t\tcase <-closed:\n\t\t\t\t\tcancel()\n\t\t\t\t}\n\t\t\t}(ctx.Done(), cn.CloseNotify())\n\t\t}\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, outboundMarshaler, w, req, err)\n\t\t}\n\t\tresp, md, err := request_AudioService_SetDetail_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_AudioService_SetDetail_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_AudioService_DeleteDetail_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(ctx)\n\t\tdefer cancel()\n\t\tif cn, ok := w.(http.CloseNotifier); ok {\n\t\t\tgo func(done <-chan struct{}, closed <-chan bool) {\n\t\t\t\tselect {\n\t\t\t\tcase <-done:\n\t\t\t\tcase <-closed:\n\t\t\t\t\tcancel()\n\t\t\t\t}\n\t\t\t}(ctx.Done(), cn.CloseNotify())\n\t\t}\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, outboundMarshaler, w, req, err)\n\t\t}\n\t\tresp, md, err := request_AudioService_DeleteDetail_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_AudioService_DeleteDetail_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_AudioService_GetListOne_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(ctx)\n\t\tdefer cancel()\n\t\tif cn, ok := w.(http.CloseNotifier); ok {\n\t\t\tgo func(done <-chan struct{}, closed <-chan bool) {\n\t\t\t\tselect {\n\t\t\t\tcase <-done:\n\t\t\t\tcase <-closed:\n\t\t\t\t\tcancel()\n\t\t\t\t}\n\t\t\t}(ctx.Done(), cn.CloseNotify())\n\t\t}\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, outboundMarshaler, w, req, err)\n\t\t}\n\t\tresp, md, err := request_AudioService_GetListOne_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_AudioService_GetListOne_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_AudioService_GetList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(ctx)\n\t\tdefer cancel()\n\t\tif cn, ok := w.(http.CloseNotifier); ok {\n\t\t\tgo func(done <-chan struct{}, closed <-chan bool) {\n\t\t\t\tselect {\n\t\t\t\tcase <-done:\n\t\t\t\tcase <-closed:\n\t\t\t\t\tcancel()\n\t\t\t\t}\n\t\t\t}(ctx.Done(), cn.CloseNotify())\n\t\t}\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, outboundMarshaler, w, req, err)\n\t\t}\n\t\tresp, md, err := request_AudioService_GetList_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_AudioService_GetList_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_AudioService_AddToList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(ctx)\n\t\tdefer cancel()\n\t\tif cn, ok := w.(http.CloseNotifier); ok {\n\t\t\tgo func(done <-chan struct{}, closed <-chan bool) {\n\t\t\t\tselect {\n\t\t\t\tcase <-done:\n\t\t\t\tcase <-closed:\n\t\t\t\t\tcancel()\n\t\t\t\t}\n\t\t\t}(ctx.Done(), cn.CloseNotify())\n\t\t}\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, outboundMarshaler, w, req, err)\n\t\t}\n\t\tresp, md, err := request_AudioService_AddToList_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_AudioService_AddToList_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\tmux.Handle(\"POST\", pattern_AudioService_RemoveToList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {\n\t\tctx, cancel := context.WithCancel(ctx)\n\t\tdefer cancel()\n\t\tif cn, ok := w.(http.CloseNotifier); ok {\n\t\t\tgo func(done <-chan struct{}, closed <-chan bool) {\n\t\t\t\tselect {\n\t\t\t\tcase <-done:\n\t\t\t\tcase <-closed:\n\t\t\t\t\tcancel()\n\t\t\t\t}\n\t\t\t}(ctx.Done(), cn.CloseNotify())\n\t\t}\n\t\tinboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)\n\t\trctx, err := runtime.AnnotateContext(ctx, req)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, outboundMarshaler, w, req, err)\n\t\t}\n\t\tresp, md, err := request_AudioService_RemoveToList_0(rctx, inboundMarshaler, client, req, pathParams)\n\t\tctx = runtime.NewServerMetadataContext(ctx, md)\n\t\tif err != nil {\n\t\t\truntime.HTTPError(ctx, outboundMarshaler, w, req, err)\n\t\t\treturn\n\t\t}\n\n\t\tforward_AudioService_RemoveToList_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)\n\n\t})\n\n\treturn nil\n}", "func Input(c *cli.Context) error {\n\tvar file string\n\tfmt.Println(\"Enter the output file name\")\n\tfmt.Scan(&file)\n\tif file == \"\" {\n\t\tfile = inputFileName\n\t}\n\n\tvar str string\n\tfmt.Println(\"Enter the music you want to play\")\n\tfmt.Scan(&str)\n\n\tvar score []uint8\n\tfor _, t := range str {\n\t\tscore = append(score, values.Scale(fmt.Sprintf(\"%c\", t)))\n\t}\n\n\tdivision, err := smf.NewDivision(ticks, smf.NOSMTPE)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tmidi, err := smf.NewSMF(smf.Format0, *division)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttrack := &smf.Track{}\n\terr = midi.AddTrack(track)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar list []*smf.MIDIEvent\n\tfor i, t := range score {\n\t\tvar d uint32\n\t\tif i != 0 {\n\t\t\td = onDeltaTime\n\t\t}\n\t\ttoneOn, err := smf.NewMIDIEvent(d, smf.NoteOnStatus, 0x00, t, 0x64)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlist = append(list, toneOn)\n\t\ttoneOff, err := smf.NewMIDIEvent(offDeltaTime, smf.NoteOffStatus, 0x00, t, 0x64)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlist = append(list, toneOff)\n\t}\n\n\tfor _, l := range list {\n\t\tif err := track.AddEvent(l); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tmetaEvent, err := smf.NewMetaEvent(21, smf.MetaEndOfTrack, []byte{})\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := track.AddEvent(metaEvent); err != nil {\n\t\treturn err\n\t}\n\n\toutputMidi, err := os.Create(fmt.Sprintf(\"./%s.mid\", file))\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer outputMidi.Close()\n\n\twriter := bufio.NewWriter(outputMidi)\n\tsmfio.Write(writer, midi)\n\treturn writer.Flush()\n}", "func (rc *RecognitionClient) NewAudioRequest(audioFilePath string) (*stt.StreamingRecognitionRequest, error) {\n\taudioFile, err := ioutil.ReadFile(filepath.Clean(audioFilePath))\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to open the audio file\")\n\t}\n\n\treturn &stt.StreamingRecognitionRequest{\n\t\tStreamingRequest: &stt.StreamingRecognitionRequest_AudioContent{AudioContent: audioFile},\n\t}, nil\n}", "func listen() error {\n\t// define https variable\n\taddress := config.Get(\"https\", \"address\")\n\tcertificate := config.Get(\"https\", \"certificate\")\n\tkey := config.Get(\"https\", \"key\")\n\n\t// return error\n\treturn http.ListenAndServeTLS(address, certificate, key, nil)\n}", "func (snake Snake) Speak() {\n\tfmt.Println(snake.sound)\n}", "func main() {\n\n\tfmt.Println(\" _ _ _ _ \\n\" +\n\t\t\"| | | | | | | | \\n\" +\n\t\t\"| |__ | |_| |_ _ __ _ __ ___ ___ ___ _ __ __| | ___ _ __ \\n\" +\n\t\t\"| '_ \\\\| __| __| '_ \\\\ | '__/ _ \\\\/ __/ _ \\\\| '__/ _` |/ _ \\\\ '__|\\n\" +\n\t\t\"| | | | |_| |_| |_) | | | | __/ (_| (_) | | | (_| | __/ | \\n\" +\n\t\t\"|_| |_|\\\\__|\\\\__| .__/ |_| \\\\___|\\\\___\\\\___/|_| \\\\__,_|\\\\___|_| \\n\" +\n\t\t\" | | \\n\" +\n\t\t\" |_| \\n\")\n\n\tfmt.Println(\"starting http recorder...\")\n\tflag.StringVar(&recorderPort, \"recorderPort\", \"12345\", \"Port on which requests are catched and stored\")\n\tflag.StringVar(&retrieverPort, \"retrieverPort\", \"23456\", \"Port on which requests can be retrieved\")\n\tflag.Parse()\n\tfifo.Init()\n\tgo nethttp.ListenAndServe(fmt.Sprint(\":\", recorderPort), nethttp.HandlerFunc(http.RecorderHandler))\n\tgo nethttp.ListenAndServe(fmt.Sprint(\":\", retrieverPort), nethttp.HandlerFunc(http.RetrieverHandler))\n\n\tlog.RecorderInfo(\"Recorder is listening on port\", recorderPort)\n\tlog.RetrieverInfo(\"Retriever is listening on port\", retrieverPort)\n\n\twaitForStop()\n}", "func wavFile(flacFile os.File) os.File {\n\twavFile, err := ioutil.TempFile(\"\", Basename(flacFile)+\".wav-\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tlog.Printf(\"Using temporary wav file %q\\n\", wavFile)\n\treturn *wavFile\n}", "func (server *Server) handleVoiceTarget(client *Client, message *Message) {\n\tvoiceTarget := &protocol.VoiceTarget{}\n\terr := protobuf.Unmarshal(message.buffer, voiceTarget)\n\tif err != nil {\n\t\tclient.Panic(err)\n\t\treturn\n\t}\n\n\t// TODO: PUT VALIDATIONS IN THEIR OWN FUNCTIONS TO BE ABLE TO TEST THEM\n\tif voiceTarget.ID == nil {\n\t\treturn\n\t}\n\n\tid := *voiceTarget.ID\n\tif id < 1 || id >= 0x1f {\n\t\treturn\n\t}\n\n\t// TODO: Antoher waste of resources counting over the amount needed 1\n\tif len(voiceTarget.Targets) == 0 {\n\t\tdelete(client.voiceTargets, id)\n\t}\n\n\tfor _, target := range voiceTarget.Targets {\n\t\tnewTarget := &VoiceTarget{}\n\t\t// TODO: This can't be right\n\t\tfor _, session := range target.Session {\n\t\t\tnewTarget.AddSession(session)\n\t\t}\n\t\t// TODO: validation? get in your own function\n\t\tif target.ChannelID != nil {\n\t\t\t// WHY? Why not a struct even if you did do it\n\t\t\tchannelID := *target.ChannelID\n\t\t\tgroup := \"\"\n\t\t\tlinks := false\n\t\t\tchildChannels := false\n\t\t\tif target.Group != nil {\n\t\t\t\tgroup = *target.Group\n\t\t\t}\n\t\t\tif target.Links != nil {\n\t\t\t\tlinks = *target.Links\n\t\t\t}\n\t\t\tif target.Children != nil {\n\t\t\t\tchildChannels = *target.Children\n\t\t\t}\n\t\t\tnewTarget.AddChannel(channelID, childChannels, links, group)\n\t\t}\n\t\tif newTarget.IsEmpty() {\n\t\t\tdelete(client.voiceTargets, id)\n\t\t} else {\n\t\t\tclient.voiceTargets[id] = newTarget\n\t\t}\n\t}\n}", "func main() {\n if len(os.Args) < 3 {\n fmt.Println(\"Syntax: ./flymytello-server-webrtc-go [PATH_TO_PUB_KEY] [PATH_TO_PRIV_KEY]\")\n return;\n }\n\n // Check for password\n passwordTool, err := security.GetPassword()\n if err != nil {\n fmt.Println(\"No password found...\")\n fmt.Println(\"Generate one using setup.sh or ./setup/\")\n }\n // Wait till password available\n for err != nil{\n passwordTool, err = security.GetPassword()\n time.Sleep(time.Second * 3)\n }\n fmt.Println(\"hashed password found\")\n\n // Check if certificates are here\n if os.Args[1] == \"\" || os.Args[2] == \"\" {\n fmt.Println(\"No private or/and public key path as argument (TLS certificate)\")\n fmt.Println(\"Syntax: ./flymytello-server-webrtc-go [PATH_TO_PUB_KEY] [PATH_TO_PRIV_KEY]\")\n return\n }\n\n // New drone\n t, err := tello.NewTellodrone()\n if err != nil {\n fmt.Println(\"Cannot bind to drone ports\")\n }\n\n // new webserver for signaling\n w, err := rtc.NewTelloWebserver(5001, passwordTool, os.Args[1], os.Args[2])\n if err != nil {\n fmt.Println(\"cannot create webserver\")\n }\n fmt.Println(\"started webserver...\")\n\n // Fire up webrtc for every incoming connection\n for {\n sig := w.GetSignalerConn()\n fmt.Println(\"establishing new connection...\")\n err = rtc.InitializeRTCVideo(sig, t)\n if err != nil {\n fmt.Println(err)\n } else {\n fmt.Println(\"connection established\")\n }\n }\n}", "func (m *Music) Play(reader *bufio.Reader, volume100 int) {\n\tm.playing = true\n\tdefer func() {\n\t\tm.played <- true\n\t\tif m.stopping {\n\t\t\tm.stopped <- true\n\t\t}\n\t\tm.playing = false\n\t}()\n\n\tvolume := int(SampleAmp16bit * (float64(volume100) / 100.0))\n\toutputFileName := m.output\n\n\tif m.piano == nil {\n\t\tm.piano = NewPiano()\n\t}\n\n\tvar outputFile *os.File\n\tvar err error\n\n\t// output file\n\tif len(outputFileName) > 0 {\n\t\tif outputFileName == \"-\" {\n\t\t\toutputFile = os.Stdout\n\t\t\tm.quietMode = true\n\t\t} else {\n\t\t\topt := os.O_WRONLY | os.O_TRUNC | os.O_CREATE\n\t\t\toutputFile, err = os.OpenFile(outputFileName, opt, 0644)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Fprintln(os.Stderr, \"Error opening output file:\", err)\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\t\t}\n\t\tdefer outputFile.Close()\n\t}\n\n\tif m.quietMode {\n\t\tPrintSheet = false\n\t\tPrintNotes = false\n\t}\n\n\t// sustain state\n\tsustain := &Sustain{\n\t\tattack: 8,\n\t\tdecay: 4,\n\t\tsustain: 4,\n\t\trelease: 9,\n\t\tbuf: make([]int16, quarterNote),\n\t}\n\n\t// read lines\n\tchord := &Chord{}\n\tbufWaveLimit := 1024 * 1024 * 100\n\tcontrolKeys := \"RDHTSAVC\"\n\tmeasures := \"WHQESTI\"\n\thands := \"0LR7\"\n\tzeroToNine := \"0123456789\"\n\ttempos := zeroToNine\n\tamplitudes := zeroToNine\n\tchordNumbers := zeroToNine\n\tignoredKeys := \"\\t |\"\n\tsustainTypes := \"ADSR\"\n\tsustainLevels := zeroToNine\n\tvoiceControls := \"DPVN\"\n\n\tvar (\n\t\tbufOutput []int16\n\t\tduration = 'Q' // default note duration\n\t\tdotted bool\n\t\trest rune\n\t\tctrl rune\n\t\tvoice Voice = m.piano // default voice is piano\n\t\tsustainType rune\n\t\thand = 'R' // default is middle C octave\n\t\thandLevel rune\n\t\tcount int // line counter\n\t\ttempo = 4 // normal speed\n\t\tamplitude = 9 // max volume\n\t\tmixNextLine bool\n\t\tbufMix []int16\n\t\tlineMix string\n\t\twaitNext bool\n\t\tblockComment bool\n\t)\n\n\tfor {\n\t\tline, done := nextMusicLine(reader)\n\t\tif done {\n\t\t\tbreak\n\t\t}\n\t\tif strings.HasPrefix(line, \"#\") {\n\t\t\tif strings.HasPrefix(line, \"##\") {\n\t\t\t\t// ignore block comment\n\t\t\t\tif blockComment {\n\t\t\t\t\tblockComment = false\n\t\t\t\t} else {\n\t\t\t\t\tblockComment = true\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// ignore comments\n\t\t\t\tif PrintSheet {\n\t\t\t\t\tfmt.Println(line)\n\t\t\t\t}\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tif blockComment {\n\t\t\tcontinue\n\t\t}\n\t\tif strings.HasSuffix(line, \"VN\") {\n\t\t\t// include next line to mixer\n\t\t\tmixNextLine = true\n\t\t} else {\n\t\t\tmixNextLine = false\n\t\t}\n\t\tvar bufWave []int16\n\t\tfor _, key := range line {\n\t\t\tkeystr := string(key)\n\t\t\tif strings.ContainsAny(keystr, ignoredKeys) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif ctrl == 0 && strings.ContainsAny(keystr, controlKeys) {\n\t\t\t\tctrl = key\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif ctrl > 0 {\n\t\t\t\tswitch ctrl {\n\t\t\t\tcase 'D': // duration\n\t\t\t\t\tif strings.ContainsAny(keystr, measures) {\n\t\t\t\t\t\tduration = key\n\t\t\t\t\t}\n\t\t\t\t\tif key == 'D' {\n\t\t\t\t\t\tdotted = true\n\t\t\t\t\t}\n\t\t\t\tcase 'R': // reset\n\t\t\t\t\tif strings.ContainsAny(keystr, measures) {\n\t\t\t\t\t\trest = key\n\t\t\t\t\t}\n\t\t\t\tcase 'H': // hand\n\t\t\t\t\tif strings.ContainsAny(keystr, hands) {\n\t\t\t\t\t\thand = key\n\t\t\t\t\t}\n\t\t\t\tcase 'T': // tempo\n\t\t\t\t\tif strings.ContainsAny(keystr, tempos) {\n\t\t\t\t\t\ttempo = strings.Index(tempos, keystr)\n\t\t\t\t\t}\n\t\t\t\tcase 'S': // sustain\n\t\t\t\t\tif strings.ContainsAny(keystr, sustainTypes) {\n\t\t\t\t\t\tsustainType = key\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tif strings.ContainsAny(keystr, sustainLevels) {\n\t\t\t\t\t\tlevel := strings.Index(sustainLevels, keystr)\n\t\t\t\t\t\tswitch sustainType {\n\t\t\t\t\t\tcase 'A':\n\t\t\t\t\t\t\tsustain.attack = level\n\t\t\t\t\t\tcase 'D':\n\t\t\t\t\t\t\tsustain.decay = level\n\t\t\t\t\t\tcase 'S':\n\t\t\t\t\t\t\tsustain.sustain = level\n\t\t\t\t\t\tcase 'R':\n\t\t\t\t\t\t\tsustain.release = level\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\tcase 'A': // amplitude\n\t\t\t\t\tif strings.ContainsAny(keystr, amplitudes) {\n\t\t\t\t\t\tamplitude = strings.Index(amplitudes, keystr)\n\t\t\t\t\t}\n\t\t\t\tcase 'V': // voice\n\t\t\t\t\tif strings.ContainsAny(keystr, voiceControls) {\n\t\t\t\t\t\tswitch key {\n\t\t\t\t\t\tcase 'D': // default voice\n\t\t\t\t\t\t\tvoice.ComputerVoice(true)\n\t\t\t\t\t\tcase 'P':\n\t\t\t\t\t\t\tvoice = m.piano\n\t\t\t\t\t\t\tif voice.NaturalVoiceFound() {\n\t\t\t\t\t\t\t\tvoice.ComputerVoice(false)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\tcase 'V':\n\t\t\t\t\t\t\tif m.violin == nil {\n\t\t\t\t\t\t\t\tm.violin = NewViolin()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvoice = m.violin\n\t\t\t\t\t\t\tvoice.ComputerVoice(false)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\tcase 'C': // chord\n\t\t\t\t\tif strings.ContainsAny(keystr, chordNumbers) {\n\t\t\t\t\t\tchord.count = 0\n\t\t\t\t\t\tchord.number = strings.Index(chordNumbers, keystr)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif rest > 0 {\n\t\t\t\t\tbufRest := restNote(rest, dotted, tempo)\n\t\t\t\t\tif bufRest != nil {\n\t\t\t\t\t\tif voice.NaturalVoice() {\n\t\t\t\t\t\t\treleaseNote(sustain.buf, 0, sustain.Ratio())\n\t\t\t\t\t\t\tmixSoundWave(bufRest, sustain.buf)\n\t\t\t\t\t\t\tclearBuffer(sustain.buf)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbufWave = append(bufWave, bufRest...)\n\t\t\t\t\t}\n\t\t\t\t\trest = 0\n\t\t\t\t}\n\t\t\t\tctrl = 0\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tswitch hand {\n\t\t\tcase '0': // octave 0\n\t\t\t\thandLevel = 1000\n\t\t\tcase 'L': // octave 1, 2, 3\n\t\t\t\thandLevel = 2000\n\t\t\tcase 'R': // octave 4, 5, 6\n\t\t\t\thandLevel = 3000\n\t\t\tcase '7', '8': // octave 7, 8\n\t\t\t\thandLevel = 4000\n\t\t\t}\n\t\t\tnote := &Note{\n\t\t\t\tkey: handLevel + key,\n\t\t\t\tvolume: volume,\n\t\t\t\tamplitude: amplitude,\n\t\t\t\tduration: duration,\n\t\t\t\tdotted: dotted,\n\t\t\t\ttempo: tempo,\n\t\t\t\tsamples: 0,\n\t\t\t}\n\t\t\tnote.measure()\n\t\t\tif voice.GetNote(note, sustain) {\n\t\t\t\tdotted = false\n\t\t\t\tif chord.number > 0 {\n\t\t\t\t\t// playing a chord\n\t\t\t\t\tchord.count++\n\t\t\t\t\tif chord.buf == nil {\n\t\t\t\t\t\tchord.buf = make([]int16, len(note.buf))\n\t\t\t\t\t\tcopy(chord.buf, note.buf)\n\t\t\t\t\t\tif voice.NaturalVoice() {\n\t\t\t\t\t\t\t//copyBuffer(sustain.buf, chord.buf)\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmixSoundWave(chord.buf, note.buf)\n\t\t\t\t\t\tif voice.NaturalVoice() {\n\t\t\t\t\t\t\t//mixSoundWave(sustain.buf, note.buf)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif chord.count == chord.number {\n\t\t\t\t\t\tif voice.NaturalVoice() {\n\t\t\t\t\t\t\trelease := len(note.buf) / 10 * sustain.sustain\n\t\t\t\t\t\t\tratio := sustain.Ratio()\n\t\t\t\t\t\t\treleaseNote(sustain.buf, release, ratio)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tnote.buf = chord.buf\n\t\t\t\t\t\tchord.Reset()\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif PrintNotes {\n\t\t\t\t\t\t\tfmt.Printf(\"%v-\", m.piano.keyNoteMap[note.key])\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tvoice.SustainNote(note, sustain)\n\t\t\t\tbufWave = append(bufWave, note.buf...)\n\t\t\t\tif len(bufWave) > bufWaveLimit {\n\t\t\t\t\tfmt.Fprintln(os.Stderr, \"Line wave buffer exceeds 100MB limit.\")\n\t\t\t\t\tos.Exit(1)\n\t\t\t\t}\n\t\t\t\tif PrintNotes {\n\t\t\t\t\tfmt.Printf(\"%v \", m.piano.keyNoteMap[note.key])\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tvoiceName := strings.Split(fmt.Sprintf(\"%T\", voice), \".\")[1]\n\t\t\t\tnoteName := m.piano.keyNoteMap[note.key]\n\t\t\t\tfmt.Printf(\"%s: Invalid note: %s (%s)\\n\", voiceName, keystr, noteName)\n\t\t\t}\n\t\t}\n\t\tif mixNextLine {\n\t\t\tif bufMix == nil {\n\t\t\t\tbufMix = make([]int16, len(bufWave))\n\t\t\t\tcopy(bufMix, bufWave)\n\t\t\t\tlineMix = line\n\t\t\t} else {\n\t\t\t\tlineMix += \"\\n\" + line\n\t\t\t\tmixSoundWave(bufMix, bufWave)\n\t\t\t}\n\t\t\tcount++\n\t\t\tclearBuffer(sustain.buf)\n\t\t\tcontinue\n\t\t}\n\t\tif bufMix != nil {\n\t\t\tmixSoundWave(bufMix, bufWave)\n\t\t\tbufWave = bufMix\n\t\t\tbufMix = nil\n\t\t\tline = lineMix + \"\\n\" + line\n\t\t}\n\t\tif PrintNotes {\n\t\t\tfmt.Println()\n\t\t}\n\t\tif outputFile == nil {\n\t\t\tif len(bufWave) > 0 {\n\t\t\t\tif waitNext {\n\t\t\t\t\tm.WaitLine() // wait until previous line is done playing\n\t\t\t\t}\n\t\t\t\t// prepare next line while playing\n\t\t\t\tgo m.Playback(bufWave, bufWave)\n\t\t\t\tif PrintSheet {\n\t\t\t\t\tfmt.Println(line)\n\t\t\t\t}\n\t\t\t\twaitNext = true\n\t\t\t} else if PrintSheet {\n\t\t\t\tfmt.Println(line)\n\t\t\t}\n\t\t} else {\n\t\t\t// saving to file\n\t\t\tbuf := make([]int16, 2*len(bufWave))\n\t\t\tfor i, bar := range bufWave {\n\t\t\t\tbuf[i*2] = bar\n\t\t\t\tbuf[i*2+1] = bar\n\t\t\t}\n\t\t\tbufOutput = append(bufOutput, buf...)\n\t\t\tif PrintSheet {\n\t\t\t\tfmt.Println(line)\n\t\t\t}\n\t\t}\n\t\tclearBuffer(sustain.buf)\n\t\tcount++\n\t\tif m.stopping {\n\t\t\tbreak\n\t\t}\n\t}\n\tif waitNext {\n\t\tm.WaitLine()\n\t}\n\n\tif outputFile != nil {\n\t\t// save wave to file\n\t\tbuflen := len(bufOutput)\n\t\theader := NewWaveHeader(2, SampleRate, 16, buflen*2)\n\t\t_, err = header.WriteHeader(outputFile)\n\t\tif err != nil {\n\t\t\tfmt.Fprintln(os.Stderr, \"Error writing to output file:\", err)\n\t\t\tos.Exit(1)\n\t\t}\n\t\tbuf := int16ToByteBuf(bufOutput)\n\t\t_, err := outputFile.Write(buf)\n\t\tif err != nil {\n\t\t\tfmt.Fprintln(os.Stderr, \"Error writing to output file:\", err)\n\t\t\tos.Exit(1)\n\t\t}\n\t\tif outputFileName != \"-\" {\n\t\t\tfmt.Printf(\"wrote %s bytes to '%s'\\n\", numberComma(int64(len(buf))), outputFileName)\n\t\t}\n\t}\n}", "func DownloadVoiceFiles(music *Music, writer io.Writer, names []string) {\n\tdir := filepath.Join(HomeDir(), \"voices\")\n\tif len(names) == 0 {\n\t\tnames = []string{\"piano\", \"violin\"}\n\t}\n\tfor _, name := range names {\n\t\tif !strings.HasSuffix(name, \".zip\") {\n\t\t\tname += \".zip\"\n\t\t}\n\t\turl := \"http://bmrust.com/dl/beep/voices/\" + name\n\t\tfmt.Fprintf(writer, \"Downloading '%s'\", url)\n\n\t\t// locate file\n\t\tresp, err := http.Head(url)\n\t\tif err != nil {\n\t\t\tfmt.Fprintln(writer, \" Error:\", err)\n\t\t\tcontinue\n\t\t}\n\t\tif resp.StatusCode != http.StatusOK {\n\t\t\tfmt.Fprintln(writer, \"Error locating file. Status:\", resp.StatusCode)\n\t\t\tcontinue\n\t\t}\n\t\tfmt.Fprintf(writer, \" %s bytes ...\\n\", numberComma(resp.ContentLength))\n\n\t\t// fetch file\n\t\tresp, err = http.Get(url)\n\t\tif err != nil {\n\t\t\tfmt.Fprintln(writer, \"Error downloading file:\", err)\n\t\t\tcontinue\n\t\t}\n\t\tif resp.StatusCode != http.StatusOK {\n\t\t\tfmt.Fprintln(writer, \"Error downloading. Status:\", resp.StatusCode)\n\t\t\tcontinue\n\t\t}\n\t\tdefer resp.Body.Close()\n\n\t\t// read file\n\t\tbody, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\tfmt.Fprintln(writer, \"Error reading file:\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\t// save file\n\t\tos.MkdirAll(dir, 0755)\n\t\tfilename := filepath.Join(dir, name)\n\t\terr = ioutil.WriteFile(filename, body, 0644)\n\t\tif err != nil {\n\t\t\tfmt.Fprintln(writer, \"Error saving file:\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\tfmt.Fprintf(writer, \" Saving %s\\n\", filename)\n\t}\n\n\t// reload voices\n\tmusic.piano = NewPiano()\n\tmusic.violin = NewViolin()\n}" ]
[ "0.58823323", "0.5653581", "0.5501297", "0.55012274", "0.54926395", "0.54465216", "0.5437088", "0.5391246", "0.5354009", "0.5350853", "0.5316861", "0.53128964", "0.51836765", "0.51336247", "0.5128569", "0.51041436", "0.5057978", "0.50432605", "0.5025527", "0.5012161", "0.49966756", "0.49941865", "0.49858287", "0.49833062", "0.49790207", "0.49681273", "0.49483162", "0.49235612", "0.49141896", "0.49051937", "0.48904532", "0.4834439", "0.48331505", "0.48289776", "0.48269457", "0.47923073", "0.47866926", "0.47866628", "0.47656864", "0.47399685", "0.47355735", "0.4707039", "0.46954462", "0.46917182", "0.468788", "0.46837857", "0.4683637", "0.4680909", "0.46708018", "0.46636015", "0.4656302", "0.46536154", "0.46515048", "0.4649286", "0.4649254", "0.46376395", "0.46295074", "0.46285152", "0.4621229", "0.4619459", "0.46192163", "0.46054795", "0.4589906", "0.45857254", "0.45804727", "0.4575378", "0.4570604", "0.45594725", "0.45542184", "0.45529327", "0.45387167", "0.45337498", "0.45293343", "0.4524268", "0.4521974", "0.45199594", "0.45191333", "0.4507276", "0.4504507", "0.4489314", "0.44840804", "0.44723734", "0.44590604", "0.4457658", "0.44519967", "0.44478777", "0.4443909", "0.44393358", "0.4438296", "0.44348198", "0.4428301", "0.4425242", "0.44211978", "0.44196582", "0.44051695", "0.44004822", "0.44002563", "0.43987578", "0.43926606", "0.43807274" ]
0.7709106
0
NewAccessRequestData instantiates a new AccessRequestData object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed
func NewAccessRequestData() *AccessRequestData { this := AccessRequestData{} return &this }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewAccessRequestDataWithDefaults() *AccessRequestData {\n\tthis := AccessRequestData{}\n\treturn &this\n}", "func NewRequestData() *RequestData {\n\treturn &RequestData{\n\t\tVer: 2,\n\t}\n}", "func NewAccessRequest(user string, roles ...string) (types.AccessRequest, error) {\n\treturn NewAccessRequestWithResources(user, roles, []types.ResourceID{})\n}", "func (m *DepositRequestMeta) New() service.DataObject {\n\treturn &DepositRequest{}\n}", "func (r *RequestService) NewRequest(url string, body interface{}) *RequestService {\n\tr.URL = url\n\tif body == nil {\n\t\tr.Data = make(map[string]string)\n\t} else {\n\t\tr.Data = body\n\t}\n\treturn r\n}", "func (c *APIGateway) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\t// Run custom request initialization if present\n\tif initRequest != nil {\n\t\tinitRequest(req)\n\t}\n\n\treturn req\n}", "func NewRequest() *Request {\n\treturn defaul.NewRequest()\n}", "func UnmarshalAccessRequest(data []byte, opts ...MarshalOption) (types.AccessRequest, error) {\n\tcfg, err := CollectOptions(opts)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tvar req types.AccessRequestV3\n\tif err := utils.FastUnmarshal(data, &req); err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tif err := ValidateAccessRequest(&req); err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tif cfg.ID != 0 {\n\t\treq.SetResourceID(cfg.ID)\n\t}\n\tif !cfg.Expires.IsZero() {\n\t\treq.SetExpiry(cfg.Expires)\n\t}\n\treturn &req, nil\n}", "func (qiwi *PersonalAPI) newRequest(apiKey, method, spath string, data map[string]interface{}) (req *http.Request, err error) {\n\n\tvar path = APIURL + spath\n\n\tvar body io.Reader\n\n\tif len(data) > 0 {\n\n\t\ts, err := json.Marshal(data)\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tbody = bytes.NewBuffer(s)\n\n\t}\n\n\treq, err = http.NewRequest(method, path, body)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treq.Header.Add(\"Accept\", \"application/json\")\n\treq.Header.Set(\"Authorization\", \"Bearer \"+apiKey)\n\n\treturn req, err\n}", "func (m *TransferRequestMeta) New() service.DataObject {\n\treturn &TransferRequest{}\n}", "func NewRequest(requestName string, params rata.Params, header http.Header, query url.Values, body ...io.Reader) Request {\n\tif header == nil {\n\t\theader = http.Header{}\n\t}\n\theader.Set(\"Accept\", \"application/json\")\n\n\trequest := Request{\n\t\tRequestName: requestName,\n\t\tParams: params,\n\t\tHeader: header,\n\t\tQuery: query,\n\t}\n\n\tif len(body) == 1 {\n\t\trequest.Body = body[0]\n\t}\n\n\treturn request\n}", "func NewRequest(name string) *Request {\n\tresult := Request{name: name}\n\tresult.pending = nil\n\tresult.approved = nil\n\treturn &result\n}", "func (client *FactoriesClient) getDataPlaneAccessCreateRequest(ctx context.Context, resourceGroupName string, factoryName string, policy UserAccessPolicy, options *FactoriesClientGetDataPlaneAccessOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/getDataPlaneAccess\"\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 factoryName == \"\" {\n\t\treturn nil, errors.New(\"parameter factoryName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{factoryName}\", url.PathEscape(factoryName))\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\", \"2018-06-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, policy)\n}", "func (m *ConditionalAccessRequestBuilder) CreateGetRequestInformation(ctx context.Context, requestConfiguration *ConditionalAccessRequestBuilderGetRequestConfiguration)(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) {\n requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation()\n requestInfo.UrlTemplate = m.urlTemplate\n requestInfo.PathParameters = m.pathParameters\n requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET\n requestInfo.Headers[\"Accept\"] = \"application/json\"\n if requestConfiguration != nil {\n if requestConfiguration.QueryParameters != nil {\n requestInfo.AddQueryParameters(*(requestConfiguration.QueryParameters))\n }\n requestInfo.AddRequestHeaders(requestConfiguration.Headers)\n requestInfo.AddRequestOptions(requestConfiguration.Options)\n }\n return requestInfo, nil\n}", "func NewRequest(data interface{}) *CallRequest {\n\tswitch data.(type) {\n\tcase []byte:\n\t\tpanic(\"invalid data\")\n\t}\n\tpayload, _ := json.Marshal(data)\n\treturn &CallRequest{\n\t\tParams: nil,\n\t\tData: payload,\n\t}\n}", "func (m *AssignmentDefaultsRequestBuilder) CreateGetRequestInformation(ctx context.Context, requestConfiguration *AssignmentDefaultsRequestBuilderGetRequestConfiguration)(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) {\n requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation()\n requestInfo.UrlTemplate = m.urlTemplate\n requestInfo.PathParameters = m.pathParameters\n requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET\n requestInfo.Headers[\"Accept\"] = \"application/json\"\n if requestConfiguration != nil {\n if requestConfiguration.QueryParameters != nil {\n requestInfo.AddQueryParameters(*(requestConfiguration.QueryParameters))\n }\n requestInfo.AddRequestHeaders(requestConfiguration.Headers)\n requestInfo.AddRequestOptions(requestConfiguration.Options)\n }\n return requestInfo, nil\n}", "func (m *NewWalletRequestMeta) New() service.DataObject {\n\treturn &NewWalletRequest{}\n}", "func NewAccessReviewRequest() *AccessReviewRequestBuilder {\n\treturn &AccessReviewRequestBuilder{}\n}", "func newRequest(req *http.Request) *Request {\n\trequest := &Request{\n\t\tRequest: req,\n\t}\n\n\treturn request\n}", "func newRequest(req *http.Request) *Request {\n\treturn &Request{\n\t\tRequest: req,\n\t}\n}", "func NewAssignPostRequestBody()(*AssignPostRequestBody) {\n m := &AssignPostRequestBody{\n }\n m.SetAdditionalData(make(map[string]interface{}));\n return m\n}", "func (b *AccessReviewRequestBuilder) Build() (object *AccessReviewRequest, err error) {\n\tobject = new(AccessReviewRequest)\n\tobject.bitmap_ = b.bitmap_\n\tobject.accountUsername = b.accountUsername\n\tobject.action = b.action\n\tobject.clusterID = b.clusterID\n\tobject.clusterUUID = b.clusterUUID\n\tobject.organizationID = b.organizationID\n\tobject.resourceType = b.resourceType\n\tobject.subscriptionID = b.subscriptionID\n\treturn\n}", "func (client *Client) NewRequest(messageDataBuffer *strings.Reader) (*http.Request, error) {\n\trequest, err := http.NewRequest(\"POST\", client.BaseURL, messageDataBuffer)\n\n\tif err != nil {\n\t\terrStr := fmt.Sprintf(\"Error constructing the HTTP network request ... here is the error %v\", err)\n\t\treturn &http.Request{}, &errorString{errStr}\n\t}\n\n\t// fmt.Printf(\"ACCOUNT SID \", client.AccountSID , \"Auth Token \", client.AuthToken)\n\trequest.SetBasicAuth(client.AccountSID, client.AuthToken) // Authenticating user credentials\n\n\t// Additional header fields to accept json media types which can be used for the response\n\trequest.Header.Add(\"Accept\", \"application/json\")\n\n\t// To indicate the media type that is being sent through the request\n\trequest.Header.Add(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\treturn request, nil\n}", "func newRequest(r *http.Request, vars map[string]string) *Request {\n\trequest := &Request{r, vars, nil}\n\treturn request\n}", "func (c *IoT) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\t// Run custom request initialization if present\n\tif initRequest != nil {\n\t\tinitRequest(req)\n\t}\n\n\treturn req\n}", "func (m *AccessReviewHistoryDefinitionItemRequestBuilder) CreateGetRequestInformation(ctx context.Context, requestConfiguration *AccessReviewHistoryDefinitionItemRequestBuilderGetRequestConfiguration)(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) {\n requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation()\n requestInfo.UrlTemplate = m.urlTemplate\n requestInfo.PathParameters = m.pathParameters\n requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET\n requestInfo.Headers[\"Accept\"] = \"application/json\"\n if requestConfiguration != nil {\n if requestConfiguration.QueryParameters != nil {\n requestInfo.AddQueryParameters(*(requestConfiguration.QueryParameters))\n }\n requestInfo.AddRequestHeaders(requestConfiguration.Headers)\n requestInfo.AddRequestOptions(requestConfiguration.Options)\n }\n return requestInfo, nil\n}", "func NewRequestObject(node *tree.Node, res www.ResponseWriter, r *www.Request) *Request {\n\n\treturn &Request{\n\t\tParameters: \tparameters.New(),\n\t\tconfig:\t\t\tnode.Config,\n\t\tNode:\t\t\tnode,\n\t\tres:\t\t \tres,\n\t\tr: \t\t\t\tr,\n\t\tmethod: \t\tr.Method,\n\t}\n}", "func (gc *GatewayClient) NewRequest(opData structures.OperationRequestInterface) (*http.Response, error) {\n\t// Build whole payload structure with nested data bundles\n\trawReqData := &GenericRequest{}\n\trawReqData.Auth = *gc.auth\n\trawReqData.Data = opData\n\n\t// Get prepared structure of json byte array\n\tbufPayload, bufErr := prepareJSONPayload(rawReqData)\n\tif bufErr != nil {\n\t\treturn nil, bufErr\n\t}\n\n\t// Get combined URL path for request to API\n\turl, errURLPath := determineURL(gc, opData.GetOperationType())\n\tif errURLPath != nil {\n\t\treturn nil, errURLPath\n\t}\n\n\t// Build correct HTTP request\n\tnewReq, reqErr := buildHTTPRequest(opData.GetHTTPMethod(), url, bufPayload)\n\tif reqErr != nil {\n\t\treturn nil, reqErr\n\t}\n\n\t// Send HTTP request object\n\tresp, respErr := gc.httpClient.Do(newReq)\n\tif respErr != nil {\n\t\treturn nil, respErr\n\t}\n\n\treturn resp, nil\n}", "func NewRequest(src, dest string) *Request {\n\treturn &Request{src: src, dest: dest}\n}", "func (m *AssignmentPoliciesRequestBuilder) CreateGetRequestInformation(ctx context.Context, requestConfiguration *AssignmentPoliciesRequestBuilderGetRequestConfiguration)(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) {\n requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation()\n requestInfo.UrlTemplate = m.urlTemplate\n requestInfo.PathParameters = m.pathParameters\n requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET\n requestInfo.Headers[\"Accept\"] = \"application/json\"\n if requestConfiguration != nil {\n if requestConfiguration.QueryParameters != nil {\n requestInfo.AddQueryParameters(*(requestConfiguration.QueryParameters))\n }\n requestInfo.AddRequestHeaders(requestConfiguration.Headers)\n requestInfo.AddRequestOptions(requestConfiguration.Options)\n }\n return requestInfo, nil\n}", "func CreateBaseRequest(method, url string, body []byte, user m.AuthUser, verbose bool) *http.Request {\n\treq, err := http.NewRequest(method, url, bytes.NewBuffer(body))\n\treq.SetBasicAuth(user.Username, user.Password)\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"Accept\", \"application/json\")\n\tError(err, \"Error creating the request\")\n\n\tif verbose {\n\t\tfmt.Println(\"Request Url:\", req.URL)\n\t\tfmt.Println(\"Request Headers:\", req.Header)\n\t\tfmt.Println(\"Request Body:\", req.Body)\n\t}\n\n\treturn req\n}", "func NewRequest(token string) *Request {\n\treqID := fmt.Sprintf(\"alaudacli-%d\", time.Now().Unix())\n\trestyReq := resty.R()\n\trestyReq.SetHeader(\"Content-Type\", \"application/json\")\n\trestyReq.SetHeader(\"Alauda-Request-ID\", reqID)\n\n\tif token != \"\" {\n\t\trestyReq.SetHeader(\"Authorization\", fmt.Sprintf(\"Token %s\", token))\n\t}\n\n\treturn &Request{\n\t\trestyReq,\n\t}\n}", "func CreateRequest(playerID string, interest string, lat, lon float64) *Request {\n\treturn &Request{\n\t\tInterest: interest,\n\t\tPlayerID: playerID,\n\t\tGeoJSONType: \"Point\",\n\t\tCoordinates: []float64{lat, lon},\n\t}\n}", "func NewReq(required []string) *Request {\n\treturn &Request{\n\t\targuments: make(map[string]string),\n\t\trequired: required,\n\t}\n}", "func New(accessToken string) FacebookReq {\n\treturn FacebookReq{\n\t\tAPIVersion: currentVersion,\n\t\taccessToken: accessToken,\n\t}\n}", "func (c *InputService12ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "func NewRequest(method, urlStr string, body io.Reader, meta MetaMap) (req *Request, err error) {\n\tif meta == nil {\n\t\tmeta = make(MetaMap, 2)\n\t}\n\n\tif httpReq, err := http.NewRequest(method, urlStr, body); err == nil {\n\t\treq = &Request{\n\t\t\tRequest: httpReq,\n\t\t\tMeta: meta,\n\t\t}\n\t}\n\treturn\n}", "func NewDataRequest() *DataRequest {\n\t// Set Defaults\n\treq := DataRequest{\n\t\tStep: \"1m\",\n\t\tTimeSeries: []string{\n\t\t\t\"etcd_disk_wal_fsync_duration_seconds_bucket\",\n\t\t\t\"etcd_disk_backend_commit_duration_seconds_bucket\",\n\t\t\t\"etcd_network_peer_round_trip_time_seconds_bucket\",\n\t\t},\n\t}\n\n\treturn &req\n}", "func NewRequest(endpoint Endpoint, payload interface{}, config *models.Config) *Request {\n\treturn &Request{\n\t\tEndpoint: endpoint,\n\t\tPayload: payload,\n\t\tConfig: config,\n\t\tMethod: POST,\n\t\tContentType: JSONContentType,\n\t}\n}", "func NewRequest(reqType string) (req map[string]interface{}) {\n\treturn map[string]interface{}{\n\t\t\"req\": reqType,\n\t}\n}", "func NewRequest() *Request {\n\tr := &Request{\n\t\tAggregations: make(map[string]types.Aggregations, 0),\n\t\tExt: make(map[string]json.RawMessage, 0),\n\t\tScriptFields: make(map[string]types.ScriptField, 0),\n\t}\n\treturn r\n}", "func NewRequest() *Request {\n\tr := &Request{\n\t\tAggregations: make(map[string]types.Aggregations, 0),\n\t\tExt: make(map[string]json.RawMessage, 0),\n\t\tScriptFields: make(map[string]types.ScriptField, 0),\n\t}\n\treturn r\n}", "func (c *Client) newRequest(t RequestType) *Request {\n\tc.seqID++\n\treturn &Request{\n\t\tAPIVersion: \"v1\",\n\t\tRequestType: t,\n\t\tTracerTime: time.Now().Unix(),\n\t\tRuntimeID: globalconfig.RuntimeID(),\n\t\tSeqID: c.seqID,\n\t\tDebug: c.debug,\n\t\tApplication: Application{\n\t\t\tServiceName: c.Service,\n\t\t\tEnv: c.Env,\n\t\t\tServiceVersion: c.Version,\n\t\t\tTracerVersion: version.Tag,\n\t\t\tLanguageName: \"go\",\n\t\t\tLanguageVersion: runtime.Version(),\n\t\t},\n\t\tHost: Host{\n\t\t\tHostname: hostname,\n\t\t\tContainerID: internal.ContainerID(),\n\t\t\tOS: getOSName(),\n\t\t\tOSVersion: getOSVersion(),\n\t\t},\n\t}\n}", "func newRequest(httRequest *http.Request, props *map[string]interface{}) *request {\n req := &request{}\n req.header = &EntrySet{keys: make(map[string]string)}\n req.body = make(map[string][]string)\n req.files = make([]*File, 0)\n req.body = httRequest.Form\n req.ref = httRequest\n req.cookies = newReadOnlyCookie(httRequest)\n req.query = make(map[string][]string)\n req.query = httRequest.URL.Query()\n req.method = strings.ToLower(httRequest.Method)\n req.url = httRequest.URL.Path\n req.params = &EntrySet{keys: make(map[string]string)}\n req._url = httRequest.URL\n req.props = props\n req.fileReader = nil\n for key, value := range httRequest.Header {\n // lowercase the header key names\n req.header.Set(strings.ToLower(key), strings.Join(value, \",\"))\n }\n\n if req.header.Get(\"content-type\") == \"application/json\" {\n req.json = json.NewDecoder(httRequest.Body)\n } else {\n httRequest.ParseForm()\n }\n // check if we have an anonymous form posted\n if len(httRequest.PostForm) > 0 && len(req.body) == 0 {\n req.body = make(map[string][]string)\n }\n for key, value := range httRequest.PostForm {\n req.body[key] = value\n }\n // check whether the request is a form-data request\n var boundary string\n if req.IsMultipart(req.header.Get(\"content-type\"), &boundary) {\n var bufferSize int\n if req.header.Get(\"content-length\") != \"\" {\n bufferSize, _ = strconv.Atoi(req.header.Get(\"content-length\"))\n }\n req.ReadMultiPartBody(boundary, int64(bufferSize))\n }\n return req\n}", "func (c *InputService14ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "func NewRequest(host string) *Request {\n\trequest := &Request{host, url.Values{}, http.Header{}, BasicAuth{}}\n\treturn request\n}", "func NewSharePostRequestBody()(*SharePostRequestBody) {\n m := &SharePostRequestBody{\n }\n m.SetAdditionalData(make(map[string]interface{}));\n return m\n}", "func (c *MakeRequestController) New() {\n\tc.AppCtx.UpdateMDR(models.EmptyMakeRequestData())\n\tc.AppCtx.RefreshViews(\"request\")\n}", "func CreateAccessTokenRequest() (request *AccessTokenRequest) {\n\trequest = &AccessTokenRequest{\n\t\tRoaRequest: &requests.RoaRequest{},\n\t}\n\trequest.InitWithApiInfo(\"btripOpen\", \"2022-05-20\", \"AccessToken\", \"/btrip-open-auth/v1/access-token/action/take\", \"\", \"\")\n\trequest.Method = requests.GET\n\treturn\n}", "func NewRequest(f map[string]string, r io.Reader, h map[string]string, d encoding.DecodeFunc) *Request {\n\treturn &Request{Fields: f, Raw: r, Headers: h, decode: d}\n}", "func (s *OidcService) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := s.NewRequest(op, params, data)\n\n\treturn req\n}", "func (c *Client) newRequest(method, urlStr string, body io.Reader) (*http.Request, error) {\n\treq, err := http.NewRequest(method, urlStr, body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treq.Header.Set(\"api-name\", c.apiName)\n\treq.Header.Set(\"api-key\", c.apiKey)\n\treq.Header.Set(c.userHeader, c.user)\n\treturn req, nil\n}", "func (c *ElastiCache) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\t// Run custom request initialization if present\n\tif initRequest != nil {\n\t\tinitRequest(req)\n\t}\n\n\treturn req\n}", "func (s *AuthnReqListsService) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := s.NewRequest(op, params, data)\n\n\treturn req\n}", "func NewCreatePostRequestBody()(*CreatePostRequestBody) {\n m := &CreatePostRequestBody{\n }\n m.SetAdditionalData(make(map[string]interface{}));\n return m\n}", "func (s *HighAvailabilityService) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := s.NewRequest(op, params, data)\n\n\treturn req\n}", "func (c *InputService17ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "func (m *MobileAppAssignmentItemRequestBuilder) CreateGetRequestInformation(ctx context.Context, requestConfiguration *MobileAppAssignmentItemRequestBuilderGetRequestConfiguration)(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) {\n requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation()\n requestInfo.UrlTemplate = m.urlTemplate\n requestInfo.PathParameters = m.pathParameters\n requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET\n requestInfo.Headers[\"Accept\"] = \"application/json\"\n if requestConfiguration != nil {\n if requestConfiguration.QueryParameters != nil {\n requestInfo.AddQueryParameters(*(requestConfiguration.QueryParameters))\n }\n requestInfo.AddRequestHeaders(requestConfiguration.Headers)\n requestInfo.AddRequestOptions(requestConfiguration.Options)\n }\n return requestInfo, nil\n}", "func (m *FeatureRolloutPolicyItemRequestBuilder) CreateGetRequestInformation(ctx context.Context, requestConfiguration *FeatureRolloutPolicyItemRequestBuilderGetRequestConfiguration)(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) {\n requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation()\n requestInfo.UrlTemplate = m.urlTemplate\n requestInfo.PathParameters = m.pathParameters\n requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET\n requestInfo.Headers[\"Accept\"] = \"application/json\"\n if requestConfiguration != nil {\n if requestConfiguration.QueryParameters != nil {\n requestInfo.AddQueryParameters(*(requestConfiguration.QueryParameters))\n }\n requestInfo.AddRequestHeaders(requestConfiguration.Headers)\n requestInfo.AddRequestOptions(requestConfiguration.Options)\n }\n return requestInfo, nil\n}", "func (adm AdminClient) newRequest(method string, reqData requestData) (req *http.Request, err error) {\n\t// If no method is supplied default to 'POST'.\n\tif method == \"\" {\n\t\tmethod = \"POST\"\n\t}\n\n\t// Default all requests to \"\"\n\tlocation := \"\"\n\n\t// Construct a new target URL.\n\ttargetURL, err := adm.makeTargetURL(reqData)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Initialize a new HTTP request for the method.\n\treq, err = http.NewRequest(method, targetURL.String(), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tadm.setUserAgent(req)\n\tfor k, v := range reqData.customHeaders {\n\t\treq.Header.Set(k, v[0])\n\t}\n\tif length := len(reqData.content); length > 0 {\n\t\treq.ContentLength = int64(length)\n\t}\n\treq.Header.Set(\"X-Amz-Content-Sha256\", hex.EncodeToString(sum256(reqData.content)))\n\treq.Body = ioutil.NopCloser(bytes.NewReader(reqData.content))\n\n\treq = s3signer.SignV4(*req, adm.accessKeyID, adm.secretAccessKey, \"\", location)\n\treturn req, nil\n}", "func (s *SitesService) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := s.NewRequest(op, params, data)\n\n\treturn req\n}", "func NewRequest(url string, branch string, author string, email string, date string, deps *[]Request) *Request {\n\treturn &Request{\n\t\turl,\n\t\tbranch,\n\t\tauthor,\n\t\temail,\n\t\tdate,\n\t\tdeps,\n\t}\n}", "func New(handler http.Handler) *Request {\n\tapiTest := &APITest{}\n\n\trequest := &Request{apiTest: apiTest}\n\tresponse := &Response{apiTest: apiTest}\n\tapiTest.request = request\n\tapiTest.response = response\n\tapiTest.handler = handler\n\n\treturn apiTest.request\n}", "func (s APIv1) NewRequest(ctx context.Context, method, path string, data interface{}) (req *http.Request, err error) {\n\t// Resolve the URL reference from the path\n\tendpoint := s.endpoint.ResolveReference(&url.URL{Path: path})\n\n\tvar body io.ReadWriter\n\tif data != nil {\n\t\tbody = &bytes.Buffer{}\n\t\tif err = json.NewEncoder(body).Encode(data); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"could not serialize request data: %s\", err)\n\t\t}\n\t} else {\n\t\tbody = nil\n\t}\n\n\t// Create the http request\n\tif req, err = http.NewRequestWithContext(ctx, method, endpoint.String(), body); err != nil {\n\t\treturn nil, fmt.Errorf(\"could not create request: %s\", err)\n\t}\n\n\t// Set the headers on the request\n\treq.Header.Add(\"User-Agent\", \"Whisper/1.0\")\n\treq.Header.Add(\"Accept\", \"application/json\")\n\treq.Header.Add(\"Accept-Language\", \"en-US,en\")\n\treq.Header.Add(\"Accept-Encoding\", \"gzip, deflate, br\")\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\n\treturn req, nil\n}", "func (s *AccessRequestSuite) TestRequestMarshaling(c *C) {\n\treq1, err := NewAccessRequest(\"some-user\", \"role-1\", \"role-2\")\n\tc.Assert(err, IsNil)\n\n\tmarshaled, err := GetAccessRequestMarshaler().MarshalAccessRequest(req1)\n\tc.Assert(err, IsNil)\n\n\treq2, err := GetAccessRequestMarshaler().UnmarshalAccessRequest(marshaled)\n\tc.Assert(err, IsNil)\n\n\tif !req1.Equals(req2) {\n\t\tc.Errorf(\"unexpected inequality %+v <---> %+v\", req1, req2)\n\t}\n}", "func (api CachetBackend) NewRequest(requestType, url string, reqBody []byte) (*http.Response, interface{}, error) {\n\treq, err := http.NewRequest(requestType, api.URL+url, bytes.NewBuffer(reqBody))\n\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"X-Cachet-Token\", api.Token)\n\n\ttransport := http.DefaultTransport.(*http.Transport)\n\ttransport.TLSClientConfig = &tls.Config{InsecureSkipVerify: api.Insecure}\n\tclient := &http.Client{\n\t\tTransport: transport,\n\t}\n\n\tres, err := client.Do(req)\n\tif err != nil {\n\t\treturn nil, CachetResponse{}, err\n\t}\n\tdefer res.Body.Close()\n\tdefer req.Body.Close()\n\n\tvar body struct {\n\t\tData json.RawMessage `json:\"data\"`\n\t}\n\terr = json.NewDecoder(res.Body).Decode(&body)\n\n\treturn res, body, err\n}", "func (b *AccessReviewRequestBuilder) Copy(object *AccessReviewRequest) *AccessReviewRequestBuilder {\n\tif object == nil {\n\t\treturn b\n\t}\n\tb.bitmap_ = object.bitmap_\n\tb.accountUsername = object.accountUsername\n\tb.action = object.action\n\tb.clusterID = object.clusterID\n\tb.clusterUUID = object.clusterUUID\n\tb.organizationID = object.organizationID\n\tb.resourceType = object.resourceType\n\tb.subscriptionID = object.subscriptionID\n\treturn b\n}", "func NewInboundRequest(\n baseRequest *http.Request,\n pathParams PathParams,\n) *InboundRequest {\n req := &InboundRequest{\n Request: *baseRequest,\n PathParams: pathParams,\n }\n return req\n}", "func (m *DirectoryRequestBuilder) CreateGetRequestInformation(ctx context.Context, requestConfiguration *DirectoryRequestBuilderGetRequestConfiguration)(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) {\n requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation()\n requestInfo.UrlTemplate = m.urlTemplate\n requestInfo.PathParameters = m.pathParameters\n requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET\n requestInfo.Headers[\"Accept\"] = \"application/json\"\n if requestConfiguration != nil {\n if requestConfiguration.QueryParameters != nil {\n requestInfo.AddQueryParameters(*(requestConfiguration.QueryParameters))\n }\n requestInfo.AddRequestHeaders(requestConfiguration.Headers)\n requestInfo.AddRequestOptions(requestConfiguration.Options)\n }\n return requestInfo, nil\n}", "func (m *AssignmentPoliciesRequestBuilder) CreatePostRequestInformation(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.AccessPackageAssignmentPolicyable, requestConfiguration *AssignmentPoliciesRequestBuilderPostRequestConfiguration)(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) {\n requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation()\n requestInfo.UrlTemplate = m.urlTemplate\n requestInfo.PathParameters = m.pathParameters\n requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.POST\n requestInfo.Headers[\"Accept\"] = \"application/json\"\n requestInfo.SetContentFromParsable(ctx, m.requestAdapter, \"application/json\", body)\n if requestConfiguration != nil {\n requestInfo.AddRequestHeaders(requestConfiguration.Headers)\n requestInfo.AddRequestOptions(requestConfiguration.Options)\n }\n return requestInfo, nil\n}", "func (m *DeviceCompliancePolicyStateItemRequestBuilder) CreateGetRequestInformation(ctx context.Context, requestConfiguration *DeviceCompliancePolicyStateItemRequestBuilderGetRequestConfiguration)(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) {\n requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation()\n requestInfo.UrlTemplate = m.urlTemplate\n requestInfo.PathParameters = m.pathParameters\n requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET\n requestInfo.Headers[\"Accept\"] = \"application/json\"\n if requestConfiguration != nil {\n if requestConfiguration.QueryParameters != nil {\n requestInfo.AddQueryParameters(*(requestConfiguration.QueryParameters))\n }\n requestInfo.AddRequestHeaders(requestConfiguration.Headers)\n requestInfo.AddRequestOptions(requestConfiguration.Options)\n }\n return requestInfo, nil\n}", "func (c *InputService18ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "func (c *InputService4ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "func (c *InputService4ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "func (c *InputService2ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "func (c *InputService2ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "func NewRequest() *Request {\n\treturn &Request{}\n}", "func NewRequest() *Request {\n\treturn &Request{}\n}", "func (m *EducationAssignmentItemRequestBuilder) CreateGetRequestInformation(ctx context.Context, requestConfiguration *EducationAssignmentItemRequestBuilderGetRequestConfiguration)(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) {\n requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation()\n requestInfo.UrlTemplate = m.urlTemplate\n requestInfo.PathParameters = m.pathParameters\n requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET\n requestInfo.Headers[\"Accept\"] = \"application/json\"\n if requestConfiguration != nil {\n if requestConfiguration.QueryParameters != nil {\n requestInfo.AddQueryParameters(*(requestConfiguration.QueryParameters))\n }\n requestInfo.AddRequestHeaders(requestConfiguration.Headers)\n requestInfo.AddRequestOptions(requestConfiguration.Options)\n }\n return requestInfo, nil\n}", "func (c *InputService1ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "func (c *InputService1ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "func (c *Client) newRequest(ctx context.Context, method, url string, body io.Reader) (*http.Request, error) {\n\t// Build new request with base URL.\n\treq, err := http.NewRequest(method, c.URL+url, body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Set API key in header.\n\tif user := wtf.UserFromContext(ctx); user != nil && user.APIKey != \"\" {\n\t\treq.Header.Set(\"Authorization\", \"Bearer \"+user.APIKey)\n\t}\n\n\t// Default to JSON format.\n\treq.Header.Set(\"Accept\", \"application/json\")\n\treq.Header.Set(\"Content-type\", \"application/json\")\n\n\treturn req, nil\n}", "func (c *InputService20ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "func (c *Client) NewRequest(method, pathStr string, body interface{}) (*http.Request, error) {\n\tc.URL.Path = path.Join(c.URL.Path, pathStr)\n\n\tbuf := new(bytes.Buffer)\n\tif body != nil {\n\t\terr := json.NewEncoder(buf).Encode(body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treq, err := http.NewRequest(method, c.URL.String(), buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treq.Header.Add(\"x-access-token\", c.Token)\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\treturn req, nil\n}", "func NewRequest(path string, mode xrdfs.OpenMode, options xrdfs.OpenOptions) *Request {\n\treturn &Request{Mode: mode, Options: options, Path: path}\n}", "func NewRequest() *Request {\n\treturn &Request{\n\t\tCounter: 1,\n\t\tURLStruct: &url.URL{},\n\t\tHeader: make(http.Header),\n\t\tPathParams: make(map[string]string),\n\t}\n}", "func NewEmptyReq() *Request {\n\treturn &Request{\n\t\targuments: make(map[string]string),\n\t\trequired: []string{},\n\t}\n}", "func (c client) newRequest(ctx context.Context, method string, url string, body io.Reader) (*http.Request, error) {\n\treq, err := http.NewRequestWithContext(ctx, method, url, body)\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to build request %w\", err)\n\t}\n\n\treturn req, nil\n}", "func (c *OutputService12ProtocolTest) newRequest(op *aws.Operation, params, data interface{}) *aws.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "func NewAccessRequestWithResources(user string, roles []string, resourceIDs []types.ResourceID) (types.AccessRequest, error) {\n\treq, err := types.NewAccessRequestWithResources(uuid.New().String(), user, roles, resourceIDs)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tif err := ValidateAccessRequest(req); err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\treturn req, nil\n}", "func NewRequest(id, replyTo string, object ObjectID, method string, args ...interface{}) (*Request, error) {\n\tinputs, err := newTuple(args...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Request{\n\t\tID: id,\n\t\tInputs: inputs,\n\t\tObject: object,\n\t\tReplyTo: replyTo,\n\t\tMethod: method,\n\t}, nil\n}", "func NewRequest(addr string, body []byte) *Request {\n\treturn &Request{\n\t\tAddr: addr,\n\t\tHeader: defaultHeader(len(body)),\n\t\tBody: body,\n\t}\n}", "func (s *ApplicationsService) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := s.NewRequest(op, params, data)\n\n\treturn req\n}", "func NewRequest(params interface{}, atta map[string]interface{}) *DubboRequest {\n\tif atta == nil {\n\t\tatta = make(map[string]interface{})\n\t}\n\treturn &DubboRequest{\n\t\tParams: params,\n\t\tAttachments: atta,\n\t}\n}", "func (c *Client) NewRequest(method, urlStr string, body io.Reader) (r *http.Request, err error) {\n\tif r, err = http.NewRequest(method, urlStr, body); err != nil {\n\t\treturn\n\t}\n\n\tr.Header.Set(\"User-Agent\", c.UserAgent)\n\tr.Header.Set(\"X-Requested-With\", \"XMLHttpRequest\")\n\n\tif c.ApiKey != nil {\n\t\tr.Header.Set(\"X-Sbss-Auth\", c.ApiKey.Login)\n\t\tr.AddCookie(c.ApiKey.Cookie)\n\t}\n\n\tif method == \"POST\" {\n\t\tr.Header.Set(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\t}\n\n\treturn\n}", "func (c *InputService15ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "func (c *InputService10ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "func (c *InputService3ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "func (c *InputService3ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}", "func (c *InputService19ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request {\n\treq := c.NewRequest(op, params, data)\n\n\treturn req\n}" ]
[ "0.70773953", "0.62430733", "0.6021073", "0.59515136", "0.57436895", "0.5722486", "0.5679566", "0.5665037", "0.5621523", "0.5596342", "0.5514844", "0.54962444", "0.54893196", "0.54850084", "0.547674", "0.54765916", "0.5463834", "0.54550326", "0.54514474", "0.5415297", "0.54082865", "0.540555", "0.5388275", "0.53646785", "0.53614986", "0.53387934", "0.53275126", "0.5326563", "0.5323231", "0.5307212", "0.5289213", "0.52729815", "0.5270081", "0.5268405", "0.52432936", "0.523225", "0.52206063", "0.52201474", "0.5208297", "0.52040464", "0.51867074", "0.51867074", "0.51864576", "0.5178681", "0.51727736", "0.516959", "0.51649076", "0.51585746", "0.51561135", "0.51535505", "0.51497906", "0.51470125", "0.51405036", "0.5139353", "0.51391274", "0.51268137", "0.5120822", "0.5117881", "0.51158607", "0.5115396", "0.51134574", "0.51095635", "0.51092076", "0.5105615", "0.5104494", "0.5103345", "0.50987184", "0.5095893", "0.5095461", "0.50943667", "0.5084773", "0.5079325", "0.5077819", "0.5077819", "0.5065163", "0.5065163", "0.5061783", "0.5061783", "0.50609195", "0.5057707", "0.5057707", "0.5038825", "0.50366473", "0.50363815", "0.50204355", "0.5019989", "0.50162685", "0.50160474", "0.50136316", "0.5012312", "0.50084925", "0.50059986", "0.4992847", "0.49919936", "0.49918595", "0.499154", "0.49908313", "0.49886578", "0.49886578", "0.49846458" ]
0.7723425
0
NewAccessRequestDataWithDefaults instantiates a new AccessRequestData object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set
func NewAccessRequestDataWithDefaults() *AccessRequestData { this := AccessRequestData{} return &this }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func NewAccessRequestData() *AccessRequestData {\n\tthis := AccessRequestData{}\n\treturn &this\n}", "func (o *CreateAccessPolicyParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func NewLoginRequestWithDefaults() *LoginRequest {\n\tthis := LoginRequest{}\n\treturn &this\n}", "func initPageRequestDefaults(pageRequest *PageRequest) *PageRequest {\n\t// if the PageRequest is nil, use default PageRequest\n\tif pageRequest == nil {\n\t\tpageRequest = &PageRequest{}\n\t}\n\n\tpageRequestCopy := *pageRequest\n\tif len(pageRequestCopy.Key) == 0 {\n\t\tpageRequestCopy.Key = nil\n\t}\n\n\tif pageRequestCopy.Limit == 0 {\n\t\tpageRequestCopy.Limit = DefaultLimit\n\n\t\t// count total results when the limit is zero/not supplied\n\t\tpageRequestCopy.CountTotal = true\n\t}\n\n\treturn &pageRequestCopy\n}", "func NewAllocationRequestWithDefaults() *AllocationRequest {\n\tthis := AllocationRequest{}\n\treturn &this\n}", "func NewSuperKeyRequestWithDefaults() *SuperKeyRequest {\n\tthis := SuperKeyRequest{}\n\treturn &this\n}", "func (r *GetRequest) setDefaults(cfg *RequestConfig) {\n\tif r.Timeout == 0 {\n\t\tr.Timeout = cfg.DefaultRequestTimeout()\n\t}\n\n\tif r.Consistency == 0 {\n\t\tr.Consistency = cfg.DefaultConsistency()\n\t}\n}", "func (o *ExportUsingGETParams) SetDefaults() {\n\tvar (\n\t\tendpointsDefault = string(\"Jenkins, Jira\")\n\n\t\tpipelineDefault = string(\"Deploy Production\")\n\n\t\tpipelinesDefault = string(\"Deploy Production, Dev\")\n\n\t\tprojectDefault = string(\"Project-1\")\n\t)\n\n\tval := ExportUsingGETParams{\n\t\tEndpoints: &endpointsDefault,\n\t\tPipeline: &pipelineDefault,\n\t\tPipelines: &pipelinesDefault,\n\t\tProject: &projectDefault,\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 *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 (e *RegisterRequest) SetDefaults() {\n}", "func DefaultRequest() Request {\n\treturn Request{\n\t\tName: \"\",\n\n\t\tOwner: \"\",\n\n\t\tKubernetesVersion: \"\",\n\n\t\tMasters: []request.Master{},\n\t\tVault: request.DefaultVault(),\n\t\tWorkers: []request.Worker{},\n\t}\n}", "func (m *DepositRequestMeta) New() service.DataObject {\n\treturn &DepositRequest{}\n}", "func NewAccessFeaturesWithDefaults() *AccessFeatures {\n\tthis := AccessFeatures{}\n\treturn &this\n}", "func NewRequestData() *RequestData {\n\treturn &RequestData{\n\t\tVer: 2,\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 *HandleGetAboutUsingGETParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func NewNodeRequestWithDefaults() *NodeRequest {\n\tthis := NodeRequest{}\n\treturn &this\n}", "func (o *GetContentSourceUsingGETParams) 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 NewLoginRequestResponseDataWithDefaults() *LoginRequestResponseData {\n\tthis := LoginRequestResponseData{}\n\treturn &this\n}", "func NewAssignmentDefaultsRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*AssignmentDefaultsRequestBuilder) {\n urlParams := make(map[string]string)\n urlParams[\"request-raw-url\"] = rawUrl\n return NewAssignmentDefaultsRequestBuilderInternal(urlParams, requestAdapter)\n}", "func (o *CreateInstantPaymentParams) SetDefaults() {\n\tvar (\n\t\texternalPaymentDefault = bool(false)\n\t)\n\n\tval := CreateInstantPaymentParams{\n\t\tExternalPayment: &externalPaymentDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "func NewAccessKeyWithDefaults() *AccessKey {\n\tthis := AccessKey{}\n\treturn &this\n}", "func (o *ActionDeploymentRequestUsingPOST2Params) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func DefaultConfigRequest() *ConfigRequest {\n\tc := NewConfigRequest()\n\tc.V1.Sys.Service.Host = w.String(\"127.0.0.1\")\n\tc.V1.Sys.Service.Port = w.Int32(10131)\n\tc.V1.Sys.Log.Level = w.String(\"info\")\n\tc.V1.Sys.Log.Format = w.String(\"text\")\n\tc.V1.Sys.Storage.Database = w.String(\"secrets_service\")\n\tc.V1.Sys.Storage.User = w.String(\"secrets\")\n\treturn c\n}", "func NewAccessReviewRequest() *AccessReviewRequestBuilder {\n\treturn &AccessReviewRequestBuilder{}\n}", "func (o *FileInfoCreateParams) SetDefaults() {\n\tvar (\n\t\treturnRecordsDefault = bool(false)\n\t)\n\n\tval := FileInfoCreateParams{\n\t\tReturnRecords: &returnRecordsDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "func NewPasswordResetRequestWithDefaults() *PasswordResetRequest {\n\tthis := PasswordResetRequest{}\n\treturn &this\n}", "func NewAssignmentDefaultsRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*AssignmentDefaultsRequestBuilder) {\n m := &AssignmentDefaultsRequestBuilder{\n }\n m.urlTemplate = \"{+baseurl}/education/classes/{educationClass%2Did}/assignmentDefaults{?%24select,%24expand}\";\n urlTplParams := make(map[string]string)\n for idx, item := range pathParameters {\n urlTplParams[idx] = item\n }\n m.pathParameters = urlTplParams;\n m.requestAdapter = requestAdapter;\n return m\n}", "func (o *RetrieveCustomerGroupParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func NewCreateUserRequestWithDefaults() *CreateUserRequest {\n\tthis := CreateUserRequest{}\n\treturn &this\n}", "func NewTaskRequestWithDefaults() *TaskRequest {\n\tthis := TaskRequest{}\n\treturn &this\n}", "func (o *SecurityCertificateCollectionGetParams) SetDefaults() {\n\tvar (\n\t\treturnRecordsDefault = bool(true)\n\n\t\treturnTimeoutDefault = int64(15)\n\t)\n\n\tval := SecurityCertificateCollectionGetParams{\n\t\tReturnRecords: &returnRecordsDefault,\n\t\tReturnTimeout: &returnTimeoutDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "func NewReadConsumptionAccountRequestWithDefaults() *ReadConsumptionAccountRequest {\n\tthis := ReadConsumptionAccountRequest{}\n\tvar overall bool = false\n\tthis.Overall = &overall\n\treturn &this\n}", "func NewOAuth2ConsentRequestWithDefaults() *OAuth2ConsentRequest {\n\tthis := OAuth2ConsentRequest{}\n\treturn &this\n}", "func (r *RequestBody) AddDefaults() {\n\tif r.DomainScope == \"\" {\n\t\tr.DomainScope = \"annotated\"\n\t}\n\tif len(r.Background) > 0 && r.DomainScope != \"custom\" {\n\t\tr.DomainScope = \"custom\"\n\t}\n\n\tif r.Organism == \"\" {\n\t\tr.Organism = \"hsapiens\"\n\t}\n\n\tif r.SignificanceThresholdMethod == \"\" {\n\t\tr.SignificanceThresholdMethod = \"gSCS\"\n\t}\n\n\tif r.UserThreshold == 0 {\n\t\tr.UserThreshold = 0.01\n\t}\n}", "func (o *PredictParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func UnmarshalAccessRequest(data []byte, opts ...MarshalOption) (types.AccessRequest, error) {\n\tcfg, err := CollectOptions(opts)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tvar req types.AccessRequestV3\n\tif err := utils.FastUnmarshal(data, &req); err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tif err := ValidateAccessRequest(&req); err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\tif cfg.ID != 0 {\n\t\treq.SetResourceID(cfg.ID)\n\t}\n\tif !cfg.Expires.IsZero() {\n\t\treq.SetExpiry(cfg.Expires)\n\t}\n\treturn &req, nil\n}", "func NewLinkPrivateIpsRequestWithDefaults() *LinkPrivateIpsRequest {\n\tthis := LinkPrivateIpsRequest{}\n\treturn &this\n}", "func (o *TestEndpointParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *IgroupInitiatorCreateParams) SetDefaults() {\n\tvar (\n\t\treturnRecordsDefault = bool(false)\n\t)\n\n\tval := IgroupInitiatorCreateParams{\n\t\tReturnRecords: &returnRecordsDefault,\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 *FreezeParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func fillRequestDataInternal(span *tracepb.Span, data *contracts.RequestData) {\n\t// Everything is a custom attribute here\n\tfor k, v := range span.Attributes.AttributeMap {\n\t\tsetAttributeValueAsPropertyOrMeasurement(k, v, data.Properties, data.Measurements)\n\t}\n}", "func NewNewDataWithDefaults() *NewData {\n\tthis := NewData{}\n\treturn &this\n}", "func NewApiResponseWithDefaults() *ApiResponse {\n this := ApiResponse{}\n return &this\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 *AccountCollectionGetParams) SetDefaults() {\n\tvar (\n\t\treturnRecordsDefault = bool(true)\n\n\t\treturnTimeoutDefault = int64(15)\n\t)\n\n\tval := AccountCollectionGetParams{\n\t\tReturnRecords: &returnRecordsDefault,\n\t\tReturnTimeout: &returnTimeoutDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "func (o *GetGCParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *IpsecCaCertificateGetParams) 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 NewAccessRequest(user string, roles ...string) (types.AccessRequest, error) {\n\treturn NewAccessRequestWithResources(user, roles, []types.ResourceID{})\n}", "func (o *GetFqdnCacheParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *ExtractionListV1Params) SetDefaults() {\n\tvar (\n\t\tlimitDefault = int64(0)\n\t)\n\n\tval := ExtractionListV1Params{\n\t\tLimit: &limitDefault,\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 *GetCountersParams) SetDefaults() {\n\tvar (\n\t\tnodewiseDefault = bool(false)\n\t)\n\n\tval := GetCountersParams{\n\t\tNodewise: &nodewiseDefault,\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 *PayAllInvoicesParams) SetDefaults() {\n\tvar (\n\t\texternalPaymentDefault = bool(false)\n\t)\n\n\tval := PayAllInvoicesParams{\n\t\tExternalPayment: &externalPaymentDefault,\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 *CreateTenantParams) SetDefaults() {\n\tvar (\n\t\tuseGlobalDefaultDefault = bool(false)\n\t)\n\n\tval := CreateTenantParams{\n\t\tUseGlobalDefault: &useGlobalDefaultDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "func (m *AssignmentDefaultsRequestBuilder) CreateGetRequestInformation(ctx context.Context, requestConfiguration *AssignmentDefaultsRequestBuilderGetRequestConfiguration)(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) {\n requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation()\n requestInfo.UrlTemplate = m.urlTemplate\n requestInfo.PathParameters = m.pathParameters\n requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET\n requestInfo.Headers[\"Accept\"] = \"application/json\"\n if requestConfiguration != nil {\n if requestConfiguration.QueryParameters != nil {\n requestInfo.AddQueryParameters(*(requestConfiguration.QueryParameters))\n }\n requestInfo.AddRequestHeaders(requestConfiguration.Headers)\n requestInfo.AddRequestOptions(requestConfiguration.Options)\n }\n return requestInfo, nil\n}", "func (m *TransferRequestMeta) New() service.DataObject {\n\treturn &TransferRequest{}\n}", "func (o *FileInfoCollectionGetParams) SetDefaults() {\n\tvar (\n\t\treturnMetadataDefault = bool(false)\n\n\t\treturnRecordsDefault = bool(true)\n\n\t\treturnTimeoutDefault = int64(15)\n\t)\n\n\tval := FileInfoCollectionGetParams{\n\t\tReturnMetadata: &returnMetadataDefault,\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 CreatePolicyWithDefaults(nbmaster string, httpClient *http.Client, jwt string) {\r\n fmt.Printf(\"\\nSending a POST request to create %s with defaults...\\n\", testPolicyName)\r\n\r\n policy := map[string]interface{}{\r\n \"data\": map[string]interface{}{\r\n \"type\": \"policy\",\r\n \"id\": testPolicyName,\r\n \"attributes\": map[string]interface{}{\r\n \"policy\": map[string]interface{}{\r\n \"policyName\": testPolicyName,\r\n \"policyType\": \"VMware\",\r\n \"policyAttributes\": map[string]interface{}{},\r\n \"clients\":[]interface{}{},\r\n \"schedules\":[]interface{}{},\r\n \"backupSelections\": map[string]interface{}{\r\n \"selections\": []interface{}{}}}}}}\r\n\r\n policyRequest, _ := json.Marshal(policy)\r\n\r\n uri := \"https://\" + nbmaster + \":\" + port + \"/netbackup/\" + policiesUri\r\n\r\n request, _ := http.NewRequest(http.MethodPost, uri, bytes.NewBuffer(policyRequest))\r\n request.Header.Add(\"Content-Type\", contentTypeV2);\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 create policy.\\n\")\r\n } else {\r\n if response.StatusCode != 204 {\r\n printErrorResponse(response)\r\n } else {\r\n fmt.Printf(\"%s created successfully.\\n\", testPolicyName);\r\n responseDetails, _ := httputil.DumpResponse(response, true);\r\n fmt.Printf(string(responseDetails))\r\n }\r\n }\r\n}", "func (m *NewWalletRequestMeta) New() service.DataObject {\n\treturn &NewWalletRequest{}\n}", "func (o *Entry) Defaults() {\n if o.Type == \"\" {\n o.Type = \"ipv4\"\n }\n\n if o.ToInterface == \"\" {\n o.ToInterface = \"any\"\n }\n\n if o.Service == \"\" {\n o.Service = \"any\"\n }\n\n if len(o.SourceAddresses) == 0 {\n o.SourceAddresses = []string{\"any\"}\n }\n\n if len(o.DestinationAddresses) == 0 {\n o.DestinationAddresses = []string{\"any\"}\n }\n\n if o.SatType == \"\" {\n o.SatType = None\n }\n\n if o.DatType == \"\" {\n o.DatType = DatTypeStatic\n }\n}", "func NewCustomfieldRequestWithDefaults() *CustomfieldRequest {\n\tthis := CustomfieldRequest{}\n\treturn &this\n}", "func (o *RegenerateDeployKeyParams) 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 (b *AccessReviewRequestBuilder) Build() (object *AccessReviewRequest, err error) {\n\tobject = new(AccessReviewRequest)\n\tobject.bitmap_ = b.bitmap_\n\tobject.accountUsername = b.accountUsername\n\tobject.action = b.action\n\tobject.clusterID = b.clusterID\n\tobject.clusterUUID = b.clusterUUID\n\tobject.organizationID = b.organizationID\n\tobject.resourceType = b.resourceType\n\tobject.subscriptionID = b.subscriptionID\n\treturn\n}", "func (o *ConfigurationBackupGetParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *IndicatorCreateV1Params) SetDefaults() {\n\tvar (\n\t\tignoreWarningsDefault = bool(false)\n\t)\n\n\tval := IndicatorCreateV1Params{\n\t\tIgnoreWarnings: &ignoreWarningsDefault,\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 *GetGatewaysParams) 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 *GetGdprClientsIDParams) 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 NewClusterRequestWithDefaults() *ClusterRequest {\n\tthis := ClusterRequest{}\n\tvar cpu float32 = 250\n\tthis.Cpu = &cpu\n\tvar memory float32 = 256\n\tthis.Memory = &memory\n\tvar minRunningNodes int32 = 1\n\tthis.MinRunningNodes = &minRunningNodes\n\tvar maxRunningNodes int32 = 1\n\tthis.MaxRunningNodes = &maxRunningNodes\n\treturn &this\n}", "func (o *CreateAccessPolicyParams) WithDefaults() *CreateAccessPolicyParams {\n\to.SetDefaults()\n\treturn o\n}", "func (o *CreateGitWebhookUsingPOSTParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetCurrentGenerationParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func NewCopyToDefaultContentLocationPostRequestBody()(*CopyToDefaultContentLocationPostRequestBody) {\n m := &CopyToDefaultContentLocationPostRequestBody{\n }\n m.SetAdditionalData(make(map[string]interface{}));\n return m\n}", "func NewDefaults() map[string]interface{} {\n\tdefaults := make(map[string]interface{})\n\n\tdefaults[authPostgresURI] = \"postgresql://postgres:postgres@localhost:5432/test?sslmode=disable\"\n\tdefaults[authMigrationVersion] = 0\n\n\tdefaults[gatewayAddr] = \":10000\"\n\tdefaults[gatewayEndpoint] = \"/graphql\"\n\tdefaults[gatewayServePlayground] = true\n\tdefaults[gatewayPlaygroundEndpoint] = \"/playground\"\n\tdefaults[gatewayEnableIntrospection] = true\n\n\tdefaults[seedUserLogin] = \"root\"\n\tdefaults[seedUserPassword] = \"root\"\n\tdefaults[seedRoleTitle] = \"ROOT\"\n\tdefaults[seedRoleSuper] = true\n\n\tdefaults[sessionAccessTokenTTL] = 1000000\n\tdefaults[sessionRefreshTokenTTl] = 5000000\n\n\treturn defaults\n}", "func (o *GetTerraformConfigurationSourcesUsingGET1Params) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func NewGoogleCloudWriteRolesetRequestWithDefaults() *GoogleCloudWriteRolesetRequest {\n\tvar this GoogleCloudWriteRolesetRequest\n\n\tthis.SecretType = \"access_token\"\n\n\treturn &this\n}", "func (o *GetDistrictForSchoolParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func NewTokenLookUpAccessorRequestWithDefaults() *TokenLookUpAccessorRequest {\n\tvar this TokenLookUpAccessorRequest\n\n\treturn &this\n}", "func (o *ServiceInstanceGetParams) 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 NewApplicationStorageRequestWithDefaults() *ApplicationStorageRequest {\n\tthis := ApplicationStorageRequest{}\n\treturn &this\n}", "func (o *BudgetAddParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func NewCreateRouteRequestWithDefaults() *CreateRouteRequest {\n\tthis := CreateRouteRequest{}\n\treturn &this\n}", "func (c *MakeRequestController) New() {\n\tc.AppCtx.UpdateMDR(models.EmptyMakeRequestData())\n\tc.AppCtx.RefreshViews(\"request\")\n}", "func (o *BucketsCollectionGetParams) SetDefaults() {\n\tvar (\n\t\treturnRecordsDefault = bool(true)\n\n\t\treturnTimeoutDefault = int64(15)\n\t)\n\n\tval := BucketsCollectionGetParams{\n\t\tReturnRecords: &returnRecordsDefault,\n\t\tReturnTimeout: &returnTimeoutDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "func (o *MetroclusterInterconnectGetParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func SetDefaultAttributes(attrOriginal map[string]string) (map[string]string, error) {\n\tattr := make(map[string]string)\n\tfor k, v := range attrOriginal {\n\t\tattr[k] = v\n\t}\n\n\tsetDefaultIfEmpty(attr, csiapi.IssuerKindKey, cmapi.IssuerKind)\n\tsetDefaultIfEmpty(attr, csiapi.IssuerGroupKey, certmanager.GroupName)\n\n\tsetDefaultIfEmpty(attr, csiapi.IsCAKey, \"false\")\n\tsetDefaultIfEmpty(attr, csiapi.DurationKey, cmapi.DefaultCertificateDuration.String())\n\n\tsetDefaultIfEmpty(attr, csiapi.CAFileKey, \"ca.crt\")\n\tsetDefaultIfEmpty(attr, csiapi.CertFileKey, \"tls.crt\")\n\tsetDefaultIfEmpty(attr, csiapi.KeyFileKey, \"tls.key\")\n\n\tsetDefaultIfEmpty(attr, csiapi.KeyUsagesKey, strings.Join([]string{string(cmapi.UsageDigitalSignature), string(cmapi.UsageKeyEncipherment)}, \",\"))\n\n\treturn attr, nil\n}", "func (o *ResetPasswordTokenParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *GetTrafficFilterClaimedLinkIdsParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o *CloudTargetCreateParams) SetDefaults() {\n\tvar (\n\t\treturnRecordsDefault = bool(false)\n\n\t\treturnTimeoutDefault = int64(0)\n\t)\n\n\tval := CloudTargetCreateParams{\n\t\tReturnRecords: &returnRecordsDefault,\n\t\tReturnTimeout: &returnTimeoutDefault,\n\t}\n\n\tval.timeout = o.timeout\n\tval.Context = o.Context\n\tval.HTTPClient = o.HTTPClient\n\t*o = val\n}", "func (o *GetUserAuditLogsConnectionParams) SetDefaults() {\n\tvar (\n\t\tcontentLanguageDefault = string(\"en-US\")\n\t)\n\n\tval := GetUserAuditLogsConnectionParams{\n\t\tContentLanguage: &contentLanguageDefault,\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 *QtreeCollectionGetParams) SetDefaults() {\n\tvar (\n\t\treturnRecordsDefault = bool(true)\n\n\t\treturnTimeoutDefault = int64(15)\n\t)\n\n\tval := QtreeCollectionGetParams{\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 NewPrinterDefaults()(*PrinterDefaults) {\n m := &PrinterDefaults{\n }\n m.backingStore = ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e.BackingStoreFactoryInstance();\n m.SetAdditionalData(make(map[string]any))\n return m\n}", "func CreateBaseRequest(method, url string, body []byte, user m.AuthUser, verbose bool) *http.Request {\n\treq, err := http.NewRequest(method, url, bytes.NewBuffer(body))\n\treq.SetBasicAuth(user.Username, user.Password)\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"Accept\", \"application/json\")\n\tError(err, \"Error creating the request\")\n\n\tif verbose {\n\t\tfmt.Println(\"Request Url:\", req.URL)\n\t\tfmt.Println(\"Request Headers:\", req.Header)\n\t\tfmt.Println(\"Request Body:\", req.Body)\n\t}\n\n\treturn req\n}", "func (o *PostAttendanceHourlyPaidLeaveParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func NewGroupInviteRequestWithDefaults() *GroupInviteRequest {\n\tthis := GroupInviteRequest{}\n\treturn &this\n}" ]
[ "0.68916595", "0.61028165", "0.60329545", "0.5949014", "0.56278986", "0.5589424", "0.55564666", "0.55461293", "0.5533971", "0.55131054", "0.5509075", "0.54883885", "0.54741454", "0.5457445", "0.5451151", "0.5448829", "0.5437979", "0.5434451", "0.5433248", "0.5414379", "0.54025227", "0.54021585", "0.5377895", "0.5356416", "0.531846", "0.53146666", "0.53094333", "0.5281829", "0.5281629", "0.5250323", "0.5250143", "0.5234157", "0.52211183", "0.5219827", "0.5216783", "0.5214213", "0.5213404", "0.5192637", "0.51916146", "0.5180357", "0.51778984", "0.51738286", "0.5171112", "0.516815", "0.5159072", "0.5158762", "0.5158254", "0.51325005", "0.513242", "0.5121322", "0.5115351", "0.5114989", "0.5113086", "0.5108465", "0.5104886", "0.51009417", "0.5100588", "0.50934285", "0.5093158", "0.50910056", "0.507851", "0.5074807", "0.50733316", "0.50635", "0.5048188", "0.50469303", "0.50382966", "0.5038158", "0.50321627", "0.502273", "0.5021954", "0.50187176", "0.50145906", "0.5013628", "0.5003314", "0.4999929", "0.49940366", "0.49899203", "0.49859744", "0.4983595", "0.49826193", "0.49708286", "0.4964046", "0.49528825", "0.49492624", "0.49386823", "0.4931551", "0.49264732", "0.49252126", "0.49226356", "0.49210748", "0.49161655", "0.49128327", "0.4909766", "0.4907184", "0.49051747", "0.49000123", "0.48979312", "0.48925692", "0.48672456" ]
0.81297594
0
GetRequestId returns the RequestId field value if set, zero value otherwise.
func (o *AccessRequestData) GetRequestId() string { if o == nil || o.RequestId == nil { var ret string return ret } return *o.RequestId }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *ApplianceDeviceClaimAllOf) GetRequestId() string {\n\tif o == nil || o.RequestId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.RequestId\n}", "func (o *AssetReportFreddieGetResponse) GetRequestId() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.RequestId\n}", "func (o *Cause) GetRequestId() string {\n\tif o == nil || o.RequestId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.RequestId\n}", "func (o *PaymentInitiationPaymentGetResponse) GetRequestId() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.RequestId\n}", "func (o *WatchlistScreeningIndividualUpdateResponse) GetRequestId() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.RequestId\n}", "func (o *PartnerCustomerCreateResponse) GetRequestId() string {\n\tif o == nil || o.RequestId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.RequestId\n}", "func (o *WatchlistScreeningIndividualReviewCreateResponse) GetRequestId() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.RequestId\n}", "func (m *ServicePrincipalRiskDetection) GetRequestId()(*string) {\n val, err := m.GetBackingStore().Get(\"requestId\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func (o *TransferSweepListResponse) GetRequestId() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.RequestId\n}", "func (o *ApplianceDeviceClaimAllOf) SetRequestId(v string) {\n\to.RequestId = &v\n}", "func (o *WalletTransactionsListResponse) GetRequestId() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.RequestId\n}", "func (s *StartRunInput) SetRequestId(v string) *StartRunInput {\n\ts.RequestId = &v\n\treturn s\n}", "func (o *AssetReportFreddieGetResponse) SetRequestId(v string) {\n\to.RequestId = v\n}", "func (o *PartnerCustomerCreateResponse) SetRequestId(v string) {\n\to.RequestId = &v\n}", "func (o *PaymentInitiationPaymentGetResponse) SetRequestId(v string) {\n\to.RequestId = v\n}", "func (o *Cause) SetRequestId(v string) {\n\to.RequestId = &v\n}", "func (s *DataLakeUpdateStatus) SetRequestId(v string) *DataLakeUpdateStatus {\n\ts.RequestId = &v\n\treturn s\n}", "func (s *CreateRunGroupInput) SetRequestId(v string) *CreateRunGroupInput {\n\ts.RequestId = &v\n\treturn s\n}", "func (s *CreateWorkflowInput) SetRequestId(v string) *CreateWorkflowInput {\n\ts.RequestId = &v\n\treturn s\n}", "func (o *AccessRequestData) SetRequestId(v string) {\n\to.RequestId = &v\n}", "func (o *WatchlistScreeningIndividualUpdateResponse) SetRequestId(v string) {\n\to.RequestId = v\n}", "func (o *WatchlistScreeningIndividualReviewCreateResponse) SetRequestId(v string) {\n\to.RequestId = v\n}", "func (o *WalletTransactionsListResponse) SetRequestId(v string) {\n\to.RequestId = v\n}", "func (o *AccessRequestData) GetRequestIdOk() (*string, bool) {\n\tif o == nil || o.RequestId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.RequestId, true\n}", "func (o *TransferSweepListResponse) SetRequestId(v string) {\n\to.RequestId = v\n}", "func (o RegionAutoscalerOutput) RequestId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *RegionAutoscaler) pulumi.StringPtrOutput { return v.RequestId }).(pulumi.StringPtrOutput)\n}", "func (o *AssetReportFreddieGetResponse) GetRequestIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.RequestId, true\n}", "func (o *Cause) GetRequestIdOk() (*string, bool) {\n\tif o == nil || o.RequestId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.RequestId, true\n}", "func (o *ApplianceDeviceClaimAllOf) GetRequestIdOk() (*string, bool) {\n\tif o == nil || o.RequestId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.RequestId, true\n}", "func (o *AccessRequestData) HasRequestId() bool {\n\tif o != nil && o.RequestId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o TestMatrixOutput) RequestId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *TestMatrix) pulumi.StringPtrOutput { return v.RequestId }).(pulumi.StringPtrOutput)\n}", "func (client *ClientImpl) GetRequestsRequestId(ctx context.Context, args GetRequestsRequestIdArgs) (*Request, error) {\n\trouteValues := make(map[string]string)\n\tif args.RequestId == nil || *args.RequestId == \"\" {\n\t\treturn nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: \"args.RequestId\"}\n\t}\n\trouteValues[\"requestId\"] = *args.RequestId\n\n\tlocationId, _ := uuid.Parse(\"ebc09fe3-1b20-4667-abc5-f2b60fe8de52\")\n\tresp, err := client.Client.Send(ctx, http.MethodGet, locationId, \"6.0-preview.1\", routeValues, nil, nil, \"\", \"application/json\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar responseValue Request\n\terr = client.Client.UnmarshalBody(resp, &responseValue)\n\treturn &responseValue, err\n}", "func (m *ServicePrincipalRiskDetection) SetRequestId(value *string)() {\n err := m.GetBackingStore().Set(\"requestId\", value)\n if err != nil {\n panic(err)\n }\n}", "func GetRequestID() int {\n\tmu.Lock()\n\tdefer mu.Unlock()\n\trequestID = requestID + 1\n\treturn requestID\n}", "func (c *chain) RequestId() string {\n\treturn c.JobChain.RequestId\n}", "func (o *Cause) HasRequestId() bool {\n\tif o != nil && o.RequestId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *WatchlistScreeningIndividualUpdateResponse) GetRequestIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.RequestId, true\n}", "func (o *WatchlistScreeningIndividualReviewCreateResponse) GetRequestIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.RequestId, true\n}", "func (o *ApplianceDeviceClaimAllOf) HasRequestId() bool {\n\tif o != nil && o.RequestId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (s *IpAddressInUse) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func GetRequestID(r *http.Request) string {\n\treturn r.Header.Get(\"X-Request-Id\")\n}", "func GetRequestID(ctx context.Context) int {\n\tif rv := ctx.Value(requestIDKey); rv != nil {\n\t\tif id, ok := rv.(int); ok {\n\t\t\treturn id\n\t\t}\n\t}\n\n\treturn -1\n}", "func (o TargetProjectOutput) RequestId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *TargetProject) pulumi.StringPtrOutput { return v.RequestId }).(pulumi.StringPtrOutput)\n}", "func (o *PaymentInitiationPaymentGetResponse) GetRequestIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.RequestId, true\n}", "func (m MetaData) GetRequestID() string {\n\tif len(m) == 0 {\n\t\treturn \"\"\n\t}\n\treturn m[\"x-request-id\"]\n}", "func (o AppGatewayOutput) RequestId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *AppGateway) pulumi.StringPtrOutput { return v.RequestId }).(pulumi.StringPtrOutput)\n}", "func (o *PartnerCustomerCreateResponse) GetRequestIdOk() (*string, bool) {\n\tif o == nil || o.RequestId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.RequestId, true\n}", "func (o *TransferSweepListResponse) GetRequestIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.RequestId, true\n}", "func (o SslCertificateOutput) RequestId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SslCertificate) pulumi.StringPtrOutput { return v.RequestId }).(pulumi.StringPtrOutput)\n}", "func (o *PartnerCustomerCreateResponse) HasRequestId() bool {\n\tif o != nil && o.RequestId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (s *NoFreeAddressesInSubnet) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (o JobOutput) ClientRequestId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Job) pulumi.StringOutput { return v.ClientRequestId }).(pulumi.StringOutput)\n}", "func (o NetworkAttachmentOutput) RequestId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *NetworkAttachment) pulumi.StringPtrOutput { return v.RequestId }).(pulumi.StringPtrOutput)\n}", "func (self *ProxyRequest) requestId() string {\n\n\tt := time.Now().Local()\n\n\t// This should provide an extremely low chance to create race conditions.\n\tname := fmt.Sprintf(\n\t\t\"%s-%04d%02d%02d-%02d%02d%02d-%09d\",\n\t\tself.Request.Method,\n\t\tt.Year(),\n\t\tt.Month(),\n\t\tt.Day(),\n\t\tt.Hour(),\n\t\tt.Minute(),\n\t\tt.Second(),\n\t\tt.Nanosecond(),\n\t)\n\n\treturn name\n}", "func ContextRequestId(ctx context.Context) (requestId string) {\n\tif d, ok := ctx.Value(contextHandlerDetailsKey).(*handlerDetails); ok {\n\t\trequestId = d.requestId\n\t}\n\treturn\n}", "func GetRequestID(requestIDParams *string) string {\n\tlog.Debug(\"entering func getRequestID\")\n\t//generate UUID as request ID if it doesn't exist in request header\n\tif requestIDParams == nil || *requestIDParams == \"\" {\n\t\ttheUUID, err := uuid.NewUUID()\n\t\tnewUUID := \"\"\n\t\tif err == nil {\n\t\t\tnewUUID = theUUID.String()\n\t\t} else {\n\t\t\tnewUUID = GenerateUUID()\n\t\t}\n\t\trequestIDParams = &newUUID\n\t}\n\treturn *requestIDParams\n}", "func GetRequestID(ctx context.Context) string {\n\tid, ok := ctx.Value(contextKey(\"requestID\")).(string)\n\tif !ok {\n\t\tlogrus.Warn(\"requestID not found in context\")\n\t\treturn \"\"\n\t}\n\treturn id\n}", "func (m *Request) GetID() uint64 {\n\treturn m.RequestID\n}", "func (s *HomeRegionNotSetException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (o TargetPoolOutput) RequestId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *TargetPool) pulumi.StringPtrOutput { return v.RequestId }).(pulumi.StringPtrOutput)\n}", "func (s *InsufficientThroughputCapacity) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (o AddressGroupOutput) RequestId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *AddressGroup) pulumi.StringPtrOutput { return v.RequestId }).(pulumi.StringPtrOutput)\n}", "func GetRequestID(ctx context.Context) string {\n\n\treqID := ctx.Value(ContextKeyRequestID)\n\n\tif ret, ok := reqID.(string); ok {\n\t\treturn ret\n\t}\n\n\treturn \"\"\n}", "func (o VpnGatewayOutput) RequestId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *VpnGateway) pulumi.StringPtrOutput { return v.RequestId }).(pulumi.StringPtrOutput)\n}", "func (o *WalletTransactionsListResponse) GetRequestIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.RequestId, true\n}", "func (s *SecurityGroupNotFound) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (s *AccessPointAlreadyExists) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func GetRequestID(ctx context.Context) (string, bool) {\n\tv, ok := ctx.Value(RequestIDKey).(string)\n\treturn v, ok\n}", "func (si SignedIdentifiers) RequestID() string {\n\treturn si.rawResponse.Header.Get(\"x-ms-request-id\")\n}", "func GetRequestID(c echo.Context) string {\n\treturn c.Response().Header().Get(echo.HeaderXRequestID)\n}", "func (o ConnectorOutput) RequestId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Connector) pulumi.StringPtrOutput { return v.RequestId }).(pulumi.StringPtrOutput)\n}", "func GetRequestID(ctx context.Context) string {\n\tID := ctx.Value(RequestIDContextKey)\n\tif s, ok := ID.(string); ok {\n\t\treturn s\n\t}\n\treturn \"\"\n}", "func (rs *requestContext) RequestID() string {\n\treturn rs.requestID\n}", "func (s *TaskSetNotFoundException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (s *NonEmptyEntityException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (bstr BlobsSetTierResponse) RequestID() string {\n\treturn bstr.rawResponse.Header.Get(\"x-ms-request-id\")\n}", "func CtxRequestID(c *gin.Context) string {\n\t// first get from context\n\trequestidItf, _ := c.Get(RequestIDKey)\n\tif requestidItf != nil {\n\t\trequestid := requestidItf.(string)\n\t\tif requestid != \"\" {\n\t\t\treturn requestid\n\t\t}\n\t}\n\t// if not then get request id from header\n\trequestid := c.Request.Header.Get(RequestIDKey)\n\tif requestid != \"\" {\n\t\treturn requestid\n\t}\n\t// else gen a request id\n\treturn uuid.NewV4().String()\n}", "func (s *ServiceException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (s *InvalidTagException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (r *AnalyticsMetadata) RequestID() string {\n\treturn r.requestID\n}", "func (r requestError) RequestID() string {\n\treturn r.requestID\n}", "func (s *InsufficientCapacityException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (s *SubnetNotFound) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (s *MalformedArnException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (s *TagOperationException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (s *UtteranceSpecification) SetUtteranceRequestId(v string) *UtteranceSpecification {\n\ts.UtteranceRequestId = &v\n\treturn s\n}", "func (s *ResourceInUse) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func generateRequestId() uint64 {\n\tupdatedId := atomic.AddUint64(&internalAtomicIdCounter, 1)\n\treturn updatedId\n}", "func (s *ThroughputLimitExceeded) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (s *ClientException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (s *ClusterContainsServicesException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (s *OutboundContactNotPermittedException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (ssp StorageServiceProperties) RequestID() string {\n\treturn ssp.rawResponse.Header.Get(\"x-ms-request-id\")\n}", "func (s *InvalidRequestException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (s *ConstraintViolationException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (s *InvalidRequestException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (s *InvalidRequestException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (s *InvalidRequestException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (s *OrganizationalUnitNotEmptyException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}", "func (s *ResourceArnNotFoundException) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}" ]
[ "0.80236924", "0.7973879", "0.7956269", "0.77425015", "0.7711584", "0.7697002", "0.7656179", "0.7543845", "0.738762", "0.73301846", "0.72490346", "0.7243866", "0.7213403", "0.71987814", "0.717998", "0.71782213", "0.7157904", "0.7115722", "0.7044033", "0.70365447", "0.7031691", "0.69785106", "0.6939393", "0.6933844", "0.6918718", "0.68623745", "0.67583936", "0.67495203", "0.67295927", "0.6642131", "0.66156733", "0.6599548", "0.6555622", "0.6537608", "0.6518171", "0.6516736", "0.65021026", "0.6486773", "0.6436147", "0.6395411", "0.6393049", "0.63792735", "0.63665855", "0.6358565", "0.63542575", "0.6339005", "0.6325943", "0.6314952", "0.6270996", "0.6255641", "0.62433195", "0.62384254", "0.62109745", "0.62090755", "0.62041724", "0.61956507", "0.6170194", "0.61501807", "0.6147322", "0.6139407", "0.61306256", "0.61257166", "0.6121175", "0.6120877", "0.603879", "0.60235983", "0.6009811", "0.5995734", "0.59945136", "0.59854186", "0.59540623", "0.5950665", "0.59495777", "0.5946929", "0.5935712", "0.59327894", "0.5916487", "0.5908357", "0.5907075", "0.5905799", "0.5899238", "0.5897716", "0.5893382", "0.5887409", "0.588718", "0.5885338", "0.58802193", "0.5877924", "0.58730954", "0.5864522", "0.5861125", "0.5853071", "0.58440435", "0.5842965", "0.58417034", "0.5841253", "0.5841253", "0.5841253", "0.582036", "0.58032346" ]
0.83429796
0
GetRequestIdOk returns a tuple with the RequestId field value if set, nil otherwise and a boolean to check if the value has been set.
func (o *AccessRequestData) GetRequestIdOk() (*string, bool) { if o == nil || o.RequestId == nil { return nil, false } return o.RequestId, true }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *Cause) GetRequestIdOk() (*string, bool) {\n\tif o == nil || o.RequestId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.RequestId, true\n}", "func (o *ApplianceDeviceClaimAllOf) GetRequestIdOk() (*string, bool) {\n\tif o == nil || o.RequestId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.RequestId, true\n}", "func (o *AssetReportFreddieGetResponse) GetRequestIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.RequestId, true\n}", "func (o *WatchlistScreeningIndividualUpdateResponse) GetRequestIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.RequestId, true\n}", "func (o *WatchlistScreeningIndividualReviewCreateResponse) GetRequestIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.RequestId, true\n}", "func (o *PartnerCustomerCreateResponse) GetRequestIdOk() (*string, bool) {\n\tif o == nil || o.RequestId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.RequestId, true\n}", "func (o *PaymentInitiationPaymentGetResponse) GetRequestIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.RequestId, true\n}", "func (o *TransferSweepListResponse) GetRequestIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.RequestId, true\n}", "func (o *WalletTransactionsListResponse) GetRequestIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.RequestId, true\n}", "func (o *Cause) HasRequestId() bool {\n\tif o != nil && o.RequestId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *PartnerCustomerCreateResponse) HasRequestId() bool {\n\tif o != nil && o.RequestId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *AccessRequestData) HasRequestId() bool {\n\tif o != nil && o.RequestId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ApplianceDeviceClaimAllOf) HasRequestId() bool {\n\tif o != nil && o.RequestId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *AccessRequestData) GetRequestId() string {\n\tif o == nil || o.RequestId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.RequestId\n}", "func (o *WatchlistScreeningIndividualUpdateResponse) GetRequestId() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.RequestId\n}", "func (o *WatchlistScreeningIndividualReviewCreateResponse) GetRequestId() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.RequestId\n}", "func (o *PartnerCustomerCreateResponse) GetRequestId() string {\n\tif o == nil || o.RequestId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.RequestId\n}", "func (o *AssetReportFreddieGetResponse) GetRequestId() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.RequestId\n}", "func (o *PaymentInitiationPaymentGetResponse) GetRequestId() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.RequestId\n}", "func (o *ApplianceDeviceClaimAllOf) GetRequestId() string {\n\tif o == nil || o.RequestId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.RequestId\n}", "func (o *FiltersApiLog) GetRequestIdsOk() ([]string, bool) {\n\tif o == nil || o.RequestIds == nil {\n\t\tvar ret []string\n\t\treturn ret, false\n\t}\n\treturn *o.RequestIds, true\n}", "func (o *Cause) GetRequestId() string {\n\tif o == nil || o.RequestId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.RequestId\n}", "func (m *ServicePrincipalRiskDetection) GetRequestId()(*string) {\n val, err := m.GetBackingStore().Get(\"requestId\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func (o *ViewTag) GetIdOk() (*int32, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *SuperKeyRequest) GetSourceIdOk() (*string, bool) {\n\tif o == nil || o.SourceId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.SourceId, true\n}", "func (o *WalletTransactionsListResponse) GetRequestId() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.RequestId\n}", "func (o *TransferSweepListResponse) GetRequestId() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.RequestId\n}", "func (o *PartialApplicationKey) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *DnsViewparamDataData) GetServerIdOk() (*string, bool) {\n\tif o == nil || o.ServerId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ServerId, true\n}", "func (o *ViewCustomFieldTask) GetIdOk() (*int32, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *CreateTemplateRequestEntity) GetSnippetIdOk() (*string, bool) {\n\tif o == nil || o.SnippetId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.SnippetId, true\n}", "func (o *CredentialsResponseElement) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *ProjectApiKey) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *ReservationModel) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *ProdutoVM) GetIdOk() (*int64, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id.Get(), o.Id.IsSet()\n}", "func (o *WatchlistScreeningIndividualReviewCreateResponse) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *Vm) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *V1VolumeClaim) GetStackIdOk() (*string, bool) {\n\tif o == nil || o.StackId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.StackId, true\n}", "func (o *PostUserGroupAdminRequest) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *View) GetIdOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *ZoneZone) GetStackIdOk() (*string, bool) {\n\tif o == nil || o.StackId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.StackId, true\n}", "func (o *ProjectApiKey) GetOwnerIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.OwnerId, true\n}", "func (o *UpdateNetRequest) GetNetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.NetId, true\n}", "func (o *LoginRequest) GetSessionIdOk() (*string, bool) {\n\tif o == nil || o.SessionId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.SessionId, true\n}", "func (o *TenantExternalView) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *Environment) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *TenantWithOfferWeb) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *ClientProvidedEnhancedTransaction) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *DnsViewparamDataData) GetViewIdOk() (*string, bool) {\n\tif o == nil || o.ViewId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ViewId, true\n}", "func (o *VmRestorePoint) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *Invitation) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *SmscSession) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *ComputeBladeIdentityAllOf) GetSlotIdOk() (*int64, bool) {\n\tif o == nil || o.SlotId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.SlotId, true\n}", "func GetRequestID(ctx context.Context) (string, bool) {\n\tv, ok := ctx.Value(RequestIDKey).(string)\n\treturn v, ok\n}", "func (o *Metric) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *TfaCreateMessageRequest) GetSenderIdOk() (*string, bool) {\n\tif o == nil || o.SenderId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.SenderId, true\n}", "func (o *KanbanViewView) GetIdOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *ViewSampleProject) GetIdOk() (*int32, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *UiIntegrationCreatedModel) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *TokenResponse) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *InlineResponse200115) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *PaymentMethodCardRequest) GetTokenIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.TokenId, true\n}", "func (o *MicrosoftGraphSharedPcConfiguration) GetIdOk() (string, bool) {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Id, true\n}", "func (o *UserInvitationResponseData) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *SecurityGroup) GetNetIdOk() (*string, bool) {\n\tif o == nil || o.NetId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.NetId, true\n}", "func (o *VmResizeZone) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *ErrorResponseWeb) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *VerifiableAddress) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *PublicIp) GetVmIdOk() (*string, bool) {\n\tif o == nil || o.VmId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.VmId, true\n}", "func (o *LinkPublicIpRequest) GetNicIdOk() (*string, bool) {\n\tif o == nil || o.NicId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.NicId, true\n}", "func (o *ProcessorSignalDecisionReportRequest) GetClientIdOk() (*string, bool) {\n\tif o == nil || o.ClientId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ClientId, true\n}", "func (o *TfaApiRequestErrorDetails) GetMessageIdOk() (*string, bool) {\n\tif o == nil || o.MessageId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.MessageId, true\n}", "func (o *CheckoutResponse) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *Tag) GetIdOk() (int64, bool) {\n\tif o == nil || o.Id == nil {\n\t\tvar ret int64\n\t\treturn ret, false\n\t}\n\treturn *o.Id, true\n}", "func (o *ViewPortfolioCard) GetIdOk() (*int32, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *ParameterContextDTO) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *ModelsUser) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *PartnerCustomerCreateResponse) SetRequestId(v string) {\n\to.RequestId = &v\n}", "func ContextRequestId(ctx context.Context) (requestId string) {\n\tif d, ok := ctx.Value(contextHandlerDetailsKey).(*handlerDetails); ok {\n\t\trequestId = d.requestId\n\t}\n\treturn\n}", "func (o *LinkPublicIpRequest) GetVmIdOk() (*string, bool) {\n\tif o == nil || o.VmId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.VmId, true\n}", "func (o *StorageEnclosure) GetServerIdOk() (*int64, bool) {\n\tif o == nil || o.ServerId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ServerId, true\n}", "func (o RegionAutoscalerOutput) RequestId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *RegionAutoscaler) pulumi.StringPtrOutput { return v.RequestId }).(pulumi.StringPtrOutput)\n}", "func (o *Cluster) GetIdOk() (*int32, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *AccessKey) GetAccessKeyIdOk() (*string, bool) {\n\tif o == nil || o.AccessKeyId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.AccessKeyId, true\n}", "func (me *XsdGoPkgHasElem_RequestIdsequenceTxsdOperationRequestOperationRequestschema_RequestId_XsdtString_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_RequestIdsequenceTxsdOperationRequestOperationRequestschema_RequestId_XsdtString_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func (o *NodeRequest) GetParentNodeIdOk() (*string, bool) {\n\tif o == nil || o.ParentNodeId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ParentNodeId, true\n}", "func (o *Application) GetIdOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *UpdatePasswordReqWeb) GetTokenIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.TokenId, true\n}", "func (o *Snippet) GetIdOk() (*int32, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *PublicIp) GetNicIdOk() (*string, bool) {\n\tif o == nil || o.NicId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.NicId, true\n}", "func (o *PaymentInitiationPaymentGetResponse) SetRequestId(v string) {\n\to.RequestId = v\n}", "func (o *LinkPublicIpRequest) GetPublicIpIdOk() (*string, bool) {\n\tif o == nil || o.PublicIpId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.PublicIpId, true\n}", "func (o *LinkPrivateIpsRequest) GetNicIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.NicId, true\n}", "func (o *PublicIp) GetVmIdOk() (string, bool) {\n\tif o == nil || o.VmId == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.VmId, true\n}", "func (o *SessionDevice) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *WatchlistScreeningIndividualUpdateResponse) SetRequestId(v string) {\n\to.RequestId = v\n}", "func (o TargetProjectOutput) RequestId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *TargetProject) pulumi.StringPtrOutput { return v.RequestId }).(pulumi.StringPtrOutput)\n}", "func (o *AuthenticationResponse) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *Run) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (s *IpAddressInUse) RequestID() string {\n\treturn s.RespMetadata.RequestID\n}" ]
[ "0.81909347", "0.80314624", "0.7939465", "0.79343385", "0.7882382", "0.7867871", "0.7801602", "0.76795286", "0.7589354", "0.67871857", "0.6767483", "0.6743273", "0.6545468", "0.63314134", "0.6311387", "0.62682045", "0.6235779", "0.62147856", "0.62041295", "0.6178521", "0.61775845", "0.6176792", "0.6163466", "0.6101651", "0.6042166", "0.5993707", "0.5950606", "0.5950021", "0.5949224", "0.589604", "0.58897847", "0.5886315", "0.58659524", "0.58306795", "0.58256847", "0.58101934", "0.58014727", "0.5799331", "0.57783395", "0.5775887", "0.5754276", "0.5746104", "0.5745972", "0.57459486", "0.57386774", "0.573816", "0.57371116", "0.5716454", "0.57143134", "0.5712376", "0.57079667", "0.5700164", "0.56987804", "0.5698412", "0.5694803", "0.5689604", "0.5685342", "0.5681903", "0.5681229", "0.56743366", "0.56660223", "0.56649727", "0.566362", "0.56555164", "0.5650302", "0.5649248", "0.56459594", "0.5637341", "0.56353074", "0.56339985", "0.563375", "0.56243867", "0.5615076", "0.56123203", "0.5612303", "0.56111115", "0.56082386", "0.56018984", "0.5599356", "0.55957943", "0.5582451", "0.55779004", "0.5573453", "0.5571134", "0.5567323", "0.5563152", "0.5560746", "0.55571294", "0.5555682", "0.5548751", "0.5545061", "0.5544569", "0.5544073", "0.5537783", "0.5535828", "0.5535555", "0.5535086", "0.55242765", "0.552404", "0.55231875" ]
0.8303761
0
HasRequestId returns a boolean if a field has been set.
func (o *AccessRequestData) HasRequestId() bool { if o != nil && o.RequestId != nil { return true } return false }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *Cause) HasRequestId() bool {\n\tif o != nil && o.RequestId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *PartnerCustomerCreateResponse) HasRequestId() bool {\n\tif o != nil && o.RequestId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ApplianceDeviceClaimAllOf) HasRequestId() bool {\n\tif o != nil && o.RequestId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *SuperKeyRequest) HasSourceId() bool {\n\tif o != nil && o.SourceId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (m SecurityListRequest) HasSecurityReqID() bool {\n\treturn m.Has(tag.SecurityReqID)\n}", "func (o *V1VolumeClaim) HasStackId() bool {\n\tif o != nil && o.StackId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *AccessRequestData) GetRequestIdOk() (*string, bool) {\n\tif o == nil || o.RequestId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.RequestId, true\n}", "func (o *CreateTemplateRequestEntity) HasSnippetId() bool {\n\tif o != nil && o.SnippetId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Cause) GetRequestIdOk() (*string, bool) {\n\tif o == nil || o.RequestId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.RequestId, true\n}", "func (o *FiltersApiLog) HasRequestIds() bool {\n\tif o != nil && o.RequestIds != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (m OrderStatusRequest) HasSecurityID() bool {\n\treturn m.Has(tag.SecurityID)\n}", "func (o *VmRestorePoint) HasRegionId() bool {\n\tif o != nil && o.RegionId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *RequestIDOptions) IsUseRequestID() bool {\n\treturn o.useRequestID\n}", "func (m SecurityListRequest) HasSecurityID() bool {\n\treturn m.Has(tag.SecurityID)\n}", "func (o *TfaCreateMessageRequest) HasSenderId() bool {\n\tif o != nil && o.SenderId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (m OrderStatusRequest) HasClientID() bool {\n\treturn m.Has(tag.ClientID)\n}", "func (m OrderStatusRequest) HasClientID() bool {\n\treturn m.Has(tag.ClientID)\n}", "func (o *V1VirusDatasetRequest) HasTaxId() bool {\n\tif o != nil && o.TaxId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *TfaApiRequestErrorDetails) HasMessageId() bool {\n\tif o != nil && o.MessageId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *AssetReportFreddieGetResponse) GetRequestIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.RequestId, true\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 (m OrderStatusRequest) HasIDSource() bool {\n\treturn m.Has(tag.IDSource)\n}", "func (o *AccessKey) HasAccessKeyId() bool {\n\tif o != nil && o.AccessKeyId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ApplianceDeviceClaimAllOf) GetRequestIdOk() (*string, bool) {\n\tif o == nil || o.RequestId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.RequestId, true\n}", "func (o *LinkPublicIpRequest) HasPublicIpId() bool {\n\tif o != nil && o.PublicIpId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (f *FakeContext) RequestIDCalled() bool {\n\treturn len(f.RequestIDCalls) != 0\n}", "func (o *PartnerCustomerCreateResponse) GetRequestIdOk() (*string, bool) {\n\tif o == nil || o.RequestId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.RequestId, true\n}", "func (o *WatchlistScreeningIndividualReviewCreateResponse) GetRequestIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.RequestId, true\n}", "func (o *DnsViewparamDataData) HasServerId() bool {\n\tif o != nil && o.ServerId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (m SecurityListRequest) HasSecurityIDSource() bool {\n\treturn m.Has(tag.SecurityIDSource)\n}", "func (o *WatchlistScreeningIndividualUpdateResponse) GetRequestIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.RequestId, true\n}", "func (o *Ga4ghSearchRnaQuantificationsRequest) HasRnaQuantificationSetId() bool {\n\tif o != nil && o.RnaQuantificationSetId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *LinkPublicIpRequest) HasNicId() bool {\n\tif o != nil && o.NicId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *AccessRequestData) HasUserId() bool {\n\tif o != nil && o.UserId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (m CrossOrderCancelReplaceRequest) HasSecurityID() bool {\n\treturn m.Has(tag.SecurityID)\n}", "func (o *ZoneZone) HasStackId() bool {\n\tif o != nil && o.StackId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (f *FakeContext) WithRequestIDCalled() bool {\n\treturn len(f.WithRequestIDCalls) != 0\n}", "func (o *CreateRouteRequest) HasNicId() bool {\n\tif o != nil && o.NicId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Ga4ghSearchRnaQuantificationsRequest) HasSampleId() bool {\n\tif o != nil && o.SampleId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (m CrossOrderCancelReplaceRequest) HasRegistID() bool {\n\treturn m.Has(tag.RegistID)\n}", "func (o *ResourceVersion) HasResourceId() bool {\n\tif o != nil && o.ResourceId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *TaskCreateRequest) HasOrgID() bool {\n\tif o != nil && o.OrgID != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Run) HasRequestedAt() bool {\n\tif o != nil && o.RequestedAt != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *AccessRequestData) GetRequestId() string {\n\tif o == nil || o.RequestId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.RequestId\n}", "func (o *TenantWithOfferWeb) HasMasterApiKeyId() bool {\n\tif o != nil && o.MasterApiKeyId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ViewTag) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *LinkPublicIpRequest) HasVmId() bool {\n\tif o != nil && o.VmId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ImageImportOperation) HasUuid() bool {\n\tif o != nil && o.Uuid != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *CreateRouteRequest) HasVmId() bool {\n\tif o != nil && o.VmId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *NodeRequest) HasParentNodeId() bool {\n\tif o != nil && o.ParentNodeId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (m CrossOrderCancelReplaceRequest) HasSecurityIDSource() bool {\n\treturn m.Has(tag.SecurityIDSource)\n}", "func (o *PaymentInitiationPaymentGetResponse) GetRequestIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.RequestId, true\n}", "func (o *PartnerCustomerCreateResponse) GetRequestId() string {\n\tif o == nil || o.RequestId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.RequestId\n}", "func (o *DnsViewparamDataData) HasViewId() bool {\n\tif o != nil && o.ViewId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (m CrossOrderCancelReplaceRequest) HasCrossID() bool {\n\treturn m.Has(tag.CrossID)\n}", "func (o *ViewCustomFieldTask) HasCustomfieldId() bool {\n\tif o != nil && o.CustomfieldId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *PartnerCustomerCreateResponse) SetRequestId(v string) {\n\to.RequestId = &v\n}", "func (o *PartnerCustomerCreateRequest) HasClientId() bool {\n\tif o != nil && o.ClientId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *StorageEnclosure) HasServerId() bool {\n\tif o != nil && o.ServerId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Invoice) HasNip() bool {\n\tif o != nil && o.Nip != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *AssetReportFreddieGetResponse) GetRequestId() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.RequestId\n}", "func (f *FakeContext) RequestIDNotCalled() bool {\n\treturn len(f.RequestIDCalls) == 0\n}", "func (o *IppoolPoolMember) HasIpV4Address() bool {\n\tif o != nil && o.IpV4Address != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *WatchlistScreeningIndividualReviewCreateResponse) GetRequestId() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.RequestId\n}", "func (o *AssetReportFreddieGetResponse) SetRequestId(v string) {\n\to.RequestId = v\n}", "func (o *ActionDTO) HasSourceId() bool {\n\tif o != nil && o.SourceId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *RequestStatusMetadata) HasEtag() bool {\n\tif o != nil && o.Etag != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ViewCustomFieldTask) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *OpenapiTaskGenerationResult) HasTaskGenerationRequest() bool {\n\tif o != nil && o.TaskGenerationRequest != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (r Requests) HasRequest() bool {\n\treturn len(r) > 0\n}", "func (o *ProcessorSignalDecisionReportRequest) HasClientId() bool {\n\tif o != nil && o.ClientId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (m TradingSessionStatus) HasTradSesReqID() bool {\n\treturn m.Has(tag.TradSesReqID)\n}", "func (o *QueryTradeInfoRequest) HasPlatformID() bool {\n\tif o != nil && o.PlatformID != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *PaymentInitiationPaymentGetResponse) SetRequestId(v string) {\n\to.RequestId = v\n}", "func (o *ApplianceDeviceClaimAllOf) SetRequestId(v string) {\n\to.RequestId = &v\n}", "func (o *SubmitReplayRequestEntity) HasEventId() bool {\n\tif o != nil && o.EventId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *UserInvitationResponseData) HasId() bool {\n\treturn o != nil && o.Id != nil\n}", "func (o *CreateLoadBalancerRequest) HasPublicIp() bool {\n\tif o != nil && o.PublicIp != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *WatchlistScreeningIndividualReviewCreateResponse) SetRequestId(v string) {\n\to.RequestId = v\n}", "func (s *StartRunInput) SetRequestId(v string) *StartRunInput {\n\ts.RequestId = &v\n\treturn s\n}", "func (v *ServiceGenerator_Generate_Args) IsSetRequest() bool {\n\treturn v != nil && v.Request != nil\n}", "func (o *User) HasOnPremisesSecurityIdentifier() bool {\n\tif o != nil && o.OnPremisesSecurityIdentifier != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (m SecurityListRequest) HasInstrRegistry() bool {\n\treturn m.Has(tag.InstrRegistry)\n}", "func (o *Cause) SetRequestId(v string) {\n\to.RequestId = &v\n}", "func (o *AssetReportRefreshRequest) HasClientId() bool {\n\tif o != nil && o.ClientId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *WatchlistScreeningIndividualUpdateResponse) GetRequestId() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.RequestId\n}", "func (o *TaskRequest) HasTags() bool {\n\tif o != nil && o.Tags != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *BulletinDTO) HasSourceId() bool {\n\tif o != nil && o.SourceId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *WatchlistScreeningIndividualUpdateResponse) SetRequestId(v string) {\n\to.RequestId = v\n}", "func (s *DataLakeUpdateStatus) SetRequestId(v string) *DataLakeUpdateStatus {\n\ts.RequestId = &v\n\treturn s\n}", "func (m OrderStatusRequest) HasIssuer() bool {\n\treturn m.Has(tag.Issuer)\n}", "func (m OrderStatusRequest) HasIssuer() bool {\n\treturn m.Has(tag.Issuer)\n}", "func (o *SecurityGroup) HasNetId() bool {\n\tif o != nil && o.NetId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *SessionDevice) HasIpAddress() bool {\n\tif o != nil && o.IpAddress != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Run) HasTaskID() bool {\n\tif o != nil && o.TaskID != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *TransferSweepListResponse) GetRequestIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.RequestId, true\n}", "func (o *IdentityGetAccessTokenRequest) HasClientId() bool {\n\tif o != nil && o.ClientId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *UpdateLoadBalancerRequest) HasServerCertificateId() bool {\n\tif o != nil && o.ServerCertificateId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *WorkflowCatalogServiceRequest) HasUserIdOrEmail() bool {\n\tif o != nil && o.UserIdOrEmail != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *CredentialsResponseElement) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}" ]
[ "0.8441304", "0.8336792", "0.81253916", "0.6370415", "0.6300066", "0.6129372", "0.61130625", "0.610178", "0.60044104", "0.5998112", "0.59545314", "0.5939626", "0.5930549", "0.5883852", "0.588149", "0.5863278", "0.5863278", "0.586101", "0.58518714", "0.5781767", "0.5775306", "0.57664376", "0.5761088", "0.5754464", "0.57448494", "0.5739042", "0.5718374", "0.5708774", "0.56950545", "0.56927854", "0.5659742", "0.5658854", "0.5643677", "0.56350946", "0.56346047", "0.56337667", "0.5617831", "0.5609914", "0.5578948", "0.5575654", "0.55665207", "0.5546674", "0.5542936", "0.5535398", "0.55329925", "0.55267525", "0.5515336", "0.55120194", "0.5506108", "0.5499281", "0.548792", "0.5485738", "0.54850775", "0.548225", "0.54760605", "0.5452767", "0.54517174", "0.5447334", "0.5443836", "0.54357934", "0.54339874", "0.54315203", "0.5423618", "0.54217464", "0.54202175", "0.5401708", "0.53932106", "0.5389761", "0.5384726", "0.5373276", "0.53698176", "0.5368575", "0.53675485", "0.5364221", "0.53553057", "0.5353541", "0.5349161", "0.5348253", "0.53479666", "0.5347079", "0.5345488", "0.5334067", "0.53310263", "0.5325579", "0.53214216", "0.53212166", "0.5310989", "0.5306582", "0.53043485", "0.5303052", "0.52913445", "0.52913445", "0.52872705", "0.5281588", "0.52744424", "0.52743155", "0.5270163", "0.5268416", "0.5265995", "0.52646357" ]
0.8471667
0
SetRequestId gets a reference to the given string and assigns it to the RequestId field.
func (o *AccessRequestData) SetRequestId(v string) { o.RequestId = &v }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *ServicePrincipalRiskDetection) SetRequestId(value *string)() {\n err := m.GetBackingStore().Set(\"requestId\", value)\n if err != nil {\n panic(err)\n }\n}", "func (o *Cause) SetRequestId(v string) {\n\to.RequestId = &v\n}", "func (o *AssetReportFreddieGetResponse) SetRequestId(v string) {\n\to.RequestId = v\n}", "func (o *TransferSweepListResponse) SetRequestId(v string) {\n\to.RequestId = v\n}", "func (o *WatchlistScreeningIndividualReviewCreateResponse) SetRequestId(v string) {\n\to.RequestId = v\n}", "func (o *PartnerCustomerCreateResponse) SetRequestId(v string) {\n\to.RequestId = &v\n}", "func (o *ApplianceDeviceClaimAllOf) SetRequestId(v string) {\n\to.RequestId = &v\n}", "func (o *WatchlistScreeningIndividualUpdateResponse) SetRequestId(v string) {\n\to.RequestId = v\n}", "func (s *CreateWorkflowInput) SetRequestId(v string) *CreateWorkflowInput {\n\ts.RequestId = &v\n\treturn s\n}", "func (s *StartRunInput) SetRequestId(v string) *StartRunInput {\n\ts.RequestId = &v\n\treturn s\n}", "func (o *WalletTransactionsListResponse) SetRequestId(v string) {\n\to.RequestId = v\n}", "func (s *CreateRunGroupInput) SetRequestId(v string) *CreateRunGroupInput {\n\ts.RequestId = &v\n\treturn s\n}", "func (o *PaymentInitiationPaymentGetResponse) SetRequestId(v string) {\n\to.RequestId = v\n}", "func (s *DataLakeUpdateStatus) SetRequestId(v string) *DataLakeUpdateStatus {\n\ts.RequestId = &v\n\treturn s\n}", "func SetRequestID(ctx context.Context, id int) context.Context {\n\treturn context.WithValue(ctx, requestIDKey, id)\n}", "func SetRequestID(c context.Context, requestID string) context.Context {\n\treturn context.WithValue(c, contextKeyRequestID, requestID)\n}", "func (s *GetTableRestoreStatusInput) SetTableRestoreRequestId(v string) *GetTableRestoreStatusInput {\n\ts.TableRestoreRequestId = &v\n\treturn s\n}", "func (options *GetCustomizationRequestByIdOptions) SetRequestID(requestID string) *GetCustomizationRequestByIdOptions {\n\toptions.RequestID = core.StringPtr(requestID)\n\treturn options\n}", "func (s *TableRestoreStatus) SetTableRestoreRequestId(v string) *TableRestoreStatus {\n\ts.TableRestoreRequestId = &v\n\treturn s\n}", "func (o *ActionDeploymentRequestUsingPOST2Params) SetRequestID(requestID strfmt.UUID) {\n\to.RequestID = requestID\n}", "func SetCtxRequestID(c *gin.Context, requestid string) {\n\t// set in context\n\tc.Set(RequestIDKey, requestid)\n\t// set in header\n\tc.Writer.Header().Set(RequestIDKey, requestid)\n}", "func (p *Order) SetRequestID(id string) error {\n\tobjID, err := primitive.ObjectIDFromHex(id)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tp.RequestID = objID\n\treturn nil\n}", "func (s *UtteranceSpecification) SetUtteranceRequestId(v string) *UtteranceSpecification {\n\ts.UtteranceRequestId = &v\n\treturn s\n}", "func (o *AccessRequestData) GetRequestId() string {\n\tif o == nil || o.RequestId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.RequestId\n}", "func (request *DomainRegisterRequest) SetRequestID(value int64) {\n\trequest.ProxyMessage.SetRequestID(value)\n}", "func (o *AssetReportFreddieGetResponse) GetRequestId() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.RequestId\n}", "func (s *ResolverRule) SetCreatorRequestId(v string) *ResolverRule {\n\ts.CreatorRequestId = &v\n\treturn s\n}", "func (s *ResolverRule) SetCreatorRequestId(v string) *ResolverRule {\n\ts.CreatorRequestId = &v\n\treturn s\n}", "func (tu *TransactionUpdate) SetRequestID(id uuid.UUID) *TransactionUpdate {\n\ttu.mutation.SetRequestID(id)\n\treturn tu\n}", "func (o *Cause) GetRequestId() string {\n\tif o == nil || o.RequestId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.RequestId\n}", "func (tuo *TransactionUpdateOne) SetRequestID(id uuid.UUID) *TransactionUpdateOne {\n\ttuo.mutation.SetRequestID(id)\n\treturn tuo\n}", "func (l *LogRequest) SetRequestID(id string) {\n\tl.RequestID = id\n}", "func (s *CreateResolverRuleInput) SetCreatorRequestId(v string) *CreateResolverRuleInput {\n\ts.CreatorRequestId = &v\n\treturn s\n}", "func (s *CreateResolverRuleInput) SetCreatorRequestId(v string) *CreateResolverRuleInput {\n\ts.CreatorRequestId = &v\n\treturn s\n}", "func (o *WatchlistScreeningIndividualReviewCreateResponse) GetRequestId() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.RequestId\n}", "func SetCtxRequestID(ctx context.Context, uuid string) context.Context {\n\treturn context.WithValue(ctx, contextKeyRequestID, uuid)\n}", "func SetID(ctx context.Context, requestID string) context.Context {\n\treturn context.WithValue(ctx, requestIDKey, requestID)\n}", "func (o *WatchlistScreeningIndividualUpdateResponse) GetRequestId() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.RequestId\n}", "func SetRequestUUID(correlationHeader string) gin.HandlerFunc {\n\treturn func(c *gin.Context) {\n\t\tu := c.Request.Header.Get(correlationHeader)\n\t\tif u == \"\" {\n\t\t\tu = uuid.NewV4().String()\n\t\t}\n\t\tcontextLogger := logrus.WithField(\"uuid\", u)\n\t\tc.Set(LogKey, contextLogger)\n\t\tc.Set(ContextKey, u)\n\t}\n}", "func (_f18 *FakeContext) SetRequestIDStub(ident1 string) {\n\t_f18.RequestIDHook = func() string {\n\t\treturn ident1\n\t}\n}", "func (s *FirewallRule) SetCreatorRequestId(v string) *FirewallRule {\n\ts.CreatorRequestId = &v\n\treturn s\n}", "func (s *ResolverQueryLogConfig) SetCreatorRequestId(v string) *ResolverQueryLogConfig {\n\ts.CreatorRequestId = &v\n\treturn s\n}", "func (s *CreateResolverQueryLogConfigInput) SetCreatorRequestId(v string) *CreateResolverQueryLogConfigInput {\n\ts.CreatorRequestId = &v\n\treturn s\n}", "func (o *ApplianceDeviceClaimAllOf) GetRequestId() string {\n\tif o == nil || o.RequestId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.RequestId\n}", "func (s *CreateFirewallRuleInput) SetCreatorRequestId(v string) *CreateFirewallRuleInput {\n\ts.CreatorRequestId = &v\n\treturn s\n}", "func (m *Request) SetID(id uint64) {\n\tm.RequestID = id\n}", "func WithRequestID(ctx context.Context, requestID string) context.Context {\n\treturn context.WithValue(ctx, RequestIDKey, requestID)\n}", "func (client *ClientImpl) UpdateRequestsRequestId(ctx context.Context, args UpdateRequestsRequestIdArgs) (*Request, error) {\n\tif args.UpdateRequest == nil {\n\t\treturn nil, &azuredevops.ArgumentNilError{ArgumentName: \"args.UpdateRequest\"}\n\t}\n\trouteValues := make(map[string]string)\n\tif args.RequestId == nil || *args.RequestId == \"\" {\n\t\treturn nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: \"args.RequestId\"}\n\t}\n\trouteValues[\"requestId\"] = *args.RequestId\n\n\tbody, marshalErr := json.Marshal(*args.UpdateRequest)\n\tif marshalErr != nil {\n\t\treturn nil, marshalErr\n\t}\n\tlocationId, _ := uuid.Parse(\"ebc09fe3-1b20-4667-abc5-f2b60fe8de52\")\n\tresp, err := client.Client.Send(ctx, http.MethodPatch, locationId, \"6.0-preview.1\", routeValues, nil, bytes.NewReader(body), \"application/json\", \"application/json\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar responseValue Request\n\terr = client.Client.UnmarshalBody(resp, &responseValue)\n\treturn &responseValue, err\n}", "func ContextRequestId(ctx context.Context) (requestId string) {\n\tif d, ok := ctx.Value(contextHandlerDetailsKey).(*handlerDetails); ok {\n\t\trequestId = d.requestId\n\t}\n\treturn\n}", "func (s *FirewallRuleGroup) SetCreatorRequestId(v string) *FirewallRuleGroup {\n\ts.CreatorRequestId = &v\n\treturn s\n}", "func (s *FirewallRuleGroupMetadata) SetCreatorRequestId(v string) *FirewallRuleGroupMetadata {\n\ts.CreatorRequestId = &v\n\treturn s\n}", "func (reply *DomainDescribeReply) SetRequestID(value int64) {\n\treply.ProxyMessage.SetRequestID(value)\n}", "func (s *OutpostResolver) SetCreatorRequestId(v string) *OutpostResolver {\n\ts.CreatorRequestId = &v\n\treturn s\n}", "func (s *CreateResolverEndpointInput) SetCreatorRequestId(v string) *CreateResolverEndpointInput {\n\ts.CreatorRequestId = &v\n\treturn s\n}", "func (s *CreateResolverEndpointInput) SetCreatorRequestId(v string) *CreateResolverEndpointInput {\n\ts.CreatorRequestId = &v\n\treturn s\n}", "func (s *CreateFirewallRuleGroupInput) SetCreatorRequestId(v string) *CreateFirewallRuleGroupInput {\n\ts.CreatorRequestId = &v\n\treturn s\n}", "func (s *FirewallRuleGroupAssociation) SetCreatorRequestId(v string) *FirewallRuleGroupAssociation {\n\ts.CreatorRequestId = &v\n\treturn s\n}", "func (s *ResolverEndpoint) SetCreatorRequestId(v string) *ResolverEndpoint {\n\ts.CreatorRequestId = &v\n\treturn s\n}", "func (s *ResolverEndpoint) SetCreatorRequestId(v string) *ResolverEndpoint {\n\ts.CreatorRequestId = &v\n\treturn s\n}", "func (s *CreateOutpostResolverInput) SetCreatorRequestId(v string) *CreateOutpostResolverInput {\n\ts.CreatorRequestId = &v\n\treturn s\n}", "func (m *AmazonResourceEvidence) SetAmazonResourceId(value *string)() {\n err := m.GetBackingStore().Set(\"amazonResourceId\", value)\n if err != nil {\n panic(err)\n }\n}", "func (s *CreateFirewallDomainListInput) SetCreatorRequestId(v string) *CreateFirewallDomainListInput {\n\ts.CreatorRequestId = &v\n\treturn s\n}", "func (s *FirewallDomainList) SetCreatorRequestId(v string) *FirewallDomainList {\n\ts.CreatorRequestId = &v\n\treturn s\n}", "func (o RegionAutoscalerOutput) RequestId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *RegionAutoscaler) pulumi.StringPtrOutput { return v.RequestId }).(pulumi.StringPtrOutput)\n}", "func (s *AssociateFirewallRuleGroupInput) SetCreatorRequestId(v string) *AssociateFirewallRuleGroupInput {\n\ts.CreatorRequestId = &v\n\treturn s\n}", "func (o *PartnerCustomerCreateResponse) GetRequestId() string {\n\tif o == nil || o.RequestId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.RequestId\n}", "func (r *InvokeRequest) SetRegionId(regionId string) {\n r.RegionId = regionId\n}", "func WithRequestID(ctx context.Context, requestID eh.UUID) context.Context {\n\treturn context.WithValue(ctx, requestIDKey, requestID)\n}", "func (o *GetEventLogsUsingGETParams) SetRequestID(requestID strfmt.UUID) {\n\to.RequestID = requestID\n}", "func (s *FirewallDomainListMetadata) SetCreatorRequestId(v string) *FirewallDomainListMetadata {\n\ts.CreatorRequestId = &v\n\treturn s\n}", "func (o *DeleteBlueprintRequestUsingDELETE1Params) SetRequestID(requestID strfmt.UUID) {\n\to.RequestID = requestID\n}", "func WithRequestID(ctx context.Context, reqid string) context.Context {\n\treturn context.WithValue(ctx, reqidKey, reqid)\n}", "func WithRequestID(ctx context.Context, requestId string) context.Context {\n\tif gCtx, ok := ctx.(*gin.Context); ok {\n\t\tctx = gCtx.Request.Context()\n\t}\n\treturn context.WithValue(ctx, requestIdKey, requestId)\n}", "func (e *engine) setRequestID(ctx *Context) {\n\tif ess.IsStrEmpty(ctx.Req.Header.Get(e.requestIDHeader)) {\n\t\tctx.Req.Header.Set(e.requestIDHeader, ess.NewGUID())\n\t} else {\n\t\tlog.Debugf(\"Request already has ID: %v\", ctx.Req.Header.Get(e.requestIDHeader))\n\t}\n\tctx.Reply().Header(e.requestIDHeader, ctx.Req.Header.Get(e.requestIDHeader))\n}", "func (s *DescribeCreateAccountStatusInput) SetCreateAccountRequestId(v string) *DescribeCreateAccountStatusInput {\n\ts.CreateAccountRequestId = &v\n\treturn s\n}", "func (db *DB) SetRequest(req record.Request) (*record.ID, error) {\n\tvar (\n\t\tid *record.ID\n\t\terr error\n\t)\n\ttxerr := db.Update(func(tx *TransactionManager) error {\n\t\tid, err = tx.SetRequest(req)\n\t\treturn err\n\t})\n\tif txerr != nil {\n\t\treturn nil, txerr\n\t}\n\treturn id, nil\n}", "func (o TestMatrixOutput) RequestId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *TestMatrix) pulumi.StringPtrOutput { return v.RequestId }).(pulumi.StringPtrOutput)\n}", "func (o *PaymentInitiationPaymentGetResponse) GetRequestId() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.RequestId\n}", "func (o *SyncStatusUsingGETParams) SetRequestID(requestID string) {\n\to.RequestID = requestID\n}", "func (client *ClientImpl) DeleteRequestsRequestId(ctx context.Context, args DeleteRequestsRequestIdArgs) error {\n\trouteValues := make(map[string]string)\n\tif args.RequestId == nil || *args.RequestId == \"\" {\n\t\treturn &azuredevops.ArgumentNilOrEmptyError{ArgumentName: \"args.RequestId\"}\n\t}\n\trouteValues[\"requestId\"] = *args.RequestId\n\n\tqueryParams := url.Values{}\n\tif args.Synchronous != nil {\n\t\tqueryParams.Add(\"synchronous\", strconv.FormatBool(*args.Synchronous))\n\t}\n\tlocationId, _ := uuid.Parse(\"ebc09fe3-1b20-4667-abc5-f2b60fe8de52\")\n\t_, err := client.Client.Send(ctx, http.MethodDelete, locationId, \"6.0-preview.1\", routeValues, queryParams, nil, \"\", \"application/json\", nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func (m *Response) SetID(id uint64) {\n\tm.RequestID = id\n}", "func (s *SessionSpecification) SetOriginatingRequestId(v string) *SessionSpecification {\n\ts.OriginatingRequestId = &v\n\treturn s\n}", "func (o *TransferSweepListResponse) GetRequestId() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.RequestId\n}", "func (client *ClientImpl) GetRequestsRequestId(ctx context.Context, args GetRequestsRequestIdArgs) (*Request, error) {\n\trouteValues := make(map[string]string)\n\tif args.RequestId == nil || *args.RequestId == \"\" {\n\t\treturn nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: \"args.RequestId\"}\n\t}\n\trouteValues[\"requestId\"] = *args.RequestId\n\n\tlocationId, _ := uuid.Parse(\"ebc09fe3-1b20-4667-abc5-f2b60fe8de52\")\n\tresp, err := client.Client.Send(ctx, http.MethodGet, locationId, \"6.0-preview.1\", routeValues, nil, nil, \"\", \"application/json\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar responseValue Request\n\terr = client.Client.UnmarshalBody(resp, &responseValue)\n\treturn &responseValue, err\n}", "func (c *ProjectsLocationsMigrationJobsPatchCall) RequestId(requestId string) *ProjectsLocationsMigrationJobsPatchCall {\n\tc.urlParams_.Set(\"requestId\", requestId)\n\treturn c\n}", "func assignRequestID(r *http.Request) *http.Request {\n\tctx := c.AddRequestIDToCTX(r.Context(), uuid.New().String())\n\treturn r.WithContext(ctx)\n}", "func (_f54 *FakeContext) SetWithRequestIDStub(ident2 Context) {\n\t_f54.WithRequestIDHook = func(string) Context {\n\t\treturn ident2\n\t}\n}", "func UseRequestID(headerName string) func(http.Handler) http.Handler {\n\tf := func(h http.Handler) http.Handler {\n\t\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\t\tvar reqID string\n\t\t\tif reqID = r.Header.Get(headerName); reqID == \"\" {\n\t\t\t\t// first occurrence\n\t\t\t\treqID = pkg.GenerateNewStringUUID()\n\t\t\t}\n\t\t\tctx := r.Context()\n\t\t\tctx = context.WithValue(ctx, pkg.RequestID, reqID)\n\n\t\t\t// setup logger\n\t\t\trequestLogger := log.WithField(pkg.RequestID, reqID)\n\t\t\tctx = context.WithValue(ctx, pkg.RequestID, requestLogger)\n\n\t\t\th.ServeHTTP(w, r.WithContext(ctx))\n\t\t}\n\t\treturn http.HandlerFunc(fn)\n\t}\n\treturn f\n}", "func (o TargetPoolOutput) RequestId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *TargetPool) pulumi.StringPtrOutput { return v.RequestId }).(pulumi.StringPtrOutput)\n}", "func (c *chain) RequestId() string {\n\treturn c.JobChain.RequestId\n}", "func (_f55 *FakeContext) SetWithRequestIDInvocation(calls_f56 []*ContextWithRequestIDInvocation, fallback_f57 func() Context) {\n\t_f55.WithRequestIDHook = func(ident1 string) (ident2 Context) {\n\t\tfor _, call := range calls_f56 {\n\t\t\tif reflect.DeepEqual(call.Parameters.Ident1, ident1) {\n\t\t\t\tident2 = call.Results.Ident2\n\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\treturn fallback_f57()\n\t}\n}", "func (c *ProjectsLocationsMigrationJobsCreateCall) RequestId(requestId string) *ProjectsLocationsMigrationJobsCreateCall {\n\tc.urlParams_.Set(\"requestId\", requestId)\n\treturn c\n}", "func (c *ProjectsLocationsProcessesRunsCreateCall) RequestId(requestId string) *ProjectsLocationsProcessesRunsCreateCall {\n\tc.urlParams_.Set(\"requestId\", requestId)\n\treturn c\n}", "func RequestID(headerName string) func(next http.Handler) http.Handler {\n\treturn func(next http.Handler) http.Handler {\n\t\tfn := func(w http.ResponseWriter, req *http.Request) {\n\t\t\trequestID := req.Header.Get(headerName)\n\t\t\tif requestID == \"\" {\n\t\t\t\trequestID = NewRequestID()\n\t\t\t\treq.Header.Set(headerName, requestID)\n\t\t\t}\n\n\t\t\tctx := WithRequestID(req.Context(), requestID)\n\t\t\tnext.ServeHTTP(w, req.WithContext(ctx))\n\t\t}\n\t\treturn http.HandlerFunc(fn)\n\t}\n}", "func (o TargetProjectOutput) RequestId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *TargetProject) pulumi.StringPtrOutput { return v.RequestId }).(pulumi.StringPtrOutput)\n}", "func (o AddressGroupOutput) RequestId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *AddressGroup) pulumi.StringPtrOutput { return v.RequestId }).(pulumi.StringPtrOutput)\n}", "func RequestID(nextRequestID IdGenerator) mux.MiddlewareFunc {\n\treturn TraceRequest(\"X-Request-Id\", nextRequestID)\n}", "func WithRequestIDFromContext(name ...string) Option {\n\tvar requestIDName string\n\tif len(name) > 0 && name[0] != \"\" {\n\t\trequestIDName = name[0]\n\t} else {\n\t\trequestIDName = ContextRequestIDKey\n\t}\n\treturn func(o *options) {\n\t\to.requestIDFrom = 2\n\t\to.requestIDName = requestIDName\n\t}\n}", "func (o *WalletTransactionsListResponse) GetRequestId() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.RequestId\n}", "func (c *ProjectsLocationsProcessesCreateCall) RequestId(requestId string) *ProjectsLocationsProcessesCreateCall {\n\tc.urlParams_.Set(\"requestId\", requestId)\n\treturn c\n}" ]
[ "0.80196583", "0.7920613", "0.7745882", "0.7735481", "0.7718071", "0.76941407", "0.76734114", "0.7650508", "0.7615932", "0.7586562", "0.7578425", "0.75778246", "0.75193435", "0.7472196", "0.6780436", "0.6650736", "0.63147664", "0.629856", "0.62980247", "0.62209785", "0.6217856", "0.61819583", "0.6114737", "0.60861474", "0.60692614", "0.60610133", "0.60452145", "0.60452145", "0.6042195", "0.6026965", "0.6018939", "0.60175884", "0.59669334", "0.59669334", "0.59654963", "0.5952865", "0.5916787", "0.5877716", "0.58647007", "0.5853974", "0.58429", "0.5816627", "0.5814268", "0.5812295", "0.5801254", "0.5783137", "0.5757481", "0.5733328", "0.5714217", "0.5709931", "0.5689373", "0.5681294", "0.5678597", "0.5672754", "0.5672754", "0.5666765", "0.5666222", "0.5644567", "0.5644567", "0.5626639", "0.56213164", "0.56142783", "0.56099236", "0.5609778", "0.5603644", "0.55868745", "0.5561127", "0.5554352", "0.5551651", "0.55503196", "0.5532883", "0.55168545", "0.5515137", "0.54967463", "0.54607654", "0.54492867", "0.5439333", "0.5424509", "0.5412643", "0.5405528", "0.53712267", "0.53400195", "0.53031045", "0.5301312", "0.5295597", "0.5275329", "0.526315", "0.52547616", "0.52509993", "0.52453613", "0.5235063", "0.5224229", "0.52226967", "0.51750344", "0.5173751", "0.5172338", "0.5166442", "0.51590884", "0.51469487", "0.5142484" ]
0.7790807
2
GetUserId returns the UserId field value if set, zero value otherwise.
func (o *AccessRequestData) GetUserId() string { if o == nil || o.UserId == nil { var ret string return ret } return *o.UserId }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *ViewUserDashboard) GetUserId() int32 {\n\tif o == nil || o.UserId == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.UserId\n}", "func GetUserID(ctx context.Context) (int64, error) {\n\treturn getInt64(ctx, userIDKey)\n}", "func (o *BasicBot) GetUserId() interface{} {\n\tif o == nil {\n\t\tvar ret interface{}\n\t\treturn ret\n\t}\n\treturn o.UserId\n}", "func (o *ViewUserUtilization) GetUserId() int32 {\n\tif o == nil || o.UserId == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.UserId\n}", "func GetUserID(ctx context.Context) (int64, error) {\n\tmd, ok := metadata.FromIncomingContext(ctx)\n\tif !ok {\n\t\treturn 0, status.Errorf(codes.NotFound, \"Failed to get metadata\")\n\t}\n\n\tvar userIDStr string\n\tif userID, ok := md[\"user_id\"]; ok {\n\t\tuserIDStr = strings.Join(userID, \"\")\n\t} else {\n\t\treturn 0, status.Errorf(codes.NotFound, \"'user_id' is not found in context\")\n\t}\n\tid, err := strconv.ParseInt(userIDStr, 10, 64)\n\tif err != nil {\n\t\treturn 0, status.Errorf(codes.InvalidArgument, fmt.Sprintf(\"Failed to create new user: %v\", err))\n\t}\n\n\treturn id, nil\n}", "func GetUserId(username string) (id string, err error) {\n\tui, err := GetUserInfoNoLogin(username)\n\tif err != nil {\n\t\treturn\n\t}\n\tid = ui.Id\n\treturn\n}", "func (s *SetUserSupportInfoRequest) GetUserID() (value int64) {\n\tif s == nil {\n\t\treturn\n\t}\n\treturn s.UserID\n}", "func (user *User) GetID() (int64, error) {\n\treturn user.id, nil\n}", "func (c *Control) GetUserId(ctx *iris.Context, r *redis.Client) (int, error) {\n\tvar userId int\n\tvar err error\n\n\t// validate user session\n\t/*\n\t\tuserId, err = strconv.ParseInt(ctx.RequestHeader(\"X-User-Id\"), 10, 0)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"unable to get user id from header:\", err)\n\t\t\treturn\n\t\t}\n\t*/\n\n\tuserId, err = ctx.Session().GetInt(\"id\")\n\tif err != nil {\n\t\tsessionHeader := ctx.RequestHeader(\"X-Session-Token\")\n\t\tredisValue := r.Get(sessionHeader)\n\t\tuserId, err := redisValue.Int64()\n\t\treturn int(userId), err\n\t}\n\treturn userId, err\n}", "func (user *User) GetID() uint {\n\treturn user.ID\n}", "func (u *User) GetID() (value int64) {\n\tif u == nil {\n\t\treturn\n\t}\n\treturn u.ID\n}", "func GetUserId(e *Engine, username string) (userId int64, err error){\n\tres, _, err := e.RawSelect(Filter(\"autoscope_users\", map[string]interface{}{\n\t\t\"username\": username,\n\t}))\n\tfor res.Next(){\n\t\tm, err := res.Get()\n\t\tif err != nil { return -1, err }\n\t\treturn m[\"id\"].(int64), err\n\t}\n\treturn -1, errors.New(\"No such user found\")\n}", "func (user User) GetID() string {\n\treturn user.ID\n}", "func (u User) GetID() string {\n\treturn u.ID\n}", "func (u *UserStories) GetUserID() (value int64) {\n\tif u == nil {\n\t\treturn\n\t}\n\treturn u.UserID\n}", "func (o *VulnUpdateNotification) GetUserId() string {\n\tif o == nil || o.UserId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.UserId\n}", "func (a AuthService) GetUserID() string {\n\treturn a.userID\n}", "func (w Watch) GetUserID() int64 {\n\tuserWatchIndex := watchIndex[w.ID]\n\tindexes := strings.Split(userWatchIndex, \"-\")\n\n\t// parse all index to integer\n\tuIndex, _ := strconv.Atoi(indexes[0])\n\n\treturn data.Users[uIndex].ID\n}", "func (m *AadUserConversationMember) GetUserId()(*string) {\n return m.userId\n}", "func (u *User) GetUserID(id uint64) (model.User, error) {\n\ts := service.UserService{}\n\treturn s.GetUser(id)\n}", "func GetUserID(ctx context.Context) (string, bool) {\n\tv, ok := ctx.Value(UserIDKey).(string)\n\treturn v, ok\n}", "func (c *ChatParticipantAdmin) GetUserID() (value int) {\n\treturn c.UserID\n}", "func (c *ChatParticipantCreator) GetUserID() (value int) {\n\treturn c.UserID\n}", "func (u *User) GetID() int64 {\n\tif u == nil || u.ID == nil {\n\t\treturn 0\n\t}\n\treturn *u.ID\n}", "func (c *ChatParticipant) GetUserID() (value int) {\n\treturn c.UserID\n}", "func (o *ViewUserDashboard) GetUserIdOk() (*int32, bool) {\n\tif o == nil || o.UserId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.UserId, true\n}", "func (r *StoriesReportRequest) GetUserID() (value InputUserClass) {\n\tif r == nil {\n\t\treturn\n\t}\n\treturn r.UserID\n}", "func (s *StorePaymentPurposeGiftedPremium) GetUserID() (value int64) {\n\tif s == nil {\n\t\treturn\n\t}\n\treturn s.UserID\n}", "func (t *Token) GetUserID() int64 {\n\treturn t.UserID\n}", "func (u User) GetID() string {\n\treturn fmt.Sprintf(\"%d\", u.UserID)\n}", "func (o *User) GetId() string {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "func (o *User) GetId() string {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "func (m *AgreementAcceptance) GetUserId()(*string) {\n return m.userId\n}", "func (a Auth) GetUserID(ctx context.Context) (string, error) {\r\n\tpassContext(&ctx)\r\n\r\n\ttoken := retriveToken(ctx)\r\n\r\n\tu, err := a.authClient.GetUser(ctx, &authRPC.Session{\r\n\t\tToken: token,\r\n\t})\r\n\r\n\t// TODO: handle error\r\n\r\n\tif err != nil {\r\n\t\treturn \"\", err\r\n\t}\r\n\r\n\treturn u.GetId(), nil\r\n}", "func (t User) GetID() string {\n\treturn t.Login\n}", "func GetUserID(qr db.Queryer, email string) (int64, error) {\n\tstr := \"SELECT user_id FROM users WHERE email = ?\"\n\tuid := int64(0)\n\terr := qr.Get(&uid, str, email)\n\treturn uid, err\n}", "func GetUserID(req *restful.Request) string {\n\tuserIDInterface := req.Attribute(common.CurrentUserID)\n\tuserID, ok := userIDInterface.(string)\n\tif !ok {\n\t\treturn \"\"\n\t}\n\treturn userID\n}", "func (p Profile) GetUserID() string {\n\treturn p.UserID.Hex()\n}", "func UserID(ctx *context.APIContext) int64 {\n\tif ctx.User == nil {\n\t\treturn 0\n\t}\n\treturn ctx.User.ID\n}", "func (u *UpdateShortMessage) GetUserID() (value int64) {\n\tif u == nil {\n\t\treturn\n\t}\n\treturn u.UserID\n}", "func (o *Authorization) GetUserID() string {\n\tif o == nil || o.UserID == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.UserID\n}", "func (o *AccessRequestData) GetUserIdOk() (*string, bool) {\n\tif o == nil || o.UserId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.UserId, true\n}", "func (o *ModelsUser) GetId() string {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "func GetUserID(r *http.Request) string {\n\treturn strx.Or(r.Header.Get(\"X-User\"), r.Header.Get(\"X-User-Id\"))\n}", "func UserID(ctx *context.Context) *int {\n\tuserID := (*ctx).Value(KeyUserID)\n\tif userID != nil {\n\t\tv := userID.(int)\n\t\treturn &v\n\t}\n\treturn nil\n}", "func (r *MessagesRequestEncryptionRequest) GetUserID() (value InputUserClass) {\n\tif r == nil {\n\t\treturn\n\t}\n\treturn r.UserID\n}", "func (m *SmsLogRow) GetUserId()(*string) {\n val, err := m.GetBackingStore().Get(\"userId\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func (g *UsersGetFullUserRequest) GetID() (value InputUserClass) {\n\tif g == nil {\n\t\treturn\n\t}\n\treturn g.ID\n}", "func (a *Audience) GetUserID() string {\n\treturn a.UserID.Hex()\n}", "func (c *StickersCreateStickerSetRequest) GetUserID() (value InputUserClass) {\n\tif c == nil {\n\t\treturn\n\t}\n\treturn c.UserID\n}", "func (c *AnalyticsController) getUserId(ev *analyticsEvent) (string, *userIDError) {\n\tusername, e := c.getUsernameFromNamespace(ev)\n\tif e != nil {\n\t\treturn \"\", e\n\t}\n\n\tuserObj, exists, err := c.userStore.GetByKey(username)\n\tif err != nil || !exists {\n\t\treturn \"\", &userIDError{\n\t\t\tfmt.Sprintf(\"Failed to find user %s: %v\", username, err),\n\t\t\tuserNotFoundError,\n\t\t}\n\t}\n\n\tif userObj == nil {\n\t\treturn \"\", &userIDError{\n\t\t\tfmt.Sprintf(\"User object nil when trying to get user id\"),\n\t\t\tnoIDFoundError,\n\t\t}\n\t}\n\n\tlog.WithFields(log.Fields{\"strategy\": c.userKeyStrategy}).Debug(\"getting user ID\")\n\tuser := userObj.(*userapi.User)\n\tswitch c.userKeyStrategy {\n\tcase KeyStrategyAnnotation:\n\t\texternalId, exists := user.Annotations[c.userKeyAnnotation]\n\t\tif exists {\n\t\t\tif len(externalId) > 0 {\n\t\t\t\treturn externalId, nil\n\t\t\t}\n\t\t}\n\t\treturn \"\", &userIDError{\n\t\t\tfmt.Sprintf(\"Annotation %s does not exist\", c.userKeyAnnotation),\n\t\t\tuserNotFoundError,\n\t\t}\n\n\tcase KeyStrategyName:\n\t\tif len(user.Name) > 0 {\n\t\t\treturn user.Name, nil\n\t\t}\n\t\treturn \"\", &userIDError{\n\t\t\tfmt.Sprintf(\"Username does not exist\"),\n\t\t\tuserNotFoundError,\n\t\t}\n\n\tcase KeyStrategyUID:\n\t\t// any non-Online environment (e.g, Dedicated) will never have an externalId\n\t\t// the fallback is UserID\n\t\tuid := string(user.UID)\n\t\tif len(uid) > 0 {\n\t\t\treturn uid, nil\n\t\t}\n\t\treturn \"\", &userIDError{\n\t\t\tfmt.Sprintf(\"User UID does not exist\"),\n\t\t\tuserNotFoundError,\n\t\t}\n\n\tdefault:\n\t\tpanic(\"Invalid user key strategy set\")\n\t}\n\n\treturn \"\", &userIDError{\n\t\tfmt.Sprintf(\"No suitable ID could be found for analytic. A user must be logged in for analytics to be counted. %#v\", ev),\n\t\tnoIDFoundError,\n\t}\n}", "func (o *ViewUserUtilization) GetUserIdOk() (*int32, bool) {\n\tif o == nil || o.UserId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.UserId, true\n}", "func (em *IGMedia) GetUserId() string {\n\treturn em.Owner.Id\n}", "func (u *User) GetID() string {\n\treturn u.ID\n}", "func (u *User) GetID() string {\n\treturn u.ID\n}", "func (r *RoleMemberAdd) GetUserID() uint64 {\n\treturn r.UserID\n}", "func (o *BasicBot) GetUserIdOk() (*interface{}, bool) {\n\tif o == nil || o.UserId == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.UserId, true\n}", "func (db *Database) GetUserID(name string) (int, error) {\n\trow := db.db.QueryRow(`\n\t\tSELECT id FROM melodious.accounts WHERE username=$1 LIMIT 1;\n\t`, name)\n\n\tvar id int\n\terr := row.Scan(&id)\n\tif err == sql.ErrNoRows {\n\t\treturn -1, errors.New(\"no such user\")\n\t} else if err != nil {\n\t\treturn -1, err\n\t}\n\n\treturn 0, err\n}", "func (o *WorkflowCatalogServiceRequest) GetUserIdOrEmail() string {\n\tif o == nil || o.UserIdOrEmail == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.UserIdOrEmail\n}", "func (m *EmployeeMutation) UserId() (r string, exists bool) {\n\tv := m._UserId\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "func (u *UserEmpty) GetID() (value int64) {\n\tif u == nil {\n\t\treturn\n\t}\n\treturn u.ID\n}", "func UserID(ctx context.Context) string {\n\tif ctx == nil {\n\t\treturn \"\"\n\t}\n\n\tif id, ok := ctx.Value(userIDKey{}).(string); ok {\n\t\treturn id\n\t}\n\n\treturn \"\"\n}", "func (c *ChatStatisticsAdministratorActionsInfo) GetUserID() (value int64) {\n\tif c == nil {\n\t\treturn\n\t}\n\treturn c.UserID\n}", "func getUserId(username string) (int, error) {\n\turl := fmt.Sprintf(USER_ID_PATH, API, username, APP_VERSION)\n\tres, err := http.Get(url)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tvar data GetUserIdResponse\n\tjson.NewDecoder(res.Body).Decode(&data)\n\tif !data.Success && data.Error != \"\" {\n\t\treturn 0, errors.New(data.Error)\n\t}\n\treturn data.UserId, nil\n}", "func getUserID(userIdParam string) (int64, *rest_errors.RestError) {\n\n\tuserID, userErr := strconv.ParseInt(userIdParam, 10, 64)\n\tif userErr != nil {\n\t\treturn 0, rest_errors.NewBadRequestError(\"invalid user id\")\n\t}\n\treturn userID, nil\n}", "func (r *AttachmentPreview) GetUserID() uint64 {\n\treturn r.UserID\n}", "func GetUserID(ctx Context) error {\n\tmsg := fmt.Sprintf(\"Your userID is %d\", ctx.Sender().ID)\n\treturn ctx.Reply(msg)\n}", "func (o *ViewProjectBudget) GetCreatedByUserId() int32 {\n\tif o == nil || o.CreatedByUserId == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.CreatedByUserId\n}", "func (m *TransportMutation) UserID() (id int, exists bool) {\n\tif m.user != nil {\n\t\treturn *m.user, true\n\t}\n\treturn\n}", "func (m *AuthorizeMutation) UserID() (id int, exists bool) {\n\tif m.user != nil {\n\t\treturn *m.user, true\n\t}\n\treturn\n}", "func (e *User) GetID() *identity.ID {\n\treturn e.ID\n}", "func (z *User) GetID() string {\n\treturn z.ID\n}", "func (m *WindowsInformationProtectionDeviceRegistration) GetUserId()(*string) {\n val, err := m.GetBackingStore().Get(\"userId\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "func UserID() (int, error) {\n\tfilename := \"current_user.json\"\n\tgetUser := func() (*gitlab.User, error) {\n\t\tu, _, err := lab.Users.CurrentUser()\n\t\treturn u, err\n\t}\n\treturn userIdWithCache(filename, getUser)\n}", "func (o *WorkflowServiceItemDefinitionAllOf) GetUserIdOrEmail() string {\n\tif o == nil || o.UserIdOrEmail == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.UserIdOrEmail\n}", "func (m *CarRepairrecordMutation) UserID() (id int, exists bool) {\n\tif m.user != nil {\n\t\treturn *m.user, true\n\t}\n\treturn\n}", "func (o *TenantWithOfferWeb) GetMainUserId() string {\n\tif o == nil || o.MainUserId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.MainUserId\n}", "func (id *authIdentity) UserID() string {\n\treturn id.userID\n}", "func UserID(ctx context.Context) (string, bool) {\n\ttoken := tokenFromContext(ctx)\n\n\tif token == nil {\n\t\treturn \"\", false\n\t}\n\n\treturn token.userID, true\n}", "func (m *ProfileMutation) UserID() (id int, exists bool) {\n\tif m.user != nil {\n\t\treturn *m.user, true\n\t}\n\treturn\n}", "func (o *Authorization) GetUserIDOk() (*string, bool) {\n\tif o == nil || o.UserID == nil {\n\t\treturn nil, false\n\t}\n\treturn o.UserID, true\n}", "func (m *TokenMutation) UserID() (id int, exists bool) {\n\tif m.user != nil {\n\t\treturn *m.user, true\n\t}\n\treturn\n}", "func (o *MicrosoftGraphEducationUser) GetId() string {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Id\n}", "func GetUserID(socketID uuid.UUID) (uuid.UUID, error) {\n\tdefer mutex.Unlock()\n\tmutex.Lock()\n\n\tif session, ok := sessionCache[socketID]; ok {\n\t\treturn session.userID, nil\n\t}\n\treturn uuid.Nil, fmt.Errorf(\"No user is associated with this connection\")\n}", "func (r *User) GetID() kallax.Identifier {\n\treturn (*kallax.ULID)(&r.ID)\n}", "func (client *RedisClient) GetUserID(token string) (string, error) {\n\tval, err := client.redisdb.Get(token).Result()\n\treturn val, err\n}", "func (a *Funcs) UserID() (string, error) {\n\ta.stsInit.Do(a.initSTS)\n\treturn a.sts.UserID()\n}", "func (m *BillMutation) UserID() (id int, exists bool) {\n\tif m.user != nil {\n\t\treturn *m.user, true\n\t}\n\treturn\n}", "func (m *EmployeeMutation) UserID() (r string, exists bool) {\n\tv := m._User_id\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "func (m *CarInspectionMutation) UserID() (id int, exists bool) {\n\tif m.user != nil {\n\t\treturn *m.user, true\n\t}\n\treturn\n}", "func (s *HelixService) GetUserID(accessToken string) (string, error) {\n\treq, err := http.NewRequest(\"GET\", \"https://api.twitch.tv/helix/users\", nil)\n\tif err != nil {\n\t\tlog.Println(err.Error())\n\t\treturn \"\", err\n\t}\n\n\treq.Header.Set(\"Client-Id\", s.config.OAuth2.ClientID)\n\treq.Header.Set(\"Authorization\", fmt.Sprintf(\"Bearer %s\", accessToken))\n\n\tres, err := s.client.Do(req)\n\tif res != nil {\n\t\tdefer res.Body.Close()\n\t}\n\tif err != nil {\n\t\tlog.Println(err.Error())\n\t\treturn \"\", err\n\t}\n\n\tbodyBytes, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\tlog.Println(err.Error())\n\t\treturn \"\", err\n\t}\n\n\tvar u manyUsers\n\terr = json.Unmarshal(bodyBytes, &u)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif len(u.Users) > 1 {\n\t\tlog.Println(\"multiple users found for the same id\")\n\t\treturn \"\", errors.New(\"multiple users found for the same id\")\n\t}\n\n\treturn u.Users[0].UserID, nil\n}", "func (o *WorkflowServiceItemActionInstance) GetUserIdOrEmail() string {\n\tif o == nil || o.UserIdOrEmail == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.UserIdOrEmail\n}", "func (m *RepairinvoiceMutation) Userid() (r int, exists bool) {\n\tv := m.userid\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "func (o *VulnUpdateNotification) GetUserIdOk() (*string, bool) {\n\tif o == nil || o.UserId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.UserId, true\n}", "func (u User) ID() frameworks.ID {\n\treturn u.id\n}", "func (m *CarserviceMutation) UseridID() (id int, exists bool) {\n\tif m.userid != nil {\n\t\treturn *m.userid, true\n\t}\n\treturn\n}", "func (m *SessionMutation) UserID() (id int, exists bool) {\n\tif m.user != nil {\n\t\treturn *m.user, true\n\t}\n\treturn\n}", "func (m *AddressMutation) UserID() (r int64, exists bool) {\n\tv := m.user_id\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "func (DBConnection *MariaDBPlugin) GetUserID(userName string) (uint64, error) {\n\tvar userID uint64\n\trow := DBConnection.DBHandle.QueryRow(\"SELECT ID FROM Users WHERE Name = ?\", userName)\n\terr := row.Scan(&userID)\n\tif err != nil {\n\t\tlogging.WriteLog(logging.LogLevelError, \"MariaDBPlugin/GetUserID\", userName, logging.ResultFailure, []string{\"Username does not exist\", userName})\n\t\treturn 0, err\n\t}\n\treturn userID, nil\n}", "func (i *InstaClient) GetUserID(username string) (string, error) {\n\tsearchResult, err := i.SearchUser(username, map[string]string{\"count\": \"1\"})\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\t// If no user was found, return\n\tif len(searchResult.Users) == 0 {\n\t\treturn \"\", errors.New(\"No user found with username \" + username)\n\t}\n\treturn searchResult.Users[0].ID, nil\n}" ]
[ "0.76531625", "0.759254", "0.7537187", "0.75304866", "0.74264294", "0.73506683", "0.73041785", "0.7271143", "0.72364515", "0.7209453", "0.72064084", "0.7205173", "0.71930885", "0.71749294", "0.7136656", "0.71200925", "0.7096173", "0.7072407", "0.7061545", "0.70601636", "0.7049041", "0.7005662", "0.6996859", "0.6987647", "0.69867474", "0.69661254", "0.69591254", "0.69587815", "0.69341403", "0.6921731", "0.6882346", "0.6882346", "0.6868532", "0.6865268", "0.6861145", "0.68257296", "0.68232524", "0.6821116", "0.6807665", "0.68061703", "0.67899674", "0.6789256", "0.6740733", "0.6729024", "0.6721241", "0.671967", "0.6713668", "0.67108214", "0.66938615", "0.6669082", "0.6667307", "0.6659028", "0.66342384", "0.66036993", "0.66036993", "0.6591384", "0.65865946", "0.65842694", "0.65578157", "0.6534522", "0.6533891", "0.651806", "0.64984083", "0.6484615", "0.64773697", "0.6458908", "0.64473", "0.642322", "0.6421364", "0.64047253", "0.63927203", "0.6392365", "0.63850737", "0.63812435", "0.6378218", "0.63770205", "0.63558805", "0.634146", "0.6322131", "0.6320363", "0.63133484", "0.63007975", "0.62970966", "0.6294206", "0.62801117", "0.6278874", "0.62695533", "0.6269277", "0.6262039", "0.62376815", "0.6227535", "0.62237716", "0.62213975", "0.62181216", "0.61861306", "0.6185107", "0.61808354", "0.6179274", "0.6175311", "0.61723536" ]
0.76921207
0
GetUserIdOk returns a tuple with the UserId field value if set, nil otherwise and a boolean to check if the value has been set.
func (o *AccessRequestData) GetUserIdOk() (*string, bool) { if o == nil || o.UserId == nil { return nil, false } return o.UserId, true }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *BasicBot) GetUserIdOk() (*interface{}, bool) {\n\tif o == nil || o.UserId == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.UserId, true\n}", "func (o *ViewUserDashboard) GetUserIdOk() (*int32, bool) {\n\tif o == nil || o.UserId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.UserId, true\n}", "func (o *VulnUpdateNotification) GetUserIdOk() (*string, bool) {\n\tif o == nil || o.UserId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.UserId, true\n}", "func (o *ViewUserUtilization) GetUserIdOk() (*int32, bool) {\n\tif o == nil || o.UserId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.UserId, true\n}", "func (o *User) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *User) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *Authorization) GetUserIDOk() (*string, bool) {\n\tif o == nil || o.UserID == nil {\n\t\treturn nil, false\n\t}\n\treturn o.UserID, true\n}", "func (o *ModelsUser) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *MicrosoftGraphEducationUser) GetIdOk() (string, bool) {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Id, true\n}", "func (o *WorkflowServiceItemDefinitionAllOf) GetUserIdOrEmailOk() (*string, bool) {\n\tif o == nil || o.UserIdOrEmail == nil {\n\t\treturn nil, false\n\t}\n\treturn o.UserIdOrEmail, true\n}", "func (o *WorkflowCatalogServiceRequest) GetUserIdOrEmailOk() (*string, bool) {\n\tif o == nil || o.UserIdOrEmail == nil {\n\t\treturn nil, false\n\t}\n\treturn o.UserIdOrEmail, true\n}", "func (o *WorkflowServiceItemActionInstance) GetUserIdOrEmailOk() (*string, bool) {\n\tif o == nil || o.UserIdOrEmail == nil {\n\t\treturn nil, false\n\t}\n\treturn o.UserIdOrEmail, true\n}", "func (o *IamUserPreferenceAllOf) GetUserUniqueIdentifierOk() (*string, bool) {\n\tif o == nil || o.UserUniqueIdentifier == nil {\n\t\treturn nil, false\n\t}\n\treturn o.UserUniqueIdentifier, true\n}", "func (o *UserDisco) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *ViewProjectBudget) GetCreatedByUserIdOk() (*int32, bool) {\n\tif o == nil || o.CreatedByUserId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.CreatedByUserId, true\n}", "func (o *IamUserAuthorization) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *WatchlistScreeningIndividualUpdateResponse) GetClientUserIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ClientUserId.Get(), o.ClientUserId.IsSet()\n}", "func (o *ViewUserDashboard) GetIdOk() (*int32, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *TenantWithOfferWeb) GetMainUserIdOk() (*string, bool) {\n\tif o == nil || o.MainUserId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.MainUserId, true\n}", "func (o *EditBankConnectionParams) GetBankingUserIdOk() (*string, bool) {\n\tif o == nil || o.BankingUserId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.BankingUserId, true\n}", "func (o *IdentityAccount) GetRootUserIdOk() (*string, bool) {\n\tif o == nil || o.RootUserId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.RootUserId, true\n}", "func (o *ViewMilestone) GetCreatorUserIdOk() (*int32, bool) {\n\tif o == nil || o.CreatorUserId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.CreatorUserId, true\n}", "func (o *UserInvitationResponseData) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *PostUserGroupAdminRequest) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *NotificationProjectBudgetNotification) GetUserIdsOk() (*[]int32, bool) {\n\tif o == nil || o.UserIds == nil {\n\t\treturn nil, false\n\t}\n\treturn o.UserIds, true\n}", "func (o *IdentityAccount) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *ModelsUser) GetExternalIdOk() (*string, bool) {\n\tif o == nil || o.ExternalId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ExternalId, true\n}", "func (o *Account) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *LocalDatabaseProvider) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *Permissao) GetIdOk() (*int64, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *Ga4ghTumourboard) GetIdOk() (string, bool) {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Id, true\n}", "func (o *SessionDevice) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *Invitation) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *Application) GetIdOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *Authorization) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *ProjectApiKey) GetOwnerIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.OwnerId, true\n}", "func (o *TenantWithOfferWeb) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *PartialApplicationKey) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *SingleSelectFieldField) GetIdOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *ProdutoVM) GetIdOk() (*int64, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id.Get(), o.Id.IsSet()\n}", "func (o *View) GetIdOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *TransactionSplit) GetUserOk() (*string, bool) {\n\tif o == nil || o.User == nil {\n\t\treturn nil, false\n\t}\n\treturn o.User, true\n}", "func (o *ProjectApiKey) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *SamlConfigurationProperties) GetUserIDAttributeOk() (*SamlConfigurationPropertyItemsString, bool) {\n\tif o == nil || o.UserIDAttribute == nil {\n\t\treturn nil, false\n\t}\n\treturn o.UserIDAttribute, true\n}", "func (o *Domain) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *BasicBot) GetOwnerIdOk() (*interface{}, bool) {\n\tif o == nil || o.OwnerId == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.OwnerId, true\n}", "func (o *EventoDTO) GetIdOk() (*int64, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *AuthenticationResponse) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *ViewCustomFieldTask) GetIdOk() (*int32, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *Invitation) GetToUserOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ToUser.Get(), o.ToUser.IsSet()\n}", "func (o *ParameterContextDTO) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *CredentialsResponseElement) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *Ga4ghChemotherapy) GetIdOk() (string, bool) {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Id, true\n}", "func (o *ViewTag) GetIdOk() (*int32, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (m *EmployeeMutation) UserId() (r string, exists bool) {\n\tv := m._UserId\n\tif v == nil {\n\t\treturn\n\t}\n\treturn *v, true\n}", "func (o *Platform) GetIdOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *GetMessagesAllOf) GetIdOk() (*interface{}, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *TenantExternalView) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *User) GetEmployeeIdOk() (string, bool) {\n\tif o == nil || o.EmployeeId == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.EmployeeId, true\n}", "func (o *AccessRequestData) HasUserId() bool {\n\tif o != nil && o.UserId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *MemberResponse) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *HclFirmware) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *ViewProjectBudget) GetUpdatedByUserIdOk() (*int32, bool) {\n\tif o == nil || o.UpdatedByUserId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.UpdatedByUserId, true\n}", "func (o *ActionDTO) GetUserIdentityOk() (*string, bool) {\n\tif o == nil || o.UserIdentity == nil {\n\t\treturn nil, false\n\t}\n\treturn o.UserIdentity, true\n}", "func (o *Authorization) GetUserOk() (*string, bool) {\n\tif o == nil || o.User == nil {\n\t\treturn nil, false\n\t}\n\treturn o.User, true\n}", "func (o *Tag) GetIdOk() (int64, bool) {\n\tif o == nil || o.Id == nil {\n\t\tvar ret int64\n\t\treturn ret, false\n\t}\n\treturn *o.Id, true\n}", "func (o *EntityId) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *NotificationConfig) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *DeviceNode) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *UserPasswordCredentials) GetUserOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.User, true\n}", "func (o *BasicBot) GetUserId() interface{} {\n\tif o == nil {\n\t\tvar ret interface{}\n\t\treturn ret\n\t}\n\treturn o.UserId\n}", "func (o *BulletinDTO) GetIdOk() (*int64, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func GetUserID(ctx context.Context) (string, bool) {\n\tv, ok := ctx.Value(UserIDKey).(string)\n\treturn v, ok\n}", "func (o *ViewSampleProject) GetIdOk() (*int32, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *TeamSubject) GetIdOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *Vm) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *ReportingTaskEntity) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *Channel) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *Run) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *KanbanViewView) GetIdOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *VerifiableAddress) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *ViewMilestone) GetIdOk() (*int32, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *MicrosoftGraphSharedPcConfiguration) GetIdOk() (string, bool) {\n\tif o == nil || o.Id == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Id, true\n}", "func (o *Project) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *CustconfTimePseudoStreaming) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *Rule) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *InlineResponse20027Person) GetUserUUIDOk() (*string, bool) {\n\tif o == nil || o.UserUUID == nil {\n\t\treturn nil, false\n\t}\n\treturn o.UserUUID, true\n}", "func (o *SmscSession) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *WafPolicyGroup) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *Environment) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *NormalizedProjectRevisionHook) GetIdOk() (*string, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *Giveaway) GetProfileIdOk() (int32, bool) {\n\tif o == nil || o.ProfileId == nil {\n\t\tvar ret int32\n\t\treturn ret, false\n\t}\n\treturn *o.ProfileId, true\n}", "func (o *Venda) GetIdOk() (*int64, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *TokenResponse) GetIdOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *MonitorSearchResult) GetIdOk() (*int64, bool) {\n\tif o == nil || o.Id == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Id, true\n}", "func (o *TrashStructureApplication) GetIdOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *BasicBot) HasUserId() bool {\n\tif o != nil && o.UserId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *PostWebhook) GetIdOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Id, true\n}", "func (o *VulnUpdateNotification) HasUserId() bool {\n\tif o != nil && o.UserId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ViewUserUtilization) HasUserId() bool {\n\tif o != nil && o.UserId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}" ]
[ "0.8129843", "0.80960226", "0.8078956", "0.807395", "0.786831", "0.786831", "0.77417076", "0.77170163", "0.745114", "0.74054617", "0.7311962", "0.7198506", "0.71561456", "0.71002346", "0.7030263", "0.6978005", "0.69489896", "0.69370127", "0.6868653", "0.68050647", "0.67514133", "0.67383194", "0.67231846", "0.66557413", "0.65309227", "0.65260404", "0.6491634", "0.6447864", "0.64372605", "0.64311147", "0.64277416", "0.6421647", "0.64155906", "0.6399661", "0.63944465", "0.6393916", "0.63657963", "0.6353555", "0.6340442", "0.6337951", "0.63284296", "0.6327877", "0.6321194", "0.63211405", "0.6300055", "0.6292753", "0.62880546", "0.62825406", "0.62700987", "0.6269782", "0.62602043", "0.6248689", "0.6246464", "0.62450343", "0.62445503", "0.6234239", "0.62266505", "0.6218149", "0.6217002", "0.621121", "0.62029016", "0.62006634", "0.6196601", "0.61884856", "0.6184214", "0.6181478", "0.6179131", "0.6178839", "0.617689", "0.61729616", "0.61520857", "0.61475533", "0.6140207", "0.6135656", "0.61335677", "0.61264235", "0.6126224", "0.61226183", "0.6111032", "0.61008734", "0.6100849", "0.60993594", "0.6093664", "0.60865664", "0.60853624", "0.6074681", "0.60723275", "0.6071707", "0.60614425", "0.6057249", "0.6056073", "0.6051038", "0.6050007", "0.6023769", "0.6015971", "0.6013123", "0.6009845", "0.6009204", "0.60089844", "0.6005146" ]
0.8252935
0
HasUserId returns a boolean if a field has been set.
func (o *AccessRequestData) HasUserId() bool { if o != nil && o.UserId != nil { return true } return false }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *ViewUserDashboard) HasUserId() bool {\n\tif o != nil && o.UserId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *BasicBot) HasUserId() bool {\n\tif o != nil && o.UserId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ViewUserUtilization) HasUserId() bool {\n\tif o != nil && o.UserId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *VulnUpdateNotification) HasUserId() bool {\n\tif o != nil && o.UserId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Authorization) HasUserID() bool {\n\tif o != nil && o.UserID != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (r *RoleMemberAdd) HasUserID() bool {\n\treturn r.hasUserID\n}", "func (p *Person) HasUserID() bool {\n\tif len(p.UserIDs) > 0 {\n\t\tfor _, userID := range p.UserIDs {\n\t\t\tif userID.Content != \"\" {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\treturn false\n}", "func (o *User) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *User) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *WorkflowServiceItemDefinitionAllOf) HasUserIdOrEmail() bool {\n\tif o != nil && o.UserIdOrEmail != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *WorkflowCatalogServiceRequest) HasUserIdOrEmail() bool {\n\tif o != nil && o.UserIdOrEmail != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ModelsUser) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (d UserData) HasUser() bool {\n\treturn d.ModelData.Has(models.NewFieldName(\"User\", \"user_id\"))\n}", "func (o *ViewProjectBudget) HasCreatedByUserId() bool {\n\tif o != nil && o.CreatedByUserId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func HasUsermetaViaUserId(iUserId int64) bool {\n\tif has, err := Engine.Where(\"user_id = ?\", iUserId).Get(new(Usermeta)); err != nil {\n\t\treturn false\n\t} else {\n\t\tif has {\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t}\n}", "func (r *AttachmentPreview) HasUserID() bool {\n\treturn r.hasUserID\n}", "func (o *WorkflowServiceItemActionInstance) HasUserIdOrEmail() bool {\n\tif o != nil && o.UserIdOrEmail != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *EditBankConnectionParams) HasBankingUserId() bool {\n\tif o != nil && o.BankingUserId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (r *RoleMemberRemove) HasUserID() bool {\n\treturn r.hasUserID\n}", "func (d UserData) HasID() bool {\n\treturn d.ModelData.Has(models.NewFieldName(\"ID\", \"id\"))\n}", "func (c *User) HasID() bool { return c.ID > 0 }", "func (o *MicrosoftGraphEducationUser) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ViewUserDashboard) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ViewMilestone) HasCreatorUserId() bool {\n\tif o != nil && o.CreatorUserId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *IamUserPreferenceAllOf) HasUserUniqueIdentifier() bool {\n\tif o != nil && o.UserUniqueIdentifier != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *CreateUser200Response) HasUser() bool {\n\tif o != nil && !IsNil(o.User) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *IamUserAuthorization) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (m *AmbulanceMutation) HasuserID() (id int, exists bool) {\n\tif m.hasuser != nil {\n\t\treturn *m.hasuser, true\n\t}\n\treturn\n}", "func (d UserData) HasUsers() bool {\n\treturn d.ModelData.Has(models.NewFieldName(\"Users\", \"user_ids\"))\n}", "func (service *Service) HasUser(accountId types.ID) bool {\n\tfor _, id := range service.accountIds {\n\t\tif id == accountId {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func HasUsermetaViaUmetaId(iUmetaId int64) bool {\n\tif has, err := Engine.Where(\"umeta_id = ?\", iUmetaId).Get(new(Usermeta)); err != nil {\n\t\treturn false\n\t} else {\n\t\tif has {\n\t\t\treturn true\n\t\t}\n\t\treturn false\n\t}\n}", "func (o *User) HasEmployeeId() bool {\n\tif o != nil && o.EmployeeId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *TenantWithOfferWeb) HasMainUserId() bool {\n\tif o != nil && o.MainUserId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *SamlConfigurationProperties) HasUserIDAttribute() bool {\n\tif o != nil && o.UserIDAttribute != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (db *Database) HasUsers() (bool, error) {\n\trow := db.db.QueryRow(`\n\t\tSELECT id FROM melodious.accounts LIMIT 1;\n\t`)\n\n\tvar id int\n\terr := row.Scan(&id)\n\tif err == sql.ErrNoRows {\n\t\treturn false, nil\n\t} else if err != nil {\n\t\treturn false, err\n\t}\n\n\treturn true, err\n}", "func (o *ModelsUser) HasExternalId() bool {\n\tif o != nil && o.ExternalId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ViewUserDashboard) HasUser() bool {\n\tif o != nil && o.User != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ColumnBoardColumnMeta) HasUser() bool {\n\tif o != nil && o.User != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ViewProjectBudget) HasCompletedByUserId() bool {\n\tif o != nil && o.CompletedByUserId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *NotificationProjectBudgetNotification) HasUserIds() bool {\n\tif o != nil && o.UserIds != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Authorization) HasUser() bool {\n\tif o != nil && o.User != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (d UserData) HasPartner() bool {\n\treturn d.ModelData.Has(models.NewFieldName(\"Partner\", \"partner_id\"))\n}", "func (o *WorkflowCatalogServiceRequest) HasUser() bool {\n\tif o != nil && o.User != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func HasUser() predicate.CarRepairrecord {\n\treturn predicate.CarRepairrecord(func(s *sql.Selector) {\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(Table, FieldID),\n\t\t\tsqlgraph.To(UserTable, FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, UserTable, UserColumn),\n\t\t)\n\t\tsqlgraph.HasNeighbors(s, step)\n\t})\n}", "func (o *Invitation) HasToUser() bool {\n\tif o != nil && o.ToUser.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ViewProjectBudget) HasUpdatedByUserId() bool {\n\tif o != nil && o.UpdatedByUserId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (r *AttachmentOriginal) HasUserID() bool {\n\treturn r.hasUserID\n}", "func (d UserData) HasWriteUID() bool {\n\treturn d.ModelData.Has(models.NewFieldName(\"WriteUID\", \"write_uid\"))\n}", "func (spec *MachineSpec) HasUser() bool {\n\tif spec.User.ObjectId.Valid() {\n\t\treturn true\n\t}\n\treturn len(spec.Machine.Users) != 0 && spec.Machine.Users[0].Id.Valid()\n}", "func (o *ViewUserUtilization) HasUser() bool {\n\tif o != nil && o.User != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func storyHasUserFlag(story *stories.Story, user *users.User) bool {\n\t// Query flags table for rows with userId and storyId\n\t// if we don't get error, return true\n\tresults, err := query.New(\"flags\", \"story_id\").Where(\"story_id=?\", story.Id).Where(\"user_id=?\", user.Id).Results()\n\tif err == nil && len(results) == 0 {\n\t\treturn false\n\t}\n\n\treturn true\n}", "func (o *UserInvitationResponseData) HasId() bool {\n\treturn o != nil && o.Id != nil\n}", "func (db *gjDatabase) hasUser() bool {\n\treturn len(db.getAllUsers()) > 0\n}", "func (o *Author) HasUser() bool {\n\tif o != nil && o.User != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Vm) HasUserMetadata() bool {\n\tif o != nil && o.UserMetadata != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *UserDisco) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *TransactionSplit) HasUser() bool {\n\tif o != nil && o.User != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ActionDTO) HasUserIdentity() bool {\n\tif o != nil && o.UserIdentity != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (c *collection) hasUser(u string) bool {\n\treturn c.has(c.users, u)\n}", "func (o *IdentityAccount) HasRootUserId() bool {\n\tif o != nil && o.RootUserId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (this *managerStruct) UserExists(name string) bool {\n\tthis.mutex.RLock()\n\tid := this.getUserId(name)\n\tthis.mutex.RUnlock()\n\texists := id >= 0\n\treturn exists\n}", "func (o *MicrosoftGraphEducationUser) HasCreatedBy() bool {\n\tif o != nil && o.CreatedBy != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (wu *WxUser) Exists() bool { //wx_users\n\treturn wu._exists\n}", "func (db *Database) UserExistsID(id int) (bool, error) {\n\trow := db.db.QueryRow(`\n\t\tSELECT id FROM melodious.accounts WHERE id=$1 LIMIT 1;\n\t`, id)\n\n\tvar _id int // this is unused though\n\terr := row.Scan(&_id)\n\tif err == sql.ErrNoRows {\n\t\treturn false, nil\n\t} else if err != nil {\n\t\treturn false, err\n\t}\n\n\treturn true, nil\n}", "func IsUserPresent(ctx context.Context) bool {\n\tuserIdentity := ctx.Value(UserIdentityKey)\n\treturn userIdentity != nil && userIdentity != \"\"\n\n}", "func (u *User) Exists() bool {\n\treturn u._exists\n}", "func (u *User) Exists(id int) bool {\n\treturn !db.Select(\"id\").First(u, id).RecordNotFound()\n}", "func (d UserData) HasCreateUID() bool {\n\treturn d.ModelData.Has(models.NewFieldName(\"CreateUID\", \"create_uid\"))\n}", "func (o *ViewProjectBudget) HasDeletedByUserId() bool {\n\tif o != nil && o.DeletedByUserId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ViewCustomFieldTask) HasCreatedBy() bool {\n\tif o != nil && o.CreatedBy != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (d UserData) HasIndustry() bool {\n\treturn d.ModelData.Has(models.NewFieldName(\"Industry\", \"industry_id\"))\n}", "func (m *AmbulanceMutation) SetHasuserID(id int) {\n\tm.hasuser = &id\n}", "func (o *InlineResponse200115) HasUserDisplayPostedDate() bool {\n\tif o != nil && o.UserDisplayPostedDate != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *InlineResponse200115) HasContributingUsers() bool {\n\tif o != nil && o.ContributingUsers != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *User) HasIdentities() bool {\n\tif o != nil && o.Identities != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (_obj *DataService) HasUser(wx_id string, userExist *bool, _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_bool((*userExist), 2)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tvar _status map[string]string\n\tvar _context map[string]string\n\tif len(_opt) == 1 {\n\t\t_context = _opt[0]\n\t} else if len(_opt) == 2 {\n\t\t_context = _opt[0]\n\t\t_status = _opt[1]\n\t}\n\t_resp := new(requestf.ResponsePacket)\n\ttarsCtx := context.Background()\n\n\terr = _obj.s.Tars_invoke(tarsCtx, 0, \"hasUser\", _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_bool(&(*userExist), 2, 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 UserGoogleExists(ctx context.Context, exec boil.ContextExecutor, googleID string) (bool, error) {\n\tvar exists bool\n\tsql := \"select exists(select 1 from `user_google` where `google_id`=? limit 1)\"\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, googleID)\n\t}\n\trow := exec.QueryRowContext(ctx, sql, googleID)\n\n\terr := row.Scan(&exists)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"model2: unable to check if user_google exists\")\n\t}\n\n\treturn exists, nil\n}", "func (o *ViewMilestone) HasCreatedBy() bool {\n\tif o != nil && o.CreatedBy != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (d UserData) HasEmployee() bool {\n\treturn d.ModelData.Has(models.NewFieldName(\"Employee\", \"employee\"))\n}", "func (o *ViewCustomFieldTask) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func AuthUserExists(exec boil.Executor, id int) (bool, error) {\n\tvar exists bool\n\n\tsql := \"select exists(select 1 from `auth_user` where `id`=? limit 1)\"\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, sql)\n\t\tfmt.Fprintln(boil.DebugWriter, id)\n\t}\n\n\trow := exec.QueryRow(sql, id)\n\n\terr := row.Scan(&exists)\n\tif err != nil {\n\t\treturn false, errors.Wrap(err, \"models: unable to check if auth_user exists\")\n\t}\n\n\treturn exists, nil\n}", "func HasUser(user *models.User, username string) bool {\n\tvar err error\n\tqs := orm.NewOrm()\n\tif strings.IndexRune(username, '@') == -1 {\n\t\tuser.UserName = username\n\t\terr = qs.Read(user, \"UserName\")\n\t} else {\n\t\tuser.Email = username\n\t\terr = qs.Read(user, \"Email\")\n\t}\n\tif err == nil {\n\t\treturn true\n\t}\n\treturn false\n}", "func (d UserData) HasCountry() bool {\n\treturn d.ModelData.Has(models.NewFieldName(\"Country\", \"country_id\"))\n}", "func (o *BudgetProjectBudgetsResponseIncluded) HasUsers() bool {\n\tif o != nil && o.Users != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *User) HasOnPremisesImmutableId() bool {\n\tif o != nil && o.OnPremisesImmutableId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *LocalDatabaseProvider) HasId() bool {\n\tif o != nil && o.Id != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *InlineResponse20049Post) HasUserDisplayPostedDate() bool {\n\tif o != nil && o.UserDisplayPostedDate != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *MicrosoftGraphEducationUser) HasUser() bool {\n\tif o != nil && o.User != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *User) HasMemberOf() bool {\n\tif o != nil && o.MemberOf != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *User) HasMemberOf() bool {\n\tif o != nil && o.MemberOf != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *InlineResponse20027Person) HasUserName() bool {\n\tif o != nil && o.UserName != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *InlineResponse200115) HasUserDisplayPostedTime() bool {\n\tif o != nil && o.UserDisplayPostedTime != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *DepositSwitchTargetUser) HasTaxPayerId() bool {\n\tif o != nil && o.TaxPayerId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *User) HasPlanner() bool {\n\tif o != nil && o.Planner != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *NewLoyaltyProgram) HasUsersPerCardLimit() bool {\n\tif o != nil && o.UsersPerCardLimit != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (d UserData) HasRef() bool {\n\treturn d.ModelData.Has(models.NewFieldName(\"Ref\", \"ref\"))\n}", "func (d UserData) HasActivePartner() bool {\n\treturn d.ModelData.Has(models.NewFieldName(\"ActivePartner\", \"active_partner\"))\n}", "func (o *ViewProjectBudget) HasCreatedBy() bool {\n\tif o != nil && o.CreatedBy != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *User) HasUserType() bool {\n\tif o != nil && o.UserType != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *User) HasUserType() bool {\n\tif o != nil && o.UserType != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}" ]
[ "0.7764992", "0.7679247", "0.7617033", "0.7538421", "0.7315311", "0.7221342", "0.7042623", "0.70389766", "0.70389766", "0.7019756", "0.69904196", "0.69780916", "0.6939131", "0.6935679", "0.69116277", "0.6786717", "0.67335427", "0.6719342", "0.669938", "0.6655679", "0.6625618", "0.6605933", "0.64055216", "0.6387076", "0.6320005", "0.63095057", "0.630579", "0.62623763", "0.6260408", "0.6251601", "0.6249031", "0.62243044", "0.62028754", "0.62009925", "0.61767375", "0.6175972", "0.6175725", "0.6151281", "0.6140711", "0.61377037", "0.6133734", "0.61332804", "0.613083", "0.6085729", "0.6066197", "0.60648596", "0.60647416", "0.6054105", "0.60527694", "0.6051702", "0.6047638", "0.60460246", "0.603842", "0.60234183", "0.6015292", "0.6012515", "0.59893703", "0.59850174", "0.5984694", "0.597887", "0.5971005", "0.5928878", "0.59193224", "0.5915776", "0.5909584", "0.5881296", "0.58576554", "0.58571905", "0.5830196", "0.5817628", "0.5815922", "0.58158845", "0.5811887", "0.58098984", "0.5807722", "0.580767", "0.58033514", "0.5798381", "0.5797727", "0.5790083", "0.5788624", "0.5772752", "0.57713866", "0.5764091", "0.57638633", "0.5763487", "0.5755704", "0.5752628", "0.5751122", "0.5751122", "0.5745136", "0.57419705", "0.57417506", "0.57352203", "0.57295346", "0.5725812", "0.5713239", "0.57109016", "0.57088614", "0.57088614" ]
0.77906173
0
SetUserId gets a reference to the given string and assigns it to the UserId field.
func (o *AccessRequestData) SetUserId(v string) { o.UserId = &v }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (m *AadUserConversationMember) SetUserId(value *string)() {\n m.userId = value\n}", "func (m *AgreementAcceptance) SetUserId(value *string)() {\n m.userId = value\n}", "func (m *SmsLogRow) SetUserId(value *string)() {\n err := m.GetBackingStore().Set(\"userId\", value)\n if err != nil {\n panic(err)\n }\n}", "func (me *CONFIGURATION_IMPL) SetUserId(userId string) {\r\n me.user-id = userId\r\n}", "func (m *WindowsInformationProtectionDeviceRegistration) SetUserId(value *string)() {\n err := m.GetBackingStore().Set(\"userId\", value)\n if err != nil {\n panic(err)\n }\n}", "func SetUserID(ctx context.Context, userID int64) context.Context {\n\treturn context.WithValue(ctx, userIDKey, userID)\n}", "func SetUserID(ctx context.Context, userID string) context.Context {\n\treturn context.WithValue(ctx, userIDKey{}, userID)\n}", "func SetUser(next echo.HandlerFunc) echo.HandlerFunc {\n\treturn func(c echo.Context) error {\n\t\tc.Set(\"userIdFromToken\", \"12345\")\n\t\treturn next(c)\n\t}\n}", "func (s *UpdateUserRoutingProfileInput) SetUserId(v string) *UpdateUserRoutingProfileInput {\n\ts.UserId = &v\n\treturn s\n}", "func (l *Log) SetUser(ctx context.Context, id string) error {\n\tu, err := GetUser(ctx, id)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif u != nil {\n\t\tl.User = *u\n\t}\n\n\treturn nil\n}", "func (s *DismissUserContactInput) SetUserId(v string) *DismissUserContactInput {\n\ts.UserId = &v\n\treturn s\n}", "func (b *PhotosPutTagBuilder) UserID(v int) *PhotosPutTagBuilder {\n\tb.Params[\"user_id\"] = v\n\treturn b\n}", "func (m *CarserviceMutation) SetUseridID(id int) {\n\tm.userid = &id\n}", "func (s *UpdateUserSecurityProfilesInput) SetUserId(v string) *UpdateUserSecurityProfilesInput {\n\ts.UserId = &v\n\treturn s\n}", "func (pu *PostUpdate) SetUserID(u uint64) *PostUpdate {\n\tpu.mutation.ResetUserID()\n\tpu.mutation.SetUserID(u)\n\treturn pu\n}", "func (b *MessagesGetHistoryBuilder) UserID(v int) *MessagesGetHistoryBuilder {\n\tb.Params[\"user_id\"] = v\n\treturn b\n}", "func (s *UpdateUserIdentityInfoInput) SetUserId(v string) *UpdateUserIdentityInfoInput {\n\ts.UserId = &v\n\treturn s\n}", "func SetUsermetaViaUserId(iUserId int64, usermeta *Usermeta) (int64, error) {\n\tusermeta.UserId = iUserId\n\treturn Engine.Insert(usermeta)\n}", "func (s *PutUserStatusInput) SetUserId(v string) *PutUserStatusInput {\n\ts.UserId = &v\n\treturn s\n}", "func (s *UpdateUserPhoneConfigInput) SetUserId(v string) *UpdateUserPhoneConfigInput {\n\ts.UserId = &v\n\treturn s\n}", "func (puo *PostUpdateOne) SetUserID(u uint64) *PostUpdateOne {\n\tpuo.mutation.ResetUserID()\n\tpuo.mutation.SetUserID(u)\n\treturn puo\n}", "func (tc *TokenCreate) SetUserID(id int) *TokenCreate {\n\ttc.mutation.SetUserID(id)\n\treturn tc\n}", "func (s *CreateUserOutput) SetUserId(v string) *CreateUserOutput {\n\ts.UserId = &v\n\treturn s\n}", "func (m *ManagementTemplateStep) SetCreatedByUserId(value *string)() {\n err := m.GetBackingStore().Set(\"createdByUserId\", value)\n if err != nil {\n panic(err)\n }\n}", "func (m *TimerMutation) SetUserid(s string) {\n\tm.userid = &s\n}", "func (b *PhotosSaveWallPhotoBuilder) UserID(v int) *PhotosSaveWallPhotoBuilder {\n\tb.Params[\"user_id\"] = v\n\treturn b\n}", "func (sc *SessionCreate) SetUserID(s string) *SessionCreate {\n\tsc.mutation.SetUserID(s)\n\treturn sc\n}", "func (s *DisassociateTrafficDistributionGroupUserInput) SetUserId(v string) *DisassociateTrafficDistributionGroupUserInput {\n\ts.UserId = &v\n\treturn s\n}", "func (s *DeleteUserInput) SetUserId(v string) *DeleteUserInput {\n\ts.UserId = &v\n\treturn s\n}", "func (n *Namespace) SetUser(req *acomm.Request) (interface{}, *url.URL, error) {\n\tvar args UserArgs\n\tif err := req.UnmarshalArgs(&args); err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tuidMapPath := fmt.Sprintf(\"/proc/%d/uid_map\", args.PID)\n\tif err := writeIDMapFile(uidMapPath, args.UIDs); err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tgidMapPath := fmt.Sprintf(\"/proc/%d/gid_map\", args.PID)\n\tif err := writeIDMapFile(gidMapPath, args.GIDs); err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn nil, nil, nil\n}", "func SetUser(ctx context.Context, user string) context.Context {\n\treturn context.WithValue(ctx, UserIdentityKey, user)\n}", "func (b *MessagesAddChatUserBuilder) UserID(v int) *MessagesAddChatUserBuilder {\n\tb.Params[\"user_id\"] = v\n\treturn b\n}", "func (s *UpdateUserHierarchyInput) SetUserId(v string) *UpdateUserHierarchyInput {\n\ts.UserId = &v\n\treturn s\n}", "func (b *MessagesRemoveChatUserBuilder) UserID(v int) *MessagesRemoveChatUserBuilder {\n\tb.Params[\"user_id\"] = v\n\treturn b\n}", "func (k Keeper) SetUser(ctx sdk.Context, id string, username string, bio string) (*sdk.Result, error) {\n\n\tuser, err := k.GetUser(ctx, id)\n\tif err != nil {\n\t\treturn nil, sdkerrors.Wrap(sdkerrors.ErrInvalidAddress, \"User with address can not be found.\")\n\t}\n\n\tif user.Username != username && username != \"\" {\n\t\tuser.Username = username\n\t}\n\tif user.Bio != bio {\n\t\tuser.Bio = bio\n\t}\n\n\tstore := ctx.KVStore(k.storeKey)\n\tbz := k.cdc.MustMarshalBinaryLengthPrefixed(user)\n\tkey := []byte(types.UserPrefix + id)\n\tstore.Set(key, bz)\n\treturn &sdk.Result{Events: ctx.EventManager().Events()}, nil\n}", "func (m *User) SetEmployeeId(value *string)() {\n m.employeeId = value\n}", "func (s UserSet) SetID(value int64) {\n\ts.RecordCollection.Set(models.NewFieldName(\"ID\", \"id\"), value)\n}", "func (s *AssociateTrafficDistributionGroupUserInput) SetUserId(v string) *AssociateTrafficDistributionGroupUserInput {\n\ts.UserId = &v\n\treturn s\n}", "func (fc *FileCreate) SetUserID(id int) *FileCreate {\n\tfc.mutation.SetUserID(id)\n\treturn fc\n}", "func (b *MessagesDeleteConversationBuilder) UserID(v int) *MessagesDeleteConversationBuilder {\n\tb.Params[\"user_id\"] = v\n\treturn b\n}", "func (s *GetFederationTokenOutput) SetUserId(v string) *GetFederationTokenOutput {\n\ts.UserId = &v\n\treturn s\n}", "func (m *EmployeeMutation) SetUserId(s string) {\n\tm._UserId = &s\n}", "func (m *AuthenticationContext) SetId(value *string)() {\n err := m.GetBackingStore().Set(\"id\", value)\n if err != nil {\n panic(err)\n }\n}", "func (m *ScheduleChangeRequest) SetSenderUserId(value *string)() {\n err := m.GetBackingStore().Set(\"senderUserId\", value)\n if err != nil {\n panic(err)\n }\n}", "func SetUserIDInContext(ctx context.Context, userID int) {\n\t// create a header that the gateway will watch for\n\theader := metadata.Pairs(\"gateway-session-userId\", strconv.Itoa(userID))\n\t// send the header back to the gateway\n\tgrpc.SendHeader(ctx, header)\n}", "func (rec *RawEventCreate) SetUserID(s string) *RawEventCreate {\n\trec.mutation.SetUserID(s)\n\treturn rec\n}", "func (t *Token) SetUserID(userID int64) {\n\tt.UserID = userID\n}", "func (m *ManagementTemplateStepTenantSummary) SetCreatedByUserId(value *string)() {\n err := m.GetBackingStore().Set(\"createdByUserId\", value)\n if err != nil {\n panic(err)\n }\n}", "func (s *DescribeUserInput) SetUserId(v string) *DescribeUserInput {\n\ts.UserId = &v\n\treturn s\n}", "func (s *UserQuickConnectConfig) SetUserId(v string) *UserQuickConnectConfig {\n\ts.UserId = &v\n\treturn s\n}", "func (o *LastUserActivityTimeHandlerParams) SetUserID(userID string) {\n\to.UserID = userID\n}", "func (s *TrafficDistributionGroupUserSummary) SetUserId(v string) *TrafficDistributionGroupUserSummary {\n\ts.UserId = &v\n\treturn s\n}", "func (m *EmployeeMutation) SetUserID(s string) {\n\tm._User_id = &s\n}", "func (o *VulnUpdateNotification) SetUserId(v string) {\n\to.UserId = &v\n}", "func (s *UserAccessResultItem) SetUserId(v string) *UserAccessResultItem {\n\ts.UserId = &v\n\treturn s\n}", "func (bc *BillCreate) SetUserID(id int) *BillCreate {\n\tbc.mutation.SetUserID(id)\n\treturn bc\n}", "func SetUserOnContext(param string) gin.HandlerFunc {\n\n\treturn func(c *gin.Context) {\n\n\t\tuid := bson.ObjectIdHex(c.Params.ByName(param))\n\t\tu, err := service.ReadUserByID(uid)\n\t\tif err != nil {\n\t\t\tif err == mgo.ErrNotFound {\n\t\t\t\terrors.Send(c, errors.NotFound())\n\t\t\t} else {\n\t\t\t\tlogger.Error(err)\n\t\t\t\terrors.Send(c, fmt.Errorf(\"failed to get a user\"))\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tutils.SetTargetUser(c, u)\n\t}\n}", "func SetUser(userin UserAdd) (lastid int64, err error) {\n\t// var user UserOut\n\t// var kontak contact.ContactIn\n\tvar user UserIn\n\tvar userup UserUpdate\n\n\tuser.Uname = userin.Uname\n\n\tusers, err := FindUser(user)\n\tlog.Printf(\"%+v\", users)\n\tlog.Printf(\"%+v\", user)\n\tlog.Printf(\"%+v\", userin)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tif len(users) < 1 {\n\t\treturn 0, errors.New(\"User not found.\")\n\t}\n\n\tif len(users) < 1 {\n\t\treturn InsertUser(userin)\n\t} else {\n\t\tuserup.ContactType = userin.ContactType\n\t\tuserup.Upass = userin.Upass\n\t\treturn UpdateUser(users[0].Uid, userup)\n\t}\n\n\treturn\n}", "func (o *ViewUserDashboard) SetUserId(v int32) {\n\to.UserId = &v\n}", "func (cic *CarInspectionCreate) SetUserID(id int) *CarInspectionCreate {\n\tcic.mutation.SetUserID(id)\n\treturn cic\n}", "func (o *CreateSwiftPasswordParams) SetUserID(userID string) {\n\to.UserID = userID\n}", "func (o *VerifyCallerIDParams) SetUserID(userID string) {\n\to.UserID = userID\n}", "func (m *ScheduleChangeRequest) SetManagerUserId(value *string)() {\n err := m.GetBackingStore().Set(\"managerUserId\", value)\n if err != nil {\n panic(err)\n }\n}", "func (ec *ExperienceCreate) SetUserID(id int) *ExperienceCreate {\n\tec.mutation.SetUserID(id)\n\treturn ec\n}", "func (ocu *OAuthConnectionUpdate) SetUserID(id int) *OAuthConnectionUpdate {\n\tocu.mutation.SetUserID(id)\n\treturn ocu\n}", "func UserID(ctx *context.Context) *int {\n\tuserID := (*ctx).Value(KeyUserID)\n\tif userID != nil {\n\t\tv := userID.(int)\n\t\treturn &v\n\t}\n\treturn nil\n}", "func UserID(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldUserID), v))\n\t})\n}", "func (p *Profile) SetUserID(id string) error {\n\tobjID, err := primitive.ObjectIDFromHex(id)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tp.UserID = objID\n\treturn nil\n}", "func (ocuo *OAuthConnectionUpdateOne) SetUserID(id int) *OAuthConnectionUpdateOne {\n\tocuo.mutation.SetUserID(id)\n\treturn ocuo\n}", "func (o SignatureResponsePtrOutput) UserId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SignatureResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.UserId\n\t}).(pulumi.StringPtrOutput)\n}", "func (m *RepairinvoiceMutation) SetUserid(i int) {\n\tm.userid = &i\n\tm.adduserid = nil\n}", "func UserID(ctx context.Context) string {\n\tif ctx == nil {\n\t\treturn \"\"\n\t}\n\n\tif id, ok := ctx.Value(userIDKey{}).(string); ok {\n\t\treturn id\n\t}\n\n\treturn \"\"\n}", "func (csuo *CardScheduleUpdateOne) SetUserID(id int) *CardScheduleUpdateOne {\n\tcsuo.mutation.SetUserID(id)\n\treturn csuo\n}", "func (r userQueryIDString) Set(value string) userSetParams {\n\n\treturn userSetParams{\n\t\tdata: builder.Field{\n\t\t\tName: \"id\",\n\t\t\tValue: value,\n\t\t},\n\t}\n\n}", "func (cookieAuth *CookieAuth) Set(userId int64, w http.ResponseWriter) error {\n\tvalue := map[string]string{\n\t\t\"userId\": fmt.Sprintf(\"%v\", userId),\n\t\t\"createdAt\": time.Now().Format(createdAtLayout),\n\t}\n\tencoded, err := cookieAuth.secureCookie.Encode(cookieAuth.cookieName, value)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Cookieauth.Set: %s\", err)\n\t}\n\tcookie := &http.Cookie{\n\t\tName: cookieAuth.cookieName,\n\t\tValue: encoded,\n\t\tPath: \"/\",\n\t}\n\thttp.SetCookie(w, cookie)\n\treturn nil\n}", "func (rc *RentalCreate) SetUserID(i int) *RentalCreate {\n\trc.mutation.SetUserID(i)\n\treturn rc\n}", "func (o *GetServiceDetailsParams) SetUserID(userID *string) {\n\to.UserID = userID\n}", "func (o *SetPlanParams) SetUserID(userID string) {\n\to.UserID = userID\n}", "func (o *AdminCreateJusticeUserParams) SetUserID(userID string) {\n\to.UserID = userID\n}", "func (api API) UserId() (nickname string, err error) {\n\tbearer, err := api.Authenticator.GetToken(\"code:all\")\n\tif err != nil {\n\t\treturn\n\t}\n\tpath := api.Authenticator.GetHostPath() + api.DesignAutomationPath\n\tnickname, err = getUserID(path, bearer.AccessToken)\n\n\treturn\n}", "func (o *CreateCartUsingPOSTParams) SetUserID(userID string) {\n\to.UserID = userID\n}", "func (o *ViewUserUtilization) SetUserId(v int32) {\n\to.UserId = &v\n}", "func (p *Person) AddUserID(userID, serviceProvider string) error {\n\n\t// Must be greater than 2 characters\n\tif len(userID) <= 2 {\n\t\treturn ErrUserIDTooShort\n\t}\n\n\t// Must be greater than 2 characters\n\tif len(serviceProvider) <= 2 {\n\t\treturn ErrServiceProviderTooShort\n\t}\n\n\t// Accepted provider?\n\tif !isAcceptedValue(strings.ToLower(serviceProvider), &AllowedServiceProviders) {\n\t\treturn ErrServiceProviderNotAccepted\n\t}\n\n\t// Set the user id\n\tnewUserID := new(UserID)\n\tnewUserID.Content = userID + \"@\" + serviceProvider\n\tp.UserIDs = append(p.UserIDs, *newUserID)\n\treturn nil\n}", "func (o LookupClusterRoleTemplateBindingResultOutput) UserId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupClusterRoleTemplateBindingResult) string { return v.UserId }).(pulumi.StringOutput)\n}", "func (b *backend) setCachedUserId(userId, arn string) {\n\tif userId != \"\" {\n\t\tb.iamUserIdToArnCache.SetDefault(userId, arn)\n\t}\n}", "func (a *Funcs) UserID() (string, error) {\n\ta.stsInit.Do(a.initSTS)\n\treturn a.sts.UserID()\n}", "func (db *Database) SetUserOwnerID(id int, owner bool) error {\n\t_, err := db.db.Exec(`\n\t\tUPDATE melodious.accounts SET owner=$1 WHERE id=$2;\n\t`, owner, id)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "func UserID(ctx *context.APIContext) int64 {\n\tif ctx.User == nil {\n\t\treturn 0\n\t}\n\treturn ctx.User.ID\n}", "func (fc *FinancierCreate) SetUserID(id int) *FinancierCreate {\n\tfc.mutation.SetUserID(id)\n\treturn fc\n}", "func (o SignatureResponseOutput) UserId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v SignatureResponse) string { return v.UserId }).(pulumi.StringOutput)\n}", "func (m *TeamworkTag) SetTeamId(value *string)() {\n err := m.GetBackingStore().Set(\"teamId\", value)\n if err != nil {\n panic(err)\n }\n}", "func (m *ChannelIdentity) SetTeamId(value *string)() {\n m.teamId = value\n}", "func (eu *EmployeeUpdate) SetUserID(s string) *EmployeeUpdate {\n\teu.mutation.SetUserID(s)\n\treturn eu\n}", "func (s *TransferContactInput) SetUserId(v string) *TransferContactInput {\n\ts.UserId = &v\n\treturn s\n}", "func (o SignaturePtrOutput) UserId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Signature) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.UserId\n\t}).(pulumi.StringPtrOutput)\n}", "func (csu *CardScheduleUpdate) SetUserID(id int) *CardScheduleUpdate {\n\tcsu.mutation.SetUserID(id)\n\treturn csu\n}", "func (o GetUsersUserOutput) UserId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetUsersUser) string { return v.UserId }).(pulumi.StringOutput)\n}", "func (o *RevokeUserEntitlementsParams) SetUserID(userID string) {\n\to.UserID = userID\n}", "func (o *QueryUserExpGrantHistoryParams) SetUserID(userID string) {\n\to.UserID = userID\n}", "func (m *AzureCommunicationServicesUserIdentity) SetAzureCommunicationServicesResourceId(value *string)() {\n err := m.GetBackingStore().Set(\"azureCommunicationServicesResourceId\", value)\n if err != nil {\n panic(err)\n }\n}" ]
[ "0.754685", "0.75178033", "0.70284283", "0.70102644", "0.6776764", "0.67461425", "0.6688281", "0.6597905", "0.64959896", "0.6450103", "0.64214563", "0.64158237", "0.6393884", "0.63617873", "0.62955916", "0.62878066", "0.62769747", "0.6273325", "0.6268673", "0.6216421", "0.6200321", "0.61933416", "0.61815065", "0.6180387", "0.6167512", "0.6146465", "0.60972756", "0.60846764", "0.60792404", "0.6074463", "0.6071172", "0.6070907", "0.60297006", "0.6025107", "0.6021863", "0.6010811", "0.5990309", "0.5988365", "0.5979481", "0.59787905", "0.5971643", "0.5934943", "0.59289", "0.59255016", "0.5920243", "0.59156287", "0.59137946", "0.59137917", "0.59089154", "0.5900113", "0.5897892", "0.58818716", "0.58760834", "0.58587825", "0.5842863", "0.58240616", "0.582184", "0.58206534", "0.58095795", "0.58074087", "0.58059347", "0.57748306", "0.5766672", "0.57561666", "0.5742039", "0.5736968", "0.5733958", "0.5719979", "0.57169837", "0.5712466", "0.57047784", "0.5690281", "0.5682801", "0.5667008", "0.5648534", "0.5645366", "0.56423664", "0.5632318", "0.56274", "0.5624183", "0.5623464", "0.562106", "0.5611524", "0.5601911", "0.5601907", "0.5597536", "0.5592342", "0.5590524", "0.5586306", "0.55694973", "0.55654263", "0.556015", "0.55417436", "0.553328", "0.55266947", "0.5524039", "0.55237454", "0.55187446", "0.5506124", "0.55020124" ]
0.6308782
14
GetReason returns the Reason field value if set, zero value otherwise.
func (o *AccessRequestData) GetReason() string { if o == nil || o.Reason == nil { var ret string return ret } return *o.Reason }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (b *Base) GetReason() string {\n\treturn b.Reason\n}", "func GetReason(from Getter, t string) string {\n\tif c := Get(from, t); c != nil {\n\t\treturn c.Reason\n\t}\n\treturn \"\"\n}", "func (s *Subscription) GetReason() string {\n\tif s == nil || s.Reason == nil {\n\t\treturn \"\"\n\t}\n\treturn *s.Reason\n}", "func (r *ReportStoryRequest) GetReason() (value ReportReasonClass) {\n\tif r == nil {\n\t\treturn\n\t}\n\treturn r.Reason\n}", "func (r *MessagesReportRequest) GetReason() (value ReportReasonClass) {\n\tif r == nil {\n\t\treturn\n\t}\n\treturn r.Reason\n}", "func (o *DeploymentsCondition) GetReason() string {\n\tif o == nil || o.Reason == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Reason\n}", "func (o *DataPlaneClusterUpdateStatusRequestConditions) GetReason() string {\n\tif o == nil || o.Reason == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Reason\n}", "func (r *StoriesReportRequest) GetReason() (value ReportReasonClass) {\n\tif r == nil {\n\t\treturn\n\t}\n\treturn r.Reason\n}", "func (n *Notification) GetReason() string {\n\tif n == nil || n.Reason == nil {\n\t\treturn \"\"\n\t}\n\treturn *n.Reason\n}", "func (o *MuteFindingResponseProperties) GetReason() FindingMuteReason {\n\tif o == nil || o.Reason == nil {\n\t\tvar ret FindingMuteReason\n\t\treturn ret\n\t}\n\treturn *o.Reason\n}", "func (o *MuteFindingRequestProperties) GetReason() FindingMuteReason {\n\tif o == nil {\n\t\tvar ret FindingMuteReason\n\t\treturn ret\n\t}\n\treturn o.Reason\n}", "func (p *PhoneCallDiscarded) GetReason() (value PhoneCallDiscardReasonClass, ok bool) {\n\tif !p.Flags.Has(0) {\n\t\treturn value, false\n\t}\n\treturn p.Reason, true\n}", "func GetReason(message report.IMessage) int32 {\n\tswitch message.MessageType() {\n\tcase \"+RSP\", \"+BSP\":\n\t\treturn getLocationReason(message)\n\tcase \"+EVT\", \"+BVT\":\n\t\treturn getEventCode(message)\n\n\t}\n\treturn int32(6)\n}", "func GetReason(message report.IMessage) int32 {\n\tswitch message.MessageType() {\n\tcase \"+RSP\", \"+BSP\":\n\t\treturn getLocationReason(message)\n\tcase \"+EVT\", \"+BVT\":\n\t\treturn getEventCode(message)\n\n\t}\n\treturn int32(6)\n}", "func (o *SecurityProblemEvent) GetReason() string {\n\tif o == nil || o.Reason == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Reason\n}", "func (s *SessionTrackerV1) GetReason() string {\n\treturn s.Spec.Reason\n}", "func (s *SignatureVerification) GetReason() string {\n\tif s == nil || s.Reason == nil {\n\t\treturn \"\"\n\t}\n\treturn *s.Reason\n}", "func (o *V0037Node) GetReason() string {\n\tif o == nil || o.Reason == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Reason\n}", "func (e GetMessageResponseValidationError) Reason() string { return e.reason }", "func (s *Container) SetReason(v string) *Container {\n\ts.Reason = &v\n\treturn s\n}", "func (e HealthStatusSetValidationError) Reason() string { return e.reason }", "func (s *PropertyValidationExceptionProperty) SetReason(v string) *PropertyValidationExceptionProperty {\n\ts.Reason = &v\n\treturn s\n}", "func (e MessageDValidationError) Reason() string { return e.reason }", "func (s *ManagedAgent) SetReason(v string) *ManagedAgent {\n\ts.Reason = &v\n\treturn s\n}", "func (resp *Response) Reason() string {\n\treturn resp.Status\n}", "func (c *ContainerStatusResolver) Reason() *string {\n\treturn c.reason\n}", "func (e GetMessageRequestValidationError) Reason() string { return e.reason }", "func (e SetRequestValidationError) Reason() string { return e.reason }", "func (s *StopInferenceExperimentInput) SetReason(v string) *StopInferenceExperimentInput {\n\ts.Reason = &v\n\treturn s\n}", "func (s *RejectedRecord) SetReason(v string) *RejectedRecord {\n\ts.Reason = &v\n\treturn s\n}", "func (s *Anomaly) SetReason(v string) *Anomaly {\n\ts.Reason = &v\n\treturn s\n}", "func (e MessageEValidationError) Reason() string { return e.reason }", "func (o *DataPlaneClusterUpdateStatusRequestConditions) SetReason(v string) {\n\to.Reason = &v\n}", "func (e GetResponseValidationError) Reason() string { return e.reason }", "func (s *StopTaskInput) SetReason(v string) *StopTaskInput {\n\ts.Reason = &v\n\treturn s\n}", "func (o *DeploymentsCondition) SetReason(v string) {\n\to.Reason = &v\n}", "func (o JobConditionOutput) Reason() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v JobCondition) *string { return v.Reason }).(pulumi.StringPtrOutput)\n}", "func (o *AccessRequestData) SetReason(v string) {\n\to.Reason = &v\n}", "func (o HorizontalPodAutoscalerConditionPatchOutput) Reason() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v HorizontalPodAutoscalerConditionPatch) *string { return v.Reason }).(pulumi.StringPtrOutput)\n}", "func (o HorizontalPodAutoscalerConditionPatchOutput) Reason() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v HorizontalPodAutoscalerConditionPatch) *string { return v.Reason }).(pulumi.StringPtrOutput)\n}", "func (e MessageFValidationError) Reason() string { return e.reason }", "func (s *Failure) SetReason(v string) *Failure {\n\ts.Reason = &v\n\treturn s\n}", "func (m DontKnowTrade) GetDKReason() (v enum.DKReason, err quickfix.MessageRejectError) {\n\tvar f field.DKReasonField\n\tif err = m.Get(&f); err == nil {\n\t\tv = f.Value()\n\t}\n\treturn\n}", "func (p *PodStatusResolver) Reason() *string {\n\treturn p.reason\n}", "func (s *SubmitContainerStateChangeInput) SetReason(v string) *SubmitContainerStateChangeInput {\n\ts.Reason = &v\n\treturn s\n}", "func (e ResponseValidationError) Reason() string { return e.reason }", "func (e ChannelPayResponseValidationError) Reason() string { return e.reason }", "func (e GetRequestValidationError) Reason() string { return e.reason }", "func (e GetRequestValidationError) Reason() string { return e.reason }", "func (s *SubmitTaskStateChangeInput) SetReason(v string) *SubmitTaskStateChangeInput {\n\ts.Reason = &v\n\treturn s\n}", "func (s *ContainerStateChange) SetReason(v string) *ContainerStateChange {\n\ts.Reason = &v\n\treturn s\n}", "func (o ValidationPatchOutput) Reason() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ValidationPatch) *string { return v.Reason }).(pulumi.StringPtrOutput)\n}", "func (e SimpleResponseValidationError) Reason() string { return e.reason }", "func (e EmptyValidationError) Reason() string { return e.reason }", "func (e UpdateMessageResponseValidationError) Reason() string { return e.reason }", "func (e ActiveHealthCheckValidationError) Reason() string { return e.reason }", "func (e RequirementRuleValidationError) Reason() string { return e.reason }", "func (e MessageCValidationError) Reason() string { return e.reason }", "func (s *DataLakeUpdateException) SetReason(v string) *DataLakeUpdateException {\n\ts.Reason = &v\n\treturn s\n}", "func (o HorizontalPodAutoscalerConditionOutput) Reason() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v HorizontalPodAutoscalerCondition) *string { return v.Reason }).(pulumi.StringPtrOutput)\n}", "func (o HorizontalPodAutoscalerConditionOutput) Reason() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v HorizontalPodAutoscalerCondition) *string { return v.Reason }).(pulumi.StringPtrOutput)\n}", "func (e EutracgiValidationError) Reason() string { return e.reason }", "func (e RetrieveResponseValidationError) Reason() string { return e.reason }", "func (o *MuteFindingResponseProperties) SetReason(v FindingMuteReason) {\n\to.Reason = &v\n}", "func (e DescribeMeetingV1ResponseValidationError) Reason() string { return e.reason }", "func (e RetrieveBookingResponseValidationError) Reason() string { return e.reason }", "func (e InternalUpstreamTransport_MetadataValueSourceValidationError) Reason() string {\n\treturn e.reason\n}", "func (e ChannelPayRequestValidationError) Reason() string { return e.reason }", "func (o ValidationOutput) Reason() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v Validation) *string { return v.Reason }).(pulumi.StringPtrOutput)\n}", "func (e BitStringValidationError) Reason() string { return e.reason }", "func (u *User) GetRestrictionReason() (value []RestrictionReason, ok bool) {\n\tif u == nil {\n\t\treturn\n\t}\n\tif !u.Flags.Has(18) {\n\t\treturn value, false\n\t}\n\treturn u.RestrictionReason, true\n}", "func (p *PhoneCallDiscarded) SetReason(value PhoneCallDiscardReasonClass) {\n\tp.Flags.Set(0)\n\tp.Reason = value\n}", "func (e GetDisscusRespValidationError) Reason() string { return e.reason }", "func (o *MuteFindingRequestProperties) SetReason(v FindingMuteReason) {\n\to.Reason = v\n}", "func (se *StatusError) Reason() string {\n\treturn se.message\n}", "func (a Acknowledgement) Reason() error {\n\tswitch {\n\tcase a.State == ACK:\n\t\treturn nil\n\tcase a.State == NACK:\n\t\treturn errors.New(string(a.Message))\n\tdefault:\n\t\treturn errors.New(\"unknown acknowledgement status\")\n\t}\n}", "func (o ApplicationStatusConditionsOutput) Reason() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ApplicationStatusConditions) string { return v.Reason }).(pulumi.StringOutput)\n}", "func (s *ManagedAgentStateChange) SetReason(v string) *ManagedAgentStateChange {\n\ts.Reason = &v\n\treturn s\n}", "func (e StatusResponseValidationError) Reason() string { return e.reason }", "func (e DeleteMessageResponseValidationError) Reason() string { return e.reason }", "func GetReason(message report.IMessage) int32 {\n\tidt, found := message.GetValue(fields.DeviceType)\n\tif !found {\n\t\treturn 6 //periodical\n\t}\n\n\tdeviceType, valid := idt.(byte)\n\tif !valid {\n\t\treturn 6 //periodical\n\t}\n\n\tswitch deviceType {\n\tcase devicetypes.GV320:\n\t\treturn gv300.GetReason(message)\n\n\tcase devicetypes.GV55, devicetypes.GV55N:\n\t\treturn gv55.GetReason(message)\n\n\tcase devicetypes.GV55Lite, devicetypes.GV55NLite:\n\t\treturn gv55.GetReasonLite(message)\n\n\tcase devicetypes.GV75, devicetypes.GV75W:\n\t\treturn gv75.GetReason(message)\n\n\tcase devicetypes.GV55W:\n\t\treturn gv55w.GetReason(message)\n\n\tcase devicetypes.GV600W:\n\t\treturn gv600.GetReason(message)\n\tcase devicetypes.GV300W:\n\t\treturn gv300w.GetReason(message)\n\tdefault:\n\t\treturn gv55.GetReason(message)\n\t}\n}", "func (e GetDisscusReqValidationError) Reason() string { return e.reason }", "func (e RdsValidationError) Reason() string { return e.reason }", "func (o MachineInstanceStatusConditionsOutput) Reason() pulumi.StringOutput {\n\treturn o.ApplyT(func(v MachineInstanceStatusConditions) string { return v.Reason }).(pulumi.StringOutput)\n}", "func (m MarketDataRequestReject) GetMDReqRejReason() (v enum.MDReqRejReason, err quickfix.MessageRejectError) {\n\tvar f field.MDReqRejReasonField\n\tif err = m.Get(&f); err == nil {\n\t\tv = f.Value()\n\t}\n\treturn\n}", "func (e DescribeMeetingV1RequestValidationError) Reason() string { return e.reason }", "func (e CommonResponseValidationError) Reason() string { return e.reason }", "func (e RetrievePaymentRequestValidationError) Reason() string { return e.reason }", "func (o BuildStatusPtrOutput) Reason() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *BuildStatus) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Reason\n\t}).(pulumi.StringPtrOutput)\n}", "func (e CardHolderValidationError) Reason() string { return e.reason }", "func (e Response_DataValidationError) Reason() string { return e.reason }", "func (e SimpleRequestValidationError) Reason() string { return e.reason }", "func (e GetEventByIDResponseValidationError) Reason() string { return e.reason }", "func (e ConfigureAssessmentResponseValidationError) Reason() string { return e.reason }", "func (e CreatMessageResponseValidationError) Reason() string { return e.reason }", "func (e BootstrapValidationError) Reason() string { return e.reason }", "func (e UpdateTodoResponseValidationError) Reason() string { return e.reason }", "func (e HealthCheck_PayloadValidationError) Reason() string { return e.reason }", "func (e MessageBValidationError) Reason() string { return e.reason }", "func (_this *CrashReportBody) Reason() *string {\n\tvar ret *string\n\tvalue := _this.Value_JS.Get(\"reason\")\n\tif value.Type() != js.TypeNull && value.Type() != js.TypeUndefined {\n\t\t__tmp := (value).String()\n\t\tret = &__tmp\n\t}\n\treturn ret\n}" ]
[ "0.7881321", "0.7736951", "0.77345765", "0.77187985", "0.7605984", "0.75381196", "0.75138223", "0.7449624", "0.74401706", "0.7421407", "0.7380199", "0.7271233", "0.72215086", "0.72215086", "0.71996367", "0.7155041", "0.7095448", "0.68987787", "0.6869592", "0.6823121", "0.6797064", "0.673151", "0.6723331", "0.6722505", "0.6716403", "0.6701053", "0.66895825", "0.66839844", "0.6673606", "0.6666264", "0.665034", "0.6648263", "0.6647952", "0.66414165", "0.6641313", "0.66080105", "0.65954536", "0.656579", "0.65489244", "0.65489244", "0.65365154", "0.6532255", "0.65174305", "0.65116227", "0.65091133", "0.65038896", "0.6500438", "0.64982575", "0.64982575", "0.6496319", "0.6481778", "0.6473417", "0.64733446", "0.6472621", "0.64615643", "0.64589566", "0.6453503", "0.6450438", "0.6448896", "0.6434581", "0.6434581", "0.6434232", "0.64297664", "0.6427863", "0.6424238", "0.6417741", "0.64134264", "0.64127946", "0.6409423", "0.64084435", "0.6406356", "0.64057267", "0.6405489", "0.6401576", "0.6397913", "0.6395718", "0.639294", "0.6389999", "0.6386704", "0.6363505", "0.63619375", "0.6356801", "0.6355596", "0.6352561", "0.63516116", "0.6346708", "0.63462216", "0.6345075", "0.6332526", "0.6329929", "0.63157666", "0.6310446", "0.63065046", "0.6304546", "0.6301416", "0.62962884", "0.62935406", "0.62921745", "0.62911415", "0.6290399" ]
0.74195594
10
GetReasonOk returns a tuple with the Reason field value if set, nil otherwise and a boolean to check if the value has been set.
func (o *AccessRequestData) GetReasonOk() (*string, bool) { if o == nil || o.Reason == nil { return nil, false } return o.Reason, true }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *MuteFindingRequestProperties) GetReasonOk() (*FindingMuteReason, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Reason, true\n}", "func (o *SecurityProblemEvent) GetReasonOk() (*string, bool) {\n\tif o == nil || o.Reason == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Reason, true\n}", "func (o *DeploymentsCondition) GetReasonOk() (*string, bool) {\n\tif o == nil || o.Reason == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Reason, true\n}", "func (o *MuteFindingResponseProperties) GetReasonOk() (*FindingMuteReason, bool) {\n\tif o == nil || o.Reason == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Reason, true\n}", "func (o *DataPlaneClusterUpdateStatusRequestConditions) GetReasonOk() (*string, bool) {\n\tif o == nil || o.Reason == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Reason, true\n}", "func (o *V0037Node) GetReasonOk() (*string, bool) {\n\tif o == nil || o.Reason == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Reason, true\n}", "func (o *DataPlaneClusterUpdateStatusRequestConditions) GetReason() string {\n\tif o == nil || o.Reason == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Reason\n}", "func (o *MuteFindingResponseProperties) HasReason() bool {\n\treturn o != nil && o.Reason != nil\n}", "func (o *Transfer) GetFailureReasonOk() (*TransferFailure, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.FailureReason.Get(), o.FailureReason.IsSet()\n}", "func (o *MuteFindingResponseProperties) GetReason() FindingMuteReason {\n\tif o == nil || o.Reason == nil {\n\t\tvar ret FindingMuteReason\n\t\treturn ret\n\t}\n\treturn *o.Reason\n}", "func (o *VirtualizationIweHost) GetFailureReasonOk() (*string, bool) {\n\tif o == nil || o.FailureReason == nil {\n\t\treturn nil, false\n\t}\n\treturn o.FailureReason, true\n}", "func (o *Permissao) GetDescricaoOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Descricao.Get(), o.Descricao.IsSet()\n}", "func (o *MuteFindingRequestProperties) GetReason() FindingMuteReason {\n\tif o == nil {\n\t\tvar ret FindingMuteReason\n\t\treturn ret\n\t}\n\treturn o.Reason\n}", "func (o *UcsdBackupInfoAllOf) GetFailureReasonOk() (*string, bool) {\n\tif o == nil || o.FailureReason == nil {\n\t\treturn nil, false\n\t}\n\treturn o.FailureReason, true\n}", "func (p *PhoneCallDiscarded) GetReason() (value PhoneCallDiscardReasonClass, ok bool) {\n\tif !p.Flags.Has(0) {\n\t\treturn value, false\n\t}\n\treturn p.Reason, true\n}", "func (o *MuteFindingRequestProperties) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "func GetReason(from Getter, t string) string {\n\tif c := Get(from, t); c != nil {\n\t\treturn c.Reason\n\t}\n\treturn \"\"\n}", "func (o *EquipmentFanModule) GetOperReasonOk() ([]string, bool) {\n\tif o == nil || o.OperReason == nil {\n\t\treturn nil, false\n\t}\n\treturn o.OperReason, true\n}", "func (r *ReportStoryRequest) GetReason() (value ReportReasonClass) {\n\tif r == nil {\n\t\treturn\n\t}\n\treturn r.Reason\n}", "func (o *MuteFindingResponseProperties) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "func (o *VirtualizationIweVirtualMachine) GetFailureReasonOk() (*string, bool) {\n\tif o == nil || o.FailureReason == nil {\n\t\treturn nil, false\n\t}\n\treturn o.FailureReason, true\n}", "func (o *SecurityProblem) GetMutedOk() (*bool, bool) {\n\tif o == nil || o.Muted == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Muted, true\n}", "func (o *DataPlaneClusterUpdateStatusRequestConditions) HasReason() bool {\n\tif o != nil && o.Reason != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *DeploymentsCondition) GetReason() string {\n\tif o == nil || o.Reason == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Reason\n}", "func (o *EventRuleAction) GetBlockedOk() (*bool, bool) {\n\tif o == nil || o.Blocked == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Blocked, true\n}", "func (o *StatusDescriptorDTO) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "func (r *MessagesReportRequest) GetReason() (value ReportReasonClass) {\n\tif r == nil {\n\t\treturn\n\t}\n\treturn r.Reason\n}", "func (o *CreditBankEmploymentWarning) GetCauseOk() (*CreditBankIncomeCause, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Cause, true\n}", "func (o *EquipmentIoCardBase) GetOperReasonOk() ([]string, bool) {\n\tif o == nil || o.OperReason == nil {\n\t\treturn nil, false\n\t}\n\treturn o.OperReason, true\n}", "func (o *ConvergedinfraServerComplianceDetailsAllOf) GetHclStatusReasonOk() (*string, bool) {\n\tif o == nil || o.HclStatusReason == nil {\n\t\treturn nil, false\n\t}\n\treturn o.HclStatusReason, true\n}", "func (o *EventTypeIn) GetDescriptionOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Description, true\n}", "func (o *AccessRequestData) GetReason() string {\n\tif o == nil || o.Reason == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Reason\n}", "func (o *TransactionData) GetDescriptionOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Description, true\n}", "func (e BitStringValidationError) Reason() string { return e.reason }", "func (o *RecurrenceRepetition) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "func (e GetMessageResponseValidationError) Reason() string { return e.reason }", "func (b *Base) GetReason() string {\n\treturn b.Reason\n}", "func (o *Channel) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "func (e CreatMessageResponseValidationError) Reason() string { return e.reason }", "func (o *VirtualizationIweClusterAllOf) GetFailureReasonOk() (*string, bool) {\n\tif o == nil || o.FailureReason == nil {\n\t\treturn nil, false\n\t}\n\treturn o.FailureReason, true\n}", "func (o *WorkflowSolutionActionDefinition) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "func (r *StoriesReportRequest) GetReason() (value ReportReasonClass) {\n\tif r == nil {\n\t\treturn\n\t}\n\treturn r.Reason\n}", "func GetReason(message report.IMessage) int32 {\n\tswitch message.MessageType() {\n\tcase \"+RSP\", \"+BSP\":\n\t\treturn getLocationReason(message)\n\tcase \"+EVT\", \"+BVT\":\n\t\treturn getEventCode(message)\n\n\t}\n\treturn int32(6)\n}", "func GetReason(message report.IMessage) int32 {\n\tswitch message.MessageType() {\n\tcase \"+RSP\", \"+BSP\":\n\t\treturn getLocationReason(message)\n\tcase \"+EVT\", \"+BVT\":\n\t\treturn getEventCode(message)\n\n\t}\n\treturn int32(6)\n}", "func (e ChannelPayResponseValidationError) Reason() string { return e.reason }", "func (e UpdateMessageResponseValidationError) Reason() string { return e.reason }", "func (e SimpleResponseValidationError) Reason() string { return e.reason }", "func (e HealthStatusSetValidationError) Reason() string { return e.reason }", "func (o *OpenapiTaskGenerationResult) GetFailureReasonOk() (*string, bool) {\n\tif o == nil || o.FailureReason == nil {\n\t\treturn nil, false\n\t}\n\treturn o.FailureReason, true\n}", "func (e OutOfOneofValidationError) Reason() string { return e.reason }", "func (o *WorkflowWorkflowDefinitionAllOf) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "func (o *UpdateRole) GetDescriptionOk() (string, bool) {\n\tif o == nil || o.Description == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Description, true\n}", "func (o *Rule) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "func (o *SecurityProblemEvent) HasReason() bool {\n\tif o != nil && o.Reason != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (s *SessionTrackerV1) GetReason() string {\n\treturn s.Spec.Reason\n}", "func (o *Commitstatus) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "func (e DescribeMeetingV1ResponseValidationError) Reason() string { return e.reason }", "func (o *DataPlaneClusterUpdateStatusRequestConditions) SetReason(v string) {\n\to.Reason = &v\n}", "func (o *ProdutoVM) GetDescricaoOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Descricao.Get(), o.Descricao.IsSet()\n}", "func (e CommonResponseValidationError) Reason() string { return e.reason }", "func (o *V0037Node) GetReasonSetByUserOk() (*string, bool) {\n\tif o == nil || o.ReasonSetByUser == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ReasonSetByUser, true\n}", "func (n *Notification) GetReason() string {\n\tif n == nil || n.Reason == nil {\n\t\treturn \"\"\n\t}\n\treturn *n.Reason\n}", "func (o *EquipmentFanModule) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "func (o *Transfer) GetDescriptionOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Description, true\n}", "func (o *AccessRequestData) HasReason() bool {\n\tif o != nil && o.Reason != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (s *Subscription) GetReason() string {\n\tif s == nil || s.Reason == nil {\n\t\treturn \"\"\n\t}\n\treturn *s.Reason\n}", "func (o *TransferParams) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "func (o *CustomVendaResultado) GetMessageOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Message.Get(), o.Message.IsSet()\n}", "func (o *CreateRiskRulesData) GetDescriptionOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Description, true\n}", "func (o *GovChainMetadata) GetDescriptionOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Description, true\n}", "func (e HelloResponseValidationError) Reason() string { return e.reason }", "func (o *ConnectorTypeAllOf) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "func (o *ConnectorTypeAllOf) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "func (o HorizontalPodAutoscalerConditionPatchOutput) Reason() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v HorizontalPodAutoscalerConditionPatch) *string { return v.Reason }).(pulumi.StringPtrOutput)\n}", "func (o HorizontalPodAutoscalerConditionPatchOutput) Reason() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v HorizontalPodAutoscalerConditionPatch) *string { return v.Reason }).(pulumi.StringPtrOutput)\n}", "func (o *ResourceVersionUpdateReqWeb) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "func (e GetResponseValidationError) Reason() string { return e.reason }", "func (o *MuteFindingRequestProperties) GetMutedOk() (*bool, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Muted, true\n}", "func (o *Content) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "func PossibleReasonValues() []Reason {\n\treturn []Reason{\n\t\tReasonInvalid,\n\t\tReasonAlreadyExists,\n\t}\n}", "func (o *Cause) GetDisplayMessageOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.DisplayMessage.Get(), o.DisplayMessage.IsSet()\n}", "func (o *ClientProvidedEnhancedTransaction) GetDescriptionOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Description, true\n}", "func (o *NewLoyaltyProgram) GetDescriptionOk() (string, bool) {\n\tif o == nil || o.Description == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Description, true\n}", "func (e UpdateMeetingV1ResponseValidationError) Reason() string { return e.reason }", "func (o *Ga4ghChemotherapy) GetDescriptionOk() (string, bool) {\n\tif o == nil || o.Description == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Description, true\n}", "func (o *EmbeddedUnitModel) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "func (e ResponseMapperValidationError) Reason() string { return e.reason }", "func (e ResponseValidationError) Reason() string { return e.reason }", "func (o *ResourceVersion) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "func (o *ApplianceGroupOpStatus) GetDescriptionOk() (*string, bool) {\n\tif o == nil || o.Description == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Description, true\n}", "func (e UpdateTodoResponseValidationError) Reason() string { return e.reason }", "func (o *Ga4ghTumourboard) GetReasonTreatmentPlanDidNotChangeBasedOnProfilingOk() (string, bool) {\n\tif o == nil || o.ReasonTreatmentPlanDidNotChangeBasedOnProfiling == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.ReasonTreatmentPlanDidNotChangeBasedOnProfiling, true\n}", "func (o *MicrosoftGraphSharedPcConfiguration) GetDescriptionOk() (string, bool) {\n\tif o == nil || o.Description == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Description, true\n}", "func (s *SignatureVerification) GetReason() string {\n\tif s == nil || s.Reason == nil {\n\t\treturn \"\"\n\t}\n\treturn *s.Reason\n}", "func (u *User) GetRestrictionReason() (value []RestrictionReason, ok bool) {\n\tif u == nil {\n\t\treturn\n\t}\n\tif !u.Flags.Has(18) {\n\t\treturn value, false\n\t}\n\treturn u.RestrictionReason, true\n}", "func (e ChannelNotifyResponseValidationError) Reason() string { return e.reason }", "func (o *HealthCheckResult) GetNullableMessageOk() (string, bool) {\n\tif o == nil || o.NullableMessage == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.NullableMessage, true\n}", "func (o ApplicationStatusConditionsOutput) Reason() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ApplicationStatusConditions) string { return v.Reason }).(pulumi.StringOutput)\n}", "func (e ActiveHealthCheckValidationError) Reason() string { return e.reason }", "func (o *BaseItem) GetDescriptionOk() (string, bool) {\n\tif o == nil || o.Description == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.Description, true\n}" ]
[ "0.77358264", "0.7641399", "0.7599295", "0.7590235", "0.7505762", "0.7167399", "0.6469197", "0.63665056", "0.6330306", "0.6264527", "0.622204", "0.62128437", "0.6184463", "0.61658317", "0.6163678", "0.6082228", "0.60805756", "0.60099185", "0.6005966", "0.5972817", "0.59707206", "0.5957466", "0.5934362", "0.59141856", "0.5898507", "0.58310586", "0.58199316", "0.5817183", "0.58127445", "0.5810418", "0.578948", "0.5783461", "0.57810414", "0.57590973", "0.5746964", "0.5744092", "0.5724617", "0.57187366", "0.57051426", "0.5700932", "0.5699199", "0.5671028", "0.56706154", "0.56706154", "0.5649651", "0.56437844", "0.5643456", "0.56417125", "0.56386954", "0.5638122", "0.5636185", "0.563514", "0.5632298", "0.5616732", "0.5614419", "0.56139356", "0.56115", "0.56061876", "0.56017643", "0.55919665", "0.55894476", "0.5585888", "0.55792904", "0.55763894", "0.5574059", "0.5573952", "0.55608326", "0.5560821", "0.55587536", "0.55559146", "0.55538535", "0.5552797", "0.5552797", "0.5549975", "0.5549975", "0.5548952", "0.55455893", "0.55430627", "0.55331403", "0.5531706", "0.5531454", "0.55251276", "0.55225426", "0.5522188", "0.5520755", "0.5518205", "0.5513212", "0.5513078", "0.550443", "0.549751", "0.54921144", "0.5489613", "0.5489279", "0.5486382", "0.54848015", "0.5480909", "0.5478992", "0.54778576", "0.54731226", "0.5470792" ]
0.7654388
1
HasReason returns a boolean if a field has been set.
func (o *AccessRequestData) HasReason() bool { if o != nil && o.Reason != nil { return true } return false }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *MuteFindingResponseProperties) HasReason() bool {\n\treturn o != nil && o.Reason != nil\n}", "func (o *SecurityProblemEvent) HasReason() bool {\n\tif o != nil && o.Reason != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *DataPlaneClusterUpdateStatusRequestConditions) HasReason() bool {\n\tif o != nil && o.Reason != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *DeploymentsCondition) HasReason() bool {\n\tif o != nil && o.Reason != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *V0037Node) HasReason() bool {\n\tif o != nil && o.Reason != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (m DontKnowTrade) HasDKReason() bool {\n\treturn m.Has(tag.DKReason)\n}", "func (m MarketDataRequestReject) HasMDReqRejReason() bool {\n\treturn m.Has(tag.MDReqRejReason)\n}", "func (rs Reasons) Has(r Reason) bool {\n\t_, ok := rs[r]\n\treturn ok\n}", "func (o *EquipmentFanModule) HasOperReason() bool {\n\tif o != nil && o.OperReason != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (obj *expense) HasRemaining() bool {\n\treturn obj.remaining != nil\n}", "func (o *RiskRulesListAllOfData) HasField() bool {\n\tif o != nil && !IsNil(o.Field) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Ga4ghTumourboard) HasReasonTreatmentPlanDidNotChangeBasedOnProfiling() bool {\n\tif o != nil && o.ReasonTreatmentPlanDidNotChangeBasedOnProfiling != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func HasConditionReason(conditions []toolchainv1alpha1.Condition, conditionType toolchainv1alpha1.ConditionType, reason string) bool {\n\tcon, found := FindConditionByType(conditions, conditionType)\n\treturn found && con.Reason == reason\n}", "func (o *V0037Node) HasReasonSetByUser() bool {\n\tif o != nil && o.ReasonSetByUser != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *MuteFindingRequestProperties) HasDescription() bool {\n\treturn o != nil && o.Description != nil\n}", "func (o *StatusDescriptorDTO) HasField() bool {\n\tif o != nil && o.Field != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Permissao) HasDescricao() bool {\n\tif o != nil && o.Descricao.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (field Field) IsDefined() bool {\n\treturn field.Var != nil\n}", "func (o *FieldError) HasMessage() bool {\n\tif o != nil && o.Message != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *VirtualizationIweVirtualMachine) HasFailureReason() bool {\n\tif o != nil && o.FailureReason != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *MuteFindingResponseProperties) HasDescription() bool {\n\treturn o != nil && o.Description != nil\n}", "func (o *VirtualizationIweHost) HasFailureReason() bool {\n\tif o != nil && o.FailureReason != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (x *fastReflection_EventRetire) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1alpha1.EventRetire.retirer\":\n\t\treturn x.Retirer != \"\"\n\tcase \"regen.ecocredit.v1alpha1.EventRetire.batch_denom\":\n\t\treturn x.BatchDenom != \"\"\n\tcase \"regen.ecocredit.v1alpha1.EventRetire.amount\":\n\t\treturn x.Amount != \"\"\n\tcase \"regen.ecocredit.v1alpha1.EventRetire.location\":\n\t\treturn x.Location != \"\"\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1alpha1.EventRetire\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1alpha1.EventRetire does not contain field %s\", fd.FullName()))\n\t}\n}", "func (ls Set) Has(field string) bool {\n\t_, exists := ls[field]\n\treturn exists\n}", "func (o *EquipmentIoCardBase) HasOperReason() bool {\n\tif o != nil && o.OperReason != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *SecurityProblem) HasMuted() bool {\n\tif o != nil && o.Muted != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ViewProjectBudget) HasIsRepeating() bool {\n\tif o != nil && o.IsRepeating != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *SecurityProblemEvent) HasMuteState() bool {\n\tif o != nil && o.MuteState != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *PiggyBankEvent) HasAmount() bool {\n\tif o != nil && o.Amount != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (m *Message) HasResponded() bool {\n\treturn atomic.LoadInt32(&m.responded) == 1\n}", "func (m *Message) HasResponded() bool {\n\treturn atomic.LoadInt32(&m.responded) == 1\n}", "func (o *TransactionSplit) HasForeignAmount() bool {\n\tif o != nil && o.ForeignAmount.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func IsHasField(st interface{}, fieldName string) bool {\n\treturn HasField(st, fieldName)\n}", "func (o *MuteFindingResponseProperties) HasMuted() bool {\n\treturn o != nil && o.Muted != nil\n}", "func (m NoSides) HasFundRenewWaiv() bool {\n\treturn m.Has(tag.FundRenewWaiv)\n}", "func (o *OpenapiTaskGenerationResult) HasFailureReason() bool {\n\tif o != nil && o.FailureReason != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *PaymentInitiationPayment) HasRefundDetails() bool {\n\tif o != nil && o.RefundDetails.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *NotificationProjectBudgetNotification) HasBudgetId() bool {\n\tif o != nil && o.BudgetId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (x *fastReflection_EventCancel) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"regen.ecocredit.v1alpha1.EventCancel.canceller\":\n\t\treturn x.Canceller != \"\"\n\tcase \"regen.ecocredit.v1alpha1.EventCancel.batch_denom\":\n\t\treturn x.BatchDenom != \"\"\n\tcase \"regen.ecocredit.v1alpha1.EventCancel.amount\":\n\t\treturn x.Amount != \"\"\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: regen.ecocredit.v1alpha1.EventCancel\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message regen.ecocredit.v1alpha1.EventCancel does not contain field %s\", fd.FullName()))\n\t}\n}", "func (o *FieldError) HasField() bool {\n\tif o != nil && o.Field != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (p *Player) HasFolded() bool {\n\treturn helpers.ContainsString(p.Game.CurrentQuestionRound().FoldedPlayerIds, p.ID)\n}", "func (o *ProcessorSignalDecisionReportRequest) HasDaysFundsOnHold() bool {\n\tif o != nil && o.DaysFundsOnHold.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *PostWebhook) HasPrDeclined() bool {\n\tif o != nil && o.PrDeclined != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (x *fastReflection_MsgCommunityPoolSpend) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.distribution.v1beta1.MsgCommunityPoolSpend.authority\":\n\t\treturn x.Authority != \"\"\n\tcase \"cosmos.distribution.v1beta1.MsgCommunityPoolSpend.recipient\":\n\t\treturn x.Recipient != \"\"\n\tcase \"cosmos.distribution.v1beta1.MsgCommunityPoolSpend.amount\":\n\t\treturn len(x.Amount) != 0\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.distribution.v1beta1.MsgCommunityPoolSpend\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.distribution.v1beta1.MsgCommunityPoolSpend does not contain field %s\", fd.FullName()))\n\t}\n}", "func (x *fastReflection_Supply) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.bank.v1beta1.Supply.total\":\n\t\treturn len(x.Total) != 0\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.bank.v1beta1.Supply\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.bank.v1beta1.Supply does not contain field %s\", fd.FullName()))\n\t}\n}", "func (x *fastReflection_ModuleOptions) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.autocli.v1.ModuleOptions.tx\":\n\t\treturn x.Tx != nil\n\tcase \"cosmos.autocli.v1.ModuleOptions.query\":\n\t\treturn x.Query != nil\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.autocli.v1.ModuleOptions\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.autocli.v1.ModuleOptions does not contain field %s\", fd.FullName()))\n\t}\n}", "func (o *ErrorDetails) HasMessage() bool {\n\tif o != nil && !IsNil(o.Message) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *AvailableBudgetUpdate) HasAmount() bool {\n\tif o != nil && o.Amount != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (x *fastReflection_LightClientAttackEvidence) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"tendermint.types.LightClientAttackEvidence.conflicting_block\":\n\t\treturn x.ConflictingBlock != nil\n\tcase \"tendermint.types.LightClientAttackEvidence.common_height\":\n\t\treturn x.CommonHeight != int64(0)\n\tcase \"tendermint.types.LightClientAttackEvidence.byzantine_validators\":\n\t\treturn len(x.ByzantineValidators) != 0\n\tcase \"tendermint.types.LightClientAttackEvidence.total_voting_power\":\n\t\treturn x.TotalVotingPower != int64(0)\n\tcase \"tendermint.types.LightClientAttackEvidence.timestamp\":\n\t\treturn x.Timestamp != nil\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: tendermint.types.LightClientAttackEvidence\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message tendermint.types.LightClientAttackEvidence does not contain field %s\", fd.FullName()))\n\t}\n}", "func (o *CustomVendaResultado) HasMessage() bool {\n\tif o != nil && o.Message.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *OnpremUpgradePhase) HasMessage() bool {\n\tif o != nil && o.Message != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (x *fastReflection_MsgWithdrawDelegatorRewardResponse) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse.amount\":\n\t\treturn len(x.Amount) != 0\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "func (o *ViewProjectBudget) HasRepeatsRemaining() bool {\n\tif o != nil && o.RepeatsRemaining != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *UcsdBackupInfoAllOf) HasFailureReason() bool {\n\tif o != nil && o.FailureReason != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (x *fastReflection_EvidenceList) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"tendermint.types.EvidenceList.evidence\":\n\t\treturn len(x.Evidence) != 0\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: tendermint.types.EvidenceList\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message tendermint.types.EvidenceList does not contain field %s\", fd.FullName()))\n\t}\n}", "func (me TAssignmentStatus) IsRejected() bool { return me.String() == \"Rejected\" }", "func (b FormatOption) Has(flag FormatOption) bool { return b&flag != 0 }", "func (m *Measurement) HasField(name string) bool {\n\tm.mu.RLock()\n\tdefer m.mu.RUnlock()\n\t_, hasField := m.fieldNames[name]\n\treturn hasField\n}", "func (o *SyntheticsGlobalVariableParseTestOptions) HasField() bool {\n\treturn o != nil && o.Field != nil\n}", "func (x *fastReflection_MsgDepositValidatorRewardsPool) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPool.depositor\":\n\t\treturn x.Depositor != \"\"\n\tcase \"cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPool.validator_address\":\n\t\treturn x.ValidatorAddress != \"\"\n\tcase \"cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPool.amount\":\n\t\treturn len(x.Amount) != 0\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPool\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPool does not contain field %s\", fd.FullName()))\n\t}\n}", "func (x *fastReflection_Evidence) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"tendermint.types.Evidence.duplicate_vote_evidence\":\n\t\tif x.Sum == nil {\n\t\t\treturn false\n\t\t} else if _, ok := x.Sum.(*Evidence_DuplicateVoteEvidence); ok {\n\t\t\treturn true\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\tcase \"tendermint.types.Evidence.light_client_attack_evidence\":\n\t\tif x.Sum == nil {\n\t\t\treturn false\n\t\t} else if _, ok := x.Sum.(*Evidence_LightClientAttackEvidence); ok {\n\t\t\treturn true\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: tendermint.types.Evidence\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message tendermint.types.Evidence does not contain field %s\", fd.FullName()))\n\t}\n}", "func (f *Form) Has(field string, r *http.Request) bool {\n\tx := r.Form.Get(field)\n\tif x == \"\" {\n\t\treturn false\n\t}\n\treturn true\n}", "func (o *EventoDTO) HasMensagem() bool {\n\tif o != nil && o.Mensagem.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (x *fastReflection_MsgWithdrawDelegatorReward) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward.delegator_address\":\n\t\treturn x.DelegatorAddress != \"\"\n\tcase \"cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward.validator_address\":\n\t\treturn x.ValidatorAddress != \"\"\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward does not contain field %s\", fd.FullName()))\n\t}\n}", "func (m TradingSessionStatus) HasTradSesStatusRejReason() bool {\n\treturn m.Has(tag.TradSesStatusRejReason)\n}", "func (o *UpdateRole) HasDescription() bool {\n\tif o != nil && o.Description != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (p ByName) HasBeenSet() bool {\n\treturn len(p.whereIsParamSet) > 0\n}", "func (f Flags) Has(v Flags) bool {\n\treturn f&v != 0\n}", "func (o *LogicalDatabaseResponse) HasDescription() bool {\n\tif o != nil && o.Description != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *EquipmentFanModule) HasDescription() bool {\n\tif o != nil && o.Description != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func HasFund() predicate.CoveredPerson {\n\treturn predicate.CoveredPerson(func(s *sql.Selector) {\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(Table, FieldID),\n\t\t\tsqlgraph.To(FundTable, FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, true, FundTable, FundColumn),\n\t\t)\n\t\tsqlgraph.HasNeighbors(s, step)\n\t})\n}", "func (chain foreignKeyChain) HasForeignKey(fkName string) bool {\n\tif _, ok := chain.fkNames[strings.ToLower(fkName)]; ok {\n\t\treturn true\n\t}\n\treturn false\n}", "func (c *Configuration) Has(field string) bool {\n\tout := getField(c.App, field)\n\tif out == nil {\n\t\tout = getField(c.Base, field)\n\t}\n\n\treturn out != nil\n}", "func (x *fastReflection_ValidatorOutstandingRewardsRecord) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord.validator_address\":\n\t\treturn x.ValidatorAddress != \"\"\n\tcase \"cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord.outstanding_rewards\":\n\t\treturn len(x.OutstandingRewards) != 0\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.distribution.v1beta1.ValidatorOutstandingRewardsRecord does not contain field %s\", fd.FullName()))\n\t}\n}", "func (x *fastReflection_MsgWithdrawValidatorCommissionResponse) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse.amount\":\n\t\treturn len(x.Amount) != 0\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse does not contain field %s\", fd.FullName()))\n\t}\n}", "func (x *fastReflection_SendEnabled) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.bank.v1beta1.SendEnabled.denom\":\n\t\treturn x.Denom != \"\"\n\tcase \"cosmos.bank.v1beta1.SendEnabled.enabled\":\n\t\treturn x.Enabled != false\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.bank.v1beta1.SendEnabled\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.bank.v1beta1.SendEnabled does not contain field %s\", fd.FullName()))\n\t}\n}", "func (o *PayPeriodDetails) HasPayDay() bool {\n\tif o != nil && o.PayDay.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *TransferParams) HasDescription() bool {\n\tif o != nil && o.Description != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ViewMilestone) HasReminder() bool {\n\tif o != nil && o.Reminder != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *StorageVdMemberEpAllOf) HasOperQualifierReason() bool {\n\tif o != nil && o.OperQualifierReason != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *FormField) HasResponse() bool {\n\tif o != nil && o.Response != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (s *Struct) HasField(name string) bool {\n\tfor _, f := range s.Fields {\n\t\tif f.Name == name {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "func (o *DeploymentsCondition) HasMessage() bool {\n\tif o != nil && o.Message != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *InlineResponse20034Milestone) HasReminder() bool {\n\tif o != nil && o.Reminder != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *OnpremUpgradeNoteAllOf) HasMessage() bool {\n\tif o != nil && o.Message != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (x *fastReflection_Metadata) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.bank.v1beta1.Metadata.description\":\n\t\treturn x.Description != \"\"\n\tcase \"cosmos.bank.v1beta1.Metadata.denom_units\":\n\t\treturn len(x.DenomUnits) != 0\n\tcase \"cosmos.bank.v1beta1.Metadata.base\":\n\t\treturn x.Base != \"\"\n\tcase \"cosmos.bank.v1beta1.Metadata.display\":\n\t\treturn x.Display != \"\"\n\tcase \"cosmos.bank.v1beta1.Metadata.name\":\n\t\treturn x.Name != \"\"\n\tcase \"cosmos.bank.v1beta1.Metadata.symbol\":\n\t\treturn x.Symbol != \"\"\n\tcase \"cosmos.bank.v1beta1.Metadata.uri\":\n\t\treturn x.Uri != \"\"\n\tcase \"cosmos.bank.v1beta1.Metadata.uri_hash\":\n\t\treturn x.UriHash != \"\"\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.bank.v1beta1.Metadata\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.bank.v1beta1.Metadata does not contain field %s\", fd.FullName()))\n\t}\n}", "func (me TrestrictionType) IsNeedToKnow() bool { return me.String() == \"need-to-know\" }", "func (m Modifiers) Has(v int) bool {\n\treturn uint(m)&uint(v) > 0\n}", "func (o *ConvergedinfraServerComplianceDetailsAllOf) HasHclStatusReason() bool {\n\tif o != nil && o.HclStatusReason != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ResourceVersionUpdateReqWeb) HasDescription() bool {\n\tif o != nil && o.Description != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *RecurrenceRepetition) HasDescription() bool {\n\tif o != nil && o.Description != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *TfaCreateMessageRequest) HasRepeatDTMF() bool {\n\tif o != nil && o.RepeatDTMF != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (f RedactFlags) Has(flag RedactFlags) bool {\n\treturn (f & flag) != 0\n}", "func (o *ViewProjectBudget) HasRepeatPeriod() bool {\n\tif o != nil && o.RepeatPeriod != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *RequestStatusMetadata) HasMessage() bool {\n\tif o != nil && o.Message != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *RequestSepaMoneyTransferParams) HasPurpose() bool {\n\tif o != nil && o.Purpose != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (me TEventType) IsAssignmentRejected() bool { return me.String() == \"AssignmentRejected\" }", "func (x *fastReflection_MsgSetWithdrawAddress) Has(fd protoreflect.FieldDescriptor) bool {\n\tswitch fd.FullName() {\n\tcase \"cosmos.distribution.v1beta1.MsgSetWithdrawAddress.delegator_address\":\n\t\treturn x.DelegatorAddress != \"\"\n\tcase \"cosmos.distribution.v1beta1.MsgSetWithdrawAddress.withdraw_address\":\n\t\treturn x.WithdrawAddress != \"\"\n\tdefault:\n\t\tif fd.IsExtension() {\n\t\t\tpanic(fmt.Errorf(\"proto3 declared messages do not support extensions: cosmos.distribution.v1beta1.MsgSetWithdrawAddress\"))\n\t\t}\n\t\tpanic(fmt.Errorf(\"message cosmos.distribution.v1beta1.MsgSetWithdrawAddress does not contain field %s\", fd.FullName()))\n\t}\n}", "func (o *IncidentUpdateRelationships) HasPostmortem() bool {\n\treturn o != nil && o.Postmortem != nil\n}", "func (m MarketDataRequestReject) HasText() bool {\n\treturn m.Has(tag.Text)\n}" ]
[ "0.76115483", "0.7274396", "0.7256791", "0.70727515", "0.67456263", "0.6175955", "0.613829", "0.59197396", "0.5823754", "0.5812148", "0.58042496", "0.578228", "0.57609344", "0.57390994", "0.5715928", "0.56853133", "0.5632058", "0.5600456", "0.5582313", "0.5572288", "0.5525678", "0.5522201", "0.5505818", "0.5466765", "0.5455501", "0.545029", "0.5448376", "0.53779197", "0.5372779", "0.5366969", "0.5366969", "0.5359978", "0.53452396", "0.5342451", "0.53378", "0.53326225", "0.5318397", "0.53172475", "0.5317243", "0.53143245", "0.5313157", "0.53067696", "0.53031427", "0.52934015", "0.52860063", "0.52843", "0.5282695", "0.5266418", "0.526337", "0.5245257", "0.5242925", "0.5233807", "0.52273744", "0.5219644", "0.52194595", "0.5217631", "0.52097017", "0.5209014", "0.5203623", "0.52020097", "0.51922214", "0.51841664", "0.5182314", "0.5181541", "0.51788247", "0.5176502", "0.5146399", "0.5142949", "0.5142545", "0.5140045", "0.5129517", "0.5122318", "0.51210374", "0.51188016", "0.5117878", "0.5116227", "0.5114884", "0.5112151", "0.5107577", "0.5104284", "0.5102444", "0.5101383", "0.50949377", "0.50935006", "0.5090519", "0.5087911", "0.5085179", "0.50840795", "0.50838745", "0.50837445", "0.50815576", "0.50735", "0.5072189", "0.5071295", "0.5067926", "0.5064883", "0.50589675", "0.5058335", "0.50504357", "0.5049273" ]
0.71086115
3
SetReason gets a reference to the given string and assigns it to the Reason field.
func (o *AccessRequestData) SetReason(v string) { o.Reason = &v }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (in *ActionVpsSetMaintenanceInput) SetReason(value string) *ActionVpsSetMaintenanceInput {\n\tin.Reason = value\n\n\tif in._selectedParameters == nil {\n\t\tin._selectedParameters = make(map[string]interface{})\n\t}\n\n\tin._selectedParameters[\"Reason\"] = nil\n\treturn in\n}", "func (s *Container) SetReason(v string) *Container {\n\ts.Reason = &v\n\treturn s\n}", "func (in *ActionUserRequestChangeResolveInput) SetReason(value string) *ActionUserRequestChangeResolveInput {\n\tin.Reason = value\n\n\tif in._selectedParameters == nil {\n\t\tin._selectedParameters = make(map[string]interface{})\n\t}\n\n\tin._selectedParameters[\"Reason\"] = nil\n\treturn in\n}", "func (s *ManagedAgent) SetReason(v string) *ManagedAgent {\n\ts.Reason = &v\n\treturn s\n}", "func (s *Anomaly) SetReason(v string) *Anomaly {\n\ts.Reason = &v\n\treturn s\n}", "func (s *Failure) SetReason(v string) *Failure {\n\ts.Reason = &v\n\treturn s\n}", "func (o *V0037Node) SetReason(v string) {\n\to.Reason = &v\n}", "func (s *RejectedRecord) SetReason(v string) *RejectedRecord {\n\ts.Reason = &v\n\treturn s\n}", "func (o *DeploymentsCondition) SetReason(v string) {\n\to.Reason = &v\n}", "func (s *StopInferenceExperimentInput) SetReason(v string) *StopInferenceExperimentInput {\n\ts.Reason = &v\n\treturn s\n}", "func (s *SubmitContainerStateChangeInput) SetReason(v string) *SubmitContainerStateChangeInput {\n\ts.Reason = &v\n\treturn s\n}", "func (s *StopTaskInput) SetReason(v string) *StopTaskInput {\n\ts.Reason = &v\n\treturn s\n}", "func (o *SecurityProblemEvent) SetReason(v string) {\n\to.Reason = &v\n}", "func (p *PhoneCallDiscarded) SetReason(value PhoneCallDiscardReasonClass) {\n\tp.Flags.Set(0)\n\tp.Reason = value\n}", "func (s *SubmitTaskStateChangeInput) SetReason(v string) *SubmitTaskStateChangeInput {\n\ts.Reason = &v\n\treturn s\n}", "func (s *ManagedAgentStateChange) SetReason(v string) *ManagedAgentStateChange {\n\ts.Reason = &v\n\treturn s\n}", "func (o *DataPlaneClusterUpdateStatusRequestConditions) SetReason(v string) {\n\to.Reason = &v\n}", "func (s *PropertyValidationExceptionProperty) SetReason(v string) *PropertyValidationExceptionProperty {\n\ts.Reason = &v\n\treturn s\n}", "func (s *ContainerStateChange) SetReason(v string) *ContainerStateChange {\n\ts.Reason = &v\n\treturn s\n}", "func (o *MuteFindingRequestProperties) SetReason(v FindingMuteReason) {\n\to.Reason = v\n}", "func (s *DataLakeUpdateException) SetReason(v string) *DataLakeUpdateException {\n\ts.Reason = &v\n\treturn s\n}", "func (o *MuteFindingResponseProperties) SetReason(v FindingMuteReason) {\n\to.Reason = &v\n}", "func (b *Base) AppendReason(y string) {\n\tif b.Reason == \"\" {\n\t\tb.Reason = y\n\t} else {\n\t\tb.Reason = y + \". \" + b.Reason\n\t}\n}", "func (rb *DataframeAnalyticsFieldSelectionBuilder) Reason(reason string) *DataframeAnalyticsFieldSelectionBuilder {\n\trb.v.Reason = &reason\n\treturn rb\n}", "func (me *TSAFPTPortugueseTaxExemptionReason) Set(s string) { (*xsdt.String)(me).Set(s) }", "func (b *ConditionApplyConfiguration) WithReason(value string) *ConditionApplyConfiguration {\n\tb.Reason = &value\n\treturn b\n}", "func Reason(v string) predicate.ProfileUKM {\n\treturn predicate.ProfileUKM(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldReason), v))\n\t})\n}", "func (e SetRequestValidationError) Reason() string { return e.reason }", "func (m *DirectoryAudit) SetResultReason(value *string)() {\n m.resultReason = value\n}", "func GetReason(from Getter, t string) string {\n\tif c := Get(from, t); c != nil {\n\t\treturn c.Reason\n\t}\n\treturn \"\"\n}", "func (biuo *BlockInstanceUpdateOne) SetFailureReason(s string) *BlockInstanceUpdateOne {\n\tbiuo.mutation.SetFailureReason(s)\n\treturn biuo\n}", "func (this *SIPResponse) SetReasonPhrase(reasonPhrase string) {\n\t//if this.reasonPhrase == nil)\n\t// throw new IllegalArgumentException(\"Bad reason phrase\");\n\tif this.statusLine == nil {\n\t\tthis.statusLine = header.NewStatusLine()\n\t}\n\tthis.statusLine.SetReasonPhrase(reasonPhrase)\n}", "func (e BitStringValidationError) Reason() string { return e.reason }", "func (biu *BlockInstanceUpdate) SetFailureReason(s string) *BlockInstanceUpdate {\n\tbiu.mutation.SetFailureReason(s)\n\treturn biu\n}", "func (u *User) SetRestrictionReason(value []RestrictionReason) {\n\tu.Flags.Set(18)\n\tu.RestrictionReason = value\n}", "func (o *Transfer) SetFailureReason(v TransferFailure) {\n\to.FailureReason.Set(&v)\n}", "func (e HealthStatusSetValidationError) Reason() string { return e.reason }", "func (e ReferenceValidationError) Reason() string { return e.reason }", "func (b *Base) GetReason() string {\n\treturn b.Reason\n}", "func ReasonContains(v string) predicate.ProfileUKM {\n\treturn predicate.ProfileUKM(func(s *sql.Selector) {\n\t\ts.Where(sql.Contains(s.C(FieldReason), v))\n\t})\n}", "func (in *ActionUserDeleteInput) SetChangeReason(value string) *ActionUserDeleteInput {\n\tin.ChangeReason = value\n\n\tif in._selectedParameters == nil {\n\t\tin._selectedParameters = make(map[string]interface{})\n\t}\n\n\tin._selectedParameters[\"ChangeReason\"] = nil\n\treturn in\n}", "func (o *VirtualizationIweHost) SetFailureReason(v string) {\n\to.FailureReason = &v\n}", "func (in *ActionUserRequestChangeResolveInput) SetChangeReason(value string) *ActionUserRequestChangeResolveInput {\n\tin.ChangeReason = value\n\n\tif in._selectedParameters == nil {\n\t\tin._selectedParameters = make(map[string]interface{})\n\t}\n\n\tin._selectedParameters[\"ChangeReason\"] = nil\n\treturn in\n}", "func ReasonEQ(v string) predicate.ProfileUKM {\n\treturn predicate.ProfileUKM(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldReason), v))\n\t})\n}", "func (m *MachineScope) SetFailureReason(v capierrors.MachineStatusError) {\n\tm.AzureMachine.Status.FailureReason = &v\n}", "func (e WordValidationError) Reason() string { return e.reason }", "func (e SkillValidationError) Reason() string { return e.reason }", "func (me *TNotifyWorkersFailureCode) Set(s string) { (*xsdt.String)(me).Set(s) }", "func (o *VirtualizationIweVirtualMachine) SetFailureReason(v string) {\n\to.FailureReason = &v\n}", "func (o HorizontalPodAutoscalerConditionPatchOutput) Reason() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v HorizontalPodAutoscalerConditionPatch) *string { return v.Reason }).(pulumi.StringPtrOutput)\n}", "func (o HorizontalPodAutoscalerConditionPatchOutput) Reason() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v HorizontalPodAutoscalerConditionPatch) *string { return v.Reason }).(pulumi.StringPtrOutput)\n}", "func (e ResponseValidationError) Reason() string { return e.reason }", "func (m *mTOServiceItem) SetRejectionReason(val *string) {\n\tm.rejectionReasonField = val\n}", "func (e ConfigureAssessmentResponseValidationError) Reason() string { return e.reason }", "func (m DontKnowTrade) SetDKReason(v enum.DKReason) {\n\tm.Set(field.NewDKReason(v))\n}", "func (s *Subscription) GetReason() string {\n\tif s == nil || s.Reason == nil {\n\t\treturn \"\"\n\t}\n\treturn *s.Reason\n}", "func (e RequirementRuleValidationError) Reason() string { return e.reason }", "func (s *Endpoint) SetFailureReason(v string) *Endpoint {\n\ts.FailureReason = &v\n\treturn s\n}", "func (s *RecommendationJobInferenceBenchmark) SetFailureReason(v string) *RecommendationJobInferenceBenchmark {\n\ts.FailureReason = &v\n\treturn s\n}", "func (s *ProcessingJob) SetFailureReason(v string) *ProcessingJob {\n\ts.FailureReason = &v\n\treturn s\n}", "func WithReason(ctx context.Context, reason Reason) context.Context {\n\tinfo := infoFromCtx(ctx)\n\tinfo.reason = reason\n\treturn withInfo(ctx, info)\n}", "func (e UpdateMeetingV1ResponseValidationError) Reason() string { return e.reason }", "func (c *SearchCall) FailureReason(failureReason string) *SearchCall {\n\tc.urlParams_.Set(\"failure_reason\", failureReason)\n\treturn c\n}", "func (o ValidationPatchOutput) Reason() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ValidationPatch) *string { return v.Reason }).(pulumi.StringPtrOutput)\n}", "func (e HttpConnectionManager_SetCurrentClientCertDetailsValidationError) Reason() string {\n\treturn e.reason\n}", "func (e RicStyleNameValidationError) Reason() string { return e.reason }", "func (e UpsertEventResponseValidationError) Reason() string { return e.reason }", "func (e LanguageValidationError) Reason() string { return e.reason }", "func (s *CallAnalyticsJob) SetFailureReason(v string) *CallAnalyticsJob {\n\ts.FailureReason = &v\n\treturn s\n}", "func (e MessageDValidationError) Reason() string { return e.reason }", "func (e UpdateTodoResponseValidationError) Reason() string { return e.reason }", "func (e RicReportStyleListValidationError) Reason() string { return e.reason }", "func (e UpdateMeetingV1RequestValidationError) Reason() string { return e.reason }", "func (e RdsValidationError) Reason() string { return e.reason }", "func Reason(err error) string {\n\tif err == nil {\n\t\treturn \"\"\n\t}\n\tif reasoner, ok := err.(Reasoner); ok {\n\t\treturn reasoner.Reason()\n\t}\n\treturn \"\"\n}", "func (e UpdateEmployeeResponseValidationError) Reason() string { return e.reason }", "func (resp *Response) Reason() string {\n\treturn resp.Status\n}", "func (e RicStyleTypeValidationError) Reason() string { return e.reason }", "func (o *DeleteV1PostMortemsReportsReportIDReasonsReasonIDParams) SetReasonID(reasonID string) {\n\to.ReasonID = reasonID\n}", "func (o *OpenapiTaskGenerationResult) SetFailureReason(v string) {\n\to.FailureReason = &v\n}", "func (e MessageEValidationError) Reason() string { return e.reason }", "func (e ConfigureAssessmentRequestValidationError) Reason() string { return e.reason }", "func (e DocValidationError) Reason() string { return e.reason }", "func (s *TrainingJob) SetFailureReason(v string) *TrainingJob {\n\ts.FailureReason = &v\n\treturn s\n}", "func (e ReverseResponseValidationError) Reason() string { return e.reason }", "func (a Acknowledgement) Reason() error {\n\tswitch {\n\tcase a.State == ACK:\n\t\treturn nil\n\tcase a.State == NACK:\n\t\treturn errors.New(string(a.Message))\n\tdefault:\n\t\treturn errors.New(\"unknown acknowledgement status\")\n\t}\n}", "func (o HorizontalPodAutoscalerConditionOutput) Reason() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v HorizontalPodAutoscalerCondition) *string { return v.Reason }).(pulumi.StringPtrOutput)\n}", "func (o HorizontalPodAutoscalerConditionOutput) Reason() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v HorizontalPodAutoscalerCondition) *string { return v.Reason }).(pulumi.StringPtrOutput)\n}", "func (o LienOutput) Reason() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Lien) pulumi.StringOutput { return v.Reason }).(pulumi.StringOutput)\n}", "func (o *AccessRequestData) GetReason() string {\n\tif o == nil || o.Reason == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Reason\n}", "func (me *XsdGoPkgHasElem_ReasonsequenceRejectQualificationRequestRequestschema_Reason_XsdtString_) Walk() (err error) {\n\tif fn := WalkHandlers.XsdGoPkgHasElem_ReasonsequenceRejectQualificationRequestRequestschema_Reason_XsdtString_; me != nil {\n\t\tif fn != nil {\n\t\t\tif err = fn(me, true); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t\tif fn != nil {\n\t\t\tif err = fn(me, false); xsdt.OnWalkError(&err, &WalkErrors, WalkContinueOnError, WalkOnError) {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "func (e SimpleResponseValidationError) Reason() string { return e.reason }", "func (e UpdateResponseValidationError) Reason() string { return e.reason }", "func (e MessageFValidationError) Reason() string { return e.reason }", "func (s *OfflineStoreStatus) SetBlockedReason(v string) *OfflineStoreStatus {\n\ts.BlockedReason = &v\n\treturn s\n}", "func (o *MuteFindingResponseProperties) GetReason() FindingMuteReason {\n\tif o == nil || o.Reason == nil {\n\t\tvar ret FindingMuteReason\n\t\treturn ret\n\t}\n\treturn *o.Reason\n}", "func (o ValidationOutput) Reason() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v Validation) *string { return v.Reason }).(pulumi.StringPtrOutput)\n}", "func (s *Vocabulary) SetFailureReason(v string) *Vocabulary {\n\ts.FailureReason = &v\n\treturn s\n}", "func (e CreditValidationError) Reason() string { return e.reason }", "func (e UpdateEmployeeRequestValidationError) Reason() string { return e.reason }" ]
[ "0.7588342", "0.75555855", "0.7391301", "0.73863524", "0.732477", "0.72936296", "0.7237444", "0.7230092", "0.71569836", "0.7131406", "0.70648354", "0.703295", "0.70267826", "0.70198286", "0.70076007", "0.6991592", "0.69526464", "0.69444793", "0.6924092", "0.688562", "0.68724513", "0.6846214", "0.6380087", "0.6219681", "0.6183798", "0.6061048", "0.60596454", "0.6001916", "0.5995388", "0.57501394", "0.5737752", "0.57337624", "0.5719806", "0.570701", "0.56777376", "0.56629896", "0.56445014", "0.5621468", "0.5614676", "0.55933297", "0.5591516", "0.55770695", "0.5549069", "0.5464525", "0.5462472", "0.5462259", "0.54607475", "0.5451085", "0.5447926", "0.54478043", "0.54478043", "0.5441513", "0.5438783", "0.54366094", "0.541894", "0.5417933", "0.5416322", "0.54128563", "0.54047626", "0.5358972", "0.53469485", "0.5342679", "0.53402", "0.5337694", "0.53359795", "0.5332848", "0.53222466", "0.5307806", "0.53019595", "0.5296731", "0.5294141", "0.5281841", "0.5281281", "0.5271294", "0.5271216", "0.52677894", "0.5254984", "0.52522564", "0.5250236", "0.52496016", "0.52469826", "0.5246768", "0.52426463", "0.5242319", "0.52422845", "0.5236925", "0.52296203", "0.52296203", "0.5228441", "0.52266455", "0.5223089", "0.52181894", "0.5213628", "0.5213213", "0.5212671", "0.5202731", "0.5200159", "0.5197463", "0.5195086", "0.5194599" ]
0.750126
2
GetRequestedDays returns the RequestedDays field value if set, zero value otherwise.
func (o *AccessRequestData) GetRequestedDays() int32 { if o == nil || o.RequestedDays == nil { var ret int32 return ret } return *o.RequestedDays }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *AssetReportRefreshRequest) GetDaysRequested() int32 {\n\tif o == nil || o.DaysRequested.Get() == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.DaysRequested.Get()\n}", "func (o *CreditBankEmploymentReport) GetDaysRequested() int32 {\n\tif o == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\n\treturn o.DaysRequested\n}", "func (o *AssetReport) GetDaysRequested() float32 {\n\tif o == nil {\n\t\tvar ret float32\n\t\treturn ret\n\t}\n\n\treturn o.DaysRequested\n}", "func (o *AssetReport) SetDaysRequested(v float32) {\n\to.DaysRequested = v\n}", "func (o *AccessRequestData) SetRequestedDays(v int32) {\n\to.RequestedDays = &v\n}", "func (o *CreditBankEmploymentReport) SetDaysRequested(v int32) {\n\to.DaysRequested = v\n}", "func (o *AssetReportRefreshRequest) SetDaysRequested(v int32) {\n\to.DaysRequested.Set(&v)\n}", "func (o *AccessRequestData) GetRequestedDaysOk() (*int32, bool) {\n\tif o == nil || o.RequestedDays == nil {\n\t\treturn nil, false\n\t}\n\treturn o.RequestedDays, true\n}", "func (o *AssetReportRefreshRequest) GetDaysRequestedOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.DaysRequested.Get(), o.DaysRequested.IsSet()\n}", "func (o *CreditBankEmploymentReport) GetDaysRequestedOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.DaysRequested, true\n}", "func (o *AssetReport) GetDaysRequestedOk() (*float32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.DaysRequested, true\n}", "func (o *AssetReportRefreshRequest) SetDaysRequestedNil() {\n\to.DaysRequested.Set(nil)\n}", "func (o *AccessRequestData) HasRequestedDays() bool {\n\tif o != nil && o.RequestedDays != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *AssetReportRefreshRequest) HasDaysRequested() bool {\n\tif o != nil && o.DaysRequested.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *AssetReportRefreshRequest) UnsetDaysRequested() {\n\to.DaysRequested.Unset()\n}", "func (request *DomainRegisterRequest) GetRetentionDays() int32 {\n\treturn request.GetIntProperty(\"RetentionDays\")\n}", "func (o *PeriodModel) GetDays() int32 {\n\tif o == nil || o.Days == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.Days\n}", "func (o *BaseReportLongestGapInsights) GetDays() int32 {\n\tif o == nil || o.Days == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.Days\n}", "func (o *PutCustomersCustomerFidSubscriptionsSubscriptionFidAutoCancelDaysParams) SetDays(days int32) {\n\to.Days = days\n}", "func (o BucketObjectLockConfigurationRuleDefaultRetentionPtrOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *BucketObjectLockConfigurationRuleDefaultRetention) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Days\n\t}).(pulumi.IntPtrOutput)\n}", "func (c *Job) Days() *Job {\n\tif c.delayUnit == delayNone {\n\t\tc.unit = days\n\t} else {\n\t\tc.delayUnit = delayDays\n\t}\n\treturn c\n}", "func (o BucketObjectLockConfigurationRuleDefaultRetentionOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v BucketObjectLockConfigurationRuleDefaultRetention) *int { return v.Days }).(pulumi.IntPtrOutput)\n}", "func RecoverableDays(days int) ChangeOption {\n\treturn changeOption{\n\t\tapplier: applierFunc(\n\t\t\tfunc(caller caller, co interface{}) {\n\t\t\t\tco.(*secret.UpdateSetRequest).Attributes.RecoverableDays = days\n\t\t\t},\n\t\t),\n\t}\n}", "func (o DeleteRetentionPolicyResponsePtrOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *DeleteRetentionPolicyResponse) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Days\n\t}).(pulumi.IntPtrOutput)\n}", "func (o BucketObjectLockConfigurationV2RuleDefaultRetentionPtrOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *BucketObjectLockConfigurationV2RuleDefaultRetention) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Days\n\t}).(pulumi.IntPtrOutput)\n}", "func (o BucketIntelligentTieringConfigurationTieringOutput) Days() pulumi.IntOutput {\n\treturn o.ApplyT(func(v BucketIntelligentTieringConfigurationTiering) int { return v.Days }).(pulumi.IntOutput)\n}", "func (m *DeviceManagementSettings) GetDeviceComplianceCheckinThresholdDays()(*int32) {\n val, err := m.GetBackingStore().Get(\"deviceComplianceCheckinThresholdDays\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*int32)\n }\n return nil\n}", "func (request *DomainRegisterRequest) SetRetentionDays(value int32) {\n\trequest.SetIntProperty(\"RetentionDays\", value)\n}", "func (o BucketObjectLockConfigurationV2RuleDefaultRetentionOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v BucketObjectLockConfigurationV2RuleDefaultRetention) *int { return v.Days }).(pulumi.IntPtrOutput)\n}", "func (o *ProcessorSignalDecisionReportRequest) GetDaysFundsOnHold() int32 {\n\tif o == nil || o.DaysFundsOnHold.Get() == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.DaysFundsOnHold.Get()\n}", "func (o BucketV2ObjectLockConfigurationRuleDefaultRetentionOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v BucketV2ObjectLockConfigurationRuleDefaultRetention) *int { return v.Days }).(pulumi.IntPtrOutput)\n}", "func (o DeleteRetentionPolicyResponseOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v DeleteRetentionPolicyResponse) *int { return v.Days }).(pulumi.IntPtrOutput)\n}", "func (o BucketLifecycleRuleExpirationPtrOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *BucketLifecycleRuleExpiration) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Days\n\t}).(pulumi.IntPtrOutput)\n}", "func (q *Quotas) RequestsPerDay(issuerName utils.IssuerKey) int {\n\tq.lock.Lock()\n\tdefer q.lock.Unlock()\n\n\tquotas, ok := q.issuerToQuotas[issuerName]\n\tif !ok {\n\t\treturn 0\n\t}\n\treturn quotas.requestsPerDay\n}", "func (o BucketLifecycleRuleExpirationOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v BucketLifecycleRuleExpiration) *int { return v.Days }).(pulumi.IntPtrOutput)\n}", "func (o *BaseReportLongestGapInsights) SetDays(v int32) {\n\to.Days = &v\n}", "func (o BucketLifecycleRuleTransitionOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v BucketLifecycleRuleTransition) *int { return v.Days }).(pulumi.IntPtrOutput)\n}", "func (s *DataLakeLifecycleExpiration) SetDays(v int64) *DataLakeLifecycleExpiration {\n\ts.Days = &v\n\treturn s\n}", "func (m *AndroidCompliancePolicy) GetPasswordExpirationDays()(*int32) {\n val, err := m.GetBackingStore().Get(\"passwordExpirationDays\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*int32)\n }\n return nil\n}", "func (i ISODuration) GetDays() int {\r\n\treturn i.duration.Days\r\n}", "func (m OrderStatusRequest) GetMaturityDay() (v int, err quickfix.MessageRejectError) {\n\tvar f field.MaturityDayField\n\tif err = m.Get(&f); err == nil {\n\t\tv = f.Value()\n\t}\n\treturn\n}", "func (o DeleteRetentionPolicyPtrOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *DeleteRetentionPolicy) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Days\n\t}).(pulumi.IntPtrOutput)\n}", "func (s *DataLakeLifecycleTransition) SetDays(v int64) *DataLakeLifecycleTransition {\n\ts.Days = &v\n\treturn s\n}", "func (o *PeriodModel) SetDays(v int32) {\n\to.Days = &v\n}", "func getDays(time *int) int {\n\treturn getTimeScale(time, 86400)\n}", "func (o BucketLifecycleRuleNoncurrentVersionExpirationOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v BucketLifecycleRuleNoncurrentVersionExpiration) *int { return v.Days }).(pulumi.IntPtrOutput)\n}", "func (m *OrderConfirmation) GetRequestedAmount() uint64 {\n\tif m != nil {\n\t\treturn m.RequestedAmount\n\t}\n\treturn 0\n}", "func (m NoMDEntries) GetSellerDays() (v int, err quickfix.MessageRejectError) {\n\tvar f field.SellerDaysField\n\tif err = m.Get(&f); err == nil {\n\t\tv = f.Value()\n\t}\n\treturn\n}", "func (o *LoginRequest) GetRequestedScope() []string {\n\tif o == nil || o.RequestedScope == nil {\n\t\tvar ret []string\n\t\treturn ret\n\t}\n\treturn o.RequestedScope\n}", "func (o BucketLifecycleRuleNoncurrentVersionExpirationPtrOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *BucketLifecycleRuleNoncurrentVersionExpiration) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Days\n\t}).(pulumi.IntPtrOutput)\n}", "func (o BucketLifecycleRuleNoncurrentVersionTransitionOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v BucketLifecycleRuleNoncurrentVersionTransition) *int { return v.Days }).(pulumi.IntPtrOutput)\n}", "func (o *PeriodModel) GetDaysOk() (*int32, bool) {\n\tif o == nil || o.Days == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Days, true\n}", "func (o RegistryRetentionPolicyPtrOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *RegistryRetentionPolicy) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Days\n\t}).(pulumi.IntPtrOutput)\n}", "func (m *DeviceManagementSettings) SetDeviceComplianceCheckinThresholdDays(value *int32)() {\n err := m.GetBackingStore().Set(\"deviceComplianceCheckinThresholdDays\", value)\n if err != nil {\n panic(err)\n }\n}", "func (j *Job) Days() *Job {\n\tj.unit = JOB_UNIT_TYPE_DAY\n\treturn j\n}", "func (im *IAMManager) passedDays(now, lastUsedDate time.Time, days float64, operator string) (float64, bool) {\n\n\tvar empty float64\n\tlastUsedDateDays := now.Sub(lastUsedDate).Hours() / 24\n\texpressionResult, err := expression.BoolExpression(lastUsedDateDays, days, operator)\n\tif err != nil {\n\t\treturn empty, false\n\t}\n\tif !expressionResult {\n\t\treturn lastUsedDateDays, false\n\t}\n\n\treturn lastUsedDateDays, true\n\n}", "func (o *LoginRequest) SetRequestedScope(v []string) {\n\to.RequestedScope = v\n}", "func (o DeleteRetentionPolicyOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v DeleteRetentionPolicy) *int { return v.Days }).(pulumi.IntPtrOutput)\n}", "func (o BucketLifecycleConfigurationV2RuleExpirationPtrOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *BucketLifecycleConfigurationV2RuleExpiration) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Days\n\t}).(pulumi.IntPtrOutput)\n}", "func (o *BaseReportLongestGapInsights) GetDaysOk() (*int32, bool) {\n\tif o == nil || o.Days == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Days, true\n}", "func (o BucketV2LifecycleRuleNoncurrentVersionExpirationOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v BucketV2LifecycleRuleNoncurrentVersionExpiration) *int { return v.Days }).(pulumi.IntPtrOutput)\n}", "func (m *EntitlementManagementSettings) GetDaysUntilExternalUserDeletedAfterBlocked()(*int32) {\n val, err := m.GetBackingStore().Get(\"daysUntilExternalUserDeletedAfterBlocked\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*int32)\n }\n return nil\n}", "func (o *OAuth2ConsentRequest) SetRequestedScope(v []string) {\n\to.RequestedScope = v\n}", "func (o BucketLifecycleConfigurationV2RuleExpirationOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v BucketLifecycleConfigurationV2RuleExpiration) *int { return v.Days }).(pulumi.IntPtrOutput)\n}", "func (o BucketV2LifecycleRuleNoncurrentVersionTransitionOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v BucketV2LifecycleRuleNoncurrentVersionTransition) *int { return v.Days }).(pulumi.IntPtrOutput)\n}", "func (o *OAuth2ConsentRequest) GetRequestedScope() []string {\n\tif o == nil || o.RequestedScope == nil {\n\t\tvar ret []string\n\t\treturn ret\n\t}\n\treturn o.RequestedScope\n}", "func (o RegistryRetentionPolicyOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v RegistryRetentionPolicy) *int { return v.Days }).(pulumi.IntPtrOutput)\n}", "func (s sequence) Days(days int) []time.Time {\n\tvar values []time.Time\n\tfor day := days; day >= 0; day-- {\n\t\tvalues = append(values, time.Now().AddDate(0, 0, -day))\n\t}\n\treturn values\n}", "func (m *IosUpdateConfiguration) GetScheduledInstallDays()([]DayOfWeek) {\n val, err := m.GetBackingStore().Get(\"scheduledInstallDays\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]DayOfWeek)\n }\n return nil\n}", "func (m *DeviceEnrollmentWindowsHelloForBusinessConfiguration) GetPinExpirationInDays()(*int32) {\n val, err := m.GetBackingStore().Get(\"pinExpirationInDays\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*int32)\n }\n return nil\n}", "func (g *Gauges) RequestedCheckpoints() prometheus.Gauge {\n\treturn g.new(\n\t\tprometheus.GaugeOpts{\n\t\t\tName: \"postgresql_checkpoints_requested\",\n\t\t\tHelp: \"Number of requested checkpoints that have been performed\",\n\t\t\tConstLabels: g.labels,\n\t\t},\n\t\t\"SELECT checkpoints_req FROM pg_stat_bgwriter\",\n\t)\n}", "func (o BucketV2LifecycleRuleExpirationOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v BucketV2LifecycleRuleExpiration) *int { return v.Days }).(pulumi.IntPtrOutput)\n}", "func (o BucketLifecycleConfigurationV2RuleTransitionOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v BucketLifecycleConfigurationV2RuleTransition) *int { return v.Days }).(pulumi.IntPtrOutput)\n}", "func (o *ConditionRequestRateCondition) GetRequests() string {\n\tif o == nil || o.Requests == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Requests\n}", "func (i *Invoice) GetEmailRequested() (value bool) {\n\tif i == nil {\n\t\treturn\n\t}\n\treturn i.Flags.Has(3)\n}", "func ViewAvailableDays(res http.ResponseWriter, req *http.Request) {\n\ttype dayData struct {\n\t\tDay string\n\t\tRemainingOrd int\n\t}\n\tvar AvailableDaysData []dayData\n\n\tfor n := 0; n < len(ds.WeeklySchedule); n++ {\n\t\tif ds.WeeklySchedule[n].CurrentOrders < ds.WeeklySchedule[n].MaxOrders {\n\t\t\tremainingOrders := ds.WeeklySchedule[n].MaxOrders - ds.WeeklySchedule[n].CurrentOrders\n\t\t\tif remainingOrders > 0 {\n\t\t\t\ttempData := dayData{\n\t\t\t\t\tDay: ds.IntToDay(n + 1),\n\t\t\t\t\tRemainingOrd: remainingOrders}\n\t\t\t\tAvailableDaysData = append(AvailableDaysData, tempData)\n\t\t\t}\n\t\t\t//fmt.Println(intToDay(n+1), \"is available for booking.\", remainingOrders, \"orders still available for taking.\")\n\t\t}\n\t}\n\terr := tpl.ExecuteTemplate(res, \"availableDays.gohtml\", AvailableDaysData)\n\tif err != nil {\n\t\thttp.Error(res, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n}", "func (o BucketV2LifecycleRuleTransitionOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v BucketV2LifecycleRuleTransition) *int { return v.Days }).(pulumi.IntPtrOutput)\n}", "func (o AutoSnapshotPolicyOutput) RetentionDays() pulumi.IntOutput {\n\treturn o.ApplyT(func(v *AutoSnapshotPolicy) pulumi.IntOutput { return v.RetentionDays }).(pulumi.IntOutput)\n}", "func (o *Windows10CompliancePolicy) GetPasswordExpirationDays() int32 {\n\tif o == nil || o.PasswordExpirationDays == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.PasswordExpirationDays\n}", "func (m *AndroidCompliancePolicy) SetPasswordExpirationDays(value *int32)() {\n err := m.GetBackingStore().Set(\"passwordExpirationDays\", value)\n if err != nil {\n panic(err)\n }\n}", "func (to *Session) GetDeliveryServiceRequests() ([]tc.DeliveryServiceRequest, toclientlib.ReqInf, error) {\n\treturn to.GetDeliveryServiceRequestsWithHdr(nil)\n}", "func (i *Invoice) GetPhoneRequested() (value bool) {\n\tif i == nil {\n\t\treturn\n\t}\n\treturn i.Flags.Has(2)\n}", "func (o *IscsiInitiatorGetIterRequest) DesiredAttributes() IscsiInitiatorGetIterRequestDesiredAttributes {\n\tvar r IscsiInitiatorGetIterRequestDesiredAttributes\n\tif o.DesiredAttributesPtr == nil {\n\t\treturn r\n\t}\n\tr = *o.DesiredAttributesPtr\n\treturn r\n}", "func (q *Query) DaysRange() string {\n\treturn q.sheetName + \"!\" + \"1:1\"\n}", "func GetRequestedCapacity(list v1.ResourceList) (int64, error) {\n\n\tresourceCapacity := list[apis.ResourceStorage]\n\t// Check if deviceClaim has valid capacity request\n\tcapacity, err := (&resourceCapacity).AsInt64()\n\tif !err || capacity <= 0 {\n\t\treturn 0, fmt.Errorf(\"invalid capacity requested, %v\", err)\n\t}\n\treturn capacity, nil\n}", "func (m *AndroidWorkProfileGeneralDeviceConfiguration) GetPasswordExpirationDays()(*int32) {\n return m.passwordExpirationDays\n}", "func (o BucketBillingPtrOutput) RequesterPays() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v *BucketBilling) *bool {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.RequesterPays\n\t}).(pulumi.BoolPtrOutput)\n}", "func days(d float64) time.Duration {\n\treturn time.Duration(24*d) * time.Hour // Close enough\n}", "func (o *MicrosoftGraphWindows10CompliancePolicy) GetPasswordExpirationDays() int32 {\n\tif o == nil || o.PasswordExpirationDays == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.PasswordExpirationDays\n}", "func (m *RecurrencePattern) GetDaysOfWeek()([]DayOfWeek) {\n return m.daysOfWeek\n}", "func (m *AndroidWorkProfileGeneralDeviceConfiguration) GetWorkProfilePasswordExpirationDays()(*int32) {\n return m.workProfilePasswordExpirationDays\n}", "func (i *Invoice) SetEmailRequested(value bool) {\n\tif value {\n\t\ti.Flags.Set(3)\n\t\ti.EmailRequested = true\n\t} else {\n\t\ti.Flags.Unset(3)\n\t\ti.EmailRequested = false\n\t}\n}", "func (reply *DomainDescribeReply) GetConfigurationRetentionDays() int32 {\n\treturn reply.GetIntProperty(\"ConfigurationRetentionDays\")\n}", "func Generate(request *Request) []*WorkingDay {\n\tif request.Groups == nil || len(request.Groups) == 0 {\n\t\treturn []*WorkingDay{}\n\t}\n\n\t// reinitialize the seed\n\trand.Seed(time.Now().UnixNano())\n\n\t// index 0 is for 1h, while index 9 is for 10h\n\tchoiceWeight := [10]int{0, 8, 8, 6, 4, 4, 4, 4, 1, 1}\n\n\t// get hours\n\ttotalHours := calculateTotalHours(request.Groups)\n\thours := generateHours(totalHours, choiceWeight)\n\n\t// skip day chance\n\tskipDay := [7]int{6, -8, -8, -8, -8, -8, 4}\n\n\t// get days\n\tdays := fillDays(hours, request.Year, time.Month(request.Month), skipDay)\n\n\t// split into groups\n\treturn splitDaysIntoGroups(days, request.Groups)\n}", "func (m *DeviceEnrollmentWindowsHelloForBusinessConfiguration) SetPinExpirationInDays(value *int32)() {\n err := m.GetBackingStore().Set(\"pinExpirationInDays\", value)\n if err != nil {\n panic(err)\n }\n}", "func (e Expiration) IsDaysNull() bool {\n\treturn e.Days == ExpirationDays(0)\n}", "func (s *APAPIServer) GetDpEntries(req *fibcapi.ApGetDpEntriesRequest, stream fibcapi.FIBCApApi_GetDpEntriesServer) error {\n\treturn s.ctl.GetDpEntries(req.Type, stream)\n}", "func (o *GetCatalogXMLParams) SetRequestedDate(requestedDate *strfmt.DateTime) {\n\to.RequestedDate = requestedDate\n}", "func (o SnapshotOutput) RetentionDays() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *Snapshot) pulumi.IntPtrOutput { return v.RetentionDays }).(pulumi.IntPtrOutput)\n}", "func (o *IscsiInterfaceGetIterRequest) DesiredAttributes() IscsiInterfaceGetIterRequestDesiredAttributes {\n\tvar r IscsiInterfaceGetIterRequestDesiredAttributes\n\tif o.DesiredAttributesPtr == nil {\n\t\treturn r\n\t}\n\tr = *o.DesiredAttributesPtr\n\treturn r\n}" ]
[ "0.8715455", "0.8437382", "0.83855915", "0.8356219", "0.83166206", "0.8281905", "0.8255426", "0.74855375", "0.7401453", "0.7165001", "0.7151393", "0.7092475", "0.7045034", "0.6661487", "0.6225183", "0.56489784", "0.5535044", "0.5287407", "0.5178021", "0.51658577", "0.5111705", "0.51089334", "0.5091748", "0.5068666", "0.5049921", "0.50310767", "0.50258315", "0.5007203", "0.49825504", "0.49651808", "0.49452004", "0.49436474", "0.49392876", "0.4922455", "0.48876593", "0.48666966", "0.48563877", "0.48562124", "0.48288554", "0.48182294", "0.48146912", "0.47768041", "0.47731298", "0.47670957", "0.47635436", "0.4755727", "0.4751724", "0.4749177", "0.47369605", "0.47338507", "0.47318998", "0.47084254", "0.4698992", "0.46970883", "0.4675643", "0.466947", "0.46479687", "0.461977", "0.46076405", "0.45841387", "0.45765138", "0.4571908", "0.45572817", "0.45284757", "0.45220113", "0.45137486", "0.45058432", "0.4502009", "0.44970453", "0.44873244", "0.4449436", "0.44478017", "0.44467437", "0.4426926", "0.4414924", "0.44148993", "0.44123113", "0.43659297", "0.43637273", "0.4343778", "0.43284217", "0.43240407", "0.4320928", "0.43044233", "0.42998284", "0.42989418", "0.4290588", "0.42867473", "0.42756575", "0.42742208", "0.42663744", "0.42619228", "0.42548186", "0.425083", "0.4250759", "0.42438227", "0.42367086", "0.423387", "0.4229192", "0.42286757" ]
0.8730878
0
GetRequestedDaysOk returns a tuple with the RequestedDays field value if set, nil otherwise and a boolean to check if the value has been set.
func (o *AccessRequestData) GetRequestedDaysOk() (*int32, bool) { if o == nil || o.RequestedDays == nil { return nil, false } return o.RequestedDays, true }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *AssetReportRefreshRequest) GetDaysRequestedOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.DaysRequested.Get(), o.DaysRequested.IsSet()\n}", "func (o *AssetReport) GetDaysRequestedOk() (*float32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.DaysRequested, true\n}", "func (o *CreditBankEmploymentReport) GetDaysRequestedOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.DaysRequested, true\n}", "func (o *AssetReportRefreshRequest) GetDaysRequested() int32 {\n\tif o == nil || o.DaysRequested.Get() == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.DaysRequested.Get()\n}", "func (o *AccessRequestData) GetRequestedDays() int32 {\n\tif o == nil || o.RequestedDays == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.RequestedDays\n}", "func (o *AccessRequestData) HasRequestedDays() bool {\n\tif o != nil && o.RequestedDays != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *CreditBankEmploymentReport) GetDaysRequested() int32 {\n\tif o == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\n\treturn o.DaysRequested\n}", "func (o *AssetReport) GetDaysRequested() float32 {\n\tif o == nil {\n\t\tvar ret float32\n\t\treturn ret\n\t}\n\n\treturn o.DaysRequested\n}", "func (o *AssetReport) SetDaysRequested(v float32) {\n\to.DaysRequested = v\n}", "func (o *AssetReportRefreshRequest) HasDaysRequested() bool {\n\tif o != nil && o.DaysRequested.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *AccessRequestData) SetRequestedDays(v int32) {\n\to.RequestedDays = &v\n}", "func (o *AssetReportRefreshRequest) SetDaysRequested(v int32) {\n\to.DaysRequested.Set(&v)\n}", "func (o *CreditBankEmploymentReport) SetDaysRequested(v int32) {\n\to.DaysRequested = v\n}", "func (o *PeriodModel) GetDaysOk() (*int32, bool) {\n\tif o == nil || o.Days == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Days, true\n}", "func (o *AssetReportRefreshRequest) SetDaysRequestedNil() {\n\to.DaysRequested.Set(nil)\n}", "func (o *BaseReportLongestGapInsights) GetDaysOk() (*int32, bool) {\n\tif o == nil || o.Days == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Days, true\n}", "func (o *MaintenanceWindowRecurrence) GetDayOk() (*string, bool) {\n\tif o == nil || o.Day == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Day, true\n}", "func (o *ProcessorSignalDecisionReportRequest) GetDaysFundsOnHoldOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.DaysFundsOnHold.Get(), o.DaysFundsOnHold.IsSet()\n}", "func (o *MicrosoftGraphWindows10CompliancePolicy) GetPasswordExpirationDaysOk() (int32, bool) {\n\tif o == nil || o.PasswordExpirationDays == nil {\n\t\tvar ret int32\n\t\treturn ret, false\n\t}\n\treturn *o.PasswordExpirationDays, true\n}", "func (o *Windows10CompliancePolicy) GetPasswordExpirationDaysOk() (int32, bool) {\n\tif o == nil || o.PasswordExpirationDays == nil {\n\t\tvar ret int32\n\t\treturn ret, false\n\t}\n\treturn *o.PasswordExpirationDays, true\n}", "func (im *IAMManager) passedDays(now, lastUsedDate time.Time, days float64, operator string) (float64, bool) {\n\n\tvar empty float64\n\tlastUsedDateDays := now.Sub(lastUsedDate).Hours() / 24\n\texpressionResult, err := expression.BoolExpression(lastUsedDateDays, days, operator)\n\tif err != nil {\n\t\treturn empty, false\n\t}\n\tif !expressionResult {\n\t\treturn lastUsedDateDays, false\n\t}\n\n\treturn lastUsedDateDays, true\n\n}", "func (o *AssetReportRefreshRequest) UnsetDaysRequested() {\n\to.DaysRequested.Unset()\n}", "func (o *StoragePhysicalDisk) GetWearStatusInDaysOk() (*int64, bool) {\n\tif o == nil || o.WearStatusInDays == nil {\n\t\treturn nil, false\n\t}\n\treturn o.WearStatusInDays, true\n}", "func (o BucketBillingResponseOutput) RequesterPays() pulumi.BoolOutput {\n\treturn o.ApplyT(func(v BucketBillingResponse) bool { return v.RequesterPays }).(pulumi.BoolOutput)\n}", "func (o BucketBillingPtrOutput) RequesterPays() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v *BucketBilling) *bool {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.RequesterPays\n\t}).(pulumi.BoolPtrOutput)\n}", "func (o BucketBillingOutput) RequesterPays() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v BucketBilling) *bool { return v.RequesterPays }).(pulumi.BoolPtrOutput)\n}", "func (o BucketObjectLockConfigurationRuleDefaultRetentionPtrOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *BucketObjectLockConfigurationRuleDefaultRetention) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Days\n\t}).(pulumi.IntPtrOutput)\n}", "func RecoverableDays(days int) ChangeOption {\n\treturn changeOption{\n\t\tapplier: applierFunc(\n\t\t\tfunc(caller caller, co interface{}) {\n\t\t\t\tco.(*secret.UpdateSetRequest).Attributes.RecoverableDays = days\n\t\t\t},\n\t\t),\n\t}\n}", "func (o *ProcessorSignalDecisionReportRequest) GetDaysFundsOnHold() int32 {\n\tif o == nil || o.DaysFundsOnHold.Get() == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.DaysFundsOnHold.Get()\n}", "func (e Expiration) IsDaysNull() bool {\n\treturn e.Days == ExpirationDays(0)\n}", "func (o *BaseReportLongestGapInsights) HasDays() bool {\n\tif o != nil && o.Days != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (m *DeviceManagementSettings) GetDeviceComplianceCheckinThresholdDays()(*int32) {\n val, err := m.GetBackingStore().Get(\"deviceComplianceCheckinThresholdDays\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*int32)\n }\n return nil\n}", "func (o BucketObjectLockConfigurationRuleDefaultRetentionOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v BucketObjectLockConfigurationRuleDefaultRetention) *int { return v.Days }).(pulumi.IntPtrOutput)\n}", "func (o DeleteRetentionPolicyResponsePtrOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *DeleteRetentionPolicyResponse) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Days\n\t}).(pulumi.IntPtrOutput)\n}", "func (o *PeriodModel) GetDays() int32 {\n\tif o == nil || o.Days == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.Days\n}", "func (o BucketObjectLockConfigurationV2RuleDefaultRetentionPtrOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *BucketObjectLockConfigurationV2RuleDefaultRetention) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Days\n\t}).(pulumi.IntPtrOutput)\n}", "func (o *PutCustomersCustomerFidSubscriptionsSubscriptionFidAutoCancelDaysParams) SetDays(days int32) {\n\to.Days = days\n}", "func (o BucketIntelligentTieringConfigurationTieringOutput) Days() pulumi.IntOutput {\n\treturn o.ApplyT(func(v BucketIntelligentTieringConfigurationTiering) int { return v.Days }).(pulumi.IntOutput)\n}", "func (c *Job) Days() *Job {\n\tif c.delayUnit == delayNone {\n\t\tc.unit = days\n\t} else {\n\t\tc.delayUnit = delayDays\n\t}\n\treturn c\n}", "func (o DeleteRetentionPolicyResponseOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v DeleteRetentionPolicyResponse) *int { return v.Days }).(pulumi.IntPtrOutput)\n}", "func (o *Ga4ghChemotherapy) GetDaysPerCycleOk() (string, bool) {\n\tif o == nil || o.DaysPerCycle == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.DaysPerCycle, true\n}", "func (o *PeriodModel) HasDays() bool {\n\tif o != nil && o.Days != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o BucketObjectLockConfigurationV2RuleDefaultRetentionOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v BucketObjectLockConfigurationV2RuleDefaultRetention) *int { return v.Days }).(pulumi.IntPtrOutput)\n}", "func (o BucketV2ObjectLockConfigurationRuleDefaultRetentionOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v BucketV2ObjectLockConfigurationRuleDefaultRetention) *int { return v.Days }).(pulumi.IntPtrOutput)\n}", "func (o *ReservationServiceItemModel) GetDatesOk() (*[]ServiceDateItemModel, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Dates, true\n}", "func (request *DomainRegisterRequest) GetRetentionDays() int32 {\n\treturn request.GetIntProperty(\"RetentionDays\")\n}", "func checkDays(searchParam string) (bool, string) {\n\tvalidDays := map[string]struct{}{\n\t\t\"monday\": {},\n\t\t\"tuesday\": {},\n\t\t\"wednesday\": {},\n\t\t\"thursday\": {},\n\t\t\"friday\": {},\n\t\t\"saturday\": {},\n\t\t\"sunday\": {},\n\t}\n\n\tif _, ok := validDays[strings.ToLower(searchParam)]; !ok {\n\t\treturn false, \"Invalid day of the week.\"\n\t}\n\n\treturn true, \"valid\"\n}", "func (o *FiltersApiLog) GetRequestIdsOk() ([]string, bool) {\n\tif o == nil || o.RequestIds == nil {\n\t\tvar ret []string\n\t\treturn ret, false\n\t}\n\treturn *o.RequestIds, true\n}", "func (o BucketLifecycleRuleTransitionOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v BucketLifecycleRuleTransition) *int { return v.Days }).(pulumi.IntPtrOutput)\n}", "func (o BucketLifecycleRuleNoncurrentVersionTransitionOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v BucketLifecycleRuleNoncurrentVersionTransition) *int { return v.Days }).(pulumi.IntPtrOutput)\n}", "func (o *ConditionRequestRateCondition) GetRequestsOk() (*string, bool) {\n\tif o == nil || o.Requests == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Requests, true\n}", "func (o *ProcessorSignalDecisionReportRequest) HasDaysFundsOnHold() bool {\n\tif o != nil && o.DaysFundsOnHold.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *BaseReportLongestGapInsights) GetDays() int32 {\n\tif o == nil || o.Days == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.Days\n}", "func (i ISODuration) GetDays() int {\r\n\treturn i.duration.Days\r\n}", "func (m OrderStatusRequest) GetMaturityDay() (v int, err quickfix.MessageRejectError) {\n\tvar f field.MaturityDayField\n\tif err = m.Get(&f); err == nil {\n\t\tv = f.Value()\n\t}\n\treturn\n}", "func (j *Job) Days() *Job {\n\tj.unit = JOB_UNIT_TYPE_DAY\n\treturn j\n}", "func WithValidityDays(v int) Option {\n\treturn func(s *Signer) {\n\t\ts.validityDays = v\n\t}\n}", "func (o *PayPeriodDetails) GetPayDayOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.PayDay.Get(), o.PayDay.IsSet()\n}", "func (o BucketLifecycleRuleExpirationPtrOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *BucketLifecycleRuleExpiration) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Days\n\t}).(pulumi.IntPtrOutput)\n}", "func (o *LoginRequest) GetRequestedScopeOk() ([]string, bool) {\n\tif o == nil || o.RequestedScope == nil {\n\t\treturn nil, false\n\t}\n\treturn o.RequestedScope, true\n}", "func (o *MaintenanceWindowRecurrence) GetDayOfMonthOk() (*int32, bool) {\n\tif o == nil || o.DayOfMonth == nil {\n\t\treturn nil, false\n\t}\n\treturn o.DayOfMonth, true\n}", "func (o *ProcessorSignalDecisionReportRequest) GetAmountInstantlyAvailableOk() (*float64, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.AmountInstantlyAvailable.Get(), o.AmountInstantlyAvailable.IsSet()\n}", "func Days(days ...int) TemporalExpression {\n\tee := make([]TemporalExpression, len(days))\n\tfor i, d := range days {\n\t\tee[i] = Day(d)\n\t}\n\treturn Or(ee...)\n}", "func (o *TaskOptions) GetShiftProjectDatesOk() (*bool, bool) {\n\tif o == nil || o.ShiftProjectDates == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ShiftProjectDates, true\n}", "func (o *ProjectDeploymentRuleResponse) GetWeekdayOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Weekday.Get(), o.Weekday.IsSet()\n}", "func (o *BaseReportLongestGapInsights) SetDays(v int32) {\n\to.Days = &v\n}", "func (o *ViewProjectMinMaxAvailableDates) GetSuggestedStartDateOk() (*string, bool) {\n\tif o == nil || o.SuggestedStartDate == nil {\n\t\treturn nil, false\n\t}\n\treturn o.SuggestedStartDate, true\n}", "func (o BucketV2LifecycleRuleNoncurrentVersionTransitionOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v BucketV2LifecycleRuleNoncurrentVersionTransition) *int { return v.Days }).(pulumi.IntPtrOutput)\n}", "func (m NoMDEntries) GetSellerDays() (v int, err quickfix.MessageRejectError) {\n\tvar f field.SellerDaysField\n\tif err = m.Get(&f); err == nil {\n\t\tv = f.Value()\n\t}\n\treturn\n}", "func (o BucketLifecycleRuleNoncurrentVersionExpirationPtrOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *BucketLifecycleRuleNoncurrentVersionExpiration) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Days\n\t}).(pulumi.IntPtrOutput)\n}", "func ViewAvailableDays(res http.ResponseWriter, req *http.Request) {\n\ttype dayData struct {\n\t\tDay string\n\t\tRemainingOrd int\n\t}\n\tvar AvailableDaysData []dayData\n\n\tfor n := 0; n < len(ds.WeeklySchedule); n++ {\n\t\tif ds.WeeklySchedule[n].CurrentOrders < ds.WeeklySchedule[n].MaxOrders {\n\t\t\tremainingOrders := ds.WeeklySchedule[n].MaxOrders - ds.WeeklySchedule[n].CurrentOrders\n\t\t\tif remainingOrders > 0 {\n\t\t\t\ttempData := dayData{\n\t\t\t\t\tDay: ds.IntToDay(n + 1),\n\t\t\t\t\tRemainingOrd: remainingOrders}\n\t\t\t\tAvailableDaysData = append(AvailableDaysData, tempData)\n\t\t\t}\n\t\t\t//fmt.Println(intToDay(n+1), \"is available for booking.\", remainingOrders, \"orders still available for taking.\")\n\t\t}\n\t}\n\terr := tpl.ExecuteTemplate(res, \"availableDays.gohtml\", AvailableDaysData)\n\tif err != nil {\n\t\thttp.Error(res, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n}", "func (o BucketLifecycleRuleExpirationOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v BucketLifecycleRuleExpiration) *int { return v.Days }).(pulumi.IntPtrOutput)\n}", "func (o BucketLifecycleRuleNoncurrentVersionExpirationOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v BucketLifecycleRuleNoncurrentVersionExpiration) *int { return v.Days }).(pulumi.IntPtrOutput)\n}", "func (o *PaymentStatusUpdateWebhook) GetAdjustedStartDateOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.AdjustedStartDate.Get(), o.AdjustedStartDate.IsSet()\n}", "func days(d float64) time.Duration {\n\treturn time.Duration(24*d) * time.Hour // Close enough\n}", "func (m *DeviceManagementSettings) SetDeviceComplianceCheckinThresholdDays(value *int32)() {\n err := m.GetBackingStore().Set(\"deviceComplianceCheckinThresholdDays\", value)\n if err != nil {\n panic(err)\n }\n}", "func (m *AndroidCompliancePolicy) GetPasswordExpirationDays()(*int32) {\n val, err := m.GetBackingStore().Get(\"passwordExpirationDays\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*int32)\n }\n return nil\n}", "func (m CrossOrderCancelReplaceRequest) GetLocateReqd() (v bool, err quickfix.MessageRejectError) {\n\tvar f field.LocateReqdField\n\tif err = m.Get(&f); err == nil {\n\t\tv = f.Value()\n\t}\n\treturn\n}", "func (o *PeriodModel) SetDays(v int32) {\n\to.Days = &v\n}", "func (o BucketLifecycleConfigurationV2RuleTransitionOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v BucketLifecycleConfigurationV2RuleTransition) *int { return v.Days }).(pulumi.IntPtrOutput)\n}", "func (o DeleteRetentionPolicyPtrOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *DeleteRetentionPolicy) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Days\n\t}).(pulumi.IntPtrOutput)\n}", "func (o RegistryRetentionPolicyPtrOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *RegistryRetentionPolicy) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Days\n\t}).(pulumi.IntPtrOutput)\n}", "func (o BucketV2LifecycleRuleTransitionOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v BucketV2LifecycleRuleTransition) *int { return v.Days }).(pulumi.IntPtrOutput)\n}", "func (m NoMDEntries) HasSellerDays() bool {\n\treturn m.Has(tag.SellerDays)\n}", "func (o BucketLifecycleConfigurationV2RuleExpirationPtrOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *BucketLifecycleConfigurationV2RuleExpiration) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Days\n\t}).(pulumi.IntPtrOutput)\n}", "func (m *EntitlementManagementSettings) GetDaysUntilExternalUserDeletedAfterBlocked()(*int32) {\n val, err := m.GetBackingStore().Get(\"daysUntilExternalUserDeletedAfterBlocked\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*int32)\n }\n return nil\n}", "func (o BucketV2LifecycleRuleNoncurrentVersionExpirationOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v BucketV2LifecycleRuleNoncurrentVersionExpiration) *int { return v.Days }).(pulumi.IntPtrOutput)\n}", "func (o *ProvenanceRequestDTO) GetStartDateOk() (*string, bool) {\n\tif o == nil || o.StartDate == nil {\n\t\treturn nil, false\n\t}\n\treturn o.StartDate, true\n}", "func (request *DomainRegisterRequest) SetRetentionDays(value int32) {\n\trequest.SetIntProperty(\"RetentionDays\", value)\n}", "func (o *StoragePhysicalDisk) GetWearStatusInDays() int64 {\n\tif o == nil || o.WearStatusInDays == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\treturn *o.WearStatusInDays\n}", "func (o DeleteRetentionPolicyOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v DeleteRetentionPolicy) *int { return v.Days }).(pulumi.IntPtrOutput)\n}", "func (o *OAuth2ConsentRequest) GetRequestedScopeOk() ([]string, bool) {\n\tif o == nil || o.RequestedScope == nil {\n\t\treturn nil, false\n\t}\n\treturn o.RequestedScope, true\n}", "func getDays(time *int) int {\n\treturn getTimeScale(time, 86400)\n}", "func (o *ViewProjectMinMaxAvailableDates) GetSuggestedEndDateOk() (*string, bool) {\n\tif o == nil || o.SuggestedEndDate == nil {\n\t\treturn nil, false\n\t}\n\treturn o.SuggestedEndDate, true\n}", "func (o *PayPeriodDetails) GetStartDateOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.StartDate.Get(), o.StartDate.IsSet()\n}", "func (o *ProcessorSignalDecisionReportRequest) GetInitiatedOk() (*bool, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Initiated, true\n}", "func (o *ViewProjectBudget) GetRepeatsRemainingOk() (*int32, bool) {\n\tif o == nil || o.RepeatsRemaining == nil {\n\t\treturn nil, false\n\t}\n\treturn o.RepeatsRemaining, true\n}", "func (s *DataLakeLifecycleExpiration) SetDays(v int64) *DataLakeLifecycleExpiration {\n\ts.Days = &v\n\treturn s\n}", "func (o *EventAttributes) GetDateHappenedOk() (*int64, bool) {\n\tif o == nil || o.DateHappened == nil {\n\t\treturn nil, false\n\t}\n\treturn o.DateHappened, true\n}", "func (o *MuteFindingRequestProperties) GetExpirationDateOk() (*int64, bool) {\n\tif o == nil || o.ExpirationDate == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ExpirationDate, true\n}" ]
[ "0.86048347", "0.8203597", "0.812837", "0.7565374", "0.7392896", "0.7230249", "0.7155143", "0.71162575", "0.7081519", "0.70338076", "0.69844204", "0.6961741", "0.6942474", "0.6559127", "0.6465181", "0.6438515", "0.56063884", "0.55806965", "0.53871804", "0.53544563", "0.53176904", "0.5260924", "0.52497494", "0.52165765", "0.51901", "0.5118596", "0.49654835", "0.49507555", "0.49483106", "0.49414137", "0.49400496", "0.4924612", "0.48990396", "0.4891787", "0.48640606", "0.4856854", "0.4842077", "0.48389128", "0.4835096", "0.4825398", "0.4784952", "0.47790885", "0.47751558", "0.47676548", "0.4766456", "0.47361043", "0.47295427", "0.47177774", "0.46875373", "0.46706542", "0.4655814", "0.46482977", "0.46220455", "0.45908034", "0.45843816", "0.45737562", "0.45653903", "0.45601138", "0.45506507", "0.45505506", "0.45446727", "0.454445", "0.45436668", "0.45430228", "0.45418832", "0.45330685", "0.45302975", "0.44980547", "0.4494122", "0.44904873", "0.4482174", "0.4479651", "0.44779223", "0.44608492", "0.44375357", "0.44276476", "0.44266284", "0.44165772", "0.4385473", "0.43851122", "0.43750703", "0.43506366", "0.43473265", "0.43437606", "0.43380377", "0.43288675", "0.43258157", "0.43092072", "0.42972368", "0.4295467", "0.42780697", "0.42683718", "0.4268159", "0.426501", "0.4262006", "0.4256993", "0.4252987", "0.4250908", "0.42419934", "0.4239244" ]
0.859045
1
HasRequestedDays returns a boolean if a field has been set.
func (o *AccessRequestData) HasRequestedDays() bool { if o != nil && o.RequestedDays != nil { return true } return false }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *AssetReportRefreshRequest) HasDaysRequested() bool {\n\tif o != nil && o.DaysRequested.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ProcessorSignalDecisionReportRequest) HasDaysFundsOnHold() bool {\n\tif o != nil && o.DaysFundsOnHold.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *AssetReportRefreshRequest) GetDaysRequestedOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.DaysRequested.Get(), o.DaysRequested.IsSet()\n}", "func (o *AccessRequestData) GetRequestedDaysOk() (*int32, bool) {\n\tif o == nil || o.RequestedDays == nil {\n\t\treturn nil, false\n\t}\n\treturn o.RequestedDays, true\n}", "func (o *AssetReport) GetDaysRequestedOk() (*float32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.DaysRequested, true\n}", "func (o *AssetReport) SetDaysRequested(v float32) {\n\to.DaysRequested = v\n}", "func (o *CreditBankEmploymentReport) GetDaysRequestedOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.DaysRequested, true\n}", "func (o *PeriodModel) HasDays() bool {\n\tif o != nil && o.Days != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *AssetReportRefreshRequest) GetDaysRequested() int32 {\n\tif o == nil || o.DaysRequested.Get() == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.DaysRequested.Get()\n}", "func (o *BaseReportLongestGapInsights) HasDays() bool {\n\tif o != nil && o.Days != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *CreditBankEmploymentReport) SetDaysRequested(v int32) {\n\to.DaysRequested = v\n}", "func (o *CreditBankEmploymentReport) GetDaysRequested() int32 {\n\tif o == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\n\treturn o.DaysRequested\n}", "func (o *AssetReportRefreshRequest) SetDaysRequested(v int32) {\n\to.DaysRequested.Set(&v)\n}", "func (o *AssetReport) GetDaysRequested() float32 {\n\tif o == nil {\n\t\tvar ret float32\n\t\treturn ret\n\t}\n\n\treturn o.DaysRequested\n}", "func (o *AccessRequestData) SetRequestedDays(v int32) {\n\to.RequestedDays = &v\n}", "func (o *AccessRequestData) GetRequestedDays() int32 {\n\tif o == nil || o.RequestedDays == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.RequestedDays\n}", "func (o *AssetReportRefreshRequest) SetDaysRequestedNil() {\n\to.DaysRequested.Set(nil)\n}", "func (m OrderStatusRequest) HasMaturityDay() bool {\n\treturn m.Has(tag.MaturityDay)\n}", "func (o *MaintenanceWindowRecurrence) HasDay() bool {\n\tif o != nil && o.Day != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (m NoMDEntries) HasSellerDays() bool {\n\treturn m.Has(tag.SellerDays)\n}", "func (o *ProcessorSignalDecisionReportRequest) HasAmountInstantlyAvailable() bool {\n\tif o != nil && o.AmountInstantlyAvailable.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ViewProjectMinMaxAvailableDates) HasSuggestedStartDate() bool {\n\tif o != nil && o.SuggestedStartDate != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ProvenanceRequestDTO) HasStartDate() bool {\n\tif o != nil && o.StartDate != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *MuteFindingRequestProperties) HasExpirationDate() bool {\n\treturn o != nil && o.ExpirationDate != nil\n}", "func (e Expiration) IsDaysNull() bool {\n\treturn e.Days == ExpirationDays(0)\n}", "func (o *Ga4ghChemotherapy) HasDaysPerCycle() bool {\n\tif o != nil && o.DaysPerCycle != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ViewProjectMinMaxAvailableDates) HasSuggestedEndDate() bool {\n\tif o != nil && o.SuggestedEndDate != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *MicrosoftGraphWindows10CompliancePolicy) HasPasswordExpirationDays() bool {\n\tif o != nil && o.PasswordExpirationDays != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (im *IAMManager) passedDays(now, lastUsedDate time.Time, days float64, operator string) (float64, bool) {\n\n\tvar empty float64\n\tlastUsedDateDays := now.Sub(lastUsedDate).Hours() / 24\n\texpressionResult, err := expression.BoolExpression(lastUsedDateDays, days, operator)\n\tif err != nil {\n\t\treturn empty, false\n\t}\n\tif !expressionResult {\n\t\treturn lastUsedDateDays, false\n\t}\n\n\treturn lastUsedDateDays, true\n\n}", "func (o *ProcessorSignalDecisionReportRequest) GetDaysFundsOnHoldOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.DaysFundsOnHold.Get(), o.DaysFundsOnHold.IsSet()\n}", "func (o *StoragePhysicalDisk) HasWearStatusInDays() bool {\n\tif o != nil && o.WearStatusInDays != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Windows10CompliancePolicy) HasPasswordExpirationDays() bool {\n\tif o != nil && o.PasswordExpirationDays != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Giveaway) HasStartDate() bool {\n\tif o != nil && o.StartDate != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *RollbackDeductedLoyaltyPointsEffectProps) HasStartDate() bool {\n\tif o != nil && o.StartDate != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *PayPeriodDetails) HasPayDay() bool {\n\tif o != nil && o.PayDay.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *Run) HasRequestedAt() bool {\n\tif o != nil && o.RequestedAt != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (t LifecycleTransition) IsSet() bool {\n\treturn t.TransitionDate != nil && !t.TransitionDate.IsZero() || t.TransitionInDays > 0\n}", "func (o *TaskOptions) HasShiftProjectDates() bool {\n\tif o != nil && o.ShiftProjectDates != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ProjectDeploymentRuleResponse) HasWeekday() bool {\n\tif o != nil && o.Weekday.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (me TimePeriod) IsSevenDays() bool { return me.String() == \"SevenDays\" }", "func (e LifecycleExpiration) IsSet() bool {\n\treturn e.ExpirationDate != nil && !e.ExpirationDate.IsZero() || e.ExpirationInDays > 0\n}", "func (o *EventAttributes) HasDateHappened() bool {\n\treturn o != nil && o.DateHappened != nil\n}", "func (o *PayPeriodDetails) HasStartDate() bool {\n\tif o != nil && o.StartDate.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (m CrossOrderCancelReplaceRequest) HasFutSettDate() bool {\n\treturn m.Has(tag.FutSettDate)\n}", "func (o *AssetReportRefreshRequest) UnsetDaysRequested() {\n\to.DaysRequested.Unset()\n}", "func (o *DowntimeScheduleRecurrencesCreateRequest) HasTimezone() bool {\n\treturn o != nil && o.Timezone != nil\n}", "func (o *ViewProjectBudget) HasDateCreated() bool {\n\tif o != nil && o.DateCreated != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *MuteFindingResponseProperties) HasExpirationDate() bool {\n\treturn o != nil && o.ExpirationDate != nil\n}", "func (o BucketBillingResponseOutput) RequesterPays() pulumi.BoolOutput {\n\treturn o.ApplyT(func(v BucketBillingResponse) bool { return v.RequesterPays }).(pulumi.BoolOutput)\n}", "func CheckPurgeDays(CreationDate string, Purge int) bool {\n\tc, err := time.Parse(\"2006-01-02T15:04:05Z\", CreationDate)\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn int(time.Now().Sub(c).Hours()/24) > Purge\n}", "func (o *LoginRequest) HasRequestedScope() bool {\n\tif o != nil && o.RequestedScope != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ViewProjectMinMaxAvailableDates) HasMinStartDate() bool {\n\tif o != nil && o.MinStartDate != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *TppCredentialsParams) HasValidUntilDate() bool {\n\tif o != nil && o.ValidUntilDate != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ViewProjectBudget) HasRepeatsRemaining() bool {\n\tif o != nil && o.RepeatsRemaining != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (m NoMDEntries) HasExpireDate() bool {\n\treturn m.Has(tag.ExpireDate)\n}", "func (o BucketBillingPtrOutput) RequesterPays() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v *BucketBilling) *bool {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.RequesterPays\n\t}).(pulumi.BoolPtrOutput)\n}", "func (m CrossOrderCancelReplaceRequest) HasExpireDate() bool {\n\treturn m.Has(tag.ExpireDate)\n}", "func (o *Ga4ghChemotherapy) HasStartDate() bool {\n\tif o != nil && o.StartDate != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (i *Invoice) GetPhoneRequested() (value bool) {\n\tif i == nil {\n\t\treturn\n\t}\n\treturn i.Flags.Has(2)\n}", "func (o *LaunchpadClicks) HasDate() bool {\n\tif o != nil && o.Date != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (info MsigApprovalsInfo) HasRequested(actor eos.AccountName) bool {\n\tfor _, r := range info.RequestedApprovals {\n\t\tif r.Level.Actor == actor {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn info.HasApproved(actor)\n}", "func (o *ProcessorSignalDecisionReportRequest) GetDaysFundsOnHold() int32 {\n\tif o == nil || o.DaysFundsOnHold.Get() == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.DaysFundsOnHold.Get()\n}", "func (o *InlineObject753) HasDatePurchased() bool {\n\tif o != nil && o.DatePurchased != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o BucketBillingOutput) RequesterPays() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v BucketBilling) *bool { return v.RequesterPays }).(pulumi.BoolPtrOutput)\n}", "func (request *DomainRegisterRequest) GetRetentionDays() int32 {\n\treturn request.GetIntProperty(\"RetentionDays\")\n}", "func (o *ProvenanceRequestDTO) HasEndDate() bool {\n\tif o != nil && o.EndDate != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (v *ServiceGenerator_Generate_Args) IsSetRequest() bool {\n\treturn v != nil && v.Request != nil\n}", "func (m CrossOrderCancelReplaceRequest) HasLocateReqd() bool {\n\treturn m.Has(tag.LocateReqd)\n}", "func (obj *expense) HasRemaining() bool {\n\treturn obj.remaining != nil\n}", "func (o *MetricsQueryResponse) HasToDate() bool {\n\tif o != nil && o.ToDate != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (m MarketDataSnapshotFullRefresh) HasMDReqID() bool {\n\treturn m.Has(tag.MDReqID)\n}", "func (d UserData) HasCreateDate() bool {\n\treturn d.ModelData.Has(models.NewFieldName(\"CreateDate\", \"create_date\"))\n}", "func (o *ConditionRequestRateCondition) HasRequests() bool {\n\tif o != nil && o.Requests != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *RollbackDeductedLoyaltyPointsEffectProps) HasExpiryDate() bool {\n\tif o != nil && o.ExpiryDate != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (m SecurityListRequest) HasIssueDate() bool {\n\treturn m.Has(tag.IssueDate)\n}", "func (o *TppCertificateParams) HasValidUntilDate() bool {\n\tif o != nil && o.ValidUntilDate != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *InlineResponse20051TodoItems) HasStartDate() bool {\n\tif o != nil && o.StartDate != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (i *Invoice) GetEmailRequested() (value bool) {\n\tif i == nil {\n\t\treturn\n\t}\n\treturn i.Flags.Has(3)\n}", "func daemonSetIsReady(ds *appsv1.DaemonSet) bool {\n\treturn ds.Status.DesiredNumberScheduled == ds.Status.NumberAvailable\n}", "func (d UserData) HasDate() bool {\n\treturn d.ModelData.Has(models.NewFieldName(\"Date\", \"date\"))\n}", "func (o *ViewProjectBudget) HasDateDeleted() bool {\n\tif o != nil && o.DateDeleted != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *PeriodModel) GetDaysOk() (*int32, bool) {\n\tif o == nil || o.Days == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Days, true\n}", "func (o *FiltersApiLog) HasRequestIds() bool {\n\tif o != nil && o.RequestIds != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (s *TradeStage) CanMakeDelReq() bool {\n\tif len(s.Docs) > 0 {\n\t\treturn false\n\t}\n\tl := len(s.DelReqs)\n\treturn l == 0 || s.DelReqs[l-1].Status != ApprovalPending // last delreq is not pending, then can delete\n}", "func (m SecurityListRequest) HasRedemptionDate() bool {\n\treturn m.Has(tag.RedemptionDate)\n}", "func (o *ViewProjectBudget) HasDateCompleted() bool {\n\tif o != nil && o.DateCompleted != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (request *DomainRegisterRequest) SetRetentionDays(value int32) {\n\trequest.SetIntProperty(\"RetentionDays\", value)\n}", "func (i *Invoice) GetShippingAddressRequested() (value bool) {\n\tif i == nil {\n\t\treturn\n\t}\n\treturn i.Flags.Has(4)\n}", "func (m *InternalDomainFederation) GetIsSignedAuthenticationRequestRequired()(*bool) {\n val, err := m.GetBackingStore().Get(\"isSignedAuthenticationRequestRequired\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*bool)\n }\n return nil\n}", "func (o *MaintenanceWindowRecurrence) HasDayOfMonth() bool {\n\tif o != nil && o.DayOfMonth != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func NewLocateReqd(val bool) LocateReqdField {\n\treturn LocateReqdField{quickfix.FIXBoolean(val)}\n}", "func (_Dospayment *DospaymentCaller) HasServiceFee(opts *bind.CallOpts, payer common.Address, serviceType *big.Int) (bool, error) {\n\tvar (\n\t\tret0 = new(bool)\n\t)\n\tout := ret0\n\terr := _Dospayment.contract.Call(opts, out, \"hasServiceFee\", payer, serviceType)\n\treturn *ret0, err\n}", "func (o *InlineResponse20014Projects) HasStartDate() bool {\n\tif o != nil && o.StartDate != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *ViewMilestone) HasDeadline() bool {\n\tif o != nil && o.Deadline != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (m MarketDataRequestReject) HasMDReqID() bool {\n\treturn m.Has(tag.MDReqID)\n}", "func (o *HttpPushWebhookTest) HasRequestTimeout() bool {\n\tif o != nil && o.RequestTimeout != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *TfaCreateMessageRequest) HasRepeatDTMF() bool {\n\tif o != nil && o.RepeatDTMF != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *AccessKey) HasExpirationDate() bool {\n\tif o != nil && o.ExpirationDate != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (r *ReferenceAdapter) IsDeletionRequested() bool {\n\treturn r.ProjectReference.DeletionTimestamp != nil\n}", "func (o *SummaryEventResponse) HasToday() bool {\n\tif o != nil && o.Today != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}" ]
[ "0.8471082", "0.6876881", "0.6793111", "0.64848155", "0.6456762", "0.6436269", "0.63662356", "0.6364872", "0.6363886", "0.63087153", "0.6277165", "0.61807173", "0.6166833", "0.616343", "0.6080762", "0.6068704", "0.5783408", "0.5711446", "0.5670552", "0.5662135", "0.56383485", "0.55823565", "0.55068433", "0.5471558", "0.5397893", "0.53954476", "0.53109443", "0.5302399", "0.5296838", "0.52605754", "0.525594", "0.5234845", "0.523185", "0.51976955", "0.5184285", "0.51719946", "0.51468873", "0.5143514", "0.5140719", "0.512656", "0.5110876", "0.5109821", "0.5102357", "0.5062375", "0.50227076", "0.50169075", "0.50121456", "0.500272", "0.49854985", "0.49675924", "0.49500203", "0.49472412", "0.4943646", "0.49207276", "0.4908389", "0.49079636", "0.4905962", "0.4904347", "0.49026617", "0.4899531", "0.48974055", "0.4895475", "0.4892557", "0.4891361", "0.48869777", "0.4881154", "0.4881115", "0.4880252", "0.48731592", "0.48569104", "0.48449704", "0.48141146", "0.4793613", "0.47888517", "0.47810328", "0.47771502", "0.47764578", "0.47630343", "0.47601312", "0.47585428", "0.47523117", "0.47444114", "0.4744192", "0.47314486", "0.4730936", "0.4729218", "0.4727444", "0.4719511", "0.4718289", "0.47152355", "0.47033602", "0.4691167", "0.46878785", "0.46866742", "0.46751192", "0.46518785", "0.4645055", "0.46425918", "0.4634465", "0.46328348" ]
0.82155514
1
SetRequestedDays gets a reference to the given int32 and assigns it to the RequestedDays field.
func (o *AccessRequestData) SetRequestedDays(v int32) { o.RequestedDays = &v }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "func (o *CreditBankEmploymentReport) SetDaysRequested(v int32) {\n\to.DaysRequested = v\n}", "func (o *AssetReportRefreshRequest) SetDaysRequested(v int32) {\n\to.DaysRequested.Set(&v)\n}", "func (o *AssetReport) SetDaysRequested(v float32) {\n\to.DaysRequested = v\n}", "func (o *AccessRequestData) GetRequestedDays() int32 {\n\tif o == nil || o.RequestedDays == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.RequestedDays\n}", "func (o *AssetReportRefreshRequest) GetDaysRequested() int32 {\n\tif o == nil || o.DaysRequested.Get() == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.DaysRequested.Get()\n}", "func (o *CreditBankEmploymentReport) GetDaysRequested() int32 {\n\tif o == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\n\treturn o.DaysRequested\n}", "func (o *AssetReportRefreshRequest) SetDaysRequestedNil() {\n\to.DaysRequested.Set(nil)\n}", "func (o *AssetReportRefreshRequest) UnsetDaysRequested() {\n\to.DaysRequested.Unset()\n}", "func (o *AssetReport) GetDaysRequested() float32 {\n\tif o == nil {\n\t\tvar ret float32\n\t\treturn ret\n\t}\n\n\treturn o.DaysRequested\n}", "func (o *AccessRequestData) HasRequestedDays() bool {\n\tif o != nil && o.RequestedDays != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (m *DeviceManagementSettings) SetDeviceComplianceCheckinThresholdDays(value *int32)() {\n err := m.GetBackingStore().Set(\"deviceComplianceCheckinThresholdDays\", value)\n if err != nil {\n panic(err)\n }\n}", "func (request *DomainRegisterRequest) SetRetentionDays(value int32) {\n\trequest.SetIntProperty(\"RetentionDays\", value)\n}", "func (o *AccessRequestData) GetRequestedDaysOk() (*int32, bool) {\n\tif o == nil || o.RequestedDays == nil {\n\t\treturn nil, false\n\t}\n\treturn o.RequestedDays, true\n}", "func (o *AssetReportRefreshRequest) GetDaysRequestedOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.DaysRequested.Get(), o.DaysRequested.IsSet()\n}", "func (o *CreditBankEmploymentReport) GetDaysRequestedOk() (*int32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.DaysRequested, true\n}", "func (o *AssetReportRefreshRequest) HasDaysRequested() bool {\n\tif o != nil && o.DaysRequested.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "func (o *PutCustomersCustomerFidSubscriptionsSubscriptionFidAutoCancelDaysParams) SetDays(days int32) {\n\to.Days = days\n}", "func RecoverableDays(days int) ChangeOption {\n\treturn changeOption{\n\t\tapplier: applierFunc(\n\t\t\tfunc(caller caller, co interface{}) {\n\t\t\t\tco.(*secret.UpdateSetRequest).Attributes.RecoverableDays = days\n\t\t\t},\n\t\t),\n\t}\n}", "func (m *AndroidCompliancePolicy) SetPasswordExpirationDays(value *int32)() {\n err := m.GetBackingStore().Set(\"passwordExpirationDays\", value)\n if err != nil {\n panic(err)\n }\n}", "func (m *DeviceEnrollmentWindowsHelloForBusinessConfiguration) SetPinExpirationInDays(value *int32)() {\n err := m.GetBackingStore().Set(\"pinExpirationInDays\", value)\n if err != nil {\n panic(err)\n }\n}", "func SetDay(cd int) {\n\tdaycount = cd\n}", "func (m *AndroidWorkProfileGeneralDeviceConfiguration) SetWorkProfilePasswordExpirationDays(value *int32)() {\n m.workProfilePasswordExpirationDays = value\n}", "func (m *IosUpdateConfiguration) SetScheduledInstallDays(value []DayOfWeek)() {\n err := m.GetBackingStore().Set(\"scheduledInstallDays\", value)\n if err != nil {\n panic(err)\n }\n}", "func (o *AssetReport) GetDaysRequestedOk() (*float32, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.DaysRequested, true\n}", "func (i ISODuration) SetDays(days int) {\r\n\ti.duration.Days = days\r\n}", "func (_DayLimitMock *DayLimitMockTransactor) SetDailyLimit(opts *bind.TransactOpts, _newLimit *big.Int) (*types.Transaction, error) {\n\treturn _DayLimitMock.contract.Transact(opts, \"setDailyLimit\", _newLimit)\n}", "func (o *BaseReportLongestGapInsights) SetDays(v int32) {\n\to.Days = &v\n}", "func (o *PeriodModel) SetDays(v int32) {\n\to.Days = &v\n}", "func (m *AndroidWorkProfileGeneralDeviceConfiguration) SetPasswordExpirationDays(value *int32)() {\n m.passwordExpirationDays = value\n}", "func (db *DynamoConnection) SetLookbackWindow(nDays int64) {\n\tdb.queryLookbackDays = nDays\n}", "func (m *EntitlementManagementSettings) SetDaysUntilExternalUserDeletedAfterBlocked(value *int32)() {\n err := m.GetBackingStore().Set(\"daysUntilExternalUserDeletedAfterBlocked\", value)\n if err != nil {\n panic(err)\n }\n}", "func (o *LoginRequest) SetRequestedScope(v []string) {\n\to.RequestedScope = v\n}", "func (i *Invoice) SetPhoneRequested(value bool) {\n\tif value {\n\t\ti.Flags.Set(2)\n\t\ti.PhoneRequested = true\n\t} else {\n\t\ti.Flags.Unset(2)\n\t\ti.PhoneRequested = false\n\t}\n}", "func SetMaxRequests(serviceName string, maxRequests *uint32) {\n\tsrc.mu.Lock()\n\tdefer src.mu.Unlock()\n\tc, ok := src.services[serviceName]\n\tif !ok {\n\t\tc = &ServiceRequestsCounter{ServiceName: serviceName}\n\t\tsrc.services[serviceName] = c\n\t}\n\tif maxRequests != nil {\n\t\tc.maxRequests = *maxRequests\n\t} else {\n\t\tc.maxRequests = defaultMaxRequests\n\t}\n}", "func (o *OAuth2ConsentRequest) SetRequestedScope(v []string) {\n\to.RequestedScope = v\n}", "func (s *DataLakeLifecycleExpiration) SetDays(v int64) *DataLakeLifecycleExpiration {\n\ts.Days = &v\n\treturn s\n}", "func SetRequirements(ctx context.Context, in interface{}) context.Context {\n\treturn context.WithValue(ctx, requirementSetMarker{}, &requirementSetMarker{in})\n}", "func (_DayLimitMock *DayLimitMockTransactorSession) SetDailyLimit(_newLimit *big.Int) (*types.Transaction, error) {\n\treturn _DayLimitMock.Contract.SetDailyLimit(&_DayLimitMock.TransactOpts, _newLimit)\n}", "func (s *Spanet) SetDay(day int) (int, error) {\n\treturn s.commandInt(\"S03\", day, 1, 31, \"day\", \"%02d\")\n}", "func (s *DataLakeLifecycleTransition) SetDays(v int64) *DataLakeLifecycleTransition {\n\ts.Days = &v\n\treturn s\n}", "func (_DayLimitMock *DayLimitMockSession) SetDailyLimit(_newLimit *big.Int) (*types.Transaction, error) {\n\treturn _DayLimitMock.Contract.SetDailyLimit(&_DayLimitMock.TransactOpts, _newLimit)\n}", "func (o *FiltersApiLog) SetRequestIds(v []string) {\n\to.RequestIds = &v\n}", "func (o *GetCatalogXMLParams) SetRequestedDate(requestedDate *strfmt.DateTime) {\n\to.RequestedDate = requestedDate\n}", "func (m *RecurrencePattern) SetDaysOfWeek(value []DayOfWeek)() {\n m.daysOfWeek = value\n}", "func (m OrderStatusRequest) SetMaturityDay(v int) {\n\tm.Set(field.NewMaturityDay(v))\n}", "func WithValidityDays(v int) Option {\n\treturn func(s *Signer) {\n\t\ts.validityDays = v\n\t}\n}", "func (request *DomainRegisterRequest) GetRetentionDays() int32 {\n\treturn request.GetIntProperty(\"RetentionDays\")\n}", "func (c *Job) Days() *Job {\n\tif c.delayUnit == delayNone {\n\t\tc.unit = days\n\t} else {\n\t\tc.delayUnit = delayDays\n\t}\n\treturn c\n}", "func (m *InformationProtection) SetThreatAssessmentRequests(value []ThreatAssessmentRequestable)() {\n err := m.GetBackingStore().Set(\"threatAssessmentRequests\", value)\n if err != nil {\n panic(err)\n }\n}", "func (r *Reporter) setupDays(dateFrom, dateTo time.Time) (time.Time, int, error) {\n\tif dateTo.Before(dateFrom) {\n\t\treturn time.Now(), 0, errors.New(r.Config.Translate.DateError1)\n\t}\n\tif dateTo.After(time.Now()) {\n\t\treturn time.Now(), 0, errors.New(r.Config.Translate.DateError2)\n\t}\n\tdateFromRounded := time.Date(dateFrom.Year(), dateFrom.Month(), dateFrom.Day(), 0, 0, 0, 0, time.UTC)\n\tdateToRounded := time.Date(dateTo.Year(), dateTo.Month(), dateTo.Day(), 0, 0, 0, 0, time.UTC)\n\tnumberOfDays := int(dateToRounded.Sub(dateFromRounded).Hours() / 24)\n\treturn dateFromRounded, numberOfDays, nil\n}", "func (m *RecurrenceRange) SetStartDate(value *i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.DateOnly)() {\n err := m.GetBackingStore().Set(\"startDate\", value)\n if err != nil {\n panic(err)\n }\n}", "func (mr *MockClientMockRecorder) SetMax404Retries(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SetMax404Retries\", reflect.TypeOf((*MockClient)(nil).SetMax404Retries), arg0)\n}", "func (m *RiskyServicePrincipalsDismissPostRequestBody) SetServicePrincipalIds(value []string)() {\n err := m.GetBackingStore().Set(\"servicePrincipalIds\", value)\n if err != nil {\n panic(err)\n }\n}", "func (o *MultipleMetricsParams) SetRequestedMetrics(requestedMetrics *models.MetricsReadRequest) {\n\to.RequestedMetrics = requestedMetrics\n}", "func (me *TxsdRedefineTimeSyncTokenTypeComplexContentRestrictionSeedLength) Set(s string) {\n\t(*xsdt.Integer)(me).Set(s)\n}", "func (o *PutCustomersCustomerFidSubscriptionsSubscriptionFidAutoCancelDaysParams) WithDays(days int32) *PutCustomersCustomerFidSubscriptionsSubscriptionFidAutoCancelDaysParams {\n\to.SetDays(days)\n\treturn o\n}", "func (m *ScheduleRequestBuilder) OfferShiftRequests()(*i98ee724eb951b642ca62569abf1d3cda0e9ca342b1c35e6bb93d1ab0b5946191.OfferShiftRequestsRequestBuilder) {\n return i98ee724eb951b642ca62569abf1d3cda0e9ca342b1c35e6bb93d1ab0b5946191.NewOfferShiftRequestsRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "func (tu *TransactionfactorUpdate) SetNumDay(i int) *TransactionfactorUpdate {\n\ttu.mutation.ResetNumDay()\n\ttu.mutation.SetNumDay(i)\n\treturn tu\n}", "func (o DeleteRetentionPolicyResponseOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v DeleteRetentionPolicyResponse) *int { return v.Days }).(pulumi.IntPtrOutput)\n}", "func (o BucketObjectLockConfigurationRuleDefaultRetentionOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v BucketObjectLockConfigurationRuleDefaultRetention) *int { return v.Days }).(pulumi.IntPtrOutput)\n}", "func (m *ManagementTemplateStepTenantSummary) SetAssignedTenantsCount(value *int32)() {\n err := m.GetBackingStore().Set(\"assignedTenantsCount\", value)\n if err != nil {\n panic(err)\n }\n}", "func (tuo *TransactionfactorUpdateOne) SetNumDay(i int) *TransactionfactorUpdateOne {\n\ttuo.mutation.ResetNumDay()\n\ttuo.mutation.SetNumDay(i)\n\treturn tuo\n}", "func (o *PostAutoDiscoveryDNSParams) SetScheduleDays(scheduleDays *string) {\n\to.ScheduleDays = scheduleDays\n}", "func (m *ScheduleRequestBuilder) SwapShiftsChangeRequests()(*i4ee57924c99393c68749c89c3f52497a0a762f96e8c85319a78b103466ae6d15.SwapShiftsChangeRequestsRequestBuilder) {\n return i4ee57924c99393c68749c89c3f52497a0a762f96e8c85319a78b103466ae6d15.NewSwapShiftsChangeRequestsRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "func (m *RecurrencePattern) SetDayOfMonth(value *int32)() {\n m.dayOfMonth = value\n}", "func (m *DeviceManagementSettings) GetDeviceComplianceCheckinThresholdDays()(*int32) {\n val, err := m.GetBackingStore().Get(\"deviceComplianceCheckinThresholdDays\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*int32)\n }\n return nil\n}", "func WithAllowRenewalDays(r int) Option {\n\treturn func(s *Signer) {\n\t\ts.allowRenewalDays = r\n\t}\n}", "func (_Crowdsale *CrowdsaleTransactor) SetStartDate(opts *bind.TransactOpts, _startDate *big.Int) (*types.Transaction, error) {\n\treturn _Crowdsale.contract.Transact(opts, \"setStartDate\", _startDate)\n}", "func (o *PutCustomersCustomerFidSubscriptionsSubscriptionFidAutoCancelDaysParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param customerFid\n\tif err := r.SetPathParam(\"customerFid\", o.CustomerFid); err != nil {\n\t\treturn err\n\t}\n\n\t// form param days\n\tfrDays := o.Days\n\tfDays := swag.FormatInt32(frDays)\n\tif fDays != \"\" {\n\t\tif err := r.SetFormParam(\"days\", fDays); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param subscriptionFid\n\tif err := r.SetPathParam(\"subscriptionFid\", o.SubscriptionFid); 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 (dt DateTime) ShiftDays(days int) DateTime {\n\treturn DateTimeFromTime(dt.Time().AddDate(0, 0, days))\n}", "func (q *Quotas) RequestsPerDay(issuerName utils.IssuerKey) int {\n\tq.lock.Lock()\n\tdefer q.lock.Unlock()\n\n\tquotas, ok := q.issuerToQuotas[issuerName]\n\tif !ok {\n\t\treturn 0\n\t}\n\treturn quotas.requestsPerDay\n}", "func (rc *RequiredCapability) SetKeys(keys map[string]interface{}) {\n\t// this utilizes the non panicking type assertion, if the thrown\n\t// away ok variable is false it will be the zero of the type.\n\tid, _ := keys[deliveryServiceQueryParam].(int)\n\trc.DeliveryServiceID = &id\n\n\tcapability, _ := keys[requiredCapabilityQueryParam].(string)\n\trc.RequiredCapability = &capability\n}", "func (o DeleteRetentionPolicyResponsePtrOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *DeleteRetentionPolicyResponse) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Days\n\t}).(pulumi.IntPtrOutput)\n}", "func (m *PrivilegedAccessGroupEligibilitySchedule) SetAccessId(value *PrivilegedAccessGroupRelationships)() {\n err := m.GetBackingStore().Set(\"accessId\", value)\n if err != nil {\n panic(err)\n }\n}", "func (m *Application) SetRequiredResourceAccess(value []RequiredResourceAccessable)() {\n m.requiredResourceAccess = value\n}", "func (m *DirectoryRequestBuilder) RoleAssignmentScheduleRequests()(*i1ecb617cf3506073901d6ebbc926c43ae20c2fe24b4f636c07d76b404da7758e.RoleAssignmentScheduleRequestsRequestBuilder) {\n return i1ecb617cf3506073901d6ebbc926c43ae20c2fe24b4f636c07d76b404da7758e.NewRoleAssignmentScheduleRequestsRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "func (o BucketObjectLockConfigurationV2RuleDefaultRetentionOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v BucketObjectLockConfigurationV2RuleDefaultRetention) *int { return v.Days }).(pulumi.IntPtrOutput)\n}", "func (m NoMDEntries) SetSellerDays(v int) {\n\tm.Set(field.NewSellerDays(v))\n}", "func (eDays ExpirationDays) MarshalXML(e *xml.Encoder, startElement xml.StartElement) error {\n\tif eDays == 0 {\n\t\treturn nil\n\t}\n\treturn e.EncodeElement(int(eDays), startElement)\n}", "func (s *service) SetDeviceDiscoveryRequest(ctx context.Context, req *api.DeviceDiscovery) (*api.Empty, error) {\n\tdiscoverMetrics.SetRequestTotalCounters.WithLabelValues(req.GetId()).Inc()\n\tif err := s.Manager.SetDevicesDiscoveryRequest(ctx, *req); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &api.Empty{}, nil\n}", "func (m *RequestSchedule) SetRecurrence(value PatternedRecurrenceable)() {\n err := m.GetBackingStore().Set(\"recurrence\", value)\n if err != nil {\n panic(err)\n }\n}", "func (m *AppConsentApprovalRoute) SetAppConsentRequests(value []AppConsentRequestable)() {\n m.appConsentRequests = value\n}", "func (o *PutCustomersCustomerFidSubscriptionsSubscriptionFidAutoCancelDaysParams) SetDefaults() {\n\t// no default values defined for this parameter\n}", "func (o BucketObjectLockConfigurationRuleDefaultRetentionPtrOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *BucketObjectLockConfigurationRuleDefaultRetention) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Days\n\t}).(pulumi.IntPtrOutput)\n}", "func (m *ScheduleChangeRequest) SetAssignedTo(value *ScheduleChangeRequestActor)() {\n err := m.GetBackingStore().Set(\"assignedTo\", value)\n if err != nil {\n panic(err)\n }\n}", "func ErrRequestPays(codespace sdk.CodespaceType, requestID RequestID) sdk.Error {\n\treturn sdk.NewError(codespace, RequestPays, fmt.Sprintf(RequestPaysMessage, requestID))\n}", "func (o *Order) UpdateQuantityRequested(id string, quantity int) error {\n\ti, err := o.findItem(id)\n\tif err != nil {\n\t\treturn err\n\t}\n\to.Items[i].QuantityRequested = quantity\n\treturn nil\n}", "func (o BucketV2ObjectLockConfigurationRuleDefaultRetentionOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v BucketV2ObjectLockConfigurationRuleDefaultRetention) *int { return v.Days }).(pulumi.IntPtrOutput)\n}", "func SetRequestID(ctx context.Context, id int) context.Context {\n\treturn context.WithValue(ctx, requestIDKey, id)\n}", "func (m *ManagementTemplateStepTenantSummary) SetIneligibleTenantsCount(value *int32)() {\n err := m.GetBackingStore().Set(\"ineligibleTenantsCount\", value)\n if err != nil {\n panic(err)\n }\n}", "func (k Keeper) SetRequestCount(ctx sdk.Context, count uint64) {\n\tstore := prefix.NewStore(ctx.KVStore(k.storeKey), []byte{})\n\tbyteKey := types.KeyPrefix(types.RequestCountKey)\n\tbz := make([]byte, 8)\n\tbinary.BigEndian.PutUint64(bz, count)\n\tstore.Set(byteKey, bz)\n}", "func (_Bindings *BindingsTransactor) SetReserveFactor(opts *bind.TransactOpts, newReserveFactorMantissa *big.Int) (*types.Transaction, error) {\n\treturn _Bindings.contract.Transact(opts, \"_setReserveFactor\", newReserveFactorMantissa)\n}", "func (p *discoverPool) SetDiscoverRequest(req api.DeviceDiscovery) error {\n\tp.requests.Pub(req)\n\tdiscoverPoolMetrics.SetRequestTotalCounters.WithLabelValues(req.GetId()).Inc()\n\treturn nil\n}", "func (c *StatsGetSearchapplicationCall) StartDateDay(startDateDay int64) *StatsGetSearchapplicationCall {\n\tc.urlParams_.Set(\"startDate.day\", fmt.Sprint(startDateDay))\n\treturn c\n}", "func (o BucketObjectLockConfigurationV2RuleDefaultRetentionPtrOutput) Days() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *BucketObjectLockConfigurationV2RuleDefaultRetention) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Days\n\t}).(pulumi.IntPtrOutput)\n}", "func (i *Invoice) SetShippingAddressRequested(value bool) {\n\tif value {\n\t\ti.Flags.Set(4)\n\t\ti.ShippingAddressRequested = true\n\t} else {\n\t\ti.Flags.Unset(4)\n\t\ti.ShippingAddressRequested = false\n\t}\n}", "func (s *TestBase) DeleteSignalsRequestedState(updatedInfo *p.WorkflowExecutionInfo, updatedStats *p.ExecutionStats, updatedVersionHistories *p.VersionHistories,\n\tcondition int64, deleteSignalsRequestedID string) error {\n\treturn s.UpdateWorkflowExecutionWithRangeID(updatedInfo, updatedStats, updatedVersionHistories, nil, nil,\n\t\ts.ShardInfo.RangeID, condition, nil, nil, nil,\n\t\tnil, nil, nil, nil, nil, nil,\n\t\tnil, nil, nil, deleteSignalsRequestedID)\n}", "func (o BucketIntelligentTieringConfigurationTieringOutput) Days() pulumi.IntOutput {\n\treturn o.ApplyT(func(v BucketIntelligentTieringConfigurationTiering) int { return v.Days }).(pulumi.IntOutput)\n}", "func (o *ProcessorSignalDecisionReportRequest) UnsetDaysFundsOnHold() {\n\to.DaysFundsOnHold.Unset()\n}", "func (f *ServiceFlags) SetBytes(x []byte) {\n\tvar b [4]byte\n\tcopy(b[:], x)\n\t*f = ServiceFlags(*(*uint32)(unsafe.Pointer(&b)))\n}" ]
[ "0.80620563", "0.80277723", "0.7990827", "0.71289706", "0.6958429", "0.6800112", "0.63616997", "0.6276934", "0.6239969", "0.5844596", "0.5823929", "0.58175325", "0.57866526", "0.55684894", "0.55262524", "0.5485366", "0.5433429", "0.54066235", "0.5384902", "0.527945", "0.51748306", "0.51356393", "0.5131757", "0.5122988", "0.50468194", "0.503123", "0.4964132", "0.49545085", "0.49288726", "0.4912278", "0.48574266", "0.4845049", "0.47944736", "0.47770947", "0.4731629", "0.4712601", "0.46961308", "0.46844935", "0.4634772", "0.4625436", "0.45962033", "0.4579597", "0.45689783", "0.45687437", "0.4544722", "0.45380136", "0.44933277", "0.44615892", "0.44466358", "0.44327542", "0.4400428", "0.43856403", "0.43711329", "0.43233347", "0.42917284", "0.4285125", "0.42644593", "0.42466044", "0.4244939", "0.4240551", "0.42397007", "0.42291558", "0.4217815", "0.42140985", "0.4209136", "0.41998124", "0.4190861", "0.4189767", "0.41852093", "0.4180702", "0.41749606", "0.41722557", "0.4163418", "0.41530138", "0.4150533", "0.4149632", "0.4130117", "0.4125404", "0.41212812", "0.4120881", "0.41005972", "0.4100043", "0.40976724", "0.40958774", "0.40871882", "0.40805465", "0.4073629", "0.40573862", "0.40510696", "0.4048935", "0.40449676", "0.4023172", "0.40160054", "0.40031016", "0.39963403", "0.39955795", "0.3992206", "0.39904442", "0.39889178", "0.39872786" ]
0.8420044
0