]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/blame - vendor/github.com/hashicorp/terraform/terraform/ui_input_prefix.go
Upgrade to 0.12
[github/fretlink/terraform-provider-statuscake.git] / vendor / github.com / hashicorp / terraform / terraform / ui_input_prefix.go
CommitLineData
bae9f6d2
JC
1package terraform
2
3import (
107c1cdb 4 "context"
bae9f6d2
JC
5 "fmt"
6)
7
8// PrefixUIInput is an implementation of UIInput that prefixes the ID
9// with a string, allowing queries to be namespaced.
10type PrefixUIInput struct {
11 IdPrefix string
12 QueryPrefix string
13 UIInput UIInput
14}
15
107c1cdb 16func (i *PrefixUIInput) Input(ctx context.Context, opts *InputOpts) (string, error) {
bae9f6d2
JC
17 opts.Id = fmt.Sprintf("%s.%s", i.IdPrefix, opts.Id)
18 opts.Query = fmt.Sprintf("%s%s", i.QueryPrefix, opts.Query)
107c1cdb 19 return i.UIInput.Input(ctx, opts)
bae9f6d2 20}