Rename to GetOkExists
This commit is contained in:
parent
270bbdb19b
commit
268138dbd4
|
@ -104,7 +104,7 @@ func (d *ResourceData) GetOk(key string) (interface{}, bool) {
|
|||
return r.Value, exists
|
||||
}
|
||||
|
||||
// GetOkRaw returns the data for a given key and whether or not the key
|
||||
// GetOkExists returns the data for a given key and whether or not the key
|
||||
// has been set to a non-zero value. This is only useful for determining
|
||||
// if boolean attributes have been set, if they are Optional but do not
|
||||
// have a Default value.
|
||||
|
@ -114,7 +114,7 @@ func (d *ResourceData) GetOk(key string) (interface{}, bool) {
|
|||
// without a default, to fully check for a literal assignment, regardless
|
||||
// of the zero-value for that type.
|
||||
// This should only be used if absolutely required/needed.
|
||||
func (d *ResourceData) GetOkRaw(key string) (interface{}, bool) {
|
||||
func (d *ResourceData) GetOkExists(key string) (interface{}, bool) {
|
||||
r := d.getRaw(key, getSourceSet)
|
||||
exists := r.Exists && !r.Computed
|
||||
return r.Value, exists
|
||||
|
|
|
@ -1082,7 +1082,7 @@ func TestResourceDataGetOk(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestResourceDataGetOkRaw(t *testing.T) {
|
||||
func TestResourceDataGetOkExists(t *testing.T) {
|
||||
cases := []struct {
|
||||
Name string
|
||||
Schema map[string]*Schema
|
||||
|
@ -1266,7 +1266,7 @@ func TestResourceDataGetOkRaw(t *testing.T) {
|
|||
t.Fatalf("%s err: %s", tc.Name, err)
|
||||
}
|
||||
|
||||
v, ok := d.GetOkRaw(tc.Key)
|
||||
v, ok := d.GetOkExists(tc.Key)
|
||||
if s, ok := v.(*Set); ok {
|
||||
v = s.List()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue