{-# 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.WorkSpaces.DescribeWorkspaceBundles
-- 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)
--
-- Retrieves a list that describes the available WorkSpace bundles.
--
-- You can filter the results using either bundle ID or owner, but not
-- both.
--
-- This operation returns paginated results.
module Amazonka.WorkSpaces.DescribeWorkspaceBundles
  ( -- * Creating a Request
    DescribeWorkspaceBundles (..),
    newDescribeWorkspaceBundles,

    -- * Request Lenses
    describeWorkspaceBundles_bundleIds,
    describeWorkspaceBundles_owner,
    describeWorkspaceBundles_nextToken,

    -- * Destructuring the Response
    DescribeWorkspaceBundlesResponse (..),
    newDescribeWorkspaceBundlesResponse,

    -- * Response Lenses
    describeWorkspaceBundlesResponse_bundles,
    describeWorkspaceBundlesResponse_nextToken,
    describeWorkspaceBundlesResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.WorkSpaces.Types

-- | /See:/ 'newDescribeWorkspaceBundles' smart constructor.
data DescribeWorkspaceBundles = DescribeWorkspaceBundles'
  { -- | The identifiers of the bundles. You cannot combine this parameter with
    -- any other filter.
    DescribeWorkspaceBundles -> Maybe (NonEmpty Text)
bundleIds :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | The owner of the bundles. You cannot combine this parameter with any
    -- other filter.
    --
    -- To describe the bundles provided by Amazon Web Services, specify
    -- @AMAZON@. To describe the bundles that belong to your account, don\'t
    -- specify a value.
    DescribeWorkspaceBundles -> Maybe Text
owner :: Prelude.Maybe Prelude.Text,
    -- | The token for the next set of results. (You received this token from a
    -- previous call.)
    DescribeWorkspaceBundles -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
  }
  deriving (DescribeWorkspaceBundles -> DescribeWorkspaceBundles -> Bool
(DescribeWorkspaceBundles -> DescribeWorkspaceBundles -> Bool)
-> (DescribeWorkspaceBundles -> DescribeWorkspaceBundles -> Bool)
-> Eq DescribeWorkspaceBundles
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeWorkspaceBundles -> DescribeWorkspaceBundles -> Bool
$c/= :: DescribeWorkspaceBundles -> DescribeWorkspaceBundles -> Bool
== :: DescribeWorkspaceBundles -> DescribeWorkspaceBundles -> Bool
$c== :: DescribeWorkspaceBundles -> DescribeWorkspaceBundles -> Bool
Prelude.Eq, ReadPrec [DescribeWorkspaceBundles]
ReadPrec DescribeWorkspaceBundles
Int -> ReadS DescribeWorkspaceBundles
ReadS [DescribeWorkspaceBundles]
(Int -> ReadS DescribeWorkspaceBundles)
-> ReadS [DescribeWorkspaceBundles]
-> ReadPrec DescribeWorkspaceBundles
-> ReadPrec [DescribeWorkspaceBundles]
-> Read DescribeWorkspaceBundles
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeWorkspaceBundles]
$creadListPrec :: ReadPrec [DescribeWorkspaceBundles]
readPrec :: ReadPrec DescribeWorkspaceBundles
$creadPrec :: ReadPrec DescribeWorkspaceBundles
readList :: ReadS [DescribeWorkspaceBundles]
$creadList :: ReadS [DescribeWorkspaceBundles]
readsPrec :: Int -> ReadS DescribeWorkspaceBundles
$creadsPrec :: Int -> ReadS DescribeWorkspaceBundles
Prelude.Read, Int -> DescribeWorkspaceBundles -> ShowS
[DescribeWorkspaceBundles] -> ShowS
DescribeWorkspaceBundles -> String
(Int -> DescribeWorkspaceBundles -> ShowS)
-> (DescribeWorkspaceBundles -> String)
-> ([DescribeWorkspaceBundles] -> ShowS)
-> Show DescribeWorkspaceBundles
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeWorkspaceBundles] -> ShowS
$cshowList :: [DescribeWorkspaceBundles] -> ShowS
show :: DescribeWorkspaceBundles -> String
$cshow :: DescribeWorkspaceBundles -> String
showsPrec :: Int -> DescribeWorkspaceBundles -> ShowS
$cshowsPrec :: Int -> DescribeWorkspaceBundles -> ShowS
Prelude.Show, (forall x.
 DescribeWorkspaceBundles -> Rep DescribeWorkspaceBundles x)
-> (forall x.
    Rep DescribeWorkspaceBundles x -> DescribeWorkspaceBundles)
-> Generic DescribeWorkspaceBundles
forall x.
Rep DescribeWorkspaceBundles x -> DescribeWorkspaceBundles
forall x.
DescribeWorkspaceBundles -> Rep DescribeWorkspaceBundles x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeWorkspaceBundles x -> DescribeWorkspaceBundles
$cfrom :: forall x.
DescribeWorkspaceBundles -> Rep DescribeWorkspaceBundles x
Prelude.Generic)

-- |
-- Create a value of 'DescribeWorkspaceBundles' 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:
--
-- 'bundleIds', 'describeWorkspaceBundles_bundleIds' - The identifiers of the bundles. You cannot combine this parameter with
-- any other filter.
--
-- 'owner', 'describeWorkspaceBundles_owner' - The owner of the bundles. You cannot combine this parameter with any
-- other filter.
--
-- To describe the bundles provided by Amazon Web Services, specify
-- @AMAZON@. To describe the bundles that belong to your account, don\'t
-- specify a value.
--
-- 'nextToken', 'describeWorkspaceBundles_nextToken' - The token for the next set of results. (You received this token from a
-- previous call.)
newDescribeWorkspaceBundles ::
  DescribeWorkspaceBundles
newDescribeWorkspaceBundles :: DescribeWorkspaceBundles
newDescribeWorkspaceBundles =
  DescribeWorkspaceBundles' :: Maybe (NonEmpty Text)
-> Maybe Text -> Maybe Text -> DescribeWorkspaceBundles
DescribeWorkspaceBundles'
    { $sel:bundleIds:DescribeWorkspaceBundles' :: Maybe (NonEmpty Text)
bundleIds =
        Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:owner:DescribeWorkspaceBundles' :: Maybe Text
owner = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeWorkspaceBundles' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The identifiers of the bundles. You cannot combine this parameter with
-- any other filter.
describeWorkspaceBundles_bundleIds :: Lens.Lens' DescribeWorkspaceBundles (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
describeWorkspaceBundles_bundleIds :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> DescribeWorkspaceBundles -> f DescribeWorkspaceBundles
describeWorkspaceBundles_bundleIds = (DescribeWorkspaceBundles -> Maybe (NonEmpty Text))
-> (DescribeWorkspaceBundles
    -> Maybe (NonEmpty Text) -> DescribeWorkspaceBundles)
-> Lens
     DescribeWorkspaceBundles
     DescribeWorkspaceBundles
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeWorkspaceBundles' {Maybe (NonEmpty Text)
bundleIds :: Maybe (NonEmpty Text)
$sel:bundleIds:DescribeWorkspaceBundles' :: DescribeWorkspaceBundles -> Maybe (NonEmpty Text)
bundleIds} -> Maybe (NonEmpty Text)
bundleIds) (\s :: DescribeWorkspaceBundles
s@DescribeWorkspaceBundles' {} Maybe (NonEmpty Text)
a -> DescribeWorkspaceBundles
s {$sel:bundleIds:DescribeWorkspaceBundles' :: Maybe (NonEmpty Text)
bundleIds = Maybe (NonEmpty Text)
a} :: DescribeWorkspaceBundles) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> DescribeWorkspaceBundles -> f DescribeWorkspaceBundles)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> DescribeWorkspaceBundles
-> f DescribeWorkspaceBundles
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty 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
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The owner of the bundles. You cannot combine this parameter with any
-- other filter.
--
-- To describe the bundles provided by Amazon Web Services, specify
-- @AMAZON@. To describe the bundles that belong to your account, don\'t
-- specify a value.
describeWorkspaceBundles_owner :: Lens.Lens' DescribeWorkspaceBundles (Prelude.Maybe Prelude.Text)
describeWorkspaceBundles_owner :: (Maybe Text -> f (Maybe Text))
-> DescribeWorkspaceBundles -> f DescribeWorkspaceBundles
describeWorkspaceBundles_owner = (DescribeWorkspaceBundles -> Maybe Text)
-> (DescribeWorkspaceBundles
    -> Maybe Text -> DescribeWorkspaceBundles)
-> Lens
     DescribeWorkspaceBundles
     DescribeWorkspaceBundles
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeWorkspaceBundles' {Maybe Text
owner :: Maybe Text
$sel:owner:DescribeWorkspaceBundles' :: DescribeWorkspaceBundles -> Maybe Text
owner} -> Maybe Text
owner) (\s :: DescribeWorkspaceBundles
s@DescribeWorkspaceBundles' {} Maybe Text
a -> DescribeWorkspaceBundles
s {$sel:owner:DescribeWorkspaceBundles' :: Maybe Text
owner = Maybe Text
a} :: DescribeWorkspaceBundles)

-- | The token for the next set of results. (You received this token from a
-- previous call.)
describeWorkspaceBundles_nextToken :: Lens.Lens' DescribeWorkspaceBundles (Prelude.Maybe Prelude.Text)
describeWorkspaceBundles_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeWorkspaceBundles -> f DescribeWorkspaceBundles
describeWorkspaceBundles_nextToken = (DescribeWorkspaceBundles -> Maybe Text)
-> (DescribeWorkspaceBundles
    -> Maybe Text -> DescribeWorkspaceBundles)
-> Lens
     DescribeWorkspaceBundles
     DescribeWorkspaceBundles
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeWorkspaceBundles' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeWorkspaceBundles' :: DescribeWorkspaceBundles -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeWorkspaceBundles
s@DescribeWorkspaceBundles' {} Maybe Text
a -> DescribeWorkspaceBundles
s {$sel:nextToken:DescribeWorkspaceBundles' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeWorkspaceBundles)

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

instance Prelude.NFData DescribeWorkspaceBundles

instance Core.ToHeaders DescribeWorkspaceBundles where
  toHeaders :: DescribeWorkspaceBundles -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeWorkspaceBundles -> 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
"WorkspacesService.DescribeWorkspaceBundles" ::
                          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 DescribeWorkspaceBundles where
  toJSON :: DescribeWorkspaceBundles -> Value
toJSON DescribeWorkspaceBundles' {Maybe (NonEmpty Text)
Maybe Text
nextToken :: Maybe Text
owner :: Maybe Text
bundleIds :: Maybe (NonEmpty Text)
$sel:nextToken:DescribeWorkspaceBundles' :: DescribeWorkspaceBundles -> Maybe Text
$sel:owner:DescribeWorkspaceBundles' :: DescribeWorkspaceBundles -> Maybe Text
$sel:bundleIds:DescribeWorkspaceBundles' :: DescribeWorkspaceBundles -> Maybe (NonEmpty Text)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"BundleIds" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty Text -> Pair) -> Maybe (NonEmpty Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
bundleIds,
            (Text
"Owner" 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
owner,
            (Text
"NextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken
          ]
      )

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

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

-- | /See:/ 'newDescribeWorkspaceBundlesResponse' smart constructor.
data DescribeWorkspaceBundlesResponse = DescribeWorkspaceBundlesResponse'
  { -- | Information about the bundles.
    DescribeWorkspaceBundlesResponse -> Maybe [WorkspaceBundle]
bundles :: Prelude.Maybe [WorkspaceBundle],
    -- | The token to use to retrieve the next page of results. This value is
    -- null when there are no more results to return. This token is valid for
    -- one day and must be used within that time frame.
    DescribeWorkspaceBundlesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeWorkspaceBundlesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeWorkspaceBundlesResponse
-> DescribeWorkspaceBundlesResponse -> Bool
(DescribeWorkspaceBundlesResponse
 -> DescribeWorkspaceBundlesResponse -> Bool)
-> (DescribeWorkspaceBundlesResponse
    -> DescribeWorkspaceBundlesResponse -> Bool)
-> Eq DescribeWorkspaceBundlesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeWorkspaceBundlesResponse
-> DescribeWorkspaceBundlesResponse -> Bool
$c/= :: DescribeWorkspaceBundlesResponse
-> DescribeWorkspaceBundlesResponse -> Bool
== :: DescribeWorkspaceBundlesResponse
-> DescribeWorkspaceBundlesResponse -> Bool
$c== :: DescribeWorkspaceBundlesResponse
-> DescribeWorkspaceBundlesResponse -> Bool
Prelude.Eq, ReadPrec [DescribeWorkspaceBundlesResponse]
ReadPrec DescribeWorkspaceBundlesResponse
Int -> ReadS DescribeWorkspaceBundlesResponse
ReadS [DescribeWorkspaceBundlesResponse]
(Int -> ReadS DescribeWorkspaceBundlesResponse)
-> ReadS [DescribeWorkspaceBundlesResponse]
-> ReadPrec DescribeWorkspaceBundlesResponse
-> ReadPrec [DescribeWorkspaceBundlesResponse]
-> Read DescribeWorkspaceBundlesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeWorkspaceBundlesResponse]
$creadListPrec :: ReadPrec [DescribeWorkspaceBundlesResponse]
readPrec :: ReadPrec DescribeWorkspaceBundlesResponse
$creadPrec :: ReadPrec DescribeWorkspaceBundlesResponse
readList :: ReadS [DescribeWorkspaceBundlesResponse]
$creadList :: ReadS [DescribeWorkspaceBundlesResponse]
readsPrec :: Int -> ReadS DescribeWorkspaceBundlesResponse
$creadsPrec :: Int -> ReadS DescribeWorkspaceBundlesResponse
Prelude.Read, Int -> DescribeWorkspaceBundlesResponse -> ShowS
[DescribeWorkspaceBundlesResponse] -> ShowS
DescribeWorkspaceBundlesResponse -> String
(Int -> DescribeWorkspaceBundlesResponse -> ShowS)
-> (DescribeWorkspaceBundlesResponse -> String)
-> ([DescribeWorkspaceBundlesResponse] -> ShowS)
-> Show DescribeWorkspaceBundlesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeWorkspaceBundlesResponse] -> ShowS
$cshowList :: [DescribeWorkspaceBundlesResponse] -> ShowS
show :: DescribeWorkspaceBundlesResponse -> String
$cshow :: DescribeWorkspaceBundlesResponse -> String
showsPrec :: Int -> DescribeWorkspaceBundlesResponse -> ShowS
$cshowsPrec :: Int -> DescribeWorkspaceBundlesResponse -> ShowS
Prelude.Show, (forall x.
 DescribeWorkspaceBundlesResponse
 -> Rep DescribeWorkspaceBundlesResponse x)
-> (forall x.
    Rep DescribeWorkspaceBundlesResponse x
    -> DescribeWorkspaceBundlesResponse)
-> Generic DescribeWorkspaceBundlesResponse
forall x.
Rep DescribeWorkspaceBundlesResponse x
-> DescribeWorkspaceBundlesResponse
forall x.
DescribeWorkspaceBundlesResponse
-> Rep DescribeWorkspaceBundlesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeWorkspaceBundlesResponse x
-> DescribeWorkspaceBundlesResponse
$cfrom :: forall x.
DescribeWorkspaceBundlesResponse
-> Rep DescribeWorkspaceBundlesResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeWorkspaceBundlesResponse' 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:
--
-- 'bundles', 'describeWorkspaceBundlesResponse_bundles' - Information about the bundles.
--
-- 'nextToken', 'describeWorkspaceBundlesResponse_nextToken' - The token to use to retrieve the next page of results. This value is
-- null when there are no more results to return. This token is valid for
-- one day and must be used within that time frame.
--
-- 'httpStatus', 'describeWorkspaceBundlesResponse_httpStatus' - The response's http status code.
newDescribeWorkspaceBundlesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeWorkspaceBundlesResponse
newDescribeWorkspaceBundlesResponse :: Int -> DescribeWorkspaceBundlesResponse
newDescribeWorkspaceBundlesResponse Int
pHttpStatus_ =
  DescribeWorkspaceBundlesResponse' :: Maybe [WorkspaceBundle]
-> Maybe Text -> Int -> DescribeWorkspaceBundlesResponse
DescribeWorkspaceBundlesResponse'
    { $sel:bundles:DescribeWorkspaceBundlesResponse' :: Maybe [WorkspaceBundle]
bundles =
        Maybe [WorkspaceBundle]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeWorkspaceBundlesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeWorkspaceBundlesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the bundles.
describeWorkspaceBundlesResponse_bundles :: Lens.Lens' DescribeWorkspaceBundlesResponse (Prelude.Maybe [WorkspaceBundle])
describeWorkspaceBundlesResponse_bundles :: (Maybe [WorkspaceBundle] -> f (Maybe [WorkspaceBundle]))
-> DescribeWorkspaceBundlesResponse
-> f DescribeWorkspaceBundlesResponse
describeWorkspaceBundlesResponse_bundles = (DescribeWorkspaceBundlesResponse -> Maybe [WorkspaceBundle])
-> (DescribeWorkspaceBundlesResponse
    -> Maybe [WorkspaceBundle] -> DescribeWorkspaceBundlesResponse)
-> Lens' DescribeWorkspaceBundlesResponse (Maybe [WorkspaceBundle])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeWorkspaceBundlesResponse' {Maybe [WorkspaceBundle]
bundles :: Maybe [WorkspaceBundle]
$sel:bundles:DescribeWorkspaceBundlesResponse' :: DescribeWorkspaceBundlesResponse -> Maybe [WorkspaceBundle]
bundles} -> Maybe [WorkspaceBundle]
bundles) (\s :: DescribeWorkspaceBundlesResponse
s@DescribeWorkspaceBundlesResponse' {} Maybe [WorkspaceBundle]
a -> DescribeWorkspaceBundlesResponse
s {$sel:bundles:DescribeWorkspaceBundlesResponse' :: Maybe [WorkspaceBundle]
bundles = Maybe [WorkspaceBundle]
a} :: DescribeWorkspaceBundlesResponse) ((Maybe [WorkspaceBundle] -> f (Maybe [WorkspaceBundle]))
 -> DescribeWorkspaceBundlesResponse
 -> f DescribeWorkspaceBundlesResponse)
-> ((Maybe [WorkspaceBundle] -> f (Maybe [WorkspaceBundle]))
    -> Maybe [WorkspaceBundle] -> f (Maybe [WorkspaceBundle]))
-> (Maybe [WorkspaceBundle] -> f (Maybe [WorkspaceBundle]))
-> DescribeWorkspaceBundlesResponse
-> f DescribeWorkspaceBundlesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [WorkspaceBundle]
  [WorkspaceBundle]
  [WorkspaceBundle]
  [WorkspaceBundle]
-> Iso
     (Maybe [WorkspaceBundle])
     (Maybe [WorkspaceBundle])
     (Maybe [WorkspaceBundle])
     (Maybe [WorkspaceBundle])
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
  [WorkspaceBundle]
  [WorkspaceBundle]
  [WorkspaceBundle]
  [WorkspaceBundle]
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. This token is valid for
-- one day and must be used within that time frame.
describeWorkspaceBundlesResponse_nextToken :: Lens.Lens' DescribeWorkspaceBundlesResponse (Prelude.Maybe Prelude.Text)
describeWorkspaceBundlesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeWorkspaceBundlesResponse
-> f DescribeWorkspaceBundlesResponse
describeWorkspaceBundlesResponse_nextToken = (DescribeWorkspaceBundlesResponse -> Maybe Text)
-> (DescribeWorkspaceBundlesResponse
    -> Maybe Text -> DescribeWorkspaceBundlesResponse)
-> Lens' DescribeWorkspaceBundlesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeWorkspaceBundlesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeWorkspaceBundlesResponse' :: DescribeWorkspaceBundlesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeWorkspaceBundlesResponse
s@DescribeWorkspaceBundlesResponse' {} Maybe Text
a -> DescribeWorkspaceBundlesResponse
s {$sel:nextToken:DescribeWorkspaceBundlesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeWorkspaceBundlesResponse)

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

instance
  Prelude.NFData
    DescribeWorkspaceBundlesResponse