Class OptionGroup
An option group.
Inherited Members
Namespace: Amazon.CDK.AWS.RDS
Assembly: Amazon.CDK.AWS.RDS.dll
Syntax (csharp)
public class OptionGroup : Resource, IOptionGroup, IResource, IConstruct, IDependable
Syntax (vb)
Public Class OptionGroup
Inherits Resource
Implements IOptionGroup, IResource, IConstruct, IDependable
Remarks
ExampleMetadata: lit=test/integ.instance.lit.ts infused
Examples
// Set open cursors with parameter group
var parameterGroup = new ParameterGroup(this, "ParameterGroup", new ParameterGroupProps {
Engine = DatabaseInstanceEngine.OracleSe2(new OracleSe2InstanceEngineProps { Version = OracleEngineVersion.VER_19_0_0_0_2020_04_R1 }),
Parameters = new Dictionary<string, string> {
{ "open_cursors", "2500" }
}
});
var optionGroup = new OptionGroup(this, "OptionGroup", new OptionGroupProps {
Engine = DatabaseInstanceEngine.OracleSe2(new OracleSe2InstanceEngineProps { Version = OracleEngineVersion.VER_19_0_0_0_2020_04_R1 }),
Configurations = new [] { new OptionConfiguration {
Name = "LOCATOR"
}, new OptionConfiguration {
Name = "OEM",
Port = 1158,
Vpc = vpc
} }
});
// Allow connections to OEM
optionGroup.OptionConnections.OEM.Connections.AllowDefaultPortFromAnyIpv4();
// Database instance with production values
var instance = new DatabaseInstance(this, "Instance", new DatabaseInstanceProps {
Engine = DatabaseInstanceEngine.OracleSe2(new OracleSe2InstanceEngineProps { Version = OracleEngineVersion.VER_19_0_0_0_2020_04_R1 }),
LicenseModel = LicenseModel.BRING_YOUR_OWN_LICENSE,
InstanceType = InstanceType.Of(InstanceClass.BURSTABLE3, InstanceSize.MEDIUM),
MultiAz = true,
StorageType = StorageType.IO1,
Credentials = Credentials.FromUsername("syscdk"),
Vpc = vpc,
DatabaseName = "ORCL",
StorageEncrypted = true,
BackupRetention = Duration.Days(7),
MonitoringInterval = Duration.Seconds(60),
EnablePerformanceInsights = true,
CloudwatchLogsExports = new [] { "trace", "audit", "alert", "listener" },
CloudwatchLogsRetention = RetentionDays.ONE_MONTH,
AutoMinorVersionUpgrade = true, // required to be true if LOCATOR is used in the option group
OptionGroup = optionGroup,
ParameterGroup = parameterGroup,
RemovalPolicy = RemovalPolicy.DESTROY
});
// Allow connections on default port from any IPV4
instance.Connections.AllowDefaultPortFromAnyIpv4();
// Rotate the master user password every 30 days
instance.AddRotationSingleUser();
// Add alarm for high CPU
// Add alarm for high CPU
new Alarm(this, "HighCPU", new AlarmProps {
Metric = instance.MetricCPUUtilization(),
Threshold = 90,
EvaluationPeriods = 1
});
// Trigger Lambda function on instance availability events
var fn = new Function(this, "Function", new FunctionProps {
Code = Code.FromInline("exports.handler = (event) => console.log(event);"),
Handler = "index.handler",
Runtime = Runtime.NODEJS_14_X
});
var availabilityRule = instance.OnEvent("Availability", new OnEventOptions { Target = new LambdaFunction(fn) });
availabilityRule.AddEventPattern(new EventPattern {
Detail = new Dictionary<string, object> {
{ "EventCategories", new [] { "availability" } }
}
});
Synopsis
Constructors
OptionGroup(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
OptionGroup(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
OptionGroup(Construct, String, IOptionGroupProps) |
Properties
OptionConnections | The connections object for the options. |
OptionGroupName | The name of the option group. |
Methods
AddConfiguration(IOptionConfiguration) | Adds a configuration to this OptionGroup. |
FromOptionGroupName(Construct, String, String) | Import an existing option group. |
Constructors
OptionGroup(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected OptionGroup(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
OptionGroup(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected OptionGroup(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
OptionGroup(Construct, String, IOptionGroupProps)
public OptionGroup(Construct scope, string id, IOptionGroupProps props)
Parameters
- scope Constructs.Construct
- id System.String
- props IOptionGroupProps
Properties
OptionConnections
The connections object for the options.
public virtual IDictionary<string, Connections_> OptionConnections { get; }
Property Value
System.Collections.Generic.IDictionary<System.String, Connections_>
OptionGroupName
The name of the option group.
public virtual string OptionGroupName { get; }
Property Value
System.String
Methods
AddConfiguration(IOptionConfiguration)
Adds a configuration to this OptionGroup.
public virtual bool AddConfiguration(IOptionConfiguration configuration)
Parameters
- configuration IOptionConfiguration
Returns
System.Boolean
Remarks
This method is a no-op for an imported OptionGroup.
FromOptionGroupName(Construct, String, String)
Import an existing option group.
public static IOptionGroup FromOptionGroupName(Construct scope, string id, string optionGroupName)
Parameters
- scope Constructs.Construct
- id System.String
- optionGroupName System.String
Returns