{-# 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.ContainerServiceECRImagePullerRoleRequest
-- 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.ContainerServiceECRImagePullerRoleRequest 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 a request to activate or deactivate 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:/ 'newContainerServiceECRImagePullerRoleRequest' smart constructor.
data ContainerServiceECRImagePullerRoleRequest = ContainerServiceECRImagePullerRoleRequest'
  { -- | A Boolean value that indicates whether to activate the role.
    ContainerServiceECRImagePullerRoleRequest -> Maybe Bool
isActive :: Prelude.Maybe Prelude.Bool
  }
  deriving (ContainerServiceECRImagePullerRoleRequest
-> ContainerServiceECRImagePullerRoleRequest -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ContainerServiceECRImagePullerRoleRequest
-> ContainerServiceECRImagePullerRoleRequest -> Bool
$c/= :: ContainerServiceECRImagePullerRoleRequest
-> ContainerServiceECRImagePullerRoleRequest -> Bool
== :: ContainerServiceECRImagePullerRoleRequest
-> ContainerServiceECRImagePullerRoleRequest -> Bool
$c== :: ContainerServiceECRImagePullerRoleRequest
-> ContainerServiceECRImagePullerRoleRequest -> Bool
Prelude.Eq, ReadPrec [ContainerServiceECRImagePullerRoleRequest]
ReadPrec ContainerServiceECRImagePullerRoleRequest
Int -> ReadS ContainerServiceECRImagePullerRoleRequest
ReadS [ContainerServiceECRImagePullerRoleRequest]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ContainerServiceECRImagePullerRoleRequest]
$creadListPrec :: ReadPrec [ContainerServiceECRImagePullerRoleRequest]
readPrec :: ReadPrec ContainerServiceECRImagePullerRoleRequest
$creadPrec :: ReadPrec ContainerServiceECRImagePullerRoleRequest
readList :: ReadS [ContainerServiceECRImagePullerRoleRequest]
$creadList :: ReadS [ContainerServiceECRImagePullerRoleRequest]
readsPrec :: Int -> ReadS ContainerServiceECRImagePullerRoleRequest
$creadsPrec :: Int -> ReadS ContainerServiceECRImagePullerRoleRequest
Prelude.Read, Int -> ContainerServiceECRImagePullerRoleRequest -> ShowS
[ContainerServiceECRImagePullerRoleRequest] -> ShowS
ContainerServiceECRImagePullerRoleRequest -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ContainerServiceECRImagePullerRoleRequest] -> ShowS
$cshowList :: [ContainerServiceECRImagePullerRoleRequest] -> ShowS
show :: ContainerServiceECRImagePullerRoleRequest -> String
$cshow :: ContainerServiceECRImagePullerRoleRequest -> String
showsPrec :: Int -> ContainerServiceECRImagePullerRoleRequest -> ShowS
$cshowsPrec :: Int -> ContainerServiceECRImagePullerRoleRequest -> ShowS
Prelude.Show, forall x.
Rep ContainerServiceECRImagePullerRoleRequest x
-> ContainerServiceECRImagePullerRoleRequest
forall x.
ContainerServiceECRImagePullerRoleRequest
-> Rep ContainerServiceECRImagePullerRoleRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ContainerServiceECRImagePullerRoleRequest x
-> ContainerServiceECRImagePullerRoleRequest
$cfrom :: forall x.
ContainerServiceECRImagePullerRoleRequest
-> Rep ContainerServiceECRImagePullerRoleRequest x
Prelude.Generic)

-- |
-- Create a value of 'ContainerServiceECRImagePullerRoleRequest' 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', 'containerServiceECRImagePullerRoleRequest_isActive' - A Boolean value that indicates whether to activate the role.
newContainerServiceECRImagePullerRoleRequest ::
  ContainerServiceECRImagePullerRoleRequest
newContainerServiceECRImagePullerRoleRequest :: ContainerServiceECRImagePullerRoleRequest
newContainerServiceECRImagePullerRoleRequest =
  ContainerServiceECRImagePullerRoleRequest'
    { $sel:isActive:ContainerServiceECRImagePullerRoleRequest' :: Maybe Bool
isActive =
        forall a. Maybe a
Prelude.Nothing
    }

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

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

instance
  Prelude.NFData
    ContainerServiceECRImagePullerRoleRequest
  where
  rnf :: ContainerServiceECRImagePullerRoleRequest -> ()
rnf ContainerServiceECRImagePullerRoleRequest' {Maybe Bool
isActive :: Maybe Bool
$sel:isActive:ContainerServiceECRImagePullerRoleRequest' :: ContainerServiceECRImagePullerRoleRequest -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
isActive

instance
  Data.ToJSON
    ContainerServiceECRImagePullerRoleRequest
  where
  toJSON :: ContainerServiceECRImagePullerRoleRequest -> Value
toJSON ContainerServiceECRImagePullerRoleRequest' {Maybe Bool
isActive :: Maybe Bool
$sel:isActive:ContainerServiceECRImagePullerRoleRequest' :: ContainerServiceECRImagePullerRoleRequest -> Maybe Bool
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"isActive" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
isActive]
      )