1 /**
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  * SPDX-License-Identifier: Apache-2.0.
4  */
5 
6 #include <aws/securityhub/model/AwsCloudFrontDistributionOriginGroupFailoverStatusCodes.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 SecurityHub
17 {
18 namespace Model
19 {
20 
AwsCloudFrontDistributionOriginGroupFailoverStatusCodes()21 AwsCloudFrontDistributionOriginGroupFailoverStatusCodes::AwsCloudFrontDistributionOriginGroupFailoverStatusCodes() :
22     m_itemsHasBeenSet(false),
23     m_quantity(0),
24     m_quantityHasBeenSet(false)
25 {
26 }
27 
AwsCloudFrontDistributionOriginGroupFailoverStatusCodes(JsonView jsonValue)28 AwsCloudFrontDistributionOriginGroupFailoverStatusCodes::AwsCloudFrontDistributionOriginGroupFailoverStatusCodes(JsonView jsonValue) :
29     m_itemsHasBeenSet(false),
30     m_quantity(0),
31     m_quantityHasBeenSet(false)
32 {
33   *this = jsonValue;
34 }
35 
operator =(JsonView jsonValue)36 AwsCloudFrontDistributionOriginGroupFailoverStatusCodes& AwsCloudFrontDistributionOriginGroupFailoverStatusCodes::operator =(JsonView jsonValue)
37 {
38   if(jsonValue.ValueExists("Items"))
39   {
40     Array<JsonView> itemsJsonList = jsonValue.GetArray("Items");
41     for(unsigned itemsIndex = 0; itemsIndex < itemsJsonList.GetLength(); ++itemsIndex)
42     {
43       m_items.push_back(itemsJsonList[itemsIndex].AsInteger());
44     }
45     m_itemsHasBeenSet = true;
46   }
47 
48   if(jsonValue.ValueExists("Quantity"))
49   {
50     m_quantity = jsonValue.GetInteger("Quantity");
51 
52     m_quantityHasBeenSet = true;
53   }
54 
55   return *this;
56 }
57 
Jsonize() const58 JsonValue AwsCloudFrontDistributionOriginGroupFailoverStatusCodes::Jsonize() const
59 {
60   JsonValue payload;
61 
62   if(m_itemsHasBeenSet)
63   {
64    Array<JsonValue> itemsJsonList(m_items.size());
65    for(unsigned itemsIndex = 0; itemsIndex < itemsJsonList.GetLength(); ++itemsIndex)
66    {
67      itemsJsonList[itemsIndex].AsInteger(m_items[itemsIndex]);
68    }
69    payload.WithArray("Items", std::move(itemsJsonList));
70 
71   }
72 
73   if(m_quantityHasBeenSet)
74   {
75    payload.WithInteger("Quantity", m_quantity);
76 
77   }
78 
79   return payload;
80 }
81 
82 } // namespace Model
83 } // namespace SecurityHub
84 } // namespace Aws
85