{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Snowball.Types.JobLogs where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 failure log is
    -- located.
    JobLogs -> Maybe Text
jobFailureLogURI :: Prelude.Maybe Prelude.Text,
    -- | 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 success log is
    -- located.
    JobLogs -> Maybe Text
jobSuccessLogURI :: Prelude.Maybe Prelude.Text
  }
  deriving (JobLogs -> JobLogs -> Bool
(JobLogs -> JobLogs -> Bool)
-> (JobLogs -> JobLogs -> Bool) -> Eq JobLogs
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]
(Int -> ReadS JobLogs)
-> ReadS [JobLogs]
-> ReadPrec JobLogs
-> ReadPrec [JobLogs]
-> Read 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
(Int -> JobLogs -> ShowS)
-> (JobLogs -> String) -> ([JobLogs] -> ShowS) -> Show JobLogs
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. JobLogs -> Rep JobLogs x)
-> (forall x. Rep JobLogs x -> JobLogs) -> Generic JobLogs
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:
--
-- 'jobFailureLogURI', 'jobLogs_jobFailureLogURI' - A link to an Amazon S3 presigned URL where the job failure log is
-- located.
--
-- 'jobCompletionReportURI', 'jobLogs_jobCompletionReportURI' - A link to an Amazon S3 presigned URL where the job completion report 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' :: Maybe Text -> Maybe Text -> Maybe Text -> JobLogs
JobLogs'
    { $sel:jobFailureLogURI:JobLogs' :: Maybe Text
jobFailureLogURI = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:jobCompletionReportURI:JobLogs' :: Maybe Text
jobCompletionReportURI = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:jobSuccessLogURI:JobLogs' :: Maybe Text
jobSuccessLogURI = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: (Maybe Text -> f (Maybe Text)) -> JobLogs -> f JobLogs
jobLogs_jobFailureLogURI = (JobLogs -> Maybe Text)
-> (JobLogs -> Maybe Text -> JobLogs)
-> Lens JobLogs JobLogs (Maybe Text) (Maybe Text)
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 completion report is
-- located.
jobLogs_jobCompletionReportURI :: Lens.Lens' JobLogs (Prelude.Maybe Prelude.Text)
jobLogs_jobCompletionReportURI :: (Maybe Text -> f (Maybe Text)) -> JobLogs -> f JobLogs
jobLogs_jobCompletionReportURI = (JobLogs -> Maybe Text)
-> (JobLogs -> Maybe Text -> JobLogs)
-> Lens JobLogs JobLogs (Maybe Text) (Maybe Text)
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 success log is
-- located.
jobLogs_jobSuccessLogURI :: Lens.Lens' JobLogs (Prelude.Maybe Prelude.Text)
jobLogs_jobSuccessLogURI :: (Maybe Text -> f (Maybe Text)) -> JobLogs -> f JobLogs
jobLogs_jobSuccessLogURI = (JobLogs -> Maybe Text)
-> (JobLogs -> Maybe Text -> JobLogs)
-> Lens JobLogs JobLogs (Maybe Text) (Maybe Text)
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 Core.FromJSON JobLogs where
  parseJSON :: Value -> Parser JobLogs
parseJSON =
    String -> (Object -> Parser JobLogs) -> Value -> Parser JobLogs
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"JobLogs"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> JobLogs
JobLogs'
            (Maybe Text -> Maybe Text -> Maybe Text -> JobLogs)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> JobLogs)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"JobFailureLogURI")
            Parser (Maybe Text -> Maybe Text -> JobLogs)
-> Parser (Maybe Text) -> Parser (Maybe Text -> JobLogs)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"JobCompletionReportURI")
            Parser (Maybe Text -> JobLogs)
-> Parser (Maybe Text) -> Parser JobLogs
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"JobSuccessLogURI")
      )

instance Prelude.Hashable JobLogs

instance Prelude.NFData JobLogs