{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.MigrationHubStrategy.GetPortfolioSummary
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retrieves overall summary including the number of servers to rehost and
-- the overall number of anti-patterns.
module Amazonka.MigrationHubStrategy.GetPortfolioSummary
  ( -- * Creating a Request
    GetPortfolioSummary (..),
    newGetPortfolioSummary,

    -- * Destructuring the Response
    GetPortfolioSummaryResponse (..),
    newGetPortfolioSummaryResponse,

    -- * Response Lenses
    getPortfolioSummaryResponse_assessmentSummary,
    getPortfolioSummaryResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MigrationHubStrategy.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newGetPortfolioSummary' smart constructor.
data GetPortfolioSummary = GetPortfolioSummary'
  {
  }
  deriving (GetPortfolioSummary -> GetPortfolioSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetPortfolioSummary -> GetPortfolioSummary -> Bool
$c/= :: GetPortfolioSummary -> GetPortfolioSummary -> Bool
== :: GetPortfolioSummary -> GetPortfolioSummary -> Bool
$c== :: GetPortfolioSummary -> GetPortfolioSummary -> Bool
Prelude.Eq, ReadPrec [GetPortfolioSummary]
ReadPrec GetPortfolioSummary
Int -> ReadS GetPortfolioSummary
ReadS [GetPortfolioSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetPortfolioSummary]
$creadListPrec :: ReadPrec [GetPortfolioSummary]
readPrec :: ReadPrec GetPortfolioSummary
$creadPrec :: ReadPrec GetPortfolioSummary
readList :: ReadS [GetPortfolioSummary]
$creadList :: ReadS [GetPortfolioSummary]
readsPrec :: Int -> ReadS GetPortfolioSummary
$creadsPrec :: Int -> ReadS GetPortfolioSummary
Prelude.Read, Int -> GetPortfolioSummary -> ShowS
[GetPortfolioSummary] -> ShowS
GetPortfolioSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetPortfolioSummary] -> ShowS
$cshowList :: [GetPortfolioSummary] -> ShowS
show :: GetPortfolioSummary -> String
$cshow :: GetPortfolioSummary -> String
showsPrec :: Int -> GetPortfolioSummary -> ShowS
$cshowsPrec :: Int -> GetPortfolioSummary -> ShowS
Prelude.Show, forall x. Rep GetPortfolioSummary x -> GetPortfolioSummary
forall x. GetPortfolioSummary -> Rep GetPortfolioSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetPortfolioSummary x -> GetPortfolioSummary
$cfrom :: forall x. GetPortfolioSummary -> Rep GetPortfolioSummary x
Prelude.Generic)

-- |
-- Create a value of 'GetPortfolioSummary' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
newGetPortfolioSummary ::
  GetPortfolioSummary
newGetPortfolioSummary :: GetPortfolioSummary
newGetPortfolioSummary = GetPortfolioSummary
GetPortfolioSummary'

instance Core.AWSRequest GetPortfolioSummary where
  type
    AWSResponse GetPortfolioSummary =
      GetPortfolioSummaryResponse
  request :: (Service -> Service)
-> GetPortfolioSummary -> Request GetPortfolioSummary
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetPortfolioSummary
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetPortfolioSummary)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe AssessmentSummary -> Int -> GetPortfolioSummaryResponse
GetPortfolioSummaryResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"assessmentSummary")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable GetPortfolioSummary where
  hashWithSalt :: Int -> GetPortfolioSummary -> Int
hashWithSalt Int
_salt GetPortfolioSummary
_ =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ()

instance Prelude.NFData GetPortfolioSummary where
  rnf :: GetPortfolioSummary -> ()
rnf GetPortfolioSummary
_ = ()

instance Data.ToHeaders GetPortfolioSummary where
  toHeaders :: GetPortfolioSummary -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToPath GetPortfolioSummary where
  toPath :: GetPortfolioSummary -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/get-portfolio-summary"

instance Data.ToQuery GetPortfolioSummary where
  toQuery :: GetPortfolioSummary -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newGetPortfolioSummaryResponse' smart constructor.
data GetPortfolioSummaryResponse = GetPortfolioSummaryResponse'
  { -- | An assessment summary for the portfolio including the number of servers
    -- to rehost and the overall number of anti-patterns.
    GetPortfolioSummaryResponse -> Maybe AssessmentSummary
assessmentSummary :: Prelude.Maybe AssessmentSummary,
    -- | The response's http status code.
    GetPortfolioSummaryResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetPortfolioSummaryResponse -> GetPortfolioSummaryResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetPortfolioSummaryResponse -> GetPortfolioSummaryResponse -> Bool
$c/= :: GetPortfolioSummaryResponse -> GetPortfolioSummaryResponse -> Bool
== :: GetPortfolioSummaryResponse -> GetPortfolioSummaryResponse -> Bool
$c== :: GetPortfolioSummaryResponse -> GetPortfolioSummaryResponse -> Bool
Prelude.Eq, ReadPrec [GetPortfolioSummaryResponse]
ReadPrec GetPortfolioSummaryResponse
Int -> ReadS GetPortfolioSummaryResponse
ReadS [GetPortfolioSummaryResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetPortfolioSummaryResponse]
$creadListPrec :: ReadPrec [GetPortfolioSummaryResponse]
readPrec :: ReadPrec GetPortfolioSummaryResponse
$creadPrec :: ReadPrec GetPortfolioSummaryResponse
readList :: ReadS [GetPortfolioSummaryResponse]
$creadList :: ReadS [GetPortfolioSummaryResponse]
readsPrec :: Int -> ReadS GetPortfolioSummaryResponse
$creadsPrec :: Int -> ReadS GetPortfolioSummaryResponse
Prelude.Read, Int -> GetPortfolioSummaryResponse -> ShowS
[GetPortfolioSummaryResponse] -> ShowS
GetPortfolioSummaryResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetPortfolioSummaryResponse] -> ShowS
$cshowList :: [GetPortfolioSummaryResponse] -> ShowS
show :: GetPortfolioSummaryResponse -> String
$cshow :: GetPortfolioSummaryResponse -> String
showsPrec :: Int -> GetPortfolioSummaryResponse -> ShowS
$cshowsPrec :: Int -> GetPortfolioSummaryResponse -> ShowS
Prelude.Show, forall x.
Rep GetPortfolioSummaryResponse x -> GetPortfolioSummaryResponse
forall x.
GetPortfolioSummaryResponse -> Rep GetPortfolioSummaryResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetPortfolioSummaryResponse x -> GetPortfolioSummaryResponse
$cfrom :: forall x.
GetPortfolioSummaryResponse -> Rep GetPortfolioSummaryResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetPortfolioSummaryResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'assessmentSummary', 'getPortfolioSummaryResponse_assessmentSummary' - An assessment summary for the portfolio including the number of servers
-- to rehost and the overall number of anti-patterns.
--
-- 'httpStatus', 'getPortfolioSummaryResponse_httpStatus' - The response's http status code.
newGetPortfolioSummaryResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetPortfolioSummaryResponse
newGetPortfolioSummaryResponse :: Int -> GetPortfolioSummaryResponse
newGetPortfolioSummaryResponse Int
pHttpStatus_ =
  GetPortfolioSummaryResponse'
    { $sel:assessmentSummary:GetPortfolioSummaryResponse' :: Maybe AssessmentSummary
assessmentSummary =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetPortfolioSummaryResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An assessment summary for the portfolio including the number of servers
-- to rehost and the overall number of anti-patterns.
getPortfolioSummaryResponse_assessmentSummary :: Lens.Lens' GetPortfolioSummaryResponse (Prelude.Maybe AssessmentSummary)
getPortfolioSummaryResponse_assessmentSummary :: Lens' GetPortfolioSummaryResponse (Maybe AssessmentSummary)
getPortfolioSummaryResponse_assessmentSummary = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPortfolioSummaryResponse' {Maybe AssessmentSummary
assessmentSummary :: Maybe AssessmentSummary
$sel:assessmentSummary:GetPortfolioSummaryResponse' :: GetPortfolioSummaryResponse -> Maybe AssessmentSummary
assessmentSummary} -> Maybe AssessmentSummary
assessmentSummary) (\s :: GetPortfolioSummaryResponse
s@GetPortfolioSummaryResponse' {} Maybe AssessmentSummary
a -> GetPortfolioSummaryResponse
s {$sel:assessmentSummary:GetPortfolioSummaryResponse' :: Maybe AssessmentSummary
assessmentSummary = Maybe AssessmentSummary
a} :: GetPortfolioSummaryResponse)

-- | The response's http status code.
getPortfolioSummaryResponse_httpStatus :: Lens.Lens' GetPortfolioSummaryResponse Prelude.Int
getPortfolioSummaryResponse_httpStatus :: Lens' GetPortfolioSummaryResponse Int
getPortfolioSummaryResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPortfolioSummaryResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetPortfolioSummaryResponse' :: GetPortfolioSummaryResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetPortfolioSummaryResponse
s@GetPortfolioSummaryResponse' {} Int
a -> GetPortfolioSummaryResponse
s {$sel:httpStatus:GetPortfolioSummaryResponse' :: Int
httpStatus = Int
a} :: GetPortfolioSummaryResponse)

instance Prelude.NFData GetPortfolioSummaryResponse where
  rnf :: GetPortfolioSummaryResponse -> ()
rnf GetPortfolioSummaryResponse' {Int
Maybe AssessmentSummary
httpStatus :: Int
assessmentSummary :: Maybe AssessmentSummary
$sel:httpStatus:GetPortfolioSummaryResponse' :: GetPortfolioSummaryResponse -> Int
$sel:assessmentSummary:GetPortfolioSummaryResponse' :: GetPortfolioSummaryResponse -> Maybe AssessmentSummary
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe AssessmentSummary
assessmentSummary
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus