{-# 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.GetNetworkResources
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Describes the network resources for the specified global network.
--
-- The results include information from the corresponding Describe call for
-- the resource, minus any sensitive information such as pre-shared keys.
--
-- This operation returns paginated results.
module Amazonka.NetworkManager.GetNetworkResources
  ( -- * Creating a Request
    GetNetworkResources (..),
    newGetNetworkResources,

    -- * Request Lenses
    getNetworkResources_accountId,
    getNetworkResources_awsRegion,
    getNetworkResources_coreNetworkId,
    getNetworkResources_maxResults,
    getNetworkResources_nextToken,
    getNetworkResources_registeredGatewayArn,
    getNetworkResources_resourceArn,
    getNetworkResources_resourceType,
    getNetworkResources_globalNetworkId,

    -- * Destructuring the Response
    GetNetworkResourcesResponse (..),
    newGetNetworkResourcesResponse,

    -- * Response Lenses
    getNetworkResourcesResponse_networkResources,
    getNetworkResourcesResponse_nextToken,
    getNetworkResourcesResponse_httpStatus,
  )
where

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

-- | /See:/ 'newGetNetworkResources' smart constructor.
data GetNetworkResources = GetNetworkResources'
  { -- | The Amazon Web Services account ID.
    GetNetworkResources -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Web Services Region.
    GetNetworkResources -> Maybe Text
awsRegion :: Prelude.Maybe Prelude.Text,
    -- | The ID of a core network.
    GetNetworkResources -> Maybe Text
coreNetworkId :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to return.
    GetNetworkResources -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The token for the next page of results.
    GetNetworkResources -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the gateway.
    GetNetworkResources -> Maybe Text
registeredGatewayArn :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the resource.
    GetNetworkResources -> Maybe Text
resourceArn :: Prelude.Maybe Prelude.Text,
    -- | The resource type.
    --
    -- The following are the supported resource types for Direct Connect:
    --
    -- -   @dxcon@ - The definition model is
    --     <https://docs.aws.amazon.com/directconnect/latest/APIReference/API_Connection.html Connection>.
    --
    -- -   @dx-gateway@ - The definition model is
    --     <https://docs.aws.amazon.com/directconnect/latest/APIReference/API_DirectConnectGateway.html DirectConnectGateway>.
    --
    -- -   @dx-vif@ - The definition model is
    --     <https://docs.aws.amazon.com/directconnect/latest/APIReference/API_VirtualInterface.html VirtualInterface>.
    --
    -- The following are the supported resource types for Network Manager:
    --
    -- -   @connection@ - The definition model is
    --     <https://docs.aws.amazon.com/networkmanager/latest/APIReference/API_Connection.html Connection>.
    --
    -- -   @device@ - The definition model is
    --     <https://docs.aws.amazon.com/networkmanager/latest/APIReference/API_Device.html Device>.
    --
    -- -   @link@ - The definition model is
    --     <https://docs.aws.amazon.com/networkmanager/latest/APIReference/API_Link.html Link>.
    --
    -- -   @site@ - The definition model is
    --     <https://docs.aws.amazon.com/networkmanager/latest/APIReference/API_Site.html Site>.
    --
    -- The following are the supported resource types for Amazon VPC:
    --
    -- -   @customer-gateway@ - The definition model is
    --     <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CustomerGateway.html CustomerGateway>.
    --
    -- -   @transit-gateway@ - The definition model is
    --     <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_TransitGateway.html TransitGateway>.
    --
    -- -   @transit-gateway-attachment@ - The definition model is
    --     <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_TransitGatewayAttachment.html TransitGatewayAttachment>.
    --
    -- -   @transit-gateway-connect-peer@ - The definition model is
    --     <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_TransitGatewayConnectPeer.html TransitGatewayConnectPeer>.
    --
    -- -   @transit-gateway-route-table@ - The definition model is
    --     <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_TransitGatewayRouteTable.html TransitGatewayRouteTable>.
    --
    -- -   @vpn-connection@ - The definition model is
    --     <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_VpnConnection.html VpnConnection>.
    GetNetworkResources -> Maybe Text
resourceType :: Prelude.Maybe Prelude.Text,
    -- | The ID of the global network.
    GetNetworkResources -> Text
globalNetworkId :: Prelude.Text
  }
  deriving (GetNetworkResources -> GetNetworkResources -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetNetworkResources -> GetNetworkResources -> Bool
$c/= :: GetNetworkResources -> GetNetworkResources -> Bool
== :: GetNetworkResources -> GetNetworkResources -> Bool
$c== :: GetNetworkResources -> GetNetworkResources -> Bool
Prelude.Eq, ReadPrec [GetNetworkResources]
ReadPrec GetNetworkResources
Int -> ReadS GetNetworkResources
ReadS [GetNetworkResources]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetNetworkResources]
$creadListPrec :: ReadPrec [GetNetworkResources]
readPrec :: ReadPrec GetNetworkResources
$creadPrec :: ReadPrec GetNetworkResources
readList :: ReadS [GetNetworkResources]
$creadList :: ReadS [GetNetworkResources]
readsPrec :: Int -> ReadS GetNetworkResources
$creadsPrec :: Int -> ReadS GetNetworkResources
Prelude.Read, Int -> GetNetworkResources -> ShowS
[GetNetworkResources] -> ShowS
GetNetworkResources -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetNetworkResources] -> ShowS
$cshowList :: [GetNetworkResources] -> ShowS
show :: GetNetworkResources -> String
$cshow :: GetNetworkResources -> String
showsPrec :: Int -> GetNetworkResources -> ShowS
$cshowsPrec :: Int -> GetNetworkResources -> ShowS
Prelude.Show, forall x. Rep GetNetworkResources x -> GetNetworkResources
forall x. GetNetworkResources -> Rep GetNetworkResources x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetNetworkResources x -> GetNetworkResources
$cfrom :: forall x. GetNetworkResources -> Rep GetNetworkResources x
Prelude.Generic)

-- |
-- Create a value of 'GetNetworkResources' 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:
--
-- 'accountId', 'getNetworkResources_accountId' - The Amazon Web Services account ID.
--
-- 'awsRegion', 'getNetworkResources_awsRegion' - The Amazon Web Services Region.
--
-- 'coreNetworkId', 'getNetworkResources_coreNetworkId' - The ID of a core network.
--
-- 'maxResults', 'getNetworkResources_maxResults' - The maximum number of results to return.
--
-- 'nextToken', 'getNetworkResources_nextToken' - The token for the next page of results.
--
-- 'registeredGatewayArn', 'getNetworkResources_registeredGatewayArn' - The ARN of the gateway.
--
-- 'resourceArn', 'getNetworkResources_resourceArn' - The ARN of the resource.
--
-- 'resourceType', 'getNetworkResources_resourceType' - The resource type.
--
-- The following are the supported resource types for Direct Connect:
--
-- -   @dxcon@ - The definition model is
--     <https://docs.aws.amazon.com/directconnect/latest/APIReference/API_Connection.html Connection>.
--
-- -   @dx-gateway@ - The definition model is
--     <https://docs.aws.amazon.com/directconnect/latest/APIReference/API_DirectConnectGateway.html DirectConnectGateway>.
--
-- -   @dx-vif@ - The definition model is
--     <https://docs.aws.amazon.com/directconnect/latest/APIReference/API_VirtualInterface.html VirtualInterface>.
--
-- The following are the supported resource types for Network Manager:
--
-- -   @connection@ - The definition model is
--     <https://docs.aws.amazon.com/networkmanager/latest/APIReference/API_Connection.html Connection>.
--
-- -   @device@ - The definition model is
--     <https://docs.aws.amazon.com/networkmanager/latest/APIReference/API_Device.html Device>.
--
-- -   @link@ - The definition model is
--     <https://docs.aws.amazon.com/networkmanager/latest/APIReference/API_Link.html Link>.
--
-- -   @site@ - The definition model is
--     <https://docs.aws.amazon.com/networkmanager/latest/APIReference/API_Site.html Site>.
--
-- The following are the supported resource types for Amazon VPC:
--
-- -   @customer-gateway@ - The definition model is
--     <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CustomerGateway.html CustomerGateway>.
--
-- -   @transit-gateway@ - The definition model is
--     <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_TransitGateway.html TransitGateway>.
--
-- -   @transit-gateway-attachment@ - The definition model is
--     <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_TransitGatewayAttachment.html TransitGatewayAttachment>.
--
-- -   @transit-gateway-connect-peer@ - The definition model is
--     <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_TransitGatewayConnectPeer.html TransitGatewayConnectPeer>.
--
-- -   @transit-gateway-route-table@ - The definition model is
--     <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_TransitGatewayRouteTable.html TransitGatewayRouteTable>.
--
-- -   @vpn-connection@ - The definition model is
--     <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_VpnConnection.html VpnConnection>.
--
-- 'globalNetworkId', 'getNetworkResources_globalNetworkId' - The ID of the global network.
newGetNetworkResources ::
  -- | 'globalNetworkId'
  Prelude.Text ->
  GetNetworkResources
newGetNetworkResources :: Text -> GetNetworkResources
newGetNetworkResources Text
pGlobalNetworkId_ =
  GetNetworkResources'
    { $sel:accountId:GetNetworkResources' :: Maybe Text
accountId = forall a. Maybe a
Prelude.Nothing,
      $sel:awsRegion:GetNetworkResources' :: Maybe Text
awsRegion = forall a. Maybe a
Prelude.Nothing,
      $sel:coreNetworkId:GetNetworkResources' :: Maybe Text
coreNetworkId = forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:GetNetworkResources' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:GetNetworkResources' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:registeredGatewayArn:GetNetworkResources' :: Maybe Text
registeredGatewayArn = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceArn:GetNetworkResources' :: Maybe Text
resourceArn = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:GetNetworkResources' :: Maybe Text
resourceType = forall a. Maybe a
Prelude.Nothing,
      $sel:globalNetworkId:GetNetworkResources' :: Text
globalNetworkId = Text
pGlobalNetworkId_
    }

-- | The Amazon Web Services account ID.
getNetworkResources_accountId :: Lens.Lens' GetNetworkResources (Prelude.Maybe Prelude.Text)
getNetworkResources_accountId :: Lens' GetNetworkResources (Maybe Text)
getNetworkResources_accountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetNetworkResources' {Maybe Text
accountId :: Maybe Text
$sel:accountId:GetNetworkResources' :: GetNetworkResources -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: GetNetworkResources
s@GetNetworkResources' {} Maybe Text
a -> GetNetworkResources
s {$sel:accountId:GetNetworkResources' :: Maybe Text
accountId = Maybe Text
a} :: GetNetworkResources)

-- | The Amazon Web Services Region.
getNetworkResources_awsRegion :: Lens.Lens' GetNetworkResources (Prelude.Maybe Prelude.Text)
getNetworkResources_awsRegion :: Lens' GetNetworkResources (Maybe Text)
getNetworkResources_awsRegion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetNetworkResources' {Maybe Text
awsRegion :: Maybe Text
$sel:awsRegion:GetNetworkResources' :: GetNetworkResources -> Maybe Text
awsRegion} -> Maybe Text
awsRegion) (\s :: GetNetworkResources
s@GetNetworkResources' {} Maybe Text
a -> GetNetworkResources
s {$sel:awsRegion:GetNetworkResources' :: Maybe Text
awsRegion = Maybe Text
a} :: GetNetworkResources)

-- | The ID of a core network.
getNetworkResources_coreNetworkId :: Lens.Lens' GetNetworkResources (Prelude.Maybe Prelude.Text)
getNetworkResources_coreNetworkId :: Lens' GetNetworkResources (Maybe Text)
getNetworkResources_coreNetworkId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetNetworkResources' {Maybe Text
coreNetworkId :: Maybe Text
$sel:coreNetworkId:GetNetworkResources' :: GetNetworkResources -> Maybe Text
coreNetworkId} -> Maybe Text
coreNetworkId) (\s :: GetNetworkResources
s@GetNetworkResources' {} Maybe Text
a -> GetNetworkResources
s {$sel:coreNetworkId:GetNetworkResources' :: Maybe Text
coreNetworkId = Maybe Text
a} :: GetNetworkResources)

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

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

-- | The ARN of the gateway.
getNetworkResources_registeredGatewayArn :: Lens.Lens' GetNetworkResources (Prelude.Maybe Prelude.Text)
getNetworkResources_registeredGatewayArn :: Lens' GetNetworkResources (Maybe Text)
getNetworkResources_registeredGatewayArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetNetworkResources' {Maybe Text
registeredGatewayArn :: Maybe Text
$sel:registeredGatewayArn:GetNetworkResources' :: GetNetworkResources -> Maybe Text
registeredGatewayArn} -> Maybe Text
registeredGatewayArn) (\s :: GetNetworkResources
s@GetNetworkResources' {} Maybe Text
a -> GetNetworkResources
s {$sel:registeredGatewayArn:GetNetworkResources' :: Maybe Text
registeredGatewayArn = Maybe Text
a} :: GetNetworkResources)

-- | The ARN of the resource.
getNetworkResources_resourceArn :: Lens.Lens' GetNetworkResources (Prelude.Maybe Prelude.Text)
getNetworkResources_resourceArn :: Lens' GetNetworkResources (Maybe Text)
getNetworkResources_resourceArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetNetworkResources' {Maybe Text
resourceArn :: Maybe Text
$sel:resourceArn:GetNetworkResources' :: GetNetworkResources -> Maybe Text
resourceArn} -> Maybe Text
resourceArn) (\s :: GetNetworkResources
s@GetNetworkResources' {} Maybe Text
a -> GetNetworkResources
s {$sel:resourceArn:GetNetworkResources' :: Maybe Text
resourceArn = Maybe Text
a} :: GetNetworkResources)

-- | The resource type.
--
-- The following are the supported resource types for Direct Connect:
--
-- -   @dxcon@ - The definition model is
--     <https://docs.aws.amazon.com/directconnect/latest/APIReference/API_Connection.html Connection>.
--
-- -   @dx-gateway@ - The definition model is
--     <https://docs.aws.amazon.com/directconnect/latest/APIReference/API_DirectConnectGateway.html DirectConnectGateway>.
--
-- -   @dx-vif@ - The definition model is
--     <https://docs.aws.amazon.com/directconnect/latest/APIReference/API_VirtualInterface.html VirtualInterface>.
--
-- The following are the supported resource types for Network Manager:
--
-- -   @connection@ - The definition model is
--     <https://docs.aws.amazon.com/networkmanager/latest/APIReference/API_Connection.html Connection>.
--
-- -   @device@ - The definition model is
--     <https://docs.aws.amazon.com/networkmanager/latest/APIReference/API_Device.html Device>.
--
-- -   @link@ - The definition model is
--     <https://docs.aws.amazon.com/networkmanager/latest/APIReference/API_Link.html Link>.
--
-- -   @site@ - The definition model is
--     <https://docs.aws.amazon.com/networkmanager/latest/APIReference/API_Site.html Site>.
--
-- The following are the supported resource types for Amazon VPC:
--
-- -   @customer-gateway@ - The definition model is
--     <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CustomerGateway.html CustomerGateway>.
--
-- -   @transit-gateway@ - The definition model is
--     <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_TransitGateway.html TransitGateway>.
--
-- -   @transit-gateway-attachment@ - The definition model is
--     <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_TransitGatewayAttachment.html TransitGatewayAttachment>.
--
-- -   @transit-gateway-connect-peer@ - The definition model is
--     <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_TransitGatewayConnectPeer.html TransitGatewayConnectPeer>.
--
-- -   @transit-gateway-route-table@ - The definition model is
--     <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_TransitGatewayRouteTable.html TransitGatewayRouteTable>.
--
-- -   @vpn-connection@ - The definition model is
--     <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_VpnConnection.html VpnConnection>.
getNetworkResources_resourceType :: Lens.Lens' GetNetworkResources (Prelude.Maybe Prelude.Text)
getNetworkResources_resourceType :: Lens' GetNetworkResources (Maybe Text)
getNetworkResources_resourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetNetworkResources' {Maybe Text
resourceType :: Maybe Text
$sel:resourceType:GetNetworkResources' :: GetNetworkResources -> Maybe Text
resourceType} -> Maybe Text
resourceType) (\s :: GetNetworkResources
s@GetNetworkResources' {} Maybe Text
a -> GetNetworkResources
s {$sel:resourceType:GetNetworkResources' :: Maybe Text
resourceType = Maybe Text
a} :: GetNetworkResources)

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

instance Core.AWSPager GetNetworkResources where
  page :: GetNetworkResources
-> AWSResponse GetNetworkResources -> Maybe GetNetworkResources
page GetNetworkResources
rq AWSResponse GetNetworkResources
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse GetNetworkResources
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetNetworkResourcesResponse (Maybe Text)
getNetworkResourcesResponse_nextToken
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse GetNetworkResources
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetNetworkResourcesResponse (Maybe [NetworkResource])
getNetworkResourcesResponse_networkResources
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ GetNetworkResources
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' GetNetworkResources (Maybe Text)
getNetworkResources_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse GetNetworkResources
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetNetworkResourcesResponse (Maybe Text)
getNetworkResourcesResponse_nextToken
          forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest GetNetworkResources where
  type
    AWSResponse GetNetworkResources =
      GetNetworkResourcesResponse
  request :: (Service -> Service)
-> GetNetworkResources -> Request GetNetworkResources
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetNetworkResources
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetNetworkResources)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe [NetworkResource]
-> Maybe Text -> Int -> GetNetworkResourcesResponse
GetNetworkResourcesResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"NetworkResources"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"NextToken")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable GetNetworkResources where
  hashWithSalt :: Int -> GetNetworkResources -> Int
hashWithSalt Int
_salt GetNetworkResources' {Maybe Natural
Maybe Text
Text
globalNetworkId :: Text
resourceType :: Maybe Text
resourceArn :: Maybe Text
registeredGatewayArn :: Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
coreNetworkId :: Maybe Text
awsRegion :: Maybe Text
accountId :: Maybe Text
$sel:globalNetworkId:GetNetworkResources' :: GetNetworkResources -> Text
$sel:resourceType:GetNetworkResources' :: GetNetworkResources -> Maybe Text
$sel:resourceArn:GetNetworkResources' :: GetNetworkResources -> Maybe Text
$sel:registeredGatewayArn:GetNetworkResources' :: GetNetworkResources -> Maybe Text
$sel:nextToken:GetNetworkResources' :: GetNetworkResources -> Maybe Text
$sel:maxResults:GetNetworkResources' :: GetNetworkResources -> Maybe Natural
$sel:coreNetworkId:GetNetworkResources' :: GetNetworkResources -> Maybe Text
$sel:awsRegion:GetNetworkResources' :: GetNetworkResources -> Maybe Text
$sel:accountId:GetNetworkResources' :: GetNetworkResources -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
accountId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
awsRegion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
coreNetworkId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
registeredGatewayArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
resourceArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
resourceType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
globalNetworkId

instance Prelude.NFData GetNetworkResources where
  rnf :: GetNetworkResources -> ()
rnf GetNetworkResources' {Maybe Natural
Maybe Text
Text
globalNetworkId :: Text
resourceType :: Maybe Text
resourceArn :: Maybe Text
registeredGatewayArn :: Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
coreNetworkId :: Maybe Text
awsRegion :: Maybe Text
accountId :: Maybe Text
$sel:globalNetworkId:GetNetworkResources' :: GetNetworkResources -> Text
$sel:resourceType:GetNetworkResources' :: GetNetworkResources -> Maybe Text
$sel:resourceArn:GetNetworkResources' :: GetNetworkResources -> Maybe Text
$sel:registeredGatewayArn:GetNetworkResources' :: GetNetworkResources -> Maybe Text
$sel:nextToken:GetNetworkResources' :: GetNetworkResources -> Maybe Text
$sel:maxResults:GetNetworkResources' :: GetNetworkResources -> Maybe Natural
$sel:coreNetworkId:GetNetworkResources' :: GetNetworkResources -> Maybe Text
$sel:awsRegion:GetNetworkResources' :: GetNetworkResources -> Maybe Text
$sel:accountId:GetNetworkResources' :: GetNetworkResources -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
accountId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
awsRegion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
coreNetworkId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
registeredGatewayArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
resourceArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
resourceType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
globalNetworkId

instance Data.ToHeaders GetNetworkResources where
  toHeaders :: GetNetworkResources -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToPath GetNetworkResources where
  toPath :: GetNetworkResources -> ByteString
toPath GetNetworkResources' {Maybe Natural
Maybe Text
Text
globalNetworkId :: Text
resourceType :: Maybe Text
resourceArn :: Maybe Text
registeredGatewayArn :: Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
coreNetworkId :: Maybe Text
awsRegion :: Maybe Text
accountId :: Maybe Text
$sel:globalNetworkId:GetNetworkResources' :: GetNetworkResources -> Text
$sel:resourceType:GetNetworkResources' :: GetNetworkResources -> Maybe Text
$sel:resourceArn:GetNetworkResources' :: GetNetworkResources -> Maybe Text
$sel:registeredGatewayArn:GetNetworkResources' :: GetNetworkResources -> Maybe Text
$sel:nextToken:GetNetworkResources' :: GetNetworkResources -> Maybe Text
$sel:maxResults:GetNetworkResources' :: GetNetworkResources -> Maybe Natural
$sel:coreNetworkId:GetNetworkResources' :: GetNetworkResources -> Maybe Text
$sel:awsRegion:GetNetworkResources' :: GetNetworkResources -> Maybe Text
$sel:accountId:GetNetworkResources' :: GetNetworkResources -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/global-networks/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
globalNetworkId,
        ByteString
"/network-resources"
      ]

instance Data.ToQuery GetNetworkResources where
  toQuery :: GetNetworkResources -> QueryString
toQuery GetNetworkResources' {Maybe Natural
Maybe Text
Text
globalNetworkId :: Text
resourceType :: Maybe Text
resourceArn :: Maybe Text
registeredGatewayArn :: Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
coreNetworkId :: Maybe Text
awsRegion :: Maybe Text
accountId :: Maybe Text
$sel:globalNetworkId:GetNetworkResources' :: GetNetworkResources -> Text
$sel:resourceType:GetNetworkResources' :: GetNetworkResources -> Maybe Text
$sel:resourceArn:GetNetworkResources' :: GetNetworkResources -> Maybe Text
$sel:registeredGatewayArn:GetNetworkResources' :: GetNetworkResources -> Maybe Text
$sel:nextToken:GetNetworkResources' :: GetNetworkResources -> Maybe Text
$sel:maxResults:GetNetworkResources' :: GetNetworkResources -> Maybe Natural
$sel:coreNetworkId:GetNetworkResources' :: GetNetworkResources -> Maybe Text
$sel:awsRegion:GetNetworkResources' :: GetNetworkResources -> Maybe Text
$sel:accountId:GetNetworkResources' :: GetNetworkResources -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"accountId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
accountId,
        ByteString
"awsRegion" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
awsRegion,
        ByteString
"coreNetworkId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
coreNetworkId,
        ByteString
"maxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxResults,
        ByteString
"nextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken,
        ByteString
"registeredGatewayArn" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
registeredGatewayArn,
        ByteString
"resourceArn" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
resourceArn,
        ByteString
"resourceType" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
resourceType
      ]

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

-- |
-- Create a value of 'GetNetworkResourcesResponse' 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:
--
-- 'networkResources', 'getNetworkResourcesResponse_networkResources' - The network resources.
--
-- 'nextToken', 'getNetworkResourcesResponse_nextToken' - The token for the next page of results.
--
-- 'httpStatus', 'getNetworkResourcesResponse_httpStatus' - The response's http status code.
newGetNetworkResourcesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetNetworkResourcesResponse
newGetNetworkResourcesResponse :: Int -> GetNetworkResourcesResponse
newGetNetworkResourcesResponse Int
pHttpStatus_ =
  GetNetworkResourcesResponse'
    { $sel:networkResources:GetNetworkResourcesResponse' :: Maybe [NetworkResource]
networkResources =
        forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:GetNetworkResourcesResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetNetworkResourcesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The network resources.
getNetworkResourcesResponse_networkResources :: Lens.Lens' GetNetworkResourcesResponse (Prelude.Maybe [NetworkResource])
getNetworkResourcesResponse_networkResources :: Lens' GetNetworkResourcesResponse (Maybe [NetworkResource])
getNetworkResourcesResponse_networkResources = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetNetworkResourcesResponse' {Maybe [NetworkResource]
networkResources :: Maybe [NetworkResource]
$sel:networkResources:GetNetworkResourcesResponse' :: GetNetworkResourcesResponse -> Maybe [NetworkResource]
networkResources} -> Maybe [NetworkResource]
networkResources) (\s :: GetNetworkResourcesResponse
s@GetNetworkResourcesResponse' {} Maybe [NetworkResource]
a -> GetNetworkResourcesResponse
s {$sel:networkResources:GetNetworkResourcesResponse' :: Maybe [NetworkResource]
networkResources = Maybe [NetworkResource]
a} :: GetNetworkResourcesResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

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

instance Prelude.NFData GetNetworkResourcesResponse where
  rnf :: GetNetworkResourcesResponse -> ()
rnf GetNetworkResourcesResponse' {Int
Maybe [NetworkResource]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
networkResources :: Maybe [NetworkResource]
$sel:httpStatus:GetNetworkResourcesResponse' :: GetNetworkResourcesResponse -> Int
$sel:nextToken:GetNetworkResourcesResponse' :: GetNetworkResourcesResponse -> Maybe Text
$sel:networkResources:GetNetworkResourcesResponse' :: GetNetworkResourcesResponse -> Maybe [NetworkResource]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [NetworkResource]
networkResources
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus