Skip to main content

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.

required parameters

context.Context
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.

required parameters

context.Context
io.ReadSeeker
response, err := client.Sanitize(ctx, &sanitize.SanitizeRequest{
	TransferRequest: pangea.TransferRequest{
		TransferMethod: pangea.TMpostURL,
	},
	UploadedFileName: "uploaded_file",
}, file)

Type CDR

type CDR struct

CDR represents the CDR PangeaResponseResult.

required parameters

int `json:"file_attachments_removed"`
int `json:"interactive_contents_removed"`
type CDR struct {
	FileAttachmentsRemoved		int	`json:"file_attachments_removed"`
	InteractiveContentsRemoved	int	`json:"interactive_contents_removed"`
}

Type Client

type Client interface

required parameters

func(ctx context.Context, input *SanitizeRequest, file io.ReadSeeker) (*pangea.PangeaResponse[SanitizeResult], error)

Sanitize.

context.Context
io.ReadSeeker
func(ctx context.Context, input *SanitizeRequest) (*pangea.PangeaResponse[SanitizeResult], error)

Sanitize via presigned URL.

context.Context
pangea.BaseServicer

Base service methods

type 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 struct

DefangData represents the DefangData PangeaResponseResult.

required parameters

int `json:"external_urls_count"`
int `json:"external_domains_count"`
int `json:"defanged_count"`
string `json:"url_intel_summary"`
string `json:"domain_intel_summary"`
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 struct

RedactData represents the RedactData PangeaResponseResult.

required parameters

int `json:"redaction_count"`
map[string]int `json:"summary_counts"`

The scoring result of a set of rules.

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 struct

required parameters

string `json:"field_type"`
float64 `json:"score"`
string `json:"text"`
int `json:"start"`
int `json:"end"`
bool `json:"redacted"`
type 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 struct

SanitizeContent represents the SanitizeContent API request model.

required parameters

*bool `json:"url_intel,omitempty"`
string `json:"url_intel_provider,omitempty"`
*bool `json:"domain_intel,omitempty"`
string `json:"domain_intel_provider,omitempty"`
*bool `json:"defang,omitempty"`
*int `json:"defang_threshold,omitempty"`
*bool `json:"redact,omitempty"`
*bool `json:"redact_detect_only,omitempty"`

If redact is enabled, avoids redacting the file and instead returns the PII analysis engine results. Only works if redact is enabled.

*bool `json:"remove_attachments,omitempty"`
*bool `json:"remove_interactive,omitempty"`
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 struct

SanitizeData represents the SanitizeData PangeaResponseResult.

required parameters

*DefangData `json:"defang,omitempty"`
bool `json:"malicious_file"`
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 struct

SanitizeFile represents the SanitizeFile API request model.

required parameters

string `json:"scan_provider,omitempty"`
type SanitizeFile struct {
	ScanProvider string `json:"scan_provider,omitempty"`
}

Type SanitizeRequest

type SanitizeRequest struct

SanitizeRequest represents the SanitizeRequest API request model.

required parameters

string `json:"source_url,omitempty"`
string `json:"share_id,omitempty"`
*int `json:"size,omitempty"`
string `json:"crc32c,omitempty"`
string `json:"sha256,omitempty"`
string `json:"uploaded_file_name,omitempty"`
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 struct

SanitizeResult represents the SanitizeResult PangeaResponseResult.

required parameters

*string `json:"dest_url,omitempty"`
*string `json:"dest_share_id,omitempty"`
map[string]interface{} `json:"parameters,omitempty"`
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 struct

SanitizeShareOutput represents the SanitizeShareOutput API request model.

required parameters

*bool `json:"enabled,omitempty"`
string `json:"output_folder,omitempty"`
type SanitizeShareOutput struct {
	Enabled		*bool	`json:"enabled,omitempty"`
	OutputFolder	string	`json:"output_folder,omitempty"`
}

Type sanitize

type sanitize struct
type sanitize struct {
	pangea.BaseService
}