Supports tag management APIs.

This commit is contained in:
sdk-team
2020-07-03 10:53:44 +08:00
parent 7fecdadace
commit 4b39c98f5a
29 changed files with 1040 additions and 3 deletions

View File

@@ -0,0 +1,91 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/ons/model/ListTagResourcesRequest.h>
using AlibabaCloud::Ons::Model::ListTagResourcesRequest;
ListTagResourcesRequest::ListTagResourcesRequest() :
RpcServiceRequest("ons", "2019-02-14", "ListTagResources")
{
setMethod(HttpRequest::Method::Post);
}
ListTagResourcesRequest::~ListTagResourcesRequest()
{}
std::vector<std::string> ListTagResourcesRequest::getResourceId()const
{
return resourceId_;
}
void ListTagResourcesRequest::setResourceId(const std::vector<std::string>& resourceId)
{
resourceId_ = resourceId;
for(int dep1 = 0; dep1!= resourceId.size(); dep1++) {
setParameter("ResourceId."+ std::to_string(dep1), resourceId.at(dep1));
}
}
std::string ListTagResourcesRequest::getResourceType()const
{
return resourceType_;
}
void ListTagResourcesRequest::setResourceType(const std::string& resourceType)
{
resourceType_ = resourceType;
setParameter("ResourceType", resourceType);
}
std::string ListTagResourcesRequest::getInstanceId()const
{
return instanceId_;
}
void ListTagResourcesRequest::setInstanceId(const std::string& instanceId)
{
instanceId_ = instanceId;
setParameter("InstanceId", instanceId);
}
std::string ListTagResourcesRequest::getNextToken()const
{
return nextToken_;
}
void ListTagResourcesRequest::setNextToken(const std::string& nextToken)
{
nextToken_ = nextToken;
setParameter("NextToken", nextToken);
}
std::vector<ListTagResourcesRequest::Tag> ListTagResourcesRequest::getTag()const
{
return tag_;
}
void ListTagResourcesRequest::setTag(const std::vector<Tag>& tag)
{
tag_ = tag;
for(int dep1 = 0; dep1!= tag.size(); dep1++) {
auto tagObj = tag.at(dep1);
std::string tagObjStr = "Tag." + std::to_string(dep1 + 1);
setParameter(tagObjStr + ".Value", tagObj.value);
setParameter(tagObjStr + ".Key", tagObj.key);
}
}

View File

@@ -0,0 +1,72 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/ons/model/ListTagResourcesResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Ons;
using namespace AlibabaCloud::Ons::Model;
ListTagResourcesResult::ListTagResourcesResult() :
ServiceResult()
{}
ListTagResourcesResult::ListTagResourcesResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
ListTagResourcesResult::~ListTagResourcesResult()
{}
void ListTagResourcesResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto allTagResourcesNode = value["TagResources"]["TagResource"];
for (auto valueTagResourcesTagResource : allTagResourcesNode)
{
TagResource tagResourcesObject;
if(!valueTagResourcesTagResource["TagKey"].isNull())
tagResourcesObject.tagKey = valueTagResourcesTagResource["TagKey"].asString();
if(!valueTagResourcesTagResource["TagValue"].isNull())
tagResourcesObject.tagValue = valueTagResourcesTagResource["TagValue"].asString();
if(!valueTagResourcesTagResource["ResourceType"].isNull())
tagResourcesObject.resourceType = valueTagResourcesTagResource["ResourceType"].asString();
if(!valueTagResourcesTagResource["ResourceId"].isNull())
tagResourcesObject.resourceId = valueTagResourcesTagResource["ResourceId"].asString();
if(!valueTagResourcesTagResource["InstanceId"].isNull())
tagResourcesObject.instanceId = valueTagResourcesTagResource["InstanceId"].asString();
tagResources_.push_back(tagResourcesObject);
}
if(!value["NextToken"].isNull())
nextToken_ = value["NextToken"].asString();
}
std::string ListTagResourcesResult::getNextToken()const
{
return nextToken_;
}
std::vector<ListTagResourcesResult::TagResource> ListTagResourcesResult::getTagResources()const
{
return tagResources_;
}

View File

@@ -60,3 +60,19 @@ void OnsGroupListRequest::setGroupType(const std::string& groupType)
setParameter("GroupType", groupType);
}
std::vector<OnsGroupListRequest::Tag> OnsGroupListRequest::getTag()const
{
return tag_;
}
void OnsGroupListRequest::setTag(const std::vector<Tag>& tag)
{
tag_ = tag;
for(int dep1 = 0; dep1!= tag.size(); dep1++) {
auto tagObj = tag.at(dep1);
std::string tagObjStr = "Tag." + std::to_string(dep1 + 1);
setParameter(tagObjStr + ".Value", tagObj.value);
setParameter(tagObjStr + ".Key", tagObj.key);
}
}

View File

@@ -59,6 +59,16 @@ void OnsGroupListResult::parse(const std::string &payload)
dataObject.createTime = std::stol(valueDataSubscribeInfoDo["CreateTime"].asString());
if(!valueDataSubscribeInfoDo["GroupType"].isNull())
dataObject.groupType = valueDataSubscribeInfoDo["GroupType"].asString();
auto allTagsNode = allDataNode["Tags"]["Tag"];
for (auto allDataNodeTagsTag : allTagsNode)
{
SubscribeInfoDo::Tag tagsObject;
if(!allDataNodeTagsTag["Key"].isNull())
tagsObject.key = allDataNodeTagsTag["Key"].asString();
if(!allDataNodeTagsTag["Value"].isNull())
tagsObject.value = allDataNodeTagsTag["Value"].asString();
dataObject.tags.push_back(tagsObject);
}
data_.push_back(dataObject);
}
if(!value["HelpUrl"].isNull())

View File

@@ -27,3 +27,19 @@ OnsInstanceInServiceListRequest::OnsInstanceInServiceListRequest() :
OnsInstanceInServiceListRequest::~OnsInstanceInServiceListRequest()
{}
std::vector<OnsInstanceInServiceListRequest::Tag> OnsInstanceInServiceListRequest::getTag()const
{
return tag_;
}
void OnsInstanceInServiceListRequest::setTag(const std::vector<Tag>& tag)
{
tag_ = tag;
for(int dep1 = 0; dep1!= tag.size(); dep1++) {
auto tagObj = tag.at(dep1);
std::string tagObjStr = "Tag." + std::to_string(dep1 + 1);
setParameter(tagObjStr + ".Value", tagObj.value);
setParameter(tagObjStr + ".Key", tagObj.key);
}
}

View File

@@ -55,6 +55,16 @@ void OnsInstanceInServiceListResult::parse(const std::string &payload)
dataObject.instanceName = valueDataInstanceVO["InstanceName"].asString();
if(!valueDataInstanceVO["IndependentNaming"].isNull())
dataObject.independentNaming = valueDataInstanceVO["IndependentNaming"].asString() == "true";
auto allTagsNode = allDataNode["Tags"]["Tag"];
for (auto allDataNodeTagsTag : allTagsNode)
{
InstanceVO::Tag tagsObject;
if(!allDataNodeTagsTag["Key"].isNull())
tagsObject.key = allDataNodeTagsTag["Key"].asString();
if(!allDataNodeTagsTag["Value"].isNull())
tagsObject.value = allDataNodeTagsTag["Value"].asString();
dataObject.tags.push_back(tagsObject);
}
data_.push_back(dataObject);
}
if(!value["HelpUrl"].isNull())

View File

@@ -49,3 +49,19 @@ void OnsTopicListRequest::setTopic(const std::string& topic)
setParameter("Topic", topic);
}
std::vector<OnsTopicListRequest::Tag> OnsTopicListRequest::getTag()const
{
return tag_;
}
void OnsTopicListRequest::setTag(const std::vector<Tag>& tag)
{
tag_ = tag;
for(int dep1 = 0; dep1!= tag.size(); dep1++) {
auto tagObj = tag.at(dep1);
std::string tagObjStr = "Tag." + std::to_string(dep1 + 1);
setParameter(tagObjStr + ".Value", tagObj.value);
setParameter(tagObjStr + ".Key", tagObj.key);
}
}

View File

@@ -61,6 +61,16 @@ void OnsTopicListResult::parse(const std::string &payload)
dataObject.instanceId = valueDataPublishInfoDo["InstanceId"].asString();
if(!valueDataPublishInfoDo["IndependentNaming"].isNull())
dataObject.independentNaming = valueDataPublishInfoDo["IndependentNaming"].asString() == "true";
auto allTagsNode = allDataNode["Tags"]["Tag"];
for (auto allDataNodeTagsTag : allTagsNode)
{
PublishInfoDo::Tag tagsObject;
if(!allDataNodeTagsTag["Key"].isNull())
tagsObject.key = allDataNodeTagsTag["Key"].asString();
if(!allDataNodeTagsTag["Value"].isNull())
tagsObject.value = allDataNodeTagsTag["Value"].asString();
dataObject.tags.push_back(tagsObject);
}
data_.push_back(dataObject);
}
if(!value["HelpUrl"].isNull())

View File

@@ -0,0 +1,80 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/ons/model/TagResourcesRequest.h>
using AlibabaCloud::Ons::Model::TagResourcesRequest;
TagResourcesRequest::TagResourcesRequest() :
RpcServiceRequest("ons", "2019-02-14", "TagResources")
{
setMethod(HttpRequest::Method::Post);
}
TagResourcesRequest::~TagResourcesRequest()
{}
std::vector<std::string> TagResourcesRequest::getResourceId()const
{
return resourceId_;
}
void TagResourcesRequest::setResourceId(const std::vector<std::string>& resourceId)
{
resourceId_ = resourceId;
for(int dep1 = 0; dep1!= resourceId.size(); dep1++) {
setParameter("ResourceId."+ std::to_string(dep1), resourceId.at(dep1));
}
}
std::string TagResourcesRequest::getResourceType()const
{
return resourceType_;
}
void TagResourcesRequest::setResourceType(const std::string& resourceType)
{
resourceType_ = resourceType;
setParameter("ResourceType", resourceType);
}
std::string TagResourcesRequest::getInstanceId()const
{
return instanceId_;
}
void TagResourcesRequest::setInstanceId(const std::string& instanceId)
{
instanceId_ = instanceId;
setParameter("InstanceId", instanceId);
}
std::vector<TagResourcesRequest::Tag> TagResourcesRequest::getTag()const
{
return tag_;
}
void TagResourcesRequest::setTag(const std::vector<Tag>& tag)
{
tag_ = tag;
for(int dep1 = 0; dep1!= tag.size(); dep1++) {
auto tagObj = tag.at(dep1);
std::string tagObjStr = "Tag." + std::to_string(dep1 + 1);
setParameter(tagObjStr + ".Value", tagObj.value);
setParameter(tagObjStr + ".Key", tagObj.key);
}
}

View File

@@ -0,0 +1,44 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/ons/model/TagResourcesResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Ons;
using namespace AlibabaCloud::Ons::Model;
TagResourcesResult::TagResourcesResult() :
ServiceResult()
{}
TagResourcesResult::TagResourcesResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
TagResourcesResult::~TagResourcesResult()
{}
void TagResourcesResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
}

View File

@@ -0,0 +1,88 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/ons/model/UntagResourcesRequest.h>
using AlibabaCloud::Ons::Model::UntagResourcesRequest;
UntagResourcesRequest::UntagResourcesRequest() :
RpcServiceRequest("ons", "2019-02-14", "UntagResources")
{
setMethod(HttpRequest::Method::Post);
}
UntagResourcesRequest::~UntagResourcesRequest()
{}
bool UntagResourcesRequest::getAll()const
{
return all_;
}
void UntagResourcesRequest::setAll(bool all)
{
all_ = all;
setParameter("All", all ? "true" : "false");
}
std::vector<std::string> UntagResourcesRequest::getResourceId()const
{
return resourceId_;
}
void UntagResourcesRequest::setResourceId(const std::vector<std::string>& resourceId)
{
resourceId_ = resourceId;
for(int dep1 = 0; dep1!= resourceId.size(); dep1++) {
setParameter("ResourceId."+ std::to_string(dep1), resourceId.at(dep1));
}
}
std::string UntagResourcesRequest::getResourceType()const
{
return resourceType_;
}
void UntagResourcesRequest::setResourceType(const std::string& resourceType)
{
resourceType_ = resourceType;
setParameter("ResourceType", resourceType);
}
std::string UntagResourcesRequest::getInstanceId()const
{
return instanceId_;
}
void UntagResourcesRequest::setInstanceId(const std::string& instanceId)
{
instanceId_ = instanceId;
setParameter("InstanceId", instanceId);
}
std::vector<std::string> UntagResourcesRequest::getTagKey()const
{
return tagKey_;
}
void UntagResourcesRequest::setTagKey(const std::vector<std::string>& tagKey)
{
tagKey_ = tagKey;
for(int dep1 = 0; dep1!= tagKey.size(); dep1++) {
setParameter("TagKey."+ std::to_string(dep1), tagKey.at(dep1));
}
}

View File

@@ -0,0 +1,44 @@
/*
* Copyright 2009-2017 Alibaba Cloud All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <alibabacloud/ons/model/UntagResourcesResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Ons;
using namespace AlibabaCloud::Ons::Model;
UntagResourcesResult::UntagResourcesResult() :
ServiceResult()
{}
UntagResourcesResult::UntagResourcesResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
UntagResourcesResult::~UntagResourcesResult()
{}
void UntagResourcesResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
}