Closed umarali-nagoor closed 4 years ago
Executed following example
Steps:
1) Configure the allowed_ip list and update the existing COS bucket
Snippet code
// Update allowed_ip uOptions := &rc.UpdateBucketConfigOptions{ Bucket: core.StringPtr(bName), Firewall: &rc.Firewall{ AllowedIp: []string{"192.168.0.0","192.168.0.1"}, }, }
RESULT :
umars-MBP:resourceconfigurationv1 umarali$ go run resourceconfiguration_v1.go
&{
2) Try to remove the ip based access by making allowed_ip list empty
// Update Config Options uOptions := &rc.UpdateBucketConfigOptions{ Bucket: core.StringPtr(bName), Firewall: &rc.Firewall{ AllowedIp: []string{}, }, }
RESULT:
The provided JSON was malformed or did not validate against the published schema
@umarali-nagoor I've got a workaround, but it requires a local edit to the SDK until we can release a patched version.
If you can go to line 342 and remove ,omitempty
there shouldn't be a problem. Right now the compiler is looking at the empty slice and omitting from the generated JSON, causing the error. Once the omitempty
flag is removed, then something like this will work to remove the firewall:
var newFilter = make([]string, 0)
uOptions := &rc.UpdateBucketConfigOptions{
Bucket: core.StringPtr(bName),
Firewall: &rc.Firewall{
AllowedIp: newFilter,
},
}
Hi @umarali-nagoor, we are working with our internal team to get this addressed in our code generation tools. In the mean time, could you please try the workaround suggested above by @nglange and let us know if it works for you while we pursue the fix?
As mentioned we are tracking this issue now internally. Closing issue.
@nglange @sandersrIBM Do we have any update on this issue...We need to have ETA for this
Problem :
Steps :
Result :
SDK Used :
Snippet from api doc :
allowed_ip : List of IPv4 or IPv6 addresses in CIDR notation to be affected by firewall in CIDR notation is supported. Passing an empty array will lift the IP address filter.
Tested in terraform-provider-ibm v1.8.1