{-# 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.CreateIndex
(
CreateIndex (..),
newCreateIndex,
createIndex_linkName,
createIndex_parentReference,
createIndex_directoryArn,
createIndex_orderedIndexedAttributeList,
createIndex_isUnique,
CreateIndexResponse (..),
newCreateIndexResponse,
createIndexResponse_objectIdentifier,
createIndexResponse_httpStatus,
)
where
import Amazonka.CloudDirectory.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreateIndex = CreateIndex'
{
CreateIndex -> Maybe Text
linkName :: Prelude.Maybe Prelude.Text,
CreateIndex -> Maybe ObjectReference
parentReference :: Prelude.Maybe ObjectReference,
CreateIndex -> Text
directoryArn :: Prelude.Text,
CreateIndex -> [AttributeKey]
orderedIndexedAttributeList :: [AttributeKey],
CreateIndex -> Bool
isUnique :: Prelude.Bool
}
deriving (CreateIndex -> CreateIndex -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateIndex -> CreateIndex -> Bool
$c/= :: CreateIndex -> CreateIndex -> Bool
== :: CreateIndex -> CreateIndex -> Bool
$c== :: CreateIndex -> CreateIndex -> Bool
Prelude.Eq, ReadPrec [CreateIndex]
ReadPrec CreateIndex
Int -> ReadS CreateIndex
ReadS [CreateIndex]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateIndex]
$creadListPrec :: ReadPrec [CreateIndex]
readPrec :: ReadPrec CreateIndex
$creadPrec :: ReadPrec CreateIndex
readList :: ReadS [CreateIndex]
$creadList :: ReadS [CreateIndex]
readsPrec :: Int -> ReadS CreateIndex
$creadsPrec :: Int -> ReadS CreateIndex
Prelude.Read, Int -> CreateIndex -> ShowS
[CreateIndex] -> ShowS
CreateIndex -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateIndex] -> ShowS
$cshowList :: [CreateIndex] -> ShowS
show :: CreateIndex -> String
$cshow :: CreateIndex -> String
showsPrec :: Int -> CreateIndex -> ShowS
$cshowsPrec :: Int -> CreateIndex -> ShowS
Prelude.Show, forall x. Rep CreateIndex x -> CreateIndex
forall x. CreateIndex -> Rep CreateIndex x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateIndex x -> CreateIndex
$cfrom :: forall x. CreateIndex -> Rep CreateIndex x
Prelude.Generic)
newCreateIndex ::
Prelude.Text ->
Prelude.Bool ->
CreateIndex
newCreateIndex :: Text -> Bool -> CreateIndex
newCreateIndex Text
pDirectoryArn_ Bool
pIsUnique_ =
CreateIndex'
{ $sel:linkName:CreateIndex' :: Maybe Text
linkName = forall a. Maybe a
Prelude.Nothing,
$sel:parentReference:CreateIndex' :: Maybe ObjectReference
parentReference = forall a. Maybe a
Prelude.Nothing,
$sel:directoryArn:CreateIndex' :: Text
directoryArn = Text
pDirectoryArn_,
$sel:orderedIndexedAttributeList:CreateIndex' :: [AttributeKey]
orderedIndexedAttributeList = forall a. Monoid a => a
Prelude.mempty,
$sel:isUnique:CreateIndex' :: Bool
isUnique = Bool
pIsUnique_
}
createIndex_linkName :: Lens.Lens' CreateIndex (Prelude.Maybe Prelude.Text)
createIndex_linkName :: Lens' CreateIndex (Maybe Text)
createIndex_linkName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateIndex' {Maybe Text
linkName :: Maybe Text
$sel:linkName:CreateIndex' :: CreateIndex -> Maybe Text
linkName} -> Maybe Text
linkName) (\s :: CreateIndex
s@CreateIndex' {} Maybe Text
a -> CreateIndex
s {$sel:linkName:CreateIndex' :: Maybe Text
linkName = Maybe Text
a} :: CreateIndex)
createIndex_parentReference :: Lens.Lens' CreateIndex (Prelude.Maybe ObjectReference)
createIndex_parentReference :: Lens' CreateIndex (Maybe ObjectReference)
createIndex_parentReference = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateIndex' {Maybe ObjectReference
parentReference :: Maybe ObjectReference
$sel:parentReference:CreateIndex' :: CreateIndex -> Maybe ObjectReference
parentReference} -> Maybe ObjectReference
parentReference) (\s :: CreateIndex
s@CreateIndex' {} Maybe ObjectReference
a -> CreateIndex
s {$sel:parentReference:CreateIndex' :: Maybe ObjectReference
parentReference = Maybe ObjectReference
a} :: CreateIndex)
createIndex_directoryArn :: Lens.Lens' CreateIndex Prelude.Text
createIndex_directoryArn :: Lens' CreateIndex Text
createIndex_directoryArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateIndex' {Text
directoryArn :: Text
$sel:directoryArn:CreateIndex' :: CreateIndex -> Text
directoryArn} -> Text
directoryArn) (\s :: CreateIndex
s@CreateIndex' {} Text
a -> CreateIndex
s {$sel:directoryArn:CreateIndex' :: Text
directoryArn = Text
a} :: CreateIndex)
createIndex_orderedIndexedAttributeList :: Lens.Lens' CreateIndex [AttributeKey]
createIndex_orderedIndexedAttributeList :: Lens' CreateIndex [AttributeKey]
createIndex_orderedIndexedAttributeList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateIndex' {[AttributeKey]
orderedIndexedAttributeList :: [AttributeKey]
$sel:orderedIndexedAttributeList:CreateIndex' :: CreateIndex -> [AttributeKey]
orderedIndexedAttributeList} -> [AttributeKey]
orderedIndexedAttributeList) (\s :: CreateIndex
s@CreateIndex' {} [AttributeKey]
a -> CreateIndex
s {$sel:orderedIndexedAttributeList:CreateIndex' :: [AttributeKey]
orderedIndexedAttributeList = [AttributeKey]
a} :: CreateIndex) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createIndex_isUnique :: Lens.Lens' CreateIndex Prelude.Bool
createIndex_isUnique :: Lens' CreateIndex Bool
createIndex_isUnique = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateIndex' {Bool
isUnique :: Bool
$sel:isUnique:CreateIndex' :: CreateIndex -> Bool
isUnique} -> Bool
isUnique) (\s :: CreateIndex
s@CreateIndex' {} Bool
a -> CreateIndex
s {$sel:isUnique:CreateIndex' :: Bool
isUnique = Bool
a} :: CreateIndex)
instance Core.AWSRequest CreateIndex where
type AWSResponse CreateIndex = CreateIndexResponse
request :: (Service -> Service) -> CreateIndex -> Request CreateIndex
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateIndex
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateIndex)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Text -> Int -> CreateIndexResponse
CreateIndexResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ObjectIdentifier")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable CreateIndex where
hashWithSalt :: Int -> CreateIndex -> Int
hashWithSalt Int
_salt CreateIndex' {Bool
[AttributeKey]
Maybe Text
Maybe ObjectReference
Text
isUnique :: Bool
orderedIndexedAttributeList :: [AttributeKey]
directoryArn :: Text
parentReference :: Maybe ObjectReference
linkName :: Maybe Text
$sel:isUnique:CreateIndex' :: CreateIndex -> Bool
$sel:orderedIndexedAttributeList:CreateIndex' :: CreateIndex -> [AttributeKey]
$sel:directoryArn:CreateIndex' :: CreateIndex -> Text
$sel:parentReference:CreateIndex' :: CreateIndex -> Maybe ObjectReference
$sel:linkName:CreateIndex' :: CreateIndex -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
linkName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ObjectReference
parentReference
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
directoryArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [AttributeKey]
orderedIndexedAttributeList
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Bool
isUnique
instance Prelude.NFData CreateIndex where
rnf :: CreateIndex -> ()
rnf CreateIndex' {Bool
[AttributeKey]
Maybe Text
Maybe ObjectReference
Text
isUnique :: Bool
orderedIndexedAttributeList :: [AttributeKey]
directoryArn :: Text
parentReference :: Maybe ObjectReference
linkName :: Maybe Text
$sel:isUnique:CreateIndex' :: CreateIndex -> Bool
$sel:orderedIndexedAttributeList:CreateIndex' :: CreateIndex -> [AttributeKey]
$sel:directoryArn:CreateIndex' :: CreateIndex -> Text
$sel:parentReference:CreateIndex' :: CreateIndex -> Maybe ObjectReference
$sel:linkName:CreateIndex' :: CreateIndex -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
linkName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ObjectReference
parentReference
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
directoryArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [AttributeKey]
orderedIndexedAttributeList
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Bool
isUnique
instance Data.ToHeaders CreateIndex where
toHeaders :: CreateIndex -> ResponseHeaders
toHeaders CreateIndex' {Bool
[AttributeKey]
Maybe Text
Maybe ObjectReference
Text
isUnique :: Bool
orderedIndexedAttributeList :: [AttributeKey]
directoryArn :: Text
parentReference :: Maybe ObjectReference
linkName :: Maybe Text
$sel:isUnique:CreateIndex' :: CreateIndex -> Bool
$sel:orderedIndexedAttributeList:CreateIndex' :: CreateIndex -> [AttributeKey]
$sel:directoryArn:CreateIndex' :: CreateIndex -> Text
$sel:parentReference:CreateIndex' :: CreateIndex -> Maybe ObjectReference
$sel:linkName:CreateIndex' :: CreateIndex -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[HeaderName
"x-amz-data-partition" forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# Text
directoryArn]
instance Data.ToJSON CreateIndex where
toJSON :: CreateIndex -> Value
toJSON CreateIndex' {Bool
[AttributeKey]
Maybe Text
Maybe ObjectReference
Text
isUnique :: Bool
orderedIndexedAttributeList :: [AttributeKey]
directoryArn :: Text
parentReference :: Maybe ObjectReference
linkName :: Maybe Text
$sel:isUnique:CreateIndex' :: CreateIndex -> Bool
$sel:orderedIndexedAttributeList:CreateIndex' :: CreateIndex -> [AttributeKey]
$sel:directoryArn:CreateIndex' :: CreateIndex -> Text
$sel:parentReference:CreateIndex' :: CreateIndex -> Maybe ObjectReference
$sel:linkName:CreateIndex' :: CreateIndex -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"LinkName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
linkName,
(Key
"ParentReference" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ObjectReference
parentReference,
forall a. a -> Maybe a
Prelude.Just
( Key
"OrderedIndexedAttributeList"
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [AttributeKey]
orderedIndexedAttributeList
),
forall a. a -> Maybe a
Prelude.Just (Key
"IsUnique" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Bool
isUnique)
]
)
instance Data.ToPath CreateIndex where
toPath :: CreateIndex -> ByteString
toPath =
forall a b. a -> b -> a
Prelude.const
ByteString
"/amazonclouddirectory/2017-01-11/index"
instance Data.ToQuery CreateIndex where
toQuery :: CreateIndex -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateIndexResponse = CreateIndexResponse'
{
CreateIndexResponse -> Maybe Text
objectIdentifier :: Prelude.Maybe Prelude.Text,
CreateIndexResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateIndexResponse -> CreateIndexResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateIndexResponse -> CreateIndexResponse -> Bool
$c/= :: CreateIndexResponse -> CreateIndexResponse -> Bool
== :: CreateIndexResponse -> CreateIndexResponse -> Bool
$c== :: CreateIndexResponse -> CreateIndexResponse -> Bool
Prelude.Eq, ReadPrec [CreateIndexResponse]
ReadPrec CreateIndexResponse
Int -> ReadS CreateIndexResponse
ReadS [CreateIndexResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateIndexResponse]
$creadListPrec :: ReadPrec [CreateIndexResponse]
readPrec :: ReadPrec CreateIndexResponse
$creadPrec :: ReadPrec CreateIndexResponse
readList :: ReadS [CreateIndexResponse]
$creadList :: ReadS [CreateIndexResponse]
readsPrec :: Int -> ReadS CreateIndexResponse
$creadsPrec :: Int -> ReadS CreateIndexResponse
Prelude.Read, Int -> CreateIndexResponse -> ShowS
[CreateIndexResponse] -> ShowS
CreateIndexResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateIndexResponse] -> ShowS
$cshowList :: [CreateIndexResponse] -> ShowS
show :: CreateIndexResponse -> String
$cshow :: CreateIndexResponse -> String
showsPrec :: Int -> CreateIndexResponse -> ShowS
$cshowsPrec :: Int -> CreateIndexResponse -> ShowS
Prelude.Show, forall x. Rep CreateIndexResponse x -> CreateIndexResponse
forall x. CreateIndexResponse -> Rep CreateIndexResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateIndexResponse x -> CreateIndexResponse
$cfrom :: forall x. CreateIndexResponse -> Rep CreateIndexResponse x
Prelude.Generic)
newCreateIndexResponse ::
Prelude.Int ->
CreateIndexResponse
newCreateIndexResponse :: Int -> CreateIndexResponse
newCreateIndexResponse Int
pHttpStatus_ =
CreateIndexResponse'
{ $sel:objectIdentifier:CreateIndexResponse' :: Maybe Text
objectIdentifier =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateIndexResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createIndexResponse_objectIdentifier :: Lens.Lens' CreateIndexResponse (Prelude.Maybe Prelude.Text)
createIndexResponse_objectIdentifier :: Lens' CreateIndexResponse (Maybe Text)
createIndexResponse_objectIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateIndexResponse' {Maybe Text
objectIdentifier :: Maybe Text
$sel:objectIdentifier:CreateIndexResponse' :: CreateIndexResponse -> Maybe Text
objectIdentifier} -> Maybe Text
objectIdentifier) (\s :: CreateIndexResponse
s@CreateIndexResponse' {} Maybe Text
a -> CreateIndexResponse
s {$sel:objectIdentifier:CreateIndexResponse' :: Maybe Text
objectIdentifier = Maybe Text
a} :: CreateIndexResponse)
createIndexResponse_httpStatus :: Lens.Lens' CreateIndexResponse Prelude.Int
createIndexResponse_httpStatus :: Lens' CreateIndexResponse Int
createIndexResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateIndexResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateIndexResponse' :: CreateIndexResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateIndexResponse
s@CreateIndexResponse' {} Int
a -> CreateIndexResponse
s {$sel:httpStatus:CreateIndexResponse' :: Int
httpStatus = Int
a} :: CreateIndexResponse)
instance Prelude.NFData CreateIndexResponse where
rnf :: CreateIndexResponse -> ()
rnf CreateIndexResponse' {Int
Maybe Text
httpStatus :: Int
objectIdentifier :: Maybe Text
$sel:httpStatus:CreateIndexResponse' :: CreateIndexResponse -> Int
$sel:objectIdentifier:CreateIndexResponse' :: CreateIndexResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
objectIdentifier
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus