Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Jobs Enums #617

Merged
merged 8 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion jobs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# This file is generated

cmake_minimum_required(VERSION 3.1)

project(IotJobs-cpp LANGUAGES CXX)
if (DEFINED SIMPLE_VERSION)
message("Jobs version is ${SIMPLE_VERSION}")
message("IotJobs version is ${SIMPLE_VERSION}")
set(PROJECT_VERSION ${SIMPLE_VERSION})
endif()

Expand Down
2 changes: 2 additions & 0 deletions jobs/cmake/iotjobs-cpp-config.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# This file is generated

include(CMakeFindDependencyMacro)

find_dependency(aws-crt-cpp)
Expand Down
4 changes: 2 additions & 2 deletions jobs/include/aws/iotjobs/JobStatus.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ namespace Aws

namespace JobStatusMarshaller
{
const char *AWS_IOTJOBS_API ToString(JobStatus val);
JobStatus AWS_IOTJOBS_API FromString(const Aws::Crt::String &val);
AWS_IOTJOBS_API const char *ToString(JobStatus val);
AWS_IOTJOBS_API JobStatus FromString(const Aws::Crt::String &val);
} // namespace JobStatusMarshaller
} // namespace Iotjobs
} // namespace Aws
4 changes: 2 additions & 2 deletions jobs/include/aws/iotjobs/RejectedErrorCode.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ namespace Aws

namespace RejectedErrorCodeMarshaller
{
const char *AWS_IOTJOBS_API ToString(RejectedErrorCode val);
RejectedErrorCode AWS_IOTJOBS_API FromString(const Aws::Crt::String &val);
AWS_IOTJOBS_API const char *ToString(RejectedErrorCode val);
AWS_IOTJOBS_API RejectedErrorCode FromString(const Aws::Crt::String &val);
} // namespace RejectedErrorCodeMarshaller
} // namespace Iotjobs
} // namespace Aws
28 changes: 14 additions & 14 deletions jobs/source/JobStatus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

#include <assert.h>

