Sanitize | Golang SDK
Sanitize via presigned URL
func (e *sanitize) RequestUploadURL(ctx context.Context, input *SanitizeRequest) (*pangea.PangeaResponse[SanitizeResult], error)Apply file sanitization actions according to specified rules via a presigned URL.
presignedUrl, err := client.RequestUploadURL(ctx, &sanitize.SanitizeRequest{
TransferRequest: pangea.TransferRequest{
TransferMethod: pangea.TMputURL,
},
UploadedFileName: "uploaded_file",
})
// Upload file to `presignedUrl.AcceptedResult.PutURL`.
// Poll for Sanitize's result
response, err := client.PollResultByID(ctx, *presignedUrl.RequestID, &sanitize.SanitizeResult{})
Sanitize
func (e *sanitize) Sanitize(ctx context.Context, input *SanitizeRequest, file io.ReadSeeker) (*pangea.PangeaResponse[SanitizeResult], error)Apply file sanitization actions according to specified rules.
response, err := client.Sanitize(ctx, &sanitize.SanitizeRequest{
TransferRequest: pangea.TransferRequest{
TransferMethod: pangea.TMpostURL,
},
UploadedFileName: "uploaded_file",
}, file)
Type CDR
type CDR structCDR represents the CDR PangeaResponseResult.
type CDR struct {
FileAttachmentsRemoved int `json:"file_attachments_removed"`
InteractiveContentsRemoved int `json:"interactive_contents_removed"`
}
Type Client
type Client interfacetype Client interface {
// Sanitize.
Sanitize(ctx context.Context, input *SanitizeRequest, file io.ReadSeeker) (*pangea.PangeaResponse[SanitizeResult], error)
// Sanitize via presigned URL.
RequestUploadURL(ctx context.Context, input *SanitizeRequest) (*pangea.PangeaResponse[SanitizeResult], error)
// Base service methods
pangea.BaseServicer
}
Type DefangData
type DefangData structDefangData represents the DefangData PangeaResponseResult.
type DefangData struct {
ExternalURLsCount int `json:"external_urls_count"`
ExternalDomainsCount int `json:"external_domains_count"`
DefangedCount int `json:"defanged_count"`
URLIntelSummary string `json:"url_intel_summary"`
DomainIntelSummary string `json:"domain_intel_summary"`
}
Type RedactData
type RedactData structRedactData represents the RedactData PangeaResponseResult.
type RedactData struct {
RedactionCount int `json:"redaction_count"`
SummaryCounts map[string]int `json:"summary_counts"`
// The scoring result of a set of rules.
RecognizerResults []RedactRecognizerResult `json:"recognizer_results,omitempty"`
}
Type RedactRecognizerResult
type RedactRecognizerResult structtype RedactRecognizerResult struct {
FieldType string `json:"field_type"` // The entity name.
Score float64 `json:"score"` // The certainty score that the entity matches this specific snippet.
Text string `json:"text"` // The text snippet that matched.
Start int `json:"start"` // The starting index of a snippet.
End int `json:"end"` // The ending index of a snippet.
Redacted bool `json:"redacted"` // Indicates if this rule was used to anonymize a text snippet.
}
Type SanitizeContent
type SanitizeContent structSanitizeContent represents the SanitizeContent API request model.
type SanitizeContent struct {
URLIntel *bool `json:"url_intel,omitempty"`
URLIntelProvider string `json:"url_intel_provider,omitempty"`
DomainIntel *bool `json:"domain_intel,omitempty"`
DomainIntelProvider string `json:"domain_intel_provider,omitempty"`
Defang *bool `json:"defang,omitempty"`
DefangThreshold *int `json:"defang_threshold,omitempty"`
Redact *bool `json:"redact,omitempty"`
// If redact is enabled, avoids redacting the file and instead returns the
// PII analysis engine results. Only works if redact is enabled.
RedactDetectOnly *bool `json:"redact_detect_only,omitempty"`
RemoveAttachments *bool `json:"remove_attachments,omitempty"`
RemoveInteractive *bool `json:"remove_interactive,omitempty"`
}
Type SanitizeData
type SanitizeData structSanitizeData represents the SanitizeData PangeaResponseResult.
type SanitizeData struct {
Defang *DefangData `json:"defang,omitempty"`
Redact *RedactData `json:"redact,omitempty"`
MaliciousFile bool `json:"malicious_file"`
CDR *CDR `json:"cdr,omitempty"`
}
Type SanitizeFile
type SanitizeFile structSanitizeFile represents the SanitizeFile API request model.
type SanitizeFile struct {
ScanProvider string `json:"scan_provider,omitempty"`
}
Type SanitizeRequest
type SanitizeRequest structSanitizeRequest represents the SanitizeRequest API request model.
type SanitizeRequest struct {
pangea.BaseRequest
pangea.TransferRequest
SourceURL string `json:"source_url,omitempty"`
ShareID string `json:"share_id,omitempty"`
File *SanitizeFile `json:"file,omitempty"`
Content *SanitizeContent `json:"content,omitempty"`
ShareOutput *SanitizeShareOutput `json:"share_output,omitempty"`
Size *int `json:"size,omitempty"`
CRC32C string `json:"crc32c,omitempty"`
SHA256 string `json:"sha256,omitempty"`
UploadedFileName string `json:"uploaded_file_name,omitempty"`
}
Type SanitizeResult
type SanitizeResult structSanitizeResult represents the SanitizeResult PangeaResponseResult.
type SanitizeResult struct {
DestURL *string `json:"dest_url,omitempty"`
DestShareID *string `json:"dest_share_id,omitempty"`
Data SanitizeData `json:"data"`
Parameters map[string]interface{} `json:"parameters,omitempty"`
}
Type SanitizeShareOutput
type SanitizeShareOutput structSanitizeShareOutput represents the SanitizeShareOutput API request model.
type SanitizeShareOutput struct {
Enabled *bool `json:"enabled,omitempty"`
OutputFolder string `json:"output_folder,omitempty"`
}
Type sanitize
type sanitize structtype sanitize struct {
pangea.BaseService
}