Rename to GetOkExists

This commit is contained in:
Jake Champlin 2017-08-03 12:05:19 -04:00
parent 270bbdb19b
commit 268138dbd4
No known key found for this signature in database
GPG Key ID: DC31F41958EF4AC2
2 changed files with 4 additions and 4 deletions

View File

@ -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

View File

@ -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()
}