{-# 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.DescribeWorkspaceImages
-- 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 one or more specified images, if the
-- image identifiers are provided. Otherwise, all images in the account are
-- described.
--
-- This operation returns paginated results.
module Amazonka.WorkSpaces.DescribeWorkspaceImages
  ( -- * Creating a Request
    DescribeWorkspaceImages (..),
    newDescribeWorkspaceImages,

    -- * Request Lenses
    describeWorkspaceImages_imageIds,
    describeWorkspaceImages_nextToken,
    describeWorkspaceImages_imageType,
    describeWorkspaceImages_maxResults,

    -- * Destructuring the Response
    DescribeWorkspaceImagesResponse (..),
    newDescribeWorkspaceImagesResponse,

    -- * Response Lenses
    describeWorkspaceImagesResponse_images,
    describeWorkspaceImagesResponse_nextToken,
    describeWorkspaceImagesResponse_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:/ 'newDescribeWorkspaceImages' smart constructor.
data DescribeWorkspaceImages = DescribeWorkspaceImages'
  { -- | The identifier of the image.
    DescribeWorkspaceImages -> Maybe (NonEmpty Text)
imageIds :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | If you received a @NextToken@ from a previous call that was paginated,
    -- provide this token to receive the next set of results.
    DescribeWorkspaceImages -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The type (owned or shared) of the image.
    DescribeWorkspaceImages -> Maybe ImageType
imageType :: Prelude.Maybe ImageType,
    -- | The maximum number of items to return.
    DescribeWorkspaceImages -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (DescribeWorkspaceImages -> DescribeWorkspaceImages -> Bool
(DescribeWorkspaceImages -> DescribeWorkspaceImages -> Bool)
-> (DescribeWorkspaceImages -> DescribeWorkspaceImages -> Bool)
-> Eq DescribeWorkspaceImages
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeWorkspaceImages -> DescribeWorkspaceImages -> Bool
$c/= :: DescribeWorkspaceImages -> DescribeWorkspaceImages -> Bool
== :: DescribeWorkspaceImages -> DescribeWorkspaceImages -> Bool
$c== :: DescribeWorkspaceImages -> DescribeWorkspaceImages -> Bool
Prelude.Eq, ReadPrec [DescribeWorkspaceImages]
ReadPrec DescribeWorkspaceImages
Int -> ReadS DescribeWorkspaceImages
ReadS [DescribeWorkspaceImages]
(Int -> ReadS DescribeWorkspaceImages)
-> ReadS [DescribeWorkspaceImages]
-> ReadPrec DescribeWorkspaceImages
-> ReadPrec [DescribeWorkspaceImages]
-> Read DescribeWorkspaceImages
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeWorkspaceImages]
$creadListPrec :: ReadPrec [DescribeWorkspaceImages]
readPrec :: ReadPrec DescribeWorkspaceImages
$creadPrec :: ReadPrec DescribeWorkspaceImages
readList :: ReadS [DescribeWorkspaceImages]
$creadList :: ReadS [DescribeWorkspaceImages]
readsPrec :: Int -> ReadS DescribeWorkspaceImages
$creadsPrec :: Int -> ReadS DescribeWorkspaceImages
Prelude.Read, Int -> DescribeWorkspaceImages -> ShowS
[DescribeWorkspaceImages] -> ShowS
DescribeWorkspaceImages -> String
(Int -> DescribeWorkspaceImages -> ShowS)
-> (DescribeWorkspaceImages -> String)
-> ([DescribeWorkspaceImages] -> ShowS)
-> Show DescribeWorkspaceImages
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeWorkspaceImages] -> ShowS
$cshowList :: [DescribeWorkspaceImages] -> ShowS
show :: DescribeWorkspaceImages -> String
$cshow :: DescribeWorkspaceImages -> String
showsPrec :: Int -> DescribeWorkspaceImages -> ShowS
$cshowsPrec :: Int -> DescribeWorkspaceImages -> ShowS
Prelude.Show, (forall x.
 DescribeWorkspaceImages -> Rep DescribeWorkspaceImages x)
-> (forall x.
    Rep DescribeWorkspaceImages x -> DescribeWorkspaceImages)
-> Generic DescribeWorkspaceImages
forall x. Rep DescribeWorkspaceImages x -> DescribeWorkspaceImages
forall x. DescribeWorkspaceImages -> Rep DescribeWorkspaceImages x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeWorkspaceImages x -> DescribeWorkspaceImages
$cfrom :: forall x. DescribeWorkspaceImages -> Rep DescribeWorkspaceImages x
Prelude.Generic)

-- |
-- Create a value of 'DescribeWorkspaceImages' 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:
--
-- 'imageIds', 'describeWorkspaceImages_imageIds' - The identifier of the image.
--
-- 'nextToken', 'describeWorkspaceImages_nextToken' - If you received a @NextToken@ from a previous call that was paginated,
-- provide this token to receive the next set of results.
--
-- 'imageType', 'describeWorkspaceImages_imageType' - The type (owned or shared) of the image.
--
-- 'maxResults', 'describeWorkspaceImages_maxResults' - The maximum number of items to return.
newDescribeWorkspaceImages ::
  DescribeWorkspaceImages
newDescribeWorkspaceImages :: DescribeWorkspaceImages
newDescribeWorkspaceImages =
  DescribeWorkspaceImages' :: Maybe (NonEmpty Text)
-> Maybe Text
-> Maybe ImageType
-> Maybe Natural
-> DescribeWorkspaceImages
DescribeWorkspaceImages'
    { $sel:imageIds:DescribeWorkspaceImages' :: Maybe (NonEmpty Text)
imageIds =
        Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeWorkspaceImages' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:imageType:DescribeWorkspaceImages' :: Maybe ImageType
imageType = Maybe ImageType
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeWorkspaceImages' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The identifier of the image.
describeWorkspaceImages_imageIds :: Lens.Lens' DescribeWorkspaceImages (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
describeWorkspaceImages_imageIds :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> DescribeWorkspaceImages -> f DescribeWorkspaceImages
describeWorkspaceImages_imageIds = (DescribeWorkspaceImages -> Maybe (NonEmpty Text))
-> (DescribeWorkspaceImages
    -> Maybe (NonEmpty Text) -> DescribeWorkspaceImages)
-> Lens
     DescribeWorkspaceImages
     DescribeWorkspaceImages
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeWorkspaceImages' {Maybe (NonEmpty Text)
imageIds :: Maybe (NonEmpty Text)
$sel:imageIds:DescribeWorkspaceImages' :: DescribeWorkspaceImages -> Maybe (NonEmpty Text)
imageIds} -> Maybe (NonEmpty Text)
imageIds) (\s :: DescribeWorkspaceImages
s@DescribeWorkspaceImages' {} Maybe (NonEmpty Text)
a -> DescribeWorkspaceImages
s {$sel:imageIds:DescribeWorkspaceImages' :: Maybe (NonEmpty Text)
imageIds = Maybe (NonEmpty Text)
a} :: DescribeWorkspaceImages) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> DescribeWorkspaceImages -> f DescribeWorkspaceImages)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> DescribeWorkspaceImages
-> f DescribeWorkspaceImages
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

-- | If you received a @NextToken@ from a previous call that was paginated,
-- provide this token to receive the next set of results.
describeWorkspaceImages_nextToken :: Lens.Lens' DescribeWorkspaceImages (Prelude.Maybe Prelude.Text)
describeWorkspaceImages_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeWorkspaceImages -> f DescribeWorkspaceImages
describeWorkspaceImages_nextToken = (DescribeWorkspaceImages -> Maybe Text)
-> (DescribeWorkspaceImages
    -> Maybe Text -> DescribeWorkspaceImages)
-> Lens
     DescribeWorkspaceImages
     DescribeWorkspaceImages
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeWorkspaceImages' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeWorkspaceImages' :: DescribeWorkspaceImages -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeWorkspaceImages
s@DescribeWorkspaceImages' {} Maybe Text
a -> DescribeWorkspaceImages
s {$sel:nextToken:DescribeWorkspaceImages' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeWorkspaceImages)

-- | The type (owned or shared) of the image.
describeWorkspaceImages_imageType :: Lens.Lens' DescribeWorkspaceImages (Prelude.Maybe ImageType)
describeWorkspaceImages_imageType :: (Maybe ImageType -> f (Maybe ImageType))
-> DescribeWorkspaceImages -> f DescribeWorkspaceImages
describeWorkspaceImages_imageType = (DescribeWorkspaceImages -> Maybe ImageType)
-> (DescribeWorkspaceImages
    -> Maybe ImageType -> DescribeWorkspaceImages)
-> Lens
     DescribeWorkspaceImages
     DescribeWorkspaceImages
     (Maybe ImageType)
     (Maybe ImageType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeWorkspaceImages' {Maybe ImageType
imageType :: Maybe ImageType
$sel:imageType:DescribeWorkspaceImages' :: DescribeWorkspaceImages -> Maybe ImageType
imageType} -> Maybe ImageType
imageType) (\s :: DescribeWorkspaceImages
s@DescribeWorkspaceImages' {} Maybe ImageType
a -> DescribeWorkspaceImages
s {$sel:imageType:DescribeWorkspaceImages' :: Maybe ImageType
imageType = Maybe ImageType
a} :: DescribeWorkspaceImages)

-- | The maximum number of items to return.
describeWorkspaceImages_maxResults :: Lens.Lens' DescribeWorkspaceImages (Prelude.Maybe Prelude.Natural)
describeWorkspaceImages_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> DescribeWorkspaceImages -> f DescribeWorkspaceImages
describeWorkspaceImages_maxResults = (DescribeWorkspaceImages -> Maybe Natural)
-> (DescribeWorkspaceImages
    -> Maybe Natural -> DescribeWorkspaceImages)
-> Lens
     DescribeWorkspaceImages
     DescribeWorkspaceImages
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeWorkspaceImages' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:DescribeWorkspaceImages' :: DescribeWorkspaceImages -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: DescribeWorkspaceImages
s@DescribeWorkspaceImages' {} Maybe Natural
a -> DescribeWorkspaceImages
s {$sel:maxResults:DescribeWorkspaceImages' :: Maybe Natural
maxResults = Maybe Natural
a} :: DescribeWorkspaceImages)

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

instance Prelude.NFData DescribeWorkspaceImages

instance Core.ToHeaders DescribeWorkspaceImages where
  toHeaders :: DescribeWorkspaceImages -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeWorkspaceImages -> 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.DescribeWorkspaceImages" ::
                          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 DescribeWorkspaceImages where
  toJSON :: DescribeWorkspaceImages -> Value
toJSON DescribeWorkspaceImages' {Maybe Natural
Maybe (NonEmpty Text)
Maybe Text
Maybe ImageType
maxResults :: Maybe Natural
imageType :: Maybe ImageType
nextToken :: Maybe Text
imageIds :: Maybe (NonEmpty Text)
$sel:maxResults:DescribeWorkspaceImages' :: DescribeWorkspaceImages -> Maybe Natural
$sel:imageType:DescribeWorkspaceImages' :: DescribeWorkspaceImages -> Maybe ImageType
$sel:nextToken:DescribeWorkspaceImages' :: DescribeWorkspaceImages -> Maybe Text
$sel:imageIds:DescribeWorkspaceImages' :: DescribeWorkspaceImages -> Maybe (NonEmpty Text)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ImageIds" 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)
imageIds,
            (Text
"NextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Text
"ImageType" Text -> ImageType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ImageType -> Pair) -> Maybe ImageType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ImageType
imageType,
            (Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults
          ]
      )

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

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

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

-- |
-- Create a value of 'DescribeWorkspaceImagesResponse' 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:
--
-- 'images', 'describeWorkspaceImagesResponse_images' - Information about the images.
--
-- 'nextToken', 'describeWorkspaceImagesResponse_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', 'describeWorkspaceImagesResponse_httpStatus' - The response's http status code.
newDescribeWorkspaceImagesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeWorkspaceImagesResponse
newDescribeWorkspaceImagesResponse :: Int -> DescribeWorkspaceImagesResponse
newDescribeWorkspaceImagesResponse Int
pHttpStatus_ =
  DescribeWorkspaceImagesResponse' :: Maybe [WorkspaceImage]
-> Maybe Text -> Int -> DescribeWorkspaceImagesResponse
DescribeWorkspaceImagesResponse'
    { $sel:images:DescribeWorkspaceImagesResponse' :: Maybe [WorkspaceImage]
images =
        Maybe [WorkspaceImage]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeWorkspaceImagesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeWorkspaceImagesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the images.
describeWorkspaceImagesResponse_images :: Lens.Lens' DescribeWorkspaceImagesResponse (Prelude.Maybe [WorkspaceImage])
describeWorkspaceImagesResponse_images :: (Maybe [WorkspaceImage] -> f (Maybe [WorkspaceImage]))
-> DescribeWorkspaceImagesResponse
-> f DescribeWorkspaceImagesResponse
describeWorkspaceImagesResponse_images = (DescribeWorkspaceImagesResponse -> Maybe [WorkspaceImage])
-> (DescribeWorkspaceImagesResponse
    -> Maybe [WorkspaceImage] -> DescribeWorkspaceImagesResponse)
-> Lens' DescribeWorkspaceImagesResponse (Maybe [WorkspaceImage])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeWorkspaceImagesResponse' {Maybe [WorkspaceImage]
images :: Maybe [WorkspaceImage]
$sel:images:DescribeWorkspaceImagesResponse' :: DescribeWorkspaceImagesResponse -> Maybe [WorkspaceImage]
images} -> Maybe [WorkspaceImage]
images) (\s :: DescribeWorkspaceImagesResponse
s@DescribeWorkspaceImagesResponse' {} Maybe [WorkspaceImage]
a -> DescribeWorkspaceImagesResponse
s {$sel:images:DescribeWorkspaceImagesResponse' :: Maybe [WorkspaceImage]
images = Maybe [WorkspaceImage]
a} :: DescribeWorkspaceImagesResponse) ((Maybe [WorkspaceImage] -> f (Maybe [WorkspaceImage]))
 -> DescribeWorkspaceImagesResponse
 -> f DescribeWorkspaceImagesResponse)
-> ((Maybe [WorkspaceImage] -> f (Maybe [WorkspaceImage]))
    -> Maybe [WorkspaceImage] -> f (Maybe [WorkspaceImage]))
-> (Maybe [WorkspaceImage] -> f (Maybe [WorkspaceImage]))
-> DescribeWorkspaceImagesResponse
-> f DescribeWorkspaceImagesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [WorkspaceImage] [WorkspaceImage] [WorkspaceImage] [WorkspaceImage]
-> Iso
     (Maybe [WorkspaceImage])
     (Maybe [WorkspaceImage])
     (Maybe [WorkspaceImage])
     (Maybe [WorkspaceImage])
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
  [WorkspaceImage] [WorkspaceImage] [WorkspaceImage] [WorkspaceImage]
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.
describeWorkspaceImagesResponse_nextToken :: Lens.Lens' DescribeWorkspaceImagesResponse (Prelude.Maybe Prelude.Text)
describeWorkspaceImagesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeWorkspaceImagesResponse
-> f DescribeWorkspaceImagesResponse
describeWorkspaceImagesResponse_nextToken = (DescribeWorkspaceImagesResponse -> Maybe Text)
-> (DescribeWorkspaceImagesResponse
    -> Maybe Text -> DescribeWorkspaceImagesResponse)
-> Lens' DescribeWorkspaceImagesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeWorkspaceImagesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeWorkspaceImagesResponse' :: DescribeWorkspaceImagesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeWorkspaceImagesResponse
s@DescribeWorkspaceImagesResponse' {} Maybe Text
a -> DescribeWorkspaceImagesResponse
s {$sel:nextToken:DescribeWorkspaceImagesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeWorkspaceImagesResponse)

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

instance
  Prelude.NFData
    DescribeWorkspaceImagesResponse