Skip to content

Commit 8ce6dd9

Browse files
committed
Updated dynatrace_log_timestamp resource
1 parent c8af200 commit 8ce6dd9

File tree

4 files changed

+115
-13
lines changed

4 files changed

+115
-13
lines changed

dynatrace/api/builtin/logmonitoring/timestampconfiguration/schema.json

+44-1
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,17 @@
180180
"nullable": false,
181181
"type": "boolean"
182182
},
183+
"entry-boundary": {
184+
"description": "Optional field. Enter a fragment of the line text that starts the entry. No support for wildcards - the text is treated literally.",
185+
"displayName": "Entry boundary pattern",
186+
"documentation": "",
187+
"maxObjects": 1,
188+
"modificationPolicy": "DEFAULT",
189+
"nullable": true,
190+
"type": {
191+
"$ref": "#/types/EntryBoundary"
192+
}
193+
},
183194
"matchers": {
184195
"description": "",
185196
"displayName": "",
@@ -244,6 +255,33 @@
244255
],
245256
"schemaId": "builtin:logmonitoring.timestamp-configuration",
246257
"types": {
258+
"EntryBoundary": {
259+
"description": "",
260+
"displayName": "EntryBoundary",
261+
"documentation": "",
262+
"properties": {
263+
"pattern": {
264+
"constraints": [
265+
{
266+
"maxLength": 500,
267+
"minLength": 1,
268+
"type": "LENGTH"
269+
}
270+
],
271+
"description": "",
272+
"displayName": "",
273+
"documentation": "",
274+
"maxObjects": 1,
275+
"modificationPolicy": "DEFAULT",
276+
"nullable": true,
277+
"type": "text"
278+
}
279+
},
280+
"summaryPattern": "",
281+
"type": "object",
282+
"version": "0",
283+
"versionInfo": ""
284+
},
247285
"Matcher": {
248286
"constraints": [
249287
{
@@ -351,12 +389,17 @@
351389
"displayName": "Timestamp Search Limit",
352390
"id": "dateSearchLimit",
353391
"propertyRef": "date-search-limit"
392+
},
393+
{
394+
"displayName": "Entry boundary",
395+
"id": "entryBoundary",
396+
"propertyRef": "entry-boundary/pattern"
354397
}
355398
],
356399
"emptyState": {
357400
"text": "**Create your first rule**\n\nAdd the first rule to configure timestamp patterns"
358401
}
359402
}
360403
},
361-
"version": "1.0.8"
404+
"version": "1.0.9"
362405
}

dynatrace/api/builtin/logmonitoring/timestampconfiguration/service.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323
"github.com/dynatrace-oss/terraform-provider-dynatrace/dynatrace/settings/services/settings20"
2424
)
2525

26-
const SchemaVersion = "1.0.8"
26+
const SchemaVersion = "1.0.9"
2727
const SchemaID = "builtin:logmonitoring.timestamp-configuration"
2828

2929
func Service(credentials *settings.Credentials) settings.CRUDService[*timestampconfiguration.Settings] {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/**
2+
* @license
3+
* Copyright 2020 Dynatrace LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package timestampconfiguration
19+
20+
import (
21+
"github.com/dynatrace-oss/terraform-provider-dynatrace/terraform/hcl"
22+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
23+
)
24+
25+
type EntryBoundary struct {
26+
Pattern *string `json:"pattern,omitempty"`
27+
}
28+
29+
func (me *EntryBoundary) Schema() map[string]*schema.Schema {
30+
return map[string]*schema.Schema{
31+
"pattern": {
32+
Type: schema.TypeString,
33+
Description: "no documentation available",
34+
Optional: true, // nullable
35+
},
36+
}
37+
}
38+
39+
func (me *EntryBoundary) MarshalHCL(properties hcl.Properties) error {
40+
return properties.EncodeAll(map[string]any{
41+
"pattern": me.Pattern,
42+
})
43+
}
44+
45+
func (me *EntryBoundary) UnmarshalHCL(decoder hcl.Decoder) error {
46+
return decoder.DecodeAll(map[string]any{
47+
"pattern": &me.Pattern,
48+
})
49+
}

dynatrace/api/builtin/logmonitoring/timestampconfiguration/settings/settings.go

+21-11
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,15 @@ import (
2323
)
2424

2525
type Settings struct {
26-
Config_item_title string `json:"config-item-title"` // Name
27-
Date_search_limit *int `json:"date-search-limit,omitempty"` // (v1.275) Defines the number of characters in every log line (starting from the first character in the line) where the timestamp is searched.
28-
Date_time_pattern string `json:"date-time-pattern"` // Date-time pattern
29-
Enabled bool `json:"enabled"` // This setting is enabled (`true`) or disabled (`false`)
30-
Matchers Matchers `json:"matchers,omitempty"`
31-
Scope *string `json:"-" scope:"scope"` // The scope of this setting (HOST, HOST_GROUP). Omit this property if you want to cover the whole environment.
32-
Timezone string `json:"timezone"` // Timezone
33-
InsertAfter string `json:"-"`
26+
Config_item_title string `json:"config-item-title"` // Name
27+
Date_search_limit *int `json:"date-search-limit,omitempty"` // Defines the number of characters in every log line (starting from the first character in the line) where the timestamp is searched.
28+
Date_time_pattern string `json:"date-time-pattern"` // Date-time pattern
29+
Enabled bool `json:"enabled"` // This setting is enabled (`true`) or disabled (`false`)
30+
Entry_boundary *EntryBoundary `json:"entry-boundary,omitempty"` // Optional field. Enter a fragment of the line text that starts the entry. No support for wildcards - the text is treated literally.
31+
Matchers Matchers `json:"matchers,omitempty"`
32+
Scope *string `json:"-" scope:"scope"` // The scope of this setting (HOST, HOST_GROUP). Omit this property if you want to cover the whole environment.
33+
Timezone string `json:"timezone"` // Timezone
34+
InsertAfter string `json:"-"`
3435
}
3536

3637
func (me *Settings) Name() string {
@@ -46,7 +47,7 @@ func (me *Settings) Schema() map[string]*schema.Schema {
4647
},
4748
"date_search_limit": {
4849
Type: schema.TypeInt,
49-
Description: "(v1.275) Defines the number of characters in every log line (starting from the first character in the line) where the timestamp is searched.",
50+
Description: "Defines the number of characters in every log line (starting from the first character in the line) where the timestamp is searched.",
5051
Optional: true, // nullable
5152
},
5253
"date_time_pattern": {
@@ -59,10 +60,18 @@ func (me *Settings) Schema() map[string]*schema.Schema {
5960
Description: "This setting is enabled (`true`) or disabled (`false`)",
6061
Required: true,
6162
},
63+
"entry_boundary": {
64+
Type: schema.TypeList,
65+
Description: "Optional field. Enter a fragment of the line text that starts the entry. No support for wildcards - the text is treated literally.",
66+
Optional: true, // nullable
67+
Elem: &schema.Resource{Schema: new(EntryBoundary).Schema()},
68+
MinItems: 1,
69+
MaxItems: 1,
70+
},
6271
"matchers": {
6372
Type: schema.TypeList,
6473
Description: "no documentation available",
65-
Optional: true,
74+
Optional: true, // minobjects == 0
6675
Elem: &schema.Resource{Schema: new(Matchers).Schema()},
6776
MinItems: 1,
6877
MaxItems: 1,
@@ -72,7 +81,6 @@ func (me *Settings) Schema() map[string]*schema.Schema {
7281
Description: "The scope of this setting (HOST, HOST_GROUP). Omit this property if you want to cover the whole environment.",
7382
Optional: true,
7483
Default: "environment",
75-
ForceNew: true,
7684
},
7785
"timezone": {
7886
Type: schema.TypeString,
@@ -94,6 +102,7 @@ func (me *Settings) MarshalHCL(properties hcl.Properties) error {
94102
"date_search_limit": me.Date_search_limit,
95103
"date_time_pattern": me.Date_time_pattern,
96104
"enabled": me.Enabled,
105+
"entry_boundary": me.Entry_boundary,
97106
"matchers": me.Matchers,
98107
"scope": me.Scope,
99108
"timezone": me.Timezone,
@@ -107,6 +116,7 @@ func (me *Settings) UnmarshalHCL(decoder hcl.Decoder) error {
107116
"date_search_limit": &me.Date_search_limit,
108117
"date_time_pattern": &me.Date_time_pattern,
109118
"enabled": &me.Enabled,
119+
"entry_boundary": &me.Entry_boundary,
110120
"matchers": &me.Matchers,
111121
"scope": &me.Scope,
112122
"timezone": &me.Timezone,

0 commit comments

Comments
 (0)