static const size_t IN_PROGRESS_HASH = Aws::Crt::HashString("IN_PROGRESS");
static const size_t FAILED_HASH = Aws::Crt::HashString("FAILED");
static const size_t QUEUED_HASH = Aws::Crt::HashString("QUEUED");
static const size_t IN_PROGRESS_HASH = Aws::Crt::HashString("IN_PROGRESS");
static const size_t TIMED_OUT_HASH = Aws::Crt::HashString("TIMED_OUT");
static const size_t FAILED_HASH = Aws::Crt::HashString("FAILED");
static const size_t SUCCEEDED_HASH = Aws::Crt::HashString("SUCCEEDED");
static const size_t CANCELED_HASH = Aws::Crt::HashString("CANCELED");
static const size_t REJECTED_HASH = Aws::Crt::HashString("REJECTED");
Expand All @@ -30,14 +30,14 @@ namespace Aws
{
switch (status)
{
case JobStatus::IN_PROGRESS:
return "IN_PROGRESS";
case JobStatus::FAILED:
return "FAILED";
case JobStatus::QUEUED:
return "QUEUED";
case JobStatus::IN_PROGRESS:
return "IN_PROGRESS";
case JobStatus::TIMED_OUT:
return "TIMED_OUT";
case JobStatus::FAILED:
return "FAILED";
case JobStatus::SUCCEEDED:
return "SUCCEEDED";
case JobStatus::CANCELED:
Expand All @@ -56,24 +56,24 @@ namespace Aws
{
size_t hash = Crt::HashString(str.c_str());

if (hash == IN_PROGRESS_HASH)
if (hash == QUEUED_HASH)
{
return JobStatus::IN_PROGRESS;
return JobStatus::QUEUED;
}

if (hash == FAILED_HASH)
if (hash == IN_PROGRESS_HASH)
{
return JobStatus::FAILED;
return JobStatus::IN_PROGRESS;
}

if (hash == QUEUED_HASH)
if (hash == TIMED_OUT_HASH)
{
return JobStatus::QUEUED;
return JobStatus::TIMED_OUT;
}

if (hash == TIMED_OUT_HASH)
if (hash == FAILED_HASH)
{
return JobStatus::TIMED_OUT;
return JobStatus::FAILED;
}

if (hash == SUCCEEDED_HASH)
Expand Down
56 changes: 28 additions & 28 deletions jobs/source/RejectedErrorCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
#include <assert.h>

static const size_t INVALID_TOPIC_HASH = Aws::Crt::HashString("InvalidTopic");
static const size_t INVALID_JSON_HASH = Aws::Crt::HashString("InvalidJson");
static const size_t INVALID_REQUEST_HASH = Aws::Crt::HashString("InvalidRequest");
static const size_t INVALID_STATE_TRANSITION_HASH = Aws::Crt::HashString("InvalidStateTransition");
static const size_t RESOURCE_NOT_FOUND_HASH = Aws::Crt::HashString("ResourceNotFound");
static const size_t INVALID_REQUEST_HASH = Aws::Crt::HashString("InvalidRequest");
static const size_t REQUEST_THROTTLED_HASH = Aws::Crt::HashString("RequestThrottled");
static const size_t VERSION_MISMATCH_HASH = Aws::Crt::HashString("VersionMismatch");
static const size_t INTERNAL_ERROR_HASH = Aws::Crt::HashString("InternalError");
static const size_t REQUEST_THROTTLED_HASH = Aws::Crt::HashString("RequestThrottled");
static const size_t TERMINAL_STATE_REACHED_HASH = Aws::Crt::HashString("TerminalStateReached");
static const size_t INVALID_JSON_HASH = Aws::Crt::HashString("InvalidJson");
static const size_t VERSION_MISMATCH_HASH = Aws::Crt::HashString("VersionMismatch");

namespace Aws
{
Expand All @@ -33,22 +33,22 @@ namespace Aws
{
case RejectedErrorCode::InvalidTopic:
return "InvalidTopic";
case RejectedErrorCode::InvalidJson:
return "InvalidJson";
case RejectedErrorCode::InvalidRequest:
return "InvalidRequest";
case RejectedErrorCode::InvalidStateTransition:
return "InvalidStateTransition";
case RejectedErrorCode::ResourceNotFound:
return "ResourceNotFound";
case RejectedErrorCode::InvalidRequest:
return "InvalidRequest";
case RejectedErrorCode::RequestThrottled:
return "RequestThrottled";
case RejectedErrorCode::VersionMismatch:
return "VersionMismatch";
case RejectedErrorCode::InternalError:
return "InternalError";
case RejectedErrorCode::RequestThrottled:
return "RequestThrottled";
case RejectedErrorCode::TerminalStateReached:
return "TerminalStateReached";
case RejectedErrorCode::InvalidJson:
return "InvalidJson";
case RejectedErrorCode::VersionMismatch:
return "VersionMismatch";
default:
assert(0);
return "UNKNOWN_VALUE";
Expand All @@ -64,44 +64,44 @@ namespace Aws
return RejectedErrorCode::InvalidTopic;
}

if (hash == INVALID_STATE_TRANSITION_HASH)
if (hash == INVALID_JSON_HASH)
{
return RejectedErrorCode::InvalidStateTransition;
return RejectedErrorCode::InvalidJson;
}

if (hash == RESOURCE_NOT_FOUND_HASH)
if (hash == INVALID_REQUEST_HASH)
{
return RejectedErrorCode::ResourceNotFound;
return RejectedErrorCode::InvalidRequest;
}

if (hash == INVALID_REQUEST_HASH)
if (hash == INVALID_STATE_TRANSITION_HASH)
{
return RejectedErrorCode::InvalidRequest;
return RejectedErrorCode::InvalidStateTransition;
}

if (hash == REQUEST_THROTTLED_HASH)
if (hash == RESOURCE_NOT_FOUND_HASH)
{
return RejectedErrorCode::RequestThrottled;
return RejectedErrorCode::ResourceNotFound;
}

if (hash == INTERNAL_ERROR_HASH)
if (hash == VERSION_MISMATCH_HASH)
{
return RejectedErrorCode::InternalError;
return RejectedErrorCode::VersionMismatch;
}

if (hash == TERMINAL_STATE_REACHED_HASH)
if (hash == INTERNAL_ERROR_HASH)
{
return RejectedErrorCode::TerminalStateReached;
return RejectedErrorCode::InternalError;
}

if (hash == INVALID_JSON_HASH)
if (hash == REQUEST_THROTTLED_HASH)
{
return RejectedErrorCode::InvalidJson;
return RejectedErrorCode::RequestThrottled;
}

if (hash == VERSION_MISMATCH_HASH)
if (hash == TERMINAL_STATE_REACHED_HASH)
{
return RejectedErrorCode::VersionMismatch;
return RejectedErrorCode::TerminalStateReached;
}

assert(0);
Expand Down
Loading