Skip to content

Latest commit

 

History

History
265 lines (181 loc) · 13.2 KB

File metadata and controls

265 lines (181 loc) · 13.2 KB

Client.Governance.Data.Policies

Overview

Available Operations

  • retrieve - Gets specified policy
  • update - Updates an existing policy
  • list - Lists policies
  • create - Creates new policy
  • download - Downloads violations CSV for policy

retrieve

Fetches the specified policy version, or the latest if no version is provided.

Example Usage

package hello.world;

import com.glean.api_client.glean_api_client.Glean;
import com.glean.api_client.glean_api_client.models.operations.GetpolicyResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws Exception {

        Glean sdk = Glean.builder()
                .apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
            .build();

        GetpolicyResponse res = sdk.client().governance().data().policies().retrieve()
                .id("<id>")
                .call();

        if (res.getDlpReportResponse().isPresent()) {
            System.out.println(res.getDlpReportResponse().get());
        }
    }
}

Parameters

Parameter Type Required Description
id String ✔️ The id of the policy to fetch.
version Optional<Long> 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.

Response

GetpolicyResponse

Errors

Error Type Status Code Content Type
models/errors/APIException 4XX, 5XX */*

update

Updates an existing policy.

Example Usage

package hello.world;

import com.glean.api_client.glean_api_client.Glean;
import com.glean.api_client.glean_api_client.models.components.UpdateDlpReportRequest;
import com.glean.api_client.glean_api_client.models.operations.UpdatepolicyResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws Exception {

        Glean sdk = Glean.builder()
                .apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
            .build();

        UpdatepolicyResponse res = sdk.client().governance().data().policies().update()
                .id("<id>")
                .updateDlpReportRequest(UpdateDlpReportRequest.builder()
                    .build())
                .call();

        if (res.updateDlpReportResponse().isPresent()) {
            System.out.println(res.updateDlpReportResponse().get());
        }
    }
}

Parameters

Parameter Type Required Description
id String ✔️ The id of the policy to fetch.
updateDlpReportRequest UpdateDlpReportRequest ✔️ N/A

Response

UpdatepolicyResponse

Errors

Error Type Status Code Content Type
models/errors/APIException 4XX, 5XX */*

list

Lists policies with filtering.

Example Usage

package hello.world;

import com.glean.api_client.glean_api_client.Glean;
import com.glean.api_client.glean_api_client.models.operations.ListpoliciesResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws Exception {

        Glean sdk = Glean.builder()
                .apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
            .build();

        ListpoliciesResponse res = sdk.client().governance().data().policies().list()
                .call();

        if (res.listDlpReportsResponse().isPresent()) {
            System.out.println(res.listDlpReportsResponse().get());
        }
    }
}

Parameters

Parameter Type Required Description
autoHide Optional<Boolean> Filter to return reports with a given value of auto-hide.
frequency Optional<String> Filter to return reports with a given frequency.

Response

ListpoliciesResponse

Errors

Error Type Status Code Content Type
models/errors/APIException 4XX, 5XX */*

create

Creates a new policy with specified specifications and returns its id.

Example Usage

package hello.world;

import com.glean.api_client.glean_api_client.Glean;
import com.glean.api_client.glean_api_client.models.components.CreateDlpReportRequest;
import com.glean.api_client.glean_api_client.models.operations.CreatepolicyResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws Exception {

        Glean sdk = Glean.builder()
                .apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
            .build();

        CreateDlpReportRequest req = CreateDlpReportRequest.builder()
                .build();

        CreatepolicyResponse res = sdk.client().governance().data().policies().create()
                .request(req)
                .call();

        if (res.createDlpReportResponse().isPresent()) {
            System.out.println(res.createDlpReportResponse().get());
        }
    }
}

Parameters

Parameter Type Required Description
request CreateDlpReportRequest ✔️ The request object to use for the request.

Response

CreatepolicyResponse

Errors

Error Type Status Code Content Type
models/errors/APIException 4XX, 5XX */*

download

Downloads CSV violations report for a specific policy id. This does not support continuous policies.

Example Usage

package hello.world;

import com.glean.api_client.glean_api_client.Glean;
import com.glean.api_client.glean_api_client.models.operations.DownloadpolicycsvResponse;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws Exception {

        Glean sdk = Glean.builder()
                .apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
            .build();

        DownloadpolicycsvResponse res = sdk.client().governance().data().policies().download()
                .id("<id>")
                .call();

        if (res.res().isPresent()) {
            System.out.println(res.res().get());
        }
    }
}

Parameters

Parameter Type Required Description
id String ✔️ The id of the policy to download violations for.

Response

DownloadpolicycsvResponse

Errors

Error Type Status Code Content Type
models/errors/APIException 4XX, 5XX */*