{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.UpdateAccountSettings
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Update the AWS Proton pipeline service account settings.
module Amazonka.Proton.UpdateAccountSettings
  ( -- * Creating a Request
    UpdateAccountSettings (..),
    newUpdateAccountSettings,

    -- * Request Lenses
    updateAccountSettings_pipelineServiceRoleArn,

    -- * Destructuring the Response
    UpdateAccountSettingsResponse (..),
    newUpdateAccountSettingsResponse,

    -- * Response Lenses
    updateAccountSettingsResponse_httpStatus,
    updateAccountSettingsResponse_accountSettings,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Proton.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newUpdateAccountSettings' smart constructor.
data UpdateAccountSettings = UpdateAccountSettings'
  { -- | The Amazon Resource Name (ARN) of the AWS Proton pipeline service role.
    UpdateAccountSettings -> Maybe Text
pipelineServiceRoleArn :: Prelude.Maybe Prelude.Text
  }
  deriving (UpdateAccountSettings -> UpdateAccountSettings -> Bool
(UpdateAccountSettings -> UpdateAccountSettings -> Bool)
-> (UpdateAccountSettings -> UpdateAccountSettings -> Bool)
-> Eq UpdateAccountSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateAccountSettings -> UpdateAccountSettings -> Bool
$c/= :: UpdateAccountSettings -> UpdateAccountSettings -> Bool
== :: UpdateAccountSettings -> UpdateAccountSettings -> Bool
$c== :: UpdateAccountSettings -> UpdateAccountSettings -> Bool
Prelude.Eq, ReadPrec [UpdateAccountSettings]
ReadPrec UpdateAccountSettings
Int -> ReadS UpdateAccountSettings
ReadS [UpdateAccountSettings]
(Int -> ReadS UpdateAccountSettings)
-> ReadS [UpdateAccountSettings]
-> ReadPrec UpdateAccountSettings
-> ReadPrec [UpdateAccountSettings]
-> Read UpdateAccountSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateAccountSettings]
$creadListPrec :: ReadPrec [UpdateAccountSettings]
readPrec :: ReadPrec UpdateAccountSettings
$creadPrec :: ReadPrec UpdateAccountSettings
readList :: ReadS [UpdateAccountSettings]
$creadList :: ReadS [UpdateAccountSettings]
readsPrec :: Int -> ReadS UpdateAccountSettings
$creadsPrec :: Int -> ReadS UpdateAccountSettings
Prelude.Read, Int -> UpdateAccountSettings -> ShowS
[UpdateAccountSettings] -> ShowS
UpdateAccountSettings -> String
(Int -> UpdateAccountSettings -> ShowS)
-> (UpdateAccountSettings -> String)
-> ([UpdateAccountSettings] -> ShowS)
-> Show UpdateAccountSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateAccountSettings] -> ShowS
$cshowList :: [UpdateAccountSettings] -> ShowS
show :: UpdateAccountSettings -> String
$cshow :: UpdateAccountSettings -> String
showsPrec :: Int -> UpdateAccountSettings -> ShowS
$cshowsPrec :: Int -> UpdateAccountSettings -> ShowS
Prelude.Show, (forall x. UpdateAccountSettings -> Rep UpdateAccountSettings x)
-> (forall x. Rep UpdateAccountSettings x -> UpdateAccountSettings)
-> Generic UpdateAccountSettings
forall x. Rep UpdateAccountSettings x -> UpdateAccountSettings
forall x. UpdateAccountSettings -> Rep UpdateAccountSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateAccountSettings x -> UpdateAccountSettings
$cfrom :: forall x. UpdateAccountSettings -> Rep UpdateAccountSettings x
Prelude.Generic)

-- |
-- Create a value of 'UpdateAccountSettings' 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:
--
-- 'pipelineServiceRoleArn', 'updateAccountSettings_pipelineServiceRoleArn' - The Amazon Resource Name (ARN) of the AWS Proton pipeline service role.
newUpdateAccountSettings ::
  UpdateAccountSettings
newUpdateAccountSettings :: UpdateAccountSettings
newUpdateAccountSettings =
  UpdateAccountSettings' :: Maybe Text -> UpdateAccountSettings
UpdateAccountSettings'
    { $sel:pipelineServiceRoleArn:UpdateAccountSettings' :: Maybe Text
pipelineServiceRoleArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the AWS Proton pipeline service role.
updateAccountSettings_pipelineServiceRoleArn :: Lens.Lens' UpdateAccountSettings (Prelude.Maybe Prelude.Text)
updateAccountSettings_pipelineServiceRoleArn :: (Maybe Text -> f (Maybe Text))
-> UpdateAccountSettings -> f UpdateAccountSettings
updateAccountSettings_pipelineServiceRoleArn = (UpdateAccountSettings -> Maybe Text)
-> (UpdateAccountSettings -> Maybe Text -> UpdateAccountSettings)
-> Lens
     UpdateAccountSettings
     UpdateAccountSettings
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAccountSettings' {Maybe Text
pipelineServiceRoleArn :: Maybe Text
$sel:pipelineServiceRoleArn:UpdateAccountSettings' :: UpdateAccountSettings -> Maybe Text
pipelineServiceRoleArn} -> Maybe Text
pipelineServiceRoleArn) (\s :: UpdateAccountSettings
s@UpdateAccountSettings' {} Maybe Text
a -> UpdateAccountSettings
s {$sel:pipelineServiceRoleArn:UpdateAccountSettings' :: Maybe Text
pipelineServiceRoleArn = Maybe Text
a} :: UpdateAccountSettings)

instance Core.AWSRequest UpdateAccountSettings where
  type
    AWSResponse UpdateAccountSettings =
      UpdateAccountSettingsResponse
  request :: UpdateAccountSettings -> Request UpdateAccountSettings
request = Service -> UpdateAccountSettings -> Request UpdateAccountSettings
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateAccountSettings
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateAccountSettings)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse UpdateAccountSettings))
-> Logger
-> Service
-> Proxy UpdateAccountSettings
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateAccountSettings)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> AccountSettings -> UpdateAccountSettingsResponse
UpdateAccountSettingsResponse'
            (Int -> AccountSettings -> UpdateAccountSettingsResponse)
-> Either String Int
-> Either String (AccountSettings -> UpdateAccountSettingsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            Either String (AccountSettings -> UpdateAccountSettingsResponse)
-> Either String AccountSettings
-> Either String UpdateAccountSettingsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String AccountSettings
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"accountSettings")
      )

instance Prelude.Hashable UpdateAccountSettings

instance Prelude.NFData UpdateAccountSettings

instance Core.ToHeaders UpdateAccountSettings where
  toHeaders :: UpdateAccountSettings -> ResponseHeaders
toHeaders =
    ResponseHeaders -> UpdateAccountSettings -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AwsProton20200720.UpdateAccountSettings" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

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

instance Core.ToPath UpdateAccountSettings where
  toPath :: UpdateAccountSettings -> ByteString
toPath = ByteString -> UpdateAccountSettings -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery UpdateAccountSettings where
  toQuery :: UpdateAccountSettings -> QueryString
toQuery = QueryString -> UpdateAccountSettings -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newUpdateAccountSettingsResponse' smart constructor.
data UpdateAccountSettingsResponse = UpdateAccountSettingsResponse'
  { -- | The response's http status code.
    UpdateAccountSettingsResponse -> Int
httpStatus :: Prelude.Int,
    -- | The AWS Proton pipeline service role detail data that\'s returned by AWS
    -- Proton.
    UpdateAccountSettingsResponse -> AccountSettings
accountSettings :: AccountSettings
  }
  deriving (UpdateAccountSettingsResponse
-> UpdateAccountSettingsResponse -> Bool
(UpdateAccountSettingsResponse
 -> UpdateAccountSettingsResponse -> Bool)
-> (UpdateAccountSettingsResponse
    -> UpdateAccountSettingsResponse -> Bool)
-> Eq UpdateAccountSettingsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateAccountSettingsResponse
-> UpdateAccountSettingsResponse -> Bool
$c/= :: UpdateAccountSettingsResponse
-> UpdateAccountSettingsResponse -> Bool
== :: UpdateAccountSettingsResponse
-> UpdateAccountSettingsResponse -> Bool
$c== :: UpdateAccountSettingsResponse
-> UpdateAccountSettingsResponse -> Bool
Prelude.Eq, ReadPrec [UpdateAccountSettingsResponse]
ReadPrec UpdateAccountSettingsResponse
Int -> ReadS UpdateAccountSettingsResponse
ReadS [UpdateAccountSettingsResponse]
(Int -> ReadS UpdateAccountSettingsResponse)
-> ReadS [UpdateAccountSettingsResponse]
-> ReadPrec UpdateAccountSettingsResponse
-> ReadPrec [UpdateAccountSettingsResponse]
-> Read UpdateAccountSettingsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateAccountSettingsResponse]
$creadListPrec :: ReadPrec [UpdateAccountSettingsResponse]
readPrec :: ReadPrec UpdateAccountSettingsResponse
$creadPrec :: ReadPrec UpdateAccountSettingsResponse
readList :: ReadS [UpdateAccountSettingsResponse]
$creadList :: ReadS [UpdateAccountSettingsResponse]
readsPrec :: Int -> ReadS UpdateAccountSettingsResponse
$creadsPrec :: Int -> ReadS UpdateAccountSettingsResponse
Prelude.Read, Int -> UpdateAccountSettingsResponse -> ShowS
[UpdateAccountSettingsResponse] -> ShowS
UpdateAccountSettingsResponse -> String
(Int -> UpdateAccountSettingsResponse -> ShowS)
-> (UpdateAccountSettingsResponse -> String)
-> ([UpdateAccountSettingsResponse] -> ShowS)
-> Show UpdateAccountSettingsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateAccountSettingsResponse] -> ShowS
$cshowList :: [UpdateAccountSettingsResponse] -> ShowS
show :: UpdateAccountSettingsResponse -> String
$cshow :: UpdateAccountSettingsResponse -> String
showsPrec :: Int -> UpdateAccountSettingsResponse -> ShowS
$cshowsPrec :: Int -> UpdateAccountSettingsResponse -> ShowS
Prelude.Show, (forall x.
 UpdateAccountSettingsResponse
 -> Rep UpdateAccountSettingsResponse x)
-> (forall x.
    Rep UpdateAccountSettingsResponse x
    -> UpdateAccountSettingsResponse)
-> Generic UpdateAccountSettingsResponse
forall x.
Rep UpdateAccountSettingsResponse x
-> UpdateAccountSettingsResponse
forall x.
UpdateAccountSettingsResponse
-> Rep UpdateAccountSettingsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateAccountSettingsResponse x
-> UpdateAccountSettingsResponse
$cfrom :: forall x.
UpdateAccountSettingsResponse
-> Rep UpdateAccountSettingsResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateAccountSettingsResponse' 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:
--
-- 'httpStatus', 'updateAccountSettingsResponse_httpStatus' - The response's http status code.
--
-- 'accountSettings', 'updateAccountSettingsResponse_accountSettings' - The AWS Proton pipeline service role detail data that\'s returned by AWS
-- Proton.
newUpdateAccountSettingsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'accountSettings'
  AccountSettings ->
  UpdateAccountSettingsResponse
newUpdateAccountSettingsResponse :: Int -> AccountSettings -> UpdateAccountSettingsResponse
newUpdateAccountSettingsResponse
  Int
pHttpStatus_
  AccountSettings
pAccountSettings_ =
    UpdateAccountSettingsResponse' :: Int -> AccountSettings -> UpdateAccountSettingsResponse
UpdateAccountSettingsResponse'
      { $sel:httpStatus:UpdateAccountSettingsResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:accountSettings:UpdateAccountSettingsResponse' :: AccountSettings
accountSettings = AccountSettings
pAccountSettings_
      }

-- | The response's http status code.
updateAccountSettingsResponse_httpStatus :: Lens.Lens' UpdateAccountSettingsResponse Prelude.Int
updateAccountSettingsResponse_httpStatus :: (Int -> f Int)
-> UpdateAccountSettingsResponse -> f UpdateAccountSettingsResponse
updateAccountSettingsResponse_httpStatus = (UpdateAccountSettingsResponse -> Int)
-> (UpdateAccountSettingsResponse
    -> Int -> UpdateAccountSettingsResponse)
-> Lens
     UpdateAccountSettingsResponse UpdateAccountSettingsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAccountSettingsResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateAccountSettingsResponse' :: UpdateAccountSettingsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateAccountSettingsResponse
s@UpdateAccountSettingsResponse' {} Int
a -> UpdateAccountSettingsResponse
s {$sel:httpStatus:UpdateAccountSettingsResponse' :: Int
httpStatus = Int
a} :: UpdateAccountSettingsResponse)

-- | The AWS Proton pipeline service role detail data that\'s returned by AWS
-- Proton.
updateAccountSettingsResponse_accountSettings :: Lens.Lens' UpdateAccountSettingsResponse AccountSettings
updateAccountSettingsResponse_accountSettings :: (AccountSettings -> f AccountSettings)
-> UpdateAccountSettingsResponse -> f UpdateAccountSettingsResponse
updateAccountSettingsResponse_accountSettings = (UpdateAccountSettingsResponse -> AccountSettings)
-> (UpdateAccountSettingsResponse
    -> AccountSettings -> UpdateAccountSettingsResponse)
-> Lens
     UpdateAccountSettingsResponse
     UpdateAccountSettingsResponse
     AccountSettings
     AccountSettings
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAccountSettingsResponse' {AccountSettings
accountSettings :: AccountSettings
$sel:accountSettings:UpdateAccountSettingsResponse' :: UpdateAccountSettingsResponse -> AccountSettings
accountSettings} -> AccountSettings
accountSettings) (\s :: UpdateAccountSettingsResponse
s@UpdateAccountSettingsResponse' {} AccountSettings
a -> UpdateAccountSettingsResponse
s {$sel:accountSettings:UpdateAccountSettingsResponse' :: AccountSettings
accountSettings = AccountSettings
a} :: UpdateAccountSettingsResponse)

instance Prelude.NFData UpdateAccountSettingsResponse