-
Notifications
You must be signed in to change notification settings - Fork 17
/
ProxyTarget.go
100 lines (85 loc) · 2.3 KB
/
ProxyTarget.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
package awsrds
import (
_init_ "github.com/aws/aws-cdk-go/awscdk/v2/jsii"
_jsii_ "github.com/aws/jsii-runtime-go/runtime"
)
// Proxy target: Instance or Cluster.
//
// A target group is a collection of databases that the proxy can connect to.
// Currently, you can specify only one RDS DB instance or Aurora DB cluster.
//
// Example:
// var vpc vpc
//
// cluster := rds.NewDatabaseCluster(this, jsii.String("Database"), &DatabaseClusterProps{
// Engine: rds.DatabaseClusterEngine_AuroraMysql(&AuroraMysqlClusterEngineProps{
// Version: rds.AuroraMysqlEngineVersion_VER_3_03_0(),
// }),
// Writer: rds.ClusterInstance_Provisioned(jsii.String("writer")),
// Vpc: Vpc,
// })
//
// proxy := rds.NewDatabaseProxy(this, jsii.String("Proxy"), &DatabaseProxyProps{
// ProxyTarget: rds.ProxyTarget_FromCluster(cluster),
// Secrets: []iSecret{
// cluster.Secret,
// },
// Vpc: Vpc,
// })
//
// role := iam.NewRole(this, jsii.String("DBProxyRole"), &RoleProps{
// AssumedBy: iam.NewAccountPrincipal(this.Account),
// })
// proxy.GrantConnect(role, jsii.String("admin"))
//
type ProxyTarget interface {
// Bind this target to the specified database proxy.
Bind(proxy DatabaseProxy) *ProxyTargetConfig
}
// The jsii proxy struct for ProxyTarget
type jsiiProxy_ProxyTarget struct {
_ byte // padding
}
// From cluster.
func ProxyTarget_FromCluster(cluster IDatabaseCluster) ProxyTarget {
_init_.Initialize()
if err := validateProxyTarget_FromClusterParameters(cluster); err != nil {
panic(err)
}
var returns ProxyTarget
_jsii_.StaticInvoke(
"aws-cdk-lib.aws_rds.ProxyTarget",
"fromCluster",
[]interface{}{cluster},
&returns,
)
return returns
}
// From instance.
func ProxyTarget_FromInstance(instance IDatabaseInstance) ProxyTarget {
_init_.Initialize()
if err := validateProxyTarget_FromInstanceParameters(instance); err != nil {
panic(err)
}
var returns ProxyTarget
_jsii_.StaticInvoke(
"aws-cdk-lib.aws_rds.ProxyTarget",
"fromInstance",
[]interface{}{instance},
&returns,
)
return returns
}
func (p *jsiiProxy_ProxyTarget) Bind(proxy DatabaseProxy) *ProxyTargetConfig {
if err := p.validateBindParameters(proxy); err != nil {
panic(err)
}
var returns *ProxyTargetConfig
_jsii_.Invoke(
p,
"bind",
[]interface{}{proxy},
&returns,
)
return returns
}