{-# 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.Lightsail.GetContainerLog
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns the log events of a container of your Amazon Lightsail container
-- service.
--
-- If your container service has more than one node (i.e., a scale greater
-- than 1), then the log events that are returned for the specified
-- container are merged from all nodes on your container service.
--
-- Container logs are retained for a certain amount of time. For more
-- information, see
-- <https://docs.aws.amazon.com/general/latest/gr/lightsail.html Amazon Lightsail endpoints and quotas>
-- in the /Amazon Web Services General Reference/.
module Amazonka.Lightsail.GetContainerLog
  ( -- * Creating a Request
    GetContainerLog (..),
    newGetContainerLog,

    -- * Request Lenses
    getContainerLog_endTime,
    getContainerLog_filterPattern,
    getContainerLog_pageToken,
    getContainerLog_startTime,
    getContainerLog_serviceName,
    getContainerLog_containerName,

    -- * Destructuring the Response
    GetContainerLogResponse (..),
    newGetContainerLogResponse,

    -- * Response Lenses
    getContainerLogResponse_logEvents,
    getContainerLogResponse_nextPageToken,
    getContainerLogResponse_httpStatus,
  )
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
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newGetContainerLog' smart constructor.
data GetContainerLog = GetContainerLog'
  { -- | The end of the time interval for which to get log data.
    --
    -- Constraints:
    --
    -- -   Specified in Coordinated Universal Time (UTC).
    --
    -- -   Specified in the Unix time format.
    --
    --     For example, if you wish to use an end time of October 1, 2018, at 9
    --     PM UTC, specify @1538427600@ as the end time.
    --
    -- You can convert a human-friendly time to Unix time format using a
    -- converter like <https://www.epochconverter.com/ Epoch converter>.
    GetContainerLog -> Maybe POSIX
endTime :: Prelude.Maybe Data.POSIX,
    -- | The pattern to use to filter the returned log events to a specific term.
    --
    -- The following are a few examples of filter patterns that you can
    -- specify:
    --
    -- -   To return all log events, specify a filter pattern of @\"\"@.
    --
    -- -   To exclude log events that contain the @ERROR@ term, and return all
    --     other log events, specify a filter pattern of @\"-ERROR\"@.
    --
    -- -   To return log events that contain the @ERROR@ term, specify a filter
    --     pattern of @\"ERROR\"@.
    --
    -- -   To return log events that contain both the @ERROR@ and @Exception@
    --     terms, specify a filter pattern of @\"ERROR Exception\"@.
    --
    -- -   To return log events that contain the @ERROR@ /or/ the @Exception@
    --     term, specify a filter pattern of @\"?ERROR ?Exception\"@.
    GetContainerLog -> Maybe Text
filterPattern :: Prelude.Maybe Prelude.Text,
    -- | The token to advance to the next page of results from your request.
    --
    -- To get a page token, perform an initial @GetContainerLog@ request. If
    -- your results are paginated, the response will return a next page token
    -- that you can specify as the page token in a subsequent request.
    GetContainerLog -> Maybe Text
pageToken :: Prelude.Maybe Prelude.Text,
    -- | The start of the time interval for which to get log data.
    --
    -- Constraints:
    --
    -- -   Specified in Coordinated Universal Time (UTC).
    --
    -- -   Specified in the Unix time format.
    --
    --     For example, if you wish to use a start time of October 1, 2018, at
    --     8 PM UTC, specify @1538424000@ as the start time.
    --
    -- You can convert a human-friendly time to Unix time format using a
    -- converter like <https://www.epochconverter.com/ Epoch converter>.
    GetContainerLog -> Maybe POSIX
startTime :: Prelude.Maybe Data.POSIX,
    -- | The name of the container service for which to get a container log.
    GetContainerLog -> Text
serviceName :: Prelude.Text,
    -- | The name of the container that is either running or previously ran on
    -- the container service for which to return a log.
    GetContainerLog -> Text
containerName :: Prelude.Text
  }
  deriving (GetContainerLog -> GetContainerLog -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetContainerLog -> GetContainerLog -> Bool
$c/= :: GetContainerLog -> GetContainerLog -> Bool
== :: GetContainerLog -> GetContainerLog -> Bool
$c== :: GetContainerLog -> GetContainerLog -> Bool
Prelude.Eq, ReadPrec [GetContainerLog]
ReadPrec GetContainerLog
Int -> ReadS GetContainerLog
ReadS [GetContainerLog]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetContainerLog]
$creadListPrec :: ReadPrec [GetContainerLog]
readPrec :: ReadPrec GetContainerLog
$creadPrec :: ReadPrec GetContainerLog
readList :: ReadS [GetContainerLog]
$creadList :: ReadS [GetContainerLog]
readsPrec :: Int -> ReadS GetContainerLog
$creadsPrec :: Int -> ReadS GetContainerLog
Prelude.Read, Int -> GetContainerLog -> ShowS
[GetContainerLog] -> ShowS
GetContainerLog -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetContainerLog] -> ShowS
$cshowList :: [GetContainerLog] -> ShowS
show :: GetContainerLog -> String
$cshow :: GetContainerLog -> String
showsPrec :: Int -> GetContainerLog -> ShowS
$cshowsPrec :: Int -> GetContainerLog -> ShowS
Prelude.Show, forall x. Rep GetContainerLog x -> GetContainerLog
forall x. GetContainerLog -> Rep GetContainerLog x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetContainerLog x -> GetContainerLog
$cfrom :: forall x. GetContainerLog -> Rep GetContainerLog x
Prelude.Generic)

-- |
-- Create a value of 'GetContainerLog' 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:
--
-- 'endTime', 'getContainerLog_endTime' - The end of the time interval for which to get log data.
--
-- Constraints:
--
-- -   Specified in Coordinated Universal Time (UTC).
--
-- -   Specified in the Unix time format.
--
--     For example, if you wish to use an end time of October 1, 2018, at 9
--     PM UTC, specify @1538427600@ as the end time.
--
-- You can convert a human-friendly time to Unix time format using a
-- converter like <https://www.epochconverter.com/ Epoch converter>.
--
-- 'filterPattern', 'getContainerLog_filterPattern' - The pattern to use to filter the returned log events to a specific term.
--
-- The following are a few examples of filter patterns that you can
-- specify:
--
-- -   To return all log events, specify a filter pattern of @\"\"@.
--
-- -   To exclude log events that contain the @ERROR@ term, and return all
--     other log events, specify a filter pattern of @\"-ERROR\"@.
--
-- -   To return log events that contain the @ERROR@ term, specify a filter
--     pattern of @\"ERROR\"@.
--
-- -   To return log events that contain both the @ERROR@ and @Exception@
--     terms, specify a filter pattern of @\"ERROR Exception\"@.
--
-- -   To return log events that contain the @ERROR@ /or/ the @Exception@
--     term, specify a filter pattern of @\"?ERROR ?Exception\"@.
--
-- 'pageToken', 'getContainerLog_pageToken' - The token to advance to the next page of results from your request.
--
-- To get a page token, perform an initial @GetContainerLog@ request. If
-- your results are paginated, the response will return a next page token
-- that you can specify as the page token in a subsequent request.
--
-- 'startTime', 'getContainerLog_startTime' - The start of the time interval for which to get log data.
--
-- Constraints:
--
-- -   Specified in Coordinated Universal Time (UTC).
--
-- -   Specified in the Unix time format.
--
--     For example, if you wish to use a start time of October 1, 2018, at
--     8 PM UTC, specify @1538424000@ as the start time.
--
-- You can convert a human-friendly time to Unix time format using a
-- converter like <https://www.epochconverter.com/ Epoch converter>.
--
-- 'serviceName', 'getContainerLog_serviceName' - The name of the container service for which to get a container log.
--
-- 'containerName', 'getContainerLog_containerName' - The name of the container that is either running or previously ran on
-- the container service for which to return a log.
newGetContainerLog ::
  -- | 'serviceName'
  Prelude.Text ->
  -- | 'containerName'
  Prelude.Text ->
  GetContainerLog
newGetContainerLog :: Text -> Text -> GetContainerLog
newGetContainerLog Text
pServiceName_ Text
pContainerName_ =
  GetContainerLog'
    { $sel:endTime:GetContainerLog' :: Maybe POSIX
endTime = forall a. Maybe a
Prelude.Nothing,
      $sel:filterPattern:GetContainerLog' :: Maybe Text
filterPattern = forall a. Maybe a
Prelude.Nothing,
      $sel:pageToken:GetContainerLog' :: Maybe Text
pageToken = forall a. Maybe a
Prelude.Nothing,
      $sel:startTime:GetContainerLog' :: Maybe POSIX
startTime = forall a. Maybe a
Prelude.Nothing,
      $sel:serviceName:GetContainerLog' :: Text
serviceName = Text
pServiceName_,
      $sel:containerName:GetContainerLog' :: Text
containerName = Text
pContainerName_
    }

-- | The end of the time interval for which to get log data.
--
-- Constraints:
--
-- -   Specified in Coordinated Universal Time (UTC).
--
-- -   Specified in the Unix time format.
--
--     For example, if you wish to use an end time of October 1, 2018, at 9
--     PM UTC, specify @1538427600@ as the end time.
--
-- You can convert a human-friendly time to Unix time format using a
-- converter like <https://www.epochconverter.com/ Epoch converter>.
getContainerLog_endTime :: Lens.Lens' GetContainerLog (Prelude.Maybe Prelude.UTCTime)
getContainerLog_endTime :: Lens' GetContainerLog (Maybe UTCTime)
getContainerLog_endTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetContainerLog' {Maybe POSIX
endTime :: Maybe POSIX
$sel:endTime:GetContainerLog' :: GetContainerLog -> Maybe POSIX
endTime} -> Maybe POSIX
endTime) (\s :: GetContainerLog
s@GetContainerLog' {} Maybe POSIX
a -> GetContainerLog
s {$sel:endTime:GetContainerLog' :: Maybe POSIX
endTime = Maybe POSIX
a} :: GetContainerLog) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The pattern to use to filter the returned log events to a specific term.
--
-- The following are a few examples of filter patterns that you can
-- specify:
--
-- -   To return all log events, specify a filter pattern of @\"\"@.
--
-- -   To exclude log events that contain the @ERROR@ term, and return all
--     other log events, specify a filter pattern of @\"-ERROR\"@.
--
-- -   To return log events that contain the @ERROR@ term, specify a filter
--     pattern of @\"ERROR\"@.
--
-- -   To return log events that contain both the @ERROR@ and @Exception@
--     terms, specify a filter pattern of @\"ERROR Exception\"@.
--
-- -   To return log events that contain the @ERROR@ /or/ the @Exception@
--     term, specify a filter pattern of @\"?ERROR ?Exception\"@.
getContainerLog_filterPattern :: Lens.Lens' GetContainerLog (Prelude.Maybe Prelude.Text)
getContainerLog_filterPattern :: Lens' GetContainerLog (Maybe Text)
getContainerLog_filterPattern = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetContainerLog' {Maybe Text
filterPattern :: Maybe Text
$sel:filterPattern:GetContainerLog' :: GetContainerLog -> Maybe Text
filterPattern} -> Maybe Text
filterPattern) (\s :: GetContainerLog
s@GetContainerLog' {} Maybe Text
a -> GetContainerLog
s {$sel:filterPattern:GetContainerLog' :: Maybe Text
filterPattern = Maybe Text
a} :: GetContainerLog)

-- | The token to advance to the next page of results from your request.
--
-- To get a page token, perform an initial @GetContainerLog@ request. If
-- your results are paginated, the response will return a next page token
-- that you can specify as the page token in a subsequent request.
getContainerLog_pageToken :: Lens.Lens' GetContainerLog (Prelude.Maybe Prelude.Text)
getContainerLog_pageToken :: Lens' GetContainerLog (Maybe Text)
getContainerLog_pageToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetContainerLog' {Maybe Text
pageToken :: Maybe Text
$sel:pageToken:GetContainerLog' :: GetContainerLog -> Maybe Text
pageToken} -> Maybe Text
pageToken) (\s :: GetContainerLog
s@GetContainerLog' {} Maybe Text
a -> GetContainerLog
s {$sel:pageToken:GetContainerLog' :: Maybe Text
pageToken = Maybe Text
a} :: GetContainerLog)

-- | The start of the time interval for which to get log data.
--
-- Constraints:
--
-- -   Specified in Coordinated Universal Time (UTC).
--
-- -   Specified in the Unix time format.
--
--     For example, if you wish to use a start time of October 1, 2018, at
--     8 PM UTC, specify @1538424000@ as the start time.
--
-- You can convert a human-friendly time to Unix time format using a
-- converter like <https://www.epochconverter.com/ Epoch converter>.
getContainerLog_startTime :: Lens.Lens' GetContainerLog (Prelude.Maybe Prelude.UTCTime)
getContainerLog_startTime :: Lens' GetContainerLog (Maybe UTCTime)
getContainerLog_startTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetContainerLog' {Maybe POSIX
startTime :: Maybe POSIX
$sel:startTime:GetContainerLog' :: GetContainerLog -> Maybe POSIX
startTime} -> Maybe POSIX
startTime) (\s :: GetContainerLog
s@GetContainerLog' {} Maybe POSIX
a -> GetContainerLog
s {$sel:startTime:GetContainerLog' :: Maybe POSIX
startTime = Maybe POSIX
a} :: GetContainerLog) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The name of the container service for which to get a container log.
getContainerLog_serviceName :: Lens.Lens' GetContainerLog Prelude.Text
getContainerLog_serviceName :: Lens' GetContainerLog Text
getContainerLog_serviceName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetContainerLog' {Text
serviceName :: Text
$sel:serviceName:GetContainerLog' :: GetContainerLog -> Text
serviceName} -> Text
serviceName) (\s :: GetContainerLog
s@GetContainerLog' {} Text
a -> GetContainerLog
s {$sel:serviceName:GetContainerLog' :: Text
serviceName = Text
a} :: GetContainerLog)

-- | The name of the container that is either running or previously ran on
-- the container service for which to return a log.
getContainerLog_containerName :: Lens.Lens' GetContainerLog Prelude.Text
getContainerLog_containerName :: Lens' GetContainerLog Text
getContainerLog_containerName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetContainerLog' {Text
containerName :: Text
$sel:containerName:GetContainerLog' :: GetContainerLog -> Text
containerName} -> Text
containerName) (\s :: GetContainerLog
s@GetContainerLog' {} Text
a -> GetContainerLog
s {$sel:containerName:GetContainerLog' :: Text
containerName = Text
a} :: GetContainerLog)

instance Core.AWSRequest GetContainerLog where
  type
    AWSResponse GetContainerLog =
      GetContainerLogResponse
  request :: (Service -> Service) -> GetContainerLog -> Request GetContainerLog
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetContainerLog
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetContainerLog)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe [ContainerServiceLogEvent]
-> Maybe Text -> Int -> GetContainerLogResponse
GetContainerLogResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"logEvents" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"nextPageToken")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable GetContainerLog where
  hashWithSalt :: Int -> GetContainerLog -> Int
hashWithSalt Int
_salt GetContainerLog' {Maybe Text
Maybe POSIX
Text
containerName :: Text
serviceName :: Text
startTime :: Maybe POSIX
pageToken :: Maybe Text
filterPattern :: Maybe Text
endTime :: Maybe POSIX
$sel:containerName:GetContainerLog' :: GetContainerLog -> Text
$sel:serviceName:GetContainerLog' :: GetContainerLog -> Text
$sel:startTime:GetContainerLog' :: GetContainerLog -> Maybe POSIX
$sel:pageToken:GetContainerLog' :: GetContainerLog -> Maybe Text
$sel:filterPattern:GetContainerLog' :: GetContainerLog -> Maybe Text
$sel:endTime:GetContainerLog' :: GetContainerLog -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
endTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
filterPattern
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
pageToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
startTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
serviceName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
containerName

instance Prelude.NFData GetContainerLog where
  rnf :: GetContainerLog -> ()
rnf GetContainerLog' {Maybe Text
Maybe POSIX
Text
containerName :: Text
serviceName :: Text
startTime :: Maybe POSIX
pageToken :: Maybe Text
filterPattern :: Maybe Text
endTime :: Maybe POSIX
$sel:containerName:GetContainerLog' :: GetContainerLog -> Text
$sel:serviceName:GetContainerLog' :: GetContainerLog -> Text
$sel:startTime:GetContainerLog' :: GetContainerLog -> Maybe POSIX
$sel:pageToken:GetContainerLog' :: GetContainerLog -> Maybe Text
$sel:filterPattern:GetContainerLog' :: GetContainerLog -> Maybe Text
$sel:endTime:GetContainerLog' :: GetContainerLog -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
endTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
filterPattern
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
pageToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
startTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
serviceName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
containerName

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

instance Data.ToJSON GetContainerLog where
  toJSON :: GetContainerLog -> Value
toJSON GetContainerLog' {Maybe Text
Maybe POSIX
Text
containerName :: Text
serviceName :: Text
startTime :: Maybe POSIX
pageToken :: Maybe Text
filterPattern :: Maybe Text
endTime :: Maybe POSIX
$sel:containerName:GetContainerLog' :: GetContainerLog -> Text
$sel:serviceName:GetContainerLog' :: GetContainerLog -> Text
$sel:startTime:GetContainerLog' :: GetContainerLog -> Maybe POSIX
$sel:pageToken:GetContainerLog' :: GetContainerLog -> Maybe Text
$sel:filterPattern:GetContainerLog' :: GetContainerLog -> Maybe Text
$sel:endTime:GetContainerLog' :: GetContainerLog -> Maybe POSIX
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"endTime" 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 POSIX
endTime,
            (Key
"filterPattern" 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 Text
filterPattern,
            (Key
"pageToken" 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 Text
pageToken,
            (Key
"startTime" 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 POSIX
startTime,
            forall a. a -> Maybe a
Prelude.Just (Key
"serviceName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
serviceName),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"containerName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
containerName)
          ]
      )

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

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

-- | /See:/ 'newGetContainerLogResponse' smart constructor.
data GetContainerLogResponse = GetContainerLogResponse'
  { -- | An array of objects that describe the log events of a container.
    GetContainerLogResponse -> Maybe [ContainerServiceLogEvent]
logEvents :: Prelude.Maybe [ContainerServiceLogEvent],
    -- | The token to advance to the next page of results from your request.
    --
    -- A next page token is not returned if there are no more results to
    -- display.
    --
    -- To get the next page of results, perform another @GetContainerLog@
    -- request and specify the next page token using the @pageToken@ parameter.
    GetContainerLogResponse -> Maybe Text
nextPageToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    GetContainerLogResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetContainerLogResponse -> GetContainerLogResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetContainerLogResponse -> GetContainerLogResponse -> Bool
$c/= :: GetContainerLogResponse -> GetContainerLogResponse -> Bool
== :: GetContainerLogResponse -> GetContainerLogResponse -> Bool
$c== :: GetContainerLogResponse -> GetContainerLogResponse -> Bool
Prelude.Eq, ReadPrec [GetContainerLogResponse]
ReadPrec GetContainerLogResponse
Int -> ReadS GetContainerLogResponse
ReadS [GetContainerLogResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetContainerLogResponse]
$creadListPrec :: ReadPrec [GetContainerLogResponse]
readPrec :: ReadPrec GetContainerLogResponse
$creadPrec :: ReadPrec GetContainerLogResponse
readList :: ReadS [GetContainerLogResponse]
$creadList :: ReadS [GetContainerLogResponse]
readsPrec :: Int -> ReadS GetContainerLogResponse
$creadsPrec :: Int -> ReadS GetContainerLogResponse
Prelude.Read, Int -> GetContainerLogResponse -> ShowS
[GetContainerLogResponse] -> ShowS
GetContainerLogResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetContainerLogResponse] -> ShowS
$cshowList :: [GetContainerLogResponse] -> ShowS
show :: GetContainerLogResponse -> String
$cshow :: GetContainerLogResponse -> String
showsPrec :: Int -> GetContainerLogResponse -> ShowS
$cshowsPrec :: Int -> GetContainerLogResponse -> ShowS
Prelude.Show, forall x. Rep GetContainerLogResponse x -> GetContainerLogResponse
forall x. GetContainerLogResponse -> Rep GetContainerLogResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetContainerLogResponse x -> GetContainerLogResponse
$cfrom :: forall x. GetContainerLogResponse -> Rep GetContainerLogResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetContainerLogResponse' 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:
--
-- 'logEvents', 'getContainerLogResponse_logEvents' - An array of objects that describe the log events of a container.
--
-- 'nextPageToken', 'getContainerLogResponse_nextPageToken' - The token to advance to the next page of results from your request.
--
-- A next page token is not returned if there are no more results to
-- display.
--
-- To get the next page of results, perform another @GetContainerLog@
-- request and specify the next page token using the @pageToken@ parameter.
--
-- 'httpStatus', 'getContainerLogResponse_httpStatus' - The response's http status code.
newGetContainerLogResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetContainerLogResponse
newGetContainerLogResponse :: Int -> GetContainerLogResponse
newGetContainerLogResponse Int
pHttpStatus_ =
  GetContainerLogResponse'
    { $sel:logEvents:GetContainerLogResponse' :: Maybe [ContainerServiceLogEvent]
logEvents =
        forall a. Maybe a
Prelude.Nothing,
      $sel:nextPageToken:GetContainerLogResponse' :: Maybe Text
nextPageToken = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetContainerLogResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An array of objects that describe the log events of a container.
getContainerLogResponse_logEvents :: Lens.Lens' GetContainerLogResponse (Prelude.Maybe [ContainerServiceLogEvent])
getContainerLogResponse_logEvents :: Lens' GetContainerLogResponse (Maybe [ContainerServiceLogEvent])
getContainerLogResponse_logEvents = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetContainerLogResponse' {Maybe [ContainerServiceLogEvent]
logEvents :: Maybe [ContainerServiceLogEvent]
$sel:logEvents:GetContainerLogResponse' :: GetContainerLogResponse -> Maybe [ContainerServiceLogEvent]
logEvents} -> Maybe [ContainerServiceLogEvent]
logEvents) (\s :: GetContainerLogResponse
s@GetContainerLogResponse' {} Maybe [ContainerServiceLogEvent]
a -> GetContainerLogResponse
s {$sel:logEvents:GetContainerLogResponse' :: Maybe [ContainerServiceLogEvent]
logEvents = Maybe [ContainerServiceLogEvent]
a} :: GetContainerLogResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The token to advance to the next page of results from your request.
--
-- A next page token is not returned if there are no more results to
-- display.
--
-- To get the next page of results, perform another @GetContainerLog@
-- request and specify the next page token using the @pageToken@ parameter.
getContainerLogResponse_nextPageToken :: Lens.Lens' GetContainerLogResponse (Prelude.Maybe Prelude.Text)
getContainerLogResponse_nextPageToken :: Lens' GetContainerLogResponse (Maybe Text)
getContainerLogResponse_nextPageToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetContainerLogResponse' {Maybe Text
nextPageToken :: Maybe Text
$sel:nextPageToken:GetContainerLogResponse' :: GetContainerLogResponse -> Maybe Text
nextPageToken} -> Maybe Text
nextPageToken) (\s :: GetContainerLogResponse
s@GetContainerLogResponse' {} Maybe Text
a -> GetContainerLogResponse
s {$sel:nextPageToken:GetContainerLogResponse' :: Maybe Text
nextPageToken = Maybe Text
a} :: GetContainerLogResponse)

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

instance Prelude.NFData GetContainerLogResponse where
  rnf :: GetContainerLogResponse -> ()
rnf GetContainerLogResponse' {Int
Maybe [ContainerServiceLogEvent]
Maybe Text
httpStatus :: Int
nextPageToken :: Maybe Text
logEvents :: Maybe [ContainerServiceLogEvent]
$sel:httpStatus:GetContainerLogResponse' :: GetContainerLogResponse -> Int
$sel:nextPageToken:GetContainerLogResponse' :: GetContainerLogResponse -> Maybe Text
$sel:logEvents:GetContainerLogResponse' :: GetContainerLogResponse -> Maybe [ContainerServiceLogEvent]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [ContainerServiceLogEvent]
logEvents
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextPageToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus