{-# 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.CodeDeploy.ListOnPremisesInstances
-- 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 names for one or more on-premises instances.
--
-- Unless otherwise specified, both registered and deregistered on-premises
-- instance names are listed. To list only registered or deregistered
-- on-premises instance names, use the registration status parameter.
--
-- This operation returns paginated results.
module Amazonka.CodeDeploy.ListOnPremisesInstances
  ( -- * Creating a Request
    ListOnPremisesInstances (..),
    newListOnPremisesInstances,

    -- * Request Lenses
    listOnPremisesInstances_tagFilters,
    listOnPremisesInstances_nextToken,
    listOnPremisesInstances_registrationStatus,

    -- * Destructuring the Response
    ListOnPremisesInstancesResponse (..),
    newListOnPremisesInstancesResponse,

    -- * Response Lenses
    listOnPremisesInstancesResponse_nextToken,
    listOnPremisesInstancesResponse_instanceNames,
    listOnPremisesInstancesResponse_httpStatus,
  )
where

import Amazonka.CodeDeploy.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

-- | Represents the input of a @ListOnPremisesInstances@ operation.
--
-- /See:/ 'newListOnPremisesInstances' smart constructor.
data ListOnPremisesInstances = ListOnPremisesInstances'
  { -- | The on-premises instance tags that are used to restrict the on-premises
    -- instance names returned.
    ListOnPremisesInstances -> Maybe [TagFilter]
tagFilters :: Prelude.Maybe [TagFilter],
    -- | An identifier returned from the previous list on-premises instances
    -- call. It can be used to return the next set of on-premises instances in
    -- the list.
    ListOnPremisesInstances -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The registration status of the on-premises instances:
    --
    -- -   @Deregistered@: Include deregistered on-premises instances in the
    --     resulting list.
    --
    -- -   @Registered@: Include registered on-premises instances in the
    --     resulting list.
    ListOnPremisesInstances -> Maybe RegistrationStatus
registrationStatus :: Prelude.Maybe RegistrationStatus
  }
  deriving (ListOnPremisesInstances -> ListOnPremisesInstances -> Bool
(ListOnPremisesInstances -> ListOnPremisesInstances -> Bool)
-> (ListOnPremisesInstances -> ListOnPremisesInstances -> Bool)
-> Eq ListOnPremisesInstances
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListOnPremisesInstances -> ListOnPremisesInstances -> Bool
$c/= :: ListOnPremisesInstances -> ListOnPremisesInstances -> Bool
== :: ListOnPremisesInstances -> ListOnPremisesInstances -> Bool
$c== :: ListOnPremisesInstances -> ListOnPremisesInstances -> Bool
Prelude.Eq, ReadPrec [ListOnPremisesInstances]
ReadPrec ListOnPremisesInstances
Int -> ReadS ListOnPremisesInstances
ReadS [ListOnPremisesInstances]
(Int -> ReadS ListOnPremisesInstances)
-> ReadS [ListOnPremisesInstances]
-> ReadPrec ListOnPremisesInstances
-> ReadPrec [ListOnPremisesInstances]
-> Read ListOnPremisesInstances
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListOnPremisesInstances]
$creadListPrec :: ReadPrec [ListOnPremisesInstances]
readPrec :: ReadPrec ListOnPremisesInstances
$creadPrec :: ReadPrec ListOnPremisesInstances
readList :: ReadS [ListOnPremisesInstances]
$creadList :: ReadS [ListOnPremisesInstances]
readsPrec :: Int -> ReadS ListOnPremisesInstances
$creadsPrec :: Int -> ReadS ListOnPremisesInstances
Prelude.Read, Int -> ListOnPremisesInstances -> ShowS
[ListOnPremisesInstances] -> ShowS
ListOnPremisesInstances -> String
(Int -> ListOnPremisesInstances -> ShowS)
-> (ListOnPremisesInstances -> String)
-> ([ListOnPremisesInstances] -> ShowS)
-> Show ListOnPremisesInstances
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListOnPremisesInstances] -> ShowS
$cshowList :: [ListOnPremisesInstances] -> ShowS
show :: ListOnPremisesInstances -> String
$cshow :: ListOnPremisesInstances -> String
showsPrec :: Int -> ListOnPremisesInstances -> ShowS
$cshowsPrec :: Int -> ListOnPremisesInstances -> ShowS
Prelude.Show, (forall x.
 ListOnPremisesInstances -> Rep ListOnPremisesInstances x)
-> (forall x.
    Rep ListOnPremisesInstances x -> ListOnPremisesInstances)
-> Generic ListOnPremisesInstances
forall x. Rep ListOnPremisesInstances x -> ListOnPremisesInstances
forall x. ListOnPremisesInstances -> Rep ListOnPremisesInstances x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListOnPremisesInstances x -> ListOnPremisesInstances
$cfrom :: forall x. ListOnPremisesInstances -> Rep ListOnPremisesInstances x
Prelude.Generic)

-- |
-- Create a value of 'ListOnPremisesInstances' 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:
--
-- 'tagFilters', 'listOnPremisesInstances_tagFilters' - The on-premises instance tags that are used to restrict the on-premises
-- instance names returned.
--
-- 'nextToken', 'listOnPremisesInstances_nextToken' - An identifier returned from the previous list on-premises instances
-- call. It can be used to return the next set of on-premises instances in
-- the list.
--
-- 'registrationStatus', 'listOnPremisesInstances_registrationStatus' - The registration status of the on-premises instances:
--
-- -   @Deregistered@: Include deregistered on-premises instances in the
--     resulting list.
--
-- -   @Registered@: Include registered on-premises instances in the
--     resulting list.
newListOnPremisesInstances ::
  ListOnPremisesInstances
newListOnPremisesInstances :: ListOnPremisesInstances
newListOnPremisesInstances =
  ListOnPremisesInstances' :: Maybe [TagFilter]
-> Maybe Text
-> Maybe RegistrationStatus
-> ListOnPremisesInstances
ListOnPremisesInstances'
    { $sel:tagFilters:ListOnPremisesInstances' :: Maybe [TagFilter]
tagFilters =
        Maybe [TagFilter]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListOnPremisesInstances' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:registrationStatus:ListOnPremisesInstances' :: Maybe RegistrationStatus
registrationStatus = Maybe RegistrationStatus
forall a. Maybe a
Prelude.Nothing
    }

-- | The on-premises instance tags that are used to restrict the on-premises
-- instance names returned.
listOnPremisesInstances_tagFilters :: Lens.Lens' ListOnPremisesInstances (Prelude.Maybe [TagFilter])
listOnPremisesInstances_tagFilters :: (Maybe [TagFilter] -> f (Maybe [TagFilter]))
-> ListOnPremisesInstances -> f ListOnPremisesInstances
listOnPremisesInstances_tagFilters = (ListOnPremisesInstances -> Maybe [TagFilter])
-> (ListOnPremisesInstances
    -> Maybe [TagFilter] -> ListOnPremisesInstances)
-> Lens
     ListOnPremisesInstances
     ListOnPremisesInstances
     (Maybe [TagFilter])
     (Maybe [TagFilter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOnPremisesInstances' {Maybe [TagFilter]
tagFilters :: Maybe [TagFilter]
$sel:tagFilters:ListOnPremisesInstances' :: ListOnPremisesInstances -> Maybe [TagFilter]
tagFilters} -> Maybe [TagFilter]
tagFilters) (\s :: ListOnPremisesInstances
s@ListOnPremisesInstances' {} Maybe [TagFilter]
a -> ListOnPremisesInstances
s {$sel:tagFilters:ListOnPremisesInstances' :: Maybe [TagFilter]
tagFilters = Maybe [TagFilter]
a} :: ListOnPremisesInstances) ((Maybe [TagFilter] -> f (Maybe [TagFilter]))
 -> ListOnPremisesInstances -> f ListOnPremisesInstances)
-> ((Maybe [TagFilter] -> f (Maybe [TagFilter]))
    -> Maybe [TagFilter] -> f (Maybe [TagFilter]))
-> (Maybe [TagFilter] -> f (Maybe [TagFilter]))
-> ListOnPremisesInstances
-> f ListOnPremisesInstances
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [TagFilter] [TagFilter] [TagFilter] [TagFilter]
-> Iso
     (Maybe [TagFilter])
     (Maybe [TagFilter])
     (Maybe [TagFilter])
     (Maybe [TagFilter])
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 [TagFilter] [TagFilter] [TagFilter] [TagFilter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An identifier returned from the previous list on-premises instances
-- call. It can be used to return the next set of on-premises instances in
-- the list.
listOnPremisesInstances_nextToken :: Lens.Lens' ListOnPremisesInstances (Prelude.Maybe Prelude.Text)
listOnPremisesInstances_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListOnPremisesInstances -> f ListOnPremisesInstances
listOnPremisesInstances_nextToken = (ListOnPremisesInstances -> Maybe Text)
-> (ListOnPremisesInstances
    -> Maybe Text -> ListOnPremisesInstances)
-> Lens
     ListOnPremisesInstances
     ListOnPremisesInstances
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOnPremisesInstances' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListOnPremisesInstances' :: ListOnPremisesInstances -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListOnPremisesInstances
s@ListOnPremisesInstances' {} Maybe Text
a -> ListOnPremisesInstances
s {$sel:nextToken:ListOnPremisesInstances' :: Maybe Text
nextToken = Maybe Text
a} :: ListOnPremisesInstances)

-- | The registration status of the on-premises instances:
--
-- -   @Deregistered@: Include deregistered on-premises instances in the
--     resulting list.
--
-- -   @Registered@: Include registered on-premises instances in the
--     resulting list.
listOnPremisesInstances_registrationStatus :: Lens.Lens' ListOnPremisesInstances (Prelude.Maybe RegistrationStatus)
listOnPremisesInstances_registrationStatus :: (Maybe RegistrationStatus -> f (Maybe RegistrationStatus))
-> ListOnPremisesInstances -> f ListOnPremisesInstances
listOnPremisesInstances_registrationStatus = (ListOnPremisesInstances -> Maybe RegistrationStatus)
-> (ListOnPremisesInstances
    -> Maybe RegistrationStatus -> ListOnPremisesInstances)
-> Lens
     ListOnPremisesInstances
     ListOnPremisesInstances
     (Maybe RegistrationStatus)
     (Maybe RegistrationStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOnPremisesInstances' {Maybe RegistrationStatus
registrationStatus :: Maybe RegistrationStatus
$sel:registrationStatus:ListOnPremisesInstances' :: ListOnPremisesInstances -> Maybe RegistrationStatus
registrationStatus} -> Maybe RegistrationStatus
registrationStatus) (\s :: ListOnPremisesInstances
s@ListOnPremisesInstances' {} Maybe RegistrationStatus
a -> ListOnPremisesInstances
s {$sel:registrationStatus:ListOnPremisesInstances' :: Maybe RegistrationStatus
registrationStatus = Maybe RegistrationStatus
a} :: ListOnPremisesInstances)

instance Core.AWSPager ListOnPremisesInstances where
  page :: ListOnPremisesInstances
-> AWSResponse ListOnPremisesInstances
-> Maybe ListOnPremisesInstances
page ListOnPremisesInstances
rq AWSResponse ListOnPremisesInstances
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListOnPremisesInstances
ListOnPremisesInstancesResponse
rs
            ListOnPremisesInstancesResponse
-> Getting (First Text) ListOnPremisesInstancesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListOnPremisesInstancesResponse
-> Const (First Text) ListOnPremisesInstancesResponse
Lens' ListOnPremisesInstancesResponse (Maybe Text)
listOnPremisesInstancesResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListOnPremisesInstancesResponse
 -> Const (First Text) ListOnPremisesInstancesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListOnPremisesInstancesResponse 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 ListOnPremisesInstances
forall a. Maybe a
Prelude.Nothing
    | Maybe [Text] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListOnPremisesInstances
ListOnPremisesInstancesResponse
rs
            ListOnPremisesInstancesResponse
-> Getting (First [Text]) ListOnPremisesInstancesResponse [Text]
-> Maybe [Text]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [Text] -> Const (First [Text]) (Maybe [Text]))
-> ListOnPremisesInstancesResponse
-> Const (First [Text]) ListOnPremisesInstancesResponse
Lens' ListOnPremisesInstancesResponse (Maybe [Text])
listOnPremisesInstancesResponse_instanceNames
              ((Maybe [Text] -> Const (First [Text]) (Maybe [Text]))
 -> ListOnPremisesInstancesResponse
 -> Const (First [Text]) ListOnPremisesInstancesResponse)
-> (([Text] -> Const (First [Text]) [Text])
    -> Maybe [Text] -> Const (First [Text]) (Maybe [Text]))
-> Getting (First [Text]) ListOnPremisesInstancesResponse [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 ListOnPremisesInstances
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListOnPremisesInstances -> Maybe ListOnPremisesInstances
forall a. a -> Maybe a
Prelude.Just (ListOnPremisesInstances -> Maybe ListOnPremisesInstances)
-> ListOnPremisesInstances -> Maybe ListOnPremisesInstances
forall a b. (a -> b) -> a -> b
Prelude.$
        ListOnPremisesInstances
rq
          ListOnPremisesInstances
-> (ListOnPremisesInstances -> ListOnPremisesInstances)
-> ListOnPremisesInstances
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListOnPremisesInstances -> Identity ListOnPremisesInstances
Lens
  ListOnPremisesInstances
  ListOnPremisesInstances
  (Maybe Text)
  (Maybe Text)
listOnPremisesInstances_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListOnPremisesInstances -> Identity ListOnPremisesInstances)
-> Maybe Text -> ListOnPremisesInstances -> ListOnPremisesInstances
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListOnPremisesInstances
ListOnPremisesInstancesResponse
rs
          ListOnPremisesInstancesResponse
-> Getting (First Text) ListOnPremisesInstancesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListOnPremisesInstancesResponse
-> Const (First Text) ListOnPremisesInstancesResponse
Lens' ListOnPremisesInstancesResponse (Maybe Text)
listOnPremisesInstancesResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListOnPremisesInstancesResponse
 -> Const (First Text) ListOnPremisesInstancesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListOnPremisesInstancesResponse 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 ListOnPremisesInstances where
  type
    AWSResponse ListOnPremisesInstances =
      ListOnPremisesInstancesResponse
  request :: ListOnPremisesInstances -> Request ListOnPremisesInstances
request = Service
-> ListOnPremisesInstances -> Request ListOnPremisesInstances
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListOnPremisesInstances
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListOnPremisesInstances)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListOnPremisesInstances))
-> Logger
-> Service
-> Proxy ListOnPremisesInstances
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListOnPremisesInstances)))
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 [Text] -> Int -> ListOnPremisesInstancesResponse
ListOnPremisesInstancesResponse'
            (Maybe Text
 -> Maybe [Text] -> Int -> ListOnPremisesInstancesResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe [Text] -> Int -> ListOnPremisesInstancesResponse)
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 [Text] -> Int -> ListOnPremisesInstancesResponse)
-> Either String (Maybe [Text])
-> Either String (Int -> ListOnPremisesInstancesResponse)
forall (f :: * -> *) a b. Applicative f => 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
"instanceNames" 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 (Int -> ListOnPremisesInstancesResponse)
-> Either String Int
-> Either String ListOnPremisesInstancesResponse
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 ListOnPremisesInstances

instance Prelude.NFData ListOnPremisesInstances

instance Core.ToHeaders ListOnPremisesInstances where
  toHeaders :: ListOnPremisesInstances -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListOnPremisesInstances -> 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
"CodeDeploy_20141006.ListOnPremisesInstances" ::
                          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 ListOnPremisesInstances where
  toJSON :: ListOnPremisesInstances -> Value
toJSON ListOnPremisesInstances' {Maybe [TagFilter]
Maybe Text
Maybe RegistrationStatus
registrationStatus :: Maybe RegistrationStatus
nextToken :: Maybe Text
tagFilters :: Maybe [TagFilter]
$sel:registrationStatus:ListOnPremisesInstances' :: ListOnPremisesInstances -> Maybe RegistrationStatus
$sel:nextToken:ListOnPremisesInstances' :: ListOnPremisesInstances -> Maybe Text
$sel:tagFilters:ListOnPremisesInstances' :: ListOnPremisesInstances -> Maybe [TagFilter]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"tagFilters" Text -> [TagFilter] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([TagFilter] -> Pair) -> Maybe [TagFilter] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [TagFilter]
tagFilters,
            (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
"registrationStatus" Text -> RegistrationStatus -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (RegistrationStatus -> Pair)
-> Maybe RegistrationStatus -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RegistrationStatus
registrationStatus
          ]
      )

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

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

-- | Represents the output of the list on-premises instances operation.
--
-- /See:/ 'newListOnPremisesInstancesResponse' smart constructor.
data ListOnPremisesInstancesResponse = ListOnPremisesInstancesResponse'
  { -- | If a large amount of information is returned, an identifier is also
    -- returned. It can be used in a subsequent list on-premises instances call
    -- to return the next set of on-premises instances in the list.
    ListOnPremisesInstancesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The list of matching on-premises instance names.
    ListOnPremisesInstancesResponse -> Maybe [Text]
instanceNames :: Prelude.Maybe [Prelude.Text],
    -- | The response's http status code.
    ListOnPremisesInstancesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListOnPremisesInstancesResponse
-> ListOnPremisesInstancesResponse -> Bool
(ListOnPremisesInstancesResponse
 -> ListOnPremisesInstancesResponse -> Bool)
-> (ListOnPremisesInstancesResponse
    -> ListOnPremisesInstancesResponse -> Bool)
-> Eq ListOnPremisesInstancesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListOnPremisesInstancesResponse
-> ListOnPremisesInstancesResponse -> Bool
$c/= :: ListOnPremisesInstancesResponse
-> ListOnPremisesInstancesResponse -> Bool
== :: ListOnPremisesInstancesResponse
-> ListOnPremisesInstancesResponse -> Bool
$c== :: ListOnPremisesInstancesResponse
-> ListOnPremisesInstancesResponse -> Bool
Prelude.Eq, ReadPrec [ListOnPremisesInstancesResponse]
ReadPrec ListOnPremisesInstancesResponse
Int -> ReadS ListOnPremisesInstancesResponse
ReadS [ListOnPremisesInstancesResponse]
(Int -> ReadS ListOnPremisesInstancesResponse)
-> ReadS [ListOnPremisesInstancesResponse]
-> ReadPrec ListOnPremisesInstancesResponse
-> ReadPrec [ListOnPremisesInstancesResponse]
-> Read ListOnPremisesInstancesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListOnPremisesInstancesResponse]
$creadListPrec :: ReadPrec [ListOnPremisesInstancesResponse]
readPrec :: ReadPrec ListOnPremisesInstancesResponse
$creadPrec :: ReadPrec ListOnPremisesInstancesResponse
readList :: ReadS [ListOnPremisesInstancesResponse]
$creadList :: ReadS [ListOnPremisesInstancesResponse]
readsPrec :: Int -> ReadS ListOnPremisesInstancesResponse
$creadsPrec :: Int -> ReadS ListOnPremisesInstancesResponse
Prelude.Read, Int -> ListOnPremisesInstancesResponse -> ShowS
[ListOnPremisesInstancesResponse] -> ShowS
ListOnPremisesInstancesResponse -> String
(Int -> ListOnPremisesInstancesResponse -> ShowS)
-> (ListOnPremisesInstancesResponse -> String)
-> ([ListOnPremisesInstancesResponse] -> ShowS)
-> Show ListOnPremisesInstancesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListOnPremisesInstancesResponse] -> ShowS
$cshowList :: [ListOnPremisesInstancesResponse] -> ShowS
show :: ListOnPremisesInstancesResponse -> String
$cshow :: ListOnPremisesInstancesResponse -> String
showsPrec :: Int -> ListOnPremisesInstancesResponse -> ShowS
$cshowsPrec :: Int -> ListOnPremisesInstancesResponse -> ShowS
Prelude.Show, (forall x.
 ListOnPremisesInstancesResponse
 -> Rep ListOnPremisesInstancesResponse x)
-> (forall x.
    Rep ListOnPremisesInstancesResponse x
    -> ListOnPremisesInstancesResponse)
-> Generic ListOnPremisesInstancesResponse
forall x.
Rep ListOnPremisesInstancesResponse x
-> ListOnPremisesInstancesResponse
forall x.
ListOnPremisesInstancesResponse
-> Rep ListOnPremisesInstancesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListOnPremisesInstancesResponse x
-> ListOnPremisesInstancesResponse
$cfrom :: forall x.
ListOnPremisesInstancesResponse
-> Rep ListOnPremisesInstancesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListOnPremisesInstancesResponse' 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', 'listOnPremisesInstancesResponse_nextToken' - If a large amount of information is returned, an identifier is also
-- returned. It can be used in a subsequent list on-premises instances call
-- to return the next set of on-premises instances in the list.
--
-- 'instanceNames', 'listOnPremisesInstancesResponse_instanceNames' - The list of matching on-premises instance names.
--
-- 'httpStatus', 'listOnPremisesInstancesResponse_httpStatus' - The response's http status code.
newListOnPremisesInstancesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListOnPremisesInstancesResponse
newListOnPremisesInstancesResponse :: Int -> ListOnPremisesInstancesResponse
newListOnPremisesInstancesResponse Int
pHttpStatus_ =
  ListOnPremisesInstancesResponse' :: Maybe Text
-> Maybe [Text] -> Int -> ListOnPremisesInstancesResponse
ListOnPremisesInstancesResponse'
    { $sel:nextToken:ListOnPremisesInstancesResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:instanceNames:ListOnPremisesInstancesResponse' :: Maybe [Text]
instanceNames = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListOnPremisesInstancesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | If a large amount of information is returned, an identifier is also
-- returned. It can be used in a subsequent list on-premises instances call
-- to return the next set of on-premises instances in the list.
listOnPremisesInstancesResponse_nextToken :: Lens.Lens' ListOnPremisesInstancesResponse (Prelude.Maybe Prelude.Text)
listOnPremisesInstancesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListOnPremisesInstancesResponse
-> f ListOnPremisesInstancesResponse
listOnPremisesInstancesResponse_nextToken = (ListOnPremisesInstancesResponse -> Maybe Text)
-> (ListOnPremisesInstancesResponse
    -> Maybe Text -> ListOnPremisesInstancesResponse)
-> Lens' ListOnPremisesInstancesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOnPremisesInstancesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListOnPremisesInstancesResponse' :: ListOnPremisesInstancesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListOnPremisesInstancesResponse
s@ListOnPremisesInstancesResponse' {} Maybe Text
a -> ListOnPremisesInstancesResponse
s {$sel:nextToken:ListOnPremisesInstancesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListOnPremisesInstancesResponse)

-- | The list of matching on-premises instance names.
listOnPremisesInstancesResponse_instanceNames :: Lens.Lens' ListOnPremisesInstancesResponse (Prelude.Maybe [Prelude.Text])
listOnPremisesInstancesResponse_instanceNames :: (Maybe [Text] -> f (Maybe [Text]))
-> ListOnPremisesInstancesResponse
-> f ListOnPremisesInstancesResponse
listOnPremisesInstancesResponse_instanceNames = (ListOnPremisesInstancesResponse -> Maybe [Text])
-> (ListOnPremisesInstancesResponse
    -> Maybe [Text] -> ListOnPremisesInstancesResponse)
-> Lens' ListOnPremisesInstancesResponse (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListOnPremisesInstancesResponse' {Maybe [Text]
instanceNames :: Maybe [Text]
$sel:instanceNames:ListOnPremisesInstancesResponse' :: ListOnPremisesInstancesResponse -> Maybe [Text]
instanceNames} -> Maybe [Text]
instanceNames) (\s :: ListOnPremisesInstancesResponse
s@ListOnPremisesInstancesResponse' {} Maybe [Text]
a -> ListOnPremisesInstancesResponse
s {$sel:instanceNames:ListOnPremisesInstancesResponse' :: Maybe [Text]
instanceNames = Maybe [Text]
a} :: ListOnPremisesInstancesResponse) ((Maybe [Text] -> f (Maybe [Text]))
 -> ListOnPremisesInstancesResponse
 -> f ListOnPremisesInstancesResponse)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ListOnPremisesInstancesResponse
-> f ListOnPremisesInstancesResponse
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

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

instance
  Prelude.NFData
    ListOnPremisesInstancesResponse