{-# 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.SSM.DescribeDocumentPermission
-- 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)
--
-- Describes the permissions for a Amazon Web Services Systems Manager
-- document (SSM document). If you created the document, you are the owner.
-- If a document is shared, it can either be shared privately (by
-- specifying a user\'s Amazon Web Services account ID) or publicly
-- (/All/).
module Amazonka.SSM.DescribeDocumentPermission
  ( -- * Creating a Request
    DescribeDocumentPermission (..),
    newDescribeDocumentPermission,

    -- * Request Lenses
    describeDocumentPermission_nextToken,
    describeDocumentPermission_maxResults,
    describeDocumentPermission_name,
    describeDocumentPermission_permissionType,

    -- * Destructuring the Response
    DescribeDocumentPermissionResponse (..),
    newDescribeDocumentPermissionResponse,

    -- * Response Lenses
    describeDocumentPermissionResponse_accountIds,
    describeDocumentPermissionResponse_accountSharingInfoList,
    describeDocumentPermissionResponse_nextToken,
    describeDocumentPermissionResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDescribeDocumentPermission' smart constructor.
data DescribeDocumentPermission = DescribeDocumentPermission'
  { -- | The token for the next set of items to return. (You received this token
    -- from a previous call.)
    DescribeDocumentPermission -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of items to return for this call. The call also
    -- returns a token that you can specify in a subsequent call to get the
    -- next set of results.
    DescribeDocumentPermission -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The name of the document for which you are the owner.
    DescribeDocumentPermission -> Text
name :: Prelude.Text,
    -- | The permission type for the document. The permission type can be
    -- /Share/.
    DescribeDocumentPermission -> DocumentPermissionType
permissionType :: DocumentPermissionType
  }
  deriving (DescribeDocumentPermission -> DescribeDocumentPermission -> Bool
(DescribeDocumentPermission -> DescribeDocumentPermission -> Bool)
-> (DescribeDocumentPermission
    -> DescribeDocumentPermission -> Bool)
-> Eq DescribeDocumentPermission
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeDocumentPermission -> DescribeDocumentPermission -> Bool
$c/= :: DescribeDocumentPermission -> DescribeDocumentPermission -> Bool
== :: DescribeDocumentPermission -> DescribeDocumentPermission -> Bool
$c== :: DescribeDocumentPermission -> DescribeDocumentPermission -> Bool
Prelude.Eq, ReadPrec [DescribeDocumentPermission]
ReadPrec DescribeDocumentPermission
Int -> ReadS DescribeDocumentPermission
ReadS [DescribeDocumentPermission]
(Int -> ReadS DescribeDocumentPermission)
-> ReadS [DescribeDocumentPermission]
-> ReadPrec DescribeDocumentPermission
-> ReadPrec [DescribeDocumentPermission]
-> Read DescribeDocumentPermission
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeDocumentPermission]
$creadListPrec :: ReadPrec [DescribeDocumentPermission]
readPrec :: ReadPrec DescribeDocumentPermission
$creadPrec :: ReadPrec DescribeDocumentPermission
readList :: ReadS [DescribeDocumentPermission]
$creadList :: ReadS [DescribeDocumentPermission]
readsPrec :: Int -> ReadS DescribeDocumentPermission
$creadsPrec :: Int -> ReadS DescribeDocumentPermission
Prelude.Read, Int -> DescribeDocumentPermission -> ShowS
[DescribeDocumentPermission] -> ShowS
DescribeDocumentPermission -> String
(Int -> DescribeDocumentPermission -> ShowS)
-> (DescribeDocumentPermission -> String)
-> ([DescribeDocumentPermission] -> ShowS)
-> Show DescribeDocumentPermission
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeDocumentPermission] -> ShowS
$cshowList :: [DescribeDocumentPermission] -> ShowS
show :: DescribeDocumentPermission -> String
$cshow :: DescribeDocumentPermission -> String
showsPrec :: Int -> DescribeDocumentPermission -> ShowS
$cshowsPrec :: Int -> DescribeDocumentPermission -> ShowS
Prelude.Show, (forall x.
 DescribeDocumentPermission -> Rep DescribeDocumentPermission x)
-> (forall x.
    Rep DescribeDocumentPermission x -> DescribeDocumentPermission)
-> Generic DescribeDocumentPermission
forall x.
Rep DescribeDocumentPermission x -> DescribeDocumentPermission
forall x.
DescribeDocumentPermission -> Rep DescribeDocumentPermission x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeDocumentPermission x -> DescribeDocumentPermission
$cfrom :: forall x.
DescribeDocumentPermission -> Rep DescribeDocumentPermission x
Prelude.Generic)

-- |
-- Create a value of 'DescribeDocumentPermission' 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', 'describeDocumentPermission_nextToken' - The token for the next set of items to return. (You received this token
-- from a previous call.)
--
-- 'maxResults', 'describeDocumentPermission_maxResults' - The maximum number of items to return for this call. The call also
-- returns a token that you can specify in a subsequent call to get the
-- next set of results.
--
-- 'name', 'describeDocumentPermission_name' - The name of the document for which you are the owner.
--
-- 'permissionType', 'describeDocumentPermission_permissionType' - The permission type for the document. The permission type can be
-- /Share/.
newDescribeDocumentPermission ::
  -- | 'name'
  Prelude.Text ->
  -- | 'permissionType'
  DocumentPermissionType ->
  DescribeDocumentPermission
newDescribeDocumentPermission :: Text -> DocumentPermissionType -> DescribeDocumentPermission
newDescribeDocumentPermission Text
pName_ DocumentPermissionType
pPermissionType_ =
  DescribeDocumentPermission' :: Maybe Text
-> Maybe Natural
-> Text
-> DocumentPermissionType
-> DescribeDocumentPermission
DescribeDocumentPermission'
    { $sel:nextToken:DescribeDocumentPermission' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeDocumentPermission' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:name:DescribeDocumentPermission' :: Text
name = Text
pName_,
      $sel:permissionType:DescribeDocumentPermission' :: DocumentPermissionType
permissionType = DocumentPermissionType
pPermissionType_
    }

-- | The token for the next set of items to return. (You received this token
-- from a previous call.)
describeDocumentPermission_nextToken :: Lens.Lens' DescribeDocumentPermission (Prelude.Maybe Prelude.Text)
describeDocumentPermission_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeDocumentPermission -> f DescribeDocumentPermission
describeDocumentPermission_nextToken = (DescribeDocumentPermission -> Maybe Text)
-> (DescribeDocumentPermission
    -> Maybe Text -> DescribeDocumentPermission)
-> Lens
     DescribeDocumentPermission
     DescribeDocumentPermission
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDocumentPermission' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeDocumentPermission' :: DescribeDocumentPermission -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeDocumentPermission
s@DescribeDocumentPermission' {} Maybe Text
a -> DescribeDocumentPermission
s {$sel:nextToken:DescribeDocumentPermission' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeDocumentPermission)

-- | The maximum number of items to return for this call. The call also
-- returns a token that you can specify in a subsequent call to get the
-- next set of results.
describeDocumentPermission_maxResults :: Lens.Lens' DescribeDocumentPermission (Prelude.Maybe Prelude.Natural)
describeDocumentPermission_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> DescribeDocumentPermission -> f DescribeDocumentPermission
describeDocumentPermission_maxResults = (DescribeDocumentPermission -> Maybe Natural)
-> (DescribeDocumentPermission
    -> Maybe Natural -> DescribeDocumentPermission)
-> Lens
     DescribeDocumentPermission
     DescribeDocumentPermission
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDocumentPermission' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:DescribeDocumentPermission' :: DescribeDocumentPermission -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: DescribeDocumentPermission
s@DescribeDocumentPermission' {} Maybe Natural
a -> DescribeDocumentPermission
s {$sel:maxResults:DescribeDocumentPermission' :: Maybe Natural
maxResults = Maybe Natural
a} :: DescribeDocumentPermission)

-- | The name of the document for which you are the owner.
describeDocumentPermission_name :: Lens.Lens' DescribeDocumentPermission Prelude.Text
describeDocumentPermission_name :: (Text -> f Text)
-> DescribeDocumentPermission -> f DescribeDocumentPermission
describeDocumentPermission_name = (DescribeDocumentPermission -> Text)
-> (DescribeDocumentPermission
    -> Text -> DescribeDocumentPermission)
-> Lens
     DescribeDocumentPermission DescribeDocumentPermission Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDocumentPermission' {Text
name :: Text
$sel:name:DescribeDocumentPermission' :: DescribeDocumentPermission -> Text
name} -> Text
name) (\s :: DescribeDocumentPermission
s@DescribeDocumentPermission' {} Text
a -> DescribeDocumentPermission
s {$sel:name:DescribeDocumentPermission' :: Text
name = Text
a} :: DescribeDocumentPermission)

-- | The permission type for the document. The permission type can be
-- /Share/.
describeDocumentPermission_permissionType :: Lens.Lens' DescribeDocumentPermission DocumentPermissionType
describeDocumentPermission_permissionType :: (DocumentPermissionType -> f DocumentPermissionType)
-> DescribeDocumentPermission -> f DescribeDocumentPermission
describeDocumentPermission_permissionType = (DescribeDocumentPermission -> DocumentPermissionType)
-> (DescribeDocumentPermission
    -> DocumentPermissionType -> DescribeDocumentPermission)
-> Lens
     DescribeDocumentPermission
     DescribeDocumentPermission
     DocumentPermissionType
     DocumentPermissionType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDocumentPermission' {DocumentPermissionType
permissionType :: DocumentPermissionType
$sel:permissionType:DescribeDocumentPermission' :: DescribeDocumentPermission -> DocumentPermissionType
permissionType} -> DocumentPermissionType
permissionType) (\s :: DescribeDocumentPermission
s@DescribeDocumentPermission' {} DocumentPermissionType
a -> DescribeDocumentPermission
s {$sel:permissionType:DescribeDocumentPermission' :: DocumentPermissionType
permissionType = DocumentPermissionType
a} :: DescribeDocumentPermission)

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

instance Prelude.NFData DescribeDocumentPermission

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

instance Core.ToJSON DescribeDocumentPermission where
  toJSON :: DescribeDocumentPermission -> Value
toJSON DescribeDocumentPermission' {Maybe Natural
Maybe Text
Text
DocumentPermissionType
permissionType :: DocumentPermissionType
name :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:permissionType:DescribeDocumentPermission' :: DescribeDocumentPermission -> DocumentPermissionType
$sel:name:DescribeDocumentPermission' :: DescribeDocumentPermission -> Text
$sel:maxResults:DescribeDocumentPermission' :: DescribeDocumentPermission -> Maybe Natural
$sel:nextToken:DescribeDocumentPermission' :: DescribeDocumentPermission -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (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
"Name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"PermissionType" Text -> DocumentPermissionType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DocumentPermissionType
permissionType)
          ]
      )

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

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

-- | /See:/ 'newDescribeDocumentPermissionResponse' smart constructor.
data DescribeDocumentPermissionResponse = DescribeDocumentPermissionResponse'
  { -- | The account IDs that have permission to use this document. The ID can be
    -- either an Amazon Web Services account or /All/.
    DescribeDocumentPermissionResponse -> Maybe [Text]
accountIds :: Prelude.Maybe [Prelude.Text],
    -- | A list of Amazon Web Services accounts where the current document is
    -- shared and the version shared with each account.
    DescribeDocumentPermissionResponse -> Maybe [AccountSharingInfo]
accountSharingInfoList :: Prelude.Maybe [AccountSharingInfo],
    -- | The token for the next set of items to return. Use this token to get the
    -- next set of results.
    DescribeDocumentPermissionResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeDocumentPermissionResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeDocumentPermissionResponse
-> DescribeDocumentPermissionResponse -> Bool
(DescribeDocumentPermissionResponse
 -> DescribeDocumentPermissionResponse -> Bool)
-> (DescribeDocumentPermissionResponse
    -> DescribeDocumentPermissionResponse -> Bool)
-> Eq DescribeDocumentPermissionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeDocumentPermissionResponse
-> DescribeDocumentPermissionResponse -> Bool
$c/= :: DescribeDocumentPermissionResponse
-> DescribeDocumentPermissionResponse -> Bool
== :: DescribeDocumentPermissionResponse
-> DescribeDocumentPermissionResponse -> Bool
$c== :: DescribeDocumentPermissionResponse
-> DescribeDocumentPermissionResponse -> Bool
Prelude.Eq, ReadPrec [DescribeDocumentPermissionResponse]
ReadPrec DescribeDocumentPermissionResponse
Int -> ReadS DescribeDocumentPermissionResponse
ReadS [DescribeDocumentPermissionResponse]
(Int -> ReadS DescribeDocumentPermissionResponse)
-> ReadS [DescribeDocumentPermissionResponse]
-> ReadPrec DescribeDocumentPermissionResponse
-> ReadPrec [DescribeDocumentPermissionResponse]
-> Read DescribeDocumentPermissionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeDocumentPermissionResponse]
$creadListPrec :: ReadPrec [DescribeDocumentPermissionResponse]
readPrec :: ReadPrec DescribeDocumentPermissionResponse
$creadPrec :: ReadPrec DescribeDocumentPermissionResponse
readList :: ReadS [DescribeDocumentPermissionResponse]
$creadList :: ReadS [DescribeDocumentPermissionResponse]
readsPrec :: Int -> ReadS DescribeDocumentPermissionResponse
$creadsPrec :: Int -> ReadS DescribeDocumentPermissionResponse
Prelude.Read, Int -> DescribeDocumentPermissionResponse -> ShowS
[DescribeDocumentPermissionResponse] -> ShowS
DescribeDocumentPermissionResponse -> String
(Int -> DescribeDocumentPermissionResponse -> ShowS)
-> (DescribeDocumentPermissionResponse -> String)
-> ([DescribeDocumentPermissionResponse] -> ShowS)
-> Show DescribeDocumentPermissionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeDocumentPermissionResponse] -> ShowS
$cshowList :: [DescribeDocumentPermissionResponse] -> ShowS
show :: DescribeDocumentPermissionResponse -> String
$cshow :: DescribeDocumentPermissionResponse -> String
showsPrec :: Int -> DescribeDocumentPermissionResponse -> ShowS
$cshowsPrec :: Int -> DescribeDocumentPermissionResponse -> ShowS
Prelude.Show, (forall x.
 DescribeDocumentPermissionResponse
 -> Rep DescribeDocumentPermissionResponse x)
