GoogleMonitoringAlertPolicy class final
Factory wrapper for google_monitoring_alert_policy (provider
hashicorp/google ~> 7.0).
Required identity:
localName: Terraform local name (the address segment aftergoogle_monitoring_alert_policy.).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 AlertCondition carries adisplayNameplus EXACTLY one of the 6 condition-type sub-blocks (AlertCondition.conditionThreshold,conditionAbsent,conditionMatchedLog,conditionMonitoringQueryLanguage,conditionPrometheusQueryLanguage,conditionSql).
Modeling choice for conditions: each entry is a single AlertCondition
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 [
AlertCondition(
displayName: TfArgLiteral('uptime < 95% over 5 min'),
conditionThreshold: ConditionThreshold(
filter: TfArgLiteral(
'metric.type="compute.googleapis.com/instance/uptime" '
'resource.type="gce_instance"',
),
comparison: TfArgLiteral(Comparison.lt),
thresholdValue: TfArgLiteral(0.95),
duration: TfArgLiteral('300s'),
),
),
],
notificationChannels: TfArg.literal(const <String>[]),
alertStrategy: const AlertStrategy(autoClose: TfArgLiteral('1800s')),
severity: TfArg.literal(AlertSeverity.warning),
);
Manages a Cloud Monitoring alert policy. Composition pattern: extends
Resource<$GoogleMonitoringAlertPolicy> for runtime behavior. The
nested-block helpers (AlertCondition, ConditionThreshold,
Aggregation, AlertStrategy, Documentation, etc.) are modeled in
the prelude below.
Constructors
-
GoogleMonitoringAlertPolicy({required String localName, required TfArg<
String> displayName, required TfArg<AlertCombiner> combiner, required List<AlertCondition> conditions, TfArg<List< ? notificationChannels, AlertStrategy? alertStrategy, Documentation? documentation, TfArg<String> >bool> ? enabled, TfArg<AlertSeverity> ? severity, TfArg<Map< ? userLabels, TfArg<String, String> >String> ? project, LifecycleOptions? lifecycle, List<DependencyTarget> ? dependsOn})
Properties
-
$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 -
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
-
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 (the alert policy's full resource name,projects/{project}/alertPolicies/{policy_id}).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 (same shape as id; populated by Cloud Monitoring on create).no setter - provider → ProviderBinding?
-
Optional explicit provider binding. Only the type is referenced here;
the concrete
Providerclass lives interradart_google(provider classes are defined per-provider, outside the core runtime).finalinherited - runtimeType → Type
-
A representation of the runtime type of the object.
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