AWSMetricsServiceApi.cpp 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include <AWSMetricsServiceApi.h>
  9. #include<AWSMetricsConstant.h>
  10. #include <AWSCoreBus.h>
  11. namespace AWSMetrics
  12. {
  13. namespace ServiceAPI
  14. {
  15. bool PostMetricsEventsResponseEntry::OnJsonKey(const char* key, AWSCore::JsonReader& reader)
  16. {
  17. if (strcmp(key, AwsMetricsPostMetricsEventsResponseEntryKeyErrorCode) == 0)
  18. {
  19. return reader.Accept(m_errorCode);
  20. }
  21. if (strcmp(key, AwsMetricsPostMetricsEventsResponseEntryKeyResult) == 0)
  22. {
  23. return reader.Accept(m_result);
  24. }
  25. return reader.Ignore();
  26. }
  27. bool PostMetricsEventsResponse::OnJsonKey(const char* key, AWSCore::JsonReader& reader)
  28. {
  29. if (strcmp(key, AwsMetricsPostMetricsEventsResponseKeyFailedRecordCount) == 0)
  30. {
  31. return reader.Accept(m_failedRecordCount);
  32. }
  33. if (strcmp(key, AwsMetricsPostMetricsEventsResponseKeyEvents) == 0)
  34. {
  35. return reader.Accept(m_responseEntries);
  36. }
  37. if (strcmp(key, AwsMetricsPostMetricsEventsResponseKeyTotal) == 0)
  38. {
  39. return reader.Accept(m_total);
  40. }
  41. return reader.Ignore();
  42. }
  43. bool PostMetricsEventsError::OnJsonKey(const char* key, AWSCore::JsonReader& reader)
  44. {
  45. if (strcmp(key, AwsMetricsPostMetricsEventsErrorKeyMessage) == 0)
  46. {
  47. return reader.Accept(message);
  48. }
  49. if (strcmp(key, AwsMetricsPostMetricsEventsErrorKeyType) == 0)
  50. {
  51. return reader.Accept(type);
  52. }
  53. return reader.Ignore();
  54. }
  55. // Generated request parameters
  56. bool PostMetricsEventsRequest::Parameters::BuildRequest(AWSCore::RequestBuilder& request)
  57. {
  58. bool buildResult = true;
  59. buildResult = buildResult && request.WriteJsonBodyParameter(*this);
  60. return buildResult;
  61. }
  62. bool PostMetricsEventsRequest::Parameters::WriteJson(AWSCore::JsonWriter& writer) const
  63. {
  64. bool writeResult = true;
  65. writeResult = writeResult && writer.StartObject();
  66. writeResult = writeResult && writer.Key(AwsMetricsPostMetricsEventsRequestParameterKeyEvents);
  67. writeResult = writeResult && m_metricsQueue.SerializeToJson(writer);
  68. writeResult = writeResult && writer.EndObject();
  69. return writeResult;
  70. }
  71. }
  72. }