Skip to content

Latest commit

 

History

History
166 lines (121 loc) · 7.33 KB

File metadata and controls

166 lines (121 loc) · 7.33 KB

Client.Governance.Data.Reports

Overview

Available Operations

  • Create - Creates new one-time report
  • Download - Downloads violations CSV for report
  • Status - Fetches report run status

Create

Creates a new one-time report and executes its batch job.

Example Usage

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.Reports.Create(ctx, components.UpdateDlpConfigRequest{})
    if err != nil {
        log.Fatal(err)
    }
    if res.UpdateDlpConfigResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request components.UpdateDlpConfigRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.CreatereportResponse, error

Errors

Error Type Status Code Content Type
apierrors.APIError 4XX, 5XX */*

Download

Downloads CSV violations report for a specific report id.

Example Usage

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.Reports.Download(ctx, "<id>")
    if err != nil {
        log.Fatal(err)
    }
    if res.Res != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
id string ✔️ The id of the report to download violations for.
opts []operations.Option The options for this request.

Response

*operations.DownloadreportcsvResponse, error

Errors

Error Type Status Code Content Type
apierrors.APIError 4XX, 5XX */*

Status

Fetches the status of the run corresponding to the report-id.

Example Usage

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.Reports.Status(ctx, "<id>")
    if err != nil {
        log.Fatal(err)
    }
    if res.ReportStatusResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
id string ✔️ The id of the report to get run status for.
opts []operations.Option The options for this request.

Response

*operations.GetreportstatusResponse, error

Errors

Error Type Status Code Content Type
apierrors.APIError 4XX, 5XX */*