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

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

-- |
-- Module      : Amazonka.Snowball.Types.JobLogs
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Snowball.Types.JobLogs where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Contains job logs. Whenever a Snow device is used to import data into or
-- export data out of Amazon S3, you\'ll have the option of downloading a
-- PDF job report. Job logs are returned as a part of the response syntax
-- of the @DescribeJob@ action in the @JobMetadata@ data type. The job logs
-- can be accessed for up to 60 minutes after this request has been made.
-- To access any of the job logs after 60 minutes have passed, you\'ll have
-- to make another call to the @DescribeJob@ action.
--
-- For import jobs, the PDF job report becomes available at the end of the
-- import process. For export jobs, your job report typically becomes
-- available while the Snow device for your job part is being delivered to
-- you.
--
-- The job report provides you insight into the state of your Amazon S3
-- data transfer. The report includes details about your job or job part
-- for your records.
--
-- For deeper visibility into the status of your transferred objects, you
-- can look at the two associated logs: a success log and a failure log.
-- The logs are saved in comma-separated value (CSV) format, and the name
-- of each log includes the ID of the job or job part that the log
-- describes.
--
-- /See:/ 'newJobLogs' smart constructor.
data JobLogs = JobLogs'
  { -- | A link to an Amazon S3 presigned URL where the job completion report is
    -- located.
    JobLogs -> Maybe Text
jobCompletionReportURI :: Prelude.Maybe Prelude.Text,
    -- | A link to an Amazon S3 presigned URL where the job failure log is
    -- located.
    JobLogs -> Maybe Text
jobFailureLogURI :: Prelude.Maybe Prelude.Text,
    -- | A link to an Amazon S3 presigned URL where the job success log is
    -- located.
    JobLogs -> Maybe Text
jobSuccessLogURI :: Prelude.Maybe Prelude.Text
  }
  deriving (JobLogs -> JobLogs -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: JobLogs -> JobLogs -> Bool
$c/= :: JobLogs -> JobLogs -> Bool
== :: JobLogs -> JobLogs -> Bool
$c== :: JobLogs -> JobLogs -> Bool
Prelude.Eq, ReadPrec [JobLogs]
ReadPrec JobLogs
Int -> ReadS JobLogs
ReadS [JobLogs]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [JobLogs]
$creadListPrec :: ReadPrec [JobLogs]
readPrec :: ReadPrec JobLogs
$creadPrec :: ReadPrec JobLogs
readList :: ReadS [JobLogs]
$creadList :: ReadS [JobLogs]
readsPrec :: Int -> ReadS JobLogs
$creadsPrec :: Int -> ReadS JobLogs
Prelude.Read, Int -> JobLogs -> ShowS
[JobLogs] -> ShowS
JobLogs -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [JobLogs] -> ShowS
$cshowList :: [JobLogs] -> ShowS
show :: JobLogs -> String
$cshow :: JobLogs -> String
showsPrec :: Int -> JobLogs -> ShowS
$cshowsPrec :: Int -> JobLogs -> ShowS
Prelude.Show, forall x. Rep JobLogs x -> JobLogs
forall x. JobLogs -> Rep JobLogs x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep JobLogs x -> JobLogs
$cfrom :: forall x. JobLogs -> Rep JobLogs x
Prelude.Generic)

-- |
-- Create a value of 'JobLogs' 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:
--
-- 'jobCompletionReportURI', 'jobLogs_jobCompletionReportURI' - A link to an Amazon S3 presigned URL where the job completion report is
-- located.
--
-- 'jobFailureLogURI', 'jobLogs_jobFailureLogURI' - A link to an Amazon S3 presigned URL where the job failure log is
-- located.
--
-- 'jobSuccessLogURI', 'jobLogs_jobSuccessLogURI' - A link to an Amazon S3 presigned URL where the job success log is
-- located.
newJobLogs ::
  JobLogs
newJobLogs :: JobLogs
newJobLogs =
  JobLogs'
    { $sel:jobCompletionReportURI:JobLogs' :: Maybe Text
jobCompletionReportURI = forall a. Maybe a
Prelude.Nothing,
      $sel:jobFailureLogURI:JobLogs' :: Maybe Text
jobFailureLogURI = forall a. Maybe a
Prelude.Nothing,
      $sel:jobSuccessLogURI:JobLogs' :: Maybe Text
jobSuccessLogURI = forall a. Maybe a
Prelude.Nothing
    }

-- | A link to an Amazon S3 presigned URL where the job completion report is
-- located.
jobLogs_jobCompletionReportURI :: Lens.Lens' JobLogs (Prelude.Maybe Prelude.Text)
jobLogs_jobCompletionReportURI :: Lens' JobLogs (Maybe Text)
jobLogs_jobCompletionReportURI = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobLogs' {Maybe Text
jobCompletionReportURI :: Maybe Text
$sel:jobCompletionReportURI:JobLogs' :: JobLogs -> Maybe Text
jobCompletionReportURI} -> Maybe Text
jobCompletionReportURI) (\s :: JobLogs
s@JobLogs' {} Maybe Text
a -> JobLogs
s {$sel:jobCompletionReportURI:JobLogs' :: Maybe Text
jobCompletionReportURI = Maybe Text
a} :: JobLogs)

-- | A link to an Amazon S3 presigned URL where the job failure log is
-- located.
jobLogs_jobFailureLogURI :: Lens.Lens' JobLogs (Prelude.Maybe Prelude.Text)
jobLogs_jobFailureLogURI :: Lens' JobLogs (Maybe Text)
jobLogs_jobFailureLogURI = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobLogs' {Maybe Text
jobFailureLogURI :: Maybe Text
$sel:jobFailureLogURI:JobLogs' :: JobLogs -> Maybe Text
jobFailureLogURI} -> Maybe Text
jobFailureLogURI) (\s :: JobLogs
s@JobLogs' {} Maybe Text
a -> JobLogs
s {$sel:jobFailureLogURI:JobLogs' :: Maybe Text
jobFailureLogURI = Maybe Text
a} :: JobLogs)

-- | A link to an Amazon S3 presigned URL where the job success log is
-- located.
jobLogs_jobSuccessLogURI :: Lens.Lens' JobLogs (Prelude.Maybe Prelude.Text)
jobLogs_jobSuccessLogURI :: Lens' JobLogs (Maybe Text)
jobLogs_jobSuccessLogURI = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\JobLogs' {Maybe Text
jobSuccessLogURI :: Maybe Text
$sel:jobSuccessLogURI:JobLogs' :: JobLogs -> Maybe Text
jobSuccessLogURI} -> Maybe Text
jobSuccessLogURI) (\s :: JobLogs
s@JobLogs' {} Maybe Text
a -> JobLogs
s {$sel:jobSuccessLogURI:JobLogs' :: Maybe Text
jobSuccessLogURI = Maybe Text
a} :: JobLogs)

instance Data.FromJSON JobLogs where
  parseJSON :: Value -> Parser JobLogs
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"JobLogs"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> JobLogs
JobLogs'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"JobCompletionReportURI")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"JobFailureLogURI")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"JobSuccessLogURI")
      )

instance Prelude.Hashable JobLogs where
  hashWithSalt :: Int -> JobLogs -> Int
hashWithSalt Int
_salt JobLogs' {Maybe Text
jobSuccessLogURI :: Maybe Text
jobFailureLogURI :: Maybe Text
jobCompletionReportURI :: Maybe Text
$sel:jobSuccessLogURI:JobLogs' :: JobLogs -> Maybe Text
$sel:jobFailureLogURI:JobLogs' :: JobLogs -> Maybe Text
$sel:jobCompletionReportURI:JobLogs' :: JobLogs -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
jobCompletionReportURI
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
jobFailureLogURI
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
jobSuccessLogURI

instance Prelude.NFData JobLogs where
  rnf :: JobLogs -> ()
rnf JobLogs' {Maybe Text
jobSuccessLogURI :: Maybe Text
jobFailureLogURI :: Maybe Text
jobCompletionReportURI :: Maybe Text
$sel:jobSuccessLogURI:JobLogs' :: JobLogs -> Maybe Text
$sel:jobFailureLogURI:JobLogs' :: JobLogs -> Maybe Text
$sel:jobCompletionReportURI:JobLogs' :: JobLogs -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
jobCompletionReportURI
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
jobFailureLogURI
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
jobSuccessLogURI