{-# 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.Personalize.DescribeDatasetGroup
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Describes the given dataset group. For more information on dataset
-- groups, see CreateDatasetGroup.
module Amazonka.Personalize.DescribeDatasetGroup
  ( -- * Creating a Request
    DescribeDatasetGroup (..),
    newDescribeDatasetGroup,

    -- * Request Lenses
    describeDatasetGroup_datasetGroupArn,

    -- * Destructuring the Response
    DescribeDatasetGroupResponse (..),
    newDescribeDatasetGroupResponse,

    -- * Response Lenses
    describeDatasetGroupResponse_datasetGroup,
    describeDatasetGroupResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Personalize.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDescribeDatasetGroup' smart constructor.
data DescribeDatasetGroup = DescribeDatasetGroup'
  { -- | The Amazon Resource Name (ARN) of the dataset group to describe.
    DescribeDatasetGroup -> Text
datasetGroupArn :: Prelude.Text
  }
  deriving (DescribeDatasetGroup -> DescribeDatasetGroup -> Bool
(DescribeDatasetGroup -> DescribeDatasetGroup -> Bool)
-> (DescribeDatasetGroup -> DescribeDatasetGroup -> Bool)
-> Eq DescribeDatasetGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeDatasetGroup -> DescribeDatasetGroup -> Bool
$c/= :: DescribeDatasetGroup -> DescribeDatasetGroup -> Bool
== :: DescribeDatasetGroup -> DescribeDatasetGroup -> Bool
$c== :: DescribeDatasetGroup -> DescribeDatasetGroup -> Bool
Prelude.Eq, ReadPrec [DescribeDatasetGroup]
ReadPrec DescribeDatasetGroup
Int -> ReadS DescribeDatasetGroup
ReadS [DescribeDatasetGroup]
(Int -> ReadS DescribeDatasetGroup)
-> ReadS [DescribeDatasetGroup]
-> ReadPrec DescribeDatasetGroup
-> ReadPrec [DescribeDatasetGroup]
-> Read DescribeDatasetGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeDatasetGroup]
$creadListPrec :: ReadPrec [DescribeDatasetGroup]
readPrec :: ReadPrec DescribeDatasetGroup
$creadPrec :: ReadPrec DescribeDatasetGroup
readList :: ReadS [DescribeDatasetGroup]
$creadList :: ReadS [DescribeDatasetGroup]
readsPrec :: Int -> ReadS DescribeDatasetGroup
$creadsPrec :: Int -> ReadS DescribeDatasetGroup
Prelude.Read, Int -> DescribeDatasetGroup -> ShowS
[DescribeDatasetGroup] -> ShowS
DescribeDatasetGroup -> String
(Int -> DescribeDatasetGroup -> ShowS)
-> (DescribeDatasetGroup -> String)
-> ([DescribeDatasetGroup] -> ShowS)
-> Show DescribeDatasetGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeDatasetGroup] -> ShowS
$cshowList :: [DescribeDatasetGroup] -> ShowS
show :: DescribeDatasetGroup -> String
$cshow :: DescribeDatasetGroup -> String
showsPrec :: Int -> DescribeDatasetGroup -> ShowS
$cshowsPrec :: Int -> DescribeDatasetGroup -> ShowS
Prelude.Show, (forall x. DescribeDatasetGroup -> Rep DescribeDatasetGroup x)
-> (forall x. Rep DescribeDatasetGroup x -> DescribeDatasetGroup)
-> Generic DescribeDatasetGroup
forall x. Rep DescribeDatasetGroup x -> DescribeDatasetGroup
forall x. DescribeDatasetGroup -> Rep DescribeDatasetGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeDatasetGroup x -> DescribeDatasetGroup
$cfrom :: forall x. DescribeDatasetGroup -> Rep DescribeDatasetGroup x
Prelude.Generic)

-- |
-- Create a value of 'DescribeDatasetGroup' 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:
--
-- 'datasetGroupArn', 'describeDatasetGroup_datasetGroupArn' - The Amazon Resource Name (ARN) of the dataset group to describe.
newDescribeDatasetGroup ::
  -- | 'datasetGroupArn'
  Prelude.Text ->
  DescribeDatasetGroup
newDescribeDatasetGroup :: Text -> DescribeDatasetGroup
newDescribeDatasetGroup Text
pDatasetGroupArn_ =
  DescribeDatasetGroup' :: Text -> DescribeDatasetGroup
DescribeDatasetGroup'
    { $sel:datasetGroupArn:DescribeDatasetGroup' :: Text
datasetGroupArn =
        Text
pDatasetGroupArn_
    }

-- | The Amazon Resource Name (ARN) of the dataset group to describe.
describeDatasetGroup_datasetGroupArn :: Lens.Lens' DescribeDatasetGroup Prelude.Text
describeDatasetGroup_datasetGroupArn :: (Text -> f Text) -> DescribeDatasetGroup -> f DescribeDatasetGroup
describeDatasetGroup_datasetGroupArn = (DescribeDatasetGroup -> Text)
-> (DescribeDatasetGroup -> Text -> DescribeDatasetGroup)
-> Lens DescribeDatasetGroup DescribeDatasetGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDatasetGroup' {Text
datasetGroupArn :: Text
$sel:datasetGroupArn:DescribeDatasetGroup' :: DescribeDatasetGroup -> Text
datasetGroupArn} -> Text
datasetGroupArn) (\s :: DescribeDatasetGroup
s@DescribeDatasetGroup' {} Text
a -> DescribeDatasetGroup
s {$sel:datasetGroupArn:DescribeDatasetGroup' :: Text
datasetGroupArn = Text
a} :: DescribeDatasetGroup)

instance Core.AWSRequest DescribeDatasetGroup where
  type
    AWSResponse DescribeDatasetGroup =
      DescribeDatasetGroupResponse
  request :: DescribeDatasetGroup -> Request DescribeDatasetGroup
request = Service -> DescribeDatasetGroup -> Request DescribeDatasetGroup
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeDatasetGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeDatasetGroup)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeDatasetGroup))
-> Logger
-> Service
-> Proxy DescribeDatasetGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeDatasetGroup)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe DatasetGroup -> Int -> DescribeDatasetGroupResponse
DescribeDatasetGroupResponse'
            (Maybe DatasetGroup -> Int -> DescribeDatasetGroupResponse)
-> Either String (Maybe DatasetGroup)
-> Either String (Int -> DescribeDatasetGroupResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe DatasetGroup)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"datasetGroup")
            Either String (Int -> DescribeDatasetGroupResponse)
-> Either String Int -> Either String DescribeDatasetGroupResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DescribeDatasetGroup

instance Prelude.NFData DescribeDatasetGroup

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

instance Core.ToJSON DescribeDatasetGroup where
  toJSON :: DescribeDatasetGroup -> Value
toJSON DescribeDatasetGroup' {Text
datasetGroupArn :: Text
$sel:datasetGroupArn:DescribeDatasetGroup' :: DescribeDatasetGroup -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"datasetGroupArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
datasetGroupArn)
          ]
      )

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

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

-- | /See:/ 'newDescribeDatasetGroupResponse' smart constructor.
data DescribeDatasetGroupResponse = DescribeDatasetGroupResponse'
  { -- | A listing of the dataset group\'s properties.
    DescribeDatasetGroupResponse -> Maybe DatasetGroup
datasetGroup :: Prelude.Maybe DatasetGroup,
    -- | The response's http status code.
    DescribeDatasetGroupResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeDatasetGroupResponse
-> DescribeDatasetGroupResponse -> Bool
(DescribeDatasetGroupResponse
 -> DescribeDatasetGroupResponse -> Bool)
-> (DescribeDatasetGroupResponse
    -> DescribeDatasetGroupResponse -> Bool)
-> Eq DescribeDatasetGroupResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeDatasetGroupResponse
-> DescribeDatasetGroupResponse -> Bool
$c/= :: DescribeDatasetGroupResponse
-> DescribeDatasetGroupResponse -> Bool
== :: DescribeDatasetGroupResponse
-> DescribeDatasetGroupResponse -> Bool
$c== :: DescribeDatasetGroupResponse
-> DescribeDatasetGroupResponse -> Bool
Prelude.Eq, ReadPrec [DescribeDatasetGroupResponse]
ReadPrec DescribeDatasetGroupResponse
Int -> ReadS DescribeDatasetGroupResponse
ReadS [DescribeDatasetGroupResponse]
(Int -> ReadS DescribeDatasetGroupResponse)
-> ReadS [DescribeDatasetGroupResponse]
-> ReadPrec DescribeDatasetGroupResponse
-> ReadPrec [DescribeDatasetGroupResponse]
-> Read DescribeDatasetGroupResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeDatasetGroupResponse]
$creadListPrec :: ReadPrec [DescribeDatasetGroupResponse]
readPrec :: ReadPrec DescribeDatasetGroupResponse
$creadPrec :: ReadPrec DescribeDatasetGroupResponse
readList :: ReadS [DescribeDatasetGroupResponse]
$creadList :: ReadS [DescribeDatasetGroupResponse]
readsPrec :: Int -> ReadS DescribeDatasetGroupResponse
$creadsPrec :: Int -> ReadS DescribeDatasetGroupResponse
Prelude.Read, Int -> DescribeDatasetGroupResponse -> ShowS
[DescribeDatasetGroupResponse] -> ShowS
DescribeDatasetGroupResponse -> String
(Int -> DescribeDatasetGroupResponse -> ShowS)
-> (DescribeDatasetGroupResponse -> String)
-> ([DescribeDatasetGroupResponse] -> ShowS)
-> Show DescribeDatasetGroupResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeDatasetGroupResponse] -> ShowS
$cshowList :: [DescribeDatasetGroupResponse] -> ShowS
show :: DescribeDatasetGroupResponse -> String
$cshow :: DescribeDatasetGroupResponse -> String
showsPrec :: Int -> DescribeDatasetGroupResponse -> ShowS
$cshowsPrec :: Int -> DescribeDatasetGroupResponse -> ShowS
Prelude.Show, (forall x.
 DescribeDatasetGroupResponse -> Rep DescribeDatasetGroupResponse x)
-> (forall x.
    Rep DescribeDatasetGroupResponse x -> DescribeDatasetGroupResponse)
-> Generic DescribeDatasetGroupResponse
forall x.
Rep DescribeDatasetGroupResponse x -> DescribeDatasetGroupResponse
forall x.
DescribeDatasetGroupResponse -> Rep DescribeDatasetGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeDatasetGroupResponse x -> DescribeDatasetGroupResponse
$cfrom :: forall x.
DescribeDatasetGroupResponse -> Rep DescribeDatasetGroupResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeDatasetGroupResponse' 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:
--
-- 'datasetGroup', 'describeDatasetGroupResponse_datasetGroup' - A listing of the dataset group\'s properties.
--
-- 'httpStatus', 'describeDatasetGroupResponse_httpStatus' - The response's http status code.
newDescribeDatasetGroupResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeDatasetGroupResponse
newDescribeDatasetGroupResponse :: Int -> DescribeDatasetGroupResponse
newDescribeDatasetGroupResponse Int
pHttpStatus_ =
  DescribeDatasetGroupResponse' :: Maybe DatasetGroup -> Int -> DescribeDatasetGroupResponse
DescribeDatasetGroupResponse'
    { $sel:datasetGroup:DescribeDatasetGroupResponse' :: Maybe DatasetGroup
datasetGroup =
        Maybe DatasetGroup
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeDatasetGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A listing of the dataset group\'s properties.
describeDatasetGroupResponse_datasetGroup :: Lens.Lens' DescribeDatasetGroupResponse (Prelude.Maybe DatasetGroup)
describeDatasetGroupResponse_datasetGroup :: (Maybe DatasetGroup -> f (Maybe DatasetGroup))
-> DescribeDatasetGroupResponse -> f DescribeDatasetGroupResponse
describeDatasetGroupResponse_datasetGroup = (DescribeDatasetGroupResponse -> Maybe DatasetGroup)
-> (DescribeDatasetGroupResponse
    -> Maybe DatasetGroup -> DescribeDatasetGroupResponse)
-> Lens
     DescribeDatasetGroupResponse
     DescribeDatasetGroupResponse
     (Maybe DatasetGroup)
     (Maybe DatasetGroup)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDatasetGroupResponse' {Maybe DatasetGroup
datasetGroup :: Maybe DatasetGroup
$sel:datasetGroup:DescribeDatasetGroupResponse' :: DescribeDatasetGroupResponse -> Maybe DatasetGroup
datasetGroup} -> Maybe DatasetGroup
datasetGroup) (\s :: DescribeDatasetGroupResponse
s@DescribeDatasetGroupResponse' {} Maybe DatasetGroup
a -> DescribeDatasetGroupResponse
s {$sel:datasetGroup:DescribeDatasetGroupResponse' :: Maybe DatasetGroup
datasetGroup = Maybe DatasetGroup
a} :: DescribeDatasetGroupResponse)

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

instance Prelude.NFData DescribeDatasetGroupResponse