{-# 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.ECS.ListServices
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns a list of services. You can filter the results by cluster,
-- launch type, and scheduling strategy.
--
-- This operation returns paginated results.
module Amazonka.ECS.ListServices
  ( -- * Creating a Request
    ListServices (..),
    newListServices,

    -- * Request Lenses
    listServices_cluster,
    listServices_nextToken,
    listServices_launchType,
    listServices_schedulingStrategy,
    listServices_maxResults,

    -- * Destructuring the Response
    ListServicesResponse (..),
    newListServicesResponse,

    -- * Response Lenses
    listServicesResponse_serviceArns,
    listServicesResponse_nextToken,
    listServicesResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.ECS.Types
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:/ 'newListServices' smart constructor.
data ListServices = ListServices'
  { -- | The short name or full Amazon Resource Name (ARN) of the cluster to use
    -- when filtering the @ListServices@ results. If you do not specify a
    -- cluster, the default cluster is assumed.
    ListServices -> Maybe Text
cluster :: Prelude.Maybe Prelude.Text,
    -- | The @nextToken@ value returned from a @ListServices@ request indicating
    -- that more results are available to fulfill the request and further calls
    -- will be needed. If @maxResults@ was provided, it is possible the number
    -- of results to be fewer than @maxResults@.
    --
    -- This token should be treated as an opaque identifier that is only used
    -- to retrieve the next items in a list and not for other programmatic
    -- purposes.
    ListServices -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The launch type to use when filtering the @ListServices@ results.
    ListServices -> Maybe LaunchType
launchType :: Prelude.Maybe LaunchType,
    -- | The scheduling strategy to use when filtering the @ListServices@
    -- results.
    ListServices -> Maybe SchedulingStrategy
schedulingStrategy :: Prelude.Maybe SchedulingStrategy,
    -- | The maximum number of service results returned by @ListServices@ in
    -- paginated output. When this parameter is used, @ListServices@ only
    -- returns @maxResults@ results in a single page along with a @nextToken@
    -- response element. The remaining results of the initial request can be
    -- seen by sending another @ListServices@ request with the returned
    -- @nextToken@ value. This value can be between 1 and 100. If this
    -- parameter is not used, then @ListServices@ returns up to 10 results and
    -- a @nextToken@ value if applicable.
    ListServices -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int
  }
  deriving (ListServices -> ListServices -> Bool
(ListServices -> ListServices -> Bool)
-> (ListServices -> ListServices -> Bool) -> Eq ListServices
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListServices -> ListServices -> Bool
$c/= :: ListServices -> ListServices -> Bool
== :: ListServices -> ListServices -> Bool
$c== :: ListServices -> ListServices -> Bool
Prelude.Eq, ReadPrec [ListServices]
ReadPrec ListServices
Int -> ReadS ListServices
ReadS [ListServices]
(Int -> ReadS ListServices)
-> ReadS [ListServices]
-> ReadPrec ListServices
-> ReadPrec [ListServices]
-> Read ListServices
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListServices]
$creadListPrec :: ReadPrec [ListServices]
readPrec :: ReadPrec ListServices
$creadPrec :: ReadPrec ListServices
readList :: ReadS [ListServices]
$creadList :: ReadS [ListServices]
readsPrec :: Int -> ReadS ListServices
$creadsPrec :: Int -> ReadS ListServices
Prelude.Read, Int -> ListServices -> ShowS
[ListServices] -> ShowS
ListServices -> String
(Int -> ListServices -> ShowS)
-> (ListServices -> String)
-> ([ListServices] -> ShowS)
-> Show ListServices
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListServices] -> ShowS
$cshowList :: [ListServices] -> ShowS
show :: ListServices -> String
$cshow :: ListServices -> String
showsPrec :: Int -> ListServices -> ShowS
$cshowsPrec :: Int -> ListServices -> ShowS
Prelude.Show, (forall x. ListServices -> Rep ListServices x)
-> (forall x. Rep ListServices x -> ListServices)
-> Generic ListServices
forall x. Rep ListServices x -> ListServices
forall x. ListServices -> Rep ListServices x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListServices x -> ListServices
$cfrom :: forall x. ListServices -> Rep ListServices x
Prelude.Generic)

-- |
-- Create a value of 'ListServices' 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:
--
-- 'cluster', 'listServices_cluster' - The short name or full Amazon Resource Name (ARN) of the cluster to use
-- when filtering the @ListServices@ results. If you do not specify a
-- cluster, the default cluster is assumed.
--
-- 'nextToken', 'listServices_nextToken' - The @nextToken@ value returned from a @ListServices@ request indicating
-- that more results are available to fulfill the request and further calls
-- will be needed. If @maxResults@ was provided, it is possible the number
-- of results to be fewer than @maxResults@.
--
-- This token should be treated as an opaque identifier that is only used
-- to retrieve the next items in a list and not for other programmatic
-- purposes.
--
-- 'launchType', 'listServices_launchType' - The launch type to use when filtering the @ListServices@ results.
--
-- 'schedulingStrategy', 'listServices_schedulingStrategy' - The scheduling strategy to use when filtering the @ListServices@
-- results.
--
-- 'maxResults', 'listServices_maxResults' - The maximum number of service results returned by @ListServices@ in
-- paginated output. When this parameter is used, @ListServices@ only
-- returns @maxResults@ results in a single page along with a @nextToken@
-- response element. The remaining results of the initial request can be
-- seen by sending another @ListServices@ request with the returned
-- @nextToken@ value. This value can be between 1 and 100. If this
-- parameter is not used, then @ListServices@ returns up to 10 results and
-- a @nextToken@ value if applicable.
newListServices ::
  ListServices
newListServices :: ListServices
newListServices =
  ListServices' :: Maybe Text
-> Maybe Text
-> Maybe LaunchType
-> Maybe SchedulingStrategy
-> Maybe Int
-> ListServices
ListServices'
    { $sel:cluster:ListServices' :: Maybe Text
cluster = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListServices' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:launchType:ListServices' :: Maybe LaunchType
launchType = Maybe LaunchType
forall a. Maybe a
Prelude.Nothing,
      $sel:schedulingStrategy:ListServices' :: Maybe SchedulingStrategy
schedulingStrategy = Maybe SchedulingStrategy
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListServices' :: Maybe Int
maxResults = Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The short name or full Amazon Resource Name (ARN) of the cluster to use
-- when filtering the @ListServices@ results. If you do not specify a
-- cluster, the default cluster is assumed.
listServices_cluster :: Lens.Lens' ListServices (Prelude.Maybe Prelude.Text)
listServices_cluster :: (Maybe Text -> f (Maybe Text)) -> ListServices -> f ListServices
listServices_cluster = (ListServices -> Maybe Text)
-> (ListServices -> Maybe Text -> ListServices)
-> Lens ListServices ListServices (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListServices' {Maybe Text
cluster :: Maybe Text
$sel:cluster:ListServices' :: ListServices -> Maybe Text
cluster} -> Maybe Text
cluster) (\s :: ListServices
s@ListServices' {} Maybe Text
a -> ListServices
s {$sel:cluster:ListServices' :: Maybe Text
cluster = Maybe Text
a} :: ListServices)

-- | The @nextToken@ value returned from a @ListServices@ request indicating
-- that more results are available to fulfill the request and further calls
-- will be needed. If @maxResults@ was provided, it is possible the number
-- of results to be fewer than @maxResults@.
--
-- This token should be treated as an opaque identifier that is only used
-- to retrieve the next items in a list and not for other programmatic
-- purposes.
listServices_nextToken :: Lens.Lens' ListServices (Prelude.Maybe Prelude.Text)
listServices_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListServices -> f ListServices
listServices_nextToken = (ListServices -> Maybe Text)
-> (ListServices -> Maybe Text -> ListServices)
-> Lens ListServices ListServices (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListServices' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListServices' :: ListServices -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListServices
s@ListServices' {} Maybe Text
a -> ListServices
s {$sel:nextToken:ListServices' :: Maybe Text
nextToken = Maybe Text
a} :: ListServices)

-- | The launch type to use when filtering the @ListServices@ results.
listServices_launchType :: Lens.Lens' ListServices (Prelude.Maybe LaunchType)
listServices_launchType :: (Maybe LaunchType -> f (Maybe LaunchType))
-> ListServices -> f ListServices
listServices_launchType = (ListServices -> Maybe LaunchType)
-> (ListServices -> Maybe LaunchType -> ListServices)
-> Lens
     ListServices ListServices (Maybe LaunchType) (Maybe LaunchType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListServices' {Maybe LaunchType
launchType :: Maybe LaunchType
$sel:launchType:ListServices' :: ListServices -> Maybe LaunchType
launchType} -> Maybe LaunchType
launchType) (\s :: ListServices
s@ListServices' {} Maybe LaunchType
a -> ListServices
s {$sel:launchType:ListServices' :: Maybe LaunchType
launchType = Maybe LaunchType
a} :: ListServices)

-- | The scheduling strategy to use when filtering the @ListServices@
-- results.
listServices_schedulingStrategy :: Lens.Lens' ListServices (Prelude.Maybe SchedulingStrategy)
listServices_schedulingStrategy :: (Maybe SchedulingStrategy -> f (Maybe SchedulingStrategy))
-> ListServices -> f ListServices
listServices_schedulingStrategy = (ListServices -> Maybe SchedulingStrategy)
-> (ListServices -> Maybe SchedulingStrategy -> ListServices)
-> Lens
     ListServices
     ListServices
     (Maybe SchedulingStrategy)
     (Maybe SchedulingStrategy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListServices' {Maybe SchedulingStrategy
schedulingStrategy :: Maybe SchedulingStrategy
$sel:schedulingStrategy:ListServices' :: ListServices -> Maybe SchedulingStrategy
schedulingStrategy} -> Maybe SchedulingStrategy
schedulingStrategy) (\s :: ListServices
s@ListServices' {} Maybe SchedulingStrategy
a -> ListServices
s {$sel:schedulingStrategy:ListServices' :: Maybe SchedulingStrategy
schedulingStrategy = Maybe SchedulingStrategy
a} :: ListServices)

-- | The maximum number of service results returned by @ListServices@ in
-- paginated output. When this parameter is used, @ListServices@ only
-- returns @maxResults@ results in a single page along with a @nextToken@
-- response element. The remaining results of the initial request can be
-- seen by sending another @ListServices@ request with the returned
-- @nextToken@ value. This value can be between 1 and 100. If this
-- parameter is not used, then @ListServices@ returns up to 10 results and
-- a @nextToken@ value if applicable.
listServices_maxResults :: Lens.Lens' ListServices (Prelude.Maybe Prelude.Int)
listServices_maxResults :: (Maybe Int -> f (Maybe Int)) -> ListServices -> f ListServices
listServices_maxResults = (ListServices -> Maybe Int)
-> (ListServices -> Maybe Int -> ListServices)
-> Lens ListServices ListServices (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListServices' {Maybe Int
maxResults :: Maybe Int
$sel:maxResults:ListServices' :: ListServices -> Maybe Int
maxResults} -> Maybe Int
maxResults) (\s :: ListServices
s@ListServices' {} Maybe Int
a -> ListServices
s {$sel:maxResults:ListServices' :: Maybe Int
maxResults = Maybe Int
a} :: ListServices)

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

instance Prelude.NFData ListServices

instance Core.ToHeaders ListServices where
  toHeaders :: ListServices -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListServices -> 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
"AmazonEC2ContainerServiceV20141113.ListServices" ::
                          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 ListServices where
  toJSON :: ListServices -> Value
