{-# 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.GetObjectInformation
(
GetObjectInformation (..),
newGetObjectInformation,
getObjectInformation_consistencyLevel,
getObjectInformation_directoryArn,
getObjectInformation_objectReference,
GetObjectInformationResponse (..),
newGetObjectInformationResponse,
getObjectInformationResponse_objectIdentifier,
getObjectInformationResponse_schemaFacets,
getObjectInformationResponse_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 GetObjectInformation = GetObjectInformation'
{
GetObjectInformation -> Maybe ConsistencyLevel
consistencyLevel :: Prelude.Maybe ConsistencyLevel,
GetObjectInformation -> Text
directoryArn :: Prelude.Text,
GetObjectInformation -> ObjectReference
objectReference :: ObjectReference
}
deriving (GetObjectInformation -> GetObjectInformation -> Bool
(GetObjectInformation -> GetObjectInformation -> Bool)
-> (GetObjectInformation -> GetObjectInformation -> Bool)
-> Eq GetObjectInformation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetObjectInformation -> GetObjectInformation -> Bool
$c/= :: GetObjectInformation -> GetObjectInformation -> Bool
== :: GetObjectInformation -> GetObjectInformation -> Bool
$c== :: GetObjectInformation -> GetObjectInformation -> Bool
Prelude.Eq, ReadPrec [GetObjectInformation]
ReadPrec GetObjectInformation
Int -> ReadS GetObjectInformation
ReadS [GetObjectInformation]
(Int -> ReadS GetObjectInformation)
-> ReadS [GetObjectInformation]
-> ReadPrec GetObjectInformation
-> ReadPrec [GetObjectInformation]
-> Read GetObjectInformation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetObjectInformation]
$creadListPrec :: ReadPrec [GetObjectInformation]
readPrec :: ReadPrec GetObjectInformation
$creadPrec :: ReadPrec GetObjectInformation
readList :: ReadS [GetObjectInformation]
$creadList :: ReadS [GetObjectInformation]
readsPrec :: Int -> ReadS GetObjectInformation
$creadsPrec :: Int -> ReadS GetObjectInformation
Prelude.Read, Int -> GetObjectInformation -> ShowS
[GetObjectInformation] -> ShowS
GetObjectInformation -> String
(Int -> GetObjectInformation -> ShowS)
-> (GetObjectInformation -> String)
-> ([GetObjectInformation] -> ShowS)
-> Show GetObjectInformation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetObjectInformation] -> ShowS
$cshowList :: [GetObjectInformation] -> ShowS
show :: GetObjectInformation -> String
$cshow :: GetObjectInformation -> String
showsPrec :: Int -> GetObjectInformation -> ShowS
$cshowsPrec :: Int -> GetObjectInformation -> ShowS
Prelude.Show, (forall x. GetObjectInformation -> Rep GetObjectInformation x)
-> (forall x. Rep GetObjectInformation x -> GetObjectInformation)
-> Generic GetObjectInformation
forall x. Rep GetObjectInformation x -> GetObjectInformation
forall x. GetObjectInformation -> Rep GetObjectInformation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetObjectInformation x -> GetObjectInformation
$cfrom :: forall x. GetObjectInformation -> Rep GetObjectInformation x
Prelude.Generic)
newGetObjectInformation ::
Prelude.Text ->
ObjectReference ->
GetObjectInformation
newGetObjectInformation :: Text -> ObjectReference -> GetObjectInformation
newGetObjectInformation
Text
pDirectoryArn_
ObjectReference
pObjectReference_ =
GetObjectInformation' :: Maybe ConsistencyLevel
-> Text -> ObjectReference -> GetObjectInformation
GetObjectInformation'
{ $sel:consistencyLevel:GetObjectInformation' :: Maybe ConsistencyLevel
consistencyLevel =
Maybe ConsistencyLevel
forall a. Maybe a
Prelude.Nothing,
$sel:directoryArn:GetObjectInformation' :: Text
directoryArn = Text
pDirectoryArn_,
$sel:objectReference:GetObjectInformation' :: ObjectReference
objectReference = ObjectReference
pObjectReference_
}
getObjectInformation_consistencyLevel :: Lens.Lens' GetObjectInformation (Prelude.Maybe ConsistencyLevel)
getObjectInformation_consistencyLevel :: (Maybe ConsistencyLevel -> f (Maybe ConsistencyLevel))
-> GetObjectInformation -> f GetObjectInformation
getObjectInformation_consistencyLevel = (GetObjectInformation -> Maybe ConsistencyLevel)
-> (GetObjectInformation
-> Maybe ConsistencyLevel -> GetObjectInformation)
-> Lens
GetObjectInformation
GetObjectInformation
(Maybe ConsistencyLevel)
(Maybe ConsistencyLevel)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetObjectInformation' {Maybe ConsistencyLevel
consistencyLevel :: Maybe ConsistencyLevel
$sel:consistencyLevel:GetObjectInformation' :: GetObjectInformation -> Maybe ConsistencyLevel
consistencyLevel} -> Maybe ConsistencyLevel
consistencyLevel) (\s :: GetObjectInformation
s@GetObjectInformation' {} Maybe ConsistencyLevel
a -> GetObjectInformation
s {$sel:consistencyLevel:GetObjectInformation' :: Maybe ConsistencyLevel
consistencyLevel = Maybe ConsistencyLevel
a} :: GetObjectInformation)
getObjectInformation_directoryArn :: Lens.Lens' GetObjectInformation Prelude.Text
getObjectInformation_directoryArn :: (Text -> f Text) -> GetObjectInformation -> f GetObjectInformation
getObjectInformation_directoryArn = (GetObjectInformation -> Text)
-> (GetObjectInformation -> Text -> GetObjectInformation)
-> Lens GetObjectInformation GetObjectInformation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetObjectInformation' {Text
directoryArn :: Text
$sel:directoryArn:GetObjectInformation' :: GetObjectInformation -> Text
directoryArn} -> Text
directoryArn) (\s :: GetObjectInformation
s@GetObjectInformation' {} Text
a -> GetObjectInformation
s {$sel:directoryArn:GetObjectInformation' :: Text
directoryArn = Text
a} :: GetObjectInformation)
getObjectInformation_objectReference :: Lens.Lens' GetObjectInformation ObjectReference
getObjectInformation_objectReference :: (ObjectReference -> f ObjectReference)
-> GetObjectInformation -> f GetObjectInformation
getObjectInformation_objectReference = (GetObjectInformation -> ObjectReference)
-> (GetObjectInformation
-> ObjectReference -> GetObjectInformation)
-> Lens
GetObjectInformation
GetObjectInformation
ObjectReference
ObjectReference
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetObjectInformation' {ObjectReference
objectReference :: ObjectReference
$sel:objectReference:GetObjectInformation' :: GetObjectInformation -> ObjectReference
objectReference} -> ObjectReference
objectReference) (\s :: GetObjectInformation
s@GetObjectInformation' {} ObjectReference
a -> GetObjectInformation
s {$sel:objectReference:GetObjectInformation' :: ObjectReference
objectReference = ObjectReference
a} :: GetObjectInformation)
instance Core.AWSRequest GetObjectInformation where
type
AWSResponse GetObjectInformation =
GetObjectInformationResponse
request :: GetObjectInformation -> Request GetObjectInformation
request = Service -> GetObjectInformation -> Request GetObjectInformation
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetObjectInformation
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetObjectInformation)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetObjectInformation))
-> Logger
-> Service
-> Proxy GetObjectInformation
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetObjectInformation)))
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
-> Maybe [SchemaFacet] -> Int -> GetObjectInformationResponse
GetObjectInformationResponse'
(Maybe Text
-> Maybe [SchemaFacet] -> Int -> GetObjectInformationResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe [SchemaFacet] -> Int -> GetObjectInformationResponse)
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
"ObjectIdentifier")
Either
String (Maybe [SchemaFacet] -> Int -> GetObjectInformationResponse)
-> Either String (Maybe [SchemaFacet])
-> Either String (Int -> GetObjectInformationResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [SchemaFacet]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"SchemaFacets" Either String (Maybe (Maybe [SchemaFacet]))
-> Maybe [SchemaFacet] -> Either String (Maybe [SchemaFacet])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [SchemaFacet]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> GetObjectInformationResponse)
-> Either String Int -> Either String GetObjectInformationResponse
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 GetObjectInformation
instance Prelude.NFData GetObjectInformation
instance Core.ToHeaders GetObjectInformation where
toHeaders :: GetObjectInformation -> ResponseHeaders
toHeaders GetObjectInformation' {Maybe ConsistencyLevel
Text
ObjectReference
objectReference :: ObjectReference
directoryArn :: Text
consistencyLevel :: Maybe ConsistencyLevel
$sel:objectReference:GetObjectInformation' :: GetObjectInformation -> ObjectReference
$sel:directoryArn:GetObjectInformation' :: GetObjectInformation -> Text
$sel:consistencyLevel:GetObjectInformation' :: GetObjectInformation -> Maybe ConsistencyLevel
..} =
[ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"x-amz-consistency-level" HeaderName -> Maybe ConsistencyLevel -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe ConsistencyLevel
consistencyLevel,
HeaderName
"x-amz-data-partition" HeaderName -> Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Text
directoryArn
]
instance Core.ToJSON GetObjectInformation where
toJSON :: GetObjectInformation -> Value
toJSON GetObjectInformation' {Maybe ConsistencyLevel
Text
ObjectReference
objectReference :: ObjectReference
directoryArn :: Text
consistencyLevel :: Maybe ConsistencyLevel
$sel:objectReference:GetObjectInformation' :: GetObjectInformation -> ObjectReference
$sel:directoryArn:GetObjectInformation' :: GetObjectInformation -> Text
$sel:consistencyLevel:GetObjectInformation' :: GetObjectInformation -> Maybe ConsistencyLevel
..} =
[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
"ObjectReference" Text -> ObjectReference -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ObjectReference
objectReference)
]
)
instance Core.ToPath GetObjectInformation where
toPath :: GetObjectInformation -> ByteString
toPath =
ByteString -> GetObjectInformation -> ByteString
forall a b. a -> b -> a
Prelude.const
ByteString
"/amazonclouddirectory/2017-01-11/object/information"
instance Core.ToQuery GetObjectInformation where
toQuery :: GetObjectInformation -> QueryString
toQuery = QueryString -> GetObjectInformation -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetObjectInformationResponse = GetObjectInformationResponse'
{
GetObjectInformationResponse -> Maybe Text
objectIdentifier :: Prelude.Maybe Prelude.Text,
GetObjectInformationResponse -> Maybe [SchemaFacet]
schemaFacets :: Prelude.Maybe [SchemaFacet],
GetObjectInformationResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetObjectInformationResponse
-> GetObjectInformationResponse -> Bool
(GetObjectInformationResponse
-> GetObjectInformationResponse -> Bool)
-> (GetObjectInformationResponse
-> GetObjectInformationResponse -> Bool)
-> Eq GetObjectInformationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetObjectInformationResponse
-> GetObjectInformationResponse -> Bool
$c/= :: GetObjectInformationResponse
-> GetObjectInformationResponse -> Bool
== :: GetObjectInformationResponse
-> GetObjectInformationResponse -> Bool
$c== :: GetObjectInformationResponse
-> GetObjectInformationResponse -> Bool
Prelude.Eq, ReadPrec [GetObjectInformationResponse]
ReadPrec GetObjectInformationResponse
Int -> ReadS GetObjectInformationResponse
ReadS [GetObjectInformationResponse]
(Int -> ReadS GetObjectInformationResponse)
-> ReadS [GetObjectInformationResponse]
-> ReadPrec GetObjectInformationResponse
-> ReadPrec [GetObjectInformationResponse]
-> Read GetObjectInformationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetObjectInformationResponse]
$creadListPrec :: ReadPrec [GetObjectInformationResponse]
readPrec :: ReadPrec GetObjectInformationResponse
$creadPrec :: ReadPrec GetObjectInformationResponse
readList :: ReadS [GetObjectInformationResponse]
$creadList :: ReadS [GetObjectInformationResponse]
readsPrec :: Int -> ReadS GetObjectInformationResponse
$creadsPrec :: Int -> ReadS GetObjectInformationResponse
Prelude.Read, Int -> GetObjectInformationResponse -> ShowS
[GetObjectInformationResponse] -> ShowS
GetObjectInformationResponse -> String
(Int -> GetObjectInformationResponse -> ShowS)
-> (GetObjectInformationResponse -> String)
-> ([GetObjectInformationResponse] -> ShowS)
-> Show GetObjectInformationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetObjectInformationResponse] -> ShowS
$cshowList :: [GetObjectInformationResponse] -> ShowS
show :: GetObjectInformationResponse -> String
$cshow :: GetObjectInformationResponse -> String
showsPrec :: Int -> GetObjectInformationResponse -> ShowS
$cshowsPrec :: Int -> GetObjectInformationResponse -> ShowS
Prelude.Show, (forall x.
GetObjectInformationResponse -> Rep GetObjectInformationResponse x)
-> (forall x.
Rep GetObjectInformationResponse x -> GetObjectInformationResponse)
-> Generic GetObjectInformationResponse
forall x.
Rep GetObjectInformationResponse x -> GetObjectInformationResponse
forall x.
GetObjectInformationResponse -> Rep GetObjectInformationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetObjectInformationResponse x -> GetObjectInformationResponse
$cfrom :: forall x.
GetObjectInformationResponse -> Rep GetObjectInformationResponse x
Prelude.Generic)
newGetObjectInformationResponse ::
Prelude.Int ->
GetObjectInformationResponse
newGetObjectInformationResponse :: Int -> GetObjectInformationResponse
newGetObjectInformationResponse Int
pHttpStatus_ =
GetObjectInformationResponse' :: Maybe Text
-> Maybe [SchemaFacet] -> Int -> GetObjectInformationResponse
GetObjectInformationResponse'
{ $sel:objectIdentifier:GetObjectInformationResponse' :: Maybe Text
objectIdentifier =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:schemaFacets:GetObjectInformationResponse' :: Maybe [SchemaFacet]
schemaFacets = Maybe [SchemaFacet]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetObjectInformationResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getObjectInformationResponse_objectIdentifier :: Lens.Lens' GetObjectInformationResponse (Prelude.Maybe Prelude.Text)
getObjectInformationResponse_objectIdentifier :: (Maybe Text -> f (Maybe Text))
-> GetObjectInformationResponse -> f GetObjectInformationResponse
getObjectInformationResponse_objectIdentifier = (GetObjectInformationResponse -> Maybe Text)
-> (GetObjectInformationResponse
-> Maybe Text -> GetObjectInformationResponse)
-> Lens
GetObjectInformationResponse
GetObjectInformationResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetObjectInformationResponse' {Maybe Text
objectIdentifier :: Maybe Text
$sel:objectIdentifier:GetObjectInformationResponse' :: GetObjectInformationResponse -> Maybe Text
objectIdentifier} -> Maybe Text
objectIdentifier) (\s :: GetObjectInformationResponse
s@GetObjectInformationResponse' {} Maybe Text
a -> GetObjectInformationResponse
s {$sel:objectIdentifier:GetObjectInformationResponse' :: Maybe Text
objectIdentifier = Maybe Text
a} :: GetObjectInformationResponse)
getObjectInformationResponse_schemaFacets :: Lens.Lens' GetObjectInformationResponse (Prelude.Maybe [SchemaFacet])
getObjectInformationResponse_schemaFacets :: (Maybe [SchemaFacet] -> f (Maybe [SchemaFacet]))
-> GetObjectInformationResponse -> f GetObjectInformationResponse
getObjectInformationResponse_schemaFacets = (GetObjectInformationResponse -> Maybe [SchemaFacet])
-> (GetObjectInformationResponse
-> Maybe [SchemaFacet] -> GetObjectInformationResponse)
-> Lens
GetObjectInformationResponse
GetObjectInformationResponse
(Maybe [SchemaFacet])
(Maybe [SchemaFacet])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetObjectInformationResponse' {Maybe [SchemaFacet]
schemaFacets :: Maybe [SchemaFacet]
$sel:schemaFacets:GetObjectInformationResponse' :: GetObjectInformationResponse -> Maybe [SchemaFacet]
schemaFacets} -> Maybe [SchemaFacet]
schemaFacets) (\s :: GetObjectInformationResponse
s@GetObjectInformationResponse' {} Maybe [SchemaFacet]
a -> GetObjectInformationResponse
s {$sel:schemaFacets:GetObjectInformationResponse' :: Maybe [SchemaFacet]
schemaFacets = Maybe [SchemaFacet]
a} :: GetObjectInformationResponse) ((Maybe [SchemaFacet] -> f (Maybe [SchemaFacet]))
-> GetObjectInformationResponse -> f GetObjectInformationResponse)
-> ((Maybe [SchemaFacet] -> f (Maybe [SchemaFacet]))
-> Maybe [SchemaFacet] -> f (Maybe [SchemaFacet]))
-> (Maybe [SchemaFacet] -> f (Maybe [SchemaFacet]))
-> GetObjectInformationResponse
-> f GetObjectInformationResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [SchemaFacet] [SchemaFacet] [SchemaFacet] [SchemaFacet]
-> Iso
(Maybe [SchemaFacet])
(Maybe [SchemaFacet])
(Maybe [SchemaFacet])
(Maybe [SchemaFacet])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [SchemaFacet] [SchemaFacet] [SchemaFacet] [SchemaFacet]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getObjectInformationResponse_httpStatus :: Lens.Lens' GetObjectInformationResponse Prelude.Int
getObjectInformationResponse_httpStatus :: (Int -> f Int)
-> GetObjectInformationResponse -> f GetObjectInformationResponse
getObjectInformationResponse_httpStatus = (GetObjectInformationResponse -> Int)
-> (GetObjectInformationResponse
-> Int -> GetObjectInformationResponse)
-> Lens
GetObjectInformationResponse GetObjectInformationResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetObjectInformationResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetObjectInformationResponse' :: GetObjectInformationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetObjectInformationResponse
s@GetObjectInformationResponse' {} Int
a -> GetObjectInformationResponse
s {$sel:httpStatus:GetObjectInformationResponse' :: Int
httpStatus = Int
a} :: GetObjectInformationResponse)
instance Prelude.NFData GetObjectInformationResponse