Lambda go code to copy backup job for cross region

Viewed 34

I’m writing a lambda code to copy aws backup jobs from one region to another region, I’m not familiar with GO, is this the best way to write this?

I define the func and type struct for startcopyjobinput and startcopyoutput

func (c *Backup) StartCopyJobRequest(input *StartCopyJobInput) (req *request.Request, output *StartCopyJobOutput) {
    op := &request.Operation{
        Name:       opStartCopyJob,
        HTTPMethod: "PUT",
        HTTPPath:   "/copy-jobs",
    }

    if input == nil {
        input = &StartCopyJobInput{}
    }
   
    output = &StartCopyJobOutput{}
    req = c.newRequest(op, input, output)
    return
}

func (c *Backup) StartCopyJob(input *StartCopyJobInput) (*StartCopyJobOutput, error) {


    req, out :=c.StartCopyJobRequest(input)
    return out, req.Send()
}
0 Answers
Related