2024-02-08 03:48:59 -06:00
|
|
|
// Copyright (c) The OpenTofu Authors
|
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
// Copyright (c) 2023 HashiCorp, Inc.
|
2023-05-02 10:33:06 -05:00
|
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2023-09-20 07:16:53 -05:00
|
|
|
package tofu
|
2014-09-29 01:37:36 -05:00
|
|
|
|
2019-03-07 14:07:13 -06:00
|
|
|
import "context"
|
|
|
|
|
2014-09-29 01:37:36 -05:00
|
|
|
// UIInput is the interface that must be implemented to ask for input
|
|
|
|
// from this user. This should forward the request to wherever the user
|
|
|
|
// inputs things to ask for values.
|
|
|
|
type UIInput interface {
|
2019-03-07 14:07:13 -06:00
|
|
|
Input(context.Context, *InputOpts) (string, error)
|
2014-09-29 01:37:36 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// InputOpts are options for asking for input.
|
|
|
|
type InputOpts struct {
|
|
|
|
// Id is a unique ID for the question being asked that might be
|
|
|
|
// used for logging or to look up a prior answered question.
|
2014-09-29 15:51:16 -05:00
|
|
|
Id string
|
2014-09-29 01:37:36 -05:00
|
|
|
|
|
|
|
// Query is a human-friendly question for inputting this value.
|
|
|
|
Query string
|
2014-09-29 15:12:06 -05:00
|
|
|
|
|
|
|
// Description is a description about what this option is. Be wary
|
|
|
|
// that this will probably be in a terminal so split lines as you see
|
|
|
|
// necessary.
|
|
|
|
Description string
|
2014-09-29 15:51:16 -05:00
|
|
|
|
|
|
|
// Default will be the value returned if no data is entered.
|
2014-09-29 16:00:35 -05:00
|
|
|
Default string
|
2020-06-24 13:47:59 -05:00
|
|
|
|
|
|
|
// Secret should be true if we are asking for sensitive input.
|
2023-09-26 12:09:27 -05:00
|
|
|
// If attached to a TTY, OpenTofu will disable echo.
|
2020-06-24 13:47:59 -05:00
|
|
|
Secret bool
|
2014-09-29 01:37:36 -05:00
|
|
|
}
|