IBM-Cloud / bluemix-go

Go library for accessing the Bluemix API
Apache License 2.0
37 stars 89 forks source link

API change: add the async bool parameter to service_instances Create method #60

Closed huikang closed 7 years ago

huikang commented 7 years ago

Some services e.g., Watson discovery and conversation has to be deleted with the parameter async=true. This parameter should be exposed in the method definition, e.g.,

Create(req ServiceInstanceCreateRequest, async bool) (*ServiceInstanceFields, error)
Delete(instanceGUID string, async bool) error
ashishth09 commented 7 years ago
func (s *serviceInstance) Delete(instanceGUID string, asyncs ...bool) error {
    async := true
    if len(asyncs) > 0 {
        async := asyncs[0]
    }
    rawURL := fmt.Sprintf("/v2/service_instances/%s?accepts_incomplete=true&async=%t", instanceGUID, async)
    _, err := s.client.Delete(rawURL)
    return err
}

I think this will have minimal impact on existing clients.