DescribeCasterConfigResult.cc 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. /*
  2. * Copyright 2009-2017 Alibaba Cloud All rights reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #include <alibabacloud/live/model/DescribeCasterConfigResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Live;
  19. using namespace AlibabaCloud::Live::Model;
  20. DescribeCasterConfigResult::DescribeCasterConfigResult() :
  21. ServiceResult()
  22. {}
  23. DescribeCasterConfigResult::DescribeCasterConfigResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. DescribeCasterConfigResult::~DescribeCasterConfigResult()
  29. {}
  30. void DescribeCasterConfigResult::parse(const std::string &payload)
  31. {
  32. Json::Reader reader;
  33. Json::Value value;
  34. reader.parse(payload, value);
  35. setRequestId(value["RequestId"].asString());
  36. auto allSyncGroupsConfigNode = value["SyncGroupsConfig"]["SyncGroup"];
  37. for (auto valueSyncGroupsConfigSyncGroup : allSyncGroupsConfigNode)
  38. {
  39. SyncGroup syncGroupsConfigObject;
  40. if(!valueSyncGroupsConfigSyncGroup["HostResourceId"].isNull())
  41. syncGroupsConfigObject.hostResourceId = valueSyncGroupsConfigSyncGroup["HostResourceId"].asString();
  42. if(!valueSyncGroupsConfigSyncGroup["Mode"].isNull())
  43. syncGroupsConfigObject.mode = std::stoi(valueSyncGroupsConfigSyncGroup["Mode"].asString());
  44. auto allResourceIds = value["ResourceIds"]["ResourceId"];
  45. for (auto value : allResourceIds)
  46. syncGroupsConfigObject.resourceIds.push_back(value.asString());
  47. syncGroupsConfig_.push_back(syncGroupsConfigObject);
  48. }
  49. auto transcodeConfigNode = value["TranscodeConfig"];
  50. if(!transcodeConfigNode["CasterTemplate"].isNull())
  51. transcodeConfig_.casterTemplate = transcodeConfigNode["CasterTemplate"].asString();
  52. auto allLiveTemplateIds = transcodeConfigNode["LiveTemplateIds"]["LocationId"];
  53. for (auto value : allLiveTemplateIds)
  54. transcodeConfig_.liveTemplateIds.push_back(value.asString());
  55. auto recordConfigNode = value["RecordConfig"];
  56. if(!recordConfigNode["OssEndpoint"].isNull())
  57. recordConfig_.ossEndpoint = recordConfigNode["OssEndpoint"].asString();
  58. if(!recordConfigNode["OssBucket"].isNull())
  59. recordConfig_.ossBucket = recordConfigNode["OssBucket"].asString();
  60. if(!recordConfigNode["OnDemand"].isNull())
  61. recordConfig_.onDemand = std::stoi(recordConfigNode["OnDemand"].asString());
  62. auto allRecordFormatNode = recordConfigNode["RecordFormat"]["RecordFormatItem"];
  63. for (auto recordConfigNodeRecordFormatRecordFormatItem : allRecordFormatNode)
  64. {
  65. RecordConfig::RecordFormatItem recordFormatItemObject;
  66. if(!recordConfigNodeRecordFormatRecordFormatItem["CycleDuration"].isNull())
  67. recordFormatItemObject.cycleDuration = std::stoi(recordConfigNodeRecordFormatRecordFormatItem["CycleDuration"].asString());
  68. if(!recordConfigNodeRecordFormatRecordFormatItem["SliceOssObjectPrefix"].isNull())
  69. recordFormatItemObject.sliceOssObjectPrefix = recordConfigNodeRecordFormatRecordFormatItem["SliceOssObjectPrefix"].asString();
  70. if(!recordConfigNodeRecordFormatRecordFormatItem["OssObjectPrefix"].isNull())
  71. recordFormatItemObject.ossObjectPrefix = recordConfigNodeRecordFormatRecordFormatItem["OssObjectPrefix"].asString();
  72. if(!recordConfigNodeRecordFormatRecordFormatItem["Format"].isNull())
  73. recordFormatItemObject.format = recordConfigNodeRecordFormatRecordFormatItem["Format"].asString();
  74. recordConfig_.recordFormat.push_back(recordFormatItemObject);
  75. }
  76. if(!value["Delay"].isNull())
  77. delay_ = std::stof(value["Delay"].asString());
  78. if(!value["UrgentLiveStreamUrl"].isNull())
  79. urgentLiveStreamUrl_ = value["UrgentLiveStreamUrl"].asString();
  80. if(!value["UrgentMaterialId"].isNull())
  81. urgentMaterialId_ = value["UrgentMaterialId"].asString();
  82. if(!value["CallbackUrl"].isNull())
  83. callbackUrl_ = value["CallbackUrl"].asString();
  84. if(!value["ProgramName"].isNull())
  85. programName_ = value["ProgramName"].asString();
  86. if(!value["CasterName"].isNull())
  87. casterName_ = value["CasterName"].asString();
  88. if(!value["CasterId"].isNull())
  89. casterId_ = value["CasterId"].asString();
  90. if(!value["ProgramEffect"].isNull())
  91. programEffect_ = std::stoi(value["ProgramEffect"].asString());
  92. if(!value["ChannelEnable"].isNull())
  93. channelEnable_ = std::stoi(value["ChannelEnable"].asString());
  94. if(!value["DomainName"].isNull())
  95. domainName_ = value["DomainName"].asString();
  96. if(!value["SideOutputUrlList"].isNull())
  97. sideOutputUrlList_ = value["SideOutputUrlList"].asString();
  98. if(!value["SideOutputUrl"].isNull())
  99. sideOutputUrl_ = value["SideOutputUrl"].asString();
  100. }
  101. int DescribeCasterConfigResult::getChannelEnable()const
  102. {
  103. return channelEnable_;
  104. }
  105. std::string DescribeCasterConfigResult::getDomainName()const
  106. {
  107. return domainName_;
  108. }
  109. std::string DescribeCasterConfigResult::getUrgentMaterialId()const
  110. {
  111. return urgentMaterialId_;
  112. }
  113. std::string DescribeCasterConfigResult::getSideOutputUrlList()const
  114. {
  115. return sideOutputUrlList_;
  116. }
  117. DescribeCasterConfigResult::TranscodeConfig DescribeCasterConfigResult::getTranscodeConfig()const
  118. {
  119. return transcodeConfig_;
  120. }
  121. std::string DescribeCasterConfigResult::getProgramName()const
  122. {
  123. return programName_;
  124. }
  125. float DescribeCasterConfigResult::getDelay()const
  126. {
  127. return delay_;
  128. }
  129. std::string DescribeCasterConfigResult::getCallbackUrl()const
  130. {
  131. return callbackUrl_;
  132. }
  133. std::string DescribeCasterConfigResult::getSideOutputUrl()const
  134. {
  135. return sideOutputUrl_;
  136. }
  137. std::string DescribeCasterConfigResult::getCasterName()const
  138. {
  139. return casterName_;
  140. }
  141. int DescribeCasterConfigResult::getProgramEffect()const
  142. {
  143. return programEffect_;
  144. }
  145. std::vector<DescribeCasterConfigResult::SyncGroup> DescribeCasterConfigResult::getSyncGroupsConfig()const
  146. {
  147. return syncGroupsConfig_;
  148. }
  149. std::string DescribeCasterConfigResult::getCasterId()const
  150. {
  151. return casterId_;
  152. }
  153. DescribeCasterConfigResult::RecordConfig DescribeCasterConfigResult::getRecordConfig()const
  154. {
  155. return recordConfig_;
  156. }
  157. std::string DescribeCasterConfigResult::getUrgentLiveStreamUrl()const
  158. {
  159. return urgentLiveStreamUrl_;
  160. }