{-# 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.CloudDirectory.ListObjectAttributes
-- 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)
--
-- Lists all attributes that are associated with an object.
--
-- This operation returns paginated results.
module Amazonka.CloudDirectory.ListObjectAttributes
  ( -- * Creating a Request
    ListObjectAttributes (..),
    newListObjectAttributes,

    -- * Request Lenses
    listObjectAttributes_facetFilter,
    listObjectAttributes_consistencyLevel,
    listObjectAttributes_nextToken,
    listObjectAttributes_maxResults,
    listObjectAttributes_directoryArn,
    listObjectAttributes_objectReference,

    -- * Destructuring the Response
    ListObjectAttributesResponse (..),
    newListObjectAttributesResponse,

    -- * Response Lenses
    listObjectAttributesResponse_nextToken,
    listObjectAttributesResponse_attributes,
    listObjectAttributesResponse_httpStatus,
  )
where

import Amazonka.CloudDirectory.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:/ 'newListObjectAttributes' smart constructor.
data ListObjectAttributes = ListObjectAttributes'
  { -- | Used to filter the list of object attributes that are associated with a
    -- certain facet.
    ListObjectAttributes -> Maybe SchemaFacet
facetFilter :: Prelude.Maybe SchemaFacet,
    -- | Represents the manner and timing in which the successful write or update
    -- of an object is reflected in a subsequent read operation of that same
    -- object.
    ListObjectAttributes -> Maybe ConsistencyLevel
consistencyLevel :: Prelude.Maybe ConsistencyLevel,
    -- | The pagination token.
    ListObjectAttributes -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of items to be retrieved in a single call. This is an
    -- approximate number.
    ListObjectAttributes -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The Amazon Resource Name (ARN) that is associated with the Directory
    -- where the object resides. For more information, see arns.
    ListObjectAttributes -> Text
directoryArn :: Prelude.Text,
    -- | The reference that identifies the object whose attributes will be
    -- listed.
    ListObjectAttributes -> ObjectReference
objectReference :: ObjectReference
  }
  deriving (ListObjectAttributes -> ListObjectAttributes -> Bool
(ListObjectAttributes -> ListObjectAttributes -> Bool)
-> (ListObjectAttributes -> ListObjectAttributes -> Bool)
-> Eq ListObjectAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListObjectAttributes -> ListObjectAttributes -> Bool
$c/= :: ListObjectAttributes -> ListObjectAttributes -> Bool
== :: ListObjectAttributes -> ListObjectAttributes -> Bool
$c== :: ListObjectAttributes -> ListObjectAttributes -> Bool
Prelude.Eq, ReadPrec [ListObjectAttributes]
ReadPrec ListObjectAttributes
Int -> ReadS ListObjectAttributes
ReadS [ListObjectAttributes]
(Int -> ReadS ListObjectAttributes)
-> ReadS [ListObjectAttributes]
-> ReadPrec ListObjectAttributes
-> ReadPrec [ListObjectAttributes]
-> Read ListObjectAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListObjectAttributes]
$creadListPrec :: ReadPrec [ListObjectAttributes]
readPrec :: ReadPrec ListObjectAttributes
$creadPrec :: ReadPrec ListObjectAttributes
readList :: ReadS [ListObjectAttributes]
$creadList :: ReadS [ListObjectAttributes]
readsPrec :: Int -> ReadS ListObjectAttributes
$creadsPrec :: Int -> ReadS ListObjectAttributes
Prelude.Read, Int -> ListObjectAttributes -> ShowS
[ListObjectAttributes] -> ShowS
ListObjectAttributes -> String
(Int -> ListObjectAttributes -> ShowS)
-> (ListObjectAttributes -> String)
-> ([ListObjectAttributes] -> ShowS)
-> Show ListObjectAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListObjectAttributes] -> ShowS
$cshowList :: [ListObjectAttributes] -> ShowS
show :: ListObjectAttributes -> String
$cshow :: ListObjectAttributes -> String
showsPrec :: Int -> ListObjectAttributes -> ShowS
$cshowsPrec :: Int -> ListObjectAttributes -> ShowS
Prelude.Show, (forall x. ListObjectAttributes -> Rep ListObjectAttributes x)
-> (forall x. Rep ListObjectAttributes x -> ListObjectAttributes)
-> Generic ListObjectAttributes
forall x. Rep ListObjectAttributes x -> ListObjectAttributes
forall x. ListObjectAttributes -> Rep ListObjectAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListObjectAttributes x -> ListObjectAttributes
$cfrom :: forall x. ListObjectAttributes -> Rep ListObjectAttributes x
Prelude.Generic)

-- |
-- Create a value of 'ListObjectAttributes' 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:
--
-- 'facetFilter', 'listObjectAttributes_facetFilter' - Used to filter the list of object attributes that are associated with a
-- certain facet.
--
-- 'consistencyLevel', 'listObjectAttributes_consistencyLevel' - Represents the manner and timing in which the successful write or update
-- of an object is reflected in a subsequent read operation of that same
-- object.
--
-- 'nextToken', 'listObjectAttributes_nextToken' - The pagination token.
--
-- 'maxResults', 'listObjectAttributes_maxResults' - The maximum number of items to be retrieved in a single call. This is an
-- approximate number.
--
-- 'directoryArn', 'listObjectAttributes_directoryArn' - The Amazon Resource Name (ARN) that is associated with the Directory
-- where the object resides. For more information, see arns.
--
-- 'objectReference', 'listObjectAttributes_objectReference' - The reference that identifies the object whose attributes will be
-- listed.
newListObjectAttributes ::
  -- | 'directoryArn'
  Prelude.Text ->
  -- | 'objectReference'
  ObjectReference ->
  ListObjectAttributes
newListObjectAttributes :: Text -> ObjectReference -> ListObjectAttributes
newListObjectAttributes
  Text
pDirectoryArn_
  ObjectReference
pObjectReference_ =
    ListObjectAttributes' :: Maybe SchemaFacet
-> Maybe ConsistencyLevel
-> Maybe Text
-> Maybe Natural
-> Text
-> ObjectReference
-> ListObjectAttributes
ListObjectAttributes'
      { $sel:facetFilter:ListObjectAttributes' :: Maybe SchemaFacet
facetFilter =
          Maybe SchemaFacet
forall a. Maybe a
Prelude.Nothing,
        $sel:consistencyLevel:ListObjectAttributes' :: Maybe ConsistencyLevel
consistencyLevel = Maybe ConsistencyLevel
forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:ListObjectAttributes' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:maxResults:ListObjectAttributes' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
        $sel:directoryArn:ListObjectAttributes' :: Text
directoryArn = Text
pDirectoryArn_,
        $sel:objectReference:ListObjectAttributes' :: ObjectReference
objectReference = ObjectReference
pObjectReference_
      }

-- | Used to filter the list of object attributes that are associated with a
-- certain facet.
listObjectAttributes_facetFilter :: Lens.Lens' ListObjectAttributes (Prelude.Maybe SchemaFacet)
listObjectAttributes_facetFilter :: (Maybe SchemaFacet -> f (Maybe SchemaFacet))
-> ListObjectAttributes -> f ListObjectAttributes
listObjectAttributes_facetFilter = (ListObjectAttributes -> Maybe SchemaFacet)
-> (ListObjectAttributes
    -> Maybe SchemaFacet -> ListObjectAttributes)
-> Lens
     ListObjectAttributes
     ListObjectAttributes
     (Maybe SchemaFacet)
     (Maybe SchemaFacet)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectAttributes' {Maybe SchemaFacet
facetFilter :: Maybe SchemaFacet
$sel:facetFilter:ListObjectAttributes' :: ListObjectAttributes -> Maybe SchemaFacet
facetFilter} -> Maybe SchemaFacet
facetFilter) (\s :: ListObjectAttributes
s@ListObjectAttributes' {} Maybe SchemaFacet
a -> ListObjectAttributes
s {$sel:facetFilter:ListObjectAttributes' :: Maybe SchemaFacet
facetFilter = Maybe SchemaFacet
a} :: ListObjectAttributes)

-- | Represents the manner and timing in which the successful write or update
-- of an object is reflected in a subsequent read operation of that same
-- object.
listObjectAttributes_consistencyLevel :: Lens.Lens' ListObjectAttributes (Prelude.Maybe ConsistencyLevel)
listObjectAttributes_consistencyLevel :: (Maybe ConsistencyLevel -> f (Maybe ConsistencyLevel))
-> ListObjectAttributes -> f ListObjectAttributes
listObjectAttributes_consistencyLevel = (ListObjectAttributes -> Maybe ConsistencyLevel)
-> (ListObjectAttributes
    -> Maybe ConsistencyLevel -> ListObjectAttributes)
-> Lens
     ListObjectAttributes
     ListObjectAttributes
     (Maybe ConsistencyLevel)
     (Maybe ConsistencyLevel)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectAttributes' {Maybe ConsistencyLevel
consistencyLevel :: Maybe ConsistencyLevel
$sel:consistencyLevel:ListObjectAttributes' :: ListObjectAttributes -> Maybe ConsistencyLevel
consistencyLevel} -> Maybe ConsistencyLevel
consistencyLevel) (\s :: ListObjectAttributes
s@ListObjectAttributes' {} Maybe ConsistencyLevel
a -> ListObjectAttributes
s {$sel:consistencyLevel:ListObjectAttributes' :: Maybe ConsistencyLevel
consistencyLevel = Maybe ConsistencyLevel
a} :: ListObjectAttributes)

-- | The pagination token.
listObjectAttributes_nextToken :: Lens.Lens' ListObjectAttributes (Prelude.Maybe Prelude.Text)
listObjectAttributes_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListObjectAttributes -> f ListObjectAttributes
listObjectAttributes_nextToken = (ListObjectAttributes -> Maybe Text)
-> (ListObjectAttributes -> Maybe Text -> ListObjectAttributes)
-> Lens
     ListObjectAttributes ListObjectAttributes (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectAttributes' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListObjectAttributes' :: ListObjectAttributes -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListObjectAttributes
s@ListObjectAttributes' {} Maybe Text
a -> ListObjectAttributes
s {$sel:nextToken:ListObjectAttributes' :: Maybe Text
nextToken = Maybe Text
a} :: ListObjectAttributes)

-- | The maximum number of items to be retrieved in a single call. This is an
-- approximate number.
listObjectAttributes_maxResults :: Lens.Lens' ListObjectAttributes (Prelude.Maybe Prelude.Natural)
listObjectAttributes_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListObjectAttributes -> f ListObjectAttributes
listObjectAttributes_maxResults = (ListObjectAttributes -> Maybe Natural)
-> (ListObjectAttributes -> Maybe Natural -> ListObjectAttributes)
-> Lens
     ListObjectAttributes
     ListObjectAttributes
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectAttributes' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListObjectAttributes' :: ListObjectAttributes -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListObjectAttributes
s@ListObjectAttributes' {} Maybe Natural
a -> ListObjectAttributes
s {$sel:maxResults:ListObjectAttributes' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListObjectAttributes)

-- | The Amazon Resource Name (ARN) that is associated with the Directory
-- where the object resides. For more information, see arns.
listObjectAttributes_directoryArn :: Lens.Lens' ListObjectAttributes Prelude.Text
listObjectAttributes_directoryArn :: (Text -> f Text) -> ListObjectAttributes -> f ListObjectAttributes
listObjectAttributes_directoryArn = (ListObjectAttributes -> Text)
-> (ListObjectAttributes -> Text -> ListObjectAttributes)
-> Lens ListObjectAttributes ListObjectAttributes Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectAttributes' {Text
directoryArn :: Text
$sel:directoryArn:ListObjectAttributes' :: ListObjectAttributes -> Text
directoryArn} -> Text
directoryArn) (\s :: ListObjectAttributes
s@ListObjectAttributes' {} Text
a -> ListObjectAttributes
s {$sel:directoryArn:ListObjectAttributes' :: Text
directoryArn = Text
a} :: ListObjectAttributes)

-- | The reference that identifies the object whose attributes will be
-- listed.
listObjectAttributes_objectReference :: Lens.Lens' ListObjectAttributes ObjectReference
listObjectAttributes_objectReference :: (ObjectReference -> f ObjectReference)
-> ListObjectAttributes -> f ListObjectAttributes
listObjectAttributes_objectReference = (ListObjectAttributes -> ObjectReference)
-> (ListObjectAttributes
    -> ObjectReference -> ListObjectAttributes)
