- Retrieve - Gets specified policy
- Update - Updates an existing policy
- List - Lists policies
- Create - Creates new policy
- Download - Downloads violations CSV for policy
Fetches the specified policy version, or the latest if no version is provided.
package main
import(
"context"
"os"
apiclientgo "github.com/gleanwork/api-client-go"
"log"
)
func main() {
ctx := context.Background()
s := apiclientgo.New(
apiclientgo.WithSecurity(os.Getenv("GLEAN_API_TOKEN")),
)
res, err := s.Client.Governance.Data.Policies.Retrieve(ctx, "<id>", nil)
if err != nil {
log.Fatal(err)
}
if res.GetDlpReportResponse != nil {
// handle response
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
id |
string |
✔️ | The id of the policy to fetch. |
version |
*int64 |
➖ | The version of the policy to fetch. Each time a policy is updated, the older version is still stored. If this is left empty, the latest policy is fetched. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.GetpolicyResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| apierrors.APIError | 4XX, 5XX | */* |
Updates an existing policy.
package main
import(
"context"
"os"
apiclientgo "github.com/gleanwork/api-client-go"
"github.com/gleanwork/api-client-go/models/components"
"log"
)
func main() {
ctx := context.Background()
s := apiclientgo.New(
apiclientgo.WithSecurity(os.Getenv("GLEAN_API_TOKEN")),
)
res, err := s.Client.Governance.Data.Policies.Update(ctx, "<id>", components.UpdateDlpReportRequest{})
if err != nil {
log.Fatal(err)
}
if res.UpdateDlpReportResponse != nil {
// handle response
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
id |
string |
✔️ | The id of the policy to fetch. |
updateDlpReportRequest |
components.UpdateDlpReportRequest | ✔️ | N/A |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.UpdatepolicyResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| apierrors.APIError | 4XX, 5XX | */* |
Lists policies with filtering.
package main
import(
"context"
"os"
apiclientgo "github.com/gleanwork/api-client-go"
"log"
)
func main() {
ctx := context.Background()
s := apiclientgo.New(
apiclientgo.WithSecurity(os.Getenv("GLEAN_API_TOKEN")),
)
res, err := s.Client.Governance.Data.Policies.List(ctx, nil, nil)
if err != nil {
log.Fatal(err)
}
if res.ListDlpReportsResponse != nil {
// handle response
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
autoHide |
*bool |
➖ | Filter to return reports with a given value of auto-hide. |
frequency |
*string |
➖ | Filter to return reports with a given frequency. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.ListpoliciesResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| apierrors.APIError | 4XX, 5XX | */* |
Creates a new policy with specified specifications and returns its id.
package main
import(
"context"
"os"
apiclientgo "github.com/gleanwork/api-client-go"
"github.com/gleanwork/api-client-go/models/components"
"log"
)
func main() {
ctx := context.Background()
s := apiclientgo.New(
apiclientgo.WithSecurity(os.Getenv("GLEAN_API_TOKEN")),
)
res, err := s.Client.Governance.Data.Policies.Create(ctx, components.CreateDlpReportRequest{})
if err != nil {
log.Fatal(err)
}
if res.CreateDlpReportResponse != nil {
// handle response
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
components.CreateDlpReportRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.CreatepolicyResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| apierrors.APIError | 4XX, 5XX | */* |
Downloads CSV violations report for a specific policy id. This does not support continuous policies.
package main
import(
"context"
"os"
apiclientgo "github.com/gleanwork/api-client-go"
"log"
)
func main() {
ctx := context.Background()
s := apiclientgo.New(
apiclientgo.WithSecurity(os.Getenv("GLEAN_API_TOKEN")),
)
res, err := s.Client.Governance.Data.Policies.Download(ctx, "<id>")
if err != nil {
log.Fatal(err)
}
if res.Res != nil {
// handle response
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
id |
string |
✔️ | The id of the policy to download violations for. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.DownloadpolicycsvResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| apierrors.APIError | 4XX, 5XX | */* |