{-# 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.CloudDirectory.GetFacet
(
GetFacet (..),
newGetFacet,
getFacet_schemaArn,
getFacet_name,
GetFacetResponse (..),
newGetFacetResponse,
getFacetResponse_facet,
getFacetResponse_httpStatus,
)
where
import Amazonka.CloudDirectory.Types
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
data GetFacet = GetFacet'
{
GetFacet -> Text
schemaArn :: Prelude.Text,
GetFacet -> Text
name :: Prelude.Text
}
deriving (GetFacet -> GetFacet -> Bool
(GetFacet -> GetFacet -> Bool)
-> (GetFacet -> GetFacet -> Bool) -> Eq GetFacet
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetFacet -> GetFacet -> Bool
$c/= :: GetFacet -> GetFacet -> Bool
== :: GetFacet -> GetFacet -> Bool
$c== :: GetFacet -> GetFacet -> Bool
Prelude.Eq, ReadPrec [GetFacet]
ReadPrec GetFacet
Int -> ReadS GetFacet
ReadS [GetFacet]
(Int -> ReadS GetFacet)
-> ReadS [GetFacet]
-> ReadPrec GetFacet
-> ReadPrec [GetFacet]
-> Read GetFacet
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetFacet]
$creadListPrec :: ReadPrec [GetFacet]
readPrec :: ReadPrec GetFacet
$creadPrec :: ReadPrec GetFacet
readList :: ReadS [GetFacet]
$creadList :: ReadS [GetFacet]
readsPrec :: Int -> ReadS GetFacet
$creadsPrec :: Int -> ReadS GetFacet
Prelude.Read, Int -> GetFacet -> ShowS
[GetFacet] -> ShowS
GetFacet -> String
(Int -> GetFacet -> ShowS)
-> (GetFacet -> String) -> ([GetFacet] -> ShowS) -> Show GetFacet
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetFacet] -> ShowS
$cshowList :: [GetFacet] -> ShowS
show :: GetFacet -> String
$cshow :: GetFacet -> String
showsPrec :: Int -> GetFacet -> ShowS
$cshowsPrec :: Int -> GetFacet -> ShowS
Prelude.Show, (forall x. GetFacet -> Rep GetFacet x)
-> (forall x. Rep GetFacet x -> GetFacet) -> Generic GetFacet
forall x. Rep GetFacet x -> GetFacet
forall x. GetFacet -> Rep GetFacet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetFacet x -> GetFacet
$cfrom :: forall x. GetFacet -> Rep GetFacet x
Prelude.Generic)
newGetFacet ::
Prelude.Text ->
Prelude.Text ->
GetFacet
newGetFacet :: Text -> Text -> GetFacet
newGetFacet Text
pSchemaArn_ Text
pName_ =
GetFacet' :: Text -> Text -> GetFacet
GetFacet' {$sel:schemaArn:GetFacet' :: Text
schemaArn = Text
pSchemaArn_, $sel:name:GetFacet' :: Text
name = Text
pName_}
getFacet_schemaArn :: Lens.Lens' GetFacet Prelude.Text
getFacet_schemaArn :: (Text -> f Text) -> GetFacet -> f GetFacet
getFacet_schemaArn = (GetFacet -> Text)
-> (GetFacet -> Text -> GetFacet)
-> Lens GetFacet GetFacet Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFacet' {Text
schemaArn :: Text
$sel:schemaArn:GetFacet' :: GetFacet -> Text
schemaArn} -> Text
schemaArn) (\s :: GetFacet
s@GetFacet' {} Text
a -> GetFacet
s {$sel:schemaArn:GetFacet' :: Text
schemaArn = Text
a} :: GetFacet)
getFacet_name :: Lens.Lens' GetFacet Prelude.Text
getFacet_name :: (Text -> f Text) -> GetFacet -> f GetFacet
getFacet_name = (GetFacet -> Text)
-> (GetFacet -> Text -> GetFacet)
-> Lens GetFacet GetFacet Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFacet' {Text
name :: Text
$sel:name:GetFacet' :: GetFacet -> Text
name} -> Text
name) (\s :: GetFacet
s@GetFacet' {} Text
a -> GetFacet
s {$sel:name:GetFacet' :: Text
name = Text
a} :: GetFacet)
instance Core.AWSRequest GetFacet where
type AWSResponse GetFacet = GetFacetResponse
request :: GetFacet -> Request GetFacet
request = Service -> GetFacet -> Request GetFacet
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetFacet
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetFacet)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetFacet))
-> Logger
-> Service
-> Proxy GetFacet
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetFacet)))
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 Facet -> Int -> GetFacetResponse
GetFacetResponse'
(Maybe Facet -> Int -> GetFacetResponse)
-> Either String (Maybe Facet)
-> Either String (Int -> GetFacetResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Facet)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Facet")
Either String (Int -> GetFacetResponse)
-> Either String Int -> Either String GetFacetResponse
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 GetFacet
instance Prelude.NFData GetFacet
instance Core.ToHeaders GetFacet where
toHeaders :: GetFacet -> ResponseHeaders
toHeaders GetFacet' {Text
name :: Text
schemaArn :: Text
$sel:name:GetFacet' :: GetFacet -> Text
$sel:schemaArn:GetFacet' :: GetFacet -> Text
..} =
[ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[HeaderName
"x-amz-data-partition" HeaderName -> Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Text
schemaArn]
instance Core.ToJSON GetFacet where
toJSON :: GetFacet -> Value
toJSON GetFacet' {Text
name :: Text
schemaArn :: Text
$sel:name:GetFacet' :: GetFacet -> Text
$sel:schemaArn:GetFacet' :: GetFacet -> Text
..} =
[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
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)]
)
instance Core.ToPath GetFacet where
toPath :: GetFacet -> ByteString
toPath =
ByteString -> GetFacet -> ByteString
forall a b. a -> b -> a
Prelude.const
ByteString
"/amazonclouddirectory/2017-01-11/facet"
instance Core.ToQuery GetFacet where
toQuery :: GetFacet -> QueryString
toQuery = QueryString -> GetFacet -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetFacetResponse = GetFacetResponse'
{
GetFacetResponse -> Maybe Facet
facet :: Prelude.Maybe Facet,
GetFacetResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetFacetResponse -> GetFacetResponse -> Bool
(GetFacetResponse -> GetFacetResponse -> Bool)
-> (GetFacetResponse -> GetFacetResponse -> Bool)
-> Eq GetFacetResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetFacetResponse -> GetFacetResponse -> Bool
$c/= :: GetFacetResponse -> GetFacetResponse -> Bool
== :: GetFacetResponse -> GetFacetResponse -> Bool
$c== :: GetFacetResponse -> GetFacetResponse -> Bool
Prelude.Eq, ReadPrec [GetFacetResponse]
ReadPrec GetFacetResponse
Int -> ReadS GetFacetResponse
ReadS [GetFacetResponse]
(Int -> ReadS GetFacetResponse)
-> ReadS [GetFacetResponse]
-> ReadPrec GetFacetResponse
-> ReadPrec [GetFacetResponse]
-> Read GetFacetResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetFacetResponse]
$creadListPrec :: ReadPrec [GetFacetResponse]
readPrec :: ReadPrec GetFacetResponse
$creadPrec :: ReadPrec GetFacetResponse
readList :: ReadS [GetFacetResponse]
$creadList :: ReadS [GetFacetResponse]
readsPrec :: Int -> ReadS GetFacetResponse
$creadsPrec :: Int -> ReadS GetFacetResponse
Prelude.Read, Int -> GetFacetResponse -> ShowS
[GetFacetResponse] -> ShowS
GetFacetResponse -> String
(Int -> GetFacetResponse -> ShowS)
-> (GetFacetResponse -> String)
-> ([GetFacetResponse] -> ShowS)
-> Show GetFacetResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetFacetResponse] -> ShowS
$cshowList :: [GetFacetResponse] -> ShowS
show :: GetFacetResponse -> String
$cshow :: GetFacetResponse -> String
showsPrec :: Int -> GetFacetResponse -> ShowS
$cshowsPrec :: Int -> GetFacetResponse -> ShowS
Prelude.Show, (forall x. GetFacetResponse -> Rep GetFacetResponse x)
-> (forall x. Rep GetFacetResponse x -> GetFacetResponse)
-> Generic GetFacetResponse
forall x. Rep GetFacetResponse x -> GetFacetResponse
forall x. GetFacetResponse -> Rep GetFacetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetFacetResponse x -> GetFacetResponse
$cfrom :: forall x. GetFacetResponse -> Rep GetFacetResponse x
Prelude.Generic)
newGetFacetResponse ::
Prelude.Int ->
GetFacetResponse
newGetFacetResponse :: Int -> GetFacetResponse
newGetFacetResponse Int
pHttpStatus_ =
GetFacetResponse' :: Maybe Facet -> Int -> GetFacetResponse
GetFacetResponse'
{ $sel:facet:GetFacetResponse' :: Maybe Facet
facet = Maybe Facet
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetFacetResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getFacetResponse_facet :: Lens.Lens' GetFacetResponse (Prelude.Maybe Facet)
getFacetResponse_facet :: (Maybe Facet -> f (Maybe Facet))
-> GetFacetResponse -> f GetFacetResponse
getFacetResponse_facet = (GetFacetResponse -> Maybe Facet)
-> (GetFacetResponse -> Maybe Facet -> GetFacetResponse)
-> Lens
GetFacetResponse GetFacetResponse (Maybe Facet) (Maybe Facet)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFacetResponse' {Maybe Facet
facet :: Maybe Facet
$sel:facet:GetFacetResponse' :: GetFacetResponse -> Maybe Facet
facet} -> Maybe Facet
facet) (\s :: GetFacetResponse
s@GetFacetResponse' {} Maybe Facet
a -> GetFacetResponse
s {$sel:facet:GetFacetResponse' :: Maybe Facet
facet = Maybe Facet
a} :: GetFacetResponse)
getFacetResponse_httpStatus :: Lens.Lens' GetFacetResponse Prelude.Int
getFacetResponse_httpStatus :: (Int -> f Int) -> GetFacetResponse -> f GetFacetResponse
getFacetResponse_httpStatus = (GetFacetResponse -> Int)
-> (GetFacetResponse -> Int -> GetFacetResponse)
-> Lens GetFacetResponse GetFacetResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetFacetResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetFacetResponse' :: GetFacetResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetFacetResponse
s@GetFacetResponse' {} Int
a -> GetFacetResponse
s {$sel:httpStatus:GetFacetResponse' :: Int
httpStatus = Int
a} :: GetFacetResponse)
instance Prelude.NFData GetFacetResponse