module Stratosphere.OpenSearchServerless.Index (
        module Exports, Index(..), mkIndex
    ) where
import qualified Data.Aeson as JSON
import qualified Stratosphere.Prelude as Prelude
import Stratosphere.Property
import {-# SOURCE #-} Stratosphere.OpenSearchServerless.Index.IndexSettingsProperty as Exports
import {-# SOURCE #-} Stratosphere.OpenSearchServerless.Index.MappingsProperty as Exports
import Stratosphere.ResourceProperties
import Stratosphere.Value
data Index
  = -- | See: <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opensearchserverless-index.html>
    Index {Index -> ()
haddock_workaround_ :: (),
           -- | See: <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opensearchserverless-index.html#cfn-opensearchserverless-index-collectionendpoint>
           Index -> Value Text
collectionEndpoint :: (Value Prelude.Text),
           -- | See: <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opensearchserverless-index.html#cfn-opensearchserverless-index-indexname>
           Index -> Value Text
indexName :: (Value Prelude.Text),
           -- | See: <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opensearchserverless-index.html#cfn-opensearchserverless-index-mappings>
           Index -> Maybe MappingsProperty
mappings :: (Prelude.Maybe MappingsProperty),
           -- | See: <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-opensearchserverless-index.html#cfn-opensearchserverless-index-settings>
           Index -> Maybe IndexSettingsProperty
settings :: (Prelude.Maybe IndexSettingsProperty)}
  deriving stock (Index -> Index -> Bool
(Index -> Index -> Bool) -> (Index -> Index -> Bool) -> Eq Index
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Index -> Index -> Bool
== :: Index -> Index -> Bool
$c/= :: Index -> Index -> Bool
/= :: Index -> Index -> Bool
Prelude.Eq, Int -> Index -> ShowS
[Index] -> ShowS
Index -> String
(Int -> Index -> ShowS)
-> (Index -> String) -> ([Index] -> ShowS) -> Show Index
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Index -> ShowS
showsPrec :: Int -> Index -> ShowS
$cshow :: Index -> String
show :: Index -> String
$cshowList :: [Index] -> ShowS
showList :: [Index] -> ShowS
Prelude.Show)
mkIndex :: Value Prelude.Text -> Value Prelude.Text -> Index
mkIndex :: Value Text -> Value Text -> Index
mkIndex Value Text
collectionEndpoint Value Text
indexName
  = Index
      {haddock_workaround_ :: ()
haddock_workaround_ = (), collectionEndpoint :: Value Text
collectionEndpoint = Value Text
collectionEndpoint,
       indexName :: Value Text
indexName = Value Text
indexName, mappings :: Maybe MappingsProperty
mappings = Maybe MappingsProperty
forall a. Maybe a
Prelude.Nothing,
       settings :: Maybe IndexSettingsProperty
settings = Maybe IndexSettingsProperty
forall a. Maybe a
Prelude.Nothing}
instance ToResourceProperties Index where
  toResourceProperties :: Index -> ResourceProperties
toResourceProperties Index {Maybe IndexSettingsProperty
Maybe MappingsProperty
()
Value Text
haddock_workaround_ :: Index -> ()
collectionEndpoint :: Index -> Value Text
indexName :: Index -> Value Text
mappings :: Index -> Maybe MappingsProperty
settings :: Index -> Maybe IndexSettingsProperty
haddock_workaround_ :: ()
collectionEndpoint :: Value Text
indexName :: Value Text
mappings :: Maybe MappingsProperty
settings :: Maybe IndexSettingsProperty
..}
    = ResourceProperties
        {awsType :: Text
awsType = Text
"AWS::OpenSearchServerless::Index",
         supportsTags :: Bool
supportsTags = Bool
Prelude.False,
         properties :: Object
properties = [Item Object] -> Object
forall l. IsList l => [Item l] -> l
Prelude.fromList
                        ([(Key, Value)] -> [(Key, Value)] -> [(Key, Value)]
forall a. Semigroup a => a -> a -> a
(Prelude.<>)
                           [Key
"CollectionEndpoint" Key -> Value Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
JSON..= Value Text
collectionEndpoint,
                            Key
"IndexName" Key -> Value Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
JSON..= Value Text
indexName]
                           ([Maybe (Key, Value)] -> [(Key, Value)]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
                              [Key -> MappingsProperty -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
(JSON..=) Key
"Mappings" (MappingsProperty -> (Key, Value))
-> Maybe MappingsProperty -> Maybe (Key, Value)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MappingsProperty
mappings,
                               Key -> IndexSettingsProperty -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
(JSON..=) Key
"Settings" (IndexSettingsProperty -> (Key, Value))
-> Maybe IndexSettingsProperty -> Maybe (Key, Value)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe IndexSettingsProperty
settings]))}
instance JSON.ToJSON Index where
  toJSON :: Index -> Value
toJSON Index {Maybe IndexSettingsProperty
Maybe MappingsProperty
()
Value Text
haddock_workaround_ :: Index -> ()
collectionEndpoint :: Index -> Value Text
indexName :: Index -> Value Text
mappings :: Index -> Maybe MappingsProperty
settings :: Index -> Maybe IndexSettingsProperty
haddock_workaround_ :: ()
collectionEndpoint :: Value Text
indexName :: Value Text
mappings :: Maybe MappingsProperty
settings :: Maybe IndexSettingsProperty
..}
    = [(Key, Value)] -> Value
JSON.object
        ([Item [(Key, Value)]] -> [(Key, Value)]
forall l. IsList l => [Item l] -> l
Prelude.fromList
           ([(Key, Value)] -> [(Key, Value)] -> [(Key, Value)]
forall a. Semigroup a => a -> a -> a
(Prelude.<>)
              [Key
"CollectionEndpoint" Key -> Value Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
JSON..= Value Text
collectionEndpoint,
               Key
"IndexName" Key -> Value Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
JSON..= Value Text
indexName]
              ([Maybe (Key, Value)] -> [(Key, Value)]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
                 [Key -> MappingsProperty -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
(JSON..=) Key
"Mappings" (MappingsProperty -> (Key, Value))
-> Maybe MappingsProperty -> Maybe (Key, Value)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MappingsProperty
mappings,
                  Key -> IndexSettingsProperty -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
(JSON..=) Key
"Settings" (IndexSettingsProperty -> (Key, Value))
-> Maybe IndexSettingsProperty -> Maybe (Key, Value)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe IndexSettingsProperty
settings])))
instance Property "CollectionEndpoint" Index where
  type PropertyType "CollectionEndpoint" Index = Value Prelude.Text
  set :: PropertyType "CollectionEndpoint" Index -> Index -> Index
set PropertyType "CollectionEndpoint" Index
newValue Index {Maybe IndexSettingsProperty
Maybe MappingsProperty
()
Value Text
haddock_workaround_ :: Index -> ()
collectionEndpoint :: Index -> Value Text
indexName :: Index -> Value Text
mappings :: Index -> Maybe MappingsProperty
settings :: Index -> Maybe IndexSettingsProperty
haddock_workaround_ :: ()
collectionEndpoint :: Value Text
indexName :: Value Text
mappings :: Maybe MappingsProperty
settings :: Maybe IndexSettingsProperty
..} = Index {collectionEndpoint :: Value Text
collectionEndpoint = PropertyType "CollectionEndpoint" Index
Value Text
newValue, Maybe IndexSettingsProperty
Maybe MappingsProperty
()
Value Text
haddock_workaround_ :: ()
indexName :: Value Text
mappings :: Maybe MappingsProperty
settings :: Maybe IndexSettingsProperty
haddock_workaround_ :: ()
indexName :: Value Text
mappings :: Maybe MappingsProperty
settings :: Maybe IndexSettingsProperty
..}
instance Property "IndexName" Index where
  type PropertyType "IndexName" Index = Value Prelude.Text
  set :: PropertyType "IndexName" Index -> Index -> Index
set PropertyType "IndexName" Index
newValue Index {Maybe IndexSettingsProperty
Maybe MappingsProperty
()
Value Text
haddock_workaround_ :: Index -> ()
collectionEndpoint :: Index -> Value Text
indexName :: Index -> Value Text
mappings :: Index -> Maybe MappingsProperty
settings :: Index -> Maybe IndexSettingsProperty
haddock_workaround_ :: ()
collectionEndpoint :: Value Text
indexName :: Value Text
mappings :: Maybe MappingsProperty
settings :: Maybe IndexSettingsProperty
..} = Index {indexName :: Value Text
indexName = PropertyType "IndexName" Index
Value Text
newValue, Maybe IndexSettingsProperty
Maybe MappingsProperty
()
Value Text
haddock_workaround_ :: ()
collectionEndpoint :: Value Text
mappings :: Maybe MappingsProperty
settings :: Maybe IndexSettingsProperty
haddock_workaround_ :: ()
collectionEndpoint :: Value Text
mappings :: Maybe MappingsProperty
settings :: Maybe IndexSettingsProperty
..}
instance Property "Mappings" Index where
  type PropertyType "Mappings" Index = MappingsProperty
  set :: PropertyType "Mappings" Index -> Index -> Index
set PropertyType "Mappings" Index
newValue Index {Maybe IndexSettingsProperty
Maybe MappingsProperty
()
Value Text
haddock_workaround_ :: Index -> ()
collectionEndpoint :: Index -> Value Text
indexName :: Index -> Value Text
mappings :: Index -> Maybe MappingsProperty
settings :: Index -> Maybe IndexSettingsProperty
haddock_workaround_ :: ()
collectionEndpoint :: Value Text
indexName :: Value Text
mappings :: Maybe MappingsProperty
settings :: Maybe IndexSettingsProperty
..}
    = Index {mappings :: Maybe MappingsProperty
mappings = MappingsProperty -> Maybe MappingsProperty
forall a. a -> Maybe a
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure PropertyType "Mappings" Index
MappingsProperty
newValue, Maybe IndexSettingsProperty
()
Value Text
haddock_workaround_ :: ()
collectionEndpoint :: Value Text
indexName :: Value Text
settings :: Maybe IndexSettingsProperty
haddock_workaround_ :: ()
collectionEndpoint :: Value Text
indexName :: Value Text
settings :: Maybe IndexSettingsProperty
..}
instance Property "Settings" Index where
  type PropertyType "Settings" Index = IndexSettingsProperty
  set :: PropertyType "Settings" Index -> Index -> Index
set PropertyType "Settings" Index
newValue Index {Maybe IndexSettingsProperty
Maybe MappingsProperty
()
Value Text
haddock_workaround_ :: Index -> ()
collectionEndpoint :: Index -> Value Text
indexName :: Index -> Value Text
mappings :: Index -> Maybe MappingsProperty
settings :: Index -> Maybe IndexSettingsProperty
haddock_workaround_ :: ()
collectionEndpoint :: Value Text
indexName :: Value Text
mappings :: Maybe MappingsProperty
settings :: Maybe IndexSettingsProperty
..}
    = Index {settings :: Maybe IndexSettingsProperty
settings = IndexSettingsProperty -> Maybe IndexSettingsProperty
forall a. a -> Maybe a
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure PropertyType "Settings" Index
IndexSettingsProperty
newValue, Maybe MappingsProperty
()
Value Text
haddock_workaround_ :: ()
collectionEndpoint :: Value Text
indexName :: Value Text
mappings :: Maybe MappingsProperty
haddock_workaround_ :: ()
collectionEndpoint :: Value Text
indexName :: Value Text
mappings :: Maybe MappingsProperty
..}