Skip to content

Commit c3ac959

Browse files
create_service_token should use POST is name is empty (#862) (#864)
Co-authored-by: Laurent Saint-Félix <laurent.saintfelix@elastic.co>
1 parent 427fa93 commit c3ac959

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

internal/build/cmd/generate/commands/gensource/generator.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,15 @@ func (r ` + g.Endpoint.MethodWithNamespace() + `Request) Do(providedCtx context.
526526
method = "POST"
527527
}`)
528528
g.w("\n\n")
529+
case "security.create_service_token":
530+
g.w("\t")
531+
g.w(`if r.Name != "" {
532+
method = "POST"
533+
} else {
534+
method = "PUT"
535+
}`)
536+
g.w("\n\n")
537+
529538
default:
530539
var httpMethod string
531540
// If endpoint has both GET and POST available

0 commit comments

Comments
 (0)