{-# 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 #-}
module Amazonka.AppStream.CopyImage
(
CopyImage (..),
newCopyImage,
copyImage_destinationImageDescription,
copyImage_sourceImageName,
copyImage_destinationImageName,
copyImage_destinationRegion,
CopyImageResponse (..),
newCopyImageResponse,
copyImageResponse_destinationImageName,
copyImageResponse_httpStatus,
)
where
import Amazonka.AppStream.Types
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
data CopyImage = CopyImage'
{
CopyImage -> Maybe Text
destinationImageDescription :: Prelude.Maybe Prelude.Text,
CopyImage -> Text
sourceImageName :: Prelude.Text,
CopyImage -> Text
destinationImageName :: Prelude.Text,
CopyImage -> Text
destinationRegion :: Prelude.Text
}
deriving (CopyImage -> CopyImage -> Bool
(CopyImage -> CopyImage -> Bool)
-> (CopyImage -> CopyImage -> Bool) -> Eq CopyImage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CopyImage -> CopyImage -> Bool
$c/= :: CopyImage -> CopyImage -> Bool
== :: CopyImage -> CopyImage -> Bool
$c== :: CopyImage -> CopyImage -> Bool
Prelude.Eq, ReadPrec [CopyImage]
ReadPrec CopyImage
Int -> ReadS CopyImage
ReadS [CopyImage]
(Int -> ReadS CopyImage)
-> ReadS [CopyImage]
-> ReadPrec CopyImage
-> ReadPrec [CopyImage]
-> Read CopyImage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CopyImage]
$creadListPrec :: ReadPrec [CopyImage]
readPrec :: ReadPrec CopyImage
$creadPrec :: ReadPrec CopyImage
readList :: ReadS [CopyImage]
$creadList :: ReadS [CopyImage]
readsPrec :: Int -> ReadS CopyImage
$creadsPrec :: Int -> ReadS CopyImage
Prelude.Read, Int -> CopyImage -> ShowS
[CopyImage] -> ShowS
CopyImage -> String
(Int -> CopyImage -> ShowS)
-> (CopyImage -> String)
-> ([CopyImage] -> ShowS)
-> Show CopyImage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CopyImage] -> ShowS
$cshowList :: [CopyImage] -> ShowS
show :: CopyImage -> String
$cshow :: CopyImage -> String
showsPrec :: Int -> CopyImage -> ShowS
$cshowsPrec :: Int -> CopyImage -> ShowS
Prelude.Show, (forall x. CopyImage -> Rep CopyImage x)
-> (forall x. Rep CopyImage x -> CopyImage) -> Generic CopyImage
forall x. Rep CopyImage x -> CopyImage
forall x. CopyImage -> Rep CopyImage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CopyImage x -> CopyImage
$cfrom :: forall x. CopyImage -> Rep CopyImage x
Prelude.Generic)
newCopyImage ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
CopyImage
newCopyImage :: Text -> Text -> Text -> CopyImage
newCopyImage
Text
pSourceImageName_
Text
pDestinationImageName_
Text
pDestinationRegion_ =
CopyImage' :: Maybe Text -> Text -> Text -> Text -> CopyImage
CopyImage'
{ $sel:destinationImageDescription:CopyImage' :: Maybe Text
destinationImageDescription =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:sourceImageName:CopyImage' :: Text
sourceImageName = Text
pSourceImageName_,
$sel:destinationImageName:CopyImage' :: Text
destinationImageName = Text
pDestinationImageName_,
$sel:destinationRegion:CopyImage' :: Text
destinationRegion = Text
pDestinationRegion_
}
copyImage_destinationImageDescription :: Lens.Lens' CopyImage (Prelude.Maybe Prelude.Text)
copyImage_destinationImageDescription :: (Maybe Text -> f (Maybe Text)) -> CopyImage -> f CopyImage
copyImage_destinationImageDescription = (CopyImage -> Maybe Text)
-> (CopyImage -> Maybe Text -> CopyImage)
-> Lens CopyImage CopyImage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyImage' {Maybe Text
destinationImageDescription :: Maybe Text
$sel:destinationImageDescription:CopyImage' :: CopyImage -> Maybe Text
destinationImageDescription} -> Maybe Text
destinationImageDescription) (\s :: CopyImage
s@CopyImage' {} Maybe Text
a -> CopyImage
s {$sel:destinationImageDescription:CopyImage' :: Maybe Text
destinationImageDescription = Maybe Text
a} :: CopyImage)
copyImage_sourceImageName :: Lens.Lens' CopyImage Prelude.Text
copyImage_sourceImageName :: (Text -> f Text) -> CopyImage -> f CopyImage
copyImage_sourceImageName = (CopyImage -> Text)
-> (CopyImage -> Text -> CopyImage)
-> Lens CopyImage CopyImage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyImage' {Text
sourceImageName :: Text
$sel:sourceImageName:CopyImage' :: CopyImage -> Text
sourceImageName} -> Text
sourceImageName) (\s :: CopyImage
s@CopyImage' {} Text
a -> CopyImage
s {$sel:sourceImageName:CopyImage' :: Text
sourceImageName = Text
a} :: CopyImage)
copyImage_destinationImageName :: Lens.Lens' CopyImage Prelude.Text
copyImage_destinationImageName :: (Text -> f Text) -> CopyImage -> f CopyImage
copyImage_destinationImageName = (CopyImage -> Text)
-> (CopyImage -> Text -> CopyImage)
-> Lens CopyImage CopyImage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyImage' {Text
destinationImageName :: Text
$sel:destinationImageName:CopyImage' :: CopyImage -> Text
destinationImageName} -> Text
destinationImageName) (\s :: CopyImage
s@CopyImage' {} Text
a -> CopyImage
s {$sel:destinationImageName:CopyImage' :: Text
destinationImageName = Text
a} :: CopyImage)
copyImage_destinationRegion :: Lens.Lens' CopyImage Prelude.Text
copyImage_destinationRegion :: (Text -> f Text) -> CopyImage -> f CopyImage
copyImage_destinationRegion = (CopyImage -> Text)
-> (CopyImage -> Text -> CopyImage)
-> Lens CopyImage CopyImage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyImage' {Text
destinationRegion :: Text
$sel:destinationRegion:CopyImage' :: CopyImage -> Text
destinationRegion} -> Text
destinationRegion) (\s :: CopyImage
s@CopyImage' {} Text
a -> CopyImage
s {$sel:destinationRegion:CopyImage' :: Text
destinationRegion = Text
a} :: CopyImage)
instance Core.AWSRequest CopyImage where
type AWSResponse CopyImage = CopyImageResponse
request :: CopyImage -> Request CopyImage
request = Service -> CopyImage -> Request CopyImage
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CopyImage
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CopyImage)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CopyImage))
-> Logger
-> Service
-> Proxy CopyImage
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CopyImage)))
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 -> CopyImageResponse
CopyImageResponse'
(Maybe Text -> Int -> CopyImageResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CopyImageResponse)
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
"DestinationImageName")
Either String (Int -> CopyImageResponse)
-> Either String Int -> Either String CopyImageResponse
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 CopyImage
instance Prelude.NFData CopyImage
instance Core.ToHeaders CopyImage where
toHeaders :: CopyImage -> ResponseHeaders
toHeaders =
ResponseHeaders -> CopyImage -> 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
"PhotonAdminProxyService.CopyImage" ::
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 CopyImage where
toJSON :: CopyImage -> Value
toJSON CopyImage' {Maybe Text
Text
destinationRegion :: Text
destinationImageName :: Text
sourceImageName :: Text
destinationImageDescription :: Maybe Text
$sel:destinationRegion:CopyImage' :: CopyImage -> Text
$sel:destinationImageName:CopyImage' :: CopyImage -> Text
$sel:sourceImageName:CopyImage' :: CopyImage -> Text
$sel:destinationImageDescription:CopyImage' :: CopyImage -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"DestinationImageDescription" 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
destinationImageDescription,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"SourceImageName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
sourceImageName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"DestinationImageName"
Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
destinationImageName
),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"DestinationRegion" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
destinationRegion)
]
)
instance Core.ToPath CopyImage where
toPath :: CopyImage -> ByteString
toPath = ByteString -> CopyImage -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CopyImage where
toQuery :: CopyImage -> QueryString
toQuery = QueryString -> CopyImage -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CopyImageResponse = CopyImageResponse'
{
CopyImageResponse -> Maybe Text
destinationImageName :: Prelude.Maybe Prelude.Text,
CopyImageResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CopyImageResponse -> CopyImageResponse -> Bool
(CopyImageResponse -> CopyImageResponse -> Bool)
-> (CopyImageResponse -> CopyImageResponse -> Bool)
-> Eq CopyImageResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CopyImageResponse -> CopyImageResponse -> Bool
$c/= :: CopyImageResponse -> CopyImageResponse -> Bool
== :: CopyImageResponse -> CopyImageResponse -> Bool
$c== :: CopyImageResponse -> CopyImageResponse -> Bool
Prelude.Eq, ReadPrec [CopyImageResponse]
ReadPrec CopyImageResponse
Int -> ReadS CopyImageResponse
ReadS [CopyImageResponse]
(Int -> ReadS CopyImageResponse)
-> ReadS [CopyImageResponse]
-> ReadPrec CopyImageResponse
-> ReadPrec [CopyImageResponse]
-> Read CopyImageResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CopyImageResponse]
$creadListPrec :: ReadPrec [CopyImageResponse]
readPrec :: ReadPrec CopyImageResponse
$creadPrec :: ReadPrec CopyImageResponse
readList :: ReadS [CopyImageResponse]
$creadList :: ReadS [CopyImageResponse]
readsPrec :: Int -> ReadS CopyImageResponse
$creadsPrec :: Int -> ReadS CopyImageResponse
Prelude.Read, Int -> CopyImageResponse -> ShowS
[CopyImageResponse] -> ShowS
CopyImageResponse -> String
(Int -> CopyImageResponse -> ShowS)
-> (CopyImageResponse -> String)
-> ([CopyImageResponse] -> ShowS)
-> Show CopyImageResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CopyImageResponse] -> ShowS
$cshowList :: [CopyImageResponse] -> ShowS
show :: CopyImageResponse -> String
$cshow :: CopyImageResponse -> String
showsPrec :: Int -> CopyImageResponse -> ShowS
$cshowsPrec :: Int -> CopyImageResponse -> ShowS
Prelude.Show, (forall x. CopyImageResponse -> Rep CopyImageResponse x)
-> (forall x. Rep CopyImageResponse x -> CopyImageResponse)
-> Generic CopyImageResponse
forall x. Rep CopyImageResponse x -> CopyImageResponse
forall x. CopyImageResponse -> Rep CopyImageResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CopyImageResponse x -> CopyImageResponse
$cfrom :: forall x. CopyImageResponse -> Rep CopyImageResponse x
Prelude.Generic)
newCopyImageResponse ::
Prelude.Int ->
CopyImageResponse
newCopyImageResponse :: Int -> CopyImageResponse
newCopyImageResponse Int
pHttpStatus_ =
CopyImageResponse' :: Maybe Text -> Int -> CopyImageResponse
CopyImageResponse'
{ $sel:destinationImageName:CopyImageResponse' :: Maybe Text
destinationImageName =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CopyImageResponse' :: Int
httpStatus = Int
pHttpStatus_
}
copyImageResponse_destinationImageName :: Lens.Lens' CopyImageResponse (Prelude.Maybe Prelude.Text)
copyImageResponse_destinationImageName :: (Maybe Text -> f (Maybe Text))
-> CopyImageResponse -> f CopyImageResponse
copyImageResponse_destinationImageName = (CopyImageResponse -> Maybe Text)
-> (CopyImageResponse -> Maybe Text -> CopyImageResponse)
-> Lens
CopyImageResponse CopyImageResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyImageResponse' {Maybe Text
destinationImageName :: Maybe Text
$sel:destinationImageName:CopyImageResponse' :: CopyImageResponse -> Maybe Text
destinationImageName} -> Maybe Text
destinationImageName) (\s :: CopyImageResponse
s@CopyImageResponse' {} Maybe Text
a -> CopyImageResponse
s {$sel:destinationImageName:CopyImageResponse' :: Maybe Text
destinationImageName = Maybe Text
a} :: CopyImageResponse)
copyImageResponse_httpStatus :: Lens.Lens' CopyImageResponse Prelude.Int
copyImageResponse_httpStatus :: (Int -> f Int) -> CopyImageResponse -> f CopyImageResponse
copyImageResponse_httpStatus = (CopyImageResponse -> Int)
-> (CopyImageResponse -> Int -> CopyImageResponse)
-> Lens CopyImageResponse CopyImageResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CopyImageResponse' {Int
httpStatus :: Int
$sel:httpStatus:CopyImageResponse' :: CopyImageResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CopyImageResponse
s@CopyImageResponse' {} Int
a -> CopyImageResponse
s {$sel:httpStatus:CopyImageResponse' :: Int
httpStatus = Int
a} :: CopyImageResponse)
instance Prelude.NFData CopyImageResponse