{-# 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.ListCopyJobs
-- 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 metadata about your copy jobs.
module Amazonka.Backup.ListCopyJobs
  ( -- * Creating a Request
    ListCopyJobs (..),
    newListCopyJobs,

    -- * Request Lenses
    listCopyJobs_byResourceArn,
    listCopyJobs_byCreatedAfter,
    listCopyJobs_byAccountId,
    listCopyJobs_byCreatedBefore,
    listCopyJobs_byDestinationVaultArn,
    listCopyJobs_byResourceType,
    listCopyJobs_nextToken,
    listCopyJobs_byState,
    listCopyJobs_maxResults,

    -- * Destructuring the Response
    ListCopyJobsResponse (..),
    newListCopyJobsResponse,

    -- * Response Lenses
    listCopyJobsResponse_nextToken,
    listCopyJobsResponse_copyJobs,
    listCopyJobsResponse_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:/ 'newListCopyJobs' smart constructor.
data ListCopyJobs = ListCopyJobs'
  { -- | Returns only copy jobs that match the specified resource Amazon Resource
    -- Name (ARN).
    ListCopyJobs -> Maybe Text
byResourceArn :: Prelude.Maybe Prelude.Text,
    -- | Returns only copy jobs that were created after the specified date.
    ListCopyJobs -> Maybe POSIX
byCreatedAfter :: Prelude.Maybe Core.POSIX,
    -- | The account ID to list the jobs from. Returns only copy jobs associated
    -- with the specified account ID.
    ListCopyJobs -> Maybe Text
byAccountId :: Prelude.Maybe Prelude.Text,
    -- | Returns only copy jobs that were created before the specified date.
    ListCopyJobs -> Maybe POSIX
byCreatedBefore :: Prelude.Maybe Core.POSIX,
    -- | An Amazon Resource Name (ARN) that uniquely identifies a source backup
    -- vault to copy from; for example,
    -- @arn:aws:backup:us-east-1:123456789012:vault:aBackupVault@.
    ListCopyJobs -> Maybe Text
byDestinationVaultArn :: 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
    ListCopyJobs -> 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.
    ListCopyJobs -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Returns only copy jobs that are in the specified state.
    ListCopyJobs -> Maybe CopyJobState
byState :: Prelude.Maybe CopyJobState,
    -- | The maximum number of items to be returned.
    ListCopyJobs -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListCopyJobs -> ListCopyJobs -> Bool
(ListCopyJobs -> ListCopyJobs -> Bool)
-> (ListCopyJobs -> ListCopyJobs -> Bool) -> Eq ListCopyJobs
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListCopyJobs -> ListCopyJobs -> Bool
$c/= :: ListCopyJobs -> ListCopyJobs -> Bool
== :: ListCopyJobs -> ListCopyJobs -> Bool
$c== :: ListCopyJobs -> ListCopyJobs -> Bool
Prelude.Eq, ReadPrec [ListCopyJobs]
ReadPrec ListCopyJobs
Int -> ReadS ListCopyJobs
ReadS [ListCopyJobs]
(Int -> ReadS ListCopyJobs)
-> ReadS [ListCopyJobs]
-> ReadPrec ListCopyJobs
-> ReadPrec [ListCopyJobs]
-> Read ListCopyJobs
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListCopyJobs]
$creadListPrec :: ReadPrec [ListCopyJobs]
readPrec :: ReadPrec ListCopyJobs
$creadPrec :: ReadPrec ListCopyJobs
readList :: ReadS [ListCopyJobs]
$creadList :: ReadS [ListCopyJobs]
readsPrec :: Int -> ReadS ListCopyJobs
$creadsPrec :: Int -> ReadS ListCopyJobs
Prelude.Read, Int -> ListCopyJobs -> ShowS
[ListCopyJobs] -> ShowS
ListCopyJobs -> String
(Int -> ListCopyJobs -> ShowS)
-> (ListCopyJobs -> String)
-> ([ListCopyJobs] -> ShowS)
-> Show ListCopyJobs
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListCopyJobs] -> ShowS
$cshowList :: [ListCopyJobs] -> ShowS
show :: ListCopyJobs -> String
$cshow :: ListCopyJobs -> String
showsPrec :: Int -> ListCopyJobs -> ShowS
$cshowsPrec :: Int -> ListCopyJobs -> ShowS
Prelude.Show, (forall x. ListCopyJobs -> Rep ListCopyJobs x)
-> (forall x. Rep ListCopyJobs x -> ListCopyJobs)
-> Generic ListCopyJobs
forall x. Rep ListCopyJobs x -> ListCopyJobs
forall x. ListCopyJobs -> Rep ListCopyJobs x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListCopyJobs x -> ListCopyJobs
$cfrom :: forall x. ListCopyJobs -> Rep ListCopyJobs x
Prelude.Generic)

-- |
-- Create a value of 'ListCopyJobs' 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', 'listCopyJobs_byResourceArn' - Returns only copy jobs that match the specified resource Amazon Resource
-- Name (ARN).
--
-- 'byCreatedAfter', 'listCopyJobs_byCreatedAfter' - Returns only copy jobs that were created after the specified date.
--
-- 'byAccountId', 'listCopyJobs_byAccountId' - The account ID to list the jobs from. Returns only copy jobs associated
-- with the specified account ID.
--
-- 'byCreatedBefore', 'listCopyJobs_byCreatedBefore' - Returns only copy jobs that were created before the specified date.
--
-- 'byDestinationVaultArn', 'listCopyJobs_byDestinationVaultArn' - An Amazon Resource Name (ARN) that uniquely identifies a source backup
-- vault to copy from; for example,
-- @arn:aws:backup:us-east-1:123456789012:vault:aBackupVault@.
--
-- 'byResourceType', 'listCopyJobs_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', 'listCopyJobs_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', 'listCopyJobs_byState' - Returns only copy jobs that are in the specified state.
--
-- 'maxResults', 'listCopyJobs_maxResults' - The maximum number of items to be returned.
newListCopyJobs ::
  ListCopyJobs
newListCopyJobs :: ListCopyJobs
newListCopyJobs =
  ListCopyJobs' :: Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe CopyJobState
-> Maybe Natural
-> ListCopyJobs
ListCopyJobs'
    { $sel:byResourceArn:ListCopyJobs' :: Maybe Text
byResourceArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:byCreatedAfter:ListCopyJobs' :: Maybe POSIX
byCreatedAfter = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:byAccountId:ListCopyJobs' :: Maybe Text
byAccountId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:byCreatedBefore:ListCopyJobs' :: Maybe POSIX
byCreatedBefore = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:byDestinationVaultArn:ListCopyJobs' :: Maybe Text
byDestinationVaultArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:byResourceType:ListCopyJobs' :: Maybe Text
byResourceType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListCopyJobs' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:byState:ListCopyJobs' :: Maybe CopyJobState
byState = Maybe CopyJobState
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListCopyJobs' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

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

-- | Returns only copy jobs that were created after the specified date.
listCopyJobs_byCreatedAfter :: Lens.Lens' ListCopyJobs (Prelude.Maybe Prelude.UTCTime)
listCopyJobs_byCreatedAfter :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ListCopyJobs -> f ListCopyJobs
listCopyJobs_byCreatedAfter = (ListCopyJobs -> Maybe POSIX)
-> (ListCopyJobs -> Maybe POSIX -> ListCopyJobs)
-> Lens ListCopyJobs ListCopyJobs (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCopyJobs' {Maybe POSIX
byCreatedAfter :: Maybe POSIX
$sel:byCreatedAfter:ListCopyJobs' :: ListCopyJobs -> Maybe POSIX
byCreatedAfter} -> Maybe POSIX
byCreatedAfter) (\s :: ListCopyJobs
s@ListCopyJobs' {} Maybe POSIX
a -> ListCopyJobs
s {$sel:byCreatedAfter:ListCopyJobs' :: Maybe POSIX
byCreatedAfter = Maybe POSIX
a} :: ListCopyJobs) ((Maybe POSIX -> f (Maybe POSIX))
 -> ListCopyJobs -> f ListCopyJobs)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ListCopyJobs
-> f ListCopyJobs
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 copy jobs associated
-- with the specified account ID.
listCopyJobs_byAccountId :: Lens.Lens' ListCopyJobs (Prelude.Maybe Prelude.Text)
listCopyJobs_byAccountId :: (Maybe Text -> f (Maybe Text)) -> ListCopyJobs -> f ListCopyJobs
listCopyJobs_byAccountId = (ListCopyJobs -> Maybe Text)
-> (ListCopyJobs -> Maybe Text -> ListCopyJobs)
-> Lens ListCopyJobs ListCopyJobs (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCopyJobs' {Maybe Text
byAccountId :: Maybe Text
$sel:byAccountId:ListCopyJobs' :: ListCopyJobs -> Maybe Text
byAccountId} -> Maybe Text
byAccountId) (\s :: ListCopyJobs
s@ListCopyJobs' {} Maybe Text
a -> ListCopyJobs
s {$sel:byAccountId:ListCopyJobs' :: Maybe Text
byAccountId = Maybe Text
a} :: ListCopyJobs)

-- | Returns only copy jobs that were created before the specified date.
listCopyJobs_byCreatedBefore :: Lens.Lens' ListCopyJobs (Prelude.Maybe Prelude.UTCTime)
listCopyJobs_byCreatedBefore :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ListCopyJobs -> f ListCopyJobs
listCopyJobs_byCreatedBefore = (ListCopyJobs -> Maybe POSIX)
-> (ListCopyJobs -> Maybe POSIX -> ListCopyJobs)
-> Lens ListCopyJobs ListCopyJobs (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCopyJobs' {Maybe POSIX
byCreatedBefore :: Maybe POSIX
$sel:byCreatedBefore:ListCopyJobs' :: ListCopyJobs -> Maybe POSIX
byCreatedBefore} -> Maybe POSIX
byCreatedBefore) (\s :: ListCopyJobs
s@ListCopyJobs' {} Maybe POSIX
a -> ListCopyJobs
s {$sel:byCreatedBefore:ListCopyJobs' :: Maybe POSIX
byCreatedBefore = Maybe POSIX
a} :: ListCopyJobs) ((Maybe POSIX -> f (Maybe POSIX))
 -> ListCopyJobs -> f ListCopyJobs)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ListCopyJobs
-> f ListCopyJobs
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

-- | An Amazon Resource Name (ARN) that uniquely identifies a source backup
-- vault to copy from; for example,
-- @arn:aws:backup:us-east-1:123456789012:vault:aBackupVault@.
listCopyJobs_byDestinationVaultArn :: Lens.Lens' ListCopyJobs (Prelude.Maybe Prelude.Text)
listCopyJobs_byDestinationVaultArn :: (Maybe Text -> f (Maybe Text)) -> ListCopyJobs -> f ListCopyJobs
listCopyJobs_byDestinationVaultArn = (ListCopyJobs -> Maybe Text)
-> (ListCopyJobs -> Maybe Text -> ListCopyJobs)
-> Lens ListCopyJobs ListCopyJobs (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCopyJobs' {Maybe Text
byDestinationVaultArn :: Maybe Text
$sel:byDestinationVaultArn:ListCopyJobs' :: ListCopyJobs -> Maybe Text
byDestinationVaultArn} -> Maybe Text
byDestinationVaultArn) (\s :: ListCopyJobs
s@ListCopyJobs' {} Maybe Text
a -> ListCopyJobs
s {$sel:byDestinationVaultArn:ListCopyJobs' :: Maybe Text
byDestinationVaultArn = Maybe Text
a} :: ListCopyJobs)

-- | 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
listCopyJobs_byResourceType :: Lens.Lens' ListCopyJobs (Prelude.Maybe Prelude.Text)
listCopyJobs_byResourceType :: (Maybe Text -> f (Maybe Text)) -> ListCopyJobs -> f ListCopyJobs
listCopyJobs_byResourceType = (ListCopyJobs -> Maybe Text)
-> (ListCopyJobs -> Maybe Text -> ListCopyJobs)
-> Lens ListCopyJobs ListCopyJobs (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCopyJobs' {Maybe Text
byResourceType :: Maybe Text
$sel:byResourceType:ListCopyJobs' :: ListCopyJobs -> Maybe Text
byResourceType} -> Maybe Text
byResourceType) (\s :: ListCopyJobs
s@ListCopyJobs' {} Maybe Text
a -> ListCopyJobs
s {$sel:byResourceType:ListCopyJobs' :: Maybe Text
byResourceType = Maybe Text
a} :: ListCopyJobs)

-- | 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.
listCopyJobs_nextToken :: Lens.Lens' ListCopyJobs (Prelude.Maybe Prelude.Text)
listCopyJobs_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListCopyJobs -> f ListCopyJobs
listCopyJobs_nextToken = (ListCopyJobs -> Maybe Text)
-> (ListCopyJobs -> Maybe Text -> ListCopyJobs)
-> Lens ListCopyJobs ListCopyJobs (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCopyJobs' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListCopyJobs' :: ListCopyJobs -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListCopyJobs
s@ListCopyJobs' {} Maybe Text
a -> ListCopyJobs
s {$sel:nextToken:ListCopyJobs' :: Maybe Text
nextToken = Maybe Text
a} :: ListCopyJobs)

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

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

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

instance Prelude.NFData ListCopyJobs

instance Core.ToHeaders ListCopyJobs where
  toHeaders :: ListCopyJobs -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListCopyJobs -> 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 ListCopyJobs where
  toPath :: ListCopyJobs -> ByteString
toPath = ByteString -> ListCopyJobs -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/copy-jobs/"

instance Core.ToQuery ListCopyJobs where
  toQuery :: ListCopyJobs -> QueryString
toQuery ListCopyJobs' {Maybe Natural
Maybe Text
Maybe POSIX
Maybe CopyJobState
maxResults :: Maybe Natural
byState :: Maybe CopyJobState
nextToken :: Maybe Text
byResourceType :: Maybe Text
byDestinationVaultArn :: Maybe Text
byCreatedBefore :: Maybe POSIX
byAccountId :: Maybe Text
byCreatedAfter :: Maybe POSIX
byResourceArn :: Maybe Text
$sel:maxResults:ListCopyJobs' :: ListCopyJobs -> Maybe Natural
$sel:byState:ListCopyJobs' :: ListCopyJobs -> Maybe CopyJobState
$sel:nextToken:ListCopyJobs' :: ListCopyJobs -> Maybe Text
$sel:byResourceType:ListCopyJobs' :: ListCopyJobs -> Maybe Text
$sel:byDestinationVaultArn:ListCopyJobs' :: ListCopyJobs -> Maybe Text
$sel:byCreatedBefore:ListCopyJobs' :: ListCopyJobs -> Maybe POSIX
$sel:byAccountId:ListCopyJobs' :: ListCopyJobs -> Maybe Text
$sel:byCreatedAfter:ListCopyJobs' :: ListCopyJobs -> Maybe POSIX
$sel:byResourceArn:ListCopyJobs' :: ListCopyJobs -> 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
"destinationVaultArn" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
byDestinationVaultArn,
        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 CopyJobState -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe CopyJobState
byState,
        ByteString
"maxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults
      ]

-- | /See:/ 'newListCopyJobsResponse' smart constructor.
data ListCopyJobsResponse = ListCopyJobsResponse'
  { -- | 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.
    ListCopyJobsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | An array of structures containing metadata about your copy jobs returned
    -- in JSON format.
    ListCopyJobsResponse -> Maybe [CopyJob]
copyJobs :: Prelude.Maybe [CopyJob],
    -- | The response's http status code.
    ListCopyJobsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListCopyJobsResponse -> ListCopyJobsResponse -> Bool
(ListCopyJobsResponse -> ListCopyJobsResponse -> Bool)
-> (ListCopyJobsResponse -> ListCopyJobsResponse -> Bool)
-> Eq ListCopyJobsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListCopyJobsResponse -> ListCopyJobsResponse -> Bool
$c/= :: ListCopyJobsResponse -> ListCopyJobsResponse -> Bool
== :: ListCopyJobsResponse -> ListCopyJobsResponse -> Bool
$c== :: ListCopyJobsResponse -> ListCopyJobsResponse -> Bool
Prelude.Eq, ReadPrec [ListCopyJobsResponse]
ReadPrec ListCopyJobsResponse
Int -> ReadS ListCopyJobsResponse
ReadS [ListCopyJobsResponse]
(Int -> ReadS ListCopyJobsResponse)
-> ReadS [ListCopyJobsResponse]
-> ReadPrec ListCopyJobsResponse
-> ReadPrec [ListCopyJobsResponse]
-> Read ListCopyJobsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListCopyJobsResponse]
$creadListPrec :: ReadPrec [ListCopyJobsResponse]
readPrec :: ReadPrec ListCopyJobsResponse
$creadPrec :: ReadPrec ListCopyJobsResponse
readList :: ReadS [ListCopyJobsResponse]
$creadList :: ReadS [ListCopyJobsResponse]
readsPrec :: Int -> ReadS ListCopyJobsResponse
$creadsPrec :: Int -> ReadS ListCopyJobsResponse
Prelude.Read, Int -> ListCopyJobsResponse -> ShowS
[ListCopyJobsResponse] -> ShowS
ListCopyJobsResponse -> String
(Int -> ListCopyJobsResponse -> ShowS)
-> (ListCopyJobsResponse -> String)
-> ([ListCopyJobsResponse] -> ShowS)
-> Show ListCopyJobsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListCopyJobsResponse] -> ShowS
$cshowList :: [ListCopyJobsResponse] -> ShowS
show :: ListCopyJobsResponse -> String
$cshow :: ListCopyJobsResponse -> String
showsPrec :: Int -> ListCopyJobsResponse -> ShowS
$cshowsPrec :: Int -> ListCopyJobsResponse -> ShowS
Prelude.Show, (forall x. ListCopyJobsResponse -> Rep ListCopyJobsResponse x)
-> (forall x. Rep ListCopyJobsResponse x -> ListCopyJobsResponse)
-> Generic ListCopyJobsResponse
forall x. Rep ListCopyJobsResponse x -> ListCopyJobsResponse
forall x. ListCopyJobsResponse -> Rep ListCopyJobsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListCopyJobsResponse x -> ListCopyJobsResponse
$cfrom :: forall x. ListCopyJobsResponse -> Rep ListCopyJobsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListCopyJobsResponse' 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:
--
-- 'nextToken', 'listCopyJobsResponse_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.
--
-- 'copyJobs', 'listCopyJobsResponse_copyJobs' - An array of structures containing metadata about your copy jobs returned
-- in JSON format.
--
-- 'httpStatus', 'listCopyJobsResponse_httpStatus' - The response's http status code.
newListCopyJobsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListCopyJobsResponse
newListCopyJobsResponse :: Int -> ListCopyJobsResponse
newListCopyJobsResponse Int
pHttpStatus_ =
  ListCopyJobsResponse' :: Maybe Text -> Maybe [CopyJob] -> Int -> ListCopyJobsResponse
ListCopyJobsResponse'
    { $sel:nextToken:ListCopyJobsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:copyJobs:ListCopyJobsResponse' :: Maybe [CopyJob]
copyJobs = Maybe [CopyJob]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListCopyJobsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | 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.
listCopyJobsResponse_nextToken :: Lens.Lens' ListCopyJobsResponse (Prelude.Maybe Prelude.Text)
listCopyJobsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListCopyJobsResponse -> f ListCopyJobsResponse
listCopyJobsResponse_nextToken = (ListCopyJobsResponse -> Maybe Text)
-> (ListCopyJobsResponse -> Maybe Text -> ListCopyJobsResponse)
-> Lens
     ListCopyJobsResponse ListCopyJobsResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCopyJobsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListCopyJobsResponse' :: ListCopyJobsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListCopyJobsResponse
s@ListCopyJobsResponse' {} Maybe Text
a -> ListCopyJobsResponse
s {$sel:nextToken:ListCopyJobsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListCopyJobsResponse)

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

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

instance Prelude.NFData ListCopyJobsResponse