106 lines
3.1 KiB
C++
106 lines
3.1 KiB
C++
/**
|
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
* SPDX-License-Identifier: Apache-2.0.
|
|
*/
|
|
|
|
#include <aws/batch/model/JobStatus.h>
|
|
#include <aws/core/utils/HashingUtils.h>
|
|
#include <aws/core/Globals.h>
|
|
#include <aws/core/utils/EnumParseOverflowContainer.h>
|
|
|
|
using namespace Aws::Utils;
|
|
|
|
|
|
namespace Aws
|
|
{
|
|
namespace Batch
|
|
{
|
|
namespace Model
|
|
{
|
|
namespace JobStatusMapper
|
|
{
|
|
|
|
static const int SUBMITTED_HASH = HashingUtils::HashString("SUBMITTED");
|
|
static const int PENDING_HASH = HashingUtils::HashString("PENDING");
|
|
static const int RUNNABLE_HASH = HashingUtils::HashString("RUNNABLE");
|
|
static const int STARTING_HASH = HashingUtils::HashString("STARTING");
|
|
static const int RUNNING_HASH = HashingUtils::HashString("RUNNING");
|
|
static const int SUCCEEDED_HASH = HashingUtils::HashString("SUCCEEDED");
|
|
static const int FAILED_HASH = HashingUtils::HashString("FAILED");
|
|
|
|
|
|
JobStatus GetJobStatusForName(const Aws::String& name)
|
|
{
|
|
int hashCode = HashingUtils::HashString(name.c_str());
|
|
if (hashCode == SUBMITTED_HASH)
|
|
{
|
|
return JobStatus::SUBMITTED;
|
|
}
|
|
else if (hashCode == PENDING_HASH)
|
|
{
|
|
return JobStatus::PENDING;
|
|
}
|
|
else if (hashCode == RUNNABLE_HASH)
|
|
{
|
|
return JobStatus::RUNNABLE;
|
|
}
|
|
else if (hashCode == STARTING_HASH)
|
|
{
|
|
return JobStatus::STARTING;
|
|
}
|
|
else if (hashCode == RUNNING_HASH)
|
|
{
|
|
return JobStatus::RUNNING;
|
|
}
|
|
else if (hashCode == SUCCEEDED_HASH)
|
|
{
|
|
return JobStatus::SUCCEEDED;
|
|
}
|
|
else if (hashCode == FAILED_HASH)
|
|
{
|
|
return JobStatus::FAILED;
|
|
}
|
|
EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
|
|
if(overflowContainer)
|
|
{
|
|
overflowContainer->StoreOverflow(hashCode, name);
|
|
return static_cast<JobStatus>(hashCode);
|
|
}
|
|
|
|
return JobStatus::NOT_SET;
|
|
}
|
|
|
|
Aws::String GetNameForJobStatus(JobStatus enumValue)
|
|
{
|
|
switch(enumValue)
|
|
{
|
|
case JobStatus::SUBMITTED:
|
|
return "SUBMITTED";
|
|
case JobStatus::PENDING:
|
|
return "PENDING";
|
|
case JobStatus::RUNNABLE:
|
|
return "RUNNABLE";
|
|
case JobStatus::STARTING:
|
|
return "STARTING";
|
|
case JobStatus::RUNNING:
|
|
return "RUNNING";
|
|
case JobStatus::SUCCEEDED:
|
|
return "SUCCEEDED";
|
|
case JobStatus::FAILED:
|
|
return "FAILED";
|
|
default:
|
|
EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
|
|
if(overflowContainer)
|
|
{
|
|
return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue));
|
|
}
|
|
|
|
return {};
|
|
}
|
|
}
|
|
|
|
} // namespace JobStatusMapper
|
|
} // namespace Model
|
|
} // namespace Batch
|
|
} // namespace Aws
|