{-# 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.ECRPublic.InitiateLayerUpload
(
InitiateLayerUpload (..),
newInitiateLayerUpload,
initiateLayerUpload_registryId,
initiateLayerUpload_repositoryName,
InitiateLayerUploadResponse (..),
newInitiateLayerUploadResponse,
initiateLayerUploadResponse_partSize,
initiateLayerUploadResponse_uploadId,
initiateLayerUploadResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ECRPublic.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data InitiateLayerUpload = InitiateLayerUpload'
{
InitiateLayerUpload -> Maybe Text
registryId :: Prelude.Maybe Prelude.Text,
InitiateLayerUpload -> Text
repositoryName :: Prelude.Text
}
deriving (InitiateLayerUpload -> InitiateLayerUpload -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InitiateLayerUpload -> InitiateLayerUpload -> Bool
$c/= :: InitiateLayerUpload -> InitiateLayerUpload -> Bool
== :: InitiateLayerUpload -> InitiateLayerUpload -> Bool
$c== :: InitiateLayerUpload -> InitiateLayerUpload -> Bool
Prelude.Eq, ReadPrec [InitiateLayerUpload]
ReadPrec InitiateLayerUpload
Int -> ReadS InitiateLayerUpload
ReadS [InitiateLayerUpload]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InitiateLayerUpload]
$creadListPrec :: ReadPrec [InitiateLayerUpload]
readPrec :: ReadPrec InitiateLayerUpload
$creadPrec :: ReadPrec InitiateLayerUpload
readList :: ReadS [InitiateLayerUpload]
$creadList :: ReadS [InitiateLayerUpload]
readsPrec :: Int -> ReadS InitiateLayerUpload
$creadsPrec :: Int -> ReadS InitiateLayerUpload
Prelude.Read, Int -> InitiateLayerUpload -> ShowS
[InitiateLayerUpload] -> ShowS
InitiateLayerUpload -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InitiateLayerUpload] -> ShowS
$cshowList :: [InitiateLayerUpload] -> ShowS
show :: InitiateLayerUpload -> String
$cshow :: InitiateLayerUpload -> String
showsPrec :: Int -> InitiateLayerUpload -> ShowS
$cshowsPrec :: Int -> InitiateLayerUpload -> ShowS
Prelude.Show, forall x. Rep InitiateLayerUpload x -> InitiateLayerUpload
forall x. InitiateLayerUpload -> Rep InitiateLayerUpload x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InitiateLayerUpload x -> InitiateLayerUpload
$cfrom :: forall x. InitiateLayerUpload -> Rep InitiateLayerUpload x
Prelude.Generic)
newInitiateLayerUpload ::
Prelude.Text ->
InitiateLayerUpload
newInitiateLayerUpload :: Text -> InitiateLayerUpload
newInitiateLayerUpload Text
pRepositoryName_ =
InitiateLayerUpload'
{ $sel:registryId:InitiateLayerUpload' :: Maybe Text
registryId = forall a. Maybe a
Prelude.Nothing,
$sel:repositoryName:InitiateLayerUpload' :: Text
repositoryName = Text
pRepositoryName_
}
initiateLayerUpload_registryId :: Lens.Lens' InitiateLayerUpload (Prelude.Maybe Prelude.Text)
initiateLayerUpload_registryId :: Lens' InitiateLayerUpload (Maybe Text)
initiateLayerUpload_registryId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InitiateLayerUpload' {Maybe Text
registryId :: Maybe Text
$sel:registryId:InitiateLayerUpload' :: InitiateLayerUpload -> Maybe Text
registryId} -> Maybe Text
registryId) (\s :: InitiateLayerUpload
s@InitiateLayerUpload' {} Maybe Text
a -> InitiateLayerUpload
s {$sel:registryId:InitiateLayerUpload' :: Maybe Text
registryId = Maybe Text
a} :: InitiateLayerUpload)
initiateLayerUpload_repositoryName :: Lens.Lens' InitiateLayerUpload Prelude.Text
initiateLayerUpload_repositoryName :: Lens' InitiateLayerUpload Text
initiateLayerUpload_repositoryName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InitiateLayerUpload' {Text
repositoryName :: Text
$sel:repositoryName:InitiateLayerUpload' :: InitiateLayerUpload -> Text
repositoryName} -> Text
repositoryName) (\s :: InitiateLayerUpload
s@InitiateLayerUpload' {} Text
a -> InitiateLayerUpload
s {$sel:repositoryName:InitiateLayerUpload' :: Text
repositoryName = Text
a} :: InitiateLayerUpload)
instance Core.AWSRequest InitiateLayerUpload where
type
AWSResponse InitiateLayerUpload =
InitiateLayerUploadResponse
request :: (Service -> Service)
-> InitiateLayerUpload -> Request InitiateLayerUpload
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 InitiateLayerUpload
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse InitiateLayerUpload)))
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 Natural -> Maybe Text -> Int -> InitiateLayerUploadResponse
InitiateLayerUploadResponse'
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
"partSize")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"uploadId")
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 InitiateLayerUpload where
hashWithSalt :: Int -> InitiateLayerUpload -> Int
hashWithSalt Int
_salt InitiateLayerUpload' {Maybe Text
Text
repositoryName :: Text
registryId :: Maybe Text
$sel:repositoryName:InitiateLayerUpload' :: InitiateLayerUpload -> Text
$sel:registryId:InitiateLayerUpload' :: InitiateLayerUpload -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
registryId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
repositoryName
instance Prelude.NFData InitiateLayerUpload where
rnf :: InitiateLayerUpload -> ()
rnf InitiateLayerUpload' {Maybe Text
Text
repositoryName :: Text
registryId :: Maybe Text
$sel:repositoryName:InitiateLayerUpload' :: InitiateLayerUpload -> Text
$sel:registryId:InitiateLayerUpload' :: InitiateLayerUpload -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
registryId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
repositoryName
instance Data.ToHeaders InitiateLayerUpload where
toHeaders :: InitiateLayerUpload -> 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
"SpencerFrontendService.InitiateLayerUpload" ::
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 InitiateLayerUpload where
toJSON :: InitiateLayerUpload -> Value
toJSON InitiateLayerUpload' {Maybe Text
Text
repositoryName :: Text
registryId :: Maybe Text
$sel:repositoryName:InitiateLayerUpload' :: InitiateLayerUpload -> Text
$sel:registryId:InitiateLayerUpload' :: InitiateLayerUpload -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"registryId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
registryId,
forall a. a -> Maybe a
Prelude.Just
(Key
"repositoryName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
repositoryName)
]
)
instance Data.ToPath InitiateLayerUpload where
toPath :: InitiateLayerUpload -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery InitiateLayerUpload where
toQuery :: InitiateLayerUpload -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data InitiateLayerUploadResponse = InitiateLayerUploadResponse'
{
InitiateLayerUploadResponse -> Maybe Natural
partSize :: Prelude.Maybe Prelude.Natural,
InitiateLayerUploadResponse -> Maybe Text
uploadId :: Prelude.Maybe Prelude.Text,
InitiateLayerUploadResponse -> Int
httpStatus :: Prelude.Int
}
deriving (InitiateLayerUploadResponse -> InitiateLayerUploadResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InitiateLayerUploadResponse -> InitiateLayerUploadResponse -> Bool
$c/= :: InitiateLayerUploadResponse -> InitiateLayerUploadResponse -> Bool
== :: InitiateLayerUploadResponse -> InitiateLayerUploadResponse -> Bool
$c== :: InitiateLayerUploadResponse -> InitiateLayerUploadResponse -> Bool
Prelude.Eq, ReadPrec [InitiateLayerUploadResponse]
ReadPrec InitiateLayerUploadResponse
Int -> ReadS InitiateLayerUploadResponse
ReadS [InitiateLayerUploadResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InitiateLayerUploadResponse]
$creadListPrec :: ReadPrec [InitiateLayerUploadResponse]
readPrec :: ReadPrec InitiateLayerUploadResponse
$creadPrec :: ReadPrec InitiateLayerUploadResponse
readList :: ReadS [InitiateLayerUploadResponse]
$creadList :: ReadS [InitiateLayerUploadResponse]
readsPrec :: Int -> ReadS InitiateLayerUploadResponse
$creadsPrec :: Int -> ReadS InitiateLayerUploadResponse
Prelude.Read, Int -> InitiateLayerUploadResponse -> ShowS
[InitiateLayerUploadResponse] -> ShowS
InitiateLayerUploadResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InitiateLayerUploadResponse] -> ShowS
$cshowList :: [InitiateLayerUploadResponse] -> ShowS
show :: InitiateLayerUploadResponse -> String
$cshow :: InitiateLayerUploadResponse -> String
showsPrec :: Int -> InitiateLayerUploadResponse -> ShowS
$cshowsPrec :: Int -> InitiateLayerUploadResponse -> ShowS
Prelude.Show, forall x.
Rep InitiateLayerUploadResponse x -> InitiateLayerUploadResponse
forall x.
InitiateLayerUploadResponse -> Rep InitiateLayerUploadResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep InitiateLayerUploadResponse x -> InitiateLayerUploadResponse
$cfrom :: forall x.
InitiateLayerUploadResponse -> Rep InitiateLayerUploadResponse x
Prelude.Generic)
newInitiateLayerUploadResponse ::
Prelude.Int ->
InitiateLayerUploadResponse
newInitiateLayerUploadResponse :: Int -> InitiateLayerUploadResponse
newInitiateLayerUploadResponse Int
pHttpStatus_ =
InitiateLayerUploadResponse'
{ $sel:partSize:InitiateLayerUploadResponse' :: Maybe Natural
partSize =
forall a. Maybe a
Prelude.Nothing,
$sel:uploadId:InitiateLayerUploadResponse' :: Maybe Text
uploadId = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:InitiateLayerUploadResponse' :: Int
httpStatus = Int
pHttpStatus_
}
initiateLayerUploadResponse_partSize :: Lens.Lens' InitiateLayerUploadResponse (Prelude.Maybe Prelude.Natural)
initiateLayerUploadResponse_partSize :: Lens' InitiateLayerUploadResponse (Maybe Natural)
initiateLayerUploadResponse_partSize = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InitiateLayerUploadResponse' {Maybe Natural
partSize :: Maybe Natural
$sel:partSize:InitiateLayerUploadResponse' :: InitiateLayerUploadResponse -> Maybe Natural
partSize} -> Maybe Natural
partSize) (\s :: InitiateLayerUploadResponse
s@InitiateLayerUploadResponse' {} Maybe Natural
a -> InitiateLayerUploadResponse
s {$sel:partSize:InitiateLayerUploadResponse' :: Maybe Natural
partSize = Maybe Natural
a} :: InitiateLayerUploadResponse)
initiateLayerUploadResponse_uploadId :: Lens.Lens' InitiateLayerUploadResponse (Prelude.Maybe Prelude.Text)
initiateLayerUploadResponse_uploadId :: Lens' InitiateLayerUploadResponse (Maybe Text)
initiateLayerUploadResponse_uploadId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InitiateLayerUploadResponse' {Maybe Text
uploadId :: Maybe Text
$sel:uploadId:InitiateLayerUploadResponse' :: InitiateLayerUploadResponse -> Maybe Text
uploadId} -> Maybe Text
uploadId) (\s :: InitiateLayerUploadResponse
s@InitiateLayerUploadResponse' {} Maybe Text
a -> InitiateLayerUploadResponse
s {$sel:uploadId:InitiateLayerUploadResponse' :: Maybe Text
uploadId = Maybe Text
a} :: InitiateLayerUploadResponse)
initiateLayerUploadResponse_httpStatus :: Lens.Lens' InitiateLayerUploadResponse Prelude.Int
initiateLayerUploadResponse_httpStatus :: Lens' InitiateLayerUploadResponse Int
initiateLayerUploadResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InitiateLayerUploadResponse' {Int
httpStatus :: Int
$sel:httpStatus:InitiateLayerUploadResponse' :: InitiateLayerUploadResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: InitiateLayerUploadResponse
s@InitiateLayerUploadResponse' {} Int
a -> InitiateLayerUploadResponse
s {$sel:httpStatus:InitiateLayerUploadResponse' :: Int
httpStatus = Int
a} :: InitiateLayerUploadResponse)
instance Prelude.NFData InitiateLayerUploadResponse where
rnf :: InitiateLayerUploadResponse -> ()
rnf InitiateLayerUploadResponse' {Int
Maybe Natural
Maybe Text
httpStatus :: Int
uploadId :: Maybe Text
partSize :: Maybe Natural
$sel:httpStatus:InitiateLayerUploadResponse' :: InitiateLayerUploadResponse -> Int
$sel:uploadId:InitiateLayerUploadResponse' :: InitiateLayerUploadResponse -> Maybe Text
$sel:partSize:InitiateLayerUploadResponse' :: InitiateLayerUploadResponse -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
partSize
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
uploadId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus