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