1 /** 2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 * SPDX-License-Identifier: Apache-2.0. 4 */ 5 6 #include <aws/iot/model/CertificateValidity.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 IoT 17 { 18 namespace Model 19 { 20 CertificateValidity()21CertificateValidity::CertificateValidity() : 22 m_notBeforeHasBeenSet(false), 23 m_notAfterHasBeenSet(false) 24 { 25 } 26 CertificateValidity(JsonView jsonValue)27CertificateValidity::CertificateValidity(JsonView jsonValue) : 28 m_notBeforeHasBeenSet(false), 29 m_notAfterHasBeenSet(false) 30 { 31 *this = jsonValue; 32 } 33 operator =(JsonView jsonValue)34CertificateValidity& CertificateValidity::operator =(JsonView jsonValue) 35 { 36 if(jsonValue.ValueExists("notBefore")) 37 { 38 m_notBefore = jsonValue.GetDouble("notBefore"); 39 40 m_notBeforeHasBeenSet = true; 41 } 42 43 if(jsonValue.ValueExists("notAfter")) 44 { 45 m_notAfter = jsonValue.GetDouble("notAfter"); 46 47 m_notAfterHasBeenSet = true; 48 } 49 50 return *this; 51 } 52 Jsonize() const53JsonValue CertificateValidity::Jsonize() const 54 { 55 JsonValue payload; 56 57 if(m_notBeforeHasBeenSet) 58 { 59 payload.WithDouble("notBefore", m_notBefore.SecondsWithMSPrecision()); 60 } 61 62 if(m_notAfterHasBeenSet) 63 { 64 payload.WithDouble("notAfter", m_notAfter.SecondsWithMSPrecision()); 65 } 66 67 return payload; 68 } 69 70 } // namespace Model 71 } // namespace IoT 72 } // namespace Aws 73