GoogleMonitoringAlertPolicy class final
Factory wrapper for google_monitoring_alert_policy.
A description of the conditions under which some aspect of your system is considered to be "unhealthy" and the ways to notify people or services about this state.
Required identity beyond localName:
displayName: human-readable label shown in dashboards / notifications (<= 512 Unicode characters).combiner: how multipleconditionscombine into an incident. Use AlertCombiner.and / AlertCombiner.or / AlertCombiner.andWithMatchingResource.conditions: non-empty list. Each MonitoringAlertPolicyAlertCondition carries adisplayNameplus EXACTLY one of the 6 condition-type sub-blocks (MonitoringAlertPolicyAlertCondition.conditionThreshold,conditionAbsent,conditionMatchedLog,conditionMonitoringQueryLanguage,conditionPrometheusQueryLanguage,conditionSql).
Modeling choice for conditions: each entry is a single MonitoringAlertPolicyAlertCondition
helper with one required displayName plus 6 mutually-exclusive nullable
sub-fields. Terraform enforces the exactly_one_of contract at apply time,
so we keep the Dart shape flat (and the count of generated classes
manageable) instead of introducing a 6-variant sealed type.
Example (threshold on Compute Engine instance uptime):
final policy = GoogleMonitoringAlertPolicy(
localName: 'compute_uptime',
displayName: TfArg.literal('Compute instance uptime SLO'),
combiner: TfArg.literal(AlertCombiner.or),
conditions: const [
MonitoringAlertPolicyAlertCondition(
displayName: TfArgLiteral('uptime < 95% over 5 min'),
conditionThreshold: MonitoringAlertPolicyConditionThreshold(
filter: TfArgLiteral(
'metric.type="compute.googleapis.com/instance/uptime" '
'resource.type="gce_instance"',
),
comparison: TfArgLiteral(Comparison.lessThan),
thresholdValue: TfArgLiteral(0.95),
duration: TfArgLiteral('300s'),
),
),
],
notificationChannels: TfArg.literal(const <String>[]),
alertStrategy: const MonitoringAlertPolicyAlertStrategy(autoClose: TfArgLiteral('1800s')),
severity: TfArg.literal(AlertSeverity.warning),
);
Constructors
-
GoogleMonitoringAlertPolicy({required String localName, required TfArg<
String> displayName, required TfArg<AlertCombiner> combiner, required List<MonitoringAlertPolicyAlertCondition> conditions, TfArg<List< ? notificationChannels, MonitoringAlertPolicyAlertStrategy? alertStrategy, MonitoringAlertPolicyDocumentation? documentation, TfArg<String> >bool> ? enabled, TfArg<AlertSeverity> ? severity, TfArg<Map< ? userLabels, TfArg<String, String> >String> ? project, LifecycleOptions? lifecycle, List<DependencyTarget> ? dependsOn})
Properties
-
argMap
→ Map<
String, TfArg?> -
Argument-name → TfArg map. Keys are snake_case (Terraform JSON name).
Synth emits these keys directly; the factory is responsible for the
camelCase → snake_case translation at construction time.
finalinherited
-
creationRecord
→ TfRef<
List< Map< >String, Object?> > -
Reference to
creation_recordattribute.no setter -
dependsOn
→ List<
DependencyTarget> ? -
Optional
depends_on = [...]. Each entry is aDependencyTarget— either a wholesale resource (rendered as bare address) or an explicitTfRef(rendered viabareAddress).finalinherited - hashCode → int
-
The hash code for this object.
no setterinherited
-
id
→ TfRef<
String> -
Reference to
idattribute.no setter - kind → ResourceKind
-
Always
ResourceKind.resource. Overridden byData.no setterinherited - lifecycle → LifecycleOptions?
-
Optional
lifecycle { ... }block.finalinherited - localName → String
-
User-supplied local name within a Stack.
finalinherited
-
nameRef
→ TfRef<
String> -
Reference to
nameattribute.no setter - provider → String?
-
Optional Terraform
providermeta-argument (e.g.'google-beta').finalinherited - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
sensitiveFields
→ Set<
String> -
Field names that are
@Sensitiveper the IR-derived per-resource constant. Curated factories override with a baked-instatic const Set<String>(file-private in v0.5+).no setter - supportsDeletionProtection → bool
-
Capability flag: true when this resource's underlying Terraform
schema has a
deletion_protectionboolean attribute that the synth-time devMode flow can flip tofalse. Defaults to false; the codegen emitter overrides this totruefor wrappers whose schema includes the attribute.no setterinherited - terraformType → String
-
Terraform resource type, e.g.
google_pubsub_topic.finalinherited - tfAddress → String
-
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited