{-# 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.CreateConnection
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a connection between two devices. The devices can be a physical
-- or virtual appliance that connects to a third-party appliance in a VPC,
-- or a physical appliance that connects to another physical appliance in
-- an on-premises network.
module Amazonka.NetworkManager.CreateConnection
  ( -- * Creating a Request
    CreateConnection (..),
    newCreateConnection,

    -- * Request Lenses
    createConnection_connectedLinkId,
    createConnection_description,
    createConnection_linkId,
    createConnection_tags,
    createConnection_globalNetworkId,
    createConnection_deviceId,
    createConnection_connectedDeviceId,

    -- * Destructuring the Response
    CreateConnectionResponse (..),
    newCreateConnectionResponse,

    -- * Response Lenses
    createConnectionResponse_connection,
    createConnectionResponse_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:/ 'newCreateConnection' smart constructor.
data CreateConnection = CreateConnection'
  { -- | The ID of the link for the second device.
    CreateConnection -> Maybe Text
connectedLinkId :: Prelude.Maybe Prelude.Text,
    -- | A description of the connection.
    --
    -- Length Constraints: Maximum length of 256 characters.
    CreateConnection -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The ID of the link for the first device.
    CreateConnection -> Maybe Text
linkId :: Prelude.Maybe Prelude.Text,
    -- | The tags to apply to the resource during creation.
    CreateConnection -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The ID of the global network.
    CreateConnection -> Text
globalNetworkId :: Prelude.Text,
    -- | The ID of the first device in the connection.
    CreateConnection -> Text
deviceId :: Prelude.Text,
    -- | The ID of the second device in the connection.
    CreateConnection -> Text
connectedDeviceId :: Prelude.Text
  }
  deriving (CreateConnection -> CreateConnection -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateConnection -> CreateConnection -> Bool
$c/= :: CreateConnection -> CreateConnection -> Bool
== :: CreateConnection -> CreateConnection -> Bool
$c== :: CreateConnection -> CreateConnection -> Bool
Prelude.Eq, ReadPrec [CreateConnection]
ReadPrec CreateConnection
Int -> ReadS CreateConnection
ReadS [CreateConnection]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateConnection]
$creadListPrec :: ReadPrec [CreateConnection]
readPrec :: ReadPrec CreateConnection
$creadPrec :: ReadPrec CreateConnection
readList :: ReadS [CreateConnection]
$creadList :: ReadS [CreateConnection]
readsPrec :: Int -> ReadS CreateConnection
$creadsPrec :: Int -> ReadS CreateConnection
Prelude.Read, Int -> CreateConnection -> ShowS
[CreateConnection] -> ShowS
CreateConnection -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateConnection] -> ShowS
$cshowList :: [CreateConnection] -> ShowS
show :: CreateConnection -> String
$cshow :: CreateConnection -> String
showsPrec :: Int -> CreateConnection -> ShowS
$cshowsPrec :: Int -> CreateConnection -> ShowS
Prelude.Show, forall x. Rep CreateConnection x -> CreateConnection
forall x. CreateConnection -> Rep CreateConnection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateConnection x -> CreateConnection
$cfrom :: forall x. CreateConnection -> Rep CreateConnection x
Prelude.Generic)

-- |
-- Create a value of 'CreateConnection' 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:
--
-- 'connectedLinkId', 'createConnection_connectedLinkId' - The ID of the link for the second device.
--
-- 'description', 'createConnection_description' - A description of the connection.
--
-- Length Constraints: Maximum length of 256 characters.
--
-- 'linkId', 'createConnection_linkId' - The ID of the link for the first device.
--
-- 'tags', 'createConnection_tags' - The tags to apply to the resource during creation.
--
-- 'globalNetworkId', 'createConnection_globalNetworkId' - The ID of the global network.
--
-- 'deviceId', 'createConnection_deviceId' - The ID of the first device in the connection.
--
-- 'connectedDeviceId', 'createConnection_connectedDeviceId' - The ID of the second device in the connection.
newCreateConnection ::
  -- | 'globalNetworkId'
  Prelude.Text ->
  -- | 'deviceId'
  Prelude.Text ->
  -- | 'connectedDeviceId'
  Prelude.Text ->
  CreateConnection
newCreateConnection :: Text -> Text -> Text -> CreateConnection
newCreateConnection
  Text
pGlobalNetworkId_
  Text
pDeviceId_
  Text
pConnectedDeviceId_ =
    CreateConnection'
      { $sel:connectedLinkId:CreateConnection' :: Maybe Text
connectedLinkId =
          forall a. Maybe a
Prelude.Nothing,
        $sel:description:CreateConnection' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
        $sel:linkId:CreateConnection' :: Maybe Text
linkId = forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateConnection' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
        $sel:globalNetworkId:CreateConnection' :: Text
globalNetworkId = Text
pGlobalNetworkId_,
        $sel:deviceId:CreateConnection' :: Text
deviceId = Text
pDeviceId_,
        $sel:connectedDeviceId:CreateConnection' :: Text
connectedDeviceId = Text
pConnectedDeviceId_
      }

-- | The ID of the link for the second device.
createConnection_connectedLinkId :: Lens.Lens' CreateConnection (Prelude.Maybe Prelude.Text)
createConnection_connectedLinkId :: Lens' CreateConnection (Maybe Text)
createConnection_connectedLinkId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConnection' {Maybe Text
connectedLinkId :: Maybe Text
$sel:connectedLinkId:CreateConnection' :: CreateConnection -> Maybe Text
connectedLinkId} -> Maybe Text
connectedLinkId) (\s :: CreateConnection
s@CreateConnection' {} Maybe Text
a -> CreateConnection
s {$sel:connectedLinkId:CreateConnection' :: Maybe Text
connectedLinkId = Maybe Text
a} :: CreateConnection)

-- | A description of the connection.
--
-- Length Constraints: Maximum length of 256 characters.
createConnection_description :: Lens.Lens' CreateConnection (Prelude.Maybe Prelude.Text)
createConnection_description :: Lens' CreateConnection (Maybe Text)
createConnection_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConnection' {Maybe Text
description :: Maybe Text
$sel:description:CreateConnection' :: CreateConnection -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateConnection
s@CreateConnection' {} Maybe Text
a -> CreateConnection
s {$sel:description:CreateConnection' :: Maybe Text
description = Maybe Text
a} :: CreateConnection)

-- | The ID of the link for the first device.
createConnection_linkId :: Lens.Lens' CreateConnection (Prelude.Maybe Prelude.Text)
createConnection_linkId :: Lens' CreateConnection (Maybe Text)
createConnection_linkId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConnection' {Maybe Text
linkId :: Maybe Text
$sel:linkId:CreateConnection' :: CreateConnection -> Maybe Text
linkId} -> Maybe Text
linkId) (\s :: CreateConnection
s@CreateConnection' {} Maybe Text
a -> CreateConnection
s {$sel:linkId:CreateConnection' :: Maybe Text
linkId = Maybe Text
a} :: CreateConnection)

-- | The tags to apply to the resource during creation.
createConnection_tags :: Lens.Lens' CreateConnection (Prelude.Maybe [Tag])
createConnection_tags :: Lens' CreateConnection (Maybe [Tag])
createConnection_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConnection' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateConnection' :: CreateConnection -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateConnection
s@CreateConnection' {} Maybe [Tag]
a -> CreateConnection
s {$sel:tags:CreateConnection' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateConnection) 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 ID of the global network.
createConnection_globalNetworkId :: Lens.Lens' CreateConnection Prelude.Text
createConnection_globalNetworkId :: Lens' CreateConnection Text
createConnection_globalNetworkId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConnection' {Text
globalNetworkId :: Text
$sel:globalNetworkId:CreateConnection' :: CreateConnection -> Text
globalNetworkId} -> Text
globalNetworkId) (\s :: CreateConnection
s@CreateConnection' {} Text
a -> CreateConnection
s {$sel:globalNetworkId:CreateConnection' :: Text
globalNetworkId = Text
a} :: CreateConnection)

-- | The ID of the first device in the connection.
createConnection_deviceId :: Lens.Lens' CreateConnection Prelude.Text
createConnection_deviceId :: Lens' CreateConnection Text
createConnection_deviceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConnection' {Text
deviceId :: Text
$sel:deviceId:CreateConnection' :: CreateConnection -> Text
deviceId} -> Text
deviceId) (\s :: CreateConnection
s@CreateConnection' {} Text
a -> CreateConnection
s {$sel:deviceId:CreateConnection' :: Text
deviceId = Text
a} :: CreateConnection)

-- | The ID of the second device in the connection.
createConnection_connectedDeviceId :: Lens.Lens' CreateConnection Prelude.Text
createConnection_connectedDeviceId :: Lens' CreateConnection Text
createConnection_connectedDeviceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConnection' {Text
connectedDeviceId :: Text
$sel:connectedDeviceId:CreateConnection' :: CreateConnection -> Text
connectedDeviceId} -> Text
connectedDeviceId) (\s :: CreateConnection
s@CreateConnection' {} Text
a -> CreateConnection
s {$sel:connectedDeviceId:CreateConnection' :: Text
connectedDeviceId = Text
a} :: CreateConnection)

instance Core.AWSRequest CreateConnection where
  type
    AWSResponse CreateConnection =
      CreateConnectionResponse
  request :: (Service -> Service)
-> CreateConnection -> Request CreateConnection
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateConnection
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateConnection)))
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 Connection -> Int -> CreateConnectionResponse
CreateConnectionResponse'
            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
"Connection")
            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 CreateConnection where
  hashWithSalt :: Int -> CreateConnection -> Int
hashWithSalt Int
_salt CreateConnection' {Maybe [Tag]
Maybe Text
Text
connectedDeviceId :: Text
deviceId :: Text
globalNetworkId :: Text
tags :: Maybe [Tag]
linkId :: Maybe Text
description :: Maybe Text
connectedLinkId :: Maybe Text
$sel:connectedDeviceId:CreateConnection' :: CreateConnection -> Text
$sel:deviceId:CreateConnection' :: CreateConnection -> Text
$sel:globalNetworkId:CreateConnection' :: CreateConnection -> Text
$sel:tags:CreateConnection' :: CreateConnection -> Maybe [Tag]
$sel:linkId:CreateConnection' :: CreateConnection -> Maybe Text
$sel:description:CreateConnection' :: CreateConnection -> Maybe Text
$sel:connectedLinkId:CreateConnection' :: CreateConnection -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
connectedLinkId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
linkId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
globalNetworkId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
deviceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
connectedDeviceId

instance Prelude.NFData CreateConnection where
  rnf :: CreateConnection -> ()
rnf CreateConnection' {Maybe [Tag]
Maybe Text
Text
connectedDeviceId :: Text
deviceId :: Text
globalNetworkId :: Text
tags :: Maybe [Tag]
linkId :: Maybe Text
description :: Maybe Text
connectedLinkId :: Maybe Text
$sel:connectedDeviceId:CreateConnection' :: CreateConnection -> Text
$sel:deviceId:CreateConnection' :: CreateConnection -> Text
$sel:globalNetworkId:CreateConnection' :: CreateConnection -> Text
$sel:tags:CreateConnection' :: CreateConnection -> Maybe [Tag]
$sel:linkId:CreateConnection' :: CreateConnection -> Maybe Text
$sel:description:CreateConnection' :: CreateConnection -> Maybe Text
$sel:connectedLinkId:CreateConnection' :: CreateConnection -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
connectedLinkId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
linkId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
globalNetworkId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
deviceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
connectedDeviceId

instance Data.ToHeaders CreateConnection where
  toHeaders :: CreateConnection -> 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.ToJSON CreateConnection where
  toJSON :: CreateConnection -> Value
toJSON CreateConnection' {Maybe [Tag]
Maybe Text
Text
connectedDeviceId :: Text
deviceId :: Text
globalNetworkId :: Text
tags :: Maybe [Tag]
linkId :: Maybe Text
description :: Maybe Text
connectedLinkId :: Maybe Text
$sel:connectedDeviceId:CreateConnection' :: CreateConnection -> Text
$sel:deviceId:CreateConnection' :: CreateConnection -> Text
$sel:globalNetworkId:CreateConnection' :: CreateConnection -> Text
$sel:tags:CreateConnection' :: CreateConnection -> Maybe [Tag]
$sel:linkId:CreateConnection' :: CreateConnection -> Maybe Text
$sel:description:CreateConnection' :: CreateConnection -> Maybe Text
$sel:connectedLinkId:CreateConnection' :: CreateConnection -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"ConnectedLinkId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
connectedLinkId,
            (Key
"Description" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
            (Key
"LinkId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
linkId,
            (Key
"Tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
            forall a. a -> Maybe a
Prelude.Just (Key
"DeviceId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
deviceId),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"ConnectedDeviceId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
connectedDeviceId)
          ]
      )

instance Data.ToPath CreateConnection where
  toPath :: CreateConnection -> ByteString
toPath CreateConnection' {Maybe [Tag]
Maybe Text
Text
connectedDeviceId :: Text
deviceId :: Text
globalNetworkId :: Text
tags :: Maybe [Tag]
linkId :: Maybe Text
description :: Maybe Text
connectedLinkId :: Maybe Text
$sel:connectedDeviceId:CreateConnection' :: CreateConnection -> Text
$sel:deviceId:CreateConnection' :: CreateConnection -> Text
$sel:globalNetworkId:CreateConnection' :: CreateConnection -> Text
$sel:tags:CreateConnection' :: CreateConnection -> Maybe [Tag]
$sel:linkId:CreateConnection' :: CreateConnection -> Maybe Text
$sel:description:CreateConnection' :: CreateConnection -> Maybe Text
$sel:connectedLinkId:CreateConnection' :: CreateConnection -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/global-networks/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
globalNetworkId,
        ByteString
"/connections"
      ]

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

-- | /See:/ 'newCreateConnectionResponse' smart constructor.
data CreateConnectionResponse = CreateConnectionResponse'
  { -- | Information about the connection.
    CreateConnectionResponse -> Maybe Connection
connection :: Prelude.Maybe Connection,
    -- | The response's http status code.
    CreateConnectionResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateConnectionResponse -> CreateConnectionResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateConnectionResponse -> CreateConnectionResponse -> Bool
$c/= :: CreateConnectionResponse -> CreateConnectionResponse -> Bool
== :: CreateConnectionResponse -> CreateConnectionResponse -> Bool
$c== :: CreateConnectionResponse -> CreateConnectionResponse -> Bool
Prelude.Eq, ReadPrec [CreateConnectionResponse]
ReadPrec CreateConnectionResponse
Int -> ReadS CreateConnectionResponse
ReadS [CreateConnectionResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateConnectionResponse]
$creadListPrec :: ReadPrec [CreateConnectionResponse]
readPrec :: ReadPrec CreateConnectionResponse
$creadPrec :: ReadPrec CreateConnectionResponse
readList :: ReadS [CreateConnectionResponse]
$creadList :: ReadS [CreateConnectionResponse]
readsPrec :: Int -> ReadS CreateConnectionResponse
$creadsPrec :: Int -> ReadS CreateConnectionResponse
Prelude.Read, Int -> CreateConnectionResponse -> ShowS
[CreateConnectionResponse] -> ShowS
CreateConnectionResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateConnectionResponse] -> ShowS
$cshowList :: [CreateConnectionResponse] -> ShowS
show :: CreateConnectionResponse -> String
$cshow :: CreateConnectionResponse -> String
showsPrec :: Int -> CreateConnectionResponse -> ShowS
$cshowsPrec :: Int -> CreateConnectionResponse -> ShowS
Prelude.Show, forall x.
Rep CreateConnectionResponse x -> CreateConnectionResponse
forall x.
CreateConnectionResponse -> Rep CreateConnectionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateConnectionResponse x -> CreateConnectionResponse
$cfrom :: forall x.
CreateConnectionResponse -> Rep CreateConnectionResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateConnectionResponse' 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:
--
-- 'connection', 'createConnectionResponse_connection' - Information about the connection.
--
-- 'httpStatus', 'createConnectionResponse_httpStatus' - The response's http status code.
newCreateConnectionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateConnectionResponse
newCreateConnectionResponse :: Int -> CreateConnectionResponse
newCreateConnectionResponse Int
pHttpStatus_ =
  CreateConnectionResponse'
    { $sel:connection:CreateConnectionResponse' :: Maybe Connection
connection =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateConnectionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the connection.
createConnectionResponse_connection :: Lens.Lens' CreateConnectionResponse (Prelude.Maybe Connection)
createConnectionResponse_connection :: Lens' CreateConnectionResponse (Maybe Connection)
createConnectionResponse_connection = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConnectionResponse' {Maybe Connection
connection :: Maybe Connection
$sel:connection:CreateConnectionResponse' :: CreateConnectionResponse -> Maybe Connection
connection} -> Maybe Connection
connection) (\s :: CreateConnectionResponse
s@CreateConnectionResponse' {} Maybe Connection
a -> CreateConnectionResponse
s {$sel:connection:CreateConnectionResponse' :: Maybe Connection
connection = Maybe Connection
a} :: CreateConnectionResponse)

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

instance Prelude.NFData CreateConnectionResponse where
  rnf :: CreateConnectionResponse -> ()
rnf CreateConnectionResponse' {Int
Maybe Connection
httpStatus :: Int
connection :: Maybe Connection
$sel:httpStatus:CreateConnectionResponse' :: CreateConnectionResponse -> Int
$sel:connection:CreateConnectionResponse' :: CreateConnectionResponse -> Maybe Connection
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Connection
connection
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus