{-# 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.SageMaker.Types.MetadataProperties
-- 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.SageMaker.Types.MetadataProperties where

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

-- | Metadata properties of the tracking entity, trial, or trial component.
--
-- /See:/ 'newMetadataProperties' smart constructor.
data MetadataProperties = MetadataProperties'
  { -- | The commit ID.
    MetadataProperties -> Maybe Text
commitId :: Prelude.Maybe Prelude.Text,
    -- | The repository.
    MetadataProperties -> Maybe Text
repository :: Prelude.Maybe Prelude.Text,
    -- | The entity this entity was generated by.
    MetadataProperties -> Maybe Text
generatedBy :: Prelude.Maybe Prelude.Text,
    -- | The project ID.
    MetadataProperties -> Maybe Text
projectId :: Prelude.Maybe Prelude.Text
  }
  deriving (MetadataProperties -> MetadataProperties -> Bool
(MetadataProperties -> MetadataProperties -> Bool)
-> (MetadataProperties -> MetadataProperties -> Bool)
-> Eq MetadataProperties
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MetadataProperties -> MetadataProperties -> Bool
$c/= :: MetadataProperties -> MetadataProperties -> Bool
== :: MetadataProperties -> MetadataProperties -> Bool
$c== :: MetadataProperties -> MetadataProperties -> Bool
Prelude.Eq, ReadPrec [MetadataProperties]
ReadPrec MetadataProperties
Int -> ReadS MetadataProperties
ReadS [MetadataProperties]
(Int -> ReadS MetadataProperties)
-> ReadS [MetadataProperties]
-> ReadPrec MetadataProperties
-> ReadPrec [MetadataProperties]
-> Read MetadataProperties
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MetadataProperties]
$creadListPrec :: ReadPrec [MetadataProperties]
readPrec :: ReadPrec MetadataProperties
$creadPrec :: ReadPrec MetadataProperties
readList :: ReadS [MetadataProperties]
$creadList :: ReadS [MetadataProperties]
readsPrec :: Int -> ReadS MetadataProperties
$creadsPrec :: Int -> ReadS MetadataProperties
Prelude.Read, Int -> MetadataProperties -> ShowS
[MetadataProperties] -> ShowS
MetadataProperties -> String
(Int -> MetadataProperties -> ShowS)
-> (MetadataProperties -> String)
-> ([MetadataProperties] -> ShowS)
-> Show MetadataProperties
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MetadataProperties] -> ShowS
$cshowList :: [MetadataProperties] -> ShowS
show :: MetadataProperties -> String
$cshow :: MetadataProperties -> String
showsPrec :: Int -> MetadataProperties -> ShowS
$cshowsPrec :: Int -> MetadataProperties -> ShowS
Prelude.Show, (forall x. MetadataProperties -> Rep MetadataProperties x)
-> (forall x. Rep MetadataProperties x -> MetadataProperties)
-> Generic MetadataProperties
forall x. Rep MetadataProperties x -> MetadataProperties
forall x. MetadataProperties -> Rep MetadataProperties x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MetadataProperties x -> MetadataProperties
$cfrom :: forall x. MetadataProperties -> Rep MetadataProperties x
Prelude.Generic)

-- |
-- Create a value of 'MetadataProperties' 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:
--
-- 'commitId', 'metadataProperties_commitId' - The commit ID.
--
-- 'repository', 'metadataProperties_repository' - The repository.
--
-- 'generatedBy', 'metadataProperties_generatedBy' - The entity this entity was generated by.
--
-- 'projectId', 'metadataProperties_projectId' - The project ID.
newMetadataProperties ::
  MetadataProperties
newMetadataProperties :: MetadataProperties
newMetadataProperties =
  MetadataProperties' :: Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> MetadataProperties
MetadataProperties'
    { $sel:commitId:MetadataProperties' :: Maybe Text
commitId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:repository:MetadataProperties' :: Maybe Text
repository = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:generatedBy:MetadataProperties' :: Maybe Text
generatedBy = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:projectId:MetadataProperties' :: Maybe Text
projectId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The commit ID.
metadataProperties_commitId :: Lens.Lens' MetadataProperties (Prelude.Maybe Prelude.Text)
metadataProperties_commitId :: (Maybe Text -> f (Maybe Text))
-> MetadataProperties -> f MetadataProperties
metadataProperties_commitId = (MetadataProperties -> Maybe Text)
-> (MetadataProperties -> Maybe Text -> MetadataProperties)
-> Lens
     MetadataProperties MetadataProperties (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetadataProperties' {Maybe Text
commitId :: Maybe Text
$sel:commitId:MetadataProperties' :: MetadataProperties -> Maybe Text
commitId} -> Maybe Text
commitId) (\s :: MetadataProperties
s@MetadataProperties' {} Maybe Text
a -> MetadataProperties
s {$sel:commitId:MetadataProperties' :: Maybe Text
commitId = Maybe Text
a} :: MetadataProperties)

-- | The repository.
metadataProperties_repository :: Lens.Lens' MetadataProperties (Prelude.Maybe Prelude.Text)
metadataProperties_repository :: (Maybe Text -> f (Maybe Text))
-> MetadataProperties -> f MetadataProperties
metadataProperties_repository = (MetadataProperties -> Maybe Text)
-> (MetadataProperties -> Maybe Text -> MetadataProperties)
-> Lens
     MetadataProperties MetadataProperties (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetadataProperties' {Maybe Text
repository :: Maybe Text
$sel:repository:MetadataProperties' :: MetadataProperties -> Maybe Text
repository} -> Maybe Text
repository) (\s :: MetadataProperties
s@MetadataProperties' {} Maybe Text
a -> MetadataProperties
s {$sel:repository:MetadataProperties' :: Maybe Text
repository = Maybe Text
a} :: MetadataProperties)

-- | The entity this entity was generated by.
metadataProperties_generatedBy :: Lens.Lens' MetadataProperties (Prelude.Maybe Prelude.Text)
metadataProperties_generatedBy :: (Maybe Text -> f (Maybe Text))
-> MetadataProperties -> f MetadataProperties
metadataProperties_generatedBy = (MetadataProperties -> Maybe Text)
-> (MetadataProperties -> Maybe Text -> MetadataProperties)
-> Lens
     MetadataProperties MetadataProperties (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetadataProperties' {Maybe Text
generatedBy :: Maybe Text
$sel:generatedBy:MetadataProperties' :: MetadataProperties -> Maybe Text
generatedBy} -> Maybe Text
generatedBy) (\s :: MetadataProperties
s@MetadataProperties' {} Maybe Text
a -> MetadataProperties
s {$sel:generatedBy:MetadataProperties' :: Maybe Text
generatedBy = Maybe Text
a} :: MetadataProperties)

-- | The project ID.
metadataProperties_projectId :: Lens.Lens' MetadataProperties (Prelude.Maybe Prelude.Text)
metadataProperties_projectId :: (Maybe Text -> f (Maybe Text))
-> MetadataProperties -> f MetadataProperties
metadataProperties_projectId = (MetadataProperties -> Maybe Text)
-> (MetadataProperties -> Maybe Text -> MetadataProperties)
-> Lens
     MetadataProperties MetadataProperties (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetadataProperties' {Maybe Text
projectId :: Maybe Text
$sel:projectId:MetadataProperties' :: MetadataProperties -> Maybe Text
projectId} -> Maybe Text
projectId) (\s :: MetadataProperties
s@MetadataProperties' {} Maybe Text
a -> MetadataProperties
s {$sel:projectId:MetadataProperties' :: Maybe Text
projectId = Maybe Text
a} :: MetadataProperties)

instance Core.FromJSON MetadataProperties where
  parseJSON :: Value -> Parser MetadataProperties
parseJSON =
    String
-> (Object -> Parser MetadataProperties)
-> Value
-> Parser MetadataProperties
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"MetadataProperties"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> MetadataProperties
MetadataProperties'
            (Maybe Text
 -> Maybe Text -> Maybe Text -> Maybe Text -> MetadataProperties)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Text -> MetadataProperties)
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
"CommitId")
            Parser
  (Maybe Text -> Maybe Text -> Maybe Text -> MetadataProperties)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> MetadataProperties)
forall (f :: * -> *) a b. Applicative f => 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
"Repository")
            Parser (Maybe Text -> Maybe Text -> MetadataProperties)
-> Parser (Maybe Text) -> Parser (Maybe Text -> MetadataProperties)
forall (f :: * -> *) a b. Applicative f => 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
"GeneratedBy")
            Parser (Maybe Text -> MetadataProperties)
-> Parser (Maybe Text) -> Parser MetadataProperties
forall (f :: * -> *) a b. Applicative f => 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
"ProjectId")
      )

instance Prelude.Hashable MetadataProperties

instance Prelude.NFData MetadataProperties

instance Core.ToJSON MetadataProperties where
  toJSON :: MetadataProperties -> Value
toJSON MetadataProperties' {Maybe Text
projectId :: Maybe Text
generatedBy :: Maybe Text
repository :: Maybe Text
commitId :: Maybe Text
$sel:projectId:MetadataProperties' :: MetadataProperties -> Maybe Text
$sel:generatedBy:MetadataProperties' :: MetadataProperties -> Maybe Text
$sel:repository:MetadataProperties' :: MetadataProperties -> Maybe Text
$sel:commitId:MetadataProperties' :: MetadataProperties -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"CommitId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
commitId,
            (Text
"Repository" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
repository,
            (Text
"GeneratedBy" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
generatedBy,
            (Text
"ProjectId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
projectId
          ]
      )