{-# 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.Glacier.ListJobs
-- 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)
--
-- This operation lists jobs for a vault, including jobs that are
-- in-progress and jobs that have recently finished. The List Job operation
-- returns a list of these jobs sorted by job initiation time.
--
-- Amazon Glacier retains recently completed jobs for a period before
-- deleting them; however, it eventually removes completed jobs. The output
-- of completed jobs can be retrieved. Retaining completed jobs for a
-- period of time after they have completed enables you to get a job output
-- in the event you miss the job completion notification or your first
-- attempt to download it fails. For example, suppose you start an archive
-- retrieval job to download an archive. After the job completes, you start
-- to download the archive but encounter a network error. In this scenario,
-- you can retry and download the archive while the job exists.
--
-- The List Jobs operation supports pagination. You should always check the
-- response @Marker@ field. If there are no more jobs to list, the @Marker@
-- field is set to @null@. If there are more jobs to list, the @Marker@
-- field is set to a non-null value, which you can use to continue the
-- pagination of the list. To return a list of jobs that begins at a
-- specific job, set the marker request parameter to the @Marker@ value for
-- that job that you obtained from a previous List Jobs request.
--
-- You can set a maximum limit for the number of jobs returned in the
-- response by specifying the @limit@ parameter in the request. The default
-- limit is 50. The number of jobs returned might be fewer than the limit,
-- but the number of returned jobs never exceeds the limit.
--
-- Additionally, you can filter the jobs list returned by specifying the
-- optional @statuscode@ parameter or @completed@ parameter, or both. Using
-- the @statuscode@ parameter, you can specify to return only jobs that
-- match either the @InProgress@, @Succeeded@, or @Failed@ status. Using
-- the @completed@ parameter, you can specify to return only jobs that were
-- completed (@true@) or jobs that were not completed (@false@).
--
-- For more information about using this operation, see the documentation
-- for the underlying REST API
-- <https://docs.aws.amazon.com/amazonglacier/latest/dev/api-jobs-get.html List Jobs>.
--
-- This operation returns paginated results.
module Amazonka.Glacier.ListJobs
  ( -- * Creating a Request
    ListJobs (..),
    newListJobs,

    -- * Request Lenses
    listJobs_marker,
    listJobs_completed,
    listJobs_limit,
    listJobs_statuscode,
    listJobs_accountId,
    listJobs_vaultName,

    -- * Destructuring the Response
    ListJobsResponse (..),
    newListJobsResponse,

    -- * Response Lenses
    listJobsResponse_marker,
    listJobsResponse_jobList,
    listJobsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.Glacier.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | Provides options for retrieving a job list for an Amazon S3 Glacier
-- vault.
--
-- /See:/ 'newListJobs' smart constructor.
data ListJobs = ListJobs'
  { -- | An opaque string used for pagination. This value specifies the job at
    -- which the listing of jobs should begin. Get the marker value from a
    -- previous List Jobs response. You only need to include the marker if you
    -- are continuing the pagination of results started in a previous List Jobs
    -- request.
    ListJobs -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The state of the jobs to return. You can specify @true@ or @false@.
    ListJobs -> Maybe Text
completed :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of jobs to be returned. The default limit is 50. The
    -- number of jobs returned might be fewer than the specified limit, but the
    -- number of returned jobs never exceeds the limit.
    ListJobs -> Maybe Text
limit :: Prelude.Maybe Prelude.Text,
    -- | The type of job status to return. You can specify the following values:
    -- @InProgress@, @Succeeded@, or @Failed@.
    ListJobs -> Maybe Text
statuscode :: Prelude.Maybe Prelude.Text,
    -- | The @AccountId@ value is the AWS account ID of the account that owns the
    -- vault. You can either specify an AWS account ID or optionally a single
    -- \'@-@\' (hyphen), in which case Amazon S3 Glacier uses the AWS account
    -- ID associated with the credentials used to sign the request. If you use
    -- an account ID, do not include any hyphens (\'-\') in the ID.
    ListJobs -> Text
accountId :: Prelude.Text,
    -- | The name of the vault.
    ListJobs -> Text
vaultName :: Prelude.Text
  }
  deriving (ListJobs -> ListJobs -> Bool
(ListJobs -> ListJobs -> Bool)
-> (ListJobs -> ListJobs -> Bool) -> Eq ListJobs
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListJobs -> ListJobs -> Bool
$c/= :: ListJobs -> ListJobs -> Bool
== :: ListJobs -> ListJobs -> Bool
$c== :: ListJobs -> ListJobs -> Bool
Prelude.Eq, ReadPrec [ListJobs]
ReadPrec ListJobs
Int -> ReadS ListJobs
ReadS [ListJobs]
(Int -> ReadS ListJobs)
-> ReadS [ListJobs]
-> ReadPrec ListJobs
-> ReadPrec [ListJobs]
-> Read ListJobs
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListJobs]
$creadListPrec :: ReadPrec [ListJobs]
readPrec :: ReadPrec ListJobs
$creadPrec :: ReadPrec ListJobs
readList :: ReadS [ListJobs]
$creadList :: ReadS [ListJobs]
readsPrec :: Int -> ReadS ListJobs
$creadsPrec :: Int -> ReadS ListJobs
Prelude.Read, Int -> ListJobs -> ShowS
[ListJobs] -> ShowS
ListJobs -> String
(Int -> ListJobs -> ShowS)
-> (ListJobs -> String) -> ([ListJobs] -> ShowS) -> Show ListJobs
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListJobs] -> ShowS
$cshowList :: [ListJobs] -> ShowS
show :: ListJobs -> String
$cshow :: ListJobs -> String
showsPrec :: Int -> ListJobs -> ShowS
$cshowsPrec :: Int -> ListJobs -> ShowS
Prelude.Show, (forall x. ListJobs -> Rep ListJobs x)
-> (forall x. Rep ListJobs x -> ListJobs) -> Generic ListJobs
forall x. Rep ListJobs x -> ListJobs
forall x. ListJobs -> Rep ListJobs x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListJobs x -> ListJobs
$cfrom :: forall x. ListJobs -> Rep ListJobs x
Prelude.Generic)

-- |
-- Create a value of 'ListJobs' 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:
--
-- 'marker', 'listJobs_marker' - An opaque string used for pagination. This value specifies the job at
-- which the listing of jobs should begin. Get the marker value from a
-- previous List Jobs response. You only need to include the marker if you
-- are continuing the pagination of results started in a previous List Jobs
-- request.
--
-- 'completed', 'listJobs_completed' - The state of the jobs to return. You can specify @true@ or @false@.
--
-- 'limit', 'listJobs_limit' - The maximum number of jobs to be returned. The default limit is 50. The
-- number of jobs returned might be fewer than the specified limit, but the
-- number of returned jobs never exceeds the limit.
--
-- 'statuscode', 'listJobs_statuscode' - The type of job status to return. You can specify the following values:
-- @InProgress@, @Succeeded@, or @Failed@.
--
-- 'accountId', 'listJobs_accountId' - The @AccountId@ value is the AWS account ID of the account that owns the
-- vault. You can either specify an AWS account ID or optionally a single
-- \'@-@\' (hyphen), in which case Amazon S3 Glacier uses the AWS account
-- ID associated with the credentials used to sign the request. If you use
-- an account ID, do not include any hyphens (\'-\') in the ID.
--
-- 'vaultName', 'listJobs_vaultName' - The name of the vault.
newListJobs ::
  -- | 'accountId'
  Prelude.Text ->
  -- | 'vaultName'
  Prelude.Text ->
  ListJobs
newListJobs :: Text -> Text -> ListJobs
newListJobs Text
pAccountId_ Text
pVaultName_ =
  ListJobs' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> Text
-> ListJobs
ListJobs'
    { $sel:marker:ListJobs' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:completed:ListJobs' :: Maybe Text
completed = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:limit:ListJobs' :: Maybe Text
limit = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:statuscode:ListJobs' :: Maybe Text
statuscode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:accountId:ListJobs' :: Text
accountId = Text
pAccountId_,
      $sel:vaultName:ListJobs' :: Text
vaultName = Text
pVaultName_
    }

-- | An opaque string used for pagination. This value specifies the job at
-- which the listing of jobs should begin. Get the marker value from a
-- previous List Jobs response. You only need to include the marker if you
-- are continuing the pagination of results started in a previous List Jobs
-- request.
listJobs_marker :: Lens.Lens' ListJobs (Prelude.Maybe Prelude.Text)
listJobs_marker :: (Maybe Text -> f (Maybe Text)) -> ListJobs -> f ListJobs
listJobs_marker = (ListJobs -> Maybe Text)
-> (ListJobs -> Maybe Text -> ListJobs)
-> Lens ListJobs ListJobs (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListJobs' {Maybe Text
marker :: Maybe Text
$sel:marker:ListJobs' :: ListJobs -> Maybe Text
marker} -> Maybe Text
marker) (\s :: ListJobs
s@ListJobs' {} Maybe Text
a -> ListJobs
s {$sel:marker:ListJobs' :: Maybe Text
marker = Maybe Text
a} :: ListJobs)

-- | The state of the jobs to return. You can specify @true@ or @false@.
listJobs_completed :: Lens.Lens' ListJobs (Prelude.Maybe Prelude.Text)
listJobs_completed :: (Maybe Text -> f (Maybe Text)) -> ListJobs -> f ListJobs
listJobs_completed = (ListJobs -> Maybe Text)
-> (ListJobs -> Maybe Text -> ListJobs)
-> Lens ListJobs ListJobs (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListJobs' {Maybe Text
completed :: Maybe Text
$sel:completed:ListJobs' :: ListJobs -> Maybe Text
completed} -> Maybe Text
completed) (\s :: ListJobs
s@ListJobs' {} Maybe Text
a -> ListJobs
s {$sel:completed:ListJobs' :: Maybe Text
completed = Maybe Text
a} :: ListJobs)

-- | The maximum number of jobs to be returned. The default limit is 50. The
-- number of jobs returned might be fewer than the specified limit, but the
-- number of returned jobs never exceeds the limit.
listJobs_limit :: Lens.Lens' ListJobs (Prelude.Maybe Prelude.Text)
listJobs_limit :: (Maybe Text -> f (Maybe Text)) -> ListJobs -> f ListJobs
listJobs_limit = (ListJobs -> Maybe Text)
-> (ListJobs -> Maybe Text -> ListJobs)
-> Lens ListJobs ListJobs (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListJobs' {Maybe Text
limit :: Maybe Text
$sel:limit:ListJobs' :: ListJobs -> Maybe Text
limit} -> Maybe Text
limit) (\s :: ListJobs
s@ListJobs' {} Maybe Text
a -> ListJobs
s {$sel:limit:ListJobs' :: Maybe Text
limit = Maybe Text
a} :: ListJobs)

-- | The type of job status to return. You can specify the following values:
-- @InProgress@, @Succeeded@, or @Failed@.
listJobs_statuscode :: Lens.Lens' ListJobs (Prelude.Maybe Prelude.Text)
listJobs_statuscode :: (Maybe Text -> f (Maybe Text)) -> ListJobs -> f ListJobs
listJobs_statuscode = (ListJobs -> Maybe Text)
-> (ListJobs -> Maybe Text -> ListJobs)
-> Lens ListJobs ListJobs (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListJobs' {Maybe Text
statuscode :: Maybe Text
$sel:statuscode:ListJobs' :: ListJobs -> Maybe Text
statuscode} -> Maybe Text
statuscode) (\s :: ListJobs
s@ListJobs' {} Maybe Text
a -> ListJobs
s {$sel:statuscode:ListJobs' :: Maybe Text
statuscode = Maybe Text
a} :: ListJobs)

-- | The @AccountId@ value is the AWS account ID of the account that owns the
-- vault. You can either specify an AWS account ID or optionally a single
-- \'@-@\' (hyphen), in which case Amazon S3 Glacier uses the AWS account
-- ID associated with the credentials used to sign the request. If you use
-- an account ID, do not include any hyphens (\'-\') in the ID.
listJobs_accountId :: Lens.Lens' ListJobs Prelude.Text
listJobs_accountId :: (Text -> f Text) -> ListJobs -> f ListJobs
listJobs_accountId = (ListJobs -> Text)
-> (ListJobs -> Text -> ListJobs)
-> Lens ListJobs ListJobs Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListJobs' {Text
accountId :: Text
$sel:accountId:ListJobs' :: ListJobs -> Text
accountId} -> Text
accountId) (\s :: ListJobs
s@ListJobs' {} Text
a -> ListJobs
s {$sel:accountId:ListJobs' :: Text
accountId = Text
a} :: ListJobs)

-- | The name of the vault.
listJobs_vaultName :: Lens.Lens' ListJobs Prelude.Text
listJobs_vaultName :: (Text -> f Text) -> ListJobs -> f ListJobs
listJobs_vaultName = (ListJobs -> Text)
-> (ListJobs -> Text -> ListJobs)
-> Lens ListJobs ListJobs Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListJobs' {Text
vaultName :: Text
$sel:vaultName:ListJobs' :: ListJobs -> Text
vaultName} -> Text
vaultName) (\s :: ListJobs
s@ListJobs' {} Text
a -> ListJobs
s {$sel:vaultName:ListJobs' :: Text
vaultName = Text
a} :: ListJobs)

instance Core.AWSPager ListJobs where
  page :: ListJobs -> AWSResponse ListJobs -> Maybe ListJobs
page ListJobs
rq AWSResponse ListJobs
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListJobs
ListJobsResponse
rs
            ListJobsResponse
-> Getting (First Text) ListJobsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListJobsResponse -> Const (First Text) ListJobsResponse
Lens' ListJobsResponse (Maybe Text)
listJobsResponse_marker ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListJobsResponse -> Const (First Text) ListJobsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListJobsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListJobs
forall a. Maybe a
Prelude.Nothing
    | Maybe [GlacierJobDescription] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListJobs
ListJobsResponse
rs
            ListJobsResponse
-> Getting
     (First [GlacierJobDescription])
     ListJobsResponse
     [GlacierJobDescription]
-> Maybe [GlacierJobDescription]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [GlacierJobDescription]
 -> Const
      (First [GlacierJobDescription]) (Maybe [GlacierJobDescription]))
-> ListJobsResponse
-> Const (First [GlacierJobDescription]) ListJobsResponse
Lens' ListJobsResponse (Maybe [GlacierJobDescription])
listJobsResponse_jobList ((Maybe [GlacierJobDescription]
  -> Const
       (First [GlacierJobDescription]) (Maybe [GlacierJobDescription]))
 -> ListJobsResponse
 -> Const (First [GlacierJobDescription]) ListJobsResponse)
-> (([GlacierJobDescription]
     -> Const (First [GlacierJobDescription]) [GlacierJobDescription])
    -> Maybe [GlacierJobDescription]
    -> Const
         (First [GlacierJobDescription]) (Maybe [GlacierJobDescription]))
-> Getting
     (First [GlacierJobDescription])
     ListJobsResponse
     [GlacierJobDescription]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([GlacierJobDescription]
 -> Const (First [GlacierJobDescription]) [GlacierJobDescription])
-> Maybe [GlacierJobDescription]
-> Const
     (First [GlacierJobDescription]) (Maybe [GlacierJobDescription])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListJobs
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListJobs -> Maybe ListJobs
forall a. a -> Maybe a
Prelude.Just (ListJobs -> Maybe ListJobs) -> ListJobs -> Maybe ListJobs
forall a b. (a -> b) -> a -> b
Prelude.$
        ListJobs
rq
          ListJobs -> (ListJobs -> ListJobs) -> ListJobs
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListJobs -> Identity ListJobs
Lens ListJobs ListJobs (Maybe Text) (Maybe Text)
listJobs_marker
          ((Maybe Text -> Identity (Maybe Text))
 -> ListJobs -> Identity ListJobs)
-> Maybe Text -> ListJobs -> ListJobs
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListJobs
ListJobsResponse
rs
          ListJobsResponse
-> Getting (First Text) ListJobsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListJobsResponse -> Const (First Text) ListJobsResponse
Lens' ListJobsResponse (Maybe Text)
listJobsResponse_marker ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListJobsResponse -> Const (First Text) ListJobsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListJobsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListJobs where
  type AWSResponse ListJobs = ListJobsResponse
  request :: ListJobs -> Request ListJobs
request =
    ByteString -> Request ListJobs -> Request ListJobs
forall a. ByteString -> Request a -> Request a
Request.glacierVersionHeader (Service -> ByteString
Core._serviceVersion Service
defaultService)
      (Request ListJobs -> Request ListJobs)
-> (ListJobs -> Request ListJobs) -> ListJobs -> Request ListJobs
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Service -> ListJobs -> Request ListJobs
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy ListJobs
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListJobs)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListJobs))
-> Logger
-> Service
-> Proxy ListJobs
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListJobs)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe [GlacierJobDescription] -> Int -> ListJobsResponse
ListJobsResponse'
            (Maybe Text
 -> Maybe [GlacierJobDescription] -> Int -> ListJobsResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe [GlacierJobDescription] -> Int -> ListJobsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Marker")
            Either
  String (Maybe [GlacierJobDescription] -> Int -> ListJobsResponse)
-> Either String (Maybe [GlacierJobDescription])
-> Either String (Int -> ListJobsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Either String (Maybe (Maybe [GlacierJobDescription]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"JobList" Either String (Maybe (Maybe [GlacierJobDescription]))
-> Maybe [GlacierJobDescription]
-> Either String (Maybe [GlacierJobDescription])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [GlacierJobDescription]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Int -> ListJobsResponse)
-> Either String Int -> Either String ListJobsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable ListJobs

instance Prelude.NFData ListJobs

instance Core.ToHeaders ListJobs where
  toHeaders :: ListJobs -> ResponseHeaders
toHeaders = ResponseHeaders -> ListJobs -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToPath ListJobs where
  toPath :: ListJobs -> ByteString
toPath ListJobs' {Maybe Text
Text
vaultName :: Text
accountId :: Text
statuscode :: Maybe Text
limit :: Maybe Text
completed :: Maybe Text
marker :: Maybe Text
$sel:vaultName:ListJobs' :: ListJobs -> Text
$sel:accountId:ListJobs' :: ListJobs -> Text
$sel:statuscode:ListJobs' :: ListJobs -> Maybe Text
$sel:limit:ListJobs' :: ListJobs -> Maybe Text
$sel:completed:ListJobs' :: ListJobs -> Maybe Text
$sel:marker:ListJobs' :: ListJobs -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
accountId,
        ByteString
"/vaults/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
vaultName,
        ByteString
"/jobs"
      ]

instance Core.ToQuery ListJobs where
  toQuery :: ListJobs -> QueryString
toQuery ListJobs' {Maybe Text
Text
vaultName :: Text
accountId :: Text
statuscode :: Maybe Text
limit :: Maybe Text
completed :: Maybe Text
marker :: Maybe Text
$sel:vaultName:ListJobs' :: ListJobs -> Text
$sel:accountId:ListJobs' :: ListJobs -> Text
$sel:statuscode:ListJobs' :: ListJobs -> Maybe Text
$sel:limit:ListJobs' :: ListJobs -> Maybe Text
$sel:completed:ListJobs' :: ListJobs -> Maybe Text
$sel:marker:ListJobs' :: ListJobs -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"marker" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
marker,
        ByteString
"completed" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
completed,
        ByteString
"limit" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
limit,
        ByteString
"statuscode" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
statuscode
      ]

-- | Contains the Amazon S3 Glacier response to your request.
--
-- /See:/ 'newListJobsResponse' smart constructor.
data ListJobsResponse = ListJobsResponse'
  { -- | An opaque string used for pagination that specifies the job at which the
    -- listing of jobs should begin. You get the @marker@ value from a previous
    -- List Jobs response. You only need to include the marker if you are
    -- continuing the pagination of the results started in a previous List Jobs
    -- request.
    ListJobsResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | A list of job objects. Each job object contains metadata describing the
    -- job.
    ListJobsResponse -> Maybe [GlacierJobDescription]
jobList :: Prelude.Maybe [GlacierJobDescription],
    -- | The response's http status code.
    ListJobsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListJobsResponse -> ListJobsResponse -> Bool
(ListJobsResponse -> ListJobsResponse -> Bool)
-> (ListJobsResponse -> ListJobsResponse -> Bool)
-> Eq ListJobsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListJobsResponse -> ListJobsResponse -> Bool
$c/= :: ListJobsResponse -> ListJobsResponse -> Bool
== :: ListJobsResponse -> ListJobsResponse -> Bool
$c== :: ListJobsResponse -> ListJobsResponse -> Bool
Prelude.Eq, ReadPrec [ListJobsResponse]
ReadPrec ListJobsResponse
Int -> ReadS ListJobsResponse
ReadS [ListJobsResponse]
(Int -> ReadS ListJobsResponse)
-> ReadS [ListJobsResponse]
-> ReadPrec ListJobsResponse
-> ReadPrec [ListJobsResponse]
-> Read ListJobsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListJobsResponse]
$creadListPrec :: ReadPrec [ListJobsResponse]
readPrec :: ReadPrec ListJobsResponse
$creadPrec :: ReadPrec ListJobsResponse
readList :: ReadS [ListJobsResponse]
$creadList :: ReadS [ListJobsResponse]
readsPrec :: Int -> ReadS ListJobsResponse
$creadsPrec :: Int -> ReadS ListJobsResponse
Prelude.Read, Int -> ListJobsResponse -> ShowS
[ListJobsResponse] -> ShowS
ListJobsResponse -> String
(Int -> ListJobsResponse -> ShowS)
-> (ListJobsResponse -> String)
-> ([ListJobsResponse] -> ShowS)
-> Show ListJobsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListJobsResponse] -> ShowS
$cshowList :: [ListJobsResponse] -> ShowS
show :: ListJobsResponse -> String
$cshow :: ListJobsResponse -> String
showsPrec :: Int -> ListJobsResponse -> ShowS
$cshowsPrec :: Int -> ListJobsResponse -> ShowS
Prelude.Show, (forall x. ListJobsResponse -> Rep ListJobsResponse x)
-> (forall x. Rep ListJobsResponse x -> ListJobsResponse)
-> Generic ListJobsResponse
forall x. Rep ListJobsResponse x -> ListJobsResponse
forall x. ListJobsResponse -> Rep ListJobsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListJobsResponse x -> ListJobsResponse
$cfrom :: forall x. ListJobsResponse -> Rep ListJobsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListJobsResponse' 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:
--
-- 'marker', 'listJobsResponse_marker' - An opaque string used for pagination that specifies the job at which the
-- listing of jobs should begin. You get the @marker@ value from a previous
-- List Jobs response. You only need to include the marker if you are
-- continuing the pagination of the results started in a previous List Jobs
-- request.
--
-- 'jobList', 'listJobsResponse_jobList' - A list of job objects. Each job object contains metadata describing the
-- job.
--
-- 'httpStatus', 'listJobsResponse_httpStatus' - The response's http status code.
newListJobsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListJobsResponse
newListJobsResponse :: Int -> ListJobsResponse
newListJobsResponse Int
pHttpStatus_ =
  ListJobsResponse' :: Maybe Text
-> Maybe [GlacierJobDescription] -> Int -> ListJobsResponse
ListJobsResponse'
    { $sel:marker:ListJobsResponse' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:jobList:ListJobsResponse' :: Maybe [GlacierJobDescription]
jobList = Maybe [GlacierJobDescription]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListJobsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An opaque string used for pagination that specifies the job at which the
-- listing of jobs should begin. You get the @marker@ value from a previous
-- List Jobs response. You only need to include the marker if you are
-- continuing the pagination of the results started in a previous List Jobs
-- request.
listJobsResponse_marker :: Lens.Lens' ListJobsResponse (Prelude.Maybe Prelude.Text)
listJobsResponse_marker :: (Maybe Text -> f (Maybe Text))
-> ListJobsResponse -> f ListJobsResponse
listJobsResponse_marker = (ListJobsResponse -> Maybe Text)
-> (ListJobsResponse -> Maybe Text -> ListJobsResponse)
-> Lens' ListJobsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListJobsResponse' {Maybe Text
marker :: Maybe Text
$sel:marker:ListJobsResponse' :: ListJobsResponse -> Maybe Text
marker} -> Maybe Text
marker) (\s :: ListJobsResponse
s@ListJobsResponse' {} Maybe Text
a -> ListJobsResponse
s {$sel:marker:ListJobsResponse' :: Maybe Text
marker = Maybe Text
a} :: ListJobsResponse)

-- | A list of job objects. Each job object contains metadata describing the
-- job.
listJobsResponse_jobList :: Lens.Lens' ListJobsResponse (Prelude.Maybe [GlacierJobDescription])
listJobsResponse_jobList :: (Maybe [GlacierJobDescription]
 -> f (Maybe [GlacierJobDescription]))
-> ListJobsResponse -> f ListJobsResponse
listJobsResponse_jobList = (ListJobsResponse -> Maybe [GlacierJobDescription])
-> (ListJobsResponse
    -> Maybe [GlacierJobDescription] -> ListJobsResponse)
-> Lens' ListJobsResponse (Maybe [GlacierJobDescription])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListJobsResponse' {Maybe [GlacierJobDescription]
jobList :: Maybe [GlacierJobDescription]
$sel:jobList:ListJobsResponse' :: ListJobsResponse -> Maybe [GlacierJobDescription]
jobList} -> Maybe [GlacierJobDescription]
jobList) (\s :: ListJobsResponse
s@ListJobsResponse' {} Maybe [GlacierJobDescription]
a -> ListJobsResponse
s {$sel:jobList:ListJobsResponse' :: Maybe [GlacierJobDescription]
jobList = Maybe [GlacierJobDescription]
a} :: ListJobsResponse) ((Maybe [GlacierJobDescription]
  -> f (Maybe [GlacierJobDescription]))
 -> ListJobsResponse -> f ListJobsResponse)
-> ((Maybe [GlacierJobDescription]
     -> f (Maybe [GlacierJobDescription]))
    -> Maybe [GlacierJobDescription]
    -> f (Maybe [GlacierJobDescription]))
-> (Maybe [GlacierJobDescription]
    -> f (Maybe [GlacierJobDescription]))
-> ListJobsResponse
-> f ListJobsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [GlacierJobDescription]
  [GlacierJobDescription]
  [GlacierJobDescription]
  [GlacierJobDescription]
-> Iso
     (Maybe [GlacierJobDescription])
     (Maybe [GlacierJobDescription])
     (Maybe [GlacierJobDescription])
     (Maybe [GlacierJobDescription])
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 AnIso
  [GlacierJobDescription]
  [GlacierJobDescription]
  [GlacierJobDescription]
  [GlacierJobDescription]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData ListJobsResponse