// SetAttachment sets the Attachment field's value.
499917
func (s *DescribeAttachmentOutput) SetAttachment(v *Attachment) *DescribeAttachmentOutput {
	s.Attachment = v
	return s
}
383783
func (s *GetDocumentOutput) SetAttachmentsContent(v []*AttachmentContent) *GetDocumentOutput {
	s.AttachmentsContent = v
	return s
}
850344
func DeleteAttachment(a *Attachment, remove bool) error {
	_, err := DeleteAttachments([]*Attachment{a}, remove)
	return err
}
714296
func (s *Disk) SetAttachmentState(v string) *Disk {
	s.AttachmentState = &v
	return s
}
249170
func uploadAttachment(r io.Reader, ct string) (*att, error) {
	//combined AES-256 and HMAC-SHA256 key
	keys := make([]byte, 64)
	randBytes(keys)

	b, err := ioutil.ReadAll(r)
	if err != nil {
		return nil, err
	}

	e, err := aesEncrypt(keys[:32], b)
	if err != nil {
		return nil, err
	}

	m := appendMAC(keys[32:], e)

	id, location, err := allocateAttachment()
	if err != nil {
		return nil, err
	}
	err = putAttachment(location, m)
	if err != nil {
		return nil, err
	}
	return &att{id, ct, keys}, nil
}
1320631
func (s *GenericAttachment) SetAttachmentLinkUrl(v string) *GenericAttachment {
	s.AttachmentLinkUrl = &v
	return s
}
409152
func (m *Message) NewAttachment() *Attachment {
	a := &Attachment{}
	m.AddAttachment(a)

	return a
}
1030966
func (s *DescribeChannelOutput) SetInputAttachments(v []*InputAttachment) *DescribeChannelOutput {
	s.InputAttachments = v
	return s
}
830641
func (s *InputSwitchScheduleActionSettings) SetInputAttachmentNameReference(v string) *InputSwitchScheduleActionSettings {
	s.InputAttachmentNameReference = &v
	return s
}
615923
func (s *BatchListIndexResponse) SetIndexAttachments(v []*IndexAttachment) *BatchListIndexResponse {
	s.IndexAttachments = v
	return s
}
138299
func (s *DetectDocumentTextInput) SetDocument(v *Document) *DetectDocumentTextInput {
	s.Document = v
	return s
}
513568
func (s *ResponseCard) SetGenericAttachments(v []*GenericAttachment) *ResponseCard {
	s.GenericAttachments = v
	return s
}
1006442
func putAttachment(url string, body []byte) error {
	br := bytes.NewReader(body)
	req, err := http.NewRequest("PUT", url, br)
	if err != nil {
		return err
	}
	req.Header.Add("Content-type", "application/octet-stream")
	req.Header.Add("Content-length", strconv.Itoa(len(body)))
	resp, err := http.DefaultClient.Do(req)

	if resp != nil && (resp.StatusCode < 200 || resp.StatusCode >= 300) {
		return fmt.Errorf("HTTP status %d\n", resp.StatusCode)
	}

	return err
}
49035
func (m *Message) AddAttachment(attachment string) {
	m.attachments = append(m.attachments, attachment)
}
313831
func (s *StartChannelOutput) SetInputAttachments(v []*InputAttachment) *StartChannelOutput {
	s.InputAttachments = v
	return s
}
536454
func (h *AttachmentHeader) SetFilename(filename string) {
	dispParams := map[string]string{"filename": filename}
	h.SetContentDisposition("attachment", dispParams)
}
885352
func (w *Writer) CreateAttachment(h AttachmentHeader) (io.WriteCloser, error) {
	initAttachmentHeader(&h)
	return w.mw.CreatePart(h.Header)
}