// resourceCommentRead reads comment details using jira api
resourceCommentRead reads comment details using jira api
// resourceCommentRead reads comment details using jira api
func resourceCommentRead(d *schema.ResourceData, m interface{}) error {
	config := m.(*Config)
	issue, res, err := config.jiraClient.Issue.Get(d.Get("issue_key").(string), nil)
	if err != nil {
		body, _ := ioutil.ReadAll(res.Body)
		return errors.Wrapf(err, "getting jira issue failed: %s", body)
	}
	var comment *jira.Comment
	for _, c := range issue.Fields.Comments.Comments {
		if c.ID == d.Id() {
			comment = c
			break
		}
	}
	if comment == nil {
		d.SetId("")
		return nil
	}
	d.Set("body", comment.Body)
	return nil
}
func resourceCommentRead ( d * schema . ResourceData , m interface { } ) error { config := m . ( * Config ) issue , res , err := config . jiraClient . Issue . Get ( d . Get ( " " ) . ( string ) , nil ) if err != nil { body , _ := ioutil . ReadAll ( res . Body ) return errors . Wrapf ( err , " " , body ) } var comment * jira . Comment for _ , c := range issue . Fields . Comments . Comments { if c . ID == d . Id ( ) { comment = c break } } if comment == nil { d . SetId ( " " ) return nil } d . Set ( " " , comment . Body ) return nil }
resourceCommentRead reads comment details using jira api
resourceCommentRead reads comment details using jira api