diff --git a/docs/data-sources/conversations_messaging_settings.md b/docs/data-sources/conversations_messaging_settings.md index 4012c9202..d093dd0ed 100644 --- a/docs/data-sources/conversations_messaging_settings.md +++ b/docs/data-sources/conversations_messaging_settings.md @@ -10,7 +10,13 @@ description: |- Genesys Cloud conversations messaging settings data source. Select an conversations messaging settings by name +## Example Usage +```terraform +data "genesyscloud_conversations_messaging_settings" "example-messaging-settings" { + name = "settings name" +} +``` ## Schema diff --git a/docs/resources/conversations_messaging_settings.md b/docs/resources/conversations_messaging_settings.md index d91111828..b2a86a76b 100644 --- a/docs/resources/conversations_messaging_settings.md +++ b/docs/resources/conversations_messaging_settings.md @@ -11,9 +11,37 @@ Genesys Cloud conversations messaging settings ## API Usage The following Genesys Cloud APIs are used by this resource. Ensure your OAuth Client has been granted the necessary scopes and permissions to perform these operations: -**No APIs** - - +* [GET /api/v2/conversations/messaging/settings](https://developer.genesys.cloud/devapps/api-explorer#get-api-v2-conversations-messaging-settings) +* [POST /api/v2/conversations/messaging/settings](https://developer.genesys.cloud/devapps/api-explorer#post-api-v2-conversations-messaging-settings) +* [GET /api/v2/conversations/messaging/settings/{messageSettingId}](https://developer.genesys.cloud/devapps/api-explorer#get-api-v2-conversations-messaging-settings--messageSettingId-) +* [PATCH /api/v2/conversations/messaging/settings/{messageSettingId}](https://developer.genesys.cloud/devapps/api-explorer#patch-api-v2-conversations-messaging-settings--messageSettingId-) +* [DELETE /api/v2/conversations/messaging/settings/{messageSettingId}](https://developer.genesys.cloud/devapps/api-explorer#delete-api-v2-conversations-messaging-settings--messageSettingId-) + +## Example Usage + +```terraform +resource "genesyscloud_conversations_messaging_settings" "example-messaging-settings" { + name = "Sample Messaging Settings" + content { + story { + mention { + inbound = "Enabled" + } + reply { + inbound = "Enabled" + } + } + } + event { + typing { + on { + inbound = "Enabled" + outbound = "Enabled" + } + } + } +} +``` ## Schema diff --git a/examples/data-sources/genesyscloud_conversations_messaging_settings/data-source.tf b/examples/data-sources/genesyscloud_conversations_messaging_settings/data-source.tf new file mode 100644 index 000000000..b1f4d48b1 --- /dev/null +++ b/examples/data-sources/genesyscloud_conversations_messaging_settings/data-source.tf @@ -0,0 +1,3 @@ +data "genesyscloud_conversations_messaging_settings" "example-messaging-settings" { + name = "settings name" +} \ No newline at end of file diff --git a/examples/resources/genesyscloud_conversations_messaging_settings/apis.md b/examples/resources/genesyscloud_conversations_messaging_settings/apis.md new file mode 100644 index 000000000..9f6c3fe3e --- /dev/null +++ b/examples/resources/genesyscloud_conversations_messaging_settings/apis.md @@ -0,0 +1,5 @@ +* [GET /api/v2/conversations/messaging/settings](https://developer.genesys.cloud/devapps/api-explorer#get-api-v2-conversations-messaging-settings) +* [POST /api/v2/conversations/messaging/settings](https://developer.genesys.cloud/devapps/api-explorer#post-api-v2-conversations-messaging-settings) +* [GET /api/v2/conversations/messaging/settings/{messageSettingId}](https://developer.genesys.cloud/devapps/api-explorer#get-api-v2-conversations-messaging-settings--messageSettingId-) +* [PATCH /api/v2/conversations/messaging/settings/{messageSettingId}](https://developer.genesys.cloud/devapps/api-explorer#patch-api-v2-conversations-messaging-settings--messageSettingId-) +* [DELETE /api/v2/conversations/messaging/settings/{messageSettingId}](https://developer.genesys.cloud/devapps/api-explorer#delete-api-v2-conversations-messaging-settings--messageSettingId-) \ No newline at end of file diff --git a/examples/resources/genesyscloud_conversations_messaging_settings/resource.tf b/examples/resources/genesyscloud_conversations_messaging_settings/resource.tf new file mode 100644 index 000000000..d80fe743a --- /dev/null +++ b/examples/resources/genesyscloud_conversations_messaging_settings/resource.tf @@ -0,0 +1,21 @@ +resource "genesyscloud_conversations_messaging_settings" "example-messaging-settings" { + name = "Sample Messaging Settings" + content { + story { + mention { + inbound = "Enabled" + } + reply { + inbound = "Enabled" + } + } + } + event { + typing { + on { + inbound = "Enabled" + outbound = "Enabled" + } + } + } +} \ No newline at end of file diff --git a/genesyscloud/conversations_messaging_settings/resource_conversations_messaging_settings.go b/genesyscloud/conversations_messaging_settings/resource_conversations_messaging_settings.go index a0d7dc931..f1304dc77 100644 --- a/genesyscloud/conversations_messaging_settings/resource_conversations_messaging_settings.go +++ b/genesyscloud/conversations_messaging_settings/resource_conversations_messaging_settings.go @@ -18,7 +18,7 @@ import ( "github.com/mypurecloud/platform-client-sdk-go/v133/platformclientv2" ) -func getAllAuthConversationsMessagingSettingss(ctx context.Context, clientConfig *platformclientv2.Configuration) (resourceExporter.ResourceIDMetaMap, diag.Diagnostics) { +func getAllAuthConversationsMessagingSettings(ctx context.Context, clientConfig *platformclientv2.Configuration) (resourceExporter.ResourceIDMetaMap, diag.Diagnostics) { proxy := getConversationsMessagingSettingsProxy(clientConfig) resources := make(resourceExporter.ResourceIDMetaMap) @@ -28,7 +28,6 @@ func getAllAuthConversationsMessagingSettingss(ctx context.Context, clientConfig } for _, messagingSetting := range *messagingSettings { - log.Printf("Dealing with messaging setting id : %s", *messagingSetting.Id) resources[*messagingSetting.Id] = &resourceExporter.ResourceMeta{Name: *messagingSetting.Name} } diff --git a/genesyscloud/conversations_messaging_settings/resource_conversations_messaging_settings_schema.go b/genesyscloud/conversations_messaging_settings/resource_conversations_messaging_settings_schema.go index 7776be6e7..9564bbd70 100644 --- a/genesyscloud/conversations_messaging_settings/resource_conversations_messaging_settings_schema.go +++ b/genesyscloud/conversations_messaging_settings/resource_conversations_messaging_settings_schema.go @@ -118,18 +118,20 @@ func ResourceConversationsMessagingSettings() *schema.Resource { Type: schema.TypeString, }, "content": { - Description: "Settings relating to message contents", - Optional: true, - Type: schema.TypeList, - MaxItems: 1, - Elem: contentSettingResource, + Description: "Settings relating to message contents", + Optional: true, + Type: schema.TypeList, + MaxItems: 1, + Elem: contentSettingResource, + AtLeastOneOf: []string{"content", "event"}, }, "event": { - Description: "Settings relating to events which may occur", - Optional: true, - Type: schema.TypeList, - MaxItems: 1, - Elem: eventSettingResource, + Description: "Settings relating to events which may occur", + Optional: true, + Type: schema.TypeList, + MaxItems: 1, + Elem: eventSettingResource, + AtLeastOneOf: []string{"content", "event"}, }, }, } @@ -156,6 +158,6 @@ func DataSourceConversationsMessagingSettings() *schema.Resource { // ConversationsMessagingSettingsExporter returns the resourceExporter object used to hold the genesyscloud_conversations_messaging_settings exporter's config func ConversationsMessagingSettingsExporter() *resourceExporter.ResourceExporter { return &resourceExporter.ResourceExporter{ - GetResourcesFunc: provider.GetAllWithPooledClient(getAllAuthConversationsMessagingSettingss), + GetResourcesFunc: provider.GetAllWithPooledClient(getAllAuthConversationsMessagingSettings), } }