{-# 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.EC2.GetGroupsForCapacityReservation
-- 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 the resource groups to which a Capacity Reservation has been
-- added.
--
-- This operation returns paginated results.
module Amazonka.EC2.GetGroupsForCapacityReservation
  ( -- * Creating a Request
    GetGroupsForCapacityReservation (..),
    newGetGroupsForCapacityReservation,

    -- * Request Lenses
    getGroupsForCapacityReservation_dryRun,
    getGroupsForCapacityReservation_maxResults,
    getGroupsForCapacityReservation_nextToken,
    getGroupsForCapacityReservation_capacityReservationId,

    -- * Destructuring the Response
    GetGroupsForCapacityReservationResponse (..),
    newGetGroupsForCapacityReservationResponse,

    -- * Response Lenses
    getGroupsForCapacityReservationResponse_capacityReservationGroups,
    getGroupsForCapacityReservationResponse_nextToken,
    getGroupsForCapacityReservationResponse_httpStatus,
  )
where

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

-- | /See:/ 'newGetGroupsForCapacityReservation' smart constructor.
data GetGroupsForCapacityReservation = GetGroupsForCapacityReservation'
  { -- | Checks whether you have the required permissions for the action, without
    -- actually making the request, and provides an error response. If you have
    -- the required permissions, the error response is @DryRunOperation@.
    -- Otherwise, it is @UnauthorizedOperation@.
    GetGroupsForCapacityReservation -> Maybe Bool
dryRun :: Prelude.Maybe Prelude.Bool,
    -- | The maximum number of results to return for the request in a single
    -- page. The remaining results can be seen by sending another request with
    -- the returned @nextToken@ value. This value can be between 5 and 500. If
    -- @maxResults@ is given a larger value than 500, you receive an error.
    GetGroupsForCapacityReservation -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The token to use to retrieve the next page of results.
    GetGroupsForCapacityReservation -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The ID of the Capacity Reservation.
    GetGroupsForCapacityReservation -> Text
capacityReservationId :: Prelude.Text
  }
  deriving (GetGroupsForCapacityReservation
-> GetGroupsForCapacityReservation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetGroupsForCapacityReservation
-> GetGroupsForCapacityReservation -> Bool
$c/= :: GetGroupsForCapacityReservation
-> GetGroupsForCapacityReservation -> Bool
== :: GetGroupsForCapacityReservation
-> GetGroupsForCapacityReservation -> Bool
$c== :: GetGroupsForCapacityReservation
-> GetGroupsForCapacityReservation -> Bool
Prelude.Eq, ReadPrec [GetGroupsForCapacityReservation]
ReadPrec GetGroupsForCapacityReservation
Int -> ReadS GetGroupsForCapacityReservation
ReadS [GetGroupsForCapacityReservation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetGroupsForCapacityReservation]
$creadListPrec :: ReadPrec [GetGroupsForCapacityReservation]
readPrec :: ReadPrec GetGroupsForCapacityReservation
$creadPrec :: ReadPrec GetGroupsForCapacityReservation
readList :: ReadS [GetGroupsForCapacityReservation]
$creadList :: ReadS [GetGroupsForCapacityReservation]
readsPrec :: Int -> ReadS GetGroupsForCapacityReservation
$creadsPrec :: Int -> ReadS GetGroupsForCapacityReservation
Prelude.Read, Int -> GetGroupsForCapacityReservation -> ShowS
[GetGroupsForCapacityReservation] -> ShowS
GetGroupsForCapacityReservation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetGroupsForCapacityReservation] -> ShowS
$cshowList :: [GetGroupsForCapacityReservation] -> ShowS
show :: GetGroupsForCapacityReservation -> String
$cshow :: GetGroupsForCapacityReservation -> String
showsPrec :: Int -> GetGroupsForCapacityReservation -> ShowS
$cshowsPrec :: Int -> GetGroupsForCapacityReservation -> ShowS
Prelude.Show, forall x.
Rep GetGroupsForCapacityReservation x
-> GetGroupsForCapacityReservation
forall x.
GetGroupsForCapacityReservation
-> Rep GetGroupsForCapacityReservation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetGroupsForCapacityReservation x
-> GetGroupsForCapacityReservation
$cfrom :: forall x.
GetGroupsForCapacityReservation
-> Rep GetGroupsForCapacityReservation x
Prelude.Generic)

-- |
-- Create a value of 'GetGroupsForCapacityReservation' 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:
--
-- 'dryRun', 'getGroupsForCapacityReservation_dryRun' - Checks whether you have the required permissions for the action, without
-- actually making the request, and provides an error response. If you have
-- the required permissions, the error response is @DryRunOperation@.
-- Otherwise, it is @UnauthorizedOperation@.
--
-- 'maxResults', 'getGroupsForCapacityReservation_maxResults' - The maximum number of results to return for the request in a single
-- page. The remaining results can be seen by sending another request with
-- the returned @nextToken@ value. This value can be between 5 and 500. If
-- @maxResults@ is given a larger value than 500, you receive an error.
--
-- 'nextToken', 'getGroupsForCapacityReservation_nextToken' - The token to use to retrieve the next page of results.
--
-- 'capacityReservationId', 'getGroupsForCapacityReservation_capacityReservationId' - The ID of the Capacity Reservation.
newGetGroupsForCapacityReservation ::
  -- | 'capacityReservationId'
  Prelude.Text ->
  GetGroupsForCapacityReservation
newGetGroupsForCapacityReservation :: Text -> GetGroupsForCapacityReservation
newGetGroupsForCapacityReservation
  Text
pCapacityReservationId_ =
    GetGroupsForCapacityReservation'
      { $sel:dryRun:GetGroupsForCapacityReservation' :: Maybe Bool
dryRun =
          forall a. Maybe a
Prelude.Nothing,
        $sel:maxResults:GetGroupsForCapacityReservation' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:GetGroupsForCapacityReservation' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
        $sel:capacityReservationId:GetGroupsForCapacityReservation' :: Text
capacityReservationId =
          Text
pCapacityReservationId_
      }

-- | Checks whether you have the required permissions for the action, without
-- actually making the request, and provides an error response. If you have
-- the required permissions, the error response is @DryRunOperation@.
-- Otherwise, it is @UnauthorizedOperation@.
getGroupsForCapacityReservation_dryRun :: Lens.Lens' GetGroupsForCapacityReservation (Prelude.Maybe Prelude.Bool)
getGroupsForCapacityReservation_dryRun :: Lens' GetGroupsForCapacityReservation (Maybe Bool)
getGroupsForCapacityReservation_dryRun = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGroupsForCapacityReservation' {Maybe Bool
dryRun :: Maybe Bool
$sel:dryRun:GetGroupsForCapacityReservation' :: GetGroupsForCapacityReservation -> Maybe Bool
dryRun} -> Maybe Bool
dryRun) (\s :: GetGroupsForCapacityReservation
s@GetGroupsForCapacityReservation' {} Maybe Bool
a -> GetGroupsForCapacityReservation
s {$sel:dryRun:GetGroupsForCapacityReservation' :: Maybe Bool
dryRun = Maybe Bool
a} :: GetGroupsForCapacityReservation)

-- | The maximum number of results to return for the request in a single
-- page. The remaining results can be seen by sending another request with
-- the returned @nextToken@ value. This value can be between 5 and 500. If
-- @maxResults@ is given a larger value than 500, you receive an error.
getGroupsForCapacityReservation_maxResults :: Lens.Lens' GetGroupsForCapacityReservation (Prelude.Maybe Prelude.Natural)
getGroupsForCapacityReservation_maxResults :: Lens' GetGroupsForCapacityReservation (Maybe Natural)
getGroupsForCapacityReservation_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGroupsForCapacityReservation' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:GetGroupsForCapacityReservation' :: GetGroupsForCapacityReservation -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: GetGroupsForCapacityReservation
s@GetGroupsForCapacityReservation' {} Maybe Natural
a -> GetGroupsForCapacityReservation
s {$sel:maxResults:GetGroupsForCapacityReservation' :: Maybe Natural
maxResults = Maybe Natural
a} :: GetGroupsForCapacityReservation)

-- | The token to use to retrieve the next page of results.
getGroupsForCapacityReservation_nextToken :: Lens.Lens' GetGroupsForCapacityReservation (Prelude.Maybe Prelude.Text)
getGroupsForCapacityReservation_nextToken :: Lens' GetGroupsForCapacityReservation (Maybe Text)
getGroupsForCapacityReservation_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGroupsForCapacityReservation' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetGroupsForCapacityReservation' :: GetGroupsForCapacityReservation -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetGroupsForCapacityReservation
s@GetGroupsForCapacityReservation' {} Maybe Text
a -> GetGroupsForCapacityReservation
s {$sel:nextToken:GetGroupsForCapacityReservation' :: Maybe Text
nextToken = Maybe Text
a} :: GetGroupsForCapacityReservation)

-- | The ID of the Capacity Reservation.
getGroupsForCapacityReservation_capacityReservationId :: Lens.Lens' GetGroupsForCapacityReservation Prelude.Text
getGroupsForCapacityReservation_capacityReservationId :: Lens' GetGroupsForCapacityReservation Text
getGroupsForCapacityReservation_capacityReservationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGroupsForCapacityReservation' {Text
capacityReservationId :: Text
$sel:capacityReservationId:GetGroupsForCapacityReservation' :: GetGroupsForCapacityReservation -> Text
capacityReservationId} -> Text
capacityReservationId) (\s :: GetGroupsForCapacityReservation
s@GetGroupsForCapacityReservation' {} Text
a -> GetGroupsForCapacityReservation
s {$sel:capacityReservationId:GetGroupsForCapacityReservation' :: Text
capacityReservationId = Text
a} :: GetGroupsForCapacityReservation)

instance
  Core.AWSPager
    GetGroupsForCapacityReservation
  where
  page :: GetGroupsForCapacityReservation
-> AWSResponse GetGroupsForCapacityReservation
-> Maybe GetGroupsForCapacityReservation
page GetGroupsForCapacityReservation
rq AWSResponse GetGroupsForCapacityReservation
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse GetGroupsForCapacityReservation
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetGroupsForCapacityReservationResponse (Maybe Text)
getGroupsForCapacityReservationResponse_nextToken
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse GetGroupsForCapacityReservation
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens'
  GetGroupsForCapacityReservationResponse
  (Maybe [CapacityReservationGroup])
getGroupsForCapacityReservationResponse_capacityReservationGroups
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ GetGroupsForCapacityReservation
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' GetGroupsForCapacityReservation (Maybe Text)
getGroupsForCapacityReservation_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse GetGroupsForCapacityReservation
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetGroupsForCapacityReservationResponse (Maybe Text)
getGroupsForCapacityReservationResponse_nextToken
          forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance
  Core.AWSRequest
    GetGroupsForCapacityReservation
  where
  type
    AWSResponse GetGroupsForCapacityReservation =
      GetGroupsForCapacityReservationResponse
  request :: (Service -> Service)
-> GetGroupsForCapacityReservation
-> Request GetGroupsForCapacityReservation
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetGroupsForCapacityReservation
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse GetGroupsForCapacityReservation)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe [CapacityReservationGroup]
-> Maybe Text -> Int -> GetGroupsForCapacityReservationResponse
GetGroupsForCapacityReservationResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x
                            forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"capacityReservationGroupSet"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                            forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"item")
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"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
    GetGroupsForCapacityReservation
  where
  hashWithSalt :: Int -> GetGroupsForCapacityReservation -> Int
hashWithSalt
    Int
_salt
    GetGroupsForCapacityReservation' {Maybe Bool
Maybe Natural
Maybe Text
Text
capacityReservationId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
dryRun :: Maybe Bool
$sel:capacityReservationId:GetGroupsForCapacityReservation' :: GetGroupsForCapacityReservation -> Text
$sel:nextToken:GetGroupsForCapacityReservation' :: GetGroupsForCapacityReservation -> Maybe Text
$sel:maxResults:GetGroupsForCapacityReservation' :: GetGroupsForCapacityReservation -> Maybe Natural
$sel:dryRun:GetGroupsForCapacityReservation' :: GetGroupsForCapacityReservation -> Maybe Bool
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
dryRun
        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` Text
capacityReservationId

instance
  Prelude.NFData
    GetGroupsForCapacityReservation
  where
  rnf :: GetGroupsForCapacityReservation -> ()
rnf GetGroupsForCapacityReservation' {Maybe Bool
Maybe Natural
Maybe Text
Text
capacityReservationId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
dryRun :: Maybe Bool
$sel:capacityReservationId:GetGroupsForCapacityReservation' :: GetGroupsForCapacityReservation -> Text
$sel:nextToken:GetGroupsForCapacityReservation' :: GetGroupsForCapacityReservation -> Maybe Text
$sel:maxResults:GetGroupsForCapacityReservation' :: GetGroupsForCapacityReservation -> Maybe Natural
$sel:dryRun:GetGroupsForCapacityReservation' :: GetGroupsForCapacityReservation -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
dryRun
      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 Text
capacityReservationId

instance
  Data.ToHeaders
    GetGroupsForCapacityReservation
  where
  toHeaders :: GetGroupsForCapacityReservation -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

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

instance Data.ToQuery GetGroupsForCapacityReservation where
  toQuery :: GetGroupsForCapacityReservation -> QueryString
toQuery GetGroupsForCapacityReservation' {Maybe Bool
Maybe Natural
Maybe Text
Text
capacityReservationId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
dryRun :: Maybe Bool
$sel:capacityReservationId:GetGroupsForCapacityReservation' :: GetGroupsForCapacityReservation -> Text
$sel:nextToken:GetGroupsForCapacityReservation' :: GetGroupsForCapacityReservation -> Maybe Text
$sel:maxResults:GetGroupsForCapacityReservation' :: GetGroupsForCapacityReservation -> Maybe Natural
$sel:dryRun:GetGroupsForCapacityReservation' :: GetGroupsForCapacityReservation -> Maybe Bool
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: ( ByteString
"GetGroupsForCapacityReservation" ::
                      Prelude.ByteString
                  ),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2016-11-15" :: Prelude.ByteString),
        ByteString
"DryRun" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
dryRun,
        ByteString
"MaxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxResults,
        ByteString
"NextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken,
        ByteString
"CapacityReservationId"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
capacityReservationId
      ]

-- | /See:/ 'newGetGroupsForCapacityReservationResponse' smart constructor.
data GetGroupsForCapacityReservationResponse = GetGroupsForCapacityReservationResponse'
  { -- | Information about the resource groups to which the Capacity Reservation
    -- has been added.
    GetGroupsForCapacityReservationResponse
-> Maybe [CapacityReservationGroup]
capacityReservationGroups :: Prelude.Maybe [CapacityReservationGroup],
    -- | The token to use to retrieve the next page of results. This value is
    -- @null@ when there are no more results to return.
    GetGroupsForCapacityReservationResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    GetGroupsForCapacityReservationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetGroupsForCapacityReservationResponse
-> GetGroupsForCapacityReservationResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetGroupsForCapacityReservationResponse
-> GetGroupsForCapacityReservationResponse -> Bool
$c/= :: GetGroupsForCapacityReservationResponse
-> GetGroupsForCapacityReservationResponse -> Bool
== :: GetGroupsForCapacityReservationResponse
-> GetGroupsForCapacityReservationResponse -> Bool
$c== :: GetGroupsForCapacityReservationResponse
-> GetGroupsForCapacityReservationResponse -> Bool
Prelude.Eq, ReadPrec [GetGroupsForCapacityReservationResponse]
ReadPrec GetGroupsForCapacityReservationResponse
Int -> ReadS GetGroupsForCapacityReservationResponse
ReadS [GetGroupsForCapacityReservationResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetGroupsForCapacityReservationResponse]
$creadListPrec :: ReadPrec [GetGroupsForCapacityReservationResponse]
readPrec :: ReadPrec GetGroupsForCapacityReservationResponse
$creadPrec :: ReadPrec GetGroupsForCapacityReservationResponse
readList :: ReadS [GetGroupsForCapacityReservationResponse]
$creadList :: ReadS [GetGroupsForCapacityReservationResponse]
readsPrec :: Int -> ReadS GetGroupsForCapacityReservationResponse
$creadsPrec :: Int -> ReadS GetGroupsForCapacityReservationResponse
Prelude.Read, Int -> GetGroupsForCapacityReservationResponse -> ShowS
[GetGroupsForCapacityReservationResponse] -> ShowS
GetGroupsForCapacityReservationResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetGroupsForCapacityReservationResponse] -> ShowS
$cshowList :: [GetGroupsForCapacityReservationResponse] -> ShowS
show :: GetGroupsForCapacityReservationResponse -> String
$cshow :: GetGroupsForCapacityReservationResponse -> String
showsPrec :: Int -> GetGroupsForCapacityReservationResponse -> ShowS
$cshowsPrec :: Int -> GetGroupsForCapacityReservationResponse -> ShowS
Prelude.Show, forall x.
Rep GetGroupsForCapacityReservationResponse x
-> GetGroupsForCapacityReservationResponse
forall x.
GetGroupsForCapacityReservationResponse
-> Rep GetGroupsForCapacityReservationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetGroupsForCapacityReservationResponse x
-> GetGroupsForCapacityReservationResponse
$cfrom :: forall x.
GetGroupsForCapacityReservationResponse
-> Rep GetGroupsForCapacityReservationResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetGroupsForCapacityReservationResponse' 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:
--
-- 'capacityReservationGroups', 'getGroupsForCapacityReservationResponse_capacityReservationGroups' - Information about the resource groups to which the Capacity Reservation
-- has been added.
--
-- 'nextToken', 'getGroupsForCapacityReservationResponse_nextToken' - The token to use to retrieve the next page of results. This value is
-- @null@ when there are no more results to return.
--
-- 'httpStatus', 'getGroupsForCapacityReservationResponse_httpStatus' - The response's http status code.
newGetGroupsForCapacityReservationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetGroupsForCapacityReservationResponse
newGetGroupsForCapacityReservationResponse :: Int -> GetGroupsForCapacityReservationResponse
newGetGroupsForCapacityReservationResponse
  Int
pHttpStatus_ =
    GetGroupsForCapacityReservationResponse'
      { $sel:capacityReservationGroups:GetGroupsForCapacityReservationResponse' :: Maybe [CapacityReservationGroup]
capacityReservationGroups =
          forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:GetGroupsForCapacityReservationResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:GetGroupsForCapacityReservationResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | Information about the resource groups to which the Capacity Reservation
-- has been added.
getGroupsForCapacityReservationResponse_capacityReservationGroups :: Lens.Lens' GetGroupsForCapacityReservationResponse (Prelude.Maybe [CapacityReservationGroup])
getGroupsForCapacityReservationResponse_capacityReservationGroups :: Lens'
  GetGroupsForCapacityReservationResponse
  (Maybe [CapacityReservationGroup])
getGroupsForCapacityReservationResponse_capacityReservationGroups = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGroupsForCapacityReservationResponse' {Maybe [CapacityReservationGroup]
capacityReservationGroups :: Maybe [CapacityReservationGroup]
$sel:capacityReservationGroups:GetGroupsForCapacityReservationResponse' :: GetGroupsForCapacityReservationResponse
-> Maybe [CapacityReservationGroup]
capacityReservationGroups} -> Maybe [CapacityReservationGroup]
capacityReservationGroups) (\s :: GetGroupsForCapacityReservationResponse
s@GetGroupsForCapacityReservationResponse' {} Maybe [CapacityReservationGroup]
a -> GetGroupsForCapacityReservationResponse
s {$sel:capacityReservationGroups:GetGroupsForCapacityReservationResponse' :: Maybe [CapacityReservationGroup]
capacityReservationGroups = Maybe [CapacityReservationGroup]
a} :: GetGroupsForCapacityReservationResponse) 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 use to retrieve the next page of results. This value is
-- @null@ when there are no more results to return.
getGroupsForCapacityReservationResponse_nextToken :: Lens.Lens' GetGroupsForCapacityReservationResponse (Prelude.Maybe Prelude.Text)
getGroupsForCapacityReservationResponse_nextToken :: Lens' GetGroupsForCapacityReservationResponse (Maybe Text)
getGroupsForCapacityReservationResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetGroupsForCapacityReservationResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetGroupsForCapacityReservationResponse' :: GetGroupsForCapacityReservationResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetGroupsForCapacityReservationResponse
s@GetGroupsForCapacityReservationResponse' {} Maybe Text
a -> GetGroupsForCapacityReservationResponse
s {$sel:nextToken:GetGroupsForCapacityReservationResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetGroupsForCapacityReservationResponse)

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

instance
  Prelude.NFData
    GetGroupsForCapacityReservationResponse
  where
  rnf :: GetGroupsForCapacityReservationResponse -> ()
rnf GetGroupsForCapacityReservationResponse' {Int
Maybe [CapacityReservationGroup]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
capacityReservationGroups :: Maybe [CapacityReservationGroup]
$sel:httpStatus:GetGroupsForCapacityReservationResponse' :: GetGroupsForCapacityReservationResponse -> Int
$sel:nextToken:GetGroupsForCapacityReservationResponse' :: GetGroupsForCapacityReservationResponse -> Maybe Text
$sel:capacityReservationGroups:GetGroupsForCapacityReservationResponse' :: GetGroupsForCapacityReservationResponse
-> Maybe [CapacityReservationGroup]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [CapacityReservationGroup]
capacityReservationGroups
      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