{-# 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.Lightsail.Types.PrivateRegistryAccess
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Lightsail.Types.PrivateRegistryAccess where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Lightsail.Types.ContainerServiceECRImagePullerRole
import qualified Amazonka.Prelude as Prelude

-- | Describes the configuration for an Amazon Lightsail container service to
-- access private container image repositories, such as Amazon Elastic
-- Container Registry (Amazon ECR) private repositories.
--
-- For more information, see
-- <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-container-service-ecr-private-repo-access Configuring access to an Amazon ECR private repository for an Amazon Lightsail container service>
-- in the /Amazon Lightsail Developer Guide/.
--
-- /See:/ 'newPrivateRegistryAccess' smart constructor.
data PrivateRegistryAccess = PrivateRegistryAccess'
  { -- | An object that describes the activation status of the role that you can
    -- use to grant a Lightsail container service access to Amazon ECR private
    -- repositories. If the role is activated, the Amazon Resource Name (ARN)
    -- of the role is also listed.
    PrivateRegistryAccess -> Maybe ContainerServiceECRImagePullerRole
ecrImagePullerRole :: Prelude.Maybe ContainerServiceECRImagePullerRole
  }
  deriving (PrivateRegistryAccess -> PrivateRegistryAccess -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PrivateRegistryAccess -> PrivateRegistryAccess -> Bool
$c/= :: PrivateRegistryAccess -> PrivateRegistryAccess -> Bool
== :: PrivateRegistryAccess -> PrivateRegistryAccess -> Bool
$c== :: PrivateRegistryAccess -> PrivateRegistryAccess -> Bool
Prelude.Eq, ReadPrec [PrivateRegistryAccess]
ReadPrec PrivateRegistryAccess
Int -> ReadS PrivateRegistryAccess
ReadS [PrivateRegistryAccess]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PrivateRegistryAccess]
$creadListPrec :: ReadPrec [PrivateRegistryAccess]
readPrec :: ReadPrec PrivateRegistryAccess
$creadPrec :: ReadPrec PrivateRegistryAccess
readList :: ReadS [PrivateRegistryAccess]
$creadList :: ReadS [PrivateRegistryAccess]
readsPrec :: Int -> ReadS PrivateRegistryAccess
$creadsPrec :: Int -> ReadS PrivateRegistryAccess
Prelude.Read, Int -> PrivateRegistryAccess -> ShowS
[PrivateRegistryAccess] -> ShowS
PrivateRegistryAccess -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PrivateRegistryAccess] -> ShowS
$cshowList :: [PrivateRegistryAccess] -> ShowS
show :: PrivateRegistryAccess -> String
$cshow :: PrivateRegistryAccess -> String
showsPrec :: Int -> PrivateRegistryAccess -> ShowS
$cshowsPrec :: Int -> PrivateRegistryAccess -> ShowS
Prelude.Show, forall x. Rep PrivateRegistryAccess x -> PrivateRegistryAccess
forall x. PrivateRegistryAccess -> Rep PrivateRegistryAccess x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PrivateRegistryAccess x -> PrivateRegistryAccess
$cfrom :: forall x. PrivateRegistryAccess -> Rep PrivateRegistryAccess x
Prelude.Generic)

-- |
-- Create a value of 'PrivateRegistryAccess' 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:
--
-- 'ecrImagePullerRole', 'privateRegistryAccess_ecrImagePullerRole' - An object that describes the activation status of the role that you can
-- use to grant a Lightsail container service access to Amazon ECR private
-- repositories. If the role is activated, the Amazon Resource Name (ARN)
-- of the role is also listed.
newPrivateRegistryAccess ::
  PrivateRegistryAccess
newPrivateRegistryAccess :: PrivateRegistryAccess
newPrivateRegistryAccess =
  PrivateRegistryAccess'
    { $sel:ecrImagePullerRole:PrivateRegistryAccess' :: Maybe ContainerServiceECRImagePullerRole
ecrImagePullerRole =
        forall a. Maybe a
Prelude.Nothing
    }

-- | An object that describes the activation status of the role that you can
-- use to grant a Lightsail container service access to Amazon ECR private
-- repositories. If the role is activated, the Amazon Resource Name (ARN)
-- of the role is also listed.
privateRegistryAccess_ecrImagePullerRole :: Lens.Lens' PrivateRegistryAccess (Prelude.Maybe ContainerServiceECRImagePullerRole)
privateRegistryAccess_ecrImagePullerRole :: Lens'
  PrivateRegistryAccess (Maybe ContainerServiceECRImagePullerRole)
privateRegistryAccess_ecrImagePullerRole = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PrivateRegistryAccess' {Maybe ContainerServiceECRImagePullerRole
ecrImagePullerRole :: Maybe ContainerServiceECRImagePullerRole
$sel:ecrImagePullerRole:PrivateRegistryAccess' :: PrivateRegistryAccess -> Maybe ContainerServiceECRImagePullerRole
ecrImagePullerRole} -> Maybe ContainerServiceECRImagePullerRole
ecrImagePullerRole) (\s :: PrivateRegistryAccess
s@PrivateRegistryAccess' {} Maybe ContainerServiceECRImagePullerRole
a -> PrivateRegistryAccess
s {$sel:ecrImagePullerRole:PrivateRegistryAccess' :: Maybe ContainerServiceECRImagePullerRole
ecrImagePullerRole = Maybe ContainerServiceECRImagePullerRole
a} :: PrivateRegistryAccess)

instance Data.FromJSON PrivateRegistryAccess where
  parseJSON :: Value -> Parser PrivateRegistryAccess
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"PrivateRegistryAccess"
      ( \Object
x ->
          Maybe ContainerServiceECRImagePullerRole -> PrivateRegistryAccess
PrivateRegistryAccess'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ecrImagePullerRole")
      )

instance Prelude.Hashable PrivateRegistryAccess where
  hashWithSalt :: Int -> PrivateRegistryAccess -> Int
hashWithSalt Int
_salt PrivateRegistryAccess' {Maybe ContainerServiceECRImagePullerRole
ecrImagePullerRole :: Maybe ContainerServiceECRImagePullerRole
$sel:ecrImagePullerRole:PrivateRegistryAccess' :: PrivateRegistryAccess -> Maybe ContainerServiceECRImagePullerRole
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ContainerServiceECRImagePullerRole
ecrImagePullerRole

instance Prelude.NFData PrivateRegistryAccess where
  rnf :: PrivateRegistryAccess -> ()
rnf PrivateRegistryAccess' {Maybe ContainerServiceECRImagePullerRole
ecrImagePullerRole :: Maybe ContainerServiceECRImagePullerRole
$sel:ecrImagePullerRole:PrivateRegistryAccess' :: PrivateRegistryAccess -> Maybe ContainerServiceECRImagePullerRole
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ContainerServiceECRImagePullerRole
ecrImagePullerRole