Sdk version release.
This commit is contained in:
94
ddosdiversion/CMakeLists.txt
Normal file
94
ddosdiversion/CMakeLists.txt
Normal file
@@ -0,0 +1,94 @@
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
set(public_header_dir ${CMAKE_CURRENT_SOURCE_DIR}/../include)
|
||||
|
||||
set(ddosdiversion_public_header
|
||||
include/alibabacloud/ddosdiversion/DdosDiversionClient.h
|
||||
include/alibabacloud/ddosdiversion/DdosDiversionExport.h )
|
||||
|
||||
set(ddosdiversion_public_header_model
|
||||
include/alibabacloud/ddosdiversion/model/ConfigNetStatusRequest.h
|
||||
include/alibabacloud/ddosdiversion/model/ConfigNetStatusResult.h
|
||||
include/alibabacloud/ddosdiversion/model/ListInstanceRequest.h
|
||||
include/alibabacloud/ddosdiversion/model/ListInstanceResult.h
|
||||
include/alibabacloud/ddosdiversion/model/QueryNetListRequest.h
|
||||
include/alibabacloud/ddosdiversion/model/QueryNetListResult.h )
|
||||
|
||||
set(ddosdiversion_src
|
||||
src/DdosDiversionClient.cc
|
||||
src/model/ConfigNetStatusRequest.cc
|
||||
src/model/ConfigNetStatusResult.cc
|
||||
src/model/ListInstanceRequest.cc
|
||||
src/model/ListInstanceResult.cc
|
||||
src/model/QueryNetListRequest.cc
|
||||
src/model/QueryNetListResult.cc )
|
||||
|
||||
add_library(ddosdiversion ${LIB_TYPE}
|
||||
${ddosdiversion_public_header}
|
||||
${ddosdiversion_public_header_model}
|
||||
${ddosdiversion_src})
|
||||
|
||||
set_target_properties(ddosdiversion
|
||||
PROPERTIES
|
||||
LINKER_LANGUAGE CXX
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
OUTPUT_NAME ${TARGET_OUTPUT_NAME_PREFIX}ddosdiversion
|
||||
)
|
||||
|
||||
if(${LIB_TYPE} STREQUAL "SHARED")
|
||||
set_target_properties(ddosdiversion
|
||||
PROPERTIES
|
||||
DEFINE_SYMBOL ALIBABACLOUD_DDOSDIVERSION_LIBRARY)
|
||||
endif()
|
||||
|
||||
target_include_directories(ddosdiversion
|
||||
PRIVATE include
|
||||
${CMAKE_SOURCE_DIR}/core/include
|
||||
)
|
||||
target_link_libraries(ddosdiversion
|
||||
core)
|
||||
|
||||
if(CMAKE_HOST_WIN32)
|
||||
ExternalProject_Get_Property(jsoncpp INSTALL_DIR)
|
||||
set(jsoncpp_install_dir ${INSTALL_DIR})
|
||||
add_dependencies(ddosdiversion
|
||||
jsoncpp)
|
||||
target_include_directories(ddosdiversion
|
||||
PRIVATE ${jsoncpp_install_dir}/include)
|
||||
target_link_libraries(ddosdiversion
|
||||
${jsoncpp_install_dir}/lib/jsoncpp.lib)
|
||||
set_target_properties(ddosdiversion
|
||||
PROPERTIES
|
||||
COMPILE_OPTIONS "/bigobj")
|
||||
else()
|
||||
target_include_directories(ddosdiversion
|
||||
PRIVATE /usr/include/jsoncpp)
|
||||
target_link_libraries(ddosdiversion
|
||||
jsoncpp)
|
||||
endif()
|
||||
|
||||
install(FILES ${ddosdiversion_public_header}
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/ddosdiversion)
|
||||
install(FILES ${ddosdiversion_public_header_model}
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/ddosdiversion/model)
|
||||
install(TARGETS ddosdiversion
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
)
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef ALIBABACLOUD_DDOSDIVERSION_DDOSDIVERSIONCLIENT_H_
|
||||
#define ALIBABACLOUD_DDOSDIVERSION_DDOSDIVERSIONCLIENT_H_
|
||||
|
||||
#include <future>
|
||||
#include <alibabacloud/core/AsyncCallerContext.h>
|
||||
#include <alibabacloud/core/EndpointProvider.h>
|
||||
#include <alibabacloud/core/RpcServiceClient.h>
|
||||
#include "DdosDiversionExport.h"
|
||||
#include "model/ConfigNetStatusRequest.h"
|
||||
#include "model/ConfigNetStatusResult.h"
|
||||
#include "model/ListInstanceRequest.h"
|
||||
#include "model/ListInstanceResult.h"
|
||||
#include "model/QueryNetListRequest.h"
|
||||
#include "model/QueryNetListResult.h"
|
||||
|
||||
|
||||
namespace AlibabaCloud
|
||||
{
|
||||
namespace DdosDiversion
|
||||
{
|
||||
class ALIBABACLOUD_DDOSDIVERSION_EXPORT DdosDiversionClient : public RpcServiceClient
|
||||
{
|
||||
public:
|
||||
typedef Outcome<Error, Model::ConfigNetStatusResult> ConfigNetStatusOutcome;
|
||||
typedef std::future<ConfigNetStatusOutcome> ConfigNetStatusOutcomeCallable;
|
||||
typedef std::function<void(const DdosDiversionClient*, const Model::ConfigNetStatusRequest&, const ConfigNetStatusOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ConfigNetStatusAsyncHandler;
|
||||
typedef Outcome<Error, Model::ListInstanceResult> ListInstanceOutcome;
|
||||
typedef std::future<ListInstanceOutcome> ListInstanceOutcomeCallable;
|
||||
typedef std::function<void(const DdosDiversionClient*, const Model::ListInstanceRequest&, const ListInstanceOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ListInstanceAsyncHandler;
|
||||
typedef Outcome<Error, Model::QueryNetListResult> QueryNetListOutcome;
|
||||
typedef std::future<QueryNetListOutcome> QueryNetListOutcomeCallable;
|
||||
typedef std::function<void(const DdosDiversionClient*, const Model::QueryNetListRequest&, const QueryNetListOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> QueryNetListAsyncHandler;
|
||||
|
||||
DdosDiversionClient(const Credentials &credentials, const ClientConfiguration &configuration);
|
||||
DdosDiversionClient(const std::shared_ptr<CredentialsProvider> &credentialsProvider, const ClientConfiguration &configuration);
|
||||
DdosDiversionClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration);
|
||||
~DdosDiversionClient();
|
||||
ConfigNetStatusOutcome configNetStatus(const Model::ConfigNetStatusRequest &request)const;
|
||||
void configNetStatusAsync(const Model::ConfigNetStatusRequest& request, const ConfigNetStatusAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
ConfigNetStatusOutcomeCallable configNetStatusCallable(const Model::ConfigNetStatusRequest& request) const;
|
||||
ListInstanceOutcome listInstance(const Model::ListInstanceRequest &request)const;
|
||||
void listInstanceAsync(const Model::ListInstanceRequest& request, const ListInstanceAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
ListInstanceOutcomeCallable listInstanceCallable(const Model::ListInstanceRequest& request) const;
|
||||
QueryNetListOutcome queryNetList(const Model::QueryNetListRequest &request)const;
|
||||
void queryNetListAsync(const Model::QueryNetListRequest& request, const QueryNetListAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
QueryNetListOutcomeCallable queryNetListCallable(const Model::QueryNetListRequest& request) const;
|
||||
|
||||
private:
|
||||
std::shared_ptr<EndpointProvider> endpointProvider_;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // !ALIBABACLOUD_DDOSDIVERSION_DDOSDIVERSIONCLIENT_H_
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef ALIBABACLOUD_DDOSDIVERSION_DDOSDIVERSIONEXPORT_H_
|
||||
#define ALIBABACLOUD_DDOSDIVERSION_DDOSDIVERSIONEXPORT_H_
|
||||
|
||||
#include <alibabacloud/core/Global.h>
|
||||
|
||||
#if defined(ALIBABACLOUD_SHARED)
|
||||
# if defined(ALIBABACLOUD_DDOSDIVERSION_LIBRARY)
|
||||
# define ALIBABACLOUD_DDOSDIVERSION_EXPORT ALIBABACLOUD_DECL_EXPORT
|
||||
# else
|
||||
# define ALIBABACLOUD_DDOSDIVERSION_EXPORT ALIBABACLOUD_DECL_IMPORT
|
||||
# endif
|
||||
#else
|
||||
# define ALIBABACLOUD_DDOSDIVERSION_EXPORT
|
||||
#endif
|
||||
|
||||
#endif // !ALIBABACLOUD_DDOSDIVERSION_DDOSDIVERSIONEXPORT_H_
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef ALIBABACLOUD_DDOSDIVERSION_MODEL_CONFIGNETSTATUSREQUEST_H_
|
||||
#define ALIBABACLOUD_DDOSDIVERSION_MODEL_CONFIGNETSTATUSREQUEST_H_
|
||||
|
||||
#include <alibabacloud/ddosdiversion/DdosDiversionExport.h>
|
||||
#include <alibabacloud/core/RpcServiceRequest.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
namespace AlibabaCloud {
|
||||
namespace DdosDiversion {
|
||||
namespace Model {
|
||||
class ALIBABACLOUD_DDOSDIVERSION_EXPORT ConfigNetStatusRequest : public RpcServiceRequest {
|
||||
public:
|
||||
ConfigNetStatusRequest();
|
||||
~ConfigNetStatusRequest();
|
||||
std::vector<std::string> getRegions() const;
|
||||
void setRegions(const std::vector<std::string> ®ions);
|
||||
std::vector<std::string> getSubNets() const;
|
||||
void setSubNets(const std::vector<std::string> &subNets);
|
||||
std::string getNet() const;
|
||||
void setNet(const std::string &net);
|
||||
std::string getSaleId() const;
|
||||
void setSaleId(const std::string &saleId);
|
||||
std::string getStatus() const;
|
||||
void setStatus(const std::string &status);
|
||||
|
||||
private:
|
||||
std::vector<std::string> regions_;
|
||||
std::vector<std::string> subNets_;
|
||||
std::string net_;
|
||||
std::string saleId_;
|
||||
std::string status_;
|
||||
};
|
||||
} // namespace Model
|
||||
} // namespace DdosDiversion
|
||||
} // namespace AlibabaCloud
|
||||
#endif // !ALIBABACLOUD_DDOSDIVERSION_MODEL_CONFIGNETSTATUSREQUEST_H_
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef ALIBABACLOUD_DDOSDIVERSION_MODEL_CONFIGNETSTATUSRESULT_H_
|
||||
#define ALIBABACLOUD_DDOSDIVERSION_MODEL_CONFIGNETSTATUSRESULT_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <alibabacloud/core/ServiceResult.h>
|
||||
#include <alibabacloud/ddosdiversion/DdosDiversionExport.h>
|
||||
|
||||
namespace AlibabaCloud
|
||||
{
|
||||
namespace DdosDiversion
|
||||
{
|
||||
namespace Model
|
||||
{
|
||||
class ALIBABACLOUD_DDOSDIVERSION_EXPORT ConfigNetStatusResult : public ServiceResult
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
ConfigNetStatusResult();
|
||||
explicit ConfigNetStatusResult(const std::string &payload);
|
||||
~ConfigNetStatusResult();
|
||||
std::string getMessage()const;
|
||||
long getCode()const;
|
||||
|
||||
protected:
|
||||
void parse(const std::string &payload);
|
||||
private:
|
||||
std::string message_;
|
||||
long code_;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // !ALIBABACLOUD_DDOSDIVERSION_MODEL_CONFIGNETSTATUSRESULT_H_
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef ALIBABACLOUD_DDOSDIVERSION_MODEL_LISTINSTANCEREQUEST_H_
|
||||
#define ALIBABACLOUD_DDOSDIVERSION_MODEL_LISTINSTANCEREQUEST_H_
|
||||
|
||||
#include <alibabacloud/ddosdiversion/DdosDiversionExport.h>
|
||||
#include <alibabacloud/core/RpcServiceRequest.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
namespace AlibabaCloud {
|
||||
namespace DdosDiversion {
|
||||
namespace Model {
|
||||
class ALIBABACLOUD_DDOSDIVERSION_EXPORT ListInstanceRequest : public RpcServiceRequest {
|
||||
public:
|
||||
ListInstanceRequest();
|
||||
~ListInstanceRequest();
|
||||
long getNum() const;
|
||||
void setNum(long num);
|
||||
std::string getSaleId() const;
|
||||
void setSaleId(const std::string &saleId);
|
||||
std::string getName() const;
|
||||
void setName(const std::string &name);
|
||||
long getPage() const;
|
||||
void setPage(long page);
|
||||
std::string getStatus() const;
|
||||
void setStatus(const std::string &status);
|
||||
|
||||
private:
|
||||
long num_;
|
||||
std::string saleId_;
|
||||
std::string name_;
|
||||
long page_;
|
||||
std::string status_;
|
||||
};
|
||||
} // namespace Model
|
||||
} // namespace DdosDiversion
|
||||
} // namespace AlibabaCloud
|
||||
#endif // !ALIBABACLOUD_DDOSDIVERSION_MODEL_LISTINSTANCEREQUEST_H_
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
#ifndef ALIBABACLOUD_DDOSDIVERSION_MODEL_LISTINSTANCERESULT_H_
|
||||
#define ALIBABACLOUD_DDOSDIVERSION_MODEL_LISTINSTANCERESULT_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <alibabacloud/core/ServiceResult.h>
|
||||
#include <alibabacloud/ddosdiversion/DdosDiversionExport.h>
|
||||
|
||||
namespace AlibabaCloud
|
||||
{
|
||||
namespace DdosDiversion
|
||||
{
|
||||
namespace Model
|
||||
{
|
||||
class ALIBABACLOUD_DDOSDIVERSION_EXPORT ListInstanceResult : public ServiceResult
|
||||
{
|
||||
public:
|
||||
struct DataItem
|
||||
{
|
||||
struct Data
|
||||
{
|
||||
struct Spec
|
||||
{
|
||||
std::string diversionType;
|
||||
std::string normalBandwidth;
|
||||
std::string mitigationAnalysisCapacity;
|
||||
std::string mitigationNums;
|
||||
std::string mitigationAnalysis;
|
||||
std::string mitigationCapacity;
|
||||
std::string coverage;
|
||||
std::string idcNumbers;
|
||||
std::string edition;
|
||||
std::string ipSubnetNums;
|
||||
std::string initialInstallation;
|
||||
std::string initialQty;
|
||||
};
|
||||
std::string status;
|
||||
std::string comment;
|
||||
std::string gmtCreate;
|
||||
std::string message;
|
||||
std::string instanceId;
|
||||
std::string userId;
|
||||
std::string gmtExpire;
|
||||
std::string gmtModify;
|
||||
std::string saleId;
|
||||
Spec spec;
|
||||
std::string name;
|
||||
};
|
||||
std::vector<DataItem::Data> instances;
|
||||
long total;
|
||||
long num;
|
||||
long page;
|
||||
};
|
||||
|
||||
|
||||
ListInstanceResult();
|
||||
explicit ListInstanceResult(const std::string &payload);
|
||||
~ListInstanceResult();
|
||||
std::string getMessage()const;
|
||||
std::vector<DataItem> getData()const;
|
||||
long getCode()const;
|
||||
|
||||
protected:
|
||||
void parse(const std::string &payload);
|
||||
private:
|
||||
std::string message_;
|
||||
std::vector<DataItem> data_;
|
||||
long code_;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // !ALIBABACLOUD_DDOSDIVERSION_MODEL_LISTINSTANCERESULT_H_
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef ALIBABACLOUD_DDOSDIVERSION_MODEL_QUERYNETLISTREQUEST_H_
|
||||
#define ALIBABACLOUD_DDOSDIVERSION_MODEL_QUERYNETLISTREQUEST_H_
|
||||
|
||||
#include <alibabacloud/ddosdiversion/DdosDiversionExport.h>
|
||||
#include <alibabacloud/core/RpcServiceRequest.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
namespace AlibabaCloud {
|
||||
namespace DdosDiversion {
|
||||
namespace Model {
|
||||
class ALIBABACLOUD_DDOSDIVERSION_EXPORT QueryNetListRequest : public RpcServiceRequest {
|
||||
public:
|
||||
QueryNetListRequest();
|
||||
~QueryNetListRequest();
|
||||
long getNum() const;
|
||||
void setNum(long num);
|
||||
std::string getMainNet() const;
|
||||
void setMainNet(const std::string &mainNet);
|
||||
std::string getMode() const;
|
||||
void setMode(const std::string &mode);
|
||||
std::string getNet() const;
|
||||
void setNet(const std::string &net);
|
||||
std::string getSaleId() const;
|
||||
void setSaleId(const std::string &saleId);
|
||||
long getPage() const;
|
||||
void setPage(long page);
|
||||
|
||||
private:
|
||||
long num_;
|
||||
std::string mainNet_;
|
||||
std::string mode_;
|
||||
std::string net_;
|
||||
std::string saleId_;
|
||||
long page_;
|
||||
};
|
||||
} // namespace Model
|
||||
} // namespace DdosDiversion
|
||||
} // namespace AlibabaCloud
|
||||
#endif // !ALIBABACLOUD_DDOSDIVERSION_MODEL_QUERYNETLISTREQUEST_H_
|
||||
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef ALIBABACLOUD_DDOSDIVERSION_MODEL_QUERYNETLISTRESULT_H_
|
||||
#define ALIBABACLOUD_DDOSDIVERSION_MODEL_QUERYNETLISTRESULT_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <alibabacloud/core/ServiceResult.h>
|
||||
#include <alibabacloud/ddosdiversion/DdosDiversionExport.h>
|
||||
|
||||
namespace AlibabaCloud
|
||||
{
|
||||
namespace DdosDiversion
|
||||
{
|
||||
namespace Model
|
||||
{
|
||||
class ALIBABACLOUD_DDOSDIVERSION_EXPORT QueryNetListResult : public ServiceResult
|
||||
{
|
||||
public:
|
||||
struct DataItem
|
||||
{
|
||||
struct Data
|
||||
{
|
||||
struct DDoSDefense
|
||||
{
|
||||
struct DjPolicy
|
||||
{
|
||||
std::string policyName;
|
||||
};
|
||||
struct CleanTh
|
||||
{
|
||||
int pps;
|
||||
int mbps;
|
||||
};
|
||||
struct HoleTh
|
||||
{
|
||||
int threshMbps;
|
||||
};
|
||||
CleanTh cleanTh;
|
||||
DjPolicy djPolicy;
|
||||
HoleTh holeTh;
|
||||
};
|
||||
struct DeclaredItem
|
||||
{
|
||||
std::string region;
|
||||
std::string declared;
|
||||
};
|
||||
DDoSDefense dDoSDefense;
|
||||
long netExtend;
|
||||
std::string upstreamType;
|
||||
std::string mode;
|
||||
std::string saleId;
|
||||
std::vector<Data::DeclaredItem> declared;
|
||||
std::string netMain;
|
||||
int declaredState;
|
||||
std::string gmtCreate;
|
||||
std::string userId;
|
||||
std::string gmtModify;
|
||||
long fwdEffect;
|
||||
std::string net;
|
||||
std::string netType;
|
||||
};
|
||||
std::vector<DataItem::Data> nets;
|
||||
long total;
|
||||
long num;
|
||||
long page;
|
||||
};
|
||||
|
||||
|
||||
QueryNetListResult();
|
||||
explicit QueryNetListResult(const std::string &payload);
|
||||
~QueryNetListResult();
|
||||
std::string getMessage()const;
|
||||
std::vector<DataItem> getData()const;
|
||||
long getCode()const;
|
||||
|
||||
protected:
|
||||
void parse(const std::string &payload);
|
||||
private:
|
||||
std::string message_;
|
||||
std::vector<DataItem> data_;
|
||||
long code_;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // !ALIBABACLOUD_DDOSDIVERSION_MODEL_QUERYNETLISTRESULT_H_
|
||||
161
ddosdiversion/src/DdosDiversionClient.cc
Normal file
161
ddosdiversion/src/DdosDiversionClient.cc
Normal file
@@ -0,0 +1,161 @@
|
||||
/*
|
||||
* 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/ddosdiversion/DdosDiversionClient.h>
|
||||
#include <alibabacloud/core/SimpleCredentialsProvider.h>
|
||||
|
||||
using namespace AlibabaCloud;
|
||||
using namespace AlibabaCloud::Location;
|
||||
using namespace AlibabaCloud::DdosDiversion;
|
||||
using namespace AlibabaCloud::DdosDiversion::Model;
|
||||
|
||||
namespace
|
||||
{
|
||||
const std::string SERVICE_NAME = "DdosDiversion";
|
||||
}
|
||||
|
||||
DdosDiversionClient::DdosDiversionClient(const Credentials &credentials, const ClientConfiguration &configuration) :
|
||||
RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(credentials), configuration)
|
||||
{
|
||||
auto locationClient = std::make_shared<LocationClient>(credentials, configuration);
|
||||
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "");
|
||||
}
|
||||
|
||||
DdosDiversionClient::DdosDiversionClient(const std::shared_ptr<CredentialsProvider>& credentialsProvider, const ClientConfiguration & configuration) :
|
||||
RpcServiceClient(SERVICE_NAME, credentialsProvider, configuration)
|
||||
{
|
||||
auto locationClient = std::make_shared<LocationClient>(credentialsProvider, configuration);
|
||||
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "");
|
||||
}
|
||||
|
||||
DdosDiversionClient::DdosDiversionClient(const std::string & accessKeyId, const std::string & accessKeySecret, const ClientConfiguration & configuration) :
|
||||
RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(accessKeyId, accessKeySecret), configuration)
|
||||
{
|
||||
auto locationClient = std::make_shared<LocationClient>(accessKeyId, accessKeySecret, configuration);
|
||||
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "");
|
||||
}
|
||||
|
||||
DdosDiversionClient::~DdosDiversionClient()
|
||||
{}
|
||||
|
||||
DdosDiversionClient::ConfigNetStatusOutcome DdosDiversionClient::configNetStatus(const ConfigNetStatusRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return ConfigNetStatusOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return ConfigNetStatusOutcome(ConfigNetStatusResult(outcome.result()));
|
||||
else
|
||||
return ConfigNetStatusOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void DdosDiversionClient::configNetStatusAsync(const ConfigNetStatusRequest& request, const ConfigNetStatusAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, configNetStatus(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
DdosDiversionClient::ConfigNetStatusOutcomeCallable DdosDiversionClient::configNetStatusCallable(const ConfigNetStatusRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<ConfigNetStatusOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->configNetStatus(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
DdosDiversionClient::ListInstanceOutcome DdosDiversionClient::listInstance(const ListInstanceRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return ListInstanceOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return ListInstanceOutcome(ListInstanceResult(outcome.result()));
|
||||
else
|
||||
return ListInstanceOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void DdosDiversionClient::listInstanceAsync(const ListInstanceRequest& request, const ListInstanceAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, listInstance(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
DdosDiversionClient::ListInstanceOutcomeCallable DdosDiversionClient::listInstanceCallable(const ListInstanceRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<ListInstanceOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->listInstance(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
DdosDiversionClient::QueryNetListOutcome DdosDiversionClient::queryNetList(const QueryNetListRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return QueryNetListOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return QueryNetListOutcome(QueryNetListResult(outcome.result()));
|
||||
else
|
||||
return QueryNetListOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void DdosDiversionClient::queryNetListAsync(const QueryNetListRequest& request, const QueryNetListAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, queryNetList(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
DdosDiversionClient::QueryNetListOutcomeCallable DdosDiversionClient::queryNetListCallable(const QueryNetListRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<QueryNetListOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->queryNetList(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
76
ddosdiversion/src/model/ConfigNetStatusRequest.cc
Normal file
76
ddosdiversion/src/model/ConfigNetStatusRequest.cc
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* 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/ddosdiversion/model/ConfigNetStatusRequest.h>
|
||||
|
||||
using AlibabaCloud::DdosDiversion::Model::ConfigNetStatusRequest;
|
||||
|
||||
ConfigNetStatusRequest::ConfigNetStatusRequest()
|
||||
: RpcServiceRequest("ddosdiversion", "2023-07-01", "ConfigNetStatus") {
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
ConfigNetStatusRequest::~ConfigNetStatusRequest() {}
|
||||
|
||||
std::vector<ConfigNetStatusRequest::std::string> ConfigNetStatusRequest::getRegions() const {
|
||||
return regions_;
|
||||
}
|
||||
|
||||
void ConfigNetStatusRequest::setRegions(const std::vector<ConfigNetStatusRequest::std::string> ®ions) {
|
||||
regions_ = regions;
|
||||
for(int dep1 = 0; dep1 != regions.size(); dep1++) {
|
||||
setParameter(std::string("Regions") + "." + std::to_string(dep1 + 1), regions[dep1]);
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<ConfigNetStatusRequest::std::string> ConfigNetStatusRequest::getSubNets() const {
|
||||
return subNets_;
|
||||
}
|
||||
|
||||
void ConfigNetStatusRequest::setSubNets(const std::vector<ConfigNetStatusRequest::std::string> &subNets) {
|
||||
subNets_ = subNets;
|
||||
for(int dep1 = 0; dep1 != subNets.size(); dep1++) {
|
||||
setParameter(std::string("SubNets") + "." + std::to_string(dep1 + 1), subNets[dep1]);
|
||||
}
|
||||
}
|
||||
|
||||
std::string ConfigNetStatusRequest::getNet() const {
|
||||
return net_;
|
||||
}
|
||||
|
||||
void ConfigNetStatusRequest::setNet(const std::string &net) {
|
||||
net_ = net;
|
||||
setParameter(std::string("Net"), net);
|
||||
}
|
||||
|
||||
std::string ConfigNetStatusRequest::getSaleId() const {
|
||||
return saleId_;
|
||||
}
|
||||
|
||||
void ConfigNetStatusRequest::setSaleId(const std::string &saleId) {
|
||||
saleId_ = saleId;
|
||||
setParameter(std::string("SaleId"), saleId);
|
||||
}
|
||||
|
||||
std::string ConfigNetStatusRequest::getStatus() const {
|
||||
return status_;
|
||||
}
|
||||
|
||||
void ConfigNetStatusRequest::setStatus(const std::string &status) {
|
||||
status_ = status;
|
||||
setParameter(std::string("Status"), status);
|
||||
}
|
||||
|
||||
58
ddosdiversion/src/model/ConfigNetStatusResult.cc
Normal file
58
ddosdiversion/src/model/ConfigNetStatusResult.cc
Normal file
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* 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/ddosdiversion/model/ConfigNetStatusResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::DdosDiversion;
|
||||
using namespace AlibabaCloud::DdosDiversion::Model;
|
||||
|
||||
ConfigNetStatusResult::ConfigNetStatusResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
ConfigNetStatusResult::ConfigNetStatusResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
ConfigNetStatusResult::~ConfigNetStatusResult()
|
||||
{}
|
||||
|
||||
void ConfigNetStatusResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
if(!value["Code"].isNull())
|
||||
code_ = std::stol(value["Code"].asString());
|
||||
if(!value["Message"].isNull())
|
||||
message_ = value["Message"].asString();
|
||||
|
||||
}
|
||||
|
||||
std::string ConfigNetStatusResult::getMessage()const
|
||||
{
|
||||
return message_;
|
||||
}
|
||||
|
||||
long ConfigNetStatusResult::getCode()const
|
||||
{
|
||||
return code_;
|
||||
}
|
||||
|
||||
72
ddosdiversion/src/model/ListInstanceRequest.cc
Normal file
72
ddosdiversion/src/model/ListInstanceRequest.cc
Normal 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/ddosdiversion/model/ListInstanceRequest.h>
|
||||
|
||||
using AlibabaCloud::DdosDiversion::Model::ListInstanceRequest;
|
||||
|
||||
ListInstanceRequest::ListInstanceRequest()
|
||||
: RpcServiceRequest("ddosdiversion", "2023-07-01", "ListInstance") {
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
ListInstanceRequest::~ListInstanceRequest() {}
|
||||
|
||||
long ListInstanceRequest::getNum() const {
|
||||
return num_;
|
||||
}
|
||||
|
||||
void ListInstanceRequest::setNum(long num) {
|
||||
num_ = num;
|
||||
setParameter(std::string("Num"), std::to_string(num));
|
||||
}
|
||||
|
||||
std::string ListInstanceRequest::getSaleId() const {
|
||||
return saleId_;
|
||||
}
|
||||
|
||||
void ListInstanceRequest::setSaleId(const std::string &saleId) {
|
||||
saleId_ = saleId;
|
||||
setParameter(std::string("SaleId"), saleId);
|
||||
}
|
||||
|
||||
std::string ListInstanceRequest::getName() const {
|
||||
return name_;
|
||||
}
|
||||
|
||||
void ListInstanceRequest::setName(const std::string &name) {
|
||||
name_ = name;
|
||||
setParameter(std::string("Name"), name);
|
||||
}
|
||||
|
||||
long ListInstanceRequest::getPage() const {
|
||||
return page_;
|
||||
}
|
||||
|
||||
void ListInstanceRequest::setPage(long page) {
|
||||
page_ = page;
|
||||
setParameter(std::string("Page"), std::to_string(page));
|
||||
}
|
||||
|
||||
std::string ListInstanceRequest::getStatus() const {
|
||||
return status_;
|
||||
}
|
||||
|
||||
void ListInstanceRequest::setStatus(const std::string &status) {
|
||||
status_ = status;
|
||||
setParameter(std::string("Status"), status);
|
||||
}
|
||||
|
||||
126
ddosdiversion/src/model/ListInstanceResult.cc
Normal file
126
ddosdiversion/src/model/ListInstanceResult.cc
Normal file
@@ -0,0 +1,126 @@
|
||||
/*
|
||||
* 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/ddosdiversion/model/ListInstanceResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::DdosDiversion;
|
||||
using namespace AlibabaCloud::DdosDiversion::Model;
|
||||
|
||||
ListInstanceResult::ListInstanceResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
ListInstanceResult::ListInstanceResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
ListInstanceResult::~ListInstanceResult()
|
||||
{}
|
||||
|
||||
void ListInstanceResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
auto allDataNode = value["Data"]["dataItem"];
|
||||
for (auto valueDatadataItem : allDataNode)
|
||||
{
|
||||
DataItem dataObject;
|
||||
if(!valueDatadataItem["Total"].isNull())
|
||||
dataObject.total = std::stol(valueDatadataItem["Total"].asString());
|
||||
if(!valueDatadataItem["Page"].isNull())
|
||||
dataObject.page = std::stol(valueDatadataItem["Page"].asString());
|
||||
if(!valueDatadataItem["Num"].isNull())
|
||||
dataObject.num = std::stol(valueDatadataItem["Num"].asString());
|
||||
auto allInstancesNode = valueDatadataItem["Instances"]["data"];
|
||||
for (auto valueDatadataItemInstancesdata : allInstancesNode)
|
||||
{
|
||||
DataItem::Data instancesObject;
|
||||
if(!valueDatadataItemInstancesdata["UserId"].isNull())
|
||||
instancesObject.userId = valueDatadataItemInstancesdata["UserId"].asString();
|
||||
if(!valueDatadataItemInstancesdata["SaleId"].isNull())
|
||||
instancesObject.saleId = valueDatadataItemInstancesdata["SaleId"].asString();
|
||||
if(!valueDatadataItemInstancesdata["InstanceId"].isNull())
|
||||
instancesObject.instanceId = valueDatadataItemInstancesdata["InstanceId"].asString();
|
||||
if(!valueDatadataItemInstancesdata["Name"].isNull())
|
||||
instancesObject.name = valueDatadataItemInstancesdata["Name"].asString();
|
||||
if(!valueDatadataItemInstancesdata["Status"].isNull())
|
||||
instancesObject.status = valueDatadataItemInstancesdata["Status"].asString();
|
||||
if(!valueDatadataItemInstancesdata["Comment"].isNull())
|
||||
instancesObject.comment = valueDatadataItemInstancesdata["Comment"].asString();
|
||||
if(!valueDatadataItemInstancesdata["Message"].isNull())
|
||||
instancesObject.message = valueDatadataItemInstancesdata["Message"].asString();
|
||||
if(!valueDatadataItemInstancesdata["GmtExpire"].isNull())
|
||||
instancesObject.gmtExpire = valueDatadataItemInstancesdata["GmtExpire"].asString();
|
||||
if(!valueDatadataItemInstancesdata["GmtCreate"].isNull())
|
||||
instancesObject.gmtCreate = valueDatadataItemInstancesdata["GmtCreate"].asString();
|
||||
if(!valueDatadataItemInstancesdata["GmtModify"].isNull())
|
||||
instancesObject.gmtModify = valueDatadataItemInstancesdata["GmtModify"].asString();
|
||||
auto specNode = value["Spec"];
|
||||
if(!specNode["IdcNumbers"].isNull())
|
||||
instancesObject.spec.idcNumbers = specNode["IdcNumbers"].asString();
|
||||
if(!specNode["NormalBandwidth"].isNull())
|
||||
instancesObject.spec.normalBandwidth = specNode["NormalBandwidth"].asString();
|
||||
if(!specNode["IpSubnetNums"].isNull())
|
||||
instancesObject.spec.ipSubnetNums = specNode["IpSubnetNums"].asString();
|
||||
if(!specNode["Coverage"].isNull())
|
||||
instancesObject.spec.coverage = specNode["Coverage"].asString();
|
||||
if(!specNode["Edition"].isNull())
|
||||
instancesObject.spec.edition = specNode["Edition"].asString();
|
||||
if(!specNode["MitigationCapacity"].isNull())
|
||||
instancesObject.spec.mitigationCapacity = specNode["MitigationCapacity"].asString();
|
||||
if(!specNode["MitigationNums"].isNull())
|
||||
instancesObject.spec.mitigationNums = specNode["MitigationNums"].asString();
|
||||
if(!specNode["DiversionType"].isNull())
|
||||
instancesObject.spec.diversionType = specNode["DiversionType"].asString();
|
||||
if(!specNode["MitigationAnalysis"].isNull())
|
||||
instancesObject.spec.mitigationAnalysis = specNode["MitigationAnalysis"].asString();
|
||||
if(!specNode["MitigationAnalysisCapacity"].isNull())
|
||||
instancesObject.spec.mitigationAnalysisCapacity = specNode["MitigationAnalysisCapacity"].asString();
|
||||
if(!specNode["InitialInstallation"].isNull())
|
||||
instancesObject.spec.initialInstallation = specNode["InitialInstallation"].asString();
|
||||
if(!specNode["InitialQty"].isNull())
|
||||
instancesObject.spec.initialQty = specNode["InitialQty"].asString();
|
||||
dataObject.instances.push_back(instancesObject);
|
||||
}
|
||||
data_.push_back(dataObject);
|
||||
}
|
||||
if(!value["Code"].isNull())
|
||||
code_ = std::stol(value["Code"].asString());
|
||||
if(!value["Message"].isNull())
|
||||
message_ = value["Message"].asString();
|
||||
|
||||
}
|
||||
|
||||
std::string ListInstanceResult::getMessage()const
|
||||
{
|
||||
return message_;
|
||||
}
|
||||
|
||||
std::vector<ListInstanceResult::DataItem> ListInstanceResult::getData()const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
long ListInstanceResult::getCode()const
|
||||
{
|
||||
return code_;
|
||||
}
|
||||
|
||||
81
ddosdiversion/src/model/QueryNetListRequest.cc
Normal file
81
ddosdiversion/src/model/QueryNetListRequest.cc
Normal file
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* 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/ddosdiversion/model/QueryNetListRequest.h>
|
||||
|
||||
using AlibabaCloud::DdosDiversion::Model::QueryNetListRequest;
|
||||
|
||||
QueryNetListRequest::QueryNetListRequest()
|
||||
: RpcServiceRequest("ddosdiversion", "2023-07-01", "QueryNetList") {
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
QueryNetListRequest::~QueryNetListRequest() {}
|
||||
|
||||
long QueryNetListRequest::getNum() const {
|
||||
return num_;
|
||||
}
|
||||
|
||||
void QueryNetListRequest::setNum(long num) {
|
||||
num_ = num;
|
||||
setParameter(std::string("Num"), std::to_string(num));
|
||||
}
|
||||
|
||||
std::string QueryNetListRequest::getMainNet() const {
|
||||
return mainNet_;
|
||||
}
|
||||
|
||||
void QueryNetListRequest::setMainNet(const std::string &mainNet) {
|
||||
mainNet_ = mainNet;
|
||||
setParameter(std::string("MainNet"), mainNet);
|
||||
}
|
||||
|
||||
std::string QueryNetListRequest::getMode() const {
|
||||
return mode_;
|
||||
}
|
||||
|
||||
void QueryNetListRequest::setMode(const std::string &mode) {
|
||||
mode_ = mode;
|
||||
setParameter(std::string("Mode"), mode);
|
||||
}
|
||||
|
||||
std::string QueryNetListRequest::getNet() const {
|
||||
return net_;
|
||||
}
|
||||
|
||||
void QueryNetListRequest::setNet(const std::string &net) {
|
||||
net_ = net;
|
||||
setParameter(std::string("Net"), net);
|
||||
}
|
||||
|
||||
std::string QueryNetListRequest::getSaleId() const {
|
||||
return saleId_;
|
||||
}
|
||||
|
||||
void QueryNetListRequest::setSaleId(const std::string &saleId) {
|
||||
saleId_ = saleId;
|
||||
setParameter(std::string("SaleId"), saleId);
|
||||
}
|
||||
|
||||
long QueryNetListRequest::getPage() const {
|
||||
return page_;
|
||||
}
|
||||
|
||||
void QueryNetListRequest::setPage(long page) {
|
||||
page_ = page;
|
||||
setParameter(std::string("Page"), std::to_string(page));
|
||||
}
|
||||
|
||||
127
ddosdiversion/src/model/QueryNetListResult.cc
Normal file
127
ddosdiversion/src/model/QueryNetListResult.cc
Normal file
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* 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/ddosdiversion/model/QueryNetListResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::DdosDiversion;
|
||||
using namespace AlibabaCloud::DdosDiversion::Model;
|
||||
|
||||
QueryNetListResult::QueryNetListResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
QueryNetListResult::QueryNetListResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
QueryNetListResult::~QueryNetListResult()
|
||||
{}
|
||||
|
||||
void QueryNetListResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
auto allDataNode = value["Data"]["dataItem"];
|
||||
for (auto valueDatadataItem : allDataNode)
|
||||
{
|
||||
DataItem dataObject;
|
||||
if(!valueDatadataItem["Total"].isNull())
|
||||
dataObject.total = std::stol(valueDatadataItem["Total"].asString());
|
||||
if(!valueDatadataItem["Page"].isNull())
|
||||
dataObject.page = std::stol(valueDatadataItem["Page"].asString());
|
||||
if(!valueDatadataItem["Num"].isNull())
|
||||
dataObject.num = std::stol(valueDatadataItem["Num"].asString());
|
||||
auto allNetsNode = valueDatadataItem["Nets"]["data"];
|
||||
for (auto valueDatadataItemNetsdata : allNetsNode)
|
||||
{
|
||||
DataItem::Data netsObject;
|
||||
if(!valueDatadataItemNetsdata["UserId"].isNull())
|
||||
netsObject.userId = valueDatadataItemNetsdata["UserId"].asString();
|
||||
if(!valueDatadataItemNetsdata["SaleId"].isNull())
|
||||
netsObject.saleId = valueDatadataItemNetsdata["SaleId"].asString();
|
||||
if(!valueDatadataItemNetsdata["UpstreamType"].isNull())
|
||||
netsObject.upstreamType = valueDatadataItemNetsdata["UpstreamType"].asString();
|
||||
if(!valueDatadataItemNetsdata["Net"].isNull())
|
||||
netsObject.net = valueDatadataItemNetsdata["Net"].asString();
|
||||
if(!valueDatadataItemNetsdata["NetType"].isNull())
|
||||
netsObject.netType = valueDatadataItemNetsdata["NetType"].asString();
|
||||
if(!valueDatadataItemNetsdata["Mode"].isNull())
|
||||
netsObject.mode = valueDatadataItemNetsdata["Mode"].asString();
|
||||
if(!valueDatadataItemNetsdata["DeclaredState"].isNull())
|
||||
netsObject.declaredState = std::stoi(valueDatadataItemNetsdata["DeclaredState"].asString());
|
||||
if(!valueDatadataItemNetsdata["GmtCreate"].isNull())
|
||||
netsObject.gmtCreate = valueDatadataItemNetsdata["GmtCreate"].asString();
|
||||
if(!valueDatadataItemNetsdata["GmtModify"].isNull())
|
||||
netsObject.gmtModify = valueDatadataItemNetsdata["GmtModify"].asString();
|
||||
if(!valueDatadataItemNetsdata["NetExtend"].isNull())
|
||||
netsObject.netExtend = std::stol(valueDatadataItemNetsdata["NetExtend"].asString());
|
||||
if(!valueDatadataItemNetsdata["FwdEffect"].isNull())
|
||||
netsObject.fwdEffect = std::stol(valueDatadataItemNetsdata["FwdEffect"].asString());
|
||||
if(!valueDatadataItemNetsdata["NetMain"].isNull())
|
||||
netsObject.netMain = valueDatadataItemNetsdata["NetMain"].asString();
|
||||
auto allDeclaredNode = valueDatadataItemNetsdata["Declared"]["declaredItem"];
|
||||
for (auto valueDatadataItemNetsdataDeclareddeclaredItem : allDeclaredNode)
|
||||
{
|
||||
DataItem::Data::DeclaredItem declaredObject;
|
||||
if(!valueDatadataItemNetsdataDeclareddeclaredItem["Region"].isNull())
|
||||
declaredObject.region = valueDatadataItemNetsdataDeclareddeclaredItem["Region"].asString();
|
||||
if(!valueDatadataItemNetsdataDeclareddeclaredItem["Declared"].isNull())
|
||||
declaredObject.declared = valueDatadataItemNetsdataDeclareddeclaredItem["Declared"].asString();
|
||||
netsObject.declared.push_back(declaredObject);
|
||||
}
|
||||
auto dDoSDefenseNode = value["DDoSDefense"];
|
||||
auto djPolicyNode = dDoSDefenseNode["DjPolicy"];
|
||||
if(!djPolicyNode["PolicyName"].isNull())
|
||||
netsObject.dDoSDefense.djPolicy.policyName = djPolicyNode["PolicyName"].asString();
|
||||
auto cleanThNode = dDoSDefenseNode["CleanTh"];
|
||||
if(!cleanThNode["Mbps"].isNull())
|
||||
netsObject.dDoSDefense.cleanTh.mbps = std::stoi(cleanThNode["Mbps"].asString());
|
||||
if(!cleanThNode["Pps"].isNull())
|
||||
netsObject.dDoSDefense.cleanTh.pps = std::stoi(cleanThNode["Pps"].asString());
|
||||
auto holeThNode = dDoSDefenseNode["HoleTh"];
|
||||
if(!holeThNode["ThreshMbps"].isNull())
|
||||
netsObject.dDoSDefense.holeTh.threshMbps = std::stoi(holeThNode["ThreshMbps"].asString());
|
||||
dataObject.nets.push_back(netsObject);
|
||||
}
|
||||
data_.push_back(dataObject);
|
||||
}
|
||||
if(!value["Code"].isNull())
|
||||
code_ = std::stol(value["Code"].asString());
|
||||
if(!value["Message"].isNull())
|
||||
message_ = value["Message"].asString();
|
||||
|
||||
}
|
||||
|
||||
std::string QueryNetListResult::getMessage()const
|
||||
{
|
||||
return message_;
|
||||
}
|
||||
|
||||
std::vector<QueryNetListResult::DataItem> QueryNetListResult::getData()const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
long QueryNetListResult::getCode()const
|
||||
{
|
||||
return code_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user