1 /** 2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 * SPDX-License-Identifier: Apache-2.0. 4 */ 5 6 #include <aws/macie2/model/TagCriterionForJob.h> 7 #include <aws/core/utils/json/JsonSerializer.h> 8 9 #include <utility> 10 11 using namespace Aws::Utils::Json; 12 using namespace Aws::Utils; 13 14 namespace Aws 15 { 16 namespace Macie2 17 { 18 namespace Model 19 { 20 TagCriterionForJob()21TagCriterionForJob::TagCriterionForJob() : 22 m_comparator(JobComparator::NOT_SET), 23 m_comparatorHasBeenSet(false), 24 m_tagValuesHasBeenSet(false) 25 { 26 } 27 TagCriterionForJob(JsonView jsonValue)28TagCriterionForJob::TagCriterionForJob(JsonView jsonValue) : 29 m_comparator(JobComparator::NOT_SET), 30 m_comparatorHasBeenSet(false), 31 m_tagValuesHasBeenSet(false) 32 { 33 *this = jsonValue; 34 } 35 operator =(JsonView jsonValue)36TagCriterionForJob& TagCriterionForJob::operator =(JsonView jsonValue) 37 { 38 if(jsonValue.ValueExists("comparator")) 39 { 40 m_comparator = JobComparatorMapper::GetJobComparatorForName(jsonValue.GetString("comparator")); 41 42 m_comparatorHasBeenSet = true; 43 } 44 45 if(jsonValue.ValueExists("tagValues")) 46 { 47 Array<JsonView> tagValuesJsonList = jsonValue.GetArray("tagValues"); 48 for(unsigned tagValuesIndex = 0; tagValuesIndex < tagValuesJsonList.GetLength(); ++tagValuesIndex) 49 { 50 m_tagValues.push_back(tagValuesJsonList[tagValuesIndex].AsObject()); 51 } 52 m_tagValuesHasBeenSet = true; 53 } 54 55 return *this; 56 } 57 Jsonize() const58JsonValue TagCriterionForJob::Jsonize() const 59 { 60 JsonValue payload; 61 62 if(m_comparatorHasBeenSet) 63 { 64 payload.WithString("comparator", JobComparatorMapper::GetNameForJobComparator(m_comparator)); 65 } 66 67 if(m_tagValuesHasBeenSet) 68 { 69 Array<JsonValue> tagValuesJsonList(m_tagValues.size()); 70 for(unsigned tagValuesIndex = 0; tagValuesIndex < tagValuesJsonList.GetLength(); ++tagValuesIndex) 71 { 72 tagValuesJsonList[tagValuesIndex].AsObject(m_tagValues[tagValuesIndex].Jsonize()); 73 } 74 payload.WithArray("tagValues", std::move(tagValuesJsonList)); 75 76 } 77 78 return payload; 79 } 80 81 } // namespace Model 82 } // namespace Macie2 83 } // namespace Aws 84