{-# 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.CloudWatchLogs.PutLogEvents
-- 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)
--
-- Uploads a batch of log events to the specified log stream.
--
-- You must include the sequence token obtained from the response of the
-- previous call. An upload in a newly created log stream does not require
-- a sequence token. You can also get the sequence token in the
-- @expectedSequenceToken@ field from @InvalidSequenceTokenException@. If
-- you call @PutLogEvents@ twice within a narrow time period using the same
-- value for @sequenceToken@, both calls might be successful or one might
-- be rejected.
--
-- The batch of events must satisfy the following constraints:
--
-- -   The maximum batch size is 1,048,576 bytes. This size is calculated
--     as the sum of all event messages in UTF-8, plus 26 bytes for each
--     log event.
--
-- -   None of the log events in the batch can be more than 2 hours in the
--     future.
--
-- -   None of the log events in the batch can be older than 14 days or
--     older than the retention period of the log group.
--
-- -   The log events in the batch must be in chronological order by their
--     timestamp. The timestamp is the time the event occurred, expressed
--     as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. (In
--     Amazon Web Services Tools for PowerShell and the Amazon Web Services
--     SDK for .NET, the timestamp is specified in .NET format:
--     yyyy-mm-ddThh:mm:ss. For example, 2017-09-15T13:45:30.)
--
-- -   A batch of log events in a single request cannot span more than 24
--     hours. Otherwise, the operation fails.
--
-- -   The maximum number of log events in a batch is 10,000.
--
-- -   There is a quota of 5 requests per second per log stream. Additional
--     requests are throttled. This quota can\'t be changed.
--
-- If a call to @PutLogEvents@ returns \"UnrecognizedClientException\" the
-- most likely cause is an invalid Amazon Web Services access key ID or
-- secret key.
module Amazonka.CloudWatchLogs.PutLogEvents
  ( -- * Creating a Request
    PutLogEvents (..),
    newPutLogEvents,

    -- * Request Lenses
    putLogEvents_sequenceToken,
    putLogEvents_logGroupName,
    putLogEvents_logStreamName,
    putLogEvents_logEvents,

    -- * Destructuring the Response
    PutLogEventsResponse (..),
    newPutLogEventsResponse,

    -- * Response Lenses
    putLogEventsResponse_rejectedLogEventsInfo,
    putLogEventsResponse_nextSequenceToken,
    putLogEventsResponse_httpStatus,
  )
where

import Amazonka.CloudWatchLogs.Types
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

-- | /See:/ 'newPutLogEvents' smart constructor.
data PutLogEvents = PutLogEvents'
  { -- | The sequence token obtained from the response of the previous
    -- @PutLogEvents@ call. An upload in a newly created log stream does not
    -- require a sequence token. You can also get the sequence token using
    -- <https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeLogStreams.html DescribeLogStreams>.
    -- If you call @PutLogEvents@ twice within a narrow time period using the
    -- same value for @sequenceToken@, both calls might be successful or one
    -- might be rejected.
    PutLogEvents -> Maybe Text
sequenceToken :: Prelude.Maybe Prelude.Text,
    -- | The name of the log group.
    PutLogEvents -> Text
logGroupName :: Prelude.Text,
    -- | The name of the log stream.
    PutLogEvents -> Text
logStreamName :: Prelude.Text,
    -- | The log events.
    PutLogEvents -> NonEmpty InputLogEvent
logEvents :: Prelude.NonEmpty InputLogEvent
  }
  deriving (PutLogEvents -> PutLogEvents -> Bool
(PutLogEvents -> PutLogEvents -> Bool)
-> (PutLogEvents -> PutLogEvents -> Bool) -> Eq PutLogEvents
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PutLogEvents -> PutLogEvents -> Bool
$c/= :: PutLogEvents -> PutLogEvents -> Bool
== :: PutLogEvents -> PutLogEvents -> Bool
$c== :: PutLogEvents -> PutLogEvents -> Bool
Prelude.Eq, ReadPrec [PutLogEvents]
ReadPrec PutLogEvents
Int -> ReadS PutLogEvents
ReadS [PutLogEvents]
(Int -> ReadS PutLogEvents)
-> ReadS [PutLogEvents]
-> ReadPrec PutLogEvents
-> ReadPrec [PutLogEvents]
-> Read PutLogEvents
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PutLogEvents]
$creadListPrec :: ReadPrec [PutLogEvents]
readPrec :: ReadPrec PutLogEvents
$creadPrec :: ReadPrec PutLogEvents
readList :: ReadS [PutLogEvents]
$creadList :: ReadS [PutLogEvents]
readsPrec :: Int -> ReadS PutLogEvents
$creadsPrec :: Int -> ReadS PutLogEvents
Prelude.Read, Int -> PutLogEvents -> ShowS
[PutLogEvents] -> ShowS
PutLogEvents -> String
(Int -> PutLogEvents -> ShowS)
-> (PutLogEvents -> String)
-> ([PutLogEvents] -> ShowS)
-> Show PutLogEvents
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PutLogEvents] -> ShowS
$cshowList :: [PutLogEvents] -> ShowS
show :: PutLogEvents -> String
$cshow :: PutLogEvents -> String
showsPrec :: Int -> PutLogEvents -> ShowS
$cshowsPrec :: Int -> PutLogEvents -> ShowS
Prelude.Show, (forall x. PutLogEvents -> Rep PutLogEvents x)
-> (forall x. Rep PutLogEvents x -> PutLogEvents)
-> Generic PutLogEvents
forall x. Rep PutLogEvents x -> PutLogEvents
forall x. PutLogEvents -> Rep PutLogEvents x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PutLogEvents x -> PutLogEvents
$cfrom :: forall x. PutLogEvents -> Rep PutLogEvents x
Prelude.Generic)

-- |
-- Create a value of 'PutLogEvents' 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:
--
-- 'sequenceToken', 'putLogEvents_sequenceToken' - The sequence token obtained from the response of the previous
-- @PutLogEvents@ call. An upload in a newly created log stream does not
-- require a sequence token. You can also get the sequence token using
-- <https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeLogStreams.html DescribeLogStreams>.
-- If you call @PutLogEvents@ twice within a narrow time period using the
-- same value for @sequenceToken@, both calls might be successful or one
-- might be rejected.
--
-- 'logGroupName', 'putLogEvents_logGroupName' - The name of the log group.
--
-- 'logStreamName', 'putLogEvents_logStreamName' - The name of the log stream.
--
-- 'logEvents', 'putLogEvents_logEvents' - The log events.
newPutLogEvents ::
  -- | 'logGroupName'
  Prelude.Text ->
  -- | 'logStreamName'
  Prelude.Text ->
  -- | 'logEvents'
  Prelude.NonEmpty InputLogEvent ->
  PutLogEvents
newPutLogEvents :: Text -> Text -> NonEmpty InputLogEvent -> PutLogEvents
newPutLogEvents
  Text
pLogGroupName_
  Text
pLogStreamName_
  NonEmpty InputLogEvent
pLogEvents_ =
    PutLogEvents' :: Maybe Text
-> Text -> Text -> NonEmpty InputLogEvent -> PutLogEvents
PutLogEvents'
      { $sel:sequenceToken:PutLogEvents' :: Maybe Text
sequenceToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:logGroupName:PutLogEvents' :: Text
logGroupName = Text
pLogGroupName_,
        $sel:logStreamName:PutLogEvents' :: Text
logStreamName = Text
pLogStreamName_,
        $sel:logEvents:PutLogEvents' :: NonEmpty InputLogEvent
logEvents = Tagged (NonEmpty InputLogEvent) (Identity (NonEmpty InputLogEvent))
-> Tagged
     (NonEmpty InputLogEvent) (Identity (NonEmpty InputLogEvent))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged
   (NonEmpty InputLogEvent) (Identity (NonEmpty InputLogEvent))
 -> Tagged
      (NonEmpty InputLogEvent) (Identity (NonEmpty InputLogEvent)))
-> NonEmpty InputLogEvent -> NonEmpty InputLogEvent
forall t b. AReview t b -> b -> t
Lens.# NonEmpty InputLogEvent
pLogEvents_
      }

-- | The sequence token obtained from the response of the previous
-- @PutLogEvents@ call. An upload in a newly created log stream does not
-- require a sequence token. You can also get the sequence token using
-- <https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeLogStreams.html DescribeLogStreams>.
-- If you call @PutLogEvents@ twice within a narrow time period using the
-- same value for @sequenceToken@, both calls might be successful or one
-- might be rejected.
putLogEvents_sequenceToken :: Lens.Lens' PutLogEvents (Prelude.Maybe Prelude.Text)
putLogEvents_sequenceToken :: (Maybe Text -> f (Maybe Text)) -> PutLogEvents -> f PutLogEvents
putLogEvents_sequenceToken = (PutLogEvents -> Maybe Text)
-> (PutLogEvents -> Maybe Text -> PutLogEvents)
-> Lens PutLogEvents PutLogEvents (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutLogEvents' {Maybe Text
sequenceToken :: Maybe Text
$sel:sequenceToken:PutLogEvents' :: PutLogEvents -> Maybe Text
sequenceToken} -> Maybe Text
sequenceToken) (\s :: PutLogEvents
s@PutLogEvents' {} Maybe Text
a -> PutLogEvents
s {$sel:sequenceToken:PutLogEvents' :: Maybe Text
sequenceToken = Maybe Text
a} :: PutLogEvents)

-- | The name of the log group.
putLogEvents_logGroupName :: Lens.Lens' PutLogEvents Prelude.Text
putLogEvents_logGroupName :: (Text -> f Text) -> PutLogEvents -> f PutLogEvents
putLogEvents_logGroupName = (PutLogEvents -> Text)
-> (PutLogEvents -> Text -> PutLogEvents)
-> Lens PutLogEvents PutLogEvents Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutLogEvents' {Text
logGroupName :: Text
$sel:logGroupName:PutLogEvents' :: PutLogEvents -> Text
logGroupName} -> Text
logGroupName) (\s :: PutLogEvents
s@PutLogEvents' {} Text
a -> PutLogEvents
s {$sel:logGroupName:PutLogEvents' :: Text
logGroupName = Text
a} :: PutLogEvents)

-- | The name of the log stream.
putLogEvents_logStreamName :: Lens.Lens' PutLogEvents Prelude.Text
putLogEvents_logStreamName :: (Text -> f Text) -> PutLogEvents -> f PutLogEvents
putLogEvents_logStreamName = (PutLogEvents -> Text)
-> (PutLogEvents -> Text -> PutLogEvents)
-> Lens PutLogEvents PutLogEvents Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutLogEvents' {Text
logStreamName :: Text
$sel:logStreamName:PutLogEvents' :: PutLogEvents -> Text
logStreamName} -> Text
logStreamName) (\s :: PutLogEvents
s@PutLogEvents' {} Text
a -> PutLogEvents
s {$sel:logStreamName:PutLogEvents' :: Text
logStreamName = Text
a} :: PutLogEvents)

-- | The log events.
putLogEvents_logEvents :: Lens.Lens' PutLogEvents (Prelude.NonEmpty InputLogEvent)
putLogEvents_logEvents :: (NonEmpty InputLogEvent -> f (NonEmpty InputLogEvent))
-> PutLogEvents -> f PutLogEvents
putLogEvents_logEvents = (PutLogEvents -> NonEmpty InputLogEvent)
-> (PutLogEvents -> NonEmpty InputLogEvent -> PutLogEvents)
-> Lens
     PutLogEvents
     PutLogEvents
     (NonEmpty InputLogEvent)
     (NonEmpty InputLogEvent)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutLogEvents' {NonEmpty InputLogEvent
logEvents :: NonEmpty InputLogEvent
$sel:logEvents:PutLogEvents' :: PutLogEvents -> NonEmpty InputLogEvent
logEvents} -> NonEmpty InputLogEvent
logEvents) (\s :: PutLogEvents
s@PutLogEvents' {} NonEmpty InputLogEvent
a -> PutLogEvents
s {$sel:logEvents:PutLogEvents' :: NonEmpty InputLogEvent
logEvents = NonEmpty InputLogEvent
a} :: PutLogEvents) ((NonEmpty InputLogEvent -> f (NonEmpty InputLogEvent))
 -> PutLogEvents -> f PutLogEvents)
-> ((NonEmpty InputLogEvent -> f (NonEmpty InputLogEvent))
    -> NonEmpty InputLogEvent -> f (NonEmpty InputLogEvent))
-> (NonEmpty InputLogEvent -> f (NonEmpty InputLogEvent))
-> PutLogEvents
-> f PutLogEvents
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty InputLogEvent -> f (NonEmpty InputLogEvent))
-> NonEmpty InputLogEvent -> f (NonEmpty InputLogEvent)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest PutLogEvents where
  type AWSResponse PutLogEvents = PutLogEventsResponse
  request :: PutLogEvents -> Request PutLogEvents
request = Service -> PutLogEvents -> Request PutLogEvents
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy PutLogEvents
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutLogEvents)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse PutLogEvents))
-> Logger
-> Service
-> Proxy PutLogEvents
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse PutLogEvents)))
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 ->
          Maybe RejectedLogEventsInfo
-> Maybe Text -> Int -> PutLogEventsResponse
PutLogEventsResponse'
            (Maybe RejectedLogEventsInfo
 -> Maybe Text -> Int -> PutLogEventsResponse)
-> Either String (Maybe RejectedLogEventsInfo)
-> Either String (Maybe Text -> Int -> PutLogEventsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe RejectedLogEventsInfo)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"rejectedLogEventsInfo")
            Either String (Maybe Text -> Int -> PutLogEventsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> PutLogEventsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"nextSequenceToken")
            Either String (Int -> PutLogEventsResponse)
-> Either String Int -> Either String PutLogEventsResponse
forall (f :: * -> *) a b. Applicative f => 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 PutLogEvents

instance Prelude.NFData PutLogEvents

instance Core.ToHeaders PutLogEvents where
  toHeaders :: PutLogEvents -> ResponseHeaders
toHeaders =
    ResponseHeaders -> PutLogEvents -> 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
"Logs_20140328.PutLogEvents" :: Prelude.ByteString),
            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 PutLogEvents where
  toJSON :: PutLogEvents -> Value
toJSON PutLogEvents' {Maybe Text
NonEmpty InputLogEvent
Text
logEvents :: NonEmpty InputLogEvent
logStreamName :: Text
logGroupName :: Text
sequenceToken :: Maybe Text
$sel:logEvents:PutLogEvents' :: PutLogEvents -> NonEmpty InputLogEvent
$sel:logStreamName:PutLogEvents' :: PutLogEvents -> Text
$sel:logGroupName:PutLogEvents' :: PutLogEvents -> Text
$sel:sequenceToken:PutLogEvents' :: PutLogEvents -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"sequenceToken" 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
sequenceToken,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"logGroupName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
logGroupName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"logStreamName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
logStreamName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"logEvents" Text -> NonEmpty InputLogEvent -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty InputLogEvent
logEvents)
          ]
      )

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

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

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

-- |
-- Create a value of 'PutLogEventsResponse' 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:
--
-- 'rejectedLogEventsInfo', 'putLogEventsResponse_rejectedLogEventsInfo' - The rejected events.
--
-- 'nextSequenceToken', 'putLogEventsResponse_nextSequenceToken' - The next sequence token.
--
-- 'httpStatus', 'putLogEventsResponse_httpStatus' - The response's http status code.
newPutLogEventsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  PutLogEventsResponse
newPutLogEventsResponse :: Int -> PutLogEventsResponse
newPutLogEventsResponse Int
pHttpStatus_ =
  PutLogEventsResponse' :: Maybe RejectedLogEventsInfo
-> Maybe Text -> Int -> PutLogEventsResponse
PutLogEventsResponse'
    { $sel:rejectedLogEventsInfo:PutLogEventsResponse' :: Maybe RejectedLogEventsInfo
rejectedLogEventsInfo =
        Maybe RejectedLogEventsInfo
forall a. Maybe a
Prelude.Nothing,
      $sel:nextSequenceToken:PutLogEventsResponse' :: Maybe Text
nextSequenceToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:PutLogEventsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The rejected events.
putLogEventsResponse_rejectedLogEventsInfo :: Lens.Lens' PutLogEventsResponse (Prelude.Maybe RejectedLogEventsInfo)
putLogEventsResponse_rejectedLogEventsInfo :: (Maybe RejectedLogEventsInfo -> f (Maybe RejectedLogEventsInfo))
-> PutLogEventsResponse -> f PutLogEventsResponse
putLogEventsResponse_rejectedLogEventsInfo = (PutLogEventsResponse -> Maybe RejectedLogEventsInfo)
-> (PutLogEventsResponse
    -> Maybe RejectedLogEventsInfo -> PutLogEventsResponse)
-> Lens
     PutLogEventsResponse
     PutLogEventsResponse
     (Maybe RejectedLogEventsInfo)
     (Maybe RejectedLogEventsInfo)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutLogEventsResponse' {Maybe RejectedLogEventsInfo
rejectedLogEventsInfo :: Maybe RejectedLogEventsInfo
$sel:rejectedLogEventsInfo:PutLogEventsResponse' :: PutLogEventsResponse -> Maybe RejectedLogEventsInfo
rejectedLogEventsInfo} -> Maybe RejectedLogEventsInfo
rejectedLogEventsInfo) (\s :: PutLogEventsResponse
s@PutLogEventsResponse' {} Maybe RejectedLogEventsInfo
a -> PutLogEventsResponse
s {$sel:rejectedLogEventsInfo:PutLogEventsResponse' :: Maybe RejectedLogEventsInfo
rejectedLogEventsInfo = Maybe RejectedLogEventsInfo
a} :: PutLogEventsResponse)

-- | The next sequence token.
putLogEventsResponse_nextSequenceToken :: Lens.Lens' PutLogEventsResponse (Prelude.Maybe Prelude.Text)
putLogEventsResponse_nextSequenceToken :: (Maybe Text -> f (Maybe Text))
-> PutLogEventsResponse -> f PutLogEventsResponse
putLogEventsResponse_nextSequenceToken = (PutLogEventsResponse -> Maybe Text)
-> (PutLogEventsResponse -> Maybe Text -> PutLogEventsResponse)
-> Lens
     PutLogEventsResponse PutLogEventsResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PutLogEventsResponse' {Maybe Text
nextSequenceToken :: Maybe Text
$sel:nextSequenceToken:PutLogEventsResponse' :: PutLogEventsResponse -> Maybe Text
nextSequenceToken} -> Maybe Text
nextSequenceToken) (\s :: PutLogEventsResponse
s@PutLogEventsResponse' {} Maybe Text
a -> PutLogEventsResponse
s {$sel:nextSequenceToken:PutLogEventsResponse' :: Maybe Text
nextSequenceToken = Maybe Text
a} :: PutLogEventsResponse)

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

instance Prelude.NFData PutLogEventsResponse