{-# 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.OpenSearch.UpdatePackage
(
UpdatePackage (..),
newUpdatePackage,
updatePackage_packageDescription,
updatePackage_commitMessage,
updatePackage_packageID,
updatePackage_packageSource,
UpdatePackageResponse (..),
newUpdatePackageResponse,
updatePackageResponse_packageDetails,
updatePackageResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.OpenSearch.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data UpdatePackage = UpdatePackage'
{
UpdatePackage -> Maybe Text
packageDescription :: Prelude.Maybe Prelude.Text,
UpdatePackage -> Maybe Text
commitMessage :: Prelude.Maybe Prelude.Text,
UpdatePackage -> Text
packageID :: Prelude.Text,
UpdatePackage -> PackageSource
packageSource :: PackageSource
}
deriving (UpdatePackage -> UpdatePackage -> Bool
(UpdatePackage -> UpdatePackage -> Bool)
-> (UpdatePackage -> UpdatePackage -> Bool) -> Eq UpdatePackage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdatePackage -> UpdatePackage -> Bool
$c/= :: UpdatePackage -> UpdatePackage -> Bool
== :: UpdatePackage -> UpdatePackage -> Bool
$c== :: UpdatePackage -> UpdatePackage -> Bool
Prelude.Eq, ReadPrec [UpdatePackage]
ReadPrec UpdatePackage
Int -> ReadS UpdatePackage
ReadS [UpdatePackage]
(Int -> ReadS UpdatePackage)
-> ReadS [UpdatePackage]
-> ReadPrec UpdatePackage
-> ReadPrec [UpdatePackage]
-> Read UpdatePackage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdatePackage]
$creadListPrec :: ReadPrec [UpdatePackage]
readPrec :: ReadPrec UpdatePackage
$creadPrec :: ReadPrec UpdatePackage
readList :: ReadS [UpdatePackage]
$creadList :: ReadS [UpdatePackage]
readsPrec :: Int -> ReadS UpdatePackage
$creadsPrec :: Int -> ReadS UpdatePackage
Prelude.Read, Int -> UpdatePackage -> ShowS
[UpdatePackage] -> ShowS
UpdatePackage -> String
(Int -> UpdatePackage -> ShowS)
-> (UpdatePackage -> String)
-> ([UpdatePackage] -> ShowS)
-> Show UpdatePackage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdatePackage] -> ShowS
$cshowList :: [UpdatePackage] -> ShowS
show :: UpdatePackage -> String
$cshow :: UpdatePackage -> String
showsPrec :: Int -> UpdatePackage -> ShowS
$cshowsPrec :: Int -> UpdatePackage -> ShowS
Prelude.Show, (forall x. UpdatePackage -> Rep UpdatePackage x)
-> (forall x. Rep UpdatePackage x -> UpdatePackage)
-> Generic UpdatePackage
forall x. Rep UpdatePackage x -> UpdatePackage
forall x. UpdatePackage -> Rep UpdatePackage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdatePackage x -> UpdatePackage
$cfrom :: forall x. UpdatePackage -> Rep UpdatePackage x
Prelude.Generic)
newUpdatePackage ::
Prelude.Text ->
PackageSource ->
UpdatePackage
newUpdatePackage :: Text -> PackageSource -> UpdatePackage
newUpdatePackage Text
pPackageID_ PackageSource
pPackageSource_ =
UpdatePackage' :: Maybe Text -> Maybe Text -> Text -> PackageSource -> UpdatePackage
UpdatePackage'
{ $sel:packageDescription:UpdatePackage' :: Maybe Text
packageDescription =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:commitMessage:UpdatePackage' :: Maybe Text
commitMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:packageID:UpdatePackage' :: Text
packageID = Text
pPackageID_,
$sel:packageSource:UpdatePackage' :: PackageSource
packageSource = PackageSource
pPackageSource_
}
updatePackage_packageDescription :: Lens.Lens' UpdatePackage (Prelude.Maybe Prelude.Text)
updatePackage_packageDescription :: (Maybe Text -> f (Maybe Text)) -> UpdatePackage -> f UpdatePackage
updatePackage_packageDescription = (UpdatePackage -> Maybe Text)
-> (UpdatePackage -> Maybe Text -> UpdatePackage)
-> Lens UpdatePackage UpdatePackage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePackage' {Maybe Text
packageDescription :: Maybe Text
$sel:packageDescription:UpdatePackage' :: UpdatePackage -> Maybe Text
packageDescription} -> Maybe Text
packageDescription) (\s :: UpdatePackage
s@UpdatePackage' {} Maybe Text
a -> UpdatePackage
s {$sel:packageDescription:UpdatePackage' :: Maybe Text
packageDescription = Maybe Text
a} :: UpdatePackage)
updatePackage_commitMessage :: Lens.Lens' UpdatePackage (Prelude.Maybe Prelude.Text)
updatePackage_commitMessage :: (Maybe Text -> f (Maybe Text)) -> UpdatePackage -> f UpdatePackage
updatePackage_commitMessage = (UpdatePackage -> Maybe Text)
-> (UpdatePackage -> Maybe Text -> UpdatePackage)
-> Lens UpdatePackage UpdatePackage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePackage' {Maybe Text
commitMessage :: Maybe Text
$sel:commitMessage:UpdatePackage' :: UpdatePackage -> Maybe Text
commitMessage} -> Maybe Text
commitMessage) (\s :: UpdatePackage
s@UpdatePackage' {} Maybe Text
a -> UpdatePackage
s {$sel:commitMessage:UpdatePackage' :: Maybe Text
commitMessage = Maybe Text
a} :: UpdatePackage)
updatePackage_packageID :: Lens.Lens' UpdatePackage Prelude.Text
updatePackage_packageID :: (Text -> f Text) -> UpdatePackage -> f UpdatePackage
updatePackage_packageID = (UpdatePackage -> Text)
-> (UpdatePackage -> Text -> UpdatePackage)
-> Lens UpdatePackage UpdatePackage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePackage' {Text
packageID :: Text
$sel:packageID:UpdatePackage' :: UpdatePackage -> Text
packageID} -> Text
packageID) (\s :: UpdatePackage
s@UpdatePackage' {} Text
a -> UpdatePackage
s {$sel:packageID:UpdatePackage' :: Text
packageID = Text
a} :: UpdatePackage)
updatePackage_packageSource :: Lens.Lens' UpdatePackage PackageSource
updatePackage_packageSource :: (PackageSource -> f PackageSource)
-> UpdatePackage -> f UpdatePackage
updatePackage_packageSource = (UpdatePackage -> PackageSource)
-> (UpdatePackage -> PackageSource -> UpdatePackage)
-> Lens UpdatePackage UpdatePackage PackageSource PackageSource
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePackage' {PackageSource
packageSource :: PackageSource
$sel:packageSource:UpdatePackage' :: UpdatePackage -> PackageSource
packageSource} -> PackageSource
packageSource) (\s :: UpdatePackage
s@UpdatePackage' {} PackageSource
a -> UpdatePackage
s {$sel:packageSource:UpdatePackage' :: PackageSource
packageSource = PackageSource
a} :: UpdatePackage)
instance Core.AWSRequest UpdatePackage where
type
AWSResponse UpdatePackage =
UpdatePackageResponse
request :: UpdatePackage -> Request UpdatePackage
request = Service -> UpdatePackage -> Request UpdatePackage
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdatePackage
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdatePackage)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdatePackage))
-> Logger
-> Service
-> Proxy UpdatePackage
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdatePackage)))
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 PackageDetails -> Int -> UpdatePackageResponse
UpdatePackageResponse'
(Maybe PackageDetails -> Int -> UpdatePackageResponse)
-> Either String (Maybe PackageDetails)
-> Either String (Int -> UpdatePackageResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe PackageDetails)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"PackageDetails")
Either String (Int -> UpdatePackageResponse)
-> Either String Int -> Either String UpdatePackageResponse
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 UpdatePackage
instance Prelude.NFData UpdatePackage
instance Core.ToHeaders UpdatePackage where
toHeaders :: UpdatePackage -> ResponseHeaders
toHeaders = ResponseHeaders -> UpdatePackage -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON UpdatePackage where
toJSON :: UpdatePackage -> Value
toJSON UpdatePackage' {Maybe Text
Text
PackageSource
packageSource :: PackageSource
packageID :: Text
commitMessage :: Maybe Text
packageDescription :: Maybe Text
$sel:packageSource:UpdatePackage' :: UpdatePackage -> PackageSource
$sel:packageID:UpdatePackage' :: UpdatePackage -> Text
$sel:commitMessage:UpdatePackage' :: UpdatePackage -> Maybe Text
$sel:packageDescription:UpdatePackage' :: UpdatePackage -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"PackageDescription" 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
packageDescription,
(Text
"CommitMessage" 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
commitMessage,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"PackageID" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
packageID),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"PackageSource" Text -> PackageSource -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= PackageSource
packageSource)
]
)
instance Core.ToPath UpdatePackage where
toPath :: UpdatePackage -> ByteString
toPath = ByteString -> UpdatePackage -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/2021-01-01/packages/update"
instance Core.ToQuery UpdatePackage where
toQuery :: UpdatePackage -> QueryString
toQuery = QueryString -> UpdatePackage -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdatePackageResponse = UpdatePackageResponse'
{
UpdatePackageResponse -> Maybe PackageDetails
packageDetails :: Prelude.Maybe PackageDetails,
UpdatePackageResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdatePackageResponse -> UpdatePackageResponse -> Bool
(UpdatePackageResponse -> UpdatePackageResponse -> Bool)
-> (UpdatePackageResponse -> UpdatePackageResponse -> Bool)
-> Eq UpdatePackageResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdatePackageResponse -> UpdatePackageResponse -> Bool
$c/= :: UpdatePackageResponse -> UpdatePackageResponse -> Bool
== :: UpdatePackageResponse -> UpdatePackageResponse -> Bool
$c== :: UpdatePackageResponse -> UpdatePackageResponse -> Bool
Prelude.Eq, ReadPrec [UpdatePackageResponse]
ReadPrec UpdatePackageResponse
Int -> ReadS UpdatePackageResponse
ReadS [UpdatePackageResponse]
(Int -> ReadS UpdatePackageResponse)
-> ReadS [UpdatePackageResponse]
-> ReadPrec UpdatePackageResponse
-> ReadPrec [UpdatePackageResponse]
-> Read UpdatePackageResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdatePackageResponse]
$creadListPrec :: ReadPrec [UpdatePackageResponse]
readPrec :: ReadPrec UpdatePackageResponse
$creadPrec :: ReadPrec UpdatePackageResponse
readList :: ReadS [UpdatePackageResponse]
$creadList :: ReadS [UpdatePackageResponse]
readsPrec :: Int -> ReadS UpdatePackageResponse
$creadsPrec :: Int -> ReadS UpdatePackageResponse
Prelude.Read, Int -> UpdatePackageResponse -> ShowS
[UpdatePackageResponse] -> ShowS
UpdatePackageResponse -> String
(Int -> UpdatePackageResponse -> ShowS)
-> (UpdatePackageResponse -> String)
-> ([UpdatePackageResponse] -> ShowS)
-> Show UpdatePackageResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdatePackageResponse] -> ShowS
$cshowList :: [UpdatePackageResponse] -> ShowS
show :: UpdatePackageResponse -> String
$cshow :: UpdatePackageResponse -> String
showsPrec :: Int -> UpdatePackageResponse -> ShowS
$cshowsPrec :: Int -> UpdatePackageResponse -> ShowS
Prelude.Show, (forall x. UpdatePackageResponse -> Rep UpdatePackageResponse x)
-> (forall x. Rep UpdatePackageResponse x -> UpdatePackageResponse)
-> Generic UpdatePackageResponse
forall x. Rep UpdatePackageResponse x -> UpdatePackageResponse
forall x. UpdatePackageResponse -> Rep UpdatePackageResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdatePackageResponse x -> UpdatePackageResponse
$cfrom :: forall x. UpdatePackageResponse -> Rep UpdatePackageResponse x
Prelude.Generic)
newUpdatePackageResponse ::
Prelude.Int ->
UpdatePackageResponse
newUpdatePackageResponse :: Int -> UpdatePackageResponse
newUpdatePackageResponse Int
pHttpStatus_ =
UpdatePackageResponse' :: Maybe PackageDetails -> Int -> UpdatePackageResponse
UpdatePackageResponse'
{ $sel:packageDetails:UpdatePackageResponse' :: Maybe PackageDetails
packageDetails =
Maybe PackageDetails
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdatePackageResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updatePackageResponse_packageDetails :: Lens.Lens' UpdatePackageResponse (Prelude.Maybe PackageDetails)
updatePackageResponse_packageDetails :: (Maybe PackageDetails -> f (Maybe PackageDetails))
-> UpdatePackageResponse -> f UpdatePackageResponse
updatePackageResponse_packageDetails = (UpdatePackageResponse -> Maybe PackageDetails)
-> (UpdatePackageResponse
-> Maybe PackageDetails -> UpdatePackageResponse)
-> Lens
UpdatePackageResponse
UpdatePackageResponse
(Maybe PackageDetails)
(Maybe PackageDetails)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePackageResponse' {Maybe PackageDetails
packageDetails :: Maybe PackageDetails
$sel:packageDetails:UpdatePackageResponse' :: UpdatePackageResponse -> Maybe PackageDetails
packageDetails} -> Maybe PackageDetails
packageDetails) (\s :: UpdatePackageResponse
s@UpdatePackageResponse' {} Maybe PackageDetails
a -> UpdatePackageResponse
s {$sel:packageDetails:UpdatePackageResponse' :: Maybe PackageDetails
packageDetails = Maybe PackageDetails
a} :: UpdatePackageResponse)
updatePackageResponse_httpStatus :: Lens.Lens' UpdatePackageResponse Prelude.Int
updatePackageResponse_httpStatus :: (Int -> f Int) -> UpdatePackageResponse -> f UpdatePackageResponse
updatePackageResponse_httpStatus = (UpdatePackageResponse -> Int)
-> (UpdatePackageResponse -> Int -> UpdatePackageResponse)
-> Lens UpdatePackageResponse UpdatePackageResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePackageResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdatePackageResponse' :: UpdatePackageResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdatePackageResponse
s@UpdatePackageResponse' {} Int
a -> UpdatePackageResponse
s {$sel:httpStatus:UpdatePackageResponse' :: Int
httpStatus = Int
a} :: UpdatePackageResponse)
instance Prelude.NFData UpdatePackageResponse