{-# 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.RDS.CreateDBProxy
-- 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 DB proxy.
module Amazonka.RDS.CreateDBProxy
  ( -- * Creating a Request
    CreateDBProxy (..),
    newCreateDBProxy,

    -- * Request Lenses
    createDBProxy_debugLogging,
    createDBProxy_requireTLS,
    createDBProxy_idleClientTimeout,
    createDBProxy_vpcSecurityGroupIds,
    createDBProxy_tags,
    createDBProxy_dbProxyName,
    createDBProxy_engineFamily,
    createDBProxy_auth,
    createDBProxy_roleArn,
    createDBProxy_vpcSubnetIds,

    -- * Destructuring the Response
    CreateDBProxyResponse (..),
    newCreateDBProxyResponse,

    -- * Response Lenses
    createDBProxyResponse_dbProxy,
    createDBProxyResponse_httpStatus,
  )
where

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

-- | /See:/ 'newCreateDBProxy' smart constructor.
data CreateDBProxy = CreateDBProxy'
  { -- | Whether the proxy includes detailed information about SQL statements in
    -- its logs. This information helps you to debug issues involving SQL
    -- behavior or the performance and scalability of the proxy connections.
    -- The debug information includes the text of SQL statements that you
    -- submit through the proxy. Thus, only enable this setting when needed for
    -- debugging, and only when you have security measures in place to
    -- safeguard any sensitive information that appears in the logs.
    CreateDBProxy -> Maybe Bool
debugLogging :: Prelude.Maybe Prelude.Bool,
    -- | A Boolean parameter that specifies whether Transport Layer Security
    -- (TLS) encryption is required for connections to the proxy. By enabling
    -- this setting, you can enforce encrypted TLS connections to the proxy.
    CreateDBProxy -> Maybe Bool
requireTLS :: Prelude.Maybe Prelude.Bool,
    -- | The number of seconds that a connection to the proxy can be inactive
    -- before the proxy disconnects it. You can set this value higher or lower
    -- than the connection timeout limit for the associated database.
    CreateDBProxy -> Maybe Int
idleClientTimeout :: Prelude.Maybe Prelude.Int,
    -- | One or more VPC security group IDs to associate with the new proxy.
    CreateDBProxy -> Maybe [Text]
vpcSecurityGroupIds :: Prelude.Maybe [Prelude.Text],
    -- | An optional set of key-value pairs to associate arbitrary data of your
    -- choosing with the proxy.
    CreateDBProxy -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The identifier for the proxy. This name must be unique for all proxies
    -- owned by your Amazon Web Services account in the specified Amazon Web
    -- Services Region. An identifier must begin with a letter and must contain
    -- only ASCII letters, digits, and hyphens; it can\'t end with a hyphen or
    -- contain two consecutive hyphens.
    CreateDBProxy -> Text
dbProxyName :: Prelude.Text,
    -- | The kinds of databases that the proxy can connect to. This value
    -- determines which database network protocol the proxy recognizes when it
    -- interprets network traffic to and from the database. The engine family
    -- applies to MySQL and PostgreSQL for both RDS and Aurora.
    CreateDBProxy -> EngineFamily
engineFamily :: EngineFamily,
    -- | The authorization mechanism that the proxy uses.
    CreateDBProxy -> [UserAuthConfig]
auth :: [UserAuthConfig],
    -- | The Amazon Resource Name (ARN) of the IAM role that the proxy uses to
    -- access secrets in Amazon Web Services Secrets Manager.
    CreateDBProxy -> Text
roleArn :: Prelude.Text,
    -- | One or more VPC subnet IDs to associate with the new proxy.
    CreateDBProxy -> [Text]
vpcSubnetIds :: [Prelude.Text]
  }
  deriving (CreateDBProxy -> CreateDBProxy -> Bool
(CreateDBProxy -> CreateDBProxy -> Bool)
-> (CreateDBProxy -> CreateDBProxy -> Bool) -> Eq CreateDBProxy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDBProxy -> CreateDBProxy -> Bool
$c/= :: CreateDBProxy -> CreateDBProxy -> Bool
== :: CreateDBProxy -> CreateDBProxy -> Bool
$c== :: CreateDBProxy -> CreateDBProxy -> Bool
Prelude.Eq, ReadPrec [CreateDBProxy]
ReadPrec CreateDBProxy
Int -> ReadS CreateDBProxy
ReadS [CreateDBProxy]
(Int -> ReadS CreateDBProxy)
-> ReadS [CreateDBProxy]
-> ReadPrec CreateDBProxy
-> ReadPrec [CreateDBProxy]
-> Read CreateDBProxy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDBProxy]
$creadListPrec :: ReadPrec [CreateDBProxy]
readPrec :: ReadPrec CreateDBProxy
$creadPrec :: ReadPrec CreateDBProxy
readList :: ReadS [CreateDBProxy]
$creadList :: ReadS [CreateDBProxy]
readsPrec :: Int -> ReadS CreateDBProxy
$creadsPrec :: Int -> ReadS CreateDBProxy
Prelude.Read, Int -> CreateDBProxy -> ShowS
[CreateDBProxy] -> ShowS
CreateDBProxy -> String
(Int -> CreateDBProxy -> ShowS)
-> (CreateDBProxy -> String)
-> ([CreateDBProxy] -> ShowS)
-> Show CreateDBProxy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDBProxy] -> ShowS
$cshowList :: [CreateDBProxy] -> ShowS
show :: CreateDBProxy -> String
$cshow :: CreateDBProxy -> String
showsPrec :: Int -> CreateDBProxy -> ShowS
$cshowsPrec :: Int -> CreateDBProxy -> ShowS
Prelude.Show, (forall x. CreateDBProxy -> Rep CreateDBProxy x)
-> (forall x. Rep CreateDBProxy x -> CreateDBProxy)
-> Generic CreateDBProxy
forall x. Rep CreateDBProxy x -> CreateDBProxy
forall x. CreateDBProxy -> Rep CreateDBProxy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateDBProxy x -> CreateDBProxy
$cfrom :: forall x. CreateDBProxy -> Rep CreateDBProxy x
Prelude.Generic)

-- |
-- Create a value of 'CreateDBProxy' 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:
--
-- 'debugLogging', 'createDBProxy_debugLogging' - Whether the proxy includes detailed information about SQL statements in
-- its logs. This information helps you to debug issues involving SQL
-- behavior or the performance and scalability of the proxy connections.
-- The debug information includes the text of SQL statements that you
-- submit through the proxy. Thus, only enable this setting when needed for
-- debugging, and only when you have security measures in place to
-- safeguard any sensitive information that appears in the logs.
--
-- 'requireTLS', 'createDBProxy_requireTLS' - A Boolean parameter that specifies whether Transport Layer Security
-- (TLS) encryption is required for connections to the proxy. By enabling
-- this setting, you can enforce encrypted TLS connections to the proxy.
--
-- 'idleClientTimeout', 'createDBProxy_idleClientTimeout' - The number of seconds that a connection to the proxy can be inactive
-- before the proxy disconnects it. You can set this value higher or lower
-- than the connection timeout limit for the associated database.
--
-- 'vpcSecurityGroupIds', 'createDBProxy_vpcSecurityGroupIds' - One or more VPC security group IDs to associate with the new proxy.
--
-- 'tags', 'createDBProxy_tags' - An optional set of key-value pairs to associate arbitrary data of your
-- choosing with the proxy.
--
-- 'dbProxyName', 'createDBProxy_dbProxyName' - The identifier for the proxy. This name must be unique for all proxies
-- owned by your Amazon Web Services account in the specified Amazon Web
-- Services Region. An identifier must begin with a letter and must contain
-- only ASCII letters, digits, and hyphens; it can\'t end with a hyphen or
-- contain two consecutive hyphens.
--
-- 'engineFamily', 'createDBProxy_engineFamily' - The kinds of databases that the proxy can connect to. This value
-- determines which database network protocol the proxy recognizes when it
-- interprets network traffic to and from the database. The engine family
-- applies to MySQL and PostgreSQL for both RDS and Aurora.
--
-- 'auth', 'createDBProxy_auth' - The authorization mechanism that the proxy uses.
--
-- 'roleArn', 'createDBProxy_roleArn' - The Amazon Resource Name (ARN) of the IAM role that the proxy uses to
-- access secrets in Amazon Web Services Secrets Manager.
--
-- 'vpcSubnetIds', 'createDBProxy_vpcSubnetIds' - One or more VPC subnet IDs to associate with the new proxy.
newCreateDBProxy ::
  -- | 'dbProxyName'
  Prelude.Text ->
  -- | 'engineFamily'
  EngineFamily ->
  -- | 'roleArn'
  Prelude.Text ->
  CreateDBProxy
newCreateDBProxy :: Text -> EngineFamily -> Text -> CreateDBProxy
newCreateDBProxy
  Text
pDBProxyName_
  EngineFamily
pEngineFamily_
  Text
pRoleArn_ =
    CreateDBProxy' :: Maybe Bool
-> Maybe Bool
-> Maybe Int
-> Maybe [Text]
-> Maybe [Tag]
-> Text
-> EngineFamily
-> [UserAuthConfig]
-> Text
-> [Text]
-> CreateDBProxy
CreateDBProxy'
      { $sel:debugLogging:CreateDBProxy' :: Maybe Bool
debugLogging = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:requireTLS:CreateDBProxy' :: Maybe Bool
requireTLS = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:idleClientTimeout:CreateDBProxy' :: Maybe Int
idleClientTimeout = Maybe Int
forall a. Maybe a
Prelude.Nothing,
        $sel:vpcSecurityGroupIds:CreateDBProxy' :: Maybe [Text]
vpcSecurityGroupIds = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateDBProxy' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:dbProxyName:CreateDBProxy' :: Text
dbProxyName = Text
pDBProxyName_,
        $sel:engineFamily:CreateDBProxy' :: EngineFamily
engineFamily = EngineFamily
pEngineFamily_,
        $sel:auth:CreateDBProxy' :: [UserAuthConfig]
auth = [UserAuthConfig]
forall a. Monoid a => a
Prelude.mempty,
        $sel:roleArn:CreateDBProxy' :: Text
roleArn = Text
pRoleArn_,
        $sel:vpcSubnetIds:CreateDBProxy' :: [Text]
vpcSubnetIds = [Text]
forall a. Monoid a => a
Prelude.mempty
      }

-- | Whether the proxy includes detailed information about SQL statements in
-- its logs. This information helps you to debug issues involving SQL
-- behavior or the performance and scalability of the proxy connections.
-- The debug information includes the text of SQL statements that you
-- submit through the proxy. Thus, only enable this setting when needed for
-- debugging, and only when you have security measures in place to
-- safeguard any sensitive information that appears in the logs.
createDBProxy_debugLogging :: Lens.Lens' CreateDBProxy (Prelude.Maybe Prelude.Bool)
createDBProxy_debugLogging :: (Maybe Bool -> f (Maybe Bool)) -> CreateDBProxy -> f CreateDBProxy
createDBProxy_debugLogging = (CreateDBProxy -> Maybe Bool)
-> (CreateDBProxy -> Maybe Bool -> CreateDBProxy)
-> Lens CreateDBProxy CreateDBProxy (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDBProxy' {Maybe Bool
debugLogging :: Maybe Bool
$sel:debugLogging:CreateDBProxy' :: CreateDBProxy -> Maybe Bool
debugLogging} -> Maybe Bool
debugLogging) (\s :: CreateDBProxy
s@CreateDBProxy' {} Maybe Bool
a -> CreateDBProxy
s {$sel:debugLogging:CreateDBProxy' :: Maybe Bool
debugLogging = Maybe Bool
a} :: CreateDBProxy)

-- | A Boolean parameter that specifies whether Transport Layer Security
-- (TLS) encryption is required for connections to the proxy. By enabling
-- this setting, you can enforce encrypted TLS connections to the proxy.
createDBProxy_requireTLS :: Lens.Lens' CreateDBProxy (Prelude.Maybe Prelude.Bool)
createDBProxy_requireTLS :: (Maybe Bool -> f (Maybe Bool)) -> CreateDBProxy -> f CreateDBProxy
createDBProxy_requireTLS = (CreateDBProxy -> Maybe Bool)
-> (CreateDBProxy -> Maybe Bool -> CreateDBProxy)
-> Lens CreateDBProxy CreateDBProxy (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDBProxy' {Maybe Bool
requireTLS :: Maybe Bool
$sel:requireTLS:CreateDBProxy' :: CreateDBProxy -> Maybe Bool
requireTLS} -> Maybe Bool
requireTLS) (\s :: CreateDBProxy
s@CreateDBProxy' {} Maybe Bool
a -> CreateDBProxy
s {$sel:requireTLS:CreateDBProxy' :: Maybe Bool
requireTLS = Maybe Bool
a} :: CreateDBProxy)

-- | The number of seconds that a connection to the proxy can be inactive
-- before the proxy disconnects it. You can set this value higher or lower
-- than the connection timeout limit for the associated database.
createDBProxy_idleClientTimeout :: Lens.Lens' CreateDBProxy (Prelude.Maybe Prelude.Int)
createDBProxy_idleClientTimeout :: (Maybe Int -> f (Maybe Int)) -> CreateDBProxy -> f CreateDBProxy
createDBProxy_idleClientTimeout = (CreateDBProxy -> Maybe Int)
-> (CreateDBProxy -> Maybe Int -> CreateDBProxy)
-> Lens CreateDBProxy CreateDBProxy (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDBProxy' {Maybe Int
idleClientTimeout :: Maybe Int
$sel:idleClientTimeout:CreateDBProxy' :: CreateDBProxy -> Maybe Int
idleClientTimeout} -> Maybe Int
idleClientTimeout) (\s :: CreateDBProxy
s@CreateDBProxy' {} Maybe Int
a -> CreateDBProxy
s {$sel:idleClientTimeout:CreateDBProxy' :: Maybe Int
idleClientTimeout = Maybe Int
a} :: CreateDBProxy)

-- | One or more VPC security group IDs to associate with the new proxy.
createDBProxy_vpcSecurityGroupIds :: Lens.Lens' CreateDBProxy (Prelude.Maybe [Prelude.Text])
createDBProxy_vpcSecurityGroupIds :: (Maybe [Text] -> f (Maybe [Text]))
-> CreateDBProxy -> f CreateDBProxy
createDBProxy_vpcSecurityGroupIds = (CreateDBProxy -> Maybe [Text])
-> (CreateDBProxy -> Maybe [Text] -> CreateDBProxy)
-> Lens CreateDBProxy CreateDBProxy (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDBProxy' {Maybe [Text]
vpcSecurityGroupIds :: Maybe [Text]
$sel:vpcSecurityGroupIds:CreateDBProxy' :: CreateDBProxy -> Maybe [Text]
vpcSecurityGroupIds} -> Maybe [Text]
vpcSecurityGroupIds) (\s :: CreateDBProxy
s@CreateDBProxy' {} Maybe [Text]
a -> CreateDBProxy
s {$sel:vpcSecurityGroupIds:CreateDBProxy' :: Maybe [Text]
vpcSecurityGroupIds = Maybe [Text]
a} :: CreateDBProxy) ((Maybe [Text] -> f (Maybe [Text]))
 -> CreateDBProxy -> f CreateDBProxy)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> CreateDBProxy
-> f CreateDBProxy
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An optional set of key-value pairs to associate arbitrary data of your
-- choosing with the proxy.
createDBProxy_tags :: Lens.Lens' CreateDBProxy (Prelude.Maybe [Tag])
createDBProxy_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateDBProxy -> f CreateDBProxy
createDBProxy_tags = (CreateDBProxy -> Maybe [Tag])
-> (CreateDBProxy -> Maybe [Tag] -> CreateDBProxy)
-> Lens CreateDBProxy CreateDBProxy (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDBProxy' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateDBProxy' :: CreateDBProxy -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateDBProxy
s@CreateDBProxy' {} Maybe [Tag]
a -> CreateDBProxy
s {$sel:tags:CreateDBProxy' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateDBProxy) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateDBProxy -> f CreateDBProxy)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateDBProxy
-> f CreateDBProxy
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [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 [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The identifier for the proxy. This name must be unique for all proxies
-- owned by your Amazon Web Services account in the specified Amazon Web
-- Services Region. An identifier must begin with a letter and must contain
-- only ASCII letters, digits, and hyphens; it can\'t end with a hyphen or
-- contain two consecutive hyphens.
createDBProxy_dbProxyName :: Lens.Lens' CreateDBProxy Prelude.Text
createDBProxy_dbProxyName :: (Text -> f Text) -> CreateDBProxy -> f CreateDBProxy
createDBProxy_dbProxyName = (CreateDBProxy -> Text)
-> (CreateDBProxy -> Text -> CreateDBProxy)
-> Lens CreateDBProxy CreateDBProxy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDBProxy' {Text
dbProxyName :: Text
$sel:dbProxyName:CreateDBProxy' :: CreateDBProxy -> Text
dbProxyName} -> Text
dbProxyName) (\s :: CreateDBProxy
s@CreateDBProxy' {} Text
a -> CreateDBProxy
s {$sel:dbProxyName:CreateDBProxy' :: Text
dbProxyName = Text
a} :: CreateDBProxy)

-- | The kinds of databases that the proxy can connect to. This value
-- determines which database network protocol the proxy recognizes when it
-- interprets network traffic to and from the database. The engine family
-- applies to MySQL and PostgreSQL for both RDS and Aurora.
createDBProxy_engineFamily :: Lens.Lens' CreateDBProxy EngineFamily
createDBProxy_engineFamily :: (EngineFamily -> f EngineFamily)
-> CreateDBProxy -> f CreateDBProxy
createDBProxy_engineFamily = (CreateDBProxy -> EngineFamily)
-> (CreateDBProxy -> EngineFamily -> CreateDBProxy)
-> Lens CreateDBProxy CreateDBProxy EngineFamily EngineFamily
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDBProxy' {EngineFamily
engineFamily :: EngineFamily
$sel:engineFamily:CreateDBProxy' :: CreateDBProxy -> EngineFamily
engineFamily} -> EngineFamily
engineFamily) (\s :: CreateDBProxy
s@CreateDBProxy' {} EngineFamily
a -> CreateDBProxy
s {$sel:engineFamily:CreateDBProxy' :: EngineFamily
engineFamily = EngineFamily
a} :: CreateDBProxy)

-- | The authorization mechanism that the proxy uses.
createDBProxy_auth :: Lens.Lens' CreateDBProxy [UserAuthConfig]
createDBProxy_auth :: ([UserAuthConfig] -> f [UserAuthConfig])
-> CreateDBProxy -> f CreateDBProxy
createDBProxy_auth = (CreateDBProxy -> [UserAuthConfig])
-> (CreateDBProxy -> [UserAuthConfig] -> CreateDBProxy)
-> Lens
     CreateDBProxy CreateDBProxy [UserAuthConfig] [UserAuthConfig]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDBProxy' {[UserAuthConfig]
auth :: [UserAuthConfig]
$sel:auth:CreateDBProxy' :: CreateDBProxy -> [UserAuthConfig]
auth} -> [UserAuthConfig]
auth) (\s :: CreateDBProxy
s@CreateDBProxy' {} [UserAuthConfig]
a -> CreateDBProxy
s {$sel:auth:CreateDBProxy' :: [UserAuthConfig]
auth = [UserAuthConfig]
a} :: CreateDBProxy) (([UserAuthConfig] -> f [UserAuthConfig])
 -> CreateDBProxy -> f CreateDBProxy)
-> (([UserAuthConfig] -> f [UserAuthConfig])
    -> [UserAuthConfig] -> f [UserAuthConfig])
-> ([UserAuthConfig] -> f [UserAuthConfig])
-> CreateDBProxy
-> f CreateDBProxy
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([UserAuthConfig] -> f [UserAuthConfig])
-> [UserAuthConfig] -> f [UserAuthConfig]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The Amazon Resource Name (ARN) of the IAM role that the proxy uses to
-- access secrets in Amazon Web Services Secrets Manager.
createDBProxy_roleArn :: Lens.Lens' CreateDBProxy Prelude.Text
createDBProxy_roleArn :: (Text -> f Text) -> CreateDBProxy -> f CreateDBProxy
createDBProxy_roleArn = (CreateDBProxy -> Text)
-> (CreateDBProxy -> Text -> CreateDBProxy)
-> Lens CreateDBProxy CreateDBProxy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDBProxy' {Text
roleArn :: Text
$sel:roleArn:CreateDBProxy' :: CreateDBProxy -> Text
roleArn} -> Text
roleArn) (\s :: CreateDBProxy
s@CreateDBProxy' {} Text
a -> CreateDBProxy
s {$sel:roleArn:CreateDBProxy' :: Text
roleArn = Text
a} :: CreateDBProxy)

-- | One or more VPC subnet IDs to associate with the new proxy.
createDBProxy_vpcSubnetIds :: Lens.Lens' CreateDBProxy [Prelude.Text]
createDBProxy_vpcSubnetIds :: ([Text] -> f [Text]) -> CreateDBProxy -> f CreateDBProxy
createDBProxy_vpcSubnetIds = (CreateDBProxy -> [Text])
-> (CreateDBProxy -> [Text] -> CreateDBProxy)
-> Lens CreateDBProxy CreateDBProxy [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDBProxy' {[Text]
vpcSubnetIds :: [Text]
$sel:vpcSubnetIds:CreateDBProxy' :: CreateDBProxy -> [Text]
vpcSubnetIds} -> [Text]
vpcSubnetIds) (\s :: CreateDBProxy
s@CreateDBProxy' {} [Text]
a -> CreateDBProxy
s {$sel:vpcSubnetIds:CreateDBProxy' :: [Text]
vpcSubnetIds = [Text]
a} :: CreateDBProxy) (([Text] -> f [Text]) -> CreateDBProxy -> f CreateDBProxy)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> CreateDBProxy
-> f CreateDBProxy
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest CreateDBProxy where
  type
    AWSResponse CreateDBProxy =
      CreateDBProxyResponse
  request :: CreateDBProxy -> Request CreateDBProxy
request = Service -> CreateDBProxy -> Request CreateDBProxy
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateDBProxy
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateDBProxy)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse CreateDBProxy))
-> Logger
-> Service
-> Proxy CreateDBProxy
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateDBProxy)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"CreateDBProxyResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe DBProxy -> Int -> CreateDBProxyResponse
CreateDBProxyResponse'
            (Maybe DBProxy -> Int -> CreateDBProxyResponse)
-> Either String (Maybe DBProxy)
-> Either String (Int -> CreateDBProxyResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe DBProxy)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"DBProxy")
            Either String (Int -> CreateDBProxyResponse)
-> Either String Int -> Either String CreateDBProxyResponse
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 CreateDBProxy

instance Prelude.NFData CreateDBProxy

instance Core.ToHeaders CreateDBProxy where
  toHeaders :: CreateDBProxy -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateDBProxy -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

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

instance Core.ToQuery CreateDBProxy where
  toQuery :: CreateDBProxy -> QueryString
toQuery CreateDBProxy' {[Text]
[UserAuthConfig]
Maybe Bool
Maybe Int
Maybe [Text]
Maybe [Tag]
Text
EngineFamily
vpcSubnetIds :: [Text]
roleArn :: Text
auth :: [UserAuthConfig]
engineFamily :: EngineFamily
dbProxyName :: Text
tags :: Maybe [Tag]
vpcSecurityGroupIds :: Maybe [Text]
idleClientTimeout :: Maybe Int
requireTLS :: Maybe Bool
debugLogging :: Maybe Bool
$sel:vpcSubnetIds:CreateDBProxy' :: CreateDBProxy -> [Text]
$sel:roleArn:CreateDBProxy' :: CreateDBProxy -> Text
$sel:auth:CreateDBProxy' :: CreateDBProxy -> [UserAuthConfig]
$sel:engineFamily:CreateDBProxy' :: CreateDBProxy -> EngineFamily
$sel:dbProxyName:CreateDBProxy' :: CreateDBProxy -> Text
$sel:tags:CreateDBProxy' :: CreateDBProxy -> Maybe [Tag]
$sel:vpcSecurityGroupIds:CreateDBProxy' :: CreateDBProxy -> Maybe [Text]
$sel:idleClientTimeout:CreateDBProxy' :: CreateDBProxy -> Maybe Int
$sel:requireTLS:CreateDBProxy' :: CreateDBProxy -> Maybe Bool
$sel:debugLogging:CreateDBProxy' :: CreateDBProxy -> Maybe Bool
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"CreateDBProxy" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2014-10-31" :: Prelude.ByteString),
        ByteString
"DebugLogging" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
debugLogging,
        ByteString
"RequireTLS" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
requireTLS,
        ByteString
"IdleClientTimeout" ByteString -> Maybe Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Int
idleClientTimeout,
        ByteString
"VpcSecurityGroupIds"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            ( ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member"
                ([Text] -> QueryString) -> Maybe [Text] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
vpcSecurityGroupIds
            ),
        ByteString
"Tags"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            (ByteString -> [Tag] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"Tag" ([Tag] -> QueryString) -> Maybe [Tag] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags),
        ByteString
"DBProxyName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
dbProxyName,
        ByteString
"EngineFamily" ByteString -> EngineFamily -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: EngineFamily
engineFamily,
        ByteString
"Auth" ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ByteString -> [UserAuthConfig] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" [UserAuthConfig]
auth,
        ByteString
"RoleArn" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
roleArn,
        ByteString
"VpcSubnetIds"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" [Text]
vpcSubnetIds
      ]

-- | /See:/ 'newCreateDBProxyResponse' smart constructor.
data CreateDBProxyResponse = CreateDBProxyResponse'
  { -- | The @DBProxy@ structure corresponding to the new proxy.
    CreateDBProxyResponse -> Maybe DBProxy
dbProxy :: Prelude.Maybe DBProxy,
    -- | The response's http status code.
    CreateDBProxyResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateDBProxyResponse -> CreateDBProxyResponse -> Bool
(CreateDBProxyResponse -> CreateDBProxyResponse -> Bool)
-> (CreateDBProxyResponse -> CreateDBProxyResponse -> Bool)
-> Eq CreateDBProxyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDBProxyResponse -> CreateDBProxyResponse -> Bool
$c/= :: CreateDBProxyResponse -> CreateDBProxyResponse -> Bool
== :: CreateDBProxyResponse -> CreateDBProxyResponse -> Bool
$c== :: CreateDBProxyResponse -> CreateDBProxyResponse -> Bool
Prelude.Eq, ReadPrec [CreateDBProxyResponse]
ReadPrec CreateDBProxyResponse
Int -> ReadS CreateDBProxyResponse
ReadS [CreateDBProxyResponse]
(Int -> ReadS CreateDBProxyResponse)
-> ReadS [CreateDBProxyResponse]
-> ReadPrec CreateDBProxyResponse
-> ReadPrec [CreateDBProxyResponse]
-> Read CreateDBProxyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDBProxyResponse]
$creadListPrec :: ReadPrec [CreateDBProxyResponse]
readPrec :: ReadPrec CreateDBProxyResponse
$creadPrec :: ReadPrec CreateDBProxyResponse
readList :: ReadS [CreateDBProxyResponse]
$creadList :: ReadS [CreateDBProxyResponse]
readsPrec :: Int -> ReadS CreateDBProxyResponse
$creadsPrec :: Int -> ReadS CreateDBProxyResponse
Prelude.Read, Int -> CreateDBProxyResponse -> ShowS
[CreateDBProxyResponse] -> ShowS
CreateDBProxyResponse -> String
(Int -> CreateDBProxyResponse -> ShowS)
-> (CreateDBProxyResponse -> String)
-> ([CreateDBProxyResponse] -> ShowS)
-> Show CreateDBProxyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDBProxyResponse] -> ShowS
$cshowList :: [CreateDBProxyResponse] -> ShowS
show :: CreateDBProxyResponse -> String
$cshow :: CreateDBProxyResponse -> String
showsPrec :: Int -> CreateDBProxyResponse -> ShowS
$cshowsPrec :: Int -> CreateDBProxyResponse -> ShowS
Prelude.Show, (forall x. CreateDBProxyResponse -> Rep CreateDBProxyResponse x)
-> (forall x. Rep CreateDBProxyResponse x -> CreateDBProxyResponse)
-> Generic CreateDBProxyResponse
forall x. Rep CreateDBProxyResponse x -> CreateDBProxyResponse
forall x. CreateDBProxyResponse -> Rep CreateDBProxyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateDBProxyResponse x -> CreateDBProxyResponse
$cfrom :: forall x. CreateDBProxyResponse -> Rep CreateDBProxyResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateDBProxyResponse' 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:
--
-- 'dbProxy', 'createDBProxyResponse_dbProxy' - The @DBProxy@ structure corresponding to the new proxy.
--
-- 'httpStatus', 'createDBProxyResponse_httpStatus' - The response's http status code.
newCreateDBProxyResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateDBProxyResponse
newCreateDBProxyResponse :: Int -> CreateDBProxyResponse
newCreateDBProxyResponse Int
pHttpStatus_ =
  CreateDBProxyResponse' :: Maybe DBProxy -> Int -> CreateDBProxyResponse
CreateDBProxyResponse'
    { $sel:dbProxy:CreateDBProxyResponse' :: Maybe DBProxy
dbProxy = Maybe DBProxy
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateDBProxyResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The @DBProxy@ structure corresponding to the new proxy.
createDBProxyResponse_dbProxy :: Lens.Lens' CreateDBProxyResponse (Prelude.Maybe DBProxy)
createDBProxyResponse_dbProxy :: (Maybe DBProxy -> f (Maybe DBProxy))
-> CreateDBProxyResponse -> f CreateDBProxyResponse
createDBProxyResponse_dbProxy = (CreateDBProxyResponse -> Maybe DBProxy)
-> (CreateDBProxyResponse
    -> Maybe DBProxy -> CreateDBProxyResponse)
-> Lens
     CreateDBProxyResponse
     CreateDBProxyResponse
     (Maybe DBProxy)
     (Maybe DBProxy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDBProxyResponse' {Maybe DBProxy
dbProxy :: Maybe DBProxy
$sel:dbProxy:CreateDBProxyResponse' :: CreateDBProxyResponse -> Maybe DBProxy
dbProxy} -> Maybe DBProxy
dbProxy) (\s :: CreateDBProxyResponse
s@CreateDBProxyResponse' {} Maybe DBProxy
a -> CreateDBProxyResponse
s {$sel:dbProxy:CreateDBProxyResponse' :: Maybe DBProxy
dbProxy = Maybe DBProxy
a} :: CreateDBProxyResponse)

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

instance Prelude.NFData CreateDBProxyResponse