Skip to content

Commit

Permalink
feat: add notification email resource
Browse files Browse the repository at this point in the history
  • Loading branch information
Fuochi committed Dec 9, 2022
1 parent 767afa5 commit 174877c
Show file tree
Hide file tree
Showing 12 changed files with 642 additions and 56 deletions.
8 changes: 4 additions & 4 deletions docs/data-sources/notification.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ data "radarr_notification" "example" {
- `auth_user` (String) Auth user.
- `author` (String) Author.
- `avatar` (String) Avatar.
- `bcc` (String) Bcc.
- `bcc` (Set of String) Bcc.
- `bot_token` (String) Bot token.
- `cc` (String) Cc.
- `cc` (Set of String) Cc.
- `channel` (String) Channel.
- `channel_tags` (Set of String) Channel tags.
- `chat_id` (String) Chat ID.
Expand All @@ -48,7 +48,7 @@ data "radarr_notification" "example" {
- `config_contract` (String) Notification configuration template.
- `consumer_key` (String) Consumer key.
- `consumer_secret` (String) Consumer secret.
- `device_ids` (Set of Number) Device IDs.
- `device_ids` (Set of String) Device IDs.
- `device_names` (String) Device names.
- `devices` (Set of String) Devices.
- `direct_message` (Boolean) Direct message flag.
Expand Down Expand Up @@ -98,7 +98,7 @@ data "radarr_notification" "example" {
- `sign_in` (String) Sign in.
- `sound` (String) Sound.
- `tags` (Set of Number) List of associated tags.
- `to` (String) To.
- `to` (Set of String) To.
- `token` (String) Token.
- `topics` (Set of String) Devices.
- `update_library` (Boolean) Update library flag.
Expand Down
8 changes: 4 additions & 4 deletions docs/data-sources/notifications.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ Read-Only:
- `auth_user` (String) Auth user.
- `author` (String) Author.
- `avatar` (String) Avatar.
- `bcc` (String) Bcc.
- `bcc` (Set of String) Bcc.
- `bot_token` (String) Bot token.
- `cc` (String) Cc.
- `cc` (Set of String) Cc.
- `channel` (String) Channel.
- `channel_tags` (Set of String) Channel tags.
- `chat_id` (String) Chat ID.
Expand All @@ -51,7 +51,7 @@ Read-Only:
- `config_contract` (String) Notification configuration template.
- `consumer_key` (String) Consumer key.
- `consumer_secret` (String) Consumer secret.
- `device_ids` (Set of Number) Device IDs.
- `device_ids` (Set of String) Device IDs.
- `device_names` (String) Device names.
- `devices` (Set of String) Devices.
- `direct_message` (Boolean) Direct message flag.
Expand Down Expand Up @@ -102,7 +102,7 @@ Read-Only:
- `sign_in` (String) Sign in.
- `sound` (String) Sound.
- `tags` (Set of Number) List of associated tags.
- `to` (String) To.
- `to` (Set of String) To.
- `token` (String) Token.
- `topics` (Set of String) Devices.
- `update_library` (Boolean) Update library flag.
Expand Down
8 changes: 4 additions & 4 deletions docs/resources/notification.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,17 @@ resource "radarr_notification" "example" {
- `auth_user` (String) Auth user.
- `author` (String) Author.
- `avatar` (String) Avatar.
- `bcc` (String) Bcc.
- `bcc` (Set of String) Bcc.
- `bot_token` (String) Bot token.
- `cc` (String) Cc.
- `cc` (Set of String) Cc.
- `channel` (String) Channel.
- `channel_tags` (Set of String) Channel tags.
- `chat_id` (String) Chat ID.
- `clean_library` (Boolean) Clean library flag.
- `click_url` (String) Click URL.
- `consumer_key` (String) Consumer key.
- `consumer_secret` (String) Consumer secret.
- `device_ids` (Set of Number) Device IDs.
- `device_ids` (Set of String) Device IDs.
- `device_names` (String) Device names.
- `devices` (Set of String) Devices.
- `direct_message` (Boolean) Direct message flag.
Expand Down Expand Up @@ -116,7 +116,7 @@ resource "radarr_notification" "example" {
- `sign_in` (String) Sign in.
- `sound` (String) Sound.
- `tags` (Set of Number) List of associated tags.
- `to` (String) To.
- `to` (Set of String) To.
- `token` (String) Token.
- `topics` (Set of String) Devices.
- `update_library` (Boolean) Update library flag.
Expand Down
80 changes: 80 additions & 0 deletions docs/resources/notification_email.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "radarr_notification_email Resource - terraform-provider-radarr"
subcategory: "Notifications"
description: |-
Notification Email resource.
For more information refer to Notification https://wiki.servarr.com/radarr/settings#connect and Email https://wiki.servarr.com/radarr/supported#email.
---

# radarr_notification_email (Resource)

<!-- subcategory:Notifications -->Notification Email resource.
For more information refer to [Notification](https://wiki.servarr.com/radarr/settings#connect) and [Email](https://wiki.servarr.com/radarr/supported#email).

## Example Usage

```terraform
resource "radarr_notification_email" "example" {
on_grab = false
on_download = true
on_upgrade = true
on_movie_added = false
on_movie_delete = false
on_movie_file_delete = false
on_movie_file_delete_for_upgrade = true
on_health_issue = false
on_application_update = false
include_health_warnings = false
name = "Example"
server = "http://email-server.net"
port = 587
from = "[email protected]"
to = ["[email protected]", "[email protected]"]
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `from` (String) From.
- `include_health_warnings` (Boolean) Include health warnings.
- `name` (String) NotificationEmail name.
- `on_application_update` (Boolean) On application update flag.
- `on_download` (Boolean) On download flag.
- `on_grab` (Boolean) On grab flag.
- `on_health_issue` (Boolean) On health issue flag.
- `on_movie_added` (Boolean) On movie added flag.
- `on_movie_delete` (Boolean) On movie delete flag.
- `on_movie_file_delete` (Boolean) On movie file delete flag.
- `on_movie_file_delete_for_upgrade` (Boolean) On movie file delete for upgrade flag.
- `on_upgrade` (Boolean) On upgrade flag.
- `server` (String) Server.
- `to` (Set of String) To.

### Optional

- `bcc` (Set of String) Bcc.
- `cc` (Set of String) Cc.
- `password` (String, Sensitive) Password.
- `port` (Number) Port.
- `require_encryption` (Boolean) Require encryption flag.
- `tags` (Set of Number) List of associated tags.
- `username` (String) Username.

### Read-Only

- `id` (Number) Notification ID.

## Import

Import is supported using the following syntax:

```shell
# import using the API/UI ID
terraform import radarr_notification_email.example 1
```
2 changes: 2 additions & 0 deletions examples/resources/radarr_notification_email/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# import using the API/UI ID
terraform import radarr_notification_email.example 1
19 changes: 19 additions & 0 deletions examples/resources/radarr_notification_email/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
resource "radarr_notification_email" "example" {
on_grab = false
on_download = true
on_upgrade = true
on_movie_added = false
on_movie_delete = false
on_movie_file_delete = false
on_movie_file_delete_for_upgrade = true
on_health_issue = false
on_application_update = false

include_health_warnings = false
name = "Example"

server = "http://email-server.net"
port = 587
from = "[email protected]"
to = ["[email protected]", "[email protected]"]
}
27 changes: 15 additions & 12 deletions internal/provider/notification_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,18 +197,10 @@ func (d *NotificationDataSource) Schema(ctx context.Context, req datasource.Sche
MarkdownDescription: "Instance name.",
Computed: true,
},
"bcc": schema.StringAttribute{
MarkdownDescription: "Bcc.",
Computed: true,
},
"bot_token": schema.StringAttribute{
MarkdownDescription: "Bot token.",
Computed: true,
},
"cc": schema.StringAttribute{
MarkdownDescription: "Cc.",
Computed: true,
},
"channel": schema.StringAttribute{
MarkdownDescription: "Channel.",
Computed: true,
Expand Down Expand Up @@ -285,10 +277,6 @@ func (d *NotificationDataSource) Schema(ctx context.Context, req datasource.Sche
MarkdownDescription: "Sound.",
Computed: true,
},
"to": schema.StringAttribute{
MarkdownDescription: "To.",
Computed: true,
},
"token": schema.StringAttribute{
MarkdownDescription: "Token.",
Computed: true,
Expand Down Expand Up @@ -373,6 +361,21 @@ func (d *NotificationDataSource) Schema(ctx context.Context, req datasource.Sche
Computed: true,
ElementType: types.StringType,
},
"to": schema.SetAttribute{
MarkdownDescription: "To.",
Computed: true,
ElementType: types.StringType,
},
"cc": schema.SetAttribute{
MarkdownDescription: "Cc.",
Computed: true,
ElementType: types.StringType,
},
"bcc": schema.SetAttribute{
MarkdownDescription: "Bcc.",
Computed: true,
ElementType: types.StringType,
},
},
}
}
Expand Down
Loading

0 comments on commit 174877c

Please sign in to comment.