{-# 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.SecurityHub.Types.AwsEcrRepositoryLifecyclePolicyDetails
-- 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.SecurityHub.Types.AwsEcrRepositoryLifecyclePolicyDetails where

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

-- | Information about the lifecycle policy for the repository.
--
-- /See:/ 'newAwsEcrRepositoryLifecyclePolicyDetails' smart constructor.
data AwsEcrRepositoryLifecyclePolicyDetails = AwsEcrRepositoryLifecyclePolicyDetails'
  { -- | The Amazon Web Services account identifier that is associated with the
    -- registry that contains the repository.
    AwsEcrRepositoryLifecyclePolicyDetails -> Maybe Text
registryId :: Prelude.Maybe Prelude.Text,
    -- | The text of the lifecycle policy.
    AwsEcrRepositoryLifecyclePolicyDetails -> Maybe Text
lifecyclePolicyText :: Prelude.Maybe Prelude.Text
  }
  deriving (AwsEcrRepositoryLifecyclePolicyDetails
-> AwsEcrRepositoryLifecyclePolicyDetails -> Bool
(AwsEcrRepositoryLifecyclePolicyDetails
 -> AwsEcrRepositoryLifecyclePolicyDetails -> Bool)
-> (AwsEcrRepositoryLifecyclePolicyDetails
    -> AwsEcrRepositoryLifecyclePolicyDetails -> Bool)
-> Eq AwsEcrRepositoryLifecyclePolicyDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsEcrRepositoryLifecyclePolicyDetails
-> AwsEcrRepositoryLifecyclePolicyDetails -> Bool
$c/= :: AwsEcrRepositoryLifecyclePolicyDetails
-> AwsEcrRepositoryLifecyclePolicyDetails -> Bool
== :: AwsEcrRepositoryLifecyclePolicyDetails
-> AwsEcrRepositoryLifecyclePolicyDetails -> Bool
$c== :: AwsEcrRepositoryLifecyclePolicyDetails
-> AwsEcrRepositoryLifecyclePolicyDetails -> Bool
Prelude.Eq, ReadPrec [AwsEcrRepositoryLifecyclePolicyDetails]
ReadPrec AwsEcrRepositoryLifecyclePolicyDetails
Int -> ReadS AwsEcrRepositoryLifecyclePolicyDetails
ReadS [AwsEcrRepositoryLifecyclePolicyDetails]
(Int -> ReadS AwsEcrRepositoryLifecyclePolicyDetails)
-> ReadS [AwsEcrRepositoryLifecyclePolicyDetails]
-> ReadPrec AwsEcrRepositoryLifecyclePolicyDetails
-> ReadPrec [AwsEcrRepositoryLifecyclePolicyDetails]
-> Read AwsEcrRepositoryLifecyclePolicyDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsEcrRepositoryLifecyclePolicyDetails]
$creadListPrec :: ReadPrec [AwsEcrRepositoryLifecyclePolicyDetails]
readPrec :: ReadPrec AwsEcrRepositoryLifecyclePolicyDetails
$creadPrec :: ReadPrec AwsEcrRepositoryLifecyclePolicyDetails
readList :: ReadS [AwsEcrRepositoryLifecyclePolicyDetails]
$creadList :: ReadS [AwsEcrRepositoryLifecyclePolicyDetails]
readsPrec :: Int -> ReadS AwsEcrRepositoryLifecyclePolicyDetails
$creadsPrec :: Int -> ReadS AwsEcrRepositoryLifecyclePolicyDetails
Prelude.Read, Int -> AwsEcrRepositoryLifecyclePolicyDetails -> ShowS
[AwsEcrRepositoryLifecyclePolicyDetails] -> ShowS
AwsEcrRepositoryLifecyclePolicyDetails -> String
(Int -> AwsEcrRepositoryLifecyclePolicyDetails -> ShowS)
-> (AwsEcrRepositoryLifecyclePolicyDetails -> String)
-> ([AwsEcrRepositoryLifecyclePolicyDetails] -> ShowS)
-> Show AwsEcrRepositoryLifecyclePolicyDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsEcrRepositoryLifecyclePolicyDetails] -> ShowS
$cshowList :: [AwsEcrRepositoryLifecyclePolicyDetails] -> ShowS
show :: AwsEcrRepositoryLifecyclePolicyDetails -> String
$cshow :: AwsEcrRepositoryLifecyclePolicyDetails -> String
showsPrec :: Int -> AwsEcrRepositoryLifecyclePolicyDetails -> ShowS
$cshowsPrec :: Int -> AwsEcrRepositoryLifecyclePolicyDetails -> ShowS
Prelude.Show, (forall x.
 AwsEcrRepositoryLifecyclePolicyDetails
 -> Rep AwsEcrRepositoryLifecyclePolicyDetails x)
-> (forall x.
    Rep AwsEcrRepositoryLifecyclePolicyDetails x
    -> AwsEcrRepositoryLifecyclePolicyDetails)
-> Generic AwsEcrRepositoryLifecyclePolicyDetails
forall x.
Rep AwsEcrRepositoryLifecyclePolicyDetails x
-> AwsEcrRepositoryLifecyclePolicyDetails
forall x.
AwsEcrRepositoryLifecyclePolicyDetails
-> Rep AwsEcrRepositoryLifecyclePolicyDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsEcrRepositoryLifecyclePolicyDetails x
-> AwsEcrRepositoryLifecyclePolicyDetails
$cfrom :: forall x.
AwsEcrRepositoryLifecyclePolicyDetails
-> Rep AwsEcrRepositoryLifecyclePolicyDetails x
Prelude.Generic)

-- |
-- Create a value of 'AwsEcrRepositoryLifecyclePolicyDetails' 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:
--
-- 'registryId', 'awsEcrRepositoryLifecyclePolicyDetails_registryId' - The Amazon Web Services account identifier that is associated with the
-- registry that contains the repository.
--
-- 'lifecyclePolicyText', 'awsEcrRepositoryLifecyclePolicyDetails_lifecyclePolicyText' - The text of the lifecycle policy.
newAwsEcrRepositoryLifecyclePolicyDetails ::
  AwsEcrRepositoryLifecyclePolicyDetails
newAwsEcrRepositoryLifecyclePolicyDetails :: AwsEcrRepositoryLifecyclePolicyDetails
newAwsEcrRepositoryLifecyclePolicyDetails =
  AwsEcrRepositoryLifecyclePolicyDetails' :: Maybe Text -> Maybe Text -> AwsEcrRepositoryLifecyclePolicyDetails
AwsEcrRepositoryLifecyclePolicyDetails'
    { $sel:registryId:AwsEcrRepositoryLifecyclePolicyDetails' :: Maybe Text
registryId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lifecyclePolicyText:AwsEcrRepositoryLifecyclePolicyDetails' :: Maybe Text
lifecyclePolicyText =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Web Services account identifier that is associated with the
-- registry that contains the repository.
awsEcrRepositoryLifecyclePolicyDetails_registryId :: Lens.Lens' AwsEcrRepositoryLifecyclePolicyDetails (Prelude.Maybe Prelude.Text)
awsEcrRepositoryLifecyclePolicyDetails_registryId :: (Maybe Text -> f (Maybe Text))
-> AwsEcrRepositoryLifecyclePolicyDetails
-> f AwsEcrRepositoryLifecyclePolicyDetails
awsEcrRepositoryLifecyclePolicyDetails_registryId = (AwsEcrRepositoryLifecyclePolicyDetails -> Maybe Text)
-> (AwsEcrRepositoryLifecyclePolicyDetails
    -> Maybe Text -> AwsEcrRepositoryLifecyclePolicyDetails)
-> Lens
     AwsEcrRepositoryLifecyclePolicyDetails
     AwsEcrRepositoryLifecyclePolicyDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEcrRepositoryLifecyclePolicyDetails' {Maybe Text
registryId :: Maybe Text
$sel:registryId:AwsEcrRepositoryLifecyclePolicyDetails' :: AwsEcrRepositoryLifecyclePolicyDetails -> Maybe Text
registryId} -> Maybe Text
registryId) (\s :: AwsEcrRepositoryLifecyclePolicyDetails
s@AwsEcrRepositoryLifecyclePolicyDetails' {} Maybe Text
a -> AwsEcrRepositoryLifecyclePolicyDetails
s {$sel:registryId:AwsEcrRepositoryLifecyclePolicyDetails' :: Maybe Text
registryId = Maybe Text
a} :: AwsEcrRepositoryLifecyclePolicyDetails)

-- | The text of the lifecycle policy.
awsEcrRepositoryLifecyclePolicyDetails_lifecyclePolicyText :: Lens.Lens' AwsEcrRepositoryLifecyclePolicyDetails (Prelude.Maybe Prelude.Text)
awsEcrRepositoryLifecyclePolicyDetails_lifecyclePolicyText :: (Maybe Text -> f (Maybe Text))
-> AwsEcrRepositoryLifecyclePolicyDetails
-> f AwsEcrRepositoryLifecyclePolicyDetails
awsEcrRepositoryLifecyclePolicyDetails_lifecyclePolicyText = (AwsEcrRepositoryLifecyclePolicyDetails -> Maybe Text)
-> (AwsEcrRepositoryLifecyclePolicyDetails
    -> Maybe Text -> AwsEcrRepositoryLifecyclePolicyDetails)
-> Lens
     AwsEcrRepositoryLifecyclePolicyDetails
     AwsEcrRepositoryLifecyclePolicyDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEcrRepositoryLifecyclePolicyDetails' {Maybe Text
lifecyclePolicyText :: Maybe Text
$sel:lifecyclePolicyText:AwsEcrRepositoryLifecyclePolicyDetails' :: AwsEcrRepositoryLifecyclePolicyDetails -> Maybe Text
lifecyclePolicyText} -> Maybe Text
lifecyclePolicyText) (\s :: AwsEcrRepositoryLifecyclePolicyDetails
s@AwsEcrRepositoryLifecyclePolicyDetails' {} Maybe Text
a -> AwsEcrRepositoryLifecyclePolicyDetails
s {$sel:lifecyclePolicyText:AwsEcrRepositoryLifecyclePolicyDetails' :: Maybe Text
lifecyclePolicyText = Maybe Text
a} :: AwsEcrRepositoryLifecyclePolicyDetails)

instance
  Core.FromJSON
    AwsEcrRepositoryLifecyclePolicyDetails
  where
  parseJSON :: Value -> Parser AwsEcrRepositoryLifecyclePolicyDetails
parseJSON =
    String
-> (Object -> Parser AwsEcrRepositoryLifecyclePolicyDetails)
-> Value
-> Parser AwsEcrRepositoryLifecyclePolicyDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsEcrRepositoryLifecyclePolicyDetails"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> AwsEcrRepositoryLifecyclePolicyDetails
AwsEcrRepositoryLifecyclePolicyDetails'
            (Maybe Text
 -> Maybe Text -> AwsEcrRepositoryLifecyclePolicyDetails)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> AwsEcrRepositoryLifecyclePolicyDetails)
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
"RegistryId")
            Parser (Maybe Text -> AwsEcrRepositoryLifecyclePolicyDetails)
-> Parser (Maybe Text)
-> Parser AwsEcrRepositoryLifecyclePolicyDetails
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
"LifecyclePolicyText")
      )

instance
  Prelude.Hashable
    AwsEcrRepositoryLifecyclePolicyDetails

instance
  Prelude.NFData
    AwsEcrRepositoryLifecyclePolicyDetails

instance
  Core.ToJSON
    AwsEcrRepositoryLifecyclePolicyDetails
  where
  toJSON :: AwsEcrRepositoryLifecyclePolicyDetails -> Value
toJSON AwsEcrRepositoryLifecyclePolicyDetails' {Maybe Text
lifecyclePolicyText :: Maybe Text
registryId :: Maybe Text
$sel:lifecyclePolicyText:AwsEcrRepositoryLifecyclePolicyDetails' :: AwsEcrRepositoryLifecyclePolicyDetails -> Maybe Text
$sel:registryId:AwsEcrRepositoryLifecyclePolicyDetails' :: AwsEcrRepositoryLifecyclePolicyDetails -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"RegistryId" 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
registryId,
            (Text
"LifecyclePolicyText" 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
lifecyclePolicyText
          ]
      )