{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
{ $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 :: Lens' RegisterContainerImage Text
registerContainerImage_serviceName = 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 :: Lens' RegisterContainerImage Text
registerContainerImage_label = 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 :: Lens' RegisterContainerImage Text
registerContainerImage_digest = 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 :: (Service -> Service)
-> RegisterContainerImage -> Request RegisterContainerImage
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy RegisterContainerImage
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse RegisterContainerImage)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe ContainerImage -> Int -> RegisterContainerImageResponse
RegisterContainerImageResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"containerImage")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable RegisterContainerImage where
hashWithSalt :: Int -> RegisterContainerImage -> Int
hashWithSalt Int
_salt RegisterContainerImage' {Text
digest :: Text
label :: Text
serviceName :: Text
$sel:digest:RegisterContainerImage' :: RegisterContainerImage -> Text
$sel:label:RegisterContainerImage' :: RegisterContainerImage -> Text
$sel:serviceName:RegisterContainerImage' :: RegisterContainerImage -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
serviceName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
label
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
digest
instance Prelude.NFData RegisterContainerImage where
rnf :: RegisterContainerImage -> ()
rnf RegisterContainerImage' {Text
digest :: Text
label :: Text
serviceName :: Text
$sel:digest:RegisterContainerImage' :: RegisterContainerImage -> Text
$sel:label:RegisterContainerImage' :: RegisterContainerImage -> Text
$sel:serviceName:RegisterContainerImage' :: RegisterContainerImage -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
serviceName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
label
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
digest
instance Data.ToHeaders RegisterContainerImage where
toHeaders :: RegisterContainerImage -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"Lightsail_20161128.RegisterContainerImage" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just (Key
"serviceName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
serviceName),
forall a. a -> Maybe a
Prelude.Just (Key
"label" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
label),
forall a. a -> Maybe a
Prelude.Just (Key
"digest" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
digest)
]
)
instance Data.ToPath RegisterContainerImage where
toPath :: RegisterContainerImage -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery RegisterContainerImage where
toQuery :: RegisterContainerImage -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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.
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'
{ $sel:containerImage:RegisterContainerImageResponse' :: Maybe ContainerImage
containerImage =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:RegisterContainerImageResponse' :: Int
httpStatus = Int
pHttpStatus_
}
registerContainerImageResponse_containerImage :: Lens.Lens' RegisterContainerImageResponse (Prelude.Maybe ContainerImage)
registerContainerImageResponse_containerImage :: Lens' RegisterContainerImageResponse (Maybe ContainerImage)
registerContainerImageResponse_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 :: Lens' RegisterContainerImageResponse Int
registerContainerImageResponse_httpStatus = 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
where
rnf :: RegisterContainerImageResponse -> ()
rnf RegisterContainerImageResponse' {Int
Maybe ContainerImage
httpStatus :: Int
containerImage :: Maybe ContainerImage
$sel:httpStatus:RegisterContainerImageResponse' :: RegisterContainerImageResponse -> Int
$sel:containerImage:RegisterContainerImageResponse' :: RegisterContainerImageResponse -> Maybe ContainerImage
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe ContainerImage
containerImage
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus