{-# 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.ImportWorkspaceImage
-- 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)
--
-- Imports the specified Windows 10 Bring Your Own License (BYOL) image
-- into Amazon WorkSpaces. The image must be an already licensed Amazon EC2
-- image that is in your Amazon Web Services account, and you must own the
-- image. For more information about creating BYOL images, see
-- <https://docs.aws.amazon.com/workspaces/latest/adminguide/byol-windows-images.html Bring Your Own Windows Desktop Licenses>.
module Amazonka.WorkSpaces.ImportWorkspaceImage
  ( -- * Creating a Request
    ImportWorkspaceImage (..),
    newImportWorkspaceImage,

    -- * Request Lenses
    importWorkspaceImage_applications,
    importWorkspaceImage_tags,
    importWorkspaceImage_ec2ImageId,
    importWorkspaceImage_ingestionProcess,
    importWorkspaceImage_imageName,
    importWorkspaceImage_imageDescription,

    -- * Destructuring the Response
    ImportWorkspaceImageResponse (..),
    newImportWorkspaceImageResponse,

    -- * Response Lenses
    importWorkspaceImageResponse_imageId,
    importWorkspaceImageResponse_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:/ 'newImportWorkspaceImage' smart constructor.
data ImportWorkspaceImage = ImportWorkspaceImage'
  { -- | If specified, the version of Microsoft Office to subscribe to. Valid
    -- only for Windows 10 BYOL images. For more information about subscribing
    -- to Office for BYOL images, see
    -- <https://docs.aws.amazon.com/workspaces/latest/adminguide/byol-windows-images.html Bring Your Own Windows Desktop Licenses>.
    --
    -- Although this parameter is an array, only one item is allowed at this
    -- time.
    ImportWorkspaceImage -> Maybe (NonEmpty Application)
applications :: Prelude.Maybe (Prelude.NonEmpty Application),
    -- | The tags. Each WorkSpaces resource can have a maximum of 50 tags.
    ImportWorkspaceImage -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The identifier of the EC2 image.
    ImportWorkspaceImage -> Text
ec2ImageId :: Prelude.Text,
    -- | The ingestion process to be used when importing the image, depending on
    -- which protocol you want to use for your BYOL Workspace image, either
    -- PCoIP or WorkSpaces Streaming Protocol (WSP). To use WSP, specify a
    -- value that ends in @_WSP@. To use PCoIP, specify a value that does not
    -- end in @_WSP@.
    --
    -- For non-GPU-enabled bundles (bundles other than Graphics or
    -- GraphicsPro), specify @BYOL_REGULAR@ or @BYOL_REGULAR_WSP@, depending on
    -- the protocol.
    ImportWorkspaceImage -> WorkspaceImageIngestionProcess
ingestionProcess :: WorkspaceImageIngestionProcess,
    -- | The name of the WorkSpace image.
    ImportWorkspaceImage -> Text
imageName :: Prelude.Text,
    -- | The description of the WorkSpace image.
    ImportWorkspaceImage -> Text
imageDescription :: Prelude.Text
  }
  deriving (ImportWorkspaceImage -> ImportWorkspaceImage -> Bool
(ImportWorkspaceImage -> ImportWorkspaceImage -> Bool)
-> (ImportWorkspaceImage -> ImportWorkspaceImage -> Bool)
-> Eq ImportWorkspaceImage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImportWorkspaceImage -> ImportWorkspaceImage -> Bool
$c/= :: ImportWorkspaceImage -> ImportWorkspaceImage -> Bool
== :: ImportWorkspaceImage -> ImportWorkspaceImage -> Bool
$c== :: ImportWorkspaceImage -> ImportWorkspaceImage -> Bool
Prelude.Eq, ReadPrec [ImportWorkspaceImage]
ReadPrec ImportWorkspaceImage
Int -> ReadS ImportWorkspaceImage
ReadS [ImportWorkspaceImage]
(Int -> ReadS ImportWorkspaceImage)
-> ReadS [ImportWorkspaceImage]
-> ReadPrec ImportWorkspaceImage
-> ReadPrec [ImportWorkspaceImage]
-> Read ImportWorkspaceImage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ImportWorkspaceImage]
$creadListPrec :: ReadPrec [ImportWorkspaceImage]
readPrec :: ReadPrec ImportWorkspaceImage
$creadPrec :: ReadPrec ImportWorkspaceImage
readList :: ReadS [ImportWorkspaceImage]
$creadList :: ReadS [ImportWorkspaceImage]
readsPrec :: Int -> ReadS ImportWorkspaceImage
$creadsPrec :: Int -> ReadS ImportWorkspaceImage
Prelude.Read, Int -> ImportWorkspaceImage -> ShowS
[ImportWorkspaceImage] -> ShowS
ImportWorkspaceImage -> String
(Int -> ImportWorkspaceImage -> ShowS)
-> (ImportWorkspaceImage -> String)
-> ([ImportWorkspaceImage] -> ShowS)
-> Show ImportWorkspaceImage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ImportWorkspaceImage] -> ShowS
$cshowList :: [ImportWorkspaceImage] -> ShowS
show :: ImportWorkspaceImage -> String
$cshow :: ImportWorkspaceImage -> String
showsPrec :: Int -> ImportWorkspaceImage -> ShowS
$cshowsPrec :: Int -> ImportWorkspaceImage -> ShowS
Prelude.Show, (forall x. ImportWorkspaceImage -> Rep ImportWorkspaceImage x)
-> (forall x. Rep ImportWorkspaceImage x -> ImportWorkspaceImage)
-> Generic ImportWorkspaceImage
forall x. Rep ImportWorkspaceImage x -> ImportWorkspaceImage
forall x. ImportWorkspaceImage -> Rep ImportWorkspaceImage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ImportWorkspaceImage x -> ImportWorkspaceImage
$cfrom :: forall x. ImportWorkspaceImage -> Rep ImportWorkspaceImage x
Prelude.Generic)

-- |
-- Create a value of 'ImportWorkspaceImage' 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:
--
-- 'applications', 'importWorkspaceImage_applications' - If specified, the version of Microsoft Office to subscribe to. Valid
-- only for Windows 10 BYOL images. For more information about subscribing
-- to Office for BYOL images, see
-- <https://docs.aws.amazon.com/workspaces/latest/adminguide/byol-windows-images.html Bring Your Own Windows Desktop Licenses>.
--
-- Although this parameter is an array, only one item is allowed at this
-- time.
--
-- 'tags', 'importWorkspaceImage_tags' - The tags. Each WorkSpaces resource can have a maximum of 50 tags.
--
-- 'ec2ImageId', 'importWorkspaceImage_ec2ImageId' - The identifier of the EC2 image.
--
-- 'ingestionProcess', 'importWorkspaceImage_ingestionProcess' - The ingestion process to be used when importing the image, depending on
-- which protocol you want to use for your BYOL Workspace image, either
-- PCoIP or WorkSpaces Streaming Protocol (WSP). To use WSP, specify a
-- value that ends in @_WSP@. To use PCoIP, specify a value that does not
-- end in @_WSP@.
--
-- For non-GPU-enabled bundles (bundles other than Graphics or
-- GraphicsPro), specify @BYOL_REGULAR@ or @BYOL_REGULAR_WSP@, depending on
-- the protocol.
--
-- 'imageName', 'importWorkspaceImage_imageName' - The name of the WorkSpace image.
--
-- 'imageDescription', 'importWorkspaceImage_imageDescription' - The description of the WorkSpace image.
newImportWorkspaceImage ::
  -- | 'ec2ImageId'
  Prelude.Text ->
  -- | 'ingestionProcess'
  WorkspaceImageIngestionProcess ->
  -- | 'imageName'
  Prelude.Text ->
  -- | 'imageDescription'
  Prelude.Text ->
  ImportWorkspaceImage
newImportWorkspaceImage :: Text
-> WorkspaceImageIngestionProcess
-> Text
-> Text
-> ImportWorkspaceImage
newImportWorkspaceImage
  Text
pEc2ImageId_
  WorkspaceImageIngestionProcess
pIngestionProcess_
  Text
pImageName_
  Text
pImageDescription_ =
    ImportWorkspaceImage' :: Maybe (NonEmpty Application)
-> Maybe [Tag]
-> Text
-> WorkspaceImageIngestionProcess
-> Text
-> Text
-> ImportWorkspaceImage
ImportWorkspaceImage'
      { $sel:applications:ImportWorkspaceImage' :: Maybe (NonEmpty Application)
applications =
          Maybe (NonEmpty Application)
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:ImportWorkspaceImage' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:ec2ImageId:ImportWorkspaceImage' :: Text
ec2ImageId = Text
pEc2ImageId_,
        $sel:ingestionProcess:ImportWorkspaceImage' :: WorkspaceImageIngestionProcess
ingestionProcess = WorkspaceImageIngestionProcess
pIngestionProcess_,
        $sel:imageName:ImportWorkspaceImage' :: Text
imageName = Text
pImageName_,
        $sel:imageDescription:ImportWorkspaceImage' :: Text
imageDescription = Text
pImageDescription_
      }

-- | If specified, the version of Microsoft Office to subscribe to. Valid
-- only for Windows 10 BYOL images. For more information about subscribing
-- to Office for BYOL images, see
-- <https://docs.aws.amazon.com/workspaces/latest/adminguide/byol-windows-images.html Bring Your Own Windows Desktop Licenses>.
--
-- Although this parameter is an array, only one item is allowed at this
-- time.
importWorkspaceImage_applications :: Lens.Lens' ImportWorkspaceImage (Prelude.Maybe (Prelude.NonEmpty Application))
importWorkspaceImage_applications :: (Maybe (NonEmpty Application) -> f (Maybe (NonEmpty Application)))
-> ImportWorkspaceImage -> f ImportWorkspaceImage
importWorkspaceImage_applications = (ImportWorkspaceImage -> Maybe (NonEmpty Application))
-> (ImportWorkspaceImage
    -> Maybe (NonEmpty Application) -> ImportWorkspaceImage)
-> Lens
     ImportWorkspaceImage
     ImportWorkspaceImage
     (Maybe (NonEmpty Application))
     (Maybe (NonEmpty Application))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportWorkspaceImage' {Maybe (NonEmpty Application)
applications :: Maybe (NonEmpty Application)
$sel:applications:ImportWorkspaceImage' :: ImportWorkspaceImage -> Maybe (NonEmpty Application)
applications} -> Maybe (NonEmpty Application)
applications) (\s :: ImportWorkspaceImage
s@ImportWorkspaceImage' {} Maybe (NonEmpty Application)
a -> ImportWorkspaceImage
s {$sel:applications:ImportWorkspaceImage' :: Maybe (NonEmpty Application)
applications = Maybe (NonEmpty Application)
a} :: ImportWorkspaceImage) ((Maybe (NonEmpty Application) -> f (Maybe (NonEmpty Application)))
 -> ImportWorkspaceImage -> f ImportWorkspaceImage)
-> ((Maybe (NonEmpty Application)
     -> f (Maybe (NonEmpty Application)))
    -> Maybe (NonEmpty Application)
    -> f (Maybe (NonEmpty Application)))
-> (Maybe (NonEmpty Application)
    -> f (Maybe (NonEmpty Application)))
-> ImportWorkspaceImage
-> f ImportWorkspaceImage
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Application)
  (NonEmpty Application)
  (NonEmpty Application)
  (NonEmpty Application)
-> Iso
     (Maybe (NonEmpty Application))
     (Maybe (NonEmpty Application))
     (Maybe (NonEmpty Application))
     (Maybe (NonEmpty Application))
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 Application)
  (NonEmpty Application)
  (NonEmpty Application)
  (NonEmpty Application)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The tags. Each WorkSpaces resource can have a maximum of 50 tags.
importWorkspaceImage_tags :: Lens.Lens' ImportWorkspaceImage (Prelude.Maybe [Tag])
importWorkspaceImage_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> ImportWorkspaceImage -> f ImportWorkspaceImage
importWorkspaceImage_tags = (ImportWorkspaceImage -> Maybe [Tag])
-> (ImportWorkspaceImage -> Maybe [Tag] -> ImportWorkspaceImage)
-> Lens
     ImportWorkspaceImage
     ImportWorkspaceImage
     (Maybe [Tag])
     (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportWorkspaceImage' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:ImportWorkspaceImage' :: ImportWorkspaceImage -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: ImportWorkspaceImage
s@ImportWorkspaceImage' {} Maybe [Tag]
a -> ImportWorkspaceImage
s {$sel:tags:ImportWorkspaceImage' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: ImportWorkspaceImage) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> ImportWorkspaceImage -> f ImportWorkspaceImage)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> ImportWorkspaceImage
-> f ImportWorkspaceImage
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The identifier of the EC2 image.
importWorkspaceImage_ec2ImageId :: Lens.Lens' ImportWorkspaceImage Prelude.Text
importWorkspaceImage_ec2ImageId :: (Text -> f Text) -> ImportWorkspaceImage -> f ImportWorkspaceImage
importWorkspaceImage_ec2ImageId = (ImportWorkspaceImage -> Text)
-> (ImportWorkspaceImage -> Text -> ImportWorkspaceImage)
-> Lens ImportWorkspaceImage ImportWorkspaceImage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportWorkspaceImage' {Text
ec2ImageId :: Text
$sel:ec2ImageId:ImportWorkspaceImage' :: ImportWorkspaceImage -> Text
ec2ImageId} -> Text
ec2ImageId) (\s :: ImportWorkspaceImage
s@ImportWorkspaceImage' {} Text
a -> ImportWorkspaceImage
s {$sel:ec2ImageId:ImportWorkspaceImage' :: Text
ec2ImageId = Text
a} :: ImportWorkspaceImage)

-- | The ingestion process to be used when importing the image, depending on
-- which protocol you want to use for your BYOL Workspace image, either
-- PCoIP or WorkSpaces Streaming Protocol (WSP). To use WSP, specify a
-- value that ends in @_WSP@. To use PCoIP, specify a value that does not
-- end in @_WSP@.
--
-- For non-GPU-enabled bundles (bundles other than Graphics or
-- GraphicsPro), specify @BYOL_REGULAR@ or @BYOL_REGULAR_WSP@, depending on
-- the protocol.
importWorkspaceImage_ingestionProcess :: Lens.Lens' ImportWorkspaceImage WorkspaceImageIngestionProcess
importWorkspaceImage_ingestionProcess :: (WorkspaceImageIngestionProcess
 -> f WorkspaceImageIngestionProcess)
-> ImportWorkspaceImage -> f ImportWorkspaceImage
importWorkspaceImage_ingestionProcess = (ImportWorkspaceImage -> WorkspaceImageIngestionProcess)
-> (ImportWorkspaceImage
    -> WorkspaceImageIngestionProcess -> ImportWorkspaceImage)
-> Lens
     ImportWorkspaceImage
     ImportWorkspaceImage
     WorkspaceImageIngestionProcess
     WorkspaceImageIngestionProcess
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportWorkspaceImage' {WorkspaceImageIngestionProcess
ingestionProcess :: WorkspaceImageIngestionProcess
$sel:ingestionProcess:ImportWorkspaceImage' :: ImportWorkspaceImage -> WorkspaceImageIngestionProcess
ingestionProcess} -> WorkspaceImageIngestionProcess
ingestionProcess) (\s :: ImportWorkspaceImage
s@ImportWorkspaceImage' {} WorkspaceImageIngestionProcess
a -> ImportWorkspaceImage
s {$sel:ingestionProcess:ImportWorkspaceImage' :: WorkspaceImageIngestionProcess
ingestionProcess = WorkspaceImageIngestionProcess
a} :: ImportWorkspaceImage)

-- | The name of the WorkSpace image.
importWorkspaceImage_imageName :: Lens.Lens' ImportWorkspaceImage Prelude.Text
importWorkspaceImage_imageName :: (Text -> f Text) -> ImportWorkspaceImage -> f ImportWorkspaceImage
importWorkspaceImage_imageName = (ImportWorkspaceImage -> Text)
-> (ImportWorkspaceImage -> Text -> ImportWorkspaceImage)
-> Lens ImportWorkspaceImage ImportWorkspaceImage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportWorkspaceImage' {Text
imageName :: Text
$sel:imageName:ImportWorkspaceImage' :: ImportWorkspaceImage -> Text
imageName} -> Text
imageName) (\s :: ImportWorkspaceImage
s@ImportWorkspaceImage' {} Text
a -> ImportWorkspaceImage
s {$sel:imageName:ImportWorkspaceImage' :: Text
imageName = Text
a} :: ImportWorkspaceImage)

-- | The description of the WorkSpace image.
importWorkspaceImage_imageDescription :: Lens.Lens' ImportWorkspaceImage Prelude.Text
importWorkspaceImage_imageDescription :: (Text -> f Text) -> ImportWorkspaceImage -> f ImportWorkspaceImage
importWorkspaceImage_imageDescription = (ImportWorkspaceImage -> Text)
-> (ImportWorkspaceImage -> Text -> ImportWorkspaceImage)
-> Lens ImportWorkspaceImage ImportWorkspaceImage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportWorkspaceImage' {Text
imageDescription :: Text
$sel:imageDescription:ImportWorkspaceImage' :: ImportWorkspaceImage -> Text
imageDescription} -> Text
imageDescription) (\s :: ImportWorkspaceImage
s@ImportWorkspaceImage' {} Text
a -> ImportWorkspaceImage
s {$sel:imageDescription:ImportWorkspaceImage' :: Text
imageDescription = Text
a} :: ImportWorkspaceImage)

instance Core.AWSRequest ImportWorkspaceImage where
  type
    AWSResponse ImportWorkspaceImage =
      ImportWorkspaceImageResponse
  request :: ImportWorkspaceImage -> Request ImportWorkspaceImage
request = Service -> ImportWorkspaceImage -> Request ImportWorkspaceImage
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ImportWorkspaceImage
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ImportWorkspaceImage)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ImportWorkspaceImage))
-> Logger
-> Service
-> Proxy ImportWorkspaceImage
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ImportWorkspaceImage)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Int -> ImportWorkspaceImageResponse
ImportWorkspaceImageResponse'
            (Maybe Text -> Int -> ImportWorkspaceImageResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ImportWorkspaceImageResponse)
forall (f :: * -> *) a b. Functor 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
"ImageId")
            Either String (Int -> ImportWorkspaceImageResponse)
-> Either String Int -> Either String ImportWorkspaceImageResponse
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 ImportWorkspaceImage

instance Prelude.NFData ImportWorkspaceImage

instance Core.ToHeaders ImportWorkspaceImage where
  toHeaders :: ImportWorkspaceImage -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ImportWorkspaceImage -> 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.ImportWorkspaceImage" ::
                          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 ImportWorkspaceImage where
  toJSON :: ImportWorkspaceImage -> Value
toJSON ImportWorkspaceImage' {Maybe [Tag]
Maybe (NonEmpty Application)
Text
WorkspaceImageIngestionProcess
imageDescription :: Text
imageName :: Text
ingestionProcess :: WorkspaceImageIngestionProcess
ec2ImageId :: Text
tags :: Maybe [Tag]
applications :: Maybe (NonEmpty Application)
$sel:imageDescription:ImportWorkspaceImage' :: ImportWorkspaceImage -> Text
$sel:imageName:ImportWorkspaceImage' :: ImportWorkspaceImage -> Text
$sel:ingestionProcess:ImportWorkspaceImage' :: ImportWorkspaceImage -> WorkspaceImageIngestionProcess
$sel:ec2ImageId:ImportWorkspaceImage' :: ImportWorkspaceImage -> Text
$sel:tags:ImportWorkspaceImage' :: ImportWorkspaceImage -> Maybe [Tag]
$sel:applications:ImportWorkspaceImage' :: ImportWorkspaceImage -> Maybe (NonEmpty Application)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Applications" Text -> NonEmpty Application -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty Application -> Pair)
-> Maybe (NonEmpty Application) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Application)
applications,
            (Text
"Tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Ec2ImageId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
ec2ImageId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"IngestionProcess" Text -> WorkspaceImageIngestionProcess -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= WorkspaceImageIngestionProcess
ingestionProcess),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ImageName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
imageName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ImageDescription" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
imageDescription)
          ]
      )

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

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

-- | /See:/ 'newImportWorkspaceImageResponse' smart constructor.
data ImportWorkspaceImageResponse = ImportWorkspaceImageResponse'
  { -- | The identifier of the WorkSpace image.
    ImportWorkspaceImageResponse -> Maybe Text
imageId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ImportWorkspaceImageResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ImportWorkspaceImageResponse
-> ImportWorkspaceImageResponse -> Bool
(ImportWorkspaceImageResponse
 -> ImportWorkspaceImageResponse -> Bool)
-> (ImportWorkspaceImageResponse
    -> ImportWorkspaceImageResponse -> Bool)
-> Eq ImportWorkspaceImageResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImportWorkspaceImageResponse
-> ImportWorkspaceImageResponse -> Bool
$c/= :: ImportWorkspaceImageResponse
-> ImportWorkspaceImageResponse -> Bool
== :: ImportWorkspaceImageResponse
-> ImportWorkspaceImageResponse -> Bool
$c== :: ImportWorkspaceImageResponse
-> ImportWorkspaceImageResponse -> Bool
Prelude.Eq, ReadPrec [ImportWorkspaceImageResponse]
ReadPrec ImportWorkspaceImageResponse
Int -> ReadS ImportWorkspaceImageResponse
ReadS [ImportWorkspaceImageResponse]
(Int -> ReadS ImportWorkspaceImageResponse)
-> ReadS [ImportWorkspaceImageResponse]
-> ReadPrec ImportWorkspaceImageResponse
-> ReadPrec [ImportWorkspaceImageResponse]
-> Read ImportWorkspaceImageResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ImportWorkspaceImageResponse]
$creadListPrec :: ReadPrec [ImportWorkspaceImageResponse]
readPrec :: ReadPrec ImportWorkspaceImageResponse
$creadPrec :: ReadPrec ImportWorkspaceImageResponse
readList :: ReadS [ImportWorkspaceImageResponse]
$creadList :: ReadS [ImportWorkspaceImageResponse]
readsPrec :: Int -> ReadS ImportWorkspaceImageResponse
$creadsPrec :: Int -> ReadS ImportWorkspaceImageResponse
Prelude.Read, Int -> ImportWorkspaceImageResponse -> ShowS
[ImportWorkspaceImageResponse] -> ShowS
ImportWorkspaceImageResponse -> String
(Int -> ImportWorkspaceImageResponse -> ShowS)
-> (ImportWorkspaceImageResponse -> String)
-> ([ImportWorkspaceImageResponse] -> ShowS)
-> Show ImportWorkspaceImageResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ImportWorkspaceImageResponse] -> ShowS
$cshowList :: [ImportWorkspaceImageResponse] -> ShowS
show :: ImportWorkspaceImageResponse -> String
$cshow :: ImportWorkspaceImageResponse -> String
showsPrec :: Int -> ImportWorkspaceImageResponse -> ShowS
$cshowsPrec :: Int -> ImportWorkspaceImageResponse -> ShowS
Prelude.Show, (forall x.
 ImportWorkspaceImageResponse -> Rep ImportWorkspaceImageResponse x)
-> (forall x.
    Rep ImportWorkspaceImageResponse x -> ImportWorkspaceImageResponse)
-> Generic ImportWorkspaceImageResponse
forall x.
Rep ImportWorkspaceImageResponse x -> ImportWorkspaceImageResponse
forall x.
ImportWorkspaceImageResponse -> Rep ImportWorkspaceImageResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ImportWorkspaceImageResponse x -> ImportWorkspaceImageResponse
$cfrom :: forall x.
ImportWorkspaceImageResponse -> Rep ImportWorkspaceImageResponse x
Prelude.Generic)

-- |
-- Create a value of 'ImportWorkspaceImageResponse' 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:
--
-- 'imageId', 'importWorkspaceImageResponse_imageId' - The identifier of the WorkSpace image.
--
-- 'httpStatus', 'importWorkspaceImageResponse_httpStatus' - The response's http status code.
newImportWorkspaceImageResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ImportWorkspaceImageResponse
newImportWorkspaceImageResponse :: Int -> ImportWorkspaceImageResponse
newImportWorkspaceImageResponse Int
pHttpStatus_ =
  ImportWorkspaceImageResponse' :: Maybe Text -> Int -> ImportWorkspaceImageResponse
ImportWorkspaceImageResponse'
    { $sel:imageId:ImportWorkspaceImageResponse' :: Maybe Text
imageId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ImportWorkspaceImageResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The identifier of the WorkSpace image.
importWorkspaceImageResponse_imageId :: Lens.Lens' ImportWorkspaceImageResponse (Prelude.Maybe Prelude.Text)
importWorkspaceImageResponse_imageId :: (Maybe Text -> f (Maybe Text))
-> ImportWorkspaceImageResponse -> f ImportWorkspaceImageResponse
importWorkspaceImageResponse_imageId = (ImportWorkspaceImageResponse -> Maybe Text)
-> (ImportWorkspaceImageResponse
    -> Maybe Text -> ImportWorkspaceImageResponse)
-> Lens
     ImportWorkspaceImageResponse
     ImportWorkspaceImageResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportWorkspaceImageResponse' {Maybe Text
imageId :: Maybe Text
$sel:imageId:ImportWorkspaceImageResponse' :: ImportWorkspaceImageResponse -> Maybe Text
imageId} -> Maybe Text
imageId) (\s :: ImportWorkspaceImageResponse
s@ImportWorkspaceImageResponse' {} Maybe Text
a -> ImportWorkspaceImageResponse
s {$sel:imageId:ImportWorkspaceImageResponse' :: Maybe Text
imageId = Maybe Text
a} :: ImportWorkspaceImageResponse)

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

instance Prelude.NFData ImportWorkspaceImageResponse