{-# 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.PrivateRegistryAccessRequest
-- 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.PrivateRegistryAccessRequest 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.ContainerServiceECRImagePullerRoleRequest
import qualified Amazonka.Prelude as Prelude

-- | Describes a request to configure 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:/ 'newPrivateRegistryAccessRequest' smart constructor.
data PrivateRegistryAccessRequest = PrivateRegistryAccessRequest'
  { -- | An object to describe 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.
    PrivateRegistryAccessRequest
-> Maybe ContainerServiceECRImagePullerRoleRequest
ecrImagePullerRole :: Prelude.Maybe ContainerServiceECRImagePullerRoleRequest
  }
  deriving (PrivateRegistryAccessRequest
-> PrivateRegistryAccessRequest -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PrivateRegistryAccessRequest
-> PrivateRegistryAccessRequest -> Bool
$c/= :: PrivateRegistryAccessRequest
-> PrivateRegistryAccessRequest -> Bool
== :: PrivateRegistryAccessRequest
-> PrivateRegistryAccessRequest -> Bool
$c== :: PrivateRegistryAccessRequest
-> PrivateRegistryAccessRequest -> Bool
Prelude.Eq, ReadPrec [PrivateRegistryAccessRequest]
ReadPrec PrivateRegistryAccessRequest
Int -> ReadS PrivateRegistryAccessRequest
ReadS [PrivateRegistryAccessRequest]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PrivateRegistryAccessRequest]
$creadListPrec :: ReadPrec [PrivateRegistryAccessRequest]
readPrec :: ReadPrec PrivateRegistryAccessRequest
$creadPrec :: ReadPrec PrivateRegistryAccessRequest
readList :: ReadS [PrivateRegistryAccessRequest]
$creadList :: ReadS [PrivateRegistryAccessRequest]
readsPrec :: Int -> ReadS PrivateRegistryAccessRequest
$creadsPrec :: Int -> ReadS PrivateRegistryAccessRequest
Prelude.Read, Int -> PrivateRegistryAccessRequest -> ShowS
[PrivateRegistryAccessRequest] -> ShowS
PrivateRegistryAccessRequest -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PrivateRegistryAccessRequest] -> ShowS
$cshowList :: [PrivateRegistryAccessRequest] -> ShowS
show :: PrivateRegistryAccessRequest -> String
$cshow :: PrivateRegistryAccessRequest -> String
showsPrec :: Int -> PrivateRegistryAccessRequest -> ShowS
$cshowsPrec :: Int -> PrivateRegistryAccessRequest -> ShowS
Prelude.Show, forall x.
Rep PrivateRegistryAccessRequest x -> PrivateRegistryAccessRequest
forall x.
PrivateRegistryAccessRequest -> Rep PrivateRegistryAccessRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PrivateRegistryAccessRequest x -> PrivateRegistryAccessRequest
$cfrom :: forall x.
PrivateRegistryAccessRequest -> Rep PrivateRegistryAccessRequest x
Prelude.Generic)

-- |
-- Create a value of 'PrivateRegistryAccessRequest' 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', 'privateRegistryAccessRequest_ecrImagePullerRole' - An object to describe 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.
newPrivateRegistryAccessRequest ::
  PrivateRegistryAccessRequest
newPrivateRegistryAccessRequest :: PrivateRegistryAccessRequest
newPrivateRegistryAccessRequest =
  PrivateRegistryAccessRequest'
    { $sel:ecrImagePullerRole:PrivateRegistryAccessRequest' :: Maybe ContainerServiceECRImagePullerRoleRequest
ecrImagePullerRole =
        forall a. Maybe a
Prelude.Nothing
    }

-- | An object to describe 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.
privateRegistryAccessRequest_ecrImagePullerRole :: Lens.Lens' PrivateRegistryAccessRequest (Prelude.Maybe ContainerServiceECRImagePullerRoleRequest)
privateRegistryAccessRequest_ecrImagePullerRole :: Lens'
  PrivateRegistryAccessRequest
  (Maybe ContainerServiceECRImagePullerRoleRequest)
privateRegistryAccessRequest_ecrImagePullerRole = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PrivateRegistryAccessRequest' {Maybe ContainerServiceECRImagePullerRoleRequest
ecrImagePullerRole :: Maybe ContainerServiceECRImagePullerRoleRequest
$sel:ecrImagePullerRole:PrivateRegistryAccessRequest' :: PrivateRegistryAccessRequest
-> Maybe ContainerServiceECRImagePullerRoleRequest
ecrImagePullerRole} -> Maybe ContainerServiceECRImagePullerRoleRequest
ecrImagePullerRole) (\s :: PrivateRegistryAccessRequest
s@PrivateRegistryAccessRequest' {} Maybe ContainerServiceECRImagePullerRoleRequest
a -> PrivateRegistryAccessRequest
s {$sel:ecrImagePullerRole:PrivateRegistryAccessRequest' :: Maybe ContainerServiceECRImagePullerRoleRequest
ecrImagePullerRole = Maybe ContainerServiceECRImagePullerRoleRequest
a} :: PrivateRegistryAccessRequest)

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

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

instance Data.ToJSON PrivateRegistryAccessRequest where
  toJSON :: PrivateRegistryAccessRequest -> Value
toJSON PrivateRegistryAccessRequest' {Maybe ContainerServiceECRImagePullerRoleRequest
ecrImagePullerRole :: Maybe ContainerServiceECRImagePullerRoleRequest
$sel:ecrImagePullerRole:PrivateRegistryAccessRequest' :: PrivateRegistryAccessRequest
-> Maybe ContainerServiceECRImagePullerRoleRequest
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"ecrImagePullerRole" 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 ContainerServiceECRImagePullerRoleRequest
ecrImagePullerRole
          ]
      )