/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include using namespace Aws::Utils::Json; using namespace Aws::Utils; namespace Aws { namespace EMR { namespace Model { NotebookExecution::NotebookExecution() : m_notebookExecutionIdHasBeenSet(false), m_editorIdHasBeenSet(false), m_executionEngineHasBeenSet(false), m_notebookExecutionNameHasBeenSet(false), m_notebookParamsHasBeenSet(false), m_status(NotebookExecutionStatus::NOT_SET), m_statusHasBeenSet(false), m_startTimeHasBeenSet(false), m_endTimeHasBeenSet(false), m_arnHasBeenSet(false), m_outputNotebookURIHasBeenSet(false), m_lastStateChangeReasonHasBeenSet(false), m_notebookInstanceSecurityGroupIdHasBeenSet(false), m_tagsHasBeenSet(false), m_notebookS3LocationHasBeenSet(false), m_outputNotebookS3LocationHasBeenSet(false), m_outputNotebookFormat(OutputNotebookFormat::NOT_SET), m_outputNotebookFormatHasBeenSet(false), m_environmentVariablesHasBeenSet(false) { } NotebookExecution::NotebookExecution(JsonView jsonValue) : m_notebookExecutionIdHasBeenSet(false), m_editorIdHasBeenSet(false), m_executionEngineHasBeenSet(false), m_notebookExecutionNameHasBeenSet(false), m_notebookParamsHasBeenSet(false), m_status(NotebookExecutionStatus::NOT_SET), m_statusHasBeenSet(false), m_startTimeHasBeenSet(false), m_endTimeHasBeenSet(false), m_arnHasBeenSet(false), m_outputNotebookURIHasBeenSet(false), m_lastStateChangeReasonHasBeenSet(false), m_notebookInstanceSecurityGroupIdHasBeenSet(false), m_tagsHasBeenSet(false), m_notebookS3LocationHasBeenSet(false), m_outputNotebookS3LocationHasBeenSet(false), m_outputNotebookFormat(OutputNotebookFormat::NOT_SET), m_outputNotebookFormatHasBeenSet(false), m_environmentVariablesHasBeenSet(false) { *this = jsonValue; } NotebookExecution& NotebookExecution::operator =(JsonView jsonValue) { if(jsonValue.ValueExists("NotebookExecutionId")) { m_notebookExecutionId = jsonValue.GetString("NotebookExecutionId"); m_notebookExecutionIdHasBeenSet = true; } if(jsonValue.ValueExists("EditorId")) { m_editorId = jsonValue.GetString("EditorId"); m_editorIdHasBeenSet = true; } if(jsonValue.ValueExists("ExecutionEngine")) { m_executionEngine = jsonValue.GetObject("ExecutionEngine"); m_executionEngineHasBeenSet = true; } if(jsonValue.ValueExists("NotebookExecutionName")) { m_notebookExecutionName = jsonValue.GetString("NotebookExecutionName"); m_notebookExecutionNameHasBeenSet = true; } if(jsonValue.ValueExists("NotebookParams")) { m_notebookParams = jsonValue.GetString("NotebookParams"); m_notebookParamsHasBeenSet = true; } if(jsonValue.ValueExists("Status")) { m_status = NotebookExecutionStatusMapper::GetNotebookExecutionStatusForName(jsonValue.GetString("Status")); m_statusHasBeenSet = true; } if(jsonValue.ValueExists("StartTime")) { m_startTime = jsonValue.GetDouble("StartTime"); m_startTimeHasBeenSet = true; } if(jsonValue.ValueExists("EndTime")) { m_endTime = jsonValue.GetDouble("EndTime"); m_endTimeHasBeenSet = true; } if(jsonValue.ValueExists("Arn")) { m_arn = jsonValue.GetString("Arn"); m_arnHasBeenSet = true; } if(jsonValue.ValueExists("OutputNotebookURI")) { m_outputNotebookURI = jsonValue.GetString("OutputNotebookURI"); m_outputNotebookURIHasBeenSet = true; } if(jsonValue.ValueExists("LastStateChangeReason")) { m_lastStateChangeReason = jsonValue.GetString("LastStateChangeReason"); m_lastStateChangeReasonHasBeenSet = true; } if(jsonValue.ValueExists("NotebookInstanceSecurityGroupId")) { m_notebookInstanceSecurityGroupId = jsonValue.GetString("NotebookInstanceSecurityGroupId"); m_notebookInstanceSecurityGroupIdHasBeenSet = true; } if(jsonValue.ValueExists("Tags")) { Aws::Utils::Array tagsJsonList = jsonValue.GetArray("Tags"); for(unsigned tagsIndex = 0; tagsIndex < tagsJsonList.GetLength(); ++tagsIndex) { m_tags.push_back(tagsJsonList[tagsIndex].AsObject()); } m_tagsHasBeenSet = true; } if(jsonValue.ValueExists("NotebookS3Location")) { m_notebookS3Location = jsonValue.GetObject("NotebookS3Location"); m_notebookS3LocationHasBeenSet = true; } if(jsonValue.ValueExists("OutputNotebookS3Location")) { m_outputNotebookS3Location = jsonValue.GetObject("OutputNotebookS3Location"); m_outputNotebookS3LocationHasBeenSet = true; } if(jsonValue.ValueExists("OutputNotebookFormat")) { m_outputNotebookFormat = OutputNotebookFormatMapper::GetOutputNotebookFormatForName(jsonValue.GetString("OutputNotebookFormat")); m_outputNotebookFormatHasBeenSet = true; } if(jsonValue.ValueExists("EnvironmentVariables")) { Aws::Map environmentVariablesJsonMap = jsonValue.GetObject("EnvironmentVariables").GetAllObjects(); for(auto& environmentVariablesItem : environmentVariablesJsonMap) { m_environmentVariables[environmentVariablesItem.first] = environmentVariablesItem.second.AsString(); } m_environmentVariablesHasBeenSet = true; } return *this; } JsonValue NotebookExecution::Jsonize() const { JsonValue payload; if(m_notebookExecutionIdHasBeenSet) { payload.WithString("NotebookExecutionId", m_notebookExecutionId); } if(m_editorIdHasBeenSet) { payload.WithString("EditorId", m_editorId); } if(m_executionEngineHasBeenSet) { payload.WithObject("ExecutionEngine", m_executionEngine.Jsonize()); } if(m_notebookExecutionNameHasBeenSet) { payload.WithString("NotebookExecutionName", m_notebookExecutionName); } if(m_notebookParamsHasBeenSet) { payload.WithString("NotebookParams", m_notebookParams); } if(m_statusHasBeenSet) { payload.WithString("Status", NotebookExecutionStatusMapper::GetNameForNotebookExecutionStatus(m_status)); } if(m_startTimeHasBeenSet) { payload.WithDouble("StartTime", m_startTime.SecondsWithMSPrecision()); } if(m_endTimeHasBeenSet) { payload.WithDouble("EndTime", m_endTime.SecondsWithMSPrecision()); } if(m_arnHasBeenSet) { payload.WithString("Arn", m_arn); } if(m_outputNotebookURIHasBeenSet) { payload.WithString("OutputNotebookURI", m_outputNotebookURI); } if(m_lastStateChangeReasonHasBeenSet) { payload.WithString("LastStateChangeReason", m_lastStateChangeReason); } if(m_notebookInstanceSecurityGroupIdHasBeenSet) { payload.WithString("NotebookInstanceSecurityGroupId", m_notebookInstanceSecurityGroupId); } if(m_tagsHasBeenSet) { Aws::Utils::Array tagsJsonList(m_tags.size()); for(unsigned tagsIndex = 0; tagsIndex < tagsJsonList.GetLength(); ++tagsIndex) { tagsJsonList[tagsIndex].AsObject(m_tags[tagsIndex].Jsonize()); } payload.WithArray("Tags", std::move(tagsJsonList)); } if(m_notebookS3LocationHasBeenSet) { payload.WithObject("NotebookS3Location", m_notebookS3Location.Jsonize()); } if(m_outputNotebookS3LocationHasBeenSet) { payload.WithObject("OutputNotebookS3Location", m_outputNotebookS3Location.Jsonize()); } if(m_outputNotebookFormatHasBeenSet) { payload.WithString("OutputNotebookFormat", OutputNotebookFormatMapper::GetNameForOutputNotebookFormat(m_outputNotebookFormat)); } if(m_environmentVariablesHasBeenSet) { JsonValue environmentVariablesJsonMap; for(auto& environmentVariablesItem : m_environmentVariables) { environmentVariablesJsonMap.WithString(environmentVariablesItem.first, environmentVariablesItem.second); } payload.WithObject("EnvironmentVariables", std::move(environmentVariablesJsonMap)); } return payload; } } // namespace Model } // namespace EMR } // namespace Aws