-> Lens
     ListObjectAttributes
     ListObjectAttributes
     ObjectReference
     ObjectReference
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectAttributes' {ObjectReference
objectReference :: ObjectReference
$sel:objectReference:ListObjectAttributes' :: ListObjectAttributes -> ObjectReference
objectReference} -> ObjectReference
objectReference) (\s :: ListObjectAttributes
s@ListObjectAttributes' {} ObjectReference
a -> ListObjectAttributes
s {$sel:objectReference:ListObjectAttributes' :: ObjectReference
objectReference = ObjectReference
a} :: ListObjectAttributes)

instance Core.AWSPager ListObjectAttributes where
  page :: ListObjectAttributes
-> AWSResponse ListObjectAttributes -> Maybe ListObjectAttributes
page ListObjectAttributes
rq AWSResponse ListObjectAttributes
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListObjectAttributes
ListObjectAttributesResponse
rs
            ListObjectAttributesResponse
-> Getting (First Text) ListObjectAttributesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListObjectAttributesResponse
-> Const (First Text) ListObjectAttributesResponse
Lens' ListObjectAttributesResponse (Maybe Text)
listObjectAttributesResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListObjectAttributesResponse
 -> Const (First Text) ListObjectAttributesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListObjectAttributesResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListObjectAttributes
forall a. Maybe a
Prelude.Nothing
    | Maybe [AttributeKeyAndValue] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListObjectAttributes
ListObjectAttributesResponse
rs
            ListObjectAttributesResponse
-> Getting
     (First [AttributeKeyAndValue])
     ListObjectAttributesResponse
     [AttributeKeyAndValue]
-> Maybe [AttributeKeyAndValue]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [AttributeKeyAndValue]
 -> Const
      (First [AttributeKeyAndValue]) (Maybe [AttributeKeyAndValue]))
-> ListObjectAttributesResponse
-> Const
     (First [AttributeKeyAndValue]) ListObjectAttributesResponse
Lens' ListObjectAttributesResponse (Maybe [AttributeKeyAndValue])
listObjectAttributesResponse_attributes
              ((Maybe [AttributeKeyAndValue]
  -> Const
       (First [AttributeKeyAndValue]) (Maybe [AttributeKeyAndValue]))
 -> ListObjectAttributesResponse
 -> Const
      (First [AttributeKeyAndValue]) ListObjectAttributesResponse)
-> (([AttributeKeyAndValue]
     -> Const (First [AttributeKeyAndValue]) [AttributeKeyAndValue])
    -> Maybe [AttributeKeyAndValue]
    -> Const
         (First [AttributeKeyAndValue]) (Maybe [AttributeKeyAndValue]))
-> Getting
     (First [AttributeKeyAndValue])
     ListObjectAttributesResponse
     [AttributeKeyAndValue]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([AttributeKeyAndValue]
 -> Const (First [AttributeKeyAndValue]) [AttributeKeyAndValue])
-> Maybe [AttributeKeyAndValue]
-> Const
     (First [AttributeKeyAndValue]) (Maybe [AttributeKeyAndValue])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListObjectAttributes
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListObjectAttributes -> Maybe ListObjectAttributes
forall a. a -> Maybe a
Prelude.Just (ListObjectAttributes -> Maybe ListObjectAttributes)
-> ListObjectAttributes -> Maybe ListObjectAttributes
forall a b. (a -> b) -> a -> b
Prelude.$
        ListObjectAttributes
rq
          ListObjectAttributes
-> (ListObjectAttributes -> ListObjectAttributes)
-> ListObjectAttributes
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListObjectAttributes -> Identity ListObjectAttributes
Lens
  ListObjectAttributes ListObjectAttributes (Maybe Text) (Maybe Text)
listObjectAttributes_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListObjectAttributes -> Identity ListObjectAttributes)
-> Maybe Text -> ListObjectAttributes -> ListObjectAttributes
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListObjectAttributes
ListObjectAttributesResponse
rs
          ListObjectAttributesResponse
-> Getting (First Text) ListObjectAttributesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListObjectAttributesResponse
-> Const (First Text) ListObjectAttributesResponse
Lens' ListObjectAttributesResponse (Maybe Text)
listObjectAttributesResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListObjectAttributesResponse
 -> Const (First Text) ListObjectAttributesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListObjectAttributesResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListObjectAttributes where
  type
    AWSResponse ListObjectAttributes =
      ListObjectAttributesResponse
  request :: ListObjectAttributes -> Request ListObjectAttributes
request = Service -> ListObjectAttributes -> Request ListObjectAttributes
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListObjectAttributes
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListObjectAttributes)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListObjectAttributes))
-> Logger
-> Service
-> Proxy ListObjectAttributes
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListObjectAttributes)))
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 Text
-> Maybe [AttributeKeyAndValue]
-> Int
-> ListObjectAttributesResponse
ListObjectAttributesResponse'
            (Maybe Text
 -> Maybe [AttributeKeyAndValue]
 -> Int
 -> ListObjectAttributesResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [AttributeKeyAndValue]
      -> Int -> ListObjectAttributesResponse)
forall (f :: * -> *) a b. Functor 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
"NextToken")
            Either
  String
  (Maybe [AttributeKeyAndValue]
   -> Int -> ListObjectAttributesResponse)
-> Either String (Maybe [AttributeKeyAndValue])
-> Either String (Int -> ListObjectAttributesResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Either String (Maybe (Maybe [AttributeKeyAndValue]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Attributes" Either String (Maybe (Maybe [AttributeKeyAndValue]))
-> Maybe [AttributeKeyAndValue]
-> Either String (Maybe [AttributeKeyAndValue])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [AttributeKeyAndValue]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Int -> ListObjectAttributesResponse)
-> Either String Int -> Either String ListObjectAttributesResponse
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 ListObjectAttributes

instance Prelude.NFData ListObjectAttributes

instance Core.ToHeaders ListObjectAttributes where
  toHeaders :: ListObjectAttributes -> ResponseHeaders
toHeaders ListObjectAttributes' {Maybe Natural
Maybe Text
Maybe ConsistencyLevel
Maybe SchemaFacet
Text
ObjectReference
objectReference :: ObjectReference
directoryArn :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
consistencyLevel :: Maybe ConsistencyLevel
facetFilter :: Maybe SchemaFacet
$sel:objectReference:ListObjectAttributes' :: ListObjectAttributes -> ObjectReference
$sel:directoryArn:ListObjectAttributes' :: ListObjectAttributes -> Text
$sel:maxResults:ListObjectAttributes' :: ListObjectAttributes -> Maybe Natural
$sel:nextToken:ListObjectAttributes' :: ListObjectAttributes -> Maybe Text
$sel:consistencyLevel:ListObjectAttributes' :: ListObjectAttributes -> Maybe ConsistencyLevel
$sel:facetFilter:ListObjectAttributes' :: ListObjectAttributes -> Maybe SchemaFacet
..} =
    [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ HeaderName
"x-amz-consistency-level" HeaderName -> Maybe ConsistencyLevel -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe ConsistencyLevel
consistencyLevel,
        HeaderName
"x-amz-data-partition" HeaderName -> Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Text
directoryArn
      ]

instance Core.ToJSON ListObjectAttributes where
  toJSON :: ListObjectAttributes -> Value
toJSON ListObjectAttributes' {Maybe Natural
Maybe Text
Maybe ConsistencyLevel
Maybe SchemaFacet
Text
ObjectReference
objectReference :: ObjectReference
directoryArn :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
consistencyLevel :: Maybe ConsistencyLevel
facetFilter :: Maybe SchemaFacet
$sel:objectReference:ListObjectAttributes' :: ListObjectAttributes -> ObjectReference
$sel:directoryArn:ListObjectAttributes' :: ListObjectAttributes -> Text
$sel:maxResults:ListObjectAttributes' :: ListObjectAttributes -> Maybe Natural
$sel:nextToken:ListObjectAttributes' :: ListObjectAttributes -> Maybe Text
$sel:consistencyLevel:ListObjectAttributes' :: ListObjectAttributes -> Maybe ConsistencyLevel
$sel:facetFilter:ListObjectAttributes' :: ListObjectAttributes -> Maybe SchemaFacet
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"FacetFilter" Text -> SchemaFacet -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SchemaFacet -> Pair) -> Maybe SchemaFacet -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SchemaFacet
facetFilter,
            (Text
"NextToken" 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
nextToken,
            (Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ObjectReference" Text -> ObjectReference -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ObjectReference
objectReference)
          ]
      )

instance Core.ToPath ListObjectAttributes where
  toPath :: ListObjectAttributes -> ByteString
toPath =
    ByteString -> ListObjectAttributes -> ByteString
forall a b. a -> b -> a
Prelude.const
      ByteString
"/amazonclouddirectory/2017-01-11/object/attributes"

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

-- | /See:/ 'newListObjectAttributesResponse' smart constructor.
data ListObjectAttributesResponse = ListObjectAttributesResponse'
  { -- | The pagination token.
    ListObjectAttributesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Attributes map that is associated with the object. @AttributeArn@ is the
    -- key, and attribute value is the value.
    ListObjectAttributesResponse -> Maybe [AttributeKeyAndValue]
attributes :: Prelude.Maybe [AttributeKeyAndValue],
    -- | The response's http status code.
    ListObjectAttributesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListObjectAttributesResponse
-> ListObjectAttributesResponse -> Bool
(ListObjectAttributesResponse
 -> ListObjectAttributesResponse -> Bool)
-> (ListObjectAttributesResponse
    -> ListObjectAttributesResponse -> Bool)
-> Eq ListObjectAttributesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListObjectAttributesResponse
-> ListObjectAttributesResponse -> Bool
$c/= :: ListObjectAttributesResponse
-> ListObjectAttributesResponse -> Bool
== :: ListObjectAttributesResponse
-> ListObjectAttributesResponse -> Bool
$c== :: ListObjectAttributesResponse
-> ListObjectAttributesResponse -> Bool
Prelude.Eq, ReadPrec [ListObjectAttributesResponse]
ReadPrec ListObjectAttributesResponse
Int -> ReadS ListObjectAttributesResponse
ReadS [ListObjectAttributesResponse]
(Int -> ReadS ListObjectAttributesResponse)
-> ReadS [ListObjectAttributesResponse]
-> ReadPrec ListObjectAttributesResponse
-> ReadPrec [ListObjectAttributesResponse]
-> Read ListObjectAttributesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListObjectAttributesResponse]
$creadListPrec :: ReadPrec [ListObjectAttributesResponse]
readPrec :: ReadPrec ListObjectAttributesResponse
$creadPrec :: ReadPrec ListObjectAttributesResponse
readList :: ReadS [ListObjectAttributesResponse]
$creadList :: ReadS [ListObjectAttributesResponse]
readsPrec :: Int -> ReadS ListObjectAttributesResponse
$creadsPrec :: Int -> ReadS ListObjectAttributesResponse
Prelude.Read, Int -> ListObjectAttributesResponse -> ShowS
[ListObjectAttributesResponse] -> ShowS
ListObjectAttributesResponse -> String
(Int -> ListObjectAttributesResponse -> ShowS)
-> (ListObjectAttributesResponse -> String)
-> ([ListObjectAttributesResponse] -> ShowS)
-> Show ListObjectAttributesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListObjectAttributesResponse] -> ShowS
$cshowList :: [ListObjectAttributesResponse] -> ShowS
show :: ListObjectAttributesResponse -> String
$cshow :: ListObjectAttributesResponse -> String
showsPrec :: Int -> ListObjectAttributesResponse -> ShowS
$cshowsPrec :: Int -> ListObjectAttributesResponse -> ShowS
Prelude.Show, (forall x.
 ListObjectAttributesResponse -> Rep ListObjectAttributesResponse x)
-> (forall x.
    Rep ListObjectAttributesResponse x -> ListObjectAttributesResponse)
-> Generic ListObjectAttributesResponse
forall x.
Rep ListObjectAttributesResponse x -> ListObjectAttributesResponse
forall x.
ListObjectAttributesResponse -> Rep ListObjectAttributesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListObjectAttributesResponse x -> ListObjectAttributesResponse
$cfrom :: forall x.
ListObjectAttributesResponse -> Rep ListObjectAttributesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListObjectAttributesResponse' 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:
--
-- 'nextToken', 'listObjectAttributesResponse_nextToken' - The pagination token.
--
-- 'attributes', 'listObjectAttributesResponse_attributes' - Attributes map that is associated with the object. @AttributeArn@ is the
-- key, and attribute value is the value.
--
-- 'httpStatus', 'listObjectAttributesResponse_httpStatus' - The response's http status code.
newListObjectAttributesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListObjectAttributesResponse
newListObjectAttributesResponse :: Int -> ListObjectAttributesResponse
newListObjectAttributesResponse Int
pHttpStatus_ =
  ListObjectAttributesResponse' :: Maybe Text
-> Maybe [AttributeKeyAndValue]
-> Int
-> ListObjectAttributesResponse
ListObjectAttributesResponse'
    { $sel:nextToken:ListObjectAttributesResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:attributes:ListObjectAttributesResponse' :: Maybe [AttributeKeyAndValue]
attributes = Maybe [AttributeKeyAndValue]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListObjectAttributesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The pagination token.
listObjectAttributesResponse_nextToken :: Lens.Lens' ListObjectAttributesResponse (Prelude.Maybe Prelude.Text)
listObjectAttributesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListObjectAttributesResponse -> f ListObjectAttributesResponse
listObjectAttributesResponse_nextToken = (ListObjectAttributesResponse -> Maybe Text)
-> (ListObjectAttributesResponse
    -> Maybe Text -> ListObjectAttributesResponse)
-> Lens' ListObjectAttributesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectAttributesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListObjectAttributesResponse' :: ListObjectAttributesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListObjectAttributesResponse
s@ListObjectAttributesResponse' {} Maybe Text
a -> ListObjectAttributesResponse
s {$sel:nextToken:ListObjectAttributesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListObjectAttributesResponse)

-- | Attributes map that is associated with the object. @AttributeArn@ is the
-- key, and attribute value is the value.
listObjectAttributesResponse_attributes :: Lens.Lens' ListObjectAttributesResponse (Prelude.Maybe [AttributeKeyAndValue])
listObjectAttributesResponse_attributes :: (Maybe [AttributeKeyAndValue] -> f (Maybe [AttributeKeyAndValue]))
-> ListObjectAttributesResponse -> f ListObjectAttributesResponse
listObjectAttributesResponse_attributes = (ListObjectAttributesResponse -> Maybe [AttributeKeyAndValue])
-> (ListObjectAttributesResponse
    -> Maybe [AttributeKeyAndValue] -> ListObjectAttributesResponse)
-> Lens'
     ListObjectAttributesResponse (Maybe [AttributeKeyAndValue])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListObjectAttributesResponse' {Maybe [AttributeKeyAndValue]
attributes :: Maybe [AttributeKeyAndValue]
$sel:attributes:ListObjectAttributesResponse' :: ListObjectAttributesResponse -> Maybe [AttributeKeyAndValue]
attributes} -> Maybe [AttributeKeyAndValue]
attributes) (\s :: ListObjectAttributesResponse
s@ListObjectAttributesResponse' {} Maybe [AttributeKeyAndValue]
a -> ListObjectAttributesResponse
s {$sel:attributes:ListObjectAttributesResponse' :: Maybe [AttributeKeyAndValue]
attributes = Maybe [AttributeKeyAndValue]
a} :: ListObjectAttributesResponse) ((Maybe [AttributeKeyAndValue] -> f (Maybe [AttributeKeyAndValue]))
 -> ListObjectAttributesResponse -> f ListObjectAttributesResponse)
-> ((Maybe [AttributeKeyAndValue]
     -> f (Maybe [AttributeKeyAndValue]))
    -> Maybe [AttributeKeyAndValue]
    -> f (Maybe [AttributeKeyAndValue]))
-> (Maybe [AttributeKeyAndValue]
    -> f (Maybe [AttributeKeyAndValue]))
-> ListObjectAttributesResponse
-> f ListObjectAttributesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AttributeKeyAndValue]
  [AttributeKeyAndValue]
  [AttributeKeyAndValue]
  [AttributeKeyAndValue]
-> Iso
     (Maybe [AttributeKeyAndValue])
     (Maybe [AttributeKeyAndValue])
     (Maybe [AttributeKeyAndValue])
     (Maybe [AttributeKeyAndValue])
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 AnIso
  [AttributeKeyAndValue]
  [AttributeKeyAndValue]
  [AttributeKeyAndValue]
  [AttributeKeyAndValue]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData ListObjectAttributesResponse