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
|
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
|
// 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
|
// if boolean attributes have been set, if they are Optional but do not
|
||||||
// have a Default value.
|
// 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
|
// without a default, to fully check for a literal assignment, regardless
|
||||||
// of the zero-value for that type.
|
// of the zero-value for that type.
|
||||||
// This should only be used if absolutely required/needed.
|
// 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)
|
r := d.getRaw(key, getSourceSet)
|
||||||
exists := r.Exists && !r.Computed
|
exists := r.Exists && !r.Computed
|
||||||
return r.Value, exists
|
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 {
|
cases := []struct {
|
||||||
Name string
|
Name string
|
||||||
Schema map[string]*Schema
|
Schema map[string]*Schema
|
||||||
|
@ -1266,7 +1266,7 @@ func TestResourceDataGetOkRaw(t *testing.T) {
|
||||||
t.Fatalf("%s err: %s", tc.Name, err)
|
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 {
|
if s, ok := v.(*Set); ok {
|
||||||
v = s.List()
|
v = s.List()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue