{-# 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.ListDeploymentTargets
-- 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 an array of target IDs that are associated a deployment.
--
-- This operation returns paginated results.
module Amazonka.CodeDeploy.ListDeploymentTargets
  ( -- * Creating a Request
    ListDeploymentTargets (..),
    newListDeploymentTargets,

    -- * Request Lenses
    listDeploymentTargets_deploymentId,
    listDeploymentTargets_targetFilters,
    listDeploymentTargets_nextToken,

    -- * Destructuring the Response
    ListDeploymentTargetsResponse (..),
    newListDeploymentTargetsResponse,

    -- * Response Lenses
    listDeploymentTargetsResponse_nextToken,
    listDeploymentTargetsResponse_targetIds,
    listDeploymentTargetsResponse_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

-- | /See:/ 'newListDeploymentTargets' smart constructor.
data ListDeploymentTargets = ListDeploymentTargets'
  { -- | The unique ID of a deployment.
    ListDeploymentTargets -> Maybe Text
deploymentId :: Prelude.Maybe Prelude.Text,
    -- | A key used to filter the returned targets. The two valid values are:
    --
    -- -   @TargetStatus@ - A @TargetStatus@ filter string can be @Failed@,
    --     @InProgress@, @Pending@, @Ready@, @Skipped@, @Succeeded@, or
    --     @Unknown@.
    --
    -- -   @ServerInstanceLabel@ - A @ServerInstanceLabel@ filter string can be
    --     @Blue@ or @Green@.
    ListDeploymentTargets -> Maybe (HashMap TargetFilterName [Text])
targetFilters :: Prelude.Maybe (Prelude.HashMap TargetFilterName [Prelude.Text]),
    -- | A token identifier returned from the previous @ListDeploymentTargets@
    -- call. It can be used to return the next set of deployment targets in the
    -- list.
    ListDeploymentTargets -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
  }
  deriving (ListDeploymentTargets -> ListDeploymentTargets -> Bool
(ListDeploymentTargets -> ListDeploymentTargets -> Bool)
-> (ListDeploymentTargets -> ListDeploymentTargets -> Bool)
-> Eq ListDeploymentTargets
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListDeploymentTargets -> ListDeploymentTargets -> Bool
$c/= :: ListDeploymentTargets -> ListDeploymentTargets -> Bool
== :: ListDeploymentTargets -> ListDeploymentTargets -> Bool
$c== :: ListDeploymentTargets -> ListDeploymentTargets -> Bool
Prelude.Eq, ReadPrec [ListDeploymentTargets]
ReadPrec ListDeploymentTargets
Int -> ReadS ListDeploymentTargets
ReadS [ListDeploymentTargets]
(Int -> ReadS ListDeploymentTargets)
-> ReadS [ListDeploymentTargets]
-> ReadPrec ListDeploymentTargets
-> ReadPrec [ListDeploymentTargets]
-> Read ListDeploymentTargets
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListDeploymentTargets]
$creadListPrec :: ReadPrec [ListDeploymentTargets]
readPrec :: ReadPrec ListDeploymentTargets
$creadPrec :: ReadPrec ListDeploymentTargets
readList :: ReadS [ListDeploymentTargets]
$creadList :: ReadS [ListDeploymentTargets]
readsPrec :: Int -> ReadS ListDeploymentTargets
$creadsPrec :: Int -> ReadS ListDeploymentTargets
Prelude.Read, Int -> ListDeploymentTargets -> ShowS
[ListDeploymentTargets] -> ShowS
ListDeploymentTargets -> String
(Int -> ListDeploymentTargets -> ShowS)
-> (ListDeploymentTargets -> String)
-> ([ListDeploymentTargets] -> ShowS)
-> Show ListDeploymentTargets
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListDeploymentTargets] -> ShowS
$cshowList :: [ListDeploymentTargets] -> ShowS
show :: ListDeploymentTargets -> String
$cshow :: ListDeploymentTargets -> String
showsPrec :: Int -> ListDeploymentTargets -> ShowS
$cshowsPrec :: Int -> ListDeploymentTargets -> ShowS
Prelude.Show, (forall x. ListDeploymentTargets -> Rep ListDeploymentTargets x)
-> (forall x. Rep ListDeploymentTargets x -> ListDeploymentTargets)
-> Generic ListDeploymentTargets
forall x. Rep ListDeploymentTargets x -> ListDeploymentTargets
forall x. ListDeploymentTargets -> Rep ListDeploymentTargets x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListDeploymentTargets x -> ListDeploymentTargets
$cfrom :: forall x. ListDeploymentTargets -> Rep ListDeploymentTargets x
Prelude.Generic)

-- |
-- Create a value of 'ListDeploymentTargets' 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:
--
-- 'deploymentId', 'listDeploymentTargets_deploymentId' - The unique ID of a deployment.
--
-- 'targetFilters', 'listDeploymentTargets_targetFilters' - A key used to filter the returned targets. The two valid values are:
--
-- -   @TargetStatus@ - A @TargetStatus@ filter string can be @Failed@,
--     @InProgress@, @Pending@, @Ready@, @Skipped@, @Succeeded@, or
--     @Unknown@.
--
-- -   @ServerInstanceLabel@ - A @ServerInstanceLabel@ filter string can be
--     @Blue@ or @Green@.
--
-- 'nextToken', 'listDeploymentTargets_nextToken' - A token identifier returned from the previous @ListDeploymentTargets@
-- call. It can be used to return the next set of deployment targets in the
-- list.
newListDeploymentTargets ::
  ListDeploymentTargets
newListDeploymentTargets :: ListDeploymentTargets
newListDeploymentTargets =
  ListDeploymentTargets' :: Maybe Text
-> Maybe (HashMap TargetFilterName [Text])
-> Maybe Text
-> ListDeploymentTargets
ListDeploymentTargets'
    { $sel:deploymentId:ListDeploymentTargets' :: Maybe Text
deploymentId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:targetFilters:ListDeploymentTargets' :: Maybe (HashMap TargetFilterName [Text])
targetFilters = Maybe (HashMap TargetFilterName [Text])
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListDeploymentTargets' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The unique ID of a deployment.
listDeploymentTargets_deploymentId :: Lens.Lens' ListDeploymentTargets (Prelude.Maybe Prelude.Text)
listDeploymentTargets_deploymentId :: (Maybe Text -> f (Maybe Text))
-> ListDeploymentTargets -> f ListDeploymentTargets
listDeploymentTargets_deploymentId = (ListDeploymentTargets -> Maybe Text)
-> (ListDeploymentTargets -> Maybe Text -> ListDeploymentTargets)
-> Lens
     ListDeploymentTargets
     ListDeploymentTargets
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDeploymentTargets' {Maybe Text
deploymentId :: Maybe Text
$sel:deploymentId:ListDeploymentTargets' :: ListDeploymentTargets -> Maybe Text
deploymentId} -> Maybe Text
deploymentId) (\s :: ListDeploymentTargets
s@ListDeploymentTargets' {} Maybe Text
a -> ListDeploymentTargets
s {$sel:deploymentId:ListDeploymentTargets' :: Maybe Text
deploymentId = Maybe Text
a} :: ListDeploymentTargets)

-- | A key used to filter the returned targets. The two valid values are:
--
-- -   @TargetStatus@ - A @TargetStatus@ filter string can be @Failed@,
--     @InProgress@, @Pending@, @Ready@, @Skipped@, @Succeeded@, or
--     @Unknown@.
--
-- -   @ServerInstanceLabel@ - A @ServerInstanceLabel@ filter string can be
--     @Blue@ or @Green@.
listDeploymentTargets_targetFilters :: Lens.Lens' ListDeploymentTargets (Prelude.Maybe (Prelude.HashMap TargetFilterName [Prelude.Text]))
listDeploymentTargets_targetFilters :: (Maybe (HashMap TargetFilterName [Text])
 -> f (Maybe (HashMap TargetFilterName [Text])))
-> ListDeploymentTargets -> f ListDeploymentTargets
listDeploymentTargets_targetFilters = (ListDeploymentTargets -> Maybe (HashMap TargetFilterName [Text]))
-> (ListDeploymentTargets
    -> Maybe (HashMap TargetFilterName [Text])
    -> ListDeploymentTargets)
-> Lens
     ListDeploymentTargets
     ListDeploymentTargets
     (Maybe (HashMap TargetFilterName [Text]))
     (Maybe (HashMap TargetFilterName [Text]))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDeploymentTargets' {Maybe (HashMap TargetFilterName [Text])
targetFilters :: Maybe (HashMap TargetFilterName [Text])
$sel:targetFilters:ListDeploymentTargets' :: ListDeploymentTargets -> Maybe (HashMap TargetFilterName [Text])
targetFilters} -> Maybe (HashMap TargetFilterName [Text])
targetFilters) (\s :: ListDeploymentTargets
s@ListDeploymentTargets' {} Maybe (HashMap TargetFilterName [Text])
a -> ListDeploymentTargets
s {$sel:targetFilters:ListDeploymentTargets' :: Maybe (HashMap TargetFilterName [Text])
targetFilters = Maybe (HashMap TargetFilterName [Text])
a} :: ListDeploymentTargets) ((Maybe (HashMap TargetFilterName [Text])
  -> f (Maybe (HashMap TargetFilterName [Text])))
 -> ListDeploymentTargets -> f ListDeploymentTargets)
-> ((Maybe (HashMap TargetFilterName [Text])
     -> f (Maybe (HashMap TargetFilterName [Text])))
    -> Maybe (HashMap TargetFilterName [Text])
    -> f (Maybe (HashMap TargetFilterName [Text])))
-> (Maybe (HashMap TargetFilterName [Text])
    -> f (Maybe (HashMap TargetFilterName [Text])))
-> ListDeploymentTargets
-> f ListDeploymentTargets
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap TargetFilterName [Text])
  (HashMap TargetFilterName [Text])
  (HashMap TargetFilterName [Text])
  (HashMap TargetFilterName [Text])
-> Iso
     (Maybe (HashMap TargetFilterName [Text]))
     (Maybe (HashMap TargetFilterName [Text]))
     (Maybe (HashMap TargetFilterName [Text]))
     (Maybe (HashMap TargetFilterName [Text]))
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
  (HashMap TargetFilterName [Text])
  (HashMap TargetFilterName [Text])
  (HashMap TargetFilterName [Text])
  (HashMap TargetFilterName [Text])
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

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

instance Prelude.NFData ListDeploymentTargets

instance Core.ToHeaders ListDeploymentTargets where
  toHeaders :: ListDeploymentTargets -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListDeploymentTargets -> 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.ListDeploymentTargets" ::
                          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 ListDeploymentTargets where
  toJSON :: ListDeploymentTargets -> Value
toJSON ListDeploymentTargets' {Maybe Text
Maybe (HashMap TargetFilterName [Text])
nextToken :: Maybe Text
targetFilters :: Maybe (HashMap TargetFilterName [Text])
deploymentId :: Maybe Text
$sel:nextToken:ListDeploymentTargets' :: ListDeploymentTargets -> Maybe Text
$sel:targetFilters:ListDeploymentTargets' :: ListDeploymentTargets -> Maybe (HashMap TargetFilterName [Text])
$sel:deploymentId:ListDeploymentTargets' :: ListDeploymentTargets -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"deploymentId" 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
deploymentId,
            (Text
"targetFilters" Text -> HashMap TargetFilterName [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap TargetFilterName [Text] -> Pair)
-> Maybe (HashMap TargetFilterName [Text]) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap TargetFilterName [Text])
targetFilters,
            (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
          ]
      )

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

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

-- | /See:/ 'newListDeploymentTargetsResponse' smart constructor.
data ListDeploymentTargetsResponse = ListDeploymentTargetsResponse'
  { -- | If a large amount of information is returned, a token identifier is also
    -- returned. It can be used in a subsequent @ListDeploymentTargets@ call to
    -- return the next set of deployment targets in the list.
    ListDeploymentTargetsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The unique IDs of deployment targets.
    ListDeploymentTargetsResponse -> Maybe [Text]
targetIds :: Prelude.Maybe [Prelude.Text],
    -- | The response's http status code.
    ListDeploymentTargetsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListDeploymentTargetsResponse
-> ListDeploymentTargetsResponse -> Bool
(ListDeploymentTargetsResponse
 -> ListDeploymentTargetsResponse -> Bool)
-> (ListDeploymentTargetsResponse
    -> ListDeploymentTargetsResponse -> Bool)
-> Eq ListDeploymentTargetsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListDeploymentTargetsResponse
-> ListDeploymentTargetsResponse -> Bool
$c/= :: ListDeploymentTargetsResponse
-> ListDeploymentTargetsResponse -> Bool
== :: ListDeploymentTargetsResponse
-> ListDeploymentTargetsResponse -> Bool
$c== :: ListDeploymentTargetsResponse
-> ListDeploymentTargetsResponse -> Bool
Prelude.Eq, ReadPrec [ListDeploymentTargetsResponse]
ReadPrec ListDeploymentTargetsResponse
Int -> ReadS ListDeploymentTargetsResponse
ReadS [ListDeploymentTargetsResponse]
(Int -> ReadS ListDeploymentTargetsResponse)
-> ReadS [ListDeploymentTargetsResponse]
-> ReadPrec ListDeploymentTargetsResponse
-> ReadPrec [ListDeploymentTargetsResponse]
-> Read ListDeploymentTargetsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListDeploymentTargetsResponse]
$creadListPrec :: ReadPrec [ListDeploymentTargetsResponse]
readPrec :: ReadPrec ListDeploymentTargetsResponse
$creadPrec :: ReadPrec ListDeploymentTargetsResponse
readList :: ReadS [ListDeploymentTargetsResponse]
$creadList :: ReadS [ListDeploymentTargetsResponse]
readsPrec :: Int -> ReadS ListDeploymentTargetsResponse
$creadsPrec :: Int -> ReadS ListDeploymentTargetsResponse
Prelude.Read, Int -> ListDeploymentTargetsResponse -> ShowS
[ListDeploymentTargetsResponse] -> ShowS
ListDeploymentTargetsResponse -> String
(Int -> ListDeploymentTargetsResponse -> ShowS)
-> (ListDeploymentTargetsResponse -> String)
-> ([ListDeploymentTargetsResponse] -> ShowS)
-> Show ListDeploymentTargetsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListDeploymentTargetsResponse] -> ShowS
$cshowList :: [ListDeploymentTargetsResponse] -> ShowS
show :: ListDeploymentTargetsResponse -> String
$cshow :: ListDeploymentTargetsResponse -> String
showsPrec :: Int -> ListDeploymentTargetsResponse -> ShowS
$cshowsPrec :: Int -> ListDeploymentTargetsResponse -> ShowS
Prelude.Show, (forall x.
 ListDeploymentTargetsResponse
 -> Rep ListDeploymentTargetsResponse x)
-> (forall x.
    Rep ListDeploymentTargetsResponse x
    -> ListDeploymentTargetsResponse)
-> Generic ListDeploymentTargetsResponse
forall x.
Rep ListDeploymentTargetsResponse x
-> ListDeploymentTargetsResponse
forall x.
ListDeploymentTargetsResponse
-> Rep ListDeploymentTargetsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListDeploymentTargetsResponse x
-> ListDeploymentTargetsResponse
$cfrom :: forall x.
ListDeploymentTargetsResponse
-> Rep ListDeploymentTargetsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListDeploymentTargetsResponse' 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', 'listDeploymentTargetsResponse_nextToken' - If a large amount of information is returned, a token identifier is also
-- returned. It can be used in a subsequent @ListDeploymentTargets@ call to
-- return the next set of deployment targets in the list.
--
-- 'targetIds', 'listDeploymentTargetsResponse_targetIds' - The unique IDs of deployment targets.
--
-- 'httpStatus', 'listDeploymentTargetsResponse_httpStatus' - The response's http status code.
newListDeploymentTargetsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListDeploymentTargetsResponse
newListDeploymentTargetsResponse :: Int -> ListDeploymentTargetsResponse
newListDeploymentTargetsResponse Int
pHttpStatus_ =
  ListDeploymentTargetsResponse' :: Maybe Text -> Maybe [Text] -> Int -> ListDeploymentTargetsResponse
ListDeploymentTargetsResponse'
    { $sel:nextToken:ListDeploymentTargetsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:targetIds:ListDeploymentTargetsResponse' :: Maybe [Text]
targetIds = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListDeploymentTargetsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

-- | The unique IDs of deployment targets.
listDeploymentTargetsResponse_targetIds :: Lens.Lens' ListDeploymentTargetsResponse (Prelude.Maybe [Prelude.Text])
listDeploymentTargetsResponse_targetIds :: (Maybe [Text] -> f (Maybe [Text]))
-> ListDeploymentTargetsResponse -> f ListDeploymentTargetsResponse
listDeploymentTargetsResponse_targetIds = (ListDeploymentTargetsResponse -> Maybe [Text])
-> (ListDeploymentTargetsResponse
    -> Maybe [Text] -> ListDeploymentTargetsResponse)
-> Lens' ListDeploymentTargetsResponse (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDeploymentTargetsResponse' {Maybe [Text]
targetIds :: Maybe [Text]
$sel:targetIds:ListDeploymentTargetsResponse' :: ListDeploymentTargetsResponse -> Maybe [Text]
targetIds} -> Maybe [Text]
targetIds) (\s :: ListDeploymentTargetsResponse
s@ListDeploymentTargetsResponse' {} Maybe [Text]
a -> ListDeploymentTargetsResponse
s {$sel:targetIds:ListDeploymentTargetsResponse' :: Maybe [Text]
targetIds = Maybe [Text]
a} :: ListDeploymentTargetsResponse) ((Maybe [Text] -> f (Maybe [Text]))
 -> ListDeploymentTargetsResponse
 -> f ListDeploymentTargetsResponse)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ListDeploymentTargetsResponse
-> f ListDeploymentTargetsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData ListDeploymentTargetsResponse