{-# 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.NetworkManager.GetLinkAssociations
-- 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 the link associations for a device or a link. Either the device ID
-- or the link ID must be specified.
--
-- This operation returns paginated results.
module Amazonka.NetworkManager.GetLinkAssociations
  ( -- * Creating a Request
    GetLinkAssociations (..),
    newGetLinkAssociations,

    -- * Request Lenses
    getLinkAssociations_nextToken,
    getLinkAssociations_linkId,
    getLinkAssociations_deviceId,
    getLinkAssociations_maxResults,
    getLinkAssociations_globalNetworkId,

    -- * Destructuring the Response
    GetLinkAssociationsResponse (..),
    newGetLinkAssociationsResponse,

    -- * Response Lenses
    getLinkAssociationsResponse_nextToken,
    getLinkAssociationsResponse_linkAssociations,
    getLinkAssociationsResponse_httpStatus,
  )
where

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

-- | /See:/ 'newGetLinkAssociations' smart constructor.
data GetLinkAssociations = GetLinkAssociations'
  { -- | The token for the next page of results.
    GetLinkAssociations -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The ID of the link.
    GetLinkAssociations -> Maybe Text
linkId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the device.
    GetLinkAssociations -> Maybe Text
deviceId :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to return.
    GetLinkAssociations -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The ID of the global network.
    GetLinkAssociations -> Text
globalNetworkId :: Prelude.Text
  }
  deriving (GetLinkAssociations -> GetLinkAssociations -> Bool
(GetLinkAssociations -> GetLinkAssociations -> Bool)
-> (GetLinkAssociations -> GetLinkAssociations -> Bool)
-> Eq GetLinkAssociations
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetLinkAssociations -> GetLinkAssociations -> Bool
$c/= :: GetLinkAssociations -> GetLinkAssociations -> Bool
== :: GetLinkAssociations -> GetLinkAssociations -> Bool
$c== :: GetLinkAssociations -> GetLinkAssociations -> Bool
Prelude.Eq, ReadPrec [GetLinkAssociations]
ReadPrec GetLinkAssociations
Int -> ReadS GetLinkAssociations
ReadS [GetLinkAssociations]
(Int -> ReadS GetLinkAssociations)
-> ReadS [GetLinkAssociations]
-> ReadPrec GetLinkAssociations
-> ReadPrec [GetLinkAssociations]
-> Read GetLinkAssociations
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetLinkAssociations]
$creadListPrec :: ReadPrec [GetLinkAssociations]
readPrec :: ReadPrec GetLinkAssociations
$creadPrec :: ReadPrec GetLinkAssociations
readList :: ReadS [GetLinkAssociations]
$creadList :: ReadS [GetLinkAssociations]
readsPrec :: Int -> ReadS GetLinkAssociations
$creadsPrec :: Int -> ReadS GetLinkAssociations
Prelude.Read, Int -> GetLinkAssociations -> ShowS
[GetLinkAssociations] -> ShowS
GetLinkAssociations -> String
(Int -> GetLinkAssociations -> ShowS)
-> (GetLinkAssociations -> String)
-> ([GetLinkAssociations] -> ShowS)
-> Show GetLinkAssociations
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetLinkAssociations] -> ShowS
$cshowList :: [GetLinkAssociations] -> ShowS
show :: GetLinkAssociations -> String
$cshow :: GetLinkAssociations -> String
showsPrec :: Int -> GetLinkAssociations -> ShowS
$cshowsPrec :: Int -> GetLinkAssociations -> ShowS
Prelude.Show, (forall x. GetLinkAssociations -> Rep GetLinkAssociations x)
-> (forall x. Rep GetLinkAssociations x -> GetLinkAssociations)
-> Generic GetLinkAssociations
forall x. Rep GetLinkAssociations x -> GetLinkAssociations
forall x. GetLinkAssociations -> Rep GetLinkAssociations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetLinkAssociations x -> GetLinkAssociations
$cfrom :: forall x. GetLinkAssociations -> Rep GetLinkAssociations x
Prelude.Generic)

-- |
-- Create a value of 'GetLinkAssociations' 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', 'getLinkAssociations_nextToken' - The token for the next page of results.
--
-- 'linkId', 'getLinkAssociations_linkId' - The ID of the link.
--
-- 'deviceId', 'getLinkAssociations_deviceId' - The ID of the device.
--
-- 'maxResults', 'getLinkAssociations_maxResults' - The maximum number of results to return.
--
-- 'globalNetworkId', 'getLinkAssociations_globalNetworkId' - The ID of the global network.
newGetLinkAssociations ::
  -- | 'globalNetworkId'
  Prelude.Text ->
  GetLinkAssociations
newGetLinkAssociations :: Text -> GetLinkAssociations
newGetLinkAssociations Text
pGlobalNetworkId_ =
  GetLinkAssociations' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Natural
-> Text
-> GetLinkAssociations
GetLinkAssociations'
    { $sel:nextToken:GetLinkAssociations' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:linkId:GetLinkAssociations' :: Maybe Text
linkId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:deviceId:GetLinkAssociations' :: Maybe Text
deviceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:GetLinkAssociations' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:globalNetworkId:GetLinkAssociations' :: Text
globalNetworkId = Text
pGlobalNetworkId_
    }

-- | The token for the next page of results.
getLinkAssociations_nextToken :: Lens.Lens' GetLinkAssociations (Prelude.Maybe Prelude.Text)
getLinkAssociations_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetLinkAssociations -> f GetLinkAssociations
getLinkAssociations_nextToken = (GetLinkAssociations -> Maybe Text)
-> (GetLinkAssociations -> Maybe Text -> GetLinkAssociations)
-> Lens
     GetLinkAssociations GetLinkAssociations (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLinkAssociations' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetLinkAssociations' :: GetLinkAssociations -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetLinkAssociations
s@GetLinkAssociations' {} Maybe Text
a -> GetLinkAssociations
s {$sel:nextToken:GetLinkAssociations' :: Maybe Text
nextToken = Maybe Text
a} :: GetLinkAssociations)

-- | The ID of the link.
getLinkAssociations_linkId :: Lens.Lens' GetLinkAssociations (Prelude.Maybe Prelude.Text)
getLinkAssociations_linkId :: (Maybe Text -> f (Maybe Text))
-> GetLinkAssociations -> f GetLinkAssociations
getLinkAssociations_linkId = (GetLinkAssociations -> Maybe Text)
-> (GetLinkAssociations -> Maybe Text -> GetLinkAssociations)
-> Lens
     GetLinkAssociations GetLinkAssociations (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLinkAssociations' {Maybe Text
linkId :: Maybe Text
$sel:linkId:GetLinkAssociations' :: GetLinkAssociations -> Maybe Text
linkId} -> Maybe Text
linkId) (\s :: GetLinkAssociations
s@GetLinkAssociations' {} Maybe Text
a -> GetLinkAssociations
s {$sel:linkId:GetLinkAssociations' :: Maybe Text
linkId = Maybe Text
a} :: GetLinkAssociations)

-- | The ID of the device.
getLinkAssociations_deviceId :: Lens.Lens' GetLinkAssociations (Prelude.Maybe Prelude.Text)
getLinkAssociations_deviceId :: (Maybe Text -> f (Maybe Text))
-> GetLinkAssociations -> f GetLinkAssociations
getLinkAssociations_deviceId = (GetLinkAssociations -> Maybe Text)
-> (GetLinkAssociations -> Maybe Text -> GetLinkAssociations)
-> Lens
     GetLinkAssociations GetLinkAssociations (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLinkAssociations' {Maybe Text
deviceId :: Maybe Text
$sel:deviceId:GetLinkAssociations' :: GetLinkAssociations -> Maybe Text
deviceId} -> Maybe Text
deviceId) (\s :: GetLinkAssociations
s@GetLinkAssociations' {} Maybe Text
a -> GetLinkAssociations
s {$sel:deviceId:GetLinkAssociations' :: Maybe Text
deviceId = Maybe Text
a} :: GetLinkAssociations)

-- | The maximum number of results to return.
getLinkAssociations_maxResults :: Lens.Lens' GetLinkAssociations (Prelude.Maybe Prelude.Natural)
getLinkAssociations_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> GetLinkAssociations -> f GetLinkAssociations
getLinkAssociations_maxResults = (GetLinkAssociations -> Maybe Natural)
-> (GetLinkAssociations -> Maybe Natural -> GetLinkAssociations)
-> Lens
     GetLinkAssociations
     GetLinkAssociations
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLinkAssociations' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:GetLinkAssociations' :: GetLinkAssociations -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: GetLinkAssociations
s@GetLinkAssociations' {} Maybe Natural
a -> GetLinkAssociations
s {$sel:maxResults:GetLinkAssociations' :: Maybe Natural
maxResults = Maybe Natural
a} :: GetLinkAssociations)

-- | The ID of the global network.
getLinkAssociations_globalNetworkId :: Lens.Lens' GetLinkAssociations Prelude.Text
getLinkAssociations_globalNetworkId :: (Text -> f Text) -> GetLinkAssociations -> f GetLinkAssociations
getLinkAssociations_globalNetworkId = (GetLinkAssociations -> Text)
-> (GetLinkAssociations -> Text -> GetLinkAssociations)
-> Lens GetLinkAssociations GetLinkAssociations Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLinkAssociations' {Text
globalNetworkId :: Text
$sel:globalNetworkId:GetLinkAssociations' :: GetLinkAssociations -> Text
globalNetworkId} -> Text
globalNetworkId) (\s :: GetLinkAssociations
s@GetLinkAssociations' {} Text
a -> GetLinkAssociations
s {$sel:globalNetworkId:GetLinkAssociations' :: Text
globalNetworkId = Text
a} :: GetLinkAssociations)

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

instance Prelude.NFData GetLinkAssociations

instance Core.ToHeaders GetLinkAssociations where
  toHeaders :: GetLinkAssociations -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetLinkAssociations -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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.ToPath GetLinkAssociations where
  toPath :: GetLinkAssociations -> ByteString
toPath GetLinkAssociations' {Maybe Natural
Maybe Text
Text
globalNetworkId :: Text
maxResults :: Maybe Natural
deviceId :: Maybe Text
linkId :: Maybe Text
nextToken :: Maybe Text
$sel:globalNetworkId:GetLinkAssociations' :: GetLinkAssociations -> Text
$sel:maxResults:GetLinkAssociations' :: GetLinkAssociations -> Maybe Natural
$sel:deviceId:GetLinkAssociations' :: GetLinkAssociations -> Maybe Text
$sel:linkId:GetLinkAssociations' :: GetLinkAssociations -> Maybe Text
$sel:nextToken:GetLinkAssociations' :: GetLinkAssociations -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/global-networks/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
globalNetworkId,
        ByteString
"/link-associations"
      ]

instance Core.ToQuery GetLinkAssociations where
  toQuery :: GetLinkAssociations -> QueryString
toQuery GetLinkAssociations' {Maybe Natural
Maybe Text
Text
globalNetworkId :: Text
maxResults :: Maybe Natural
deviceId :: Maybe Text
linkId :: Maybe Text
nextToken :: Maybe Text
$sel:globalNetworkId:GetLinkAssociations' :: GetLinkAssociations -> Text
$sel:maxResults:GetLinkAssociations' :: GetLinkAssociations -> Maybe Natural
$sel:deviceId:GetLinkAssociations' :: GetLinkAssociations -> Maybe Text
$sel:linkId:GetLinkAssociations' :: GetLinkAssociations -> Maybe Text
$sel:nextToken:GetLinkAssociations' :: GetLinkAssociations -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"nextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"linkId" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
linkId,
        ByteString
"deviceId" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
deviceId,
        ByteString
"maxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults
      ]

-- | /See:/ 'newGetLinkAssociationsResponse' smart constructor.
data GetLinkAssociationsResponse = GetLinkAssociationsResponse'
  { -- | The token for the next page of results.
    GetLinkAssociationsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The link associations.
    GetLinkAssociationsResponse -> Maybe [LinkAssociation]
linkAssociations :: Prelude.Maybe [LinkAssociation],
    -- | The response's http status code.
    GetLinkAssociationsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetLinkAssociationsResponse -> GetLinkAssociationsResponse -> Bool
(GetLinkAssociationsResponse
 -> GetLinkAssociationsResponse -> Bool)
-> (GetLinkAssociationsResponse
    -> GetLinkAssociationsResponse -> Bool)
-> Eq GetLinkAssociationsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetLinkAssociationsResponse -> GetLinkAssociationsResponse -> Bool
$c/= :: GetLinkAssociationsResponse -> GetLinkAssociationsResponse -> Bool
== :: GetLinkAssociationsResponse -> GetLinkAssociationsResponse -> Bool
$c== :: GetLinkAssociationsResponse -> GetLinkAssociationsResponse -> Bool
Prelude.Eq, ReadPrec [GetLinkAssociationsResponse]
ReadPrec GetLinkAssociationsResponse
Int -> ReadS GetLinkAssociationsResponse
ReadS [GetLinkAssociationsResponse]
(Int -> ReadS GetLinkAssociationsResponse)
-> ReadS [GetLinkAssociationsResponse]
-> ReadPrec GetLinkAssociationsResponse
-> ReadPrec [GetLinkAssociationsResponse]
-> Read GetLinkAssociationsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetLinkAssociationsResponse]
$creadListPrec :: ReadPrec [GetLinkAssociationsResponse]
readPrec :: ReadPrec GetLinkAssociationsResponse
$creadPrec :: ReadPrec GetLinkAssociationsResponse
readList :: ReadS [GetLinkAssociationsResponse]
$creadList :: ReadS [GetLinkAssociationsResponse]
readsPrec :: Int -> ReadS GetLinkAssociationsResponse
$creadsPrec :: Int -> ReadS GetLinkAssociationsResponse
Prelude.Read, Int -> GetLinkAssociationsResponse -> ShowS
[GetLinkAssociationsResponse] -> ShowS
GetLinkAssociationsResponse -> String
(Int -> GetLinkAssociationsResponse -> ShowS)
-> (GetLinkAssociationsResponse -> String)
-> ([GetLinkAssociationsResponse] -> ShowS)
-> Show GetLinkAssociationsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetLinkAssociationsResponse] -> ShowS
$cshowList :: [GetLinkAssociationsResponse] -> ShowS
show :: GetLinkAssociationsResponse -> String
$cshow :: GetLinkAssociationsResponse -> String
showsPrec :: Int -> GetLinkAssociationsResponse -> ShowS
$cshowsPrec :: Int -> GetLinkAssociationsResponse -> ShowS
Prelude.Show, (forall x.
 GetLinkAssociationsResponse -> Rep GetLinkAssociationsResponse x)
-> (forall x.
    Rep GetLinkAssociationsResponse x -> GetLinkAssociationsResponse)
-> Generic GetLinkAssociationsResponse
forall x.
Rep GetLinkAssociationsResponse x -> GetLinkAssociationsResponse
forall x.
GetLinkAssociationsResponse -> Rep GetLinkAssociationsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetLinkAssociationsResponse x -> GetLinkAssociationsResponse
$cfrom :: forall x.
GetLinkAssociationsResponse -> Rep GetLinkAssociationsResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetLinkAssociationsResponse' 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', 'getLinkAssociationsResponse_nextToken' - The token for the next page of results.
--
-- 'linkAssociations', 'getLinkAssociationsResponse_linkAssociations' - The link associations.
--
-- 'httpStatus', 'getLinkAssociationsResponse_httpStatus' - The response's http status code.
newGetLinkAssociationsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetLinkAssociationsResponse
newGetLinkAssociationsResponse :: Int -> GetLinkAssociationsResponse
newGetLinkAssociationsResponse Int
pHttpStatus_ =
  GetLinkAssociationsResponse' :: Maybe Text
-> Maybe [LinkAssociation] -> Int -> GetLinkAssociationsResponse
GetLinkAssociationsResponse'
    { $sel:nextToken:GetLinkAssociationsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:linkAssociations:GetLinkAssociationsResponse' :: Maybe [LinkAssociation]
linkAssociations = Maybe [LinkAssociation]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetLinkAssociationsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The token for the next page of results.
getLinkAssociationsResponse_nextToken :: Lens.Lens' GetLinkAssociationsResponse (Prelude.Maybe Prelude.Text)
getLinkAssociationsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetLinkAssociationsResponse -> f GetLinkAssociationsResponse
getLinkAssociationsResponse_nextToken = (GetLinkAssociationsResponse -> Maybe Text)
-> (GetLinkAssociationsResponse
    -> Maybe Text -> GetLinkAssociationsResponse)
-> Lens' GetLinkAssociationsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLinkAssociationsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetLinkAssociationsResponse' :: GetLinkAssociationsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetLinkAssociationsResponse
s@GetLinkAssociationsResponse' {} Maybe Text
a -> GetLinkAssociationsResponse
s {$sel:nextToken:GetLinkAssociationsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetLinkAssociationsResponse)

-- | The link associations.
getLinkAssociationsResponse_linkAssociations :: Lens.Lens' GetLinkAssociationsResponse (Prelude.Maybe [LinkAssociation])
getLinkAssociationsResponse_linkAssociations :: (Maybe [LinkAssociation] -> f (Maybe [LinkAssociation]))
-> GetLinkAssociationsResponse -> f GetLinkAssociationsResponse
getLinkAssociationsResponse_linkAssociations = (GetLinkAssociationsResponse -> Maybe [LinkAssociation])
-> (GetLinkAssociationsResponse
    -> Maybe [LinkAssociation] -> GetLinkAssociationsResponse)
-> Lens' GetLinkAssociationsResponse (Maybe [LinkAssociation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLinkAssociationsResponse' {Maybe [LinkAssociation]
linkAssociations :: Maybe [LinkAssociation]
$sel:linkAssociations:GetLinkAssociationsResponse' :: GetLinkAssociationsResponse -> Maybe [LinkAssociation]
linkAssociations} -> Maybe [LinkAssociation]
linkAssociations) (\s :: GetLinkAssociationsResponse
s@GetLinkAssociationsResponse' {} Maybe [LinkAssociation]
a -> GetLinkAssociationsResponse
s {$sel:linkAssociations:GetLinkAssociationsResponse' :: Maybe [LinkAssociation]
linkAssociations = Maybe [LinkAssociation]
a} :: GetLinkAssociationsResponse) ((Maybe [LinkAssociation] -> f (Maybe [LinkAssociation]))
 -> GetLinkAssociationsResponse -> f GetLinkAssociationsResponse)
-> ((Maybe [LinkAssociation] -> f (Maybe [LinkAssociation]))
    -> Maybe [LinkAssociation] -> f (Maybe [LinkAssociation]))
-> (Maybe [LinkAssociation] -> f (Maybe [LinkAssociation]))
-> GetLinkAssociationsResponse
-> f GetLinkAssociationsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [LinkAssociation]
  [LinkAssociation]
  [LinkAssociation]
  [LinkAssociation]
-> Iso
     (Maybe [LinkAssociation])
     (Maybe [LinkAssociation])
     (Maybe [LinkAssociation])
     (Maybe [LinkAssociation])
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
  [LinkAssociation]
  [LinkAssociation]
  [LinkAssociation]
  [LinkAssociation]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData GetLinkAssociationsResponse