summaryrefslogtreecommitdiffstats
path: root/contrib/libs/aws-sdk-cpp/aws-cpp-sdk-sqs/source/model/ReceiveMessageRequest.cpp
blob: 87ca22e7ced5a9274b4c81f9217bef92cd2cf225 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/**
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * SPDX-License-Identifier: Apache-2.0.
 */

#include <aws/sqs/model/ReceiveMessageRequest.h>
#include <aws/core/utils/StringUtils.h>
#include <aws/core/utils/memory/stl/AWSStringStream.h>

using namespace Aws::SQS::Model;
using namespace Aws::Utils;

ReceiveMessageRequest::ReceiveMessageRequest() : 
    m_queueUrlHasBeenSet(false),
    m_attributeNamesHasBeenSet(false),
    m_messageAttributeNamesHasBeenSet(false),
    m_maxNumberOfMessages(0),
    m_maxNumberOfMessagesHasBeenSet(false),
    m_visibilityTimeout(0),
    m_visibilityTimeoutHasBeenSet(false),
    m_waitTimeSeconds(0),
    m_waitTimeSecondsHasBeenSet(false),
    m_receiveRequestAttemptIdHasBeenSet(false)
{
}

Aws::String ReceiveMessageRequest::SerializePayload() const
{
  Aws::StringStream ss;
  ss << "Action=ReceiveMessage&";
  if(m_queueUrlHasBeenSet)
  {
    ss << "QueueUrl=" << StringUtils::URLEncode(m_queueUrl.c_str()) << "&";
  }

  if(m_attributeNamesHasBeenSet)
  {
    unsigned attributeNamesCount = 1;
    for(auto& item : m_attributeNames)
    {
      ss << "AttributeName." << attributeNamesCount << "="
          << StringUtils::URLEncode(QueueAttributeNameMapper::GetNameForQueueAttributeName(item).c_str()) << "&";
      attributeNamesCount++;
    }
  }

  if(m_messageAttributeNamesHasBeenSet)
  {
    unsigned messageAttributeNamesCount = 1;
    for(auto& item : m_messageAttributeNames)
    {
      ss << "MessageAttributeName." << messageAttributeNamesCount << "="
          << StringUtils::URLEncode(item.c_str()) << "&";
      messageAttributeNamesCount++;
    }
  }

  if(m_maxNumberOfMessagesHasBeenSet)
  {
    ss << "MaxNumberOfMessages=" << m_maxNumberOfMessages << "&";
  }

  if(m_visibilityTimeoutHasBeenSet)
  {
    ss << "VisibilityTimeout=" << m_visibilityTimeout << "&";
  }

  if(m_waitTimeSecondsHasBeenSet)
  {
    ss << "WaitTimeSeconds=" << m_waitTimeSeconds << "&";
  }

  if(m_receiveRequestAttemptIdHasBeenSet)
  {
    ss << "ReceiveRequestAttemptId=" << StringUtils::URLEncode(m_receiveRequestAttemptId.c_str()) << "&";
  }

  ss << "Version=2012-11-05";
  return ss.str();
}


void  ReceiveMessageRequest::DumpBodyToUrl(Aws::Http::URI& uri ) const
{
  uri.SetQueryString(SerializePayload());
}