GetDomainFields add request field
This commit is contained in:
86
oms/CMakeLists.txt
Normal file
86
oms/CMakeLists.txt
Normal file
@@ -0,0 +1,86 @@
|
||||
#
|
||||
# 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(oms_public_header
|
||||
include/alibabacloud/oms/OmsClient.h
|
||||
include/alibabacloud/oms/OmsExport.h )
|
||||
|
||||
set(oms_public_header_model
|
||||
include/alibabacloud/oms/model/GetDomainFieldsRequest.h
|
||||
include/alibabacloud/oms/model/GetDomainFieldsResult.h )
|
||||
|
||||
set(oms_src
|
||||
src/OmsClient.cc
|
||||
src/model/GetDomainFieldsRequest.cc
|
||||
src/model/GetDomainFieldsResult.cc )
|
||||
|
||||
add_library(oms ${LIB_TYPE}
|
||||
${oms_public_header}
|
||||
${oms_public_header_model}
|
||||
${oms_src})
|
||||
|
||||
set_target_properties(oms
|
||||
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}oms
|
||||
)
|
||||
|
||||
if(${LIB_TYPE} STREQUAL "SHARED")
|
||||
set_target_properties(oms
|
||||
PROPERTIES
|
||||
DEFINE_SYMBOL ALIBABACLOUD_OMS_LIBRARY)
|
||||
endif()
|
||||
|
||||
target_include_directories(oms
|
||||
PRIVATE include
|
||||
${CMAKE_SOURCE_DIR}/core/include
|
||||
)
|
||||
target_link_libraries(oms
|
||||
core)
|
||||
|
||||
if(CMAKE_HOST_WIN32)
|
||||
ExternalProject_Get_Property(jsoncpp INSTALL_DIR)
|
||||
set(jsoncpp_install_dir ${INSTALL_DIR})
|
||||
add_dependencies(oms
|
||||
jsoncpp)
|
||||
target_include_directories(oms
|
||||
PRIVATE ${jsoncpp_install_dir}/include)
|
||||
target_link_libraries(oms
|
||||
${jsoncpp_install_dir}/lib/jsoncpp.lib)
|
||||
set_target_properties(oms
|
||||
PROPERTIES
|
||||
COMPILE_OPTIONS "/bigobj")
|
||||
else()
|
||||
target_include_directories(oms
|
||||
PRIVATE /usr/include/jsoncpp)
|
||||
target_link_libraries(oms
|
||||
jsoncpp)
|
||||
endif()
|
||||
|
||||
install(FILES ${oms_public_header}
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/oms)
|
||||
install(FILES ${oms_public_header_model}
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/oms/model)
|
||||
install(TARGETS oms
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
)
|
||||
54
oms/include/alibabacloud/oms/OmsClient.h
Normal file
54
oms/include/alibabacloud/oms/OmsClient.h
Normal file
@@ -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_OMS_OMSCLIENT_H_
|
||||
#define ALIBABACLOUD_OMS_OMSCLIENT_H_
|
||||
|
||||
#include <future>
|
||||
#include <alibabacloud/core/AsyncCallerContext.h>
|
||||
#include <alibabacloud/core/EndpointProvider.h>
|
||||
#include <alibabacloud/core/RpcServiceClient.h>
|
||||
#include "OmsExport.h"
|
||||
#include "model/GetDomainFieldsRequest.h"
|
||||
#include "model/GetDomainFieldsResult.h"
|
||||
|
||||
|
||||
namespace AlibabaCloud
|
||||
{
|
||||
namespace Oms
|
||||
{
|
||||
class ALIBABACLOUD_OMS_EXPORT OmsClient : public RpcServiceClient
|
||||
{
|
||||
public:
|
||||
typedef Outcome<Error, Model::GetDomainFieldsResult> GetDomainFieldsOutcome;
|
||||
typedef std::future<GetDomainFieldsOutcome> GetDomainFieldsOutcomeCallable;
|
||||
typedef std::function<void(const OmsClient*, const Model::GetDomainFieldsRequest&, const GetDomainFieldsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GetDomainFieldsAsyncHandler;
|
||||
|
||||
OmsClient(const Credentials &credentials, const ClientConfiguration &configuration);
|
||||
OmsClient(const std::shared_ptr<CredentialsProvider> &credentialsProvider, const ClientConfiguration &configuration);
|
||||
OmsClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration);
|
||||
~OmsClient();
|
||||
GetDomainFieldsOutcome getDomainFields(const Model::GetDomainFieldsRequest &request)const;
|
||||
void getDomainFieldsAsync(const Model::GetDomainFieldsRequest& request, const GetDomainFieldsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
GetDomainFieldsOutcomeCallable getDomainFieldsCallable(const Model::GetDomainFieldsRequest& request) const;
|
||||
|
||||
private:
|
||||
std::shared_ptr<EndpointProvider> endpointProvider_;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // !ALIBABACLOUD_OMS_OMSCLIENT_H_
|
||||
32
oms/include/alibabacloud/oms/OmsExport.h
Normal file
32
oms/include/alibabacloud/oms/OmsExport.h
Normal file
@@ -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_OMS_OMSEXPORT_H_
|
||||
#define ALIBABACLOUD_OMS_OMSEXPORT_H_
|
||||
|
||||
#include <alibabacloud/core/Global.h>
|
||||
|
||||
#if defined(ALIBABACLOUD_SHARED)
|
||||
# if defined(ALIBABACLOUD_OMS_LIBRARY)
|
||||
# define ALIBABACLOUD_OMS_EXPORT ALIBABACLOUD_DECL_EXPORT
|
||||
# else
|
||||
# define ALIBABACLOUD_OMS_EXPORT ALIBABACLOUD_DECL_IMPORT
|
||||
# endif
|
||||
#else
|
||||
# define ALIBABACLOUD_OMS_EXPORT
|
||||
#endif
|
||||
|
||||
#endif // !ALIBABACLOUD_OMS_OMSEXPORT_H_
|
||||
45
oms/include/alibabacloud/oms/model/GetDomainFieldsRequest.h
Normal file
45
oms/include/alibabacloud/oms/model/GetDomainFieldsRequest.h
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* 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_OMS_MODEL_GETDOMAINFIELDSREQUEST_H_
|
||||
#define ALIBABACLOUD_OMS_MODEL_GETDOMAINFIELDSREQUEST_H_
|
||||
|
||||
#include <alibabacloud/oms/OmsExport.h>
|
||||
#include <alibabacloud/core/RpcServiceRequest.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
namespace AlibabaCloud {
|
||||
namespace Oms {
|
||||
namespace Model {
|
||||
class ALIBABACLOUD_OMS_EXPORT GetDomainFieldsRequest : public RpcServiceRequest {
|
||||
public:
|
||||
GetDomainFieldsRequest();
|
||||
~GetDomainFieldsRequest();
|
||||
std::string getDomainCode() const;
|
||||
void setDomainCode(const std::string &domainCode);
|
||||
bool getUseCache() const;
|
||||
void setUseCache(bool useCache);
|
||||
|
||||
private:
|
||||
std::string domainCode_;
|
||||
bool useCache_;
|
||||
};
|
||||
} // namespace Model
|
||||
} // namespace Oms
|
||||
} // namespace AlibabaCloud
|
||||
#endif // !ALIBABACLOUD_OMS_MODEL_GETDOMAINFIELDSREQUEST_H_
|
||||
53
oms/include/alibabacloud/oms/model/GetDomainFieldsResult.h
Normal file
53
oms/include/alibabacloud/oms/model/GetDomainFieldsResult.h
Normal file
@@ -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_OMS_MODEL_GETDOMAINFIELDSRESULT_H_
|
||||
#define ALIBABACLOUD_OMS_MODEL_GETDOMAINFIELDSRESULT_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <alibabacloud/core/ServiceResult.h>
|
||||
#include <alibabacloud/oms/OmsExport.h>
|
||||
|
||||
namespace AlibabaCloud
|
||||
{
|
||||
namespace Oms
|
||||
{
|
||||
namespace Model
|
||||
{
|
||||
class ALIBABACLOUD_OMS_EXPORT GetDomainFieldsResult : public ServiceResult
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
GetDomainFieldsResult();
|
||||
explicit GetDomainFieldsResult(const std::string &payload);
|
||||
~GetDomainFieldsResult();
|
||||
std::string getDomainCode()const;
|
||||
std::string getData()const;
|
||||
|
||||
protected:
|
||||
void parse(const std::string &payload);
|
||||
private:
|
||||
std::string domainCode_;
|
||||
std::string data_;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // !ALIBABACLOUD_OMS_MODEL_GETDOMAINFIELDSRESULT_H_
|
||||
89
oms/src/OmsClient.cc
Normal file
89
oms/src/OmsClient.cc
Normal file
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* 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/oms/OmsClient.h>
|
||||
#include <alibabacloud/core/SimpleCredentialsProvider.h>
|
||||
|
||||
using namespace AlibabaCloud;
|
||||
using namespace AlibabaCloud::Location;
|
||||
using namespace AlibabaCloud::Oms;
|
||||
using namespace AlibabaCloud::Oms::Model;
|
||||
|
||||
namespace
|
||||
{
|
||||
const std::string SERVICE_NAME = "Oms";
|
||||
}
|
||||
|
||||
OmsClient::OmsClient(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, "");
|
||||
}
|
||||
|
||||
OmsClient::OmsClient(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, "");
|
||||
}
|
||||
|
||||
OmsClient::OmsClient(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, "");
|
||||
}
|
||||
|
||||
OmsClient::~OmsClient()
|
||||
{}
|
||||
|
||||
OmsClient::GetDomainFieldsOutcome OmsClient::getDomainFields(const GetDomainFieldsRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return GetDomainFieldsOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return GetDomainFieldsOutcome(GetDomainFieldsResult(outcome.result()));
|
||||
else
|
||||
return GetDomainFieldsOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void OmsClient::getDomainFieldsAsync(const GetDomainFieldsRequest& request, const GetDomainFieldsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, getDomainFields(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
OmsClient::GetDomainFieldsOutcomeCallable OmsClient::getDomainFieldsCallable(const GetDomainFieldsRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<GetDomainFieldsOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->getDomainFields(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
45
oms/src/model/GetDomainFieldsRequest.cc
Normal file
45
oms/src/model/GetDomainFieldsRequest.cc
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* 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/oms/model/GetDomainFieldsRequest.h>
|
||||
|
||||
using AlibabaCloud::Oms::Model::GetDomainFieldsRequest;
|
||||
|
||||
GetDomainFieldsRequest::GetDomainFieldsRequest()
|
||||
: RpcServiceRequest("oms", "2019-05-27", "GetDomainFields") {
|
||||
setMethod(HttpRequest::Method::Get);
|
||||
}
|
||||
|
||||
GetDomainFieldsRequest::~GetDomainFieldsRequest() {}
|
||||
|
||||
std::string GetDomainFieldsRequest::getDomainCode() const {
|
||||
return domainCode_;
|
||||
}
|
||||
|
||||
void GetDomainFieldsRequest::setDomainCode(const std::string &domainCode) {
|
||||
domainCode_ = domainCode;
|
||||
setParameter(std::string("DomainCode"), domainCode);
|
||||
}
|
||||
|
||||
bool GetDomainFieldsRequest::getUseCache() const {
|
||||
return useCache_;
|
||||
}
|
||||
|
||||
void GetDomainFieldsRequest::setUseCache(bool useCache) {
|
||||
useCache_ = useCache;
|
||||
setParameter(std::string("UseCache"), useCache ? "true" : "false");
|
||||
}
|
||||
|
||||
58
oms/src/model/GetDomainFieldsResult.cc
Normal file
58
oms/src/model/GetDomainFieldsResult.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/oms/model/GetDomainFieldsResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Oms;
|
||||
using namespace AlibabaCloud::Oms::Model;
|
||||
|
||||
GetDomainFieldsResult::GetDomainFieldsResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
GetDomainFieldsResult::GetDomainFieldsResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
GetDomainFieldsResult::~GetDomainFieldsResult()
|
||||
{}
|
||||
|
||||
void GetDomainFieldsResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
if(!value["Data"].isNull())
|
||||
data_ = value["Data"].asString();
|
||||
if(!value["DomainCode"].isNull())
|
||||
domainCode_ = value["DomainCode"].asString();
|
||||
|
||||
}
|
||||
|
||||
std::string GetDomainFieldsResult::getDomainCode()const
|
||||
{
|
||||
return domainCode_;
|
||||
}
|
||||
|
||||
std::string GetDomainFieldsResult::getData()const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user