{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE StrictData #-} {-# LANGUAGE NoImplicitPrelude #-} {-# OPTIONS_GHC -fno-warn-unused-imports #-} {-# OPTIONS_GHC -fno-warn-unused-matches #-} -- Derived from AWS service descriptions, licensed under Apache 2.0. -- | -- Module : Amazonka.KeySpaces.Types.ClusteringKey -- Copyright : (c) 2013-2023 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) module Amazonka.KeySpaces.Types.ClusteringKey where import qualified Amazonka.Core as Core import qualified Amazonka.Core.Lens.Internal as Lens import qualified Amazonka.Data as Data import Amazonka.KeySpaces.Types.SortOrder import qualified Amazonka.Prelude as Prelude -- | The optional clustering column portion of your primary key determines -- how the data is clustered and sorted within each partition. -- -- /See:/ 'newClusteringKey' smart constructor. data ClusteringKey = ClusteringKey' { -- | The name(s) of the clustering column(s). name :: Prelude.Text, -- | Sets the ascendant (@ASC@) or descendant (@DESC@) order modifier. orderBy :: SortOrder } deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic) -- | -- Create a value of 'ClusteringKey' with all optional fields omitted. -- -- Use or to modify other optional fields. -- -- The following record fields are available, with the corresponding lenses provided -- for backwards compatibility: -- -- 'name', 'clusteringKey_name' - The name(s) of the clustering column(s). -- -- 'orderBy', 'clusteringKey_orderBy' - Sets the ascendant (@ASC@) or descendant (@DESC@) order modifier. newClusteringKey :: -- | 'name' Prelude.Text -> -- | 'orderBy' SortOrder -> ClusteringKey newClusteringKey pName_ pOrderBy_ = ClusteringKey' {name = pName_, orderBy = pOrderBy_} -- | The name(s) of the clustering column(s). clusteringKey_name :: Lens.Lens' ClusteringKey Prelude.Text clusteringKey_name = Lens.lens (\ClusteringKey' {name} -> name) (\s@ClusteringKey' {} a -> s {name = a} :: ClusteringKey) -- | Sets the ascendant (@ASC@) or descendant (@DESC@) order modifier. clusteringKey_orderBy :: Lens.Lens' ClusteringKey SortOrder clusteringKey_orderBy = Lens.lens (\ClusteringKey' {orderBy} -> orderBy) (\s@ClusteringKey' {} a -> s {orderBy = a} :: ClusteringKey) instance Data.FromJSON ClusteringKey where parseJSON = Data.withObject "ClusteringKey" ( \x -> ClusteringKey' Prelude.<$> (x Data..: "name") Prelude.<*> (x Data..: "orderBy") ) instance Prelude.Hashable ClusteringKey where hashWithSalt _salt ClusteringKey' {..} = _salt `Prelude.hashWithSalt` name `Prelude.hashWithSalt` orderBy instance Prelude.NFData ClusteringKey where rnf ClusteringKey' {..} = Prelude.rnf name `Prelude.seq` Prelude.rnf orderBy instance Data.ToJSON ClusteringKey where toJSON ClusteringKey' {..} = Data.object ( Prelude.catMaybes [ Prelude.Just ("name" Data..= name), Prelude.Just ("orderBy" Data..= orderBy) ] )