Skip to content

Instantly share code, notes, and snippets.

@ffalor
Created May 3, 2024 16:28
Show Gist options
  • Save ffalor/bf6aa249b520bdf1338650dd5cbc2ecf to your computer and use it in GitHub Desktop.
Save ffalor/bf6aa249b520bdf1338650dd5cbc2ecf to your computer and use it in GitHub Desktop.
"schedule": schema.SingleNestedAttribute{
Optional: true,
Description: "Prohibit sensor updates during a set of time blocks.",
Attributes: map[string]schema.Attribute{
"timezone": schema.SetAttribute{
Required: true,
Description: "The time zones that will be used for the time blocks.",
},
"time_block": schema.SetNestedAttribute{
Required: true,
Description: "The time block to prevent sensor updates.",
NestedObject: schema.NestedAttributeObject{
Attributes: map[string]schema.Attribute{
"days": schema.SetAttribute{
Required: true,
ElementType: types.StringType,
Description: "The days of the week the time block should be active.",
Validators: []validator.Set{
setvalidator.ValueStringsAre(
stringvalidator.OneOfCaseInsensitive(
maps.Keys(weekdays)...,
),
),
},
},
"start_time": schema.StringAttribute{
Required: true,
Description: "The start time for the time block in 24HR format. Must be atleast 1 hour before end_time.",
},
"end_time": schema.StringAttribute{
Required: true,
Description: "The end time for the time block in 24HR format. Must be atleast 1 hour more than start_time.",
},
},
},
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment