// PutIssue sets the values of an existing issue in Jira.
559735
func (client DefaultClient) AddFixVersion(issueKey string, fixVersion string) (int, error) {

	var change struct {
		Update struct {
			FixedVersions [1]struct {
				Add struct {
					Name string `json:"name"`
				} `json:"add"`
			} `json:"fixVersions"`
		} `json:"update"`
	}

	change.Update.FixedVersions[0].Add.Name = fixVersion

	data, err := json.Marshal(&change)
	if err != nil {
		return http.StatusBadRequest, err
	}

	req, err := http.NewRequest("PUT", fmt.Sprintf("%s/rest/api/2/issue/%s", client.baseURL, issueKey), bytes.NewBuffer(data))
	if err != nil {
		return http.StatusBadRequest, err
	}
	req.Header.Set("Content-type", "application/json")
	req.SetBasicAuth(client.username, client.password)

	rc, data, err := client.consumeResponse(req)
	if err != nil {
		return rc, err
	} else if rc != http.StatusNoContent {
		logger.Printf("Returned %s, becuase %s", rc, string(data))
	}

	return rc, nil
}
1374257
func NewIssue(ctx *Context, node ast.Node, ruleID, desc string, severity Score, confidence Score) *Issue {
	var code string
	fobj := ctx.FileSet.File(node.Pos())
	name := fobj.Name()

	start, end := fobj.Line(node.Pos()), fobj.Line(node.End())
	line := strconv.Itoa(start)
	if start != end {
		line = fmt.Sprintf("%d-%d", start, end)
	}

	// #nosec
	if file, err := os.Open(fobj.Name()); err == nil {
		defer file.Close()
		s := (int64)(fobj.Position(node.Pos()).Offset) // Go bug, should be int64
		e := (int64)(fobj.Position(node.End()).Offset) // Go bug, should be int64
		code, err = codeSnippet(file, s, e, node)
		if err != nil {
			code = err.Error()
		}
	}

	return &Issue{
		File:       name,
		Line:       line,
		RuleID:     ruleID,
		What:       desc,
		Confidence: confidence,
		Severity:   severity,
		Code:       code,
	}
}
68225
func (s *storeImpl) Put(ctx datastore.Context, svc *Service) error {
	//No need to store ConfigFiles
	defer ctx.Metrics().Stop(ctx.Metrics().Start("ServiceStore.Put"))
	svc.ConfigFiles = make(map[string]servicedefinition.ConfigFile)

	err := s.ds.Put(ctx, Key(svc.ID), svc)
	if err == nil {
		s.updateVolatileInfo(svc.ID, svc.DesiredState, svc.UpdatedAt) // Uses Mutex Lock
	}
	return err
}
758130
func (c *Client) Put() {
	select {
	case b := <-c.sent:
		c.p.ch <- b
	default:
	}
}
478590
func filterIssues(issues []*github.Issue, filter func(*github.Issue) bool) []*github.Issue {
	iss := make([]*github.Issue, 0, len(issues))
	for _, issue := range issues {
		if filter(issue) {
			iss = append(iss, issue)
		}
	}
	return iss
}
719785
func (pdb *BrokerCassa) Put(where sql.Expression, pointerToAStruct interface{} /*TODO TTL, opts ...datasync.PutOption*/) error {
	statement, bindings, err := PutExpToString(where, pointerToAStruct)

	if err != nil {
		return err
	}
	return pdb.session.Exec(statement, bindings...)
}
902161
func (self *qbsWrapped) Put(id int64, value interface{}, pb PBundle) (interface{}, error) {
	return self.applyPolicy(pb, func(tx *qbs.Qbs) (interface{}, error) {
		return self.put.PutQbs(id, value, pb, tx)
	})
}
957098
func SendIssueCommentMail(issue Issue, repo Repository, doer User, tos []string) {
	if len(tos) == 0 {
		return
	}

	Send(composeIssueMessage(issue, repo, doer, MAIL_ISSUE_COMMENT, tos, "issue comment"))
}
889624
func (r *Repository) GetIssuesURL() string {
	if r == nil || r.IssuesURL == nil {
		return ""
	}
	return *r.IssuesURL
}
682901
func (m *MembershipStore) Put(pkiID common.PKIidType, msg *proto.SignedGossipMessage) {
	m.Lock()
	defer m.Unlock()
	m.m[string(pkiID)] = msg
}
39902
func updateTargetIssue(raw *TargetIssueEntity, dst *issue.TargetIssue) bool {
	rebuildSummary := false
	if raw.Summary != nil {
		dst.Summary = *raw.Summary
	}
	if raw.Desc != nil {
		dst.Desc = *raw.Desc
	}
	if raw.References != nil {
		dst.References = raw.References
	}
	if raw.VulnType != nil {
		dst.VulnType = *raw.VulnType
	}
	if raw.Vector != nil {
		dst.Vector = raw.Vector.Transform()
	}
	if raw.Confirmed != nil {
		dst.Confirmed = *raw.Confirmed
	}
	if raw.False != nil {
		rebuildSummary = true
		dst.False = *raw.False
	}
	if raw.Resolved != nil {
		rebuildSummary = true
		dst.Resolved = *raw.Resolved
		if *raw.Resolved {
			dst.ResolvedAt = time.Now()
		} else {
			dst.ResolvedAt = time.Time{}
		}
	}
	if raw.Muted != nil {
		rebuildSummary = true
		dst.Muted = *raw.Muted
	}
	if raw.Severity != nil {
		if isValidSeverity(*raw.Severity) {
			rebuildSummary = true
			dst.Severity = *raw.Severity
		}
	}
	return rebuildSummary
}
758479
func (w *MockSafePointKV) Put(k string, v string) error {
	w.mockLock.Lock()
	defer w.mockLock.Unlock()
	w.store[k] = v
	return nil
}
833508
func (s *CreateCaseInput) SetIssueType(v string) *CreateCaseInput {
	s.IssueType = &v
	return s
}
575970
func (this *Beanstalkd) Put(priority, delay, ttr int, data []byte) (uint64, error) {
	e := this.send("put %d %d %d %d\r\n%s\r\n", priority, delay, ttr, len(data), data)
	if e != nil {
		return 0, e
	}
	reply, e := this.recvline()
	if e != nil {
		return 0, e
	}
	var id uint64
	_, e = fmt.Sscanf(reply, "INSERTED %d\r\n", &id)
	if e != nil {
		return 0, errors.New(reply)
	}
	return id, nil
}
694207
func (c *Client) putLabel(ctx context.Context, tx *bolt.Tx, l *platform.Label) error {
	v, err := json.Marshal(l)
	if err != nil {
		return &platform.Error{
			Err: err,
		}
	}

	key, pe := labelKey(l)
	if pe != nil {
		return pe
	}

	if err := tx.Bucket(labelBucket).Put(key, v); err != nil {
		return &platform.Error{
			Err: err,
		}
	}

	return nil
}
229457
func (v *Validator) SetIssuer(iss string) {
	v.expect()
	v.Expected.Set("iss", iss)
}
1006442
func putAttachment(url string, body []byte) error {
	br := bytes.NewReader(body)
	req, err := http.NewRequest("PUT", url, br)
	if err != nil {
		return err
	}
	req.Header.Add("Content-type", "application/octet-stream")
	req.Header.Add("Content-length", strconv.Itoa(len(body)))
	resp, err := http.DefaultClient.Do(req)

	if resp != nil && (resp.StatusCode < 200 || resp.StatusCode >= 300) {
		return fmt.Errorf("HTTP status %d\n", resp.StatusCode)
	}

	return err
}