// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.

package support

import (
	"context"

	"github.com/aws/aws-sdk-go-v2/aws"
	"github.com/aws/aws-sdk-go-v2/internal/awsutil"
)

// Please also see https://docs.aws.amazon.com/goto/WebAPI/support-2013-04-15/AddAttachmentsToSetRequest
type AddAttachmentsToSetInput struct {
	_ struct{} `type:"structure"`

	// The ID of the attachment set. If an attachmentSetId is not specified, a new
	// attachment set is created, and the ID of the set is returned in the response.
	// If an attachmentSetId is specified, the attachments are added to the specified
	// set, if it exists.
	AttachmentSetId *string `locationName:"attachmentSetId" type:"string"`

	// One or more attachments to add to the set. The limit is 3 attachments per
	// set, and the size limit is 5 MB per attachment.
	//
	// Attachments is a required field
	Attachments []Attachment `locationName:"attachments" type:"list" required:"true"`
}

// String returns the string representation
func (s AddAttachmentsToSetInput) String() string {
	return awsutil.Prettify(s)
}

// Validate inspects the fields of the type to determine if they are valid.
func (s *AddAttachmentsToSetInput) Validate() error {
	invalidParams := aws.ErrInvalidParams{Context: "AddAttachmentsToSetInput"}

	if s.Attachments == nil {
		invalidParams.Add(aws.NewErrParamRequired("Attachments"))
	}

	if invalidParams.Len() > 0 {
		return invalidParams
	}
	return nil
}

// The ID and expiry time of the attachment set returned by the AddAttachmentsToSet
// operation.
// Please also see https://docs.aws.amazon.com/goto/WebAPI/support-2013-04-15/AddAttachmentsToSetResponse
type AddAttachmentsToSetOutput struct {
	_ struct{} `type:"structure"`

	// The ID of the attachment set. If an attachmentSetId was not specified, a
	// new attachment set is created, and the ID of the set is returned in the response.
	// If an attachmentSetId was specified, the attachments are added to the specified
	// set, if it exists.
	AttachmentSetId *string `locationName:"attachmentSetId" type:"string"`

	// The time and date when the attachment set expires.
	ExpiryTime *string `locationName:"expiryTime" type:"string"`
}

// String returns the string representation
func (s AddAttachmentsToSetOutput) String() string {
	return awsutil.Prettify(s)
}

const opAddAttachmentsToSet = "AddAttachmentsToSet"

// AddAttachmentsToSetRequest returns a request value for making API operation for
// AWS Support.
//
// Adds one or more attachments to an attachment set. If an attachmentSetId
// is not specified, a new attachment set is created, and the ID of the set
// is returned in the response. If an attachmentSetId is specified, the attachments
// are added to the specified set, if it exists.
//
// An attachment set is a temporary container for attachments that are to be
// added to a case or case communication. The set is available for one hour
// after it is created; the expiryTime returned in the response indicates when
// the set expires. The maximum number of attachments in a set is 3, and the
// maximum size of any attachment in the set is 5 MB.
//
//    // Example sending a request using AddAttachmentsToSetRequest.
//    req := client.AddAttachmentsToSetRequest(params)
//    resp, err := req.Send(context.TODO())
//    if err == nil {
//        fmt.Println(resp)
//    }
//
// Please also see https://docs.aws.amazon.com/goto/WebAPI/support-2013-04-15/AddAttachmentsToSet
func (c *Client) AddAttachmentsToSetRequest(input *AddAttachmentsToSetInput) AddAttachmentsToSetRequest {
	op := &aws.Operation{
		Name:       opAddAttachmentsToSet,
		HTTPMethod: "POST",
		HTTPPath:   "/",
	}

	if input == nil {
		input = &AddAttachmentsToSetInput{}
	}

	req := c.newRequest(op, input, &AddAttachmentsToSetOutput{})
	return AddAttachmentsToSetRequest{Request: req, Input: input, Copy: c.AddAttachmentsToSetRequest}
}

// AddAttachmentsToSetRequest is the request type for the
// AddAttachmentsToSet API operation.
type AddAttachmentsToSetRequest struct {
	*aws.Request
	Input *AddAttachmentsToSetInput
	Copy  func(*AddAttachmentsToSetInput) AddAttachmentsToSetRequest
}

// Send marshals and sends the AddAttachmentsToSet API request.
func (r AddAttachmentsToSetRequest) Send(ctx context.Context) (*AddAttachmentsToSetResponse, error) {
	r.Request.SetContext(ctx)
	err := r.Request.Send()
	if err != nil {
		return nil, err
	}

	resp := &AddAttachmentsToSetResponse{
		AddAttachmentsToSetOutput: r.Request.Data.(*AddAttachmentsToSetOutput),
		response:                  &aws.Response{Request: r.Request},
	}

	return resp, nil
}

// AddAttachmentsToSetResponse is the response type for the
// AddAttachmentsToSet API operation.
type AddAttachmentsToSetResponse struct {
	*AddAttachmentsToSetOutput

	response *aws.Response
}

// SDKResponseMetdata returns the response metadata for the
// AddAttachmentsToSet request.
func (r *AddAttachmentsToSetResponse) SDKResponseMetdata() *aws.Response {
	return r.response
}
