{-# 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.Config.Types.StoredQueryMetadata
-- 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)
module Amazonka.Config.Types.StoredQueryMetadata where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Returns details of a specific query.
--
-- /See:/ 'newStoredQueryMetadata' smart constructor.
data StoredQueryMetadata = StoredQueryMetadata'
  { -- | A unique description for the query.
    StoredQueryMetadata -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The ID of the query.
    StoredQueryMetadata -> Text
queryId :: Prelude.Text,
    -- | Amazon Resource Name (ARN) of the query. For example,
    -- arn:partition:service:region:account-id:resource-type\/resource-name\/resource-id.
    StoredQueryMetadata -> Text
queryArn :: Prelude.Text,
    -- | The name of the query.
    StoredQueryMetadata -> Text
queryName :: Prelude.Text
  }
  deriving (StoredQueryMetadata -> StoredQueryMetadata -> Bool
(StoredQueryMetadata -> StoredQueryMetadata -> Bool)
-> (StoredQueryMetadata -> StoredQueryMetadata -> Bool)
-> Eq StoredQueryMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StoredQueryMetadata -> StoredQueryMetadata -> Bool
$c/= :: StoredQueryMetadata -> StoredQueryMetadata -> Bool
== :: StoredQueryMetadata -> StoredQueryMetadata -> Bool
$c== :: StoredQueryMetadata -> StoredQueryMetadata -> Bool
Prelude.Eq, ReadPrec [StoredQueryMetadata]
ReadPrec StoredQueryMetadata
Int -> ReadS StoredQueryMetadata
ReadS [StoredQueryMetadata]
(Int -> ReadS StoredQueryMetadata)
-> ReadS [StoredQueryMetadata]
-> ReadPrec StoredQueryMetadata
-> ReadPrec [StoredQueryMetadata]
-> Read StoredQueryMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StoredQueryMetadata]
$creadListPrec :: ReadPrec [StoredQueryMetadata]
readPrec :: ReadPrec StoredQueryMetadata
$creadPrec :: ReadPrec StoredQueryMetadata
readList :: ReadS [StoredQueryMetadata]
$creadList :: ReadS [StoredQueryMetadata]
readsPrec :: Int -> ReadS StoredQueryMetadata
$creadsPrec :: Int -> ReadS StoredQueryMetadata
Prelude.Read, Int -> StoredQueryMetadata -> ShowS
[StoredQueryMetadata] -> ShowS
StoredQueryMetadata -> String
(Int -> StoredQueryMetadata -> ShowS)
-> (StoredQueryMetadata -> String)
-> ([StoredQueryMetadata] -> ShowS)
-> Show StoredQueryMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StoredQueryMetadata] -> ShowS
$cshowList :: [StoredQueryMetadata] -> ShowS
show :: StoredQueryMetadata -> String
$cshow :: StoredQueryMetadata -> String
showsPrec :: Int -> StoredQueryMetadata -> ShowS
$cshowsPrec :: Int -> StoredQueryMetadata -> ShowS
Prelude.Show, (forall x. StoredQueryMetadata -> Rep StoredQueryMetadata x)
-> (forall x. Rep StoredQueryMetadata x -> StoredQueryMetadata)
-> Generic StoredQueryMetadata
forall x. Rep StoredQueryMetadata x -> StoredQueryMetadata
forall x. StoredQueryMetadata -> Rep StoredQueryMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StoredQueryMetadata x -> StoredQueryMetadata
$cfrom :: forall x. StoredQueryMetadata -> Rep StoredQueryMetadata x
Prelude.Generic)

-- |
-- Create a value of 'StoredQueryMetadata' 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:
--
-- 'description', 'storedQueryMetadata_description' - A unique description for the query.
--
-- 'queryId', 'storedQueryMetadata_queryId' - The ID of the query.
--
-- 'queryArn', 'storedQueryMetadata_queryArn' - Amazon Resource Name (ARN) of the query. For example,
-- arn:partition:service:region:account-id:resource-type\/resource-name\/resource-id.
--
-- 'queryName', 'storedQueryMetadata_queryName' - The name of the query.
newStoredQueryMetadata ::
  -- | 'queryId'
  Prelude.Text ->
  -- | 'queryArn'
  Prelude.Text ->
  -- | 'queryName'
  Prelude.Text ->
  StoredQueryMetadata
newStoredQueryMetadata :: Text -> Text -> Text -> StoredQueryMetadata
newStoredQueryMetadata
  Text
pQueryId_
  Text
pQueryArn_
  Text
pQueryName_ =
    StoredQueryMetadata' :: Maybe Text -> Text -> Text -> Text -> StoredQueryMetadata
StoredQueryMetadata'
      { $sel:description:StoredQueryMetadata' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:queryId:StoredQueryMetadata' :: Text
queryId = Text
pQueryId_,
        $sel:queryArn:StoredQueryMetadata' :: Text
queryArn = Text
pQueryArn_,
        $sel:queryName:StoredQueryMetadata' :: Text
queryName = Text
pQueryName_
      }

-- | A unique description for the query.
storedQueryMetadata_description :: Lens.Lens' StoredQueryMetadata (Prelude.Maybe Prelude.Text)
storedQueryMetadata_description :: (Maybe Text -> f (Maybe Text))
-> StoredQueryMetadata -> f StoredQueryMetadata
storedQueryMetadata_description = (StoredQueryMetadata -> Maybe Text)
-> (StoredQueryMetadata -> Maybe Text -> StoredQueryMetadata)
-> Lens
     StoredQueryMetadata StoredQueryMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StoredQueryMetadata' {Maybe Text
description :: Maybe Text
$sel:description:StoredQueryMetadata' :: StoredQueryMetadata -> Maybe Text
description} -> Maybe Text
description) (\s :: StoredQueryMetadata
s@StoredQueryMetadata' {} Maybe Text
a -> StoredQueryMetadata
s {$sel:description:StoredQueryMetadata' :: Maybe Text
description = Maybe Text
a} :: StoredQueryMetadata)

-- | The ID of the query.
storedQueryMetadata_queryId :: Lens.Lens' StoredQueryMetadata Prelude.Text
storedQueryMetadata_queryId :: (Text -> f Text) -> StoredQueryMetadata -> f StoredQueryMetadata
storedQueryMetadata_queryId = (StoredQueryMetadata -> Text)
-> (StoredQueryMetadata -> Text -> StoredQueryMetadata)
-> Lens StoredQueryMetadata StoredQueryMetadata Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StoredQueryMetadata' {Text
queryId :: Text
$sel:queryId:StoredQueryMetadata' :: StoredQueryMetadata -> Text
queryId} -> Text
queryId) (\s :: StoredQueryMetadata
s@StoredQueryMetadata' {} Text
a -> StoredQueryMetadata
s {$sel:queryId:StoredQueryMetadata' :: Text
queryId = Text
a} :: StoredQueryMetadata)

-- | Amazon Resource Name (ARN) of the query. For example,
-- arn:partition:service:region:account-id:resource-type\/resource-name\/resource-id.
storedQueryMetadata_queryArn :: Lens.Lens' StoredQueryMetadata Prelude.Text
storedQueryMetadata_queryArn :: (Text -> f Text) -> StoredQueryMetadata -> f StoredQueryMetadata
storedQueryMetadata_queryArn = (StoredQueryMetadata -> Text)
-> (StoredQueryMetadata -> Text -> StoredQueryMetadata)
-> Lens StoredQueryMetadata StoredQueryMetadata Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StoredQueryMetadata' {Text
queryArn :: Text
$sel:queryArn:StoredQueryMetadata' :: StoredQueryMetadata -> Text
queryArn} -> Text
queryArn) (\s :: StoredQueryMetadata
s@StoredQueryMetadata' {} Text
a -> StoredQueryMetadata
s {$sel:queryArn:StoredQueryMetadata' :: Text
queryArn = Text
a} :: StoredQueryMetadata)

-- | The name of the query.
storedQueryMetadata_queryName :: Lens.Lens' StoredQueryMetadata Prelude.Text
storedQueryMetadata_queryName :: (Text -> f Text) -> StoredQueryMetadata -> f StoredQueryMetadata
storedQueryMetadata_queryName = (StoredQueryMetadata -> Text)
-> (StoredQueryMetadata -> Text -> StoredQueryMetadata)
-> Lens StoredQueryMetadata StoredQueryMetadata Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StoredQueryMetadata' {Text
queryName :: Text
$sel:queryName:StoredQueryMetadata' :: StoredQueryMetadata -> Text
queryName} -> Text
queryName) (\s :: StoredQueryMetadata
s@StoredQueryMetadata' {} Text
a -> StoredQueryMetadata
s {$sel:queryName:StoredQueryMetadata' :: Text
queryName = Text
a} :: StoredQueryMetadata)

instance Core.FromJSON StoredQueryMetadata where
  parseJSON :: Value -> Parser StoredQueryMetadata
parseJSON =
    String
-> (Object -> Parser StoredQueryMetadata)
-> Value
-> Parser StoredQueryMetadata
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"StoredQueryMetadata"
      ( \Object
x ->
          Maybe Text -> Text -> Text -> Text -> StoredQueryMetadata
StoredQueryMetadata'
            (Maybe Text -> Text -> Text -> Text -> StoredQueryMetadata)
-> Parser (Maybe Text)
-> Parser (Text -> Text -> Text -> StoredQueryMetadata)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Description")
            Parser (Text -> Text -> Text -> StoredQueryMetadata)
-> Parser Text -> Parser (Text -> Text -> StoredQueryMetadata)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"QueryId")
            Parser (Text -> Text -> StoredQueryMetadata)
-> Parser Text -> Parser (Text -> StoredQueryMetadata)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"QueryArn")
            Parser (Text -> StoredQueryMetadata)
-> Parser Text -> Parser StoredQueryMetadata
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"QueryName")
      )

instance Prelude.Hashable StoredQueryMetadata

instance Prelude.NFData StoredQueryMetadata