{-# 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.StartRecommendationReportGeneration
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Starts generating a recommendation report.
module Amazonka.MigrationHubStrategy.StartRecommendationReportGeneration
  ( -- * Creating a Request
    StartRecommendationReportGeneration (..),
    newStartRecommendationReportGeneration,

    -- * Request Lenses
    startRecommendationReportGeneration_groupIdFilter,
    startRecommendationReportGeneration_outputFormat,

    -- * Destructuring the Response
    StartRecommendationReportGenerationResponse (..),
    newStartRecommendationReportGenerationResponse,

    -- * Response Lenses
    startRecommendationReportGenerationResponse_id,
    startRecommendationReportGenerationResponse_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:/ 'newStartRecommendationReportGeneration' smart constructor.
data StartRecommendationReportGeneration = StartRecommendationReportGeneration'
  { -- | Groups the resources in the recommendation report with a unique name.
    StartRecommendationReportGeneration -> Maybe [Group]
groupIdFilter :: Prelude.Maybe [Group],
    -- | The output format for the recommendation report file. The default format
    -- is Microsoft Excel.
    StartRecommendationReportGeneration -> Maybe OutputFormat
outputFormat :: Prelude.Maybe OutputFormat
  }
  deriving (StartRecommendationReportGeneration
-> StartRecommendationReportGeneration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartRecommendationReportGeneration
-> StartRecommendationReportGeneration -> Bool
$c/= :: StartRecommendationReportGeneration
-> StartRecommendationReportGeneration -> Bool
== :: StartRecommendationReportGeneration
-> StartRecommendationReportGeneration -> Bool
$c== :: StartRecommendationReportGeneration
-> StartRecommendationReportGeneration -> Bool
Prelude.Eq, ReadPrec [StartRecommendationReportGeneration]
ReadPrec StartRecommendationReportGeneration
Int -> ReadS StartRecommendationReportGeneration
ReadS [StartRecommendationReportGeneration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartRecommendationReportGeneration]
$creadListPrec :: ReadPrec [StartRecommendationReportGeneration]
readPrec :: ReadPrec StartRecommendationReportGeneration
$creadPrec :: ReadPrec StartRecommendationReportGeneration
readList :: ReadS [StartRecommendationReportGeneration]
$creadList :: ReadS [StartRecommendationReportGeneration]
readsPrec :: Int -> ReadS StartRecommendationReportGeneration
$creadsPrec :: Int -> ReadS StartRecommendationReportGeneration
Prelude.Read, Int -> StartRecommendationReportGeneration -> ShowS
[StartRecommendationReportGeneration] -> ShowS
StartRecommendationReportGeneration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartRecommendationReportGeneration] -> ShowS
$cshowList :: [StartRecommendationReportGeneration] -> ShowS
show :: StartRecommendationReportGeneration -> String
$cshow :: StartRecommendationReportGeneration -> String
showsPrec :: Int -> StartRecommendationReportGeneration -> ShowS
$cshowsPrec :: Int -> StartRecommendationReportGeneration -> ShowS
Prelude.Show, forall x.
Rep StartRecommendationReportGeneration x
-> StartRecommendationReportGeneration
forall x.
StartRecommendationReportGeneration
-> Rep StartRecommendationReportGeneration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartRecommendationReportGeneration x
-> StartRecommendationReportGeneration
$cfrom :: forall x.
StartRecommendationReportGeneration
-> Rep StartRecommendationReportGeneration x
Prelude.Generic)

-- |
-- Create a value of 'StartRecommendationReportGeneration' 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:
--
-- 'groupIdFilter', 'startRecommendationReportGeneration_groupIdFilter' - Groups the resources in the recommendation report with a unique name.
--
-- 'outputFormat', 'startRecommendationReportGeneration_outputFormat' - The output format for the recommendation report file. The default format
-- is Microsoft Excel.
newStartRecommendationReportGeneration ::
  StartRecommendationReportGeneration
newStartRecommendationReportGeneration :: StartRecommendationReportGeneration
newStartRecommendationReportGeneration =
  StartRecommendationReportGeneration'
    { $sel:groupIdFilter:StartRecommendationReportGeneration' :: Maybe [Group]
groupIdFilter =
        forall a. Maybe a
Prelude.Nothing,
      $sel:outputFormat:StartRecommendationReportGeneration' :: Maybe OutputFormat
outputFormat = forall a. Maybe a
Prelude.Nothing
    }

-- | Groups the resources in the recommendation report with a unique name.
startRecommendationReportGeneration_groupIdFilter :: Lens.Lens' StartRecommendationReportGeneration (Prelude.Maybe [Group])
startRecommendationReportGeneration_groupIdFilter :: Lens' StartRecommendationReportGeneration (Maybe [Group])
startRecommendationReportGeneration_groupIdFilter = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartRecommendationReportGeneration' {Maybe [Group]
groupIdFilter :: Maybe [Group]
$sel:groupIdFilter:StartRecommendationReportGeneration' :: StartRecommendationReportGeneration -> Maybe [Group]
groupIdFilter} -> Maybe [Group]
groupIdFilter) (\s :: StartRecommendationReportGeneration
s@StartRecommendationReportGeneration' {} Maybe [Group]
a -> StartRecommendationReportGeneration
s {$sel:groupIdFilter:StartRecommendationReportGeneration' :: Maybe [Group]
groupIdFilter = Maybe [Group]
a} :: StartRecommendationReportGeneration) 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 output format for the recommendation report file. The default format
-- is Microsoft Excel.
startRecommendationReportGeneration_outputFormat :: Lens.Lens' StartRecommendationReportGeneration (Prelude.Maybe OutputFormat)
startRecommendationReportGeneration_outputFormat :: Lens' StartRecommendationReportGeneration (Maybe OutputFormat)
startRecommendationReportGeneration_outputFormat = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartRecommendationReportGeneration' {Maybe OutputFormat
outputFormat :: Maybe OutputFormat
$sel:outputFormat:StartRecommendationReportGeneration' :: StartRecommendationReportGeneration -> Maybe OutputFormat
outputFormat} -> Maybe OutputFormat
outputFormat) (\s :: StartRecommendationReportGeneration
s@StartRecommendationReportGeneration' {} Maybe OutputFormat
a -> StartRecommendationReportGeneration
s {$sel:outputFormat:StartRecommendationReportGeneration' :: Maybe OutputFormat
outputFormat = Maybe OutputFormat
a} :: StartRecommendationReportGeneration)

instance
  Core.AWSRequest
    StartRecommendationReportGeneration
  where
  type
    AWSResponse StartRecommendationReportGeneration =
      StartRecommendationReportGenerationResponse
  request :: (Service -> Service)
-> StartRecommendationReportGeneration
-> Request StartRecommendationReportGeneration
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy StartRecommendationReportGeneration
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse StartRecommendationReportGeneration)))
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 Text -> Int -> StartRecommendationReportGenerationResponse
StartRecommendationReportGenerationResponse'
            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
"id")
            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
    StartRecommendationReportGeneration
  where
  hashWithSalt :: Int -> StartRecommendationReportGeneration -> Int
hashWithSalt
    Int
_salt
    StartRecommendationReportGeneration' {Maybe [Group]
Maybe OutputFormat
outputFormat :: Maybe OutputFormat
groupIdFilter :: Maybe [Group]
$sel:outputFormat:StartRecommendationReportGeneration' :: StartRecommendationReportGeneration -> Maybe OutputFormat
$sel:groupIdFilter:StartRecommendationReportGeneration' :: StartRecommendationReportGeneration -> Maybe [Group]
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Group]
groupIdFilter
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe OutputFormat
outputFormat

instance
  Prelude.NFData
    StartRecommendationReportGeneration
  where
  rnf :: StartRecommendationReportGeneration -> ()
rnf StartRecommendationReportGeneration' {Maybe [Group]
Maybe OutputFormat
outputFormat :: Maybe OutputFormat
groupIdFilter :: Maybe [Group]
$sel:outputFormat:StartRecommendationReportGeneration' :: StartRecommendationReportGeneration -> Maybe OutputFormat
$sel:groupIdFilter:StartRecommendationReportGeneration' :: StartRecommendationReportGeneration -> Maybe [Group]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Group]
groupIdFilter
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe OutputFormat
outputFormat

instance
  Data.ToHeaders
    StartRecommendationReportGeneration
  where
  toHeaders :: StartRecommendationReportGeneration -> 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.ToJSON
    StartRecommendationReportGeneration
  where
  toJSON :: StartRecommendationReportGeneration -> Value
toJSON StartRecommendationReportGeneration' {Maybe [Group]
Maybe OutputFormat
outputFormat :: Maybe OutputFormat
groupIdFilter :: Maybe [Group]
$sel:outputFormat:StartRecommendationReportGeneration' :: StartRecommendationReportGeneration -> Maybe OutputFormat
$sel:groupIdFilter:StartRecommendationReportGeneration' :: StartRecommendationReportGeneration -> Maybe [Group]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"groupIdFilter" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Group]
groupIdFilter,
            (Key
"outputFormat" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe OutputFormat
outputFormat
          ]
      )

instance
  Data.ToPath
    StartRecommendationReportGeneration
  where
  toPath :: StartRecommendationReportGeneration -> ByteString
toPath =
    forall a b. a -> b -> a
Prelude.const
      ByteString
"/start-recommendation-report-generation"

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

-- | /See:/ 'newStartRecommendationReportGenerationResponse' smart constructor.
data StartRecommendationReportGenerationResponse = StartRecommendationReportGenerationResponse'
  { -- | The ID of the recommendation report generation task.
    StartRecommendationReportGenerationResponse -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    StartRecommendationReportGenerationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (StartRecommendationReportGenerationResponse
-> StartRecommendationReportGenerationResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartRecommendationReportGenerationResponse
-> StartRecommendationReportGenerationResponse -> Bool
$c/= :: StartRecommendationReportGenerationResponse
-> StartRecommendationReportGenerationResponse -> Bool
== :: StartRecommendationReportGenerationResponse
-> StartRecommendationReportGenerationResponse -> Bool
$c== :: StartRecommendationReportGenerationResponse
-> StartRecommendationReportGenerationResponse -> Bool
Prelude.Eq, ReadPrec [StartRecommendationReportGenerationResponse]
ReadPrec StartRecommendationReportGenerationResponse
Int -> ReadS StartRecommendationReportGenerationResponse
ReadS [StartRecommendationReportGenerationResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartRecommendationReportGenerationResponse]
$creadListPrec :: ReadPrec [StartRecommendationReportGenerationResponse]
readPrec :: ReadPrec StartRecommendationReportGenerationResponse
$creadPrec :: ReadPrec StartRecommendationReportGenerationResponse
readList :: ReadS [StartRecommendationReportGenerationResponse]
$creadList :: ReadS [StartRecommendationReportGenerationResponse]
readsPrec :: Int -> ReadS StartRecommendationReportGenerationResponse
$creadsPrec :: Int -> ReadS StartRecommendationReportGenerationResponse
Prelude.Read, Int -> StartRecommendationReportGenerationResponse -> ShowS
[StartRecommendationReportGenerationResponse] -> ShowS
StartRecommendationReportGenerationResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartRecommendationReportGenerationResponse] -> ShowS
$cshowList :: [StartRecommendationReportGenerationResponse] -> ShowS
show :: StartRecommendationReportGenerationResponse -> String
$cshow :: StartRecommendationReportGenerationResponse -> String
showsPrec :: Int -> StartRecommendationReportGenerationResponse -> ShowS
$cshowsPrec :: Int -> StartRecommendationReportGenerationResponse -> ShowS
Prelude.Show, forall x.
Rep StartRecommendationReportGenerationResponse x
-> StartRecommendationReportGenerationResponse
forall x.
StartRecommendationReportGenerationResponse
-> Rep StartRecommendationReportGenerationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartRecommendationReportGenerationResponse x
-> StartRecommendationReportGenerationResponse
$cfrom :: forall x.
StartRecommendationReportGenerationResponse
-> Rep StartRecommendationReportGenerationResponse x
Prelude.Generic)

-- |
-- Create a value of 'StartRecommendationReportGenerationResponse' 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:
--
-- 'id', 'startRecommendationReportGenerationResponse_id' - The ID of the recommendation report generation task.
--
-- 'httpStatus', 'startRecommendationReportGenerationResponse_httpStatus' - The response's http status code.
newStartRecommendationReportGenerationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  StartRecommendationReportGenerationResponse
newStartRecommendationReportGenerationResponse :: Int -> StartRecommendationReportGenerationResponse
newStartRecommendationReportGenerationResponse
  Int
pHttpStatus_ =
    StartRecommendationReportGenerationResponse'
      { $sel:id:StartRecommendationReportGenerationResponse' :: Maybe Text
id =
          forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:StartRecommendationReportGenerationResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | The ID of the recommendation report generation task.
startRecommendationReportGenerationResponse_id :: Lens.Lens' StartRecommendationReportGenerationResponse (Prelude.Maybe Prelude.Text)
startRecommendationReportGenerationResponse_id :: Lens' StartRecommendationReportGenerationResponse (Maybe Text)
startRecommendationReportGenerationResponse_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartRecommendationReportGenerationResponse' {Maybe Text
id :: Maybe Text
$sel:id:StartRecommendationReportGenerationResponse' :: StartRecommendationReportGenerationResponse -> Maybe Text
id} -> Maybe Text
id) (\s :: StartRecommendationReportGenerationResponse
s@StartRecommendationReportGenerationResponse' {} Maybe Text
a -> StartRecommendationReportGenerationResponse
s {$sel:id:StartRecommendationReportGenerationResponse' :: Maybe Text
id = Maybe Text
a} :: StartRecommendationReportGenerationResponse)

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

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