func()

in queue_manager.go [244:294]


func (p *MNSQueueManager) SetQueueAttributesWithOptions(queueName string, options ...QueueOption) (err error) {
	queueName = strings.TrimSpace(queueName)
	if err = checkQueueName(queueName); err != nil {
		return
	}
	opts := QueueOptions{}
	tracker := make(map[string]bool)
	for _, opt := range options {
		opt(&opts, tracker)
	}

	message := CreateQueueRequest{}
	if tracker["delaySeconds"] {
		if err = checkDelaySeconds(opts.delaySeconds); err != nil {
			return
		}
		message.DelaySeconds = opts.delaySeconds
	}

	if tracker["maxMessageSize"] {
		message.MaxMessageSize = opts.maxMessageSize
	}

	if tracker["messageRetentionPeriod"] {
		if err = checkMessageRetentionPeriod(opts.messageRetentionPeriod); err != nil {
			return
		}
		message.MessageRetentionPeriod = opts.messageRetentionPeriod
	}

	if tracker["visibilityTimeout"] {
		if err = checkVisibilityTimeout(opts.visibilityTimeout); err != nil {
			return
		}
		message.VisibilityTimeout = opts.visibilityTimeout
	}

	if tracker["pollingWaitSeconds"] {
		if err = checkPollingWaitSeconds(opts.pollingWaitSeconds); err != nil {
			return
		}
		message.PollingWaitSeconds = opts.pollingWaitSeconds
	}

	if tracker["loggingEnabled"] {
		message.LoggingEnabled = opts.loggingEnabled
	}

	_, err = send(p.cli, p.decoder, PUT, nil, &message, fmt.Sprintf("queues/%s?metaoverride=true", queueName), nil)
	return
}