{-# 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.GetApplicationComponentStrategies
-- 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 a list of all the recommended strategies and tools for an
-- application component running on a server.
module Amazonka.MigrationHubStrategy.GetApplicationComponentStrategies
  ( -- * Creating a Request
    GetApplicationComponentStrategies (..),
    newGetApplicationComponentStrategies,

    -- * Request Lenses
    getApplicationComponentStrategies_applicationComponentId,

    -- * Destructuring the Response
    GetApplicationComponentStrategiesResponse (..),
    newGetApplicationComponentStrategiesResponse,

    -- * Response Lenses
    getApplicationComponentStrategiesResponse_applicationComponentStrategies,
    getApplicationComponentStrategiesResponse_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:/ 'newGetApplicationComponentStrategies' smart constructor.
data GetApplicationComponentStrategies = GetApplicationComponentStrategies'
  { -- | The ID of the application component. The ID is unique within an AWS
    -- account.
    GetApplicationComponentStrategies -> Text
applicationComponentId :: Prelude.Text
  }
  deriving (GetApplicationComponentStrategies
-> GetApplicationComponentStrategies -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetApplicationComponentStrategies
-> GetApplicationComponentStrategies -> Bool
$c/= :: GetApplicationComponentStrategies
-> GetApplicationComponentStrategies -> Bool
== :: GetApplicationComponentStrategies
-> GetApplicationComponentStrategies -> Bool
$c== :: GetApplicationComponentStrategies
-> GetApplicationComponentStrategies -> Bool
Prelude.Eq, ReadPrec [GetApplicationComponentStrategies]
ReadPrec GetApplicationComponentStrategies
Int -> ReadS GetApplicationComponentStrategies
ReadS [GetApplicationComponentStrategies]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetApplicationComponentStrategies]
$creadListPrec :: ReadPrec [GetApplicationComponentStrategies]
readPrec :: ReadPrec GetApplicationComponentStrategies
$creadPrec :: ReadPrec GetApplicationComponentStrategies
readList :: ReadS [GetApplicationComponentStrategies]
$creadList :: ReadS [GetApplicationComponentStrategies]
readsPrec :: Int -> ReadS GetApplicationComponentStrategies
$creadsPrec :: Int -> ReadS GetApplicationComponentStrategies
Prelude.Read, Int -> GetApplicationComponentStrategies -> ShowS
[GetApplicationComponentStrategies] -> ShowS
GetApplicationComponentStrategies -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetApplicationComponentStrategies] -> ShowS
$cshowList :: [GetApplicationComponentStrategies] -> ShowS
show :: GetApplicationComponentStrategies -> String
$cshow :: GetApplicationComponentStrategies -> String
showsPrec :: Int -> GetApplicationComponentStrategies -> ShowS
$cshowsPrec :: Int -> GetApplicationComponentStrategies -> ShowS
Prelude.Show, forall x.
Rep GetApplicationComponentStrategies x
-> GetApplicationComponentStrategies
forall x.
GetApplicationComponentStrategies
-> Rep GetApplicationComponentStrategies x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetApplicationComponentStrategies x
-> GetApplicationComponentStrategies
$cfrom :: forall x.
GetApplicationComponentStrategies
-> Rep GetApplicationComponentStrategies x
Prelude.Generic)

-- |
-- Create a value of 'GetApplicationComponentStrategies' 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:
--
-- 'applicationComponentId', 'getApplicationComponentStrategies_applicationComponentId' - The ID of the application component. The ID is unique within an AWS
-- account.
newGetApplicationComponentStrategies ::
  -- | 'applicationComponentId'
  Prelude.Text ->
  GetApplicationComponentStrategies
newGetApplicationComponentStrategies :: Text -> GetApplicationComponentStrategies
newGetApplicationComponentStrategies
  Text
pApplicationComponentId_ =
    GetApplicationComponentStrategies'
      { $sel:applicationComponentId:GetApplicationComponentStrategies' :: Text
applicationComponentId =
          Text
pApplicationComponentId_
      }

-- | The ID of the application component. The ID is unique within an AWS
-- account.
getApplicationComponentStrategies_applicationComponentId :: Lens.Lens' GetApplicationComponentStrategies Prelude.Text
getApplicationComponentStrategies_applicationComponentId :: Lens' GetApplicationComponentStrategies Text
getApplicationComponentStrategies_applicationComponentId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApplicationComponentStrategies' {Text
applicationComponentId :: Text
$sel:applicationComponentId:GetApplicationComponentStrategies' :: GetApplicationComponentStrategies -> Text
applicationComponentId} -> Text
applicationComponentId) (\s :: GetApplicationComponentStrategies
s@GetApplicationComponentStrategies' {} Text
a -> GetApplicationComponentStrategies
s {$sel:applicationComponentId:GetApplicationComponentStrategies' :: Text
applicationComponentId = Text
a} :: GetApplicationComponentStrategies)

instance
  Core.AWSRequest
    GetApplicationComponentStrategies
  where
  type
    AWSResponse GetApplicationComponentStrategies =
      GetApplicationComponentStrategiesResponse
  request :: (Service -> Service)
-> GetApplicationComponentStrategies
-> Request GetApplicationComponentStrategies
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 GetApplicationComponentStrategies
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse GetApplicationComponentStrategies)))
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 [ApplicationComponentStrategy]
-> Int -> GetApplicationComponentStrategiesResponse
GetApplicationComponentStrategiesResponse'
            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
"applicationComponentStrategies"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                        )
            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
    GetApplicationComponentStrategies
  where
  hashWithSalt :: Int -> GetApplicationComponentStrategies -> Int
hashWithSalt
    Int
_salt
    GetApplicationComponentStrategies' {Text
applicationComponentId :: Text
$sel:applicationComponentId:GetApplicationComponentStrategies' :: GetApplicationComponentStrategies -> Text
..} =
      Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
applicationComponentId

instance
  Prelude.NFData
    GetApplicationComponentStrategies
  where
  rnf :: GetApplicationComponentStrategies -> ()
rnf GetApplicationComponentStrategies' {Text
applicationComponentId :: Text
$sel:applicationComponentId:GetApplicationComponentStrategies' :: GetApplicationComponentStrategies -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
applicationComponentId

instance
  Data.ToHeaders
    GetApplicationComponentStrategies
  where
  toHeaders :: GetApplicationComponentStrategies -> 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
    GetApplicationComponentStrategies
  where
  toPath :: GetApplicationComponentStrategies -> ByteString
toPath GetApplicationComponentStrategies' {Text
applicationComponentId :: Text
$sel:applicationComponentId:GetApplicationComponentStrategies' :: GetApplicationComponentStrategies -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/get-applicationcomponent-strategies/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
applicationComponentId
      ]

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

-- | /See:/ 'newGetApplicationComponentStrategiesResponse' smart constructor.
data GetApplicationComponentStrategiesResponse = GetApplicationComponentStrategiesResponse'
  { -- | A list of application component strategy recommendations.
    GetApplicationComponentStrategiesResponse
-> Maybe [ApplicationComponentStrategy]
applicationComponentStrategies :: Prelude.Maybe [ApplicationComponentStrategy],
    -- | The response's http status code.
    GetApplicationComponentStrategiesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetApplicationComponentStrategiesResponse
-> GetApplicationComponentStrategiesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetApplicationComponentStrategiesResponse
-> GetApplicationComponentStrategiesResponse -> Bool
$c/= :: GetApplicationComponentStrategiesResponse
-> GetApplicationComponentStrategiesResponse -> Bool
== :: GetApplicationComponentStrategiesResponse
-> GetApplicationComponentStrategiesResponse -> Bool
$c== :: GetApplicationComponentStrategiesResponse
-> GetApplicationComponentStrategiesResponse -> Bool
Prelude.Eq, ReadPrec [GetApplicationComponentStrategiesResponse]
ReadPrec GetApplicationComponentStrategiesResponse
Int -> ReadS GetApplicationComponentStrategiesResponse
ReadS [GetApplicationComponentStrategiesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetApplicationComponentStrategiesResponse]
$creadListPrec :: ReadPrec [GetApplicationComponentStrategiesResponse]
readPrec :: ReadPrec GetApplicationComponentStrategiesResponse
$creadPrec :: ReadPrec GetApplicationComponentStrategiesResponse
readList :: ReadS [GetApplicationComponentStrategiesResponse]
$creadList :: ReadS [GetApplicationComponentStrategiesResponse]
readsPrec :: Int -> ReadS GetApplicationComponentStrategiesResponse
$creadsPrec :: Int -> ReadS GetApplicationComponentStrategiesResponse
Prelude.Read, Int -> GetApplicationComponentStrategiesResponse -> ShowS
[GetApplicationComponentStrategiesResponse] -> ShowS
GetApplicationComponentStrategiesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetApplicationComponentStrategiesResponse] -> ShowS
$cshowList :: [GetApplicationComponentStrategiesResponse] -> ShowS
show :: GetApplicationComponentStrategiesResponse -> String
$cshow :: GetApplicationComponentStrategiesResponse -> String
showsPrec :: Int -> GetApplicationComponentStrategiesResponse -> ShowS
$cshowsPrec :: Int -> GetApplicationComponentStrategiesResponse -> ShowS
Prelude.Show, forall x.
Rep GetApplicationComponentStrategiesResponse x
-> GetApplicationComponentStrategiesResponse
forall x.
GetApplicationComponentStrategiesResponse
-> Rep GetApplicationComponentStrategiesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetApplicationComponentStrategiesResponse x
-> GetApplicationComponentStrategiesResponse
$cfrom :: forall x.
GetApplicationComponentStrategiesResponse
-> Rep GetApplicationComponentStrategiesResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetApplicationComponentStrategiesResponse' 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:
--
-- 'applicationComponentStrategies', 'getApplicationComponentStrategiesResponse_applicationComponentStrategies' - A list of application component strategy recommendations.
--
-- 'httpStatus', 'getApplicationComponentStrategiesResponse_httpStatus' - The response's http status code.
newGetApplicationComponentStrategiesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetApplicationComponentStrategiesResponse
newGetApplicationComponentStrategiesResponse :: Int -> GetApplicationComponentStrategiesResponse
newGetApplicationComponentStrategiesResponse
  Int
pHttpStatus_ =
    GetApplicationComponentStrategiesResponse'
      { $sel:applicationComponentStrategies:GetApplicationComponentStrategiesResponse' :: Maybe [ApplicationComponentStrategy]
applicationComponentStrategies =
          forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:GetApplicationComponentStrategiesResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | A list of application component strategy recommendations.
getApplicationComponentStrategiesResponse_applicationComponentStrategies :: Lens.Lens' GetApplicationComponentStrategiesResponse (Prelude.Maybe [ApplicationComponentStrategy])
getApplicationComponentStrategiesResponse_applicationComponentStrategies :: Lens'
  GetApplicationComponentStrategiesResponse
  (Maybe [ApplicationComponentStrategy])
getApplicationComponentStrategiesResponse_applicationComponentStrategies = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApplicationComponentStrategiesResponse' {Maybe [ApplicationComponentStrategy]
applicationComponentStrategies :: Maybe [ApplicationComponentStrategy]
$sel:applicationComponentStrategies:GetApplicationComponentStrategiesResponse' :: GetApplicationComponentStrategiesResponse
-> Maybe [ApplicationComponentStrategy]
applicationComponentStrategies} -> Maybe [ApplicationComponentStrategy]
applicationComponentStrategies) (\s :: GetApplicationComponentStrategiesResponse
s@GetApplicationComponentStrategiesResponse' {} Maybe [ApplicationComponentStrategy]
a -> GetApplicationComponentStrategiesResponse
s {$sel:applicationComponentStrategies:GetApplicationComponentStrategiesResponse' :: Maybe [ApplicationComponentStrategy]
applicationComponentStrategies = Maybe [ApplicationComponentStrategy]
a} :: GetApplicationComponentStrategiesResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    GetApplicationComponentStrategiesResponse
  where
  rnf :: GetApplicationComponentStrategiesResponse -> ()
rnf GetApplicationComponentStrategiesResponse' {Int
Maybe [ApplicationComponentStrategy]
httpStatus :: Int
applicationComponentStrategies :: Maybe [ApplicationComponentStrategy]
$sel:httpStatus:GetApplicationComponentStrategiesResponse' :: GetApplicationComponentStrategiesResponse -> Int
$sel:applicationComponentStrategies:GetApplicationComponentStrategiesResponse' :: GetApplicationComponentStrategiesResponse
-> Maybe [ApplicationComponentStrategy]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [ApplicationComponentStrategy]
applicationComponentStrategies
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus