SDK (function) to list NPE/PE attributes? #947
-
Using the golang SDK, is there a mechanism to identify the attributes that an NPE or PE has? In other words, if I want to call the function below, and set values to something appropriate; is there a function that I can call elsewhere (e.g. in an integration test) to list potential values ? // Based on
// - https://github.com/opentdf/platform/tree/main/sdk
// - https://github.com/opentdf/otdfctl
//
// Create a TDF
_, err = sdkClient.CreateTDF(enc, bytes.NewReader(b),
sdk.WithDataAttributes(values...),
sdk.WithKasInformation(sdk.KASInfo{
URL: config.KasUrl,
PublicKey: "",
},
),
) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Yes, but we don't have a convenient method quite yet. What you'll need to do is use the Authorization Service https://github.com/opentdf/platform/blob/main/sdk/sdk.go#L140 which uses this proto https://github.com/opentdf/platform/blob/main/service/authorization/authorization.proto. Also keep in mind that the client (i.e. service-client) will need the appropriate permissions. It should look something like this, but keep in mind you'll need to import the protocols for authorization. package main
import "github.com/opentdf/platform/protocol/go/authorization"
// ...
sdkClient.Authorization.GetEntitlements(context.TODO(), &authorization.GetEntitlementsRequest{
Entities: []*authorization.Entity{
{
Id: "e1",
EntityType: &authorization.Entity_EmailAddress{
EmailAddress: "bob@example.com",
},
},
},
}) |
Beta Was this translation helpful? Give feedback.
Yes, but we don't have a convenient method quite yet. What you'll need to do is use the Authorization Service https://github.com/opentdf/platform/blob/main/sdk/sdk.go#L140 which uses this proto https://github.com/opentdf/platform/blob/main/service/authorization/authorization.proto.
Also keep in mind that the client (i.e. service-client) will need the appropriate permissions.
It should look something like this, but keep in mind you'll need to import the protocols for authorization.