/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include #include #include #include #include using namespace Aws::MigrationHubRefactorSpaces::Model; using namespace Aws::Utils::Json; using namespace Aws::Utils; using namespace Aws; GetServiceResult::GetServiceResult() : m_endpointType(ServiceEndpointType::NOT_SET), m_state(ServiceState::NOT_SET) { } GetServiceResult::GetServiceResult(const Aws::AmazonWebServiceResult& result) : m_endpointType(ServiceEndpointType::NOT_SET), m_state(ServiceState::NOT_SET) { *this = result; } GetServiceResult& GetServiceResult::operator =(const Aws::AmazonWebServiceResult& result) { JsonView jsonValue = result.GetPayload().View(); if(jsonValue.ValueExists("ApplicationId")) { m_applicationId = jsonValue.GetString("ApplicationId"); } if(jsonValue.ValueExists("Arn")) { m_arn = jsonValue.GetString("Arn"); } if(jsonValue.ValueExists("CreatedByAccountId")) { m_createdByAccountId = jsonValue.GetString("CreatedByAccountId"); } if(jsonValue.ValueExists("CreatedTime")) { m_createdTime = jsonValue.GetDouble("CreatedTime"); } if(jsonValue.ValueExists("Description")) { m_description = jsonValue.GetString("Description"); } if(jsonValue.ValueExists("EndpointType")) { m_endpointType = ServiceEndpointTypeMapper::GetServiceEndpointTypeForName(jsonValue.GetString("EndpointType")); } if(jsonValue.ValueExists("EnvironmentId")) { m_environmentId = jsonValue.GetString("EnvironmentId"); } if(jsonValue.ValueExists("Error")) { m_error = jsonValue.GetObject("Error"); } if(jsonValue.ValueExists("LambdaEndpoint")) { m_lambdaEndpoint = jsonValue.GetObject("LambdaEndpoint"); } if(jsonValue.ValueExists("LastUpdatedTime")) { m_lastUpdatedTime = jsonValue.GetDouble("LastUpdatedTime"); } if(jsonValue.ValueExists("Name")) { m_name = jsonValue.GetString("Name"); } if(jsonValue.ValueExists("OwnerAccountId")) { m_ownerAccountId = jsonValue.GetString("OwnerAccountId"); } if(jsonValue.ValueExists("ServiceId")) { m_serviceId = jsonValue.GetString("ServiceId"); } if(jsonValue.ValueExists("State")) { m_state = ServiceStateMapper::GetServiceStateForName(jsonValue.GetString("State")); } if(jsonValue.ValueExists("Tags")) { Aws::Map tagsJsonMap = jsonValue.GetObject("Tags").GetAllObjects(); for(auto& tagsItem : tagsJsonMap) { m_tags[tagsItem.first] = tagsItem.second.AsString(); } } if(jsonValue.ValueExists("UrlEndpoint")) { m_urlEndpoint = jsonValue.GetObject("UrlEndpoint"); } if(jsonValue.ValueExists("VpcId")) { m_vpcId = jsonValue.GetString("VpcId"); } const auto& headers = result.GetHeaderValueCollection(); const auto& requestIdIter = headers.find("x-amzn-requestid"); if(requestIdIter != headers.end()) { m_requestId = requestIdIter->second; } return *this; }