{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.SageMaker.ListAssociations
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Lists the associations in your account and their properties.
--
-- This operation returns paginated results.
module Amazonka.SageMaker.ListAssociations
  ( -- * Creating a Request
    ListAssociations (..),
    newListAssociations,

    -- * Request Lenses
    listAssociations_associationType,
    listAssociations_createdAfter,
    listAssociations_createdBefore,
    listAssociations_destinationArn,
    listAssociations_destinationType,
    listAssociations_maxResults,
    listAssociations_nextToken,
    listAssociations_sortBy,
    listAssociations_sortOrder,
    listAssociations_sourceArn,
    listAssociations_sourceType,

    -- * Destructuring the Response
    ListAssociationsResponse (..),
    newListAssociationsResponse,

    -- * Response Lenses
    listAssociationsResponse_associationSummaries,
    listAssociationsResponse_nextToken,
    listAssociationsResponse_httpStatus,
  )
where

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
import Amazonka.SageMaker.Types

-- | /See:/ 'newListAssociations' smart constructor.
data ListAssociations = ListAssociations'
  { -- | A filter that returns only associations of the specified type.
    ListAssociations -> Maybe AssociationEdgeType
associationType :: Prelude.Maybe AssociationEdgeType,
    -- | A filter that returns only associations created on or after the
    -- specified time.
    ListAssociations -> Maybe POSIX
createdAfter :: Prelude.Maybe Data.POSIX,
    -- | A filter that returns only associations created on or before the
    -- specified time.
    ListAssociations -> Maybe POSIX
createdBefore :: Prelude.Maybe Data.POSIX,
    -- | A filter that returns only associations with the specified destination
    -- Amazon Resource Name (ARN).
    ListAssociations -> Maybe Text
destinationArn :: Prelude.Maybe Prelude.Text,
    -- | A filter that returns only associations with the specified destination
    -- type.
    ListAssociations -> Maybe Text
destinationType :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of associations to return in the response. The
    -- default value is 10.
    ListAssociations -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | If the previous call to @ListAssociations@ didn\'t return the full set
    -- of associations, the call returns a token for getting the next set of
    -- associations.
    ListAssociations -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The property used to sort results. The default value is @CreationTime@.
    ListAssociations -> Maybe SortAssociationsBy
sortBy :: Prelude.Maybe SortAssociationsBy,
    -- | The sort order. The default value is @Descending@.
    ListAssociations -> Maybe SortOrder
sortOrder :: Prelude.Maybe SortOrder,
    -- | A filter that returns only associations with the specified source ARN.
    ListAssociations -> Maybe Text
sourceArn :: Prelude.Maybe Prelude.Text,
    -- | A filter that returns only associations with the specified source type.
    ListAssociations -> Maybe Text
sourceType :: Prelude.Maybe Prelude.Text
  }
  deriving (ListAssociations -> ListAssociations -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAssociations -> ListAssociations -> Bool
$c/= :: ListAssociations -> ListAssociations -> Bool
== :: ListAssociations -> ListAssociations -> Bool
$c== :: ListAssociations -> ListAssociations -> Bool
Prelude.Eq, ReadPrec [ListAssociations]
ReadPrec ListAssociations
Int -> ReadS ListAssociations
ReadS [ListAssociations]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAssociations]
$creadListPrec :: ReadPrec [ListAssociations]
readPrec :: ReadPrec ListAssociations
$creadPrec :: ReadPrec ListAssociations
readList :: ReadS [ListAssociations]
$creadList :: ReadS [ListAssociations]
readsPrec :: Int -> ReadS ListAssociations
$creadsPrec :: Int -> ReadS ListAssociations
Prelude.Read, Int -> ListAssociations -> ShowS
[ListAssociations] -> ShowS
ListAssociations -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAssociations] -> ShowS
$cshowList :: [ListAssociations] -> ShowS
show :: ListAssociations -> String
$cshow :: ListAssociations -> String
showsPrec :: Int -> ListAssociations -> ShowS
$cshowsPrec :: Int -> ListAssociations -> ShowS
Prelude.Show, forall x. Rep ListAssociations x -> ListAssociations
forall x. ListAssociations -> Rep ListAssociations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListAssociations x -> ListAssociations
$cfrom :: forall x. ListAssociations -> Rep ListAssociations x
Prelude.Generic)

