{-# 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.Panorama.RegisterPackageVersion
(
RegisterPackageVersion (..),
newRegisterPackageVersion,
registerPackageVersion_markLatest,
registerPackageVersion_ownerAccount,
registerPackageVersion_packageId,
registerPackageVersion_packageVersion,
registerPackageVersion_patchVersion,
RegisterPackageVersionResponse (..),
newRegisterPackageVersionResponse,
registerPackageVersionResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Panorama.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data RegisterPackageVersion = RegisterPackageVersion'
{
RegisterPackageVersion -> Maybe Bool
markLatest :: Prelude.Maybe Prelude.Bool,
RegisterPackageVersion -> Maybe Text
ownerAccount :: Prelude.Maybe Prelude.Text,
RegisterPackageVersion -> Text
packageId :: Prelude.Text,
RegisterPackageVersion -> Text
packageVersion :: Prelude.Text,
RegisterPackageVersion -> Text
patchVersion :: Prelude.Text
}
deriving (RegisterPackageVersion -> RegisterPackageVersion -> Bool
(RegisterPackageVersion -> RegisterPackageVersion -> Bool)
-> (RegisterPackageVersion -> RegisterPackageVersion -> Bool)
-> Eq RegisterPackageVersion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegisterPackageVersion -> RegisterPackageVersion -> Bool
$c/= :: RegisterPackageVersion -> RegisterPackageVersion -> Bool
== :: RegisterPackageVersion -> RegisterPackageVersion -> Bool
$c== :: RegisterPackageVersion -> RegisterPackageVersion -> Bool
Prelude.Eq, ReadPrec [RegisterPackageVersion]
ReadPrec RegisterPackageVersion
Int -> ReadS RegisterPackageVersion
ReadS [RegisterPackageVersion]
(Int -> ReadS RegisterPackageVersion)
-> ReadS [RegisterPackageVersion]
-> ReadPrec RegisterPackageVersion
-> ReadPrec [RegisterPackageVersion]
-> Read RegisterPackageVersion
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegisterPackageVersion]
$creadListPrec :: ReadPrec [RegisterPackageVersion]
readPrec :: ReadPrec RegisterPackageVersion
$creadPrec :: ReadPrec RegisterPackageVersion
readList :: ReadS [RegisterPackageVersion]
$creadList :: ReadS [RegisterPackageVersion]
readsPrec :: Int -> ReadS RegisterPackageVersion
$creadsPrec :: Int -> ReadS RegisterPackageVersion
Prelude.Read, Int -> RegisterPackageVersion -> ShowS
[RegisterPackageVersion] -> ShowS
RegisterPackageVersion -> String
(Int -> RegisterPackageVersion -> ShowS)
-> (RegisterPackageVersion -> String)
-> ([RegisterPackageVersion] -> ShowS)
-> Show RegisterPackageVersion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegisterPackageVersion] -> ShowS
$cshowList :: [RegisterPackageVersion] -> ShowS
show :: RegisterPackageVersion -> String
$cshow :: RegisterPackageVersion -> String
showsPrec :: Int -> RegisterPackageVersion -> ShowS
$cshowsPrec :: Int -> RegisterPackageVersion -> ShowS
Prelude.Show, (forall x. RegisterPackageVersion -> Rep RegisterPackageVersion x)
-> (forall x.
Rep RegisterPackageVersion x -> RegisterPackageVersion)
-> Generic RegisterPackageVersion
forall x. Rep RegisterPackageVersion x -> RegisterPackageVersion
forall x. RegisterPackageVersion -> Rep RegisterPackageVersion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RegisterPackageVersion x -> RegisterPackageVersion
$cfrom :: forall x. RegisterPackageVersion -> Rep RegisterPackageVersion x
Prelude.Generic)
newRegisterPackageVersion ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
RegisterPackageVersion
newRegisterPackageVersion :: Text -> Text -> Text -> RegisterPackageVersion
newRegisterPackageVersion
Text
pPackageId_
Text
pPackageVersion_
Text
pPatchVersion_ =
RegisterPackageVersion' :: Maybe Bool
-> Maybe Text -> Text -> Text -> Text -> RegisterPackageVersion
RegisterPackageVersion'
{ $sel:markLatest:RegisterPackageVersion' :: Maybe Bool
markLatest =
Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:ownerAccount:RegisterPackageVersion' :: Maybe Text
ownerAccount = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:packageId:RegisterPackageVersion' :: Text
packageId = Text
pPackageId_,
$sel:packageVersion:RegisterPackageVersion' :: Text
packageVersion = Text
pPackageVersion_,
$sel:patchVersion:RegisterPackageVersion' :: Text
patchVersion = Text
pPatchVersion_
}
registerPackageVersion_markLatest :: Lens.Lens' RegisterPackageVersion (Prelude.Maybe Prelude.Bool)
registerPackageVersion_markLatest :: (Maybe Bool -> f (Maybe Bool))
-> RegisterPackageVersion -> f RegisterPackageVersion
registerPackageVersion_markLatest = (RegisterPackageVersion -> Maybe Bool)
-> (RegisterPackageVersion -> Maybe Bool -> RegisterPackageVersion)
-> Lens
RegisterPackageVersion
RegisterPackageVersion
(Maybe Bool)
(Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterPackageVersion' {Maybe Bool
markLatest :: Maybe Bool
$sel:markLatest:RegisterPackageVersion' :: RegisterPackageVersion -> Maybe Bool
markLatest} -> Maybe Bool
markLatest) (\s :: RegisterPackageVersion
s@RegisterPackageVersion' {} Maybe Bool
a -> RegisterPackageVersion
s {$sel:markLatest:RegisterPackageVersion' :: Maybe Bool
markLatest = Maybe Bool
a} :: RegisterPackageVersion)
registerPackageVersion_ownerAccount :: Lens.Lens' RegisterPackageVersion (Prelude.Maybe Prelude.Text)
registerPackageVersion_ownerAccount :: (Maybe Text -> f (Maybe Text))
-> RegisterPackageVersion -> f RegisterPackageVersion
registerPackageVersion_ownerAccount = (RegisterPackageVersion -> Maybe Text)
-> (RegisterPackageVersion -> Maybe Text -> RegisterPackageVersion)
-> Lens
RegisterPackageVersion
RegisterPackageVersion
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterPackageVersion' {Maybe Text
ownerAccount :: Maybe Text
$sel:ownerAccount:RegisterPackageVersion' :: RegisterPackageVersion -> Maybe Text
ownerAccount} -> Maybe Text
ownerAccount) (\s :: RegisterPackageVersion
s@RegisterPackageVersion' {} Maybe Text
a -> RegisterPackageVersion
s {$sel:ownerAccount:RegisterPackageVersion' :: Maybe Text
ownerAccount = Maybe Text
a} :: RegisterPackageVersion)
registerPackageVersion_packageId :: Lens.Lens' RegisterPackageVersion Prelude.Text
registerPackageVersion_packageId :: (Text -> f Text)
-> RegisterPackageVersion -> f RegisterPackageVersion
registerPackageVersion_packageId = (RegisterPackageVersion -> Text)
-> (RegisterPackageVersion -> Text -> RegisterPackageVersion)
-> Lens RegisterPackageVersion RegisterPackageVersion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterPackageVersion' {Text
packageId :: Text
$sel:packageId:RegisterPackageVersion' :: RegisterPackageVersion -> Text
packageId} -> Text
packageId) (\s :: RegisterPackageVersion
s@RegisterPackageVersion' {} Text
a -> RegisterPackageVersion
s {$sel:packageId:RegisterPackageVersion' :: Text
packageId = Text
a} :: RegisterPackageVersion)
registerPackageVersion_packageVersion :: Lens.Lens' RegisterPackageVersion Prelude.Text
registerPackageVersion_packageVersion :: (Text -> f Text)
-> RegisterPackageVersion -> f RegisterPackageVersion
registerPackageVersion_packageVersion = (RegisterPackageVersion -> Text)
-> (RegisterPackageVersion -> Text -> RegisterPackageVersion)
-> Lens RegisterPackageVersion RegisterPackageVersion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterPackageVersion' {Text
packageVersion :: Text
$sel:packageVersion:RegisterPackageVersion' :: RegisterPackageVersion -> Text
packageVersion} -> Text
packageVersion) (\s :: RegisterPackageVersion
s@RegisterPackageVersion' {} Text
a -> RegisterPackageVersion
s {$sel:packageVersion:RegisterPackageVersion' :: Text
packageVersion = Text
a} :: RegisterPackageVersion)
registerPackageVersion_patchVersion :: Lens.Lens' RegisterPackageVersion Prelude.Text
registerPackageVersion_patchVersion :: (Text -> f Text)
-> RegisterPackageVersion -> f RegisterPackageVersion
registerPackageVersion_patchVersion = (RegisterPackageVersion -> Text)
-> (RegisterPackageVersion -> Text -> RegisterPackageVersion)
-> Lens RegisterPackageVersion RegisterPackageVersion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterPackageVersion' {Text
patchVersion :: Text
$sel:patchVersion:RegisterPackageVersion' :: RegisterPackageVersion -> Text
patchVersion} -> Text
patchVersion) (\s :: RegisterPackageVersion
s@RegisterPackageVersion' {} Text
a -> RegisterPackageVersion
s {$sel:patchVersion:RegisterPackageVersion' :: Text
patchVersion = Text
a} :: RegisterPackageVersion)
instance Core.AWSRequest RegisterPackageVersion where
type
AWSResponse RegisterPackageVersion =
RegisterPackageVersionResponse
request :: RegisterPackageVersion -> Request RegisterPackageVersion
request = Service -> RegisterPackageVersion -> Request RegisterPackageVersion
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy RegisterPackageVersion
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse RegisterPackageVersion)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse RegisterPackageVersion))
-> Logger
-> Service
-> Proxy RegisterPackageVersion
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse RegisterPackageVersion)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> RegisterPackageVersionResponse
RegisterPackageVersionResponse'
(Int -> RegisterPackageVersionResponse)
-> Either String Int
-> Either String RegisterPackageVersionResponse
forall (f :: * -> *) a b. Functor 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 RegisterPackageVersion
instance Prelude.NFData RegisterPackageVersion
instance Core.ToHeaders RegisterPackageVersion where
toHeaders :: RegisterPackageVersion -> ResponseHeaders
toHeaders =
ResponseHeaders -> RegisterPackageVersion -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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 RegisterPackageVersion where
toJSON :: RegisterPackageVersion -> Value
toJSON RegisterPackageVersion' {Maybe Bool
Maybe Text
Text
patchVersion :: Text
packageVersion :: Text
packageId :: Text
ownerAccount :: Maybe Text
markLatest :: Maybe Bool
$sel:patchVersion:RegisterPackageVersion' :: RegisterPackageVersion -> Text
$sel:packageVersion:RegisterPackageVersion' :: RegisterPackageVersion -> Text
$sel:packageId:RegisterPackageVersion' :: RegisterPackageVersion -> Text
$sel:ownerAccount:RegisterPackageVersion' :: RegisterPackageVersion -> Maybe Text
$sel:markLatest:RegisterPackageVersion' :: RegisterPackageVersion -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"MarkLatest" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
markLatest,
(Text
"OwnerAccount" 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
ownerAccount
]
)
instance Core.ToPath RegisterPackageVersion where
toPath :: RegisterPackageVersion -> ByteString
toPath RegisterPackageVersion' {Maybe Bool
Maybe Text
Text
patchVersion :: Text
packageVersion :: Text
packageId :: Text
ownerAccount :: Maybe Text
markLatest :: Maybe Bool
$sel:patchVersion:RegisterPackageVersion' :: RegisterPackageVersion -> Text
$sel:packageVersion:RegisterPackageVersion' :: RegisterPackageVersion -> Text
$sel:packageId:RegisterPackageVersion' :: RegisterPackageVersion -> Text
$sel:ownerAccount:RegisterPackageVersion' :: RegisterPackageVersion -> Maybe Text
$sel:markLatest:RegisterPackageVersion' :: RegisterPackageVersion -> Maybe Bool
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/packages/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
packageId,
ByteString
"/versions/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
packageVersion,
ByteString
"/patch/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
patchVersion
]
instance Core.ToQuery RegisterPackageVersion where
toQuery :: RegisterPackageVersion -> QueryString
toQuery = QueryString -> RegisterPackageVersion -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data RegisterPackageVersionResponse = RegisterPackageVersionResponse'
{
RegisterPackageVersionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (RegisterPackageVersionResponse
-> RegisterPackageVersionResponse -> Bool
(RegisterPackageVersionResponse
-> RegisterPackageVersionResponse -> Bool)
-> (RegisterPackageVersionResponse
-> RegisterPackageVersionResponse -> Bool)
-> Eq RegisterPackageVersionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegisterPackageVersionResponse
-> RegisterPackageVersionResponse -> Bool
$c/= :: RegisterPackageVersionResponse
-> RegisterPackageVersionResponse -> Bool
== :: RegisterPackageVersionResponse
-> RegisterPackageVersionResponse -> Bool
$c== :: RegisterPackageVersionResponse
-> RegisterPackageVersionResponse -> Bool
Prelude.Eq, ReadPrec [RegisterPackageVersionResponse]
ReadPrec RegisterPackageVersionResponse
Int -> ReadS RegisterPackageVersionResponse
ReadS [RegisterPackageVersionResponse]
(Int -> ReadS RegisterPackageVersionResponse)
-> ReadS [RegisterPackageVersionResponse]
-> ReadPrec RegisterPackageVersionResponse
-> ReadPrec [RegisterPackageVersionResponse]
-> Read RegisterPackageVersionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegisterPackageVersionResponse]
$creadListPrec :: ReadPrec [RegisterPackageVersionResponse]
readPrec :: ReadPrec RegisterPackageVersionResponse
$creadPrec :: ReadPrec RegisterPackageVersionResponse
readList :: ReadS [RegisterPackageVersionResponse]
$creadList :: ReadS [RegisterPackageVersionResponse]
readsPrec :: Int -> ReadS RegisterPackageVersionResponse
$creadsPrec :: Int -> ReadS RegisterPackageVersionResponse
Prelude.Read, Int -> RegisterPackageVersionResponse -> ShowS
[RegisterPackageVersionResponse] -> ShowS
RegisterPackageVersionResponse -> String
(Int -> RegisterPackageVersionResponse -> ShowS)
-> (RegisterPackageVersionResponse -> String)
-> ([RegisterPackageVersionResponse] -> ShowS)
-> Show RegisterPackageVersionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegisterPackageVersionResponse] -> ShowS
$cshowList :: [RegisterPackageVersionResponse] -> ShowS
show :: RegisterPackageVersionResponse -> String
$cshow :: RegisterPackageVersionResponse -> String
showsPrec :: Int -> RegisterPackageVersionResponse -> ShowS
$cshowsPrec :: Int -> RegisterPackageVersionResponse -> ShowS
Prelude.Show, (forall x.
RegisterPackageVersionResponse
-> Rep RegisterPackageVersionResponse x)
-> (forall x.
Rep RegisterPackageVersionResponse x
-> RegisterPackageVersionResponse)
-> Generic RegisterPackageVersionResponse
forall x.
Rep RegisterPackageVersionResponse x
-> RegisterPackageVersionResponse
forall x.
RegisterPackageVersionResponse
-> Rep RegisterPackageVersionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RegisterPackageVersionResponse x
-> RegisterPackageVersionResponse
$cfrom :: forall x.
RegisterPackageVersionResponse
-> Rep RegisterPackageVersionResponse x
Prelude.Generic)
newRegisterPackageVersionResponse ::
Prelude.Int ->
RegisterPackageVersionResponse
newRegisterPackageVersionResponse :: Int -> RegisterPackageVersionResponse
newRegisterPackageVersionResponse Int
pHttpStatus_ =
RegisterPackageVersionResponse' :: Int -> RegisterPackageVersionResponse
RegisterPackageVersionResponse'
{ $sel:httpStatus:RegisterPackageVersionResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
registerPackageVersionResponse_httpStatus :: Lens.Lens' RegisterPackageVersionResponse Prelude.Int
registerPackageVersionResponse_httpStatus :: (Int -> f Int)
-> RegisterPackageVersionResponse
-> f RegisterPackageVersionResponse
registerPackageVersionResponse_httpStatus = (RegisterPackageVersionResponse -> Int)
-> (RegisterPackageVersionResponse
-> Int -> RegisterPackageVersionResponse)
-> Lens
RegisterPackageVersionResponse
RegisterPackageVersionResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterPackageVersionResponse' {Int
httpStatus :: Int
$sel:httpStatus:RegisterPackageVersionResponse' :: RegisterPackageVersionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: RegisterPackageVersionResponse
s@RegisterPackageVersionResponse' {} Int
a -> RegisterPackageVersionResponse
s {$sel:httpStatus:RegisterPackageVersionResponse' :: Int
httpStatus = Int
a} :: RegisterPackageVersionResponse)
instance
Prelude.NFData
RegisterPackageVersionResponse