{-# 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.CodeDeploy.ListApplicationRevisions
-- 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)
--
-- Lists information about revisions for an application.
--
-- This operation returns paginated results.
module Amazonka.CodeDeploy.ListApplicationRevisions
  ( -- * Creating a Request
    ListApplicationRevisions (..),
    newListApplicationRevisions,

    -- * Request Lenses
    listApplicationRevisions_s3KeyPrefix,
    listApplicationRevisions_deployed,
    listApplicationRevisions_sortOrder,
    listApplicationRevisions_nextToken,
    listApplicationRevisions_s3Bucket,
    listApplicationRevisions_sortBy,
    listApplicationRevisions_applicationName,

    -- * Destructuring the Response
    ListApplicationRevisionsResponse (..),
    newListApplicationRevisionsResponse,

    -- * Response Lenses
    listApplicationRevisionsResponse_nextToken,
    listApplicationRevisionsResponse_revisions,
    listApplicationRevisionsResponse_httpStatus,
  )
where

import Amazonka.CodeDeploy.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

-- | Represents the input of a @ListApplicationRevisions@ operation.
--
-- /See:/ 'newListApplicationRevisions' smart constructor.
data ListApplicationRevisions = ListApplicationRevisions'
  { -- | A key prefix for the set of Amazon S3 objects to limit the search for
    -- revisions.
    ListApplicationRevisions -> Maybe Text
s3KeyPrefix :: Prelude.Maybe Prelude.Text,
    -- | Whether to list revisions based on whether the revision is the target
    -- revision of a deployment group:
    --
    -- -   @include@: List revisions that are target revisions of a deployment
    --     group.
    --
    -- -   @exclude@: Do not list revisions that are target revisions of a
    --     deployment group.
    --
    -- -   @ignore@: List all revisions.
    ListApplicationRevisions -> Maybe ListStateFilterAction
deployed :: Prelude.Maybe ListStateFilterAction,
    -- | The order in which to sort the list results:
    --
    -- -   @ascending@: ascending order.
    --
    -- -   @descending@: descending order.
    --
    -- If not specified, the results are sorted in ascending order.
    --
    -- If set to null, the results are sorted in an arbitrary order.
    ListApplicationRevisions -> Maybe SortOrder
sortOrder :: Prelude.Maybe SortOrder,
    -- | An identifier returned from the previous @ListApplicationRevisions@
    -- call. It can be used to return the next set of applications in the list.
    ListApplicationRevisions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | An Amazon S3 bucket name to limit the search for revisions.
    --
    -- If set to null, all of the user\'s buckets are searched.
    ListApplicationRevisions -> Maybe Text
s3Bucket :: Prelude.Maybe Prelude.Text,
    -- | The column name to use to sort the list results:
    --
    -- -   @registerTime@: Sort by the time the revisions were registered with
    --     AWS CodeDeploy.
    --
    -- -   @firstUsedTime@: Sort by the time the revisions were first used in a
    --     deployment.
    --
    -- -   @lastUsedTime@: Sort by the time the revisions were last used in a
    --     deployment.
    --
    -- If not specified or set to null, the results are returned in an
    -- arbitrary order.
    ListApplicationRevisions -> Maybe ApplicationRevisionSortBy
sortBy :: Prelude.Maybe ApplicationRevisionSortBy,
    -- | The name of an AWS CodeDeploy application associated with the IAM user
    -- or AWS account.
    ListApplicationRevisions -> Text
applicationName :: Prelude.Text
  }
  deriving (ListApplicationRevisions -> ListApplicationRevisions -> Bool
(ListApplicationRevisions -> ListApplicationRevisions -> Bool)
-> (ListApplicationRevisions -> ListApplicationRevisions -> Bool)
-> Eq ListApplicationRevisions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListApplicationRevisions -> ListApplicationRevisions -> Bool
$c/= :: ListApplicationRevisions -> ListApplicationRevisions -> Bool
== :: ListApplicationRevisions -> ListApplicationRevisions -> Bool
$c== :: ListApplicationRevisions -> ListApplicationRevisions -> Bool
Prelude.Eq, ReadPrec [ListApplicationRevisions]
ReadPrec ListApplicationRevisions
Int -> ReadS ListApplicationRevisions
ReadS [ListApplicationRevisions]
(Int -> ReadS ListApplicationRevisions)
-> ReadS [ListApplicationRevisions]
-> ReadPrec ListApplicationRevisions
-> ReadPrec [ListApplicationRevisions]
-> Read ListApplicationRevisions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListApplicationRevisions]
$creadListPrec :: ReadPrec [ListApplicationRevisions]
readPrec :: ReadPrec ListApplicationRevisions
$creadPrec :: ReadPrec ListApplicationRevisions
readList :: ReadS [ListApplicationRevisions]
$creadList :: ReadS [ListApplicationRevisions]
readsPrec :: Int -> ReadS ListApplicationRevisions
$creadsPrec :: Int -> ReadS ListApplicationRevisions
Prelude.Read, Int -> ListApplicationRevisions -> ShowS
[ListApplicationRevisions] -> ShowS
ListApplicationRevisions -> String
(Int -> ListApplicationRevisions -> ShowS)
-> (ListApplicationRevisions -> String)
-> ([ListApplicationRevisions] -> ShowS)
-> Show ListApplicationRevisions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListApplicationRevisions] -> ShowS
$cshowList :: [ListApplicationRevisions] -> ShowS
show :: ListApplicationRevisions -> String
$cshow :: ListApplicationRevisions -> String
showsPrec :: Int -> ListApplicationRevisions -> ShowS
$cshowsPrec :: Int -> ListApplicationRevisions -> ShowS
Prelude.Show, (forall x.
 ListApplicationRevisions -> Rep ListApplicationRevisions x)
-> (forall x.
    Rep ListApplicationRevisions x -> ListApplicationRevisions)
-> Generic ListApplicationRevisions
forall x.
Rep ListApplicationRevisions x -> ListApplicationRevisions
forall x.
ListApplicationRevisions -> Rep ListApplicationRevisions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListApplicationRevisions x -> ListApplicationRevisions
$cfrom :: forall x.
ListApplicationRevisions -> Rep ListApplicationRevisions x
Prelude.Generic)

-- |
-- Create a value of 'ListApplicationRevisions' 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:
--
-- 's3KeyPrefix', 'listApplicationRevisions_s3KeyPrefix' - A key prefix for the set of Amazon S3 objects to limit the search for
-- revisions.
--
-- 'deployed', 'listApplicationRevisions_deployed' - Whether to list revisions based on whether the revision is the target
-- revision of a deployment group:
--
-- -   @include@: List revisions that are target revisions of a deployment
--     group.
--
-- -   @exclude@: Do not list revisions that are target revisions of a
--     deployment group.
--
-- -   @ignore@: List all revisions.
--
-- 'sortOrder', 'listApplicationRevisions_sortOrder' - The order in which to sort the list results:
--
-- -   @ascending@: ascending order.
--
-- -   @descending@: descending order.
--
-- If not specified, the results are sorted in ascending order.
--
-- If set to null, the results are sorted in an arbitrary order.
--
-- 'nextToken', 'listApplicationRevisions_nextToken' - An identifier returned from the previous @ListApplicationRevisions@
-- call. It can be used to return the next set of applications in the list.
--
-- 's3Bucket', 'listApplicationRevisions_s3Bucket' - An Amazon S3 bucket name to limit the search for revisions.
--
-- If set to null, all of the user\'s buckets are searched.
--
-- 'sortBy', 'listApplicationRevisions_sortBy' - The column name to use to sort the list results:
--
-- -   @registerTime@: Sort by the time the revisions were registered with
--     AWS CodeDeploy.
--
-- -   @firstUsedTime@: Sort by the time the revisions were first used in a
--     deployment.
--
-- -   @lastUsedTime@: Sort by the time the revisions were last used in a
--     deployment.
--
-- If not specified or set to null, the results are returned in an
-- arbitrary order.
--
-- 'applicationName', 'listApplicationRevisions_applicationName' - The name of an AWS CodeDeploy application associated with the IAM user
-- or AWS account.
newListApplicationRevisions ::
  -- | 'applicationName'
  Prelude.Text ->
  ListApplicationRevisions
newListApplicationRevisions :: Text -> ListApplicationRevisions
newListApplicationRevisions Text
pApplicationName_ =
  ListApplicationRevisions' :: Maybe Text
-> Maybe ListStateFilterAction
-> Maybe SortOrder
-> Maybe Text
-> Maybe Text
-> Maybe ApplicationRevisionSortBy
-> Text
-> ListApplicationRevisions
ListApplicationRevisions'
    { $sel:s3KeyPrefix:ListApplicationRevisions' :: Maybe Text
s3KeyPrefix =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:deployed:ListApplicationRevisions' :: Maybe ListStateFilterAction
deployed = Maybe ListStateFilterAction
forall a. Maybe a
Prelude.Nothing,
      $sel:sortOrder:ListApplicationRevisions' :: Maybe SortOrder
sortOrder = Maybe SortOrder
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListApplicationRevisions' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:s3Bucket:ListApplicationRevisions' :: Maybe Text
s3Bucket = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sortBy:ListApplicationRevisions' :: Maybe ApplicationRevisionSortBy
sortBy = Maybe ApplicationRevisionSortBy
forall a. Maybe a
Prelude.Nothing,
      $sel:applicationName:ListApplicationRevisions' :: Text
applicationName = Text
pApplicationName_
    }

-- | A key prefix for the set of Amazon S3 objects to limit the search for
-- revisions.
listApplicationRevisions_s3KeyPrefix :: Lens.Lens' ListApplicationRevisions (Prelude.Maybe Prelude.Text)
listApplicationRevisions_s3KeyPrefix :: (Maybe Text -> f (Maybe Text))
-> ListApplicationRevisions -> f ListApplicationRevisions
listApplicationRevisions_s3KeyPrefix = (ListApplicationRevisions -> Maybe Text)
-> (ListApplicationRevisions
    -> Maybe Text -> ListApplicationRevisions)
-> Lens
     ListApplicationRevisions
     ListApplicationRevisions
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListApplicationRevisions' {Maybe Text
s3KeyPrefix :: Maybe Text
$sel:s3KeyPrefix:ListApplicationRevisions' :: ListApplicationRevisions -> Maybe Text
s3KeyPrefix} -> Maybe Text
s3KeyPrefix) (\s :: ListApplicationRevisions
s@ListApplicationRevisions' {} Maybe Text
a -> ListApplicationRevisions
s {$sel:s3KeyPrefix:ListApplicationRevisions' :: Maybe Text
s3KeyPrefix = Maybe Text
a} :: ListApplicationRevisions)

-- | Whether to list revisions based on whether the revision is the target
-- revision of a deployment group:
--
-- -   @include@: List revisions that are target revisions of a deployment
--     group.
--
-- -   @exclude@: Do not list revisions that are target revisions of a
--     deployment group.
--
-- -   @ignore@: List all revisions.
listApplicationRevisions_deployed :: Lens.Lens' ListApplicationRevisions (Prelude.Maybe ListStateFilterAction)
listApplicationRevisions_deployed :: (Maybe ListStateFilterAction -> f (Maybe ListStateFilterAction))
-> ListApplicationRevisions -> f ListApplicationRevisions
listApplicationRevisions_deployed = (ListApplicationRevisions -> Maybe ListStateFilterAction)
-> (ListApplicationRevisions
    -> Maybe ListStateFilterAction -> ListApplicationRevisions)
-> Lens
     ListApplicationRevisions
     ListApplicationRevisions
     (Maybe ListStateFilterAction)
     (Maybe ListStateFilterAction)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListApplicationRevisions' {Maybe ListStateFilterAction
deployed :: Maybe ListStateFilterAction
$sel:deployed:ListApplicationRevisions' :: ListApplicationRevisions -> Maybe ListStateFilterAction
deployed} -> Maybe ListStateFilterAction
deployed) (\s :: ListApplicationRevisions
s@ListApplicationRevisions' {} Maybe ListStateFilterAction
a -> ListApplicationRevisions
s {$sel:deployed:ListApplicationRevisions' :: Maybe ListStateFilterAction
deployed = Maybe ListStateFilterAction
a} :: ListApplicationRevisions)

-- | The order in which to sort the list results:
--
-- -   @ascending@: ascending order.
--
-- -   @descending@: descending order.
--
-- If not specified, the results are sorted in ascending order.
--
-- If set to null, the results are sorted in an arbitrary order.
listApplicationRevisions_sortOrder :: Lens.Lens' ListApplicationRevisions (Prelude.Maybe SortOrder)
listApplicationRevisions_sortOrder :: (Maybe SortOrder -> f (Maybe SortOrder))
-> ListApplicationRevisions -> f ListApplicationRevisions
listApplicationRevisions_sortOrder = (ListApplicationRevisions -> Maybe SortOrder)
-> (ListApplicationRevisions
    -> Maybe SortOrder -> ListApplicationRevisions)
-> Lens
     ListApplicationRevisions
     ListApplicationRevisions
     (Maybe SortOrder)
     (Maybe SortOrder)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListApplicationRevisions' {Maybe SortOrder
sortOrder :: Maybe SortOrder
$sel:sortOrder:ListApplicationRevisions' :: ListApplicationRevisions -> Maybe SortOrder
sortOrder} -> Maybe SortOrder
sortOrder) (\s :: ListApplicationRevisions
s@ListApplicationRevisions' {} Maybe SortOrder
a -> ListApplicationRevisions
s {$sel:sortOrder:ListApplicationRevisions' :: Maybe SortOrder
sortOrder = Maybe SortOrder
a} :: ListApplicationRevisions)

-- | An identifier returned from the previous @ListApplicationRevisions@
-- call. It can be used to return the next set of applications in the list.
listApplicationRevisions_nextToken :: Lens.Lens' ListApplicationRevisions (Prelude.Maybe Prelude.Text)
listApplicationRevisions_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListApplicationRevisions -> f ListApplicationRevisions
listApplicationRevisions_nextToken = (ListApplicationRevisions -> Maybe Text)
-> (ListApplicationRevisions
    -> Maybe Text -> ListApplicationRevisions)
-> Lens
     ListApplicationRevisions
     ListApplicationRevisions
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListApplicationRevisions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListApplicationRevisions' :: ListApplicationRevisions -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListApplicationRevisions
s@ListApplicationRevisions' {} Maybe Text
a -> ListApplicationRevisions
s {$sel:nextToken:ListApplicationRevisions' :: Maybe Text
nextToken = Maybe Text
a} :: ListApplicationRevisions)

-- | An Amazon S3 bucket name to limit the search for revisions.
--
-- If set to null, all of the user\'s buckets are searched.
listApplicationRevisions_s3Bucket :: Lens.Lens' ListApplicationRevisions (Prelude.Maybe Prelude.Text)
listApplicationRevisions_s3Bucket :: (Maybe Text -> f (Maybe Text))
-> ListApplicationRevisions -> f ListApplicationRevisions
listApplicationRevisions_s3Bucket = (ListApplicationRevisions -> Maybe Text)
-> (ListApplicationRevisions
    -> Maybe Text -> ListApplicationRevisions)
-> Lens
     ListApplicationRevisions
     ListApplicationRevisions
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListApplicationRevisions' {Maybe Text
s3Bucket :: Maybe Text
$sel:s3Bucket:ListApplicationRevisions' :: ListApplicationRevisions -> Maybe Text
s3Bucket} -> Maybe Text
s3Bucket) (\s :: ListApplicationRevisions
s@ListApplicationRevisions' {} Maybe Text
a -> ListApplicationRevisions
s {$sel:s3Bucket:ListApplicationRevisions' :: Maybe Text
s3Bucket = Maybe Text
a} :: ListApplicationRevisions)

-- | The column name to use to sort the list results:
--
-- -   @registerTime@: Sort by the time the revisions were registered with
--     AWS CodeDeploy.
--
-- -   @firstUsedTime@: Sort by the time the revisions were first used in a
--     deployment.
--
-- -   @lastUsedTime@: Sort by the time the revisions were last used in a
--     deployment.
--
-- If not specified or set to null, the results are returned in an
-- arbitrary order.
listApplicationRevisions_sortBy :: Lens.Lens' ListApplicationRevisions (Prelude.Maybe ApplicationRevisionSortBy)
listApplicationRevisions_sortBy :: (Maybe ApplicationRevisionSortBy
 -> f (Maybe ApplicationRevisionSortBy))
-> ListApplicationRevisions -> f ListApplicationRevisions
listApplicationRevisions_sortBy = (ListApplicationRevisions -> Maybe ApplicationRevisionSortBy)
-> (ListApplicationRevisions
    -> Maybe ApplicationRevisionSortBy -> ListApplicationRevisions)
-> Lens
     ListApplicationRevisions
     ListApplicationRevisions
     (Maybe ApplicationRevisionSortBy)
     (Maybe ApplicationRevisionSortBy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListApplicationRevisions' {Maybe ApplicationRevisionSortBy
sortBy :: Maybe ApplicationRevisionSortBy
$sel:sortBy:ListApplicationRevisions' :: ListApplicationRevisions -> Maybe ApplicationRevisionSortBy
sortBy} -> Maybe ApplicationRevisionSortBy
sortBy) (\s :: ListApplicationRevisions
s@ListApplicationRevisions' {} Maybe ApplicationRevisionSortBy
a -> ListApplicationRevisions
s {$sel:sortBy:ListApplicationRevisions' :: Maybe ApplicationRevisionSortBy
sortBy = Maybe ApplicationRevisionSortBy
a} :: ListApplicationRevisions)

-- | The name of an AWS CodeDeploy application associated with the IAM user
-- or AWS account.
listApplicationRevisions_applicationName :: Lens.Lens' ListApplicationRevisions Prelude.Text
listApplicationRevisions_applicationName :: (Text -> f Text)
-> ListApplicationRevisions -> f ListApplicationRevisions
listApplicationRevisions_applicationName = (ListApplicationRevisions -> Text)
-> (ListApplicationRevisions -> Text -> ListApplicationRevisions)
-> Lens ListApplicationRevisions ListApplicationRevisions Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListApplicationRevisions' {Text
applicationName :: Text
$sel:applicationName:ListApplicationRevisions' :: ListApplicationRevisions -> Text
applicationName} -> Text
applicationName) (\s :: ListApplicationRevisions
s@ListApplicationRevisions' {} Text
a -> ListApplicationRevisions
s {$sel:applicationName:ListApplicationRevisions' :: Text
applicationName = Text
a} :: ListApplicationRevisions)

instance Core.AWSPager ListApplicationRevisions where
  page :: ListApplicationRevisions
-> AWSResponse ListApplicationRevisions
-> Maybe ListApplicationRevisions
page ListApplicationRevisions
rq AWSResponse ListApplicationRevisions
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListApplicationRevisions
ListApplicationRevisionsResponse
rs
            ListApplicationRevisionsResponse
-> Getting (First Text) ListApplicationRevisionsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListApplicationRevisionsResponse
-> Const (First Text) ListApplicationRevisionsResponse
Lens' ListApplicationRevisionsResponse (Maybe Text)
listApplicationRevisionsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListApplicationRevisionsResponse
 -> Const (First Text) ListApplicationRevisionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListApplicationRevisionsResponse 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 ListApplicationRevisions
forall a. Maybe a
Prelude.Nothing
    | Maybe [RevisionLocation] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListApplicationRevisions
ListApplicationRevisionsResponse
rs
            ListApplicationRevisionsResponse
-> Getting
     (First [RevisionLocation])
     ListApplicationRevisionsResponse
     [RevisionLocation]
-> Maybe [RevisionLocation]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [RevisionLocation]
 -> Const (First [RevisionLocation]) (Maybe [RevisionLocation]))
-> ListApplicationRevisionsResponse
-> Const
     (First [RevisionLocation]) ListApplicationRevisionsResponse
Lens' ListApplicationRevisionsResponse (Maybe [RevisionLocation])
listApplicationRevisionsResponse_revisions
              ((Maybe [RevisionLocation]
  -> Const (First [RevisionLocation]) (Maybe [RevisionLocation]))
 -> ListApplicationRevisionsResponse
 -> Const
      (First [RevisionLocation]) ListApplicationRevisionsResponse)
-> (([RevisionLocation]
     -> Const (First [RevisionLocation]) [RevisionLocation])
    -> Maybe [RevisionLocation]
    -> Const (First [RevisionLocation]) (Maybe [RevisionLocation]))
-> Getting
     (First [RevisionLocation])
     ListApplicationRevisionsResponse
     [RevisionLocation]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([RevisionLocation]
 -> Const (First [RevisionLocation]) [RevisionLocation])
-> Maybe [RevisionLocation]
-> Const (First [RevisionLocation]) (Maybe [RevisionLocation])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListApplicationRevisions
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListApplicationRevisions -> Maybe ListApplicationRevisions
forall a. a -> Maybe a
Prelude.Just (ListApplicationRevisions -> Maybe ListApplicationRevisions)
-> ListApplicationRevisions -> Maybe ListApplicationRevisions
forall a b. (a -> b) -> a -> b
Prelude.$
        ListApplicationRevisions
rq
          ListApplicationRevisions
-> (ListApplicationRevisions -> ListApplicationRevisions)
-> ListApplicationRevisions
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListApplicationRevisions -> Identity ListApplicationRevisions
Lens
  ListApplicationRevisions
  ListApplicationRevisions
  (Maybe Text)
  (Maybe Text)
listApplicationRevisions_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListApplicationRevisions -> Identity ListApplicationRevisions)
-> Maybe Text
-> ListApplicationRevisions
-> ListApplicationRevisions
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListApplicationRevisions
ListApplicationRevisionsResponse
rs
          ListApplicationRevisionsResponse
-> Getting (First Text) ListApplicationRevisionsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListApplicationRevisionsResponse
-> Const (First Text) ListApplicationRevisionsResponse
Lens' ListApplicationRevisionsResponse (Maybe Text)
listApplicationRevisionsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListApplicationRevisionsResponse
 -> Const (First Text) ListApplicationRevisionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListApplicationRevisionsResponse 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 ListApplicationRevisions where
  type
    AWSResponse ListApplicationRevisions =
      ListApplicationRevisionsResponse
  request :: ListApplicationRevisions -> Request ListApplicationRevisions
request = Service
-> ListApplicationRevisions -> Request ListApplicationRevisions
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListApplicationRevisions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListApplicationRevisions)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListApplicationRevisions))
-> Logger
-> Service
-> Proxy ListApplicationRevisions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListApplicationRevisions)))
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 [RevisionLocation]
-> Int
-> ListApplicationRevisionsResponse
ListApplicationRevisionsResponse'
            (Maybe Text
 -> Maybe [RevisionLocation]
 -> Int
 -> ListApplicationRevisionsResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [RevisionLocation]
      -> Int -> ListApplicationRevisionsResponse)
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 [RevisionLocation]
   -> Int -> ListApplicationRevisionsResponse)
-> Either String (Maybe [RevisionLocation])
-> Either String (Int -> ListApplicationRevisionsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [RevisionLocation]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"revisions" Either String (Maybe (Maybe [RevisionLocation]))
-> Maybe [RevisionLocation]
-> Either String (Maybe [RevisionLocation])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [RevisionLocation]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Int -> ListApplicationRevisionsResponse)
-> Either String Int
-> Either String ListApplicationRevisionsResponse
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 ListApplicationRevisions

instance Prelude.NFData ListApplicationRevisions

instance Core.ToHeaders ListApplicationRevisions where
  toHeaders :: ListApplicationRevisions -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListApplicationRevisions -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"CodeDeploy_20141006.ListApplicationRevisions" ::
                          Prelude.ByteString
                      ),
            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.ToJSON ListApplicationRevisions where
  toJSON :: ListApplicationRevisions -> Value
toJSON ListApplicationRevisions' {Maybe Text
Maybe ApplicationRevisionSortBy
Maybe ListStateFilterAction
Maybe SortOrder
Text
applicationName :: Text
sortBy :: Maybe ApplicationRevisionSortBy
s3Bucket :: Maybe Text
nextToken :: Maybe Text
sortOrder :: Maybe SortOrder
deployed :: Maybe ListStateFilterAction
s3KeyPrefix :: Maybe Text
$sel:applicationName:ListApplicationRevisions' :: ListApplicationRevisions -> Text
$sel:sortBy:ListApplicationRevisions' :: ListApplicationRevisions -> Maybe ApplicationRevisionSortBy
$sel:s3Bucket:ListApplicationRevisions' :: ListApplicationRevisions -> Maybe Text
$sel:nextToken:ListApplicationRevisions' :: ListApplicationRevisions -> Maybe Text
$sel:sortOrder:ListApplicationRevisions' :: ListApplicationRevisions -> Maybe SortOrder
$sel:deployed:ListApplicationRevisions' :: ListApplicationRevisions -> Maybe ListStateFilterAction
$sel:s3KeyPrefix:ListApplicationRevisions' :: ListApplicationRevisions -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"s3KeyPrefix" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
s3KeyPrefix,
            (Text
"deployed" Text -> ListStateFilterAction -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ListStateFilterAction -> Pair)
-> Maybe ListStateFilterAction -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ListStateFilterAction
deployed,
            (Text
"sortOrder" Text -> SortOrder -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SortOrder -> Pair) -> Maybe SortOrder -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SortOrder
sortOrder,
            (Text
"nextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Text
"s3Bucket" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
s3Bucket,
            (Text
"sortBy" Text -> ApplicationRevisionSortBy -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ApplicationRevisionSortBy -> Pair)
-> Maybe ApplicationRevisionSortBy -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ApplicationRevisionSortBy
sortBy,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"applicationName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
applicationName)
          ]
      )

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

instance Core.ToQuery ListApplicationRevisions where
  toQuery :: ListApplicationRevisions -> QueryString
toQuery = QueryString -> ListApplicationRevisions -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | Represents the output of a @ListApplicationRevisions@ operation.
--
-- /See:/ 'newListApplicationRevisionsResponse' smart constructor.
data ListApplicationRevisionsResponse = ListApplicationRevisionsResponse'
  { -- | If a large amount of information is returned, an identifier is also
    -- returned. It can be used in a subsequent list application revisions call
    -- to return the next set of application revisions in the list.
    ListApplicationRevisionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A list of locations that contain the matching revisions.
    ListApplicationRevisionsResponse -> Maybe [RevisionLocation]
revisions :: Prelude.Maybe [RevisionLocation],
    -- | The response's http status code.
    ListApplicationRevisionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListApplicationRevisionsResponse
-> ListApplicationRevisionsResponse -> Bool
(ListApplicationRevisionsResponse
 -> ListApplicationRevisionsResponse -> Bool)
-> (ListApplicationRevisionsResponse
    -> ListApplicationRevisionsResponse -> Bool)
-> Eq ListApplicationRevisionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListApplicationRevisionsResponse
-> ListApplicationRevisionsResponse -> Bool
$c/= :: ListApplicationRevisionsResponse
-> ListApplicationRevisionsResponse -> Bool
== :: ListApplicationRevisionsResponse
-> ListApplicationRevisionsResponse -> Bool
$c== :: ListApplicationRevisionsResponse
-> ListApplicationRevisionsResponse -> Bool
Prelude.Eq, ReadPrec [ListApplicationRevisionsResponse]
ReadPrec ListApplicationRevisionsResponse
Int -> ReadS ListApplicationRevisionsResponse
ReadS [ListApplicationRevisionsResponse]
(Int -> ReadS ListApplicationRevisionsResponse)
-> ReadS [ListApplicationRevisionsResponse]
-> ReadPrec ListApplicationRevisionsResponse
-> ReadPrec [ListApplicationRevisionsResponse]
-> Read ListApplicationRevisionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListApplicationRevisionsResponse]
$creadListPrec :: ReadPrec [ListApplicationRevisionsResponse]
readPrec :: ReadPrec ListApplicationRevisionsResponse
$creadPrec :: ReadPrec ListApplicationRevisionsResponse
readList :: ReadS [ListApplicationRevisionsResponse]
$creadList :: ReadS [ListApplicationRevisionsResponse]
readsPrec :: Int -> ReadS ListApplicationRevisionsResponse
$creadsPrec :: Int -> ReadS ListApplicationRevisionsResponse
Prelude.Read, Int -> ListApplicationRevisionsResponse -> ShowS
[ListApplicationRevisionsResponse] -> ShowS
ListApplicationRevisionsResponse -> String
(Int -> ListApplicationRevisionsResponse -> ShowS)
-> (ListApplicationRevisionsResponse -> String)
-> ([ListApplicationRevisionsResponse] -> ShowS)
-> Show ListApplicationRevisionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListApplicationRevisionsResponse] -> ShowS
$cshowList :: [ListApplicationRevisionsResponse] -> ShowS
show :: ListApplicationRevisionsResponse -> String
$cshow :: ListApplicationRevisionsResponse -> String
showsPrec :: Int -> ListApplicationRevisionsResponse -> ShowS
$cshowsPrec :: Int -> ListApplicationRevisionsResponse -> ShowS
Prelude.Show, (forall x.
 ListApplicationRevisionsResponse
 -> Rep ListApplicationRevisionsResponse x)
-> (forall x.
    Rep ListApplicationRevisionsResponse x
    -> ListApplicationRevisionsResponse)
-> Generic ListApplicationRevisionsResponse
forall x.
Rep ListApplicationRevisionsResponse x
-> ListApplicationRevisionsResponse
forall x.
ListApplicationRevisionsResponse
-> Rep ListApplicationRevisionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListApplicationRevisionsResponse x
-> ListApplicationRevisionsResponse
$cfrom :: forall x.
ListApplicationRevisionsResponse
-> Rep ListApplicationRevisionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListApplicationRevisionsResponse' 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', 'listApplicationRevisionsResponse_nextToken' - If a large amount of information is returned, an identifier is also
-- returned. It can be used in a subsequent list application revisions call
-- to return the next set of application revisions in the list.
--
-- 'revisions', 'listApplicationRevisionsResponse_revisions' - A list of locations that contain the matching revisions.
--
-- 'httpStatus', 'listApplicationRevisionsResponse_httpStatus' - The response's http status code.
newListApplicationRevisionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListApplicationRevisionsResponse
newListApplicationRevisionsResponse :: Int -> ListApplicationRevisionsResponse
newListApplicationRevisionsResponse Int
pHttpStatus_ =
  ListApplicationRevisionsResponse' :: Maybe Text
-> Maybe [RevisionLocation]
-> Int
-> ListApplicationRevisionsResponse
ListApplicationRevisionsResponse'
    { $sel:nextToken:ListApplicationRevisionsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:revisions:ListApplicationRevisionsResponse' :: Maybe [RevisionLocation]
revisions = Maybe [RevisionLocation]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListApplicationRevisionsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | If a large amount of information is returned, an identifier is also
-- returned. It can be used in a subsequent list application revisions call
-- to return the next set of application revisions in the list.
listApplicationRevisionsResponse_nextToken :: Lens.Lens' ListApplicationRevisionsResponse (Prelude.Maybe Prelude.Text)
listApplicationRevisionsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListApplicationRevisionsResponse
-> f ListApplicationRevisionsResponse
listApplicationRevisionsResponse_nextToken = (ListApplicationRevisionsResponse -> Maybe Text)
-> (ListApplicationRevisionsResponse
    -> Maybe Text -> ListApplicationRevisionsResponse)
-> Lens' ListApplicationRevisionsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListApplicationRevisionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListApplicationRevisionsResponse' :: ListApplicationRevisionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListApplicationRevisionsResponse
s@ListApplicationRevisionsResponse' {} Maybe Text
a -> ListApplicationRevisionsResponse
s {$sel:nextToken:ListApplicationRevisionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListApplicationRevisionsResponse)

-- | A list of locations that contain the matching revisions.
listApplicationRevisionsResponse_revisions :: Lens.Lens' ListApplicationRevisionsResponse (Prelude.Maybe [RevisionLocation])
listApplicationRevisionsResponse_revisions :: (Maybe [RevisionLocation] -> f (Maybe [RevisionLocation]))
-> ListApplicationRevisionsResponse
-> f ListApplicationRevisionsResponse
listApplicationRevisionsResponse_revisions = (ListApplicationRevisionsResponse -> Maybe [RevisionLocation])
-> (ListApplicationRevisionsResponse
    -> Maybe [RevisionLocation] -> ListApplicationRevisionsResponse)
-> Lens'
     ListApplicationRevisionsResponse (Maybe [RevisionLocation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListApplicationRevisionsResponse' {Maybe [RevisionLocation]
revisions :: Maybe [RevisionLocation]
$sel:revisions:ListApplicationRevisionsResponse' :: ListApplicationRevisionsResponse -> Maybe [RevisionLocation]
revisions} -> Maybe [RevisionLocation]
revisions) (\s :: ListApplicationRevisionsResponse
s@ListApplicationRevisionsResponse' {} Maybe [RevisionLocation]
a -> ListApplicationRevisionsResponse
s {$sel:revisions:ListApplicationRevisionsResponse' :: Maybe [RevisionLocation]
revisions = Maybe [RevisionLocation]
a} :: ListApplicationRevisionsResponse) ((Maybe [RevisionLocation] -> f (Maybe [RevisionLocation]))
 -> ListApplicationRevisionsResponse
 -> f ListApplicationRevisionsResponse)
-> ((Maybe [RevisionLocation] -> f (Maybe [RevisionLocation]))
    -> Maybe [RevisionLocation] -> f (Maybe [RevisionLocation]))
-> (Maybe [RevisionLocation] -> f (Maybe [RevisionLocation]))
-> ListApplicationRevisionsResponse
-> f ListApplicationRevisionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [RevisionLocation]
  [RevisionLocation]
  [RevisionLocation]
  [RevisionLocation]
-> Iso
     (Maybe [RevisionLocation])
     (Maybe [RevisionLocation])
     (Maybe [RevisionLocation])
     (Maybe [RevisionLocation])
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
  [RevisionLocation]
  [RevisionLocation]
  [RevisionLocation]
  [RevisionLocation]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    ListApplicationRevisionsResponse