{-# 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.SageMakerGeoSpatial.ListRasterDataCollections
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Use this operation to get raster data collections.
--
-- This operation returns paginated results.
module Amazonka.SageMakerGeoSpatial.ListRasterDataCollections
  ( -- * Creating a Request
    ListRasterDataCollections (..),
    newListRasterDataCollections,

    -- * Request Lenses
    listRasterDataCollections_maxResults,
    listRasterDataCollections_nextToken,

    -- * Destructuring the Response
    ListRasterDataCollectionsResponse (..),
    newListRasterDataCollectionsResponse,

    -- * Response Lenses
    listRasterDataCollectionsResponse_nextToken,
    listRasterDataCollectionsResponse_httpStatus,
    listRasterDataCollectionsResponse_rasterDataCollectionSummaries,
  )
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.SageMakerGeoSpatial.Types

-- | /See:/ 'newListRasterDataCollections' smart constructor.
data ListRasterDataCollections = ListRasterDataCollections'
  { -- | The total number of items to return.
    ListRasterDataCollections -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | If the previous response was truncated, you receive this token. Use it
    -- in your next request to receive the next set of results.
    ListRasterDataCollections -> Maybe (Sensitive Text)
nextToken :: Prelude.Maybe (Data.Sensitive Prelude.Text)
  }
  deriving (ListRasterDataCollections -> ListRasterDataCollections -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListRasterDataCollections -> ListRasterDataCollections -> Bool
$c/= :: ListRasterDataCollections -> ListRasterDataCollections -> Bool
== :: ListRasterDataCollections -> ListRasterDataCollections -> Bool
$c== :: ListRasterDataCollections -> ListRasterDataCollections -> Bool
Prelude.Eq, Int -> ListRasterDataCollections -> ShowS
[ListRasterDataCollections] -> ShowS
ListRasterDataCollections -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListRasterDataCollections] -> ShowS
$cshowList :: [ListRasterDataCollections] -> ShowS
show :: ListRasterDataCollections -> String
$cshow :: ListRasterDataCollections -> String
showsPrec :: Int -> ListRasterDataCollections -> ShowS
$cshowsPrec :: Int -> ListRasterDataCollections -> ShowS
Prelude.Show, forall x.
Rep ListRasterDataCollections x -> ListRasterDataCollections
forall x.
ListRasterDataCollections -> Rep ListRasterDataCollections x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListRasterDataCollections x -> ListRasterDataCollections
$cfrom :: forall x.
ListRasterDataCollections -> Rep ListRasterDataCollections x
Prelude.Generic)

-- |
-- Create a value of 'ListRasterDataCollections' 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:
--
-- 'maxResults', 'listRasterDataCollections_maxResults' - The total number of items to return.
--
-- 'nextToken', 'listRasterDataCollections_nextToken' - If the previous response was truncated, you receive this token. Use it
-- in your next request to receive the next set of results.
newListRasterDataCollections ::
  ListRasterDataCollections
newListRasterDataCollections :: ListRasterDataCollections
newListRasterDataCollections =
  ListRasterDataCollections'
    { $sel:maxResults:ListRasterDataCollections' :: Maybe Natural
maxResults =
        forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListRasterDataCollections' :: Maybe (Sensitive Text)
nextToken = forall a. Maybe a
Prelude.Nothing
    }

-- | The total number of items to return.
listRasterDataCollections_maxResults :: Lens.Lens' ListRasterDataCollections (Prelude.Maybe Prelude.Natural)
listRasterDataCollections_maxResults :: Lens' ListRasterDataCollections (Maybe Natural)
listRasterDataCollections_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRasterDataCollections' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListRasterDataCollections' :: ListRasterDataCollections -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListRasterDataCollections
s@ListRasterDataCollections' {} Maybe Natural
a -> ListRasterDataCollections
s {$sel:maxResults:ListRasterDataCollections' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListRasterDataCollections)

-- | If the previous response was truncated, you receive this token. Use it
-- in your next request to receive the next set of results.
listRasterDataCollections_nextToken :: Lens.Lens' ListRasterDataCollections (Prelude.Maybe Prelude.Text)
listRasterDataCollections_nextToken :: Lens' ListRasterDataCollections (Maybe Text)
listRasterDataCollections_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRasterDataCollections' {Maybe (Sensitive Text)
nextToken :: Maybe (Sensitive Text)
$sel:nextToken:ListRasterDataCollections' :: ListRasterDataCollections -> Maybe (Sensitive Text)
nextToken} -> Maybe (Sensitive Text)
nextToken) (\s :: ListRasterDataCollections
s@ListRasterDataCollections' {} Maybe (Sensitive Text)
a -> ListRasterDataCollections
s {$sel:nextToken:ListRasterDataCollections' :: Maybe (Sensitive Text)
nextToken = Maybe (Sensitive Text)
a} :: ListRasterDataCollections) 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. Iso' (Sensitive a) a
Data._Sensitive

instance Core.AWSPager ListRasterDataCollections where
  page :: ListRasterDataCollections
-> AWSResponse ListRasterDataCollections
-> Maybe ListRasterDataCollections
page ListRasterDataCollections
rq AWSResponse ListRasterDataCollections
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListRasterDataCollections
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListRasterDataCollectionsResponse (Maybe Text)
listRasterDataCollectionsResponse_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 ListRasterDataCollections
rs
            forall s a. s -> Getting a s a -> a
Lens.^. Lens'
  ListRasterDataCollectionsResponse [RasterDataCollectionMetadata]
listRasterDataCollectionsResponse_rasterDataCollectionSummaries
        ) =
        forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ ListRasterDataCollections
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListRasterDataCollections (Maybe Text)
listRasterDataCollections_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListRasterDataCollections
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListRasterDataCollectionsResponse (Maybe Text)
listRasterDataCollectionsResponse_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 ListRasterDataCollections where
  type
    AWSResponse ListRasterDataCollections =
      ListRasterDataCollectionsResponse
  request :: (Service -> Service)
-> ListRasterDataCollections -> Request ListRasterDataCollections
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListRasterDataCollections
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListRasterDataCollections)))
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 (Sensitive Text)
-> Int
-> [RasterDataCollectionMetadata]
-> ListRasterDataCollectionsResponse
ListRasterDataCollectionsResponse'
            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
"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))
            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
"RasterDataCollectionSummaries"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable ListRasterDataCollections where
  hashWithSalt :: Int -> ListRasterDataCollections -> Int
hashWithSalt Int
_salt ListRasterDataCollections' {Maybe Natural
Maybe (Sensitive Text)
nextToken :: Maybe (Sensitive Text)
maxResults :: Maybe Natural
$sel:nextToken:ListRasterDataCollections' :: ListRasterDataCollections -> Maybe (Sensitive Text)
$sel:maxResults:ListRasterDataCollections' :: ListRasterDataCollections -> Maybe Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
nextToken

instance Prelude.NFData ListRasterDataCollections where
  rnf :: ListRasterDataCollections -> ()
rnf ListRasterDataCollections' {Maybe Natural
Maybe (Sensitive Text)
nextToken :: Maybe (Sensitive Text)
maxResults :: Maybe Natural
$sel:nextToken:ListRasterDataCollections' :: ListRasterDataCollections -> Maybe (Sensitive Text)
$sel:maxResults:ListRasterDataCollections' :: ListRasterDataCollections -> Maybe Natural
..} =
    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 (Sensitive Text)
nextToken

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

instance Data.ToPath ListRasterDataCollections where
  toPath :: ListRasterDataCollections -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/raster-data-collections"

instance Data.ToQuery ListRasterDataCollections where
  toQuery :: ListRasterDataCollections -> QueryString
toQuery ListRasterDataCollections' {Maybe Natural
Maybe (Sensitive Text)
nextToken :: Maybe (Sensitive Text)
maxResults :: Maybe Natural
$sel:nextToken:ListRasterDataCollections' :: ListRasterDataCollections -> Maybe (Sensitive Text)
$sel:maxResults:ListRasterDataCollections' :: ListRasterDataCollections -> Maybe Natural
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"MaxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxResults,
        ByteString
"NextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe (Sensitive Text)
nextToken
      ]

-- | /See:/ 'newListRasterDataCollectionsResponse' smart constructor.
data ListRasterDataCollectionsResponse = ListRasterDataCollectionsResponse'
  { -- | If the previous response was truncated, you receive this token. Use it
    -- in your next request to receive the next set of results.
    ListRasterDataCollectionsResponse -> Maybe (Sensitive Text)
nextToken :: Prelude.Maybe (Data.Sensitive Prelude.Text),
    -- | The response's http status code.
    ListRasterDataCollectionsResponse -> Int
httpStatus :: Prelude.Int,
    -- | Contains summary information about the raster data collection.
    ListRasterDataCollectionsResponse -> [RasterDataCollectionMetadata]
rasterDataCollectionSummaries :: [RasterDataCollectionMetadata]
  }
  deriving (ListRasterDataCollectionsResponse
-> ListRasterDataCollectionsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListRasterDataCollectionsResponse
-> ListRasterDataCollectionsResponse -> Bool
$c/= :: ListRasterDataCollectionsResponse
-> ListRasterDataCollectionsResponse -> Bool
== :: ListRasterDataCollectionsResponse
-> ListRasterDataCollectionsResponse -> Bool
$c== :: ListRasterDataCollectionsResponse
-> ListRasterDataCollectionsResponse -> Bool
Prelude.Eq, Int -> ListRasterDataCollectionsResponse -> ShowS
[ListRasterDataCollectionsResponse] -> ShowS
ListRasterDataCollectionsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListRasterDataCollectionsResponse] -> ShowS
$cshowList :: [ListRasterDataCollectionsResponse] -> ShowS
show :: ListRasterDataCollectionsResponse -> String
$cshow :: ListRasterDataCollectionsResponse -> String
showsPrec :: Int -> ListRasterDataCollectionsResponse -> ShowS
$cshowsPrec :: Int -> ListRasterDataCollectionsResponse -> ShowS
Prelude.Show, forall x.
Rep ListRasterDataCollectionsResponse x
-> ListRasterDataCollectionsResponse
forall x.
ListRasterDataCollectionsResponse
-> Rep ListRasterDataCollectionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListRasterDataCollectionsResponse x
-> ListRasterDataCollectionsResponse
$cfrom :: forall x.
ListRasterDataCollectionsResponse
-> Rep ListRasterDataCollectionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListRasterDataCollectionsResponse' 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:
--
-- 'nextToken', 'listRasterDataCollectionsResponse_nextToken' - If the previous response was truncated, you receive this token. Use it
-- in your next request to receive the next set of results.
--
-- 'httpStatus', 'listRasterDataCollectionsResponse_httpStatus' - The response's http status code.
--
-- 'rasterDataCollectionSummaries', 'listRasterDataCollectionsResponse_rasterDataCollectionSummaries' - Contains summary information about the raster data collection.
newListRasterDataCollectionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListRasterDataCollectionsResponse
newListRasterDataCollectionsResponse :: Int -> ListRasterDataCollectionsResponse
newListRasterDataCollectionsResponse Int
pHttpStatus_ =
  ListRasterDataCollectionsResponse'
    { $sel:nextToken:ListRasterDataCollectionsResponse' :: Maybe (Sensitive Text)
nextToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListRasterDataCollectionsResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:rasterDataCollectionSummaries:ListRasterDataCollectionsResponse' :: [RasterDataCollectionMetadata]
rasterDataCollectionSummaries =
        forall a. Monoid a => a
Prelude.mempty
    }

-- | If the previous response was truncated, you receive this token. Use it
-- in your next request to receive the next set of results.
listRasterDataCollectionsResponse_nextToken :: Lens.Lens' ListRasterDataCollectionsResponse (Prelude.Maybe Prelude.Text)
listRasterDataCollectionsResponse_nextToken :: Lens' ListRasterDataCollectionsResponse (Maybe Text)
listRasterDataCollectionsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRasterDataCollectionsResponse' {Maybe (Sensitive Text)
nextToken :: Maybe (Sensitive Text)
$sel:nextToken:ListRasterDataCollectionsResponse' :: ListRasterDataCollectionsResponse -> Maybe (Sensitive Text)
nextToken} -> Maybe (Sensitive Text)
nextToken) (\s :: ListRasterDataCollectionsResponse
s@ListRasterDataCollectionsResponse' {} Maybe (Sensitive Text)
a -> ListRasterDataCollectionsResponse
s {$sel:nextToken:ListRasterDataCollectionsResponse' :: Maybe (Sensitive Text)
nextToken = Maybe (Sensitive Text)
a} :: ListRasterDataCollectionsResponse) 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. Iso' (Sensitive a) a
Data._Sensitive

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

-- | Contains summary information about the raster data collection.
listRasterDataCollectionsResponse_rasterDataCollectionSummaries :: Lens.Lens' ListRasterDataCollectionsResponse [RasterDataCollectionMetadata]
listRasterDataCollectionsResponse_rasterDataCollectionSummaries :: Lens'
  ListRasterDataCollectionsResponse [RasterDataCollectionMetadata]
listRasterDataCollectionsResponse_rasterDataCollectionSummaries = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRasterDataCollectionsResponse' {[RasterDataCollectionMetadata]
rasterDataCollectionSummaries :: [RasterDataCollectionMetadata]
$sel:rasterDataCollectionSummaries:ListRasterDataCollectionsResponse' :: ListRasterDataCollectionsResponse -> [RasterDataCollectionMetadata]
rasterDataCollectionSummaries} -> [RasterDataCollectionMetadata]
rasterDataCollectionSummaries) (\s :: ListRasterDataCollectionsResponse
s@ListRasterDataCollectionsResponse' {} [RasterDataCollectionMetadata]
a -> ListRasterDataCollectionsResponse
s {$sel:rasterDataCollectionSummaries:ListRasterDataCollectionsResponse' :: [RasterDataCollectionMetadata]
rasterDataCollectionSummaries = [RasterDataCollectionMetadata]
a} :: ListRasterDataCollectionsResponse) 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

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