toJSON ListServices' {Maybe Int
Maybe Text
Maybe LaunchType
Maybe SchedulingStrategy
maxResults :: Maybe Int
schedulingStrategy :: Maybe SchedulingStrategy
launchType :: Maybe LaunchType
nextToken :: Maybe Text
cluster :: Maybe Text
$sel:maxResults:ListServices' :: ListServices -> Maybe Int
$sel:schedulingStrategy:ListServices' :: ListServices -> Maybe SchedulingStrategy
$sel:launchType:ListServices' :: ListServices -> Maybe LaunchType
$sel:nextToken:ListServices' :: ListServices -> Maybe Text
$sel:cluster:ListServices' :: ListServices -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"cluster" 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
cluster,
            (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
"launchType" Text -> LaunchType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (LaunchType -> Pair) -> Maybe LaunchType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe LaunchType
launchType,
            (Text
"schedulingStrategy" Text -> SchedulingStrategy -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (SchedulingStrategy -> Pair)
-> Maybe SchedulingStrategy -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SchedulingStrategy
schedulingStrategy,
            (Text
"maxResults" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
maxResults
          ]
      )

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

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

-- | /See:/ 'newListServicesResponse' smart constructor.
data ListServicesResponse = ListServicesResponse'
  { -- | The list of full ARN entries for each service associated with the
    -- specified cluster.
    ListServicesResponse -> Maybe [Text]
serviceArns :: Prelude.Maybe [Prelude.Text],
    -- | The @nextToken@ value to include in a future @ListServices@ request.
    -- When the results of a @ListServices@ request exceed @maxResults@, this
    -- value can be used to retrieve the next page of results. This value is
    -- @null@ when there are no more results to return.
    ListServicesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListServicesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListServicesResponse -> ListServicesResponse -> Bool
(ListServicesResponse -> ListServicesResponse -> Bool)
-> (ListServicesResponse -> ListServicesResponse -> Bool)
-> Eq ListServicesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListServicesResponse -> ListServicesResponse -> Bool
$c/= :: ListServicesResponse -> ListServicesResponse -> Bool
== :: ListServicesResponse -> ListServicesResponse -> Bool
$c== :: ListServicesResponse -> ListServicesResponse -> Bool
Prelude.Eq, ReadPrec [ListServicesResponse]
ReadPrec ListServicesResponse
Int -> ReadS ListServicesResponse
ReadS [ListServicesResponse]
(Int -> ReadS ListServicesResponse)
-> ReadS [ListServicesResponse]
-> ReadPrec ListServicesResponse
-> ReadPrec [ListServicesResponse]
-> Read ListServicesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListServicesResponse]
$creadListPrec :: ReadPrec [ListServicesResponse]
readPrec :: ReadPrec ListServicesResponse
$creadPrec :: ReadPrec ListServicesResponse
readList :: ReadS [ListServicesResponse]
$creadList :: ReadS [ListServicesResponse]
readsPrec :: Int -> ReadS ListServicesResponse
$creadsPrec :: Int -> ReadS ListServicesResponse
Prelude.Read, Int -> ListServicesResponse -> ShowS
[ListServicesResponse] -> ShowS
ListServicesResponse -> String
(Int -> ListServicesResponse -> ShowS)
-> (ListServicesResponse -> String)
-> ([ListServicesResponse] -> ShowS)
-> Show ListServicesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListServicesResponse] -> ShowS
$cshowList :: [ListServicesResponse] -> ShowS
show :: ListServicesResponse -> String
$cshow :: ListServicesResponse -> String
showsPrec :: Int -> ListServicesResponse -> ShowS
$cshowsPrec :: Int -> ListServicesResponse -> ShowS
Prelude.Show, (forall x. ListServicesResponse -> Rep ListServicesResponse x)
-> (forall x. Rep ListServicesResponse x -> ListServicesResponse)
-> Generic ListServicesResponse
forall x. Rep ListServicesResponse x -> ListServicesResponse
forall x. ListServicesResponse -> Rep ListServicesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListServicesResponse x -> ListServicesResponse
$cfrom :: forall x. ListServicesResponse -> Rep ListServicesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListServicesResponse' 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:
--
-- 'serviceArns', 'listServicesResponse_serviceArns' - The list of full ARN entries for each service associated with the
-- specified cluster.
--
-- 'nextToken', 'listServicesResponse_nextToken' - The @nextToken@ value to include in a future @ListServices@ request.
-- When the results of a @ListServices@ request exceed @maxResults@, this
-- value can be used to retrieve the next page of results. This value is
-- @null@ when there are no more results to return.
--
-- 'httpStatus', 'listServicesResponse_httpStatus' - The response's http status code.
newListServicesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListServicesResponse
newListServicesResponse :: Int -> ListServicesResponse
newListServicesResponse Int
pHttpStatus_ =
  ListServicesResponse' :: Maybe [Text] -> Maybe Text -> Int -> ListServicesResponse
ListServicesResponse'
    { $sel:serviceArns:ListServicesResponse' :: Maybe [Text]
serviceArns =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListServicesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListServicesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The list of full ARN entries for each service associated with the
-- specified cluster.
listServicesResponse_serviceArns :: Lens.Lens' ListServicesResponse (Prelude.Maybe [Prelude.Text])
listServicesResponse_serviceArns :: (Maybe [Text] -> f (Maybe [Text]))
-> ListServicesResponse -> f ListServicesResponse
listServicesResponse_serviceArns = (ListServicesResponse -> Maybe [Text])
-> (ListServicesResponse -> Maybe [Text] -> ListServicesResponse)
-> Lens' ListServicesResponse (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListServicesResponse' {Maybe [Text]
serviceArns :: Maybe [Text]
$sel:serviceArns:ListServicesResponse' :: ListServicesResponse -> Maybe [Text]
serviceArns} -> Maybe [Text]
serviceArns) (\s :: ListServicesResponse
s@ListServicesResponse' {} Maybe [Text]
a -> ListServicesResponse
s {$sel:serviceArns:ListServicesResponse' :: Maybe [Text]
serviceArns = Maybe [Text]
a} :: ListServicesResponse) ((Maybe [Text] -> f (Maybe [Text]))
 -> ListServicesResponse -> f ListServicesResponse)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ListServicesResponse
-> f ListServicesResponse
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 @nextToken@ value to include in a future @ListServices@ request.
-- When the results of a @ListServices@ request exceed @maxResults@, this
-- value can be used to retrieve the next page of results. This value is
-- @null@ when there are no more results to return.
listServicesResponse_nextToken :: Lens.Lens' ListServicesResponse (Prelude.Maybe Prelude.Text)
listServicesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListServicesResponse -> f ListServicesResponse
listServicesResponse_nextToken = (ListServicesResponse -> Maybe Text)
-> (ListServicesResponse -> Maybe Text -> ListServicesResponse)
-> Lens' ListServicesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListServicesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListServicesResponse' :: ListServicesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListServicesResponse
s@ListServicesResponse' {} Maybe Text
a -> ListServicesResponse
s {$sel:nextToken:ListServicesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListServicesResponse)

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

instance Prelude.NFData ListServicesResponse