{-# 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.Route53Domains.ListOperations
-- 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 information about all of the operations that return an operation
-- ID and that have ever been performed on domains that were registered by
-- the current account.
--
-- This command runs only in the us-east-1 Region.
--
-- This operation returns paginated results.
module Amazonka.Route53Domains.ListOperations
  ( -- * Creating a Request
    ListOperations (..),
    newListOperations,

    -- * Request Lenses
    listOperations_marker,
    listOperations_maxItems,
    listOperations_sortBy,
    listOperations_sortOrder,
    listOperations_status,
    listOperations_submittedSince,
    listOperations_type,

    -- * Destructuring the Response
    ListOperationsResponse (..),
    newListOperationsResponse,

    -- * Response Lenses
    listOperationsResponse_nextPageMarker,
    listOperationsResponse_operations,
    listOperationsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.Route53Domains.Types

-- | The ListOperations request includes the following elements.
--
-- /See:/ 'newListOperations' smart constructor.
data ListOperations = ListOperations'
  { -- | For an initial request for a list of operations, omit this element. If
    -- the number of operations that are not yet complete is greater than the
    -- value that you specified for @MaxItems@, you can use @Marker@ to return
    -- additional operations. Get the value of @NextPageMarker@ from the
    -- previous response, and submit another request that includes the value of
    -- @NextPageMarker@ in the @Marker@ element.
    ListOperations -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | Number of domains to be returned.
    --
    -- Default: 20
    ListOperations -> Maybe Int
maxItems :: Prelude.Maybe Prelude.Int,
    -- | The sort type for returned values.
    ListOperations -> Maybe ListOperationsSortAttributeName
sortBy :: Prelude.Maybe ListOperationsSortAttributeName,
    -- | The sort order ofr returned values, either ascending or descending.
    ListOperations -> Maybe SortOrder
sortOrder :: Prelude.Maybe SortOrder,
    -- | The status of the operations.
    ListOperations -> Maybe [OperationStatus]
status :: Prelude.Maybe [OperationStatus],
    -- | An optional parameter that lets you get information about all the
    -- operations that you submitted after a specified date and time. Specify
    -- the date and time in Unix time format and Coordinated Universal time
    -- (UTC).
    ListOperations -> Maybe POSIX
submittedSince :: Prelude.Maybe Data.POSIX,
    -- | An arrays of the domains operation types.
    ListOperations -> Maybe [OperationType]
type' :: Prelude.Maybe [OperationType]
  }
  deriving (ListOperations -> ListOperations -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListOperations -> ListOperations -> Bool
$c/= :: ListOperations -> ListOperations -> Bool
== :: ListOperations -> ListOperations -> Bool
$c== :: ListOperations -> ListOperations -> Bool
Prelude.Eq, ReadPrec [ListOperations]
ReadPrec ListOperations
Int -> ReadS ListOperations
ReadS [ListOperations]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListOperations]
$creadListPrec :: ReadPrec [ListOperations]
readPrec :: ReadPrec ListOperations
$creadPrec :: ReadPrec ListOperations
readList :: ReadS [ListOperations]
$creadList :: ReadS [ListOperations]
readsPrec :: Int -> ReadS ListOperations
$creadsPrec :: Int -> ReadS ListOperations
Prelude.Read, Int -> ListOperations -> ShowS
[ListOperations] -> ShowS
ListOperations -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListOperations] -> ShowS
$cshowList :: [ListOperations] -> ShowS
show :: ListOperations -> String
$cshow :: ListOperations -> String
showsPrec :: Int -> ListOperations -> ShowS
$cshowsPrec :: Int -> ListOperations -> ShowS
Prelude.Show, forall x. Rep ListOperations x -> ListOperations
forall x. ListOperations -> Rep ListOperations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListOperations x -> ListOperations
$cfrom :: forall x. ListOperations -> Rep ListOperations x
Prelude.Generic)

-- |
-- Create a value of 'ListOperations' 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:
--
-- 'marker', 'listOperations_marker' - For an initial request for a list of operations, omit this element. If
-- the number of operations that are not yet complete is greater than the
-- value that you specified for @MaxItems@, you can use @Marker@ to return
-- additional operations. Get the value of @NextPageMarker@ from the
-- previous response, and submit another request that includes the value of
-- @NextPageMarker@ in the @Marker@ element.
--
-- 'maxItems', 'listOperations_maxItems' - Number of domains to be returned.
--
-- Default: 20
--
-- 'sortBy', 'listOperations_sortBy' - The sort type for returned values.
--
-- 'sortOrder', 'listOperations_sortOrder' - The sort order ofr returned values, either ascending or descending.
--
-- 'status', 'listOperations_status' - The status of the operations.
--
-- 'submittedSince', 'listOperations_submittedSince' - An optional parameter that lets you get information about all the
-- operations that you submitted after a specified date and time. Specify
-- the date and time in Unix time format and Coordinated Universal time
-- (UTC).
--
-- 'type'', 'listOperations_type' - An arrays of the domains operation types.
newListOperations ::
  ListOperations
newListOperations :: ListOperations
newListOperations =
  ListOperations'
    { $sel:marker:ListOperations' :: Maybe Text
marker = forall a. Maybe a
Prelude.Nothing,
      $sel:maxItems:ListOperations' :: Maybe Int
maxItems = forall a. Maybe a
Prelude.Nothing,
      $sel:sortBy:ListOperations' :: Maybe ListOperationsSortAttributeName
sortBy = forall a. Maybe a
Prelude.Nothing,
      $sel:sortOrder:ListOperations' :: Maybe SortOrder
sortOrder = forall a. Maybe a
Prelude.Nothing,
      $sel:status:ListOperations' :: Maybe [OperationStatus]
status = forall a. Maybe a
Prelude.Nothing,
      $sel:submittedSince:ListOperations' :: Maybe POSIX
submittedSince = forall a. Maybe a
Prelude.Nothing,
      $sel:type':ListOperations' :: Maybe [OperationType]
type' = forall a. Maybe a
Prelude.Nothing
    }

-- | For an initial request for a list of operations, omit this element. If
-- the number of operations that are not yet complete is greater than the
-- value that you specified for @MaxItems@, you can use @Marker@ to return
-- additional operations. Get the value of @NextPageMarker@ from the
-- previous response, and submit another request that includes the value of
-- @NextPageMarker@ in the @Marker@ element.
listOperations_marker :: Lens.Lens' ListOperations (Prelude.Maybe Prelude.Text)
listOperations_marker :: Lens' ListOperations (Maybe Text)
listOperations_marker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOperations' {Maybe Text
marker :: Maybe Text
$sel:marker:ListOperations' :: ListOperations -> Maybe Text
marker} -> Maybe Text
marker) (\s :: ListOperations
s@ListOperations' {} Maybe Text
a -> ListOperations
s {$sel:marker:ListOperations' :: Maybe Text
marker = Maybe Text
a} :: ListOperations)

-- | Number of domains to be returned.
--
-- Default: 20
listOperations_maxItems :: Lens.Lens' ListOperations (Prelude.Maybe Prelude.Int)
listOperations_maxItems :: Lens' ListOperations (Maybe Int)
listOperations_maxItems = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOperations' {Maybe Int
maxItems :: Maybe Int
$sel:maxItems:ListOperations' :: ListOperations -> Maybe Int
maxItems} -> Maybe Int
maxItems) (\s :: ListOperations
s@ListOperations' {} Maybe Int
a -> ListOperations
s {$sel:maxItems:ListOperations' :: Maybe Int
maxItems = Maybe Int
a} :: ListOperations)

-- | The sort type for returned values.
listOperations_sortBy :: Lens.Lens' ListOperations (Prelude.Maybe ListOperationsSortAttributeName)
listOperations_sortBy :: Lens' ListOperations (Maybe ListOperationsSortAttributeName)
listOperations_sortBy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOperations' {Maybe ListOperationsSortAttributeName
sortBy :: Maybe ListOperationsSortAttributeName
$sel:sortBy:ListOperations' :: ListOperations -> Maybe ListOperationsSortAttributeName
sortBy} -> Maybe ListOperationsSortAttributeName
sortBy) (\s :: ListOperations
s@ListOperations' {} Maybe ListOperationsSortAttributeName
a -> ListOperations
s {$sel:sortBy:ListOperations' :: Maybe ListOperationsSortAttributeName
sortBy = Maybe ListOperationsSortAttributeName
a} :: ListOperations)

-- | The sort order ofr returned values, either ascending or descending.
listOperations_sortOrder :: Lens.Lens' ListOperations (Prelude.Maybe SortOrder)
listOperations_sortOrder :: Lens' ListOperations (Maybe SortOrder)
listOperations_sortOrder = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOperations' {Maybe SortOrder
sortOrder :: Maybe SortOrder
$sel:sortOrder:ListOperations' :: ListOperations -> Maybe SortOrder
sortOrder} -> Maybe SortOrder
sortOrder) (\s :: ListOperations
s@ListOperations' {} Maybe SortOrder
a -> ListOperations
s {$sel:sortOrder:ListOperations' :: Maybe SortOrder
sortOrder = Maybe SortOrder
a} :: ListOperations)

-- | The status of the operations.
listOperations_status :: Lens.Lens' ListOperations (Prelude.Maybe [OperationStatus])
listOperations_status :: Lens' ListOperations (Maybe [OperationStatus])
listOperations_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOperations' {Maybe [OperationStatus]
status :: Maybe [OperationStatus]
$sel:status:ListOperations' :: ListOperations -> Maybe [OperationStatus]
status} -> Maybe [OperationStatus]
status) (\s :: ListOperations
s@ListOperations' {} Maybe [OperationStatus]
a -> ListOperations
s {$sel:status:ListOperations' :: Maybe [OperationStatus]
status = Maybe [OperationStatus]
a} :: ListOperations) 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

-- | An optional parameter that lets you get information about all the
-- operations that you submitted after a specified date and time. Specify
-- the date and time in Unix time format and Coordinated Universal time
-- (UTC).
listOperations_submittedSince :: Lens.Lens' ListOperations (Prelude.Maybe Prelude.UTCTime)
listOperations_submittedSince :: Lens' ListOperations (Maybe UTCTime)
listOperations_submittedSince = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOperations' {Maybe POSIX
submittedSince :: Maybe POSIX
$sel:submittedSince:ListOperations' :: ListOperations -> Maybe POSIX
submittedSince} -> Maybe POSIX
submittedSince) (\s :: ListOperations
s@ListOperations' {} Maybe POSIX
a -> ListOperations
s {$sel:submittedSince:ListOperations' :: Maybe POSIX
submittedSince = Maybe POSIX
a} :: ListOperations) 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

-- | An arrays of the domains operation types.
listOperations_type :: Lens.Lens' ListOperations (Prelude.Maybe [OperationType])
listOperations_type :: Lens' ListOperations (Maybe [OperationType])
listOperations_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOperations' {Maybe [OperationType]
type' :: Maybe [OperationType]
$sel:type':ListOperations' :: ListOperations -> Maybe [OperationType]
type'} -> Maybe [OperationType]
type') (\s :: ListOperations
s@ListOperations' {} Maybe [OperationType]
a -> ListOperations
s {$sel:type':ListOperations' :: Maybe [OperationType]
type' = Maybe [OperationType]
a} :: ListOperations) 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

instance Core.AWSPager ListOperations where
  page :: ListOperations
-> AWSResponse ListOperations -> Maybe ListOperations
page ListOperations
rq AWSResponse ListOperations
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListOperations
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListOperationsResponse (Maybe Text)
listOperationsResponse_nextPageMarker
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListOperations
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListOperationsResponse (Maybe [OperationSummary])
listOperationsResponse_operations
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ ListOperations
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListOperations (Maybe Text)
listOperations_marker
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListOperations
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListOperationsResponse (Maybe Text)
listOperationsResponse_nextPageMarker
          forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListOperations where
  type
    AWSResponse ListOperations =
      ListOperationsResponse
  request :: (Service -> Service) -> ListOperations -> Request ListOperations
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 ListOperations
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListOperations)))
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 Text
-> Maybe [OperationSummary] -> Int -> ListOperationsResponse
ListOperationsResponse'
            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
"NextPageMarker")
            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
"Operations" 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.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable ListOperations where
  hashWithSalt :: Int -> ListOperations -> Int
hashWithSalt Int
_salt ListOperations' {Maybe Int
Maybe [OperationStatus]
Maybe [OperationType]
Maybe Text
Maybe POSIX
Maybe ListOperationsSortAttributeName
Maybe SortOrder
type' :: Maybe [OperationType]
submittedSince :: Maybe POSIX
status :: Maybe [OperationStatus]
sortOrder :: Maybe SortOrder
sortBy :: Maybe ListOperationsSortAttributeName
maxItems :: Maybe Int
marker :: Maybe Text
$sel:type':ListOperations' :: ListOperations -> Maybe [OperationType]
$sel:submittedSince:ListOperations' :: ListOperations -> Maybe POSIX
$sel:status:ListOperations' :: ListOperations -> Maybe [OperationStatus]
$sel:sortOrder:ListOperations' :: ListOperations -> Maybe SortOrder
$sel:sortBy:ListOperations' :: ListOperations -> Maybe ListOperationsSortAttributeName
$sel:maxItems:ListOperations' :: ListOperations -> Maybe Int
$sel:marker:ListOperations' :: ListOperations -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
marker
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
maxItems
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ListOperationsSortAttributeName
sortBy
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SortOrder
sortOrder
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [OperationStatus]
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
submittedSince
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [OperationType]
type'

instance Prelude.NFData ListOperations where
  rnf :: ListOperations -> ()
rnf ListOperations' {Maybe Int
Maybe [OperationStatus]
Maybe [OperationType]
Maybe Text
Maybe POSIX
Maybe ListOperationsSortAttributeName
Maybe SortOrder
type' :: Maybe [OperationType]
submittedSince :: Maybe POSIX
status :: Maybe [OperationStatus]
sortOrder :: Maybe SortOrder
sortBy :: Maybe ListOperationsSortAttributeName
maxItems :: Maybe Int
marker :: Maybe Text
$sel:type':ListOperations' :: ListOperations -> Maybe [OperationType]
$sel:submittedSince:ListOperations' :: ListOperations -> Maybe POSIX
$sel:status:ListOperations' :: ListOperations -> Maybe [OperationStatus]
$sel:sortOrder:ListOperations' :: ListOperations -> Maybe SortOrder
$sel:sortBy:ListOperations' :: ListOperations -> Maybe ListOperationsSortAttributeName
$sel:maxItems:ListOperations' :: ListOperations -> Maybe Int
$sel:marker:ListOperations' :: ListOperations -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
marker
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
maxItems
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ListOperationsSortAttributeName
sortBy
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SortOrder
sortOrder
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [OperationStatus]
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
submittedSince
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [OperationType]
type'

instance Data.ToHeaders ListOperations where
  toHeaders :: ListOperations -> 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
"Route53Domains_v20140515.ListOperations" ::
                          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 ListOperations where
  toJSON :: ListOperations -> Value
toJSON ListOperations' {Maybe Int
Maybe [OperationStatus]
Maybe [OperationType]
Maybe Text
Maybe POSIX
Maybe ListOperationsSortAttributeName
Maybe SortOrder
type' :: Maybe [OperationType]
submittedSince :: Maybe POSIX
status :: Maybe [OperationStatus]
sortOrder :: Maybe SortOrder
sortBy :: Maybe ListOperationsSortAttributeName
maxItems :: Maybe Int
marker :: Maybe Text
$sel:type':ListOperations' :: ListOperations -> Maybe [OperationType]
$sel:submittedSince:ListOperations' :: ListOperations -> Maybe POSIX
$sel:status:ListOperations' :: ListOperations -> Maybe [OperationStatus]
$sel:sortOrder:ListOperations' :: ListOperations -> Maybe SortOrder
$sel:sortBy:ListOperations' :: ListOperations -> Maybe ListOperationsSortAttributeName
$sel:maxItems:ListOperations' :: ListOperations -> Maybe Int
$sel:marker:ListOperations' :: ListOperations -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"Marker" 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
marker,
            (Key
"MaxItems" 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 Int
maxItems,
            (Key
"SortBy" 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 ListOperationsSortAttributeName
sortBy,
            (Key
"SortOrder" 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 SortOrder
sortOrder,
            (Key
"Status" 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 [OperationStatus]
status,
            (Key
"SubmittedSince" 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
submittedSince,
            (Key
"Type" 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 [OperationType]
type'
          ]
      )

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

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

-- | The ListOperations response includes the following elements.
--
-- /See:/ 'newListOperationsResponse' smart constructor.
data ListOperationsResponse = ListOperationsResponse'
  { -- | If there are more operations than you specified for @MaxItems@ in the
    -- request, submit another request and include the value of
    -- @NextPageMarker@ in the value of @Marker@.
    ListOperationsResponse -> Maybe Text
nextPageMarker :: Prelude.Maybe Prelude.Text,
    -- | Lists summaries of the operations.
    ListOperationsResponse -> Maybe [OperationSummary]
operations :: Prelude.Maybe [OperationSummary],
    -- | The response's http status code.
    ListOperationsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListOperationsResponse -> ListOperationsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListOperationsResponse -> ListOperationsResponse -> Bool
$c/= :: ListOperationsResponse -> ListOperationsResponse -> Bool
== :: ListOperationsResponse -> ListOperationsResponse -> Bool
$c== :: ListOperationsResponse -> ListOperationsResponse -> Bool
Prelude.Eq, ReadPrec [ListOperationsResponse]
ReadPrec ListOperationsResponse
Int -> ReadS ListOperationsResponse
ReadS [ListOperationsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListOperationsResponse]
$creadListPrec :: ReadPrec [ListOperationsResponse]
readPrec :: ReadPrec ListOperationsResponse
$creadPrec :: ReadPrec ListOperationsResponse
readList :: ReadS [ListOperationsResponse]
$creadList :: ReadS [ListOperationsResponse]
readsPrec :: Int -> ReadS ListOperationsResponse
$creadsPrec :: Int -> ReadS ListOperationsResponse
Prelude.Read, Int -> ListOperationsResponse -> ShowS
[ListOperationsResponse] -> ShowS
ListOperationsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListOperationsResponse] -> ShowS
$cshowList :: [ListOperationsResponse] -> ShowS
show :: ListOperationsResponse -> String
$cshow :: ListOperationsResponse -> String
showsPrec :: Int -> ListOperationsResponse -> ShowS
$cshowsPrec :: Int -> ListOperationsResponse -> ShowS
Prelude.Show, forall x. Rep ListOperationsResponse x -> ListOperationsResponse
forall x. ListOperationsResponse -> Rep ListOperationsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListOperationsResponse x -> ListOperationsResponse
$cfrom :: forall x. ListOperationsResponse -> Rep ListOperationsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListOperationsResponse' 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:
--
-- 'nextPageMarker', 'listOperationsResponse_nextPageMarker' - If there are more operations than you specified for @MaxItems@ in the
-- request, submit another request and include the value of
-- @NextPageMarker@ in the value of @Marker@.
--
-- 'operations', 'listOperationsResponse_operations' - Lists summaries of the operations.
--
-- 'httpStatus', 'listOperationsResponse_httpStatus' - The response's http status code.
newListOperationsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListOperationsResponse
newListOperationsResponse :: Int -> ListOperationsResponse
newListOperationsResponse Int
pHttpStatus_ =
  ListOperationsResponse'
    { $sel:nextPageMarker:ListOperationsResponse' :: Maybe Text
nextPageMarker =
        forall a. Maybe a
Prelude.Nothing,
      $sel:operations:ListOperationsResponse' :: Maybe [OperationSummary]
operations = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListOperationsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | If there are more operations than you specified for @MaxItems@ in the
-- request, submit another request and include the value of
-- @NextPageMarker@ in the value of @Marker@.
listOperationsResponse_nextPageMarker :: Lens.Lens' ListOperationsResponse (Prelude.Maybe Prelude.Text)
listOperationsResponse_nextPageMarker :: Lens' ListOperationsResponse (Maybe Text)
listOperationsResponse_nextPageMarker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOperationsResponse' {Maybe Text
nextPageMarker :: Maybe Text
$sel:nextPageMarker:ListOperationsResponse' :: ListOperationsResponse -> Maybe Text
nextPageMarker} -> Maybe Text
nextPageMarker) (\s :: ListOperationsResponse
s@ListOperationsResponse' {} Maybe Text
a -> ListOperationsResponse
s {$sel:nextPageMarker:ListOperationsResponse' :: Maybe Text
nextPageMarker = Maybe Text
a} :: ListOperationsResponse)

-- | Lists summaries of the operations.
listOperationsResponse_operations :: Lens.Lens' ListOperationsResponse (Prelude.Maybe [OperationSummary])
listOperationsResponse_operations :: Lens' ListOperationsResponse (Maybe [OperationSummary])
listOperationsResponse_operations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOperationsResponse' {Maybe [OperationSummary]
operations :: Maybe [OperationSummary]
$sel:operations:ListOperationsResponse' :: ListOperationsResponse -> Maybe [OperationSummary]
operations} -> Maybe [OperationSummary]
operations) (\s :: ListOperationsResponse
s@ListOperationsResponse' {} Maybe [OperationSummary]
a -> ListOperationsResponse
s {$sel:operations:ListOperationsResponse' :: Maybe [OperationSummary]
operations = Maybe [OperationSummary]
a} :: ListOperationsResponse) 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 response's http status code.
listOperationsResponse_httpStatus :: Lens.Lens' ListOperationsResponse Prelude.Int
listOperationsResponse_httpStatus :: Lens' ListOperationsResponse Int
listOperationsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOperationsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListOperationsResponse' :: ListOperationsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListOperationsResponse
s@ListOperationsResponse' {} Int
a -> ListOperationsResponse
s {$sel:httpStatus:ListOperationsResponse' :: Int
httpStatus = Int
a} :: ListOperationsResponse)

instance Prelude.NFData ListOperationsResponse where
  rnf :: ListOperationsResponse -> ()
rnf ListOperationsResponse' {Int
Maybe [OperationSummary]
Maybe Text
httpStatus :: Int
operations :: Maybe [OperationSummary]
nextPageMarker :: Maybe Text
$sel:httpStatus:ListOperationsResponse' :: ListOperationsResponse -> Int
$sel:operations:ListOperationsResponse' :: ListOperationsResponse -> Maybe [OperationSummary]
$sel:nextPageMarker:ListOperationsResponse' :: ListOperationsResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextPageMarker
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [OperationSummary]
operations
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus