{-# 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.ElasticSearch.CreatePackage
(
CreatePackage (..),
newCreatePackage,
createPackage_packageDescription,
createPackage_packageName,
createPackage_packageType,
createPackage_packageSource,
CreatePackageResponse (..),
newCreatePackageResponse,
createPackageResponse_packageDetails,
createPackageResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ElasticSearch.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreatePackage = CreatePackage'
{
CreatePackage -> Maybe Text
packageDescription :: Prelude.Maybe Prelude.Text,
CreatePackage -> Text
packageName :: Prelude.Text,
CreatePackage -> PackageType
packageType :: PackageType,
CreatePackage -> PackageSource
packageSource :: PackageSource
}
deriving (CreatePackage -> CreatePackage -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreatePackage -> CreatePackage -> Bool
$c/= :: CreatePackage -> CreatePackage -> Bool
== :: CreatePackage -> CreatePackage -> Bool
$c== :: CreatePackage -> CreatePackage -> Bool
Prelude.Eq, ReadPrec [CreatePackage]
ReadPrec CreatePackage
Int -> ReadS CreatePackage
ReadS [CreatePackage]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreatePackage]
$creadListPrec :: ReadPrec [CreatePackage]
readPrec :: ReadPrec CreatePackage
$creadPrec :: ReadPrec CreatePackage
readList :: ReadS [CreatePackage]
$creadList :: ReadS [CreatePackage]
readsPrec :: Int -> ReadS CreatePackage
$creadsPrec :: Int -> ReadS CreatePackage
Prelude.Read, Int -> CreatePackage -> ShowS
[CreatePackage] -> ShowS
CreatePackage -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreatePackage] -> ShowS
$cshowList :: [CreatePackage] -> ShowS
show :: CreatePackage -> String
$cshow :: CreatePackage -> String
showsPrec :: Int -> CreatePackage -> ShowS
$cshowsPrec :: Int -> CreatePackage -> ShowS
Prelude.Show, forall x. Rep CreatePackage x -> CreatePackage
forall x. CreatePackage -> Rep CreatePackage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreatePackage x -> CreatePackage
$cfrom :: forall x. CreatePackage -> Rep CreatePackage x
Prelude.Generic)
newCreatePackage ::
Prelude.Text ->
PackageType ->
PackageSource ->
CreatePackage
newCreatePackage :: Text -> PackageType -> PackageSource -> CreatePackage
newCreatePackage
Text
pPackageName_
PackageType
pPackageType_
PackageSource
pPackageSource_ =
CreatePackage'
{ $sel:packageDescription:CreatePackage' :: Maybe Text
packageDescription =
forall a. Maybe a
Prelude.Nothing,
$sel:packageName:CreatePackage' :: Text
packageName = Text
pPackageName_,
$sel:packageType:CreatePackage' :: PackageType
packageType = PackageType
pPackageType_,
$sel:packageSource:CreatePackage' :: PackageSource
packageSource = PackageSource
pPackageSource_
}
createPackage_packageDescription :: Lens.Lens' CreatePackage (Prelude.Maybe Prelude.Text)
createPackage_packageDescription :: Lens' CreatePackage (Maybe Text)
createPackage_packageDescription = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePackage' {Maybe Text
packageDescription :: Maybe Text
$sel:packageDescription:CreatePackage' :: CreatePackage -> Maybe Text
packageDescription} -> Maybe Text
packageDescription) (\s :: CreatePackage
s@CreatePackage' {} Maybe Text
a -> CreatePackage
s {$sel:packageDescription:CreatePackage' :: Maybe Text
packageDescription = Maybe Text
a} :: CreatePackage)
createPackage_packageName :: Lens.Lens' CreatePackage Prelude.Text
createPackage_packageName :: Lens' CreatePackage Text
createPackage_packageName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePackage' {Text
packageName :: Text
$sel:packageName:CreatePackage' :: CreatePackage -> Text
packageName} -> Text
packageName) (\s :: CreatePackage
s@CreatePackage' {} Text
a -> CreatePackage
s {$sel:packageName:CreatePackage' :: Text
packageName = Text
a} :: CreatePackage)
createPackage_packageType :: Lens.Lens' CreatePackage PackageType
createPackage_packageType :: Lens' CreatePackage PackageType
createPackage_packageType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePackage' {PackageType
packageType :: PackageType
$sel:packageType:CreatePackage' :: CreatePackage -> PackageType
packageType} -> PackageType
packageType) (\s :: CreatePackage
s@CreatePackage' {} PackageType
a -> CreatePackage
s {$sel:packageType:CreatePackage' :: PackageType
packageType = PackageType
a} :: CreatePackage)
createPackage_packageSource :: Lens.Lens' CreatePackage PackageSource
createPackage_packageSource :: Lens' CreatePackage PackageSource
createPackage_packageSource = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePackage' {PackageSource
packageSource :: PackageSource
$sel:packageSource:CreatePackage' :: CreatePackage -> PackageSource
packageSource} -> PackageSource
packageSource) (\s :: CreatePackage
s@CreatePackage' {} PackageSource
a -> CreatePackage
s {$sel:packageSource:CreatePackage' :: PackageSource
packageSource = PackageSource
a} :: CreatePackage)
instance Core.AWSRequest CreatePackage where
type
AWSResponse CreatePackage =
CreatePackageResponse
request :: (Service -> Service) -> CreatePackage -> Request CreatePackage
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 CreatePackage
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreatePackage)))
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 PackageDetails -> Int -> CreatePackageResponse
CreatePackageResponse'
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
"PackageDetails")
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 CreatePackage where
hashWithSalt :: Int -> CreatePackage -> Int
hashWithSalt Int
_salt CreatePackage' {Maybe Text
Text
PackageSource
PackageType
packageSource :: PackageSource
packageType :: PackageType
packageName :: Text
packageDescription :: Maybe Text
$sel:packageSource:CreatePackage' :: CreatePackage -> PackageSource
$sel:packageType:CreatePackage' :: CreatePackage -> PackageType
$sel:packageName:CreatePackage' :: CreatePackage -> Text
$sel:packageDescription:CreatePackage' :: CreatePackage -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
packageDescription
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
packageName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` PackageType
packageType
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` PackageSource
packageSource
instance Prelude.NFData CreatePackage where
rnf :: CreatePackage -> ()
rnf CreatePackage' {Maybe Text
Text
PackageSource
PackageType
packageSource :: PackageSource
packageType :: PackageType
packageName :: Text
packageDescription :: Maybe Text
$sel:packageSource:CreatePackage' :: CreatePackage -> PackageSource
$sel:packageType:CreatePackage' :: CreatePackage -> PackageType
$sel:packageName:CreatePackage' :: CreatePackage -> Text
$sel:packageDescription:CreatePackage' :: CreatePackage -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
packageDescription
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
packageName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf PackageType
packageType
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf PackageSource
packageSource
instance Data.ToHeaders CreatePackage where
toHeaders :: CreatePackage -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToJSON CreatePackage where
toJSON :: CreatePackage -> Value
toJSON CreatePackage' {Maybe Text
Text
PackageSource
PackageType
packageSource :: PackageSource
packageType :: PackageType
packageName :: Text
packageDescription :: Maybe Text
$sel:packageSource:CreatePackage' :: CreatePackage -> PackageSource
$sel:packageType:CreatePackage' :: CreatePackage -> PackageType
$sel:packageName:CreatePackage' :: CreatePackage -> Text
$sel:packageDescription:CreatePackage' :: CreatePackage -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"PackageDescription" 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
packageDescription,
forall a. a -> Maybe a
Prelude.Just (Key
"PackageName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
packageName),
forall a. a -> Maybe a
Prelude.Just (Key
"PackageType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= PackageType
packageType),
forall a. a -> Maybe a
Prelude.Just
(Key
"PackageSource" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= PackageSource
packageSource)
]
)
instance Data.ToPath CreatePackage where
toPath :: CreatePackage -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/2015-01-01/packages"
instance Data.ToQuery CreatePackage where
toQuery :: CreatePackage -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreatePackageResponse = CreatePackageResponse'
{
CreatePackageResponse -> Maybe PackageDetails
packageDetails :: Prelude.Maybe PackageDetails,
CreatePackageResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreatePackageResponse -> CreatePackageResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreatePackageResponse -> CreatePackageResponse -> Bool
$c/= :: CreatePackageResponse -> CreatePackageResponse -> Bool
== :: CreatePackageResponse -> CreatePackageResponse -> Bool
$c== :: CreatePackageResponse -> CreatePackageResponse -> Bool
Prelude.Eq, ReadPrec [CreatePackageResponse]
ReadPrec CreatePackageResponse
Int -> ReadS CreatePackageResponse
ReadS [CreatePackageResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreatePackageResponse]
$creadListPrec :: ReadPrec [CreatePackageResponse]
readPrec :: ReadPrec CreatePackageResponse
$creadPrec :: ReadPrec CreatePackageResponse
readList :: ReadS [CreatePackageResponse]
$creadList :: ReadS [CreatePackageResponse]
readsPrec :: Int -> ReadS CreatePackageResponse
$creadsPrec :: Int -> ReadS CreatePackageResponse
Prelude.Read, Int -> CreatePackageResponse -> ShowS
[CreatePackageResponse] -> ShowS
CreatePackageResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreatePackageResponse] -> ShowS
$cshowList :: [CreatePackageResponse] -> ShowS
show :: CreatePackageResponse -> String
$cshow :: CreatePackageResponse -> String
showsPrec :: Int -> CreatePackageResponse -> ShowS
$cshowsPrec :: Int -> CreatePackageResponse -> ShowS
Prelude.Show, forall x. Rep CreatePackageResponse x -> CreatePackageResponse
forall x. CreatePackageResponse -> Rep CreatePackageResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreatePackageResponse x -> CreatePackageResponse
$cfrom :: forall x. CreatePackageResponse -> Rep CreatePackageResponse x
Prelude.Generic)
newCreatePackageResponse ::
Prelude.Int ->
CreatePackageResponse
newCreatePackageResponse :: Int -> CreatePackageResponse
newCreatePackageResponse Int
pHttpStatus_ =
CreatePackageResponse'
{ $sel:packageDetails:CreatePackageResponse' :: Maybe PackageDetails
packageDetails =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreatePackageResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createPackageResponse_packageDetails :: Lens.Lens' CreatePackageResponse (Prelude.Maybe PackageDetails)
createPackageResponse_packageDetails :: Lens' CreatePackageResponse (Maybe PackageDetails)
createPackageResponse_packageDetails = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePackageResponse' {Maybe PackageDetails
packageDetails :: Maybe PackageDetails
$sel:packageDetails:CreatePackageResponse' :: CreatePackageResponse -> Maybe PackageDetails
packageDetails} -> Maybe PackageDetails
packageDetails) (\s :: CreatePackageResponse
s@CreatePackageResponse' {} Maybe PackageDetails
a -> CreatePackageResponse
s {$sel:packageDetails:CreatePackageResponse' :: Maybe PackageDetails
packageDetails = Maybe PackageDetails
a} :: CreatePackageResponse)
createPackageResponse_httpStatus :: Lens.Lens' CreatePackageResponse Prelude.Int
createPackageResponse_httpStatus :: Lens' CreatePackageResponse Int
createPackageResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePackageResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreatePackageResponse' :: CreatePackageResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreatePackageResponse
s@CreatePackageResponse' {} Int
a -> CreatePackageResponse
s {$sel:httpStatus:CreatePackageResponse' :: Int
httpStatus = Int
a} :: CreatePackageResponse)
instance Prelude.NFData CreatePackageResponse where
rnf :: CreatePackageResponse -> ()
rnf CreatePackageResponse' {Int
Maybe PackageDetails
httpStatus :: Int
packageDetails :: Maybe PackageDetails
$sel:httpStatus:CreatePackageResponse' :: CreatePackageResponse -> Int
$sel:packageDetails:CreatePackageResponse' :: CreatePackageResponse -> Maybe PackageDetails
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe PackageDetails
packageDetails
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus