{-# 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.ECR.Types.ImageReplicationStatus
-- 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.ECR.Types.ImageReplicationStatus where

import qualified Amazonka.Core as Core
import Amazonka.ECR.Types.ReplicationStatus
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The status of the replication process for an image.
--
-- /See:/ 'newImageReplicationStatus' smart constructor.
data ImageReplicationStatus = ImageReplicationStatus'
  { -- | The image replication status.
    ImageReplicationStatus -> Maybe ReplicationStatus
status :: Prelude.Maybe ReplicationStatus,
    -- | The failure code for a replication that has failed.
    ImageReplicationStatus -> Maybe Text
failureCode :: Prelude.Maybe Prelude.Text,
    -- | The AWS account ID associated with the registry to which the image
    -- belongs.
    ImageReplicationStatus -> Maybe Text
registryId :: Prelude.Maybe Prelude.Text,
    -- | The destination Region for the image replication.
    ImageReplicationStatus -> Maybe Text
region :: Prelude.Maybe Prelude.Text
  }
  deriving (ImageReplicationStatus -> ImageReplicationStatus -> Bool
(ImageReplicationStatus -> ImageReplicationStatus -> Bool)
-> (ImageReplicationStatus -> ImageReplicationStatus -> Bool)
-> Eq ImageReplicationStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImageReplicationStatus -> ImageReplicationStatus -> Bool
$c/= :: ImageReplicationStatus -> ImageReplicationStatus -> Bool
== :: ImageReplicationStatus -> ImageReplicationStatus -> Bool
$c== :: ImageReplicationStatus -> ImageReplicationStatus -> Bool
Prelude.Eq, ReadPrec [ImageReplicationStatus]
ReadPrec ImageReplicationStatus
Int -> ReadS ImageReplicationStatus
ReadS [ImageReplicationStatus]
(Int -> ReadS ImageReplicationStatus)
-> ReadS [ImageReplicationStatus]
-> ReadPrec ImageReplicationStatus
-> ReadPrec [ImageReplicationStatus]
-> Read ImageReplicationStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ImageReplicationStatus]
$creadListPrec :: ReadPrec [ImageReplicationStatus]
readPrec :: ReadPrec ImageReplicationStatus
$creadPrec :: ReadPrec ImageReplicationStatus
readList :: ReadS [ImageReplicationStatus]
$creadList :: ReadS [ImageReplicationStatus]
readsPrec :: Int -> ReadS ImageReplicationStatus
$creadsPrec :: Int -> ReadS ImageReplicationStatus
Prelude.Read, Int -> ImageReplicationStatus -> ShowS
[ImageReplicationStatus] -> ShowS
ImageReplicationStatus -> String
(Int -> ImageReplicationStatus -> ShowS)
-> (ImageReplicationStatus -> String)
-> ([ImageReplicationStatus] -> ShowS)
-> Show ImageReplicationStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ImageReplicationStatus] -> ShowS
$cshowList :: [ImageReplicationStatus] -> ShowS
show :: ImageReplicationStatus -> String
$cshow :: ImageReplicationStatus -> String
showsPrec :: Int -> ImageReplicationStatus -> ShowS
$cshowsPrec :: Int -> ImageReplicationStatus -> ShowS
Prelude.Show, (forall x. ImageReplicationStatus -> Rep ImageReplicationStatus x)
-> (forall x.
    Rep ImageReplicationStatus x -> ImageReplicationStatus)
-> Generic ImageReplicationStatus
forall x. Rep ImageReplicationStatus x -> ImageReplicationStatus
forall x. ImageReplicationStatus -> Rep ImageReplicationStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ImageReplicationStatus x -> ImageReplicationStatus
$cfrom :: forall x. ImageReplicationStatus -> Rep ImageReplicationStatus x
Prelude.Generic)

-- |
-- Create a value of 'ImageReplicationStatus' 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:
--
-- 'status', 'imageReplicationStatus_status' - The image replication status.
--
-- 'failureCode', 'imageReplicationStatus_failureCode' - The failure code for a replication that has failed.
--
-- 'registryId', 'imageReplicationStatus_registryId' - The AWS account ID associated with the registry to which the image
-- belongs.
--
-- 'region', 'imageReplicationStatus_region' - The destination Region for the image replication.
newImageReplicationStatus ::
  ImageReplicationStatus
newImageReplicationStatus :: ImageReplicationStatus
newImageReplicationStatus =
  ImageReplicationStatus' :: Maybe ReplicationStatus
-> Maybe Text -> Maybe Text -> Maybe Text -> ImageReplicationStatus
ImageReplicationStatus'
    { $sel:status:ImageReplicationStatus' :: Maybe ReplicationStatus
status = Maybe ReplicationStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:failureCode:ImageReplicationStatus' :: Maybe Text
failureCode = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:registryId:ImageReplicationStatus' :: Maybe Text
registryId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:region:ImageReplicationStatus' :: Maybe Text
region = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The image replication status.
imageReplicationStatus_status :: Lens.Lens' ImageReplicationStatus (Prelude.Maybe ReplicationStatus)
imageReplicationStatus_status :: (Maybe ReplicationStatus -> f (Maybe ReplicationStatus))
-> ImageReplicationStatus -> f ImageReplicationStatus
imageReplicationStatus_status = (ImageReplicationStatus -> Maybe ReplicationStatus)
-> (ImageReplicationStatus
    -> Maybe ReplicationStatus -> ImageReplicationStatus)
-> Lens
     ImageReplicationStatus
     ImageReplicationStatus
     (Maybe ReplicationStatus)
     (Maybe ReplicationStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImageReplicationStatus' {Maybe ReplicationStatus
status :: Maybe ReplicationStatus
$sel:status:ImageReplicationStatus' :: ImageReplicationStatus -> Maybe ReplicationStatus
status} -> Maybe ReplicationStatus
status) (\s :: ImageReplicationStatus
s@ImageReplicationStatus' {} Maybe ReplicationStatus
a -> ImageReplicationStatus
s {$sel:status:ImageReplicationStatus' :: Maybe ReplicationStatus
status = Maybe ReplicationStatus
a} :: ImageReplicationStatus)

-- | The failure code for a replication that has failed.
imageReplicationStatus_failureCode :: Lens.Lens' ImageReplicationStatus (Prelude.Maybe Prelude.Text)
imageReplicationStatus_failureCode :: (Maybe Text -> f (Maybe Text))
-> ImageReplicationStatus -> f ImageReplicationStatus
imageReplicationStatus_failureCode = (ImageReplicationStatus -> Maybe Text)
-> (ImageReplicationStatus -> Maybe Text -> ImageReplicationStatus)
-> Lens
     ImageReplicationStatus
     ImageReplicationStatus
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImageReplicationStatus' {Maybe Text
failureCode :: Maybe Text
$sel:failureCode:ImageReplicationStatus' :: ImageReplicationStatus -> Maybe Text
failureCode} -> Maybe Text
failureCode) (\s :: ImageReplicationStatus
s@ImageReplicationStatus' {} Maybe Text
a -> ImageReplicationStatus
s {$sel:failureCode:ImageReplicationStatus' :: Maybe Text
failureCode = Maybe Text
a} :: ImageReplicationStatus)

-- | The AWS account ID associated with the registry to which the image
-- belongs.
imageReplicationStatus_registryId :: Lens.Lens' ImageReplicationStatus (Prelude.Maybe Prelude.Text)
imageReplicationStatus_registryId :: (Maybe Text -> f (Maybe Text))
-> ImageReplicationStatus -> f ImageReplicationStatus
imageReplicationStatus_registryId = (ImageReplicationStatus -> Maybe Text)
-> (ImageReplicationStatus -> Maybe Text -> ImageReplicationStatus)
-> Lens
     ImageReplicationStatus
     ImageReplicationStatus
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImageReplicationStatus' {Maybe Text
registryId :: Maybe Text
$sel:registryId:ImageReplicationStatus' :: ImageReplicationStatus -> Maybe Text
registryId} -> Maybe Text
registryId) (\s :: ImageReplicationStatus
s@ImageReplicationStatus' {} Maybe Text
a -> ImageReplicationStatus
s {$sel:registryId:ImageReplicationStatus' :: Maybe Text
registryId = Maybe Text
a} :: ImageReplicationStatus)

-- | The destination Region for the image replication.
imageReplicationStatus_region :: Lens.Lens' ImageReplicationStatus (Prelude.Maybe Prelude.Text)
imageReplicationStatus_region :: (Maybe Text -> f (Maybe Text))
-> ImageReplicationStatus -> f ImageReplicationStatus
imageReplicationStatus_region = (ImageReplicationStatus -> Maybe Text)
-> (ImageReplicationStatus -> Maybe Text -> ImageReplicationStatus)
-> Lens
     ImageReplicationStatus
     ImageReplicationStatus
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImageReplicationStatus' {Maybe Text
region :: Maybe Text
$sel:region:ImageReplicationStatus' :: ImageReplicationStatus -> Maybe Text
region} -> Maybe Text
region) (\s :: ImageReplicationStatus
s@ImageReplicationStatus' {} Maybe Text
a -> ImageReplicationStatus
s {$sel:region:ImageReplicationStatus' :: Maybe Text
region = Maybe Text
a} :: ImageReplicationStatus)

instance Core.FromJSON ImageReplicationStatus where
  parseJSON :: Value -> Parser ImageReplicationStatus
parseJSON =
    String
-> (Object -> Parser ImageReplicationStatus)
-> Value
-> Parser ImageReplicationStatus
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ImageReplicationStatus"
      ( \Object
x ->
          Maybe ReplicationStatus
-> Maybe Text -> Maybe Text -> Maybe Text -> ImageReplicationStatus
ImageReplicationStatus'
            (Maybe ReplicationStatus
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> ImageReplicationStatus)
-> Parser (Maybe ReplicationStatus)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Text -> ImageReplicationStatus)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ReplicationStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"status")
            Parser
  (Maybe Text -> Maybe Text -> Maybe Text -> ImageReplicationStatus)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> ImageReplicationStatus)
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
"failureCode")
            Parser (Maybe Text -> Maybe Text -> ImageReplicationStatus)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> ImageReplicationStatus)
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
"registryId")
            Parser (Maybe Text -> ImageReplicationStatus)
-> Parser (Maybe Text) -> Parser ImageReplicationStatus
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
"region")
      )

instance Prelude.Hashable ImageReplicationStatus

instance Prelude.NFData ImageReplicationStatus