{-# 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.CodeBuild.ListSharedProjects
-- 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 a list of projects that are shared with other Amazon Web Services
-- accounts or users.
--
-- This operation returns paginated results.
module Amazonka.CodeBuild.ListSharedProjects
  ( -- * Creating a Request
    ListSharedProjects (..),
    newListSharedProjects,

    -- * Request Lenses
    listSharedProjects_sortOrder,
    listSharedProjects_nextToken,
    listSharedProjects_maxResults,
    listSharedProjects_sortBy,

    -- * Destructuring the Response
    ListSharedProjectsResponse (..),
    newListSharedProjectsResponse,

    -- * Response Lenses
    listSharedProjectsResponse_nextToken,
    listSharedProjectsResponse_projects,
    listSharedProjectsResponse_httpStatus,
  )
where

import Amazonka.CodeBuild.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:/ 'newListSharedProjects' smart constructor.
data ListSharedProjects = ListSharedProjects'
  { -- | The order in which to list shared build projects. Valid values include:
    --
    -- -   @ASCENDING@: List in ascending order.
    --
    -- -   @DESCENDING@: List in descending order.
    ListSharedProjects -> Maybe SortOrderType
sortOrder :: Prelude.Maybe SortOrderType,
    -- | During a previous call, the maximum number of items that can be returned
    -- is the value specified in @maxResults@. If there more items in the list,
    -- then a unique string called a /nextToken/ is returned. 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.
    ListSharedProjects -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of paginated shared build projects returned per
    -- response. Use @nextToken@ to iterate pages in the list of returned
    -- @Project@ objects. The default value is 100.
    ListSharedProjects -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The criterion to be used to list build projects shared with the current
    -- Amazon Web Services account or user. Valid values include:
    --
    -- -   @ARN@: List based on the ARN.
    --
    -- -   @MODIFIED_TIME@: List based on when information about the shared
    --     project was last changed.
    ListSharedProjects -> Maybe SharedResourceSortByType
sortBy :: Prelude.Maybe SharedResourceSortByType
  }
  deriving (ListSharedProjects -> ListSharedProjects -> Bool
(ListSharedProjects -> ListSharedProjects -> Bool)
-> (ListSharedProjects -> ListSharedProjects -> Bool)
-> Eq ListSharedProjects
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListSharedProjects -> ListSharedProjects -> Bool
$c/= :: ListSharedProjects -> ListSharedProjects -> Bool
== :: ListSharedProjects -> ListSharedProjects -> Bool
$c== :: ListSharedProjects -> ListSharedProjects -> Bool
Prelude.Eq, ReadPrec [ListSharedProjects]
ReadPrec ListSharedProjects
Int -> ReadS ListSharedProjects
ReadS [ListSharedProjects]
(Int -> ReadS ListSharedProjects)
-> ReadS [ListSharedProjects]
-> ReadPrec ListSharedProjects
-> ReadPrec [ListSharedProjects]
-> Read ListSharedProjects
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListSharedProjects]
$creadListPrec :: ReadPrec [ListSharedProjects]
readPrec :: ReadPrec ListSharedProjects
$creadPrec :: ReadPrec ListSharedProjects
readList :: ReadS [ListSharedProjects]
$creadList :: ReadS [ListSharedProjects]
readsPrec :: Int -> ReadS ListSharedProjects
$creadsPrec :: Int -> ReadS ListSharedProjects
Prelude.Read, Int -> ListSharedProjects -> ShowS
[ListSharedProjects] -> ShowS
ListSharedProjects -> String
(Int -> ListSharedProjects -> ShowS)
-> (ListSharedProjects -> String)
-> ([ListSharedProjects] -> ShowS)
-> Show ListSharedProjects
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListSharedProjects] -> ShowS
$cshowList :: [ListSharedProjects] -> ShowS
show :: ListSharedProjects -> String
$cshow :: ListSharedProjects -> String
showsPrec :: Int -> ListSharedProjects -> ShowS
$cshowsPrec :: Int -> ListSharedProjects -> ShowS
Prelude.Show, (forall x. ListSharedProjects -> Rep ListSharedProjects x)
-> (forall x. Rep ListSharedProjects x -> ListSharedProjects)
-> Generic ListSharedProjects
forall x. Rep ListSharedProjects x -> ListSharedProjects
forall x. ListSharedProjects -> Rep ListSharedProjects x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListSharedProjects x -> ListSharedProjects
$cfrom :: forall x. ListSharedProjects -> Rep ListSharedProjects x
Prelude.Generic)

-- |
-- Create a value of 'ListSharedProjects' 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:
--
-- 'sortOrder', 'listSharedProjects_sortOrder' - The order in which to list shared build projects. Valid values include:
--
-- -   @ASCENDING@: List in ascending order.
--
-- -   @DESCENDING@: List in descending order.
--
-- 'nextToken', 'listSharedProjects_nextToken' - During a previous call, the maximum number of items that can be returned
-- is the value specified in @maxResults@. If there more items in the list,
-- then a unique string called a /nextToken/ is returned. 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.
--
-- 'maxResults', 'listSharedProjects_maxResults' - The maximum number of paginated shared build projects returned per
-- response. Use @nextToken@ to iterate pages in the list of returned
-- @Project@ objects. The default value is 100.
--
-- 'sortBy', 'listSharedProjects_sortBy' - The criterion to be used to list build projects shared with the current
-- Amazon Web Services account or user. Valid values include:
--
-- -   @ARN@: List based on the ARN.
--
-- -   @MODIFIED_TIME@: List based on when information about the shared
--     project was last changed.
newListSharedProjects ::
  ListSharedProjects
newListSharedProjects :: ListSharedProjects
newListSharedProjects =
  ListSharedProjects' :: Maybe SortOrderType
-> Maybe Text
-> Maybe Natural
-> Maybe SharedResourceSortByType
-> ListSharedProjects
ListSharedProjects'
    { $sel:sortOrder:ListSharedProjects' :: Maybe SortOrderType
sortOrder = Maybe SortOrderType
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListSharedProjects' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListSharedProjects' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:sortBy:ListSharedProjects' :: Maybe SharedResourceSortByType
sortBy = Maybe SharedResourceSortByType
forall a. Maybe a
Prelude.Nothing
    }

-- | The order in which to list shared build projects. Valid values include:
--
-- -   @ASCENDING@: List in ascending order.
--
-- -   @DESCENDING@: List in descending order.
listSharedProjects_sortOrder :: Lens.Lens' ListSharedProjects (Prelude.Maybe SortOrderType)
listSharedProjects_sortOrder :: (Maybe SortOrderType -> f (Maybe SortOrderType))
-> ListSharedProjects -> f ListSharedProjects
listSharedProjects_sortOrder = (ListSharedProjects -> Maybe SortOrderType)
-> (ListSharedProjects
    -> Maybe SortOrderType -> ListSharedProjects)
-> Lens
     ListSharedProjects
     ListSharedProjects
     (Maybe SortOrderType)
     (Maybe SortOrderType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSharedProjects' {Maybe SortOrderType
sortOrder :: Maybe SortOrderType
$sel:sortOrder:ListSharedProjects' :: ListSharedProjects -> Maybe SortOrderType
sortOrder} -> Maybe SortOrderType
sortOrder) (\s :: ListSharedProjects
s@ListSharedProjects' {} Maybe SortOrderType
a -> ListSharedProjects
s {$sel:sortOrder:ListSharedProjects' :: Maybe SortOrderType
sortOrder = Maybe SortOrderType
a} :: ListSharedProjects)

-- | During a previous call, the maximum number of items that can be returned
-- is the value specified in @maxResults@. If there more items in the list,
-- then a unique string called a /nextToken/ is returned. 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.
listSharedProjects_nextToken :: Lens.Lens' ListSharedProjects (Prelude.Maybe Prelude.Text)
listSharedProjects_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListSharedProjects -> f ListSharedProjects
listSharedProjects_nextToken = (ListSharedProjects -> Maybe Text)
-> (ListSharedProjects -> Maybe Text -> ListSharedProjects)
-> Lens
     ListSharedProjects ListSharedProjects (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSharedProjects' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListSharedProjects' :: ListSharedProjects -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListSharedProjects
s@ListSharedProjects' {} Maybe Text
a -> ListSharedProjects
s {$sel:nextToken:ListSharedProjects' :: Maybe Text
nextToken = Maybe Text
a} :: ListSharedProjects)

-- | The maximum number of paginated shared build projects returned per
-- response. Use @nextToken@ to iterate pages in the list of returned
-- @Project@ objects. The default value is 100.
listSharedProjects_maxResults :: Lens.Lens' ListSharedProjects (Prelude.Maybe Prelude.Natural)
listSharedProjects_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListSharedProjects -> f ListSharedProjects
listSharedProjects_maxResults = (ListSharedProjects -> Maybe Natural)
-> (ListSharedProjects -> Maybe Natural -> ListSharedProjects)
-> Lens
     ListSharedProjects
     ListSharedProjects
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSharedProjects' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListSharedProjects' :: ListSharedProjects -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListSharedProjects
s@ListSharedProjects' {} Maybe Natural
a -> ListSharedProjects
s {$sel:maxResults:ListSharedProjects' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListSharedProjects)

-- | The criterion to be used to list build projects shared with the current
-- Amazon Web Services account or user. Valid values include:
--
-- -   @ARN@: List based on the ARN.
--
-- -   @MODIFIED_TIME@: List based on when information about the shared
--     project was last changed.
listSharedProjects_sortBy :: Lens.Lens' ListSharedProjects (Prelude.Maybe SharedResourceSortByType)
listSharedProjects_sortBy :: (Maybe SharedResourceSortByType
 -> f (Maybe SharedResourceSortByType))
-> ListSharedProjects -> f ListSharedProjects
listSharedProjects_sortBy = (ListSharedProjects -> Maybe SharedResourceSortByType)
-> (ListSharedProjects
    -> Maybe SharedResourceSortByType -> ListSharedProjects)
-> Lens
     ListSharedProjects
     ListSharedProjects
     (Maybe SharedResourceSortByType)
     (Maybe SharedResourceSortByType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSharedProjects' {Maybe SharedResourceSortByType
sortBy :: Maybe SharedResourceSortByType
$sel:sortBy:ListSharedProjects' :: ListSharedProjects -> Maybe SharedResourceSortByType
sortBy} -> Maybe SharedResourceSortByType
sortBy) (\s :: ListSharedProjects
s@ListSharedProjects' {} Maybe SharedResourceSortByType
a -> ListSharedProjects
s {$sel:sortBy:ListSharedProjects' :: Maybe SharedResourceSortByType
sortBy = Maybe SharedResourceSortByType
a} :: ListSharedProjects)

instance Core.AWSPager ListSharedProjects where
  page :: ListSharedProjects
-> AWSResponse ListSharedProjects -> Maybe ListSharedProjects
page ListSharedProjects
rq AWSResponse ListSharedProjects
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListSharedProjects
ListSharedProjectsResponse
rs
            ListSharedProjectsResponse
-> Getting (First Text) ListSharedProjectsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListSharedProjectsResponse
-> Const (First Text) ListSharedProjectsResponse
Lens' ListSharedProjectsResponse (Maybe Text)
listSharedProjectsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListSharedProjectsResponse
 -> Const (First Text) ListSharedProjectsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListSharedProjectsResponse 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 ListSharedProjects
forall a. Maybe a
Prelude.Nothing
    | Maybe [Text] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListSharedProjects
ListSharedProjectsResponse
rs
            ListSharedProjectsResponse
-> Getting (First [Text]) ListSharedProjectsResponse [Text]
-> Maybe [Text]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe (NonEmpty Text)
 -> Const (First [Text]) (Maybe (NonEmpty Text)))
-> ListSharedProjectsResponse
-> Const (First [Text]) ListSharedProjectsResponse
Lens' ListSharedProjectsResponse (Maybe (NonEmpty Text))
listSharedProjectsResponse_projects
              ((Maybe (NonEmpty Text)
  -> Const (First [Text]) (Maybe (NonEmpty Text)))
 -> ListSharedProjectsResponse
 -> Const (First [Text]) ListSharedProjectsResponse)
-> (([Text] -> Const (First [Text]) [Text])
    -> Maybe (NonEmpty Text)
    -> Const (First [Text]) (Maybe (NonEmpty Text)))
-> Getting (First [Text]) ListSharedProjectsResponse [Text]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> Const (First [Text]) (NonEmpty Text))
-> Maybe (NonEmpty Text)
-> Const (First [Text]) (Maybe (NonEmpty Text))
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
              ((NonEmpty Text -> Const (First [Text]) (NonEmpty Text))
 -> Maybe (NonEmpty Text)
 -> Const (First [Text]) (Maybe (NonEmpty Text)))
-> (([Text] -> Const (First [Text]) [Text])
    -> NonEmpty Text -> Const (First [Text]) (NonEmpty Text))
-> ([Text] -> Const (First [Text]) [Text])
-> Maybe (NonEmpty Text)
-> Const (First [Text]) (Maybe (NonEmpty Text))
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> [Text])
-> ([Text] -> Const (First [Text]) [Text])
-> NonEmpty Text
-> Const (First [Text]) (NonEmpty Text)
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to NonEmpty Text -> [Text]
forall l. IsList l => l -> [Item l]
Prelude.toList
        ) =
      Maybe ListSharedProjects
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListSharedProjects -> Maybe ListSharedProjects
forall a. a -> Maybe a
Prelude.Just (ListSharedProjects -> Maybe ListSharedProjects)
-> ListSharedProjects -> Maybe ListSharedProjects
forall a b. (a -> b) -> a -> b
Prelude.$
        ListSharedProjects
rq
          ListSharedProjects
-> (ListSharedProjects -> ListSharedProjects) -> ListSharedProjects
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListSharedProjects -> Identity ListSharedProjects
Lens
  ListSharedProjects ListSharedProjects (Maybe Text) (Maybe Text)
listSharedProjects_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListSharedProjects -> Identity ListSharedProjects)
-> Maybe Text -> ListSharedProjects -> ListSharedProjects
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListSharedProjects
ListSharedProjectsResponse
rs
          ListSharedProjectsResponse
-> Getting (First Text) ListSharedProjectsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListSharedProjectsResponse
-> Const (First Text) ListSharedProjectsResponse
Lens' ListSharedProjectsResponse (Maybe Text)
listSharedProjectsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListSharedProjectsResponse
 -> Const (First Text) ListSharedProjectsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListSharedProjectsResponse 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 ListSharedProjects where
  type
    AWSResponse ListSharedProjects =
      ListSharedProjectsResponse
  request :: ListSharedProjects -> Request ListSharedProjects
request = Service -> ListSharedProjects -> Request ListSharedProjects
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListSharedProjects
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListSharedProjects)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListSharedProjects))
-> Logger
-> Service
-> Proxy ListSharedProjects
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListSharedProjects)))
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 (NonEmpty Text) -> Int -> ListSharedProjectsResponse
ListSharedProjectsResponse'
            (Maybe Text
 -> Maybe (NonEmpty Text) -> Int -> ListSharedProjectsResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe (NonEmpty Text) -> Int -> ListSharedProjectsResponse)
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 (NonEmpty Text) -> Int -> ListSharedProjectsResponse)
-> Either String (Maybe (NonEmpty Text))
-> Either String (Int -> ListSharedProjectsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (NonEmpty Text))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"projects")
            Either String (Int -> ListSharedProjectsResponse)
-> Either String Int -> Either String ListSharedProjectsResponse
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 ListSharedProjects

instance Prelude.NFData ListSharedProjects

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

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

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

-- | /See:/ 'newListSharedProjectsResponse' smart constructor.
data ListSharedProjectsResponse = ListSharedProjectsResponse'
  { -- | During a previous call, the maximum number of items that can be returned
    -- is the value specified in @maxResults@. If there more items in the list,
    -- then a unique string called a /nextToken/ is returned. 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.
    ListSharedProjectsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The list of ARNs for the build projects shared with the current Amazon
    -- Web Services account or user.
    ListSharedProjectsResponse -> Maybe (NonEmpty Text)
projects :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | The response's http status code.
    ListSharedProjectsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListSharedProjectsResponse -> ListSharedProjectsResponse -> Bool
(ListSharedProjectsResponse -> ListSharedProjectsResponse -> Bool)
-> (ListSharedProjectsResponse
    -> ListSharedProjectsResponse -> Bool)
-> Eq ListSharedProjectsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListSharedProjectsResponse -> ListSharedProjectsResponse -> Bool
$c/= :: ListSharedProjectsResponse -> ListSharedProjectsResponse -> Bool
== :: ListSharedProjectsResponse -> ListSharedProjectsResponse -> Bool
$c== :: ListSharedProjectsResponse -> ListSharedProjectsResponse -> Bool
Prelude.Eq, ReadPrec [ListSharedProjectsResponse]
ReadPrec ListSharedProjectsResponse
Int -> ReadS ListSharedProjectsResponse
ReadS [ListSharedProjectsResponse]
(Int -> ReadS ListSharedProjectsResponse)
-> ReadS [ListSharedProjectsResponse]
-> ReadPrec ListSharedProjectsResponse
-> ReadPrec [ListSharedProjectsResponse]
-> Read ListSharedProjectsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListSharedProjectsResponse]
$creadListPrec :: ReadPrec [ListSharedProjectsResponse]
readPrec :: ReadPrec ListSharedProjectsResponse
$creadPrec :: ReadPrec ListSharedProjectsResponse
readList :: ReadS [ListSharedProjectsResponse]
$creadList :: ReadS [ListSharedProjectsResponse]
readsPrec :: Int -> ReadS ListSharedProjectsResponse
$creadsPrec :: Int -> ReadS ListSharedProjectsResponse
Prelude.Read, Int -> ListSharedProjectsResponse -> ShowS
[ListSharedProjectsResponse] -> ShowS
ListSharedProjectsResponse -> String
(Int -> ListSharedProjectsResponse -> ShowS)
-> (ListSharedProjectsResponse -> String)
-> ([ListSharedProjectsResponse] -> ShowS)
-> Show ListSharedProjectsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListSharedProjectsResponse] -> ShowS
$cshowList :: [ListSharedProjectsResponse] -> ShowS
show :: ListSharedProjectsResponse -> String
$cshow :: ListSharedProjectsResponse -> String
showsPrec :: Int -> ListSharedProjectsResponse -> ShowS
$cshowsPrec :: Int -> ListSharedProjectsResponse -> ShowS
Prelude.Show, (forall x.
 ListSharedProjectsResponse -> Rep ListSharedProjectsResponse x)
-> (forall x.
    Rep ListSharedProjectsResponse x -> ListSharedProjectsResponse)
-> Generic ListSharedProjectsResponse
forall x.
Rep ListSharedProjectsResponse x -> ListSharedProjectsResponse
forall x.
ListSharedProjectsResponse -> Rep ListSharedProjectsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListSharedProjectsResponse x -> ListSharedProjectsResponse
$cfrom :: forall x.
ListSharedProjectsResponse -> Rep ListSharedProjectsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListSharedProjectsResponse' 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', 'listSharedProjectsResponse_nextToken' - During a previous call, the maximum number of items that can be returned
-- is the value specified in @maxResults@. If there more items in the list,
-- then a unique string called a /nextToken/ is returned. 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.
--
-- 'projects', 'listSharedProjectsResponse_projects' - The list of ARNs for the build projects shared with the current Amazon
-- Web Services account or user.
--
-- 'httpStatus', 'listSharedProjectsResponse_httpStatus' - The response's http status code.
newListSharedProjectsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListSharedProjectsResponse
newListSharedProjectsResponse :: Int -> ListSharedProjectsResponse
newListSharedProjectsResponse Int
pHttpStatus_ =
  ListSharedProjectsResponse' :: Maybe Text
-> Maybe (NonEmpty Text) -> Int -> ListSharedProjectsResponse
ListSharedProjectsResponse'
    { $sel:nextToken:ListSharedProjectsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:projects:ListSharedProjectsResponse' :: Maybe (NonEmpty Text)
projects = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListSharedProjectsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | During a previous call, the maximum number of items that can be returned
-- is the value specified in @maxResults@. If there more items in the list,
-- then a unique string called a /nextToken/ is returned. 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.
listSharedProjectsResponse_nextToken :: Lens.Lens' ListSharedProjectsResponse (Prelude.Maybe Prelude.Text)
listSharedProjectsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListSharedProjectsResponse -> f ListSharedProjectsResponse
listSharedProjectsResponse_nextToken = (ListSharedProjectsResponse -> Maybe Text)
-> (ListSharedProjectsResponse
    -> Maybe Text -> ListSharedProjectsResponse)
-> Lens' ListSharedProjectsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSharedProjectsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListSharedProjectsResponse' :: ListSharedProjectsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListSharedProjectsResponse
s@ListSharedProjectsResponse' {} Maybe Text
a -> ListSharedProjectsResponse
s {$sel:nextToken:ListSharedProjectsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListSharedProjectsResponse)

-- | The list of ARNs for the build projects shared with the current Amazon
-- Web Services account or user.
listSharedProjectsResponse_projects :: Lens.Lens' ListSharedProjectsResponse (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
listSharedProjectsResponse_projects :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> ListSharedProjectsResponse -> f ListSharedProjectsResponse
listSharedProjectsResponse_projects = (ListSharedProjectsResponse -> Maybe (NonEmpty Text))
-> (ListSharedProjectsResponse
    -> Maybe (NonEmpty Text) -> ListSharedProjectsResponse)
-> Lens' ListSharedProjectsResponse (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSharedProjectsResponse' {Maybe (NonEmpty Text)
projects :: Maybe (NonEmpty Text)
$sel:projects:ListSharedProjectsResponse' :: ListSharedProjectsResponse -> Maybe (NonEmpty Text)
projects} -> Maybe (NonEmpty Text)
projects) (\s :: ListSharedProjectsResponse
s@ListSharedProjectsResponse' {} Maybe (NonEmpty Text)
a -> ListSharedProjectsResponse
s {$sel:projects:ListSharedProjectsResponse' :: Maybe (NonEmpty Text)
projects = Maybe (NonEmpty Text)
a} :: ListSharedProjectsResponse) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> ListSharedProjectsResponse -> f ListSharedProjectsResponse)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> ListSharedProjectsResponse
-> f ListSharedProjectsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty 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
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData ListSharedProjectsResponse