Compare commits
1 Commits
imagerecog
...
safconsole
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6e4fea5ea2 |
@@ -1,3 +1,6 @@
|
|||||||
|
2021-02-04 Version: patch
|
||||||
|
- Supported console.
|
||||||
|
|
||||||
2021-02-04 Version: patch
|
2021-02-04 Version: patch
|
||||||
- Update TaggingImage.
|
- Update TaggingImage.
|
||||||
|
|
||||||
|
|||||||
90
safconsole/CMakeLists.txt
Normal file
90
safconsole/CMakeLists.txt
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
#
|
||||||
|
# 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(safconsole_public_header
|
||||||
|
include/alibabacloud/safconsole/SafconsoleClient.h
|
||||||
|
include/alibabacloud/safconsole/SafconsoleExport.h )
|
||||||
|
|
||||||
|
set(safconsole_public_header_model
|
||||||
|
include/alibabacloud/safconsole/model/RevokeFeedbackRequest.h
|
||||||
|
include/alibabacloud/safconsole/model/RevokeFeedbackResult.h
|
||||||
|
include/alibabacloud/safconsole/model/SendFeedbackRequest.h
|
||||||
|
include/alibabacloud/safconsole/model/SendFeedbackResult.h )
|
||||||
|
|
||||||
|
set(safconsole_src
|
||||||
|
src/SafconsoleClient.cc
|
||||||
|
src/model/RevokeFeedbackRequest.cc
|
||||||
|
src/model/RevokeFeedbackResult.cc
|
||||||
|
src/model/SendFeedbackRequest.cc
|
||||||
|
src/model/SendFeedbackResult.cc )
|
||||||
|
|
||||||
|
add_library(safconsole ${LIB_TYPE}
|
||||||
|
${safconsole_public_header}
|
||||||
|
${safconsole_public_header_model}
|
||||||
|
${safconsole_src})
|
||||||
|
|
||||||
|
set_target_properties(safconsole
|
||||||
|
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}safconsole
|
||||||
|
)
|
||||||
|
|
||||||
|
if(${LIB_TYPE} STREQUAL "SHARED")
|
||||||
|
set_target_properties(safconsole
|
||||||
|
PROPERTIES
|
||||||
|
DEFINE_SYMBOL ALIBABACLOUD_SAFCONSOLE_LIBRARY)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_include_directories(safconsole
|
||||||
|
PRIVATE include
|
||||||
|
${CMAKE_SOURCE_DIR}/core/include
|
||||||
|
)
|
||||||
|
target_link_libraries(safconsole
|
||||||
|
core)
|
||||||
|
|
||||||
|
if(CMAKE_HOST_WIN32)
|
||||||
|
ExternalProject_Get_Property(jsoncpp INSTALL_DIR)
|
||||||
|
set(jsoncpp_install_dir ${INSTALL_DIR})
|
||||||
|
add_dependencies(safconsole
|
||||||
|
jsoncpp)
|
||||||
|
target_include_directories(safconsole
|
||||||
|
PRIVATE ${jsoncpp_install_dir}/include)
|
||||||
|
target_link_libraries(safconsole
|
||||||
|
${jsoncpp_install_dir}/lib/jsoncpp.lib)
|
||||||
|
set_target_properties(safconsole
|
||||||
|
PROPERTIES
|
||||||
|
COMPILE_OPTIONS "/bigobj")
|
||||||
|
else()
|
||||||
|
target_include_directories(safconsole
|
||||||
|
PRIVATE /usr/include/jsoncpp)
|
||||||
|
target_link_libraries(safconsole
|
||||||
|
jsoncpp)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
install(FILES ${safconsole_public_header}
|
||||||
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/safconsole)
|
||||||
|
install(FILES ${safconsole_public_header_model}
|
||||||
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/safconsole/model)
|
||||||
|
install(TARGETS safconsole
|
||||||
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
|
)
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
* 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_SAFCONSOLE_SAFCONSOLECLIENT_H_
|
||||||
|
#define ALIBABACLOUD_SAFCONSOLE_SAFCONSOLECLIENT_H_
|
||||||
|
|
||||||
|
#include <future>
|
||||||
|
#include <alibabacloud/core/AsyncCallerContext.h>
|
||||||
|
#include <alibabacloud/core/EndpointProvider.h>
|
||||||
|
#include <alibabacloud/core/RpcServiceClient.h>
|
||||||
|
#include "SafconsoleExport.h"
|
||||||
|
#include "model/RevokeFeedbackRequest.h"
|
||||||
|
#include "model/RevokeFeedbackResult.h"
|
||||||
|
#include "model/SendFeedbackRequest.h"
|
||||||
|
#include "model/SendFeedbackResult.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace AlibabaCloud
|
||||||
|
{
|
||||||
|
namespace Safconsole
|
||||||
|
{
|
||||||
|
class ALIBABACLOUD_SAFCONSOLE_EXPORT SafconsoleClient : public RpcServiceClient
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef Outcome<Error, Model::RevokeFeedbackResult> RevokeFeedbackOutcome;
|
||||||
|
typedef std::future<RevokeFeedbackOutcome> RevokeFeedbackOutcomeCallable;
|
||||||
|
typedef std::function<void(const SafconsoleClient*, const Model::RevokeFeedbackRequest&, const RevokeFeedbackOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> RevokeFeedbackAsyncHandler;
|
||||||
|
typedef Outcome<Error, Model::SendFeedbackResult> SendFeedbackOutcome;
|
||||||
|
typedef std::future<SendFeedbackOutcome> SendFeedbackOutcomeCallable;
|
||||||
|
typedef std::function<void(const SafconsoleClient*, const Model::SendFeedbackRequest&, const SendFeedbackOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> SendFeedbackAsyncHandler;
|
||||||
|
|
||||||
|
SafconsoleClient(const Credentials &credentials, const ClientConfiguration &configuration);
|
||||||
|
SafconsoleClient(const std::shared_ptr<CredentialsProvider> &credentialsProvider, const ClientConfiguration &configuration);
|
||||||
|
SafconsoleClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration);
|
||||||
|
~SafconsoleClient();
|
||||||
|
RevokeFeedbackOutcome revokeFeedback(const Model::RevokeFeedbackRequest &request)const;
|
||||||
|
void revokeFeedbackAsync(const Model::RevokeFeedbackRequest& request, const RevokeFeedbackAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||||
|
RevokeFeedbackOutcomeCallable revokeFeedbackCallable(const Model::RevokeFeedbackRequest& request) const;
|
||||||
|
SendFeedbackOutcome sendFeedback(const Model::SendFeedbackRequest &request)const;
|
||||||
|
void sendFeedbackAsync(const Model::SendFeedbackRequest& request, const SendFeedbackAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||||
|
SendFeedbackOutcomeCallable sendFeedbackCallable(const Model::SendFeedbackRequest& request) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::shared_ptr<EndpointProvider> endpointProvider_;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // !ALIBABACLOUD_SAFCONSOLE_SAFCONSOLECLIENT_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_SAFCONSOLE_SAFCONSOLEEXPORT_H_
|
||||||
|
#define ALIBABACLOUD_SAFCONSOLE_SAFCONSOLEEXPORT_H_
|
||||||
|
|
||||||
|
#include <alibabacloud/core/Global.h>
|
||||||
|
|
||||||
|
#if defined(ALIBABACLOUD_SHARED)
|
||||||
|
# if defined(ALIBABACLOUD_SAFCONSOLE_LIBRARY)
|
||||||
|
# define ALIBABACLOUD_SAFCONSOLE_EXPORT ALIBABACLOUD_DECL_EXPORT
|
||||||
|
# else
|
||||||
|
# define ALIBABACLOUD_SAFCONSOLE_EXPORT ALIBABACLOUD_DECL_IMPORT
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# define ALIBABACLOUD_SAFCONSOLE_EXPORT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // !ALIBABACLOUD_SAFCONSOLE_SAFCONSOLEEXPORT_H_
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* 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_SAFCONSOLE_MODEL_REVOKEFEEDBACKREQUEST_H_
|
||||||
|
#define ALIBABACLOUD_SAFCONSOLE_MODEL_REVOKEFEEDBACKREQUEST_H_
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include <alibabacloud/core/RpcServiceRequest.h>
|
||||||
|
#include <alibabacloud/safconsole/SafconsoleExport.h>
|
||||||
|
|
||||||
|
namespace AlibabaCloud
|
||||||
|
{
|
||||||
|
namespace Safconsole
|
||||||
|
{
|
||||||
|
namespace Model
|
||||||
|
{
|
||||||
|
class ALIBABACLOUD_SAFCONSOLE_EXPORT RevokeFeedbackRequest : public RpcServiceRequest
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
RevokeFeedbackRequest();
|
||||||
|
~RevokeFeedbackRequest();
|
||||||
|
|
||||||
|
std::string getSampleType()const;
|
||||||
|
void setSampleType(const std::string& sampleType);
|
||||||
|
std::string getValue()const;
|
||||||
|
void setValue(const std::string& value);
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string sampleType_;
|
||||||
|
std::string value_;
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // !ALIBABACLOUD_SAFCONSOLE_MODEL_REVOKEFEEDBACKREQUEST_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_SAFCONSOLE_MODEL_REVOKEFEEDBACKRESULT_H_
|
||||||
|
#define ALIBABACLOUD_SAFCONSOLE_MODEL_REVOKEFEEDBACKRESULT_H_
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include <utility>
|
||||||
|
#include <alibabacloud/core/ServiceResult.h>
|
||||||
|
#include <alibabacloud/safconsole/SafconsoleExport.h>
|
||||||
|
|
||||||
|
namespace AlibabaCloud
|
||||||
|
{
|
||||||
|
namespace Safconsole
|
||||||
|
{
|
||||||
|
namespace Model
|
||||||
|
{
|
||||||
|
class ALIBABACLOUD_SAFCONSOLE_EXPORT RevokeFeedbackResult : public ServiceResult
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
RevokeFeedbackResult();
|
||||||
|
explicit RevokeFeedbackResult(const std::string &payload);
|
||||||
|
~RevokeFeedbackResult();
|
||||||
|
std::string getMessage()const;
|
||||||
|
std::string getCode()const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void parse(const std::string &payload);
|
||||||
|
private:
|
||||||
|
std::string message_;
|
||||||
|
std::string code_;
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // !ALIBABACLOUD_SAFCONSOLE_MODEL_REVOKEFEEDBACKRESULT_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_SAFCONSOLE_MODEL_SENDFEEDBACKREQUEST_H_
|
||||||
|
#define ALIBABACLOUD_SAFCONSOLE_MODEL_SENDFEEDBACKREQUEST_H_
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include <alibabacloud/core/RpcServiceRequest.h>
|
||||||
|
#include <alibabacloud/safconsole/SafconsoleExport.h>
|
||||||
|
|
||||||
|
namespace AlibabaCloud
|
||||||
|
{
|
||||||
|
namespace Safconsole
|
||||||
|
{
|
||||||
|
namespace Model
|
||||||
|
{
|
||||||
|
class ALIBABACLOUD_SAFCONSOLE_EXPORT SendFeedbackRequest : public RpcServiceRequest
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
SendFeedbackRequest();
|
||||||
|
~SendFeedbackRequest();
|
||||||
|
|
||||||
|
std::string getRiskLabel()const;
|
||||||
|
void setRiskLabel(const std::string& riskLabel);
|
||||||
|
std::string getSampleType()const;
|
||||||
|
void setSampleType(const std::string& sampleType);
|
||||||
|
std::string getValue()const;
|
||||||
|
void setValue(const std::string& value);
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string riskLabel_;
|
||||||
|
std::string sampleType_;
|
||||||
|
std::string value_;
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // !ALIBABACLOUD_SAFCONSOLE_MODEL_SENDFEEDBACKREQUEST_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_SAFCONSOLE_MODEL_SENDFEEDBACKRESULT_H_
|
||||||
|
#define ALIBABACLOUD_SAFCONSOLE_MODEL_SENDFEEDBACKRESULT_H_
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include <utility>
|
||||||
|
#include <alibabacloud/core/ServiceResult.h>
|
||||||
|
#include <alibabacloud/safconsole/SafconsoleExport.h>
|
||||||
|
|
||||||
|
namespace AlibabaCloud
|
||||||
|
{
|
||||||
|
namespace Safconsole
|
||||||
|
{
|
||||||
|
namespace Model
|
||||||
|
{
|
||||||
|
class ALIBABACLOUD_SAFCONSOLE_EXPORT SendFeedbackResult : public ServiceResult
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
|
||||||
|
SendFeedbackResult();
|
||||||
|
explicit SendFeedbackResult(const std::string &payload);
|
||||||
|
~SendFeedbackResult();
|
||||||
|
std::string getMessage()const;
|
||||||
|
int getCode()const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void parse(const std::string &payload);
|
||||||
|
private:
|
||||||
|
std::string message_;
|
||||||
|
int code_;
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // !ALIBABACLOUD_SAFCONSOLE_MODEL_SENDFEEDBACKRESULT_H_
|
||||||
125
safconsole/src/SafconsoleClient.cc
Normal file
125
safconsole/src/SafconsoleClient.cc
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
/*
|
||||||
|
* 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/safconsole/SafconsoleClient.h>
|
||||||
|
#include <alibabacloud/core/SimpleCredentialsProvider.h>
|
||||||
|
|
||||||
|
using namespace AlibabaCloud;
|
||||||
|
using namespace AlibabaCloud::Location;
|
||||||
|
using namespace AlibabaCloud::Safconsole;
|
||||||
|
using namespace AlibabaCloud::Safconsole::Model;
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
const std::string SERVICE_NAME = "safconsole";
|
||||||
|
}
|
||||||
|
|
||||||
|
SafconsoleClient::SafconsoleClient(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, "safconsole");
|
||||||
|
}
|
||||||
|
|
||||||
|
SafconsoleClient::SafconsoleClient(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, "safconsole");
|
||||||
|
}
|
||||||
|
|
||||||
|
SafconsoleClient::SafconsoleClient(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, "safconsole");
|
||||||
|
}
|
||||||
|
|
||||||
|
SafconsoleClient::~SafconsoleClient()
|
||||||
|
{}
|
||||||
|
|
||||||
|
SafconsoleClient::RevokeFeedbackOutcome SafconsoleClient::revokeFeedback(const RevokeFeedbackRequest &request) const
|
||||||
|
{
|
||||||
|
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||||
|
if (!endpointOutcome.isSuccess())
|
||||||
|
return RevokeFeedbackOutcome(endpointOutcome.error());
|
||||||
|
|
||||||
|
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||||
|
|
||||||
|
if (outcome.isSuccess())
|
||||||
|
return RevokeFeedbackOutcome(RevokeFeedbackResult(outcome.result()));
|
||||||
|
else
|
||||||
|
return RevokeFeedbackOutcome(outcome.error());
|
||||||
|
}
|
||||||
|
|
||||||
|
void SafconsoleClient::revokeFeedbackAsync(const RevokeFeedbackRequest& request, const RevokeFeedbackAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||||
|
{
|
||||||
|
auto fn = [this, request, handler, context]()
|
||||||
|
{
|
||||||
|
handler(this, request, revokeFeedback(request), context);
|
||||||
|
};
|
||||||
|
|
||||||
|
asyncExecute(new Runnable(fn));
|
||||||
|
}
|
||||||
|
|
||||||
|
SafconsoleClient::RevokeFeedbackOutcomeCallable SafconsoleClient::revokeFeedbackCallable(const RevokeFeedbackRequest &request) const
|
||||||
|
{
|
||||||
|
auto task = std::make_shared<std::packaged_task<RevokeFeedbackOutcome()>>(
|
||||||
|
[this, request]()
|
||||||
|
{
|
||||||
|
return this->revokeFeedback(request);
|
||||||
|
});
|
||||||
|
|
||||||
|
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||||
|
return task->get_future();
|
||||||
|
}
|
||||||
|
|
||||||
|
SafconsoleClient::SendFeedbackOutcome SafconsoleClient::sendFeedback(const SendFeedbackRequest &request) const
|
||||||
|
{
|
||||||
|
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||||
|
if (!endpointOutcome.isSuccess())
|
||||||
|
return SendFeedbackOutcome(endpointOutcome.error());
|
||||||
|
|
||||||
|
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||||
|
|
||||||
|
if (outcome.isSuccess())
|
||||||
|
return SendFeedbackOutcome(SendFeedbackResult(outcome.result()));
|
||||||
|
else
|
||||||
|
return SendFeedbackOutcome(outcome.error());
|
||||||
|
}
|
||||||
|
|
||||||
|
void SafconsoleClient::sendFeedbackAsync(const SendFeedbackRequest& request, const SendFeedbackAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||||
|
{
|
||||||
|
auto fn = [this, request, handler, context]()
|
||||||
|
{
|
||||||
|
handler(this, request, sendFeedback(request), context);
|
||||||
|
};
|
||||||
|
|
||||||
|
asyncExecute(new Runnable(fn));
|
||||||
|
}
|
||||||
|
|
||||||
|
SafconsoleClient::SendFeedbackOutcomeCallable SafconsoleClient::sendFeedbackCallable(const SendFeedbackRequest &request) const
|
||||||
|
{
|
||||||
|
auto task = std::make_shared<std::packaged_task<SendFeedbackOutcome()>>(
|
||||||
|
[this, request]()
|
||||||
|
{
|
||||||
|
return this->sendFeedback(request);
|
||||||
|
});
|
||||||
|
|
||||||
|
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||||
|
return task->get_future();
|
||||||
|
}
|
||||||
|
|
||||||
51
safconsole/src/model/RevokeFeedbackRequest.cc
Normal file
51
safconsole/src/model/RevokeFeedbackRequest.cc
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* 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/safconsole/model/RevokeFeedbackRequest.h>
|
||||||
|
|
||||||
|
using AlibabaCloud::Safconsole::Model::RevokeFeedbackRequest;
|
||||||
|
|
||||||
|
RevokeFeedbackRequest::RevokeFeedbackRequest() :
|
||||||
|
RpcServiceRequest("safconsole", "2021-01-12", "RevokeFeedback")
|
||||||
|
{
|
||||||
|
setMethod(HttpRequest::Method::Post);
|
||||||
|
}
|
||||||
|
|
||||||
|
RevokeFeedbackRequest::~RevokeFeedbackRequest()
|
||||||
|
{}
|
||||||
|
|
||||||
|
std::string RevokeFeedbackRequest::getSampleType()const
|
||||||
|
{
|
||||||
|
return sampleType_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RevokeFeedbackRequest::setSampleType(const std::string& sampleType)
|
||||||
|
{
|
||||||
|
sampleType_ = sampleType;
|
||||||
|
setBodyParameter("SampleType", sampleType);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string RevokeFeedbackRequest::getValue()const
|
||||||
|
{
|
||||||
|
return value_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RevokeFeedbackRequest::setValue(const std::string& value)
|
||||||
|
{
|
||||||
|
value_ = value;
|
||||||
|
setBodyParameter("Value", value);
|
||||||
|
}
|
||||||
|
|
||||||
58
safconsole/src/model/RevokeFeedbackResult.cc
Normal file
58
safconsole/src/model/RevokeFeedbackResult.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/safconsole/model/RevokeFeedbackResult.h>
|
||||||
|
#include <json/json.h>
|
||||||
|
|
||||||
|
using namespace AlibabaCloud::Safconsole;
|
||||||
|
using namespace AlibabaCloud::Safconsole::Model;
|
||||||
|
|
||||||
|
RevokeFeedbackResult::RevokeFeedbackResult() :
|
||||||
|
ServiceResult()
|
||||||
|
{}
|
||||||
|
|
||||||
|
RevokeFeedbackResult::RevokeFeedbackResult(const std::string &payload) :
|
||||||
|
ServiceResult()
|
||||||
|
{
|
||||||
|
parse(payload);
|
||||||
|
}
|
||||||
|
|
||||||
|
RevokeFeedbackResult::~RevokeFeedbackResult()
|
||||||
|
{}
|
||||||
|
|
||||||
|
void RevokeFeedbackResult::parse(const std::string &payload)
|
||||||
|
{
|
||||||
|
Json::Reader reader;
|
||||||
|
Json::Value value;
|
||||||
|
reader.parse(payload, value);
|
||||||
|
setRequestId(value["RequestId"].asString());
|
||||||
|
if(!value["Code"].isNull())
|
||||||
|
code_ = value["Code"].asString();
|
||||||
|
if(!value["Message"].isNull())
|
||||||
|
message_ = value["Message"].asString();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string RevokeFeedbackResult::getMessage()const
|
||||||
|
{
|
||||||
|
return message_;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string RevokeFeedbackResult::getCode()const
|
||||||
|
{
|
||||||
|
return code_;
|
||||||
|
}
|
||||||
|
|
||||||
62
safconsole/src/model/SendFeedbackRequest.cc
Normal file
62
safconsole/src/model/SendFeedbackRequest.cc
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
* 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/safconsole/model/SendFeedbackRequest.h>
|
||||||
|
|
||||||
|
using AlibabaCloud::Safconsole::Model::SendFeedbackRequest;
|
||||||
|
|
||||||
|
SendFeedbackRequest::SendFeedbackRequest() :
|
||||||
|
RpcServiceRequest("safconsole", "2021-01-12", "SendFeedback")
|
||||||
|
{
|
||||||
|
setMethod(HttpRequest::Method::Post);
|
||||||
|
}
|
||||||
|
|
||||||
|
SendFeedbackRequest::~SendFeedbackRequest()
|
||||||
|
{}
|
||||||
|
|
||||||
|
std::string SendFeedbackRequest::getRiskLabel()const
|
||||||
|
{
|
||||||
|
return riskLabel_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SendFeedbackRequest::setRiskLabel(const std::string& riskLabel)
|
||||||
|
{
|
||||||
|
riskLabel_ = riskLabel;
|
||||||
|
setParameter("RiskLabel", riskLabel);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string SendFeedbackRequest::getSampleType()const
|
||||||
|
{
|
||||||
|
return sampleType_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SendFeedbackRequest::setSampleType(const std::string& sampleType)
|
||||||
|
{
|
||||||
|
sampleType_ = sampleType;
|
||||||
|
setParameter("SampleType", sampleType);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string SendFeedbackRequest::getValue()const
|
||||||
|
{
|
||||||
|
return value_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SendFeedbackRequest::setValue(const std::string& value)
|
||||||
|
{
|
||||||
|
value_ = value;
|
||||||
|
setParameter("Value", value);
|
||||||
|
}
|
||||||
|
|
||||||
58
safconsole/src/model/SendFeedbackResult.cc
Normal file
58
safconsole/src/model/SendFeedbackResult.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/safconsole/model/SendFeedbackResult.h>
|
||||||
|
#include <json/json.h>
|
||||||
|
|
||||||
|
using namespace AlibabaCloud::Safconsole;
|
||||||
|
using namespace AlibabaCloud::Safconsole::Model;
|
||||||
|
|
||||||
|
SendFeedbackResult::SendFeedbackResult() :
|
||||||
|
ServiceResult()
|
||||||
|
{}
|
||||||
|
|
||||||
|
SendFeedbackResult::SendFeedbackResult(const std::string &payload) :
|
||||||
|
ServiceResult()
|
||||||
|
{
|
||||||
|
parse(payload);
|
||||||
|
}
|
||||||
|
|
||||||
|
SendFeedbackResult::~SendFeedbackResult()
|
||||||
|
{}
|
||||||
|
|
||||||
|
void SendFeedbackResult::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::stoi(value["Code"].asString());
|
||||||
|
if(!value["Message"].isNull())
|
||||||
|
message_ = value["Message"].asString();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string SendFeedbackResult::getMessage()const
|
||||||
|
{
|
||||||
|
return message_;
|
||||||
|
}
|
||||||
|
|
||||||
|
int SendFeedbackResult::getCode()const
|
||||||
|
{
|
||||||
|
return code_;
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user