{-# 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.Cloud9.DescribeEnvironmentMemberships
-- 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)
--
-- Gets information about environment members for an Cloud9 development
-- environment.
--
-- This operation returns paginated results.
module Amazonka.Cloud9.DescribeEnvironmentMemberships
  ( -- * Creating a Request
    DescribeEnvironmentMemberships (..),
    newDescribeEnvironmentMemberships,

    -- * Request Lenses
    describeEnvironmentMemberships_userArn,
    describeEnvironmentMemberships_nextToken,
    describeEnvironmentMemberships_permissions,
    describeEnvironmentMemberships_environmentId,
    describeEnvironmentMemberships_maxResults,

    -- * Destructuring the Response
    DescribeEnvironmentMembershipsResponse (..),
    newDescribeEnvironmentMembershipsResponse,

    -- * Response Lenses
    describeEnvironmentMembershipsResponse_nextToken,
    describeEnvironmentMembershipsResponse_memberships,
    describeEnvironmentMembershipsResponse_httpStatus,
  )
where

import Amazonka.Cloud9.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:/ 'newDescribeEnvironmentMemberships' smart constructor.
data DescribeEnvironmentMemberships = DescribeEnvironmentMemberships'
  { -- | The Amazon Resource Name (ARN) of an individual environment member to
    -- get information about. If no value is specified, information about all
    -- environment members are returned.
    DescribeEnvironmentMemberships -> Maybe Text
userArn :: Prelude.Maybe Prelude.Text,
    -- | During a previous call, if there are more than 25 items in the list,
    -- only the first 25 items are returned, along with a unique string called
    -- a /next token/. To get the next batch of items in the list, call this
    -- operation again, adding the next token to the call. To get all of the
    -- items in the list, keep calling this operation with each subsequent next
    -- token that is returned, until no more next tokens are returned.
    DescribeEnvironmentMemberships -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The type of environment member permissions to get information about.
    -- Available values include:
    --
    -- -   @owner@: Owns the environment.
    --
    -- -   @read-only@: Has read-only access to the environment.
    --
    -- -   @read-write@: Has read-write access to the environment.
    --
    -- If no value is specified, information about all environment members are
    -- returned.
    DescribeEnvironmentMemberships -> Maybe [Permissions]
permissions :: Prelude.Maybe [Permissions],
    -- | The ID of the environment to get environment member information about.
    DescribeEnvironmentMemberships -> Maybe Text
environmentId :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of environment members to get information about.
    DescribeEnvironmentMemberships -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (DescribeEnvironmentMemberships
-> DescribeEnvironmentMemberships -> Bool
(DescribeEnvironmentMemberships
 -> DescribeEnvironmentMemberships -> Bool)
-> (DescribeEnvironmentMemberships
    -> DescribeEnvironmentMemberships -> Bool)
-> Eq DescribeEnvironmentMemberships
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeEnvironmentMemberships
-> DescribeEnvironmentMemberships -> Bool
$c/= :: DescribeEnvironmentMemberships
-> DescribeEnvironmentMemberships -> Bool
== :: DescribeEnvironmentMemberships
-> DescribeEnvironmentMemberships -> Bool
$c== :: DescribeEnvironmentMemberships
-> DescribeEnvironmentMemberships -> Bool
Prelude.Eq, ReadPrec [DescribeEnvironmentMemberships]
ReadPrec DescribeEnvironmentMemberships
Int -> ReadS DescribeEnvironmentMemberships
ReadS [DescribeEnvironmentMemberships]
(Int -> ReadS DescribeEnvironmentMemberships)
-> ReadS [DescribeEnvironmentMemberships]
-> ReadPrec DescribeEnvironmentMemberships
-> ReadPrec [DescribeEnvironmentMemberships]
-> Read DescribeEnvironmentMemberships
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeEnvironmentMemberships]
$creadListPrec :: ReadPrec [DescribeEnvironmentMemberships]
readPrec :: ReadPrec DescribeEnvironmentMemberships
$creadPrec :: ReadPrec DescribeEnvironmentMemberships
readList :: ReadS [DescribeEnvironmentMemberships]
$creadList :: ReadS [DescribeEnvironmentMemberships]
readsPrec :: Int -> ReadS DescribeEnvironmentMemberships
$creadsPrec :: Int -> ReadS DescribeEnvironmentMemberships
Prelude.Read, Int -> DescribeEnvironmentMemberships -> ShowS
[DescribeEnvironmentMemberships] -> ShowS
DescribeEnvironmentMemberships -> String
(Int -> DescribeEnvironmentMemberships -> ShowS)
-> (DescribeEnvironmentMemberships -> String)
-> ([DescribeEnvironmentMemberships] -> ShowS)
-> Show DescribeEnvironmentMemberships
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeEnvironmentMemberships] -> ShowS
$cshowList :: [DescribeEnvironmentMemberships] -> ShowS
show :: DescribeEnvironmentMemberships -> String
$cshow :: DescribeEnvironmentMemberships -> String
showsPrec :: Int -> DescribeEnvironmentMemberships -> ShowS
$cshowsPrec :: Int -> DescribeEnvironmentMemberships -> ShowS
Prelude.Show, (forall x.
 DescribeEnvironmentMemberships
 -> Rep DescribeEnvironmentMemberships x)
-> (forall x.
    Rep DescribeEnvironmentMemberships x
    -> DescribeEnvironmentMemberships)
-> Generic DescribeEnvironmentMemberships
forall x.
Rep DescribeEnvironmentMemberships x
-> DescribeEnvironmentMemberships
forall x.
DescribeEnvironmentMemberships
-> Rep DescribeEnvironmentMemberships x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeEnvironmentMemberships x
-> DescribeEnvironmentMemberships
$cfrom :: forall x.
DescribeEnvironmentMemberships
-> Rep DescribeEnvironmentMemberships x
Prelude.Generic)

-- |
-- Create a value of 'DescribeEnvironmentMemberships' 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:
--
-- 'userArn', 'describeEnvironmentMemberships_userArn' - The Amazon Resource Name (ARN) of an individual environment member to
-- get information about. If no value is specified, information about all
-- environment members are returned.
--
-- 'nextToken', 'describeEnvironmentMemberships_nextToken' - During a previous call, if there are more than 25 items in the list,
-- only the first 25 items are returned, along with a unique string called
-- a /next token/. To get the next batch of items in the list, call this
-- operation again, adding the next token to the call. To get all of the
-- items in the list, keep calling this operation with each subsequent next
-- token that is returned, until no more next tokens are returned.
--
-- 'permissions', 'describeEnvironmentMemberships_permissions' - The type of environment member permissions to get information about.
-- Available values include:
--
-- -   @owner@: Owns the environment.
--
-- -   @read-only@: Has read-only access to the environment.
--
-- -   @read-write@: Has read-write access to the environment.
--
-- If no value is specified, information about all environment members are
-- returned.
--
-- 'environmentId', 'describeEnvironmentMemberships_environmentId' - The ID of the environment to get environment member information about.
--
-- 'maxResults', 'describeEnvironmentMemberships_maxResults' - The maximum number of environment members to get information about.
newDescribeEnvironmentMemberships ::
  DescribeEnvironmentMemberships
newDescribeEnvironmentMemberships :: DescribeEnvironmentMemberships
newDescribeEnvironmentMemberships =
  DescribeEnvironmentMemberships' :: Maybe Text
-> Maybe Text
-> Maybe [Permissions]
-> Maybe Text
-> Maybe Natural
-> DescribeEnvironmentMemberships
DescribeEnvironmentMemberships'
    { $sel:userArn:DescribeEnvironmentMemberships' :: Maybe Text
userArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeEnvironmentMemberships' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:permissions:DescribeEnvironmentMemberships' :: Maybe [Permissions]
permissions = Maybe [Permissions]
forall a. Maybe a
Prelude.Nothing,
      $sel:environmentId:DescribeEnvironmentMemberships' :: Maybe Text
environmentId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribeEnvironmentMemberships' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of an individual environment member to
-- get information about. If no value is specified, information about all
-- environment members are returned.
describeEnvironmentMemberships_userArn :: Lens.Lens' DescribeEnvironmentMemberships (Prelude.Maybe Prelude.Text)
describeEnvironmentMemberships_userArn :: (Maybe Text -> f (Maybe Text))
-> DescribeEnvironmentMemberships
-> f DescribeEnvironmentMemberships
describeEnvironmentMemberships_userArn = (DescribeEnvironmentMemberships -> Maybe Text)
-> (DescribeEnvironmentMemberships
    -> Maybe Text -> DescribeEnvironmentMemberships)
-> Lens
     DescribeEnvironmentMemberships
     DescribeEnvironmentMemberships
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEnvironmentMemberships' {Maybe Text
userArn :: Maybe Text
$sel:userArn:DescribeEnvironmentMemberships' :: DescribeEnvironmentMemberships -> Maybe Text
userArn} -> Maybe Text
userArn) (\s :: DescribeEnvironmentMemberships
s@DescribeEnvironmentMemberships' {} Maybe Text
a -> DescribeEnvironmentMemberships
s {$sel:userArn:DescribeEnvironmentMemberships' :: Maybe Text
userArn = Maybe Text
a} :: DescribeEnvironmentMemberships)

-- | During a previous call, if there are more than 25 items in the list,
-- only the first 25 items are returned, along with a unique string called
-- a /next token/. To get the next batch of items in the list, call this
-- operation again, adding the next token to the call. To get all of the
-- items in the list, keep calling this operation with each subsequent next
-- token that is returned, until no more next tokens are returned.
describeEnvironmentMemberships_nextToken :: Lens.Lens' DescribeEnvironmentMemberships (Prelude.Maybe Prelude.Text)
describeEnvironmentMemberships_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeEnvironmentMemberships
-> f DescribeEnvironmentMemberships
describeEnvironmentMemberships_nextToken = (DescribeEnvironmentMemberships -> Maybe Text)
-> (DescribeEnvironmentMemberships
    -> Maybe Text -> DescribeEnvironmentMemberships)
-> Lens
     DescribeEnvironmentMemberships
     DescribeEnvironmentMemberships
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEnvironmentMemberships' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeEnvironmentMemberships' :: DescribeEnvironmentMemberships -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeEnvironmentMemberships
s@DescribeEnvironmentMemberships' {} Maybe Text
a -> DescribeEnvironmentMemberships
s {$sel:nextToken:DescribeEnvironmentMemberships' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeEnvironmentMemberships)

-- | The type of environment member permissions to get information about.
-- Available values include:
--
-- -   @owner@: Owns the environment.
--
-- -   @read-only@: Has read-only access to the environment.
--
-- -   @read-write@: Has read-write access to the environment.
--
-- If no value is specified, information about all environment members are
-- returned.
describeEnvironmentMemberships_permissions :: Lens.Lens' DescribeEnvironmentMemberships (Prelude.Maybe [Permissions])
describeEnvironmentMemberships_permissions :: (Maybe [Permissions] -> f (Maybe [Permissions]))
-> DescribeEnvironmentMemberships
-> f DescribeEnvironmentMemberships
describeEnvironmentMemberships_permissions = (DescribeEnvironmentMemberships -> Maybe [Permissions])
-> (DescribeEnvironmentMemberships
    -> Maybe [Permissions] -> DescribeEnvironmentMemberships)
-> Lens
     DescribeEnvironmentMemberships
     DescribeEnvironmentMemberships
     (Maybe [Permissions])
     (Maybe [Permissions])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEnvironmentMemberships' {Maybe [Permissions]
permissions :: Maybe [Permissions]
$sel:permissions:DescribeEnvironmentMemberships' :: DescribeEnvironmentMemberships -> Maybe [Permissions]
permissions} -> Maybe [Permissions]
permissions) (\s :: DescribeEnvironmentMemberships
s@DescribeEnvironmentMemberships' {} Maybe [Permissions]
a -> DescribeEnvironmentMemberships
s {$sel:permissions:DescribeEnvironmentMemberships' :: Maybe [Permissions]
permissions = Maybe [Permissions]
a} :: DescribeEnvironmentMemberships) ((Maybe [Permissions] -> f (Maybe [Permissions]))
 -> DescribeEnvironmentMemberships
 -> f DescribeEnvironmentMemberships)
-> ((Maybe [Permissions] -> f (Maybe [Permissions]))
    -> Maybe [Permissions] -> f (Maybe [Permissions]))
-> (Maybe [Permissions] -> f (Maybe [Permissions]))
-> DescribeEnvironmentMemberships
-> f DescribeEnvironmentMemberships
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Permissions] [Permissions] [Permissions] [Permissions]
-> Iso
     (Maybe [Permissions])
     (Maybe [Permissions])
     (Maybe [Permissions])
     (Maybe [Permissions])
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 [Permissions] [Permissions] [Permissions] [Permissions]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The ID of the environment to get environment member information about.
describeEnvironmentMemberships_environmentId :: Lens.Lens' DescribeEnvironmentMemberships (Prelude.Maybe Prelude.Text)
describeEnvironmentMemberships_environmentId :: (Maybe Text -> f (Maybe Text))
-> DescribeEnvironmentMemberships
-> f DescribeEnvironmentMemberships
describeEnvironmentMemberships_environmentId = (DescribeEnvironmentMemberships -> Maybe Text)
-> (DescribeEnvironmentMemberships
    -> Maybe Text -> DescribeEnvironmentMemberships)
-> Lens
     DescribeEnvironmentMemberships
     DescribeEnvironmentMemberships
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEnvironmentMemberships' {Maybe Text
environmentId :: Maybe Text
$sel:environmentId:DescribeEnvironmentMemberships' :: DescribeEnvironmentMemberships -> Maybe Text
environmentId} -> Maybe Text
environmentId) (\s :: DescribeEnvironmentMemberships
s@DescribeEnvironmentMemberships' {} Maybe Text
a -> DescribeEnvironmentMemberships
s {$sel:environmentId:DescribeEnvironmentMemberships' :: Maybe Text
environmentId = Maybe Text
a} :: DescribeEnvironmentMemberships)

-- | The maximum number of environment members to get information about.
describeEnvironmentMemberships_maxResults :: Lens.Lens' DescribeEnvironmentMemberships (Prelude.Maybe Prelude.Natural)
describeEnvironmentMemberships_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> DescribeEnvironmentMemberships
-> f DescribeEnvironmentMemberships
describeEnvironmentMemberships_maxResults = (DescribeEnvironmentMemberships -> Maybe Natural)
-> (DescribeEnvironmentMemberships
    -> Maybe Natural -> DescribeEnvironmentMemberships)
-> Lens
     DescribeEnvironmentMemberships
     DescribeEnvironmentMemberships
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEnvironmentMemberships' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:DescribeEnvironmentMemberships' :: DescribeEnvironmentMemberships -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: DescribeEnvironmentMemberships
s@DescribeEnvironmentMemberships' {} Maybe Natural
a -> DescribeEnvironmentMemberships
s {$sel:maxResults:DescribeEnvironmentMemberships' :: Maybe Natural
maxResults = Maybe Natural
a} :: DescribeEnvironmentMemberships)

instance Core.AWSPager DescribeEnvironmentMemberships where
  page :: DescribeEnvironmentMemberships
-> AWSResponse DescribeEnvironmentMemberships
-> Maybe DescribeEnvironmentMemberships
page DescribeEnvironmentMemberships
rq AWSResponse DescribeEnvironmentMemberships
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeEnvironmentMemberships
DescribeEnvironmentMembershipsResponse
rs
            DescribeEnvironmentMembershipsResponse
-> Getting (First Text) DescribeEnvironmentMembershipsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeEnvironmentMembershipsResponse
-> Const (First Text) DescribeEnvironmentMembershipsResponse
Lens' DescribeEnvironmentMembershipsResponse (Maybe Text)
describeEnvironmentMembershipsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeEnvironmentMembershipsResponse
 -> Const (First Text) DescribeEnvironmentMembershipsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeEnvironmentMembershipsResponse 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 DescribeEnvironmentMemberships
forall a. Maybe a
Prelude.Nothing
    | Maybe [EnvironmentMember] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeEnvironmentMemberships
DescribeEnvironmentMembershipsResponse
rs
            DescribeEnvironmentMembershipsResponse
-> Getting
     (First [EnvironmentMember])
     DescribeEnvironmentMembershipsResponse
     [EnvironmentMember]
-> Maybe [EnvironmentMember]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [EnvironmentMember]
 -> Const (First [EnvironmentMember]) (Maybe [EnvironmentMember]))
-> DescribeEnvironmentMembershipsResponse
-> Const
     (First [EnvironmentMember]) DescribeEnvironmentMembershipsResponse
Lens'
  DescribeEnvironmentMembershipsResponse (Maybe [EnvironmentMember])
describeEnvironmentMembershipsResponse_memberships
              ((Maybe [EnvironmentMember]
  -> Const (First [EnvironmentMember]) (Maybe [EnvironmentMember]))
 -> DescribeEnvironmentMembershipsResponse
 -> Const
      (First [EnvironmentMember]) DescribeEnvironmentMembershipsResponse)
-> (([EnvironmentMember]
     -> Const (First [EnvironmentMember]) [EnvironmentMember])
    -> Maybe [EnvironmentMember]
    -> Const (First [EnvironmentMember]) (Maybe [EnvironmentMember]))
-> Getting
     (First [EnvironmentMember])
     DescribeEnvironmentMembershipsResponse
     [EnvironmentMember]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([EnvironmentMember]
 -> Const (First [EnvironmentMember]) [EnvironmentMember])
-> Maybe [EnvironmentMember]
-> Const (First [EnvironmentMember]) (Maybe [EnvironmentMember])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeEnvironmentMemberships
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeEnvironmentMemberships
-> Maybe DescribeEnvironmentMemberships
forall a. a -> Maybe a
Prelude.Just (DescribeEnvironmentMemberships
 -> Maybe DescribeEnvironmentMemberships)
-> DescribeEnvironmentMemberships
-> Maybe DescribeEnvironmentMemberships
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeEnvironmentMemberships
rq
          DescribeEnvironmentMemberships
-> (DescribeEnvironmentMemberships
    -> DescribeEnvironmentMemberships)
-> DescribeEnvironmentMemberships
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeEnvironmentMemberships
-> Identity DescribeEnvironmentMemberships
Lens
  DescribeEnvironmentMemberships
  DescribeEnvironmentMemberships
  (Maybe Text)
  (Maybe Text)
describeEnvironmentMemberships_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeEnvironmentMemberships
 -> Identity DescribeEnvironmentMemberships)
-> Maybe Text
-> DescribeEnvironmentMemberships
-> DescribeEnvironmentMemberships
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeEnvironmentMemberships
DescribeEnvironmentMembershipsResponse
rs
          DescribeEnvironmentMembershipsResponse
-> Getting (First Text) DescribeEnvironmentMembershipsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeEnvironmentMembershipsResponse
-> Const (First Text) DescribeEnvironmentMembershipsResponse
Lens' DescribeEnvironmentMembershipsResponse (Maybe Text)
describeEnvironmentMembershipsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeEnvironmentMembershipsResponse
 -> Const (First Text) DescribeEnvironmentMembershipsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeEnvironmentMembershipsResponse 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
    DescribeEnvironmentMemberships
  where
  type
    AWSResponse DescribeEnvironmentMemberships =
      DescribeEnvironmentMembershipsResponse
  request :: DescribeEnvironmentMemberships
-> Request DescribeEnvironmentMemberships
request = Service
-> DescribeEnvironmentMemberships
-> Request DescribeEnvironmentMemberships
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeEnvironmentMemberships
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DescribeEnvironmentMemberships)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeEnvironmentMemberships))
-> Logger
-> Service
-> Proxy DescribeEnvironmentMemberships
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DescribeEnvironmentMemberships)))
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 [EnvironmentMember]
-> Int
-> DescribeEnvironmentMembershipsResponse
DescribeEnvironmentMembershipsResponse'
            (Maybe Text
 -> Maybe [EnvironmentMember]
 -> Int
 -> DescribeEnvironmentMembershipsResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [EnvironmentMember]
      -> Int -> DescribeEnvironmentMembershipsResponse)
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 [EnvironmentMember]
   -> Int -> DescribeEnvironmentMembershipsResponse)
-> Either String (Maybe [EnvironmentMember])
-> Either String (Int -> DescribeEnvironmentMembershipsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [EnvironmentMember]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"memberships" Either String (Maybe (Maybe [EnvironmentMember]))
-> Maybe [EnvironmentMember]
-> Either String (Maybe [EnvironmentMember])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [EnvironmentMember]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Int -> DescribeEnvironmentMembershipsResponse)
-> Either String Int
-> Either String DescribeEnvironmentMembershipsResponse
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
    DescribeEnvironmentMemberships

instance
  Prelude.NFData
    DescribeEnvironmentMemberships

instance
  Core.ToHeaders
    DescribeEnvironmentMemberships
  where
  toHeaders :: DescribeEnvironmentMemberships -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> DescribeEnvironmentMemberships -> 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
"AWSCloud9WorkspaceManagementService.DescribeEnvironmentMemberships" ::
                          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 DescribeEnvironmentMemberships where
  toJSON :: DescribeEnvironmentMemberships -> Value
toJSON DescribeEnvironmentMemberships' {Maybe Natural
Maybe [Permissions]
Maybe Text
maxResults :: Maybe Natural
environmentId :: Maybe Text
permissions :: Maybe [Permissions]
nextToken :: Maybe Text
userArn :: Maybe Text
$sel:maxResults:DescribeEnvironmentMemberships' :: DescribeEnvironmentMemberships -> Maybe Natural
$sel:environmentId:DescribeEnvironmentMemberships' :: DescribeEnvironmentMemberships -> Maybe Text
$sel:permissions:DescribeEnvironmentMemberships' :: DescribeEnvironmentMemberships -> Maybe [Permissions]
$sel:nextToken:DescribeEnvironmentMemberships' :: DescribeEnvironmentMemberships -> Maybe Text
$sel:userArn:DescribeEnvironmentMemberships' :: DescribeEnvironmentMemberships -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"userArn" 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
userArn,
            (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
"permissions" Text -> [Permissions] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Permissions] -> Pair) -> Maybe [Permissions] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Permissions]
permissions,
            (Text
"environmentId" 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
environmentId,
            (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
          ]
      )

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

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

-- | /See:/ 'newDescribeEnvironmentMembershipsResponse' smart constructor.
data DescribeEnvironmentMembershipsResponse = DescribeEnvironmentMembershipsResponse'
  { -- | If there are more than 25 items in the list, only the first 25 items are
    -- returned, along with a unique string called a /next token/. To get the
    -- next batch of items in the list, call this operation again, adding the
    -- next token to the call.
    DescribeEnvironmentMembershipsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Information about the environment members for the environment.
    DescribeEnvironmentMembershipsResponse -> Maybe [EnvironmentMember]
memberships :: Prelude.Maybe [EnvironmentMember],
    -- | The response's http status code.
    DescribeEnvironmentMembershipsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeEnvironmentMembershipsResponse
-> DescribeEnvironmentMembershipsResponse -> Bool
(DescribeEnvironmentMembershipsResponse
 -> DescribeEnvironmentMembershipsResponse -> Bool)
-> (DescribeEnvironmentMembershipsResponse
    -> DescribeEnvironmentMembershipsResponse -> Bool)
-> Eq DescribeEnvironmentMembershipsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeEnvironmentMembershipsResponse
-> DescribeEnvironmentMembershipsResponse -> Bool
$c/= :: DescribeEnvironmentMembershipsResponse
-> DescribeEnvironmentMembershipsResponse -> Bool
== :: DescribeEnvironmentMembershipsResponse
-> DescribeEnvironmentMembershipsResponse -> Bool
$c== :: DescribeEnvironmentMembershipsResponse
-> DescribeEnvironmentMembershipsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeEnvironmentMembershipsResponse]
ReadPrec DescribeEnvironmentMembershipsResponse
Int -> ReadS DescribeEnvironmentMembershipsResponse
ReadS [DescribeEnvironmentMembershipsResponse]
(Int -> ReadS DescribeEnvironmentMembershipsResponse)
-> ReadS [DescribeEnvironmentMembershipsResponse]
-> ReadPrec DescribeEnvironmentMembershipsResponse
-> ReadPrec [DescribeEnvironmentMembershipsResponse]
-> Read DescribeEnvironmentMembershipsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeEnvironmentMembershipsResponse]
$creadListPrec :: ReadPrec [DescribeEnvironmentMembershipsResponse]
readPrec :: ReadPrec DescribeEnvironmentMembershipsResponse
$creadPrec :: ReadPrec DescribeEnvironmentMembershipsResponse
readList :: ReadS [DescribeEnvironmentMembershipsResponse]
$creadList :: ReadS [DescribeEnvironmentMembershipsResponse]
readsPrec :: Int -> ReadS DescribeEnvironmentMembershipsResponse
$creadsPrec :: Int -> ReadS DescribeEnvironmentMembershipsResponse
Prelude.Read, Int -> DescribeEnvironmentMembershipsResponse -> ShowS
[DescribeEnvironmentMembershipsResponse] -> ShowS
DescribeEnvironmentMembershipsResponse -> String
(Int -> DescribeEnvironmentMembershipsResponse -> ShowS)
-> (DescribeEnvironmentMembershipsResponse -> String)
-> ([DescribeEnvironmentMembershipsResponse] -> ShowS)
-> Show DescribeEnvironmentMembershipsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeEnvironmentMembershipsResponse] -> ShowS
$cshowList :: [DescribeEnvironmentMembershipsResponse] -> ShowS
show :: DescribeEnvironmentMembershipsResponse -> String
$cshow :: DescribeEnvironmentMembershipsResponse -> String
showsPrec :: Int -> DescribeEnvironmentMembershipsResponse -> ShowS
$cshowsPrec :: Int -> DescribeEnvironmentMembershipsResponse -> ShowS
Prelude.Show, (forall x.
 DescribeEnvironmentMembershipsResponse
 -> Rep DescribeEnvironmentMembershipsResponse x)
-> (forall x.
    Rep DescribeEnvironmentMembershipsResponse x
    -> DescribeEnvironmentMembershipsResponse)
-> Generic DescribeEnvironmentMembershipsResponse
forall x.
Rep DescribeEnvironmentMembershipsResponse x
-> DescribeEnvironmentMembershipsResponse
forall x.
DescribeEnvironmentMembershipsResponse
-> Rep DescribeEnvironmentMembershipsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeEnvironmentMembershipsResponse x
-> DescribeEnvironmentMembershipsResponse
$cfrom :: forall x.
DescribeEnvironmentMembershipsResponse
-> Rep DescribeEnvironmentMembershipsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeEnvironmentMembershipsResponse' 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', 'describeEnvironmentMembershipsResponse_nextToken' - If there are more than 25 items in the list, only the first 25 items are
-- returned, along with a unique string called a /next token/. To get the
-- next batch of items in the list, call this operation again, adding the
-- next token to the call.
--
-- 'memberships', 'describeEnvironmentMembershipsResponse_memberships' - Information about the environment members for the environment.
--
-- 'httpStatus', 'describeEnvironmentMembershipsResponse_httpStatus' - The response's http status code.
newDescribeEnvironmentMembershipsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeEnvironmentMembershipsResponse
newDescribeEnvironmentMembershipsResponse :: Int -> DescribeEnvironmentMembershipsResponse
newDescribeEnvironmentMembershipsResponse
  Int
pHttpStatus_ =
    DescribeEnvironmentMembershipsResponse' :: Maybe Text
-> Maybe [EnvironmentMember]
-> Int
-> DescribeEnvironmentMembershipsResponse
DescribeEnvironmentMembershipsResponse'
      { $sel:nextToken:DescribeEnvironmentMembershipsResponse' :: Maybe Text
nextToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:memberships:DescribeEnvironmentMembershipsResponse' :: Maybe [EnvironmentMember]
memberships = Maybe [EnvironmentMember]
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:DescribeEnvironmentMembershipsResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | If there are more than 25 items in the list, only the first 25 items are
-- returned, along with a unique string called a /next token/. To get the
-- next batch of items in the list, call this operation again, adding the
-- next token to the call.
describeEnvironmentMembershipsResponse_nextToken :: Lens.Lens' DescribeEnvironmentMembershipsResponse (Prelude.Maybe Prelude.Text)
describeEnvironmentMembershipsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeEnvironmentMembershipsResponse
-> f DescribeEnvironmentMembershipsResponse
describeEnvironmentMembershipsResponse_nextToken = (DescribeEnvironmentMembershipsResponse -> Maybe Text)
-> (DescribeEnvironmentMembershipsResponse
    -> Maybe Text -> DescribeEnvironmentMembershipsResponse)
-> Lens' DescribeEnvironmentMembershipsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEnvironmentMembershipsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeEnvironmentMembershipsResponse' :: DescribeEnvironmentMembershipsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeEnvironmentMembershipsResponse
s@DescribeEnvironmentMembershipsResponse' {} Maybe Text
a -> DescribeEnvironmentMembershipsResponse
s {$sel:nextToken:DescribeEnvironmentMembershipsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeEnvironmentMembershipsResponse)

-- | Information about the environment members for the environment.
describeEnvironmentMembershipsResponse_memberships :: Lens.Lens' DescribeEnvironmentMembershipsResponse (Prelude.Maybe [EnvironmentMember])
describeEnvironmentMembershipsResponse_memberships :: (Maybe [EnvironmentMember] -> f (Maybe [EnvironmentMember]))
-> DescribeEnvironmentMembershipsResponse
-> f DescribeEnvironmentMembershipsResponse
describeEnvironmentMembershipsResponse_memberships = (DescribeEnvironmentMembershipsResponse
 -> Maybe [EnvironmentMember])
-> (DescribeEnvironmentMembershipsResponse
    -> Maybe [EnvironmentMember]
    -> DescribeEnvironmentMembershipsResponse)
-> Lens'
     DescribeEnvironmentMembershipsResponse (Maybe [EnvironmentMember])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEnvironmentMembershipsResponse' {Maybe [EnvironmentMember]
memberships :: Maybe [EnvironmentMember]
$sel:memberships:DescribeEnvironmentMembershipsResponse' :: DescribeEnvironmentMembershipsResponse -> Maybe [EnvironmentMember]
memberships} -> Maybe [EnvironmentMember]
memberships) (\s :: DescribeEnvironmentMembershipsResponse
s@DescribeEnvironmentMembershipsResponse' {} Maybe [EnvironmentMember]
a -> DescribeEnvironmentMembershipsResponse
s {$sel:memberships:DescribeEnvironmentMembershipsResponse' :: Maybe [EnvironmentMember]
memberships = Maybe [EnvironmentMember]
a} :: DescribeEnvironmentMembershipsResponse) ((Maybe [EnvironmentMember] -> f (Maybe [EnvironmentMember]))
 -> DescribeEnvironmentMembershipsResponse
 -> f DescribeEnvironmentMembershipsResponse)
-> ((Maybe [EnvironmentMember] -> f (Maybe [EnvironmentMember]))
    -> Maybe [EnvironmentMember] -> f (Maybe [EnvironmentMember]))
-> (Maybe [EnvironmentMember] -> f (Maybe [EnvironmentMember]))
-> DescribeEnvironmentMembershipsResponse
-> f DescribeEnvironmentMembershipsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [EnvironmentMember]
  [EnvironmentMember]
  [EnvironmentMember]
  [EnvironmentMember]
-> Iso
     (Maybe [EnvironmentMember])
     (Maybe [EnvironmentMember])
     (Maybe [EnvironmentMember])
     (Maybe [EnvironmentMember])
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
  [EnvironmentMember]
  [EnvironmentMember]
  [EnvironmentMember]
  [EnvironmentMember]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    DescribeEnvironmentMembershipsResponse