-> (forall x.
    Rep DescribeDocumentPermissionResponse x
    -> DescribeDocumentPermissionResponse)
-> Generic DescribeDocumentPermissionResponse
forall x.
Rep DescribeDocumentPermissionResponse x
-> DescribeDocumentPermissionResponse
forall x.
DescribeDocumentPermissionResponse
-> Rep DescribeDocumentPermissionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeDocumentPermissionResponse x
-> DescribeDocumentPermissionResponse
$cfrom :: forall x.
DescribeDocumentPermissionResponse
-> Rep DescribeDocumentPermissionResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeDocumentPermissionResponse' 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:
--
-- 'accountIds', 'describeDocumentPermissionResponse_accountIds' - The account IDs that have permission to use this document. The ID can be
-- either an Amazon Web Services account or /All/.
--
-- 'accountSharingInfoList', 'describeDocumentPermissionResponse_accountSharingInfoList' - A list of Amazon Web Services accounts where the current document is
-- shared and the version shared with each account.
--
-- 'nextToken', 'describeDocumentPermissionResponse_nextToken' - The token for the next set of items to return. Use this token to get the
-- next set of results.
--
-- 'httpStatus', 'describeDocumentPermissionResponse_httpStatus' - The response's http status code.
newDescribeDocumentPermissionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeDocumentPermissionResponse
newDescribeDocumentPermissionResponse :: Int -> DescribeDocumentPermissionResponse
newDescribeDocumentPermissionResponse Int
pHttpStatus_ =
  DescribeDocumentPermissionResponse' :: Maybe [Text]
-> Maybe [AccountSharingInfo]
-> Maybe Text
-> Int
-> DescribeDocumentPermissionResponse
DescribeDocumentPermissionResponse'
    { $sel:accountIds:DescribeDocumentPermissionResponse' :: Maybe [Text]
accountIds =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:accountSharingInfoList:DescribeDocumentPermissionResponse' :: Maybe [AccountSharingInfo]
accountSharingInfoList =
        Maybe [AccountSharingInfo]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeDocumentPermissionResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeDocumentPermissionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The account IDs that have permission to use this document. The ID can be
-- either an Amazon Web Services account or /All/.
describeDocumentPermissionResponse_accountIds :: Lens.Lens' DescribeDocumentPermissionResponse (Prelude.Maybe [Prelude.Text])
describeDocumentPermissionResponse_accountIds :: (Maybe [Text] -> f (Maybe [Text]))
-> DescribeDocumentPermissionResponse
-> f DescribeDocumentPermissionResponse
describeDocumentPermissionResponse_accountIds = (DescribeDocumentPermissionResponse -> Maybe [Text])
-> (DescribeDocumentPermissionResponse
    -> Maybe [Text] -> DescribeDocumentPermissionResponse)
-> Lens
     DescribeDocumentPermissionResponse
     DescribeDocumentPermissionResponse
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDocumentPermissionResponse' {Maybe [Text]
accountIds :: Maybe [Text]
$sel:accountIds:DescribeDocumentPermissionResponse' :: DescribeDocumentPermissionResponse -> Maybe [Text]
accountIds} -> Maybe [Text]
accountIds) (\s :: DescribeDocumentPermissionResponse
s@DescribeDocumentPermissionResponse' {} Maybe [Text]
a -> DescribeDocumentPermissionResponse
s {$sel:accountIds:DescribeDocumentPermissionResponse' :: Maybe [Text]
accountIds = Maybe [Text]
a} :: DescribeDocumentPermissionResponse) ((Maybe [Text] -> f (Maybe [Text]))
 -> DescribeDocumentPermissionResponse
 -> f DescribeDocumentPermissionResponse)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DescribeDocumentPermissionResponse
-> f DescribeDocumentPermissionResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A list of Amazon Web Services accounts where the current document is
-- shared and the version shared with each account.
describeDocumentPermissionResponse_accountSharingInfoList :: Lens.Lens' DescribeDocumentPermissionResponse (Prelude.Maybe [AccountSharingInfo])
describeDocumentPermissionResponse_accountSharingInfoList :: (Maybe [AccountSharingInfo] -> f (Maybe [AccountSharingInfo]))
-> DescribeDocumentPermissionResponse
-> f DescribeDocumentPermissionResponse
describeDocumentPermissionResponse_accountSharingInfoList = (DescribeDocumentPermissionResponse -> Maybe [AccountSharingInfo])
-> (DescribeDocumentPermissionResponse
    -> Maybe [AccountSharingInfo]
    -> DescribeDocumentPermissionResponse)
-> Lens
     DescribeDocumentPermissionResponse
     DescribeDocumentPermissionResponse
     (Maybe [AccountSharingInfo])
     (Maybe [AccountSharingInfo])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDocumentPermissionResponse' {Maybe [AccountSharingInfo]
accountSharingInfoList :: Maybe [AccountSharingInfo]
$sel:accountSharingInfoList:DescribeDocumentPermissionResponse' :: DescribeDocumentPermissionResponse -> Maybe [AccountSharingInfo]
accountSharingInfoList} -> Maybe [AccountSharingInfo]
accountSharingInfoList) (\s :: DescribeDocumentPermissionResponse
s@DescribeDocumentPermissionResponse' {} Maybe [AccountSharingInfo]
a -> DescribeDocumentPermissionResponse
s {$sel:accountSharingInfoList:DescribeDocumentPermissionResponse' :: Maybe [AccountSharingInfo]
accountSharingInfoList = Maybe [AccountSharingInfo]
a} :: DescribeDocumentPermissionResponse) ((Maybe [AccountSharingInfo] -> f (Maybe [AccountSharingInfo]))
 -> DescribeDocumentPermissionResponse
 -> f DescribeDocumentPermissionResponse)
-> ((Maybe [AccountSharingInfo] -> f (Maybe [AccountSharingInfo]))
    -> Maybe [AccountSharingInfo] -> f (Maybe [AccountSharingInfo]))
-> (Maybe [AccountSharingInfo] -> f (Maybe [AccountSharingInfo]))
-> DescribeDocumentPermissionResponse
-> f DescribeDocumentPermissionResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AccountSharingInfo]
  [AccountSharingInfo]
  [AccountSharingInfo]
  [AccountSharingInfo]
-> Iso
     (Maybe [AccountSharingInfo])
     (Maybe [AccountSharingInfo])
     (Maybe [AccountSharingInfo])
     (Maybe [AccountSharingInfo])
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
  [AccountSharingInfo]
  [AccountSharingInfo]
  [AccountSharingInfo]
  [AccountSharingInfo]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The token for the next set of items to return. Use this token to get the
-- next set of results.
describeDocumentPermissionResponse_nextToken :: Lens.Lens' DescribeDocumentPermissionResponse (Prelude.Maybe Prelude.Text)
describeDocumentPermissionResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeDocumentPermissionResponse
-> f DescribeDocumentPermissionResponse
describeDocumentPermissionResponse_nextToken = (DescribeDocumentPermissionResponse -> Maybe Text)
-> (DescribeDocumentPermissionResponse
    -> Maybe Text -> DescribeDocumentPermissionResponse)
-> Lens
     DescribeDocumentPermissionResponse
     DescribeDocumentPermissionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDocumentPermissionResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeDocumentPermissionResponse' :: DescribeDocumentPermissionResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeDocumentPermissionResponse
s@DescribeDocumentPermissionResponse' {} Maybe Text
a -> DescribeDocumentPermissionResponse
s {$sel:nextToken:DescribeDocumentPermissionResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeDocumentPermissionResponse)

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

instance
  Prelude.NFData
    DescribeDocumentPermissionResponse