Struct: s3crypto.S3LoadStrategy

import "../ibm-cos-sdk-go/service/s3/s3crypto"

Overview

S3LoadStrategy will load the instruction file from s3

Implemented Interfaces

s3crypto.Cipher, s3crypto.LoadStrategy, s3manager.ReadSeekerWriteTo, s3manager.WriterReadFrom

Structure Field Summary collapse

Method Summary collapse

Structure Field Details

Client *s3.S3

InstructionFileSuffix string

Method Details

func (load S3LoadStrategy) Load(req *request.Request) (Envelope, error)

Load from a given instruction file suffix



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
// File 'service/s3/s3crypto/strategy.go', line 85

func (load S3LoadStrategy) Load(req *request.Request) (Envelope, error) { env := Envelope{} if load.InstructionFileSuffix == "" { load.InstructionFileSuffix = DefaultInstructionKeySuffix } input := req.Params.(*s3.GetObjectInput) out, err := load.Client.GetObject(&s3.GetObjectInput{ Key: aws.String(strings.Join([]string{*input.Key, load.InstructionFileSuffix}, "")), Bucket: input.Bucket, }) if err != nil { return env, err } b, err := ioutil.ReadAll(out.Body) if err != nil { return env, err } err = json.Unmarshal(b, &env) return env, err }