permitio/permit-golang

Nil Pointer on Deleting Resource Instances

Closed this issue · 0 comments

The problem is that there is a misspelling of Resource as Resouce here:

ResouceInstances *ResourceInstancesApiService

While that isn't a big deal, the problem is when the NewAPIClient function is called, that function sets ResourceInstanceApi twice instead of setting one of them to the Resouce:
c.ResourceInstancesApi = (*ResourceInstancesApiService)(&c.common)
c.ResourceInstancesApi = (*ResourceInstancesApiService)(&c.common)

And here the incorrectly named value is being used:

httpRes, err := r.client.ResouceInstances.DeleteResourceInstance(ctx,
r.config.Context.GetProject(),
r.config.Context.GetEnvironment(),
instanceId,
).Execute()