{-# 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.DissociatePackage
(
DissociatePackage (..),
newDissociatePackage,
dissociatePackage_packageID,
dissociatePackage_domainName,
DissociatePackageResponse (..),
newDissociatePackageResponse,
dissociatePackageResponse_domainPackageDetails,
dissociatePackageResponse_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 DissociatePackage = DissociatePackage'
{
DissociatePackage -> Text
packageID :: Prelude.Text,
DissociatePackage -> Text
domainName :: Prelude.Text
}
deriving (DissociatePackage -> DissociatePackage -> Bool
(DissociatePackage -> DissociatePackage -> Bool)
-> (DissociatePackage -> DissociatePackage -> Bool)
-> Eq DissociatePackage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DissociatePackage -> DissociatePackage -> Bool
$c/= :: DissociatePackage -> DissociatePackage -> Bool
== :: DissociatePackage -> DissociatePackage -> Bool
$c== :: DissociatePackage -> DissociatePackage -> Bool
Prelude.Eq, ReadPrec [DissociatePackage]
ReadPrec DissociatePackage
Int -> ReadS DissociatePackage
ReadS [DissociatePackage]
(Int -> ReadS DissociatePackage)
-> ReadS [DissociatePackage]
-> ReadPrec DissociatePackage
-> ReadPrec [DissociatePackage]
-> Read DissociatePackage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DissociatePackage]
$creadListPrec :: ReadPrec [DissociatePackage]
readPrec :: ReadPrec DissociatePackage
$creadPrec :: ReadPrec DissociatePackage
readList :: ReadS [DissociatePackage]
$creadList :: ReadS [DissociatePackage]
readsPrec :: Int -> ReadS DissociatePackage
$creadsPrec :: Int -> ReadS DissociatePackage
Prelude.Read, Int -> DissociatePackage -> ShowS
[DissociatePackage] -> ShowS
DissociatePackage -> String
(Int -> DissociatePackage -> ShowS)
-> (DissociatePackage -> String)
-> ([DissociatePackage] -> ShowS)
-> Show DissociatePackage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DissociatePackage] -> ShowS
$cshowList :: [DissociatePackage] -> ShowS
show :: DissociatePackage -> String
$cshow :: DissociatePackage -> String
showsPrec :: Int -> DissociatePackage -> ShowS
$cshowsPrec :: Int -> DissociatePackage -> ShowS
Prelude.Show, (forall x. DissociatePackage -> Rep DissociatePackage x)
-> (forall x. Rep DissociatePackage x -> DissociatePackage)
-> Generic DissociatePackage
forall x. Rep DissociatePackage x -> DissociatePackage
forall x. DissociatePackage -> Rep DissociatePackage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DissociatePackage x -> DissociatePackage
$cfrom :: forall x. DissociatePackage -> Rep DissociatePackage x
Prelude.Generic)
newDissociatePackage ::
Prelude.Text ->
Prelude.Text ->
DissociatePackage
newDissociatePackage :: Text -> Text -> DissociatePackage
newDissociatePackage Text
pPackageID_ Text
pDomainName_ =
DissociatePackage' :: Text -> Text -> DissociatePackage
DissociatePackage'
{ $sel:packageID:DissociatePackage' :: Text
packageID = Text
pPackageID_,
$sel:domainName:DissociatePackage' :: Text
domainName = Text
pDomainName_
}
dissociatePackage_packageID :: Lens.Lens' DissociatePackage Prelude.Text
dissociatePackage_packageID :: (Text -> f Text) -> DissociatePackage -> f DissociatePackage
dissociatePackage_packageID = (DissociatePackage -> Text)
-> (DissociatePackage -> Text -> DissociatePackage)
-> Lens DissociatePackage DissociatePackage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DissociatePackage' {Text
packageID :: Text
$sel:packageID:DissociatePackage' :: DissociatePackage -> Text
packageID} -> Text
packageID) (\s :: DissociatePackage
s@DissociatePackage' {} Text
a -> DissociatePackage
s {$sel:packageID:DissociatePackage' :: Text
packageID = Text
a} :: DissociatePackage)
dissociatePackage_domainName :: Lens.Lens' DissociatePackage Prelude.Text
dissociatePackage_domainName :: (Text -> f Text) -> DissociatePackage -> f DissociatePackage
dissociatePackage_domainName = (DissociatePackage -> Text)
-> (DissociatePackage -> Text -> DissociatePackage)
-> Lens DissociatePackage DissociatePackage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DissociatePackage' {Text
domainName :: Text
$sel:domainName:DissociatePackage' :: DissociatePackage -> Text
domainName} -> Text
domainName) (\s :: DissociatePackage
s@DissociatePackage' {} Text
a -> DissociatePackage
s {$sel:domainName:DissociatePackage' :: Text
domainName = Text
a} :: DissociatePackage)
instance Core.AWSRequest DissociatePackage where
type
AWSResponse DissociatePackage =
DissociatePackageResponse
request :: DissociatePackage -> Request DissociatePackage
request = Service -> DissociatePackage -> Request DissociatePackage
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DissociatePackage
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DissociatePackage)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DissociatePackage))
-> Logger
-> Service
-> Proxy DissociatePackage
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DissociatePackage)))
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 DomainPackageDetails -> Int -> DissociatePackageResponse
DissociatePackageResponse'
(Maybe DomainPackageDetails -> Int -> DissociatePackageResponse)
-> Either String (Maybe DomainPackageDetails)
-> Either String (Int -> DissociatePackageResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe DomainPackageDetails)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"DomainPackageDetails")
Either String (Int -> DissociatePackageResponse)
-> Either String Int -> Either String DissociatePackageResponse
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 DissociatePackage
instance Prelude.NFData DissociatePackage
instance Core.ToHeaders DissociatePackage where
toHeaders :: DissociatePackage -> ResponseHeaders
toHeaders = ResponseHeaders -> DissociatePackage -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON DissociatePackage where
toJSON :: DissociatePackage -> Value
toJSON = Value -> DissociatePackage -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)
instance Core.ToPath DissociatePackage where
toPath :: DissociatePackage -> ByteString
toPath DissociatePackage' {Text
domainName :: Text
packageID :: Text
$sel:domainName:DissociatePackage' :: DissociatePackage -> Text
$sel:packageID:DissociatePackage' :: DissociatePackage -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/2021-01-01/packages/dissociate/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
packageID,
ByteString
"/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
domainName
]
instance Core.ToQuery DissociatePackage where
toQuery :: DissociatePackage -> QueryString
toQuery = QueryString -> DissociatePackage -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DissociatePackageResponse = DissociatePackageResponse'
{
DissociatePackageResponse -> Maybe DomainPackageDetails
domainPackageDetails :: Prelude.Maybe DomainPackageDetails,
DissociatePackageResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DissociatePackageResponse -> DissociatePackageResponse -> Bool
(DissociatePackageResponse -> DissociatePackageResponse -> Bool)
-> (DissociatePackageResponse -> DissociatePackageResponse -> Bool)
-> Eq DissociatePackageResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DissociatePackageResponse -> DissociatePackageResponse -> Bool
$c/= :: DissociatePackageResponse -> DissociatePackageResponse -> Bool
== :: DissociatePackageResponse -> DissociatePackageResponse -> Bool
$c== :: DissociatePackageResponse -> DissociatePackageResponse -> Bool
Prelude.Eq, ReadPrec [DissociatePackageResponse]
ReadPrec DissociatePackageResponse
Int -> ReadS DissociatePackageResponse
ReadS [DissociatePackageResponse]
(Int -> ReadS DissociatePackageResponse)
-> ReadS [DissociatePackageResponse]
-> ReadPrec DissociatePackageResponse
-> ReadPrec [DissociatePackageResponse]
-> Read DissociatePackageResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DissociatePackageResponse]
$creadListPrec :: ReadPrec [DissociatePackageResponse]
readPrec :: ReadPrec DissociatePackageResponse
$creadPrec :: ReadPrec DissociatePackageResponse
readList :: ReadS [DissociatePackageResponse]
$creadList :: ReadS [DissociatePackageResponse]
readsPrec :: Int -> ReadS DissociatePackageResponse
$creadsPrec :: Int -> ReadS DissociatePackageResponse
Prelude.Read, Int -> DissociatePackageResponse -> ShowS
[DissociatePackageResponse] -> ShowS
DissociatePackageResponse -> String
(Int -> DissociatePackageResponse -> ShowS)
-> (DissociatePackageResponse -> String)
-> ([DissociatePackageResponse] -> ShowS)
-> Show DissociatePackageResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DissociatePackageResponse] -> ShowS
$cshowList :: [DissociatePackageResponse] -> ShowS
show :: DissociatePackageResponse -> String
$cshow :: DissociatePackageResponse -> String
showsPrec :: Int -> DissociatePackageResponse -> ShowS
$cshowsPrec :: Int -> DissociatePackageResponse -> ShowS
Prelude.Show, (forall x.
DissociatePackageResponse -> Rep DissociatePackageResponse x)
-> (forall x.
Rep DissociatePackageResponse x -> DissociatePackageResponse)
-> Generic DissociatePackageResponse
forall x.
Rep DissociatePackageResponse x -> DissociatePackageResponse
forall x.
DissociatePackageResponse -> Rep DissociatePackageResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DissociatePackageResponse x -> DissociatePackageResponse
$cfrom :: forall x.
DissociatePackageResponse -> Rep DissociatePackageResponse x
Prelude.Generic)
newDissociatePackageResponse ::
Prelude.Int ->
DissociatePackageResponse
newDissociatePackageResponse :: Int -> DissociatePackageResponse
newDissociatePackageResponse Int
pHttpStatus_ =
DissociatePackageResponse' :: Maybe DomainPackageDetails -> Int -> DissociatePackageResponse
DissociatePackageResponse'
{ $sel:domainPackageDetails:DissociatePackageResponse' :: Maybe DomainPackageDetails
domainPackageDetails =
Maybe DomainPackageDetails
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DissociatePackageResponse' :: Int
httpStatus = Int
pHttpStatus_
}
dissociatePackageResponse_domainPackageDetails :: Lens.Lens' DissociatePackageResponse (Prelude.Maybe DomainPackageDetails)
dissociatePackageResponse_domainPackageDetails :: (Maybe DomainPackageDetails -> f (Maybe DomainPackageDetails))
-> DissociatePackageResponse -> f DissociatePackageResponse
dissociatePackageResponse_domainPackageDetails = (DissociatePackageResponse -> Maybe DomainPackageDetails)
-> (DissociatePackageResponse
-> Maybe DomainPackageDetails -> DissociatePackageResponse)
-> Lens
DissociatePackageResponse
DissociatePackageResponse
(Maybe DomainPackageDetails)
(Maybe DomainPackageDetails)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DissociatePackageResponse' {Maybe DomainPackageDetails
domainPackageDetails :: Maybe DomainPackageDetails
$sel:domainPackageDetails:DissociatePackageResponse' :: DissociatePackageResponse -> Maybe DomainPackageDetails
domainPackageDetails} -> Maybe DomainPackageDetails
domainPackageDetails) (\s :: DissociatePackageResponse
s@DissociatePackageResponse' {} Maybe DomainPackageDetails
a -> DissociatePackageResponse
s {$sel:domainPackageDetails:DissociatePackageResponse' :: Maybe DomainPackageDetails
domainPackageDetails = Maybe DomainPackageDetails
a} :: DissociatePackageResponse)
dissociatePackageResponse_httpStatus :: Lens.Lens' DissociatePackageResponse Prelude.Int
dissociatePackageResponse_httpStatus :: (Int -> f Int)
-> DissociatePackageResponse -> f DissociatePackageResponse
dissociatePackageResponse_httpStatus = (DissociatePackageResponse -> Int)
-> (DissociatePackageResponse -> Int -> DissociatePackageResponse)
-> Lens DissociatePackageResponse DissociatePackageResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DissociatePackageResponse' {Int
httpStatus :: Int
$sel:httpStatus:DissociatePackageResponse' :: DissociatePackageResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DissociatePackageResponse
s@DissociatePackageResponse' {} Int
a -> DissociatePackageResponse
s {$sel:httpStatus:DissociatePackageResponse' :: Int
httpStatus = Int
a} :: DissociatePackageResponse)
instance Prelude.NFData DissociatePackageResponse