In particular, I'm not sure on what to pass as `parent` to the method `GrafeasV1Beta1ApiService.ListNotes`
I have something that looks like this:
import(
"context"
"fmt"
v1beta1 "github.com/grafeas/client-go/0.1.0"
)
func main() {
config := v1beta1.NewConfiguration()
config.BasePath = "http://localhost:9090" // port-forwarding using kubectl
client := v1beta1.NewAPIClient(config)
request_ctx := context.Background()
api_resp, http_resp, err := client.GrafeasV1Beta1Api.ListNotes(ctx, "myproj", &v1beta1.ListNotesOpts{})
if err != nil {
fmt.Println("error getting note", err)
} else {
fmt.Println(api_resp)
fmt.Println(http_resp)
}
} Which returns `"error getting note 404 Not Found"`. The 404 makes me think that it's sending _something_ to the grafeas server, but the path is badly formatted.
If I construct the request manually on the CLI with curl, this works:
So I would expect the client-go library to construct a request that looks broadly similar.
Digging further into the documentation here,
https://github.com/grafeas/client-go/blob/master/0.1.0/docs/GrafeasV1Beta1Api.md#listnotes| parent | string | The name of the project to list notes for in the form of `projects/[PROJECT_ID]`. |
I've tried passing in my parent string a "projects/myproj" but with the same 404 outcome.
localVarPath := a.client.cfg.BasePath + "/v1beta1/{parent=projects/*}/notes"
localVarPath = strings.Replace(localVarPath, "{"+"parent"+"}", fmt.Sprintf("%v", parent), -1)
I'm afraid I'm just not sure how to read this path manipulation, but from what I can tell, it doesn't actually do anything with the `parent` parameter.
`localVarPath` is first instantiated as "
http://localhost:9090/v1beta1/{parent=projects/*}/notes" and then the Replace function tries to replease `"{"+"parent"+"}"` (="{parent}") with my argument `parent` (= "projects/krypton"). But (unless I'm completely misunderstanding the intent of this line, or how golang string manipluations work) this doesn't do anything, since "{parent}" doesn't exist in the initial string.
Hence, the request seems to be sent to the path `
http://localhost:9090/v1beta1/{parent=projects/*}/notes`, which correctly returns a 404.
Am I missing something obvious here? I haven't tried working through any of the other methods exposed in `GrafeasV1Beta1ApiService`, but judging by the code I would expect the same to happen.