{-# 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.Proton.Types.AccountSettings
-- 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.Proton.Types.AccountSettings 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
import Amazonka.Proton.Types.RepositoryBranch

-- | Proton settings that are used for multiple services in the Amazon Web
-- Services account.
--
-- /See:/ 'newAccountSettings' smart constructor.
data AccountSettings = AccountSettings'
  { -- | The Amazon Resource Name (ARN) of the service role that Proton uses for
    -- provisioning pipelines. Proton assumes this role for CodeBuild-based
    -- provisioning.
    AccountSettings -> Maybe Text
pipelineCodebuildRoleArn :: Prelude.Maybe Prelude.Text,
    -- | The linked repository for pipeline provisioning. Required if you have
    -- environments configured for self-managed provisioning with services that
    -- include pipelines. A linked repository is a repository that has been
    -- registered with Proton. For more information, see CreateRepository.
    AccountSettings -> Maybe RepositoryBranch
pipelineProvisioningRepository :: Prelude.Maybe RepositoryBranch,
    -- | The Amazon Resource Name (ARN) of the service role you want to use for
    -- provisioning pipelines. Assumed by Proton for Amazon Web
    -- Services-managed provisioning, and by customer-owned automation for
    -- self-managed provisioning.
    AccountSettings -> Maybe Text
pipelineServiceRoleArn :: Prelude.Maybe Prelude.Text
  }
  deriving (AccountSettings -> AccountSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AccountSettings -> AccountSettings -> Bool
$c/= :: AccountSettings -> AccountSettings -> Bool
== :: AccountSettings -> AccountSettings -> Bool
$c== :: AccountSettings -> AccountSettings -> Bool
Prelude.Eq, ReadPrec [AccountSettings]
ReadPrec AccountSettings
Int -> ReadS AccountSettings
ReadS [AccountSettings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AccountSettings]
$creadListPrec :: ReadPrec [AccountSettings]
readPrec :: ReadPrec AccountSettings
$creadPrec :: ReadPrec AccountSettings
readList :: ReadS [AccountSettings]
$creadList :: ReadS [AccountSettings]
readsPrec :: Int -> ReadS AccountSettings
$creadsPrec :: Int -> ReadS AccountSettings
Prelude.Read, Int -> AccountSettings -> ShowS
[AccountSettings] -> ShowS
AccountSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AccountSettings] -> ShowS
$cshowList :: [AccountSettings] -> ShowS
show :: AccountSettings -> String
$cshow :: AccountSettings -> String
showsPrec :: Int -> AccountSettings -> ShowS
$cshowsPrec :: Int -> AccountSettings -> ShowS
Prelude.Show, forall x. Rep AccountSettings x -> AccountSettings
forall x. AccountSettings -> Rep AccountSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AccountSettings x -> AccountSettings
$cfrom :: forall x. AccountSettings -> Rep AccountSettings x
Prelude.Generic)

-- |
-- Create a value of 'AccountSettings' 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:
--
-- 'pipelineCodebuildRoleArn', 'accountSettings_pipelineCodebuildRoleArn' - The Amazon Resource Name (ARN) of the service role that Proton uses for
-- provisioning pipelines. Proton assumes this role for CodeBuild-based
-- provisioning.
--
-- 'pipelineProvisioningRepository', 'accountSettings_pipelineProvisioningRepository' - The linked repository for pipeline provisioning. Required if you have
-- environments configured for self-managed provisioning with services that
-- include pipelines. A linked repository is a repository that has been
-- registered with Proton. For more information, see CreateRepository.
--
-- 'pipelineServiceRoleArn', 'accountSettings_pipelineServiceRoleArn' - The Amazon Resource Name (ARN) of the service role you want to use for
-- provisioning pipelines. Assumed by Proton for Amazon Web
-- Services-managed provisioning, and by customer-owned automation for
-- self-managed provisioning.
newAccountSettings ::
  AccountSettings
newAccountSettings :: AccountSettings
newAccountSettings =
  AccountSettings'
    { $sel:pipelineCodebuildRoleArn:AccountSettings' :: Maybe Text
pipelineCodebuildRoleArn =
        forall a. Maybe a
Prelude.Nothing,
      $sel:pipelineProvisioningRepository:AccountSettings' :: Maybe RepositoryBranch
pipelineProvisioningRepository = forall a. Maybe a
Prelude.Nothing,
      $sel:pipelineServiceRoleArn:AccountSettings' :: Maybe Text
pipelineServiceRoleArn = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the service role that Proton uses for
-- provisioning pipelines. Proton assumes this role for CodeBuild-based
-- provisioning.
accountSettings_pipelineCodebuildRoleArn :: Lens.Lens' AccountSettings (Prelude.Maybe Prelude.Text)
accountSettings_pipelineCodebuildRoleArn :: Lens' AccountSettings (Maybe Text)
accountSettings_pipelineCodebuildRoleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountSettings' {Maybe Text
pipelineCodebuildRoleArn :: Maybe Text
$sel:pipelineCodebuildRoleArn:AccountSettings' :: AccountSettings -> Maybe Text
pipelineCodebuildRoleArn} -> Maybe Text
pipelineCodebuildRoleArn) (\s :: AccountSettings
s@AccountSettings' {} Maybe Text
a -> AccountSettings
s {$sel:pipelineCodebuildRoleArn:AccountSettings' :: Maybe Text
pipelineCodebuildRoleArn = Maybe Text
a} :: AccountSettings)

-- | The linked repository for pipeline provisioning. Required if you have
-- environments configured for self-managed provisioning with services that
-- include pipelines. A linked repository is a repository that has been
-- registered with Proton. For more information, see CreateRepository.
accountSettings_pipelineProvisioningRepository :: Lens.Lens' AccountSettings (Prelude.Maybe RepositoryBranch)
accountSettings_pipelineProvisioningRepository :: Lens' AccountSettings (Maybe RepositoryBranch)
accountSettings_pipelineProvisioningRepository = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountSettings' {Maybe RepositoryBranch
pipelineProvisioningRepository :: Maybe RepositoryBranch
$sel:pipelineProvisioningRepository:AccountSettings' :: AccountSettings -> Maybe RepositoryBranch
pipelineProvisioningRepository} -> Maybe RepositoryBranch
pipelineProvisioningRepository) (\s :: AccountSettings
s@AccountSettings' {} Maybe RepositoryBranch
a -> AccountSettings
s {$sel:pipelineProvisioningRepository:AccountSettings' :: Maybe RepositoryBranch
pipelineProvisioningRepository = Maybe RepositoryBranch
a} :: AccountSettings)

-- | The Amazon Resource Name (ARN) of the service role you want to use for
-- provisioning pipelines. Assumed by Proton for Amazon Web
-- Services-managed provisioning, and by customer-owned automation for
-- self-managed provisioning.
accountSettings_pipelineServiceRoleArn :: Lens.Lens' AccountSettings (Prelude.Maybe Prelude.Text)
accountSettings_pipelineServiceRoleArn :: Lens' AccountSettings (Maybe Text)
accountSettings_pipelineServiceRoleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountSettings' {Maybe Text
pipelineServiceRoleArn :: Maybe Text
$sel:pipelineServiceRoleArn:AccountSettings' :: AccountSettings -> Maybe Text
pipelineServiceRoleArn} -> Maybe Text
pipelineServiceRoleArn) (\s :: AccountSettings
s@AccountSettings' {} Maybe Text
a -> AccountSettings
s {$sel:pipelineServiceRoleArn:AccountSettings' :: Maybe Text
pipelineServiceRoleArn = Maybe Text
a} :: AccountSettings)

instance Data.FromJSON AccountSettings where
  parseJSON :: Value -> Parser AccountSettings
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AccountSettings"
      ( \Object
x ->
          Maybe Text
-> Maybe RepositoryBranch -> Maybe Text -> AccountSettings
AccountSettings'
            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
"pipelineCodebuildRoleArn")
            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
"pipelineProvisioningRepository")
            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
"pipelineServiceRoleArn")
      )

instance Prelude.Hashable AccountSettings where
  hashWithSalt :: Int -> AccountSettings -> Int
hashWithSalt Int
_salt AccountSettings' {Maybe Text
Maybe RepositoryBranch
pipelineServiceRoleArn :: Maybe Text
pipelineProvisioningRepository :: Maybe RepositoryBranch
pipelineCodebuildRoleArn :: Maybe Text
$sel:pipelineServiceRoleArn:AccountSettings' :: AccountSettings -> Maybe Text
$sel:pipelineProvisioningRepository:AccountSettings' :: AccountSettings -> Maybe RepositoryBranch
$sel:pipelineCodebuildRoleArn:AccountSettings' :: AccountSettings -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
pipelineCodebuildRoleArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RepositoryBranch
pipelineProvisioningRepository
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
pipelineServiceRoleArn

instance Prelude.NFData AccountSettings where
  rnf :: AccountSettings -> ()
rnf AccountSettings' {Maybe Text
Maybe RepositoryBranch
pipelineServiceRoleArn :: Maybe Text
pipelineProvisioningRepository :: Maybe RepositoryBranch
pipelineCodebuildRoleArn :: Maybe Text
$sel:pipelineServiceRoleArn:AccountSettings' :: AccountSettings -> Maybe Text
$sel:pipelineProvisioningRepository:AccountSettings' :: AccountSettings -> Maybe RepositoryBranch
$sel:pipelineCodebuildRoleArn:AccountSettings' :: AccountSettings -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
pipelineCodebuildRoleArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RepositoryBranch
pipelineProvisioningRepository
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
pipelineServiceRoleArn