/** * 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 VerifiedPermissions { namespace Model { PolicyItem::PolicyItem() : m_policyStoreIdHasBeenSet(false), m_policyIdHasBeenSet(false), m_policyType(PolicyType::NOT_SET), m_policyTypeHasBeenSet(false), m_principalHasBeenSet(false), m_resourceHasBeenSet(false), m_definitionHasBeenSet(false), m_createdDateHasBeenSet(false), m_lastUpdatedDateHasBeenSet(false) { } PolicyItem::PolicyItem(JsonView jsonValue) : m_policyStoreIdHasBeenSet(false), m_policyIdHasBeenSet(false), m_policyType(PolicyType::NOT_SET), m_policyTypeHasBeenSet(false), m_principalHasBeenSet(false), m_resourceHasBeenSet(false), m_definitionHasBeenSet(false), m_createdDateHasBeenSet(false), m_lastUpdatedDateHasBeenSet(false) { *this = jsonValue; } PolicyItem& PolicyItem::operator =(JsonView jsonValue) { if(jsonValue.ValueExists("policyStoreId")) { m_policyStoreId = jsonValue.GetString("policyStoreId"); m_policyStoreIdHasBeenSet = true; } if(jsonValue.ValueExists("policyId")) { m_policyId = jsonValue.GetString("policyId"); m_policyIdHasBeenSet = true; } if(jsonValue.ValueExists("policyType")) { m_policyType = PolicyTypeMapper::GetPolicyTypeForName(jsonValue.GetString("policyType")); m_policyTypeHasBeenSet = true; } if(jsonValue.ValueExists("principal")) { m_principal = jsonValue.GetObject("principal"); m_principalHasBeenSet = true; } if(jsonValue.ValueExists("resource")) { m_resource = jsonValue.GetObject("resource"); m_resourceHasBeenSet = true; } if(jsonValue.ValueExists("definition")) { m_definition = jsonValue.GetObject("definition"); m_definitionHasBeenSet = true; } if(jsonValue.ValueExists("createdDate")) { m_createdDate = jsonValue.GetString("createdDate"); m_createdDateHasBeenSet = true; } if(jsonValue.ValueExists("lastUpdatedDate")) { m_lastUpdatedDate = jsonValue.GetString("lastUpdatedDate"); m_lastUpdatedDateHasBeenSet = true; } return *this; } JsonValue PolicyItem::Jsonize() const { JsonValue payload; if(m_policyStoreIdHasBeenSet) { payload.WithString("policyStoreId", m_policyStoreId); } if(m_policyIdHasBeenSet) { payload.WithString("policyId", m_policyId); } if(m_policyTypeHasBeenSet) { payload.WithString("policyType", PolicyTypeMapper::GetNameForPolicyType(m_policyType)); } if(m_principalHasBeenSet) { payload.WithObject("principal", m_principal.Jsonize()); } if(m_resourceHasBeenSet) { payload.WithObject("resource", m_resource.Jsonize()); } if(m_definitionHasBeenSet) { payload.WithObject("definition", m_definition.Jsonize()); } if(m_createdDateHasBeenSet) { payload.WithString("createdDate", m_createdDate.ToGmtString(Aws::Utils::DateFormat::ISO_8601)); } if(m_lastUpdatedDateHasBeenSet) { payload.WithString("lastUpdatedDate", m_lastUpdatedDate.ToGmtString(Aws::Utils::DateFormat::ISO_8601)); } return payload; } } // namespace Model } // namespace VerifiedPermissions } // namespace Aws