9
9
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
10
10
)
11
11
12
- type listIPAccessListsResponse struct {
13
- ListIPAccessListsResponse []ipAccessListStatus `json:"ip_access_lists,omitempty"`
12
+ type ListIPAccessListsResponse struct {
13
+ ListIPAccessListsResponse []IpAccessListStatus `json:"ip_access_lists,omitempty"`
14
14
}
15
15
16
16
type createIPAccessListRequest struct {
@@ -19,7 +19,7 @@ type createIPAccessListRequest struct {
19
19
IPAddresses []string `json:"ip_addresses"`
20
20
}
21
21
22
- type ipAccessListStatus struct {
22
+ type IpAccessListStatus struct {
23
23
ListID string `json:"list_id"`
24
24
Label string `json:"label"`
25
25
ListType string `json:"list_type"`
@@ -32,15 +32,15 @@ type ipAccessListStatus struct {
32
32
Enabled bool `json:"enabled,omitempty"`
33
33
}
34
34
35
- type ipAccessListStatusWrapper struct {
36
- IPAccessList ipAccessListStatus `json:"ip_access_list,omitempty"`
35
+ type IpAccessListStatusWrapper struct {
36
+ IPAccessList IpAccessListStatus `json:"ip_access_list,omitempty"`
37
37
}
38
38
39
39
type ipAccessListUpdateRequest struct {
40
40
Label string `json:"label"`
41
41
ListType string `json:"list_type"`
42
42
IPAddresses []string `json:"ip_addresses"`
43
- Enabled bool `json:"enabled,omitempty"`
43
+ Enabled bool `json:"enabled,omitempty" tf:"default:true" `
44
44
}
45
45
46
46
// Preview feature: https://docs.databricks.com/security/network/ip-access-list.html
@@ -59,8 +59,8 @@ func NewIPAccessListsAPI(ctx context.Context, m interface{}) ipAccessListsAPI {
59
59
}
60
60
61
61
// Create creates the IP Access List to given the instance pool configuration
62
- func (a ipAccessListsAPI ) Create (cr createIPAccessListRequest ) (status ipAccessListStatus , err error ) {
63
- wrapper := ipAccessListStatusWrapper {}
62
+ func (a ipAccessListsAPI ) Create (cr createIPAccessListRequest ) (status IpAccessListStatus , err error ) {
63
+ wrapper := IpAccessListStatusWrapper {}
64
64
err = a .client .Post (a .context , "/ip-access-lists" , cr , & wrapper )
65
65
if err != nil {
66
66
return
@@ -78,16 +78,16 @@ func (a ipAccessListsAPI) Delete(objectID string) (err error) {
78
78
return
79
79
}
80
80
81
- func (a ipAccessListsAPI ) Read (objectID string ) (status ipAccessListStatus , err error ) {
82
- wrapper := ipAccessListStatusWrapper {}
81
+ func (a ipAccessListsAPI ) Read (objectID string ) (status IpAccessListStatus , err error ) {
82
+ wrapper := IpAccessListStatusWrapper {}
83
83
err = a .client .Get (a .context , "/ip-access-lists/" + objectID , nil , & wrapper )
84
84
status = wrapper .IPAccessList
85
85
return
86
86
}
87
87
88
- func (a ipAccessListsAPI ) List () (listResponse listIPAccessListsResponse , err error ) {
89
- listResponse = listIPAccessListsResponse {}
90
- err = a .client .Get (a .context , "/ip-access-lists" , & listResponse , nil )
88
+ func (a ipAccessListsAPI ) List () (listResponse ListIPAccessListsResponse , err error ) {
89
+ listResponse = ListIPAccessListsResponse {}
90
+ err = a .client .Get (a .context , "/ip-access-lists" , nil , & listResponse )
91
91
return
92
92
}
93
93
@@ -100,7 +100,6 @@ func ResourceIPAccessList() *schema.Resource {
100
100
Type : schema .TypeString ,
101
101
ValidateFunc : validation .Any (validation .IsIPv4Address , validation .IsCIDR ),
102
102
}
103
- s ["enabled" ].Default = true
104
103
return s
105
104
})
106
105
return common.Resource {
0 commit comments