{"id":340793,"date":"2022-11-04T21:00:06","date_gmt":"2022-11-04T21:00:06","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=340793"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=340793","title":{"rendered":"<span>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 HCL-\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447 \u0432 Jira. \u0427\u0430\u0441\u0442\u044c 1<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412\u0434\u043e\u0445\u043d\u043e\u0432\u0438\u0432\u0448\u0438\u0441\u044c \u0441\u0442\u0430\u0442\u044c\u0435\u0439 <a href=\"https:\/\/habr.com\/ru\/company\/domclick\/blog\/692814\/\" rel=\"noopener noreferrer nofollow\">&#171;\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 Go-\u043f\u0440\u043e\u0435\u043a\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 Terraform&#187;<\/a> \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0432 \u043a\u0430\u043a\u043e\u043c-\u043d\u0438\u0431\u0443\u0434\u044c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u043d\u0430 HCL. <\/p>\n<p>\u0418 \u043a\u0430\u043a-\u0442\u043e, \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0439 \u0440\u0430\u0437, \u0437\u0430\u043c\u0435\u043d\u044f\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0432 \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u043d\u0430 python, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c  \u0437\u0430\u0434\u0430\u0447\u043a\u0438 \u0432 Jira, \u043c\u0435\u043d\u044f \u043f\u043e\u0441\u0435\u0442\u0438\u043b\u0430 \u043c\u044b\u0441\u043b\u044c, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0443\u0442\u0438\u043b\u0438\u0442\u043a\u0443 \u043d\u0430 Go, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0432 HCL \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0438 \u0432 Jira. \u0417\u0430\u043e\u0434\u043d\u043e \u0438 \u0441 Go \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u043b\u044e\u0441\u044c.<\/p>\n<p>\u0417\u0430\u0431\u0435\u0433\u0430\u044f \u0432\u043f\u0435\u0440\u0435\u0434 \u0441\u043a\u0430\u0436\u0443, \u0447\u0442\u043e \u043f\u043e\u0438\u0441\u043a\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0438 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0441\u0435\u0440\u0430 \u0434\u0430\u043b\u0438\u0441\u044c \u043c\u043d\u0435 \u0442\u0440\u0443\u0434\u043d\u043e. \u041a\u0440\u043e\u043c\u0435 \u043f\u0430\u0440\u044b \u0431\u0430\u043d\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u043d\u0430\u0439\u0442\u0438 \u0447\u0442\u043e-\u0442\u043e \u0432\u043c\u0435\u043d\u044f\u0435\u043c\u043e\u0435 \u043c\u043d\u0435 \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c. \u0411\u044b\u043b\u0438 \u043c\u044b\u0441\u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430 Python,  \u043d\u043e \u0434\u043b\u044f Python \u043f\u0430\u0440\u0441\u0435\u0440 \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u0441\u043e\u0432\u0441\u0435\u043c \u0443\u0431\u043e\u0433\u0438\u043c, \u043c\u043e\u0433 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438 HCL \u0432 dict \u0438 \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0432\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f \u043a \u0437\u0430\u0442\u0435\u0435 \u0441 Go.<\/p>\n<p>\u0427\u0435\u0433\u043e \u0445\u043e\u0447\u0443 \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u0443\u0442\u0438\u043b\u0438\u0442\u044b:<\/p>\n<ul>\n<li>\n<p>\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0437\u0430\u0434\u0430\u0447 \u043f\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0432 HCL \u0441 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c \u0440\u0430\u0437\u043d\u044b\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u043f\u043e\u043b\u0435\u0439, \u0432\u043a\u043b\u044e\u0447\u0430\u044f <em>custom fields<\/em><\/p>\n<\/li>\n<li>\n<p>\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0434\u0430\u0447 (<em>\u0431\u044b\u0432\u0430\u0435\u0442 \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c 30 \u043f\u043e\u0445\u043e\u0436\u0438\u0445 \u0437\u0430\u0434\u0430\u0447 \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0435\u0432<\/em>) \u043f\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0443 \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432\/\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432<\/p>\n<\/li>\n<li>\n<p>\u043b\u0438\u043d\u043a\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0438, \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u0434\u0437\u0430\u0434\u0430\u0447\u0438<\/p>\n<\/li>\n<li>\n<p>\u0432\u0441\u0435 \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0434\u043b\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447<\/p>\n<\/li>\n<\/ul>\n<p>\u0418\u0442\u0430\u043a, \u043d\u0430\u0447\u043d\u0435\u043c \u0441 \u0441\u0430\u043c\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430. \u0425\u043e\u0447\u0443 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u0432 \u0431\u043b\u043e\u043a\u0435 <em>create<\/em>, \u0430 \u0434\u043b\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u043b\u043e\u043a <em>update<\/em>. \u041d\u0430\u0447\u043d\u0435\u043c \u043f\u043e\u043a\u0430 \u0441 <em>create<\/em><\/p>\n<pre><code class=\"ruby\">create \"Task\" {   project     = \"AA\"                # required   summary     = \"My first issue\"    # required   assignee    = \"ivanov\"            # required   description = \"issue description\" # optional   labels      = [\"no-qa\"]           # optional }<\/code><\/pre>\n<p>\u0433\u0434\u0435 Task &#8212; \u044d\u0442\u043e \u0442\u0438\u043f issue<\/p>\n<p>\u0414\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u043d\u0430\u043c \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434<\/p>\n<pre><code class=\"go\">package main  import ( \"github.com\/hashicorp\/hcl\/v2\/gohcl\" \"github.com\/hashicorp\/hcl\/v2\/hclparse\" \"github.com\/kr\/pretty\" \"log\" )  type Root struct { Create config `hcl:\"create,block\"` }  type config struct { Type        string   `hcl:\"type,label\"` Project     string   `hcl:\"project\"` Summary     string   `hcl:\"summary\"` Assignee    string   `hcl:\"assignee\"` Description string   `hcl:\"description,optional\"` Labels      []string `hcl:\"labels,optional\"` }  func main() { filename := \"example.hcl\"  parser := hclparse.NewParser() f, diags := parser.ParseHCLFile(filename) if diags.HasErrors() { log.Fatal(diags) }  var root Root diags = gohcl.DecodeBody(f.Body, nil, &amp;root) if diags.HasErrors() { log.Fatal(diags) }  _, _ = pretty.Println(root) } <\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043e\u0442\u0432\u0435\u0442<\/p>\n<pre><code class=\"julia\">main.Root{     Create: main.config{         Type:        \"Task\",         Project:     \"AA\",         Summary:     \"My first issue\",         Assignee:    \"ivanov\",         Description: \"issue description\",         Labels:      {\"no-qa\"},     }, }<\/code><\/pre>\n<p>\u041f\u0440\u043e\u0431\u0443\u0435\u043c \u0443\u0431\u0440\u0430\u0442\u044c required \u043f\u043e\u043b\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <em>project<\/em><\/p>\n<pre><code>2022\/11\/04 21:55:07 example.hcl:1,15-15: Missing required argument; The argument \"project\" is required, but no definition was found. exit status 1<\/code><\/pre>\n<p>\u0412\u0440\u043e\u0434\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u043d\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0438\u043c\u043f\u0430\u0442\u0438\u0447\u043d\u0435\u0435 \u0432\u044b\u0432\u043e\u0434 \u043e\u0448\u0438\u0431\u043a\u0438. \u041f\u0435\u0440\u0435\u0434 <em>log.Fatal()<\/em> \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434<\/p>\n<pre><code class=\"go\">wr := hcl.NewDiagnosticTextWriter( os.Stdout,      \/\/ writer to send messages to parser.Files(), \/\/ the parser's file cache, for source snippets 78,             \/\/ wrapping width true,           \/\/ generate colored\/highlighted output ) _ = wr.WriteDiagnostics(diags)<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u0435\u0441\u043b\u0438 \u0443\u0431\u0440\u0430\u0442\u044c \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u043b\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <em>summary<\/em>, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0442\u0430\u043a\u043e\u0439 \u0432\u044b\u0432\u043e\u0434<\/p>\n<pre><code>Error: Missing required argument    on example.hcl line 1, in create \"Task\":    1: create \"Task\" {  The argument \"summary\" is required, but no definition was found.  2022\/11\/04 21:59:43 example.hcl:1,15-15: Missing required argument; The argument \"summary\" is required, but no definition was found. exit status 1<\/code><\/pre>\n<p>\u041c\u043d\u0435 \u0442\u0430\u043a\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0435.<\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u043b\u0438\u0435\u043d\u0442 \u0434\u043b\u044f Jira \u0438 \u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443 (user\/pass \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a Jira \u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f)<\/p>\n<pre><code class=\"go\">package main  import ( \"fmt\" \"github.com\/andygrunwald\/go-jira\" \"github.com\/hashicorp\/hcl\/v2\" \"github.com\/hashicorp\/hcl\/v2\/gohcl\" \"github.com\/hashicorp\/hcl\/v2\/hclparse\" \"github.com\/kr\/pretty\" \"log\" \"os\" )  type Root struct { Create config `hcl:\"create,block\"` }  type config struct { Type        string   `hcl:\"type,label\"` Project     string   `hcl:\"project\"` Summary     string   `hcl:\"summary\"` Assignee    string   `hcl:\"assignee\"` Description string   `hcl:\"description,optional\"` Labels      []string `hcl:\"labels,optional\"` }  func renderDiags(diags hcl.Diagnostics, files map[string]*hcl.File) { wr := hcl.NewDiagnosticTextWriter( os.Stdout, \/\/ writer to send messages to files,     \/\/ the parser's file cache, for source snippets 78,        \/\/ wrapping width true,      \/\/ generate colored\/highlighted output ) _ = wr.WriteDiagnostics(diags) }  func main() { filename := \"example.hcl\"  parser := hclparse.NewParser() f, diags := parser.ParseHCLFile(filename) if diags.HasErrors() { renderDiags(diags, parser.Files())  log.Fatal(diags) }  var root Root diags = gohcl.DecodeBody(f.Body, nil, &amp;root) if diags.HasErrors() { renderDiags(diags, parser.Files())  log.Fatal(diags) }  _, _ = pretty.Println(root)  basicAuth := jira.BasicAuthTransport{ Username: os.Getenv(\"JIRA_USERNAME\"), Password: os.Getenv(\"JIRA_PASSWORD\"), } jiraClient, _ := jira.NewClient(basicAuth.Client(), os.Getenv(\"JIRA_URL\"))  i := jira.Issue{ Fields: &amp;jira.IssueFields{ Description: root.Create.Description, Type:        jira.IssueType{Name: root.Create.Type}, Project:     jira.Project{Key: root.Create.Project}, Summary:     root.Create.Summary, Labels:      root.Create.Labels, }, }  issue, _, err := jiraClient.Issue.Create(&amp;i) if err != nil { log.Fatal(err) }  fmt.Println(issue.Key) } <\/code><\/pre>\n<p>\u041e\u0442\u043b\u0438\u0447\u043d\u043e, \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u043a\u0443 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0443\u0434\u0430\u043b\u043e\u0441\u044c<\/p>\n<pre><code>main.Root{     Create: main.config{         Type:        \"Task\",         Project:     \"AA\",         Summary:     \"My first issue\",         Assignee:    \"ivanov\",         Description: \"issue description\",         Labels:      {\"no-qa\"},     }, } AA-1234<\/code><\/pre>\n<p>\u0410 \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442, \u0435\u0441\u043b\u0438 \u0432 \u0444\u0430\u0439\u043b\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u044c 2 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0441 \u0442\u0438\u043f\u043e\u043c Bug) \u0438 \u0431\u043e\u043b\u0435\u0435 \u0431\u043b\u043e\u043a\u043e\u0432 <em>create<\/em>?<\/p>\n<pre><code>Error: Duplicate create block    on example.hcl line 9, in create \"Bug\":    9: create \"Bug\" {  Only one create block is allowed. Another was defined at example.hcl:1,1-14.  2022\/11\/04 22:20:48 example.hcl:9,1-13: Duplicate create block; Only one create block is allowed. Another was defined at example.hcl:1,1-14. exit status 1 <\/code><\/pre>\n<p>\u041e\u043a, \u0432\u0440\u043e\u0434\u0435 \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u043e \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u0442\u044c<\/p>\n<pre><code class=\"go\">... \/\/ \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0434\u043b\u044f Root, \u0447\u0442\u043e create - \u044d\u0442\u043e \u043c\u0430\u0441\u0441\u0438\u0432 type Root struct { Create []config `hcl:\"create,block\"` } ... \/\/ \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 create for _, create := range root.Create { i := jira.Issue{ Fields: &amp;jira.IssueFields{ Description: create.Description, Type:        jira.IssueType{Name: create.Type}, Project:     jira.Project{Key: create.Project}, Summary:     create.Summary, Labels:      create.Labels, }, }  issue, _, err := jiraClient.Issue.Create(&amp;i) if err != nil { log.Fatal(err) }  fmt.Println(issue.Key) } ...<\/code><\/pre>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/p>\n<pre><code>main.Root{     Create: {         {             Type:        \"Task\",             Project:     \"AA\",             Summary:     \"My first issue\",             Assignee:    \"ivanov\",             Description: \"issue description\",             Labels:      {\"no-qa\"},         },         {             Type:        \"Bug\",             Project:     \"AA\",             Summary:     \"My first issue\",             Assignee:    \"ivanov\",             Description: \"issue description\",             Labels:      {\"no-qa\"},         },     }, } AA-1001 AA-1002<\/code><\/pre>\n<p>\u0423\u0436\u0435 \u043b\u0443\u0447\u0448\u0435, \u043d\u043e \u043f\u043e\u043a\u0430 \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043c\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430 Python. <\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u044f \u0445\u043e\u0447\u0443 \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438. \u0421 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u0438 \u043d\u0430\u0447\u0430\u043b\u0438\u0441\u044c \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0441 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043c\u043e\u0438\u0445 \u0445\u043e\u0442\u0435\u043b\u043e\u043a \u0438\u0437-\u0437\u0430 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u0442\u043e\u043b\u043a\u043e\u0432\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 (\u043b\u0438\u0431\u043e \u044f \u043f\u043b\u043e\u0445\u043e \u0438\u0441\u043a\u0430\u043b \u0438 \u043d\u0435 \u0443\u043c\u0435\u044e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043e\u043a\u0430\u043c\u0438), \u0430 \u0442\u0430\u043a \u0436\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u043e\u043f\u044b\u0442\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u043d\u0430 Go.<\/p>\n<p>\u041f\u0440\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438 \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u044b\u0439 \u043f\u0430\u0440\u0441\u0438\u043d\u0433, \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440\u044b, \u043f\u043e \u0445\u043e\u0434\u0443 \u043f\u0440\u0438\u043e\u0431\u0440\u0435\u0442\u0435\u043d\u0438\u044f \u043e\u043f\u044b\u0442\u0430, \u0431\u0443\u0434\u0443 \u043f\u043e\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043d\u0430 <a href=\"https:\/\/github.com\/Ailme\/go-jira-hcl-example\" rel=\"noopener noreferrer nofollow\">github<\/a><\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/697500\/\"> https:\/\/habr.com\/ru\/post\/697500\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412\u0434\u043e\u0445\u043d\u043e\u0432\u0438\u0432\u0448\u0438\u0441\u044c \u0441\u0442\u0430\u0442\u044c\u0435\u0439 <a href=\"https:\/\/habr.com\/ru\/company\/domclick\/blog\/692814\/\" rel=\"noopener noreferrer nofollow\">&#171;\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 Go-\u043f\u0440\u043e\u0435\u043a\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 Terraform&#187;<\/a> \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0432 \u043a\u0430\u043a\u043e\u043c-\u043d\u0438\u0431\u0443\u0434\u044c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u043d\u0430 HCL. <\/p>\n<p>\u0418 \u043a\u0430\u043a-\u0442\u043e, \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0439 \u0440\u0430\u0437, \u0437\u0430\u043c\u0435\u043d\u044f\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0432 \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u043d\u0430 python, \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c  \u0437\u0430\u0434\u0430\u0447\u043a\u0438 \u0432 Jira, \u043c\u0435\u043d\u044f \u043f\u043e\u0441\u0435\u0442\u0438\u043b\u0430 \u043c\u044b\u0441\u043b\u044c, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0443\u0442\u0438\u043b\u0438\u0442\u043a\u0443 \u043d\u0430 Go, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0432 HCL \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0438 \u0432 Jira. \u0417\u0430\u043e\u0434\u043d\u043e \u0438 \u0441 Go \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u043b\u044e\u0441\u044c.<\/p>\n<p>\u0417\u0430\u0431\u0435\u0433\u0430\u044f \u0432\u043f\u0435\u0440\u0435\u0434 \u0441\u043a\u0430\u0436\u0443, \u0447\u0442\u043e \u043f\u043e\u0438\u0441\u043a\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0438 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u0441\u0435\u0440\u0430 \u0434\u0430\u043b\u0438\u0441\u044c \u043c\u043d\u0435 \u0442\u0440\u0443\u0434\u043d\u043e. \u041a\u0440\u043e\u043c\u0435 \u043f\u0430\u0440\u044b \u0431\u0430\u043d\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u043d\u0430\u0439\u0442\u0438 \u0447\u0442\u043e-\u0442\u043e \u0432\u043c\u0435\u043d\u044f\u0435\u043c\u043e\u0435 \u043c\u043d\u0435 \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c. \u0411\u044b\u043b\u0438 \u043c\u044b\u0441\u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430 Python,  \u043d\u043e \u0434\u043b\u044f Python \u043f\u0430\u0440\u0441\u0435\u0440 \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u0441\u043e\u0432\u0441\u0435\u043c \u0443\u0431\u043e\u0433\u0438\u043c, \u043c\u043e\u0433 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438 HCL \u0432 dict \u0438 \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0432\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f \u043a \u0437\u0430\u0442\u0435\u0435 \u0441 Go.<\/p>\n<p>\u0427\u0435\u0433\u043e \u0445\u043e\u0447\u0443 \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u0443\u0442\u0438\u043b\u0438\u0442\u044b:<\/p>\n<ul>\n<li>\n<p>\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0437\u0430\u0434\u0430\u0447 \u043f\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0432 HCL \u0441 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c \u0440\u0430\u0437\u043d\u044b\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u043f\u043e\u043b\u0435\u0439, \u0432\u043a\u043b\u044e\u0447\u0430\u044f <em>custom fields<\/em><\/p>\n<\/li>\n<li>\n<p>\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0434\u0430\u0447 (<em>\u0431\u044b\u0432\u0430\u0435\u0442 \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c 30 \u043f\u043e\u0445\u043e\u0436\u0438\u0445 \u0437\u0430\u0434\u0430\u0447 \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0435\u0432<\/em>) \u043f\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0443 \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432\/\u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432<\/p>\n<\/li>\n<li>\n<p>\u043b\u0438\u043d\u043a\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0438, \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u043e\u0434\u0437\u0430\u0434\u0430\u0447\u0438<\/p>\n<\/li>\n<li>\n<p>\u0432\u0441\u0435 \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0434\u043b\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447<\/p>\n<\/li>\n<\/ul>\n<p>\u0418\u0442\u0430\u043a, \u043d\u0430\u0447\u043d\u0435\u043c \u0441 \u0441\u0430\u043c\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430. \u0425\u043e\u0447\u0443 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0435\u043c\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u0432 \u0431\u043b\u043e\u043a\u0435 <em>create<\/em>, \u0430 \u0434\u043b\u044f \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u043b\u043e\u043a <em>update<\/em>. \u041d\u0430\u0447\u043d\u0435\u043c \u043f\u043e\u043a\u0430 \u0441 <em>create<\/em><\/p>\n<pre><code class=\"ruby\">create \"Task\" {   project     = \"AA\"                # required   summary     = \"My first issue\"    # required   assignee    = \"ivanov\"            # required   description = \"issue description\" # optional   labels      = [\"no-qa\"]           # optional }<\/code><\/pre>\n<p>\u0433\u0434\u0435 Task &#8212; \u044d\u0442\u043e \u0442\u0438\u043f issue<\/p>\n<p>\u0414\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u043d\u0430\u043c \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434<\/p>\n<pre><code class=\"go\">package main  import ( \"github.com\/hashicorp\/hcl\/v2\/gohcl\" \"github.com\/hashicorp\/hcl\/v2\/hclparse\" \"github.com\/kr\/pretty\" \"log\" )  type Root struct { Create config `hcl:\"create,block\"` }  type config struct { Type        string   `hcl:\"type,label\"` Project     string   `hcl:\"project\"` Summary     string   `hcl:\"summary\"` Assignee    string   `hcl:\"assignee\"` Description string   `hcl:\"description,optional\"` Labels      []string `hcl:\"labels,optional\"` }  func main() { filename := \"example.hcl\"  parser := hclparse.NewParser() f, diags := parser.ParseHCLFile(filename) if diags.HasErrors() { log.Fatal(diags) }  var root Root diags = gohcl.DecodeBody(f.Body, nil, &amp;root) if diags.HasErrors() { log.Fatal(diags) }  _, _ = pretty.Println(root) } <\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043e\u0442\u0432\u0435\u0442<\/p>\n<pre><code class=\"julia\">main.Root{     Create: main.config{         Type:        \"Task\",         Project:     \"AA\",         Summary:     \"My first issue\",         Assignee:    \"ivanov\",         Description: \"issue description\",         Labels:      {\"no-qa\"},     }, }<\/code><\/pre>\n<p>\u041f\u0440\u043e\u0431\u0443\u0435\u043c \u0443\u0431\u0440\u0430\u0442\u044c required \u043f\u043e\u043b\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <em>project<\/em><\/p>\n<pre><code>2022\/11\/04 21:55:07 example.hcl:1,15-15: Missing required argument; The argument \"project\" is required, but no definition was found. exit status 1<\/code><\/pre>\n<p>\u0412\u0440\u043e\u0434\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u043d\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0438\u043c\u043f\u0430\u0442\u0438\u0447\u043d\u0435\u0435 \u0432\u044b\u0432\u043e\u0434 \u043e\u0448\u0438\u0431\u043a\u0438. \u041f\u0435\u0440\u0435\u0434 <em>log.Fatal()<\/em> \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434<\/p>\n<pre><code class=\"go\">wr := hcl.NewDiagnosticTextWriter( os.Stdout,      \/\/ writer to send messages to parser.Files(), \/\/ the parser's file cache, for source snippets 78,             \/\/ wrapping width true,           \/\/ generate colored\/highlighted output ) _ = wr.WriteDiagnostics(diags)<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u0435\u0441\u043b\u0438 \u0443\u0431\u0440\u0430\u0442\u044c \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u043b\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <em>summary<\/em>, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0442\u0430\u043a\u043e\u0439 \u0432\u044b\u0432\u043e\u0434<\/p>\n<pre><code>Error: Missing required argument    on example.hcl line 1, in create \"Task\":    1: create \"Task\" {  The argument \"summary\" is required, but no definition was found.  2022\/11\/04 21:59:43 example.hcl:1,15-15: Missing required argument; The argument \"summary\" is required, but no definition was found. exit status 1<\/code><\/pre>\n<p>\u041c\u043d\u0435 \u0442\u0430\u043a\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0435.<\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043a\u043b\u0438\u0435\u043d\u0442 \u0434\u043b\u044f Jira \u0438 \u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443 (user\/pass \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a Jira \u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f)<\/p>\n<pre><code class=\"go\">package main  import ( \"fmt\" \"github.com\/andygrunwald\/go-jira\" \"github.com\/hashicorp\/hcl\/v2\" \"github.com\/hashicorp\/hcl\/v2\/gohcl\" \"github.com\/hashicorp\/hcl\/v2\/hclparse\" \"github.com\/kr\/pretty\" \"log\" \"os\" )  type Root struct { Create config `hcl:\"create,block\"` }  type config struct { Type        string   `hcl:\"type,label\"` Project     string   `hcl:\"project\"` Summary     string   `hcl:\"summary\"` Assignee    string   `hcl:\"assignee\"` Description string   `hcl:\"description,optional\"` Labels      []string `hcl:\"labels,optional\"` }  func renderDiags(diags hcl.Diagnostics, files map[string]*hcl.File) { wr := hcl.NewDiagnosticTextWriter( os.Stdout, \/\/ writer to send messages to files,     \/\/ the parser's file cache, for source snippets 78,        \/\/ wrapping width true,      \/\/ generate colored\/highlighted output ) _ = wr.WriteDiagnostics(diags) }  func main() { filename := \"example.hcl\"  parser := hclparse.NewParser() f, diags := parser.ParseHCLFile(filename) if diags.HasErrors() { renderDiags(diags, parser.Files())  log.Fatal(diags) }  var root Root diags = gohcl.DecodeBody(f.Body, nil, &amp;root) if diags.HasErrors() { renderDiags(diags, parser.Files())  log.Fatal(diags) }  _, _ = pretty.Println(root)  basicAuth := jira.BasicAuthTransport{ Username: os.Getenv(\"JIRA_USERNAME\"), Password: os.Getenv(\"JIRA_PASSWORD\"), } jiraClient, _ := jira.NewClient(basicAuth.Client(), os.Getenv(\"JIRA_URL\"))  i := jira.Issue{ Fields: &amp;jira.IssueFields{ Description: root.Create.Description, Type:        jira.IssueType{Name: root.Create.Type}, Project:     jira.Project{Key: root.Create.Project}, Summary:     root.Create.Summary, Labels:      root.Create.Labels, }, }  issue, _, err := jiraClient.Issue.Create(&amp;i) if err != nil { log.Fatal(err) }  fmt.Println(issue.Key) } <\/code><\/pre>\n<p>\u041e\u0442\u043b\u0438\u0447\u043d\u043e, \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u043a\u0443 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0443\u0434\u0430\u043b\u043e\u0441\u044c<\/p>\n<pre><code>main.Root{     Create: main.config{         Type:        \"Task\",         Project:     \"AA\",         Summary:     \"My first issue\",         Assignee:    \"ivanov\",         Description: \"issue description\",         Labels:      {\"no-qa\"},     }, } AA-1234<\/code><\/pre>\n<p>\u0410 \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442, \u0435\u0441\u043b\u0438 \u0432 \u0444\u0430\u0439\u043b\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u044c 2 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0441 \u0442\u0438\u043f\u043e\u043c Bug) \u0438 \u0431\u043e\u043b\u0435\u0435 \u0431\u043b\u043e\u043a\u043e\u0432 <em>create<\/em>?<\/p>\n<pre><code>Error: Duplicate create block    on example.hcl line 9, in create \"Bug\":    9: create \"Bug\" {  Only one create block is allowed. Another was defined at example.hcl:1,1-14.  2022\/11\/04 22:20:48 example.hcl:9,1-13: Duplicate create block; Only one create block is allowed. Another was defined at example.hcl:1,1-14. exit status 1 <\/code><\/pre>\n<p>\u041e\u043a, \u0432\u0440\u043e\u0434\u0435 \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u043e \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u0442\u044c<\/p>\n<pre><code class=\"go\">... \/\/ \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0434\u043b\u044f Root, \u0447\u0442\u043e create - \u044d\u0442\u043e \u043c\u0430\u0441\u0441\u0438\u0432 type Root struct { Create []config `hcl:\"create,block\"` } ... \/\/ \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0438\u0437 create for _, create := range root.Create { i := jira.Issue{ Fields: &amp;jira.IssueFields{ Description: create.Description, Type:        jira.IssueType{Name: create.Type}, Project:     jira.Project{Key: create.Project}, Summary:     create.Summary, Labels:      create.Labels, }, }  issue, _, err := jiraClient.Issue.Create(&amp;i) if err != nil { log.Fatal(err) }  fmt.Println(issue.Key) } ...<\/code><\/pre>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/p>\n<pre><code>main.Root{     Create: {         {             Type:        \"Task\",             Project:     \"AA\",             Summary:     \"My first issue\",             Assignee:    \"ivanov\",             Description: \"issue description\",             Labels:      {\"no-qa\"},         },         {             Type:        \"Bug\",             Project:     \"AA\",             Summary:     \"My first issue\",             Assignee:    \"ivanov\",             Description: \"issue description\",             Labels:      {\"no-qa\"},         },     }, } AA-1001 AA-1002<\/code><\/pre>\n<p>\u0423\u0436\u0435 \u043b\u0443\u0447\u0448\u0435, \u043d\u043e \u043f\u043e\u043a\u0430 \u044d\u0442\u043e\u0433\u043e \u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043c\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430 Python. <\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u044f \u0445\u043e\u0447\u0443 \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438. \u0421 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u0438 \u043d\u0430\u0447\u0430\u043b\u0438\u0441\u044c \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0441 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043c\u043e\u0438\u0445 \u0445\u043e\u0442\u0435\u043b\u043e\u043a \u0438\u0437-\u0437\u0430 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u0442\u043e\u043b\u043a\u043e\u0432\u044b\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 (\u043b\u0438\u0431\u043e \u044f \u043f\u043b\u043e\u0445\u043e \u0438\u0441\u043a\u0430\u043b \u0438 \u043d\u0435 \u0443\u043c\u0435\u044e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043e\u043a\u0430\u043c\u0438), \u0430 \u0442\u0430\u043a \u0436\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u044f \u043e\u043f\u044b\u0442\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c \u043d\u0430 Go.<\/p>\n<p>\u041f\u0440\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438 \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u044b\u0439 \u043f\u0430\u0440\u0441\u0438\u043d\u0433, \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440\u044b, \u043f\u043e \u0445\u043e\u0434\u0443 \u043f\u0440\u0438\u043e\u0431\u0440\u0435\u0442\u0435\u043d\u0438\u044f \u043e\u043f\u044b\u0442\u0430, \u0431\u0443\u0434\u0443 \u043f\u043e\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043d\u0430 <a href=\"https:\/\/github.com\/Ailme\/go-jira-hcl-example\" rel=\"noopener noreferrer nofollow\">github<\/a><\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/697500\/\"> https:\/\/habr.com\/ru\/post\/697500\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-340793","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/340793","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=340793"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/340793\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=340793"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=340793"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=340793"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}