func createQueue(svc *sqs.SQS, queueName string) { params := &sqs.CreateQueueInput{ QueueName: &queueName, } _, err := svc.CreateQueue(params) if err != nil { log.Fatal(err) } }
func createQueue(sqsInstance *sqs.SQS, queueName string) (*string, error) { createQueueOutput, err := sqsInstance.CreateQueue(&sqs.CreateQueueInput{QueueName: &queueName}) if err != nil { return nil, err } return createQueueOutput.QueueURL, nil }
func createQueue(svc *sqs.SQS, queueName string) (string, error) { params := &sqs.CreateQueueInput{ QueueName: aws.String(queueName), // Required } resp, err := svc.CreateQueue(params) if err != nil { return "", err } return *resp.QueueUrl, nil }
func createDefaultQueue(s *sqs.SQS, queueName string, attrs map[string]string) *string { queueAttrs := map[string]*string{ cq.AttrVisibilityTimeout: aws.String("10"), cq.AttrDelaySeconds: aws.String("0"), cq.AttrMaximumMessageSize: aws.String("123456"), cq.AttrMessageRetentionPeriod: aws.String("300"), cq.AttrReceiveMessageWaitTimeSeconds: aws.String("15"), } for k, v := range attrs { queueAttrs[k] = aws.String(v) } resp, err := s.CreateQueue(&sqs.CreateQueueInput{ QueueName: &queueName, Attributes: queueAttrs, }) So(err, ShouldBeNil) So(resp.QueueUrl, ShouldNotBeNil) So(*resp.QueueUrl, ShouldContainSubstring, "/"+queueName) return resp.QueueUrl }