{-# 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.Lightsail.RegisterContainerImage
(
RegisterContainerImage (..),
newRegisterContainerImage,
registerContainerImage_serviceName,
registerContainerImage_label,
registerContainerImage_digest,
RegisterContainerImageResponse (..),
newRegisterContainerImageResponse,
registerContainerImageResponse_containerImage,
registerContainerImageResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Lightsail.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data RegisterContainerImage = RegisterContainerImage'
{
RegisterContainerImage -> Text
serviceName :: Prelude.Text,
RegisterContainerImage -> Text
label :: Prelude.Text,
RegisterContainerImage -> Text
digest :: Prelude.Text
}
deriving (RegisterContainerImage -> RegisterContainerImage -> Bool
(RegisterContainerImage -> RegisterContainerImage -> Bool)
-> (RegisterContainerImage -> RegisterContainerImage -> Bool)
-> Eq RegisterContainerImage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegisterContainerImage -> RegisterContainerImage -> Bool
$c/= :: RegisterContainerImage -> RegisterContainerImage -> Bool
== :: RegisterContainerImage -> RegisterContainerImage -> Bool
$c== :: RegisterContainerImage -> RegisterContainerImage -> Bool
Prelude.Eq, ReadPrec [RegisterContainerImage]
ReadPrec RegisterContainerImage
Int -> ReadS RegisterContainerImage
ReadS [RegisterContainerImage]
(Int -> ReadS RegisterContainerImage)
-> ReadS [RegisterContainerImage]
-> ReadPrec RegisterContainerImage
-> ReadPrec [RegisterContainerImage]
-> Read RegisterContainerImage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegisterContainerImage]
$creadListPrec :: ReadPrec [RegisterContainerImage]
readPrec :: ReadPrec RegisterContainerImage
$creadPrec :: ReadPrec RegisterContainerImage
readList :: ReadS [RegisterContainerImage]
$creadList :: ReadS [RegisterContainerImage]
readsPrec :: Int -> ReadS RegisterContainerImage
$creadsPrec :: Int -> ReadS RegisterContainerImage
Prelude.Read, Int -> RegisterContainerImage -> ShowS
[RegisterContainerImage] -> ShowS
RegisterContainerImage -> String
(Int -> RegisterContainerImage -> ShowS)
-> (RegisterContainerImage -> String)
-> ([RegisterContainerImage] -> ShowS)
-> Show RegisterContainerImage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegisterContainerImage] -> ShowS
$cshowList :: [RegisterContainerImage] -> ShowS
show :: RegisterContainerImage -> String
$cshow :: RegisterContainerImage -> String
showsPrec :: Int -> RegisterContainerImage -> ShowS
$cshowsPrec :: Int -> RegisterContainerImage -> ShowS
Prelude.Show, (forall x. RegisterContainerImage -> Rep RegisterContainerImage x)
-> (forall x.
Rep RegisterContainerImage x -> RegisterContainerImage)
-> Generic RegisterContainerImage
forall x. Rep RegisterContainerImage x -> RegisterContainerImage
forall x. RegisterContainerImage -> Rep RegisterContainerImage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RegisterContainerImage x -> RegisterContainerImage
$cfrom :: forall x. RegisterContainerImage -> Rep RegisterContainerImage x
Prelude.Generic)
newRegisterContainerImage ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
RegisterContainerImage
newRegisterContainerImage :: Text -> Text -> Text -> RegisterContainerImage
newRegisterContainerImage
Text
pServiceName_
Text
pLabel_
Text
pDigest_ =
RegisterContainerImage' :: Text -> Text -> Text -> RegisterContainerImage
RegisterContainerImage'
{ $sel:serviceName:RegisterContainerImage' :: Text
serviceName =
Text
pServiceName_,
$sel:label:RegisterContainerImage' :: Text
label = Text
pLabel_,
$sel:digest:RegisterContainerImage' :: Text
digest = Text
pDigest_
}
registerContainerImage_serviceName :: Lens.Lens' RegisterContainerImage Prelude.Text
registerContainerImage_serviceName :: (Text -> f Text)
-> RegisterContainerImage -> f RegisterContainerImage
registerContainerImage_serviceName = (RegisterContainerImage -> Text)
-> (RegisterContainerImage -> Text -> RegisterContainerImage)
-> Lens RegisterContainerImage RegisterContainerImage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterContainerImage' {Text
serviceName :: Text
$sel:serviceName:RegisterContainerImage' :: RegisterContainerImage -> Text
serviceName} -> Text
serviceName) (\s :: RegisterContainerImage
s@RegisterContainerImage' {} Text
a -> RegisterContainerImage
s {$sel:serviceName:RegisterContainerImage' :: Text
serviceName = Text
a} :: RegisterContainerImage)
registerContainerImage_label :: Lens.Lens' RegisterContainerImage Prelude.Text
registerContainerImage_label :: (Text -> f Text)
-> RegisterContainerImage -> f RegisterContainerImage
registerContainerImage_label = (RegisterContainerImage -> Text)
-> (RegisterContainerImage -> Text -> RegisterContainerImage)
-> Lens RegisterContainerImage RegisterContainerImage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterContainerImage' {Text
label :: Text
$sel:label:RegisterContainerImage' :: RegisterContainerImage -> Text
label} -> Text
label) (\s :: RegisterContainerImage
s@RegisterContainerImage' {} Text
a -> RegisterContainerImage
s {$sel:label:RegisterContainerImage' :: Text
label = Text
a} :: RegisterContainerImage)
registerContainerImage_digest :: Lens.Lens' RegisterContainerImage Prelude.Text
registerContainerImage_digest :: (Text -> f Text)
-> RegisterContainerImage -> f RegisterContainerImage
registerContainerImage_digest = (RegisterContainerImage -> Text)
-> (RegisterContainerImage -> Text -> RegisterContainerImage)
-> Lens RegisterContainerImage RegisterContainerImage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterContainerImage' {Text
digest :: Text
$sel:digest:RegisterContainerImage' :: RegisterContainerImage -> Text
digest} -> Text
digest) (\s :: RegisterContainerImage
s@RegisterContainerImage' {} Text
a -> RegisterContainerImage
s {$sel:digest:RegisterContainerImage' :: Text
digest = Text
a} :: RegisterContainerImage)
instance Core.AWSRequest RegisterContainerImage where
type
AWSResponse RegisterContainerImage =
RegisterContainerImageResponse
request :: RegisterContainerImage -> Request RegisterContainerImage
request = Service -> RegisterContainerImage -> Request RegisterContainerImage
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy RegisterContainerImage
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse RegisterContainerImage)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse RegisterContainerImage))
-> Logger
-> Service
-> Proxy RegisterContainerImage
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse RegisterContainerImage)))
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 ContainerImage -> Int -> RegisterContainerImageResponse
RegisterContainerImageResponse'
(Maybe ContainerImage -> Int -> RegisterContainerImageResponse)
-> Either String (Maybe ContainerImage)
-> Either String (Int -> RegisterContainerImageResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ContainerImage)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"containerImage")
Either String (Int -> RegisterContainerImageResponse)
-> Either String Int
-> Either String RegisterContainerImageResponse
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 RegisterContainerImage
instance Prelude.NFData RegisterContainerImage
instance Core.ToHeaders RegisterContainerImage where
toHeaders :: RegisterContainerImage -> ResponseHeaders
toHeaders =
ResponseHeaders -> RegisterContainerImage -> 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
"Lightsail_20161128.RegisterContainerImage" ::
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 RegisterContainerImage where
toJSON :: RegisterContainerImage -> Value
toJSON RegisterContainerImage' {Text
digest :: Text
label :: Text
serviceName :: Text
$sel:digest:RegisterContainerImage' :: RegisterContainerImage -> Text
$sel:label:RegisterContainerImage' :: RegisterContainerImage -> Text
$sel:serviceName:RegisterContainerImage' :: RegisterContainerImage -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"serviceName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
serviceName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"label" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
label),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"digest" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
digest)
]
)
instance Core.ToPath RegisterContainerImage where
toPath :: RegisterContainerImage -> ByteString
toPath = ByteString -> RegisterContainerImage -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery RegisterContainerImage where
toQuery :: RegisterContainerImage -> QueryString
toQuery = QueryString -> RegisterContainerImage -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data RegisterContainerImageResponse = RegisterContainerImageResponse'
{ RegisterContainerImageResponse -> Maybe ContainerImage
containerImage :: Prelude.Maybe ContainerImage,
RegisterContainerImageResponse -> Int
httpStatus :: Prelude.Int
}
deriving (RegisterContainerImageResponse
-> RegisterContainerImageResponse -> Bool
(RegisterContainerImageResponse
-> RegisterContainerImageResponse -> Bool)
-> (RegisterContainerImageResponse
-> RegisterContainerImageResponse -> Bool)
-> Eq RegisterContainerImageResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegisterContainerImageResponse
-> RegisterContainerImageResponse -> Bool
$c/= :: RegisterContainerImageResponse
-> RegisterContainerImageResponse -> Bool
== :: RegisterContainerImageResponse
-> RegisterContainerImageResponse -> Bool
$c== :: RegisterContainerImageResponse
-> RegisterContainerImageResponse -> Bool
Prelude.Eq, ReadPrec [RegisterContainerImageResponse]
ReadPrec RegisterContainerImageResponse
Int -> ReadS RegisterContainerImageResponse
ReadS [RegisterContainerImageResponse]
(Int -> ReadS RegisterContainerImageResponse)
-> ReadS [RegisterContainerImageResponse]
-> ReadPrec RegisterContainerImageResponse
-> ReadPrec [RegisterContainerImageResponse]
-> Read RegisterContainerImageResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegisterContainerImageResponse]
$creadListPrec :: ReadPrec [RegisterContainerImageResponse]
readPrec :: ReadPrec RegisterContainerImageResponse
$creadPrec :: ReadPrec RegisterContainerImageResponse
readList :: ReadS [RegisterContainerImageResponse]
$creadList :: ReadS [RegisterContainerImageResponse]
readsPrec :: Int -> ReadS RegisterContainerImageResponse
$creadsPrec :: Int -> ReadS RegisterContainerImageResponse
Prelude.Read, Int -> RegisterContainerImageResponse -> ShowS
[RegisterContainerImageResponse] -> ShowS
RegisterContainerImageResponse -> String
(Int -> RegisterContainerImageResponse -> ShowS)
-> (RegisterContainerImageResponse -> String)
-> ([RegisterContainerImageResponse] -> ShowS)
-> Show RegisterContainerImageResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegisterContainerImageResponse] -> ShowS
$cshowList :: [RegisterContainerImageResponse] -> ShowS
show :: RegisterContainerImageResponse -> String
$cshow :: RegisterContainerImageResponse -> String
showsPrec :: Int -> RegisterContainerImageResponse -> ShowS
$cshowsPrec :: Int -> RegisterContainerImageResponse -> ShowS
Prelude.Show, (forall x.
RegisterContainerImageResponse
-> Rep RegisterContainerImageResponse x)
-> (forall x.
Rep RegisterContainerImageResponse x
-> RegisterContainerImageResponse)
-> Generic RegisterContainerImageResponse
forall x.
Rep RegisterContainerImageResponse x
-> RegisterContainerImageResponse
forall x.
RegisterContainerImageResponse
-> Rep RegisterContainerImageResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RegisterContainerImageResponse x
-> RegisterContainerImageResponse
$cfrom :: forall x.
RegisterContainerImageResponse
-> Rep RegisterContainerImageResponse x
Prelude.Generic)
newRegisterContainerImageResponse ::
Prelude.Int ->
RegisterContainerImageResponse
newRegisterContainerImageResponse :: Int -> RegisterContainerImageResponse
newRegisterContainerImageResponse Int
pHttpStatus_ =
RegisterContainerImageResponse' :: Maybe ContainerImage -> Int -> RegisterContainerImageResponse
RegisterContainerImageResponse'
{ $sel:containerImage:RegisterContainerImageResponse' :: Maybe ContainerImage
containerImage =
Maybe ContainerImage
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:RegisterContainerImageResponse' :: Int
httpStatus = Int
pHttpStatus_
}
registerContainerImageResponse_containerImage :: Lens.Lens' RegisterContainerImageResponse (Prelude.Maybe ContainerImage)
registerContainerImageResponse_containerImage :: (Maybe ContainerImage -> f (Maybe ContainerImage))
-> RegisterContainerImageResponse
-> f RegisterContainerImageResponse
registerContainerImageResponse_containerImage = (RegisterContainerImageResponse -> Maybe ContainerImage)
-> (RegisterContainerImageResponse
-> Maybe ContainerImage -> RegisterContainerImageResponse)
-> Lens
RegisterContainerImageResponse
RegisterContainerImageResponse
(Maybe ContainerImage)
(Maybe ContainerImage)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterContainerImageResponse' {Maybe ContainerImage
containerImage :: Maybe ContainerImage
$sel:containerImage:RegisterContainerImageResponse' :: RegisterContainerImageResponse -> Maybe ContainerImage
containerImage} -> Maybe ContainerImage
containerImage) (\s :: RegisterContainerImageResponse
s@RegisterContainerImageResponse' {} Maybe ContainerImage
a -> RegisterContainerImageResponse
s {$sel:containerImage:RegisterContainerImageResponse' :: Maybe ContainerImage
containerImage = Maybe ContainerImage
a} :: RegisterContainerImageResponse)
registerContainerImageResponse_httpStatus :: Lens.Lens' RegisterContainerImageResponse Prelude.Int
registerContainerImageResponse_httpStatus :: (Int -> f Int)
-> RegisterContainerImageResponse
-> f RegisterContainerImageResponse
registerContainerImageResponse_httpStatus = (RegisterContainerImageResponse -> Int)
-> (RegisterContainerImageResponse
-> Int -> RegisterContainerImageResponse)
-> Lens
RegisterContainerImageResponse
RegisterContainerImageResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterContainerImageResponse' {Int
httpStatus :: Int
$sel:httpStatus:RegisterContainerImageResponse' :: RegisterContainerImageResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: RegisterContainerImageResponse
s@RegisterContainerImageResponse' {} Int
a -> RegisterContainerImageResponse
s {$sel:httpStatus:RegisterContainerImageResponse' :: Int
httpStatus = Int
a} :: RegisterContainerImageResponse)
instance
Prelude.NFData
RegisterContainerImageResponse