MCPcopy
hub / github.com/minio/minio-go / SetChecksum

Method SetChecksum

post-policy.go:341–364  ·  view source on GitHub ↗

SetChecksum sets the checksum of the request.

(c Checksum)

Source from the content-addressed store, hash-verified

339
340// SetChecksum sets the checksum of the request.
341func (p *PostPolicy) SetChecksum(c Checksum) error {
342 if c.IsSet() {
343 p.formData[amzChecksumAlgo] = c.Type.String()
344 p.formData[c.Type.Key()] = c.Encoded()
345
346 policyCond := policyCondition{
347 matchType: "eq",
348 condition: fmt.Sprintf("$%s", amzChecksumAlgo),
349 value: c.Type.String(),
350 }
351 if err := p.addNewPolicy(policyCond); err != nil {
352 return err
353 }
354 policyCond = policyCondition{
355 matchType: "eq",
356 condition: fmt.Sprintf("$%s", c.Type.Key()),
357 value: c.Encoded(),
358 }
359 if err := p.addNewPolicy(policyCond); err != nil {
360 return err
361 }
362 }
363 return nil
364}
365
366// SetEncryption - sets encryption headers for POST API
367func (p *PostPolicy) SetEncryption(sse encrypt.ServerSide) {

Calls 5

addNewPolicyMethod · 0.95
EncodedMethod · 0.80
IsSetMethod · 0.45
StringMethod · 0.45
KeyMethod · 0.45

Tested by 1