{-# 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.IoTSecureTunneling.OpenTunnel
-- 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)
--
-- Creates a new tunnel, and returns two client access tokens for clients
-- to use to connect to the AWS IoT Secure Tunneling proxy server.
module Amazonka.IoTSecureTunneling.OpenTunnel
  ( -- * Creating a Request
    OpenTunnel (..),
    newOpenTunnel,

    -- * Request Lenses
    openTunnel_destinationConfig,
    openTunnel_description,
    openTunnel_timeoutConfig,
    openTunnel_tags,

    -- * Destructuring the Response
    OpenTunnelResponse (..),
    newOpenTunnelResponse,

    -- * Response Lenses
    openTunnelResponse_sourceAccessToken,
    openTunnelResponse_tunnelArn,
    openTunnelResponse_destinationAccessToken,
    openTunnelResponse_tunnelId,
    openTunnelResponse_httpStatus,
  )
where

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

-- | /See:/ 'newOpenTunnel' smart constructor.
data OpenTunnel = OpenTunnel'
  { -- | The destination configuration for the OpenTunnel request.
    OpenTunnel -> Maybe DestinationConfig
destinationConfig :: Prelude.Maybe DestinationConfig,
    -- | A short text description of the tunnel.
    OpenTunnel -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | Timeout configuration for a tunnel.
    OpenTunnel -> Maybe TimeoutConfig
timeoutConfig :: Prelude.Maybe TimeoutConfig,
    -- | A collection of tag metadata.
    OpenTunnel -> Maybe (NonEmpty Tag)
tags :: Prelude.Maybe (Prelude.NonEmpty Tag)
  }
  deriving (OpenTunnel -> OpenTunnel -> Bool
(OpenTunnel -> OpenTunnel -> Bool)
-> (OpenTunnel -> OpenTunnel -> Bool) -> Eq OpenTunnel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OpenTunnel -> OpenTunnel -> Bool
$c/= :: OpenTunnel -> OpenTunnel -> Bool
== :: OpenTunnel -> OpenTunnel -> Bool
$c== :: OpenTunnel -> OpenTunnel -> Bool
Prelude.Eq, ReadPrec [OpenTunnel]
ReadPrec OpenTunnel
Int -> ReadS OpenTunnel
ReadS [OpenTunnel]
(Int -> ReadS OpenTunnel)
-> ReadS [OpenTunnel]
-> ReadPrec OpenTunnel
-> ReadPrec [OpenTunnel]
-> Read OpenTunnel
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OpenTunnel]
$creadListPrec :: ReadPrec [OpenTunnel]
readPrec :: ReadPrec OpenTunnel
$creadPrec :: ReadPrec OpenTunnel
readList :: ReadS [OpenTunnel]
$creadList :: ReadS [OpenTunnel]
readsPrec :: Int -> ReadS OpenTunnel
$creadsPrec :: Int -> ReadS OpenTunnel
Prelude.Read, Int -> OpenTunnel -> ShowS
[OpenTunnel] -> ShowS
OpenTunnel -> String
(Int -> OpenTunnel -> ShowS)
-> (OpenTunnel -> String)
-> ([OpenTunnel] -> ShowS)
-> Show OpenTunnel
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OpenTunnel] -> ShowS
$cshowList :: [OpenTunnel] -> ShowS
show :: OpenTunnel -> String
$cshow :: OpenTunnel -> String
showsPrec :: Int -> OpenTunnel -> ShowS
$cshowsPrec :: Int -> OpenTunnel -> ShowS
Prelude.Show, (forall x. OpenTunnel -> Rep OpenTunnel x)
-> (forall x. Rep OpenTunnel x -> OpenTunnel) -> Generic OpenTunnel
forall x. Rep OpenTunnel x -> OpenTunnel
forall x. OpenTunnel -> Rep OpenTunnel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OpenTunnel x -> OpenTunnel
$cfrom :: forall x. OpenTunnel -> Rep OpenTunnel x
Prelude.Generic)

-- |
-- Create a value of 'OpenTunnel' 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:
--
-- 'destinationConfig', 'openTunnel_destinationConfig' - The destination configuration for the OpenTunnel request.
--
-- 'description', 'openTunnel_description' - A short text description of the tunnel.
--
-- 'timeoutConfig', 'openTunnel_timeoutConfig' - Timeout configuration for a tunnel.
--
-- 'tags', 'openTunnel_tags' - A collection of tag metadata.
newOpenTunnel ::
  OpenTunnel
newOpenTunnel :: OpenTunnel
newOpenTunnel =
  OpenTunnel' :: Maybe DestinationConfig
-> Maybe Text
-> Maybe TimeoutConfig
-> Maybe (NonEmpty Tag)
-> OpenTunnel
OpenTunnel'
    { $sel:destinationConfig:OpenTunnel' :: Maybe DestinationConfig
destinationConfig = Maybe DestinationConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:description:OpenTunnel' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:timeoutConfig:OpenTunnel' :: Maybe TimeoutConfig
timeoutConfig = Maybe TimeoutConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:OpenTunnel' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
forall a. Maybe a
Prelude.Nothing
    }

-- | The destination configuration for the OpenTunnel request.
openTunnel_destinationConfig :: Lens.Lens' OpenTunnel (Prelude.Maybe DestinationConfig)
openTunnel_destinationConfig :: (Maybe DestinationConfig -> f (Maybe DestinationConfig))
-> OpenTunnel -> f OpenTunnel
openTunnel_destinationConfig = (OpenTunnel -> Maybe DestinationConfig)
-> (OpenTunnel -> Maybe DestinationConfig -> OpenTunnel)
-> Lens
     OpenTunnel
     OpenTunnel
     (Maybe DestinationConfig)
     (Maybe DestinationConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OpenTunnel' {Maybe DestinationConfig
destinationConfig :: Maybe DestinationConfig
$sel:destinationConfig:OpenTunnel' :: OpenTunnel -> Maybe DestinationConfig
destinationConfig} -> Maybe DestinationConfig
destinationConfig) (\s :: OpenTunnel
s@OpenTunnel' {} Maybe DestinationConfig
a -> OpenTunnel
s {$sel:destinationConfig:OpenTunnel' :: Maybe DestinationConfig
destinationConfig = Maybe DestinationConfig
a} :: OpenTunnel)

-- | A short text description of the tunnel.
openTunnel_description :: Lens.Lens' OpenTunnel (Prelude.Maybe Prelude.Text)
openTunnel_description :: (Maybe Text -> f (Maybe Text)) -> OpenTunnel -> f OpenTunnel
openTunnel_description = (OpenTunnel -> Maybe Text)
-> (OpenTunnel -> Maybe Text -> OpenTunnel)
-> Lens OpenTunnel OpenTunnel (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OpenTunnel' {Maybe Text
description :: Maybe Text
$sel:description:OpenTunnel' :: OpenTunnel -> Maybe Text
description} -> Maybe Text
description) (\s :: OpenTunnel
s@OpenTunnel' {} Maybe Text
a -> OpenTunnel
s {$sel:description:OpenTunnel' :: Maybe Text
description = Maybe Text
a} :: OpenTunnel)

-- | Timeout configuration for a tunnel.
openTunnel_timeoutConfig :: Lens.Lens' OpenTunnel (Prelude.Maybe TimeoutConfig)
openTunnel_timeoutConfig :: (Maybe TimeoutConfig -> f (Maybe TimeoutConfig))
-> OpenTunnel -> f OpenTunnel
openTunnel_timeoutConfig = (OpenTunnel -> Maybe TimeoutConfig)
-> (OpenTunnel -> Maybe TimeoutConfig -> OpenTunnel)
-> Lens
     OpenTunnel OpenTunnel (Maybe TimeoutConfig) (Maybe TimeoutConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OpenTunnel' {Maybe TimeoutConfig
timeoutConfig :: Maybe TimeoutConfig
$sel:timeoutConfig:OpenTunnel' :: OpenTunnel -> Maybe TimeoutConfig
timeoutConfig} -> Maybe TimeoutConfig
timeoutConfig) (\s :: OpenTunnel
s@OpenTunnel' {} Maybe TimeoutConfig
a -> OpenTunnel
s {$sel:timeoutConfig:OpenTunnel' :: Maybe TimeoutConfig
timeoutConfig = Maybe TimeoutConfig
a} :: OpenTunnel)

-- | A collection of tag metadata.
openTunnel_tags :: Lens.Lens' OpenTunnel (Prelude.Maybe (Prelude.NonEmpty Tag))
openTunnel_tags :: (Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> OpenTunnel -> f OpenTunnel
openTunnel_tags = (OpenTunnel -> Maybe (NonEmpty Tag))
-> (OpenTunnel -> Maybe (NonEmpty Tag) -> OpenTunnel)
-> Lens
     OpenTunnel OpenTunnel (Maybe (NonEmpty Tag)) (Maybe (NonEmpty Tag))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OpenTunnel' {Maybe (NonEmpty Tag)
tags :: Maybe (NonEmpty Tag)
$sel:tags:OpenTunnel' :: OpenTunnel -> Maybe (NonEmpty Tag)
tags} -> Maybe (NonEmpty Tag)
tags) (\s :: OpenTunnel
s@OpenTunnel' {} Maybe (NonEmpty Tag)
a -> OpenTunnel
s {$sel:tags:OpenTunnel' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
a} :: OpenTunnel) ((Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
 -> OpenTunnel -> f OpenTunnel)
-> ((Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
    -> Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> (Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> OpenTunnel
-> f OpenTunnel
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag)
-> Iso
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest OpenTunnel where
  type AWSResponse OpenTunnel = OpenTunnelResponse
  request :: OpenTunnel -> Request OpenTunnel
request = Service -> OpenTunnel -> Request OpenTunnel
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy OpenTunnel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse OpenTunnel)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse OpenTunnel))
-> Logger
-> Service
-> Proxy OpenTunnel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse OpenTunnel)))
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 (Sensitive Text)
-> Maybe Text
-> Maybe (Sensitive Text)
-> Maybe Text
-> Int
-> OpenTunnelResponse
OpenTunnelResponse'
            (Maybe (Sensitive Text)
 -> Maybe Text
 -> Maybe (Sensitive Text)
 -> Maybe Text
 -> Int
 -> OpenTunnelResponse)
-> Either String (Maybe (Sensitive Text))
-> Either
     String
     (Maybe Text
      -> Maybe (Sensitive Text)
      -> Maybe Text
      -> Int
      -> OpenTunnelResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Sensitive Text))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"sourceAccessToken")
            Either
  String
  (Maybe Text
   -> Maybe (Sensitive Text)
   -> Maybe Text
   -> Int
   -> OpenTunnelResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe (Sensitive Text) -> Maybe Text -> Int -> OpenTunnelResponse)
forall (f :: * -> *) a b. Applicative f => 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
"tunnelArn")
            Either
  String
  (Maybe (Sensitive Text) -> Maybe Text -> Int -> OpenTunnelResponse)
-> Either String (Maybe (Sensitive Text))
-> Either String (Maybe Text -> Int -> OpenTunnelResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Sensitive Text))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"destinationAccessToken")
            Either String (Maybe Text -> Int -> OpenTunnelResponse)
-> Either String (Maybe Text)
-> Either String (Int -> OpenTunnelResponse)
forall (f :: * -> *) a b. Applicative f => 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
"tunnelId")
            Either String (Int -> OpenTunnelResponse)
-> Either String Int -> Either String OpenTunnelResponse
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 OpenTunnel

instance Prelude.NFData OpenTunnel

instance Core.ToHeaders OpenTunnel where
  toHeaders :: OpenTunnel -> ResponseHeaders
toHeaders =
    ResponseHeaders -> OpenTunnel -> 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
"IoTSecuredTunneling.OpenTunnel" ::
                          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 OpenTunnel where
  toJSON :: OpenTunnel -> Value
toJSON OpenTunnel' {Maybe (NonEmpty Tag)
Maybe Text
Maybe DestinationConfig
Maybe TimeoutConfig
tags :: Maybe (NonEmpty Tag)
timeoutConfig :: Maybe TimeoutConfig
description :: Maybe Text
destinationConfig :: Maybe DestinationConfig
$sel:tags:OpenTunnel' :: OpenTunnel -> Maybe (NonEmpty Tag)
$sel:timeoutConfig:OpenTunnel' :: OpenTunnel -> Maybe TimeoutConfig
$sel:description:OpenTunnel' :: OpenTunnel -> Maybe Text
$sel:destinationConfig:OpenTunnel' :: OpenTunnel -> Maybe DestinationConfig
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"destinationConfig" Text -> DestinationConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (DestinationConfig -> Pair)
-> Maybe DestinationConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DestinationConfig
destinationConfig,
            (Text
"description" 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
description,
            (Text
"timeoutConfig" Text -> TimeoutConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (TimeoutConfig -> Pair) -> Maybe TimeoutConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe TimeoutConfig
timeoutConfig,
            (Text
"tags" Text -> NonEmpty Tag -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty Tag -> Pair) -> Maybe (NonEmpty Tag) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Tag)
tags
          ]
      )

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

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

-- | /See:/ 'newOpenTunnelResponse' smart constructor.
data OpenTunnelResponse = OpenTunnelResponse'
  { -- | The access token the source local proxy uses to connect to AWS IoT
    -- Secure Tunneling.
    OpenTunnelResponse -> Maybe (Sensitive Text)
sourceAccessToken :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The Amazon Resource Name for the tunnel. The tunnel ARN format is
    -- @arn:aws:tunnel:\<region>:\<account-id>:tunnel\/\<tunnel-id>@
    OpenTunnelResponse -> Maybe Text
tunnelArn :: Prelude.Maybe Prelude.Text,
    -- | The access token the destination local proxy uses to connect to AWS IoT
    -- Secure Tunneling.
    OpenTunnelResponse -> Maybe (Sensitive Text)
destinationAccessToken :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | A unique alpha-numeric tunnel ID.
    OpenTunnelResponse -> Maybe Text
tunnelId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    OpenTunnelResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (OpenTunnelResponse -> OpenTunnelResponse -> Bool
(OpenTunnelResponse -> OpenTunnelResponse -> Bool)
-> (OpenTunnelResponse -> OpenTunnelResponse -> Bool)
-> Eq OpenTunnelResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OpenTunnelResponse -> OpenTunnelResponse -> Bool
$c/= :: OpenTunnelResponse -> OpenTunnelResponse -> Bool
== :: OpenTunnelResponse -> OpenTunnelResponse -> Bool
$c== :: OpenTunnelResponse -> OpenTunnelResponse -> Bool
Prelude.Eq, Int -> OpenTunnelResponse -> ShowS
[OpenTunnelResponse] -> ShowS
OpenTunnelResponse -> String
(Int -> OpenTunnelResponse -> ShowS)
-> (OpenTunnelResponse -> String)
-> ([OpenTunnelResponse] -> ShowS)
-> Show OpenTunnelResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OpenTunnelResponse] -> ShowS
$cshowList :: [OpenTunnelResponse] -> ShowS
show :: OpenTunnelResponse -> String
$cshow :: OpenTunnelResponse -> String
showsPrec :: Int -> OpenTunnelResponse -> ShowS
$cshowsPrec :: Int -> OpenTunnelResponse -> ShowS
Prelude.Show, (forall x. OpenTunnelResponse -> Rep OpenTunnelResponse x)
-> (forall x. Rep OpenTunnelResponse x -> OpenTunnelResponse)
-> Generic OpenTunnelResponse
forall x. Rep OpenTunnelResponse x -> OpenTunnelResponse
forall x. OpenTunnelResponse -> Rep OpenTunnelResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OpenTunnelResponse x -> OpenTunnelResponse
$cfrom :: forall x. OpenTunnelResponse -> Rep OpenTunnelResponse x
Prelude.Generic)

-- |
-- Create a value of 'OpenTunnelResponse' 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:
--
-- 'sourceAccessToken', 'openTunnelResponse_sourceAccessToken' - The access token the source local proxy uses to connect to AWS IoT
-- Secure Tunneling.
--
-- 'tunnelArn', 'openTunnelResponse_tunnelArn' - The Amazon Resource Name for the tunnel. The tunnel ARN format is
-- @arn:aws:tunnel:\<region>:\<account-id>:tunnel\/\<tunnel-id>@
--
-- 'destinationAccessToken', 'openTunnelResponse_destinationAccessToken' - The access token the destination local proxy uses to connect to AWS IoT
-- Secure Tunneling.
--
-- 'tunnelId', 'openTunnelResponse_tunnelId' - A unique alpha-numeric tunnel ID.
--
-- 'httpStatus', 'openTunnelResponse_httpStatus' - The response's http status code.
newOpenTunnelResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  OpenTunnelResponse
newOpenTunnelResponse :: Int -> OpenTunnelResponse
newOpenTunnelResponse Int
pHttpStatus_ =
  OpenTunnelResponse' :: Maybe (Sensitive Text)
-> Maybe Text
-> Maybe (Sensitive Text)
-> Maybe Text
-> Int
-> OpenTunnelResponse
OpenTunnelResponse'
    { $sel:sourceAccessToken:OpenTunnelResponse' :: Maybe (Sensitive Text)
sourceAccessToken =
        Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:tunnelArn:OpenTunnelResponse' :: Maybe Text
tunnelArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:destinationAccessToken:OpenTunnelResponse' :: Maybe (Sensitive Text)
destinationAccessToken = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:tunnelId:OpenTunnelResponse' :: Maybe Text
tunnelId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:OpenTunnelResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The access token the source local proxy uses to connect to AWS IoT
-- Secure Tunneling.
openTunnelResponse_sourceAccessToken :: Lens.Lens' OpenTunnelResponse (Prelude.Maybe Prelude.Text)
openTunnelResponse_sourceAccessToken :: (Maybe Text -> f (Maybe Text))
-> OpenTunnelResponse -> f OpenTunnelResponse
openTunnelResponse_sourceAccessToken = (OpenTunnelResponse -> Maybe (Sensitive Text))
-> (OpenTunnelResponse
    -> Maybe (Sensitive Text) -> OpenTunnelResponse)
-> Lens
     OpenTunnelResponse
     OpenTunnelResponse
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OpenTunnelResponse' {Maybe (Sensitive Text)
sourceAccessToken :: Maybe (Sensitive Text)
$sel:sourceAccessToken:OpenTunnelResponse' :: OpenTunnelResponse -> Maybe (Sensitive Text)
sourceAccessToken} -> Maybe (Sensitive Text)
sourceAccessToken) (\s :: OpenTunnelResponse
s@OpenTunnelResponse' {} Maybe (Sensitive Text)
a -> OpenTunnelResponse
s {$sel:sourceAccessToken:OpenTunnelResponse' :: Maybe (Sensitive Text)
sourceAccessToken = Maybe (Sensitive Text)
a} :: OpenTunnelResponse) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> OpenTunnelResponse -> f OpenTunnelResponse)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> OpenTunnelResponse
-> f OpenTunnelResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive 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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The Amazon Resource Name for the tunnel. The tunnel ARN format is
-- @arn:aws:tunnel:\<region>:\<account-id>:tunnel\/\<tunnel-id>@
openTunnelResponse_tunnelArn :: Lens.Lens' OpenTunnelResponse (Prelude.Maybe Prelude.Text)
openTunnelResponse_tunnelArn :: (Maybe Text -> f (Maybe Text))
-> OpenTunnelResponse -> f OpenTunnelResponse
openTunnelResponse_tunnelArn = (OpenTunnelResponse -> Maybe Text)
-> (OpenTunnelResponse -> Maybe Text -> OpenTunnelResponse)
-> Lens
     OpenTunnelResponse OpenTunnelResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OpenTunnelResponse' {Maybe Text
tunnelArn :: Maybe Text
$sel:tunnelArn:OpenTunnelResponse' :: OpenTunnelResponse -> Maybe Text
tunnelArn} -> Maybe Text
tunnelArn) (\s :: OpenTunnelResponse
s@OpenTunnelResponse' {} Maybe Text
a -> OpenTunnelResponse
s {$sel:tunnelArn:OpenTunnelResponse' :: Maybe Text
tunnelArn = Maybe Text
a} :: OpenTunnelResponse)

-- | The access token the destination local proxy uses to connect to AWS IoT
-- Secure Tunneling.
openTunnelResponse_destinationAccessToken :: Lens.Lens' OpenTunnelResponse (Prelude.Maybe Prelude.Text)
openTunnelResponse_destinationAccessToken :: (Maybe Text -> f (Maybe Text))
-> OpenTunnelResponse -> f OpenTunnelResponse
openTunnelResponse_destinationAccessToken = (OpenTunnelResponse -> Maybe (Sensitive Text))
-> (OpenTunnelResponse
    -> Maybe (Sensitive Text) -> OpenTunnelResponse)
-> Lens
     OpenTunnelResponse
     OpenTunnelResponse
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OpenTunnelResponse' {Maybe (Sensitive Text)
destinationAccessToken :: Maybe (Sensitive Text)
$sel:destinationAccessToken:OpenTunnelResponse' :: OpenTunnelResponse -> Maybe (Sensitive Text)
destinationAccessToken} -> Maybe (Sensitive Text)
destinationAccessToken) (\s :: OpenTunnelResponse
s@OpenTunnelResponse' {} Maybe (Sensitive Text)
a -> OpenTunnelResponse
s {$sel:destinationAccessToken:OpenTunnelResponse' :: Maybe (Sensitive Text)
destinationAccessToken = Maybe (Sensitive Text)
a} :: OpenTunnelResponse) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> OpenTunnelResponse -> f OpenTunnelResponse)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> OpenTunnelResponse
-> f OpenTunnelResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive 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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | A unique alpha-numeric tunnel ID.
openTunnelResponse_tunnelId :: Lens.Lens' OpenTunnelResponse (Prelude.Maybe Prelude.Text)
openTunnelResponse_tunnelId :: (Maybe Text -> f (Maybe Text))
-> OpenTunnelResponse -> f OpenTunnelResponse
openTunnelResponse_tunnelId = (OpenTunnelResponse -> Maybe Text)
-> (OpenTunnelResponse -> Maybe Text -> OpenTunnelResponse)
-> Lens
     OpenTunnelResponse OpenTunnelResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OpenTunnelResponse' {Maybe Text
tunnelId :: Maybe Text
$sel:tunnelId:OpenTunnelResponse' :: OpenTunnelResponse -> Maybe Text
tunnelId} -> Maybe Text
tunnelId) (\s :: OpenTunnelResponse
s@OpenTunnelResponse' {} Maybe Text
a -> OpenTunnelResponse
s {$sel:tunnelId:OpenTunnelResponse' :: Maybe Text
tunnelId = Maybe Text
a} :: OpenTunnelResponse)

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

instance Prelude.NFData OpenTunnelResponse