{-# 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.WorkLink.UpdateAuditStreamConfiguration
-- 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)
--
-- Updates the audit stream configuration for the fleet.
module Amazonka.WorkLink.UpdateAuditStreamConfiguration
  ( -- * Creating a Request
    UpdateAuditStreamConfiguration (..),
    newUpdateAuditStreamConfiguration,

    -- * Request Lenses
    updateAuditStreamConfiguration_auditStreamArn,
    updateAuditStreamConfiguration_fleetArn,

    -- * Destructuring the Response
    UpdateAuditStreamConfigurationResponse (..),
    newUpdateAuditStreamConfigurationResponse,

    -- * Response Lenses
    updateAuditStreamConfigurationResponse_httpStatus,
  )
where

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

-- | /See:/ 'newUpdateAuditStreamConfiguration' smart constructor.
data UpdateAuditStreamConfiguration = UpdateAuditStreamConfiguration'
  { -- | The ARN of the Amazon Kinesis data stream that receives the audit
    -- events.
    UpdateAuditStreamConfiguration -> Maybe Text
auditStreamArn :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the fleet.
    UpdateAuditStreamConfiguration -> Text
fleetArn :: Prelude.Text
  }
  deriving (UpdateAuditStreamConfiguration
-> UpdateAuditStreamConfiguration -> Bool
(UpdateAuditStreamConfiguration
 -> UpdateAuditStreamConfiguration -> Bool)
-> (UpdateAuditStreamConfiguration
    -> UpdateAuditStreamConfiguration -> Bool)
-> Eq UpdateAuditStreamConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateAuditStreamConfiguration
-> UpdateAuditStreamConfiguration -> Bool
$c/= :: UpdateAuditStreamConfiguration
-> UpdateAuditStreamConfiguration -> Bool
== :: UpdateAuditStreamConfiguration
-> UpdateAuditStreamConfiguration -> Bool
$c== :: UpdateAuditStreamConfiguration
-> UpdateAuditStreamConfiguration -> Bool
Prelude.Eq, ReadPrec [UpdateAuditStreamConfiguration]
ReadPrec UpdateAuditStreamConfiguration
Int -> ReadS UpdateAuditStreamConfiguration
ReadS [UpdateAuditStreamConfiguration]
(Int -> ReadS UpdateAuditStreamConfiguration)
-> ReadS [UpdateAuditStreamConfiguration]
-> ReadPrec UpdateAuditStreamConfiguration
-> ReadPrec [UpdateAuditStreamConfiguration]
-> Read UpdateAuditStreamConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateAuditStreamConfiguration]
$creadListPrec :: ReadPrec [UpdateAuditStreamConfiguration]
readPrec :: ReadPrec UpdateAuditStreamConfiguration
$creadPrec :: ReadPrec UpdateAuditStreamConfiguration
readList :: ReadS [UpdateAuditStreamConfiguration]
$creadList :: ReadS [UpdateAuditStreamConfiguration]
readsPrec :: Int -> ReadS UpdateAuditStreamConfiguration
$creadsPrec :: Int -> ReadS UpdateAuditStreamConfiguration
Prelude.Read, Int -> UpdateAuditStreamConfiguration -> ShowS
[UpdateAuditStreamConfiguration] -> ShowS
UpdateAuditStreamConfiguration -> String
(Int -> UpdateAuditStreamConfiguration -> ShowS)
-> (UpdateAuditStreamConfiguration -> String)
-> ([UpdateAuditStreamConfiguration] -> ShowS)
-> Show UpdateAuditStreamConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateAuditStreamConfiguration] -> ShowS
$cshowList :: [UpdateAuditStreamConfiguration] -> ShowS
show :: UpdateAuditStreamConfiguration -> String
$cshow :: UpdateAuditStreamConfiguration -> String
showsPrec :: Int -> UpdateAuditStreamConfiguration -> ShowS
$cshowsPrec :: Int -> UpdateAuditStreamConfiguration -> ShowS
Prelude.Show, (forall x.
 UpdateAuditStreamConfiguration
 -> Rep UpdateAuditStreamConfiguration x)
-> (forall x.
    Rep UpdateAuditStreamConfiguration x
    -> UpdateAuditStreamConfiguration)
-> Generic UpdateAuditStreamConfiguration
forall x.
Rep UpdateAuditStreamConfiguration x
-> UpdateAuditStreamConfiguration
forall x.
UpdateAuditStreamConfiguration
-> Rep UpdateAuditStreamConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateAuditStreamConfiguration x
-> UpdateAuditStreamConfiguration
$cfrom :: forall x.
UpdateAuditStreamConfiguration
-> Rep UpdateAuditStreamConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'UpdateAuditStreamConfiguration' 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:
--
-- 'auditStreamArn', 'updateAuditStreamConfiguration_auditStreamArn' - The ARN of the Amazon Kinesis data stream that receives the audit
-- events.
--
-- 'fleetArn', 'updateAuditStreamConfiguration_fleetArn' - The ARN of the fleet.
newUpdateAuditStreamConfiguration ::
  -- | 'fleetArn'
  Prelude.Text ->
  UpdateAuditStreamConfiguration
newUpdateAuditStreamConfiguration :: Text -> UpdateAuditStreamConfiguration
newUpdateAuditStreamConfiguration Text
pFleetArn_ =
  UpdateAuditStreamConfiguration' :: Maybe Text -> Text -> UpdateAuditStreamConfiguration
UpdateAuditStreamConfiguration'
    { $sel:auditStreamArn:UpdateAuditStreamConfiguration' :: Maybe Text
auditStreamArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:fleetArn:UpdateAuditStreamConfiguration' :: Text
fleetArn = Text
pFleetArn_
    }

-- | The ARN of the Amazon Kinesis data stream that receives the audit
-- events.
updateAuditStreamConfiguration_auditStreamArn :: Lens.Lens' UpdateAuditStreamConfiguration (Prelude.Maybe Prelude.Text)
updateAuditStreamConfiguration_auditStreamArn :: (Maybe Text -> f (Maybe Text))
-> UpdateAuditStreamConfiguration
-> f UpdateAuditStreamConfiguration
updateAuditStreamConfiguration_auditStreamArn = (UpdateAuditStreamConfiguration -> Maybe Text)
-> (UpdateAuditStreamConfiguration
    -> Maybe Text -> UpdateAuditStreamConfiguration)
-> Lens
     UpdateAuditStreamConfiguration
     UpdateAuditStreamConfiguration
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAuditStreamConfiguration' {Maybe Text
auditStreamArn :: Maybe Text
$sel:auditStreamArn:UpdateAuditStreamConfiguration' :: UpdateAuditStreamConfiguration -> Maybe Text
auditStreamArn} -> Maybe Text
auditStreamArn) (\s :: UpdateAuditStreamConfiguration
s@UpdateAuditStreamConfiguration' {} Maybe Text
a -> UpdateAuditStreamConfiguration
s {$sel:auditStreamArn:UpdateAuditStreamConfiguration' :: Maybe Text
auditStreamArn = Maybe Text
a} :: UpdateAuditStreamConfiguration)

-- | The ARN of the fleet.
updateAuditStreamConfiguration_fleetArn :: Lens.Lens' UpdateAuditStreamConfiguration Prelude.Text
updateAuditStreamConfiguration_fleetArn :: (Text -> f Text)
-> UpdateAuditStreamConfiguration
-> f UpdateAuditStreamConfiguration
updateAuditStreamConfiguration_fleetArn = (UpdateAuditStreamConfiguration -> Text)
-> (UpdateAuditStreamConfiguration
    -> Text -> UpdateAuditStreamConfiguration)
-> Lens
     UpdateAuditStreamConfiguration
     UpdateAuditStreamConfiguration
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAuditStreamConfiguration' {Text
fleetArn :: Text
$sel:fleetArn:UpdateAuditStreamConfiguration' :: UpdateAuditStreamConfiguration -> Text
fleetArn} -> Text
fleetArn) (\s :: UpdateAuditStreamConfiguration
s@UpdateAuditStreamConfiguration' {} Text
a -> UpdateAuditStreamConfiguration
s {$sel:fleetArn:UpdateAuditStreamConfiguration' :: Text
fleetArn = Text
a} :: UpdateAuditStreamConfiguration)

instance
  Core.AWSRequest
    UpdateAuditStreamConfiguration
  where
  type
    AWSResponse UpdateAuditStreamConfiguration =
      UpdateAuditStreamConfigurationResponse
  request :: UpdateAuditStreamConfiguration
-> Request UpdateAuditStreamConfiguration
request = Service
-> UpdateAuditStreamConfiguration
-> Request UpdateAuditStreamConfiguration
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateAuditStreamConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse UpdateAuditStreamConfiguration)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse UpdateAuditStreamConfiguration))
-> Logger
-> Service
-> Proxy UpdateAuditStreamConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse UpdateAuditStreamConfiguration)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> UpdateAuditStreamConfigurationResponse
UpdateAuditStreamConfigurationResponse'
            (Int -> UpdateAuditStreamConfigurationResponse)
-> Either String Int
-> Either String UpdateAuditStreamConfigurationResponse
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))
      )

instance
  Prelude.Hashable
    UpdateAuditStreamConfiguration

instance
  Prelude.NFData
    UpdateAuditStreamConfiguration

instance
  Core.ToHeaders
    UpdateAuditStreamConfiguration
  where
  toHeaders :: UpdateAuditStreamConfiguration -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> UpdateAuditStreamConfiguration -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON UpdateAuditStreamConfiguration where
  toJSON :: UpdateAuditStreamConfiguration -> Value
toJSON UpdateAuditStreamConfiguration' {Maybe Text
Text
fleetArn :: Text
auditStreamArn :: Maybe Text
$sel:fleetArn:UpdateAuditStreamConfiguration' :: UpdateAuditStreamConfiguration -> Text
$sel:auditStreamArn:UpdateAuditStreamConfiguration' :: UpdateAuditStreamConfiguration -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"AuditStreamArn" 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
auditStreamArn,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"FleetArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
fleetArn)
          ]
      )

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

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

-- | /See:/ 'newUpdateAuditStreamConfigurationResponse' smart constructor.
data UpdateAuditStreamConfigurationResponse = UpdateAuditStreamConfigurationResponse'
  { -- | The response's http status code.
    UpdateAuditStreamConfigurationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (UpdateAuditStreamConfigurationResponse
-> UpdateAuditStreamConfigurationResponse -> Bool
(UpdateAuditStreamConfigurationResponse
 -> UpdateAuditStreamConfigurationResponse -> Bool)
-> (UpdateAuditStreamConfigurationResponse
    -> UpdateAuditStreamConfigurationResponse -> Bool)
-> Eq UpdateAuditStreamConfigurationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateAuditStreamConfigurationResponse
-> UpdateAuditStreamConfigurationResponse -> Bool
$c/= :: UpdateAuditStreamConfigurationResponse
-> UpdateAuditStreamConfigurationResponse -> Bool
== :: UpdateAuditStreamConfigurationResponse
-> UpdateAuditStreamConfigurationResponse -> Bool
$c== :: UpdateAuditStreamConfigurationResponse
-> UpdateAuditStreamConfigurationResponse -> Bool
Prelude.Eq, ReadPrec [UpdateAuditStreamConfigurationResponse]
ReadPrec UpdateAuditStreamConfigurationResponse
Int -> ReadS UpdateAuditStreamConfigurationResponse
ReadS [UpdateAuditStreamConfigurationResponse]
(Int -> ReadS UpdateAuditStreamConfigurationResponse)
-> ReadS [UpdateAuditStreamConfigurationResponse]
-> ReadPrec UpdateAuditStreamConfigurationResponse
-> ReadPrec [UpdateAuditStreamConfigurationResponse]
-> Read UpdateAuditStreamConfigurationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateAuditStreamConfigurationResponse]
$creadListPrec :: ReadPrec [UpdateAuditStreamConfigurationResponse]
readPrec :: ReadPrec UpdateAuditStreamConfigurationResponse
$creadPrec :: ReadPrec UpdateAuditStreamConfigurationResponse
readList :: ReadS [UpdateAuditStreamConfigurationResponse]
$creadList :: ReadS [UpdateAuditStreamConfigurationResponse]
readsPrec :: Int -> ReadS UpdateAuditStreamConfigurationResponse
$creadsPrec :: Int -> ReadS UpdateAuditStreamConfigurationResponse
Prelude.Read, Int -> UpdateAuditStreamConfigurationResponse -> ShowS
[UpdateAuditStreamConfigurationResponse] -> ShowS
UpdateAuditStreamConfigurationResponse -> String
(Int -> UpdateAuditStreamConfigurationResponse -> ShowS)
-> (UpdateAuditStreamConfigurationResponse -> String)
-> ([UpdateAuditStreamConfigurationResponse] -> ShowS)
-> Show UpdateAuditStreamConfigurationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateAuditStreamConfigurationResponse] -> ShowS
$cshowList :: [UpdateAuditStreamConfigurationResponse] -> ShowS
show :: UpdateAuditStreamConfigurationResponse -> String
$cshow :: UpdateAuditStreamConfigurationResponse -> String
showsPrec :: Int -> UpdateAuditStreamConfigurationResponse -> ShowS
$cshowsPrec :: Int -> UpdateAuditStreamConfigurationResponse -> ShowS
Prelude.Show, (forall x.
 UpdateAuditStreamConfigurationResponse
 -> Rep UpdateAuditStreamConfigurationResponse x)
-> (forall x.
    Rep UpdateAuditStreamConfigurationResponse x
    -> UpdateAuditStreamConfigurationResponse)
-> Generic UpdateAuditStreamConfigurationResponse
forall x.
Rep UpdateAuditStreamConfigurationResponse x
-> UpdateAuditStreamConfigurationResponse
forall x.
UpdateAuditStreamConfigurationResponse
-> Rep UpdateAuditStreamConfigurationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateAuditStreamConfigurationResponse x
-> UpdateAuditStreamConfigurationResponse
$cfrom :: forall x.
UpdateAuditStreamConfigurationResponse
-> Rep UpdateAuditStreamConfigurationResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateAuditStreamConfigurationResponse' 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', 'updateAuditStreamConfigurationResponse_httpStatus' - The response's http status code.
newUpdateAuditStreamConfigurationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateAuditStreamConfigurationResponse
newUpdateAuditStreamConfigurationResponse :: Int -> UpdateAuditStreamConfigurationResponse
newUpdateAuditStreamConfigurationResponse
  Int
pHttpStatus_ =
    UpdateAuditStreamConfigurationResponse' :: Int -> UpdateAuditStreamConfigurationResponse
UpdateAuditStreamConfigurationResponse'
      { $sel:httpStatus:UpdateAuditStreamConfigurationResponse' :: Int
httpStatus =
          Int
pHttpStatus_
      }

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

instance
  Prelude.NFData
    UpdateAuditStreamConfigurationResponse