packages feed

amazonka-migrationhubstrategy-2.0: gen/Amazonka/MigrationHubStrategy/StartAssessment.hs

{-# 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.StartAssessment
-- 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 the assessment of an on-premises environment.
module Amazonka.MigrationHubStrategy.StartAssessment
  ( -- * Creating a Request
    StartAssessment (..),
    newStartAssessment,

    -- * Request Lenses
    startAssessment_assessmentTargets,
    startAssessment_s3bucketForAnalysisData,
    startAssessment_s3bucketForReportData,

    -- * Destructuring the Response
    StartAssessmentResponse (..),
    newStartAssessmentResponse,

    -- * Response Lenses
    startAssessmentResponse_assessmentId,
    startAssessmentResponse_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:/ 'newStartAssessment' smart constructor.
data StartAssessment = StartAssessment'
  { -- | List of criteria for assessment.
    assessmentTargets :: Prelude.Maybe [AssessmentTarget],
    -- | The S3 bucket used by the collectors to send analysis data to the
    -- service. The bucket name must begin with @migrationhub-strategy-@.
    s3bucketForAnalysisData :: Prelude.Maybe Prelude.Text,
    -- | The S3 bucket where all the reports generated by the service are stored.
    -- The bucket name must begin with @migrationhub-strategy-@.
    s3bucketForReportData :: Prelude.Maybe Prelude.Text
  }
  deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic)

-- |
-- Create a value of 'StartAssessment' 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:
--
-- 'assessmentTargets', 'startAssessment_assessmentTargets' - List of criteria for assessment.
--
-- 's3bucketForAnalysisData', 'startAssessment_s3bucketForAnalysisData' - The S3 bucket used by the collectors to send analysis data to the
-- service. The bucket name must begin with @migrationhub-strategy-@.
--
-- 's3bucketForReportData', 'startAssessment_s3bucketForReportData' - The S3 bucket where all the reports generated by the service are stored.
-- The bucket name must begin with @migrationhub-strategy-@.
newStartAssessment ::
  StartAssessment
newStartAssessment =
  StartAssessment'
    { assessmentTargets =
        Prelude.Nothing,
      s3bucketForAnalysisData = Prelude.Nothing,
      s3bucketForReportData = Prelude.Nothing
    }

-- | List of criteria for assessment.
startAssessment_assessmentTargets :: Lens.Lens' StartAssessment (Prelude.Maybe [AssessmentTarget])
startAssessment_assessmentTargets = Lens.lens (\StartAssessment' {assessmentTargets} -> assessmentTargets) (\s@StartAssessment' {} a -> s {assessmentTargets = a} :: StartAssessment) Prelude.. Lens.mapping Lens.coerced

-- | The S3 bucket used by the collectors to send analysis data to the
-- service. The bucket name must begin with @migrationhub-strategy-@.
startAssessment_s3bucketForAnalysisData :: Lens.Lens' StartAssessment (Prelude.Maybe Prelude.Text)
startAssessment_s3bucketForAnalysisData = Lens.lens (\StartAssessment' {s3bucketForAnalysisData} -> s3bucketForAnalysisData) (\s@StartAssessment' {} a -> s {s3bucketForAnalysisData = a} :: StartAssessment)

-- | The S3 bucket where all the reports generated by the service are stored.
-- The bucket name must begin with @migrationhub-strategy-@.
startAssessment_s3bucketForReportData :: Lens.Lens' StartAssessment (Prelude.Maybe Prelude.Text)
startAssessment_s3bucketForReportData = Lens.lens (\StartAssessment' {s3bucketForReportData} -> s3bucketForReportData) (\s@StartAssessment' {} a -> s {s3bucketForReportData = a} :: StartAssessment)

instance Core.AWSRequest StartAssessment where
  type
    AWSResponse StartAssessment =
      StartAssessmentResponse
  request overrides =
    Request.postJSON (overrides defaultService)
  response =
    Response.receiveJSON
      ( \s h x ->
          StartAssessmentResponse'
            Prelude.<$> (x Data..?> "assessmentId")
            Prelude.<*> (Prelude.pure (Prelude.fromEnum s))
      )

instance Prelude.Hashable StartAssessment where
  hashWithSalt _salt StartAssessment' {..} =
    _salt
      `Prelude.hashWithSalt` assessmentTargets
      `Prelude.hashWithSalt` s3bucketForAnalysisData
      `Prelude.hashWithSalt` s3bucketForReportData

instance Prelude.NFData StartAssessment where
  rnf StartAssessment' {..} =
    Prelude.rnf assessmentTargets
      `Prelude.seq` Prelude.rnf s3bucketForAnalysisData
      `Prelude.seq` Prelude.rnf s3bucketForReportData

instance Data.ToHeaders StartAssessment where
  toHeaders =
    Prelude.const
      ( Prelude.mconcat
          [ "Content-Type"
              Data.=# ( "application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON StartAssessment where
  toJSON StartAssessment' {..} =
    Data.object
      ( Prelude.catMaybes
          [ ("assessmentTargets" Data..=)
              Prelude.<$> assessmentTargets,
            ("s3bucketForAnalysisData" Data..=)
              Prelude.<$> s3bucketForAnalysisData,
            ("s3bucketForReportData" Data..=)
              Prelude.<$> s3bucketForReportData
          ]
      )

instance Data.ToPath StartAssessment where
  toPath = Prelude.const "/start-assessment"

instance Data.ToQuery StartAssessment where
  toQuery = Prelude.const Prelude.mempty

-- | /See:/ 'newStartAssessmentResponse' smart constructor.
data StartAssessmentResponse = StartAssessmentResponse'
  { -- | The ID of the assessment.
    assessmentId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    httpStatus :: Prelude.Int
  }
  deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic)

-- |
-- Create a value of 'StartAssessmentResponse' 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:
--
-- 'assessmentId', 'startAssessmentResponse_assessmentId' - The ID of the assessment.
--
-- 'httpStatus', 'startAssessmentResponse_httpStatus' - The response's http status code.
newStartAssessmentResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  StartAssessmentResponse
newStartAssessmentResponse pHttpStatus_ =
  StartAssessmentResponse'
    { assessmentId =
        Prelude.Nothing,
      httpStatus = pHttpStatus_
    }

-- | The ID of the assessment.
startAssessmentResponse_assessmentId :: Lens.Lens' StartAssessmentResponse (Prelude.Maybe Prelude.Text)
startAssessmentResponse_assessmentId = Lens.lens (\StartAssessmentResponse' {assessmentId} -> assessmentId) (\s@StartAssessmentResponse' {} a -> s {assessmentId = a} :: StartAssessmentResponse)

-- | The response's http status code.
startAssessmentResponse_httpStatus :: Lens.Lens' StartAssessmentResponse Prelude.Int
startAssessmentResponse_httpStatus = Lens.lens (\StartAssessmentResponse' {httpStatus} -> httpStatus) (\s@StartAssessmentResponse' {} a -> s {httpStatus = a} :: StartAssessmentResponse)

instance Prelude.NFData StartAssessmentResponse where
  rnf StartAssessmentResponse' {..} =
    Prelude.rnf assessmentId
      `Prelude.seq` Prelude.rnf httpStatus