@@ -5,22 +5,6 @@ import (
5
5
"github.com/kevholditch/gokong"
6
6
)
7
7
8
- func readStringArrayFromResource (d * schema.ResourceData , key string ) []string {
9
-
10
- if attr , ok := d .GetOk (key ); ok {
11
- var array []string
12
- items := attr .([]interface {})
13
- for _ , x := range items {
14
- item := x .(string )
15
- array = append (array , item )
16
- }
17
-
18
- return array
19
- }
20
-
21
- return nil
22
- }
23
-
24
8
func readStringArrayPtrFromResource (d * schema.ResourceData , key string ) []* string {
25
9
26
10
if attr , ok := d .GetOk (key ); ok {
@@ -37,40 +21,24 @@ func readStringArrayPtrFromResource(d *schema.ResourceData, key string) []*strin
37
21
return nil
38
22
}
39
23
40
- func readIntArrayFromResource (d * schema.ResourceData , key string ) []int {
41
-
42
- if attr , ok := d .GetOk (key ); ok {
43
- var array []int
44
- items := attr .([]interface {})
45
- for _ , x := range items {
46
- item := x .(int )
47
- array = append (array , item )
48
- }
49
-
50
- return array
51
- }
52
-
53
- return nil
54
- }
55
-
56
24
func readStringFromResource (d * schema.ResourceData , key string ) string {
57
- if attr , ok := d .GetOk (key ); ok {
58
- return attr .(string )
25
+ if value , ok := d .GetOk (key ); ok {
26
+ return value .(string )
59
27
}
60
28
return ""
61
29
}
62
30
63
31
func readIdPtrFromResource (d * schema.ResourceData , key string ) * gokong.Id {
64
- if attr , ok := d .GetOk (key ); ok {
65
- id := gokong .Id (attr .(string ))
32
+ if value , ok := d .GetOk (key ); ok {
33
+ id := gokong .Id (value .(string ))
66
34
return & id
67
35
}
68
36
return nil
69
37
}
70
38
71
39
func readStringPtrFromResource (d * schema.ResourceData , key string ) * string {
72
- if attr , ok := d .GetOk (key ); ok {
73
- return gokong .String (attr .(string ))
40
+ if value , ok := d .GetOk (key ); ok {
41
+ return gokong .String (value .(string ))
74
42
}
75
43
return nil
76
44
}
@@ -80,22 +48,16 @@ func readBoolPtrFromResource(d *schema.ResourceData, key string) *bool {
80
48
}
81
49
82
50
func readIntFromResource (d * schema.ResourceData , key string ) int {
83
- if attr , ok := d .GetOk (key ); ok {
84
- return attr .(int )
51
+ if value , ok := d .GetOk (key ); ok {
52
+ return value .(int )
85
53
}
86
54
return 0
87
55
}
88
56
89
57
func readIntPtrFromResource (d * schema.ResourceData , key string ) * int {
90
- return gokong .Int (d .Get (key ).(int ))
91
- }
92
-
93
- func readMapFromResource (d * schema.ResourceData , key string ) map [string ]interface {} {
94
-
95
- if attr , ok := d .GetOk (key ); ok {
96
- result := attr .(map [string ]interface {})
97
- return result
58
+ value , ok := d .GetOk (key )
59
+ if ok {
60
+ return gokong .Int (value .(int ))
98
61
}
99
-
100
62
return nil
101
63
}
0 commit comments