{-# 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.AppConfig.ListDeploymentStrategies
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Lists deployment strategies.
module Amazonka.AppConfig.ListDeploymentStrategies
  ( -- * Creating a Request
    ListDeploymentStrategies (..),
    newListDeploymentStrategies,

    -- * Request Lenses
    listDeploymentStrategies_maxResults,
    listDeploymentStrategies_nextToken,

    -- * Destructuring the Response
    ListDeploymentStrategiesResponse (..),
    newListDeploymentStrategiesResponse,

    -- * Response Lenses
    listDeploymentStrategiesResponse_items,
    listDeploymentStrategiesResponse_nextToken,
    listDeploymentStrategiesResponse_httpStatus,
  )
where

import Amazonka.AppConfig.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newListDeploymentStrategies' smart constructor.
data ListDeploymentStrategies = ListDeploymentStrategies'
  { -- | The maximum number of items to return for this call. The call also
    -- returns a token that you can specify in a subsequent call to get the
    -- next set of results.
    ListDeploymentStrategies -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | A token to start the list. Use this token to get the next set of
    -- results.
    ListDeploymentStrategies -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
  }
  deriving (ListDeploymentStrategies -> ListDeploymentStrategies -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListDeploymentStrategies -> ListDeploymentStrategies -> Bool
$c/= :: ListDeploymentStrategies -> ListDeploymentStrategies -> Bool
== :: ListDeploymentStrategies -> ListDeploymentStrategies -> Bool
$c== :: ListDeploymentStrategies -> ListDeploymentStrategies -> Bool
Prelude.Eq, ReadPrec [ListDeploymentStrategies]
ReadPrec ListDeploymentStrategies
Int -> ReadS ListDeploymentStrategies
ReadS [ListDeploymentStrategies]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListDeploymentStrategies]
$creadListPrec :: ReadPrec [ListDeploymentStrategies]
readPrec :: ReadPrec ListDeploymentStrategies
$creadPrec :: ReadPrec ListDeploymentStrategies
readList :: ReadS [ListDeploymentStrategies]
$creadList :: ReadS [ListDeploymentStrategies]
readsPrec :: Int -> ReadS ListDeploymentStrategies
$creadsPrec :: Int -> ReadS ListDeploymentStrategies
Prelude.Read, Int -> ListDeploymentStrategies -> ShowS
[ListDeploymentStrategies] -> ShowS
ListDeploymentStrategies -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListDeploymentStrategies] -> ShowS
$cshowList :: [ListDeploymentStrategies] -> ShowS
show :: ListDeploymentStrategies -> String
$cshow :: ListDeploymentStrategies -> String
showsPrec :: Int -> ListDeploymentStrategies -> ShowS
$cshowsPrec :: Int -> ListDeploymentStrategies -> ShowS
Prelude.Show, forall x.
Rep ListDeploymentStrategies x -> ListDeploymentStrategies
forall x.
ListDeploymentStrategies -> Rep ListDeploymentStrategies x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListDeploymentStrategies x -> ListDeploymentStrategies
$cfrom :: forall x.
ListDeploymentStrategies -> Rep ListDeploymentStrategies x
Prelude.Generic)

-- |
-- Create a value of 'ListDeploymentStrategies' 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:
--
-- 'maxResults', 'listDeploymentStrategies_maxResults' - The maximum number of items to return for this call. The call also
-- returns a token that you can specify in a subsequent call to get the
-- next set of results.
--
-- 'nextToken', 'listDeploymentStrategies_nextToken' - A token to start the list. Use this token to get the next set of
-- results.
newListDeploymentStrategies ::
  ListDeploymentStrategies
newListDeploymentStrategies :: ListDeploymentStrategies
newListDeploymentStrategies =
  ListDeploymentStrategies'
    { $sel:maxResults:ListDeploymentStrategies' :: Maybe Natural
maxResults =
        forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListDeploymentStrategies' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
    }

-- | The maximum number of items to return for this call. The call also
-- returns a token that you can specify in a subsequent call to get the
-- next set of results.
listDeploymentStrategies_maxResults :: Lens.Lens' ListDeploymentStrategies (Prelude.Maybe Prelude.Natural)
listDeploymentStrategies_maxResults :: Lens' ListDeploymentStrategies (Maybe Natural)
listDeploymentStrategies_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDeploymentStrategies' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListDeploymentStrategies' :: ListDeploymentStrategies -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListDeploymentStrategies
s@ListDeploymentStrategies' {} Maybe Natural
a -> ListDeploymentStrategies
s {$sel:maxResults:ListDeploymentStrategies' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListDeploymentStrategies)

-- | A token to start the list. Use this token to get the next set of
-- results.
listDeploymentStrategies_nextToken :: Lens.Lens' ListDeploymentStrategies (Prelude.Maybe Prelude.Text)
listDeploymentStrategies_nextToken :: Lens' ListDeploymentStrategies (Maybe Text)
listDeploymentStrategies_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDeploymentStrategies' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListDeploymentStrategies' :: ListDeploymentStrategies -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListDeploymentStrategies
s@ListDeploymentStrategies' {} Maybe Text
a -> ListDeploymentStrategies
s {$sel:nextToken:ListDeploymentStrategies' :: Maybe Text
nextToken = Maybe Text
a} :: ListDeploymentStrategies)

instance Core.AWSRequest ListDeploymentStrategies where
  type
    AWSResponse ListDeploymentStrategies =
      ListDeploymentStrategiesResponse
  request :: (Service -> Service)
-> ListDeploymentStrategies -> Request ListDeploymentStrategies
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListDeploymentStrategies
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListDeploymentStrategies)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe [DeploymentStrategy]
-> Maybe Text -> Int -> ListDeploymentStrategiesResponse
ListDeploymentStrategiesResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Items" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"NextToken")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable ListDeploymentStrategies where
  hashWithSalt :: Int -> ListDeploymentStrategies -> Int
hashWithSalt Int
_salt ListDeploymentStrategies' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListDeploymentStrategies' :: ListDeploymentStrategies -> Maybe Text
$sel:maxResults:ListDeploymentStrategies' :: ListDeploymentStrategies -> Maybe Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken

instance Prelude.NFData ListDeploymentStrategies where
  rnf :: ListDeploymentStrategies -> ()
rnf ListDeploymentStrategies' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListDeploymentStrategies' :: ListDeploymentStrategies -> Maybe Text
$sel:maxResults:ListDeploymentStrategies' :: ListDeploymentStrategies -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken

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

instance Data.ToPath ListDeploymentStrategies where
  toPath :: ListDeploymentStrategies -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/deploymentstrategies"

instance Data.ToQuery ListDeploymentStrategies where
  toQuery :: ListDeploymentStrategies -> QueryString
toQuery ListDeploymentStrategies' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListDeploymentStrategies' :: ListDeploymentStrategies -> Maybe Text
$sel:maxResults:ListDeploymentStrategies' :: ListDeploymentStrategies -> Maybe Natural
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"max_results" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxResults,
        ByteString
"next_token" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken
      ]

-- | /See:/ 'newListDeploymentStrategiesResponse' smart constructor.
data ListDeploymentStrategiesResponse = ListDeploymentStrategiesResponse'
  { -- | The elements from this collection.
    ListDeploymentStrategiesResponse -> Maybe [DeploymentStrategy]
items :: Prelude.Maybe [DeploymentStrategy],
    -- | The token for the next set of items to return. Use this token to get the
    -- next set of results.
    ListDeploymentStrategiesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListDeploymentStrategiesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListDeploymentStrategiesResponse
-> ListDeploymentStrategiesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListDeploymentStrategiesResponse
-> ListDeploymentStrategiesResponse -> Bool
$c/= :: ListDeploymentStrategiesResponse
-> ListDeploymentStrategiesResponse -> Bool
== :: ListDeploymentStrategiesResponse
-> ListDeploymentStrategiesResponse -> Bool
$c== :: ListDeploymentStrategiesResponse
-> ListDeploymentStrategiesResponse -> Bool
Prelude.Eq, ReadPrec [ListDeploymentStrategiesResponse]
ReadPrec ListDeploymentStrategiesResponse
Int -> ReadS ListDeploymentStrategiesResponse
ReadS [ListDeploymentStrategiesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListDeploymentStrategiesResponse]
$creadListPrec :: ReadPrec [ListDeploymentStrategiesResponse]
readPrec :: ReadPrec ListDeploymentStrategiesResponse
$creadPrec :: ReadPrec ListDeploymentStrategiesResponse
readList :: ReadS [ListDeploymentStrategiesResponse]
$creadList :: ReadS [ListDeploymentStrategiesResponse]
readsPrec :: Int -> ReadS ListDeploymentStrategiesResponse
$creadsPrec :: Int -> ReadS ListDeploymentStrategiesResponse
Prelude.Read, Int -> ListDeploymentStrategiesResponse -> ShowS
[ListDeploymentStrategiesResponse] -> ShowS
ListDeploymentStrategiesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListDeploymentStrategiesResponse] -> ShowS
$cshowList :: [ListDeploymentStrategiesResponse] -> ShowS
show :: ListDeploymentStrategiesResponse -> String
$cshow :: ListDeploymentStrategiesResponse -> String
showsPrec :: Int -> ListDeploymentStrategiesResponse -> ShowS
$cshowsPrec :: Int -> ListDeploymentStrategiesResponse -> ShowS
Prelude.Show, forall x.
Rep ListDeploymentStrategiesResponse x
-> ListDeploymentStrategiesResponse
forall x.
ListDeploymentStrategiesResponse
-> Rep ListDeploymentStrategiesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListDeploymentStrategiesResponse x
-> ListDeploymentStrategiesResponse
$cfrom :: forall x.
ListDeploymentStrategiesResponse
-> Rep ListDeploymentStrategiesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListDeploymentStrategiesResponse' 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:
--
-- 'items', 'listDeploymentStrategiesResponse_items' - The elements from this collection.
--
-- 'nextToken', 'listDeploymentStrategiesResponse_nextToken' - The token for the next set of items to return. Use this token to get the
-- next set of results.
--
-- 'httpStatus', 'listDeploymentStrategiesResponse_httpStatus' - The response's http status code.
newListDeploymentStrategiesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListDeploymentStrategiesResponse
newListDeploymentStrategiesResponse :: Int -> ListDeploymentStrategiesResponse
newListDeploymentStrategiesResponse Int
pHttpStatus_ =
  ListDeploymentStrategiesResponse'
    { $sel:items:ListDeploymentStrategiesResponse' :: Maybe [DeploymentStrategy]
items =
        forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListDeploymentStrategiesResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListDeploymentStrategiesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The elements from this collection.
listDeploymentStrategiesResponse_items :: Lens.Lens' ListDeploymentStrategiesResponse (Prelude.Maybe [DeploymentStrategy])
listDeploymentStrategiesResponse_items :: Lens' ListDeploymentStrategiesResponse (Maybe [DeploymentStrategy])
listDeploymentStrategiesResponse_items = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDeploymentStrategiesResponse' {Maybe [DeploymentStrategy]
items :: Maybe [DeploymentStrategy]
$sel:items:ListDeploymentStrategiesResponse' :: ListDeploymentStrategiesResponse -> Maybe [DeploymentStrategy]
items} -> Maybe [DeploymentStrategy]
items) (\s :: ListDeploymentStrategiesResponse
s@ListDeploymentStrategiesResponse' {} Maybe [DeploymentStrategy]
a -> ListDeploymentStrategiesResponse
s {$sel:items:ListDeploymentStrategiesResponse' :: Maybe [DeploymentStrategy]
items = Maybe [DeploymentStrategy]
a} :: ListDeploymentStrategiesResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The token for the next set of items to return. Use this token to get the
-- next set of results.
listDeploymentStrategiesResponse_nextToken :: Lens.Lens' ListDeploymentStrategiesResponse (Prelude.Maybe Prelude.Text)
listDeploymentStrategiesResponse_nextToken :: Lens' ListDeploymentStrategiesResponse (Maybe Text)
listDeploymentStrategiesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDeploymentStrategiesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListDeploymentStrategiesResponse' :: ListDeploymentStrategiesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListDeploymentStrategiesResponse
s@ListDeploymentStrategiesResponse' {} Maybe Text
a -> ListDeploymentStrategiesResponse
s {$sel:nextToken:ListDeploymentStrategiesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListDeploymentStrategiesResponse)

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

instance
  Prelude.NFData
    ListDeploymentStrategiesResponse
  where
  rnf :: ListDeploymentStrategiesResponse -> ()
rnf ListDeploymentStrategiesResponse' {Int
Maybe [DeploymentStrategy]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
items :: Maybe [DeploymentStrategy]
$sel:httpStatus:ListDeploymentStrategiesResponse' :: ListDeploymentStrategiesResponse -> Int
$sel:nextToken:ListDeploymentStrategiesResponse' :: ListDeploymentStrategiesResponse -> Maybe Text
$sel:items:ListDeploymentStrategiesResponse' :: ListDeploymentStrategiesResponse -> Maybe [DeploymentStrategy]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [DeploymentStrategy]
items
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus