{-# 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.Backup.ListBackupJobs
-- 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)
--
-- Returns a list of existing backup jobs for an authenticated account for
-- the last 30 days. For a longer period of time, consider using these
-- <https://docs.aws.amazon.com/aws-backup/latest/devguide/monitoring.html monitoring tools>.
module Amazonka.Backup.ListBackupJobs
  ( -- * Creating a Request
    ListBackupJobs (..),
    newListBackupJobs,

    -- * Request Lenses
    listBackupJobs_byResourceArn,
    listBackupJobs_byCreatedAfter,
    listBackupJobs_byAccountId,
    listBackupJobs_byCreatedBefore,
    listBackupJobs_byBackupVaultName,
    listBackupJobs_byResourceType,
    listBackupJobs_nextToken,
    listBackupJobs_byState,
    listBackupJobs_maxResults,

    -- * Destructuring the Response
    ListBackupJobsResponse (..),
    newListBackupJobsResponse,

    -- * Response Lenses
    listBackupJobsResponse_backupJobs,
    listBackupJobsResponse_nextToken,
    listBackupJobsResponse_httpStatus,
  )
where

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

-- | /See:/ 'newListBackupJobs' smart constructor.
data ListBackupJobs = ListBackupJobs'
  { -- | Returns only backup jobs that match the specified resource Amazon
    -- Resource Name (ARN).
    ListBackupJobs -> Maybe Text
byResourceArn :: Prelude.Maybe Prelude.Text,
    -- | Returns only backup jobs that were created after the specified date.
    ListBackupJobs -> Maybe POSIX
byCreatedAfter :: Prelude.Maybe Core.POSIX,
    -- | The account ID to list the jobs from. Returns only backup jobs
    -- associated with the specified account ID.
    --
    -- If used from an Organizations management account, passing @*@ returns
    -- all jobs across the organization.
    ListBackupJobs -> Maybe Text
byAccountId :: Prelude.Maybe Prelude.Text,
    -- | Returns only backup jobs that were created before the specified date.
    ListBackupJobs -> Maybe POSIX
byCreatedBefore :: Prelude.Maybe Core.POSIX,
    -- | Returns only backup jobs that will be stored in the specified backup
    -- vault. Backup vaults are identified by names that are unique to the
    -- account used to create them and the Amazon Web Services Region where
    -- they are created. They consist of lowercase letters, numbers, and
    -- hyphens.
    ListBackupJobs -> Maybe Text
byBackupVaultName :: Prelude.Maybe Prelude.Text,
    -- | Returns only backup jobs for the specified resources:
    --
    -- -   @DynamoDB@ for Amazon DynamoDB
    --
    -- -   @EBS@ for Amazon Elastic Block Store
    --
    -- -   @EC2@ for Amazon Elastic Compute Cloud
    --
    -- -   @EFS@ for Amazon Elastic File System
    --
    -- -   @RDS@ for Amazon Relational Database Service
    --
    -- -   @Aurora@ for Amazon Aurora
    --
    -- -   @Storage Gateway@ for Storage Gateway
    ListBackupJobs -> Maybe Text
byResourceType :: Prelude.Maybe Prelude.Text,
    -- | The next item following a partial list of returned items. For example,
    -- if a request is made to return @maxResults@ number of items, @NextToken@
    -- allows you to return more items in your list starting at the location
    -- pointed to by the next token.
    ListBackupJobs -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Returns only backup jobs that are in the specified state.
    ListBackupJobs -> Maybe BackupJobState
byState :: Prelude.Maybe BackupJobState,
    -- | The maximum number of items to be returned.
    ListBackupJobs -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListBackupJobs -> ListBackupJobs -> Bool
(ListBackupJobs -> ListBackupJobs -> Bool)
-> (ListBackupJobs -> ListBackupJobs -> Bool) -> Eq ListBackupJobs
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListBackupJobs -> ListBackupJobs -> Bool
$c/= :: ListBackupJobs -> ListBackupJobs -> Bool
== :: ListBackupJobs -> ListBackupJobs -> Bool
$c== :: ListBackupJobs -> ListBackupJobs -> Bool
Prelude.Eq, ReadPrec [ListBackupJobs]
ReadPrec ListBackupJobs
Int -> ReadS ListBackupJobs
ReadS [ListBackupJobs]
(Int -> ReadS ListBackupJobs)
-> ReadS [ListBackupJobs]
-> ReadPrec ListBackupJobs
-> ReadPrec [ListBackupJobs]
-> Read ListBackupJobs
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListBackupJobs]
$creadListPrec :: ReadPrec [ListBackupJobs]
readPrec :: ReadPrec ListBackupJobs
$creadPrec :: ReadPrec ListBackupJobs
readList :: ReadS [ListBackupJobs]
$creadList :: ReadS [ListBackupJobs]
readsPrec :: Int -> ReadS ListBackupJobs
$creadsPrec :: Int -> ReadS ListBackupJobs
Prelude.Read, Int -> ListBackupJobs -> ShowS
[ListBackupJobs] -> ShowS
ListBackupJobs -> String
(Int -> ListBackupJobs -> ShowS)
-> (ListBackupJobs -> String)
-> ([ListBackupJobs] -> ShowS)
-> Show ListBackupJobs
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListBackupJobs] -> ShowS
$cshowList :: [ListBackupJobs] -> ShowS
show :: ListBackupJobs -> String
$cshow :: ListBackupJobs -> String
showsPrec :: Int -> ListBackupJobs -> ShowS
$cshowsPrec :: Int -> ListBackupJobs -> ShowS
Prelude.Show, (forall x. ListBackupJobs -> Rep ListBackupJobs x)
-> (forall x. Rep ListBackupJobs x -> ListBackupJobs)
-> Generic ListBackupJobs
forall x. Rep ListBackupJobs x -> ListBackupJobs
forall x. ListBackupJobs -> Rep ListBackupJobs x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListBackupJobs x -> ListBackupJobs
$cfrom :: forall x. ListBackupJobs -> Rep ListBackupJobs x
Prelude.Generic)

-- |
-- Create a value of 'ListBackupJobs' 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:
--
-- 'byResourceArn', 'listBackupJobs_byResourceArn' - Returns only backup jobs that match the specified resource Amazon
-- Resource Name (ARN).
--
-- 'byCreatedAfter', 'listBackupJobs_byCreatedAfter' - Returns only backup jobs that were created after the specified date.
--
-- 'byAccountId', 'listBackupJobs_byAccountId' - The account ID to list the jobs from. Returns only backup jobs
-- associated with the specified account ID.
--
-- If used from an Organizations management account, passing @*@ returns
-- all jobs across the organization.
--
-- 'byCreatedBefore', 'listBackupJobs_byCreatedBefore' - Returns only backup jobs that were created before the specified date.
--
-- 'byBackupVaultName', 'listBackupJobs_byBackupVaultName' - Returns only backup jobs that will be stored in the specified backup
-- vault. Backup vaults are identified by names that are unique to the
-- account used to create them and the Amazon Web Services Region where
-- they are created. They consist of lowercase letters, numbers, and
-- hyphens.
--
-- 'byResourceType', 'listBackupJobs_byResourceType' - Returns only backup jobs for the specified resources:
--
-- -   @DynamoDB@ for Amazon DynamoDB
--
-- -   @EBS@ for Amazon Elastic Block Store
--
-- -   @EC2@ for Amazon Elastic Compute Cloud
--
-- -   @EFS@ for Amazon Elastic File System
--
-- -   @RDS@ for Amazon Relational Database Service
--
-- -   @Aurora@ for Amazon Aurora
--
-- -   @Storage Gateway@ for Storage Gateway
--
-- 'nextToken', 'listBackupJobs_nextToken' - The next item following a partial list of returned items. For example,
-- if a request is made to return @maxResults@ number of items, @NextToken@
-- allows you to return more items in your list starting at the location
-- pointed to by the next token.
--
-- 'byState', 'listBackupJobs_byState' - Returns only backup jobs that are in the specified state.
--
-- 'maxResults', 'listBackupJobs_maxResults' - The maximum number of items to be returned.
newListBackupJobs ::
  ListBackupJobs
newListBackupJobs :: ListBackupJobs
newListBackupJobs =
  ListBackupJobs' :: Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe BackupJobState
-> Maybe Natural
-> ListBackupJobs
ListBackupJobs'
    { $sel:byResourceArn:ListBackupJobs' :: Maybe Text
byResourceArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:byCreatedAfter:ListBackupJobs' :: Maybe POSIX
byCreatedAfter = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:byAccountId:ListBackupJobs' :: Maybe Text
byAccountId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:byCreatedBefore:ListBackupJobs' :: Maybe POSIX
byCreatedBefore = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:byBackupVaultName:ListBackupJobs' :: Maybe Text
byBackupVaultName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:byResourceType:ListBackupJobs' :: Maybe Text
byResourceType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListBackupJobs' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:byState:ListBackupJobs' :: Maybe BackupJobState
byState = Maybe BackupJobState
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListBackupJobs' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | Returns only backup jobs that match the specified resource Amazon
-- Resource Name (ARN).
listBackupJobs_byResourceArn :: Lens.Lens' ListBackupJobs (Prelude.Maybe Prelude.Text)
listBackupJobs_byResourceArn :: (Maybe Text -> f (Maybe Text))
-> ListBackupJobs -> f ListBackupJobs
listBackupJobs_byResourceArn = (ListBackupJobs -> Maybe Text)
-> (ListBackupJobs -> Maybe Text -> ListBackupJobs)
-> Lens ListBackupJobs ListBackupJobs (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBackupJobs' {Maybe Text
byResourceArn :: Maybe Text
$sel:byResourceArn:ListBackupJobs' :: ListBackupJobs -> Maybe Text
byResourceArn} -> Maybe Text
byResourceArn) (\s :: ListBackupJobs
s@ListBackupJobs' {} Maybe Text
a -> ListBackupJobs
s {$sel:byResourceArn:ListBackupJobs' :: Maybe Text
byResourceArn = Maybe Text
a} :: ListBackupJobs)

-- | Returns only backup jobs that were created after the specified date.
listBackupJobs_byCreatedAfter :: Lens.Lens' ListBackupJobs (Prelude.Maybe Prelude.UTCTime)
listBackupJobs_byCreatedAfter :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ListBackupJobs -> f ListBackupJobs
listBackupJobs_byCreatedAfter = (ListBackupJobs -> Maybe POSIX)
-> (ListBackupJobs -> Maybe POSIX -> ListBackupJobs)
-> Lens ListBackupJobs ListBackupJobs (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBackupJobs' {Maybe POSIX
byCreatedAfter :: Maybe POSIX
$sel:byCreatedAfter:ListBackupJobs' :: ListBackupJobs -> Maybe POSIX
byCreatedAfter} -> Maybe POSIX
byCreatedAfter) (\s :: ListBackupJobs
s@ListBackupJobs' {} Maybe POSIX
a -> ListBackupJobs
s {$sel:byCreatedAfter:ListBackupJobs' :: Maybe POSIX
byCreatedAfter = Maybe POSIX
a} :: ListBackupJobs) ((Maybe POSIX -> f (Maybe POSIX))
 -> ListBackupJobs -> f ListBackupJobs)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ListBackupJobs
-> f ListBackupJobs
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The account ID to list the jobs from. Returns only backup jobs
-- associated with the specified account ID.
--
-- If used from an Organizations management account, passing @*@ returns
-- all jobs across the organization.
listBackupJobs_byAccountId :: Lens.Lens' ListBackupJobs (Prelude.Maybe Prelude.Text)
listBackupJobs_byAccountId :: (Maybe Text -> f (Maybe Text))
-> ListBackupJobs -> f ListBackupJobs
listBackupJobs_byAccountId = (ListBackupJobs -> Maybe Text)
-> (ListBackupJobs -> Maybe Text -> ListBackupJobs)
-> Lens ListBackupJobs ListBackupJobs (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBackupJobs' {Maybe Text
byAccountId :: Maybe Text
$sel:byAccountId:ListBackupJobs' :: ListBackupJobs -> Maybe Text
byAccountId} -> Maybe Text
byAccountId) (\s :: ListBackupJobs
s@ListBackupJobs' {} Maybe Text
a -> ListBackupJobs
s {$sel:byAccountId:ListBackupJobs' :: Maybe Text
byAccountId = Maybe Text
a} :: ListBackupJobs)

-- | Returns only backup jobs that were created before the specified date.
listBackupJobs_byCreatedBefore :: Lens.Lens' ListBackupJobs (Prelude.Maybe Prelude.UTCTime)
listBackupJobs_byCreatedBefore :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ListBackupJobs -> f ListBackupJobs
listBackupJobs_byCreatedBefore = (ListBackupJobs -> Maybe POSIX)
-> (ListBackupJobs -> Maybe POSIX -> ListBackupJobs)
-> Lens ListBackupJobs ListBackupJobs (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBackupJobs' {Maybe POSIX
byCreatedBefore :: Maybe POSIX
$sel:byCreatedBefore:ListBackupJobs' :: ListBackupJobs -> Maybe POSIX
byCreatedBefore} -> Maybe POSIX
byCreatedBefore) (\s :: ListBackupJobs
s@ListBackupJobs' {} Maybe POSIX
a -> ListBackupJobs
s {$sel:byCreatedBefore:ListBackupJobs' :: Maybe POSIX
byCreatedBefore = Maybe POSIX
a} :: ListBackupJobs) ((Maybe POSIX -> f (Maybe POSIX))
 -> ListBackupJobs -> f ListBackupJobs)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ListBackupJobs
-> f ListBackupJobs
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | Returns only backup jobs that will be stored in the specified backup
-- vault. Backup vaults are identified by names that are unique to the
-- account used to create them and the Amazon Web Services Region where
-- they are created. They consist of lowercase letters, numbers, and
-- hyphens.
listBackupJobs_byBackupVaultName :: Lens.Lens' ListBackupJobs (Prelude.Maybe Prelude.Text)
listBackupJobs_byBackupVaultName :: (Maybe Text -> f (Maybe Text))
-> ListBackupJobs -> f ListBackupJobs
listBackupJobs_byBackupVaultName = (ListBackupJobs -> Maybe Text)
-> (ListBackupJobs -> Maybe Text -> ListBackupJobs)
-> Lens ListBackupJobs ListBackupJobs (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBackupJobs' {Maybe Text
byBackupVaultName :: Maybe Text
$sel:byBackupVaultName:ListBackupJobs' :: ListBackupJobs -> Maybe Text
byBackupVaultName} -> Maybe Text
byBackupVaultName) (\s :: ListBackupJobs
s@ListBackupJobs' {} Maybe Text
a -> ListBackupJobs
s {$sel:byBackupVaultName:ListBackupJobs' :: Maybe Text
byBackupVaultName = Maybe Text
a} :: ListBackupJobs)

-- | Returns only backup jobs for the specified resources:
--
-- -   @DynamoDB@ for Amazon DynamoDB
--
-- -   @EBS@ for Amazon Elastic Block Store
--
-- -   @EC2@ for Amazon Elastic Compute Cloud
--
-- -   @EFS@ for Amazon Elastic File System
--
-- -   @RDS@ for Amazon Relational Database Service
--
-- -   @Aurora@ for Amazon Aurora
--
-- -   @Storage Gateway@ for Storage Gateway
listBackupJobs_byResourceType :: Lens.Lens' ListBackupJobs (Prelude.Maybe Prelude.Text)
listBackupJobs_byResourceType :: (Maybe Text -> f (Maybe Text))
-> ListBackupJobs -> f ListBackupJobs
listBackupJobs_byResourceType = (ListBackupJobs -> Maybe Text)
-> (ListBackupJobs -> Maybe Text -> ListBackupJobs)
-> Lens ListBackupJobs ListBackupJobs (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBackupJobs' {Maybe Text
byResourceType :: Maybe Text
$sel:byResourceType:ListBackupJobs' :: ListBackupJobs -> Maybe Text
byResourceType} -> Maybe Text
byResourceType) (\s :: ListBackupJobs
s@ListBackupJobs' {} Maybe Text
a -> ListBackupJobs
s {$sel:byResourceType:ListBackupJobs' :: Maybe Text
byResourceType = Maybe Text
a} :: ListBackupJobs)

-- | The next item following a partial list of returned items. For example,
-- if a request is made to return @maxResults@ number of items, @NextToken@
-- allows you to return more items in your list starting at the location
-- pointed to by the next token.
listBackupJobs_nextToken :: Lens.Lens' ListBackupJobs (Prelude.Maybe Prelude.Text)
listBackupJobs_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListBackupJobs -> f ListBackupJobs
listBackupJobs_nextToken = (ListBackupJobs -> Maybe Text)
-> (ListBackupJobs -> Maybe Text -> ListBackupJobs)
-> Lens ListBackupJobs ListBackupJobs (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBackupJobs' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListBackupJobs' :: ListBackupJobs -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListBackupJobs
s@ListBackupJobs' {} Maybe Text
a -> ListBackupJobs
s {$sel:nextToken:ListBackupJobs' :: Maybe Text
nextToken = Maybe Text
a} :: ListBackupJobs)

-- | Returns only backup jobs that are in the specified state.
listBackupJobs_byState :: Lens.Lens' ListBackupJobs (Prelude.Maybe BackupJobState)
listBackupJobs_byState :: (Maybe BackupJobState -> f (Maybe BackupJobState))
-> ListBackupJobs -> f ListBackupJobs
listBackupJobs_byState = (ListBackupJobs -> Maybe BackupJobState)
-> (ListBackupJobs -> Maybe BackupJobState -> ListBackupJobs)
-> Lens
     ListBackupJobs
     ListBackupJobs
     (Maybe BackupJobState)
     (Maybe BackupJobState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBackupJobs' {Maybe BackupJobState
byState :: Maybe BackupJobState
$sel:byState:ListBackupJobs' :: ListBackupJobs -> Maybe BackupJobState
byState} -> Maybe BackupJobState
byState) (\s :: ListBackupJobs
s@ListBackupJobs' {} Maybe BackupJobState
a -> ListBackupJobs
s {$sel:byState:ListBackupJobs' :: Maybe BackupJobState
byState = Maybe BackupJobState
a} :: ListBackupJobs)

-- | The maximum number of items to be returned.
listBackupJobs_maxResults :: Lens.Lens' ListBackupJobs (Prelude.Maybe Prelude.Natural)
listBackupJobs_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListBackupJobs -> f ListBackupJobs
listBackupJobs_maxResults = (ListBackupJobs -> Maybe Natural)
-> (ListBackupJobs -> Maybe Natural -> ListBackupJobs)
-> Lens
     ListBackupJobs ListBackupJobs (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBackupJobs' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListBackupJobs' :: ListBackupJobs -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListBackupJobs
s@ListBackupJobs' {} Maybe Natural
a -> ListBackupJobs
s {$sel:maxResults:ListBackupJobs' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListBackupJobs)

instance Core.AWSRequest ListBackupJobs where
  type
    AWSResponse ListBackupJobs =
      ListBackupJobsResponse
  request :: ListBackupJobs -> Request ListBackupJobs
request = Service -> ListBackupJobs -> Request ListBackupJobs
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy ListBackupJobs
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListBackupJobs)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListBackupJobs))
-> Logger
-> Service
-> Proxy ListBackupJobs
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListBackupJobs)))
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 [BackupJob] -> Maybe Text -> Int -> ListBackupJobsResponse
ListBackupJobsResponse'
            (Maybe [BackupJob] -> Maybe Text -> Int -> ListBackupJobsResponse)
-> Either String (Maybe [BackupJob])
-> Either String (Maybe Text -> Int -> ListBackupJobsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [BackupJob]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"BackupJobs" Either String (Maybe (Maybe [BackupJob]))
-> Maybe [BackupJob] -> Either String (Maybe [BackupJob])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [BackupJob]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Maybe Text -> Int -> ListBackupJobsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListBackupJobsResponse)
forall (f :: * -> *) a b. Applicative f => 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
"NextToken")
            Either String (Int -> ListBackupJobsResponse)
-> Either String Int -> Either String ListBackupJobsResponse
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 ListBackupJobs

instance Prelude.NFData ListBackupJobs

instance Core.ToHeaders ListBackupJobs where
  toHeaders :: ListBackupJobs -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListBackupJobs -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToPath ListBackupJobs where
  toPath :: ListBackupJobs -> ByteString
toPath = ByteString -> ListBackupJobs -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/backup-jobs/"

instance Core.ToQuery ListBackupJobs where
  toQuery :: ListBackupJobs -> QueryString
toQuery ListBackupJobs' {Maybe Natural
Maybe Text
Maybe POSIX
Maybe BackupJobState
maxResults :: Maybe Natural
byState :: Maybe BackupJobState
nextToken :: Maybe Text
byResourceType :: Maybe Text
byBackupVaultName :: Maybe Text
byCreatedBefore :: Maybe POSIX
byAccountId :: Maybe Text
byCreatedAfter :: Maybe POSIX
byResourceArn :: Maybe Text
$sel:maxResults:ListBackupJobs' :: ListBackupJobs -> Maybe Natural
$sel:byState:ListBackupJobs' :: ListBackupJobs -> Maybe BackupJobState
$sel:nextToken:ListBackupJobs' :: ListBackupJobs -> Maybe Text
$sel:byResourceType:ListBackupJobs' :: ListBackupJobs -> Maybe Text
$sel:byBackupVaultName:ListBackupJobs' :: ListBackupJobs -> Maybe Text
$sel:byCreatedBefore:ListBackupJobs' :: ListBackupJobs -> Maybe POSIX
$sel:byAccountId:ListBackupJobs' :: ListBackupJobs -> Maybe Text
$sel:byCreatedAfter:ListBackupJobs' :: ListBackupJobs -> Maybe POSIX
$sel:byResourceArn:ListBackupJobs' :: ListBackupJobs -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"resourceArn" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
byResourceArn,
        ByteString
"createdAfter" ByteString -> Maybe POSIX -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe POSIX
byCreatedAfter,
        ByteString
"accountId" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
byAccountId,
        ByteString
"createdBefore" ByteString -> Maybe POSIX -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe POSIX
byCreatedBefore,
        ByteString
"backupVaultName" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
byBackupVaultName,
        ByteString
"resourceType" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
byResourceType,
        ByteString
"nextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"state" ByteString -> Maybe BackupJobState -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe BackupJobState
byState,
        ByteString
"maxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults
      ]

-- | /See:/ 'newListBackupJobsResponse' smart constructor.
data ListBackupJobsResponse = ListBackupJobsResponse'
  { -- | An array of structures containing metadata about your backup jobs
    -- returned in JSON format.
    ListBackupJobsResponse -> Maybe [BackupJob]
backupJobs :: Prelude.Maybe [BackupJob],
    -- | The next item following a partial list of returned items. For example,
    -- if a request is made to return @maxResults@ number of items, @NextToken@
    -- allows you to return more items in your list starting at the location
    -- pointed to by the next token.
    ListBackupJobsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListBackupJobsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListBackupJobsResponse -> ListBackupJobsResponse -> Bool
(ListBackupJobsResponse -> ListBackupJobsResponse -> Bool)
-> (ListBackupJobsResponse -> ListBackupJobsResponse -> Bool)
-> Eq ListBackupJobsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListBackupJobsResponse -> ListBackupJobsResponse -> Bool
$c/= :: ListBackupJobsResponse -> ListBackupJobsResponse -> Bool
== :: ListBackupJobsResponse -> ListBackupJobsResponse -> Bool
$c== :: ListBackupJobsResponse -> ListBackupJobsResponse -> Bool
Prelude.Eq, ReadPrec [ListBackupJobsResponse]
ReadPrec ListBackupJobsResponse
Int -> ReadS ListBackupJobsResponse
ReadS [ListBackupJobsResponse]
(Int -> ReadS ListBackupJobsResponse)
-> ReadS [ListBackupJobsResponse]
-> ReadPrec ListBackupJobsResponse
-> ReadPrec [ListBackupJobsResponse]
-> Read ListBackupJobsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListBackupJobsResponse]
$creadListPrec :: ReadPrec [ListBackupJobsResponse]
readPrec :: ReadPrec ListBackupJobsResponse
$creadPrec :: ReadPrec ListBackupJobsResponse
readList :: ReadS [ListBackupJobsResponse]
$creadList :: ReadS [ListBackupJobsResponse]
readsPrec :: Int -> ReadS ListBackupJobsResponse
$creadsPrec :: Int -> ReadS ListBackupJobsResponse
Prelude.Read, Int -> ListBackupJobsResponse -> ShowS
[ListBackupJobsResponse] -> ShowS
ListBackupJobsResponse -> String
(Int -> ListBackupJobsResponse -> ShowS)
-> (ListBackupJobsResponse -> String)
-> ([ListBackupJobsResponse] -> ShowS)
-> Show ListBackupJobsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListBackupJobsResponse] -> ShowS
$cshowList :: [ListBackupJobsResponse] -> ShowS
show :: ListBackupJobsResponse -> String
$cshow :: ListBackupJobsResponse -> String
showsPrec :: Int -> ListBackupJobsResponse -> ShowS
$cshowsPrec :: Int -> ListBackupJobsResponse -> ShowS
Prelude.Show, (forall x. ListBackupJobsResponse -> Rep ListBackupJobsResponse x)
-> (forall x.
    Rep ListBackupJobsResponse x -> ListBackupJobsResponse)
-> Generic ListBackupJobsResponse
forall x. Rep ListBackupJobsResponse x -> ListBackupJobsResponse
forall x. ListBackupJobsResponse -> Rep ListBackupJobsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListBackupJobsResponse x -> ListBackupJobsResponse
$cfrom :: forall x. ListBackupJobsResponse -> Rep ListBackupJobsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListBackupJobsResponse' 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:
--
-- 'backupJobs', 'listBackupJobsResponse_backupJobs' - An array of structures containing metadata about your backup jobs
-- returned in JSON format.
--
-- 'nextToken', 'listBackupJobsResponse_nextToken' - The next item following a partial list of returned items. For example,
-- if a request is made to return @maxResults@ number of items, @NextToken@
-- allows you to return more items in your list starting at the location
-- pointed to by the next token.
--
-- 'httpStatus', 'listBackupJobsResponse_httpStatus' - The response's http status code.
newListBackupJobsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListBackupJobsResponse
newListBackupJobsResponse :: Int -> ListBackupJobsResponse
newListBackupJobsResponse Int
pHttpStatus_ =
  ListBackupJobsResponse' :: Maybe [BackupJob] -> Maybe Text -> Int -> ListBackupJobsResponse
ListBackupJobsResponse'
    { $sel:backupJobs:ListBackupJobsResponse' :: Maybe [BackupJob]
backupJobs =
        Maybe [BackupJob]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListBackupJobsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListBackupJobsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An array of structures containing metadata about your backup jobs
-- returned in JSON format.
listBackupJobsResponse_backupJobs :: Lens.Lens' ListBackupJobsResponse (Prelude.Maybe [BackupJob])
listBackupJobsResponse_backupJobs :: (Maybe [BackupJob] -> f (Maybe [BackupJob]))
-> ListBackupJobsResponse -> f ListBackupJobsResponse
listBackupJobsResponse_backupJobs = (ListBackupJobsResponse -> Maybe [BackupJob])
-> (ListBackupJobsResponse
    -> Maybe [BackupJob] -> ListBackupJobsResponse)
-> Lens
     ListBackupJobsResponse
     ListBackupJobsResponse
     (Maybe [BackupJob])
     (Maybe [BackupJob])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBackupJobsResponse' {Maybe [BackupJob]
backupJobs :: Maybe [BackupJob]
$sel:backupJobs:ListBackupJobsResponse' :: ListBackupJobsResponse -> Maybe [BackupJob]
backupJobs} -> Maybe [BackupJob]
backupJobs) (\s :: ListBackupJobsResponse
s@ListBackupJobsResponse' {} Maybe [BackupJob]
a -> ListBackupJobsResponse
s {$sel:backupJobs:ListBackupJobsResponse' :: Maybe [BackupJob]
backupJobs = Maybe [BackupJob]
a} :: ListBackupJobsResponse) ((Maybe [BackupJob] -> f (Maybe [BackupJob]))
 -> ListBackupJobsResponse -> f ListBackupJobsResponse)
-> ((Maybe [BackupJob] -> f (Maybe [BackupJob]))
    -> Maybe [BackupJob] -> f (Maybe [BackupJob]))
-> (Maybe [BackupJob] -> f (Maybe [BackupJob]))
-> ListBackupJobsResponse
-> f ListBackupJobsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [BackupJob] [BackupJob] [BackupJob] [BackupJob]
-> Iso
     (Maybe [BackupJob])
     (Maybe [BackupJob])
     (Maybe [BackupJob])
     (Maybe [BackupJob])
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 [BackupJob] [BackupJob] [BackupJob] [BackupJob]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The next item following a partial list of returned items. For example,
-- if a request is made to return @maxResults@ number of items, @NextToken@
-- allows you to return more items in your list starting at the location
-- pointed to by the next token.
listBackupJobsResponse_nextToken :: Lens.Lens' ListBackupJobsResponse (Prelude.Maybe Prelude.Text)
listBackupJobsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListBackupJobsResponse -> f ListBackupJobsResponse
listBackupJobsResponse_nextToken = (ListBackupJobsResponse -> Maybe Text)
-> (ListBackupJobsResponse -> Maybe Text -> ListBackupJobsResponse)
-> Lens
     ListBackupJobsResponse
     ListBackupJobsResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBackupJobsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListBackupJobsResponse' :: ListBackupJobsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListBackupJobsResponse
s@ListBackupJobsResponse' {} Maybe Text
a -> ListBackupJobsResponse
s {$sel:nextToken:ListBackupJobsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListBackupJobsResponse)

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

instance Prelude.NFData ListBackupJobsResponse