{-# 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.Schemas.GetDiscoveredSchema
(
GetDiscoveredSchema (..),
newGetDiscoveredSchema,
getDiscoveredSchema_type,
getDiscoveredSchema_events,
GetDiscoveredSchemaResponse (..),
newGetDiscoveredSchemaResponse,
getDiscoveredSchemaResponse_content,
getDiscoveredSchemaResponse_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.Schemas.Types
data GetDiscoveredSchema = GetDiscoveredSchema'
{
GetDiscoveredSchema -> Type
type' :: Type,
GetDiscoveredSchema -> NonEmpty Text
events :: Prelude.NonEmpty Prelude.Text
}
deriving (GetDiscoveredSchema -> GetDiscoveredSchema -> Bool
(GetDiscoveredSchema -> GetDiscoveredSchema -> Bool)
-> (GetDiscoveredSchema -> GetDiscoveredSchema -> Bool)
-> Eq GetDiscoveredSchema
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDiscoveredSchema -> GetDiscoveredSchema -> Bool
$c/= :: GetDiscoveredSchema -> GetDiscoveredSchema -> Bool
== :: GetDiscoveredSchema -> GetDiscoveredSchema -> Bool
$c== :: GetDiscoveredSchema -> GetDiscoveredSchema -> Bool
Prelude.Eq, ReadPrec [GetDiscoveredSchema]
ReadPrec GetDiscoveredSchema
Int -> ReadS GetDiscoveredSchema
ReadS [GetDiscoveredSchema]
(Int -> ReadS GetDiscoveredSchema)
-> ReadS [GetDiscoveredSchema]
-> ReadPrec GetDiscoveredSchema
-> ReadPrec [GetDiscoveredSchema]
-> Read GetDiscoveredSchema
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDiscoveredSchema]
$creadListPrec :: ReadPrec [GetDiscoveredSchema]
readPrec :: ReadPrec GetDiscoveredSchema
$creadPrec :: ReadPrec GetDiscoveredSchema
readList :: ReadS [GetDiscoveredSchema]
$creadList :: ReadS [GetDiscoveredSchema]
readsPrec :: Int -> ReadS GetDiscoveredSchema
$creadsPrec :: Int -> ReadS GetDiscoveredSchema
Prelude.Read, Int -> GetDiscoveredSchema -> ShowS
[GetDiscoveredSchema] -> ShowS
GetDiscoveredSchema -> String
(Int -> GetDiscoveredSchema -> ShowS)
-> (GetDiscoveredSchema -> String)
-> ([GetDiscoveredSchema] -> ShowS)
-> Show GetDiscoveredSchema
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDiscoveredSchema] -> ShowS
$cshowList :: [GetDiscoveredSchema] -> ShowS
show :: GetDiscoveredSchema -> String
$cshow :: GetDiscoveredSchema -> String
showsPrec :: Int -> GetDiscoveredSchema -> ShowS
$cshowsPrec :: Int -> GetDiscoveredSchema -> ShowS
Prelude.Show, (forall x. GetDiscoveredSchema -> Rep GetDiscoveredSchema x)
-> (forall x. Rep GetDiscoveredSchema x -> GetDiscoveredSchema)
-> Generic GetDiscoveredSchema
forall x. Rep GetDiscoveredSchema x -> GetDiscoveredSchema
forall x. GetDiscoveredSchema -> Rep GetDiscoveredSchema x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetDiscoveredSchema x -> GetDiscoveredSchema
$cfrom :: forall x. GetDiscoveredSchema -> Rep GetDiscoveredSchema x
Prelude.Generic)
newGetDiscoveredSchema ::
Type ->
Prelude.NonEmpty Prelude.Text ->
GetDiscoveredSchema
newGetDiscoveredSchema :: Type -> NonEmpty Text -> GetDiscoveredSchema
newGetDiscoveredSchema Type
pType_ NonEmpty Text
pEvents_ =
GetDiscoveredSchema' :: Type -> NonEmpty Text -> GetDiscoveredSchema
GetDiscoveredSchema'
{ $sel:type':GetDiscoveredSchema' :: Type
type' = Type
pType_,
$sel:events:GetDiscoveredSchema' :: NonEmpty Text
events = Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pEvents_
}
getDiscoveredSchema_type :: Lens.Lens' GetDiscoveredSchema Type
getDiscoveredSchema_type :: (Type -> f Type) -> GetDiscoveredSchema -> f GetDiscoveredSchema
getDiscoveredSchema_type = (GetDiscoveredSchema -> Type)
-> (GetDiscoveredSchema -> Type -> GetDiscoveredSchema)
-> Lens GetDiscoveredSchema GetDiscoveredSchema Type Type
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDiscoveredSchema' {Type
type' :: Type
$sel:type':GetDiscoveredSchema' :: GetDiscoveredSchema -> Type
type'} -> Type
type') (\s :: GetDiscoveredSchema
s@GetDiscoveredSchema' {} Type
a -> GetDiscoveredSchema
s {$sel:type':GetDiscoveredSchema' :: Type
type' = Type
a} :: GetDiscoveredSchema)
getDiscoveredSchema_events :: Lens.Lens' GetDiscoveredSchema (Prelude.NonEmpty Prelude.Text)
getDiscoveredSchema_events :: (NonEmpty Text -> f (NonEmpty Text))
-> GetDiscoveredSchema -> f GetDiscoveredSchema
getDiscoveredSchema_events = (GetDiscoveredSchema -> NonEmpty Text)
-> (GetDiscoveredSchema -> NonEmpty Text -> GetDiscoveredSchema)
-> Lens
GetDiscoveredSchema
GetDiscoveredSchema
(NonEmpty Text)
(NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDiscoveredSchema' {NonEmpty Text
events :: NonEmpty Text
$sel:events:GetDiscoveredSchema' :: GetDiscoveredSchema -> NonEmpty Text
events} -> NonEmpty Text
events) (\s :: GetDiscoveredSchema
s@GetDiscoveredSchema' {} NonEmpty Text
a -> GetDiscoveredSchema
s {$sel:events:GetDiscoveredSchema' :: NonEmpty Text
events = NonEmpty Text
a} :: GetDiscoveredSchema) ((NonEmpty Text -> f (NonEmpty Text))
-> GetDiscoveredSchema -> f GetDiscoveredSchema)
-> ((NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> GetDiscoveredSchema
-> f GetDiscoveredSchema
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest GetDiscoveredSchema where
type
AWSResponse GetDiscoveredSchema =
GetDiscoveredSchemaResponse
request :: GetDiscoveredSchema -> Request GetDiscoveredSchema
request = Service -> GetDiscoveredSchema -> Request GetDiscoveredSchema
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetDiscoveredSchema
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetDiscoveredSchema)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetDiscoveredSchema))
-> Logger
-> Service
-> Proxy GetDiscoveredSchema
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetDiscoveredSchema)))
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 Text -> Int -> GetDiscoveredSchemaResponse
GetDiscoveredSchemaResponse'
(Maybe Text -> Int -> GetDiscoveredSchemaResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetDiscoveredSchemaResponse)
forall (f :: * -> *) a b. Functor 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
"Content")
Either String (Int -> GetDiscoveredSchemaResponse)
-> Either String Int -> Either String GetDiscoveredSchemaResponse
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 GetDiscoveredSchema
instance Prelude.NFData GetDiscoveredSchema
instance Core.ToHeaders GetDiscoveredSchema where
toHeaders :: GetDiscoveredSchema -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetDiscoveredSchema -> 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 GetDiscoveredSchema where
toJSON :: GetDiscoveredSchema -> Value
toJSON GetDiscoveredSchema' {NonEmpty Text
Type
events :: NonEmpty Text
type' :: Type
$sel:events:GetDiscoveredSchema' :: GetDiscoveredSchema -> NonEmpty Text
$sel:type':GetDiscoveredSchema' :: GetDiscoveredSchema -> Type
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Type" Text -> Type -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Type
type'),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Events" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
events)
]
)
instance Core.ToPath GetDiscoveredSchema where
toPath :: GetDiscoveredSchema -> ByteString
toPath = ByteString -> GetDiscoveredSchema -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/v1/discover"
instance Core.ToQuery GetDiscoveredSchema where
toQuery :: GetDiscoveredSchema -> QueryString
toQuery = QueryString -> GetDiscoveredSchema -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetDiscoveredSchemaResponse = GetDiscoveredSchemaResponse'
{
GetDiscoveredSchemaResponse -> Maybe Text
content :: Prelude.Maybe Prelude.Text,
GetDiscoveredSchemaResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetDiscoveredSchemaResponse -> GetDiscoveredSchemaResponse -> Bool
(GetDiscoveredSchemaResponse
-> GetDiscoveredSchemaResponse -> Bool)
-> (GetDiscoveredSchemaResponse
-> GetDiscoveredSchemaResponse -> Bool)
-> Eq GetDiscoveredSchemaResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDiscoveredSchemaResponse -> GetDiscoveredSchemaResponse -> Bool
$c/= :: GetDiscoveredSchemaResponse -> GetDiscoveredSchemaResponse -> Bool
== :: GetDiscoveredSchemaResponse -> GetDiscoveredSchemaResponse -> Bool
$c== :: GetDiscoveredSchemaResponse -> GetDiscoveredSchemaResponse -> Bool
Prelude.Eq, ReadPrec [GetDiscoveredSchemaResponse]
ReadPrec GetDiscoveredSchemaResponse
Int -> ReadS GetDiscoveredSchemaResponse
ReadS [GetDiscoveredSchemaResponse]
(Int -> ReadS GetDiscoveredSchemaResponse)
-> ReadS [GetDiscoveredSchemaResponse]
-> ReadPrec GetDiscoveredSchemaResponse
-> ReadPrec [GetDiscoveredSchemaResponse]
-> Read GetDiscoveredSchemaResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDiscoveredSchemaResponse]
$creadListPrec :: ReadPrec [GetDiscoveredSchemaResponse]
readPrec :: ReadPrec GetDiscoveredSchemaResponse
$creadPrec :: ReadPrec GetDiscoveredSchemaResponse
readList :: ReadS [GetDiscoveredSchemaResponse]
$creadList :: ReadS [GetDiscoveredSchemaResponse]
readsPrec :: Int -> ReadS GetDiscoveredSchemaResponse
$creadsPrec :: Int -> ReadS GetDiscoveredSchemaResponse
Prelude.Read, Int -> GetDiscoveredSchemaResponse -> ShowS
[GetDiscoveredSchemaResponse] -> ShowS
GetDiscoveredSchemaResponse -> String
(Int -> GetDiscoveredSchemaResponse -> ShowS)
-> (GetDiscoveredSchemaResponse -> String)
-> ([GetDiscoveredSchemaResponse] -> ShowS)
-> Show GetDiscoveredSchemaResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDiscoveredSchemaResponse] -> ShowS
$cshowList :: [GetDiscoveredSchemaResponse] -> ShowS
show :: GetDiscoveredSchemaResponse -> String
$cshow :: GetDiscoveredSchemaResponse -> String
showsPrec :: Int -> GetDiscoveredSchemaResponse -> ShowS
$cshowsPrec :: Int -> GetDiscoveredSchemaResponse -> ShowS
Prelude.Show, (forall x.
GetDiscoveredSchemaResponse -> Rep GetDiscoveredSchemaResponse x)
-> (forall x.
Rep GetDiscoveredSchemaResponse x -> GetDiscoveredSchemaResponse)
-> Generic GetDiscoveredSchemaResponse
forall x.
Rep GetDiscoveredSchemaResponse x -> GetDiscoveredSchemaResponse
forall x.
GetDiscoveredSchemaResponse -> Rep GetDiscoveredSchemaResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetDiscoveredSchemaResponse x -> GetDiscoveredSchemaResponse
$cfrom :: forall x.
GetDiscoveredSchemaResponse -> Rep GetDiscoveredSchemaResponse x
Prelude.Generic)
newGetDiscoveredSchemaResponse ::
Prelude.Int ->
GetDiscoveredSchemaResponse
newGetDiscoveredSchemaResponse :: Int -> GetDiscoveredSchemaResponse
newGetDiscoveredSchemaResponse Int
pHttpStatus_ =
GetDiscoveredSchemaResponse' :: Maybe Text -> Int -> GetDiscoveredSchemaResponse
GetDiscoveredSchemaResponse'
{ $sel:content:GetDiscoveredSchemaResponse' :: Maybe Text
content =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetDiscoveredSchemaResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getDiscoveredSchemaResponse_content :: Lens.Lens' GetDiscoveredSchemaResponse (Prelude.Maybe Prelude.Text)
getDiscoveredSchemaResponse_content :: (Maybe Text -> f (Maybe Text))
-> GetDiscoveredSchemaResponse -> f GetDiscoveredSchemaResponse
getDiscoveredSchemaResponse_content = (GetDiscoveredSchemaResponse -> Maybe Text)
-> (GetDiscoveredSchemaResponse
-> Maybe Text -> GetDiscoveredSchemaResponse)
-> Lens
GetDiscoveredSchemaResponse
GetDiscoveredSchemaResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDiscoveredSchemaResponse' {Maybe Text
content :: Maybe Text
$sel:content:GetDiscoveredSchemaResponse' :: GetDiscoveredSchemaResponse -> Maybe Text
content} -> Maybe Text
content) (\s :: GetDiscoveredSchemaResponse
s@GetDiscoveredSchemaResponse' {} Maybe Text
a -> GetDiscoveredSchemaResponse
s {$sel:content:GetDiscoveredSchemaResponse' :: Maybe Text
content = Maybe Text
a} :: GetDiscoveredSchemaResponse)
getDiscoveredSchemaResponse_httpStatus :: Lens.Lens' GetDiscoveredSchemaResponse Prelude.Int
getDiscoveredSchemaResponse_httpStatus :: (Int -> f Int)
-> GetDiscoveredSchemaResponse -> f GetDiscoveredSchemaResponse
getDiscoveredSchemaResponse_httpStatus = (GetDiscoveredSchemaResponse -> Int)
-> (GetDiscoveredSchemaResponse
-> Int -> GetDiscoveredSchemaResponse)
-> Lens
GetDiscoveredSchemaResponse GetDiscoveredSchemaResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDiscoveredSchemaResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetDiscoveredSchemaResponse' :: GetDiscoveredSchemaResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetDiscoveredSchemaResponse
s@GetDiscoveredSchemaResponse' {} Int
a -> GetDiscoveredSchemaResponse
s {$sel:httpStatus:GetDiscoveredSchemaResponse' :: Int
httpStatus = Int
a} :: GetDiscoveredSchemaResponse)
instance Prelude.NFData GetDiscoveredSchemaResponse