-- |
-- Create a value of 'ListAssociations' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'associationType', 'listAssociations_associationType' - A filter that returns only associations of the specified type.
--
-- 'createdAfter', 'listAssociations_createdAfter' - A filter that returns only associations created on or after the
-- specified time.
--
-- 'createdBefore', 'listAssociations_createdBefore' - A filter that returns only associations created on or before the
-- specified time.
--
-- 'destinationArn', 'listAssociations_destinationArn' - A filter that returns only associations with the specified destination
-- Amazon Resource Name (ARN).
--
-- 'destinationType', 'listAssociations_destinationType' - A filter that returns only associations with the specified destination
-- type.
--
-- 'maxResults', 'listAssociations_maxResults' - The maximum number of associations to return in the response. The
-- default value is 10.
--
-- 'nextToken', 'listAssociations_nextToken' - If the previous call to @ListAssociations@ didn\'t return the full set
-- of associations, the call returns a token for getting the next set of
-- associations.
--
-- 'sortBy', 'listAssociations_sortBy' - The property used to sort results. The default value is @CreationTime@.
--
-- 'sortOrder', 'listAssociations_sortOrder' - The sort order. The default value is @Descending@.
--
-- 'sourceArn', 'listAssociations_sourceArn' - A filter that returns only associations with the specified source ARN.
--
-- 'sourceType', 'listAssociations_sourceType' - A filter that returns only associations with the specified source type.
newListAssociations ::
  ListAssociations
newListAssociations :: ListAssociations
newListAssociations =
  ListAssociations'
    { $sel:associationType:ListAssociations' :: Maybe AssociationEdgeType
associationType =
        forall a. Maybe a
Prelude.Nothing,
      $sel:createdAfter:ListAssociations' :: Maybe POSIX
createdAfter = forall a. Maybe a
Prelude.Nothing,
      $sel:createdBefore:ListAssociations' :: Maybe POSIX
createdBefore = forall a. Maybe a
Prelude.Nothing,
      $sel:destinationArn:ListAssociations' :: Maybe Text
destinationArn = forall a. Maybe a
Prelude.Nothing,
      $sel:destinationType:ListAssociations' :: Maybe Text
destinationType = forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListAssociations' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListAssociations' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:sortBy:ListAssociations' :: Maybe SortAssociationsBy
sortBy = forall a. Maybe a
Prelude.Nothing,
      $sel:sortOrder:ListAssociations' :: Maybe SortOrder
sortOrder = forall a. Maybe a
Prelude.Nothing,
      $sel:sourceArn:ListAssociations' :: Maybe Text
sourceArn = forall a. Maybe a
Prelude.Nothing,
      $sel:sourceType:ListAssociations' :: Maybe Text
sourceType = forall a. Maybe a
Prelude.Nothing
    }

-- | A filter that returns only associations of the specified type.
listAssociations_associationType :: Lens.Lens' ListAssociations (Prelude.Maybe AssociationEdgeType)
listAssociations_associationType :: Lens' ListAssociations (Maybe AssociationEdgeType)
listAssociations_associationType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssociations' {Maybe AssociationEdgeType
associationType :: Maybe AssociationEdgeType
$sel:associationType:ListAssociations' :: ListAssociations -> Maybe AssociationEdgeType
associationType} -> Maybe AssociationEdgeType
associationType) (\s :: ListAssociations
s@ListAssociations' {} Maybe AssociationEdgeType
a -> ListAssociations
s {$sel:associationType:ListAssociations' :: Maybe AssociationEdgeType
associationType = Maybe AssociationEdgeType
a} :: ListAssociations)

-- | A filter that returns only associations created on or after the
-- specified time.
listAssociations_createdAfter :: Lens.Lens' ListAssociations (Prelude.Maybe Prelude.UTCTime)
listAssociations_createdAfter :: Lens' ListAssociations (Maybe UTCTime)
listAssociations_createdAfter = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssociations' {Maybe POSIX
createdAfter :: Maybe POSIX
$sel:createdAfter:ListAssociations' :: ListAssociations -> Maybe POSIX
createdAfter} -> Maybe POSIX
createdAfter) (\s :: ListAssociations
s@ListAssociations' {} Maybe POSIX
a -> ListAssociations
s {$sel:createdAfter:ListAssociations' :: Maybe POSIX
createdAfter = Maybe POSIX
a} :: ListAssociations) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | A filter that returns only associations created on or before the
-- specified time.
listAssociations_createdBefore :: Lens.Lens' ListAssociations (Prelude.Maybe Prelude.UTCTime)
listAssociations_createdBefore :: Lens' ListAssociations (Maybe UTCTime)
listAssociations_createdBefore = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssociations' {Maybe POSIX
createdBefore :: Maybe POSIX
$sel:createdBefore:ListAssociations' :: ListAssociations -> Maybe POSIX
createdBefore} -> Maybe POSIX
createdBefore) (\s :: ListAssociations
s@ListAssociations' {} Maybe POSIX
a -> ListAssociations
s {$sel:createdBefore:ListAssociations' :: Maybe POSIX
createdBefore = Maybe POSIX
a} :: ListAssociations) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | A filter that returns only associations with the specified destination
-- Amazon Resource Name (ARN).
listAssociations_destinationArn :: Lens.Lens' ListAssociations (Prelude.Maybe Prelude.Text)
listAssociations_destinationArn :: Lens' ListAssociations (Maybe Text)
listAssociations_destinationArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssociations' {Maybe Text
destinationArn :: Maybe Text
$sel:destinationArn:ListAssociations' :: ListAssociations -> Maybe Text
destinationArn} -> Maybe Text
destinationArn) (\s :: ListAssociations
s@ListAssociations' {} Maybe Text
a -> ListAssociations
s {$sel:destinationArn:ListAssociations' :: Maybe Text
destinationArn = Maybe Text
a} :: ListAssociations)

-- | A filter that returns only associations with the specified destination
-- type.
listAssociations_destinationType :: Lens.Lens' ListAssociations (Prelude.Maybe Prelude.Text)
listAssociations_destinationType :: Lens' ListAssociations (Maybe Text)
listAssociations_destinationType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssociations' {Maybe Text
destinationType :: Maybe Text
$sel:destinationType:ListAssociations' :: ListAssociations -> Maybe Text
destinationType} -> Maybe Text
destinationType) (\s :: ListAssociations
s@ListAssociations' {} Maybe Text
a -> ListAssociations
s {$sel:destinationType:ListAssociations' :: Maybe Text
destinationType = Maybe Text
a} :: ListAssociations)

-- | The maximum number of associations to return in the response. The
-- default value is 10.
listAssociations_maxResults :: Lens.Lens' ListAssociations (Prelude.Maybe Prelude.Natural)
listAssociations_maxResults :: Lens' ListAssociations (Maybe Natural)
listAssociations_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssociations' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListAssociations' :: ListAssociations -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListAssociations
s@ListAssociations' {} Maybe Natural
a -> ListAssociations
s {$sel:maxResults:ListAssociations' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListAssociations)

-- | If the previous call to @ListAssociations@ didn\'t return the full set
-- of associations, the call returns a token for getting the next set of
-- associations.
listAssociations_nextToken :: Lens.Lens' ListAssociations (Prelude.Maybe Prelude.Text)
listAssociations_nextToken :: Lens' ListAssociations (Maybe Text)
listAssociations_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssociations' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAssociations' :: ListAssociations -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAssociations
s@ListAssociations' {} Maybe Text
a -> ListAssociations
s {$sel:nextToken:ListAssociations' :: Maybe Text
nextToken = Maybe Text
a} :: ListAssociations)

-- | The property used to sort results. The default value is @CreationTime@.
listAssociations_sortBy :: Lens.Lens' ListAssociations (Prelude.Maybe SortAssociationsBy)
listAssociations_sortBy :: Lens' ListAssociations (Maybe SortAssociationsBy)
listAssociations_sortBy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssociations' {Maybe SortAssociationsBy
sortBy :: Maybe SortAssociationsBy
$sel:sortBy:ListAssociations' :: ListAssociations -> Maybe SortAssociationsBy
sortBy} -> Maybe SortAssociationsBy
sortBy) (\s :: ListAssociations
s@ListAssociations' {} Maybe SortAssociationsBy
a -> ListAssociations
s {$sel:sortBy:ListAssociations' :: Maybe SortAssociationsBy
sortBy = Maybe SortAssociationsBy
a} :: ListAssociations)

-- | The sort order. The default value is @Descending@.
listAssociations_sortOrder :: Lens.Lens' ListAssociations (Prelude.Maybe SortOrder)
listAssociations_sortOrder :: Lens' ListAssociations (Maybe SortOrder)
listAssociations_sortOrder = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssociations' {Maybe SortOrder
sortOrder :: Maybe SortOrder
$sel:sortOrder:ListAssociations' :: ListAssociations -> Maybe SortOrder
sortOrder} -> Maybe SortOrder
sortOrder) (\s :: ListAssociations
s@ListAssociations' {} Maybe SortOrder
a -> ListAssociations
s {$sel:sortOrder:ListAssociations' :: Maybe SortOrder
sortOrder = Maybe SortOrder
a} :: ListAssociations)

-- | A filter that returns only associations with the specified source ARN.
listAssociations_sourceArn :: Lens.Lens' ListAssociations (Prelude.Maybe Prelude.Text)
listAssociations_sourceArn :: Lens' ListAssociations (Maybe Text)
listAssociations_sourceArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssociations' {Maybe Text
sourceArn :: Maybe Text
$sel:sourceArn:ListAssociations' :: ListAssociations -> Maybe Text
sourceArn} -> Maybe Text
sourceArn) (\s :: ListAssociations
s@ListAssociations' {} Maybe Text
a -> ListAssociations
s {$sel:sourceArn:ListAssociations' :: Maybe Text
sourceArn = Maybe Text
a} :: ListAssociations)

-- | A filter that returns only associations with the specified source type.
listAssociations_sourceType :: Lens.Lens' ListAssociations (Prelude.Maybe Prelude.Text)
listAssociations_sourceType :: Lens' ListAssociations (Maybe Text)
listAssociations_sourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssociations' {Maybe Text
sourceType :: Maybe Text
$sel:sourceType:ListAssociations' :: ListAssociations -> Maybe Text
sourceType} -> Maybe Text
sourceType) (\s :: ListAssociations
s@ListAssociations' {} Maybe Text
a -> ListAssociations
s {$sel:sourceType:ListAssociations' :: Maybe Text
sourceType = Maybe Text
a} :: ListAssociations)

instance Core.AWSPager ListAssociations where
  page :: ListAssociations
-> AWSResponse ListAssociations -> Maybe ListAssociations
page ListAssociations
rq AWSResponse ListAssociations
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListAssociations
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListAssociationsResponse (Maybe Text)
listAssociationsResponse_nextToken
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListAssociations
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListAssociationsResponse (Maybe [AssociationSummary])
listAssociationsResponse_associationSummaries
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ ListAssociations
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListAssociations (Maybe Text)
listAssociations_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListAssociations
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListAssociationsResponse (Maybe Text)
listAssociationsResponse_nextToken
          forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListAssociations where
  type
    AWSResponse ListAssociations =
      ListAssociationsResponse
  request :: (Service -> Service)
-> ListAssociations -> Request ListAssociations
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListAssociations
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListAssociations)))
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 [AssociationSummary]
-> Maybe Text -> Int -> ListAssociationsResponse
ListAssociationsResponse'
            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
"AssociationSummaries"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"NextToken")
            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 ListAssociations where
  hashWithSalt :: Int -> ListAssociations -> Int
hashWithSalt Int
_salt ListAssociations' {Maybe Natural
Maybe Text
Maybe POSIX
Maybe AssociationEdgeType
Maybe SortAssociationsBy
Maybe SortOrder
sourceType :: Maybe Text
sourceArn :: Maybe Text
sortOrder :: Maybe SortOrder
sortBy :: Maybe SortAssociationsBy
nextToken :: Maybe Text
maxResults :: Maybe Natural
destinationType :: Maybe Text
destinationArn :: Maybe Text
createdBefore :: Maybe POSIX
createdAfter :: Maybe POSIX
associationType :: Maybe AssociationEdgeType
$sel:sourceType:ListAssociations' :: ListAssociations -> Maybe Text
$sel:sourceArn:ListAssociations' :: ListAssociations -> Maybe Text
$sel:sortOrder:ListAssociations' :: ListAssociations -> Maybe SortOrder
$sel:sortBy:ListAssociations' :: ListAssociations -> Maybe SortAssociationsBy
$sel:nextToken:ListAssociations' :: ListAssociations -> Maybe Text
$sel:maxResults:ListAssociations' :: ListAssociations -> Maybe Natural
$sel:destinationType:ListAssociations' :: ListAssociations -> Maybe Text
$sel:destinationArn:ListAssociations' :: ListAssociations -> Maybe Text
$sel:createdBefore:ListAssociations' :: ListAssociations -> Maybe POSIX
$sel:createdAfter:ListAssociations' :: ListAssociations -> Maybe POSIX
$sel:associationType:ListAssociations' :: ListAssociations -> Maybe AssociationEdgeType
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AssociationEdgeType
associationType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createdAfter
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createdBefore
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
destinationArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
destinationType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SortAssociationsBy
sortBy
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SortOrder
sortOrder
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sourceArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sourceType

instance Prelude.NFData ListAssociations where
  rnf :: ListAssociations -> ()
rnf ListAssociations' {Maybe Natural
Maybe Text
Maybe POSIX
Maybe AssociationEdgeType
Maybe SortAssociationsBy
Maybe SortOrder
sourceType :: Maybe Text
sourceArn :: Maybe Text
sortOrder :: Maybe SortOrder
sortBy :: Maybe SortAssociationsBy
nextToken :: Maybe Text
maxResults :: Maybe Natural
destinationType :: Maybe Text
destinationArn :: Maybe Text
createdBefore :: Maybe POSIX
createdAfter :: Maybe POSIX
associationType :: Maybe AssociationEdgeType
$sel:sourceType:ListAssociations' :: ListAssociations -> Maybe Text
$sel:sourceArn:ListAssociations' :: ListAssociations -> Maybe Text
$sel:sortOrder:ListAssociations' :: ListAssociations -> Maybe SortOrder
$sel:sortBy:ListAssociations' :: ListAssociations -> Maybe SortAssociationsBy
$sel:nextToken:ListAssociations' :: ListAssociations -> Maybe Text
$sel:maxResults:ListAssociations' :: ListAssociations -> Maybe Natural
$sel:destinationType:ListAssociations' :: ListAssociations -> Maybe Text
$sel:destinationArn:ListAssociations' :: ListAssociations -> Maybe Text
$sel:createdBefore:ListAssociations' :: ListAssociations -> Maybe POSIX
$sel:createdAfter:ListAssociations' :: ListAssociations -> Maybe POSIX
$sel:associationType:ListAssociations' :: ListAssociations -> Maybe AssociationEdgeType
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe AssociationEdgeType
associationType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createdAfter
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createdBefore
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
destinationArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
destinationType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SortAssociationsBy
sortBy
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SortOrder
sortOrder
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sourceArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sourceType

instance Data.ToHeaders ListAssociations where
  toHeaders :: ListAssociations -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# (ByteString
"SageMaker.ListAssociations" :: Prelude.ByteString),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON ListAssociations where
  toJSON :: ListAssociations -> Value
toJSON ListAssociations' {Maybe Natural
Maybe Text
Maybe POSIX
Maybe AssociationEdgeType
Maybe SortAssociationsBy
Maybe SortOrder
sourceType :: Maybe Text
sourceArn :: Maybe Text
sortOrder :: Maybe SortOrder
sortBy :: Maybe SortAssociationsBy
nextToken :: Maybe Text
maxResults :: Maybe Natural
destinationType :: Maybe Text
destinationArn :: Maybe Text
createdBefore :: Maybe POSIX
createdAfter :: Maybe POSIX
associationType :: Maybe AssociationEdgeType
$sel:sourceType:ListAssociations' :: ListAssociations -> Maybe Text
$sel:sourceArn:ListAssociations' :: ListAssociations -> Maybe Text
$sel:sortOrder:ListAssociations' :: ListAssociations -> Maybe SortOrder
$sel:sortBy:ListAssociations' :: ListAssociations -> Maybe SortAssociationsBy
$sel:nextToken:ListAssociations' :: ListAssociations -> Maybe Text
$sel:maxResults:ListAssociations' :: ListAssociations -> Maybe Natural
$sel:destinationType:ListAssociations' :: ListAssociations -> Maybe Text
$sel:destinationArn:ListAssociations' :: ListAssociations -> Maybe Text
$sel:createdBefore:ListAssociations' :: ListAssociations -> Maybe POSIX
$sel:createdAfter:ListAssociations' :: ListAssociations -> Maybe POSIX
$sel:associationType:ListAssociations' :: ListAssociations -> Maybe AssociationEdgeType
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AssociationType" 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 AssociationEdgeType
associationType,
            (Key
"CreatedAfter" 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 POSIX
createdAfter,
            (Key
"CreatedBefore" 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 POSIX
createdBefore,
            (Key
"DestinationArn" 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
destinationArn,
            (Key
"DestinationType" 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
destinationType,
            (Key
"MaxResults" 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 Natural
maxResults,
            (Key
"NextToken" 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
nextToken,
            (Key
"SortBy" 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 SortAssociationsBy
sortBy,
            (Key
"SortOrder" 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 SortOrder
sortOrder,
            (Key
"SourceArn" 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
sourceArn,
            (Key
"SourceType" 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
sourceType
          ]
      )

instance Data.ToPath ListAssociations where
  toPath :: ListAssociations -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery ListAssociations where
  toQuery :: ListAssociations -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newListAssociationsResponse' smart constructor.
data ListAssociationsResponse = ListAssociationsResponse'
  { -- | A list of associations and their properties.
    ListAssociationsResponse -> Maybe [AssociationSummary]
associationSummaries :: Prelude.Maybe [AssociationSummary],
    -- | A token for getting the next set of associations, if there are any.
    ListAssociationsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListAssociationsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListAssociationsResponse -> ListAssociationsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListAssociationsResponse -> ListAssociationsResponse -> Bool
$c/= :: ListAssociationsResponse -> ListAssociationsResponse -> Bool
== :: ListAssociationsResponse -> ListAssociationsResponse -> Bool
$c== :: ListAssociationsResponse -> ListAssociationsResponse -> Bool
Prelude.Eq, ReadPrec [ListAssociationsResponse]
ReadPrec ListAssociationsResponse
Int -> ReadS ListAssociationsResponse
ReadS [ListAssociationsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListAssociationsResponse]
$creadListPrec :: ReadPrec [ListAssociationsResponse]
readPrec :: ReadPrec ListAssociationsResponse
$creadPrec :: ReadPrec ListAssociationsResponse
readList :: ReadS [ListAssociationsResponse]
$creadList :: ReadS [ListAssociationsResponse]
readsPrec :: Int -> ReadS ListAssociationsResponse
$creadsPrec :: Int -> ReadS ListAssociationsResponse
Prelude.Read, Int -> ListAssociationsResponse -> ShowS
[ListAssociationsResponse] -> ShowS
ListAssociationsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListAssociationsResponse] -> ShowS
$cshowList :: [ListAssociationsResponse] -> ShowS
show :: ListAssociationsResponse -> String
$cshow :: ListAssociationsResponse -> String
showsPrec :: Int -> ListAssociationsResponse -> ShowS
$cshowsPrec :: Int -> ListAssociationsResponse -> ShowS
Prelude.Show, forall x.
Rep ListAssociationsResponse x -> ListAssociationsResponse
forall x.
ListAssociationsResponse -> Rep ListAssociationsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListAssociationsResponse x -> ListAssociationsResponse
$cfrom :: forall x.
ListAssociationsResponse -> Rep ListAssociationsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListAssociationsResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'associationSummaries', 'listAssociationsResponse_associationSummaries' - A list of associations and their properties.
--
-- 'nextToken', 'listAssociationsResponse_nextToken' - A token for getting the next set of associations, if there are any.
--
-- 'httpStatus', 'listAssociationsResponse_httpStatus' - The response's http status code.
newListAssociationsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListAssociationsResponse
newListAssociationsResponse :: Int -> ListAssociationsResponse
newListAssociationsResponse Int
pHttpStatus_ =
  ListAssociationsResponse'
    { $sel:associationSummaries:ListAssociationsResponse' :: Maybe [AssociationSummary]
associationSummaries =
        forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListAssociationsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListAssociationsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of associations and their properties.
listAssociationsResponse_associationSummaries :: Lens.Lens' ListAssociationsResponse (Prelude.Maybe [AssociationSummary])
listAssociationsResponse_associationSummaries :: Lens' ListAssociationsResponse (Maybe [AssociationSummary])
listAssociationsResponse_associationSummaries = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssociationsResponse' {Maybe [AssociationSummary]
associationSummaries :: Maybe [AssociationSummary]
$sel:associationSummaries:ListAssociationsResponse' :: ListAssociationsResponse -> Maybe [AssociationSummary]
associationSummaries} -> Maybe [AssociationSummary]
associationSummaries) (\s :: ListAssociationsResponse
s@ListAssociationsResponse' {} Maybe [AssociationSummary]
a -> ListAssociationsResponse
s {$sel:associationSummaries:ListAssociationsResponse' :: Maybe [AssociationSummary]
associationSummaries = Maybe [AssociationSummary]
a} :: ListAssociationsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A token for getting the next set of associations, if there are any.
listAssociationsResponse_nextToken :: Lens.Lens' ListAssociationsResponse (Prelude.Maybe Prelude.Text)
listAssociationsResponse_nextToken :: Lens' ListAssociationsResponse (Maybe Text)
listAssociationsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssociationsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAssociationsResponse' :: ListAssociationsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAssociationsResponse
s@ListAssociationsResponse' {} Maybe Text
a -> ListAssociationsResponse
s {$sel:nextToken:ListAssociationsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListAssociationsResponse)

-- | The response's http status code.
listAssociationsResponse_httpStatus :: Lens.Lens' ListAssociationsResponse Prelude.Int
listAssociationsResponse_httpStatus :: Lens' ListAssociationsResponse Int
listAssociationsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAssociationsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListAssociationsResponse' :: ListAssociationsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListAssociationsResponse
s@ListAssociationsResponse' {} Int
a -> ListAssociationsResponse
s {$sel:httpStatus:ListAssociationsResponse' :: Int
httpStatus = Int
a} :: ListAssociationsResponse)

instance Prelude.NFData ListAssociationsResponse where
  rnf :: ListAssociationsResponse -> ()
rnf ListAssociationsResponse' {Int
Maybe [AssociationSummary]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
associationSummaries :: Maybe [AssociationSummary]
$sel:httpStatus:ListAssociationsResponse' :: ListAssociationsResponse -> Int
$sel:nextToken:ListAssociationsResponse' :: ListAssociationsResponse -> Maybe Text
$sel:associationSummaries:ListAssociationsResponse' :: ListAssociationsResponse -> Maybe [AssociationSummary]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [AssociationSummary]
associationSummaries
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus