Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ type Alert struct {
ThresholdMilliseconds *float64 `json:"thresholdMilliseconds,omitempty"`
ThresholdNumber *float64 `json:"thresholdNumber,omitempty"`
ThresholdPercent *float64 `json:"thresholdPercent,omitempty"`
Trigger Trigger `json:"trigger"` // Possible Values: `AVAILABLE_DISK_SPACE_MEBIBYTES_BELOW`, `AVAILABLE_DISK_SPACE_PERCENT_BELOW`, `AVAILABLE_INODES_NUMBER_BELOW`, `AVAILABLE_INODES_PERCENT_BELOW`, `READ_ONLY_FILE_SYSTEM`, `READ_TIME_EXCEEDING`, `WRITE_TIME_EXCEEDING`
Trigger Trigger `json:"trigger"` // Possible values: `AVAILABLE_DISK_SPACE_MEBIBYTES_BELOW`, `AVAILABLE_DISK_SPACE_PERCENT_BELOW`, `AVAILABLE_INODES_NUMBER_BELOW`, `AVAILABLE_INODES_PERCENT_BELOW`, `READ_ONLY_FILE_SYSTEM`, `READ_TIME_EXCEEDING`, `WRITE_TIME_EXCEEDING`
}

func (me *Alert) Schema() map[string]*schema.Schema {
Expand Down Expand Up @@ -98,7 +98,7 @@ func (me *Alert) Schema() map[string]*schema.Schema {
},
"trigger": {
Type: schema.TypeString,
Description: "Possible Values: `AVAILABLE_DISK_SPACE_MEBIBYTES_BELOW`, `AVAILABLE_DISK_SPACE_PERCENT_BELOW`, `AVAILABLE_INODES_NUMBER_BELOW`, `AVAILABLE_INODES_PERCENT_BELOW`, `READ_ONLY_FILE_SYSTEM`, `READ_TIME_EXCEEDING`, `WRITE_TIME_EXCEEDING`",
Description: "Possible values: `AVAILABLE_DISK_SPACE_MEBIBYTES_BELOW`, `AVAILABLE_DISK_SPACE_PERCENT_BELOW`, `AVAILABLE_INODES_NUMBER_BELOW`, `AVAILABLE_INODES_PERCENT_BELOW`, `READ_ONLY_FILE_SYSTEM`, `READ_TIME_EXCEEDING`, `WRITE_TIME_EXCEEDING`",
Required: true,
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,22 @@ import (
)

type HostMetadataCondition struct {
KeyMustExist bool `json:"keyMustExist"` // When enabled, the condition requires a metadata key to exist and match the constraints; when disabled, the key is optional but must still match the constrains if it is present.
MetadataCondition string `json:"metadataCondition"` // This string has to match a required format.\n\n- `$contains(production)` – Matches if `production` appears anywhere in the host metadata value.\n- `$eq(production)` – Matches if `production` matches the host metadata value exactly.\n- `$prefix(production)` – Matches if `production` matches the prefix of the host metadata value.\n- `$suffix(production)` – Matches if `production` matches the suffix of the host metadata value.\n\nAvailable logic operations:\n- `$not($eq(production))` – Matches if the host metadata value is different from `production`.\n- `$and($prefix(production),$suffix(main))` – Matches if host metadata value starts with `production` and ends with `main`.\n- `$or($prefix(production),$suffix(main))` – Matches if host metadata value starts with `production` or ends with `main`.\n\nBrackets **(** and **)** that are part of the matched property **must be escaped with a tilde (~)**
KeyMustExist bool `json:"keyMustExist"` // When enabled, the condition requires a resource attribute to exist and match the constraints; when disabled, the key is optional but must still match the constrains if it is present.
MetadataCondition string `json:"metadataCondition"` // This string has to match a required format.\n\n - `$match(ver*_1.2.?)` – Matches string with wildcards: `*` any number (including zero) of characters and `?` exactly one character.\n - `$contains(production)` – Matches if `production` appears anywhere in the host metadata value.\n - `$eq(production)` – Matches if `production` matches the host metadata value exactly.\n - `$prefix(production)` – Matches if `production` matches the prefix of the host metadata value.\n - `$suffix(production)` – Matches if `production` matches the suffix of the host metadata value.\n\n Available logic operations:\n - `$not($eq(production))` – Matches if the host metadata value is different from `production`.\n - `$and($prefix(production),$suffix(main))` – Matches if host metadata value starts with `production` and ends with `main`.\n - `$or($prefix(production),$suffix(main))` – Matches if host metadata value starts with `production` or ends with `main`.\n\n Brackets **(** and **)** that are part of the matched property **must be escaped with a tilde (~)**
MetadataKey string `json:"metadataKey"` // Key
}

func (me *HostMetadataCondition) Schema() map[string]*schema.Schema {
return map[string]*schema.Schema{
"key_must_exist": {
Type: schema.TypeBool,
Description: "When enabled, the condition requires a metadata key to exist and match the constraints; when disabled, the key is optional but must still match the constrains if it is present.",
Description: "When enabled, the condition requires a resource attribute to exist and match the constraints; when disabled, the key is optional but must still match the constrains if it is present.",
Optional: true,
Default: true,
},
"metadata_condition": {
Type: schema.TypeString,
Description: "This string has to match a required format.\n\n- `$contains(production)` – Matches if `production` appears anywhere in the host metadata value.\n- `$eq(production)` – Matches if `production` matches the host metadata value exactly.\n- `$prefix(production)` – Matches if `production` matches the prefix of the host metadata value.\n- `$suffix(production)` – Matches if `production` matches the suffix of the host metadata value.\n\nAvailable logic operations:\n- `$not($eq(production))` – Matches if the host metadata value is different from `production`.\n- `$and($prefix(production),$suffix(main))` – Matches if host metadata value starts with `production` and ends with `main`.\n- `$or($prefix(production),$suffix(main))` – Matches if host metadata value starts with `production` or ends with `main`.\n\nBrackets **(** and **)** that are part of the matched property **must be escaped with a tilde (~)**",
Description: "This string has to match a required format.\n\n - `$match(ver*_1.2.?)` – Matches string with wildcards: `*` any number (including zero) of characters and `?` exactly one character.\n - `$contains(production)` – Matches if `production` appears anywhere in the host metadata value.\n - `$eq(production)` – Matches if `production` matches the host metadata value exactly.\n - `$prefix(production)` – Matches if `production` matches the prefix of the host metadata value.\n - `$suffix(production)` – Matches if `production` matches the suffix of the host metadata value.\n\n Available logic operations:\n - `$not($eq(production))` – Matches if the host metadata value is different from `production`.\n - `$and($prefix(production),$suffix(main))` – Matches if host metadata value starts with `production` and ends with `main`.\n - `$or($prefix(production),$suffix(main))` – Matches if host metadata value starts with `production` or ends with `main`.\n\n Brackets **(** and **)** that are part of the matched property **must be escaped with a tilde (~)**",
Required: true,
},
"metadata_key": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ type Settings struct {
DiskNameFilters []string `json:"diskNameFilters,omitempty"` // Disk will be included in this policy if **any** of the filters match
Enabled bool `json:"enabled"` // This setting is enabled (`true`) or disabled (`false`)
EventProperties MetadataItems `json:"eventProperties,omitempty"` // Set of additional key-value properties to be attached to the triggered event. You can retrieve the available property keys using the [Events API v2](https://dt-url.net/9622g1w). Additionally any Host resource attribute can be dynamically substituted (agent 1.325+)
HostMetadataConditions HostMetadataConditionTypes `json:"hostMetadataConditions,omitempty"` // The policy will be enabled if **all** conditions are met
OperatingSystem []EoperatingSystem `json:"operatingSystem,omitempty"` // Select the operating systems on which policy should be applied
HostMetadataConditions HostMetadataConditionTypes `json:"hostMetadataConditions,omitempty"` // Host resource attributes are dimensions enriching the host including custom metadata which are user-defined key-value pairs that you can assign to hosts monitored by Dynatrace.\n\n By defining custom metadata, you can enrich the monitoring data with context specific to your organization's needs, such as environment names, team ownership, application versions, or any other relevant details.\n\n See [Define tags and metadata for hosts](https://dt-url.net/w3hv0kbw).\n\n Note: Starting from version 1.325 host resource attributes are supported in addition to host custom metadata.
OperatingSystem []EoperatingSystem `json:"operatingSystem,omitempty"` // Select the operating systems on which policy should be applied. Possible values: `AIX`, `LINUX`, `WINDOWS`
PolicyName string `json:"policyName"` // Policy name
Scope *string `json:"-" scope:"scope"` // The scope of this setting (HOST, HOST_GROUP). Omit this property if you want to cover the whole environment.
InsertAfter string `json:"-"`
Expand Down Expand Up @@ -72,15 +72,15 @@ func (me *Settings) Schema() map[string]*schema.Schema {
},
"host_metadata_conditions": {
Type: schema.TypeList,
Description: "The policy will be enabled if **all** conditions are met",
Description: "Host resource attributes are dimensions enriching the host including custom metadata which are user-defined key-value pairs that you can assign to hosts monitored by Dynatrace.\n\n By defining custom metadata, you can enrich the monitoring data with context specific to your organization's needs, such as environment names, team ownership, application versions, or any other relevant details.\n\n See [Define tags and metadata for hosts](https://dt-url.net/w3hv0kbw).\n\n Note: Starting from version 1.325 host resource attributes are supported in addition to host custom metadata.",
Optional: true, // minobjects == 0
Elem: &schema.Resource{Schema: new(HostMetadataConditionTypes).Schema()},
MinItems: 1,
MaxItems: 1,
},
"operating_system": {
Type: schema.TypeSet,
Description: "Select the operating systems on which policy should be applied",
Description: "Select the operating systems on which policy should be applied. Possible values: `AIX`, `LINUX`, `WINDOWS`",
Optional: true, // minobjects == 0
Elem: &schema.Schema{Type: schema.TypeString},
},
Expand Down
Loading