{-# 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.ContainerServiceECRImagePullerRole
-- 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.ContainerServiceECRImagePullerRole where

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

-- | Describes the activation status of the role that you can use to grant an
-- Amazon Lightsail container service access to Amazon Elastic Container
-- Registry (Amazon ECR) private repositories.
--
-- When activated, Lightsail creates an Identity and Access Management
-- (IAM) role for the specified Lightsail container service. You can use
-- the ARN of the role to create a trust relationship between your
-- Lightsail container service and an Amazon ECR private repository in your
-- Amazon Web Services account. This allows your container service to pull
-- images from 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:/ 'newContainerServiceECRImagePullerRole' smart constructor.
data ContainerServiceECRImagePullerRole = ContainerServiceECRImagePullerRole'
  { -- | A Boolean value that indicates whether the role is activated.
    ContainerServiceECRImagePullerRole -> Maybe Bool
isActive :: Prelude.Maybe Prelude.Bool,
    -- | The Amazon Resource Name (ARN) of the role, if it is activated.
    ContainerServiceECRImagePullerRole -> Maybe Text
principalArn :: Prelude.Maybe Prelude.Text
  }
  deriving (ContainerServiceECRImagePullerRole
-> ContainerServiceECRImagePullerRole -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ContainerServiceECRImagePullerRole
-> ContainerServiceECRImagePullerRole -> Bool
$c/= :: ContainerServiceECRImagePullerRole
-> ContainerServiceECRImagePullerRole -> Bool
== :: ContainerServiceECRImagePullerRole
-> ContainerServiceECRImagePullerRole -> Bool
$c== :: ContainerServiceECRImagePullerRole
-> ContainerServiceECRImagePullerRole -> Bool
Prelude.Eq, ReadPrec [ContainerServiceECRImagePullerRole]
ReadPrec ContainerServiceECRImagePullerRole
Int -> ReadS ContainerServiceECRImagePullerRole
ReadS [ContainerServiceECRImagePullerRole]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ContainerServiceECRImagePullerRole]
$creadListPrec :: ReadPrec [ContainerServiceECRImagePullerRole]
readPrec :: ReadPrec ContainerServiceECRImagePullerRole
$creadPrec :: ReadPrec ContainerServiceECRImagePullerRole
readList :: ReadS [ContainerServiceECRImagePullerRole]
$creadList :: ReadS [ContainerServiceECRImagePullerRole]
readsPrec :: Int -> ReadS ContainerServiceECRImagePullerRole
$creadsPrec :: Int -> ReadS ContainerServiceECRImagePullerRole
Prelude.Read, Int -> ContainerServiceECRImagePullerRole -> ShowS
[ContainerServiceECRImagePullerRole] -> ShowS
ContainerServiceECRImagePullerRole -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ContainerServiceECRImagePullerRole] -> ShowS
$cshowList :: [ContainerServiceECRImagePullerRole] -> ShowS
show :: ContainerServiceECRImagePullerRole -> String
$cshow :: ContainerServiceECRImagePullerRole -> String
showsPrec :: Int -> ContainerServiceECRImagePullerRole -> ShowS
$cshowsPrec :: Int -> ContainerServiceECRImagePullerRole -> ShowS
Prelude.Show, forall x.
Rep ContainerServiceECRImagePullerRole x
-> ContainerServiceECRImagePullerRole
forall x.
ContainerServiceECRImagePullerRole
-> Rep ContainerServiceECRImagePullerRole x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ContainerServiceECRImagePullerRole x
-> ContainerServiceECRImagePullerRole
$cfrom :: forall x.
ContainerServiceECRImagePullerRole
-> Rep ContainerServiceECRImagePullerRole x
Prelude.Generic)

-- |
-- Create a value of 'ContainerServiceECRImagePullerRole' 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:
--
-- 'isActive', 'containerServiceECRImagePullerRole_isActive' - A Boolean value that indicates whether the role is activated.
--
-- 'principalArn', 'containerServiceECRImagePullerRole_principalArn' - The Amazon Resource Name (ARN) of the role, if it is activated.
newContainerServiceECRImagePullerRole ::
  ContainerServiceECRImagePullerRole
newContainerServiceECRImagePullerRole :: ContainerServiceECRImagePullerRole
newContainerServiceECRImagePullerRole =
  ContainerServiceECRImagePullerRole'
    { $sel:isActive:ContainerServiceECRImagePullerRole' :: Maybe Bool
isActive =
        forall a. Maybe a
Prelude.Nothing,
      $sel:principalArn:ContainerServiceECRImagePullerRole' :: Maybe Text
principalArn = forall a. Maybe a
Prelude.Nothing
    }

-- | A Boolean value that indicates whether the role is activated.
containerServiceECRImagePullerRole_isActive :: Lens.Lens' ContainerServiceECRImagePullerRole (Prelude.Maybe Prelude.Bool)
containerServiceECRImagePullerRole_isActive :: Lens' ContainerServiceECRImagePullerRole (Maybe Bool)
containerServiceECRImagePullerRole_isActive = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContainerServiceECRImagePullerRole' {Maybe Bool
isActive :: Maybe Bool
$sel:isActive:ContainerServiceECRImagePullerRole' :: ContainerServiceECRImagePullerRole -> Maybe Bool
isActive} -> Maybe Bool
isActive) (\s :: ContainerServiceECRImagePullerRole
s@ContainerServiceECRImagePullerRole' {} Maybe Bool
a -> ContainerServiceECRImagePullerRole
s {$sel:isActive:ContainerServiceECRImagePullerRole' :: Maybe Bool
isActive = Maybe Bool
a} :: ContainerServiceECRImagePullerRole)

-- | The Amazon Resource Name (ARN) of the role, if it is activated.
containerServiceECRImagePullerRole_principalArn :: Lens.Lens' ContainerServiceECRImagePullerRole (Prelude.Maybe Prelude.Text)
containerServiceECRImagePullerRole_principalArn :: Lens' ContainerServiceECRImagePullerRole (Maybe Text)
containerServiceECRImagePullerRole_principalArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ContainerServiceECRImagePullerRole' {Maybe Text
principalArn :: Maybe Text
$sel:principalArn:ContainerServiceECRImagePullerRole' :: ContainerServiceECRImagePullerRole -> Maybe Text
principalArn} -> Maybe Text
principalArn) (\s :: ContainerServiceECRImagePullerRole
s@ContainerServiceECRImagePullerRole' {} Maybe Text
a -> ContainerServiceECRImagePullerRole
s {$sel:principalArn:ContainerServiceECRImagePullerRole' :: Maybe Text
principalArn = Maybe Text
a} :: ContainerServiceECRImagePullerRole)

instance
  Data.FromJSON
    ContainerServiceECRImagePullerRole
  where
  parseJSON :: Value -> Parser ContainerServiceECRImagePullerRole
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ContainerServiceECRImagePullerRole"
      ( \Object
x ->
          Maybe Bool -> Maybe Text -> ContainerServiceECRImagePullerRole
ContainerServiceECRImagePullerRole'
            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
"isActive")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"principalArn")
      )

instance
  Prelude.Hashable
    ContainerServiceECRImagePullerRole
  where
  hashWithSalt :: Int -> ContainerServiceECRImagePullerRole -> Int
hashWithSalt
    Int
_salt
    ContainerServiceECRImagePullerRole' {Maybe Bool
Maybe Text
principalArn :: Maybe Text
isActive :: Maybe Bool
$sel:principalArn:ContainerServiceECRImagePullerRole' :: ContainerServiceECRImagePullerRole -> Maybe Text
$sel:isActive:ContainerServiceECRImagePullerRole' :: ContainerServiceECRImagePullerRole -> Maybe Bool
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
isActive
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
principalArn

instance
  Prelude.NFData
    ContainerServiceECRImagePullerRole
  where
  rnf :: ContainerServiceECRImagePullerRole -> ()
rnf ContainerServiceECRImagePullerRole' {Maybe Bool
Maybe Text
principalArn :: Maybe Text
isActive :: Maybe Bool
$sel:principalArn:ContainerServiceECRImagePullerRole' :: ContainerServiceECRImagePullerRole -> Maybe Text
$sel:isActive:ContainerServiceECRImagePullerRole' :: ContainerServiceECRImagePullerRole -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
isActive
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
principalArn