{-# 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.ComputeOptimizer.GetECSServiceRecommendations
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns Amazon ECS service recommendations.
--
-- Compute Optimizer generates recommendations for Amazon ECS services on
-- Fargate that meet a specific set of requirements. For more information,
-- see the
-- <https://docs.aws.amazon.com/compute-optimizer/latest/ug/requirements.html Supported resources and requirements>
-- in the /Compute Optimizer User Guide/.
module Amazonka.ComputeOptimizer.GetECSServiceRecommendations
  ( -- * Creating a Request
    GetECSServiceRecommendations (..),
    newGetECSServiceRecommendations,

    -- * Request Lenses
    getECSServiceRecommendations_accountIds,
    getECSServiceRecommendations_filters,
    getECSServiceRecommendations_maxResults,
    getECSServiceRecommendations_nextToken,
    getECSServiceRecommendations_serviceArns,

    -- * Destructuring the Response
    GetECSServiceRecommendationsResponse (..),
    newGetECSServiceRecommendationsResponse,

    -- * Response Lenses
    getECSServiceRecommendationsResponse_ecsServiceRecommendations,
    getECSServiceRecommendationsResponse_errors,
    getECSServiceRecommendationsResponse_nextToken,
    getECSServiceRecommendationsResponse_httpStatus,
  )
where

import Amazonka.ComputeOptimizer.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:/ 'newGetECSServiceRecommendations' smart constructor.
data GetECSServiceRecommendations = GetECSServiceRecommendations'
  { -- | Return the ECS service recommendations to the specified Amazon Web
    -- Services account IDs.
    --
    -- If your account is the management account or the delegated administrator
    -- of an organization, use this parameter to return the ECS service
    -- recommendations to specific member accounts.
    --
    -- You can only specify one account ID per request.
    GetECSServiceRecommendations -> Maybe [Text]
accountIds :: Prelude.Maybe [Prelude.Text],
    -- | An array of objects to specify a filter that returns a more specific
    -- list of ECS service recommendations.
    GetECSServiceRecommendations
-> Maybe [ECSServiceRecommendationFilter]
filters :: Prelude.Maybe [ECSServiceRecommendationFilter],
    -- | The maximum number of ECS service recommendations to return with a
    -- single request.
    --
    -- To retrieve the remaining results, make another request with the
    -- returned @nextToken@ value.
    GetECSServiceRecommendations -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The token to advance to the next page of ECS service recommendations.
    GetECSServiceRecommendations -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The ARN that identifies the ECS service.
    --
    -- The following is the format of the ARN:
    --
    -- @arn:aws:ecs:region:aws_account_id:service\/cluster-name\/service-name@
    GetECSServiceRecommendations -> Maybe [Text]
serviceArns :: Prelude.Maybe [Prelude.Text]
  }
  deriving (GetECSServiceRecommendations
-> GetECSServiceRecommendations -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetECSServiceRecommendations
-> GetECSServiceRecommendations -> Bool
$c/= :: GetECSServiceRecommendations
-> GetECSServiceRecommendations -> Bool
== :: GetECSServiceRecommendations
-> GetECSServiceRecommendations -> Bool
$c== :: GetECSServiceRecommendations
-> GetECSServiceRecommendations -> Bool
Prelude.Eq, ReadPrec [GetECSServiceRecommendations]
ReadPrec GetECSServiceRecommendations
Int -> ReadS GetECSServiceRecommendations
ReadS [GetECSServiceRecommendations]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetECSServiceRecommendations]
$creadListPrec :: ReadPrec [GetECSServiceRecommendations]
readPrec :: ReadPrec GetECSServiceRecommendations
$creadPrec :: ReadPrec GetECSServiceRecommendations
readList :: ReadS [GetECSServiceRecommendations]
$creadList :: ReadS [GetECSServiceRecommendations]
readsPrec :: Int -> ReadS GetECSServiceRecommendations
$creadsPrec :: Int -> ReadS GetECSServiceRecommendations
Prelude.Read, Int -> GetECSServiceRecommendations -> ShowS
[GetECSServiceRecommendations] -> ShowS
GetECSServiceRecommendations -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetECSServiceRecommendations] -> ShowS
$cshowList :: [GetECSServiceRecommendations] -> ShowS
show :: GetECSServiceRecommendations -> String
$cshow :: GetECSServiceRecommendations -> String
showsPrec :: Int -> GetECSServiceRecommendations -> ShowS
$cshowsPrec :: Int -> GetECSServiceRecommendations -> ShowS
Prelude.Show, forall x.
Rep GetECSServiceRecommendations x -> GetECSServiceRecommendations
forall x.
GetECSServiceRecommendations -> Rep GetECSServiceRecommendations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetECSServiceRecommendations x -> GetECSServiceRecommendations
$cfrom :: forall x.
GetECSServiceRecommendations -> Rep GetECSServiceRecommendations x
Prelude.Generic)

-- |
-- Create a value of 'GetECSServiceRecommendations' 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:
--
-- 'accountIds', 'getECSServiceRecommendations_accountIds' - Return the ECS service recommendations to the specified Amazon Web
-- Services account IDs.
--
-- If your account is the management account or the delegated administrator
-- of an organization, use this parameter to return the ECS service
-- recommendations to specific member accounts.
--
-- You can only specify one account ID per request.
--
-- 'filters', 'getECSServiceRecommendations_filters' - An array of objects to specify a filter that returns a more specific
-- list of ECS service recommendations.
--
-- 'maxResults', 'getECSServiceRecommendations_maxResults' - The maximum number of ECS service recommendations to return with a
-- single request.
--
-- To retrieve the remaining results, make another request with the
-- returned @nextToken@ value.
--
-- 'nextToken', 'getECSServiceRecommendations_nextToken' - The token to advance to the next page of ECS service recommendations.
--
-- 'serviceArns', 'getECSServiceRecommendations_serviceArns' - The ARN that identifies the ECS service.
--
-- The following is the format of the ARN:
--
-- @arn:aws:ecs:region:aws_account_id:service\/cluster-name\/service-name@
newGetECSServiceRecommendations ::
  GetECSServiceRecommendations
newGetECSServiceRecommendations :: GetECSServiceRecommendations
newGetECSServiceRecommendations =
  GetECSServiceRecommendations'
    { $sel:accountIds:GetECSServiceRecommendations' :: Maybe [Text]
accountIds =
        forall a. Maybe a
Prelude.Nothing,
      $sel:filters:GetECSServiceRecommendations' :: Maybe [ECSServiceRecommendationFilter]
filters = forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:GetECSServiceRecommendations' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:GetECSServiceRecommendations' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:serviceArns:GetECSServiceRecommendations' :: Maybe [Text]
serviceArns = forall a. Maybe a
Prelude.Nothing
    }

-- | Return the ECS service recommendations to the specified Amazon Web
-- Services account IDs.
--
-- If your account is the management account or the delegated administrator
-- of an organization, use this parameter to return the ECS service
-- recommendations to specific member accounts.
--
-- You can only specify one account ID per request.
getECSServiceRecommendations_accountIds :: Lens.Lens' GetECSServiceRecommendations (Prelude.Maybe [Prelude.Text])
getECSServiceRecommendations_accountIds :: Lens' GetECSServiceRecommendations (Maybe [Text])
getECSServiceRecommendations_accountIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetECSServiceRecommendations' {Maybe [Text]
accountIds :: Maybe [Text]
$sel:accountIds:GetECSServiceRecommendations' :: GetECSServiceRecommendations -> Maybe [Text]
accountIds} -> Maybe [Text]
accountIds) (\s :: GetECSServiceRecommendations
s@GetECSServiceRecommendations' {} Maybe [Text]
a -> GetECSServiceRecommendations
s {$sel:accountIds:GetECSServiceRecommendations' :: Maybe [Text]
accountIds = Maybe [Text]
a} :: GetECSServiceRecommendations) 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

-- | An array of objects to specify a filter that returns a more specific
-- list of ECS service recommendations.
getECSServiceRecommendations_filters :: Lens.Lens' GetECSServiceRecommendations (Prelude.Maybe [ECSServiceRecommendationFilter])
getECSServiceRecommendations_filters :: Lens'
  GetECSServiceRecommendations
  (Maybe [ECSServiceRecommendationFilter])
getECSServiceRecommendations_filters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetECSServiceRecommendations' {Maybe [ECSServiceRecommendationFilter]
filters :: Maybe [ECSServiceRecommendationFilter]
$sel:filters:GetECSServiceRecommendations' :: GetECSServiceRecommendations
-> Maybe [ECSServiceRecommendationFilter]
filters} -> Maybe [ECSServiceRecommendationFilter]
filters) (\s :: GetECSServiceRecommendations
s@GetECSServiceRecommendations' {} Maybe [ECSServiceRecommendationFilter]
a -> GetECSServiceRecommendations
s {$sel:filters:GetECSServiceRecommendations' :: Maybe [ECSServiceRecommendationFilter]
filters = Maybe [ECSServiceRecommendationFilter]
a} :: GetECSServiceRecommendations) 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 maximum number of ECS service recommendations to return with a
-- single request.
--
-- To retrieve the remaining results, make another request with the
-- returned @nextToken@ value.
getECSServiceRecommendations_maxResults :: Lens.Lens' GetECSServiceRecommendations (Prelude.Maybe Prelude.Natural)
getECSServiceRecommendations_maxResults :: Lens' GetECSServiceRecommendations (Maybe Natural)
getECSServiceRecommendations_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetECSServiceRecommendations' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:GetECSServiceRecommendations' :: GetECSServiceRecommendations -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: GetECSServiceRecommendations
s@GetECSServiceRecommendations' {} Maybe Natural
a -> GetECSServiceRecommendations
s {$sel:maxResults:GetECSServiceRecommendations' :: Maybe Natural
maxResults = Maybe Natural
a} :: GetECSServiceRecommendations)

-- | The token to advance to the next page of ECS service recommendations.
getECSServiceRecommendations_nextToken :: Lens.Lens' GetECSServiceRecommendations (Prelude.Maybe Prelude.Text)
getECSServiceRecommendations_nextToken :: Lens' GetECSServiceRecommendations (Maybe Text)
getECSServiceRecommendations_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetECSServiceRecommendations' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetECSServiceRecommendations' :: GetECSServiceRecommendations -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetECSServiceRecommendations
s@GetECSServiceRecommendations' {} Maybe Text
a -> GetECSServiceRecommendations
s {$sel:nextToken:GetECSServiceRecommendations' :: Maybe Text
nextToken = Maybe Text
a} :: GetECSServiceRecommendations)

-- | The ARN that identifies the ECS service.
--
-- The following is the format of the ARN:
--
-- @arn:aws:ecs:region:aws_account_id:service\/cluster-name\/service-name@
getECSServiceRecommendations_serviceArns :: Lens.Lens' GetECSServiceRecommendations (Prelude.Maybe [Prelude.Text])
getECSServiceRecommendations_serviceArns :: Lens' GetECSServiceRecommendations (Maybe [Text])
getECSServiceRecommendations_serviceArns = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetECSServiceRecommendations' {Maybe [Text]
serviceArns :: Maybe [Text]
$sel:serviceArns:GetECSServiceRecommendations' :: GetECSServiceRecommendations -> Maybe [Text]
serviceArns} -> Maybe [Text]
serviceArns) (\s :: GetECSServiceRecommendations
s@GetECSServiceRecommendations' {} Maybe [Text]
a -> GetECSServiceRecommendations
s {$sel:serviceArns:GetECSServiceRecommendations' :: Maybe [Text]
serviceArns = Maybe [Text]
a} :: GetECSServiceRecommendations) 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

instance Core.AWSRequest GetECSServiceRecommendations where
  type
    AWSResponse GetECSServiceRecommendations =
      GetECSServiceRecommendationsResponse
  request :: (Service -> Service)
-> GetECSServiceRecommendations
-> Request GetECSServiceRecommendations
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetECSServiceRecommendations
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetECSServiceRecommendations)))
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 [ECSServiceRecommendation]
-> Maybe [GetRecommendationError]
-> Maybe Text
-> Int
-> GetECSServiceRecommendationsResponse
GetECSServiceRecommendationsResponse'
            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
"ecsServiceRecommendations"
                            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
"errors" 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
    GetECSServiceRecommendations
  where
  hashWithSalt :: Int -> GetECSServiceRecommendations -> Int
hashWithSalt Int
_salt GetECSServiceRecommendations' {Maybe Natural
Maybe [Text]
Maybe [ECSServiceRecommendationFilter]
Maybe Text
serviceArns :: Maybe [Text]
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe [ECSServiceRecommendationFilter]
accountIds :: Maybe [Text]
$sel:serviceArns:GetECSServiceRecommendations' :: GetECSServiceRecommendations -> Maybe [Text]
$sel:nextToken:GetECSServiceRecommendations' :: GetECSServiceRecommendations -> Maybe Text
$sel:maxResults:GetECSServiceRecommendations' :: GetECSServiceRecommendations -> Maybe Natural
$sel:filters:GetECSServiceRecommendations' :: GetECSServiceRecommendations
-> Maybe [ECSServiceRecommendationFilter]
$sel:accountIds:GetECSServiceRecommendations' :: GetECSServiceRecommendations -> Maybe [Text]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
accountIds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [ECSServiceRecommendationFilter]
filters
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
serviceArns

instance Prelude.NFData GetECSServiceRecommendations where
  rnf :: GetECSServiceRecommendations -> ()
rnf GetECSServiceRecommendations' {Maybe Natural
Maybe [Text]
Maybe [ECSServiceRecommendationFilter]
Maybe Text
serviceArns :: Maybe [Text]
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe [ECSServiceRecommendationFilter]
accountIds :: Maybe [Text]
$sel:serviceArns:GetECSServiceRecommendations' :: GetECSServiceRecommendations -> Maybe [Text]
$sel:nextToken:GetECSServiceRecommendations' :: GetECSServiceRecommendations -> Maybe Text
$sel:maxResults:GetECSServiceRecommendations' :: GetECSServiceRecommendations -> Maybe Natural
$sel:filters:GetECSServiceRecommendations' :: GetECSServiceRecommendations
-> Maybe [ECSServiceRecommendationFilter]
$sel:accountIds:GetECSServiceRecommendations' :: GetECSServiceRecommendations -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
accountIds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ECSServiceRecommendationFilter]
filters
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
serviceArns

instance Data.ToHeaders GetECSServiceRecommendations where
  toHeaders :: GetECSServiceRecommendations -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"ComputeOptimizerService.GetECSServiceRecommendations" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON GetECSServiceRecommendations where
  toJSON :: GetECSServiceRecommendations -> Value
toJSON GetECSServiceRecommendations' {Maybe Natural
Maybe [Text]
Maybe [ECSServiceRecommendationFilter]
Maybe Text
serviceArns :: Maybe [Text]
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe [ECSServiceRecommendationFilter]
accountIds :: Maybe [Text]
$sel:serviceArns:GetECSServiceRecommendations' :: GetECSServiceRecommendations -> Maybe [Text]
$sel:nextToken:GetECSServiceRecommendations' :: GetECSServiceRecommendations -> Maybe Text
$sel:maxResults:GetECSServiceRecommendations' :: GetECSServiceRecommendations -> Maybe Natural
$sel:filters:GetECSServiceRecommendations' :: GetECSServiceRecommendations
-> Maybe [ECSServiceRecommendationFilter]
$sel:accountIds:GetECSServiceRecommendations' :: GetECSServiceRecommendations -> Maybe [Text]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"accountIds" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
accountIds,
            (Key
"filters" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [ECSServiceRecommendationFilter]
filters,
            (Key
"maxResults" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            (Key
"nextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Key
"serviceArns" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
serviceArns
          ]
      )

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

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

-- | /See:/ 'newGetECSServiceRecommendationsResponse' smart constructor.
data GetECSServiceRecommendationsResponse = GetECSServiceRecommendationsResponse'
  { -- | An array of objects that describe the ECS service recommendations.
    GetECSServiceRecommendationsResponse
-> Maybe [ECSServiceRecommendation]
ecsServiceRecommendations :: Prelude.Maybe [ECSServiceRecommendation],
    -- | An array of objects that describe errors of the request.
    GetECSServiceRecommendationsResponse
-> Maybe [GetRecommendationError]
errors :: Prelude.Maybe [GetRecommendationError],
    -- | The token to advance to the next page of ECS service recommendations.
    GetECSServiceRecommendationsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    GetECSServiceRecommendationsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetECSServiceRecommendationsResponse
-> GetECSServiceRecommendationsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetECSServiceRecommendationsResponse
-> GetECSServiceRecommendationsResponse -> Bool
$c/= :: GetECSServiceRecommendationsResponse
-> GetECSServiceRecommendationsResponse -> Bool
== :: GetECSServiceRecommendationsResponse
-> GetECSServiceRecommendationsResponse -> Bool
$c== :: GetECSServiceRecommendationsResponse
-> GetECSServiceRecommendationsResponse -> Bool
Prelude.Eq, ReadPrec [GetECSServiceRecommendationsResponse]
ReadPrec GetECSServiceRecommendationsResponse
Int -> ReadS GetECSServiceRecommendationsResponse
ReadS [GetECSServiceRecommendationsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetECSServiceRecommendationsResponse]
$creadListPrec :: ReadPrec [GetECSServiceRecommendationsResponse]
readPrec :: ReadPrec GetECSServiceRecommendationsResponse
$creadPrec :: ReadPrec GetECSServiceRecommendationsResponse
readList :: ReadS [GetECSServiceRecommendationsResponse]
$creadList :: ReadS [GetECSServiceRecommendationsResponse]
readsPrec :: Int -> ReadS GetECSServiceRecommendationsResponse
$creadsPrec :: Int -> ReadS GetECSServiceRecommendationsResponse
Prelude.Read, Int -> GetECSServiceRecommendationsResponse -> ShowS
[GetECSServiceRecommendationsResponse] -> ShowS
GetECSServiceRecommendationsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetECSServiceRecommendationsResponse] -> ShowS
$cshowList :: [GetECSServiceRecommendationsResponse] -> ShowS
show :: GetECSServiceRecommendationsResponse -> String
$cshow :: GetECSServiceRecommendationsResponse -> String
showsPrec :: Int -> GetECSServiceRecommendationsResponse -> ShowS
$cshowsPrec :: Int -> GetECSServiceRecommendationsResponse -> ShowS
Prelude.Show, forall x.
Rep GetECSServiceRecommendationsResponse x
-> GetECSServiceRecommendationsResponse
forall x.
GetECSServiceRecommendationsResponse
-> Rep GetECSServiceRecommendationsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetECSServiceRecommendationsResponse x
-> GetECSServiceRecommendationsResponse
$cfrom :: forall x.
GetECSServiceRecommendationsResponse
-> Rep GetECSServiceRecommendationsResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetECSServiceRecommendationsResponse' 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:
--
-- 'ecsServiceRecommendations', 'getECSServiceRecommendationsResponse_ecsServiceRecommendations' - An array of objects that describe the ECS service recommendations.
--
-- 'errors', 'getECSServiceRecommendationsResponse_errors' - An array of objects that describe errors of the request.
--
-- 'nextToken', 'getECSServiceRecommendationsResponse_nextToken' - The token to advance to the next page of ECS service recommendations.
--
-- 'httpStatus', 'getECSServiceRecommendationsResponse_httpStatus' - The response's http status code.
newGetECSServiceRecommendationsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetECSServiceRecommendationsResponse
newGetECSServiceRecommendationsResponse :: Int -> GetECSServiceRecommendationsResponse
newGetECSServiceRecommendationsResponse Int
pHttpStatus_ =
  GetECSServiceRecommendationsResponse'
    { $sel:ecsServiceRecommendations:GetECSServiceRecommendationsResponse' :: Maybe [ECSServiceRecommendation]
ecsServiceRecommendations =
        forall a. Maybe a
Prelude.Nothing,
      $sel:errors:GetECSServiceRecommendationsResponse' :: Maybe [GetRecommendationError]
errors = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:GetECSServiceRecommendationsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetECSServiceRecommendationsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An array of objects that describe the ECS service recommendations.
getECSServiceRecommendationsResponse_ecsServiceRecommendations :: Lens.Lens' GetECSServiceRecommendationsResponse (Prelude.Maybe [ECSServiceRecommendation])
getECSServiceRecommendationsResponse_ecsServiceRecommendations :: Lens'
  GetECSServiceRecommendationsResponse
  (Maybe [ECSServiceRecommendation])
getECSServiceRecommendationsResponse_ecsServiceRecommendations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetECSServiceRecommendationsResponse' {Maybe [ECSServiceRecommendation]
ecsServiceRecommendations :: Maybe [ECSServiceRecommendation]
$sel:ecsServiceRecommendations:GetECSServiceRecommendationsResponse' :: GetECSServiceRecommendationsResponse
-> Maybe [ECSServiceRecommendation]
ecsServiceRecommendations} -> Maybe [ECSServiceRecommendation]
ecsServiceRecommendations) (\s :: GetECSServiceRecommendationsResponse
s@GetECSServiceRecommendationsResponse' {} Maybe [ECSServiceRecommendation]
a -> GetECSServiceRecommendationsResponse
s {$sel:ecsServiceRecommendations:GetECSServiceRecommendationsResponse' :: Maybe [ECSServiceRecommendation]
ecsServiceRecommendations = Maybe [ECSServiceRecommendation]
a} :: GetECSServiceRecommendationsResponse) 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

-- | An array of objects that describe errors of the request.
getECSServiceRecommendationsResponse_errors :: Lens.Lens' GetECSServiceRecommendationsResponse (Prelude.Maybe [GetRecommendationError])
getECSServiceRecommendationsResponse_errors :: Lens'
  GetECSServiceRecommendationsResponse
  (Maybe [GetRecommendationError])
getECSServiceRecommendationsResponse_errors = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetECSServiceRecommendationsResponse' {Maybe [GetRecommendationError]
errors :: Maybe [GetRecommendationError]
$sel:errors:GetECSServiceRecommendationsResponse' :: GetECSServiceRecommendationsResponse
-> Maybe [GetRecommendationError]
errors} -> Maybe [GetRecommendationError]
errors) (\s :: GetECSServiceRecommendationsResponse
s@GetECSServiceRecommendationsResponse' {} Maybe [GetRecommendationError]
a -> GetECSServiceRecommendationsResponse
s {$sel:errors:GetECSServiceRecommendationsResponse' :: Maybe [GetRecommendationError]
errors = Maybe [GetRecommendationError]
a} :: GetECSServiceRecommendationsResponse) 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 to advance to the next page of ECS service recommendations.
getECSServiceRecommendationsResponse_nextToken :: Lens.Lens' GetECSServiceRecommendationsResponse (Prelude.Maybe Prelude.Text)
getECSServiceRecommendationsResponse_nextToken :: Lens' GetECSServiceRecommendationsResponse (Maybe Text)
getECSServiceRecommendationsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetECSServiceRecommendationsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetECSServiceRecommendationsResponse' :: GetECSServiceRecommendationsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetECSServiceRecommendationsResponse
s@GetECSServiceRecommendationsResponse' {} Maybe Text
a -> GetECSServiceRecommendationsResponse
s {$sel:nextToken:GetECSServiceRecommendationsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetECSServiceRecommendationsResponse)

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

instance
  Prelude.NFData
    GetECSServiceRecommendationsResponse
  where
  rnf :: GetECSServiceRecommendationsResponse -> ()
rnf GetECSServiceRecommendationsResponse' {Int
Maybe [GetRecommendationError]
Maybe [ECSServiceRecommendation]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
errors :: Maybe [GetRecommendationError]
ecsServiceRecommendations :: Maybe [ECSServiceRecommendation]
$sel:httpStatus:GetECSServiceRecommendationsResponse' :: GetECSServiceRecommendationsResponse -> Int
$sel:nextToken:GetECSServiceRecommendationsResponse' :: GetECSServiceRecommendationsResponse -> Maybe Text
$sel:errors:GetECSServiceRecommendationsResponse' :: GetECSServiceRecommendationsResponse
-> Maybe [GetRecommendationError]
$sel:ecsServiceRecommendations:GetECSServiceRecommendationsResponse' :: GetECSServiceRecommendationsResponse
-> Maybe [ECSServiceRecommendation]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [ECSServiceRecommendation]
ecsServiceRecommendations
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [GetRecommendationError]
errors
      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