I am trying to use the Go SDKs that OCI provides:
I am trying to connect using a config file in the same folder that looks like this:
[DEFAULT]
tenancy=ocid1.tenancy.oc1..abcdefg
user=ocid1.user.oc1..abcdefg
fingerprint=00:00:00:00:00.....
key_file="./oci.pem"
region=eu-frankfurt-1
package main
import (
"context"
"encoding/json"
"io"
"net/http"
fdk "github.com/fnproject/fdk-go"
)
func main() {
fdk.Handle(fdk.HandlerFunc(fnHandler))
}
func fnHandler(ctx context.Context, in io.Reader, out io.Writer) {
fnctx, ok := fdk.GetContext(ctx).(fdk.HTTPContext)
if !ok {
fdk.WriteStatus(out, http.StatusBadRequest)
io.WriteString(out, `{"error":"Invalid Request"}`)
return
}
/** Oracle NoSQL and Object Storage Connection */
/**
*
*
*
*
*
*
*
*/
response := struct {
URL string `json:"url"`
Header http.Header `json:"header"`
Config map[string]string `json:"config"`
Message bool `json:"ok"`
}{
URL: fnctx.RequestURL(),
Header: fnctx.Header(),
Config: fnctx.Config(),
Message: ok,
}
fdk.WriteStatus(out, http.StatusCreated)
json.NewEncoder(out).Encode(&response)
}