{-# 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.ServiceCatalog.DescribeConstraint
(
DescribeConstraint (..),
newDescribeConstraint,
describeConstraint_acceptLanguage,
describeConstraint_id,
DescribeConstraintResponse (..),
newDescribeConstraintResponse,
describeConstraintResponse_status,
describeConstraintResponse_constraintDetail,
describeConstraintResponse_constraintParameters,
describeConstraintResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.ServiceCatalog.Types
data DescribeConstraint = DescribeConstraint'
{
DescribeConstraint -> Maybe Text
acceptLanguage :: Prelude.Maybe Prelude.Text,
DescribeConstraint -> Text
id :: Prelude.Text
}
deriving (DescribeConstraint -> DescribeConstraint -> Bool
(DescribeConstraint -> DescribeConstraint -> Bool)
-> (DescribeConstraint -> DescribeConstraint -> Bool)
-> Eq DescribeConstraint
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeConstraint -> DescribeConstraint -> Bool
$c/= :: DescribeConstraint -> DescribeConstraint -> Bool
== :: DescribeConstraint -> DescribeConstraint -> Bool
$c== :: DescribeConstraint -> DescribeConstraint -> Bool
Prelude.Eq, ReadPrec [DescribeConstraint]
ReadPrec DescribeConstraint
Int -> ReadS DescribeConstraint
ReadS [DescribeConstraint]
(Int -> ReadS DescribeConstraint)
-> ReadS [DescribeConstraint]
-> ReadPrec DescribeConstraint
-> ReadPrec [DescribeConstraint]
-> Read DescribeConstraint
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeConstraint]
$creadListPrec :: ReadPrec [DescribeConstraint]
readPrec :: ReadPrec DescribeConstraint
$creadPrec :: ReadPrec DescribeConstraint
readList :: ReadS [DescribeConstraint]
$creadList :: ReadS [DescribeConstraint]
readsPrec :: Int -> ReadS DescribeConstraint
$creadsPrec :: Int -> ReadS DescribeConstraint
Prelude.Read, Int -> DescribeConstraint -> ShowS
[DescribeConstraint] -> ShowS
DescribeConstraint -> String
(Int -> DescribeConstraint -> ShowS)
-> (DescribeConstraint -> String)
-> ([DescribeConstraint] -> ShowS)
-> Show DescribeConstraint
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeConstraint] -> ShowS
$cshowList :: [DescribeConstraint] -> ShowS
show :: DescribeConstraint -> String
$cshow :: DescribeConstraint -> String
showsPrec :: Int -> DescribeConstraint -> ShowS
$cshowsPrec :: Int -> DescribeConstraint -> ShowS
Prelude.Show, (forall x. DescribeConstraint -> Rep DescribeConstraint x)
-> (forall x. Rep DescribeConstraint x -> DescribeConstraint)
-> Generic DescribeConstraint
forall x. Rep DescribeConstraint x -> DescribeConstraint
forall x. DescribeConstraint -> Rep DescribeConstraint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeConstraint x -> DescribeConstraint
$cfrom :: forall x. DescribeConstraint -> Rep DescribeConstraint x
Prelude.Generic)
newDescribeConstraint ::
Prelude.Text ->
DescribeConstraint
newDescribeConstraint :: Text -> DescribeConstraint
newDescribeConstraint Text
pId_ =
DescribeConstraint' :: Maybe Text -> Text -> DescribeConstraint
DescribeConstraint'
{ $sel:acceptLanguage:DescribeConstraint' :: Maybe Text
acceptLanguage =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:id:DescribeConstraint' :: Text
id = Text
pId_
}
describeConstraint_acceptLanguage :: Lens.Lens' DescribeConstraint (Prelude.Maybe Prelude.Text)
describeConstraint_acceptLanguage :: (Maybe Text -> f (Maybe Text))
-> DescribeConstraint -> f DescribeConstraint
describeConstraint_acceptLanguage = (DescribeConstraint -> Maybe Text)
-> (DescribeConstraint -> Maybe Text -> DescribeConstraint)
-> Lens
DescribeConstraint DescribeConstraint (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeConstraint' {Maybe Text
acceptLanguage :: Maybe Text
$sel:acceptLanguage:DescribeConstraint' :: DescribeConstraint -> Maybe Text
acceptLanguage} -> Maybe Text
acceptLanguage) (\s :: DescribeConstraint
s@DescribeConstraint' {} Maybe Text
a -> DescribeConstraint
s {$sel:acceptLanguage:DescribeConstraint' :: Maybe Text
acceptLanguage = Maybe Text
a} :: DescribeConstraint)
describeConstraint_id :: Lens.Lens' DescribeConstraint Prelude.Text
describeConstraint_id :: (Text -> f Text) -> DescribeConstraint -> f DescribeConstraint
describeConstraint_id = (DescribeConstraint -> Text)
-> (DescribeConstraint -> Text -> DescribeConstraint)
-> Lens DescribeConstraint DescribeConstraint Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeConstraint' {Text
id :: Text
$sel:id:DescribeConstraint' :: DescribeConstraint -> Text
id} -> Text
id) (\s :: DescribeConstraint
s@DescribeConstraint' {} Text
a -> DescribeConstraint
s {$sel:id:DescribeConstraint' :: Text
id = Text
a} :: DescribeConstraint)
instance Core.AWSRequest DescribeConstraint where
type
AWSResponse DescribeConstraint =
DescribeConstraintResponse
request :: DescribeConstraint -> Request DescribeConstraint
request = Service -> DescribeConstraint -> Request DescribeConstraint
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeConstraint
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeConstraint)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeConstraint))
-> Logger
-> Service
-> Proxy DescribeConstraint
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeConstraint)))
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 RequestStatus
-> Maybe ConstraintDetail
-> Maybe Text
-> Int
-> DescribeConstraintResponse
DescribeConstraintResponse'
(Maybe RequestStatus
-> Maybe ConstraintDetail
-> Maybe Text
-> Int
-> DescribeConstraintResponse)
-> Either String (Maybe RequestStatus)
-> Either
String
(Maybe ConstraintDetail
-> Maybe Text -> Int -> DescribeConstraintResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe RequestStatus)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Status")
Either
String
(Maybe ConstraintDetail
-> Maybe Text -> Int -> DescribeConstraintResponse)
-> Either String (Maybe ConstraintDetail)
-> Either String (Maybe Text -> Int -> DescribeConstraintResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe ConstraintDetail)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ConstraintDetail")
Either String (Maybe Text -> Int -> DescribeConstraintResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DescribeConstraintResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ConstraintParameters")
Either String (Int -> DescribeConstraintResponse)
-> Either String Int -> Either String DescribeConstraintResponse
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 DescribeConstraint
instance Prelude.NFData DescribeConstraint
instance Core.ToHeaders DescribeConstraint where
toHeaders :: DescribeConstraint -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeConstraint -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AWS242ServiceCatalogService.DescribeConstraint" ::
Prelude.ByteString
),
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 DescribeConstraint where
toJSON :: DescribeConstraint -> Value
toJSON DescribeConstraint' {Maybe Text
Text
id :: Text
acceptLanguage :: Maybe Text
$sel:id:DescribeConstraint' :: DescribeConstraint -> Text
$sel:acceptLanguage:DescribeConstraint' :: DescribeConstraint -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"AcceptLanguage" 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
acceptLanguage,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Id" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
id)
]
)
instance Core.ToPath DescribeConstraint where
toPath :: DescribeConstraint -> ByteString
toPath = ByteString -> DescribeConstraint -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeConstraint where
toQuery :: DescribeConstraint -> QueryString
toQuery = QueryString -> DescribeConstraint -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeConstraintResponse = DescribeConstraintResponse'
{
DescribeConstraintResponse -> Maybe RequestStatus
status :: Prelude.Maybe RequestStatus,
DescribeConstraintResponse -> Maybe ConstraintDetail
constraintDetail :: Prelude.Maybe ConstraintDetail,
DescribeConstraintResponse -> Maybe Text
constraintParameters :: Prelude.Maybe Prelude.Text,
DescribeConstraintResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeConstraintResponse -> DescribeConstraintResponse -> Bool
(DescribeConstraintResponse -> DescribeConstraintResponse -> Bool)
-> (DescribeConstraintResponse
-> DescribeConstraintResponse -> Bool)
-> Eq DescribeConstraintResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeConstraintResponse -> DescribeConstraintResponse -> Bool
$c/= :: DescribeConstraintResponse -> DescribeConstraintResponse -> Bool
== :: DescribeConstraintResponse -> DescribeConstraintResponse -> Bool
$c== :: DescribeConstraintResponse -> DescribeConstraintResponse -> Bool
Prelude.Eq, ReadPrec [DescribeConstraintResponse]
ReadPrec DescribeConstraintResponse
Int -> ReadS DescribeConstraintResponse
ReadS [DescribeConstraintResponse]
(Int -> ReadS DescribeConstraintResponse)
-> ReadS [DescribeConstraintResponse]
-> ReadPrec DescribeConstraintResponse
-> ReadPrec [DescribeConstraintResponse]
-> Read DescribeConstraintResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeConstraintResponse]
$creadListPrec :: ReadPrec [DescribeConstraintResponse]
readPrec :: ReadPrec DescribeConstraintResponse
$creadPrec :: ReadPrec DescribeConstraintResponse
readList :: ReadS [DescribeConstraintResponse]
$creadList :: ReadS [DescribeConstraintResponse]
readsPrec :: Int -> ReadS DescribeConstraintResponse
$creadsPrec :: Int -> ReadS DescribeConstraintResponse
Prelude.Read, Int -> DescribeConstraintResponse -> ShowS
[DescribeConstraintResponse] -> ShowS
DescribeConstraintResponse -> String
(Int -> DescribeConstraintResponse -> ShowS)
-> (DescribeConstraintResponse -> String)
-> ([DescribeConstraintResponse] -> ShowS)
-> Show DescribeConstraintResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeConstraintResponse] -> ShowS
$cshowList :: [DescribeConstraintResponse] -> ShowS
show :: DescribeConstraintResponse -> String
$cshow :: DescribeConstraintResponse -> String
showsPrec :: Int -> DescribeConstraintResponse -> ShowS
$cshowsPrec :: Int -> DescribeConstraintResponse -> ShowS
Prelude.Show, (forall x.
DescribeConstraintResponse -> Rep DescribeConstraintResponse x)
-> (forall x.
Rep DescribeConstraintResponse x -> DescribeConstraintResponse)
-> Generic DescribeConstraintResponse
forall x.
Rep DescribeConstraintResponse x -> DescribeConstraintResponse
forall x.
DescribeConstraintResponse -> Rep DescribeConstraintResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeConstraintResponse x -> DescribeConstraintResponse
$cfrom :: forall x.
DescribeConstraintResponse -> Rep DescribeConstraintResponse x
Prelude.Generic)
newDescribeConstraintResponse ::
Prelude.Int ->
DescribeConstraintResponse
newDescribeConstraintResponse :: Int -> DescribeConstraintResponse
newDescribeConstraintResponse Int
pHttpStatus_ =
DescribeConstraintResponse' :: Maybe RequestStatus
-> Maybe ConstraintDetail
-> Maybe Text
-> Int
-> DescribeConstraintResponse
DescribeConstraintResponse'
{ $sel:status:DescribeConstraintResponse' :: Maybe RequestStatus
status =
Maybe RequestStatus
forall a. Maybe a
Prelude.Nothing,
$sel:constraintDetail:DescribeConstraintResponse' :: Maybe ConstraintDetail
constraintDetail = Maybe ConstraintDetail
forall a. Maybe a
Prelude.Nothing,
$sel:constraintParameters:DescribeConstraintResponse' :: Maybe Text
constraintParameters = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeConstraintResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeConstraintResponse_status :: Lens.Lens' DescribeConstraintResponse (Prelude.Maybe RequestStatus)
describeConstraintResponse_status :: (Maybe RequestStatus -> f (Maybe RequestStatus))
-> DescribeConstraintResponse -> f DescribeConstraintResponse
describeConstraintResponse_status = (DescribeConstraintResponse -> Maybe RequestStatus)
-> (DescribeConstraintResponse
-> Maybe RequestStatus -> DescribeConstraintResponse)
-> Lens
DescribeConstraintResponse
DescribeConstraintResponse
(Maybe RequestStatus)
(Maybe RequestStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeConstraintResponse' {Maybe RequestStatus
status :: Maybe RequestStatus
$sel:status:DescribeConstraintResponse' :: DescribeConstraintResponse -> Maybe RequestStatus
status} -> Maybe RequestStatus
status) (\s :: DescribeConstraintResponse
s@DescribeConstraintResponse' {} Maybe RequestStatus
a -> DescribeConstraintResponse
s {$sel:status:DescribeConstraintResponse' :: Maybe RequestStatus
status = Maybe RequestStatus
a} :: DescribeConstraintResponse)
describeConstraintResponse_constraintDetail :: Lens.Lens' DescribeConstraintResponse (Prelude.Maybe ConstraintDetail)
describeConstraintResponse_constraintDetail :: (Maybe ConstraintDetail -> f (Maybe ConstraintDetail))
-> DescribeConstraintResponse -> f DescribeConstraintResponse
describeConstraintResponse_constraintDetail = (DescribeConstraintResponse -> Maybe ConstraintDetail)
-> (DescribeConstraintResponse
-> Maybe ConstraintDetail -> DescribeConstraintResponse)
-> Lens
DescribeConstraintResponse
DescribeConstraintResponse
(Maybe ConstraintDetail)
(Maybe ConstraintDetail)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeConstraintResponse' {Maybe ConstraintDetail
constraintDetail :: Maybe ConstraintDetail
$sel:constraintDetail:DescribeConstraintResponse' :: DescribeConstraintResponse -> Maybe ConstraintDetail
constraintDetail} -> Maybe ConstraintDetail
constraintDetail) (\s :: DescribeConstraintResponse
s@DescribeConstraintResponse' {} Maybe ConstraintDetail
a -> DescribeConstraintResponse
s {$sel:constraintDetail:DescribeConstraintResponse' :: Maybe ConstraintDetail
constraintDetail = Maybe ConstraintDetail
a} :: DescribeConstraintResponse)
describeConstraintResponse_constraintParameters :: Lens.Lens' DescribeConstraintResponse (Prelude.Maybe Prelude.Text)
describeConstraintResponse_constraintParameters :: (Maybe Text -> f (Maybe Text))
-> DescribeConstraintResponse -> f DescribeConstraintResponse
describeConstraintResponse_constraintParameters = (DescribeConstraintResponse -> Maybe Text)
-> (DescribeConstraintResponse
-> Maybe Text -> DescribeConstraintResponse)
-> Lens
DescribeConstraintResponse
DescribeConstraintResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeConstraintResponse' {Maybe Text
constraintParameters :: Maybe Text
$sel:constraintParameters:DescribeConstraintResponse' :: DescribeConstraintResponse -> Maybe Text
constraintParameters} -> Maybe Text
constraintParameters) (\s :: DescribeConstraintResponse
s@DescribeConstraintResponse' {} Maybe Text
a -> DescribeConstraintResponse
s {$sel:constraintParameters:DescribeConstraintResponse' :: Maybe Text
constraintParameters = Maybe Text
a} :: DescribeConstraintResponse)
describeConstraintResponse_httpStatus :: Lens.Lens' DescribeConstraintResponse Prelude.Int
describeConstraintResponse_httpStatus :: (Int -> f Int)
-> DescribeConstraintResponse -> f DescribeConstraintResponse
describeConstraintResponse_httpStatus = (DescribeConstraintResponse -> Int)
-> (DescribeConstraintResponse
-> Int -> DescribeConstraintResponse)
-> Lens
DescribeConstraintResponse DescribeConstraintResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeConstraintResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeConstraintResponse' :: DescribeConstraintResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeConstraintResponse
s@DescribeConstraintResponse' {} Int
a -> DescribeConstraintResponse
s {$sel:httpStatus:DescribeConstraintResponse' :: Int
httpStatus = Int
a} :: DescribeConstraintResponse)
instance Prelude.NFData DescribeConstraintResponse