diff --git a/docs/data-sources/routing_settings.md b/docs/data-sources/routing_settings.md
deleted file mode 100644
index 18d93fc8f..000000000
--- a/docs/data-sources/routing_settings.md
+++ /dev/null
@@ -1,44 +0,0 @@
----
-# generated by https://github.com/hashicorp/terraform-plugin-docs
-page_title: "genesyscloud_routing_settings Data Source - terraform-provider-genesyscloud"
-subcategory: ""
-description: |-
- An organization's routing settings
----
-
-# genesyscloud_routing_settings (Data Source)
-
-An organization's routing settings
-
-
-
-
-## Schema
-
-### Optional
-
-- `contactcenter` (Block List, Max: 1) Contact center settings (see [below for nested schema](#nestedblock--contactcenter))
-- `reset_agent_on_presence_change` (Boolean) Reset agent score when agent presence changes from off-queue to on-queue
-- `transcription` (Block List, Max: 1) Transcription settings (see [below for nested schema](#nestedblock--transcription))
-
-### Read-Only
-
-- `id` (String) The ID of this resource.
-
-
-### Nested Schema for `contactcenter`
-
-Optional:
-
-- `remove_skills_from_blind_transfer` (Boolean) Strip skills from transfer
-
-
-
-### Nested Schema for `transcription`
-
-Optional:
-
-- `content_search_enabled` (Boolean) Setting to enable/disable content search
-- `low_latency_transcription_enabled` (Boolean) Boolean flag indicating whether low latency transcription via Notification API is enabled
-- `transcription` (String) Setting to enable/disable transcription capability.Valid values: Disabled, EnabledGlobally, EnabledQueueFlow
-- `transcription_confidence_threshold` (Number) Configure confidence threshold. The possible values are from 1 to 100
diff --git a/docs/resources/journey_segment.md b/docs/resources/journey_segment.md
index 66173abf6..785e47715 100644
--- a/docs/resources/journey_segment.md
+++ b/docs/resources/journey_segment.md
@@ -60,7 +60,7 @@ resource "genesyscloud_journey_segment" "example_journey_segment_resource" {
- `color` (String) The hexadecimal color value of the segment.
- `display_name` (String) The display name of the segment.
-- `scope` (String) The target entity that a segment applies to.Valid values: Session, Customer. Changing the scope attribute will cause the existing journey_segment to be dropped and recreated with new ID.
+- `scope` (String) The target entity that a segment applies to. Valid values: Session
### Optional
diff --git a/docs/resources/outbound_contact_list_contact.md b/docs/resources/outbound_contact_list_contact.md
new file mode 100644
index 000000000..98c79269f
--- /dev/null
+++ b/docs/resources/outbound_contact_list_contact.md
@@ -0,0 +1,115 @@
+---
+page_title: "genesyscloud_outbound_contact_list_contact Resource - terraform-provider-genesyscloud"
+subcategory: ""
+description: |-
+ Genesys Cloud Outbound Contact List Contact
+---
+# genesyscloud_outbound_contact_list_contact (Resource)
+
+Genesys Cloud Outbound Contact List Contact
+
+## 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:
+
+- [POST /api/v2/outbound/contactlists/{contactListId}/contacts](https://developer.genesys.cloud/devapps/api-explorer#post-api-v2-outbound-contactlists--contactListId--contacts)
+- [GET /api/v2/outbound/contactlists/{contactListId}/contacts/{contactId}](https://developer.genesys.cloud/devapps/api-explorer#get-api-v2-outbound-contactlists--contactListId--contacts--contactId-)
+- [PUT /api/v2/outbound/contactlists/{contactListId}/contacts/{contactId}](https://developer.genesys.cloud/devapps/api-explorer#put-api-v2-outbound-contactlists--contactListId--contacts--contactId-)
+- [DELETE /api/v2/outbound/contactlists/{contactListId}/contacts/{contactId}](https://developer.genesys.cloud/devapps/api-explorer#delete-api-v2-outbound-contactlists--contactListId--contacts--contactId-)
+
+## Example Usage
+
+```terraform
+resource "genesyscloud_outbound_contact_list_contact" "contact" {
+ contact_list_id = genesyscloud_outbound_contact_list.contact_list.id
+ callable = true
+ data = {
+ Cell = "+1111111"
+ Home = "+2222222"
+ Email = "example@email.com"
+ }
+ phone_number_status {
+ key = "Cell"
+ callable = true
+ }
+ phone_number_status {
+ key = "Home"
+ callable = false
+ }
+ contactable_status {
+ media_type = "Voice"
+ contactable = true
+ column_status {
+ column = "Cell"
+ contactable = true
+ }
+ column_status {
+ column = "Home"
+ contactable = false
+ }
+ }
+ contactable_status {
+ media_type = "Email"
+ contactable = true
+ column_status {
+ column = "Email"
+ contactable = true
+ }
+ }
+}
+```
+
+
+## Schema
+
+### Required
+
+- `contact_list_id` (String) The identifier of the contact list containing this contact.
+- `data` (Map of String) An ordered map of the contact's columns and corresponding values.
+
+### Optional
+
+- `callable` (Boolean) Indicates whether or not the contact can be called. Defaults to `false`.
+- `clear_system_data` (Boolean) Clear system data. True means the system columns (attempts, callable status, etc) stored on the contact will be cleared if the contact already exists; false means they won't.
+Only applicable on the creation of a contact, so updating this field will force the contact to be deleted from the contact list and re-uploaded.
+- `contactable_status` (Block Set) A map of media types (Voice, SMS and Email) to ContactableStatus, which indicates if the contact can be contacted using the specified media type. (see [below for nested schema](#nestedblock--contactable_status))
+- `do_not_queue` (Boolean) Do not queue. True means that updated contacts will not have their positions in the queue altered, so contacts that have already been dialed will not be redialed.
+For new contacts, this parameter has no effect; False means that updated contacts will be re-queued, according to the 'priority' parameter.
+Only applicable on the creation of a contact, so updating this field will force the contact to be deleted from the contact list and re-uploaded.
+- `phone_number_status` (Block Set) A map of phone number columns to PhoneNumberStatuses, which indicate if the phone number is callable or not. (see [below for nested schema](#nestedblock--phone_number_status))
+- `priority` (Boolean) Contact priority. True means the contact(s) will be dialed next; false means the contact will go to the end of the contact queue.
+Only applicable on the creation of a contact, so updating this field will force the contact to be deleted from the contact list and re-uploaded.
+
+### Read-Only
+
+- `id` (String) The ID of this resource.
+
+
+### Nested Schema for `contactable_status`
+
+Required:
+
+- `contactable` (Boolean) Indicates whether or not the entire contact is contactable for the associated media type.
+- `media_type` (String) The key which identifies the media type (Voice, SMS and Email).
+
+Optional:
+
+- `column_status` (Block Set) A map of individual contact method columns to whether the individual column is contactable for the associated media type. (see [below for nested schema](#nestedblock--contactable_status--column_status))
+
+
+### Nested Schema for `contactable_status.column_status`
+
+Required:
+
+- `column` (String) The key which identifies the contact method column.
+- `contactable` (Boolean) Indicates whether or not an individual contact method column is contactable.
+
+
+
+
+### Nested Schema for `phone_number_status`
+
+Required:
+
+- `callable` (Boolean) Indicates whether or not a phone number is callable.
+- `key` (String) Phone number column identifier.
+
diff --git a/docs/resources/routing_queue.md b/docs/resources/routing_queue.md
index 3921981d7..a3f89f294 100644
--- a/docs/resources/routing_queue.md
+++ b/docs/resources/routing_queue.md
@@ -105,6 +105,7 @@ resource "genesyscloud_routing_queue" "example_queue" {
- `media_settings_message` (Block List, Max: 1) Message media settings. (see [below for nested schema](#nestedblock--media_settings_message))
- `members` (Set of Object) Users in the queue. If not set, this resource will not manage members. If a user is already assigned to this queue via a group, attempting to assign them using this field will cause an error to be thrown. (see [below for nested schema](#nestedatt--members))
- `message_in_queue_flow_id` (String) The in-queue flow ID to use for message conversations waiting in queue.
+- `on_hold_prompt_id` (String) The audio to be played when calls on this queue are on hold. If not configured, the default on-hold music will play.
- `outbound_email_address` (Block List, Max: 1, Deprecated) The outbound email address settings for this queue. (see [below for nested schema](#nestedblock--outbound_email_address))
- `outbound_messaging_sms_address_id` (String) The unique ID of the outbound messaging SMS address for the queue.
- `queue_flow_id` (String) The in-queue flow ID to use for call conversations waiting in queue.
diff --git a/docs/resources/routing_settings.md b/docs/resources/routing_settings.md
index 548add012..ff9c5d9e8 100644
--- a/docs/resources/routing_settings.md
+++ b/docs/resources/routing_settings.md
@@ -65,6 +65,8 @@ Optional:
- `content_search_enabled` (Boolean) Setting to enable/disable content search
- `low_latency_transcription_enabled` (Boolean) Boolean flag indicating whether low latency transcription via Notification API is enabled
+- `pci_dss_redaction_enabled` (Boolean) Setting to enable/disable PCI DSS Redaction
+- `pii_redaction_enabled` (Boolean) Setting to enable/disable PII Redaction
- `transcription` (String) Setting to enable/disable transcription capability.Valid values: Disabled, EnabledGlobally, EnabledQueueFlow
- `transcription_confidence_threshold` (Number) Configure confidence threshold. The possible values are from 1 to 100
diff --git a/docs/resources/tf_export.md b/docs/resources/tf_export.md
index 4fbff2237..b68964897 100644
--- a/docs/resources/tf_export.md
+++ b/docs/resources/tf_export.md
@@ -60,6 +60,7 @@ resource "genesyscloud_tf_export" "export" {
### Optional
+- `compress` (Boolean) Compress exported results using zip format Defaults to `false`.
- `directory` (String) Directory where the config and state files will be exported. Defaults to `./genesyscloud`.
- `enable_dependency_resolution` (Boolean) Adds a "depends_on" attribute to genesyscloud_flow resources with a list of resources that are referenced inside the flow configuration . This also resolves and exports all the dependent resources for any given resource. Defaults to `false`.
- `exclude_attributes` (List of String) Attributes to exclude from the config when exporting resources. Each value should be of the form {resource_name}.{attribute}, e.g. 'genesyscloud_user.skills'. Excluded attributes must be optional.
diff --git a/docs/resources/widget_deployment.md b/docs/resources/widget_deployment.md
index c91b869b1..8153c0069 100644
--- a/docs/resources/widget_deployment.md
+++ b/docs/resources/widget_deployment.md
@@ -27,9 +27,8 @@ resource "genesyscloud_widget_deployment" "mywidget" {
client_type = "v1"
authentication_required = true
disabled = true
- client_config {
- authentication_url = "https://examplewebsite.com"
- webchat_skin = "modern-caret-skin"
+ third_party_client_config = {
+ foo = "bar"
}
allowed_domains = []
}
@@ -41,16 +40,18 @@ resource "genesyscloud_widget_deployment" "mywidget" {
### Required
- `authentication_required` (Boolean) When true, the customer members starting a chat must be authenticated by supplying their JWT to the create operation.
-- `client_type` (String) The type of display widget for which this Deployment is configured, which controls the administrator settings shown.Valid values: v1, v2, v1-http, third-party.
+- `client_type` (String) The type of display widget for which this Deployment is configured, which controls the administrator settings shown. Valid values: v1, v1-http, v2, third-party
- `disabled` (Boolean) When true, all create chat operations using this Deployment will be rejected.
- `name` (String) Name of the Widget Deployment.
### Optional
- `allowed_domains` (List of String) The list of domains that are approved to use this Deployment; the list will be added to CORS headers for ease of web use
-- `client_config` (Block Set, Max: 1) The V1 and V1-http client configuration options that should be made available to the clients of this Deployment. (see [below for nested schema](#nestedblock--client_config))
+- `client_config` (Block Set, Max: 1, Deprecated) The V1 and V1-http client configuration options that should be made available to the clients of this Deployment. (see [below for nested schema](#nestedblock--client_config))
- `description` (String) Widget Deployment description.
- `flow_id` (String) The Inbound Chat Flow to run when new chats are initiated under this Deployment
+- `third_party_client_config` (Map of String) The third party client configuration options that should be made available to the clients of this Deployment.
+- `v2_client_config` (Map of String) The v2 client configuration options that should be made available to the clients of this Deployment.
### Read-Only
@@ -59,11 +60,8 @@ resource "genesyscloud_widget_deployment" "mywidget" {
### Nested Schema for `client_config`
-Required:
-
-- `webchat_skin` (String) Skin for the webchat user. (basic, modern-caret-skin)
-
Optional:
- `authentication_url` (String) Url endpoint to perform_authentication
+- `webchat_skin` (String) Skin for the webchat user. (basic, modern-caret-skin)
diff --git a/examples/resources/genesyscloud_outbound_contact_list_contact/apis.md b/examples/resources/genesyscloud_outbound_contact_list_contact/apis.md
new file mode 100644
index 000000000..239567e26
--- /dev/null
+++ b/examples/resources/genesyscloud_outbound_contact_list_contact/apis.md
@@ -0,0 +1,4 @@
+- [POST /api/v2/outbound/contactlists/{contactListId}/contacts](https://developer.genesys.cloud/devapps/api-explorer#post-api-v2-outbound-contactlists--contactListId--contacts)
+- [GET /api/v2/outbound/contactlists/{contactListId}/contacts/{contactId}](https://developer.genesys.cloud/devapps/api-explorer#get-api-v2-outbound-contactlists--contactListId--contacts--contactId-)
+- [PUT /api/v2/outbound/contactlists/{contactListId}/contacts/{contactId}](https://developer.genesys.cloud/devapps/api-explorer#put-api-v2-outbound-contactlists--contactListId--contacts--contactId-)
+- [DELETE /api/v2/outbound/contactlists/{contactListId}/contacts/{contactId}](https://developer.genesys.cloud/devapps/api-explorer#delete-api-v2-outbound-contactlists--contactListId--contacts--contactId-)
\ No newline at end of file
diff --git a/examples/resources/genesyscloud_outbound_contact_list_contact/resource.tf b/examples/resources/genesyscloud_outbound_contact_list_contact/resource.tf
new file mode 100644
index 000000000..07bd64312
--- /dev/null
+++ b/examples/resources/genesyscloud_outbound_contact_list_contact/resource.tf
@@ -0,0 +1,37 @@
+resource "genesyscloud_outbound_contact_list_contact" "contact" {
+ contact_list_id = genesyscloud_outbound_contact_list.contact_list.id
+ callable = true
+ data = {
+ Cell = "+1111111"
+ Home = "+2222222"
+ Email = "example@email.com"
+ }
+ phone_number_status {
+ key = "Cell"
+ callable = true
+ }
+ phone_number_status {
+ key = "Home"
+ callable = false
+ }
+ contactable_status {
+ media_type = "Voice"
+ contactable = true
+ column_status {
+ column = "Cell"
+ contactable = true
+ }
+ column_status {
+ column = "Home"
+ contactable = false
+ }
+ }
+ contactable_status {
+ media_type = "Email"
+ contactable = true
+ column_status {
+ column = "Email"
+ contactable = true
+ }
+ }
+}
\ No newline at end of file
diff --git a/examples/resources/genesyscloud_widget_deployment/resource.tf b/examples/resources/genesyscloud_widget_deployment/resource.tf
index 1070a0fde..fd79e2b04 100644
--- a/examples/resources/genesyscloud_widget_deployment/resource.tf
+++ b/examples/resources/genesyscloud_widget_deployment/resource.tf
@@ -5,9 +5,8 @@ resource "genesyscloud_widget_deployment" "mywidget" {
client_type = "v1"
authentication_required = true
disabled = true
- client_config {
- authentication_url = "https://examplewebsite.com"
- webchat_skin = "modern-caret-skin"
+ third_party_client_config = {
+ foo = "bar"
}
allowed_domains = []
}
\ No newline at end of file
diff --git a/genesyscloud/architect_datatable/data_source_genesyscloud_architect_datatable.go b/genesyscloud/architect_datatable/data_source_genesyscloud_architect_datatable.go
index 417f3779c..fe8f6f8e6 100644
--- a/genesyscloud/architect_datatable/data_source_genesyscloud_architect_datatable.go
+++ b/genesyscloud/architect_datatable/data_source_genesyscloud_architect_datatable.go
@@ -11,7 +11,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func DataSourceArchitectDatatableRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
diff --git a/genesyscloud/architect_datatable/resource_genesyscloud_architect_datatable.go b/genesyscloud/architect_datatable/resource_genesyscloud_architect_datatable.go
index 166cd32e5..0aa344ef2 100644
--- a/genesyscloud/architect_datatable/resource_genesyscloud_architect_datatable.go
+++ b/genesyscloud/architect_datatable/resource_genesyscloud_architect_datatable.go
@@ -17,7 +17,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
type Datatableproperty struct {
diff --git a/genesyscloud/architect_datatable/resource_genesyscloud_architect_datatable_proxy.go b/genesyscloud/architect_datatable/resource_genesyscloud_architect_datatable_proxy.go
index 8b65f6468..9223c15f3 100644
--- a/genesyscloud/architect_datatable/resource_genesyscloud_architect_datatable_proxy.go
+++ b/genesyscloud/architect_datatable/resource_genesyscloud_architect_datatable_proxy.go
@@ -6,7 +6,7 @@ import (
"errors"
"net/http"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
// internalProxy holds a proxy instance that can be used throughout the package
diff --git a/genesyscloud/architect_datatable/resource_genesyscloud_architect_datatable_test.go b/genesyscloud/architect_datatable/resource_genesyscloud_architect_datatable_test.go
index 89f10ec74..bd6b97a9e 100644
--- a/genesyscloud/architect_datatable/resource_genesyscloud_architect_datatable_test.go
+++ b/genesyscloud/architect_datatable/resource_genesyscloud_architect_datatable_test.go
@@ -14,7 +14,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceArchitectDatatable(t *testing.T) {
diff --git a/genesyscloud/architect_datatable_row/genesyscloud_architect_datatable_row_utils.go b/genesyscloud/architect_datatable_row/genesyscloud_architect_datatable_row_utils.go
index 669cc7e6e..a346d63de 100644
--- a/genesyscloud/architect_datatable_row/genesyscloud_architect_datatable_row_utils.go
+++ b/genesyscloud/architect_datatable_row/genesyscloud_architect_datatable_row_utils.go
@@ -11,7 +11,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
// Row IDs structured as {table-id}/{key-value}
diff --git a/genesyscloud/architect_datatable_row/resource_genesyscloud_architect_datatable_row.go b/genesyscloud/architect_datatable_row/resource_genesyscloud_architect_datatable_row.go
index abf3efdf7..74a126ee4 100644
--- a/genesyscloud/architect_datatable_row/resource_genesyscloud_architect_datatable_row.go
+++ b/genesyscloud/architect_datatable_row/resource_genesyscloud_architect_datatable_row.go
@@ -18,7 +18,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
type Datatableproperty struct {
diff --git a/genesyscloud/architect_datatable_row/resource_genesyscloud_architect_datatable_row_proxy.go b/genesyscloud/architect_datatable_row/resource_genesyscloud_architect_datatable_row_proxy.go
index 300169eb9..1f94400bc 100644
--- a/genesyscloud/architect_datatable_row/resource_genesyscloud_architect_datatable_row_proxy.go
+++ b/genesyscloud/architect_datatable_row/resource_genesyscloud_architect_datatable_row_proxy.go
@@ -5,7 +5,7 @@ import (
"encoding/json"
"errors"
"github.com/mitchellh/mapstructure"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"log"
"net/http"
rc "terraform-provider-genesyscloud/genesyscloud/resource_cache"
diff --git a/genesyscloud/architect_datatable_row/resource_genesyscloud_architect_datatable_row_test.go b/genesyscloud/architect_datatable_row/resource_genesyscloud_architect_datatable_row_test.go
index 9acccd551..070e1bc05 100644
--- a/genesyscloud/architect_datatable_row/resource_genesyscloud_architect_datatable_row_test.go
+++ b/genesyscloud/architect_datatable_row/resource_genesyscloud_architect_datatable_row_test.go
@@ -11,7 +11,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceArchitectDatatableRow(t *testing.T) {
diff --git a/genesyscloud/architect_emergencygroup/genesyscloud_architect_emergencygroup_proxy.go b/genesyscloud/architect_emergencygroup/genesyscloud_architect_emergencygroup_proxy.go
index ac8b2a6d1..01d41745a 100644
--- a/genesyscloud/architect_emergencygroup/genesyscloud_architect_emergencygroup_proxy.go
+++ b/genesyscloud/architect_emergencygroup/genesyscloud_architect_emergencygroup_proxy.go
@@ -3,7 +3,7 @@ package architect_emergencygroup
import (
"context"
"fmt"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
var internalProxy *architectEmergencyGroupProxy
diff --git a/genesyscloud/architect_emergencygroup/resource_genesyscloud_architect_emergencygroup.go b/genesyscloud/architect_emergencygroup/resource_genesyscloud_architect_emergencygroup.go
index 4e2f8622d..9523a2472 100644
--- a/genesyscloud/architect_emergencygroup/resource_genesyscloud_architect_emergencygroup.go
+++ b/genesyscloud/architect_emergencygroup/resource_genesyscloud_architect_emergencygroup.go
@@ -18,7 +18,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func getAllEmergencyGroups(ctx context.Context, clientConfig *platformclientv2.Configuration) (resourceExporter.ResourceIDMetaMap, diag.Diagnostics) {
diff --git a/genesyscloud/architect_emergencygroup/resource_genesyscloud_architect_emergencygroup_test.go b/genesyscloud/architect_emergencygroup/resource_genesyscloud_architect_emergencygroup_test.go
index fdc824edb..0cf52ad50 100644
--- a/genesyscloud/architect_emergencygroup/resource_genesyscloud_architect_emergencygroup_test.go
+++ b/genesyscloud/architect_emergencygroup/resource_genesyscloud_architect_emergencygroup_test.go
@@ -12,7 +12,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceArchitectEmergencyGroups(t *testing.T) {
diff --git a/genesyscloud/architect_emergencygroup/resource_genesyscloud_architect_emergencygroup_utils.go b/genesyscloud/architect_emergencygroup/resource_genesyscloud_architect_emergencygroup_utils.go
index e2ba82d75..11ecb8e35 100644
--- a/genesyscloud/architect_emergencygroup/resource_genesyscloud_architect_emergencygroup_utils.go
+++ b/genesyscloud/architect_emergencygroup/resource_genesyscloud_architect_emergencygroup_utils.go
@@ -2,7 +2,7 @@ package architect_emergencygroup
import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func buildSdkEmergencyGroupCallFlows(d *schema.ResourceData) *[]platformclientv2.Emergencycallflow {
diff --git a/genesyscloud/architect_flow/resource_genesyscloud_architect_flow_proxy.go b/genesyscloud/architect_flow/resource_genesyscloud_architect_flow_proxy.go
index 219ff6ece..f0642e4e5 100644
--- a/genesyscloud/architect_flow/resource_genesyscloud_architect_flow_proxy.go
+++ b/genesyscloud/architect_flow/resource_genesyscloud_architect_flow_proxy.go
@@ -3,7 +3,7 @@ package architect_flow
import (
"context"
"fmt"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"log"
rc "terraform-provider-genesyscloud/genesyscloud/resource_cache"
)
diff --git a/genesyscloud/architect_flow/resource_genesyscloud_flow.go b/genesyscloud/architect_flow/resource_genesyscloud_flow.go
index b5693448c..6c70707fd 100644
--- a/genesyscloud/architect_flow/resource_genesyscloud_flow.go
+++ b/genesyscloud/architect_flow/resource_genesyscloud_flow.go
@@ -18,7 +18,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func getAllFlows(ctx context.Context, clientConfig *platformclientv2.Configuration) (resourceExporter.ResourceIDMetaMap, diag.Diagnostics) {
diff --git a/genesyscloud/architect_flow/resource_genesyscloud_flow_test.go b/genesyscloud/architect_flow/resource_genesyscloud_flow_test.go
index 4066bc273..bb721ed40 100644
--- a/genesyscloud/architect_flow/resource_genesyscloud_flow_test.go
+++ b/genesyscloud/architect_flow/resource_genesyscloud_flow_test.go
@@ -17,7 +17,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
// lockFlow will search for a specific flow and then lock it. This is to specifically test the force_unlock flag where I want to create a flow, simulate some one locking it and then attempt to
diff --git a/genesyscloud/architect_grammar/genesyscloud_architect_grammar_proxy.go b/genesyscloud/architect_grammar/genesyscloud_architect_grammar_proxy.go
index 45a5a593f..36c73863d 100644
--- a/genesyscloud/architect_grammar/genesyscloud_architect_grammar_proxy.go
+++ b/genesyscloud/architect_grammar/genesyscloud_architect_grammar_proxy.go
@@ -6,7 +6,7 @@ import (
"log"
rc "terraform-provider-genesyscloud/genesyscloud/resource_cache"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/architect_grammar/resource_genesyscloud_architect_grammar.go b/genesyscloud/architect_grammar/resource_genesyscloud_architect_grammar.go
index 0017ec632..6fe8bff54 100644
--- a/genesyscloud/architect_grammar/resource_genesyscloud_architect_grammar.go
+++ b/genesyscloud/architect_grammar/resource_genesyscloud_architect_grammar.go
@@ -15,7 +15,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/architect_grammar/resource_genesyscloud_architect_grammar_test.go b/genesyscloud/architect_grammar/resource_genesyscloud_architect_grammar_test.go
index 05f319590..6d81a2d27 100644
--- a/genesyscloud/architect_grammar/resource_genesyscloud_architect_grammar_test.go
+++ b/genesyscloud/architect_grammar/resource_genesyscloud_architect_grammar_test.go
@@ -9,7 +9,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceArchitectGrammar(t *testing.T) {
diff --git a/genesyscloud/architect_grammar_language/genesyscloud_architect_grammar_language_proxy.go b/genesyscloud/architect_grammar_language/genesyscloud_architect_grammar_language_proxy.go
index 6f081a407..6647b9801 100644
--- a/genesyscloud/architect_grammar_language/genesyscloud_architect_grammar_language_proxy.go
+++ b/genesyscloud/architect_grammar_language/genesyscloud_architect_grammar_language_proxy.go
@@ -8,7 +8,7 @@ import (
"terraform-provider-genesyscloud/genesyscloud/util/files"
"time"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
type FileType int
diff --git a/genesyscloud/architect_grammar_language/resource_genesyscloud_architect_grammar_language.go b/genesyscloud/architect_grammar_language/resource_genesyscloud_architect_grammar_language.go
index 4a376d7b8..b8423f1a4 100644
--- a/genesyscloud/architect_grammar_language/resource_genesyscloud_architect_grammar_language.go
+++ b/genesyscloud/architect_grammar_language/resource_genesyscloud_architect_grammar_language.go
@@ -16,7 +16,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/architect_grammar_language/resource_genesyscloud_architect_grammar_language_test.go b/genesyscloud/architect_grammar_language/resource_genesyscloud_architect_grammar_language_test.go
index e36831ea4..7bc029fd3 100644
--- a/genesyscloud/architect_grammar_language/resource_genesyscloud_architect_grammar_language_test.go
+++ b/genesyscloud/architect_grammar_language/resource_genesyscloud_architect_grammar_language_test.go
@@ -15,7 +15,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceArchitectGrammarLanguage(t *testing.T) {
diff --git a/genesyscloud/architect_grammar_language/resource_genesyscloud_architect_grammar_language_utils.go b/genesyscloud/architect_grammar_language/resource_genesyscloud_architect_grammar_language_utils.go
index 58504f1f2..97f30023c 100644
--- a/genesyscloud/architect_grammar_language/resource_genesyscloud_architect_grammar_language_utils.go
+++ b/genesyscloud/architect_grammar_language/resource_genesyscloud_architect_grammar_language_utils.go
@@ -13,7 +13,7 @@ import (
"time"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/architect_ivr/data_source_genesyscloud_architect_ivr_test.go b/genesyscloud/architect_ivr/data_source_genesyscloud_architect_ivr_test.go
index e04f747f2..97345394d 100644
--- a/genesyscloud/architect_ivr/data_source_genesyscloud_architect_ivr_test.go
+++ b/genesyscloud/architect_ivr/data_source_genesyscloud_architect_ivr_test.go
@@ -6,7 +6,7 @@ import (
"testing"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"github.com/stretchr/testify/assert"
"github.com/google/uuid"
diff --git a/genesyscloud/architect_ivr/genesyscloud_architect_ivr_proxy.go b/genesyscloud/architect_ivr/genesyscloud_architect_ivr_proxy.go
index d9cec0a4f..fdd8c9c55 100644
--- a/genesyscloud/architect_ivr/genesyscloud_architect_ivr_proxy.go
+++ b/genesyscloud/architect_ivr/genesyscloud_architect_ivr_proxy.go
@@ -7,7 +7,7 @@ import (
utillists "terraform-provider-genesyscloud/genesyscloud/util/lists"
"time"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/architect_ivr/genesyscloud_architect_ivr_proxy_unit_test.go b/genesyscloud/architect_ivr/genesyscloud_architect_ivr_proxy_unit_test.go
index 723cd5c40..9c00434e0 100644
--- a/genesyscloud/architect_ivr/genesyscloud_architect_ivr_proxy_unit_test.go
+++ b/genesyscloud/architect_ivr/genesyscloud_architect_ivr_proxy_unit_test.go
@@ -11,7 +11,7 @@ import (
"testing"
"github.com/google/uuid"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestUnitUploadIvrDnisChunksSuccess(t *testing.T) {
diff --git a/genesyscloud/architect_ivr/resource_genesyscloud_architect_ivr.go b/genesyscloud/architect_ivr/resource_genesyscloud_architect_ivr.go
index 35be99a30..ab6fb8e76 100644
--- a/genesyscloud/architect_ivr/resource_genesyscloud_architect_ivr.go
+++ b/genesyscloud/architect_ivr/resource_genesyscloud_architect_ivr.go
@@ -18,7 +18,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
// getAllIvrConfigs retrieves all architect IVRs and is used for the exporter
diff --git a/genesyscloud/architect_ivr/resource_genesyscloud_architect_ivr_schema.go b/genesyscloud/architect_ivr/resource_genesyscloud_architect_ivr_schema.go
index cb0c48118..363b5f8fb 100644
--- a/genesyscloud/architect_ivr/resource_genesyscloud_architect_ivr_schema.go
+++ b/genesyscloud/architect_ivr/resource_genesyscloud_architect_ivr_schema.go
@@ -6,7 +6,7 @@ import (
"terraform-provider-genesyscloud/genesyscloud/provider"
resourceExporter "terraform-provider-genesyscloud/genesyscloud/resource_exporter"
registrar "terraform-provider-genesyscloud/genesyscloud/resource_register"
- gcloud "terraform-provider-genesyscloud/genesyscloud/validators"
+ "terraform-provider-genesyscloud/genesyscloud/validators"
)
const (
@@ -65,7 +65,7 @@ func ResourceArchitectIvrConfig() *schema.Resource {
Type: schema.TypeSet,
Optional: true,
Computed: true,
- Elem: &schema.Schema{Type: schema.TypeString, ValidateDiagFunc: gcloud.ValidatePhoneNumber},
+ Elem: &schema.Schema{Type: schema.TypeString, ValidateDiagFunc: validators.ValidatePhoneNumber},
},
"open_hours_flow_id": {
Description: "ID of inbound call flow for open hours.",
diff --git a/genesyscloud/architect_ivr/resource_genesyscloud_architect_ivr_test.go b/genesyscloud/architect_ivr/resource_genesyscloud_architect_ivr_test.go
index fcf3df126..166d0320e 100644
--- a/genesyscloud/architect_ivr/resource_genesyscloud_architect_ivr_test.go
+++ b/genesyscloud/architect_ivr/resource_genesyscloud_architect_ivr_test.go
@@ -14,7 +14,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceIvrConfigBasic(t *testing.T) {
diff --git a/genesyscloud/architect_ivr/resource_genesyscloud_architect_ivr_unit_test.go b/genesyscloud/architect_ivr/resource_genesyscloud_architect_ivr_unit_test.go
index 4f7751e75..b5c97be4b 100644
--- a/genesyscloud/architect_ivr/resource_genesyscloud_architect_ivr_unit_test.go
+++ b/genesyscloud/architect_ivr/resource_genesyscloud_architect_ivr_unit_test.go
@@ -11,7 +11,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"github.com/stretchr/testify/assert"
)
diff --git a/genesyscloud/architect_ivr/resource_genesyscloud_architect_ivr_utils.go b/genesyscloud/architect_ivr/resource_genesyscloud_architect_ivr_utils.go
index be422dd34..cfe4f8446 100644
--- a/genesyscloud/architect_ivr/resource_genesyscloud_architect_ivr_utils.go
+++ b/genesyscloud/architect_ivr/resource_genesyscloud_architect_ivr_utils.go
@@ -8,7 +8,7 @@ import (
"terraform-provider-genesyscloud/genesyscloud/util/lists"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
type IvrConfigStruct struct {
diff --git a/genesyscloud/architect_schedulegroups/genesyscloud_architect_schedulegroups_proxy.go b/genesyscloud/architect_schedulegroups/genesyscloud_architect_schedulegroups_proxy.go
index 53f3b06ef..44bf1b3ee 100644
--- a/genesyscloud/architect_schedulegroups/genesyscloud_architect_schedulegroups_proxy.go
+++ b/genesyscloud/architect_schedulegroups/genesyscloud_architect_schedulegroups_proxy.go
@@ -3,7 +3,7 @@ package architect_schedulegroups
import (
"context"
"fmt"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"log"
)
diff --git a/genesyscloud/architect_schedulegroups/resource_genesyscloud_architect_schedulegroups.go b/genesyscloud/architect_schedulegroups/resource_genesyscloud_architect_schedulegroups.go
index 5a0b08774..3b8bd4e45 100644
--- a/genesyscloud/architect_schedulegroups/resource_genesyscloud_architect_schedulegroups.go
+++ b/genesyscloud/architect_schedulegroups/resource_genesyscloud_architect_schedulegroups.go
@@ -15,7 +15,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/architect_schedulegroups/resource_genesyscloud_architect_schedulegroups_test.go b/genesyscloud/architect_schedulegroups/resource_genesyscloud_architect_schedulegroups_test.go
index fc0b0a846..b654c0254 100644
--- a/genesyscloud/architect_schedulegroups/resource_genesyscloud_architect_schedulegroups_test.go
+++ b/genesyscloud/architect_schedulegroups/resource_genesyscloud_architect_schedulegroups_test.go
@@ -12,7 +12,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceArchitectScheduleGroups(t *testing.T) {
diff --git a/genesyscloud/architect_schedules/genesyscloud_architect_schedules_proxy.go b/genesyscloud/architect_schedules/genesyscloud_architect_schedules_proxy.go
index adb92461a..9fb733127 100644
--- a/genesyscloud/architect_schedules/genesyscloud_architect_schedules_proxy.go
+++ b/genesyscloud/architect_schedules/genesyscloud_architect_schedules_proxy.go
@@ -6,7 +6,7 @@ import (
"log"
rc "terraform-provider-genesyscloud/genesyscloud/resource_cache"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/architect_schedules/resource_genesyscloud_architect_schedules.go b/genesyscloud/architect_schedules/resource_genesyscloud_architect_schedules.go
index b040cd8a9..7d0c6ba1e 100644
--- a/genesyscloud/architect_schedules/resource_genesyscloud_architect_schedules.go
+++ b/genesyscloud/architect_schedules/resource_genesyscloud_architect_schedules.go
@@ -19,7 +19,7 @@ import (
"terraform-provider-genesyscloud/genesyscloud/util/constants"
"terraform-provider-genesyscloud/genesyscloud/util/resourcedata"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
const timeFormat = "2006-01-02T15:04:05.000000"
diff --git a/genesyscloud/architect_schedules/resource_genesyscloud_architect_schedules_test.go b/genesyscloud/architect_schedules/resource_genesyscloud_architect_schedules_test.go
index 29d51b99b..f780c8d5e 100644
--- a/genesyscloud/architect_schedules/resource_genesyscloud_architect_schedules_test.go
+++ b/genesyscloud/architect_schedules/resource_genesyscloud_architect_schedules_test.go
@@ -10,7 +10,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceArchitectSchedules(t *testing.T) {
diff --git a/genesyscloud/architect_user_prompt/genesyscloud_architect_user_prompt_proxy.go b/genesyscloud/architect_user_prompt/genesyscloud_architect_user_prompt_proxy.go
index 64ca3981b..25ac10cb1 100644
--- a/genesyscloud/architect_user_prompt/genesyscloud_architect_user_prompt_proxy.go
+++ b/genesyscloud/architect_user_prompt/genesyscloud_architect_user_prompt_proxy.go
@@ -4,7 +4,7 @@ import (
"context"
"log"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
// internalProxy holds a proxy instance that can be used throughout the package
diff --git a/genesyscloud/architect_user_prompt/resource_genesyscloud_architect_user_prompt.go b/genesyscloud/architect_user_prompt/resource_genesyscloud_architect_user_prompt.go
index f28ae4274..6c7a11825 100644
--- a/genesyscloud/architect_user_prompt/resource_genesyscloud_architect_user_prompt.go
+++ b/genesyscloud/architect_user_prompt/resource_genesyscloud_architect_user_prompt.go
@@ -18,7 +18,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func getAllUserPrompts(ctx context.Context, clientConfig *platformclientv2.Configuration) (resourceExporter.ResourceIDMetaMap, diag.Diagnostics) {
diff --git a/genesyscloud/architect_user_prompt/resource_genesyscloud_architect_user_prompt_test.go b/genesyscloud/architect_user_prompt/resource_genesyscloud_architect_user_prompt_test.go
index 2e13a8771..9ed5d9cce 100644
--- a/genesyscloud/architect_user_prompt/resource_genesyscloud_architect_user_prompt_test.go
+++ b/genesyscloud/architect_user_prompt/resource_genesyscloud_architect_user_prompt_test.go
@@ -16,7 +16,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceUserPromptBasic(t *testing.T) {
diff --git a/genesyscloud/architect_user_prompt/resource_genesyscloud_architect_user_prompt_utils.go b/genesyscloud/architect_user_prompt/resource_genesyscloud_architect_user_prompt_utils.go
index 8e9b6436f..615a715c3 100644
--- a/genesyscloud/architect_user_prompt/resource_genesyscloud_architect_user_prompt_utils.go
+++ b/genesyscloud/architect_user_prompt/resource_genesyscloud_architect_user_prompt_utils.go
@@ -16,7 +16,7 @@ import (
files "terraform-provider-genesyscloud/genesyscloud/util/files"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
type PromptAudioData struct {
diff --git a/genesyscloud/auth_role/data_source_genesyscloud_auth_role.go b/genesyscloud/auth_role/data_source_genesyscloud_auth_role.go
index d83b1380b..a5539383f 100644
--- a/genesyscloud/auth_role/data_source_genesyscloud_auth_role.go
+++ b/genesyscloud/auth_role/data_source_genesyscloud_auth_role.go
@@ -6,7 +6,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"terraform-provider-genesyscloud/genesyscloud/provider"
"terraform-provider-genesyscloud/genesyscloud/util"
"time"
diff --git a/genesyscloud/auth_role/genesyscloud_auth_role_proxy.go b/genesyscloud/auth_role/genesyscloud_auth_role_proxy.go
index cce2393b4..07200518c 100644
--- a/genesyscloud/auth_role/genesyscloud_auth_role_proxy.go
+++ b/genesyscloud/auth_role/genesyscloud_auth_role_proxy.go
@@ -3,7 +3,10 @@ package auth_role
import (
"context"
"fmt"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+
+ rc "terraform-provider-genesyscloud/genesyscloud/resource_cache"
+
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
@@ -39,14 +42,17 @@ type authRoleProxy struct {
deleteAuthRoleAttr deleteAuthRoleFunc
restoreDefaultRolesAttr restoreDefaultRolesFunc
getAllowedPermissionsAttr getAllowedPermissionsFunc
+ authRoleCache rc.CacheInterface[platformclientv2.Domainorganizationrole]
}
// newAuthRoleProxy initializes the auth role proxy with all of the data needed to communicate with Genesys Cloud
func newAuthRoleProxy(clientConfig *platformclientv2.Configuration) *authRoleProxy {
api := platformclientv2.NewAuthorizationApiWithConfig(clientConfig)
+ authRoleCache := rc.NewResourceCache[platformclientv2.Domainorganizationrole]() // Create Cache for authRole resource
return &authRoleProxy{
clientConfig: clientConfig,
authorizationApi: api,
+ authRoleCache: authRoleCache,
createAuthRoleAttr: createAuthRoleFn,
getAllAuthRoleAttr: getAllAuthRoleFn,
getAuthRoleIdByNameAttr: getAuthRoleIdByNameFn,
@@ -85,11 +91,17 @@ func (p *authRoleProxy) getAuthRoleIdByName(ctx context.Context, name string) (i
// getAuthRoleById returns a single Genesys Cloud auth role by Id
func (p *authRoleProxy) getAuthRoleById(ctx context.Context, id string) (authRole *platformclientv2.Domainorganizationrole, response *platformclientv2.APIResponse, err error) {
+ if authRole := rc.GetCacheItem(p.authRoleCache, id); authRole != nil {
+ return authRole, nil, nil
+ }
return p.getAuthRoleByIdAttr(ctx, p, id)
}
// getAuthRoleById returns a single Genesys Cloud auth role by Id
func (p *authRoleProxy) getDefaultRoleById(ctx context.Context, defaultRoleId string) (roleId string, response *platformclientv2.APIResponse, err error) {
+ if authRole := rc.GetCacheItem(p.authRoleCache, defaultRoleId); authRole != nil {
+ return *authRole.Id, nil, nil
+ }
return p.getDefaultRoleIdAttr(ctx, p, defaultRoleId)
}
@@ -148,6 +160,11 @@ func getAllAuthRoleFn(ctx context.Context, p *authRoleProxy) (*[]platformclientv
allAuthRoles = append(allAuthRoles, *roles.Entities...)
}
+ //Cache the Auth Role resource into the p.authRoleCache for later use
+ for _, authRole := range allAuthRoles {
+ rc.SetCache(p.authRoleCache, *authRole.Id, authRole)
+ }
+
return &allAuthRoles, resp, nil
}
diff --git a/genesyscloud/auth_role/resource_genesyscloud_auth_role.go b/genesyscloud/auth_role/resource_genesyscloud_auth_role.go
index 09eb4eaee..37b70ee8a 100644
--- a/genesyscloud/auth_role/resource_genesyscloud_auth_role.go
+++ b/genesyscloud/auth_role/resource_genesyscloud_auth_role.go
@@ -6,7 +6,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"log"
"terraform-provider-genesyscloud/genesyscloud/consistency_checker"
"terraform-provider-genesyscloud/genesyscloud/provider"
diff --git a/genesyscloud/auth_role/resource_genesyscloud_auth_role_test.go b/genesyscloud/auth_role/resource_genesyscloud_auth_role_test.go
index f31c54c02..80782c374 100644
--- a/genesyscloud/auth_role/resource_genesyscloud_auth_role_test.go
+++ b/genesyscloud/auth_role/resource_genesyscloud_auth_role_test.go
@@ -14,7 +14,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceAuthRoleDefault(t *testing.T) {
diff --git a/genesyscloud/auth_role/resource_genesyscloud_auth_role_utils.go b/genesyscloud/auth_role/resource_genesyscloud_auth_role_utils.go
index 64a735483..7efb5f4e1 100644
--- a/genesyscloud/auth_role/resource_genesyscloud_auth_role_utils.go
+++ b/genesyscloud/auth_role/resource_genesyscloud_auth_role_utils.go
@@ -6,7 +6,7 @@ import (
"terraform-provider-genesyscloud/genesyscloud/util/lists"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func validatePermissionPolicy(proxy *authRoleProxy, policy platformclientv2.Domainpermissionpolicy) (*platformclientv2.APIResponse, error) {
diff --git a/genesyscloud/authorization_product/data_source_genesyscloud_authorization_product_test.go b/genesyscloud/authorization_product/data_source_genesyscloud_authorization_product_test.go
index dfe58bcfa..f26f62ca5 100644
--- a/genesyscloud/authorization_product/data_source_genesyscloud_authorization_product_test.go
+++ b/genesyscloud/authorization_product/data_source_genesyscloud_authorization_product_test.go
@@ -7,7 +7,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"github.com/stretchr/testify/assert"
"golang.org/x/net/context"
diff --git a/genesyscloud/authorization_product/genesyscloud_authorization_product_proxy.go b/genesyscloud/authorization_product/genesyscloud_authorization_product_proxy.go
index 2e2887b38..0a920b87a 100644
--- a/genesyscloud/authorization_product/genesyscloud_authorization_product_proxy.go
+++ b/genesyscloud/authorization_product/genesyscloud_authorization_product_proxy.go
@@ -4,7 +4,7 @@ import (
"context"
"fmt"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/data_source_genesyscloud_architect_schedules.go b/genesyscloud/data_source_genesyscloud_architect_schedules.go
index 9c7f761f5..a1b604725 100644
--- a/genesyscloud/data_source_genesyscloud_architect_schedules.go
+++ b/genesyscloud/data_source_genesyscloud_architect_schedules.go
@@ -11,7 +11,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func DataSourceSchedule() *schema.Resource {
diff --git a/genesyscloud/data_source_genesyscloud_auth_division.go b/genesyscloud/data_source_genesyscloud_auth_division.go
index fe39a49bf..dbf0c9e84 100644
--- a/genesyscloud/data_source_genesyscloud_auth_division.go
+++ b/genesyscloud/data_source_genesyscloud_auth_division.go
@@ -11,7 +11,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func dataSourceAuthDivision() *schema.Resource {
diff --git a/genesyscloud/data_source_genesyscloud_auth_division_home.go b/genesyscloud/data_source_genesyscloud_auth_division_home.go
index f2b7371b0..bf12bec4b 100644
--- a/genesyscloud/data_source_genesyscloud_auth_division_home.go
+++ b/genesyscloud/data_source_genesyscloud_auth_division_home.go
@@ -11,7 +11,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func DataSourceAuthDivisionHome() *schema.Resource {
diff --git a/genesyscloud/data_source_genesyscloud_journey_action_map.go b/genesyscloud/data_source_genesyscloud_journey_action_map.go
index 0abfcc3b3..4f02d9b46 100644
--- a/genesyscloud/data_source_genesyscloud_journey_action_map.go
+++ b/genesyscloud/data_source_genesyscloud_journey_action_map.go
@@ -11,7 +11,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func dataSourceJourneyActionMap() *schema.Resource {
diff --git a/genesyscloud/data_source_genesyscloud_journey_action_template.go b/genesyscloud/data_source_genesyscloud_journey_action_template.go
index 06b7db592..32f4f93e8 100644
--- a/genesyscloud/data_source_genesyscloud_journey_action_template.go
+++ b/genesyscloud/data_source_genesyscloud_journey_action_template.go
@@ -11,7 +11,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func dataSourceJourneyActionTemplate() *schema.Resource {
diff --git a/genesyscloud/data_source_genesyscloud_journey_outcome.go b/genesyscloud/data_source_genesyscloud_journey_outcome.go
index 4b2cefa10..ec3473602 100644
--- a/genesyscloud/data_source_genesyscloud_journey_outcome.go
+++ b/genesyscloud/data_source_genesyscloud_journey_outcome.go
@@ -11,7 +11,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func dataSourceJourneyOutcome() *schema.Resource {
diff --git a/genesyscloud/data_source_genesyscloud_journey_segment.go b/genesyscloud/data_source_genesyscloud_journey_segment.go
index e6c304c84..d870635b8 100644
--- a/genesyscloud/data_source_genesyscloud_journey_segment.go
+++ b/genesyscloud/data_source_genesyscloud_journey_segment.go
@@ -11,7 +11,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func dataSourceJourneySegment() *schema.Resource {
diff --git a/genesyscloud/data_source_genesyscloud_knowledge_category.go b/genesyscloud/data_source_genesyscloud_knowledge_category.go
index 79411ff3f..27801fee5 100644
--- a/genesyscloud/data_source_genesyscloud_knowledge_category.go
+++ b/genesyscloud/data_source_genesyscloud_knowledge_category.go
@@ -11,7 +11,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func dataSourceKnowledgeCategory() *schema.Resource {
diff --git a/genesyscloud/data_source_genesyscloud_knowledge_knowledgebase.go b/genesyscloud/data_source_genesyscloud_knowledge_knowledgebase.go
index 3ae92509f..96f15c63c 100644
--- a/genesyscloud/data_source_genesyscloud_knowledge_knowledgebase.go
+++ b/genesyscloud/data_source_genesyscloud_knowledge_knowledgebase.go
@@ -12,7 +12,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func dataSourceKnowledgeKnowledgebase() *schema.Resource {
diff --git a/genesyscloud/data_source_genesyscloud_knowledge_label.go b/genesyscloud/data_source_genesyscloud_knowledge_label.go
index 97c2c4454..45312d9d4 100644
--- a/genesyscloud/data_source_genesyscloud_knowledge_label.go
+++ b/genesyscloud/data_source_genesyscloud_knowledge_label.go
@@ -11,7 +11,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func dataSourceKnowledgeLabel() *schema.Resource {
diff --git a/genesyscloud/data_source_genesyscloud_location.go b/genesyscloud/data_source_genesyscloud_location.go
index dd7380a73..2063e68b5 100644
--- a/genesyscloud/data_source_genesyscloud_location.go
+++ b/genesyscloud/data_source_genesyscloud_location.go
@@ -11,7 +11,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func DataSourceLocation() *schema.Resource {
diff --git a/genesyscloud/data_source_genesyscloud_organizations_me.go b/genesyscloud/data_source_genesyscloud_organizations_me.go
index cc75781be..fe8a15dbe 100644
--- a/genesyscloud/data_source_genesyscloud_organizations_me.go
+++ b/genesyscloud/data_source_genesyscloud_organizations_me.go
@@ -5,7 +5,7 @@ import (
"fmt"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"terraform-provider-genesyscloud/genesyscloud/provider"
"terraform-provider-genesyscloud/genesyscloud/util"
)
diff --git a/genesyscloud/data_source_genesyscloud_quality_forms_evaluation.go b/genesyscloud/data_source_genesyscloud_quality_forms_evaluation.go
index 15bdd25b7..a69e74b4a 100644
--- a/genesyscloud/data_source_genesyscloud_quality_forms_evaluation.go
+++ b/genesyscloud/data_source_genesyscloud_quality_forms_evaluation.go
@@ -11,7 +11,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
type EvaluationFormQuestionGroupStruct struct {
diff --git a/genesyscloud/data_source_genesyscloud_quality_forms_survey.go b/genesyscloud/data_source_genesyscloud_quality_forms_survey.go
index 9b684ed24..c3f3d84ae 100644
--- a/genesyscloud/data_source_genesyscloud_quality_forms_survey.go
+++ b/genesyscloud/data_source_genesyscloud_quality_forms_survey.go
@@ -11,7 +11,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func dataSourceQualityFormsSurvey() *schema.Resource {
diff --git a/genesyscloud/data_source_genesyscloud_routing_email_domain.go b/genesyscloud/data_source_genesyscloud_routing_email_domain.go
index 4ea36c8ed..2e9266932 100644
--- a/genesyscloud/data_source_genesyscloud_routing_email_domain.go
+++ b/genesyscloud/data_source_genesyscloud_routing_email_domain.go
@@ -11,7 +11,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
// Returns the schema for the routing email domain
diff --git a/genesyscloud/data_source_genesyscloud_routing_email_domain_test.go b/genesyscloud/data_source_genesyscloud_routing_email_domain_test.go
index d594bdbf1..f155f18b3 100644
--- a/genesyscloud/data_source_genesyscloud_routing_email_domain_test.go
+++ b/genesyscloud/data_source_genesyscloud_routing_email_domain_test.go
@@ -12,7 +12,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccDataSourceRoutingEmailDomain(t *testing.T) {
diff --git a/genesyscloud/data_source_genesyscloud_routing_language.go b/genesyscloud/data_source_genesyscloud_routing_language.go
index 7edc21646..eeebd35e8 100644
--- a/genesyscloud/data_source_genesyscloud_routing_language.go
+++ b/genesyscloud/data_source_genesyscloud_routing_language.go
@@ -11,7 +11,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func dataSourceRoutingLanguage() *schema.Resource {
diff --git a/genesyscloud/data_source_genesyscloud_routing_language_test.go b/genesyscloud/data_source_genesyscloud_routing_language_test.go
index 9d6eebb2a..018c1d2e9 100644
--- a/genesyscloud/data_source_genesyscloud_routing_language_test.go
+++ b/genesyscloud/data_source_genesyscloud_routing_language_test.go
@@ -21,6 +21,12 @@ func TestAccDataSourceRoutingLanguage(t *testing.T) {
PreCheck: func() { util.TestAccPreCheck(t) },
ProviderFactories: provider.GetProviderFactories(providerResources, providerDataSources),
Steps: []resource.TestStep{
+ {
+ Config: GenerateRoutingLanguageResource(
+ langResource,
+ langName,
+ ),
+ },
{
Config: GenerateRoutingLanguageResource(
langResource,
diff --git a/genesyscloud/data_source_genesyscloud_routing_settings.go b/genesyscloud/data_source_genesyscloud_routing_settings.go
deleted file mode 100644
index 31fe3528d..000000000
--- a/genesyscloud/data_source_genesyscloud_routing_settings.go
+++ /dev/null
@@ -1,45 +0,0 @@
-package genesyscloud
-
-import (
- "context"
- "fmt"
- "github.com/hashicorp/terraform-plugin-sdk/v2/diag"
- "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
- "terraform-provider-genesyscloud/genesyscloud/provider"
- "terraform-provider-genesyscloud/genesyscloud/util"
-)
-
-func dataSourceRoutingSettings() *schema.Resource {
- return &schema.Resource{
- Description: "An organization's routing settings",
- ReadContext: provider.ReadWithPooledClient(dataSourceRoutingSettingsRead),
- SchemaVersion: 1,
- Schema: ResourceRoutingSettings().Schema,
- }
-}
-
-func dataSourceRoutingSettingsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
- sdkConfig := m.(*provider.ProviderMeta).ClientConfig
- routingAPI := platformclientv2.NewRoutingApiWithConfig(sdkConfig)
-
- settings, resp, getErr := routingAPI.GetRoutingSettings()
- if getErr != nil {
- return util.BuildAPIDiagnosticError("genesyscloud_routing_settings", fmt.Sprintf("Error requesting routing settings error: %s", getErr), resp)
- }
-
- d.SetId("datasource-settings")
- if settings.ResetAgentScoreOnPresenceChange != nil {
- d.Set("reset_agent_on_presence_change", *settings.ResetAgentScoreOnPresenceChange)
- }
-
- if diagErr := readRoutingSettingsContactCenter(d, routingAPI); diagErr != nil {
- return util.BuildDiagnosticError("genesyscloud_routing_settings", fmt.Sprintf("Error reading routing settings contact center"), fmt.Errorf("%v", diagErr))
- }
-
- if diagErr := readRoutingSettingsTranscription(d, routingAPI); diagErr != nil {
- return util.BuildDiagnosticError("genesyscloud_routing_settings", fmt.Sprintf("Error reading routing settings transcription"), fmt.Errorf("%v", diagErr))
- }
-
- return nil
-}
diff --git a/genesyscloud/data_source_genesyscloud_routing_settings_test.go b/genesyscloud/data_source_genesyscloud_routing_settings_test.go
deleted file mode 100644
index 29aa90b82..000000000
--- a/genesyscloud/data_source_genesyscloud_routing_settings_test.go
+++ /dev/null
@@ -1,65 +0,0 @@
-package genesyscloud
-
-import (
- "fmt"
- "strings"
- "terraform-provider-genesyscloud/genesyscloud/provider"
- "terraform-provider-genesyscloud/genesyscloud/util"
- "testing"
-
- "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
-)
-
-func TestAccDataSourceRoutingSettings(t *testing.T) {
- var (
- settingsResource = "test-settings"
- settingsDataSource = "test-settings-data"
- transcription = "EnabledQueueFlow"
- confidence = "1"
- )
-
- resource.Test(t, resource.TestCase{
- PreCheck: func() { util.TestAccPreCheck(t) },
- ProviderFactories: provider.GetProviderFactories(providerResources, providerDataSources),
- Steps: []resource.TestStep{
- {
- // Search by contact center
- Config: generateRoutingSettingsWithCustomAttrs(
- settingsResource,
- util.TrueValue,
- generateSettingsContactCenter(util.FalseValue),
- generateSettingsTranscription(transcription, confidence, util.TrueValue, util.FalseValue),
- ) + generateRoutingSettingsDataSource(
- settingsDataSource,
- util.TrueValue,
- "genesyscloud_routing_settings."+settingsResource,
- generateSettingsContactCenter(util.FalseValue),
- generateSettingsTranscription(transcription, confidence, util.TrueValue, util.FalseValue),
- ),
- Check: resource.ComposeTestCheckFunc(
- resource.TestCheckResourceAttrPair("data.genesyscloud_routing_settings."+settingsDataSource, "reset_agent_on_presence", "genesyscloud_routing_settings."+settingsResource, "reset_agent_on_presence"),
- resource.TestCheckResourceAttrPair("data.genesyscloud_routing_settings."+settingsDataSource, "contactcenter.remove_skills_from_blind_transfer", "genesyscloud_routing_settings."+settingsResource, "contactcenter.remove_skills_from_blind_transfer"),
- resource.TestCheckResourceAttrPair("data.genesyscloud_routing_settings."+settingsDataSource, "transcription.0.transcription", "genesyscloud_routing_settings."+settingsResource, "transcription.0.transcription"),
- resource.TestCheckResourceAttrPair("data.genesyscloud_routing_settings."+settingsDataSource, "transcription.0.transcription_confidence_threshold", "genesyscloud_routing_settings."+settingsResource, "transcription.0.transcription_confidence_threshold"),
- resource.TestCheckResourceAttrPair("data.genesyscloud_routing_settings."+settingsDataSource, "transcription.0.low_latency_transcription_enabled", "genesyscloud_routing_settings."+settingsResource, "transcription.0.low_latency_transcription_enabled"),
- resource.TestCheckResourceAttrPair("data.genesyscloud_routing_settings."+settingsDataSource, "transcription.0.content_search_enabled", "genesyscloud_routing_settings."+settingsResource, "transcription.0.content_search_enabled"),
- ),
- },
- },
- })
-}
-
-func generateRoutingSettingsDataSource(
- resourceID string,
- resetAgentScoreOnPresenceChange string,
- // Must explicitly use depends_on in terraform v0.13 when a data source references a resource
- // Fixed in v0.14 https://github.com/hashicorp/terraform/pull/26284
- dependsOnResource string,
- attrs ...string) string {
- return fmt.Sprintf(`data "genesyscloud_routing_settings" "%s" {
- reset_agent_on_presence_change = %s
- %s
- depends_on=[%s]
- }
- `, resourceID, resetAgentScoreOnPresenceChange, strings.Join(attrs, "\n"), dependsOnResource)
-}
diff --git a/genesyscloud/data_source_genesyscloud_routing_skill.go b/genesyscloud/data_source_genesyscloud_routing_skill.go
index b211fde38..22bdf02dd 100644
--- a/genesyscloud/data_source_genesyscloud_routing_skill.go
+++ b/genesyscloud/data_source_genesyscloud_routing_skill.go
@@ -13,7 +13,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
// The context is now added without Timeout ,
diff --git a/genesyscloud/data_source_genesyscloud_routing_skill_group.go b/genesyscloud/data_source_genesyscloud_routing_skill_group.go
index 5399cba09..5bb30ae14 100644
--- a/genesyscloud/data_source_genesyscloud_routing_skill_group.go
+++ b/genesyscloud/data_source_genesyscloud_routing_skill_group.go
@@ -2,18 +2,14 @@ package genesyscloud
import (
"context"
- "encoding/json"
"fmt"
- "net/http"
+ "github.com/hashicorp/terraform-plugin-sdk/v2/diag"
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"terraform-provider-genesyscloud/genesyscloud/provider"
"terraform-provider-genesyscloud/genesyscloud/util"
"time"
-
- "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
-
- "github.com/hashicorp/terraform-plugin-sdk/v2/diag"
- "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
)
func dataSourceRoutingSkillGroup() *schema.Resource {
@@ -31,52 +27,74 @@ func dataSourceRoutingSkillGroup() *schema.Resource {
}
func dataSourceRoutingSkillGroupRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
+ var (
+ resp *platformclientv2.APIResponse
+ err error
+ )
sdkConfig := m.(*provider.ProviderMeta).ClientConfig
routingAPI := platformclientv2.NewRoutingApiWithConfig(sdkConfig)
-
name := d.Get("name").(string)
- // Find first non-deleted skill by name. Retry in case new skill is not yet indexed by search
- return util.WithRetries(ctx, 15*time.Second, func() *retry.RetryError {
- for pageNum := 1; ; pageNum++ {
- const pageSize = 100
+ retryErr := util.WithRetries(ctx, 15*time.Second, func() *retry.RetryError {
+ var skillGroups []platformclientv2.Skillgroupdefinition
+ skillGroups, resp, err = getAllSkillGroupsByName(routingAPI, name)
+ if err != nil {
+ return retry.NonRetryableError(err)
+ }
- apiClient := &routingAPI.Configuration.APIClient
- path := routingAPI.Configuration.BasePath + "/api/v2/routing/skillgroups"
+ for _, skillGroup := range skillGroups {
+ if name == *skillGroup.Name {
+ d.SetId(*skillGroup.Id)
+ return nil
+ }
+ }
- headerParams := buildHeaderParams(routingAPI)
- response, err := apiClient.CallAPI(path, "GET", nil, headerParams, nil, nil, "", nil)
+ return retry.RetryableError(fmt.Errorf("failed to find skill group with name '%s'", name))
+ })
- if err != nil {
- return retry.RetryableError(util.BuildWithRetriesApiDiagnosticError("genesyscloud_routing_skill_group", fmt.Sprintf("error encountered while trying to retrieve routing skills group found with name %s | error: %s", name, err), response))
- }
+ if retryErr != nil {
+ msg := fmt.Sprintf("failed to read skill group by name %s: %v", name, retryErr)
+ if resp != nil {
+ return util.BuildAPIDiagnosticError(getSkillGroupResourceName(), msg, resp)
+ }
+ return util.BuildDiagnosticError(getSkillGroupResourceName(), msg, fmt.Errorf("%v", retryErr))
+ }
- if err == nil && response.Error != nil {
- return retry.RetryableError(util.BuildWithRetriesApiDiagnosticError("genesyscloud_routing_skill_group", fmt.Sprintf("error encountered while trying to retrieve routing skills group found with name %s | error:%s", name, err), response))
- }
- if err == nil && response.StatusCode == http.StatusNotFound {
- return retry.RetryableError(util.BuildWithRetriesApiDiagnosticError("genesyscloud_routing_skill_group", fmt.Sprintf("routing skills group not found with name %s", name), response))
- }
+ return nil
+}
- allSkillGroups := &AllSkillGroups{}
+func getAllSkillGroupsByName(api *platformclientv2.RoutingApi, name string) ([]platformclientv2.Skillgroupdefinition, *platformclientv2.APIResponse, error) {
+ const pageSize = 100
+ var (
+ after string
+ allSkillGroups []platformclientv2.Skillgroupdefinition
+ )
+
+ for {
+ skillGroups, resp, err := api.GetRoutingSkillgroups(pageSize, name, after, "")
+ if err != nil {
+ return nil, resp, err
+ }
- err = json.Unmarshal(response.RawBody, &allSkillGroups)
- if err != nil {
- return retry.RetryableError(util.BuildWithRetriesApiDiagnosticError("genesyscloud_routing_skill_group", fmt.Sprintf("error encountered while trying to retrieve routing skills group found with name %s %s", name, err), response))
- }
+ if skillGroups.Entities == nil || len(*skillGroups.Entities) == 0 {
+ break
+ }
- if allSkillGroups.Entities == nil || len(allSkillGroups.Entities) == 0 {
- return retry.RetryableError(util.BuildWithRetriesApiDiagnosticError("genesyscloud_routing_skill_group", fmt.Sprintf("no routing skills groups found with name %s", name), response))
- }
+ allSkillGroups = append(allSkillGroups, *skillGroups.Entities...)
- for _, skillGroup := range allSkillGroups.Entities {
- if skillGroup.Name == name {
- d.SetId(skillGroup.ID)
- return nil
- }
- }
+ if skillGroups.NextUri == nil || *skillGroups.NextUri == "" {
+ break
}
- })
+ after, err = util.GetQueryParamValueFromUri(*skillGroups.NextUri, "after")
+ if err != nil {
+ return nil, nil, fmt.Errorf("error parsing NextUri '%s' while reading skill groups: %v", *skillGroups.NextUri, err)
+ }
+ if after == "" {
+ break
+ }
+ }
+
+ return allSkillGroups, nil, nil
}
diff --git a/genesyscloud/data_source_genesyscloud_routing_skill_group_test.go b/genesyscloud/data_source_genesyscloud_routing_skill_group_test.go
index a059ca33f..834da4175 100644
--- a/genesyscloud/data_source_genesyscloud_routing_skill_group_test.go
+++ b/genesyscloud/data_source_genesyscloud_routing_skill_group_test.go
@@ -47,9 +47,9 @@ func generateRoutingSkillGroupDataSource(
// Must explicitly use depends_on in terraform v0.13 when a data source references a resource
// Fixed in v0.14 https://github.com/hashicorp/terraform/pull/26284
dependsOnResource string) string {
- return fmt.Sprintf(`data "genesyscloud_routing_skill_group" "%s" {
+ return fmt.Sprintf(`data "%s" "%s" {
name = %s
depends_on=[%s]
}
- `, resourceID, name, dependsOnResource)
+ `, getSkillGroupResourceName(), resourceID, name, dependsOnResource)
}
diff --git a/genesyscloud/data_source_genesyscloud_routing_utilization_label.go b/genesyscloud/data_source_genesyscloud_routing_utilization_label.go
deleted file mode 100644
index 8c9581020..000000000
--- a/genesyscloud/data_source_genesyscloud_routing_utilization_label.go
+++ /dev/null
@@ -1,53 +0,0 @@
-package genesyscloud
-
-import (
- "context"
- "fmt"
- "terraform-provider-genesyscloud/genesyscloud/provider"
- "terraform-provider-genesyscloud/genesyscloud/util"
- "time"
-
- "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
- "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
-
- "github.com/hashicorp/terraform-plugin-sdk/v2/diag"
- "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
-)
-
-func dataSourceRoutingUtilizationLabel() *schema.Resource {
- return &schema.Resource{
- Description: "Data source for Genesys Cloud Routing Utilization Labels. Select a label by name.",
- ReadContext: provider.ReadWithPooledClient(dataSourceRoutingUtilizationLabelRead),
- Schema: map[string]*schema.Schema{
- "name": {
- Description: "Label name.",
- Type: schema.TypeString,
- ValidateFunc: validation.StringDoesNotContainAny("*"),
- Required: true,
- },
- },
- }
-}
-
-func dataSourceRoutingUtilizationLabelRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
- sdkConfig := m.(*provider.ProviderMeta).ClientConfig
- routingAPI := platformclientv2.NewRoutingApiWithConfig(sdkConfig)
-
- name := d.Get("name").(string)
-
- return util.WithRetries(ctx, 15*time.Second, func() *retry.RetryError {
- labels, resp, getErr := routingAPI.GetRoutingUtilizationLabels(1, 1, "", name)
- if getErr != nil {
- return retry.NonRetryableError(util.BuildWithRetriesApiDiagnosticError("genesyscloud_routing_utilization_label", fmt.Sprintf("Error requesting label %s | error: %s", name, getErr), resp))
- }
-
- if labels.Entities == nil || len(*labels.Entities) == 0 {
- return retry.RetryableError(util.BuildWithRetriesApiDiagnosticError("genesyscloud_routing_utilization_label", fmt.Sprintf("No labels found with name %s", name), resp))
- }
-
- label := (*labels.Entities)[0]
- d.SetId(*label.Id)
- return nil
- })
-}
diff --git a/genesyscloud/data_source_genesyscloud_routing_wrapupcode.go b/genesyscloud/data_source_genesyscloud_routing_wrapupcode.go
index 5596473d3..33d96f72b 100644
--- a/genesyscloud/data_source_genesyscloud_routing_wrapupcode.go
+++ b/genesyscloud/data_source_genesyscloud_routing_wrapupcode.go
@@ -11,7 +11,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func DataSourceRoutingWrapupcode() *schema.Resource {
diff --git a/genesyscloud/data_source_genesyscloud_user.go b/genesyscloud/data_source_genesyscloud_user.go
index b74a5b487..42ce5df10 100644
--- a/genesyscloud/data_source_genesyscloud_user.go
+++ b/genesyscloud/data_source_genesyscloud_user.go
@@ -14,7 +14,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func DataSourceUser() *schema.Resource {
diff --git a/genesyscloud/data_source_genesyscloud_widget_deployment.go b/genesyscloud/data_source_genesyscloud_widget_deployment.go
index 89892889f..31b04b4de 100644
--- a/genesyscloud/data_source_genesyscloud_widget_deployment.go
+++ b/genesyscloud/data_source_genesyscloud_widget_deployment.go
@@ -11,7 +11,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func dataSourceWidgetDeployments() *schema.Resource {
diff --git a/genesyscloud/data_source_genesyscloud_widget_deployment_test.go b/genesyscloud/data_source_genesyscloud_widget_deployment_test.go
index 4d9b77b2d..ce1ce1b6d 100644
--- a/genesyscloud/data_source_genesyscloud_widget_deployment_test.go
+++ b/genesyscloud/data_source_genesyscloud_widget_deployment_test.go
@@ -2,6 +2,7 @@ package genesyscloud
import (
"fmt"
+ "strconv"
"terraform-provider-genesyscloud/genesyscloud/provider"
"terraform-provider-genesyscloud/genesyscloud/util"
"testing"
@@ -16,23 +17,18 @@ func TestAccDataSourceWidgetDeployment(t *testing.T) {
widgetDeploymentsDataSource = "widget-deployments-data"
widgetDeploymentsName = "Widget_deployments-"
)
-
+ description := "This is a test description"
+ flowId := uuid.NewString()
widgetDeployV1 := &widgetDeploymentConfig{
resourceID: widgegetDeploymentsResource,
- name: widgetDeploymentsName + uuid.NewString(),
- description: "This is a test description",
- flowID: uuid.NewString(),
- clientType: "v1",
+ name: widgetDeploymentsName,
+ description: strconv.Quote(description),
+ flowID: strconv.Quote(flowId),
+ clientType: V2,
authenticationRequired: "true",
disabled: "true",
- webChatSkin: "basic",
- authenticationUrl: "https://localhost",
}
- _, err := provider.AuthorizeSdk()
- if err != nil {
- t.Fatal(err)
- }
deleteWidgetDeploymentWithName(widgetDeploymentsName)
resource.Test(t, resource.TestCase{
@@ -40,7 +36,7 @@ func TestAccDataSourceWidgetDeployment(t *testing.T) {
ProviderFactories: provider.GetProviderFactories(providerResources, providerDataSources),
Steps: []resource.TestStep{
{
- Config: generateWidgetDeployV1(widgetDeployV1) + generateWidgetDeploymentDataSource(widgetDeploymentsDataSource, "genesyscloud_widget_deployment."+widgegetDeploymentsResource+".name", "genesyscloud_widget_deployment."+widgegetDeploymentsResource),
+ Config: generateWidgetDeploymentResource(widgetDeployV1) + generateWidgetDeploymentDataSource(widgetDeploymentsDataSource, "genesyscloud_widget_deployment."+widgegetDeploymentsResource+".name", "genesyscloud_widget_deployment."+widgegetDeploymentsResource),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrPair("data.genesyscloud_widget_deployment."+widgetDeploymentsDataSource, "id", "genesyscloud_widget_deployment."+widgegetDeploymentsResource, "id"),
),
diff --git a/genesyscloud/dependent_consumers/genesyscloud_dependent_consumer_proxy.go b/genesyscloud/dependent_consumers/genesyscloud_dependent_consumer_proxy.go
index 4c4311112..1b806376d 100644
--- a/genesyscloud/dependent_consumers/genesyscloud_dependent_consumer_proxy.go
+++ b/genesyscloud/dependent_consumers/genesyscloud_dependent_consumer_proxy.go
@@ -5,7 +5,7 @@ import (
"fmt"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"log"
"strings"
"terraform-provider-genesyscloud/genesyscloud/provider"
diff --git a/genesyscloud/employeeperformance_externalmetrics_definitions/genesyscloud_employeeperformance_externalmetrics_definitions_proxy.go b/genesyscloud/employeeperformance_externalmetrics_definitions/genesyscloud_employeeperformance_externalmetrics_definitions_proxy.go
index b252235c5..4f123630e 100644
--- a/genesyscloud/employeeperformance_externalmetrics_definitions/genesyscloud_employeeperformance_externalmetrics_definitions_proxy.go
+++ b/genesyscloud/employeeperformance_externalmetrics_definitions/genesyscloud_employeeperformance_externalmetrics_definitions_proxy.go
@@ -3,7 +3,7 @@ package employeeperformance_externalmetrics_definitions
import (
"context"
"fmt"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"log"
)
diff --git a/genesyscloud/employeeperformance_externalmetrics_definitions/resource_genesyscloud_employeeperformance_externalmetrics_definitions.go b/genesyscloud/employeeperformance_externalmetrics_definitions/resource_genesyscloud_employeeperformance_externalmetrics_definitions.go
index 3b443b79d..f8ff2b8c8 100644
--- a/genesyscloud/employeeperformance_externalmetrics_definitions/resource_genesyscloud_employeeperformance_externalmetrics_definitions.go
+++ b/genesyscloud/employeeperformance_externalmetrics_definitions/resource_genesyscloud_employeeperformance_externalmetrics_definitions.go
@@ -5,7 +5,7 @@ import (
"fmt"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"log"
"terraform-provider-genesyscloud/genesyscloud/consistency_checker"
"terraform-provider-genesyscloud/genesyscloud/provider"
diff --git a/genesyscloud/employeeperformance_externalmetrics_definitions/resource_genesyscloud_employeeperformance_externalmetrics_definitions_test.go b/genesyscloud/employeeperformance_externalmetrics_definitions/resource_genesyscloud_employeeperformance_externalmetrics_definitions_test.go
index a543c81f1..105eb00e5 100644
--- a/genesyscloud/employeeperformance_externalmetrics_definitions/resource_genesyscloud_employeeperformance_externalmetrics_definitions_test.go
+++ b/genesyscloud/employeeperformance_externalmetrics_definitions/resource_genesyscloud_employeeperformance_externalmetrics_definitions_test.go
@@ -10,7 +10,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceEmployeePerformanceExternalMetricsDefintions(t *testing.T) {
diff --git a/genesyscloud/external_contacts/genesyscloud_externalcontacts_contact_init_test.go b/genesyscloud/external_contacts/genesyscloud_externalcontacts_contact_init_test.go
index 36de1b179..1e1c09f66 100644
--- a/genesyscloud/external_contacts/genesyscloud_externalcontacts_contact_init_test.go
+++ b/genesyscloud/external_contacts/genesyscloud_externalcontacts_contact_init_test.go
@@ -39,7 +39,6 @@ func (r *registerTestInstance) registerTestDataSources() {
defer r.datasourceMapMutex.Unlock()
providerDataSources["genesyscloud_externalcontacts_contact"] = DataSourceExternalContactsContact()
-
}
// initTestResources initializes all test resources and data sources.
diff --git a/genesyscloud/external_contacts/genesyscloud_externalcontacts_contact_proxy.go b/genesyscloud/external_contacts/genesyscloud_externalcontacts_contact_proxy.go
index 44b582603..f624411ce 100644
--- a/genesyscloud/external_contacts/genesyscloud_externalcontacts_contact_proxy.go
+++ b/genesyscloud/external_contacts/genesyscloud_externalcontacts_contact_proxy.go
@@ -5,7 +5,9 @@ import (
"fmt"
"log"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ rc "terraform-provider-genesyscloud/genesyscloud/resource_cache"
+
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
@@ -50,14 +52,17 @@ type externalContactsContactsProxy struct {
getExternalContactByIdAttr getExternalContactByIdFunc
getExternalContactIdBySearchAttr getExternalContactIdBySearchFunc
updateExternalContactAttr updateExternalContactFunc
+ externalContactsCache rc.CacheInterface[platformclientv2.Externalcontact]
}
// newExternalContactsContactsProxy initializes the External Contacts proxy with all of the data needed to communicate with Genesys Cloud
func newExternalContactsContactsProxy(clientConfig *platformclientv2.Configuration) *externalContactsContactsProxy {
api := platformclientv2.NewExternalContactsApiWithConfig(clientConfig)
+ externalContactsCache := rc.NewResourceCache[platformclientv2.Externalcontact]()
return &externalContactsContactsProxy{
clientConfig: clientConfig,
externalContactsApi: api,
+ externalContactsCache: externalContactsCache,
getAllExternalContactsAttr: getAllExternalContactsFn,
createExternalContactAttr: createExternalContactFn,
getExternalContactByIdAttr: getExternalContactByIdFn,
@@ -93,6 +98,9 @@ func (p *externalContactsContactsProxy) deleteExternalContactId(ctx context.Cont
// getExternalContactById returns a single Genesys Cloud External Contact by Id
func (p *externalContactsContactsProxy) getExternalContactById(ctx context.Context, externalContactId string) (*platformclientv2.Externalcontact, *platformclientv2.APIResponse, error) {
+ if externalContacts := rc.GetCacheItem(p.externalContactsCache, externalContactId); externalContacts != nil { // Get the Externalcontact from the cache, if not there in the cache then call p.getExternalContactByIdAttr()
+ return externalContacts, nil, nil
+ }
return p.getExternalContactByIdAttr(ctx, p, externalContactId)
}
@@ -130,6 +138,12 @@ func getAllExternalContactsFn(ctx context.Context, p *externalContactsContactsPr
}
cursor = *externalContacts.Cursors.After
}
+
+ // Cache the External Contacts resource into the p.externalContactsCache for later use
+ for _, externalContact := range allExternalContacts {
+ rc.SetCache(p.externalContactsCache, *externalContact.Id, externalContact)
+ }
+
return &allExternalContacts, response, nil
}
diff --git a/genesyscloud/external_contacts/resource_genesyscloud_externalcontacts_contact.go b/genesyscloud/external_contacts/resource_genesyscloud_externalcontacts_contact.go
index bdc3722ae..98565b2ea 100644
--- a/genesyscloud/external_contacts/resource_genesyscloud_externalcontacts_contact.go
+++ b/genesyscloud/external_contacts/resource_genesyscloud_externalcontacts_contact.go
@@ -18,7 +18,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/external_contacts/resource_genesyscloud_externalcontacts_contact_schema.go b/genesyscloud/external_contacts/resource_genesyscloud_externalcontacts_contact_schema.go
index 6e56d6f0e..2b9ff630b 100644
--- a/genesyscloud/external_contacts/resource_genesyscloud_externalcontacts_contact_schema.go
+++ b/genesyscloud/external_contacts/resource_genesyscloud_externalcontacts_contact_schema.go
@@ -5,7 +5,7 @@ import (
"terraform-provider-genesyscloud/genesyscloud/provider"
resourceExporter "terraform-provider-genesyscloud/genesyscloud/resource_exporter"
registrar "terraform-provider-genesyscloud/genesyscloud/resource_register"
- gcloud "terraform-provider-genesyscloud/genesyscloud/validators"
+ "terraform-provider-genesyscloud/genesyscloud/validators"
)
/*
@@ -53,7 +53,7 @@ func ResourceExternalContact() *schema.Resource {
Type: schema.TypeString,
Optional: true,
Computed: true,
- ValidateDiagFunc: gcloud.ValidatePhoneNumber,
+ ValidateDiagFunc: validators.ValidatePhoneNumber,
},
"country_code": {
Description: "Phone number country code.",
@@ -95,7 +95,7 @@ func ResourceExternalContact() *schema.Resource {
Description: "Contact address country code.",
Type: schema.TypeString,
Optional: true,
- ValidateDiagFunc: gcloud.ValidateCountryCode,
+ ValidateDiagFunc: validators.ValidateCountryCode,
},
},
}
diff --git a/genesyscloud/external_contacts/resource_genesyscloud_externalcontacts_contact_test.go b/genesyscloud/external_contacts/resource_genesyscloud_externalcontacts_contact_test.go
index e299b2146..bf6c6c2b0 100644
--- a/genesyscloud/external_contacts/resource_genesyscloud_externalcontacts_contact_test.go
+++ b/genesyscloud/external_contacts/resource_genesyscloud_externalcontacts_contact_test.go
@@ -8,7 +8,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/external_contacts/resource_genesyscloud_externalcontacts_contact_utils.go b/genesyscloud/external_contacts/resource_genesyscloud_externalcontacts_contact_utils.go
index b6b864bb4..d7b3df901 100644
--- a/genesyscloud/external_contacts/resource_genesyscloud_externalcontacts_contact_utils.go
+++ b/genesyscloud/external_contacts/resource_genesyscloud_externalcontacts_contact_utils.go
@@ -5,7 +5,7 @@ import (
"terraform-provider-genesyscloud/genesyscloud/util/resourcedata"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"github.com/nyaruka/phonenumbers"
)
diff --git a/genesyscloud/flow_loglevel/genesyscloud_flow_loglevel_proxy.go b/genesyscloud/flow_loglevel/genesyscloud_flow_loglevel_proxy.go
index abcef0774..34437c34a 100644
--- a/genesyscloud/flow_loglevel/genesyscloud_flow_loglevel_proxy.go
+++ b/genesyscloud/flow_loglevel/genesyscloud_flow_loglevel_proxy.go
@@ -3,7 +3,7 @@ package flow_loglevel
import (
"context"
"fmt"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/flow_loglevel/resource_genesyscloud_flow_loglevel.go b/genesyscloud/flow_loglevel/resource_genesyscloud_flow_loglevel.go
index f993f67b5..0100e60ae 100644
--- a/genesyscloud/flow_loglevel/resource_genesyscloud_flow_loglevel.go
+++ b/genesyscloud/flow_loglevel/resource_genesyscloud_flow_loglevel.go
@@ -18,7 +18,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/flow_loglevel/resource_genesyscloud_flow_loglevel_test.go b/genesyscloud/flow_loglevel/resource_genesyscloud_flow_loglevel_test.go
index bddec6ed3..acbf5cd6f 100644
--- a/genesyscloud/flow_loglevel/resource_genesyscloud_flow_loglevel_test.go
+++ b/genesyscloud/flow_loglevel/resource_genesyscloud_flow_loglevel_test.go
@@ -5,7 +5,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"terraform-provider-genesyscloud/genesyscloud/architect_flow"
"terraform-provider-genesyscloud/genesyscloud/provider"
"terraform-provider-genesyscloud/genesyscloud/util"
diff --git a/genesyscloud/flow_milestone/genesyscloud_flow_milestone_proxy.go b/genesyscloud/flow_milestone/genesyscloud_flow_milestone_proxy.go
index 104daebed..932a45cc7 100644
--- a/genesyscloud/flow_milestone/genesyscloud_flow_milestone_proxy.go
+++ b/genesyscloud/flow_milestone/genesyscloud_flow_milestone_proxy.go
@@ -5,7 +5,7 @@ import (
"fmt"
"log"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/flow_milestone/resource_genesyscloud_flow_milestone.go b/genesyscloud/flow_milestone/resource_genesyscloud_flow_milestone.go
index fed202ea8..b83780b75 100644
--- a/genesyscloud/flow_milestone/resource_genesyscloud_flow_milestone.go
+++ b/genesyscloud/flow_milestone/resource_genesyscloud_flow_milestone.go
@@ -12,7 +12,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"terraform-provider-genesyscloud/genesyscloud/consistency_checker"
diff --git a/genesyscloud/flow_milestone/resource_genesyscloud_flow_milestone_test.go b/genesyscloud/flow_milestone/resource_genesyscloud_flow_milestone_test.go
index 3d7da7915..2f26afbd0 100644
--- a/genesyscloud/flow_milestone/resource_genesyscloud_flow_milestone_test.go
+++ b/genesyscloud/flow_milestone/resource_genesyscloud_flow_milestone_test.go
@@ -10,7 +10,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceFlowMilestone(t *testing.T) {
diff --git a/genesyscloud/flow_milestone/resource_genesyscloud_flow_milestone_utils.go b/genesyscloud/flow_milestone/resource_genesyscloud_flow_milestone_utils.go
index 838a056c6..46b801e53 100644
--- a/genesyscloud/flow_milestone/resource_genesyscloud_flow_milestone_utils.go
+++ b/genesyscloud/flow_milestone/resource_genesyscloud_flow_milestone_utils.go
@@ -2,7 +2,7 @@ package flow_milestone
import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/flow_outcome/genesyscloud_flow_outcome_proxy.go b/genesyscloud/flow_outcome/genesyscloud_flow_outcome_proxy.go
index 6bbe109d7..4aa3507bc 100644
--- a/genesyscloud/flow_outcome/genesyscloud_flow_outcome_proxy.go
+++ b/genesyscloud/flow_outcome/genesyscloud_flow_outcome_proxy.go
@@ -5,7 +5,7 @@ import (
"fmt"
"log"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/flow_outcome/resource_genesyscloud_flow_outcome.go b/genesyscloud/flow_outcome/resource_genesyscloud_flow_outcome.go
index 4fbb0dc8a..b36bf8781 100644
--- a/genesyscloud/flow_outcome/resource_genesyscloud_flow_outcome.go
+++ b/genesyscloud/flow_outcome/resource_genesyscloud_flow_outcome.go
@@ -11,7 +11,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"terraform-provider-genesyscloud/genesyscloud/consistency_checker"
diff --git a/genesyscloud/flow_outcome/resource_genesyscloud_flow_outcome_utils.go b/genesyscloud/flow_outcome/resource_genesyscloud_flow_outcome_utils.go
index eb0cc2e39..efde6651e 100644
--- a/genesyscloud/flow_outcome/resource_genesyscloud_flow_outcome_utils.go
+++ b/genesyscloud/flow_outcome/resource_genesyscloud_flow_outcome_utils.go
@@ -2,7 +2,7 @@ package flow_outcome
import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/group/data_source_genesyscloud_group_test.go b/genesyscloud/group/data_source_genesyscloud_group_test.go
index f6bbb0f6b..f69c4f037 100644
--- a/genesyscloud/group/data_source_genesyscloud_group_test.go
+++ b/genesyscloud/group/data_source_genesyscloud_group_test.go
@@ -10,7 +10,7 @@ import (
"time"
"github.com/google/uuid"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
diff --git a/genesyscloud/group/genesyscloud_group_proxy.go b/genesyscloud/group/genesyscloud_group_proxy.go
index 951d367b7..956ba6d43 100644
--- a/genesyscloud/group/genesyscloud_group_proxy.go
+++ b/genesyscloud/group/genesyscloud_group_proxy.go
@@ -3,7 +3,7 @@ package group
import (
"context"
"fmt"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
rc "terraform-provider-genesyscloud/genesyscloud/resource_cache"
)
diff --git a/genesyscloud/group/resource_genesyscloud_group.go b/genesyscloud/group/resource_genesyscloud_group.go
index 4792060d1..60faa5abc 100644
--- a/genesyscloud/group/resource_genesyscloud_group.go
+++ b/genesyscloud/group/resource_genesyscloud_group.go
@@ -21,7 +21,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func GetAllGroups(ctx context.Context, clientConfig *platformclientv2.Configuration) (resourceExporter.ResourceIDMetaMap, diag.Diagnostics) {
diff --git a/genesyscloud/group/resource_genesyscloud_group_test.go b/genesyscloud/group/resource_genesyscloud_group_test.go
index 930dc3d9a..f9658b391 100644
--- a/genesyscloud/group/resource_genesyscloud_group_test.go
+++ b/genesyscloud/group/resource_genesyscloud_group_test.go
@@ -13,7 +13,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceGroupBasic(t *testing.T) {
diff --git a/genesyscloud/group/resource_genesyscloud_group_utils.go b/genesyscloud/group/resource_genesyscloud_group_utils.go
index 4bf5d2ebe..b7b5652fe 100644
--- a/genesyscloud/group/resource_genesyscloud_group_utils.go
+++ b/genesyscloud/group/resource_genesyscloud_group_utils.go
@@ -3,7 +3,7 @@ package group
import (
"fmt"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"log"
"strings"
"terraform-provider-genesyscloud/genesyscloud/util"
diff --git a/genesyscloud/group_roles/genesyscloud_group_roles_proxy.go b/genesyscloud/group_roles/genesyscloud_group_roles_proxy.go
index 0cb0c84b7..87cb8703e 100644
--- a/genesyscloud/group_roles/genesyscloud_group_roles_proxy.go
+++ b/genesyscloud/group_roles/genesyscloud_group_roles_proxy.go
@@ -7,7 +7,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
var internalProxy *groupRolesProxy
diff --git a/genesyscloud/group_roles/resource_genesyscloud_group_roles_schema.go b/genesyscloud/group_roles/resource_genesyscloud_group_roles_schema.go
index c8138ae07..7adf536f1 100644
--- a/genesyscloud/group_roles/resource_genesyscloud_group_roles_schema.go
+++ b/genesyscloud/group_roles/resource_genesyscloud_group_roles_schema.go
@@ -7,7 +7,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"terraform-provider-genesyscloud/genesyscloud/provider"
resourceExporter "terraform-provider-genesyscloud/genesyscloud/resource_exporter"
diff --git a/genesyscloud/group_roles/resource_genesyscloud_group_roles_utils.go b/genesyscloud/group_roles/resource_genesyscloud_group_roles_utils.go
index 71d165e5e..d1ecb34c9 100644
--- a/genesyscloud/group_roles/resource_genesyscloud_group_roles_utils.go
+++ b/genesyscloud/group_roles/resource_genesyscloud_group_roles_utils.go
@@ -7,7 +7,7 @@ import (
"terraform-provider-genesyscloud/genesyscloud/util/lists"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func flattenSubjectRoles(d *schema.ResourceData, p *groupRolesProxy) (*schema.Set, *platformclientv2.APIResponse, error) {
diff --git a/genesyscloud/idp_adfs/genesyscloud_idp_adfs_proxy.go b/genesyscloud/idp_adfs/genesyscloud_idp_adfs_proxy.go
index 23910c006..a1825f1c1 100644
--- a/genesyscloud/idp_adfs/genesyscloud_idp_adfs_proxy.go
+++ b/genesyscloud/idp_adfs/genesyscloud_idp_adfs_proxy.go
@@ -3,7 +3,7 @@ package idp_adfs
import (
"context"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/idp_adfs/resource_genesyscloud_idp_adfs.go b/genesyscloud/idp_adfs/resource_genesyscloud_idp_adfs.go
index 1367be58b..cde86dead 100644
--- a/genesyscloud/idp_adfs/resource_genesyscloud_idp_adfs.go
+++ b/genesyscloud/idp_adfs/resource_genesyscloud_idp_adfs.go
@@ -11,7 +11,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"terraform-provider-genesyscloud/genesyscloud/consistency_checker"
diff --git a/genesyscloud/idp_adfs/resource_genesyscloud_idp_adfs_test.go b/genesyscloud/idp_adfs/resource_genesyscloud_idp_adfs_test.go
index 5b8cc3391..ef089ab46 100644
--- a/genesyscloud/idp_adfs/resource_genesyscloud_idp_adfs_test.go
+++ b/genesyscloud/idp_adfs/resource_genesyscloud_idp_adfs_test.go
@@ -9,7 +9,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceIdpAdfs(t *testing.T) {
diff --git a/genesyscloud/idp_okta/genesyscloud_idp_okta_proxy.go b/genesyscloud/idp_okta/genesyscloud_idp_okta_proxy.go
index d40d622d0..1af69517d 100644
--- a/genesyscloud/idp_okta/genesyscloud_idp_okta_proxy.go
+++ b/genesyscloud/idp_okta/genesyscloud_idp_okta_proxy.go
@@ -4,7 +4,7 @@ import (
"context"
"fmt"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/idp_okta/resource_genesyscloud_idp_okta.go b/genesyscloud/idp_okta/resource_genesyscloud_idp_okta.go
index 2925dbc85..7f0de2a14 100644
--- a/genesyscloud/idp_okta/resource_genesyscloud_idp_okta.go
+++ b/genesyscloud/idp_okta/resource_genesyscloud_idp_okta.go
@@ -13,7 +13,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"terraform-provider-genesyscloud/genesyscloud/util/constants"
"terraform-provider-genesyscloud/genesyscloud/util/lists"
diff --git a/genesyscloud/idp_okta/resource_genesyscloud_idp_okta_test.go b/genesyscloud/idp_okta/resource_genesyscloud_idp_okta_test.go
index 547eee8b3..3b2e770aa 100644
--- a/genesyscloud/idp_okta/resource_genesyscloud_idp_okta_test.go
+++ b/genesyscloud/idp_okta/resource_genesyscloud_idp_okta_test.go
@@ -9,7 +9,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceIdpOkta(t *testing.T) {
diff --git a/genesyscloud/idp_salesforce/genesyscloud_idp_salesforce_proxy.go b/genesyscloud/idp_salesforce/genesyscloud_idp_salesforce_proxy.go
index 3af3972b0..0610597c8 100644
--- a/genesyscloud/idp_salesforce/genesyscloud_idp_salesforce_proxy.go
+++ b/genesyscloud/idp_salesforce/genesyscloud_idp_salesforce_proxy.go
@@ -2,7 +2,7 @@ package idp_salesforce
import (
"context"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/idp_salesforce/resource_genesyscloud_idp_salesforce.go b/genesyscloud/idp_salesforce/resource_genesyscloud_idp_salesforce.go
index f8ba2f919..eadc684c1 100644
--- a/genesyscloud/idp_salesforce/resource_genesyscloud_idp_salesforce.go
+++ b/genesyscloud/idp_salesforce/resource_genesyscloud_idp_salesforce.go
@@ -6,7 +6,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"log"
"terraform-provider-genesyscloud/genesyscloud/consistency_checker"
"terraform-provider-genesyscloud/genesyscloud/provider"
diff --git a/genesyscloud/idp_salesforce/resource_genesyscloud_idp_salesforce_test.go b/genesyscloud/idp_salesforce/resource_genesyscloud_idp_salesforce_test.go
index 431890348..d891e5601 100644
--- a/genesyscloud/idp_salesforce/resource_genesyscloud_idp_salesforce_test.go
+++ b/genesyscloud/idp_salesforce/resource_genesyscloud_idp_salesforce_test.go
@@ -9,7 +9,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceIdpSalesforce(t *testing.T) {
diff --git a/genesyscloud/integration/genesyscloud_integration_proxy.go b/genesyscloud/integration/genesyscloud_integration_proxy.go
index 571526332..5f40e21a4 100644
--- a/genesyscloud/integration/genesyscloud_integration_proxy.go
+++ b/genesyscloud/integration/genesyscloud_integration_proxy.go
@@ -4,7 +4,7 @@ import (
"context"
"fmt"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/integration/resource_genesyscloud_integration.go b/genesyscloud/integration/resource_genesyscloud_integration.go
index cfcf214fb..d164f75a6 100644
--- a/genesyscloud/integration/resource_genesyscloud_integration.go
+++ b/genesyscloud/integration/resource_genesyscloud_integration.go
@@ -16,7 +16,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/integration/resource_genesyscloud_integration_test.go b/genesyscloud/integration/resource_genesyscloud_integration_test.go
index b0474efb2..4f0476236 100644
--- a/genesyscloud/integration/resource_genesyscloud_integration_test.go
+++ b/genesyscloud/integration/resource_genesyscloud_integration_test.go
@@ -14,7 +14,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
@@ -266,7 +266,9 @@ func TestAccResourceIntegration(t *testing.T) {
strconv.Quote(credName1),
strconv.Quote(credTypeName1),
integrationCred.GenerateCredentialFields(
- util.GenerateMapProperty(key1, strconv.Quote(val1)),
+ map[string]string{
+ key1: strconv.Quote(val1),
+ },
),
) + GenerateIntegrationResource(
inteResource2,
@@ -297,7 +299,9 @@ func TestAccResourceIntegration(t *testing.T) {
strconv.Quote(credName1),
strconv.Quote(credTypeName1),
integrationCred.GenerateCredentialFields(
- util.GenerateMapProperty(key1, strconv.Quote(val1)),
+ map[string]string{
+ key1: strconv.Quote(val1),
+ },
),
) + GenerateIntegrationResource(
inteResource2,
diff --git a/genesyscloud/integration/resource_genesyscloud_integration_utils.go b/genesyscloud/integration/resource_genesyscloud_integration_utils.go
index 5fbe82c6e..b28c17d00 100644
--- a/genesyscloud/integration/resource_genesyscloud_integration_utils.go
+++ b/genesyscloud/integration/resource_genesyscloud_integration_utils.go
@@ -10,7 +10,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/integration_action/genesyscloud_integration_action_proxy.go b/genesyscloud/integration_action/genesyscloud_integration_action_proxy.go
index 1b963ef3e..bc7f7591a 100644
--- a/genesyscloud/integration_action/genesyscloud_integration_action_proxy.go
+++ b/genesyscloud/integration_action/genesyscloud_integration_action_proxy.go
@@ -4,7 +4,7 @@ import (
"context"
"encoding/json"
"errors"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"net/http"
)
diff --git a/genesyscloud/integration_action/resource_genesyscloud_integration_action.go b/genesyscloud/integration_action/resource_genesyscloud_integration_action.go
index b0da5cf21..b2d9139c9 100644
--- a/genesyscloud/integration_action/resource_genesyscloud_integration_action.go
+++ b/genesyscloud/integration_action/resource_genesyscloud_integration_action.go
@@ -19,7 +19,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/integration_action/resource_genesyscloud_integration_action_test.go b/genesyscloud/integration_action/resource_genesyscloud_integration_action_test.go
index d3d588764..24fe588ff 100644
--- a/genesyscloud/integration_action/resource_genesyscloud_integration_action_test.go
+++ b/genesyscloud/integration_action/resource_genesyscloud_integration_action_test.go
@@ -13,7 +13,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
@@ -114,20 +114,26 @@ func TestAccResourceIntegrationAction(t *testing.T) {
reqUrlTemplate2,
reqType2,
strconv.Quote(reqTemp),
- util.GenerateMapAttr(
+ util.GenerateMapAttrWithMapProperties(
"headers",
- util.GenerateMapProperty(headerKey, strconv.Quote(headerVal1)),
+ map[string]string{
+ headerKey: strconv.Quote(headerVal1),
+ },
),
),
generateIntegrationActionConfigResponse(
strconv.Quote(successTemplate),
- util.GenerateMapAttr(
+ util.GenerateMapAttrWithMapProperties(
"translation_map",
- util.GenerateMapProperty(transMapAttr, strconv.Quote(transMapVal1)),
+ map[string]string{
+ transMapAttr: strconv.Quote(transMapVal1),
+ },
),
- util.GenerateMapAttr(
+ util.GenerateMapAttrWithMapProperties(
"translation_map_defaults",
- util.GenerateMapProperty(transMapAttr, strconv.Quote(transMapValDefault1)),
+ map[string]string{
+ transMapAttr: strconv.Quote(transMapValDefault1),
+ },
),
),
),
@@ -165,20 +171,26 @@ func TestAccResourceIntegrationAction(t *testing.T) {
reqUrlTemplate2,
reqType2,
strconv.Quote(reqTemp),
- util.GenerateMapAttr(
+ util.GenerateMapAttrWithMapProperties(
"headers",
- util.GenerateMapProperty(headerKey, strconv.Quote(headerVal2)),
+ map[string]string{
+ headerKey: strconv.Quote(headerVal2),
+ },
),
),
generateIntegrationActionConfigResponse(
strconv.Quote(successTemplate),
- util.GenerateMapAttr(
+ util.GenerateMapAttrWithMapProperties(
"translation_map",
- util.GenerateMapProperty(transMapAttr, strconv.Quote(transMapVal2)),
+ map[string]string{
+ transMapAttr: strconv.Quote(transMapVal2),
+ },
),
- util.GenerateMapAttr(
+ util.GenerateMapAttrWithMapProperties(
"translation_map_defaults",
- util.GenerateMapProperty(transMapAttr, strconv.Quote(transMapValDefault2)),
+ map[string]string{
+ transMapAttr: strconv.Quote(transMapValDefault2),
+ },
),
),
),
diff --git a/genesyscloud/integration_action/resource_genesyscloud_integration_action_utils.go b/genesyscloud/integration_action/resource_genesyscloud_integration_action_utils.go
index 23120db0c..f74621600 100644
--- a/genesyscloud/integration_action/resource_genesyscloud_integration_action_utils.go
+++ b/genesyscloud/integration_action/resource_genesyscloud_integration_action_utils.go
@@ -7,7 +7,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"terraform-provider-genesyscloud/genesyscloud/util/resourcedata"
)
diff --git a/genesyscloud/integration_credential/data_source_genesyscloud_integration_credential_test.go b/genesyscloud/integration_credential/data_source_genesyscloud_integration_credential_test.go
index 4bf17ec65..a96945459 100644
--- a/genesyscloud/integration_credential/data_source_genesyscloud_integration_credential_test.go
+++ b/genesyscloud/integration_credential/data_source_genesyscloud_integration_credential_test.go
@@ -35,7 +35,9 @@ func TestAccDataSourceIntegrationCredential(t *testing.T) {
strconv.Quote(credName1),
strconv.Quote(typeName1),
GenerateCredentialFields(
- util.GenerateMapProperty(key1, strconv.Quote(val1)),
+ map[string]string{
+ key1: strconv.Quote(val1),
+ },
),
) + generateIntegrationCredentialDataSource(credResource2,
credName1,
diff --git a/genesyscloud/integration_credential/genesyscloud_integration_credential_proxy.go b/genesyscloud/integration_credential/genesyscloud_integration_credential_proxy.go
index dd1c2336b..31f0da8df 100644
--- a/genesyscloud/integration_credential/genesyscloud_integration_credential_proxy.go
+++ b/genesyscloud/integration_credential/genesyscloud_integration_credential_proxy.go
@@ -4,7 +4,7 @@ import (
"context"
"fmt"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/integration_credential/resource_genesyscloud_integration_credential.go b/genesyscloud/integration_credential/resource_genesyscloud_integration_credential.go
index d995c6766..e82c6ca79 100644
--- a/genesyscloud/integration_credential/resource_genesyscloud_integration_credential.go
+++ b/genesyscloud/integration_credential/resource_genesyscloud_integration_credential.go
@@ -20,7 +20,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/integration_credential/resource_genesyscloud_integration_credential_test.go b/genesyscloud/integration_credential/resource_genesyscloud_integration_credential_test.go
index c90454fbe..f401541ac 100644
--- a/genesyscloud/integration_credential/resource_genesyscloud_integration_credential_test.go
+++ b/genesyscloud/integration_credential/resource_genesyscloud_integration_credential_test.go
@@ -10,7 +10,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
@@ -49,7 +49,9 @@ func TestAccResourceCredential(t *testing.T) {
strconv.Quote(credName1),
strconv.Quote(typeName1),
GenerateCredentialFields(
- util.GenerateMapProperty(key1, strconv.Quote(val1)),
+ map[string]string{
+ key1: strconv.Quote(val1),
+ },
),
),
Check: resource.ComposeTestCheckFunc(
@@ -65,7 +67,9 @@ func TestAccResourceCredential(t *testing.T) {
strconv.Quote(credName2),
strconv.Quote(typeName1),
GenerateCredentialFields(
- util.GenerateMapProperty(key1, strconv.Quote(val1_2)),
+ map[string]string{
+ key1: strconv.Quote(val1_2),
+ },
),
),
Check: resource.ComposeTestCheckFunc(
@@ -81,8 +85,10 @@ func TestAccResourceCredential(t *testing.T) {
strconv.Quote(credName2),
strconv.Quote(typeName1),
GenerateCredentialFields(
- util.GenerateMapProperty(key1, strconv.Quote(val1)),
- util.GenerateMapProperty(key2, strconv.Quote(val2)),
+ map[string]string{
+ key1: strconv.Quote(val1),
+ key2: strconv.Quote(val2),
+ },
),
),
Check: resource.ComposeTestCheckFunc(
@@ -99,8 +105,10 @@ func TestAccResourceCredential(t *testing.T) {
strconv.Quote(credName2),
strconv.Quote(typeName1),
GenerateCredentialFields(
- util.GenerateMapProperty(key1, strconv.Quote(val1)),
- util.GenerateMapProperty(key2, strconv.Quote(val2_2)),
+ map[string]string{
+ key1: strconv.Quote(val1),
+ key2: strconv.Quote(val2_2),
+ },
),
),
Check: resource.ComposeTestCheckFunc(
@@ -124,7 +132,9 @@ func TestAccResourceCredential(t *testing.T) {
strconv.Quote(credName1),
strconv.Quote(typeName2),
GenerateCredentialFields(
- util.GenerateMapProperty(key3, strconv.Quote(val3)),
+ map[string]string{
+ key3: strconv.Quote(val3),
+ },
),
),
Check: resource.ComposeTestCheckFunc(
@@ -140,7 +150,9 @@ func TestAccResourceCredential(t *testing.T) {
strconv.Quote(credName2),
strconv.Quote(typeName2),
GenerateCredentialFields(
- util.GenerateMapProperty(key3, strconv.Quote(val3)),
+ map[string]string{
+ key3: strconv.Quote(val3),
+ },
),
),
Check: resource.ComposeTestCheckFunc(
@@ -213,8 +225,10 @@ func TestAccGenesysCloudOAuthResourceCredentialWithSecret(t *testing.T) {
strconv.Quote(credName),
strconv.Quote(typeName),
GenerateCredentialFields(
- util.GenerateMapProperty("clientId", strconv.Quote(clientId)),
- util.GenerateMapProperty("clientSecret", strconv.Quote(clientSecret)),
+ map[string]string{
+ "clientId": strconv.Quote(clientId),
+ "clientSecret": strconv.Quote(clientSecret),
+ },
),
),
Check: resource.ComposeTestCheckFunc(
diff --git a/genesyscloud/integration_credential/resource_genesyscloud_integration_credential_utils.go b/genesyscloud/integration_credential/resource_genesyscloud_integration_credential_utils.go
index 83269582e..869ecf396 100644
--- a/genesyscloud/integration_credential/resource_genesyscloud_integration_credential_utils.go
+++ b/genesyscloud/integration_credential/resource_genesyscloud_integration_credential_utils.go
@@ -37,6 +37,6 @@ func GenerateCredentialResource(resourceID string, name string, credentialType s
}
// GenerateCredentialFields builds a terraform string for multiple credential fields
-func GenerateCredentialFields(fields ...string) string {
- return util.GenerateMapAttr("fields", fields...)
+func GenerateCredentialFields(fields map[string]string) string {
+ return util.GenerateMapAttrWithMapProperties("fields", fields)
}
diff --git a/genesyscloud/integration_custom_auth_action/data_source_genesyscloud_integration_custom_auth_action_test.go b/genesyscloud/integration_custom_auth_action/data_source_genesyscloud_integration_custom_auth_action_test.go
index c305ebb95..24c183ef2 100644
--- a/genesyscloud/integration_custom_auth_action/data_source_genesyscloud_integration_custom_auth_action_test.go
+++ b/genesyscloud/integration_custom_auth_action/data_source_genesyscloud_integration_custom_auth_action_test.go
@@ -31,7 +31,7 @@ func TestAccDataSourceIntegrationCustomAuthAction(t *testing.T) {
strconv.Quote(credentialResourceName),
strconv.Quote(customAuthCredentialType),
integrationCred.GenerateCredentialFields(
- util.GenerateMapProperty(credKey1, strconv.Quote(credVal1)),
+ map[string]string{credKey1: strconv.Quote(credVal1)},
),
)
diff --git a/genesyscloud/integration_custom_auth_action/genesyscloud_integration_custom_auth_action_proxy.go b/genesyscloud/integration_custom_auth_action/genesyscloud_integration_custom_auth_action_proxy.go
index 9d70ccc8b..dda4e4553 100644
--- a/genesyscloud/integration_custom_auth_action/genesyscloud_integration_custom_auth_action_proxy.go
+++ b/genesyscloud/integration_custom_auth_action/genesyscloud_integration_custom_auth_action_proxy.go
@@ -5,7 +5,7 @@ import (
"fmt"
"strings"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/integration_custom_auth_action/resource_genesyscloud_integration_custom_auth_action.go b/genesyscloud/integration_custom_auth_action/resource_genesyscloud_integration_custom_auth_action.go
index 3ae2db2df..8839fee9b 100644
--- a/genesyscloud/integration_custom_auth_action/resource_genesyscloud_integration_custom_auth_action.go
+++ b/genesyscloud/integration_custom_auth_action/resource_genesyscloud_integration_custom_auth_action.go
@@ -19,7 +19,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/integration_custom_auth_action/resource_genesyscloud_integration_custom_auth_action_test.go b/genesyscloud/integration_custom_auth_action/resource_genesyscloud_integration_custom_auth_action_test.go
index 193ef3266..3d2e51163 100644
--- a/genesyscloud/integration_custom_auth_action/resource_genesyscloud_integration_custom_auth_action_test.go
+++ b/genesyscloud/integration_custom_auth_action/resource_genesyscloud_integration_custom_auth_action_test.go
@@ -15,7 +15,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
type customAuthActionResource struct {
@@ -54,7 +54,9 @@ func TestAccResourceIntegrationCustomAuthAction(t *testing.T) {
strconv.Quote(credentialResourceName),
strconv.Quote(customAuthCredentialType),
integrationCred.GenerateCredentialFields(
- util.GenerateMapProperty(credKey1, strconv.Quote(credVal1)),
+ map[string]string{
+ credKey1: strconv.Quote(credVal1),
+ },
),
)
diff --git a/genesyscloud/integration_custom_auth_action/resource_genesyscloud_integration_custom_auth_action_utils.go b/genesyscloud/integration_custom_auth_action/resource_genesyscloud_integration_custom_auth_action_utils.go
index 2632161aa..209c4e24d 100644
--- a/genesyscloud/integration_custom_auth_action/resource_genesyscloud_integration_custom_auth_action_utils.go
+++ b/genesyscloud/integration_custom_auth_action/resource_genesyscloud_integration_custom_auth_action_utils.go
@@ -6,7 +6,7 @@ import (
integrationAction "terraform-provider-genesyscloud/genesyscloud/integration_action"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/journey_outcome_predictor/genesyscloud_journey_outcome_predictor_proxy.go b/genesyscloud/journey_outcome_predictor/genesyscloud_journey_outcome_predictor_proxy.go
index cdbdc6b6c..e5846292b 100644
--- a/genesyscloud/journey_outcome_predictor/genesyscloud_journey_outcome_predictor_proxy.go
+++ b/genesyscloud/journey_outcome_predictor/genesyscloud_journey_outcome_predictor_proxy.go
@@ -2,7 +2,7 @@ package journey_outcome_predictor
import (
"context"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/journey_outcome_predictor/resource_genesyscloud_journey_outcome_predictor.go b/genesyscloud/journey_outcome_predictor/resource_genesyscloud_journey_outcome_predictor.go
index 381edb23f..cda54b354 100644
--- a/genesyscloud/journey_outcome_predictor/resource_genesyscloud_journey_outcome_predictor.go
+++ b/genesyscloud/journey_outcome_predictor/resource_genesyscloud_journey_outcome_predictor.go
@@ -17,7 +17,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/journey_outcome_predictor/resource_genesyscloud_journey_outcome_predictor_test.go b/genesyscloud/journey_outcome_predictor/resource_genesyscloud_journey_outcome_predictor_test.go
index 3db246089..98872d160 100644
--- a/genesyscloud/journey_outcome_predictor/resource_genesyscloud_journey_outcome_predictor_test.go
+++ b/genesyscloud/journey_outcome_predictor/resource_genesyscloud_journey_outcome_predictor_test.go
@@ -9,7 +9,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceJourneyOutcomePredictor(t *testing.T) {
diff --git a/genesyscloud/journey_views/genesyscloud_journey_views_proxy.go b/genesyscloud/journey_views/genesyscloud_journey_views_proxy.go
index 929ddd59d..4964990b3 100644
--- a/genesyscloud/journey_views/genesyscloud_journey_views_proxy.go
+++ b/genesyscloud/journey_views/genesyscloud_journey_views_proxy.go
@@ -2,7 +2,7 @@ package journey_views
import (
"context"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
rc "terraform-provider-genesyscloud/genesyscloud/resource_cache"
)
diff --git a/genesyscloud/journey_views/resource_genesyscloud_journey_views.go b/genesyscloud/journey_views/resource_genesyscloud_journey_views.go
index 525f8b15f..2d6b4f702 100644
--- a/genesyscloud/journey_views/resource_genesyscloud_journey_views.go
+++ b/genesyscloud/journey_views/resource_genesyscloud_journey_views.go
@@ -6,7 +6,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"log"
"terraform-provider-genesyscloud/genesyscloud/consistency_checker"
"terraform-provider-genesyscloud/genesyscloud/provider"
@@ -65,7 +65,7 @@ func readJourneyView(ctx context.Context, d *schema.ResourceData, meta interface
}
return retry.NonRetryableError(util.BuildWithRetriesApiDiagnosticError(resourceName, fmt.Sprintf("Failed to get journeyView with viewId %s | error: %s", viewId, err), resp))
}
-
+
resourcedata.SetNillableValue(d, "name", journeyView.Name)
resourcedata.SetNillableValue(d, "description", journeyView.Description)
resourcedata.SetNillableValue(d, "interval", journeyView.Interval)
diff --git a/genesyscloud/journey_views/resource_genesyscloud_journey_views_test.go b/genesyscloud/journey_views/resource_genesyscloud_journey_views_test.go
index 5d2153764..8116ced64 100644
--- a/genesyscloud/journey_views/resource_genesyscloud_journey_views_test.go
+++ b/genesyscloud/journey_views/resource_genesyscloud_journey_views_test.go
@@ -5,7 +5,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"strings"
"terraform-provider-genesyscloud/genesyscloud/provider"
"terraform-provider-genesyscloud/genesyscloud/util"
diff --git a/genesyscloud/journey_views/resource_genesyscloud_journey_views_utils.go b/genesyscloud/journey_views/resource_genesyscloud_journey_views_utils.go
index 2f6dc4691..7c8254f7d 100644
--- a/genesyscloud/journey_views/resource_genesyscloud_journey_views_utils.go
+++ b/genesyscloud/journey_views/resource_genesyscloud_journey_views_utils.go
@@ -3,7 +3,7 @@ package journey_views
import (
"errors"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"terraform-provider-genesyscloud/genesyscloud/util/resourcedata"
)
diff --git a/genesyscloud/oauth_client/resource_genesyscloud_oauth_client.go b/genesyscloud/oauth_client/resource_genesyscloud_oauth_client.go
index 1517a4592..851bf78cc 100644
--- a/genesyscloud/oauth_client/resource_genesyscloud_oauth_client.go
+++ b/genesyscloud/oauth_client/resource_genesyscloud_oauth_client.go
@@ -19,7 +19,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func getAllOAuthClients(ctx context.Context, clientConfig *platformclientv2.Configuration) (resourceExporter.ResourceIDMetaMap, diag.Diagnostics) {
diff --git a/genesyscloud/oauth_client/resource_genesyscloud_oauth_client_proxy.go b/genesyscloud/oauth_client/resource_genesyscloud_oauth_client_proxy.go
index deda69802..f4b0416f6 100644
--- a/genesyscloud/oauth_client/resource_genesyscloud_oauth_client_proxy.go
+++ b/genesyscloud/oauth_client/resource_genesyscloud_oauth_client_proxy.go
@@ -5,7 +5,7 @@ import (
"log"
"sync"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
var internalProxy *oauthClientProxy
diff --git a/genesyscloud/oauth_client/resource_genesyscloud_oauth_client_utils.go b/genesyscloud/oauth_client/resource_genesyscloud_oauth_client_utils.go
index eebfceade..dcdacc228 100644
--- a/genesyscloud/oauth_client/resource_genesyscloud_oauth_client_utils.go
+++ b/genesyscloud/oauth_client/resource_genesyscloud_oauth_client_utils.go
@@ -6,7 +6,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func buildOAuthRedirectURIs(d *schema.ResourceData) *[]string {
diff --git a/genesyscloud/oauth_client/resource_genesyscloude_oauth_client_unit_test.go b/genesyscloud/oauth_client/resource_genesyscloude_oauth_client_unit_test.go
index 531108b05..2f8b9e9fb 100644
--- a/genesyscloud/oauth_client/resource_genesyscloude_oauth_client_unit_test.go
+++ b/genesyscloud/oauth_client/resource_genesyscloude_oauth_client_unit_test.go
@@ -9,7 +9,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"github.com/stretchr/testify/assert"
)
diff --git a/genesyscloud/organization_authentication_settings/genesyscloud_organization_authentication_settings_proxy.go b/genesyscloud/organization_authentication_settings/genesyscloud_organization_authentication_settings_proxy.go
index 980274ccf..bd316f7db 100644
--- a/genesyscloud/organization_authentication_settings/genesyscloud_organization_authentication_settings_proxy.go
+++ b/genesyscloud/organization_authentication_settings/genesyscloud_organization_authentication_settings_proxy.go
@@ -3,7 +3,7 @@ package organization_authentication_settings
import (
"context"
"fmt"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/organization_authentication_settings/resource_genesyscloud_organization_authentication_settings.go b/genesyscloud/organization_authentication_settings/resource_genesyscloud_organization_authentication_settings.go
index 5907f7216..00e0e5f2f 100644
--- a/genesyscloud/organization_authentication_settings/resource_genesyscloud_organization_authentication_settings.go
+++ b/genesyscloud/organization_authentication_settings/resource_genesyscloud_organization_authentication_settings.go
@@ -5,7 +5,7 @@ import (
"fmt"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"log"
"terraform-provider-genesyscloud/genesyscloud/consistency_checker"
"terraform-provider-genesyscloud/genesyscloud/provider"
diff --git a/genesyscloud/organization_authentication_settings/resource_genesyscloud_organization_authentication_settings_unit_test.go b/genesyscloud/organization_authentication_settings/resource_genesyscloud_organization_authentication_settings_unit_test.go
index 55e472c64..2d65d7a8b 100644
--- a/genesyscloud/organization_authentication_settings/resource_genesyscloud_organization_authentication_settings_unit_test.go
+++ b/genesyscloud/organization_authentication_settings/resource_genesyscloud_organization_authentication_settings_unit_test.go
@@ -5,7 +5,7 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"github.com/stretchr/testify/assert"
"net/http"
"terraform-provider-genesyscloud/genesyscloud/provider"
diff --git a/genesyscloud/organization_authentication_settings/resource_genesyscloud_organization_authentication_settings_utils.go b/genesyscloud/organization_authentication_settings/resource_genesyscloud_organization_authentication_settings_utils.go
index 23652caf4..d981238fd 100644
--- a/genesyscloud/organization_authentication_settings/resource_genesyscloud_organization_authentication_settings_utils.go
+++ b/genesyscloud/organization_authentication_settings/resource_genesyscloud_organization_authentication_settings_utils.go
@@ -5,7 +5,7 @@ import (
"terraform-provider-genesyscloud/genesyscloud/util/resourcedata"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/orgauthorization_pairing/genesyscloud_orgauthorization_pairing_proxy.go b/genesyscloud/orgauthorization_pairing/genesyscloud_orgauthorization_pairing_proxy.go
index d2e7f36e1..5cfb68125 100644
--- a/genesyscloud/orgauthorization_pairing/genesyscloud_orgauthorization_pairing_proxy.go
+++ b/genesyscloud/orgauthorization_pairing/genesyscloud_orgauthorization_pairing_proxy.go
@@ -4,7 +4,7 @@ import (
"context"
"fmt"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
var internalProxy *orgauthorizationPairingProxy
diff --git a/genesyscloud/orgauthorization_pairing/resource_genesyscloud_orgauthorization_pairing.go b/genesyscloud/orgauthorization_pairing/resource_genesyscloud_orgauthorization_pairing.go
index dc4e4ba74..5f4bc6923 100644
--- a/genesyscloud/orgauthorization_pairing/resource_genesyscloud_orgauthorization_pairing.go
+++ b/genesyscloud/orgauthorization_pairing/resource_genesyscloud_orgauthorization_pairing.go
@@ -15,7 +15,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func createOrgauthorizationPairing(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
diff --git a/genesyscloud/outbound/data_source_genesyscloud_outbound_cattemptlimit.go b/genesyscloud/outbound/data_source_genesyscloud_outbound_cattemptlimit.go
index 351f72353..25a84f122 100644
--- a/genesyscloud/outbound/data_source_genesyscloud_outbound_cattemptlimit.go
+++ b/genesyscloud/outbound/data_source_genesyscloud_outbound_cattemptlimit.go
@@ -11,7 +11,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func DataSourceOutboundAttemptLimit() *schema.Resource {
diff --git a/genesyscloud/outbound/data_source_genesyscloud_outbound_messagingcampaign.go b/genesyscloud/outbound/data_source_genesyscloud_outbound_messagingcampaign.go
index b7793f2e1..391bbdbf2 100644
--- a/genesyscloud/outbound/data_source_genesyscloud_outbound_messagingcampaign.go
+++ b/genesyscloud/outbound/data_source_genesyscloud_outbound_messagingcampaign.go
@@ -11,7 +11,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func dataSourceOutboundMessagingcampaign() *schema.Resource {
diff --git a/genesyscloud/outbound/data_source_genesyscloud_outbound_messagingcampaign_test.go b/genesyscloud/outbound/data_source_genesyscloud_outbound_messagingcampaign_test.go
index 100929427..a95ebc65b 100644
--- a/genesyscloud/outbound/data_source_genesyscloud_outbound_messagingcampaign_test.go
+++ b/genesyscloud/outbound/data_source_genesyscloud_outbound_messagingcampaign_test.go
@@ -13,7 +13,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
var TrueValue = "true"
diff --git a/genesyscloud/outbound/resource_genesyscloud_outbound_messagingcampaign.go b/genesyscloud/outbound/resource_genesyscloud_outbound_messagingcampaign.go
index 9ee2e0ea9..b497d5851 100644
--- a/genesyscloud/outbound/resource_genesyscloud_outbound_messagingcampaign.go
+++ b/genesyscloud/outbound/resource_genesyscloud_outbound_messagingcampaign.go
@@ -19,7 +19,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
const (
diff --git a/genesyscloud/outbound/resource_genesyscloud_outbound_messagingcampaign_test.go b/genesyscloud/outbound/resource_genesyscloud_outbound_messagingcampaign_test.go
index 0bbd54648..c0d206474 100644
--- a/genesyscloud/outbound/resource_genesyscloud_outbound_messagingcampaign_test.go
+++ b/genesyscloud/outbound/resource_genesyscloud_outbound_messagingcampaign_test.go
@@ -14,7 +14,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
obCallableTimeset "terraform-provider-genesyscloud/genesyscloud/outbound_callabletimeset"
obContactList "terraform-provider-genesyscloud/genesyscloud/outbound_contact_list"
diff --git a/genesyscloud/outbound_attempt_limit/data_source_genesyscloud_outbound_attemptlimit.go b/genesyscloud/outbound_attempt_limit/data_source_genesyscloud_outbound_attemptlimit.go
index 30a977b54..1d330796b 100644
--- a/genesyscloud/outbound_attempt_limit/data_source_genesyscloud_outbound_attemptlimit.go
+++ b/genesyscloud/outbound_attempt_limit/data_source_genesyscloud_outbound_attemptlimit.go
@@ -11,7 +11,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func DataSourceOutboundAttemptLimit() *schema.Resource {
diff --git a/genesyscloud/outbound_attempt_limit/resource_genesyscloud_outbound_attemptlimit.go b/genesyscloud/outbound_attempt_limit/resource_genesyscloud_outbound_attemptlimit.go
index 0c0831cc6..febb736c6 100644
--- a/genesyscloud/outbound_attempt_limit/resource_genesyscloud_outbound_attemptlimit.go
+++ b/genesyscloud/outbound_attempt_limit/resource_genesyscloud_outbound_attemptlimit.go
@@ -19,7 +19,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
const (
diff --git a/genesyscloud/outbound_attempt_limit/resource_genesyscloud_outbound_attemptlimit_test.go b/genesyscloud/outbound_attempt_limit/resource_genesyscloud_outbound_attemptlimit_test.go
index 896c8f02f..d9d1292be 100644
--- a/genesyscloud/outbound_attempt_limit/resource_genesyscloud_outbound_attemptlimit_test.go
+++ b/genesyscloud/outbound_attempt_limit/resource_genesyscloud_outbound_attemptlimit_test.go
@@ -11,7 +11,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
// func init() {
diff --git a/genesyscloud/outbound_callabletimeset/genesyscloud_outbound_callabletimeset_proxy.go b/genesyscloud/outbound_callabletimeset/genesyscloud_outbound_callabletimeset_proxy.go
index ae17580c0..96f564262 100644
--- a/genesyscloud/outbound_callabletimeset/genesyscloud_outbound_callabletimeset_proxy.go
+++ b/genesyscloud/outbound_callabletimeset/genesyscloud_outbound_callabletimeset_proxy.go
@@ -6,7 +6,7 @@ import (
"log"
"strings"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/outbound_callabletimeset/resource_genesyscloud_outbound_callabletimeset.go b/genesyscloud/outbound_callabletimeset/resource_genesyscloud_outbound_callabletimeset.go
index 1010a36b2..c9eb25331 100644
--- a/genesyscloud/outbound_callabletimeset/resource_genesyscloud_outbound_callabletimeset.go
+++ b/genesyscloud/outbound_callabletimeset/resource_genesyscloud_outbound_callabletimeset.go
@@ -18,7 +18,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/outbound_callabletimeset/resource_genesyscloud_outbound_callabletimeset_schema.go b/genesyscloud/outbound_callabletimeset/resource_genesyscloud_outbound_callabletimeset_schema.go
index 703ef3099..d2ccb2cac 100644
--- a/genesyscloud/outbound_callabletimeset/resource_genesyscloud_outbound_callabletimeset_schema.go
+++ b/genesyscloud/outbound_callabletimeset/resource_genesyscloud_outbound_callabletimeset_schema.go
@@ -6,7 +6,7 @@ import (
"terraform-provider-genesyscloud/genesyscloud/provider"
resourceExporter "terraform-provider-genesyscloud/genesyscloud/resource_exporter"
registrar "terraform-provider-genesyscloud/genesyscloud/resource_register"
- gcloud "terraform-provider-genesyscloud/genesyscloud/validators"
+ "terraform-provider-genesyscloud/genesyscloud/validators"
)
const resourceName = "genesyscloud_outbound_callabletimeset"
@@ -23,13 +23,13 @@ var campaignTimeslotResource = &schema.Resource{
`start_time`: {
Description: `The start time of the interval as an ISO-8601 string, i.e. HH:mm:ss`,
Required: true,
- ValidateDiagFunc: gcloud.ValidateTime,
+ ValidateDiagFunc: validators.ValidateTime,
Type: schema.TypeString,
},
`stop_time`: {
Description: `The end time of the interval as an ISO-8601 string, i.e. HH:mm:ss`,
Required: true,
- ValidateDiagFunc: gcloud.ValidateTime,
+ ValidateDiagFunc: validators.ValidateTime,
Type: schema.TypeString,
},
`day`: {
diff --git a/genesyscloud/outbound_callabletimeset/resource_genesyscloud_outbound_callabletimeset_test.go b/genesyscloud/outbound_callabletimeset/resource_genesyscloud_outbound_callabletimeset_test.go
index 85ba29c80..12f28a9d2 100644
--- a/genesyscloud/outbound_callabletimeset/resource_genesyscloud_outbound_callabletimeset_test.go
+++ b/genesyscloud/outbound_callabletimeset/resource_genesyscloud_outbound_callabletimeset_test.go
@@ -9,7 +9,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceOutboundCallabletimeset(t *testing.T) {
diff --git a/genesyscloud/outbound_callabletimeset/resource_genesyscloud_outbound_callabletimeset_utils.go b/genesyscloud/outbound_callabletimeset/resource_genesyscloud_outbound_callabletimeset_utils.go
index 0396e70b2..acba89881 100644
--- a/genesyscloud/outbound_callabletimeset/resource_genesyscloud_outbound_callabletimeset_utils.go
+++ b/genesyscloud/outbound_callabletimeset/resource_genesyscloud_outbound_callabletimeset_utils.go
@@ -5,7 +5,7 @@ import (
"strings"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/outbound_callanalysisresponseset/genesyscloud_outbound_callanalysisresponseset_proxy.go b/genesyscloud/outbound_callanalysisresponseset/genesyscloud_outbound_callanalysisresponseset_proxy.go
index 2b95656c5..5eded85c3 100644
--- a/genesyscloud/outbound_callanalysisresponseset/genesyscloud_outbound_callanalysisresponseset_proxy.go
+++ b/genesyscloud/outbound_callanalysisresponseset/genesyscloud_outbound_callanalysisresponseset_proxy.go
@@ -3,7 +3,7 @@ package outbound_callanalysisresponseset
import (
"context"
"fmt"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"log"
)
diff --git a/genesyscloud/outbound_callanalysisresponseset/resource_genesyscloud_outbound_callanalysisresponseset.go b/genesyscloud/outbound_callanalysisresponseset/resource_genesyscloud_outbound_callanalysisresponseset.go
index bc6137047..90744ea1f 100644
--- a/genesyscloud/outbound_callanalysisresponseset/resource_genesyscloud_outbound_callanalysisresponseset.go
+++ b/genesyscloud/outbound_callanalysisresponseset/resource_genesyscloud_outbound_callanalysisresponseset.go
@@ -6,7 +6,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"log"
"terraform-provider-genesyscloud/genesyscloud/consistency_checker"
"terraform-provider-genesyscloud/genesyscloud/provider"
diff --git a/genesyscloud/outbound_callanalysisresponseset/resource_genesyscloud_outbound_callanalysisresponseset_test.go b/genesyscloud/outbound_callanalysisresponseset/resource_genesyscloud_outbound_callanalysisresponseset_test.go
index afebd9631..74cd9f5fd 100644
--- a/genesyscloud/outbound_callanalysisresponseset/resource_genesyscloud_outbound_callanalysisresponseset_test.go
+++ b/genesyscloud/outbound_callanalysisresponseset/resource_genesyscloud_outbound_callanalysisresponseset_test.go
@@ -14,7 +14,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceOutboundCallAnalysisResponseSet(t *testing.T) {
diff --git a/genesyscloud/outbound_callanalysisresponseset/resource_genesyscloud_outbound_callanalysisresponseset_utils.go b/genesyscloud/outbound_callanalysisresponseset/resource_genesyscloud_outbound_callanalysisresponseset_utils.go
index c8355105a..d48a46401 100644
--- a/genesyscloud/outbound_callanalysisresponseset/resource_genesyscloud_outbound_callanalysisresponseset_utils.go
+++ b/genesyscloud/outbound_callanalysisresponseset/resource_genesyscloud_outbound_callanalysisresponseset_utils.go
@@ -3,7 +3,7 @@ package outbound_callanalysisresponseset
import (
"fmt"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"strings"
"terraform-provider-genesyscloud/genesyscloud/util/resourcedata"
)
diff --git a/genesyscloud/outbound_campaign/genesyscloud_outbound_campaign_init_test.go b/genesyscloud/outbound_campaign/genesyscloud_outbound_campaign_init_test.go
index f36ee1489..03bdbd559 100644
--- a/genesyscloud/outbound_campaign/genesyscloud_outbound_campaign_init_test.go
+++ b/genesyscloud/outbound_campaign/genesyscloud_outbound_campaign_init_test.go
@@ -16,7 +16,7 @@ import (
telephonyProvidersEdgesSite "terraform-provider-genesyscloud/genesyscloud/telephony_providers_edges_site"
"testing"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
diff --git a/genesyscloud/outbound_campaign/genesyscloud_outbound_campaign_proxy.go b/genesyscloud/outbound_campaign/genesyscloud_outbound_campaign_proxy.go
index 92c47562f..8105cebb3 100644
--- a/genesyscloud/outbound_campaign/genesyscloud_outbound_campaign_proxy.go
+++ b/genesyscloud/outbound_campaign/genesyscloud_outbound_campaign_proxy.go
@@ -11,7 +11,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/outbound_campaign/resource_genesyscloud_outbound_campaign.go b/genesyscloud/outbound_campaign/resource_genesyscloud_outbound_campaign.go
index fa9ce68bc..bdcd48c47 100644
--- a/genesyscloud/outbound_campaign/resource_genesyscloud_outbound_campaign.go
+++ b/genesyscloud/outbound_campaign/resource_genesyscloud_outbound_campaign.go
@@ -15,7 +15,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/outbound_campaign/resource_genesyscloud_outbound_campaign_test.go b/genesyscloud/outbound_campaign/resource_genesyscloud_outbound_campaign_test.go
index 5f6576e97..2ada8f3fa 100644
--- a/genesyscloud/outbound_campaign/resource_genesyscloud_outbound_campaign_test.go
+++ b/genesyscloud/outbound_campaign/resource_genesyscloud_outbound_campaign_test.go
@@ -23,7 +23,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
// Add a special generator DEVENGAGE-1646. Basically, the API makes it look like you need a full phone_columns field here. However, the API ignores the type because the devs reused the phone_columns object. However,
diff --git a/genesyscloud/outbound_campaign/resource_genesyscloud_outbound_campaign_utils.go b/genesyscloud/outbound_campaign/resource_genesyscloud_outbound_campaign_utils.go
index 7bafc268f..6f8fdc95a 100644
--- a/genesyscloud/outbound_campaign/resource_genesyscloud_outbound_campaign_utils.go
+++ b/genesyscloud/outbound_campaign/resource_genesyscloud_outbound_campaign_utils.go
@@ -18,7 +18,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/outbound_campaignrule/data_source_genesyscloud_outbound_campaignrule.go b/genesyscloud/outbound_campaignrule/data_source_genesyscloud_outbound_campaignrule.go
index dfb9710a1..e6694ebb2 100644
--- a/genesyscloud/outbound_campaignrule/data_source_genesyscloud_outbound_campaignrule.go
+++ b/genesyscloud/outbound_campaignrule/data_source_genesyscloud_outbound_campaignrule.go
@@ -11,7 +11,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func dataSourceOutboundCampaignruleRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
diff --git a/genesyscloud/outbound_campaignrule/genesyscloud_outbound_campaignrule_proxy.go b/genesyscloud/outbound_campaignrule/genesyscloud_outbound_campaignrule_proxy.go
index a7708715f..0af2b5ba4 100644
--- a/genesyscloud/outbound_campaignrule/genesyscloud_outbound_campaignrule_proxy.go
+++ b/genesyscloud/outbound_campaignrule/genesyscloud_outbound_campaignrule_proxy.go
@@ -5,7 +5,7 @@ import (
"fmt"
"log"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/outbound_campaignrule/resource_genesyscloud_outbound_campaignrule.go b/genesyscloud/outbound_campaignrule/resource_genesyscloud_outbound_campaignrule.go
index 3dbc518f2..f94ae8fe3 100644
--- a/genesyscloud/outbound_campaignrule/resource_genesyscloud_outbound_campaignrule.go
+++ b/genesyscloud/outbound_campaignrule/resource_genesyscloud_outbound_campaignrule.go
@@ -18,7 +18,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func getAllAuthCampaignRules(ctx context.Context, clientConfig *platformclientv2.Configuration) (resourceExporter.ResourceIDMetaMap, diag.Diagnostics) {
diff --git a/genesyscloud/outbound_campaignrule/resource_genesyscloud_outbound_campaignrule_test.go b/genesyscloud/outbound_campaignrule/resource_genesyscloud_outbound_campaignrule_test.go
index 53b6eeab2..2a1726d2f 100644
--- a/genesyscloud/outbound_campaignrule/resource_genesyscloud_outbound_campaignrule_test.go
+++ b/genesyscloud/outbound_campaignrule/resource_genesyscloud_outbound_campaignrule_test.go
@@ -13,7 +13,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceOutboundCampaignRuleBasic(t *testing.T) {
diff --git a/genesyscloud/outbound_campaignrule/resource_genesyscloud_outbound_campaignrule_unit_test.go b/genesyscloud/outbound_campaignrule/resource_genesyscloud_outbound_campaignrule_unit_test.go
index 8fdae8811..aa5a5196c 100644
--- a/genesyscloud/outbound_campaignrule/resource_genesyscloud_outbound_campaignrule_unit_test.go
+++ b/genesyscloud/outbound_campaignrule/resource_genesyscloud_outbound_campaignrule_unit_test.go
@@ -10,7 +10,7 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"github.com/stretchr/testify/assert"
)
diff --git a/genesyscloud/outbound_campaignrule/resource_genesyscloud_outbound_campaignrule_utils.go b/genesyscloud/outbound_campaignrule/resource_genesyscloud_outbound_campaignrule_utils.go
index 8fb38aba3..0d3240299 100644
--- a/genesyscloud/outbound_campaignrule/resource_genesyscloud_outbound_campaignrule_utils.go
+++ b/genesyscloud/outbound_campaignrule/resource_genesyscloud_outbound_campaignrule_utils.go
@@ -5,7 +5,7 @@ import (
"terraform-provider-genesyscloud/genesyscloud/util/resourcedata"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func getCampaignruleFromResourceData(d *schema.ResourceData) platformclientv2.Campaignrule {
diff --git a/genesyscloud/outbound_contact_list/data_source_genesyscloud_outbound_contactlist.go b/genesyscloud/outbound_contact_list/data_source_genesyscloud_outbound_contactlist.go
index 21e1ffc39..3c2f58501 100644
--- a/genesyscloud/outbound_contact_list/data_source_genesyscloud_outbound_contactlist.go
+++ b/genesyscloud/outbound_contact_list/data_source_genesyscloud_outbound_contactlist.go
@@ -11,7 +11,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func DataSourceOutboundContactList() *schema.Resource {
diff --git a/genesyscloud/outbound_contact_list/resource_genesyscloud_outbound_contactlist.go b/genesyscloud/outbound_contact_list/resource_genesyscloud_outbound_contactlist.go
index 51a5daa7c..144afc54a 100644
--- a/genesyscloud/outbound_contact_list/resource_genesyscloud_outbound_contactlist.go
+++ b/genesyscloud/outbound_contact_list/resource_genesyscloud_outbound_contactlist.go
@@ -20,7 +20,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
const (
@@ -625,3 +625,13 @@ func GeneratePhoneColumnsDataTypeSpecBlock(columnName, columnDataType, min, max,
}
`, columnName, columnDataType, min, max, maxLength)
}
+
+func GenerateEmailColumnsBlock(columnName, columnType, contactableTimeColumn string) string {
+ return fmt.Sprintf(`
+ email_columns {
+ column_name = "%s"
+ type = "%s"
+ contactable_time_column = %s
+ }
+`, columnName, columnType, contactableTimeColumn)
+}
diff --git a/genesyscloud/outbound_contact_list/resource_genesyscloud_outbound_contactlist_test.go b/genesyscloud/outbound_contact_list/resource_genesyscloud_outbound_contactlist_test.go
index 220478123..fd80cce10 100644
--- a/genesyscloud/outbound_contact_list/resource_genesyscloud_outbound_contactlist_test.go
+++ b/genesyscloud/outbound_contact_list/resource_genesyscloud_outbound_contactlist_test.go
@@ -12,7 +12,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceOutboundContactListBasic(t *testing.T) {
@@ -67,12 +67,12 @@ func TestAccResourceOutboundContactListBasic(t *testing.T) {
"home",
strconv.Quote("Home"),
),
- generateEmailColumnsBlock(
+ GenerateEmailColumnsBlock(
"Work",
"work",
util.NullValue,
),
- generateEmailColumnsBlock(
+ GenerateEmailColumnsBlock(
"Personal",
"personal",
util.NullValue,
@@ -124,12 +124,12 @@ func TestAccResourceOutboundContactListBasic(t *testing.T) {
"home",
strconv.Quote("Home"),
),
- generateEmailColumnsBlock(
+ GenerateEmailColumnsBlock(
"Work",
"work",
util.NullValue,
),
- generateEmailColumnsBlock(
+ GenerateEmailColumnsBlock(
"Personal",
"personal",
util.NullValue,
@@ -182,12 +182,12 @@ func TestAccResourceOutboundContactListBasic(t *testing.T) {
"home",
strconv.Quote("Home"),
),
- generateEmailColumnsBlock(
+ GenerateEmailColumnsBlock(
"Work",
"work",
util.NullValue,
),
- generateEmailColumnsBlock(
+ GenerateEmailColumnsBlock(
"Personal",
"personal",
util.NullValue,
@@ -276,12 +276,12 @@ func TestAccResourceOutboundContactListBasic(t *testing.T) {
"home",
util.NullValue,
),
- generateEmailColumnsBlock(
+ GenerateEmailColumnsBlock(
"Work",
"work",
strconv.Quote(zipCodeColumnName),
),
- generateEmailColumnsBlock(
+ GenerateEmailColumnsBlock(
"Personal",
"personal",
strconv.Quote(zipCodeColumnName),
@@ -342,16 +342,6 @@ func TestAccResourceOutboundContactListBasic(t *testing.T) {
})
}
-func generateEmailColumnsBlock(columnName, columnType, contactableTimeColumn string) string {
- return fmt.Sprintf(`
- email_columns {
- column_name = "%s"
- type = "%s"
- contactable_time_column = %s
- }
-`, columnName, columnType, contactableTimeColumn)
-}
-
func testVerifyContactListDestroyed(state *terraform.State) error {
outboundAPI := platformclientv2.NewOutboundApi()
for _, rs := range state.RootModule().Resources {
diff --git a/genesyscloud/outbound_contact_list_contact/genesyscloud_outbound_contact_list_contact_init_test.go b/genesyscloud/outbound_contact_list_contact/genesyscloud_outbound_contact_list_contact_init_test.go
new file mode 100644
index 000000000..e6c0f5694
--- /dev/null
+++ b/genesyscloud/outbound_contact_list_contact/genesyscloud_outbound_contact_list_contact_init_test.go
@@ -0,0 +1,42 @@
+package outbound_contact_list_contact
+
+import (
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
+ "sync"
+ outboundContactList "terraform-provider-genesyscloud/genesyscloud/outbound_contact_list"
+ "testing"
+)
+
+// providerResources holds a map of all registered resources
+var providerResources map[string]*schema.Resource
+
+type registerTestInstance struct {
+ resourceMapMutex sync.RWMutex
+}
+
+// registerTestResources registers all resources used in the tests
+func (r *registerTestInstance) registerTestResources() {
+ r.resourceMapMutex.Lock()
+ defer r.resourceMapMutex.Unlock()
+
+ providerResources[resourceName] = ResourceOutboundContactListContact()
+ providerResources["genesyscloud_outbound_contact_list"] = outboundContactList.ResourceOutboundContactList()
+}
+
+// initTestResources initializes all test resources.
+func initTestResources() {
+ providerResources = make(map[string]*schema.Resource)
+
+ regInstance := ®isterTestInstance{}
+
+ regInstance.registerTestResources()
+}
+
+// TestMain is a "setup" function called by the testing framework when run the test
+func TestMain(m *testing.M) {
+ // Run setup function before starting the test suite for the outbound_contact_list_contact package
+ initTestResources()
+
+ // Run the test suite for the outbound_contact_list_contact package
+ m.Run()
+}
diff --git a/genesyscloud/outbound_contact_list_contact/genesyscloud_outbound_contact_list_contact_proxy.go b/genesyscloud/outbound_contact_list_contact/genesyscloud_outbound_contact_list_contact_proxy.go
new file mode 100644
index 000000000..021e5b804
--- /dev/null
+++ b/genesyscloud/outbound_contact_list_contact/genesyscloud_outbound_contact_list_contact_proxy.go
@@ -0,0 +1,179 @@
+package outbound_contact_list_contact
+
+import (
+ "context"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
+ rc "terraform-provider-genesyscloud/genesyscloud/resource_cache"
+)
+
+var internalProxy *contactProxy
+
+type createContactFunc func(ctx context.Context, p *contactProxy, contactListId string, contact platformclientv2.Writabledialercontact, priority, clearSystemData, doNotQueue bool) ([]platformclientv2.Dialercontact, *platformclientv2.APIResponse, error)
+type readContactByIdFunc func(ctx context.Context, p *contactProxy, contactListId, contactId string) (*platformclientv2.Dialercontact, *platformclientv2.APIResponse, error)
+type updateContactFunc func(ctx context.Context, p *contactProxy, contactListId string, contactId string, contact platformclientv2.Dialercontact) (*platformclientv2.Dialercontact, *platformclientv2.APIResponse, error)
+type deleteContactFunc func(ctx context.Context, p *contactProxy, contactListId, contactId string) (*platformclientv2.APIResponse, error)
+type getAllContactsFunc func(ctx context.Context, p *contactProxy) ([]platformclientv2.Dialercontact, *platformclientv2.APIResponse, error)
+
+type contactProxy struct {
+ clientConfig *platformclientv2.Configuration
+ outboundApi *platformclientv2.OutboundApi
+ createContactAttr createContactFunc
+ readContactByIdAttr readContactByIdFunc
+ updateContactAttr updateContactFunc
+ deleteContactAttr deleteContactFunc
+ getAllContactsAttr getAllContactsFunc
+ contactCache rc.CacheInterface[platformclientv2.Dialercontact]
+}
+
+func newContactProxy(clientConfig *platformclientv2.Configuration) *contactProxy {
+ api := platformclientv2.NewOutboundApiWithConfig(clientConfig)
+ contactCache := rc.NewResourceCache[platformclientv2.Dialercontact]()
+ return &contactProxy{
+ clientConfig: clientConfig,
+ outboundApi: api,
+ createContactAttr: createContactFn,
+ readContactByIdAttr: readContactByIdFn,
+ updateContactAttr: updateContactFn,
+ deleteContactAttr: deleteContactFn,
+ getAllContactsAttr: getAllContactsFn,
+ contactCache: contactCache,
+ }
+}
+
+func getContactProxy(clientConfig *platformclientv2.Configuration) *contactProxy {
+ if internalProxy == nil {
+ internalProxy = newContactProxy(clientConfig)
+ }
+
+ return internalProxy
+}
+
+func (p *contactProxy) createContact(ctx context.Context, contactListId string, contact platformclientv2.Writabledialercontact, priority, clearSystemData, doNotQueue bool) ([]platformclientv2.Dialercontact, *platformclientv2.APIResponse, error) {
+ return p.createContactAttr(ctx, p, contactListId, contact, priority, clearSystemData, doNotQueue)
+}
+
+func (p *contactProxy) readContactById(ctx context.Context, contactListId, contactId string) (*platformclientv2.Dialercontact, *platformclientv2.APIResponse, error) {
+ return p.readContactByIdAttr(ctx, p, contactListId, contactId)
+}
+
+func (p *contactProxy) updateContact(ctx context.Context, contactListId, contactId string, contact platformclientv2.Dialercontact) (*platformclientv2.Dialercontact, *platformclientv2.APIResponse, error) {
+ return p.updateContactAttr(ctx, p, contactListId, contactId, contact)
+}
+
+func (p *contactProxy) deleteContact(ctx context.Context, contactListId, contactId string) (*platformclientv2.APIResponse, error) {
+ return p.deleteContactAttr(ctx, p, contactListId, contactId)
+}
+
+func (p *contactProxy) getAllContacts(ctx context.Context) ([]platformclientv2.Dialercontact, *platformclientv2.APIResponse, error) {
+ return p.getAllContactsAttr(ctx, p)
+}
+
+func createContactFn(_ context.Context, p *contactProxy, contactListId string, contact platformclientv2.Writabledialercontact, priority, clearSystemData, doNotQueue bool) ([]platformclientv2.Dialercontact, *platformclientv2.APIResponse, error) {
+ return p.outboundApi.PostOutboundContactlistContacts(contactListId, []platformclientv2.Writabledialercontact{contact}, priority, clearSystemData, doNotQueue)
+}
+
+func readContactByIdFn(_ context.Context, p *contactProxy, contactListId, contactId string) (*platformclientv2.Dialercontact, *platformclientv2.APIResponse, error) {
+ if contact := rc.GetCacheItem(p.contactCache, contactId); contact != nil {
+ return contact, nil, nil
+ }
+ return p.outboundApi.GetOutboundContactlistContact(contactListId, contactId)
+}
+
+func updateContactFn(_ context.Context, p *contactProxy, contactListId, contactId string, contact platformclientv2.Dialercontact) (*platformclientv2.Dialercontact, *platformclientv2.APIResponse, error) {
+ return p.outboundApi.PutOutboundContactlistContact(contactListId, contactId, contact)
+}
+
+func deleteContactFn(_ context.Context, p *contactProxy, contactListId, contactId string) (*platformclientv2.APIResponse, error) {
+ return p.outboundApi.DeleteOutboundContactlistContact(contactListId, contactId)
+}
+
+func getAllContactsFn(ctx context.Context, p *contactProxy) ([]platformclientv2.Dialercontact, *platformclientv2.APIResponse, error) {
+ var allContacts []platformclientv2.Dialercontact
+
+ contactListIds, resp, err := p.getAllContactListIds(ctx)
+ if err != nil {
+ return allContacts, resp, err
+ }
+
+ for _, contactListId := range contactListIds {
+ contacts, resp, err := p.getContactsByContactListId(ctx, contactListId)
+ if err != nil {
+ return nil, resp, err
+ }
+ allContacts = append(allContacts, contacts...)
+ }
+
+ for _, contact := range allContacts {
+ rc.SetCache(p.contactCache, *contact.Id, contact)
+ }
+
+ return allContacts, nil, nil
+}
+
+func (p *contactProxy) getContactsByContactListId(_ context.Context, contactListId string) ([]platformclientv2.Dialercontact, *platformclientv2.APIResponse, error) {
+ var (
+ pageNum = 1
+ pageSize = 50
+ allContacts []platformclientv2.Dialercontact
+ )
+
+ body := platformclientv2.Contactlistingrequest{
+ PageNumber: &pageNum,
+ PageSize: &pageSize,
+ }
+
+ data, resp, err := p.outboundApi.PostOutboundContactlistContactsSearch(contactListId, body)
+ if err != nil {
+ return nil, resp, err
+ }
+ if data.Entities == nil || len(*data.Entities) == 0 {
+ return nil, nil, nil
+ }
+ allContacts = append(allContacts, *data.Entities...)
+
+ for pageNum = 2; pageNum <= *data.PageCount; pageNum++ {
+ body.PageNumber = &pageNum
+ data, resp, err = p.outboundApi.PostOutboundContactlistContactsSearch(contactListId, body)
+ if err != nil {
+ return nil, resp, err
+ }
+ if data.Entities == nil || len(*data.Entities) == 0 {
+ break
+ }
+ allContacts = append(allContacts, *data.Entities...)
+ }
+
+ return allContacts, nil, nil
+}
+
+func (p *contactProxy) getAllContactListIds(_ context.Context) ([]string, *platformclientv2.APIResponse, error) {
+ const pageSize = 100
+ var pageNum = 1
+ var allContactListIds []string
+
+ contactListConfigs, resp, getErr := p.outboundApi.GetOutboundContactlists(false, false, pageSize, pageNum, true, "", "", []string{}, []string{}, "", "")
+ if getErr != nil {
+ return nil, resp, getErr
+ }
+ if contactListConfigs.Entities == nil || len(*contactListConfigs.Entities) == 0 {
+ return nil, nil, nil
+ }
+ for _, cl := range *contactListConfigs.Entities {
+ allContactListIds = append(allContactListIds, *cl.Id)
+ }
+
+ for pageNum := 2; pageNum <= *contactListConfigs.PageCount; pageNum++ {
+ contactListConfigs, resp, getErr := p.outboundApi.GetOutboundContactlists(false, false, pageSize, pageNum, true, "", "", []string{}, []string{}, "", "")
+ if getErr != nil {
+ return nil, resp, getErr
+ }
+ if contactListConfigs.Entities == nil || len(*contactListConfigs.Entities) == 0 {
+ break
+ }
+ for _, cl := range *contactListConfigs.Entities {
+ allContactListIds = append(allContactListIds, *cl.Id)
+ }
+ }
+
+ return allContactListIds, nil, nil
+}
diff --git a/genesyscloud/outbound_contact_list_contact/resource_genesyscloud_outbound_contact_list_contact.go b/genesyscloud/outbound_contact_list_contact/resource_genesyscloud_outbound_contact_list_contact.go
new file mode 100644
index 000000000..d8e4cdab6
--- /dev/null
+++ b/genesyscloud/outbound_contact_list_contact/resource_genesyscloud_outbound_contact_list_contact.go
@@ -0,0 +1,153 @@
+package outbound_contact_list_contact
+
+import (
+ "context"
+ "fmt"
+ "github.com/hashicorp/terraform-plugin-sdk/v2/diag"
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
+ "log"
+ "terraform-provider-genesyscloud/genesyscloud/consistency_checker"
+ "terraform-provider-genesyscloud/genesyscloud/provider"
+ resourceExporter "terraform-provider-genesyscloud/genesyscloud/resource_exporter"
+ "terraform-provider-genesyscloud/genesyscloud/util"
+ "terraform-provider-genesyscloud/genesyscloud/util/constants"
+ "terraform-provider-genesyscloud/genesyscloud/util/resourcedata"
+ "time"
+)
+
+func getAllContacts(ctx context.Context, clientConfig *platformclientv2.Configuration) (resourceExporter.ResourceIDMetaMap, diag.Diagnostics) {
+ resources := make(resourceExporter.ResourceIDMetaMap)
+ cp := getContactProxy(clientConfig)
+
+ contacts, resp, err := cp.getAllContacts(ctx)
+ if err != nil {
+ msg := fmt.Sprintf("Failed to read all contact list contacts. Error: %v", err)
+ if resp != nil {
+ return nil, util.BuildAPIDiagnosticError(resourceName, msg, resp)
+ }
+ return nil, util.BuildDiagnosticError(resourceName, msg, err)
+ }
+
+ for _, contact := range contacts {
+ //id := createCustomContactId(*contact.ContactListId, *contact.Id)
+ resources[*contact.Id] = &resourceExporter.ResourceMeta{Name: *contact.Id}
+ }
+
+ return resources, nil
+}
+
+func createOutboundContactListContact(ctx context.Context, d *schema.ResourceData, meta any) diag.Diagnostics {
+ sdkConfig := meta.(*provider.ProviderMeta).ClientConfig
+ cp := getContactProxy(sdkConfig)
+
+ contactListId := d.Get("contact_list_id").(string)
+ priority := d.Get("priority").(bool)
+ clearSystemData := d.Get("clear_system_data").(bool)
+ doNotQueue := d.Get("do_not_queue").(bool)
+
+ contactRequestBody := buildWritableContactFromResourceData(d)
+
+ log.Printf("Creating contact in contact list '%s'", contactListId)
+ contactResponseBody, resp, err := cp.createContact(ctx, contactListId, contactRequestBody, priority, clearSystemData, doNotQueue)
+ if err != nil {
+ return util.BuildAPIDiagnosticError(resourceName, fmt.Sprintf("failed to create contact '%s' for contact list '%s': %v", *contactRequestBody.Id, contactListId, err), resp)
+ }
+
+ if len(contactResponseBody) != 1 {
+ msg := fmt.Sprintf("expected to receive one dialer contact object in contact creation response. Received %v", len(contactResponseBody))
+ return util.BuildDiagnosticError(resourceName, msg, fmt.Errorf("%v", msg))
+ }
+
+ d.SetId(*contactResponseBody[0].Id)
+ log.Printf("Finished creating contact '%s' in contact list '%s'", d.Id(), contactListId)
+ return readOutboundContactListContact(ctx, d, meta)
+}
+
+func readOutboundContactListContact(ctx context.Context, d *schema.ResourceData, meta any) diag.Diagnostics {
+ var (
+ resp *platformclientv2.APIResponse
+ err error
+
+ sdkConfig = meta.(*provider.ProviderMeta).ClientConfig
+ cp = getContactProxy(sdkConfig)
+
+ contactListId = d.Get("contact_list_id").(string)
+ )
+
+ cc := consistency_checker.NewConsistencyCheck(ctx, d, meta, ResourceOutboundContactListContact(), constants.DefaultConsistencyChecks, resourceName)
+
+ retryErr := util.WithRetriesForRead(ctx, d, func() *retry.RetryError {
+ var contactResponseBody *platformclientv2.Dialercontact
+
+ log.Printf("Reading contact '%s' in contact list '%s'", d.Id(), contactListId)
+ contactResponseBody, resp, err = cp.readContactById(ctx, contactListId, d.Id())
+ if err != nil {
+ if util.IsStatus404(resp) {
+ return retry.RetryableError(err)
+ }
+ return retry.NonRetryableError(err)
+ }
+
+ _ = d.Set("contact_list_id", *contactResponseBody.ContactListId)
+ resourcedata.SetNillableValue(d, "callable", contactResponseBody.Callable)
+ resourcedata.SetNillableValue(d, "data", contactResponseBody.Data)
+ resourcedata.SetNillableValueWithSchemaSetWithFunc(d, "phone_number_status", contactResponseBody.PhoneNumberStatus, flattenPhoneNumberStatus)
+ resourcedata.SetNillableValueWithSchemaSetWithFunc(d, "contactable_status", contactResponseBody.ContactableStatus, flattenContactableStatus)
+
+ return cc.CheckState(d)
+ })
+ if retryErr != nil {
+ return util.BuildAPIDiagnosticError(resourceName, fmt.Sprintf("failed to read contact by ID '%s' from contact list '%s'. Error: %v", d.Id(), contactListId, retryErr), resp)
+ }
+ log.Printf("Done reading contact '%s' in contact list '%s'", d.Id(), contactListId)
+ return nil
+}
+
+func updateOutboundContactListContact(ctx context.Context, d *schema.ResourceData, meta any) diag.Diagnostics {
+ sdkConfig := meta.(*provider.ProviderMeta).ClientConfig
+ cp := getContactProxy(sdkConfig)
+
+ contactRequestBody := buildDialerContactFromResourceData(d)
+ contactListId := *contactRequestBody.ContactListId
+
+ log.Printf("Updating contact '%s' in contact list '%s'", d.Id(), contactListId)
+ _, resp, err := cp.updateContact(ctx, contactListId, d.Id(), contactRequestBody)
+ if err != nil {
+ msg := fmt.Sprintf("failed to update contact '%s' for contact list '%s'. Error: %v", d.Id(), contactListId, err)
+ return util.BuildAPIDiagnosticError(resourceName, msg, resp)
+ }
+
+ log.Printf("Finished updating contact '%s' in contact list '%s'", d.Id(), contactListId)
+ return readOutboundContactListContact(ctx, d, meta)
+}
+
+func deleteOutboundContactListContact(ctx context.Context, d *schema.ResourceData, meta any) diag.Diagnostics {
+ sdkConfig := meta.(*provider.ProviderMeta).ClientConfig
+ cp := getContactProxy(sdkConfig)
+
+ contactListId := d.Get("contact_list_id").(string)
+
+ log.Printf("Deleting contact '%s' from contact list '%s'", d.Id(), contactListId)
+ resp, err := cp.deleteContact(ctx, contactListId, d.Id())
+ if err != nil {
+ msg := fmt.Sprintf("failed to delete contact '%s' from contact list '%s'. Error: %v", d.Id(), contactListId, err)
+ return util.BuildAPIDiagnosticError(resourceName, msg, resp)
+ }
+
+ return util.WithRetries(ctx, 60*time.Second, func() *retry.RetryError {
+ log.Printf("Reading contact '%s'", d.Id())
+ _, resp, err := cp.readContactById(ctx, contactListId, d.Id())
+ if err != nil {
+ if util.IsStatus404(resp) {
+ log.Printf("Contact '%s' deleted", d.Id())
+ return nil
+ }
+ msg := fmt.Sprintf("failed to delete contact '%s'. Error: %v", d.Id(), err)
+ return retry.NonRetryableError(util.BuildWithRetriesApiDiagnosticError(resourceName, msg, resp))
+ }
+ msg := fmt.Sprintf("contact '%s' still exists in contact list '%s'", d.Id(), contactListId)
+ return retry.RetryableError(util.BuildWithRetriesApiDiagnosticError(resourceName, msg, resp))
+ })
+}
diff --git a/genesyscloud/outbound_contact_list_contact/resource_genesyscloud_outbound_contact_list_contact_schema.go b/genesyscloud/outbound_contact_list_contact/resource_genesyscloud_outbound_contact_list_contact_schema.go
new file mode 100644
index 000000000..445f32893
--- /dev/null
+++ b/genesyscloud/outbound_contact_list_contact/resource_genesyscloud_outbound_contact_list_contact_schema.go
@@ -0,0 +1,147 @@
+package outbound_contact_list_contact
+
+import (
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
+ "terraform-provider-genesyscloud/genesyscloud/provider"
+ resourceExporter "terraform-provider-genesyscloud/genesyscloud/resource_exporter"
+ registrar "terraform-provider-genesyscloud/genesyscloud/resource_register"
+)
+
+const resourceName = "genesyscloud_outbound_contact_list_contact"
+
+func SetRegistrar(regInstance registrar.Registrar) {
+ regInstance.RegisterResource(resourceName, ResourceOutboundContactListContact())
+ regInstance.RegisterExporter(resourceName, ContactExporter())
+}
+
+var (
+ contactableStatusResource = &schema.Resource{
+ Schema: map[string]*schema.Schema{
+ "media_type": {
+ Description: `The key which identifies the media type (Voice, SMS and Email).`,
+ Type: schema.TypeString,
+ Required: true,
+ },
+ "contactable": {
+ Description: `Indicates whether or not the entire contact is contactable for the associated media type.`,
+ Type: schema.TypeBool,
+ Required: true,
+ },
+ "column_status": {
+ Description: `A map of individual contact method columns to whether the individual column is contactable for the associated media type.`,
+ Type: schema.TypeSet,
+ Optional: true,
+ Elem: columnStatusResource,
+ },
+ },
+ }
+ columnStatusResource = &schema.Resource{
+ Schema: map[string]*schema.Schema{
+ "column": {
+ Description: `The key which identifies the contact method column.`,
+ Type: schema.TypeString,
+ Required: true,
+ },
+ "contactable": {
+ Description: `Indicates whether or not an individual contact method column is contactable.`,
+ Type: schema.TypeBool,
+ Required: true,
+ },
+ },
+ }
+ phoneNumberStatusResource = &schema.Resource{
+ Schema: map[string]*schema.Schema{
+ "key": {
+ Description: `Phone number column identifier.`,
+ Type: schema.TypeString,
+ Required: true,
+ },
+ "callable": {
+ Description: `Indicates whether or not a phone number is callable.`,
+ Type: schema.TypeBool,
+ Required: true,
+ },
+ },
+ }
+)
+
+func ContactExporter() *resourceExporter.ResourceExporter {
+ return &resourceExporter.ResourceExporter{
+ GetResourcesFunc: provider.GetAllWithPooledClient(getAllContacts),
+ RefAttrs: map[string]*resourceExporter.RefAttrSettings{
+ "contact_list_id": {RefType: "genesyscloud_outbound_contact_list"},
+ },
+ AllowZeroValuesInMap: []string{"data"},
+ }
+}
+
+func ResourceOutboundContactListContact() *schema.Resource {
+ return &schema.Resource{
+ Description: `Genesys Cloud Outbound Contact List Contact`,
+
+ CreateContext: provider.CreateWithPooledClient(createOutboundContactListContact),
+ ReadContext: provider.ReadWithPooledClient(readOutboundContactListContact),
+ UpdateContext: provider.UpdateWithPooledClient(updateOutboundContactListContact),
+ DeleteContext: provider.DeleteWithPooledClient(deleteOutboundContactListContact),
+ Importer: &schema.ResourceImporter{
+ StateContext: schema.ImportStatePassthroughContext,
+ },
+ SchemaVersion: 1,
+ Schema: map[string]*schema.Schema{
+ "contact_list_id": {
+ Description: `The identifier of the contact list containing this contact.`,
+ ForceNew: true,
+ Required: true,
+ Type: schema.TypeString,
+ },
+ "priority": {
+ Description: `Contact priority. True means the contact(s) will be dialed next; false means the contact will go to the end of the contact queue.
+Only applicable on the creation of a contact, so updating this field will force the contact to be deleted from the contact list and re-uploaded.`,
+ ForceNew: true,
+ Optional: true,
+ Type: schema.TypeBool,
+ },
+ "clear_system_data": {
+ Description: `Clear system data. True means the system columns (attempts, callable status, etc) stored on the contact will be cleared if the contact already exists; false means they won't.
+Only applicable on the creation of a contact, so updating this field will force the contact to be deleted from the contact list and re-uploaded.`,
+ ForceNew: true,
+ Optional: true,
+ Type: schema.TypeBool,
+ },
+ "do_not_queue": {
+ Description: `Do not queue. True means that updated contacts will not have their positions in the queue altered, so contacts that have already been dialed will not be redialed.
+For new contacts, this parameter has no effect; False means that updated contacts will be re-queued, according to the 'priority' parameter.
+Only applicable on the creation of a contact, so updating this field will force the contact to be deleted from the contact list and re-uploaded.`,
+ ForceNew: true,
+ Optional: true,
+ Type: schema.TypeBool,
+ },
+ "callable": {
+ Description: `Indicates whether or not the contact can be called.`,
+ Type: schema.TypeBool,
+ Default: false,
+ Optional: true,
+ },
+ "data": {
+ Description: `An ordered map of the contact's columns and corresponding values.`,
+ Type: schema.TypeMap,
+ Required: true,
+ Elem: &schema.Schema{Type: schema.TypeString},
+ },
+ "phone_number_status": {
+ Description: `A map of phone number columns to PhoneNumberStatuses, which indicate if the phone number is callable or not.`,
+ Type: schema.TypeSet,
+ Optional: true,
+ ForceNew: true,
+ Elem: phoneNumberStatusResource,
+ },
+ "contactable_status": {
+ Description: `A map of media types (Voice, SMS and Email) to ContactableStatus, which indicates if the contact can be contacted using the specified media type.`,
+ Type: schema.TypeSet,
+ Optional: true,
+ ForceNew: true,
+ Elem: contactableStatusResource,
+ },
+ },
+ }
+}
diff --git a/genesyscloud/outbound_contact_list_contact/resource_genesyscloud_outbound_contact_list_contact_test.go b/genesyscloud/outbound_contact_list_contact/resource_genesyscloud_outbound_contact_list_contact_test.go
new file mode 100644
index 000000000..4a923fc7c
--- /dev/null
+++ b/genesyscloud/outbound_contact_list_contact/resource_genesyscloud_outbound_contact_list_contact_test.go
@@ -0,0 +1,176 @@
+package outbound_contact_list_contact
+
+import (
+ "fmt"
+ "github.com/google/uuid"
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
+ "strconv"
+ outboundContactList "terraform-provider-genesyscloud/genesyscloud/outbound_contact_list"
+ "terraform-provider-genesyscloud/genesyscloud/provider"
+ "terraform-provider-genesyscloud/genesyscloud/util"
+ "testing"
+)
+
+func TestAccResourceOutboundContactListContact(t *testing.T) {
+ var (
+ resourceId = "contact"
+ fullResourceId = fmt.Sprintf("%s.%s", resourceName, resourceId)
+
+ cellColumnKey = "Cell"
+ dataCellValue = "+000000"
+ dataCellValueUpdated = "+111111"
+
+ homeColumnKey = "Home"
+ dataHomeValue = "+22222222"
+ dataHomeValueUpdated = "+33333333"
+
+ emailColumnKey = "Email"
+ dataEmailValue = "email@fake.com"
+ dataEmailValueUpdated = "fake@email.cmo"
+
+ contactListResourceId = "contact_list"
+ contactListFullResourceId = "genesyscloud_outbound_contact_list." + contactListResourceId
+ contactListName = "tf test contact list " + uuid.NewString()
+ columnNames = []string{
+ strconv.Quote(cellColumnKey),
+ strconv.Quote(homeColumnKey),
+ strconv.Quote(emailColumnKey),
+ }
+ )
+
+ const (
+ emailMediaType = "Email"
+ voiceMediaType = "Voice"
+ )
+
+ contactListResource := outboundContactList.GenerateOutboundContactList(
+ contactListResourceId,
+ contactListName,
+ util.NullValue,
+ strconv.Quote(cellColumnKey),
+ []string{strconv.Quote(cellColumnKey)},
+ columnNames,
+ util.FalseValue,
+ util.NullValue,
+ util.NullValue,
+ outboundContactList.GenerateEmailColumnsBlock(
+ emailColumnKey,
+ "work",
+ util.NullValue,
+ ),
+ outboundContactList.GeneratePhoneColumnsBlock(
+ cellColumnKey,
+ "cell",
+ strconv.Quote(cellColumnKey),
+ ),
+ outboundContactList.GeneratePhoneColumnsBlock(
+ homeColumnKey,
+ "home",
+ strconv.Quote(cellColumnKey),
+ ),
+ )
+
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { util.TestAccPreCheck(t) },
+ ProviderFactories: provider.GetProviderFactories(providerResources, nil),
+ Steps: []resource.TestStep{
+ {
+ Config: contactListResource + GenerateOutboundContactListContact(
+ resourceId,
+ contactListFullResourceId+".id",
+ util.TrueValue,
+ util.GenerateMapAttrWithMapProperties(
+ "data",
+ map[string]string{
+ cellColumnKey: strconv.Quote(dataCellValue),
+ homeColumnKey: strconv.Quote(dataHomeValue),
+ emailColumnKey: strconv.Quote(dataEmailValue),
+ },
+ ),
+ GeneratePhoneNumberStatus(cellColumnKey, util.FalseValue),
+ GeneratePhoneNumberStatus(homeColumnKey, util.TrueValue),
+ GenerateContactableStatus(
+ voiceMediaType,
+ util.FalseValue, // contactable
+ GenerateColumnStatus(cellColumnKey, util.FalseValue),
+ ),
+ GenerateContactableStatus(
+ emailMediaType,
+ util.TrueValue, // contactable
+ GenerateColumnStatus(emailColumnKey, util.TrueValue),
+ ),
+ ),
+ Check: resource.ComposeTestCheckFunc(
+ resource.TestCheckResourceAttr(fullResourceId, "callable", util.TrueValue),
+ resource.TestCheckResourceAttrPair(fullResourceId, "contact_list_id", contactListFullResourceId, "id"),
+ resource.TestCheckResourceAttr(fullResourceId, "data."+cellColumnKey, dataCellValue),
+ resource.TestCheckResourceAttr(fullResourceId, "data."+homeColumnKey, dataHomeValue),
+ resource.TestCheckResourceAttr(fullResourceId, "data."+emailColumnKey, dataEmailValue),
+ resource.TestCheckResourceAttr(fullResourceId, "phone_number_status.#", "2"),
+ resource.TestCheckResourceAttr(fullResourceId, "phone_number_status.0.key", cellColumnKey),
+ resource.TestCheckResourceAttr(fullResourceId, "phone_number_status.0.callable", util.FalseValue),
+ resource.TestCheckResourceAttr(fullResourceId, "phone_number_status.1.key", homeColumnKey),
+ resource.TestCheckResourceAttr(fullResourceId, "phone_number_status.1.callable", util.TrueValue),
+ resource.TestCheckResourceAttr(fullResourceId, "contactable_status.#", "2"),
+ resource.TestCheckResourceAttr(fullResourceId, "contactable_status.0.media_type", voiceMediaType),
+ resource.TestCheckResourceAttr(fullResourceId, "contactable_status.0.contactable", util.FalseValue),
+ resource.TestCheckResourceAttr(fullResourceId, "contactable_status.0.column_status.0.column", cellColumnKey),
+ resource.TestCheckResourceAttr(fullResourceId, "contactable_status.0.column_status.0.contactable", util.FalseValue),
+ resource.TestCheckResourceAttr(fullResourceId, "contactable_status.1.media_type", emailMediaType),
+ resource.TestCheckResourceAttr(fullResourceId, "contactable_status.1.contactable", util.TrueValue),
+ resource.TestCheckResourceAttr(fullResourceId, "contactable_status.1.column_status.0.column", emailColumnKey),
+ resource.TestCheckResourceAttr(fullResourceId, "contactable_status.1.column_status.0.contactable", util.TrueValue),
+ ),
+ },
+ {
+ // Update
+ Config: contactListResource + GenerateOutboundContactListContact(
+ resourceId,
+ contactListFullResourceId+".id",
+ util.FalseValue,
+ util.GenerateMapAttrWithMapProperties(
+ "data",
+ map[string]string{
+ cellColumnKey: strconv.Quote(dataCellValueUpdated),
+ homeColumnKey: strconv.Quote(dataHomeValueUpdated),
+ emailColumnKey: strconv.Quote(dataEmailValueUpdated),
+ },
+ ),
+ GeneratePhoneNumberStatus(cellColumnKey, util.FalseValue),
+ GeneratePhoneNumberStatus(homeColumnKey, util.TrueValue),
+ GenerateContactableStatus(
+ voiceMediaType,
+ util.FalseValue, // contactable
+ GenerateColumnStatus(cellColumnKey, util.FalseValue),
+ ),
+ GenerateContactableStatus(
+ emailMediaType,
+ util.TrueValue, // contactable
+ GenerateColumnStatus(emailColumnKey, util.TrueValue),
+ ),
+ ),
+ Check: resource.ComposeTestCheckFunc(
+ resource.TestCheckResourceAttr(fullResourceId, "callable", util.FalseValue),
+ resource.TestCheckResourceAttrPair(fullResourceId, "contact_list_id", contactListFullResourceId, "id"),
+ resource.TestCheckResourceAttr(fullResourceId, "data."+cellColumnKey, dataCellValueUpdated),
+ resource.TestCheckResourceAttr(fullResourceId, "data."+homeColumnKey, dataHomeValueUpdated),
+ resource.TestCheckResourceAttr(fullResourceId, "data."+emailColumnKey, dataEmailValueUpdated),
+ resource.TestCheckResourceAttr(fullResourceId, "phone_number_status.#", "2"),
+ resource.TestCheckResourceAttr(fullResourceId, "phone_number_status.0.key", cellColumnKey),
+ resource.TestCheckResourceAttr(fullResourceId, "phone_number_status.0.callable", util.FalseValue),
+ resource.TestCheckResourceAttr(fullResourceId, "phone_number_status.1.key", homeColumnKey),
+ resource.TestCheckResourceAttr(fullResourceId, "phone_number_status.1.callable", util.TrueValue),
+ resource.TestCheckResourceAttr(fullResourceId, "contactable_status.#", "2"),
+ resource.TestCheckResourceAttr(fullResourceId, "contactable_status.0.media_type", voiceMediaType),
+ resource.TestCheckResourceAttr(fullResourceId, "contactable_status.0.contactable", util.FalseValue),
+ resource.TestCheckResourceAttr(fullResourceId, "contactable_status.0.column_status.0.column", cellColumnKey),
+ resource.TestCheckResourceAttr(fullResourceId, "contactable_status.0.column_status.0.contactable", util.FalseValue),
+ resource.TestCheckResourceAttr(fullResourceId, "contactable_status.1.media_type", emailMediaType),
+ resource.TestCheckResourceAttr(fullResourceId, "contactable_status.1.contactable", util.TrueValue),
+ resource.TestCheckResourceAttr(fullResourceId, "contactable_status.1.column_status.0.column", emailColumnKey),
+ resource.TestCheckResourceAttr(fullResourceId, "contactable_status.1.column_status.0.contactable", util.TrueValue),
+ ),
+ },
+ },
+ })
+}
diff --git a/genesyscloud/outbound_contact_list_contact/resource_genesyscloud_outbound_contact_list_contact_utils.go b/genesyscloud/outbound_contact_list_contact/resource_genesyscloud_outbound_contact_list_contact_utils.go
new file mode 100644
index 000000000..797624746
--- /dev/null
+++ b/genesyscloud/outbound_contact_list_contact/resource_genesyscloud_outbound_contact_list_contact_utils.go
@@ -0,0 +1,182 @@
+package outbound_contact_list_contact
+
+import (
+ "fmt"
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
+ "strings"
+ utillists "terraform-provider-genesyscloud/genesyscloud/util/lists"
+ "terraform-provider-genesyscloud/genesyscloud/util/resourcedata"
+)
+
+// buildWritableContactFromResourceData used to build the request body for contact creation
+func buildWritableContactFromResourceData(d *schema.ResourceData) platformclientv2.Writabledialercontact {
+ contactListId := d.Get("contact_list_id").(string)
+ callable := d.Get("callable").(bool)
+
+ var contactRequest = platformclientv2.Writabledialercontact{
+ ContactListId: &contactListId,
+ Callable: &callable,
+ }
+
+ if dataMap, ok := d.Get("data").(map[string]any); ok {
+ stringMap := utillists.ConvertMapStringAnyToMapStringString(dataMap)
+ contactRequest.Data = &stringMap
+ }
+
+ contactRequest.PhoneNumberStatus = buildPhoneNumberStatus(d)
+ contactRequest.ContactableStatus = buildContactableStatus(d)
+ return contactRequest
+}
+
+// buildDialerContactFromResourceData used to build the request body for contact updates
+func buildDialerContactFromResourceData(d *schema.ResourceData) platformclientv2.Dialercontact {
+ contactListId := d.Get("contact_list_id").(string)
+ callable := d.Get("callable").(bool)
+ var contactRequest = platformclientv2.Dialercontact{
+ ContactListId: &contactListId,
+ Callable: &callable,
+ }
+ if dataMap, ok := d.Get("data").(map[string]any); ok {
+ stringMap := utillists.ConvertMapStringAnyToMapStringString(dataMap)
+ contactRequest.Data = &stringMap
+ }
+ contactRequest.PhoneNumberStatus = buildPhoneNumberStatus(d)
+ contactRequest.ContactableStatus = buildContactableStatus(d)
+ return contactRequest
+}
+
+func buildContactableStatus(d *schema.ResourceData) *map[string]platformclientv2.Contactablestatus {
+ contactableStatus, ok := d.Get("contactable_status").(*schema.Set)
+ if !ok {
+ return nil
+ }
+
+ contactableStatusMap := make(map[string]platformclientv2.Contactablestatus)
+
+ contactableStatusList := contactableStatus.List()
+ for _, status := range contactableStatusList {
+ currentStatusMap := status.(map[string]any)
+ mediaType := currentStatusMap["media_type"].(string)
+ contactable := currentStatusMap["contactable"].(bool)
+
+ columnStatusMap := make(map[string]platformclientv2.Columnstatus)
+ if columnStatus, ok := currentStatusMap["column_status"].(*schema.Set); ok {
+ columnStatusList := columnStatus.List()
+ for _, status := range columnStatusList {
+ currentColumnStatusMap := status.(map[string]any)
+ column := currentColumnStatusMap["column"].(string)
+ columnContactable := currentColumnStatusMap["contactable"].(bool)
+ columnStatusMap[column] = platformclientv2.Columnstatus{
+ Contactable: &columnContactable,
+ }
+ }
+ }
+ contactableStatusMap[mediaType] = platformclientv2.Contactablestatus{
+ Contactable: &contactable,
+ ColumnStatus: &columnStatusMap,
+ }
+ }
+
+ return &contactableStatusMap
+}
+
+func buildPhoneNumberStatus(d *schema.ResourceData) *map[string]platformclientv2.Phonenumberstatus {
+ phoneNumberStatus, ok := d.Get("phone_number_status").(*schema.Set)
+ if !ok {
+ return nil
+ }
+
+ phoneNumberStatusMap := make(map[string]platformclientv2.Phonenumberstatus)
+
+ phoneNumberStatusList := phoneNumberStatus.List()
+ for _, status := range phoneNumberStatusList {
+ statusMap := status.(map[string]any)
+ key := statusMap["key"].(string)
+ callable, _ := statusMap["callable"].(bool)
+ phoneNumberStatusMap[key] = platformclientv2.Phonenumberstatus{
+ Callable: &callable,
+ }
+ }
+
+ return &phoneNumberStatusMap
+}
+
+func flattenPhoneNumberStatus(phoneNumberStatus *map[string]platformclientv2.Phonenumberstatus) *schema.Set {
+ pnsSet := schema.NewSet(schema.HashResource(phoneNumberStatusResource), []interface{}{})
+ for k, v := range *phoneNumberStatus {
+ pns := make(map[string]any)
+ pns["key"] = k
+ resourcedata.SetMapValueIfNotNil(pns, "callable", v.Callable)
+ pnsSet.Add(pns)
+ }
+ return pnsSet
+}
+
+func flattenContactableStatus(contactableStatus *map[string]platformclientv2.Contactablestatus) *schema.Set {
+ csSet := schema.NewSet(schema.HashResource(contactableStatusResource), []interface{}{})
+ for k, v := range *contactableStatus {
+ cs := make(map[string]any)
+ cs["media_type"] = k
+ cs["contactable"] = *v.Contactable
+ if v.ColumnStatus != nil {
+ cs["column_status"] = flattenColumnStatus(v.ColumnStatus)
+ }
+ csSet.Add(cs)
+ }
+ return csSet
+}
+
+func flattenColumnStatus(columnStatus *map[string]platformclientv2.Columnstatus) *schema.Set {
+ if columnStatus == nil {
+ return nil
+ }
+ csSet := schema.NewSet(schema.HashResource(columnStatusResource), []interface{}{})
+ for k, v := range *columnStatus {
+ cs := make(map[string]any)
+ cs["column"] = k
+ cs["contactable"] = *v.Contactable
+ csSet.Add(cs)
+ }
+ return csSet
+}
+
+func GenerateOutboundContactListContact(
+ resourceId,
+ contactListId,
+ callable,
+ data string,
+ nestedBlocks ...string,
+) string {
+ return fmt.Sprintf(`resource "%s" "%s" {
+ contact_list_id = %s
+ callable = %s
+ %s
+ %s
+}`, resourceName, resourceId, contactListId, callable, data, strings.Join(nestedBlocks, "\n"))
+}
+
+func GeneratePhoneNumberStatus(key, callable string) string {
+ return fmt.Sprintf(`
+ phone_number_status {
+ key = "%s"
+ callable = %s
+ }`, key, callable)
+}
+
+func GenerateContactableStatus(mediaType, contactable string, nestedBlocks ...string) string {
+ return fmt.Sprintf(`
+ contactable_status {
+ media_type = "%s"
+ contactable = %s
+ %s
+ }`, mediaType, contactable, strings.Join(nestedBlocks, "\n"))
+}
+
+func GenerateColumnStatus(column, contactable string) string {
+ return fmt.Sprintf(`
+ column_status {
+ column = "%s"
+ contactable = %s
+ }`, column, contactable)
+}
diff --git a/genesyscloud/outbound_contactlistfilter/genesyscloud_outbound_contactlistfilter_proxy.go b/genesyscloud/outbound_contactlistfilter/genesyscloud_outbound_contactlistfilter_proxy.go
index c5162898d..b1e9651bb 100644
--- a/genesyscloud/outbound_contactlistfilter/genesyscloud_outbound_contactlistfilter_proxy.go
+++ b/genesyscloud/outbound_contactlistfilter/genesyscloud_outbound_contactlistfilter_proxy.go
@@ -3,7 +3,7 @@ package outbound_contactlistfilter
import (
"context"
"fmt"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"log"
)
diff --git a/genesyscloud/outbound_contactlistfilter/resource_genesyscloud_outbound_contactlistfilter.go b/genesyscloud/outbound_contactlistfilter/resource_genesyscloud_outbound_contactlistfilter.go
index 3949e2513..135ed9a44 100644
--- a/genesyscloud/outbound_contactlistfilter/resource_genesyscloud_outbound_contactlistfilter.go
+++ b/genesyscloud/outbound_contactlistfilter/resource_genesyscloud_outbound_contactlistfilter.go
@@ -6,7 +6,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"log"
"terraform-provider-genesyscloud/genesyscloud/consistency_checker"
"terraform-provider-genesyscloud/genesyscloud/provider"
diff --git a/genesyscloud/outbound_contactlistfilter/resource_genesyscloud_outbound_contactlistfilter_test.go b/genesyscloud/outbound_contactlistfilter/resource_genesyscloud_outbound_contactlistfilter_test.go
index f290bba27..385842ec2 100644
--- a/genesyscloud/outbound_contactlistfilter/resource_genesyscloud_outbound_contactlistfilter_test.go
+++ b/genesyscloud/outbound_contactlistfilter/resource_genesyscloud_outbound_contactlistfilter_test.go
@@ -13,7 +13,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceOutboundContactListFilter(t *testing.T) {
diff --git a/genesyscloud/outbound_contactlistfilter/resource_genesyscloud_outbound_contactlistfilter_utils.go b/genesyscloud/outbound_contactlistfilter/resource_genesyscloud_outbound_contactlistfilter_utils.go
index 72deee21a..ae8aa6042 100644
--- a/genesyscloud/outbound_contactlistfilter/resource_genesyscloud_outbound_contactlistfilter_utils.go
+++ b/genesyscloud/outbound_contactlistfilter/resource_genesyscloud_outbound_contactlistfilter_utils.go
@@ -3,7 +3,7 @@ package outbound_contactlistfilter
import (
"fmt"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"strings"
"terraform-provider-genesyscloud/genesyscloud/util"
"terraform-provider-genesyscloud/genesyscloud/util/resourcedata"
diff --git a/genesyscloud/outbound_dnclist/genesyscloud_outbound_dnclist_proxy.go b/genesyscloud/outbound_dnclist/genesyscloud_outbound_dnclist_proxy.go
index f81b77b47..dc051f755 100644
--- a/genesyscloud/outbound_dnclist/genesyscloud_outbound_dnclist_proxy.go
+++ b/genesyscloud/outbound_dnclist/genesyscloud_outbound_dnclist_proxy.go
@@ -4,7 +4,7 @@ import (
"context"
"fmt"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"log"
"terraform-provider-genesyscloud/genesyscloud/util"
)
diff --git a/genesyscloud/outbound_dnclist/resource_genesyscloud_outbound_dnclist.go b/genesyscloud/outbound_dnclist/resource_genesyscloud_outbound_dnclist.go
index f52c9c23d..5a98e1aa7 100644
--- a/genesyscloud/outbound_dnclist/resource_genesyscloud_outbound_dnclist.go
+++ b/genesyscloud/outbound_dnclist/resource_genesyscloud_outbound_dnclist.go
@@ -18,7 +18,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func getAllOutboundDncLists(ctx context.Context, clientConfig *platformclientv2.Configuration) (resourceExporter.ResourceIDMetaMap, diag.Diagnostics) {
diff --git a/genesyscloud/outbound_dnclist/resource_genesyscloud_outbound_dnclist_schema.go b/genesyscloud/outbound_dnclist/resource_genesyscloud_outbound_dnclist_schema.go
index 85bf567c2..c44abd1c7 100644
--- a/genesyscloud/outbound_dnclist/resource_genesyscloud_outbound_dnclist_schema.go
+++ b/genesyscloud/outbound_dnclist/resource_genesyscloud_outbound_dnclist_schema.go
@@ -6,7 +6,7 @@ import (
"terraform-provider-genesyscloud/genesyscloud/provider"
resourceExporter "terraform-provider-genesyscloud/genesyscloud/resource_exporter"
registrar "terraform-provider-genesyscloud/genesyscloud/resource_register"
- gcloud "terraform-provider-genesyscloud/genesyscloud/validators"
+ "terraform-provider-genesyscloud/genesyscloud/validators"
)
const resourceName = "genesyscloud_outbound_dnclist"
@@ -90,7 +90,7 @@ func ResourceOutboundDncList() *schema.Resource {
Description: `Expiration date for DNC phone numbers in yyyy-MM-ddTHH:mmZ format.`,
Optional: true,
Type: schema.TypeString,
- ValidateDiagFunc: gcloud.ValidateDateTime,
+ ValidateDiagFunc: validators.ValidateDateTime,
},
`phone_numbers`: {
Description: `Phone numbers to add to a DNC list. Only possible if the dncSourceType is rds. Phone numbers must be in an E.164 number format.`,
@@ -98,7 +98,7 @@ func ResourceOutboundDncList() *schema.Resource {
Type: schema.TypeList,
Elem: &schema.Schema{
Type: schema.TypeString,
- ValidateDiagFunc: gcloud.ValidatePhoneNumber,
+ ValidateDiagFunc: validators.ValidatePhoneNumber,
},
},
},
diff --git a/genesyscloud/outbound_dnclist/resource_genesyscloud_outbound_dnclist_test.go b/genesyscloud/outbound_dnclist/resource_genesyscloud_outbound_dnclist_test.go
index aa68d31e3..1eed72464 100644
--- a/genesyscloud/outbound_dnclist/resource_genesyscloud_outbound_dnclist_test.go
+++ b/genesyscloud/outbound_dnclist/resource_genesyscloud_outbound_dnclist_test.go
@@ -12,7 +12,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
const NullValue = "null"
diff --git a/genesyscloud/outbound_filespecificationtemplate/genesyscloud_outbound_filespecificationtemplate_proxy.go b/genesyscloud/outbound_filespecificationtemplate/genesyscloud_outbound_filespecificationtemplate_proxy.go
index 8c313f6c5..189cc266b 100644
--- a/genesyscloud/outbound_filespecificationtemplate/genesyscloud_outbound_filespecificationtemplate_proxy.go
+++ b/genesyscloud/outbound_filespecificationtemplate/genesyscloud_outbound_filespecificationtemplate_proxy.go
@@ -5,7 +5,7 @@ import (
"fmt"
"log"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/outbound_filespecificationtemplate/resource_genesyscloud_outbound_filespecificationtemplate.go b/genesyscloud/outbound_filespecificationtemplate/resource_genesyscloud_outbound_filespecificationtemplate.go
index 6e24fed69..8aaed672a 100644
--- a/genesyscloud/outbound_filespecificationtemplate/resource_genesyscloud_outbound_filespecificationtemplate.go
+++ b/genesyscloud/outbound_filespecificationtemplate/resource_genesyscloud_outbound_filespecificationtemplate.go
@@ -18,7 +18,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func getAllFileSpecificationTemplates(ctx context.Context, clientConfig *platformclientv2.Configuration) (resourceExporter.ResourceIDMetaMap, diag.Diagnostics) {
diff --git a/genesyscloud/outbound_filespecificationtemplate/resource_genesyscloud_outbound_filespecificationtemplate_test.go b/genesyscloud/outbound_filespecificationtemplate/resource_genesyscloud_outbound_filespecificationtemplate_test.go
index e4b4679d5..7e272fa62 100644
--- a/genesyscloud/outbound_filespecificationtemplate/resource_genesyscloud_outbound_filespecificationtemplate_test.go
+++ b/genesyscloud/outbound_filespecificationtemplate/resource_genesyscloud_outbound_filespecificationtemplate_test.go
@@ -12,7 +12,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceOutboundFileSpecificationTemplate(t *testing.T) {
diff --git a/genesyscloud/outbound_filespecificationtemplate/resource_genesyscloud_outbound_filespecificationtemplate_utils.go b/genesyscloud/outbound_filespecificationtemplate/resource_genesyscloud_outbound_filespecificationtemplate_utils.go
index 23e9742bb..f765fa485 100644
--- a/genesyscloud/outbound_filespecificationtemplate/resource_genesyscloud_outbound_filespecificationtemplate_utils.go
+++ b/genesyscloud/outbound_filespecificationtemplate/resource_genesyscloud_outbound_filespecificationtemplate_utils.go
@@ -2,7 +2,7 @@ package outbound_filespecificationtemplate
import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"terraform-provider-genesyscloud/genesyscloud/util/resourcedata"
)
diff --git a/genesyscloud/outbound_ruleset/genesyscloud_outbound_ruleset_proxy.go b/genesyscloud/outbound_ruleset/genesyscloud_outbound_ruleset_proxy.go
index 24fb87044..5e12b64ee 100644
--- a/genesyscloud/outbound_ruleset/genesyscloud_outbound_ruleset_proxy.go
+++ b/genesyscloud/outbound_ruleset/genesyscloud_outbound_ruleset_proxy.go
@@ -6,7 +6,7 @@ import (
"log"
"strings"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/outbound_ruleset/resource_genesyscloud_outbound_ruleset.go b/genesyscloud/outbound_ruleset/resource_genesyscloud_outbound_ruleset.go
index ecac64ea6..37cfa4574 100644
--- a/genesyscloud/outbound_ruleset/resource_genesyscloud_outbound_ruleset.go
+++ b/genesyscloud/outbound_ruleset/resource_genesyscloud_outbound_ruleset.go
@@ -20,7 +20,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/outbound_ruleset/resource_genesyscloud_outbound_ruleset_test.go b/genesyscloud/outbound_ruleset/resource_genesyscloud_outbound_ruleset_test.go
index 18a4b4b31..d25b21570 100644
--- a/genesyscloud/outbound_ruleset/resource_genesyscloud_outbound_ruleset_test.go
+++ b/genesyscloud/outbound_ruleset/resource_genesyscloud_outbound_ruleset_test.go
@@ -12,7 +12,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
obContactList "terraform-provider-genesyscloud/genesyscloud/outbound_contact_list"
)
diff --git a/genesyscloud/outbound_ruleset/resource_genesyscloud_outbound_ruleset_unit_test.go b/genesyscloud/outbound_ruleset/resource_genesyscloud_outbound_ruleset_unit_test.go
index 29f9c322d..d39433a83 100644
--- a/genesyscloud/outbound_ruleset/resource_genesyscloud_outbound_ruleset_unit_test.go
+++ b/genesyscloud/outbound_ruleset/resource_genesyscloud_outbound_ruleset_unit_test.go
@@ -7,7 +7,7 @@ import (
"github.com/stretchr/testify/assert"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestUnitDoesRuleConditionsRefDeletedSkill(t *testing.T) {
diff --git a/genesyscloud/outbound_ruleset/resource_genesyscloud_outbound_ruleset_utils.go b/genesyscloud/outbound_ruleset/resource_genesyscloud_outbound_ruleset_utils.go
index d97906f4e..6266b7a65 100644
--- a/genesyscloud/outbound_ruleset/resource_genesyscloud_outbound_ruleset_utils.go
+++ b/genesyscloud/outbound_ruleset/resource_genesyscloud_outbound_ruleset_utils.go
@@ -9,7 +9,7 @@ import (
"terraform-provider-genesyscloud/genesyscloud/util/resourcedata"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/outbound_sequence/genesyscloud_outbound_sequence_init_test.go b/genesyscloud/outbound_sequence/genesyscloud_outbound_sequence_init_test.go
index 9a1442ada..35029a3e7 100644
--- a/genesyscloud/outbound_sequence/genesyscloud_outbound_sequence_init_test.go
+++ b/genesyscloud/outbound_sequence/genesyscloud_outbound_sequence_init_test.go
@@ -12,7 +12,7 @@ import (
edgeSite "terraform-provider-genesyscloud/genesyscloud/telephony_providers_edges_site"
"testing"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
diff --git a/genesyscloud/outbound_sequence/genesyscloud_outbound_sequence_proxy.go b/genesyscloud/outbound_sequence/genesyscloud_outbound_sequence_proxy.go
index 18068343a..85532bf50 100644
--- a/genesyscloud/outbound_sequence/genesyscloud_outbound_sequence_proxy.go
+++ b/genesyscloud/outbound_sequence/genesyscloud_outbound_sequence_proxy.go
@@ -5,7 +5,7 @@ import (
"fmt"
"log"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/outbound_sequence/resource_genesyscloud_outbound_sequence.go b/genesyscloud/outbound_sequence/resource_genesyscloud_outbound_sequence.go
index d664c7f70..5bb9e88d7 100644
--- a/genesyscloud/outbound_sequence/resource_genesyscloud_outbound_sequence.go
+++ b/genesyscloud/outbound_sequence/resource_genesyscloud_outbound_sequence.go
@@ -12,7 +12,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"terraform-provider-genesyscloud/genesyscloud/consistency_checker"
diff --git a/genesyscloud/outbound_sequence/resource_genesyscloud_outbound_sequence_test.go b/genesyscloud/outbound_sequence/resource_genesyscloud_outbound_sequence_test.go
index 641cebf91..3740a0da7 100644
--- a/genesyscloud/outbound_sequence/resource_genesyscloud_outbound_sequence_test.go
+++ b/genesyscloud/outbound_sequence/resource_genesyscloud_outbound_sequence_test.go
@@ -13,7 +13,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceOutboundSequence(t *testing.T) {
diff --git a/genesyscloud/outbound_sequence/resource_genesyscloud_outbound_sequence_utils.go b/genesyscloud/outbound_sequence/resource_genesyscloud_outbound_sequence_utils.go
index d6bd708b2..3040db3dc 100644
--- a/genesyscloud/outbound_sequence/resource_genesyscloud_outbound_sequence_utils.go
+++ b/genesyscloud/outbound_sequence/resource_genesyscloud_outbound_sequence_utils.go
@@ -6,7 +6,7 @@ import (
"terraform-provider-genesyscloud/genesyscloud/util"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/outbound_settings/genesyscloud_outbound_settings_proxy.go b/genesyscloud/outbound_settings/genesyscloud_outbound_settings_proxy.go
index 7b61cb047..1c30b0a12 100644
--- a/genesyscloud/outbound_settings/genesyscloud_outbound_settings_proxy.go
+++ b/genesyscloud/outbound_settings/genesyscloud_outbound_settings_proxy.go
@@ -3,7 +3,7 @@ package outbound_settings
import (
"context"
"fmt"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/outbound_settings/resource_genesyscloud_outbound_settings.go b/genesyscloud/outbound_settings/resource_genesyscloud_outbound_settings.go
index c3e08b656..0febb5174 100644
--- a/genesyscloud/outbound_settings/resource_genesyscloud_outbound_settings.go
+++ b/genesyscloud/outbound_settings/resource_genesyscloud_outbound_settings.go
@@ -6,7 +6,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"log"
"terraform-provider-genesyscloud/genesyscloud/consistency_checker"
"terraform-provider-genesyscloud/genesyscloud/provider"
diff --git a/genesyscloud/outbound_settings/resource_genesyscloud_outbound_settings_schema.go b/genesyscloud/outbound_settings/resource_genesyscloud_outbound_settings_schema.go
index 89853a623..e013606ec 100644
--- a/genesyscloud/outbound_settings/resource_genesyscloud_outbound_settings_schema.go
+++ b/genesyscloud/outbound_settings/resource_genesyscloud_outbound_settings_schema.go
@@ -6,7 +6,7 @@ import (
"terraform-provider-genesyscloud/genesyscloud/provider"
resourceExporter "terraform-provider-genesyscloud/genesyscloud/resource_exporter"
registrar "terraform-provider-genesyscloud/genesyscloud/resource_register"
- gcloud "terraform-provider-genesyscloud/genesyscloud/validators"
+ "terraform-provider-genesyscloud/genesyscloud/validators"
)
/*
@@ -67,13 +67,13 @@ var (
`earliest_callable_time`: {
Description: "The earliest time to dial a contact. Valid format is HH:mm",
Optional: true,
- ValidateDiagFunc: gcloud.ValidateTimeHHMM,
+ ValidateDiagFunc: validators.ValidateTimeHHMM,
Type: schema.TypeString,
},
`latest_callable_time`: {
Description: "The latest time to dial a contact. Valid format is HH:mm.",
Optional: true,
- ValidateDiagFunc: gcloud.ValidateTimeHHMM,
+ ValidateDiagFunc: validators.ValidateTimeHHMM,
Type: schema.TypeString,
},
},
@@ -83,13 +83,13 @@ var (
`earliest_callable_time`: {
Description: "The earliest time to dial a contact. Valid format is HH:mm.",
Optional: true,
- ValidateDiagFunc: gcloud.ValidateTimeHHMM,
+ ValidateDiagFunc: validators.ValidateTimeHHMM,
Type: schema.TypeString,
},
`latest_callable_time`: {
Description: "The latest time to dial a contact. Valid format is HH:mm.",
Optional: true,
- ValidateDiagFunc: gcloud.ValidateTimeHHMM,
+ ValidateDiagFunc: validators.ValidateTimeHHMM,
Type: schema.TypeString,
},
`time_zone_id`: {
diff --git a/genesyscloud/outbound_settings/resource_genesyscloud_outbound_settings_utils.go b/genesyscloud/outbound_settings/resource_genesyscloud_outbound_settings_utils.go
index 3a277589a..06c3989a6 100644
--- a/genesyscloud/outbound_settings/resource_genesyscloud_outbound_settings_utils.go
+++ b/genesyscloud/outbound_settings/resource_genesyscloud_outbound_settings_utils.go
@@ -2,7 +2,7 @@ package outbound_settings
import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"terraform-provider-genesyscloud/genesyscloud/tfexporter_state"
"terraform-provider-genesyscloud/genesyscloud/util/lists"
"terraform-provider-genesyscloud/genesyscloud/util/resourcedata"
diff --git a/genesyscloud/outbound_wrapupcode_mappings/genesyscloud_wrapupcode_mappings_proxy.go b/genesyscloud/outbound_wrapupcode_mappings/genesyscloud_wrapupcode_mappings_proxy.go
index 81986c753..16e688455 100644
--- a/genesyscloud/outbound_wrapupcode_mappings/genesyscloud_wrapupcode_mappings_proxy.go
+++ b/genesyscloud/outbound_wrapupcode_mappings/genesyscloud_wrapupcode_mappings_proxy.go
@@ -4,7 +4,7 @@ import (
"context"
"fmt"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
var internalProxy *outboundWrapupCodeMappingsProxy
diff --git a/genesyscloud/outbound_wrapupcode_mappings/resource_genesyscloud_outbound_wrapupcode_mappings_utils.go b/genesyscloud/outbound_wrapupcode_mappings/resource_genesyscloud_outbound_wrapupcode_mappings_utils.go
index 4140f32af..1785d9808 100644
--- a/genesyscloud/outbound_wrapupcode_mappings/resource_genesyscloud_outbound_wrapupcode_mappings_utils.go
+++ b/genesyscloud/outbound_wrapupcode_mappings/resource_genesyscloud_outbound_wrapupcode_mappings_utils.go
@@ -4,7 +4,7 @@ import (
lists "terraform-provider-genesyscloud/genesyscloud/util/lists"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
// flattenOutboundWrapupCodeMappings maps a Genesys Cloud Wrapupcodemapping to a schema.Set
diff --git a/genesyscloud/outbound_wrapupcode_mappings/resource_genesyscloud_outbound_wrapupcodemappings.go b/genesyscloud/outbound_wrapupcode_mappings/resource_genesyscloud_outbound_wrapupcodemappings.go
index 97d6d62b5..cccca5eb1 100644
--- a/genesyscloud/outbound_wrapupcode_mappings/resource_genesyscloud_outbound_wrapupcodemappings.go
+++ b/genesyscloud/outbound_wrapupcode_mappings/resource_genesyscloud_outbound_wrapupcodemappings.go
@@ -19,7 +19,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
// getOutboundWrapupCodeMappings is used by the exporter to return all wrapupcode mappings
diff --git a/genesyscloud/process_automation_trigger/data_source_genesyscloud_processautomation_trigger.go b/genesyscloud/process_automation_trigger/data_source_genesyscloud_processautomation_trigger.go
index 389f39a84..0a8ee565b 100644
--- a/genesyscloud/process_automation_trigger/data_source_genesyscloud_processautomation_trigger.go
+++ b/genesyscloud/process_automation_trigger/data_source_genesyscloud_processautomation_trigger.go
@@ -14,7 +14,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
type ProcessAutomationTriggers struct {
diff --git a/genesyscloud/process_automation_trigger/process_automation_triggers_proxy.go b/genesyscloud/process_automation_trigger/process_automation_triggers_proxy.go
index 8bf04955e..3f6b07371 100644
--- a/genesyscloud/process_automation_trigger/process_automation_triggers_proxy.go
+++ b/genesyscloud/process_automation_trigger/process_automation_triggers_proxy.go
@@ -11,7 +11,7 @@ import (
"terraform-provider-genesyscloud/genesyscloud/util"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func postProcessAutomationTrigger(pat *ProcessAutomationTrigger, api *platformclientv2.IntegrationsApi) (*ProcessAutomationTrigger, *platformclientv2.APIResponse, error) {
diff --git a/genesyscloud/process_automation_trigger/process_automations_triggers_struct.go b/genesyscloud/process_automation_trigger/process_automations_triggers_struct.go
index 8da8c63f1..539b80dfd 100644
--- a/genesyscloud/process_automation_trigger/process_automations_triggers_struct.go
+++ b/genesyscloud/process_automation_trigger/process_automations_triggers_struct.go
@@ -3,7 +3,7 @@ package process_automation_trigger
import (
"encoding/json"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
type ProcessAutomationTrigger struct {
diff --git a/genesyscloud/process_automation_trigger/resource_genesyscloud_processautomation_trigger.go b/genesyscloud/process_automation_trigger/resource_genesyscloud_processautomation_trigger.go
index 440ce5d31..b6878f8a7 100644
--- a/genesyscloud/process_automation_trigger/resource_genesyscloud_processautomation_trigger.go
+++ b/genesyscloud/process_automation_trigger/resource_genesyscloud_processautomation_trigger.go
@@ -12,7 +12,7 @@ import (
"time"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"terraform-provider-genesyscloud/genesyscloud/consistency_checker"
diff --git a/genesyscloud/process_automation_trigger/resource_genesyscloud_processautomation_trigger_test.go b/genesyscloud/process_automation_trigger/resource_genesyscloud_processautomation_trigger_test.go
index fb52c29d8..e2905376f 100644
--- a/genesyscloud/process_automation_trigger/resource_genesyscloud_processautomation_trigger_test.go
+++ b/genesyscloud/process_automation_trigger/resource_genesyscloud_processautomation_trigger_test.go
@@ -13,7 +13,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceProcessAutomationTrigger(t *testing.T) {
diff --git a/genesyscloud/provider/division.go b/genesyscloud/provider/division.go
index 5af549cd9..9fefad4a8 100644
--- a/genesyscloud/provider/division.go
+++ b/genesyscloud/provider/division.go
@@ -2,7 +2,7 @@ package provider
import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"sync"
)
diff --git a/genesyscloud/provider/provider.go b/genesyscloud/provider/provider.go
index fc81e413b..346a29ffb 100644
--- a/genesyscloud/provider/provider.go
+++ b/genesyscloud/provider/provider.go
@@ -15,7 +15,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func init() {
diff --git a/genesyscloud/provider/sdk_client_pool.go b/genesyscloud/provider/sdk_client_pool.go
index 9b35c831a..0123f541c 100644
--- a/genesyscloud/provider/sdk_client_pool.go
+++ b/genesyscloud/provider/sdk_client_pool.go
@@ -8,7 +8,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
// SDKClientPool holds a Pool of client configs for the Genesys Cloud SDK. One should be
diff --git a/genesyscloud/recording_media_retention_policy/genesyscloud_recording_media_retention_policy_init_test.go b/genesyscloud/recording_media_retention_policy/genesyscloud_recording_media_retention_policy_init_test.go
index aed83d2de..35700f2f1 100644
--- a/genesyscloud/recording_media_retention_policy/genesyscloud_recording_media_retention_policy_init_test.go
+++ b/genesyscloud/recording_media_retention_policy/genesyscloud_recording_media_retention_policy_init_test.go
@@ -14,7 +14,7 @@ import (
"testing"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/recording_media_retention_policy/genesyscloud_recording_media_retention_policy_proxy.go b/genesyscloud/recording_media_retention_policy/genesyscloud_recording_media_retention_policy_proxy.go
index a5bfe82fa..345294b53 100644
--- a/genesyscloud/recording_media_retention_policy/genesyscloud_recording_media_retention_policy_proxy.go
+++ b/genesyscloud/recording_media_retention_policy/genesyscloud_recording_media_retention_policy_proxy.go
@@ -4,9 +4,10 @@ import (
"context"
"encoding/json"
"fmt"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
"net/http"
"net/url"
+
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/recording_media_retention_policy/resource_genesyscloud_recording_media_retention_policy.go b/genesyscloud/recording_media_retention_policy/resource_genesyscloud_recording_media_retention_policy.go
index 53249f037..fc0777536 100644
--- a/genesyscloud/recording_media_retention_policy/resource_genesyscloud_recording_media_retention_policy.go
+++ b/genesyscloud/recording_media_retention_policy/resource_genesyscloud_recording_media_retention_policy.go
@@ -19,7 +19,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/recording_media_retention_policy/resource_genesyscloud_recording_media_retention_policy_test.go b/genesyscloud/recording_media_retention_policy/resource_genesyscloud_recording_media_retention_policy_test.go
index fe42d0576..0c1b4c0a8 100644
--- a/genesyscloud/recording_media_retention_policy/resource_genesyscloud_recording_media_retention_policy_test.go
+++ b/genesyscloud/recording_media_retention_policy/resource_genesyscloud_recording_media_retention_policy_test.go
@@ -22,7 +22,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/recording_media_retention_policy/resource_genesyscloud_recording_media_retention_policy_utils.go b/genesyscloud/recording_media_retention_policy/resource_genesyscloud_recording_media_retention_policy_utils.go
index 8df77ba79..62037798c 100644
--- a/genesyscloud/recording_media_retention_policy/resource_genesyscloud_recording_media_retention_policy_utils.go
+++ b/genesyscloud/recording_media_retention_policy/resource_genesyscloud_recording_media_retention_policy_utils.go
@@ -10,7 +10,7 @@ import (
"terraform-provider-genesyscloud/genesyscloud/util/resourcedata"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/resource_cache/datasource_cache.go b/genesyscloud/resource_cache/datasource_cache.go
index e430e8731..20559e103 100644
--- a/genesyscloud/resource_cache/datasource_cache.go
+++ b/genesyscloud/resource_cache/datasource_cache.go
@@ -8,7 +8,7 @@ import (
"terraform-provider-genesyscloud/genesyscloud/util"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
// Cache for Data Sources
diff --git a/genesyscloud/resource_exporter/resource_exporter.go b/genesyscloud/resource_exporter/resource_exporter.go
index 3bf86c666..81d28fbd1 100644
--- a/genesyscloud/resource_exporter/resource_exporter.go
+++ b/genesyscloud/resource_exporter/resource_exporter.go
@@ -5,7 +5,7 @@ import (
"github.com/hashicorp/go-cty/cty"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"regexp"
"strings"
"sync"
@@ -103,6 +103,10 @@ type ResourceExporter struct {
// By default zero values are removed from the config due to lack of "null" support in the plugin SDK
AllowZeroValues []string
+ // AllowZeroValuesInMap is a list of attributes that are maps. Adding a map attribute to this list indicates to
+ // the exporter that the values within said map should not be cleaned up if they are zero values
+ AllowZeroValuesInMap []string
+
// AllowEmptyArrays is a list of List attributes that should allow empty arrays in export.
// By default, empty arrays are removed but some array attributes may be required in the schema
// or depending on the API behavior better presented explicitly in the API as empty arrays.
@@ -195,6 +199,10 @@ func (r *ResourceExporter) AllowForZeroValues(attribute string) bool {
return lists.ItemInSlice(attribute, r.AllowZeroValues)
}
+func (r *ResourceExporter) AllowForZeroValuesInMap(attribute string) bool {
+ return lists.ItemInSlice(attribute, r.AllowZeroValuesInMap)
+}
+
func (r *ResourceExporter) AllowForEmptyArrays(attribute string) bool {
return lists.ItemInSlice(attribute, r.AllowEmptyArrays)
}
diff --git a/genesyscloud/resource_exporter/resource_exporter_custom.go b/genesyscloud/resource_exporter/resource_exporter_custom.go
index a017efc15..70c976f12 100644
--- a/genesyscloud/resource_exporter/resource_exporter_custom.go
+++ b/genesyscloud/resource_exporter/resource_exporter_custom.go
@@ -3,7 +3,7 @@ package resource_exporter
import (
"encoding/json"
"fmt"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"log"
"regexp"
"strings"
@@ -139,7 +139,8 @@ This customer custom router will look at the skills array if present and resolve
func RuleSetSkillPropertyResolver(configMap map[string]interface{}, exporters map[string]*ResourceExporter, resourceName string) error {
if exporter, ok := exporters["genesyscloud_routing_skill"]; ok {
- skillIDs := configMap["skills"].(string)
+
+ skillIDs, _ := configMap["skills"].(string)
if len(skillIDs) == 0 {
return nil
@@ -192,7 +193,8 @@ func CampaignStatusResolver(configMap map[string]interface{}, exporters map[stri
}
func ReplyEmailAddressSelfReferenceRouteExporterResolver(configMap map[string]interface{}, exporters map[string]*ResourceExporter, resourceName string) error {
- routeId := configMap["route_id"].(string)
+
+ routeId, _ := configMap["route_id"].(string)
currentRouteReference := fmt.Sprintf("${genesyscloud_routing_email_route.%s.id}", resourceName)
if routeId == currentRouteReference {
configMap["self_reference_route"] = true
diff --git a/genesyscloud/resource_genesyscloud_architect_schedules.go b/genesyscloud/resource_genesyscloud_architect_schedules.go
index 2b8184874..e8feb700c 100644
--- a/genesyscloud/resource_genesyscloud_architect_schedules.go
+++ b/genesyscloud/resource_genesyscloud_architect_schedules.go
@@ -20,7 +20,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/leekchan/timeutil"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func getAllArchitectSchedules(_ context.Context, clientConfig *platformclientv2.Configuration) (resourceExporter.ResourceIDMetaMap, diag.Diagnostics) {
diff --git a/genesyscloud/resource_genesyscloud_auth_division.go b/genesyscloud/resource_genesyscloud_auth_division.go
index 7c0fe5745..557ba05d2 100644
--- a/genesyscloud/resource_genesyscloud_auth_division.go
+++ b/genesyscloud/resource_genesyscloud_auth_division.go
@@ -17,7 +17,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func getAllAuthDivisions(_ context.Context, clientConfig *platformclientv2.Configuration) (resourceExporter.ResourceIDMetaMap, diag.Diagnostics) {
diff --git a/genesyscloud/resource_genesyscloud_auth_division_test.go b/genesyscloud/resource_genesyscloud_auth_division_test.go
index 033097f4c..cebf83c42 100644
--- a/genesyscloud/resource_genesyscloud_auth_division_test.go
+++ b/genesyscloud/resource_genesyscloud_auth_division_test.go
@@ -13,7 +13,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceAuthDivisionBasic(t *testing.T) {
@@ -30,6 +30,9 @@ func TestAccResourceAuthDivisionBasic(t *testing.T) {
ProviderFactories: provider.GetProviderFactories(providerResources, providerDataSources),
Steps: []resource.TestStep{
{
+ PreConfig: func() {
+ time.Sleep(30 * time.Second)
+ },
// Create
Config: GenerateAuthDivisionResource(
divResource1,
diff --git a/genesyscloud/resource_genesyscloud_idp_generic.go b/genesyscloud/resource_genesyscloud_idp_generic.go
index e56c62d0f..8db0dad77 100644
--- a/genesyscloud/resource_genesyscloud_idp_generic.go
+++ b/genesyscloud/resource_genesyscloud_idp_generic.go
@@ -19,7 +19,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func getAllIdpGeneric(_ context.Context, clientConfig *platformclientv2.Configuration) (resourceExporter.ResourceIDMetaMap, diag.Diagnostics) {
diff --git a/genesyscloud/resource_genesyscloud_idp_generic_test.go b/genesyscloud/resource_genesyscloud_idp_generic_test.go
index a78c79e70..6043d440d 100644
--- a/genesyscloud/resource_genesyscloud_idp_generic_test.go
+++ b/genesyscloud/resource_genesyscloud_idp_generic_test.go
@@ -9,7 +9,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceIdpGeneric(t *testing.T) {
diff --git a/genesyscloud/resource_genesyscloud_idp_gsuite.go b/genesyscloud/resource_genesyscloud_idp_gsuite.go
index 007c6b272..75a412cdc 100644
--- a/genesyscloud/resource_genesyscloud_idp_gsuite.go
+++ b/genesyscloud/resource_genesyscloud_idp_gsuite.go
@@ -18,7 +18,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func getAllIdpGsuite(_ context.Context, clientConfig *platformclientv2.Configuration) (resourceExporter.ResourceIDMetaMap, diag.Diagnostics) {
diff --git a/genesyscloud/resource_genesyscloud_idp_gsuite_test.go b/genesyscloud/resource_genesyscloud_idp_gsuite_test.go
index 3878a5764..38e02fab6 100644
--- a/genesyscloud/resource_genesyscloud_idp_gsuite_test.go
+++ b/genesyscloud/resource_genesyscloud_idp_gsuite_test.go
@@ -9,7 +9,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceIdpGsuite(t *testing.T) {
diff --git a/genesyscloud/resource_genesyscloud_idp_onelogin.go b/genesyscloud/resource_genesyscloud_idp_onelogin.go
index 08a92192f..8191969da 100644
--- a/genesyscloud/resource_genesyscloud_idp_onelogin.go
+++ b/genesyscloud/resource_genesyscloud_idp_onelogin.go
@@ -18,7 +18,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func getAllIdpOnelogin(_ context.Context, clientConfig *platformclientv2.Configuration) (resourceExporter.ResourceIDMetaMap, diag.Diagnostics) {
diff --git a/genesyscloud/resource_genesyscloud_idp_onelogin_test.go b/genesyscloud/resource_genesyscloud_idp_onelogin_test.go
index 023d7df55..fcd55469b 100644
--- a/genesyscloud/resource_genesyscloud_idp_onelogin_test.go
+++ b/genesyscloud/resource_genesyscloud_idp_onelogin_test.go
@@ -9,7 +9,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceIdpOnelogin(t *testing.T) {
diff --git a/genesyscloud/resource_genesyscloud_idp_ping.go b/genesyscloud/resource_genesyscloud_idp_ping.go
index 64a5140a1..5be98daf0 100644
--- a/genesyscloud/resource_genesyscloud_idp_ping.go
+++ b/genesyscloud/resource_genesyscloud_idp_ping.go
@@ -18,7 +18,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func getAllIdpPing(_ context.Context, clientConfig *platformclientv2.Configuration) (resourceExporter.ResourceIDMetaMap, diag.Diagnostics) {
diff --git a/genesyscloud/resource_genesyscloud_idp_ping_test.go b/genesyscloud/resource_genesyscloud_idp_ping_test.go
index d87e59944..1211c8230 100644
--- a/genesyscloud/resource_genesyscloud_idp_ping_test.go
+++ b/genesyscloud/resource_genesyscloud_idp_ping_test.go
@@ -9,7 +9,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceIdpPing(t *testing.T) {
diff --git a/genesyscloud/resource_genesyscloud_init.go b/genesyscloud/resource_genesyscloud_init.go
index 8ca8476fa..d526a8439 100644
--- a/genesyscloud/resource_genesyscloud_init.go
+++ b/genesyscloud/resource_genesyscloud_init.go
@@ -30,11 +30,9 @@ func registerDataSources(l registrar.Registrar) {
l.RegisterDataSource("genesyscloud_quality_forms_evaluation", DataSourceQualityFormsEvaluations())
l.RegisterDataSource("genesyscloud_quality_forms_survey", dataSourceQualityFormsSurvey())
l.RegisterDataSource("genesyscloud_routing_language", dataSourceRoutingLanguage())
- l.RegisterDataSource("genesyscloud_routing_settings", dataSourceRoutingSettings())
l.RegisterDataSource("genesyscloud_routing_skill", dataSourceRoutingSkill())
l.RegisterDataSource("genesyscloud_routing_skill_group", dataSourceRoutingSkillGroup())
l.RegisterDataSource("genesyscloud_routing_email_domain", DataSourceRoutingEmailDomain())
- l.RegisterDataSource("genesyscloud_routing_utilization_label", dataSourceRoutingUtilizationLabel())
l.RegisterDataSource("genesyscloud_routing_wrapupcode", DataSourceRoutingWrapupcode())
l.RegisterDataSource("genesyscloud_user", DataSourceUser())
l.RegisterDataSource("genesyscloud_widget_deployment", dataSourceWidgetDeployments())
@@ -66,9 +64,6 @@ func registerResources(l registrar.Registrar) {
l.RegisterResource("genesyscloud_routing_language", ResourceRoutingLanguage())
l.RegisterResource("genesyscloud_routing_skill", ResourceRoutingSkill())
l.RegisterResource("genesyscloud_routing_skill_group", ResourceRoutingSkillGroup())
- l.RegisterResource("genesyscloud_routing_settings", ResourceRoutingSettings())
- l.RegisterResource("genesyscloud_routing_utilization", ResourceRoutingUtilization())
- l.RegisterResource("genesyscloud_routing_utilization_label", ResourceRoutingUtilizationLabel())
l.RegisterResource("genesyscloud_routing_wrapupcode", ResourceRoutingWrapupCode())
l.RegisterResource("genesyscloud_user", ResourceUser())
l.RegisterResource("genesyscloud_widget_deployment", ResourceWidgetDeployment())
@@ -93,11 +88,8 @@ func registerExporters(l registrar.Registrar) {
l.RegisterExporter("genesyscloud_quality_forms_survey", SurveyFormExporter())
l.RegisterExporter("genesyscloud_routing_email_domain", RoutingEmailDomainExporter())
l.RegisterExporter("genesyscloud_routing_language", RoutingLanguageExporter())
- l.RegisterExporter("genesyscloud_routing_settings", RoutingSettingsExporter())
l.RegisterExporter("genesyscloud_routing_skill", RoutingSkillExporter())
l.RegisterExporter("genesyscloud_routing_skill_group", ResourceSkillGroupExporter())
- l.RegisterExporter("genesyscloud_routing_utilization", RoutingUtilizationExporter())
- l.RegisterExporter("genesyscloud_routing_utilization_label", RoutingUtilizationLabelExporter())
l.RegisterExporter("genesyscloud_routing_wrapupcode", RoutingWrapupCodeExporter())
l.RegisterExporter("genesyscloud_user", UserExporter())
l.RegisterExporter("genesyscloud_widget_deployment", WidgetDeploymentExporter())
diff --git a/genesyscloud/resource_genesyscloud_init_test.go b/genesyscloud/resource_genesyscloud_init_test.go
index 0988af4f8..79c141fed 100644
--- a/genesyscloud/resource_genesyscloud_init_test.go
+++ b/genesyscloud/resource_genesyscloud_init_test.go
@@ -9,10 +9,13 @@ import (
"terraform-provider-genesyscloud/genesyscloud/group"
"terraform-provider-genesyscloud/genesyscloud/provider"
routingQueue "terraform-provider-genesyscloud/genesyscloud/routing_queue"
+ routingSettings "terraform-provider-genesyscloud/genesyscloud/routing_settings"
+ routingUtilization "terraform-provider-genesyscloud/genesyscloud/routing_utilization"
+ routingUtilizationLabel "terraform-provider-genesyscloud/genesyscloud/routing_utilization_label"
"testing"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
var (
@@ -58,14 +61,14 @@ func (r *registerTestInstance) registerTestResources() {
providerResources["genesyscloud_routing_language"] = ResourceRoutingLanguage()
providerResources["genesyscloud_routing_skill"] = ResourceRoutingSkill()
providerResources["genesyscloud_routing_skill_group"] = ResourceRoutingSkillGroup()
- providerResources["genesyscloud_routing_settings"] = ResourceRoutingSettings()
- providerResources["genesyscloud_routing_utilization"] = ResourceRoutingUtilization()
- providerResources["genesyscloud_routing_utilization_label"] = ResourceRoutingUtilizationLabel()
+ providerResources["genesyscloud_routing_settings"] = routingSettings.ResourceRoutingSettings()
+ providerResources["genesyscloud_routing_utilization"] = routingUtilization.ResourceRoutingUtilization()
providerResources["genesyscloud_routing_wrapupcode"] = ResourceRoutingWrapupCode()
providerResources["genesyscloud_user"] = ResourceUser()
providerResources["genesyscloud_widget_deployment"] = ResourceWidgetDeployment()
providerResources["genesyscloud_architect_schedulegroups"] = archScheduleGroup.ResourceArchitectSchedulegroups()
providerResources["genesyscloud_architect_schedules"] = architectSchedules.ResourceArchitectSchedules()
+ providerResources["genesyscloud_routing_utilization_label"] = routingUtilizationLabel.ResourceRoutingUtilizationLabel()
}
@@ -94,15 +97,13 @@ func (r *registerTestInstance) registerTestDataSources() {
providerDataSources["genesyscloud_quality_forms_evaluation"] = DataSourceQualityFormsEvaluations()
providerDataSources["genesyscloud_quality_forms_survey"] = dataSourceQualityFormsSurvey()
providerDataSources["genesyscloud_routing_language"] = dataSourceRoutingLanguage()
- providerDataSources["genesyscloud_routing_settings"] = dataSourceRoutingSettings()
providerDataSources["genesyscloud_routing_skill"] = dataSourceRoutingSkill()
providerDataSources["genesyscloud_routing_skill_group"] = dataSourceRoutingSkillGroup()
providerDataSources["genesyscloud_routing_email_domain"] = DataSourceRoutingEmailDomain()
- providerDataSources["genesyscloud_routing_utilization_label"] = dataSourceRoutingUtilizationLabel()
providerDataSources["genesyscloud_routing_wrapupcode"] = DataSourceRoutingWrapupcode()
providerDataSources["genesyscloud_user"] = DataSourceUser()
providerDataSources["genesyscloud_widget_deployment"] = dataSourceWidgetDeployments()
-
+ providerResources["genesyscloud_routing_utilization_label"] = routingUtilizationLabel.DataSourceRoutingUtilizationLabel()
}
func initTestResources() {
diff --git a/genesyscloud/resource_genesyscloud_journey_action_map.go b/genesyscloud/resource_genesyscloud_journey_action_map.go
index 76db967b7..7e1c583f0 100644
--- a/genesyscloud/resource_genesyscloud_journey_action_map.go
+++ b/genesyscloud/resource_genesyscloud_journey_action_map.go
@@ -25,7 +25,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
var (
diff --git a/genesyscloud/resource_genesyscloud_journey_action_map_test.go b/genesyscloud/resource_genesyscloud_journey_action_map_test.go
index f0753a13e..22fa108ea 100644
--- a/genesyscloud/resource_genesyscloud_journey_action_map_test.go
+++ b/genesyscloud/resource_genesyscloud_journey_action_map_test.go
@@ -14,7 +14,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
const resourceName = "genesyscloud_journey_action_map"
diff --git a/genesyscloud/resource_genesyscloud_journey_action_template.go b/genesyscloud/resource_genesyscloud_journey_action_template.go
index 243f1d4bb..ecd418113 100644
--- a/genesyscloud/resource_genesyscloud_journey_action_template.go
+++ b/genesyscloud/resource_genesyscloud_journey_action_template.go
@@ -21,7 +21,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
var (
diff --git a/genesyscloud/resource_genesyscloud_journey_action_template_test.go b/genesyscloud/resource_genesyscloud_journey_action_template_test.go
index ae33a8b3b..dd0cc9444 100644
--- a/genesyscloud/resource_genesyscloud_journey_action_template_test.go
+++ b/genesyscloud/resource_genesyscloud_journey_action_template_test.go
@@ -12,7 +12,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
const ActionTemplateResourceName = "genesyscloud_journey_action_template"
diff --git a/genesyscloud/resource_genesyscloud_journey_outcome.go b/genesyscloud/resource_genesyscloud_journey_outcome.go
index 8e163d2bd..40a1019ff 100644
--- a/genesyscloud/resource_genesyscloud_journey_outcome.go
+++ b/genesyscloud/resource_genesyscloud_journey_outcome.go
@@ -22,7 +22,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
var (
diff --git a/genesyscloud/resource_genesyscloud_journey_outcome_test.go b/genesyscloud/resource_genesyscloud_journey_outcome_test.go
index 77fc9ba2f..5f52a59bd 100644
--- a/genesyscloud/resource_genesyscloud_journey_outcome_test.go
+++ b/genesyscloud/resource_genesyscloud_journey_outcome_test.go
@@ -12,7 +12,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceJourneyOutcome(t *testing.T) {
diff --git a/genesyscloud/resource_genesyscloud_journey_segment.go b/genesyscloud/resource_genesyscloud_journey_segment.go
index 579f2c9ba..453d1191e 100644
--- a/genesyscloud/resource_genesyscloud_journey_segment.go
+++ b/genesyscloud/resource_genesyscloud_journey_segment.go
@@ -22,7 +22,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
var (
@@ -53,7 +53,7 @@ var (
}(), ""),
},
"scope": {
- Description: "The target entity that a segment applies to.Valid values: Session, Customer. Changing the scope attribute will cause the existing journey_segment to be dropped and recreated with new ID.",
+ Description: "The target entity that a segment applies to. Valid values: Session",
Type: schema.TypeString,
Required: true,
ForceNew: true, // scope can be only set during creation
@@ -63,7 +63,6 @@ var (
Description: "Whether or not the segment should be displayed to agent/supervisor users.",
Type: schema.TypeBool,
Optional: true,
- // Customer scope only supports false for this value
},
"context": {
Description: "The context of the segment.",
diff --git a/genesyscloud/resource_genesyscloud_journey_segment_test.go b/genesyscloud/resource_genesyscloud_journey_segment_test.go
index 165aa683b..7e0946b52 100644
--- a/genesyscloud/resource_genesyscloud_journey_segment_test.go
+++ b/genesyscloud/resource_genesyscloud_journey_segment_test.go
@@ -2,7 +2,6 @@ package genesyscloud
import (
"fmt"
- "github.com/google/uuid"
"log"
"strings"
"terraform-provider-genesyscloud/genesyscloud/provider"
@@ -13,15 +12,11 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
-func TestAccResourceJourneySegmentCustomer(t *testing.T) {
- runResourceJourneySegmentTestCase(t, "basic_customer_attributes")
-}
-
-func TestAccResourceJourneySegmentSession(t *testing.T) {
- runResourceJourneySegmentTestCase(t, "basic_session_attributes")
+func TestAccResourceJourneySegment(t *testing.T) {
+ runResourceJourneySegmentTestCase(t, "basic_attributes")
}
func TestAccResourceJourneySegmentContextOnly(t *testing.T) {
@@ -56,30 +51,36 @@ func setupJourneySegment(t *testing.T, testCaseName string) {
func cleanupJourneySegments(idPrefix string) {
journeyApi := platformclientv2.NewJourneyApiWithConfig(sdkConfig)
- pageCount := 1 // Needed because of broken journey common paging
- for pageNum := 1; pageNum <= pageCount; pageNum++ {
- const pageSize = 100
+ segmentsToDelete := make([]platformclientv2.Journeysegment, 0)
+
+ // go through all segments to find those to delete
+ const pageSize = 200
+ for pageNum := 1; ; pageNum++ {
journeySegments, _, getErr := journeyApi.GetJourneySegments("", pageSize, pageNum, true, nil, nil, "")
if getErr != nil {
+ log.Printf("failed to get page %v of journeySegments: %v", pageNum, getErr)
return
}
- if journeySegments.Entities == nil || len(*journeySegments.Entities) == 0 {
- break
- }
-
for _, journeySegment := range *journeySegments.Entities {
if journeySegment.DisplayName != nil && strings.HasPrefix(*journeySegment.DisplayName, idPrefix) {
- _, delErr := journeyApi.DeleteJourneySegment(*journeySegment.Id)
- if delErr != nil {
- util.BuildDiagnosticError("genesyscloud_journey_segment", fmt.Sprintf("failed to delete journey segment %s (%s)", *journeySegment.Id, *journeySegment.DisplayName), delErr)
- return
- }
- log.Printf("Deleted journey segment %s (%s)", *journeySegment.Id, *journeySegment.DisplayName)
+ segmentsToDelete = append(segmentsToDelete, journeySegment)
}
}
- pageCount = *journeySegments.PageCount
+ if *journeySegments.PageNumber >= *journeySegments.PageCount {
+ break
+ }
+ }
+
+ // delete them
+ for _, journeySegment := range segmentsToDelete {
+ _, delErr := journeyApi.DeleteJourneySegment(*journeySegment.Id)
+ if delErr != nil {
+ util.BuildDiagnosticError("genesyscloud_journey_segment", fmt.Sprintf("failed to delete journey segment %s (%s)", *journeySegment.Id, *journeySegment.DisplayName), delErr)
+ return
+ }
+ log.Printf("Deleted journey segment %s (%s)", *journeySegment.Id, *journeySegment.DisplayName)
}
}
@@ -106,36 +107,3 @@ func testVerifyJourneySegmentsDestroyed(state *terraform.State) error {
// Success. All Journey segment destroyed
return nil
}
-
-func customerSegmentationIsSupported(t *testing.T) (bool, string) {
- segmentRequest := platformclientv2.Journeysegmentrequest{
- DisplayName: platformclientv2.String("terraform_test_" + uuid.NewString()),
- Color: platformclientv2.String("#008000"),
- Scope: platformclientv2.String("Customer"),
- ShouldDisplayToAgent: platformclientv2.Bool(false),
- ExternalSegment: &platformclientv2.Requestexternalsegment{
- Id: platformclientv2.String("4654654654"),
- Name: platformclientv2.String("external segment name"),
- Source: platformclientv2.String("AdobeExperiencePlatform"),
- },
- }
-
- apiInstance := platformclientv2.NewJourneyApiWithConfig(sdkConfig)
- segment, response, err := apiInstance.PostJourneySegments(segmentRequest)
- if err != nil {
- if response != nil && response.StatusCode == 501 && strings.Contains(response.ErrorMessage, "not currently supported") {
- return false, response.ErrorMessage
- }
- t.Logf("failed to create segment inside method customerSegmentationIsSupported: %v", err)
- return true, ""
- }
-
- t.Logf("Customer segmentation has been implemented.")
-
- // cleanup segment
- if _, err := apiInstance.DeleteJourneySegment(*segment.Id); err != nil {
- t.Logf("failed to cleanup segment inside method customerSegmentationIsSupported. Segment ID: '%s'. Error: '%v'", *segment.Id, err)
- }
-
- return true, ""
-}
diff --git a/genesyscloud/resource_genesyscloud_knowledge_category.go b/genesyscloud/resource_genesyscloud_knowledge_category.go
index 5f302d90f..dc097759d 100644
--- a/genesyscloud/resource_genesyscloud_knowledge_category.go
+++ b/genesyscloud/resource_genesyscloud_knowledge_category.go
@@ -18,7 +18,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
var (
diff --git a/genesyscloud/resource_genesyscloud_knowledge_category_test.go b/genesyscloud/resource_genesyscloud_knowledge_category_test.go
index 0b4484661..06ca7764f 100644
--- a/genesyscloud/resource_genesyscloud_knowledge_category_test.go
+++ b/genesyscloud/resource_genesyscloud_knowledge_category_test.go
@@ -10,7 +10,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceKnowledgeCategoryBasic(t *testing.T) {
diff --git a/genesyscloud/resource_genesyscloud_knowledge_document.go b/genesyscloud/resource_genesyscloud_knowledge_document.go
index b11bb00c3..7c91e51bf 100644
--- a/genesyscloud/resource_genesyscloud_knowledge_document.go
+++ b/genesyscloud/resource_genesyscloud_knowledge_document.go
@@ -20,7 +20,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
var (
diff --git a/genesyscloud/resource_genesyscloud_knowledge_document_test.go b/genesyscloud/resource_genesyscloud_knowledge_document_test.go
index 33c78b2a8..0e47251ac 100644
--- a/genesyscloud/resource_genesyscloud_knowledge_document_test.go
+++ b/genesyscloud/resource_genesyscloud_knowledge_document_test.go
@@ -10,7 +10,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceKnowledgeDocumentBasic(t *testing.T) {
diff --git a/genesyscloud/resource_genesyscloud_knowledge_document_variation.go b/genesyscloud/resource_genesyscloud_knowledge_document_variation.go
index 9b55dc283..b0ed284f2 100644
--- a/genesyscloud/resource_genesyscloud_knowledge_document_variation.go
+++ b/genesyscloud/resource_genesyscloud_knowledge_document_variation.go
@@ -21,7 +21,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
var (
diff --git a/genesyscloud/resource_genesyscloud_knowledge_document_variation_test.go b/genesyscloud/resource_genesyscloud_knowledge_document_variation_test.go
index 68e05a00b..72e6fbfc4 100644
--- a/genesyscloud/resource_genesyscloud_knowledge_document_variation_test.go
+++ b/genesyscloud/resource_genesyscloud_knowledge_document_variation_test.go
@@ -10,7 +10,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceKnowledgeDocumentVariationBasic(t *testing.T) {
diff --git a/genesyscloud/resource_genesyscloud_knowledge_knowledgebase.go b/genesyscloud/resource_genesyscloud_knowledge_knowledgebase.go
index 0c549673a..4e824d71e 100644
--- a/genesyscloud/resource_genesyscloud_knowledge_knowledgebase.go
+++ b/genesyscloud/resource_genesyscloud_knowledge_knowledgebase.go
@@ -18,7 +18,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func getAllKnowledgeKnowledgebases(_ context.Context, clientConfig *platformclientv2.Configuration) (resourceExporter.ResourceIDMetaMap, diag.Diagnostics) {
diff --git a/genesyscloud/resource_genesyscloud_knowledge_knowledgebase_test.go b/genesyscloud/resource_genesyscloud_knowledge_knowledgebase_test.go
index 896cf6fce..798715ee1 100644
--- a/genesyscloud/resource_genesyscloud_knowledge_knowledgebase_test.go
+++ b/genesyscloud/resource_genesyscloud_knowledge_knowledgebase_test.go
@@ -9,7 +9,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceKnowledgeKnowledgebaseBasic(t *testing.T) {
diff --git a/genesyscloud/resource_genesyscloud_knowledge_label.go b/genesyscloud/resource_genesyscloud_knowledge_label.go
index 6e439d2b9..9b622e0ae 100644
--- a/genesyscloud/resource_genesyscloud_knowledge_label.go
+++ b/genesyscloud/resource_genesyscloud_knowledge_label.go
@@ -18,7 +18,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
var (
diff --git a/genesyscloud/resource_genesyscloud_knowledge_label_test.go b/genesyscloud/resource_genesyscloud_knowledge_label_test.go
index ef825655b..146fa7f36 100644
--- a/genesyscloud/resource_genesyscloud_knowledge_label_test.go
+++ b/genesyscloud/resource_genesyscloud_knowledge_label_test.go
@@ -10,7 +10,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceKnowledgeLabelBasic(t *testing.T) {
diff --git a/genesyscloud/resource_genesyscloud_knowledge_v1_category.go b/genesyscloud/resource_genesyscloud_knowledge_v1_category.go
index 6cb614dac..b5af3291e 100644
--- a/genesyscloud/resource_genesyscloud_knowledge_v1_category.go
+++ b/genesyscloud/resource_genesyscloud_knowledge_v1_category.go
@@ -19,7 +19,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
var (
diff --git a/genesyscloud/resource_genesyscloud_knowledge_v1_category_test.go b/genesyscloud/resource_genesyscloud_knowledge_v1_category_test.go
index b6f7b76d9..578c23b26 100644
--- a/genesyscloud/resource_genesyscloud_knowledge_v1_category_test.go
+++ b/genesyscloud/resource_genesyscloud_knowledge_v1_category_test.go
@@ -8,7 +8,7 @@ package genesyscloud
// "github.com/google/uuid"
// "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
// "github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
-// "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+// "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
// )
// func TestAccResourceKnowledgeV1CategoryBasic(t *testing.T) {
diff --git a/genesyscloud/resource_genesyscloud_knowledge_v1_document.go b/genesyscloud/resource_genesyscloud_knowledge_v1_document.go
index 6e9a363ad..a87a90384 100644
--- a/genesyscloud/resource_genesyscloud_knowledge_v1_document.go
+++ b/genesyscloud/resource_genesyscloud_knowledge_v1_document.go
@@ -22,7 +22,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
var (
diff --git a/genesyscloud/resource_genesyscloud_knowledge_v1_document_test.go b/genesyscloud/resource_genesyscloud_knowledge_v1_document_test.go
index 38266012f..b9ef197c6 100644
--- a/genesyscloud/resource_genesyscloud_knowledge_v1_document_test.go
+++ b/genesyscloud/resource_genesyscloud_knowledge_v1_document_test.go
@@ -8,7 +8,7 @@ package genesyscloud
// "github.com/google/uuid"
// "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
// "github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
-// "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+// "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
// )
// func TestAccResourceKnowledgeV1DocumentBasic(t *testing.T) {
diff --git a/genesyscloud/resource_genesyscloud_location.go b/genesyscloud/resource_genesyscloud_location.go
index 693d9c7f5..eb2ac88e0 100644
--- a/genesyscloud/resource_genesyscloud_location.go
+++ b/genesyscloud/resource_genesyscloud_location.go
@@ -21,7 +21,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"github.com/nyaruka/phonenumbers"
)
diff --git a/genesyscloud/resource_genesyscloud_location_test.go b/genesyscloud/resource_genesyscloud_location_test.go
index db2a7036b..b34a8c149 100644
--- a/genesyscloud/resource_genesyscloud_location_test.go
+++ b/genesyscloud/resource_genesyscloud_location_test.go
@@ -10,7 +10,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceLocationBasic(t *testing.T) {
diff --git a/genesyscloud/resource_genesyscloud_quality_forms_evaluation.go b/genesyscloud/resource_genesyscloud_quality_forms_evaluation.go
index e037532e6..b048bda93 100644
--- a/genesyscloud/resource_genesyscloud_quality_forms_evaluation.go
+++ b/genesyscloud/resource_genesyscloud_quality_forms_evaluation.go
@@ -21,7 +21,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
var (
diff --git a/genesyscloud/resource_genesyscloud_quality_forms_evaluation_test.go b/genesyscloud/resource_genesyscloud_quality_forms_evaluation_test.go
index da3edc9e7..bceeeff41 100644
--- a/genesyscloud/resource_genesyscloud_quality_forms_evaluation_test.go
+++ b/genesyscloud/resource_genesyscloud_quality_forms_evaluation_test.go
@@ -10,7 +10,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceEvaluationFormBasic(t *testing.T) {
diff --git a/genesyscloud/resource_genesyscloud_quality_forms_survey.go b/genesyscloud/resource_genesyscloud_quality_forms_survey.go
index fe3f68747..a8941b378 100644
--- a/genesyscloud/resource_genesyscloud_quality_forms_survey.go
+++ b/genesyscloud/resource_genesyscloud_quality_forms_survey.go
@@ -18,7 +18,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
type SurveyFormStruct struct {
diff --git a/genesyscloud/resource_genesyscloud_quality_forms_survey_test.go b/genesyscloud/resource_genesyscloud_quality_forms_survey_test.go
index 774504d74..cf763718c 100644
--- a/genesyscloud/resource_genesyscloud_quality_forms_survey_test.go
+++ b/genesyscloud/resource_genesyscloud_quality_forms_survey_test.go
@@ -10,7 +10,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceSurveyFormBasic(t *testing.T) {
diff --git a/genesyscloud/resource_genesyscloud_routing_email_domain.go b/genesyscloud/resource_genesyscloud_routing_email_domain.go
index 9d1115f5d..e17c91191 100644
--- a/genesyscloud/resource_genesyscloud_routing_email_domain.go
+++ b/genesyscloud/resource_genesyscloud_routing_email_domain.go
@@ -18,7 +18,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func getAllRoutingEmailDomains(_ context.Context, clientConfig *platformclientv2.Configuration) (resourceExporter.ResourceIDMetaMap, diag.Diagnostics) {
diff --git a/genesyscloud/resource_genesyscloud_routing_email_domain_test.go b/genesyscloud/resource_genesyscloud_routing_email_domain_test.go
index 7b2684574..016f54c20 100644
--- a/genesyscloud/resource_genesyscloud_routing_email_domain_test.go
+++ b/genesyscloud/resource_genesyscloud_routing_email_domain_test.go
@@ -16,7 +16,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceRoutingEmailDomainSub(t *testing.T) {
diff --git a/genesyscloud/resource_genesyscloud_routing_language.go b/genesyscloud/resource_genesyscloud_routing_language.go
index bb08ca53e..e30132331 100644
--- a/genesyscloud/resource_genesyscloud_routing_language.go
+++ b/genesyscloud/resource_genesyscloud_routing_language.go
@@ -17,7 +17,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func getAllRoutingLanguages(_ context.Context, clientConfig *platformclientv2.Configuration) (resourceExporter.ResourceIDMetaMap, diag.Diagnostics) {
diff --git a/genesyscloud/resource_genesyscloud_routing_language_test.go b/genesyscloud/resource_genesyscloud_routing_language_test.go
index 228fd997d..a3f416a09 100644
--- a/genesyscloud/resource_genesyscloud_routing_language_test.go
+++ b/genesyscloud/resource_genesyscloud_routing_language_test.go
@@ -9,7 +9,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceRoutingLanguageBasic(t *testing.T) {
diff --git a/genesyscloud/resource_genesyscloud_routing_settings.go b/genesyscloud/resource_genesyscloud_routing_settings.go
deleted file mode 100644
index 0e79aff55..000000000
--- a/genesyscloud/resource_genesyscloud_routing_settings.go
+++ /dev/null
@@ -1,308 +0,0 @@
-package genesyscloud
-
-import (
- "context"
- "fmt"
- "log"
- "terraform-provider-genesyscloud/genesyscloud/provider"
- "terraform-provider-genesyscloud/genesyscloud/util"
- "terraform-provider-genesyscloud/genesyscloud/util/constants"
- "time"
-
- "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
-
- "terraform-provider-genesyscloud/genesyscloud/consistency_checker"
-
- resourceExporter "terraform-provider-genesyscloud/genesyscloud/resource_exporter"
-
- "github.com/hashicorp/terraform-plugin-sdk/v2/diag"
- "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
-)
-
-func ResourceRoutingSettings() *schema.Resource {
- return &schema.Resource{
- Description: "An organization's routing settings",
-
- CreateContext: provider.CreateWithPooledClient(createRoutingSettings),
- ReadContext: provider.ReadWithPooledClient(readRoutingSettings),
- UpdateContext: provider.UpdateWithPooledClient(updateRoutingSettings),
- DeleteContext: provider.DeleteWithPooledClient(deleteRoutingSettings),
- Importer: &schema.ResourceImporter{
- StateContext: schema.ImportStatePassthroughContext,
- },
- SchemaVersion: 1,
- Schema: map[string]*schema.Schema{
- "reset_agent_on_presence_change": {
- Description: "Reset agent score when agent presence changes from off-queue to on-queue",
- Type: schema.TypeBool,
- Optional: true,
- Computed: true,
- },
- "contactcenter": {
- Description: "Contact center settings",
- Type: schema.TypeList,
- Optional: true,
- Computed: true,
- MaxItems: 1,
- Elem: &schema.Resource{
- Schema: map[string]*schema.Schema{
- "remove_skills_from_blind_transfer": {
- Description: "Strip skills from transfer",
- Type: schema.TypeBool,
- Optional: true,
- },
- },
- },
- },
- "transcription": {
- Description: "Transcription settings",
- Type: schema.TypeList,
- Optional: true,
- Computed: true,
- MaxItems: 1,
- Elem: &schema.Resource{
- Schema: map[string]*schema.Schema{
- "transcription": {
- Description: "Setting to enable/disable transcription capability.Valid values: Disabled, EnabledGlobally, EnabledQueueFlow",
- Type: schema.TypeString,
- Optional: true,
- },
- "transcription_confidence_threshold": {
- Description: "Configure confidence threshold. The possible values are from 1 to 100",
- Type: schema.TypeInt,
- Optional: true,
- },
- "low_latency_transcription_enabled": {
- Description: "Boolean flag indicating whether low latency transcription via Notification API is enabled",
- Type: schema.TypeBool,
- Optional: true,
- },
- "content_search_enabled": {
- Description: "Setting to enable/disable content search",
- Type: schema.TypeBool,
- Optional: true,
- },
- },
- },
- },
- },
- }
-}
-
-func getAllRoutingSettings(_ context.Context, clientConfig *platformclientv2.Configuration) (resourceExporter.ResourceIDMetaMap, diag.Diagnostics) {
- resources := make(resourceExporter.ResourceIDMetaMap)
- resources["0"] = &resourceExporter.ResourceMeta{Name: "routing_settings"}
- return resources, nil
-}
-
-func RoutingSettingsExporter() *resourceExporter.ResourceExporter {
- return &resourceExporter.ResourceExporter{
- GetResourcesFunc: provider.GetAllWithPooledClient(getAllRoutingSettings),
- RefAttrs: map[string]*resourceExporter.RefAttrSettings{}, // No references
- }
-}
-
-func createRoutingSettings(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
- log.Printf("Creating Routing Setting")
- d.SetId("settings")
- return updateRoutingSettings(ctx, d, meta)
-}
-
-func readRoutingSettings(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
- sdkConfig := meta.(*provider.ProviderMeta).ClientConfig
- routingAPI := platformclientv2.NewRoutingApiWithConfig(sdkConfig)
- cc := consistency_checker.NewConsistencyCheck(ctx, d, meta, ResourceRoutingSettings(), constants.DefaultConsistencyChecks, "genesyscloud_routing_settings")
-
- log.Printf("Reading setting: %s", d.Id())
- return util.WithRetriesForRead(ctx, d, func() *retry.RetryError {
- settings, resp, getErr := routingAPI.GetRoutingSettings()
-
- if getErr != nil {
- if util.IsStatus404(resp) {
- //createRoutingSettings(ctx, d, meta)
- return retry.RetryableError(util.BuildWithRetriesApiDiagnosticError("genesyscloud_routing_settings", fmt.Sprintf("Failed to read Routing Setting %s | error: %s", d.Id(), getErr), resp))
- }
- return retry.NonRetryableError(util.BuildWithRetriesApiDiagnosticError("genesyscloud_routing_settings", fmt.Sprintf("Failed to read Routing Setting %s | error: %s", d.Id(), getErr), resp))
- }
-
- if settings.ResetAgentScoreOnPresenceChange != nil {
- d.Set("reset_agent_on_presence_change", *settings.ResetAgentScoreOnPresenceChange)
- } else {
- d.Set("reset_agent_on_presence_change", nil)
- }
-
- if diagErr := readRoutingSettingsContactCenter(d, routingAPI); diagErr != nil {
- return retry.NonRetryableError(fmt.Errorf("%v", diagErr))
- }
-
- if diagErr := readRoutingSettingsTranscription(d, routingAPI); diagErr != nil {
- return retry.NonRetryableError(fmt.Errorf("%v", diagErr))
- }
-
- log.Printf("Read Routing Setting")
- return cc.CheckState(d)
- })
-}
-
-func updateRoutingSettings(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
- resetAgentOnPresenceChange := d.Get("reset_agent_on_presence_change").(bool)
-
- sdkConfig := meta.(*provider.ProviderMeta).ClientConfig
- routingAPI := platformclientv2.NewRoutingApiWithConfig(sdkConfig)
-
- log.Printf("Updating Routing Settings")
- update := platformclientv2.Routingsettings{
- ResetAgentScoreOnPresenceChange: &resetAgentOnPresenceChange,
- }
-
- diagErr := updateContactCenter(d, routingAPI)
- if diagErr != nil {
- return diagErr
- }
-
- diagErr = updateTranscription(d, routingAPI)
- if diagErr != nil {
- return diagErr
- }
-
- _, resp, err := routingAPI.PutRoutingSettings(update)
- if err != nil {
- return util.BuildAPIDiagnosticError("genesyscloud_routing_settings", fmt.Sprintf("Failed to update routing settings %s error: %s", d.Id(), err), resp)
- }
-
- time.Sleep(5 * time.Second)
-
- log.Printf("Updated Routing Settings")
- return readRoutingSettings(ctx, d, meta)
-}
-
-func deleteRoutingSettings(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
- sdkConfig := meta.(*provider.ProviderMeta).ClientConfig
- routingAPI := platformclientv2.NewRoutingApiWithConfig(sdkConfig)
-
- log.Printf("Resetting Routing Setting")
- resp, err := routingAPI.DeleteRoutingSettings()
- if err != nil {
- return util.BuildAPIDiagnosticError("genesyscloud_routing_settings", fmt.Sprintf("Failed to delete routing settings error: %s", err), resp)
- }
- log.Printf("Reset Routing Settings")
- return nil
-}
-
-func readRoutingSettingsContactCenter(d *schema.ResourceData, routingAPI *platformclientv2.RoutingApi) diag.Diagnostics {
- contactcenter, resp, getErr := routingAPI.GetRoutingSettingsContactcenter()
- if getErr != nil {
- if util.IsStatus404(resp) {
- return nil
- }
- return util.BuildAPIDiagnosticError("genesyscloud_routing_settings", fmt.Sprintf("Failed to read contact center for routing setting %s error: %s", d.Id(), getErr), resp)
- }
-
- if contactcenter == nil {
- d.Set("contactcenter", nil)
- return nil
- }
-
- contactSettings := make(map[string]interface{})
-
- if contactcenter.RemoveSkillsFromBlindTransfer != nil {
- contactSettings["remove_skills_from_blind_transfer"] = *contactcenter.RemoveSkillsFromBlindTransfer
- }
-
- d.Set("contactcenter", []interface{}{contactSettings})
- return nil
-}
-
-func readRoutingSettingsTranscription(d *schema.ResourceData, routingAPI *platformclientv2.RoutingApi) diag.Diagnostics {
- transcription, resp, getErr := routingAPI.GetRoutingSettingsTranscription()
- if getErr != nil {
- if util.IsStatus404(resp) {
- return nil
- }
- return util.BuildAPIDiagnosticError("genesyscloud_routing_settings", fmt.Sprintf("Failed to read contact center for routing settings %s error: %s", d.Id(), getErr), resp)
- }
-
- if transcription == nil {
- d.Set("transcription", nil)
- return nil
- }
-
- transcriptionSettings := make(map[string]interface{})
-
- if transcription.Transcription != nil {
- transcriptionSettings["transcription"] = *transcription.Transcription
- }
- if transcription.TranscriptionConfidenceThreshold != nil {
- transcriptionSettings["transcription_confidence_threshold"] = *transcription.TranscriptionConfidenceThreshold
- }
- if transcription.LowLatencyTranscriptionEnabled != nil {
- transcriptionSettings["low_latency_transcription_enabled"] = *transcription.LowLatencyTranscriptionEnabled
- }
- if transcription.ContentSearchEnabled != nil {
- transcriptionSettings["content_search_enabled"] = *transcription.ContentSearchEnabled
- }
-
- d.Set("transcription", []interface{}{transcriptionSettings})
- return nil
-}
-
-func updateContactCenter(d *schema.ResourceData, routingAPI *platformclientv2.RoutingApi) diag.Diagnostics {
- var removeSkillsFromBlindTransfer bool
-
- if contactCenterConfig := d.Get("contactcenter"); contactCenterConfig != nil {
- if contactCenterList := contactCenterConfig.([]interface{}); len(contactCenterList) > 0 {
- contactCenterMap := contactCenterList[0].(map[string]interface{})
-
- if contactCenterMap["remove_skills_from_blind_transfer"] != nil {
- removeSkillsFromBlindTransfer = contactCenterMap["remove_skills_from_blind_transfer"].(bool)
- }
- resp, err := routingAPI.PatchRoutingSettingsContactcenter(platformclientv2.Contactcentersettings{
- RemoveSkillsFromBlindTransfer: &removeSkillsFromBlindTransfer,
- })
-
- if err != nil {
- return util.BuildAPIDiagnosticError("genesyscloud_routing_settings", fmt.Sprintf("Failed to update contact center for routing settings %s error: %s", d.Id(), err), resp)
- }
- }
- }
- return nil
-}
-
-func updateTranscription(d *schema.ResourceData, routingAPI *platformclientv2.RoutingApi) diag.Diagnostics {
- if transcriptionConfig := d.Get("transcription"); transcriptionConfig != nil {
- if transcriptionList := transcriptionConfig.([]interface{}); len(transcriptionList) > 0 {
- transcriptionMap := transcriptionList[0].(map[string]interface{})
-
- var transcription string
- var transcriptionConfidenceThreshold int
- var lowLatencyTranscriptionEnabled bool
- var contentSearchEnabled bool
-
- if transcriptionMap["transcription"] != nil {
- transcription = transcriptionMap["transcription"].(string)
- }
- if transcriptionMap["transcription_confidence_threshold"] != nil {
- transcriptionConfidenceThreshold = transcriptionMap["transcription_confidence_threshold"].(int)
- }
- if transcriptionMap["low_latency_transcription_enabled"] != nil {
- lowLatencyTranscriptionEnabled = transcriptionMap["low_latency_transcription_enabled"].(bool)
- }
- if transcriptionMap["content_search_enabled"] != nil {
- contentSearchEnabled = transcriptionMap["content_search_enabled"].(bool)
- }
-
- _, resp, err := routingAPI.PutRoutingSettingsTranscription(platformclientv2.Transcriptionsettings{
- Transcription: &transcription,
- TranscriptionConfidenceThreshold: &transcriptionConfidenceThreshold,
- LowLatencyTranscriptionEnabled: &lowLatencyTranscriptionEnabled,
- ContentSearchEnabled: &contentSearchEnabled,
- })
-
- if err != nil {
- return util.BuildAPIDiagnosticError("genesyscloud_routing_settings", fmt.Sprintf("Failed to update Transcription for routing settings %s error: %s", d.Id(), err), resp)
- }
- }
- }
- return nil
-}
diff --git a/genesyscloud/resource_genesyscloud_routing_skill.go b/genesyscloud/resource_genesyscloud_routing_skill.go
index d0ac11e3e..91ccf0574 100644
--- a/genesyscloud/resource_genesyscloud_routing_skill.go
+++ b/genesyscloud/resource_genesyscloud_routing_skill.go
@@ -17,7 +17,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func getAllRoutingSkills(_ context.Context, clientConfig *platformclientv2.Configuration) (resourceExporter.ResourceIDMetaMap, diag.Diagnostics) {
diff --git a/genesyscloud/resource_genesyscloud_routing_skill_group.go b/genesyscloud/resource_genesyscloud_routing_skill_group.go
index b91cbd6d4..6508806de 100644
--- a/genesyscloud/resource_genesyscloud_routing_skill_group.go
+++ b/genesyscloud/resource_genesyscloud_routing_skill_group.go
@@ -21,7 +21,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
type SkillGroupsRequest struct {
@@ -34,54 +34,18 @@ type SkillGroupsRequest struct {
SkillConditions struct{} `json:"skillConditions"` //Keep this here. Even though we do not use this field in the struct The generated attributed is used as a placeholder
}
-type AllSkillGroups struct {
- Entities []struct {
- ID string `json:"id"`
- Name string `json:"name"`
- }
- NextURI string `json:"nextUri"`
- SelfURI string `json:"selfUri"`
- PreviousURI string `json:"previousUri"`
-}
-
-func getAllSkillGroups(ctx context.Context, clientConfig *platformclientv2.Configuration) (resourceExporter.ResourceIDMetaMap, diag.Diagnostics) {
+func getAllSkillGroups(_ context.Context, clientConfig *platformclientv2.Configuration) (resourceExporter.ResourceIDMetaMap, diag.Diagnostics) {
resources := make(resourceExporter.ResourceIDMetaMap)
routingAPI := platformclientv2.NewRoutingApiWithConfig(clientConfig)
- apiClient := &routingAPI.Configuration.APIClient
- route := "/api/v2/routing/skillgroups"
-
- headerParams := buildHeaderParams(routingAPI)
-
- for {
- path := routingAPI.Configuration.BasePath + route
- skillGroupPayload := &AllSkillGroups{}
-
- response, err := apiClient.CallAPI(path, "GET", nil, headerParams, nil, nil, "", nil)
-
- if err != nil {
- return nil, util.BuildAPIDiagnosticError("genesyscloud_routing_skill_group", fmt.Sprintf("Failed to get page of skill groups error: %s", err), response)
- }
-
- err = json.Unmarshal(response.RawBody, &skillGroupPayload)
- if err != nil {
- return nil, util.BuildDiagnosticError("genesyscloud_routing_skill_group", fmt.Sprintf("Failed to unmarshal skill groups"), err)
- }
-
- if skillGroupPayload.Entities == nil || len(skillGroupPayload.Entities) == 0 {
- break
- }
-
- for _, skillGroup := range skillGroupPayload.Entities {
-
- resources[skillGroup.ID] = &resourceExporter.ResourceMeta{Name: skillGroup.Name}
- }
- if route == skillGroupPayload.NextURI || skillGroupPayload.NextURI == "" {
- break
- } else {
- route = skillGroupPayload.NextURI
- }
+ allSkillGroups, resp, err := getAllSkillGroupsByName(routingAPI, "")
+ if err != nil {
+ msg := fmt.Sprintf("failed to read skill groups: %v", err)
+ return nil, util.BuildAPIDiagnosticError(getSkillGroupResourceName(), msg, resp)
+ }
+ for _, skillGroup := range allSkillGroups {
+ resources[*skillGroup.Id] = &resourceExporter.ResourceMeta{Name: *skillGroup.Name}
}
return resources, nil
@@ -101,6 +65,10 @@ func ResourceSkillGroupExporter() *resourceExporter.ResourceExporter {
}
}
+func getSkillGroupResourceName() string {
+ return "genesyscloud_routing_skill_group"
+}
+
func ResourceRoutingSkillGroup() *schema.Resource {
return &schema.Resource{
Description: `Genesys Cloud Skill Group`,
@@ -174,14 +142,14 @@ func createOrUpdateSkillGroups(ctx context.Context, d *schema.ResourceData, meta
//Merge in skill conditions
finalSkillGroupsJson, err := mergeSkillConditionsIntoSkillGroups(d, skillGroupsRequest)
if err != nil {
- return util.BuildDiagnosticError("genesyscloud_routing_skill_group", fmt.Sprintf("Failed to read the before skills groups request before: %s", skillGroupsRequest.Name), err)
+ return util.BuildDiagnosticError(getSkillGroupResourceName(), fmt.Sprintf("Failed to read the before skills groups request before: %s", skillGroupsRequest.Name), err)
}
sdkConfig := meta.(*provider.ProviderMeta).ClientConfig
routingAPI := platformclientv2.NewRoutingApiWithConfig(sdkConfig)
apiClient := &routingAPI.Configuration.APIClient
path := routingAPI.Configuration.BasePath + route
- headerParams := buildHeaderParams(routingAPI)
+ headerParams := BuildHeaderParams(routingAPI)
/*
Since API Client expects either a struct or map of maps (of json), convert the JSON string to a map
@@ -190,7 +158,7 @@ func createOrUpdateSkillGroups(ctx context.Context, d *schema.ResourceData, meta
var skillGroupsPayload map[string]interface{}
err = json.Unmarshal([]byte(finalSkillGroupsJson), &skillGroupsPayload)
if err != nil {
- return util.BuildDiagnosticError("genesyscloud_routing_skill_group", fmt.Sprintf("Failed to unmarshal the JSON payload while creating/updating the skills group %s", skillGroupsRequest.Name), err)
+ return util.BuildDiagnosticError(getSkillGroupResourceName(), fmt.Sprintf("Failed to unmarshal the JSON payload while creating/updating the skills group %s", skillGroupsRequest.Name), err)
}
httpMethod := "POST"
@@ -200,14 +168,14 @@ func createOrUpdateSkillGroups(ctx context.Context, d *schema.ResourceData, meta
response, err := apiClient.CallAPI(path, httpMethod, skillGroupsPayload, headerParams, nil, nil, "", nil)
if err != nil {
- return util.BuildAPIDiagnosticError("genesyscloud_routing_skill_group", fmt.Sprintf("Failed to create/update skill groups %s error: %s", skillGroupsRequest.Name, err), response)
+ return util.BuildAPIDiagnosticError(getSkillGroupResourceName(), fmt.Sprintf("Failed to create/update skill groups %s error: %s", skillGroupsRequest.Name, err), response)
}
//Get the results and pull out the id
skillGroupPayload := make(map[string]interface{})
err = json.Unmarshal(response.RawBody, &skillGroupPayload)
if err != nil {
- return util.BuildDiagnosticError("genesyscloud_routing_skill_group", fmt.Sprintf("Failed to unmarshal skill groups"), err)
+ return util.BuildDiagnosticError(getSkillGroupResourceName(), fmt.Sprintf("Failed to unmarshal skill groups"), err)
}
if create == true {
@@ -265,12 +233,12 @@ func postSkillGroupMemberDivisions(ctx context.Context, d *schema.ResourceData,
skillGroupsMemberDivisionIdsPayload["addDivisionIds"] = toAdd
}
- headerParams := buildHeaderParams(routingAPI)
+ headerParams := BuildHeaderParams(routingAPI)
apiClient := &routingAPI.Configuration.APIClient
path := fmt.Sprintf("%s/api/v2/routing/skillgroups/%s/members/divisions", routingAPI.Configuration.BasePath, d.Id())
response, err := apiClient.CallAPI(path, "POST", skillGroupsMemberDivisionIdsPayload, headerParams, nil, nil, "", nil)
if err != nil || response.Error != nil {
- return util.BuildAPIDiagnosticError("genesyscloud_routing_skill_group", fmt.Sprintf("Failed to create/update skill group %s member divisions error: %s", d.Id(), err), response)
+ return util.BuildAPIDiagnosticError(getSkillGroupResourceName(), fmt.Sprintf("Failed to create/update skill group %s member divisions error: %s", d.Id(), err), response)
}
log.Printf("Updated skill group %s member divisions", name)
@@ -300,7 +268,7 @@ func createListsForSkillgroupsMembersDivisionsPost(schemaMemberDivisionIds []str
if allMemberDivisionsSpecified(schemaMemberDivisionIds) {
if len(schemaMemberDivisionIds) > 1 {
- return nil, nil, util.BuildDiagnosticError("genesyscloud_routing_skill_group", fmt.Sprintf(`member_division_ids should not contain more than one item when the value of an item is "*"`), fmt.Errorf(`member_division_ids should not contain more than one item when the value of an item is "*"`))
+ return nil, nil, util.BuildDiagnosticError(getSkillGroupResourceName(), fmt.Sprintf(`member_division_ids should not contain more than one item when the value of an item is "*"`), fmt.Errorf(`member_division_ids should not contain more than one item when the value of an item is "*"`))
}
toAdd, err := getAllAuthDivisionIds(meta)
return toAdd, nil, err
@@ -361,7 +329,7 @@ func readSkillGroups(ctx context.Context, d *schema.ResourceData, meta interface
path := routingAPI.Configuration.BasePath + "/api/v2/routing/skillgroups/" + d.Id()
// add default headers if any
- headerParams := buildHeaderParams(routingAPI)
+ headerParams := BuildHeaderParams(routingAPI)
log.Printf("Reading skills group %s", d.Id())
@@ -371,11 +339,11 @@ func readSkillGroups(ctx context.Context, d *schema.ResourceData, meta interface
response, err := apiClient.CallAPI(path, "GET", nil, headerParams, nil, nil, "", nil)
if err != nil {
- return retry.NonRetryableError(util.BuildWithRetriesApiDiagnosticError("genesyscloud_routing_skill_group", fmt.Sprintf("Failed to retrieve skill groups %s", err), response))
+ return retry.NonRetryableError(util.BuildWithRetriesApiDiagnosticError(getSkillGroupResourceName(), fmt.Sprintf("Failed to retrieve skill groups %s", err), response))
}
if err == nil && response.Error != nil && response.StatusCode != http.StatusNotFound {
- return retry.NonRetryableError(util.BuildWithRetriesApiDiagnosticError("genesyscloud_routing_skill_group", fmt.Sprintf("Failed to retrieve skill groups. %s", err), response))
+ return retry.NonRetryableError(util.BuildWithRetriesApiDiagnosticError(getSkillGroupResourceName(), fmt.Sprintf("Failed to retrieve skill groups. %s", err), response))
}
err = json.Unmarshal(response.RawBody, &skillGroupPayload)
@@ -384,7 +352,7 @@ func readSkillGroups(ctx context.Context, d *schema.ResourceData, meta interface
}
if err == nil && util.IsStatus404(response) {
- return retry.RetryableError(util.BuildWithRetriesApiDiagnosticError("genesyscloud_routing_skill_group", fmt.Sprintf("Failed to read skill groups %s | error: %s", d.Id(), err), response))
+ return retry.RetryableError(util.BuildWithRetriesApiDiagnosticError(getSkillGroupResourceName(), fmt.Sprintf("Failed to read skill groups %s | error: %s", d.Id(), err), response))
}
name := skillGroupPayload["name"]
@@ -440,7 +408,7 @@ func readSkillGroups(ctx context.Context, d *schema.ResourceData, meta interface
})
}
-func buildHeaderParams(routingAPI *platformclientv2.RoutingApi) map[string]string {
+func BuildHeaderParams(routingAPI *platformclientv2.RoutingApi) map[string]string {
headerParams := make(map[string]string)
for key := range routingAPI.Configuration.DefaultHeader {
@@ -470,7 +438,7 @@ func deleteSkillGroups(ctx context.Context, d *schema.ResourceData, meta interfa
path := routingAPI.Configuration.BasePath + "/api/v2/routing/skillgroups/" + d.Id()
// add default headers if any
- headerParams := buildHeaderParams(routingAPI)
+ headerParams := BuildHeaderParams(routingAPI)
log.Printf("Deleting skills group %s", name)
response, err := apiClient.CallAPI(path, "DELETE", nil, headerParams, nil, nil, "", nil)
@@ -481,7 +449,7 @@ func deleteSkillGroups(ctx context.Context, d *schema.ResourceData, meta interfa
log.Printf("Skills Group was already deleted %s", d.Id())
return nil
}
- return util.BuildAPIDiagnosticError("genesyscloud_routing_skill_group", fmt.Sprintf("Failed to delete skill group %s error: %s", d.Id(), err), response)
+ return util.BuildAPIDiagnosticError(getSkillGroupResourceName(), fmt.Sprintf("Failed to delete skill group %s error: %s", d.Id(), err), response)
}
return util.WithRetries(ctx, 30*time.Second, func() *retry.RetryError {
@@ -494,14 +462,14 @@ func deleteSkillGroups(ctx context.Context, d *schema.ResourceData, meta interfa
log.Printf("Deleted skills group %s", d.Id())
return nil
}
- return retry.NonRetryableError(util.BuildWithRetriesApiDiagnosticError("genesyscloud_routing_skill_group", fmt.Sprintf("Error deleting skill group %s | error: %s", d.Id(), err), response))
+ return retry.NonRetryableError(util.BuildWithRetriesApiDiagnosticError(getSkillGroupResourceName(), fmt.Sprintf("Error deleting skill group %s | error: %s", d.Id(), err), response))
}
- return retry.RetryableError(util.BuildWithRetriesApiDiagnosticError("genesyscloud_routing_skill_group", fmt.Sprintf("Skill group %s still exists", d.Id()), response))
+ return retry.RetryableError(util.BuildWithRetriesApiDiagnosticError(getSkillGroupResourceName(), fmt.Sprintf("Skill group %s still exists", d.Id()), response))
})
}
func readSkillGroupMemberDivisionIds(d *schema.ResourceData, routingAPI *platformclientv2.RoutingApi) ([]string, diag.Diagnostics) {
- headers := buildHeaderParams(routingAPI)
+ headers := BuildHeaderParams(routingAPI)
apiClient := &routingAPI.Configuration.APIClient
path := fmt.Sprintf("%s/api/v2/routing/skillgroups/%s/members/divisions", routingAPI.Configuration.BasePath, d.Id())
@@ -509,13 +477,13 @@ func readSkillGroupMemberDivisionIds(d *schema.ResourceData, routingAPI *platfor
response, err := apiClient.CallAPI(path, "GET", nil, headers, nil, nil, "", nil)
if err != nil || response.Error != nil {
- return nil, util.BuildAPIDiagnosticError("genesyscloud_routing_skill_group", fmt.Sprintf("Failed to get member divisions for skill group %s error: %s", d.Id(), err), response)
+ return nil, util.BuildAPIDiagnosticError(getSkillGroupResourceName(), fmt.Sprintf("Failed to get member divisions for skill group %s error: %s", d.Id(), err), response)
}
memberDivisionsPayload := make(map[string]interface{}, 0)
err = json.Unmarshal(response.RawBody, &memberDivisionsPayload)
if err != nil {
- return nil, util.BuildDiagnosticError("genesyscloud_routing_skill_group", fmt.Sprintf("Failed to unmarshal member divisions"), err)
+ return nil, util.BuildDiagnosticError(getSkillGroupResourceName(), fmt.Sprintf("Failed to unmarshal member divisions"), err)
}
apiSkillGroupMemberDivisionIds := make([]string, 0)
@@ -593,9 +561,9 @@ func GenerateRoutingSkillGroupResourceBasic(
resourceID string,
name string,
description string) string {
- return fmt.Sprintf(`resource "genesyscloud_routing_skill_group" "%s" {
+ return fmt.Sprintf(`resource "%s" "%s" {
name = "%s"
description="%s"
}
- `, resourceID, name, description)
+ `, getSkillGroupResourceName(), resourceID, name, description)
}
diff --git a/genesyscloud/resource_genesyscloud_routing_skill_group_test.go b/genesyscloud/resource_genesyscloud_routing_skill_group_test.go
index 4c7caa783..311e08fc7 100644
--- a/genesyscloud/resource_genesyscloud_routing_skill_group_test.go
+++ b/genesyscloud/resource_genesyscloud_routing_skill_group_test.go
@@ -17,7 +17,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func testAccCheckSkillConditions(resourceName string, targetSkillConditionJson string) resource.TestCheckFunc {
@@ -391,7 +391,6 @@ data "genesyscloud_auth_division_home" "home" {}
3. Verify the skill group added those users when they match the skill expression.
*/
func TestAccResourceRoutingSkillGroupMemberDivisionsUsersAssigned(t *testing.T) {
- t.Parallel()
var (
skillGroupResourceId = "testskillgroup3"
skillGroupName = "testskillgroup3 " + uuid.NewString()
@@ -422,6 +421,9 @@ func TestAccResourceRoutingSkillGroupMemberDivisionsUsersAssigned(t *testing.T)
"genesyscloud_auth_division." + division2ResourceId + ".id",
"genesyscloud_auth_division." + division3ResourceId + ".id",
}
+ userID1 string
+ userID2 string
+ userID3 string
)
routingSkillResource := GenerateRoutingSkillResource(routingSkillResourceId, routingSkillName)
@@ -501,6 +503,9 @@ resource "genesyscloud_routing_skill_group" "%s" {
ProviderFactories: provider.GetProviderFactories(providerResources, providerDataSources),
Steps: []resource.TestStep{
{
+ PreConfig: func() {
+ time.Sleep(30 * time.Second)
+ },
Config: skillGroupResource +
routingSkillResource +
division1Resource +
@@ -511,6 +516,25 @@ resource "genesyscloud_routing_skill_group" "%s" {
user3Resource,
Check: resource.ComposeTestCheckFunc(
testVerifySkillGroupMemberCount("genesyscloud_routing_skill_group."+skillGroupResourceId, "3"),
+ func(s *terraform.State) error {
+ rs, ok := s.RootModule().Resources["genesyscloud_user."+user1ResourceId]
+ if !ok {
+ return fmt.Errorf("not found: %s", "genesyscloud_user."+user1ResourceId)
+ }
+ userID1 = rs.Primary.ID
+ log.Printf("User ID: %s\n", userID1) // Print user ID
+ rs, ok = s.RootModule().Resources["genesyscloud_user."+user2ResourceId]
+ if !ok {
+ return fmt.Errorf("not found: %s", "genesyscloud_user."+user2ResourceId)
+ }
+ userID2 = rs.Primary.ID
+ rs, ok = s.RootModule().Resources["genesyscloud_user."+user3ResourceId]
+ if !ok {
+ return fmt.Errorf("not found: %s", "genesyscloud_user."+user3ResourceId)
+ }
+ userID3 = rs.Primary.ID
+ return nil
+ },
),
},
{
@@ -518,6 +542,11 @@ resource "genesyscloud_routing_skill_group" "%s" {
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"member_division_ids"},
+ Check: resource.ComposeTestCheckFunc(
+ checkUserDeleted(userID1),
+ checkUserDeleted(userID2),
+ checkUserDeleted(userID3),
+ ),
},
},
CheckDestroy: testVerifySkillGroupDestroyed,
@@ -574,7 +603,7 @@ func testVerifySkillGroupMemberCount(resourceName string, count string) resource
// get skill group via GET /api/v2/routing/skillgroups/{skillGroupId}
path := fmt.Sprintf("%s/api/v2/routing/skillgroups/%s", routingAPI.Configuration.BasePath, resourceID)
- headers := buildHeaderParams(routingAPI)
+ headers := BuildHeaderParams(routingAPI)
apiClient := &routingAPI.Configuration.APIClient
response, err := apiClient.CallAPI(path, "GET", nil, headers, nil, nil, "", nil)
@@ -706,7 +735,7 @@ func testVerifySkillGroupDestroyed(state *terraform.State) error {
// TODO Once this code has been released into the public API we should fix this and use the SDK
- headerParams := buildHeaderParams(routingAPI)
+ headerParams := BuildHeaderParams(routingAPI)
for _, rs := range state.RootModule().Resources {
if rs.Type != "genesyscloud_routing_skill_group" {
continue
@@ -737,7 +766,7 @@ func testVerifySkillGroupDestroyed(state *terraform.State) error {
}
func getAllSkillGroupMemberDivisionIds(routingAPI *platformclientv2.RoutingApi, resourceId string) ([]string, diag.Diagnostics) {
- headers := buildHeaderParams(routingAPI)
+ headers := BuildHeaderParams(routingAPI)
apiClient := &routingAPI.Configuration.APIClient
path := fmt.Sprintf("%s/api/v2/routing/skillgroups/%s/members/divisions", routingAPI.Configuration.BasePath, resourceId)
response, err := apiClient.CallAPI(path, "GET", nil, headers, nil, nil, "", nil)
@@ -761,3 +790,45 @@ func getAllSkillGroupMemberDivisionIds(routingAPI *platformclientv2.RoutingApi,
return apiSkillGroupMemberDivisionIds, nil
}
+
+func checkUserDeleted(id string) resource.TestCheckFunc {
+ log.Printf("Fetching user with ID: %s\n", id)
+ return func(s *terraform.State) error {
+ maxAttempts := 18
+ for i := 0; i < maxAttempts; i++ {
+
+ deleted, err := isUserDeleted(id)
+ if err != nil {
+ return err
+ }
+ if deleted {
+ return nil
+ }
+ time.Sleep(10 * time.Second)
+ }
+ return fmt.Errorf("user %s was not deleted properly", id)
+ }
+}
+
+func isUserDeleted(id string) (bool, error) {
+ mu.Lock()
+ defer mu.Unlock()
+
+ usersAPI := platformclientv2.NewUsersApiWithConfig(sdkConfig)
+ // Attempt to get the user
+ _, response, err := usersAPI.GetUser(id, nil, "", "")
+
+ // Check if the user is not found (deleted)
+ if response != nil && response.StatusCode == 404 {
+ return true, nil // User is deleted
+ }
+
+ // Handle other errors
+ if err != nil {
+ log.Printf("Error fetching user: %v", err)
+ return false, err
+ }
+
+ // If user is found, it means the user is not deleted
+ return false, nil
+}
diff --git a/genesyscloud/resource_genesyscloud_routing_skill_test.go b/genesyscloud/resource_genesyscloud_routing_skill_test.go
index b213ac5af..551c061a6 100644
--- a/genesyscloud/resource_genesyscloud_routing_skill_test.go
+++ b/genesyscloud/resource_genesyscloud_routing_skill_test.go
@@ -9,7 +9,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceRoutingSkillBasic(t *testing.T) {
diff --git a/genesyscloud/resource_genesyscloud_routing_utilization.go b/genesyscloud/resource_genesyscloud_routing_utilization.go
deleted file mode 100644
index 3cc9614df..000000000
--- a/genesyscloud/resource_genesyscloud_routing_utilization.go
+++ /dev/null
@@ -1,389 +0,0 @@
-package genesyscloud
-
-import (
- "context"
- "encoding/json"
- "fmt"
- "log"
- "sort"
- "strings"
- "terraform-provider-genesyscloud/genesyscloud/provider"
- "terraform-provider-genesyscloud/genesyscloud/util"
- "terraform-provider-genesyscloud/genesyscloud/util/constants"
- "time"
-
- "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
-
- "terraform-provider-genesyscloud/genesyscloud/consistency_checker"
-
- resourceExporter "terraform-provider-genesyscloud/genesyscloud/resource_exporter"
- lists "terraform-provider-genesyscloud/genesyscloud/util/lists"
-
- "github.com/hashicorp/terraform-plugin-sdk/v2/diag"
- "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
-)
-
-type MediaUtilization struct {
- MaximumCapacity int32 `json:"maximumCapacity"`
- InterruptableMediaTypes []string `json:"interruptableMediaTypes"`
- IncludeNonAcd bool `json:"includeNonAcd"`
-}
-
-type LabelUtilization struct {
- MaximumCapacity int32 `json:"maximumCapacity"`
- InterruptingLabelIds []string `json:"interruptingLabelIds"`
-}
-
-type OrgUtilizationWithLabels struct {
- Utilization map[string]MediaUtilization `json:"utilization"`
- LabelUtilizations map[string]LabelUtilization `json:"labelUtilizations"`
-}
-
-var (
- // Map of SDK media type name to schema media type name
- utilizationMediaTypes = map[string]string{
- "call": "call",
- "callback": "callback",
- "chat": "chat",
- "email": "email",
- "message": "message",
- }
-
- utilizationSettingsResource = &schema.Resource{
- Schema: map[string]*schema.Schema{
- "maximum_capacity": {
- Description: "Maximum capacity of conversations of this media type. Value must be between 0 and 25.",
- Type: schema.TypeInt,
- Required: true,
- ValidateFunc: validation.IntBetween(0, 25),
- },
- "interruptible_media_types": {
- Description: fmt.Sprintf("Set of other media types that can interrupt this media type (%s).", strings.Join(getSdkUtilizationTypes(), " | ")),
- Type: schema.TypeSet,
- Optional: true,
- Elem: &schema.Schema{Type: schema.TypeString},
- },
- "include_non_acd": {
- Description: "Block this media type when on a non-ACD conversation.",
- Type: schema.TypeBool,
- Optional: true,
- Default: false,
- },
- },
- }
-
- utilizationLabelResource = &schema.Resource{
- Schema: map[string]*schema.Schema{
- "label_id": {
- Description: "Id of the label being configured.",
- Type: schema.TypeString,
- Required: true,
- },
- "maximum_capacity": {
- Description: "Maximum capacity of conversations with this label. Value must be between 0 and 25.",
- Type: schema.TypeInt,
- Required: true,
- ValidateFunc: validation.IntBetween(0, 25),
- },
- "interrupting_label_ids": {
- Description: "Set of other labels that can interrupt this label.",
- Type: schema.TypeSet,
- Optional: true,
- Elem: &schema.Schema{Type: schema.TypeString},
- },
- },
- }
-)
-
-func getSdkUtilizationTypes() []string {
- types := make([]string, 0, len(utilizationMediaTypes))
- for t := range utilizationMediaTypes {
- types = append(types, t)
- }
- sort.Strings(types)
- return types
-}
-
-func getAllRoutingUtilization(_ context.Context, _ *platformclientv2.Configuration) (resourceExporter.ResourceIDMetaMap, diag.Diagnostics) {
- // Routing utilization config always exists
- resources := make(resourceExporter.ResourceIDMetaMap)
- resources["0"] = &resourceExporter.ResourceMeta{Name: "routing_utilization"}
- return resources, nil
-}
-
-func RoutingUtilizationExporter() *resourceExporter.ResourceExporter {
- return &resourceExporter.ResourceExporter{
- GetResourcesFunc: provider.GetAllWithPooledClient(getAllRoutingUtilization),
- RefAttrs: map[string]*resourceExporter.RefAttrSettings{}, // No references
- AllowZeroValues: []string{"maximum_capacity"},
- }
-}
-
-func ResourceRoutingUtilization() *schema.Resource {
- return &schema.Resource{
- Description: "Genesys Cloud Org-wide Routing Utilization Settings.",
-
- CreateContext: provider.CreateWithPooledClient(createRoutingUtilization),
- ReadContext: provider.ReadWithPooledClient(readRoutingUtilization),
- UpdateContext: provider.UpdateWithPooledClient(updateRoutingUtilization),
- DeleteContext: provider.DeleteWithPooledClient(deleteRoutingUtilization),
- Importer: &schema.ResourceImporter{
- StateContext: schema.ImportStatePassthroughContext,
- },
- SchemaVersion: 1,
- Timeouts: &schema.ResourceTimeout{
- Update: schema.DefaultTimeout(8 * time.Minute),
- Read: schema.DefaultTimeout(8 * time.Minute),
- },
- Schema: map[string]*schema.Schema{
- "call": {
- Description: "Call media settings. If not set, this reverts to the default media type settings.",
- Type: schema.TypeList,
- MaxItems: 1,
- Optional: true,
- Computed: true,
- Elem: utilizationSettingsResource,
- },
- "callback": {
- Description: "Callback media settings. If not set, this reverts to the default media type settings.",
- Type: schema.TypeList,
- MaxItems: 1,
- Optional: true,
- Computed: true,
- Elem: utilizationSettingsResource,
- },
- "message": {
- Description: "Message media settings. If not set, this reverts to the default media type settings.",
- Type: schema.TypeList,
- MaxItems: 1,
- Optional: true,
- Computed: true,
- Elem: utilizationSettingsResource,
- },
- "email": {
- Description: "Email media settings. If not set, this reverts to the default media type settings.",
- Type: schema.TypeList,
- MaxItems: 1,
- Optional: true,
- Computed: true,
- Elem: utilizationSettingsResource,
- },
- "chat": {
- Description: "Chat media settings. If not set, this reverts to the default media type settings.",
- Type: schema.TypeList,
- MaxItems: 1,
- Optional: true,
- Computed: true,
- Elem: utilizationSettingsResource,
- },
- "label_utilizations": {
- Description: "Label utilization settings. If not set, default label settings will be applied. This is in PREVIEW and should not be used unless the feature is available to your organization.",
- Type: schema.TypeList,
- Optional: true,
- Computed: true,
- Elem: utilizationLabelResource,
- },
- },
- }
-}
-
-func createRoutingUtilization(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
- log.Printf("Creating Routing Utilization")
- d.SetId("routing_utilization")
- return updateRoutingUtilization(ctx, d, meta)
-}
-
-func readRoutingUtilization(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
- // Calling the Utilization API directly while the label feature is not available.
- // Once it is, this code can go back to using platformclientv2's RoutingApi to make the call.
- sdkConfig := meta.(*provider.ProviderMeta).ClientConfig
- routingAPI := platformclientv2.NewRoutingApiWithConfig(sdkConfig)
- apiClient := &routingAPI.Configuration.APIClient
- cc := consistency_checker.NewConsistencyCheck(ctx, d, meta, ResourceRoutingSkill(), constants.DefaultConsistencyChecks, "genesyscloud_routing_utilization")
-
- path := fmt.Sprintf("%s/api/v2/routing/utilization", routingAPI.Configuration.BasePath)
- headerParams := buildHeaderParams(routingAPI)
-
- log.Printf("Reading Routing Utilization")
- return util.WithRetriesForRead(ctx, d, func() *retry.RetryError {
- response, err := apiClient.CallAPI(path, "GET", nil, headerParams, nil, nil, "", nil)
- if err != nil {
- if util.IsStatus404(response) {
- return retry.RetryableError(util.BuildWithRetriesApiDiagnosticError("genesyscloud_routing_utilization", fmt.Sprintf("Failed to read Routing Utilization: %s", err), response))
- }
- return retry.NonRetryableError(util.BuildWithRetriesApiDiagnosticError("genesyscloud_routing_utilization", fmt.Sprintf("Failed to read Routing Utilization: %s", err), response))
- }
-
- orgUtilization := &OrgUtilizationWithLabels{}
- err = json.Unmarshal(response.RawBody, &orgUtilization)
-
- if orgUtilization.Utilization != nil {
- for sdkType, schemaType := range utilizationMediaTypes {
- if mediaSettings, ok := orgUtilization.Utilization[sdkType]; ok {
- d.Set(schemaType, flattenUtilizationSetting(mediaSettings))
- } else {
- d.Set(schemaType, nil)
- }
- }
- }
-
- if orgUtilization.LabelUtilizations != nil {
- originalLabelUtilizations := d.Get("label_utilizations").([]interface{})
-
- // Only add to the state the configured labels, in the configured order, but not any extras, to help terraform with matching new and old state.
- flattenedLabelUtilizations := filterAndFlattenLabelUtilizations(orgUtilization.LabelUtilizations, originalLabelUtilizations)
- d.Set("label_utilizations", flattenedLabelUtilizations)
- }
-
- log.Printf("Read Routing Utilization")
- return cc.CheckState(d)
- })
-}
-
-func updateRoutingUtilization(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
- sdkConfig := meta.(*provider.ProviderMeta).ClientConfig
- routingAPI := platformclientv2.NewRoutingApiWithConfig(sdkConfig)
-
- var resp *platformclientv2.APIResponse
- var err error
-
- log.Printf("Updating Routing Utilization")
-
- labelUtilizations := d.Get("label_utilizations").([]interface{})
-
- // Retrying on 409s because if a label is created immediately before the utilization update, it can lead to a conflict while the utilization is being updated to handle the new label.
- diagErr := util.RetryWhen(util.IsStatus409, func() (*platformclientv2.APIResponse, diag.Diagnostics) {
- // If the resource has label(s), calls the Utilization API directly.
- // This code can go back to using platformclientv2's RoutingApi to make the call once label utilization is available in platformclientv2's RoutingApi.
- if labelUtilizations != nil && len(labelUtilizations) > 0 {
- apiClient := &routingAPI.Configuration.APIClient
-
- path := fmt.Sprintf("%s/api/v2/routing/utilization", routingAPI.Configuration.BasePath)
- headerParams := buildHeaderParams(routingAPI)
- requestPayload := make(map[string]interface{})
- requestPayload["utilization"] = buildSdkMediaUtilizations(d)
- requestPayload["labelUtilizations"] = buildLabelUtilizationsRequest(labelUtilizations)
- resp, err = apiClient.CallAPI(path, "PUT", requestPayload, headerParams, nil, nil, "", nil)
- } else {
- _, resp, err = routingAPI.PutRoutingUtilization(platformclientv2.Utilizationrequest{
- Utilization: buildSdkMediaUtilizations(d),
- })
- }
-
- if err != nil {
- return resp, util.BuildAPIDiagnosticError("genesyscloud_routing_utilization", fmt.Sprintf("Failed to update Routing Utilization %s error: %s", d.Id(), err), resp)
- }
- return resp, nil
- })
-
- if diagErr != nil {
- return diagErr
- }
-
- log.Printf("Updated Routing Utilization")
- return readRoutingUtilization(ctx, d, meta)
-}
-
-func deleteRoutingUtilization(_ context.Context, _ *schema.ResourceData, meta interface{}) diag.Diagnostics {
- sdkConfig := meta.(*provider.ProviderMeta).ClientConfig
- routingAPI := platformclientv2.NewRoutingApiWithConfig(sdkConfig)
-
- // Resets to default values
- log.Printf("Resetting Routing Utilization")
- resp, err := routingAPI.DeleteRoutingUtilization()
- if err != nil {
- return util.BuildAPIDiagnosticError("genesyscloud_routing_utilization", fmt.Sprintf("Failed to reset Routing Utilization error: %s", err), resp)
- }
- log.Printf("Reset Routing Utilization")
- return nil
-}
-
-func flattenUtilizationSetting(settings MediaUtilization) []interface{} {
- settingsMap := make(map[string]interface{})
-
- settingsMap["maximum_capacity"] = settings.MaximumCapacity
- settingsMap["include_non_acd"] = settings.IncludeNonAcd
- if settings.InterruptableMediaTypes != nil {
- settingsMap["interruptible_media_types"] = lists.StringListToSet(settings.InterruptableMediaTypes)
- }
-
- return []interface{}{settingsMap}
-}
-
-func filterAndFlattenLabelUtilizations(labelUtilizations map[string]LabelUtilization, originalLabelUtilizations []interface{}) []interface{} {
- flattenedLabelUtilizations := make([]interface{}, 0)
-
- for _, originalLabelUtilization := range originalLabelUtilizations {
- originalLabelId := (originalLabelUtilization.(map[string]interface{}))["label_id"].(string)
-
- for currentLabelId, currentLabelUtilization := range labelUtilizations {
- if currentLabelId == originalLabelId {
- flattenedLabelUtilizations = append(flattenedLabelUtilizations, flattenLabelUtilization(currentLabelId, currentLabelUtilization))
- delete(labelUtilizations, currentLabelId)
- break
- }
- }
- }
-
- return flattenedLabelUtilizations
-}
-
-func flattenLabelUtilization(labelId string, labelUtilization LabelUtilization) map[string]interface{} {
- utilizationMap := make(map[string]interface{})
-
- utilizationMap["label_id"] = labelId
- utilizationMap["maximum_capacity"] = labelUtilization.MaximumCapacity
- if labelUtilization.InterruptingLabelIds != nil {
- utilizationMap["interrupting_label_ids"] = lists.StringListToSet(labelUtilization.InterruptingLabelIds)
- }
-
- return utilizationMap
-}
-
-func buildSdkMediaUtilizations(d *schema.ResourceData) *map[string]platformclientv2.Mediautilization {
- settings := make(map[string]platformclientv2.Mediautilization)
-
- for sdkType, schemaType := range utilizationMediaTypes {
- mediaSettings := d.Get(schemaType).([]interface{})
- if mediaSettings != nil && len(mediaSettings) > 0 {
- settings[sdkType] = buildSdkMediaUtilization(mediaSettings)
- }
- }
-
- return &settings
-}
-
-func buildSdkMediaUtilization(settings []interface{}) platformclientv2.Mediautilization {
- settingsMap := settings[0].(map[string]interface{})
-
- maxCapacity := settingsMap["maximum_capacity"].(int)
- includeNonAcd := settingsMap["include_non_acd"].(bool)
-
- // Optional
- interruptableMediaTypes := &[]string{}
- if types, ok := settingsMap["interruptible_media_types"]; ok {
- interruptableMediaTypes = lists.SetToStringList(types.(*schema.Set))
- }
-
- return platformclientv2.Mediautilization{
- MaximumCapacity: &maxCapacity,
- IncludeNonAcd: &includeNonAcd,
- InterruptableMediaTypes: interruptableMediaTypes,
- }
-}
-
-func buildLabelUtilizationsRequest(labelUtilizations []interface{}) map[string]LabelUtilization {
- request := make(map[string]LabelUtilization)
- for _, labelUtilization := range labelUtilizations {
- labelUtilizationMap := labelUtilization.(map[string]interface{})
- interruptingLabelIds := lists.SetToStringList(labelUtilizationMap["interrupting_label_ids"].(*schema.Set))
-
- request[labelUtilizationMap["label_id"].(string)] = LabelUtilization{
- MaximumCapacity: int32(labelUtilizationMap["maximum_capacity"].(int)),
- InterruptingLabelIds: *interruptingLabelIds,
- }
- }
- return request
-}
diff --git a/genesyscloud/resource_genesyscloud_routing_utilization_label.go b/genesyscloud/resource_genesyscloud_routing_utilization_label.go
deleted file mode 100644
index 209be66a0..000000000
--- a/genesyscloud/resource_genesyscloud_routing_utilization_label.go
+++ /dev/null
@@ -1,162 +0,0 @@
-package genesyscloud
-
-import (
- "context"
- "fmt"
- "log"
- "terraform-provider-genesyscloud/genesyscloud/provider"
- "terraform-provider-genesyscloud/genesyscloud/util"
- "terraform-provider-genesyscloud/genesyscloud/util/constants"
- "time"
-
- "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
-
- "terraform-provider-genesyscloud/genesyscloud/consistency_checker"
-
- resourceExporter "terraform-provider-genesyscloud/genesyscloud/resource_exporter"
-
- "github.com/hashicorp/terraform-plugin-sdk/v2/diag"
- "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
-)
-
-func getAllRoutingUtilizationLabels(_ context.Context, clientConfig *platformclientv2.Configuration) (resourceExporter.ResourceIDMetaMap, diag.Diagnostics) {
- resources := make(resourceExporter.ResourceIDMetaMap)
- routingAPI := platformclientv2.NewRoutingApiWithConfig(clientConfig)
-
- for pageNum := 1; ; pageNum++ {
- const pageSize = 100
- labels, resp, getErr := routingAPI.GetRoutingUtilizationLabels(pageSize, pageNum, "", "")
- if getErr != nil {
- return nil, util.BuildAPIDiagnosticError("genesyscloud_routing_utilization_label", fmt.Sprintf("Failed to get page of labels error: %s", getErr), resp)
- }
-
- if labels.Entities == nil || len(*labels.Entities) == 0 {
- break
- }
-
- for _, label := range *labels.Entities {
- resources[*label.Id] = &resourceExporter.ResourceMeta{Name: *label.Name}
- }
- }
-
- return resources, nil
-}
-
-func RoutingUtilizationLabelExporter() *resourceExporter.ResourceExporter {
- return &resourceExporter.ResourceExporter{
- GetResourcesFunc: provider.GetAllWithPooledClient(getAllRoutingUtilizationLabels),
- RefAttrs: map[string]*resourceExporter.RefAttrSettings{}, // No references
- }
-}
-
-func ResourceRoutingUtilizationLabel() *schema.Resource {
- return &schema.Resource{
- Description: "Genesys Cloud Routing Utilization Label. This resource is not yet widely available. Only use it if the feature is enabled.",
-
- CreateContext: provider.CreateWithPooledClient(createRoutingUtilizationLabel),
- ReadContext: provider.ReadWithPooledClient(readRoutingUtilizationLabel),
- UpdateContext: provider.UpdateWithPooledClient(updateRoutingUtilizationLabel),
- DeleteContext: provider.DeleteWithPooledClient(deleteRoutingUtilizationLabel),
- Importer: &schema.ResourceImporter{
- StateContext: schema.ImportStatePassthroughContext,
- },
- SchemaVersion: 1,
- Schema: map[string]*schema.Schema{
- "name": {
- Description: "Label name.",
- Type: schema.TypeString,
- Required: true,
- },
- },
- }
-}
-
-func createRoutingUtilizationLabel(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
- name := d.Get("name").(string)
-
- sdkConfig := meta.(*provider.ProviderMeta).ClientConfig
- routingAPI := platformclientv2.NewRoutingApiWithConfig(sdkConfig)
-
- log.Printf("Creating label %s", name)
- label, resp, err := routingAPI.PostRoutingUtilizationLabels(platformclientv2.Createutilizationlabelrequest{
- Name: &name,
- })
- if err != nil {
- return util.BuildAPIDiagnosticError("genesyscloud_routing_utilization_label", fmt.Sprintf("Failed to create label %s error: %s", name, err), resp)
- }
-
- d.SetId(*label.Id)
-
- log.Printf("Created label %s %s", name, *label.Id)
- return readRoutingUtilizationLabel(ctx, d, meta)
-}
-
-func updateRoutingUtilizationLabel(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
- sdkConfig := meta.(*provider.ProviderMeta).ClientConfig
- routingAPI := platformclientv2.NewRoutingApiWithConfig(sdkConfig)
-
- id := d.Id()
- name := d.Get("name").(string)
-
- log.Printf("Updating label %s with name %s", id, name)
-
- _, resp, err := routingAPI.PutRoutingUtilizationLabel(id, platformclientv2.Updateutilizationlabelrequest{
- Name: &name,
- })
- if err != nil {
- return util.BuildAPIDiagnosticError("genesyscloud_routing_utilization_label", fmt.Sprintf("Failed to update label %s error: %s", id, err), resp)
- }
-
- log.Printf("Updated label %s", id)
- return readRoutingUtilizationLabel(ctx, d, meta)
-}
-
-func readRoutingUtilizationLabel(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
- sdkConfig := meta.(*provider.ProviderMeta).ClientConfig
- routingApi := platformclientv2.NewRoutingApiWithConfig(sdkConfig)
- cc := consistency_checker.NewConsistencyCheck(ctx, d, meta, ResourceRoutingUtilizationLabel(), constants.DefaultConsistencyChecks, "genesyscloud_routing_utilization_label")
-
- log.Printf("Reading label %s", d.Id())
- return util.WithRetriesForRead(ctx, d, func() *retry.RetryError {
- label, resp, getErr := routingApi.GetRoutingUtilizationLabel(d.Id())
- if getErr != nil {
- if util.IsStatus404(resp) {
- return retry.RetryableError(util.BuildWithRetriesApiDiagnosticError("genesyscloud_routing_utilization_label", fmt.Sprintf("Failed to read label %s | error: %s", d.Id(), getErr), resp))
- }
- return retry.NonRetryableError(util.BuildWithRetriesApiDiagnosticError("genesyscloud_routing_utilization_label", fmt.Sprintf("Failed to read label %s | error: %s", d.Id(), getErr), resp))
- }
-
- d.Set("name", *label.Name)
- log.Printf("Read label %s %s", d.Id(), *label.Name)
- return cc.CheckState(d)
- })
-}
-
-func deleteRoutingUtilizationLabel(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
- name := d.Get("name").(string)
-
- sdkConfig := meta.(*provider.ProviderMeta).ClientConfig
- routingApi := platformclientv2.NewRoutingApiWithConfig(sdkConfig)
-
- log.Printf("Deleting label %s", name)
- resp, err := routingApi.DeleteRoutingUtilizationLabel(d.Id(), true)
-
- if err != nil {
- return util.BuildAPIDiagnosticError("genesyscloud_routing_utilization_label", fmt.Sprintf("Failed to delete label %s error: %s", name, err), resp)
- }
-
- return util.WithRetries(ctx, 30*time.Second, func() *retry.RetryError {
- _, resp, err := routingApi.GetRoutingUtilizationLabel(d.Id())
- if err != nil {
- if util.IsStatus404(resp) {
- // Routing label deleted
- log.Printf("Deleted Routing label %s", d.Id())
- return nil
- }
- return retry.NonRetryableError(util.BuildWithRetriesApiDiagnosticError("genesyscloud_routing_utilization_label", fmt.Sprintf("Error deleting Routing label %s: %s", d.Id(), err), resp))
- }
-
- return retry.RetryableError(util.BuildWithRetriesApiDiagnosticError("genesyscloud_routing_utilization_label", fmt.Sprintf("Routing label %s still exists", d.Id()), resp))
- })
-}
diff --git a/genesyscloud/resource_genesyscloud_routing_wrapupcode.go b/genesyscloud/resource_genesyscloud_routing_wrapupcode.go
index 32e3be970..962e28073 100644
--- a/genesyscloud/resource_genesyscloud_routing_wrapupcode.go
+++ b/genesyscloud/resource_genesyscloud_routing_wrapupcode.go
@@ -17,7 +17,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func getAllRoutingWrapupCodes(_ context.Context, clientConfig *platformclientv2.Configuration) (resourceExporter.ResourceIDMetaMap, diag.Diagnostics) {
diff --git a/genesyscloud/resource_genesyscloud_routing_wrapupcode_test.go b/genesyscloud/resource_genesyscloud_routing_wrapupcode_test.go
index 7102e6167..d4becc64d 100644
--- a/genesyscloud/resource_genesyscloud_routing_wrapupcode_test.go
+++ b/genesyscloud/resource_genesyscloud_routing_wrapupcode_test.go
@@ -9,7 +9,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceRoutingWrapupcode(t *testing.T) {
diff --git a/genesyscloud/resource_genesyscloud_user.go b/genesyscloud/resource_genesyscloud_user.go
index 8387da786..79baca358 100644
--- a/genesyscloud/resource_genesyscloud_user.go
+++ b/genesyscloud/resource_genesyscloud_user.go
@@ -7,6 +7,7 @@ import (
"log"
"strings"
"terraform-provider-genesyscloud/genesyscloud/provider"
+ routingUtilization "terraform-provider-genesyscloud/genesyscloud/routing_utilization"
"terraform-provider-genesyscloud/genesyscloud/util"
"terraform-provider-genesyscloud/genesyscloud/util/constants"
"terraform-provider-genesyscloud/genesyscloud/validators"
@@ -23,14 +24,14 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"github.com/nyaruka/phonenumbers"
)
type AgentUtilizationWithLabels struct {
- Utilization map[string]MediaUtilization `json:"utilization"`
- LabelUtilizations map[string]LabelUtilization `json:"labelUtilizations"`
- Level string `json:"level"`
+ Utilization map[string]routingUtilization.MediaUtilization `json:"utilization"`
+ LabelUtilizations map[string]routingUtilization.LabelUtilization `json:"labelUtilizations"`
+ Level string `json:"level"`
}
var (
@@ -377,7 +378,7 @@ func ResourceUser() *schema.Resource {
Optional: true,
Computed: true,
ConfigMode: schema.SchemaConfigModeAttr,
- Elem: utilizationSettingsResource,
+ Elem: routingUtilization.UtilizationSettingsResource,
},
"callback": {
Description: "Callback media settings. If not set, this reverts to the default media type settings.",
@@ -386,7 +387,7 @@ func ResourceUser() *schema.Resource {
Optional: true,
Computed: true,
ConfigMode: schema.SchemaConfigModeAttr,
- Elem: utilizationSettingsResource,
+ Elem: routingUtilization.UtilizationSettingsResource,
},
"message": {
Description: "Message media settings. If not set, this reverts to the default media type settings.",
@@ -395,7 +396,7 @@ func ResourceUser() *schema.Resource {
Optional: true,
Computed: true,
ConfigMode: schema.SchemaConfigModeAttr,
- Elem: utilizationSettingsResource,
+ Elem: routingUtilization.UtilizationSettingsResource,
},
"email": {
Description: "Email media settings. If not set, this reverts to the default media type settings.",
@@ -404,7 +405,7 @@ func ResourceUser() *schema.Resource {
Optional: true,
Computed: true,
ConfigMode: schema.SchemaConfigModeAttr,
- Elem: utilizationSettingsResource,
+ Elem: routingUtilization.UtilizationSettingsResource,
},
"chat": {
Description: "Chat media settings. If not set, this reverts to the default media type settings.",
@@ -413,7 +414,7 @@ func ResourceUser() *schema.Resource {
Optional: true,
Computed: true,
ConfigMode: schema.SchemaConfigModeAttr,
- Elem: utilizationSettingsResource,
+ Elem: routingUtilization.UtilizationSettingsResource,
},
"label_utilizations": {
Description: "Label utilization settings. If not set, default label settings will be applied. This is in PREVIEW and should not be used unless the feature is available to your organization.",
@@ -421,7 +422,7 @@ func ResourceUser() *schema.Resource {
Optional: true,
Computed: true,
ConfigMode: schema.SchemaConfigModeAttr,
- Elem: utilizationLabelResource,
+ Elem: routingUtilization.UtilizationLabelResource,
},
},
},
@@ -1050,7 +1051,7 @@ func readUserRoutingUtilization(d *schema.ResourceData, sdkConfig *platformclien
apiClient := &routingAPI.Configuration.APIClient
path := fmt.Sprintf("%s/api/v2/routing/users/%s/utilization", routingAPI.Configuration.BasePath, d.Id())
- headerParams := buildHeaderParams(routingAPI)
+ headerParams := BuildHeaderParams(routingAPI)
response, err := apiClient.CallAPI(path, "GET", nil, headerParams, nil, nil, "", nil)
if err != nil {
@@ -1073,9 +1074,9 @@ func readUserRoutingUtilization(d *schema.ResourceData, sdkConfig *platformclien
allSettings := map[string]interface{}{}
if agentUtilization.Utilization != nil {
- for sdkType, schemaType := range utilizationMediaTypes {
+ for sdkType, schemaType := range routingUtilization.UtilizationMediaTypes {
if mediaSettings, ok := agentUtilization.Utilization[sdkType]; ok {
- allSettings[schemaType] = flattenUtilizationSetting(mediaSettings)
+ allSettings[schemaType] = routingUtilization.FlattenUtilizationSetting(mediaSettings)
}
}
}
@@ -1087,7 +1088,7 @@ func readUserRoutingUtilization(d *schema.ResourceData, sdkConfig *platformclien
originalLabelUtilizations := originalSettings["label_utilizations"].([]interface{})
// Only add to the state the configured labels, in the configured order, but not any extras, to help terraform with matching new and old state.
- filteredLabelUtilizations := filterAndFlattenLabelUtilizations(agentUtilization.LabelUtilizations, originalLabelUtilizations)
+ filteredLabelUtilizations := routingUtilization.FilterAndFlattenLabelUtilizations(agentUtilization.LabelUtilizations, originalLabelUtilizations)
allSettings["label_utilizations"] = filteredLabelUtilizations
} else {
@@ -1293,16 +1294,17 @@ func updateUserRoutingUtilization(d *schema.ResourceData, usersAPI *platformclie
apiClient := &routingAPI.Configuration.APIClient
path := fmt.Sprintf("%s/api/v2/routing/users/%s/utilization", routingAPI.Configuration.BasePath, d.Id())
- headerParams := buildHeaderParams(routingAPI)
+ headerParams := BuildHeaderParams(routingAPI)
requestPayload := make(map[string]interface{})
requestPayload["utilization"] = buildMediaTypeUtilizations(allSettings)
- requestPayload["labelUtilizations"] = buildLabelUtilizationsRequest(labelUtilizations)
+
+ requestPayload["labelUtilizations"] = routingUtilization.BuildLabelUtilizationsRequest(labelUtilizations)
_, err = apiClient.CallAPI(path, "PUT", requestPayload, headerParams, nil, nil, "", nil)
} else {
sdkSettings := make(map[string]platformclientv2.Mediautilization)
- for sdkType, schemaType := range utilizationMediaTypes {
+ for sdkType, schemaType := range routingUtilization.UtilizationMediaTypes {
if mediaSettings, ok := allSettings[schemaType]; ok && len(mediaSettings.([]interface{})) > 0 {
- sdkSettings[sdkType] = buildSdkMediaUtilization(mediaSettings.([]interface{}))
+ sdkSettings[sdkType] = routingUtilization.BuildSdkMediaUtilization(mediaSettings.([]interface{}))
}
}
@@ -1391,10 +1393,10 @@ func flattenUserCertifications(certs *[]string) *schema.Set {
func buildMediaTypeUtilizations(allUtilizations map[string]interface{}) *map[string]platformclientv2.Mediautilization {
settings := make(map[string]platformclientv2.Mediautilization)
- for sdkType, schemaType := range utilizationMediaTypes {
+ for sdkType, schemaType := range routingUtilization.UtilizationMediaTypes {
mediaSettings := allUtilizations[schemaType].([]interface{})
if mediaSettings != nil && len(mediaSettings) > 0 {
- settings[sdkType] = buildSdkMediaUtilization(mediaSettings)
+ settings[sdkType] = routingUtilization.BuildSdkMediaUtilization(mediaSettings)
}
}
diff --git a/genesyscloud/resource_genesyscloud_user_test.go b/genesyscloud/resource_genesyscloud_user_test.go
index 37c39f245..c064114ea 100644
--- a/genesyscloud/resource_genesyscloud_user_test.go
+++ b/genesyscloud/resource_genesyscloud_user_test.go
@@ -6,6 +6,8 @@ import (
"strconv"
"strings"
"terraform-provider-genesyscloud/genesyscloud/provider"
+ routingUtilization "terraform-provider-genesyscloud/genesyscloud/routing_utilization"
+ routingUtilizationLabel "terraform-provider-genesyscloud/genesyscloud/routing_utilization_label"
"terraform-provider-genesyscloud/genesyscloud/util"
"testing"
"time"
@@ -14,7 +16,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceUserBasic(t *testing.T) {
@@ -731,11 +733,11 @@ func TestAccResourceUserroutingUtil(t *testing.T) {
email1,
userName,
generateUserRoutingUtil(
- generateRoutingUtilMediaType("call", maxCapacity1, util.FalseValue),
- generateRoutingUtilMediaType("callback", maxCapacity1, util.FalseValue),
- generateRoutingUtilMediaType("chat", maxCapacity1, util.FalseValue),
- generateRoutingUtilMediaType("email", maxCapacity1, util.FalseValue),
- generateRoutingUtilMediaType("message", maxCapacity1, util.FalseValue),
+ routingUtilization.GenerateRoutingUtilMediaType("call", maxCapacity1, util.FalseValue),
+ routingUtilization.GenerateRoutingUtilMediaType("callback", maxCapacity1, util.FalseValue),
+ routingUtilization.GenerateRoutingUtilMediaType("chat", maxCapacity1, util.FalseValue),
+ routingUtilization.GenerateRoutingUtilMediaType("email", maxCapacity1, util.FalseValue),
+ routingUtilization.GenerateRoutingUtilMediaType("message", maxCapacity1, util.FalseValue),
),
),
Check: resource.ComposeTestCheckFunc(
@@ -764,11 +766,11 @@ func TestAccResourceUserroutingUtil(t *testing.T) {
email1,
userName,
generateUserRoutingUtil(
- generateRoutingUtilMediaType("call", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeEmail)),
- generateRoutingUtilMediaType("callback", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
- generateRoutingUtilMediaType("chat", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
- generateRoutingUtilMediaType("email", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
- generateRoutingUtilMediaType("message", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
+ routingUtilization.GenerateRoutingUtilMediaType("call", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeEmail)),
+ routingUtilization.GenerateRoutingUtilMediaType("callback", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
+ routingUtilization.GenerateRoutingUtilMediaType("chat", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
+ routingUtilization.GenerateRoutingUtilMediaType("email", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
+ routingUtilization.GenerateRoutingUtilMediaType("message", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
),
),
Check: resource.ComposeTestCheckFunc(
@@ -797,11 +799,11 @@ func TestAccResourceUserroutingUtil(t *testing.T) {
email1,
userName,
generateUserRoutingUtil(
- generateRoutingUtilMediaType("call", maxCapacity0, util.TrueValue, strconv.Quote(utilTypeEmail)),
- generateRoutingUtilMediaType("callback", maxCapacity0, util.TrueValue, strconv.Quote(utilTypeCall)),
- generateRoutingUtilMediaType("chat", maxCapacity0, util.TrueValue, strconv.Quote(utilTypeCall)),
- generateRoutingUtilMediaType("email", maxCapacity0, util.TrueValue, strconv.Quote(utilTypeCall)),
- generateRoutingUtilMediaType("message", maxCapacity0, util.TrueValue, strconv.Quote(utilTypeCall)),
+ routingUtilization.GenerateRoutingUtilMediaType("call", maxCapacity0, util.TrueValue, strconv.Quote(utilTypeEmail)),
+ routingUtilization.GenerateRoutingUtilMediaType("callback", maxCapacity0, util.TrueValue, strconv.Quote(utilTypeCall)),
+ routingUtilization.GenerateRoutingUtilMediaType("chat", maxCapacity0, util.TrueValue, strconv.Quote(utilTypeCall)),
+ routingUtilization.GenerateRoutingUtilMediaType("email", maxCapacity0, util.TrueValue, strconv.Quote(utilTypeCall)),
+ routingUtilization.GenerateRoutingUtilMediaType("message", maxCapacity0, util.TrueValue, strconv.Quote(utilTypeCall)),
),
),
Check: resource.ComposeTestCheckFunc(
@@ -864,7 +866,7 @@ func TestAccResourceUserroutingUtilWithLabels(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() {
util.TestAccPreCheck(t)
- if err := checkIfLabelsAreEnabled(); err != nil {
+ if err := routingUtilizationLabel.CheckIfLabelsAreEnabled(); err != nil {
t.Skipf("%v", err) // be sure to skip the test and not fail it
}
},
@@ -872,21 +874,21 @@ func TestAccResourceUserroutingUtilWithLabels(t *testing.T) {
Steps: []resource.TestStep{
{
// Create with utilization settings
- Config: GenerateRoutingUtilizationLabelResource(redLabelResource, redLabelName, "") +
- GenerateRoutingUtilizationLabelResource(blueLabelResource, blueLabelName, redLabelResource) +
- GenerateRoutingUtilizationLabelResource(greenLabelResource, greenLabelName, blueLabelResource) +
+ Config: routingUtilizationLabel.GenerateRoutingUtilizationLabelResource(redLabelResource, redLabelName, "") +
+ routingUtilizationLabel.GenerateRoutingUtilizationLabelResource(blueLabelResource, blueLabelName, redLabelResource) +
+ routingUtilizationLabel.GenerateRoutingUtilizationLabelResource(greenLabelResource, greenLabelName, blueLabelResource) +
generateUserWithCustomAttrs(
userResource1,
email1,
userName,
generateUserRoutingUtil(
- generateRoutingUtilMediaType("call", maxCapacity1, util.FalseValue),
- generateRoutingUtilMediaType("callback", maxCapacity1, util.FalseValue),
- generateRoutingUtilMediaType("chat", maxCapacity1, util.FalseValue),
- generateRoutingUtilMediaType("email", maxCapacity1, util.FalseValue),
- generateRoutingUtilMediaType("message", maxCapacity1, util.FalseValue),
- generateLabelUtilization(redLabelResource, maxCapacity1),
- generateLabelUtilization(blueLabelResource, maxCapacity1, redLabelResource),
+ routingUtilization.GenerateRoutingUtilMediaType("call", maxCapacity1, util.FalseValue),
+ routingUtilization.GenerateRoutingUtilMediaType("callback", maxCapacity1, util.FalseValue),
+ routingUtilization.GenerateRoutingUtilMediaType("chat", maxCapacity1, util.FalseValue),
+ routingUtilization.GenerateRoutingUtilMediaType("email", maxCapacity1, util.FalseValue),
+ routingUtilization.GenerateRoutingUtilMediaType("message", maxCapacity1, util.FalseValue),
+ routingUtilizationLabel.GenerateLabelUtilization(redLabelResource, maxCapacity1),
+ routingUtilizationLabel.GenerateLabelUtilization(blueLabelResource, maxCapacity1, redLabelResource),
),
),
Check: resource.ComposeTestCheckFunc(
@@ -914,21 +916,21 @@ func TestAccResourceUserroutingUtilWithLabels(t *testing.T) {
},
{
// Update utilization settings and set different org-level settings
- Config: GenerateRoutingUtilizationLabelResource(redLabelResource, redLabelName, "") +
- GenerateRoutingUtilizationLabelResource(blueLabelResource, blueLabelName, redLabelResource) +
- GenerateRoutingUtilizationLabelResource(greenLabelResource, greenLabelName, blueLabelResource) +
+ Config: routingUtilizationLabel.GenerateRoutingUtilizationLabelResource(redLabelResource, redLabelName, "") +
+ routingUtilizationLabel.GenerateRoutingUtilizationLabelResource(blueLabelResource, blueLabelName, redLabelResource) +
+ routingUtilizationLabel.GenerateRoutingUtilizationLabelResource(greenLabelResource, greenLabelName, blueLabelResource) +
generateUserWithCustomAttrs(
userResource1,
email1,
userName,
generateUserRoutingUtil(
- generateRoutingUtilMediaType("call", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeEmail)),
- generateRoutingUtilMediaType("callback", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
- generateRoutingUtilMediaType("chat", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
- generateRoutingUtilMediaType("email", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
- generateRoutingUtilMediaType("message", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
- generateLabelUtilization(redLabelResource, maxCapacity2),
- generateLabelUtilization(blueLabelResource, maxCapacity2, redLabelResource),
+ routingUtilization.GenerateRoutingUtilMediaType("call", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeEmail)),
+ routingUtilization.GenerateRoutingUtilMediaType("callback", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
+ routingUtilization.GenerateRoutingUtilMediaType("chat", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
+ routingUtilization.GenerateRoutingUtilMediaType("email", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
+ routingUtilization.GenerateRoutingUtilMediaType("message", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
+ routingUtilizationLabel.GenerateLabelUtilization(redLabelResource, maxCapacity2),
+ routingUtilizationLabel.GenerateLabelUtilization(blueLabelResource, maxCapacity2, redLabelResource),
),
),
Check: resource.ComposeTestCheckFunc(
@@ -956,21 +958,21 @@ func TestAccResourceUserroutingUtilWithLabels(t *testing.T) {
},
{
// Ensure max capacity can be set to 0
- Config: GenerateRoutingUtilizationLabelResource(redLabelResource, redLabelName, "") +
- GenerateRoutingUtilizationLabelResource(blueLabelResource, blueLabelName, redLabelResource) +
- GenerateRoutingUtilizationLabelResource(greenLabelResource, greenLabelName, blueLabelResource) +
+ Config: routingUtilizationLabel.GenerateRoutingUtilizationLabelResource(redLabelResource, redLabelName, "") +
+ routingUtilizationLabel.GenerateRoutingUtilizationLabelResource(blueLabelResource, blueLabelName, redLabelResource) +
+ routingUtilizationLabel.GenerateRoutingUtilizationLabelResource(greenLabelResource, greenLabelName, blueLabelResource) +
generateUserWithCustomAttrs(
userResource1,
email1,
userName,
generateUserRoutingUtil(
- generateRoutingUtilMediaType("call", maxCapacity0, util.TrueValue, strconv.Quote(utilTypeEmail)),
- generateRoutingUtilMediaType("callback", maxCapacity0, util.TrueValue, strconv.Quote(utilTypeCall)),
- generateRoutingUtilMediaType("chat", maxCapacity0, util.TrueValue, strconv.Quote(utilTypeCall)),
- generateRoutingUtilMediaType("email", maxCapacity0, util.TrueValue, strconv.Quote(utilTypeCall)),
- generateRoutingUtilMediaType("message", maxCapacity0, util.TrueValue, strconv.Quote(utilTypeCall)),
- generateLabelUtilization(redLabelResource, maxCapacity0),
- generateLabelUtilization(blueLabelResource, maxCapacity0, redLabelResource),
+ routingUtilization.GenerateRoutingUtilMediaType("call", maxCapacity0, util.TrueValue, strconv.Quote(utilTypeEmail)),
+ routingUtilization.GenerateRoutingUtilMediaType("callback", maxCapacity0, util.TrueValue, strconv.Quote(utilTypeCall)),
+ routingUtilization.GenerateRoutingUtilMediaType("chat", maxCapacity0, util.TrueValue, strconv.Quote(utilTypeCall)),
+ routingUtilization.GenerateRoutingUtilMediaType("email", maxCapacity0, util.TrueValue, strconv.Quote(utilTypeCall)),
+ routingUtilization.GenerateRoutingUtilMediaType("message", maxCapacity0, util.TrueValue, strconv.Quote(utilTypeCall)),
+ routingUtilizationLabel.GenerateLabelUtilization(redLabelResource, maxCapacity0),
+ routingUtilizationLabel.GenerateLabelUtilization(blueLabelResource, maxCapacity0, redLabelResource),
),
),
Check: resource.ComposeTestCheckFunc(
diff --git a/genesyscloud/resource_genesyscloud_widget_deployment.go b/genesyscloud/resource_genesyscloud_widget_deployment.go
index 9ca823d39..54ef064af 100644
--- a/genesyscloud/resource_genesyscloud_widget_deployment.go
+++ b/genesyscloud/resource_genesyscloud_widget_deployment.go
@@ -4,10 +4,11 @@ import (
"context"
"fmt"
"log"
- "net/url"
+ "strings"
"terraform-provider-genesyscloud/genesyscloud/provider"
"terraform-provider-genesyscloud/genesyscloud/util"
"terraform-provider-genesyscloud/genesyscloud/util/constants"
+ "terraform-provider-genesyscloud/genesyscloud/util/resourcedata"
"time"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
@@ -15,40 +16,34 @@ import (
"terraform-provider-genesyscloud/genesyscloud/consistency_checker"
resourceExporter "terraform-provider-genesyscloud/genesyscloud/resource_exporter"
- lists "terraform-provider-genesyscloud/genesyscloud/util/lists"
+ "terraform-provider-genesyscloud/genesyscloud/util/lists"
- "github.com/hashicorp/go-cty/cty"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
const (
- V1 = "v1"
- V1HTTP = "v1-http"
- V2 = "v2"
- THIRDPARTY = "third-party"
- HTTPSPROTOCOL = "https"
- WEBSKINBASIC = "basic"
- WEBSKINMODERN = "modern-caret-skin"
+ V1 = "v1"
+ V1HTTP = "v1-http"
+ V2 = "v2"
+ THIRDPARTY = "third-party"
)
var (
+ validClientTypes = []string{V1, V1HTTP, V2, THIRDPARTY}
clientConfigSchemaResource = &schema.Resource{
Schema: map[string]*schema.Schema{
"webchat_skin": {
- Description: "Skin for the webchat user. (basic, modern-caret-skin)",
- Type: schema.TypeString,
- Required: true,
- ValidateFunc: validation.StringInSlice([]string{WEBSKINBASIC, WEBSKINMODERN}, false),
+ Description: "Skin for the webchat user. (basic, modern-caret-skin)",
+ Type: schema.TypeString,
+ Optional: true,
},
"authentication_url": {
- Description: "Url endpoint to perform_authentication",
- Type: schema.TypeString,
- Required: false,
- Optional: true,
- ValidateDiagFunc: validateAuthURL,
+ Description: "Url endpoint to perform_authentication",
+ Type: schema.TypeString,
+ Optional: true,
},
},
}
@@ -69,78 +64,6 @@ func getAllWidgetDeployments(_ context.Context, clientConfig *platformclientv2.C
return resources, nil
}
-func buildSdkAllowedDomains(d *schema.ResourceData) *[]string {
- allowed_domains := []string{}
- if domains, ok := d.GetOk("allowed_domains"); ok {
- allowed_domains = lists.InterfaceListToStrings(domains.([]interface{}))
- }
- return &allowed_domains
-}
-
-func parseSdkClientConfigData(d *schema.ResourceData) (webchatSkin *string, authenticationUrl *string) {
- clientConfigSet := d.Get("client_config").(*schema.Set)
-
- if clientConfigSet != nil && len(clientConfigSet.List()) > 0 {
- clientConfig := clientConfigSet.List()[0].(map[string]interface{})
- fields := make(map[string]string)
-
- for k, v := range clientConfig {
- fields[k] = v.(string)
- }
-
- webchatSkin := fields["webchat_skin"]
- authUrl := fields["authentication_url"]
- return &webchatSkin, &authUrl
- }
- return nil, nil
-}
-
-func validateAuthURL(authUrl interface{}, _ cty.Path) diag.Diagnostics {
- authUrlString := authUrl.(string)
- u, err := url.Parse(authUrlString)
- if err != nil {
- return util.BuildDiagnosticError("genesyscloud_widget_deployment", fmt.Sprintf("Authorization url %s provided is not a valid URL", authUrlString), err)
- }
-
- if u.Scheme == "" || u.Host == "" {
- log.Printf("Scheme: %s", u.Scheme)
- log.Printf("Host: %s", u.Host)
- return util.BuildDiagnosticError("genesyscloud_widget_deployment", fmt.Sprintf("Authorization url %s provided is not valid url", authUrlString), fmt.Errorf("authorization url provided is not valid url"))
- }
-
- if u.Scheme != HTTPSPROTOCOL {
- return util.BuildDiagnosticError("genesyscloud_widget_deployment", fmt.Sprintf("Authorization url provided must begin with https"), fmt.Errorf("authorization url provided must begin with https"))
-
- }
-
- return nil
-}
-
-func buildSDKClientConfig(clientType string, d *schema.ResourceData) (*platformclientv2.Widgetclientconfig, error) {
- widgetClientConfig := &platformclientv2.Widgetclientconfig{}
- clientConfig := d.Get("client_config").(*schema.Set)
-
- if (clientType == V1 || clientType == V1HTTP) && clientConfig.Len() == 0 {
- return nil, fmt.Errorf("V1 and v1-http widget configurations must have a client_config defined. ")
- }
-
- if clientType == V1 {
- v1Client := &platformclientv2.Widgetclientconfigv1{}
-
- v1Client.WebChatSkin, v1Client.AuthenticationUrl = parseSdkClientConfigData(d)
-
- widgetClientConfig.V1 = v1Client
- }
-
- if clientType == V1HTTP {
- v1HttpClient := &platformclientv2.Widgetclientconfigv1http{}
- v1HttpClient.WebChatSkin, v1HttpClient.AuthenticationUrl = parseSdkClientConfigData(d)
- widgetClientConfig.V1Http = v1HttpClient
- }
-
- return widgetClientConfig, nil
-}
-
func WidgetDeploymentExporter() *resourceExporter.ResourceExporter {
return &resourceExporter.ResourceExporter{
GetResourcesFunc: provider.GetAllWithPooledClient(getAllWidgetDeployments),
@@ -192,56 +115,38 @@ func ResourceWidgetDeployment() *schema.Resource {
Description: "The list of domains that are approved to use this Deployment; the list will be added to CORS headers for ease of web use",
Type: schema.TypeList,
Elem: &schema.Schema{Type: schema.TypeString},
- Required: false,
Optional: true,
},
"client_type": {
- Description: "The type of display widget for which this Deployment is configured, which controls the administrator settings shown.Valid values: v1, v2, v1-http, third-party.",
+ Description: "The type of display widget for which this Deployment is configured, which controls the administrator settings shown. Valid values: " + strings.Join(validClientTypes, ", "),
Type: schema.TypeString,
Required: true,
- ValidateFunc: validation.StringInSlice([]string{V1, V2, V1HTTP, THIRDPARTY}, false),
+ ValidateFunc: validation.StringInSlice(validClientTypes, false),
},
"client_config": {
- Description: " The V1 and V1-http client configuration options that should be made available to the clients of this Deployment.",
+ Description: "The V1 and V1-http client configuration options that should be made available to the clients of this Deployment.",
Type: schema.TypeSet,
MaxItems: 1,
Optional: true,
- Elem: clientConfigSchemaResource,
+ // when this field is removed, V1 and V1HTTP should also be removed from validClientTypes list
+ Deprecated: "This field is inactive and will be removed entirely in a later version. Please use `v2_client_config` or `third_party_client_config` instead.",
+ Elem: clientConfigSchemaResource,
+ },
+ "v2_client_config": {
+ Description: "The v2 client configuration options that should be made available to the clients of this Deployment.",
+ Type: schema.TypeMap,
+ Optional: true,
+ },
+ "third_party_client_config": {
+ Description: "The third party client configuration options that should be made available to the clients of this Deployment.",
+ Type: schema.TypeMap,
+ Optional: true,
+ ConflictsWith: []string{"v2_client_config"},
},
},
}
}
-func flattenClientConfig(clientType string, clientConfig platformclientv2.Widgetclientconfig) *schema.Set {
- clientConfigSet := schema.NewSet(schema.HashResource(clientConfigSchemaResource), []interface{}{})
-
- clientConfigMap := make(map[string]interface{})
-
- if clientType == V1 {
- if clientConfig.V1.WebChatSkin != nil {
- clientConfigMap["webchat_skin"] = *clientConfig.V1.WebChatSkin
- }
-
- if clientConfig.V1.AuthenticationUrl != nil {
- clientConfigMap["authentication_url"] = *clientConfig.V1.AuthenticationUrl
- }
- }
-
- if clientType == V1HTTP {
- if clientConfig.V1Http.WebChatSkin != nil {
- clientConfigMap["webchat_skin"] = *clientConfig.V1Http.WebChatSkin
- }
-
- if clientConfig.V1Http.AuthenticationUrl != nil {
- clientConfigMap["authentication_url"] = *clientConfig.V1Http.AuthenticationUrl
- }
- }
-
- clientConfigSet.Add(clientConfigMap)
-
- return clientConfigSet
-}
-
func readWidgetDeployment(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
sdkConfig := meta.(*provider.ProviderMeta).ClientConfig
widgetsAPI := platformclientv2.NewWidgetsApiWithConfig(sdkConfig)
@@ -259,47 +164,15 @@ func readWidgetDeployment(ctx context.Context, d *schema.ResourceData, meta inte
return retry.NonRetryableError(util.BuildWithRetriesApiDiagnosticError("genesyscloud_widget_deployment", fmt.Sprintf("Failed to read widget deployment %s | error: %s", d.Id(), getErr), resp))
}
- d.Set("name", *currentWidget.Name)
- if currentWidget.Description != nil {
- d.Set("description", *currentWidget.Description)
- } else {
- d.Set("description", nil)
- }
-
- if currentWidget.AuthenticationRequired != nil {
- d.Set("authentication_required", *currentWidget.AuthenticationRequired)
- } else {
- d.Set("authentication_required", nil)
- }
-
- if currentWidget.Disabled != nil {
- d.Set("disabled", *currentWidget.Disabled)
- } else {
- d.Set("disabled", nil)
- }
-
- if currentWidget.Flow != nil {
- d.Set("flow_id", *currentWidget.Flow.Id)
- } else {
- d.Set("flow_id", nil)
- }
-
- if currentWidget.AllowedDomains != nil {
- d.Set("allowed_domains", *currentWidget.AllowedDomains)
- } else {
- d.Set("allowed_domains", nil)
- }
-
- if currentWidget.ClientType != nil {
- d.Set("client_type", *currentWidget.ClientType)
- } else {
- d.Set("client_type", nil)
- }
-
+ _ = d.Set("name", *currentWidget.Name)
+ resourcedata.SetNillableValue(d, "description", currentWidget.Description)
+ resourcedata.SetNillableValue(d, "authentication_required", currentWidget.AuthenticationRequired)
+ resourcedata.SetNillableValue(d, "disabled", currentWidget.Disabled)
+ resourcedata.SetNillableValue(d, "allowed_domains", currentWidget.AllowedDomains)
+ resourcedata.SetNillableValue(d, "client_type", currentWidget.ClientType)
+ resourcedata.SetNillableReference(d, "flow_id", currentWidget.Flow)
if currentWidget.ClientConfig != nil {
- d.Set("client_config", flattenClientConfig(*currentWidget.ClientType, *currentWidget.ClientConfig))
- } else {
- d.Set("client_config", nil)
+ flattenClientConfig(d, *currentWidget.ClientConfig)
}
return cc.CheckState(d)
@@ -308,30 +181,19 @@ func readWidgetDeployment(ctx context.Context, d *schema.ResourceData, meta inte
func createWidgetDeployment(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
name := d.Get("name").(string)
- description := d.Get("description").(string)
- auth_required := d.Get("authentication_required").(bool)
- disabled := d.Get("disabled").(bool)
- flowId := util.BuildSdkDomainEntityRef(d, "flow_id")
- allowed_domains := buildSdkAllowedDomains(d) //Need to make this an array of strings.
- client_type := d.Get("client_type").(string)
- client_config, client_config_err := buildSDKClientConfig(client_type, d)
-
- if client_config_err != nil {
- return util.BuildDiagnosticError("genesyscloud_widget_deployment", fmt.Sprintf("Failed to create widget deployment %s", name), client_config_err)
- }
sdkConfig := meta.(*provider.ProviderMeta).ClientConfig
widgetsAPI := platformclientv2.NewWidgetsApiWithConfig(sdkConfig)
createWidget := platformclientv2.Widgetdeployment{
Name: &name,
- Description: &description,
- AuthenticationRequired: &auth_required,
- Disabled: &disabled,
- Flow: flowId,
- AllowedDomains: allowed_domains,
- ClientType: &client_type,
- ClientConfig: client_config,
+ Description: platformclientv2.String(d.Get("description").(string)),
+ AuthenticationRequired: platformclientv2.Bool(d.Get("authentication_required").(bool)),
+ Disabled: platformclientv2.Bool(d.Get("disabled").(bool)),
+ Flow: util.BuildSdkDomainEntityRef(d, "flow_id"),
+ AllowedDomains: buildSdkAllowedDomains(d),
+ ClientType: platformclientv2.String(d.Get("client_type").(string)),
+ ClientConfig: buildSDKClientConfig(d),
}
log.Printf("Creating widgets deployment %s", name)
@@ -355,28 +217,6 @@ func createWidgetDeployment(ctx context.Context, d *schema.ResourceData, meta in
return readWidgetDeployment(ctx, d, meta)
}
-// Sometimes the Widget API creates 2 deployments due to a bug. This function will delete any duplicates
-func deletePotentialDuplicateDeployments(widgetAPI *platformclientv2.WidgetsApi, name, id string, existingResourceIDMetaMap, newResourceIDMetaMap resourceExporter.ResourceIDMetaMap) {
- for _, val := range existingResourceIDMetaMap {
- for key1, val1 := range newResourceIDMetaMap {
- if val.Name == val1.Name {
- delete(newResourceIDMetaMap, key1)
- break
- }
- }
- }
-
- for key, val := range newResourceIDMetaMap {
- if key != id && val.Name == name {
- log.Printf("Deleting duplicate widget deployment %s", name)
- _, err := widgetAPI.DeleteWidgetsDeployment(key)
- if err != nil {
- log.Printf("failed to delete widget deployment %s: %s", name, err)
- }
- }
- }
-}
-
func deleteWidgetDeployment(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
name := d.Get("name").(string)
@@ -404,30 +244,19 @@ func deleteWidgetDeployment(ctx context.Context, d *schema.ResourceData, meta in
func updateWidgetDeployment(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
name := d.Get("name").(string)
- description := d.Get("description").(string)
- auth_required := d.Get("authentication_required").(bool)
- disabled := d.Get("disabled").(bool)
- flowId := util.BuildSdkDomainEntityRef(d, "flow_id")
- allowed_domains := buildSdkAllowedDomains(d) //Need to make this an array of strings.
- client_type := d.Get("client_type").(string)
- client_config, client_config_err := buildSDKClientConfig(client_type, d)
-
- if client_config_err != nil {
- return util.BuildDiagnosticError("genesyscloud_widget_deployment", fmt.Sprintf("Failed updating widget deployment %s", name), client_config_err)
- }
sdkConfig := meta.(*provider.ProviderMeta).ClientConfig
widgetsAPI := platformclientv2.NewWidgetsApiWithConfig(sdkConfig)
updateWidget := platformclientv2.Widgetdeployment{
Name: &name,
- Description: &description,
- AuthenticationRequired: &auth_required,
- Disabled: &disabled,
- Flow: flowId,
- AllowedDomains: allowed_domains,
- ClientType: &client_type,
- ClientConfig: client_config,
+ Description: platformclientv2.String(d.Get("description").(string)),
+ AuthenticationRequired: platformclientv2.Bool(d.Get("authentication_required").(bool)),
+ Disabled: platformclientv2.Bool(d.Get("disabled").(bool)),
+ Flow: util.BuildSdkDomainEntityRef(d, "flow_id"),
+ AllowedDomains: buildSdkAllowedDomains(d),
+ ClientType: platformclientv2.String(d.Get("client_type").(string)),
+ ClientConfig: buildSDKClientConfig(d),
}
log.Printf("Updating widget deployment %s", name)
@@ -440,3 +269,61 @@ func updateWidgetDeployment(ctx context.Context, d *schema.ResourceData, meta in
log.Printf("Finished updating widget deployment %s", name)
return readWidgetDeployment(ctx, d, meta)
}
+
+func buildSDKClientConfig(d *schema.ResourceData) *platformclientv2.Widgetclientconfig {
+ v2ClientConfig := d.Get("v2_client_config")
+ if m, ok := v2ClientConfig.(map[string]any); ok && len(m) > 0 {
+ return &platformclientv2.Widgetclientconfig{V2: &v2ClientConfig}
+ }
+ thirdPartyClientConfig := d.Get("third_party_client_config")
+ if m, ok := thirdPartyClientConfig.(map[string]any); ok && len(m) > 0 {
+ return &platformclientv2.Widgetclientconfig{ThirdParty: &thirdPartyClientConfig}
+ }
+ return nil
+}
+
+func buildSdkAllowedDomains(d *schema.ResourceData) *[]string {
+ if domains, ok := d.Get("allowed_domains").([]any); ok {
+ allowedDomains := lists.InterfaceListToStrings(domains)
+ return &allowedDomains
+ }
+ return nil
+}
+
+func flattenClientConfig(d *schema.ResourceData, config platformclientv2.Widgetclientconfig) {
+ if config.ThirdParty != nil {
+ thirdParty := *config.ThirdParty
+ if thirdPartyMap, _ := thirdParty.(map[string]any); len(thirdPartyMap) > 0 {
+ _ = d.Set("third_party_client_config", thirdPartyMap)
+ return
+ }
+ }
+ if config.V2 != nil {
+ v2Config := *config.V2
+ if v2ConfigMap, _ := v2Config.(map[string]any); len(v2ConfigMap) > 0 {
+ _ = d.Set("v2_client_config", v2ConfigMap)
+ }
+ }
+}
+
+// deletePotentialDuplicateDeployments Sometimes the Widget API creates 2 deployments due to a bug. This function will delete any duplicates
+func deletePotentialDuplicateDeployments(widgetAPI *platformclientv2.WidgetsApi, name, id string, existingResourceIDMetaMap, newResourceIDMetaMap resourceExporter.ResourceIDMetaMap) {
+ for _, val := range existingResourceIDMetaMap {
+ for key1, val1 := range newResourceIDMetaMap {
+ if val.Name == val1.Name {
+ delete(newResourceIDMetaMap, key1)
+ break
+ }
+ }
+ }
+
+ for key, val := range newResourceIDMetaMap {
+ if key != id && val.Name == name {
+ log.Printf("Deleting duplicate widget deployment %s", name)
+ _, err := widgetAPI.DeleteWidgetsDeployment(key)
+ if err != nil {
+ log.Printf("failed to delete widget deployment %s: %s", name, err)
+ }
+ }
+ }
+}
diff --git a/genesyscloud/resource_genesyscloud_widget_deployment_test.go b/genesyscloud/resource_genesyscloud_widget_deployment_test.go
index e3552fd4f..2f4b56c25 100644
--- a/genesyscloud/resource_genesyscloud_widget_deployment_test.go
+++ b/genesyscloud/resource_genesyscloud_widget_deployment_test.go
@@ -2,6 +2,7 @@ package genesyscloud
import (
"fmt"
+ "strconv"
"strings"
"terraform-provider-genesyscloud/genesyscloud/provider"
"terraform-provider-genesyscloud/genesyscloud/util"
@@ -10,7 +11,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
type widgetDeploymentConfig struct {
@@ -22,8 +23,8 @@ type widgetDeploymentConfig struct {
flowID string
allowedDomains []string
clientType string
- webChatSkin string
- authenticationUrl string
+ v2ClientConfig map[string]string
+ thirdPartyClientConfig map[string]string
}
func deleteWidgetDeploymentWithName(name string) {
@@ -35,139 +36,86 @@ func deleteWidgetDeploymentWithName(name string) {
for _, widgetDeployment := range *widgetDeployments.Entities {
if strings.Contains(*widgetDeployment.Name, name) {
- widgetsAPI.DeleteWidgetsDeployment(*widgetDeployment.Id)
+ _, _ = widgetsAPI.DeleteWidgetsDeployment(*widgetDeployment.Id)
}
}
}
-func generateWidgetDeployV2(widgetDeploymentConfig *widgetDeploymentConfig) string {
- return fmt.Sprintf(`resource "genesyscloud_widget_deployment" "%s" {
- name = "%s"
- description = "%s"
- flow_id = "%s"
- client_type = "%s"
- authentication_required = %s
- disabled = %s
+func generateWidgetDeploymentResource(wdConfig *widgetDeploymentConfig) string {
+ var (
+ v2ClientConfigStr string
+ thirdPartyConfigStr string
+ )
+ if wdConfig.v2ClientConfig != nil {
+ v2ClientConfigStr = util.GenerateMapAttrWithMapProperties("v2_client_config", wdConfig.v2ClientConfig)
+ }
+ if wdConfig.thirdPartyClientConfig != nil {
+ thirdPartyConfigStr = util.GenerateMapAttrWithMapProperties("third_party_client_config", wdConfig.thirdPartyClientConfig)
}
- `, widgetDeploymentConfig.resourceID,
- widgetDeploymentConfig.name,
- widgetDeploymentConfig.description,
- widgetDeploymentConfig.flowID,
- widgetDeploymentConfig.clientType,
- widgetDeploymentConfig.authenticationRequired,
- widgetDeploymentConfig.disabled)
-}
-
-func generateWidgetDeployV1(widgetDeploymentConfig *widgetDeploymentConfig) string {
return fmt.Sprintf(`resource "genesyscloud_widget_deployment" "%s" {
- name = "%s"
- description = "%s"
- flow_id = "%s"
- client_type = "%s"
+ name = "%s"
+ description = %s
+ flow_id = %s
+ client_type = "%s"
authentication_required = %s
- disabled = %s
- client_config {
- authentication_url = "%s"
- webchat_skin = "%s"
- }
+ disabled = %s
+ %s
+ %s
}
- `, widgetDeploymentConfig.resourceID,
- widgetDeploymentConfig.name,
- widgetDeploymentConfig.description,
- widgetDeploymentConfig.flowID,
- widgetDeploymentConfig.clientType,
- widgetDeploymentConfig.authenticationRequired,
- widgetDeploymentConfig.disabled,
- widgetDeploymentConfig.authenticationUrl,
- widgetDeploymentConfig.webChatSkin)
+ `, wdConfig.resourceID,
+ wdConfig.name,
+ wdConfig.description,
+ wdConfig.flowID,
+ wdConfig.clientType,
+ wdConfig.authenticationRequired,
+ wdConfig.disabled,
+ v2ClientConfigStr,
+ thirdPartyConfigStr,
+ )
}
-func TestAccResourceWidgetDeploymentV2Widget(t *testing.T) {
- t.Parallel()
- name := "My Test V2 Widget"
- widgetDeployV2 := &widgetDeploymentConfig{
- resourceID: "myTestV2Widget",
- name: name + uuid.NewString(),
- description: "This is a test description",
- flowID: uuid.NewString(),
- clientType: "v2",
- authenticationRequired: "false",
- disabled: "true",
- }
-
- _, err := provider.AuthorizeSdk()
- if err != nil {
- t.Fatal(err)
+func copyWidgetDeploymentConfig(original widgetDeploymentConfig) *widgetDeploymentConfig {
+ var widgetCopy widgetDeploymentConfig
+ widgetCopy = widgetDeploymentConfig{
+ resourceID: original.resourceID,
+ name: original.name,
+ description: original.description,
+ authenticationRequired: original.authenticationRequired,
+ disabled: original.disabled,
+ flowID: original.flowID,
+ allowedDomains: append(widgetCopy.allowedDomains, original.allowedDomains...),
+ clientType: original.clientType,
+ v2ClientConfig: original.v2ClientConfig,
+ thirdPartyClientConfig: original.thirdPartyClientConfig,
}
- deleteWidgetDeploymentWithName(name)
-
- resource.Test(t, resource.TestCase{
- PreCheck: func() { util.TestAccPreCheck(t) },
- ProviderFactories: provider.GetProviderFactories(providerResources, providerDataSources),
-
- Steps: []resource.TestStep{
- {
- //create
- Config: generateWidgetDeployV2(widgetDeployV2),
- Check: resource.ComposeTestCheckFunc(
- resource.TestCheckResourceAttr("genesyscloud_widget_deployment."+widgetDeployV2.resourceID, "name", widgetDeployV2.name),
- resource.TestCheckResourceAttr("genesyscloud_widget_deployment."+widgetDeployV2.resourceID, "description", widgetDeployV2.description),
- resource.TestCheckResourceAttr("genesyscloud_widget_deployment."+widgetDeployV2.resourceID, "flow_id", widgetDeployV2.flowID),
- resource.TestCheckResourceAttr("genesyscloud_widget_deployment."+widgetDeployV2.resourceID, "client_type", widgetDeployV2.clientType),
- resource.TestCheckResourceAttr("genesyscloud_widget_deployment."+widgetDeployV2.resourceID, "authentication_required", widgetDeployV2.authenticationRequired),
- resource.TestCheckResourceAttr("genesyscloud_widget_deployment."+widgetDeployV2.resourceID, "disabled", widgetDeployV2.disabled),
- ),
- },
- {
- //update
- Config: generateWidgetDeployV2(&widgetDeploymentConfig{
- resourceID: widgetDeployV2.resourceID,
- name: widgetDeployV2.name,
- description: "New test description",
- flowID: widgetDeployV2.flowID,
- clientType: widgetDeployV2.clientType,
- authenticationRequired: widgetDeployV2.authenticationRequired,
- disabled: widgetDeployV2.disabled,
- }),
- Check: resource.ComposeTestCheckFunc(
- resource.TestCheckResourceAttr("genesyscloud_widget_deployment."+widgetDeployV2.resourceID, "name", widgetDeployV2.name),
- resource.TestCheckResourceAttr("genesyscloud_widget_deployment."+widgetDeployV2.resourceID, "description", "New test description"),
- resource.TestCheckResourceAttr("genesyscloud_widget_deployment."+widgetDeployV2.resourceID, "flow_id", widgetDeployV2.flowID),
- resource.TestCheckResourceAttr("genesyscloud_widget_deployment."+widgetDeployV2.resourceID, "client_type", widgetDeployV2.clientType),
- resource.TestCheckResourceAttr("genesyscloud_widget_deployment."+widgetDeployV2.resourceID, "authentication_required", widgetDeployV2.authenticationRequired),
- resource.TestCheckResourceAttr("genesyscloud_widget_deployment."+widgetDeployV2.resourceID, "disabled", widgetDeployV2.disabled),
- ),
- },
- {
- // Import/Read
- ResourceName: "genesyscloud_widget_deployment." + widgetDeployV2.resourceID,
- ImportState: true,
- ImportStateVerify: true,
- },
- },
- CheckDestroy: testVerifyWidgetDeploymentDestroyed,
- })
+ return &widgetCopy
}
-func TestAccResourceWidgetDeploymentV1Widget(t *testing.T) {
+func TestAccResourceWidgetDeploymentThirdPartyWidget(t *testing.T) {
t.Parallel()
- name := "My Text V1 Widget"
- widgetDeployV1 := &widgetDeploymentConfig{
- resourceID: "myTestV1Widget",
- name: name + uuid.NewString(),
- description: "This is a test description",
- flowID: uuid.NewString(),
- clientType: "v1",
- authenticationRequired: "true",
- disabled: "true",
- webChatSkin: "basic",
- authenticationUrl: "https://localhost",
+ name := "My Test Third Party Widget" + uuid.NewString()
+ description := "This is a test description"
+ flowId := uuid.NewString()
+ widgetDeployment := &widgetDeploymentConfig{
+ resourceID: "third_party_widget",
+ name: name,
+ description: strconv.Quote(description),
+ flowID: strconv.Quote(flowId),
+ clientType: V2,
+ authenticationRequired: util.FalseValue,
+ disabled: util.TrueValue,
+ thirdPartyClientConfig: map[string]string{
+ "foo": strconv.Quote("bar"),
+ },
}
- _, err := provider.AuthorizeSdk()
- if err != nil {
- t.Fatal(err)
+ updatedDescription := "New description"
+ widgetDeploymentUpdate := copyWidgetDeploymentConfig(*widgetDeployment)
+ widgetDeploymentUpdate.description = strconv.Quote(updatedDescription)
+ widgetDeploymentUpdate.thirdPartyClientConfig = map[string]string{
+ "foo": strconv.Quote("bar2"),
}
+
deleteWidgetDeploymentWithName(name)
resource.Test(t, resource.TestCase{
@@ -177,43 +125,33 @@ func TestAccResourceWidgetDeploymentV1Widget(t *testing.T) {
Steps: []resource.TestStep{
{
//create
- Config: generateWidgetDeployV1(widgetDeployV1),
+ Config: generateWidgetDeploymentResource(widgetDeployment),
Check: resource.ComposeTestCheckFunc(
- resource.TestCheckResourceAttr("genesyscloud_widget_deployment."+widgetDeployV1.resourceID, "name", widgetDeployV1.name),
- resource.TestCheckResourceAttr("genesyscloud_widget_deployment."+widgetDeployV1.resourceID, "description", widgetDeployV1.description),
- resource.TestCheckResourceAttr("genesyscloud_widget_deployment."+widgetDeployV1.resourceID, "flow_id", widgetDeployV1.flowID),
- resource.TestCheckResourceAttr("genesyscloud_widget_deployment."+widgetDeployV1.resourceID, "client_type", widgetDeployV1.clientType),
- resource.TestCheckResourceAttr("genesyscloud_widget_deployment."+widgetDeployV1.resourceID, "authentication_required", widgetDeployV1.authenticationRequired),
- resource.TestCheckResourceAttr("genesyscloud_widget_deployment."+widgetDeployV1.resourceID, "disabled", widgetDeployV1.disabled),
- resource.TestCheckResourceAttr("genesyscloud_widget_deployment."+widgetDeployV1.resourceID, "client_config.0.authentication_url", widgetDeployV1.authenticationUrl),
- resource.TestCheckResourceAttr("genesyscloud_widget_deployment."+widgetDeployV1.resourceID, "client_config.0.webchat_skin", widgetDeployV1.webChatSkin),
+ resource.TestCheckResourceAttr("genesyscloud_widget_deployment."+widgetDeployment.resourceID, "name", name),
+ resource.TestCheckResourceAttr("genesyscloud_widget_deployment."+widgetDeployment.resourceID, "description", description),
+ resource.TestCheckResourceAttr("genesyscloud_widget_deployment."+widgetDeployment.resourceID, "flow_id", flowId),
+ resource.TestCheckResourceAttr("genesyscloud_widget_deployment."+widgetDeployment.resourceID, "client_type", widgetDeployment.clientType),
+ resource.TestCheckResourceAttr("genesyscloud_widget_deployment."+widgetDeployment.resourceID, "authentication_required", widgetDeployment.authenticationRequired),
+ resource.TestCheckResourceAttr("genesyscloud_widget_deployment."+widgetDeployment.resourceID, "disabled", widgetDeployment.disabled),
+ resource.TestCheckResourceAttr("genesyscloud_widget_deployment."+widgetDeployment.resourceID, "third_party_client_config.foo", "bar"),
),
},
{
//update
- Config: generateWidgetDeployV1(&widgetDeploymentConfig{
- resourceID: widgetDeployV1.resourceID,
- name: widgetDeployV1.name,
- description: "New test description",
- flowID: widgetDeployV1.flowID,
- clientType: widgetDeployV1.clientType,
- authenticationRequired: widgetDeployV1.authenticationRequired,
- disabled: widgetDeployV1.disabled,
- webChatSkin: widgetDeployV1.webChatSkin,
- authenticationUrl: widgetDeployV1.authenticationUrl,
- }),
+ Config: generateWidgetDeploymentResource(widgetDeploymentUpdate),
Check: resource.ComposeTestCheckFunc(
- resource.TestCheckResourceAttr("genesyscloud_widget_deployment."+widgetDeployV1.resourceID, "name", widgetDeployV1.name),
- resource.TestCheckResourceAttr("genesyscloud_widget_deployment."+widgetDeployV1.resourceID, "description", "New test description"),
- resource.TestCheckResourceAttr("genesyscloud_widget_deployment."+widgetDeployV1.resourceID, "flow_id", widgetDeployV1.flowID),
- resource.TestCheckResourceAttr("genesyscloud_widget_deployment."+widgetDeployV1.resourceID, "client_type", widgetDeployV1.clientType),
- resource.TestCheckResourceAttr("genesyscloud_widget_deployment."+widgetDeployV1.resourceID, "authentication_required", widgetDeployV1.authenticationRequired),
- resource.TestCheckResourceAttr("genesyscloud_widget_deployment."+widgetDeployV1.resourceID, "disabled", widgetDeployV1.disabled),
+ resource.TestCheckResourceAttr("genesyscloud_widget_deployment."+widgetDeployment.resourceID, "name", name),
+ resource.TestCheckResourceAttr("genesyscloud_widget_deployment."+widgetDeployment.resourceID, "description", updatedDescription),
+ resource.TestCheckResourceAttr("genesyscloud_widget_deployment."+widgetDeployment.resourceID, "flow_id", flowId),
+ resource.TestCheckResourceAttr("genesyscloud_widget_deployment."+widgetDeployment.resourceID, "client_type", widgetDeployment.clientType),
+ resource.TestCheckResourceAttr("genesyscloud_widget_deployment."+widgetDeployment.resourceID, "authentication_required", widgetDeployment.authenticationRequired),
+ resource.TestCheckResourceAttr("genesyscloud_widget_deployment."+widgetDeployment.resourceID, "disabled", widgetDeployment.disabled),
+ resource.TestCheckResourceAttr("genesyscloud_widget_deployment."+widgetDeployment.resourceID, "third_party_client_config.foo", "bar2"),
),
},
{
// Import/Read
- ResourceName: "genesyscloud_widget_deployment." + widgetDeployV1.resourceID,
+ ResourceName: "genesyscloud_widget_deployment." + widgetDeployment.resourceID,
ImportState: true,
ImportStateVerify: true,
},
diff --git a/genesyscloud/responsemanagement_library/genesyscloud_responsemanagement_library_proxy.go b/genesyscloud/responsemanagement_library/genesyscloud_responsemanagement_library_proxy.go
index e7e23345e..9478205ec 100644
--- a/genesyscloud/responsemanagement_library/genesyscloud_responsemanagement_library_proxy.go
+++ b/genesyscloud/responsemanagement_library/genesyscloud_responsemanagement_library_proxy.go
@@ -3,7 +3,7 @@ package responsemanagement_library
import (
"context"
"fmt"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"log"
)
diff --git a/genesyscloud/responsemanagement_library/resource_genesyscloud_responsemanagement_library.go b/genesyscloud/responsemanagement_library/resource_genesyscloud_responsemanagement_library.go
index 0e2f0be41..2970dd174 100644
--- a/genesyscloud/responsemanagement_library/resource_genesyscloud_responsemanagement_library.go
+++ b/genesyscloud/responsemanagement_library/resource_genesyscloud_responsemanagement_library.go
@@ -5,7 +5,7 @@ import (
"fmt"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"log"
"terraform-provider-genesyscloud/genesyscloud/provider"
resourceExporter "terraform-provider-genesyscloud/genesyscloud/resource_exporter"
diff --git a/genesyscloud/responsemanagement_library/resource_genesyscloud_responsemanagement_library_test.go b/genesyscloud/responsemanagement_library/resource_genesyscloud_responsemanagement_library_test.go
index 3b1498207..2724c81d1 100644
--- a/genesyscloud/responsemanagement_library/resource_genesyscloud_responsemanagement_library_test.go
+++ b/genesyscloud/responsemanagement_library/resource_genesyscloud_responsemanagement_library_test.go
@@ -13,7 +13,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceResponseManagementLibrary(t *testing.T) {
diff --git a/genesyscloud/responsemanagement_response/genesyscloud_responsemanagement_response_proxy.go b/genesyscloud/responsemanagement_response/genesyscloud_responsemanagement_response_proxy.go
index c953cc583..70921cbd8 100644
--- a/genesyscloud/responsemanagement_response/genesyscloud_responsemanagement_response_proxy.go
+++ b/genesyscloud/responsemanagement_response/genesyscloud_responsemanagement_response_proxy.go
@@ -3,7 +3,7 @@ package responsemanagement_response
import (
"context"
"fmt"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"log"
)
diff --git a/genesyscloud/responsemanagement_response/resource_genesyscloud_responsemanagement_response.go b/genesyscloud/responsemanagement_response/resource_genesyscloud_responsemanagement_response.go
index bdfc740c5..5e7dec46c 100644
--- a/genesyscloud/responsemanagement_response/resource_genesyscloud_responsemanagement_response.go
+++ b/genesyscloud/responsemanagement_response/resource_genesyscloud_responsemanagement_response.go
@@ -6,7 +6,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"log"
"terraform-provider-genesyscloud/genesyscloud/consistency_checker"
"terraform-provider-genesyscloud/genesyscloud/provider"
diff --git a/genesyscloud/responsemanagement_response/resource_genesyscloud_responsemanagement_response_test.go b/genesyscloud/responsemanagement_response/resource_genesyscloud_responsemanagement_response_test.go
index b3ea85af4..c9dbca7a6 100644
--- a/genesyscloud/responsemanagement_response/resource_genesyscloud_responsemanagement_response_test.go
+++ b/genesyscloud/responsemanagement_response/resource_genesyscloud_responsemanagement_response_test.go
@@ -16,7 +16,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceResponseManagementResponseFooterField(t *testing.T) {
diff --git a/genesyscloud/responsemanagement_response/resource_genesyscloud_responsemanagement_response_utils.go b/genesyscloud/responsemanagement_response/resource_genesyscloud_responsemanagement_response_utils.go
index de743a6d8..f2dd8555f 100644
--- a/genesyscloud/responsemanagement_response/resource_genesyscloud_responsemanagement_response_utils.go
+++ b/genesyscloud/responsemanagement_response/resource_genesyscloud_responsemanagement_response_utils.go
@@ -2,7 +2,7 @@ package responsemanagement_response
import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"terraform-provider-genesyscloud/genesyscloud/util"
"terraform-provider-genesyscloud/genesyscloud/util/lists"
"terraform-provider-genesyscloud/genesyscloud/util/resourcedata"
diff --git a/genesyscloud/responsemanagement_responseasset/genesyscloud_responsemanagement_responseasset_proxy.go b/genesyscloud/responsemanagement_responseasset/genesyscloud_responsemanagement_responseasset_proxy.go
index 7280c1cb2..fe64370e1 100644
--- a/genesyscloud/responsemanagement_responseasset/genesyscloud_responsemanagement_responseasset_proxy.go
+++ b/genesyscloud/responsemanagement_responseasset/genesyscloud_responsemanagement_responseasset_proxy.go
@@ -6,7 +6,7 @@ import (
"log"
rc "terraform-provider-genesyscloud/genesyscloud/resource_cache"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/responsemanagement_responseasset/resource_genesyscloud_responsemanagement_responseasset.go b/genesyscloud/responsemanagement_responseasset/resource_genesyscloud_responsemanagement_responseasset.go
index 811114b7b..94a4a0c2e 100644
--- a/genesyscloud/responsemanagement_responseasset/resource_genesyscloud_responsemanagement_responseasset.go
+++ b/genesyscloud/responsemanagement_responseasset/resource_genesyscloud_responsemanagement_responseasset.go
@@ -6,7 +6,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"log"
"terraform-provider-genesyscloud/genesyscloud/consistency_checker"
"terraform-provider-genesyscloud/genesyscloud/provider"
diff --git a/genesyscloud/responsemanagement_responseasset/resource_genesyscloud_responsemanagement_responseasset_test.go b/genesyscloud/responsemanagement_responseasset/resource_genesyscloud_responsemanagement_responseasset_test.go
index 5442793fb..7cb665c73 100644
--- a/genesyscloud/responsemanagement_responseasset/resource_genesyscloud_responsemanagement_responseasset_test.go
+++ b/genesyscloud/responsemanagement_responseasset/resource_genesyscloud_responsemanagement_responseasset_test.go
@@ -12,7 +12,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceResponseManagementResponseAsset(t *testing.T) {
diff --git a/genesyscloud/routing_email_route/genesyscloud_routing_email_route_proxy.go b/genesyscloud/routing_email_route/genesyscloud_routing_email_route_proxy.go
index 771340b62..6c8df29b3 100644
--- a/genesyscloud/routing_email_route/genesyscloud_routing_email_route_proxy.go
+++ b/genesyscloud/routing_email_route/genesyscloud_routing_email_route_proxy.go
@@ -5,7 +5,7 @@ import (
"fmt"
"log"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/routing_email_route/resource_genesyscloud_routing_email_route.go b/genesyscloud/routing_email_route/resource_genesyscloud_routing_email_route.go
index 0ede89be7..8bdffc449 100644
--- a/genesyscloud/routing_email_route/resource_genesyscloud_routing_email_route.go
+++ b/genesyscloud/routing_email_route/resource_genesyscloud_routing_email_route.go
@@ -12,7 +12,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"terraform-provider-genesyscloud/genesyscloud/consistency_checker"
diff --git a/genesyscloud/routing_email_route/resource_genesyscloud_routing_email_route_test.go b/genesyscloud/routing_email_route/resource_genesyscloud_routing_email_route_test.go
index 941e6c4c8..4cec51ca3 100644
--- a/genesyscloud/routing_email_route/resource_genesyscloud_routing_email_route_test.go
+++ b/genesyscloud/routing_email_route/resource_genesyscloud_routing_email_route_test.go
@@ -17,7 +17,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceRoutingEmailRoute(t *testing.T) {
diff --git a/genesyscloud/routing_email_route/resource_genesyscloud_routing_email_route_utils.go b/genesyscloud/routing_email_route/resource_genesyscloud_routing_email_route_utils.go
index 1eeb0cc73..c47783f4b 100644
--- a/genesyscloud/routing_email_route/resource_genesyscloud_routing_email_route_utils.go
+++ b/genesyscloud/routing_email_route/resource_genesyscloud_routing_email_route_utils.go
@@ -8,7 +8,7 @@ import (
"terraform-provider-genesyscloud/genesyscloud/util/resourcedata"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/routing_queue/data_source_genesyscloud_routing_queue.go b/genesyscloud/routing_queue/data_source_genesyscloud_routing_queue.go
index 67c47b23e..cd47befaa 100644
--- a/genesyscloud/routing_queue/data_source_genesyscloud_routing_queue.go
+++ b/genesyscloud/routing_queue/data_source_genesyscloud_routing_queue.go
@@ -11,10 +11,11 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
+ rc "terraform-provider-genesyscloud/genesyscloud/resource_cache"
+
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
- rc "terraform-provider-genesyscloud/genesyscloud/resource_cache"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
var (
diff --git a/genesyscloud/routing_queue/genesyscloud_routing_queue_init_test.go b/genesyscloud/routing_queue/genesyscloud_routing_queue_init_test.go
index df495eba4..6a9d21473 100644
--- a/genesyscloud/routing_queue/genesyscloud_routing_queue_init_test.go
+++ b/genesyscloud/routing_queue/genesyscloud_routing_queue_init_test.go
@@ -4,6 +4,7 @@ import (
"sync"
gcloud "terraform-provider-genesyscloud/genesyscloud"
architectFlow "terraform-provider-genesyscloud/genesyscloud/architect_flow"
+ "terraform-provider-genesyscloud/genesyscloud/architect_user_prompt"
"terraform-provider-genesyscloud/genesyscloud/group"
"testing"
@@ -38,6 +39,7 @@ func (r *registerTestInstance) registerTestResources() {
providerResources["genesyscloud_routing_wrapupcode"] = gcloud.ResourceRoutingWrapupCode()
providerResources["genesyscloud_flow"] = architectFlow.ResourceArchitectFlow()
providerResources["genesyscloud_routing_skill_group"] = gcloud.ResourceRoutingSkillGroup()
+ providerResources["genesyscloud_architect_user_prompt"] = architect_user_prompt.ResourceArchitectUserPrompt()
}
// registerTestDataSources registers all data sources used in the tests.
diff --git a/genesyscloud/routing_queue/genesyscloud_routing_queue_proxy.go b/genesyscloud/routing_queue/genesyscloud_routing_queue_proxy.go
index 932d59931..3a06aa969 100644
--- a/genesyscloud/routing_queue/genesyscloud_routing_queue_proxy.go
+++ b/genesyscloud/routing_queue/genesyscloud_routing_queue_proxy.go
@@ -5,7 +5,7 @@ import (
"fmt"
rc "terraform-provider-genesyscloud/genesyscloud/resource_cache"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/routing_queue/resource_genesyscloud_routing_queue.go b/genesyscloud/routing_queue/resource_genesyscloud_routing_queue.go
index c9704f65a..46ae0cba6 100644
--- a/genesyscloud/routing_queue/resource_genesyscloud_routing_queue.go
+++ b/genesyscloud/routing_queue/resource_genesyscloud_routing_queue.go
@@ -25,7 +25,7 @@ import (
"github.com/hashicorp/go-cty/cty"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
var bullseyeExpansionTypeTimeout = "TIMEOUT_SECONDS"
@@ -74,6 +74,7 @@ func createQueue(ctx context.Context, d *schema.ResourceData, meta interface{})
EmailInQueueFlow: util.BuildSdkDomainEntityRef(d, "email_in_queue_flow_id"),
MessageInQueueFlow: util.BuildSdkDomainEntityRef(d, "message_in_queue_flow_id"),
WhisperPrompt: util.BuildSdkDomainEntityRef(d, "whisper_prompt_id"),
+ OnHoldPrompt: util.BuildSdkDomainEntityRef(d, "on_hold_prompt_id"),
AutoAnswerOnly: platformclientv2.Bool(d.Get("auto_answer_only").(bool)),
CallingPartyName: platformclientv2.String(d.Get("calling_party_name").(string)),
CallingPartyNumber: platformclientv2.String(d.Get("calling_party_number").(string)),
@@ -192,6 +193,7 @@ func readQueue(ctx context.Context, d *schema.ResourceData, meta interface{}) di
resourcedata.SetNillableReference(d, "message_in_queue_flow_id", currentQueue.MessageInQueueFlow)
resourcedata.SetNillableReference(d, "email_in_queue_flow_id", currentQueue.EmailInQueueFlow)
resourcedata.SetNillableReference(d, "whisper_prompt_id", currentQueue.WhisperPrompt)
+ resourcedata.SetNillableReference(d, "on_hold_prompt_id", currentQueue.OnHoldPrompt)
resourcedata.SetNillableValue(d, "auto_answer_only", currentQueue.AutoAnswerOnly)
resourcedata.SetNillableValue(d, "enable_transcription", currentQueue.EnableTranscription)
resourcedata.SetNillableValue(d, "suppress_in_queue_call_recording", currentQueue.SuppressInQueueCallRecording)
@@ -279,6 +281,7 @@ func updateQueue(ctx context.Context, d *schema.ResourceData, meta interface{})
EmailInQueueFlow: util.BuildSdkDomainEntityRef(d, "email_in_queue_flow_id"),
MessageInQueueFlow: util.BuildSdkDomainEntityRef(d, "message_in_queue_flow_id"),
WhisperPrompt: util.BuildSdkDomainEntityRef(d, "whisper_prompt_id"),
+ OnHoldPrompt: util.BuildSdkDomainEntityRef(d, "on_hold_prompt_id"),
AutoAnswerOnly: platformclientv2.Bool(d.Get("auto_answer_only").(bool)),
CallingPartyName: platformclientv2.String(d.Get("calling_party_name").(string)),
CallingPartyNumber: platformclientv2.String(d.Get("calling_party_number").(string)),
@@ -1030,9 +1033,15 @@ func updateQueueMembers(d *schema.ResourceData, sdkConfig *platformclientv2.Conf
if len(newUserIds) > 0 {
log.Printf("Sleeping for 10 seconds")
time.Sleep(10 * time.Second)
+
+ members, diagErr := getRoutingQueueMembers(d.Id(), "group", sdkConfig)
+ if diagErr != nil {
+ return diagErr
+ }
+
for _, userId := range newUserIds {
- if err := verifyUserIsNotGroupMemberOfQueue(d.Id(), userId, sdkConfig); err != nil {
- log.Println(err.Error())
+ if err := verifyUserIsNotGroupMemberOfQueue(d.Id(), userId, members); err != nil {
+ return util.BuildDiagnosticError(resourceName, "failed to update queue member: ", err)
}
}
}
@@ -1115,39 +1124,12 @@ func removeAllExistingUserMembersFromQueue(queueId string, sdkConfig *platformcl
}
// verifyUserIsNotGroupMemberOfQueue Search through queue group members to verify that a given user is not a group member
-func verifyUserIsNotGroupMemberOfQueue(queueId, userId string, sdkConfig *platformclientv2.Configuration) error {
- var (
- userName string
- routingApi = platformclientv2.NewRoutingApiWithConfig(sdkConfig)
- usersApi = platformclientv2.NewUsersApiWithConfig(sdkConfig)
- )
-
+func verifyUserIsNotGroupMemberOfQueue(queueId, userId string, members []platformclientv2.Queuemember) error {
log.Printf("verifying that member '%s' is not assinged to the queue '%s' via a group", userId, queueId)
- // Read name of user to filter results when listing members of queue
- log.Printf("reading user %s to fetch name", userId)
- user, _, err := usersApi.GetUser(userId, nil, "", "")
- if err != nil {
- log.Printf("Failed to read name of user '%s' inside verifyUserIsNotGroupMemberOfQueue: %s. Queue ID: %s", userId, err, queueId)
- } else {
- userName = *user.Name
- log.Printf("read user %s %s", userId, userName)
- }
-
- const pageSize = 100
- for pageNum := 1; ; pageNum++ {
- users, resp, err := sdkGetRoutingQueueMembers(queueId, "group", userName, pageNum, pageSize, routingApi)
- if err != nil || resp.StatusCode != http.StatusOK {
- log.Printf("Error requesting group members of queue '%s': %v. Cannot validate that user '%s' is not already assigned via a group", queueId, err, userId)
- break
- }
- if users == nil || users.Entities == nil || len(*users.Entities) == 0 {
- break
- }
- for _, member := range *users.Entities {
- if userId == *member.Id {
- return fmt.Errorf("member %s '%s' is already assigned to queue '%s' via a group, and therefore should not be assigned as a member", userName, userId, queueId)
- }
+ for _, member := range members {
+ if *member.Id == userId {
+ return fmt.Errorf("member %s is already assigned to queue %s via a group, and therefore should not be assigned as a member", userId, queueId)
}
}
@@ -1207,25 +1189,25 @@ func getRoutingQueueMembers(queueID string, memberBy string, sdkConfig *platform
log.Printf("%d members belong to queue %s", queueMembers, queueID)
for pageNum := 1; ; pageNum++ {
- users, resp, err := sdkGetRoutingQueueMembers(queueID, memberBy, "", pageNum, pageSize, api)
+ users, resp, err := sdkGetRoutingQueueMembers(queueID, memberBy, pageNum, pageSize, api)
if err != nil || resp.StatusCode != http.StatusOK {
return nil, util.BuildAPIDiagnosticError(resourceName, fmt.Sprintf("Failed to query users for queue %s error: %s", queueID, err), resp)
}
if users == nil || users.Entities == nil || len(*users.Entities) == 0 {
membersFound := len(members)
log.Printf("%d queue members found for queue %s", membersFound, queueID)
+
if membersFound != queueMembers {
log.Printf("Member count is not equal to queue member found for queue %s, Correlation Id: %s", queueID, resp.CorrelationID)
}
return members, nil
}
- for _, user := range *users.Entities {
- members = append(members, user)
- }
+
+ members = append(members, *users.Entities...)
}
}
-func sdkGetRoutingQueueMembers(queueID, memberBy, name string, pageNumber, pageSize int, api *platformclientv2.RoutingApi) (*platformclientv2.Queuememberentitylisting, *platformclientv2.APIResponse, error) {
+func sdkGetRoutingQueueMembers(queueID, memberBy string, pageNumber, pageSize int, api *platformclientv2.RoutingApi) (*platformclientv2.Queuememberentitylisting, *platformclientv2.APIResponse, error) {
// SDK does not support nil values for boolean query params yet, so we must manually construct this HTTP request for now
apiClient := &api.Configuration.APIClient
@@ -1254,9 +1236,6 @@ func sdkGetRoutingQueueMembers(queueID, memberBy, name string, pageNumber, pageS
if memberBy != "" {
queryParams["memberBy"] = memberBy
}
- if name != "" {
- queryParams["name"] = name
- }
headerParams["Content-Type"] = "application/json"
headerParams["Accept"] = "application/json"
diff --git a/genesyscloud/routing_queue/resource_genesyscloud_routing_queue_schema.go b/genesyscloud/routing_queue/resource_genesyscloud_routing_queue_schema.go
index 896ea6e8a..58d7e83af 100644
--- a/genesyscloud/routing_queue/resource_genesyscloud_routing_queue_schema.go
+++ b/genesyscloud/routing_queue/resource_genesyscloud_routing_queue_schema.go
@@ -380,6 +380,11 @@ func ResourceRoutingQueue() *schema.Resource {
Type: schema.TypeString,
Optional: true,
},
+ "on_hold_prompt_id": {
+ Description: "The audio to be played when calls on this queue are on hold. If not configured, the default on-hold music will play.",
+ Type: schema.TypeString,
+ Optional: true,
+ },
"auto_answer_only": {
Description: "Specifies whether the configured whisper should play for all ACD calls, or only for those which are auto-answered.",
Type: schema.TypeBool,
@@ -507,6 +512,7 @@ func RoutingQueueExporter() *resourceExporter.ResourceExporter {
"email_in_queue_flow_id": {RefType: "genesyscloud_flow"},
"message_in_queue_flow_id": {RefType: "genesyscloud_flow"},
"whisper_prompt_id": {RefType: "genesyscloud_architect_user_prompt"},
+ "on_hold_prompt_id": {RefType: "genesyscloud_architect_user_prompt"},
"outbound_messaging_sms_address_id": {}, // Ref type not yet defined
"default_script_ids.*": {RefType: "genesyscloud_script"}, // Ref type not yet defined
"outbound_email_address.route_id": {RefType: "genesyscloud_routing_email_route"},
diff --git a/genesyscloud/routing_queue/resource_genesyscloud_routing_queue_test.go b/genesyscloud/routing_queue/resource_genesyscloud_routing_queue_test.go
index d4a8c70c1..20252e1db 100644
--- a/genesyscloud/routing_queue/resource_genesyscloud_routing_queue_test.go
+++ b/genesyscloud/routing_queue/resource_genesyscloud_routing_queue_test.go
@@ -5,19 +5,27 @@ import (
"log"
"strconv"
"strings"
+ "sync"
"terraform-provider-genesyscloud/genesyscloud"
"terraform-provider-genesyscloud/genesyscloud/architect_flow"
+ "terraform-provider-genesyscloud/genesyscloud/architect_user_prompt"
"terraform-provider-genesyscloud/genesyscloud/group"
"terraform-provider-genesyscloud/genesyscloud/provider"
"terraform-provider-genesyscloud/genesyscloud/util"
featureToggles "terraform-provider-genesyscloud/genesyscloud/util/feature_toggles"
+ "terraform-provider-genesyscloud/genesyscloud/util/testrunner"
"testing"
"time"
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
+)
+
+var (
+ sdkConfig *platformclientv2.Configuration
+ mu sync.Mutex
)
func TestAccResourceRoutingQueueBasic(t *testing.T) {
@@ -523,6 +531,32 @@ func TestAccResourceRoutingQueueFlows(t *testing.T) {
queueFlowInboundcallConfig1 = fmt.Sprintf("inboundCall:\n name: %s\n defaultLanguage: en-us\n startUpRef: ./menus/menu[mainMenu]\n initialGreeting:\n tts: Archy says hi!!!\n menus:\n - menu:\n name: Main Menu\n audio:\n tts: You are at the Main Menu, press 9 to disconnect.\n refId: mainMenu\n choices:\n - menuDisconnect:\n name: Disconnect\n dtmf: digit_9", queueFlowName1)
messageInQueueFlowInboundcallConfig3 = fmt.Sprintf("inboundCall:\n name: %s\n defaultLanguage: en-us\n startUpRef: ./menus/menu[mainMenu]\n initialGreeting:\n tts: Archy says hi!!!!!\n menus:\n - menu:\n name: Main Menu\n audio:\n tts: You are at the Main Menu, press 9 to disconnect.\n refId: mainMenu\n choices:\n - menuDisconnect:\n name: Disconnect\n dtmf: digit_9", queueFlowName3)
+
+ //variables for testing 'on_hold_prompt_id'
+ userPromptResource1 = "test-user_prompt_1"
+ userPromptName1 = "TestUserPrompt_1" + strings.Replace(uuid.NewString(), "-", "", -1)
+ userPromptDescription1 = "Test description"
+ userPromptResourceLang1 = "en-us"
+ userPromptResourceText1 = "This is a test greeting!"
+ userPromptResourceFileName2 = "../" + testrunner.GetTestDataPath("test-prompt-02.wav")
+ userPromptResourceTTS1 = "This is a test greeting!"
+ userPromptAsset1 = architect_user_prompt.UserPromptResourceStruct{
+ Language: userPromptResourceLang1,
+ Tts_string: strconv.Quote(userPromptResourceTTS1),
+ Text: util.NullValue,
+ Filename: util.NullValue,
+ FileContentHash: util.NullValue,
+ }
+ userPromptAsset2 = architect_user_prompt.UserPromptResourceStruct{
+ Language: userPromptResourceLang1,
+ Tts_string: util.NullValue,
+ Text: strconv.Quote(userPromptResourceText1),
+ Filename: strconv.Quote(userPromptResourceFileName2),
+ FileContentHash: userPromptResourceFileName2,
+ }
+
+ userPromptResources1 = []*architect_user_prompt.UserPromptResourceStruct{&userPromptAsset1}
+ userPromptResources2 = []*architect_user_prompt.UserPromptResourceStruct{&userPromptAsset2}
)
var homeDivisionName string
@@ -586,17 +620,24 @@ func TestAccResourceRoutingQueueFlows(t *testing.T) {
queueFlowFilePath3,
messageInQueueFlowInboundcallConfig3,
false,
- ) + GenerateRoutingQueueResourceBasic(
+ ) + architect_user_prompt.GenerateUserPromptResource(&architect_user_prompt.UserPromptStruct{
+ ResourceID: userPromptResource1,
+ Name: userPromptName1,
+ Description: strconv.Quote(userPromptDescription1),
+ Resources: userPromptResources1,
+ }) + GenerateRoutingQueueResourceBasic(
queueResource1,
queueName1,
"queue_flow_id = genesyscloud_flow."+queueFlowResource1+".id",
"email_in_queue_flow_id = genesyscloud_flow."+emailInQueueFlowResource1+".id",
"message_in_queue_flow_id = genesyscloud_flow."+messageInQueueFlowResource1+".id",
+ "on_hold_prompt_id = genesyscloud_architect_user_prompt."+userPromptResource1+".id",
),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrPair("genesyscloud_routing_queue."+queueResource1, "queue_flow_id", "genesyscloud_flow."+queueFlowResource1, "id"),
resource.TestCheckResourceAttrPair("genesyscloud_routing_queue."+queueResource1, "email_in_queue_flow_id", "genesyscloud_flow."+emailInQueueFlowResource1, "id"),
resource.TestCheckResourceAttrPair("genesyscloud_routing_queue."+queueResource1, "message_in_queue_flow_id", "genesyscloud_flow."+messageInQueueFlowResource1, "id"),
+ resource.TestCheckResourceAttrPair("genesyscloud_routing_queue."+queueResource1, "on_hold_prompt_id", "genesyscloud_architect_user_prompt."+userPromptResource1, "id"),
),
},
{
@@ -616,17 +657,24 @@ func TestAccResourceRoutingQueueFlows(t *testing.T) {
queueFlowFilePath3,
messageInQueueFlowInboundcallConfig3,
false,
- ) + GenerateRoutingQueueResourceBasic(
+ ) + architect_user_prompt.GenerateUserPromptResource(&architect_user_prompt.UserPromptStruct{
+ ResourceID: userPromptResource1,
+ Name: userPromptName1,
+ Description: strconv.Quote(userPromptDescription1),
+ Resources: userPromptResources2,
+ }) + GenerateRoutingQueueResourceBasic(
queueResource1,
queueName1,
"queue_flow_id = genesyscloud_flow."+queueFlowResource2+".id",
"email_in_queue_flow_id = genesyscloud_flow."+emailInQueueFlowResource2+".id",
"message_in_queue_flow_id = genesyscloud_flow."+messageInQueueFlowResource2+".id",
+ "on_hold_prompt_id = genesyscloud_architect_user_prompt."+userPromptResource1+".id",
),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrPair("genesyscloud_routing_queue."+queueResource1, "queue_flow_id", "genesyscloud_flow."+queueFlowResource2, "id"),
resource.TestCheckResourceAttrPair("genesyscloud_routing_queue."+queueResource1, "email_in_queue_flow_id", "genesyscloud_flow."+emailInQueueFlowResource2, "id"),
resource.TestCheckResourceAttrPair("genesyscloud_routing_queue."+queueResource1, "message_in_queue_flow_id", "genesyscloud_flow."+messageInQueueFlowResource2, "id"),
+ resource.TestCheckResourceAttrPair("genesyscloud_routing_queue."+queueResource1, "on_hold_prompt_id", "genesyscloud_architect_user_prompt."+userPromptResource1, "id"),
func(s *terraform.State) error {
time.Sleep(45 * time.Second) // Wait for 45 seconds for proper deletion of user
return nil
@@ -681,6 +729,10 @@ func TestAccResourceRoutingQueueMembers(t *testing.T) {
),
},
{
+ PreConfig: func() {
+ // Wait for a specified duration to avoid runtime error
+ time.Sleep(30 * time.Second)
+ },
// Update with another queue member and modify rings
Config: genesyscloud.GenerateBasicUserResource(
queueMemberResource1,
@@ -1088,6 +1140,7 @@ func TestAccResourceRoutingQueueMembersOutsideOfConfig(t *testing.T) {
userEmail = fmt.Sprintf("user%s@test.com", strings.Replace(uuid.NewString(), "-", "", -1))
queueResourceId = "queue"
queueName = "tf test queue " + uuid.NewString()
+ userID string
)
queueResource := fmt.Sprintf(`
@@ -1116,12 +1169,26 @@ resource "genesyscloud_user" "%s" {
{
Config: queueResource + userResource,
ExpectNonEmptyPlan: false,
+ Check: resource.ComposeTestCheckFunc(
+ func(s *terraform.State) error {
+ rs, ok := s.RootModule().Resources["genesyscloud_user."+userResourceId]
+ if !ok {
+ return fmt.Errorf("not found: %s", "genesyscloud_user."+userResourceId)
+ }
+ userID = rs.Primary.ID
+ log.Printf("User ID: %s\n", userID) // Print user ID
+ return nil
+ },
+ ),
},
{
// Import/Read
ResourceName: "genesyscloud_routing_queue." + queueResourceId,
ImportState: true,
ImportStateVerify: true,
+ Check: resource.ComposeTestCheckFunc(
+ checkUserDeleted(userID),
+ ),
},
},
CheckDestroy: testVerifyQueuesDestroyed,
@@ -1477,3 +1544,45 @@ func generateUserWithCustomAttrs(resourceID string, email string, name string, a
}
`, resourceID, email, name, strings.Join(attrs, "\n"))
}
+
+func checkUserDeleted(id string) resource.TestCheckFunc {
+ log.Printf("Fetching user with ID: %s\n", id)
+ return func(s *terraform.State) error {
+ maxAttempts := 18
+ for i := 0; i < maxAttempts; i++ {
+
+ deleted, err := isUserDeleted(id)
+ if err != nil {
+ return err
+ }
+ if deleted {
+ return nil
+ }
+ time.Sleep(10 * time.Second)
+ }
+ return fmt.Errorf("user %s was not deleted properly", id)
+ }
+}
+
+func isUserDeleted(id string) (bool, error) {
+ mu.Lock()
+ defer mu.Unlock()
+
+ usersAPI := platformclientv2.NewUsersApiWithConfig(sdkConfig)
+ // Attempt to get the user
+ _, response, err := usersAPI.GetUser(id, nil, "", "")
+
+ // Check if the user is not found (deleted)
+ if response != nil && response.StatusCode == 404 {
+ return true, nil // User is deleted
+ }
+
+ // Handle other errors
+ if err != nil {
+ log.Printf("Error fetching user: %v", err)
+ return false, err
+ }
+
+ // If user is found, it means the user is not deleted
+ return false, nil
+}
diff --git a/genesyscloud/routing_queue_conditional_group_routing/genesyscloud_routing_queue_conditional_group_routing_proxy.go b/genesyscloud/routing_queue_conditional_group_routing/genesyscloud_routing_queue_conditional_group_routing_proxy.go
index 362c8d5eb..8072bfcc7 100644
--- a/genesyscloud/routing_queue_conditional_group_routing/genesyscloud_routing_queue_conditional_group_routing_proxy.go
+++ b/genesyscloud/routing_queue_conditional_group_routing/genesyscloud_routing_queue_conditional_group_routing_proxy.go
@@ -3,7 +3,7 @@ package routing_queue_conditional_group_routing
import (
"context"
"fmt"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
rc "terraform-provider-genesyscloud/genesyscloud/resource_cache"
routingQueue "terraform-provider-genesyscloud/genesyscloud/routing_queue"
)
diff --git a/genesyscloud/routing_queue_conditional_group_routing/resource_genesyscloud_routing_queue_conditional_group_routing.go b/genesyscloud/routing_queue_conditional_group_routing/resource_genesyscloud_routing_queue_conditional_group_routing.go
index 028b585e7..a0d3b94a3 100644
--- a/genesyscloud/routing_queue_conditional_group_routing/resource_genesyscloud_routing_queue_conditional_group_routing.go
+++ b/genesyscloud/routing_queue_conditional_group_routing/resource_genesyscloud_routing_queue_conditional_group_routing.go
@@ -6,7 +6,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"log"
"strings"
consistencyChecker "terraform-provider-genesyscloud/genesyscloud/consistency_checker"
diff --git a/genesyscloud/routing_queue_conditional_group_routing/resource_genesyscloud_routing_queue_conditional_group_routing_test.go b/genesyscloud/routing_queue_conditional_group_routing/resource_genesyscloud_routing_queue_conditional_group_routing_test.go
index 03d3566a0..dadf085c8 100644
--- a/genesyscloud/routing_queue_conditional_group_routing/resource_genesyscloud_routing_queue_conditional_group_routing_test.go
+++ b/genesyscloud/routing_queue_conditional_group_routing/resource_genesyscloud_routing_queue_conditional_group_routing_test.go
@@ -18,7 +18,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
var (
@@ -330,6 +330,7 @@ func generateUserWithCustomAttrs(resourceID string, email string, name string, a
}
`, resourceID, email, name, strings.Join(attrs, "\n"))
}
+
func checkUserDeleted(id string) resource.TestCheckFunc {
log.Printf("Fetching user with ID: %s\n", id)
return func(s *terraform.State) error {
diff --git a/genesyscloud/routing_queue_conditional_group_routing/resource_genesyscloud_routing_queue_conditional_group_routing_unit_test.go b/genesyscloud/routing_queue_conditional_group_routing/resource_genesyscloud_routing_queue_conditional_group_routing_unit_test.go
index e71ff2d42..16b682245 100644
--- a/genesyscloud/routing_queue_conditional_group_routing/resource_genesyscloud_routing_queue_conditional_group_routing_unit_test.go
+++ b/genesyscloud/routing_queue_conditional_group_routing/resource_genesyscloud_routing_queue_conditional_group_routing_unit_test.go
@@ -5,7 +5,7 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"github.com/stretchr/testify/assert"
"net/http"
"terraform-provider-genesyscloud/genesyscloud/provider"
diff --git a/genesyscloud/routing_queue_outbound_email_address/genesyscloud_routing_queue_outbound_email_address_proxy.go b/genesyscloud/routing_queue_outbound_email_address/genesyscloud_routing_queue_outbound_email_address_proxy.go
index 0972d7cd5..e12da7114 100644
--- a/genesyscloud/routing_queue_outbound_email_address/genesyscloud_routing_queue_outbound_email_address_proxy.go
+++ b/genesyscloud/routing_queue_outbound_email_address/genesyscloud_routing_queue_outbound_email_address_proxy.go
@@ -3,7 +3,7 @@ package routing_queue_outbound_email_address
import (
"context"
"fmt"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
rc "terraform-provider-genesyscloud/genesyscloud/resource_cache"
routingQueue "terraform-provider-genesyscloud/genesyscloud/routing_queue"
)
diff --git a/genesyscloud/routing_queue_outbound_email_address/resource_genesyscloud_routing_queue_outbound_email_address.go b/genesyscloud/routing_queue_outbound_email_address/resource_genesyscloud_routing_queue_outbound_email_address.go
index 97a3e55b2..e94fdaee1 100644
--- a/genesyscloud/routing_queue_outbound_email_address/resource_genesyscloud_routing_queue_outbound_email_address.go
+++ b/genesyscloud/routing_queue_outbound_email_address/resource_genesyscloud_routing_queue_outbound_email_address.go
@@ -6,7 +6,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"log"
"strings"
consistencyChecker "terraform-provider-genesyscloud/genesyscloud/consistency_checker"
diff --git a/genesyscloud/routing_queue_outbound_email_address/resource_genesyscloud_routing_queue_outbound_email_address_test.go b/genesyscloud/routing_queue_outbound_email_address/resource_genesyscloud_routing_queue_outbound_email_address_test.go
index 8bf3a50b9..cfac071ce 100644
--- a/genesyscloud/routing_queue_outbound_email_address/resource_genesyscloud_routing_queue_outbound_email_address_test.go
+++ b/genesyscloud/routing_queue_outbound_email_address/resource_genesyscloud_routing_queue_outbound_email_address_test.go
@@ -5,7 +5,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"log"
"os"
"strings"
diff --git a/genesyscloud/routing_queue_outbound_email_address/resource_genesyscloud_routing_queue_outbound_email_address_unit_test.go b/genesyscloud/routing_queue_outbound_email_address/resource_genesyscloud_routing_queue_outbound_email_address_unit_test.go
index 4f0368308..6ef38582c 100644
--- a/genesyscloud/routing_queue_outbound_email_address/resource_genesyscloud_routing_queue_outbound_email_address_unit_test.go
+++ b/genesyscloud/routing_queue_outbound_email_address/resource_genesyscloud_routing_queue_outbound_email_address_unit_test.go
@@ -4,7 +4,7 @@ import (
"context"
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"github.com/stretchr/testify/assert"
"net/http"
"terraform-provider-genesyscloud/genesyscloud/provider"
diff --git a/genesyscloud/routing_settings/genesyscloud_routing_settings_init_test.go b/genesyscloud/routing_settings/genesyscloud_routing_settings_init_test.go
new file mode 100644
index 000000000..7e9c341f7
--- /dev/null
+++ b/genesyscloud/routing_settings/genesyscloud_routing_settings_init_test.go
@@ -0,0 +1,40 @@
+package routing_settings
+
+import (
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
+ "sync"
+ "testing"
+)
+
+// providerResources holds a map of all registered resources
+var providerResources map[string]*schema.Resource
+
+type registerTestInstance struct {
+ resourceMapMutex sync.RWMutex
+}
+
+// registerTestResources registers all resources used in the tests
+func (r *registerTestInstance) registerTestResources() {
+ r.resourceMapMutex.Lock()
+ defer r.resourceMapMutex.Unlock()
+
+ providerResources[resourceName] = ResourceRoutingSettings()
+}
+
+// initTestResources initializes all test resources and data sources.
+func initTestResources() {
+ providerResources = make(map[string]*schema.Resource)
+
+ regInstance := ®isterTestInstance{}
+
+ regInstance.registerTestResources()
+}
+
+// TestMain is a "setup" function called by the testing framework when run the test
+func TestMain(m *testing.M) {
+ // Run setup function before starting the test suite for routing_settings package
+ initTestResources()
+
+ // Run the test suite for the routing_settings package
+ m.Run()
+}
diff --git a/genesyscloud/routing_settings/genesyscloud_routing_settings_proxy.go b/genesyscloud/routing_settings/genesyscloud_routing_settings_proxy.go
new file mode 100644
index 000000000..111dcf6f1
--- /dev/null
+++ b/genesyscloud/routing_settings/genesyscloud_routing_settings_proxy.go
@@ -0,0 +1,110 @@
+package routing_settings
+
+import (
+ "context"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
+)
+
+var internalProxy *routingSettingsProxy
+
+type getRoutingSettingsFunc func(ctx context.Context, p *routingSettingsProxy) (*platformclientv2.Routingsettings, *platformclientv2.APIResponse, error)
+type updateRoutingSettingsFunc func(ctx context.Context, p *routingSettingsProxy, routingSettings *platformclientv2.Routingsettings) (*platformclientv2.Routingsettings, *platformclientv2.APIResponse, error)
+type deleteRoutingSettingsFunc func(ctx context.Context, p *routingSettingsProxy) (*platformclientv2.APIResponse, error)
+
+type getRoutingSettingsContactCenterFunc func(ctx context.Context, p *routingSettingsProxy) (*platformclientv2.Contactcentersettings, *platformclientv2.APIResponse, error)
+type updateRoutingSettingsContactCenterFunc func(ctx context.Context, p *routingSettingsProxy, contactCenterSettings platformclientv2.Contactcentersettings) (*platformclientv2.APIResponse, error)
+
+type getRoutingSettingsTranscriptionFunc func(ctx context.Context, p *routingSettingsProxy) (*platformclientv2.Transcriptionsettings, *platformclientv2.APIResponse, error)
+type updateRoutingSettingsTranscriptionFunc func(ctx context.Context, p *routingSettingsProxy, transcriptionSettings platformclientv2.Transcriptionsettings) (*platformclientv2.Transcriptionsettings, *platformclientv2.APIResponse, error)
+
+type routingSettingsProxy struct {
+ clientConfig *platformclientv2.Configuration
+ routingSettingsApi *platformclientv2.RoutingApi
+ getRoutingSettingsAttr getRoutingSettingsFunc
+ updateRoutingSettingsAttr updateRoutingSettingsFunc
+ deleteRoutingSettingsAttr deleteRoutingSettingsFunc
+
+ getRoutingSettingsContactCenterAttr getRoutingSettingsContactCenterFunc
+ updateRoutingSettingsContactCenterAttr updateRoutingSettingsContactCenterFunc
+
+ getRoutingSettingsTranscriptionAttr getRoutingSettingsTranscriptionFunc
+ updateRoutingSettingsTranscriptionAttr updateRoutingSettingsTranscriptionFunc
+}
+
+func newRoutingSettingsProxy(clientConfig *platformclientv2.Configuration) *routingSettingsProxy {
+ api := platformclientv2.NewRoutingApiWithConfig(clientConfig)
+ return &routingSettingsProxy{
+ clientConfig: clientConfig,
+ routingSettingsApi: api,
+ getRoutingSettingsAttr: getRoutingSettingsFn,
+ updateRoutingSettingsAttr: updateRoutingSettingsFn,
+ deleteRoutingSettingsAttr: deleteRoutingSettingsFn,
+ getRoutingSettingsContactCenterAttr: getRoutingSettingsContactCenterFn,
+ updateRoutingSettingsContactCenterAttr: updateRoutingSettingsContactCenterFn,
+ getRoutingSettingsTranscriptionAttr: getRoutingSettingsTranscriptionFn,
+ updateRoutingSettingsTranscriptionAttr: updateRoutingSettingsTranscriptionFn,
+ }
+}
+
+func getRoutingSettingsProxy(clientConfig *platformclientv2.Configuration) *routingSettingsProxy {
+ if internalProxy == nil {
+ internalProxy = newRoutingSettingsProxy(clientConfig)
+ }
+ return internalProxy
+}
+
+func (p *routingSettingsProxy) getRoutingSettings(ctx context.Context) (*platformclientv2.Routingsettings, *platformclientv2.APIResponse, error) {
+ return p.getRoutingSettingsAttr(ctx, p)
+}
+
+func (p *routingSettingsProxy) updateRoutingSettings(ctx context.Context, routingSettings *platformclientv2.Routingsettings) (*platformclientv2.Routingsettings, *platformclientv2.APIResponse, error) {
+ return p.updateRoutingSettingsAttr(ctx, p, routingSettings)
+}
+
+func (p *routingSettingsProxy) deleteRoutingSettings(ctx context.Context) (*platformclientv2.APIResponse, error) {
+ return p.deleteRoutingSettingsAttr(ctx, p)
+}
+
+func (p *routingSettingsProxy) getRoutingSettingsContactCenter(ctx context.Context) (*platformclientv2.Contactcentersettings, *platformclientv2.APIResponse, error) {
+ return p.getRoutingSettingsContactCenterAttr(ctx, p)
+}
+
+func (p *routingSettingsProxy) updateRoutingSettingsContactCenter(ctx context.Context, contactCenterSettings platformclientv2.Contactcentersettings) (*platformclientv2.APIResponse, error) {
+ return p.updateRoutingSettingsContactCenterAttr(ctx, p, contactCenterSettings)
+}
+
+func (p *routingSettingsProxy) getRoutingSettingsTranscription(ctx context.Context) (*platformclientv2.Transcriptionsettings, *platformclientv2.APIResponse, error) {
+ return p.getRoutingSettingsTranscriptionAttr(ctx, p)
+}
+
+func (p *routingSettingsProxy) updateRoutingSettingsTranscription(ctx context.Context, transcriptionSettings platformclientv2.Transcriptionsettings) (*platformclientv2.Transcriptionsettings, *platformclientv2.APIResponse, error) {
+ return p.updateRoutingSettingsTranscriptionAttr(ctx, p, transcriptionSettings)
+}
+
+func getRoutingSettingsFn(ctx context.Context, p *routingSettingsProxy) (*platformclientv2.Routingsettings, *platformclientv2.APIResponse, error) {
+ return p.routingSettingsApi.GetRoutingSettings()
+}
+
+func updateRoutingSettingsFn(ctx context.Context, p *routingSettingsProxy, routingSettings *platformclientv2.Routingsettings) (*platformclientv2.Routingsettings, *platformclientv2.APIResponse, error) {
+ return p.routingSettingsApi.PutRoutingSettings(*routingSettings)
+}
+
+func deleteRoutingSettingsFn(ctx context.Context, p *routingSettingsProxy) (*platformclientv2.APIResponse, error) {
+ return p.routingSettingsApi.DeleteRoutingSettings()
+}
+
+func getRoutingSettingsContactCenterFn(ctx context.Context, p *routingSettingsProxy) (*platformclientv2.Contactcentersettings, *platformclientv2.APIResponse, error) {
+ return p.routingSettingsApi.GetRoutingSettingsContactcenter()
+}
+
+func updateRoutingSettingsContactCenterFn(ctx context.Context, p *routingSettingsProxy, contactCenterSettings platformclientv2.Contactcentersettings) (*platformclientv2.APIResponse, error) {
+ return p.routingSettingsApi.PatchRoutingSettingsContactcenter(contactCenterSettings)
+}
+
+func getRoutingSettingsTranscriptionFn(ctx context.Context, p *routingSettingsProxy) (*platformclientv2.Transcriptionsettings, *platformclientv2.APIResponse, error) {
+ return p.routingSettingsApi.GetRoutingSettingsTranscription()
+}
+
+func updateRoutingSettingsTranscriptionFn(ctx context.Context, p *routingSettingsProxy, transcriptionSettings platformclientv2.Transcriptionsettings) (*platformclientv2.Transcriptionsettings, *platformclientv2.APIResponse, error) {
+ return p.routingSettingsApi.PutRoutingSettingsTranscription(transcriptionSettings)
+}
diff --git a/genesyscloud/routing_settings/resource_genesyscloud_routing_settings.go b/genesyscloud/routing_settings/resource_genesyscloud_routing_settings.go
new file mode 100644
index 000000000..3f4a4f2e8
--- /dev/null
+++ b/genesyscloud/routing_settings/resource_genesyscloud_routing_settings.go
@@ -0,0 +1,216 @@
+package routing_settings
+
+import (
+ "context"
+ "fmt"
+ "log"
+ "terraform-provider-genesyscloud/genesyscloud/provider"
+ "terraform-provider-genesyscloud/genesyscloud/util"
+ "terraform-provider-genesyscloud/genesyscloud/util/constants"
+ "terraform-provider-genesyscloud/genesyscloud/util/resourcedata"
+ "time"
+
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
+
+ "terraform-provider-genesyscloud/genesyscloud/consistency_checker"
+
+ resourceExporter "terraform-provider-genesyscloud/genesyscloud/resource_exporter"
+
+ "github.com/hashicorp/terraform-plugin-sdk/v2/diag"
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
+)
+
+func getAllRoutingSettings(_ context.Context, clientConfig *platformclientv2.Configuration) (resourceExporter.ResourceIDMetaMap, diag.Diagnostics) {
+ resources := make(resourceExporter.ResourceIDMetaMap)
+ resources["0"] = &resourceExporter.ResourceMeta{Name: "routing_settings"}
+ return resources, nil
+}
+
+func createRoutingSettings(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
+ log.Printf("Creating Routing Setting")
+ d.SetId("settings")
+ return updateRoutingSettings(ctx, d, meta)
+}
+
+func readRoutingSettings(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
+ sdkConfig := meta.(*provider.ProviderMeta).ClientConfig
+ proxy := getRoutingSettingsProxy(sdkConfig)
+ cc := consistency_checker.NewConsistencyCheck(ctx, d, meta, ResourceRoutingSettings(), constants.DefaultConsistencyChecks, resourceName)
+
+ log.Printf("Reading routing settings")
+
+ return util.WithRetriesForRead(ctx, d, func() *retry.RetryError {
+ settings, resp, getErr := proxy.getRoutingSettings(ctx)
+ if getErr != nil {
+ if util.IsStatus404(resp) {
+ return retry.RetryableError(util.BuildWithRetriesApiDiagnosticError(resourceName, fmt.Sprintf("Failed to read Routing Setting %s | error: %s", d.Id(), getErr), resp))
+ }
+ return retry.NonRetryableError(util.BuildWithRetriesApiDiagnosticError(resourceName, fmt.Sprintf("Failed to read Routing Setting %s | error: %s", d.Id(), getErr), resp))
+ }
+
+ resourcedata.SetNillableValue(d, "reset_agent_on_presence_change", settings.ResetAgentScoreOnPresenceChange)
+
+ if diagErr := readRoutingSettingsContactCenter(ctx, d, proxy); diagErr != nil {
+ return retry.NonRetryableError(fmt.Errorf("%v", diagErr))
+ }
+
+ if diagErr := readRoutingSettingsTranscription(ctx, d, proxy); diagErr != nil {
+ return retry.NonRetryableError(fmt.Errorf("%v", diagErr))
+ }
+
+ log.Printf("Read Routing Setting")
+ return cc.CheckState(d)
+ })
+}
+
+func updateRoutingSettings(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
+ resetAgentOnPresenceChange := d.Get("reset_agent_on_presence_change").(bool)
+ sdkConfig := meta.(*provider.ProviderMeta).ClientConfig
+ proxy := getRoutingSettingsProxy(sdkConfig)
+
+ log.Printf("Updating Routing Settings")
+ update := platformclientv2.Routingsettings{
+ ResetAgentScoreOnPresenceChange: &resetAgentOnPresenceChange,
+ }
+
+ diagErr := updateContactCenter(ctx, d, proxy)
+ if diagErr != nil {
+ return diagErr
+ }
+
+ diagErr = updateTranscription(ctx, d, proxy)
+ if diagErr != nil {
+ return diagErr
+ }
+
+ _, resp, err := proxy.updateRoutingSettings(ctx, &update)
+ if err != nil {
+ return util.BuildAPIDiagnosticError(resourceName, fmt.Sprintf("Failed to update routing settings %s error: %s", d.Id(), err), resp)
+ }
+
+ time.Sleep(5 * time.Second)
+
+ log.Printf("Updated Routing Settings")
+ return readRoutingSettings(ctx, d, meta)
+}
+
+func deleteRoutingSettings(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
+ sdkConfig := meta.(*provider.ProviderMeta).ClientConfig
+ proxy := getRoutingSettingsProxy(sdkConfig)
+
+ log.Printf("Resetting Routing Setting")
+ resp, err := proxy.deleteRoutingSettings(ctx)
+ if err != nil {
+ return util.BuildAPIDiagnosticError(resourceName, fmt.Sprintf("Failed to delete routing settings %s error: %s", d.Id(), err), resp)
+ }
+
+ log.Printf("Reset Routing Settings")
+ return nil
+}
+
+func readRoutingSettingsContactCenter(ctx context.Context, d *schema.ResourceData, proxy *routingSettingsProxy) diag.Diagnostics {
+ contactCenter, resp, getErr := proxy.getRoutingSettingsContactCenter(ctx)
+ if getErr != nil {
+ if util.IsStatus404(resp) {
+ return nil
+ }
+ return util.BuildAPIDiagnosticError(resourceName, fmt.Sprintf("Failed to read contact center for routing setting %s error: %s", d.Id(), getErr), resp)
+ }
+
+ if contactCenter == nil {
+ _ = d.Set("contactcenter", nil)
+ return nil
+ }
+
+ contactSettings := make(map[string]interface{})
+ resourcedata.SetMapValueIfNotNil(contactSettings, "remove_skills_from_blind_transfer", contactCenter.RemoveSkillsFromBlindTransfer)
+
+ _ = d.Set("contactcenter", []interface{}{contactSettings})
+ return nil
+}
+
+func updateContactCenter(ctx context.Context, d *schema.ResourceData, proxy *routingSettingsProxy) diag.Diagnostics {
+ var removeSkillsFromBlindTransfer bool
+
+ if contactCenterConfig := d.Get("contactcenter"); contactCenterConfig != nil {
+ if contactCenterList := contactCenterConfig.([]interface{}); len(contactCenterList) > 0 {
+ contactCenterMap := contactCenterList[0].(map[string]interface{})
+
+ if contactCenterMap["remove_skills_from_blind_transfer"] != nil {
+ removeSkillsFromBlindTransfer = contactCenterMap["remove_skills_from_blind_transfer"].(bool)
+ }
+
+ contactCenterSettings := platformclientv2.Contactcentersettings{
+ RemoveSkillsFromBlindTransfer: &removeSkillsFromBlindTransfer,
+ }
+
+ resp, err := proxy.updateRoutingSettingsContactCenter(ctx, contactCenterSettings)
+ if err != nil {
+ return util.BuildAPIDiagnosticError(resourceName, fmt.Sprintf("Failed to update contact center for routing settings %s error: %s", d.Id(), err), resp)
+ }
+ }
+ }
+ return nil
+}
+
+func readRoutingSettingsTranscription(ctx context.Context, d *schema.ResourceData, proxy *routingSettingsProxy) diag.Diagnostics {
+ transcription, resp, getErr := proxy.getRoutingSettingsTranscription(ctx)
+ if getErr != nil {
+ if util.IsStatus404(resp) {
+ return nil
+ }
+ return util.BuildAPIDiagnosticError(resourceName, fmt.Sprintf("Failed to read contact center for routing settings %s error: %s", d.Id(), getErr), resp)
+ }
+
+ if transcription == nil {
+ _ = d.Set("transcription", nil)
+ return nil
+ }
+
+ transcriptionSettings := make(map[string]interface{})
+ resourcedata.SetMapValueIfNotNil(transcriptionSettings, "transcription", transcription.Transcription)
+ resourcedata.SetMapValueIfNotNil(transcriptionSettings, "transcription_confidence_threshold", transcription.TranscriptionConfidenceThreshold)
+ resourcedata.SetMapValueIfNotNil(transcriptionSettings, "low_latency_transcription_enabled", transcription.LowLatencyTranscriptionEnabled)
+ resourcedata.SetMapValueIfNotNil(transcriptionSettings, "content_search_enabled", transcription.ContentSearchEnabled)
+ resourcedata.SetMapValueIfNotNil(transcriptionSettings, "pci_dss_redaction_enabled", transcription.PciDssRedactionEnabled)
+ resourcedata.SetMapValueIfNotNil(transcriptionSettings, "pii_redaction_enabled", transcription.PiiRedactionEnabled)
+
+ _ = d.Set("transcription", []interface{}{transcriptionSettings})
+ return nil
+}
+
+func updateTranscription(ctx context.Context, d *schema.ResourceData, proxy *routingSettingsProxy) diag.Diagnostics {
+ transcriptionRequest := platformclientv2.Transcriptionsettings{}
+
+ if transcriptionConfigList, ok := d.Get("transcription").([]interface{}); ok && len(transcriptionConfigList) > 0 {
+ transcriptionMap, ok := transcriptionConfigList[0].(map[string]interface{})
+ if !ok {
+ return nil
+ }
+ if transcription, ok := transcriptionMap["transcription"].(string); ok && transcription != "" {
+ transcriptionRequest.Transcription = &transcription
+ }
+ if transcriptionConfidenceThreshold, ok := transcriptionMap["transcription_confidence_threshold"].(int); ok {
+ transcriptionRequest.TranscriptionConfidenceThreshold = &transcriptionConfidenceThreshold
+ }
+ if lowLatencyTranscriptionEnabled, ok := transcriptionMap["low_latency_transcription_enabled"].(bool); ok {
+ transcriptionRequest.LowLatencyTranscriptionEnabled = &lowLatencyTranscriptionEnabled
+ }
+ if contentSearchEnabled, ok := transcriptionMap["content_search_enabled"].(bool); ok {
+ transcriptionRequest.ContentSearchEnabled = &contentSearchEnabled
+ }
+ if pciEnabled, ok := transcriptionMap["pci_dss_redaction_enabled"].(bool); ok {
+ transcriptionRequest.PciDssRedactionEnabled = &pciEnabled
+ }
+ if piiEnabled, ok := transcriptionMap["pii_redaction_enabled"].(bool); ok {
+ transcriptionRequest.PiiRedactionEnabled = &piiEnabled
+ }
+
+ _, resp, err := proxy.updateRoutingSettingsTranscription(ctx, transcriptionRequest)
+ if err != nil {
+ return util.BuildAPIDiagnosticError(resourceName, fmt.Sprintf("Failed to update Transcription for routing settings %s error: %s", d.Id(), err), resp)
+ }
+ }
+ return nil
+}
diff --git a/genesyscloud/routing_settings/resource_genesyscloud_routing_settings_schema.go b/genesyscloud/routing_settings/resource_genesyscloud_routing_settings_schema.go
new file mode 100644
index 000000000..0f0d50f28
--- /dev/null
+++ b/genesyscloud/routing_settings/resource_genesyscloud_routing_settings_schema.go
@@ -0,0 +1,101 @@
+package routing_settings
+
+import (
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
+ "terraform-provider-genesyscloud/genesyscloud/provider"
+ resourceExporter "terraform-provider-genesyscloud/genesyscloud/resource_exporter"
+ registrar "terraform-provider-genesyscloud/genesyscloud/resource_register"
+)
+
+var resourceName = "genesyscloud_routing_settings"
+
+func SetRegistrar(regInstance registrar.Registrar) {
+ regInstance.RegisterResource(resourceName, ResourceRoutingSettings())
+ regInstance.RegisterExporter(resourceName, RoutingSettingsExporter())
+}
+
+func ResourceRoutingSettings() *schema.Resource {
+ return &schema.Resource{
+ Description: "An organization's routing settings",
+
+ CreateContext: provider.CreateWithPooledClient(createRoutingSettings),
+ ReadContext: provider.ReadWithPooledClient(readRoutingSettings),
+ UpdateContext: provider.UpdateWithPooledClient(updateRoutingSettings),
+ DeleteContext: provider.DeleteWithPooledClient(deleteRoutingSettings),
+ Importer: &schema.ResourceImporter{
+ StateContext: schema.ImportStatePassthroughContext,
+ },
+ SchemaVersion: 1,
+ Schema: map[string]*schema.Schema{
+ "reset_agent_on_presence_change": {
+ Description: "Reset agent score when agent presence changes from off-queue to on-queue",
+ Type: schema.TypeBool,
+ Optional: true,
+ Computed: true,
+ },
+ "contactcenter": {
+ Description: "Contact center settings",
+ Type: schema.TypeList,
+ Optional: true,
+ Computed: true,
+ MaxItems: 1,
+ Elem: &schema.Resource{
+ Schema: map[string]*schema.Schema{
+ "remove_skills_from_blind_transfer": {
+ Description: "Strip skills from transfer",
+ Type: schema.TypeBool,
+ Optional: true,
+ },
+ },
+ },
+ },
+ "transcription": {
+ Description: "Transcription settings",
+ Type: schema.TypeList,
+ Optional: true,
+ Computed: true,
+ MaxItems: 1,
+ Elem: &schema.Resource{
+ Schema: map[string]*schema.Schema{
+ "transcription": {
+ Description: "Setting to enable/disable transcription capability.Valid values: Disabled, EnabledGlobally, EnabledQueueFlow",
+ Type: schema.TypeString,
+ Optional: true,
+ },
+ "transcription_confidence_threshold": {
+ Description: "Configure confidence threshold. The possible values are from 1 to 100",
+ Type: schema.TypeInt,
+ Optional: true,
+ },
+ "low_latency_transcription_enabled": {
+ Description: "Boolean flag indicating whether low latency transcription via Notification API is enabled",
+ Type: schema.TypeBool,
+ Optional: true,
+ },
+ "content_search_enabled": {
+ Description: "Setting to enable/disable content search",
+ Type: schema.TypeBool,
+ Optional: true,
+ },
+ `pci_dss_redaction_enabled`: {
+ Description: `Setting to enable/disable PCI DSS Redaction`,
+ Optional: true,
+ Type: schema.TypeBool,
+ },
+ `pii_redaction_enabled`: {
+ Description: `Setting to enable/disable PII Redaction`,
+ Optional: true,
+ Type: schema.TypeBool,
+ },
+ },
+ },
+ },
+ },
+ }
+}
+
+func RoutingSettingsExporter() *resourceExporter.ResourceExporter {
+ return &resourceExporter.ResourceExporter{
+ GetResourcesFunc: provider.GetAllWithPooledClient(getAllRoutingSettings),
+ }
+}
diff --git a/genesyscloud/resource_genesyscloud_routing_settings_test.go b/genesyscloud/routing_settings/resource_genesyscloud_routing_settings_test.go
similarity index 98%
rename from genesyscloud/resource_genesyscloud_routing_settings_test.go
rename to genesyscloud/routing_settings/resource_genesyscloud_routing_settings_test.go
index 96b87f348..2539787b7 100644
--- a/genesyscloud/resource_genesyscloud_routing_settings_test.go
+++ b/genesyscloud/routing_settings/resource_genesyscloud_routing_settings_test.go
@@ -1,4 +1,4 @@
-package genesyscloud
+package routing_settings
import (
"fmt"
@@ -17,7 +17,7 @@ func TestAccResourceRoutingSettingsBasic(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { util.TestAccPreCheck(t) },
- ProviderFactories: provider.GetProviderFactories(providerResources, providerDataSources),
+ ProviderFactories: provider.GetProviderFactories(providerResources, nil),
Steps: []resource.TestStep{
{
// Create
@@ -57,7 +57,7 @@ func TestAccResourceRoutingSettingsContactCenter(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { util.TestAccPreCheck(t) },
- ProviderFactories: provider.GetProviderFactories(providerResources, providerDataSources),
+ ProviderFactories: provider.GetProviderFactories(providerResources, nil),
Steps: []resource.TestStep{
{
// Create with contact center
@@ -102,7 +102,7 @@ func TestAccResourceRoutingSettingsTranscription(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { util.TestAccPreCheck(t) },
- ProviderFactories: provider.GetProviderFactories(providerResources, providerDataSources),
+ ProviderFactories: provider.GetProviderFactories(providerResources, nil),
Steps: []resource.TestStep{
{
// Create with transcription
diff --git a/genesyscloud/routing_sms_addresses/genesyscloud_routing_sms_addresses_proxy.go b/genesyscloud/routing_sms_addresses/genesyscloud_routing_sms_addresses_proxy.go
index 950087dc4..4da161286 100644
--- a/genesyscloud/routing_sms_addresses/genesyscloud_routing_sms_addresses_proxy.go
+++ b/genesyscloud/routing_sms_addresses/genesyscloud_routing_sms_addresses_proxy.go
@@ -4,7 +4,7 @@ import (
"context"
"fmt"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
// Type definitions for each func on our proxy so we can easily mock them out later
diff --git a/genesyscloud/routing_sms_addresses/genesyscloud_routing_sms_addresses_schema.go b/genesyscloud/routing_sms_addresses/genesyscloud_routing_sms_addresses_schema.go
index c9a449d0c..edc7f69bf 100644
--- a/genesyscloud/routing_sms_addresses/genesyscloud_routing_sms_addresses_schema.go
+++ b/genesyscloud/routing_sms_addresses/genesyscloud_routing_sms_addresses_schema.go
@@ -5,7 +5,7 @@ import (
"terraform-provider-genesyscloud/genesyscloud/provider"
resourceExporter "terraform-provider-genesyscloud/genesyscloud/resource_exporter"
registrar "terraform-provider-genesyscloud/genesyscloud/resource_register"
- gcloud "terraform-provider-genesyscloud/genesyscloud/validators"
+ "terraform-provider-genesyscloud/genesyscloud/validators"
)
// SetRegistrar registers all the resources, data sources and exporters in the package
@@ -68,7 +68,7 @@ func ResourceRoutingSmsAddress() *schema.Resource {
Required: true,
ForceNew: true,
Type: schema.TypeString,
- ValidateDiagFunc: gcloud.ValidateCountryCode,
+ ValidateDiagFunc: validators.ValidateCountryCode,
},
`auto_correct_address`: {
Description: `This is used when the address is created. If the value is not set or true, then the system will, if necessary, auto-correct the address you provide. Set this value to false if the system should not auto-correct the address.`,
diff --git a/genesyscloud/routing_sms_addresses/resource_genesyscloud_routing_sms_addresses.go b/genesyscloud/routing_sms_addresses/resource_genesyscloud_routing_sms_addresses.go
index 932dad163..d578d8b0c 100644
--- a/genesyscloud/routing_sms_addresses/resource_genesyscloud_routing_sms_addresses.go
+++ b/genesyscloud/routing_sms_addresses/resource_genesyscloud_routing_sms_addresses.go
@@ -18,7 +18,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
const resourceName = "genesyscloud_routing_sms_address"
diff --git a/genesyscloud/routing_sms_addresses/resource_genesyscloud_routing_sms_addresses_test.go b/genesyscloud/routing_sms_addresses/resource_genesyscloud_routing_sms_addresses_test.go
index a54f64e56..4d4185ee8 100644
--- a/genesyscloud/routing_sms_addresses/resource_genesyscloud_routing_sms_addresses_test.go
+++ b/genesyscloud/routing_sms_addresses/resource_genesyscloud_routing_sms_addresses_test.go
@@ -9,7 +9,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceRoutingSmsAddressesProdOrg(t *testing.T) {
diff --git a/genesyscloud/routing_utilization/genesyscloud_routing_utilization_init_test.go b/genesyscloud/routing_utilization/genesyscloud_routing_utilization_init_test.go
new file mode 100644
index 000000000..3a9ec469f
--- /dev/null
+++ b/genesyscloud/routing_utilization/genesyscloud_routing_utilization_init_test.go
@@ -0,0 +1,47 @@
+package routing_utilization
+
+import (
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
+ "sync"
+ "terraform-provider-genesyscloud/genesyscloud/routing_utilization_label"
+ "testing"
+)
+
+/*
+The genesyscloud_routing_utilization_init_test.go file is used to initialize the data sources and resources
+used in testing the routing_utilization resource.
+*/
+
+// providerResources holds a map of all registered resources
+var providerResources map[string]*schema.Resource
+
+type registerTestInstance struct {
+ resourceMapMutex sync.RWMutex
+}
+
+// registerTestResources registers all resources used in the tests
+func (r *registerTestInstance) registerTestResources() {
+ r.resourceMapMutex.Lock()
+ defer r.resourceMapMutex.Unlock()
+
+ providerResources[resourceName] = ResourceRoutingUtilization()
+ providerResources["genesyscloud_routing_utilization_label"] = routing_utilization_label.ResourceRoutingUtilizationLabel()
+}
+
+// initTestResources initializes all test resources and data sources.
+func initTestResources() {
+ providerResources = make(map[string]*schema.Resource)
+
+ regInstance := ®isterTestInstance{}
+
+ regInstance.registerTestResources()
+}
+
+// TestMain is a "setup" function called by the testing framework when run the test
+func TestMain(m *testing.M) {
+ // Run setup function before starting the test suite for the package
+ initTestResources()
+
+ // Run the test suite for the package
+ m.Run()
+}
diff --git a/genesyscloud/routing_utilization/genesyscloud_routing_utilization_proxy.go b/genesyscloud/routing_utilization/genesyscloud_routing_utilization_proxy.go
new file mode 100644
index 000000000..776d9664a
--- /dev/null
+++ b/genesyscloud/routing_utilization/genesyscloud_routing_utilization_proxy.go
@@ -0,0 +1,99 @@
+package routing_utilization
+
+import (
+ "context"
+ "fmt"
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
+)
+
+var internalProxy *routingUtilizationProxy
+
+type getRoutingUtilizationFunc func(ctx context.Context, p *routingUtilizationProxy) (*platformclientv2.APIResponse, error)
+type updateRoutingUtilizationFunc func(ctx context.Context, p *routingUtilizationProxy, request *platformclientv2.Utilizationrequest) (*platformclientv2.Utilizationresponse, *platformclientv2.APIResponse, error)
+type deleteRoutingUtilizationFunc func(ctx context.Context, p *routingUtilizationProxy) (*platformclientv2.APIResponse, error)
+
+type updateDirectlyFunc func(ctx context.Context, p *routingUtilizationProxy, d *schema.ResourceData, utilizationRequest []interface{}) (*platformclientv2.APIResponse, error)
+
+type routingUtilizationProxy struct {
+ clientConfig *platformclientv2.Configuration
+ routingApi *platformclientv2.RoutingApi
+ getRoutingUtilizationAttr getRoutingUtilizationFunc
+ updateRoutingUtilizationAttr updateRoutingUtilizationFunc
+ deleteRoutingUtilizationAttr deleteRoutingUtilizationFunc
+
+ updateDirectlyAttr updateDirectlyFunc
+}
+
+func newRoutingUtilizationProxy(clientConfig *platformclientv2.Configuration) *routingUtilizationProxy {
+ api := platformclientv2.NewRoutingApiWithConfig(clientConfig)
+ return &routingUtilizationProxy{
+ clientConfig: clientConfig,
+ routingApi: api,
+ getRoutingUtilizationAttr: getRoutingUtilizationFn,
+ updateRoutingUtilizationAttr: updateRoutingUtilizationFn,
+ deleteRoutingUtilizationAttr: deleteRoutingUtilizationFn,
+
+ updateDirectlyAttr: updateDirectlyFn,
+ }
+}
+
+func getRoutingUtilizationProxy(clientConfig *platformclientv2.Configuration) *routingUtilizationProxy {
+ if internalProxy == nil {
+ internalProxy = newRoutingUtilizationProxy(clientConfig)
+ }
+ return internalProxy
+}
+
+func (p *routingUtilizationProxy) getRoutingUtilization(ctx context.Context) (*platformclientv2.APIResponse, error) {
+ return p.getRoutingUtilizationAttr(ctx, p)
+}
+func (p *routingUtilizationProxy) updateRoutingUtilization(ctx context.Context, request *platformclientv2.Utilizationrequest) (*platformclientv2.Utilizationresponse, *platformclientv2.APIResponse, error) {
+ return p.updateRoutingUtilizationAttr(ctx, p, request)
+}
+func (p *routingUtilizationProxy) deleteRoutingUtilization(ctx context.Context) (*platformclientv2.APIResponse, error) {
+ return p.deleteRoutingUtilizationAttr(ctx, p)
+}
+
+func (p *routingUtilizationProxy) updateDirectly(ctx context.Context, d *schema.ResourceData, utilizationRequest []interface{}) (*platformclientv2.APIResponse, error) {
+ return p.updateDirectlyAttr(ctx, p, d, utilizationRequest)
+}
+
+// Calling the Utilization API directly while the label feature is not available.
+// Once it is, this code can go back to using platformclientv2's RoutingApi to make the call.
+func getRoutingUtilizationFn(ctx context.Context, p *routingUtilizationProxy) (*platformclientv2.APIResponse, error) {
+ apiClient := &p.routingApi.Configuration.APIClient
+ path := fmt.Sprintf("%s/api/v2/routing/utilization", p.routingApi.Configuration.BasePath)
+ headerParams := buildHeaderParams(p.routingApi)
+ resp, err := apiClient.CallAPI(path, "GET", nil, headerParams, nil, nil, "", nil)
+ if err != nil {
+ return resp, fmt.Errorf("failed to get routing utilization %s ", err)
+ }
+ return resp, nil
+}
+
+func updateRoutingUtilizationFn(ctx context.Context, p *routingUtilizationProxy, utilizationRequest *platformclientv2.Utilizationrequest) (*platformclientv2.Utilizationresponse, *platformclientv2.APIResponse, error) {
+ return p.routingApi.PutRoutingUtilization(*utilizationRequest)
+}
+
+func deleteRoutingUtilizationFn(ctx context.Context, p *routingUtilizationProxy) (*platformclientv2.APIResponse, error) {
+ return p.routingApi.DeleteRoutingUtilization()
+}
+
+// If the resource has label(s), calls the Utilization API directly.
+// This code can go back to using platformclientv2's RoutingApi to make the call once label utilization is available in platformclientv2's RoutingApi
+func updateDirectlyFn(ctx context.Context, p *routingUtilizationProxy, d *schema.ResourceData, utilizationRequest []interface{}) (*platformclientv2.APIResponse, error) {
+ apiClient := &p.routingApi.Configuration.APIClient
+
+ path := fmt.Sprintf("%s/api/v2/routing/utilization", p.routingApi.Configuration.BasePath)
+ headerParams := buildHeaderParams(p.routingApi)
+ requestPayload := make(map[string]interface{})
+ requestPayload["utilization"] = buildSdkMediaUtilizations(d)
+ requestPayload["labelUtilizations"] = BuildLabelUtilizationsRequest(utilizationRequest)
+
+ resp, err := apiClient.CallAPI(path, "PUT", requestPayload, headerParams, nil, nil, "", nil)
+ if err != nil {
+ return resp, fmt.Errorf("error updating directly %s", err)
+ }
+ return resp, nil
+}
diff --git a/genesyscloud/routing_utilization/resource_genesyscloud_routing_utilization.go b/genesyscloud/routing_utilization/resource_genesyscloud_routing_utilization.go
new file mode 100644
index 000000000..27acc28ba
--- /dev/null
+++ b/genesyscloud/routing_utilization/resource_genesyscloud_routing_utilization.go
@@ -0,0 +1,128 @@
+package routing_utilization
+
+import (
+ "context"
+ "encoding/json"
+ "fmt"
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
+ "log"
+ "terraform-provider-genesyscloud/genesyscloud/provider"
+ "terraform-provider-genesyscloud/genesyscloud/util"
+ "terraform-provider-genesyscloud/genesyscloud/util/constants"
+
+ "terraform-provider-genesyscloud/genesyscloud/consistency_checker"
+
+ "github.com/hashicorp/terraform-plugin-sdk/v2/diag"
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
+ resourceExporter "terraform-provider-genesyscloud/genesyscloud/resource_exporter"
+)
+
+func getAllRoutingUtilization(_ context.Context, _ *platformclientv2.Configuration) (resourceExporter.ResourceIDMetaMap, diag.Diagnostics) {
+ // Routing utilization config always exists
+ resources := make(resourceExporter.ResourceIDMetaMap)
+ resources["0"] = &resourceExporter.ResourceMeta{Name: "routing_utilization"}
+ return resources, nil
+}
+
+func createRoutingUtilization(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
+ log.Printf("Creating Routing Utilization")
+ d.SetId("routing_utilization")
+ return updateRoutingUtilization(ctx, d, meta)
+}
+
+func readRoutingUtilization(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
+ // Calling the Utilization API directly while the label feature is not available.
+ // Once it is, this code can go back to using platformclientv2's RoutingApi to make the call.
+ sdkConfig := meta.(*provider.ProviderMeta).ClientConfig
+ proxy := getRoutingUtilizationProxy(sdkConfig)
+ cc := consistency_checker.NewConsistencyCheck(ctx, d, meta, ResourceRoutingUtilization(), constants.DefaultConsistencyChecks, resourceName)
+ orgUtilization := &OrgUtilizationWithLabels{}
+
+ log.Printf("Reading Routing Utilization")
+
+ return util.WithRetriesForRead(ctx, d, func() *retry.RetryError {
+ resp, err := proxy.getRoutingUtilization(ctx)
+ if err != nil {
+ if util.IsStatus404(resp) {
+ return retry.RetryableError(util.BuildWithRetriesApiDiagnosticError(resourceName, fmt.Sprintf("Failed to read Routing Utilization: %s", err), resp))
+ }
+ return retry.NonRetryableError(util.BuildWithRetriesApiDiagnosticError(resourceName, fmt.Sprintf("Failed to read Routing Utilization: %s", err), resp))
+ }
+
+ err = json.Unmarshal(resp.RawBody, &orgUtilization)
+
+ if orgUtilization.Utilization != nil {
+ for sdkType, schemaType := range UtilizationMediaTypes {
+ if mediaSettings, ok := orgUtilization.Utilization[sdkType]; ok {
+ _ = d.Set(schemaType, FlattenUtilizationSetting(mediaSettings))
+ } else {
+ _ = d.Set(schemaType, nil)
+ }
+ }
+ }
+
+ if orgUtilization.LabelUtilizations != nil {
+ originalLabelUtilizations := d.Get("label_utilizations").([]interface{})
+ // Only add to the state the configured labels, in the configured order, but not any extras, to help terraform with matching new and old state.
+ flattenedLabelUtilizations := FilterAndFlattenLabelUtilizations(orgUtilization.LabelUtilizations, originalLabelUtilizations)
+ _ = d.Set("label_utilizations", flattenedLabelUtilizations)
+ }
+
+ log.Printf("Read Routing Utilization")
+ return cc.CheckState(d)
+ })
+}
+
+func updateRoutingUtilization(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
+ sdkConfig := meta.(*provider.ProviderMeta).ClientConfig
+ proxy := getRoutingUtilizationProxy(sdkConfig)
+
+ labelUtilizations := d.Get("label_utilizations").([]interface{})
+ var resp *platformclientv2.APIResponse
+ var err error
+
+ log.Printf("Updating Routing Utilization")
+
+ // Retrying on 409s because if a label is created immediately before the utilization update, it can lead to a conflict while the utilization is being updated to handle the new label.
+ diagErr := util.RetryWhen(util.IsStatus409, func() (*platformclientv2.APIResponse, diag.Diagnostics) {
+ // If the resource has label(s), calls the Utilization API directly.
+ // This code can go back to using platformclientv2's RoutingApi to make the call once label utilization is available in platformclientv2's RoutingApi.
+ if labelUtilizations != nil && len(labelUtilizations) > 0 {
+ resp, err := proxy.updateDirectly(ctx, d, labelUtilizations)
+ if err != nil {
+ return resp, util.BuildAPIDiagnosticError(resourceName, "Failed to update routing utilization directly", resp)
+ }
+ } else {
+ _, resp, err = proxy.updateRoutingUtilization(ctx, &platformclientv2.Utilizationrequest{
+ Utilization: buildSdkMediaUtilizations(d),
+ })
+ }
+
+ if err != nil {
+ return resp, util.BuildAPIDiagnosticError(resourceName, fmt.Sprintf("Failed to update Routing Utilization %s error: %s", d.Id(), err), resp)
+ }
+ return resp, nil
+ })
+ if diagErr != nil {
+ return diagErr
+ }
+
+ log.Printf("Updated Routing Utilization")
+ return readRoutingUtilization(ctx, d, meta)
+}
+
+func deleteRoutingUtilization(ctx context.Context, _ *schema.ResourceData, meta interface{}) diag.Diagnostics {
+ sdkConfig := meta.(*provider.ProviderMeta).ClientConfig
+ proxy := getRoutingUtilizationProxy(sdkConfig)
+
+ // Resets to default values
+ log.Printf("Resetting Routing Utilization")
+
+ resp, err := proxy.deleteRoutingUtilization(ctx)
+ if err != nil {
+ return util.BuildAPIDiagnosticError(resourceName, fmt.Sprintf("Failed to reset Routing Utilization | error: %s", err), resp)
+ }
+ log.Printf("Reset Routing Utilization")
+ return nil
+}
diff --git a/genesyscloud/routing_utilization/resource_genesyscloud_routing_utilization_schema.go b/genesyscloud/routing_utilization/resource_genesyscloud_routing_utilization_schema.go
new file mode 100644
index 000000000..0ebba6209
--- /dev/null
+++ b/genesyscloud/routing_utilization/resource_genesyscloud_routing_utilization_schema.go
@@ -0,0 +1,167 @@
+package routing_utilization
+
+import (
+ "fmt"
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
+ "strings"
+ "terraform-provider-genesyscloud/genesyscloud/provider"
+ resourceExporter "terraform-provider-genesyscloud/genesyscloud/resource_exporter"
+ registrar "terraform-provider-genesyscloud/genesyscloud/resource_register"
+ "time"
+)
+
+const resourceName = "genesyscloud_routing_utilization"
+
+// SetRegistrar registers all the resources and exporters in the package
+func SetRegistrar(regInstance registrar.Registrar) {
+ regInstance.RegisterResource(resourceName, ResourceRoutingUtilization())
+ regInstance.RegisterExporter(resourceName, RoutingUtilizationExporter())
+}
+
+type MediaUtilization struct {
+ MaximumCapacity int32 `json:"maximumCapacity"`
+ InterruptableMediaTypes []string `json:"interruptableMediaTypes"`
+ IncludeNonAcd bool `json:"includeNonAcd"`
+}
+
+type LabelUtilization struct {
+ MaximumCapacity int32 `json:"maximumCapacity"`
+ InterruptingLabelIds []string `json:"interruptingLabelIds"`
+}
+
+type OrgUtilizationWithLabels struct {
+ Utilization map[string]MediaUtilization `json:"utilization"`
+ LabelUtilizations map[string]LabelUtilization `json:"labelUtilizations"`
+}
+
+var (
+ // Map of SDK media type name to schema media type name
+ UtilizationMediaTypes = map[string]string{
+ "call": "call",
+ "callback": "callback",
+ "chat": "chat",
+ "email": "email",
+ "message": "message",
+ }
+
+ UtilizationSettingsResource = &schema.Resource{
+ Schema: map[string]*schema.Schema{
+ "maximum_capacity": {
+ Description: "Maximum capacity of conversations of this media type. Value must be between 0 and 25.",
+ Type: schema.TypeInt,
+ Required: true,
+ ValidateFunc: validation.IntBetween(0, 25),
+ },
+ "interruptible_media_types": {
+ Description: fmt.Sprintf("Set of other media types that can interrupt this media type (%s).", strings.Join(getSdkUtilizationTypes(), " | ")),
+ Type: schema.TypeSet,
+ Optional: true,
+ Elem: &schema.Schema{Type: schema.TypeString},
+ },
+ "include_non_acd": {
+ Description: "Block this media type when on a non-ACD conversation.",
+ Type: schema.TypeBool,
+ Optional: true,
+ Default: false,
+ },
+ },
+ }
+
+ UtilizationLabelResource = &schema.Resource{
+ Schema: map[string]*schema.Schema{
+ "label_id": {
+ Description: "Id of the label being configured.",
+ Type: schema.TypeString,
+ Required: true,
+ },
+ "maximum_capacity": {
+ Description: "Maximum capacity of conversations with this label. Value must be between 0 and 25.",
+ Type: schema.TypeInt,
+ Required: true,
+ ValidateFunc: validation.IntBetween(0, 25),
+ },
+ "interrupting_label_ids": {
+ Description: "Set of other labels that can interrupt this label.",
+ Type: schema.TypeSet,
+ Optional: true,
+ Elem: &schema.Schema{Type: schema.TypeString},
+ },
+ },
+ }
+)
+
+func ResourceRoutingUtilization() *schema.Resource {
+ return &schema.Resource{
+ Description: "Genesys Cloud Org-wide Routing Utilization Settings.",
+
+ CreateContext: provider.CreateWithPooledClient(createRoutingUtilization),
+ ReadContext: provider.ReadWithPooledClient(readRoutingUtilization),
+ UpdateContext: provider.UpdateWithPooledClient(updateRoutingUtilization),
+ DeleteContext: provider.DeleteWithPooledClient(deleteRoutingUtilization),
+ Importer: &schema.ResourceImporter{
+ StateContext: schema.ImportStatePassthroughContext,
+ },
+ SchemaVersion: 1,
+ Timeouts: &schema.ResourceTimeout{
+ Update: schema.DefaultTimeout(8 * time.Minute),
+ Read: schema.DefaultTimeout(8 * time.Minute),
+ },
+ Schema: map[string]*schema.Schema{
+ "call": {
+ Description: "Call media settings. If not set, this reverts to the default media type settings.",
+ Type: schema.TypeList,
+ MaxItems: 1,
+ Optional: true,
+ Computed: true,
+ Elem: UtilizationSettingsResource,
+ },
+ "callback": {
+ Description: "Callback media settings. If not set, this reverts to the default media type settings.",
+ Type: schema.TypeList,
+ MaxItems: 1,
+ Optional: true,
+ Computed: true,
+ Elem: UtilizationSettingsResource,
+ },
+ "message": {
+ Description: "Message media settings. If not set, this reverts to the default media type settings.",
+ Type: schema.TypeList,
+ MaxItems: 1,
+ Optional: true,
+ Computed: true,
+ Elem: UtilizationSettingsResource,
+ },
+ "email": {
+ Description: "Email media settings. If not set, this reverts to the default media type settings.",
+ Type: schema.TypeList,
+ MaxItems: 1,
+ Optional: true,
+ Computed: true,
+ Elem: UtilizationSettingsResource,
+ },
+ "chat": {
+ Description: "Chat media settings. If not set, this reverts to the default media type settings.",
+ Type: schema.TypeList,
+ MaxItems: 1,
+ Optional: true,
+ Computed: true,
+ Elem: UtilizationSettingsResource,
+ },
+ "label_utilizations": {
+ Description: "Label utilization settings. If not set, default label settings will be applied. This is in PREVIEW and should not be used unless the feature is available to your organization.",
+ Type: schema.TypeList,
+ Optional: true,
+ Computed: true,
+ Elem: UtilizationLabelResource,
+ },
+ },
+ }
+}
+
+func RoutingUtilizationExporter() *resourceExporter.ResourceExporter {
+ return &resourceExporter.ResourceExporter{
+ GetResourcesFunc: provider.GetAllWithPooledClient(getAllRoutingUtilization),
+ AllowZeroValues: []string{"maximum_capacity"},
+ }
+}
diff --git a/genesyscloud/resource_genesyscloud_routing_utilization_test.go b/genesyscloud/routing_utilization/resource_genesyscloud_routing_utilization_test.go
similarity index 77%
rename from genesyscloud/resource_genesyscloud_routing_utilization_test.go
rename to genesyscloud/routing_utilization/resource_genesyscloud_routing_utilization_test.go
index 65f90323c..0e5019ce6 100644
--- a/genesyscloud/resource_genesyscloud_routing_utilization_test.go
+++ b/genesyscloud/routing_utilization/resource_genesyscloud_routing_utilization_test.go
@@ -1,4 +1,4 @@
-package genesyscloud
+package routing_utilization
import (
"fmt"
@@ -6,6 +6,7 @@ import (
"strconv"
"strings"
"terraform-provider-genesyscloud/genesyscloud/provider"
+ routingUtilizationLabel "terraform-provider-genesyscloud/genesyscloud/routing_utilization_label"
"terraform-provider-genesyscloud/genesyscloud/util"
"testing"
"time"
@@ -13,7 +14,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceBasicRoutingUtilization(t *testing.T) {
@@ -27,16 +28,16 @@ func TestAccResourceBasicRoutingUtilization(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { util.TestAccPreCheck(t) },
- ProviderFactories: provider.GetProviderFactories(providerResources, providerDataSources),
+ ProviderFactories: provider.GetProviderFactories(providerResources, nil),
Steps: []resource.TestStep{
{
// Create
Config: generateRoutingUtilizationResource(
- generateRoutingUtilMediaType("call", maxCapacity1, util.FalseValue),
- generateRoutingUtilMediaType("callback", maxCapacity1, util.FalseValue),
- generateRoutingUtilMediaType("chat", maxCapacity1, util.FalseValue),
- generateRoutingUtilMediaType("email", maxCapacity1, util.FalseValue),
- generateRoutingUtilMediaType("message", maxCapacity1, util.FalseValue),
+ GenerateRoutingUtilMediaType("call", maxCapacity1, util.FalseValue),
+ GenerateRoutingUtilMediaType("callback", maxCapacity1, util.FalseValue),
+ GenerateRoutingUtilMediaType("chat", maxCapacity1, util.FalseValue),
+ GenerateRoutingUtilMediaType("email", maxCapacity1, util.FalseValue),
+ GenerateRoutingUtilMediaType("message", maxCapacity1, util.FalseValue),
),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("genesyscloud_routing_utilization.routing-util", "call.0.maximum_capacity", maxCapacity1),
@@ -59,11 +60,11 @@ func TestAccResourceBasicRoutingUtilization(t *testing.T) {
{
// Update with a new max capacities and interruptible media types
Config: generateRoutingUtilizationResource(
- generateRoutingUtilMediaType("call", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeEmail)),
- generateRoutingUtilMediaType("callback", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
- generateRoutingUtilMediaType("chat", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
- generateRoutingUtilMediaType("email", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
- generateRoutingUtilMediaType("message", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
+ GenerateRoutingUtilMediaType("call", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeEmail)),
+ GenerateRoutingUtilMediaType("callback", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
+ GenerateRoutingUtilMediaType("chat", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
+ GenerateRoutingUtilMediaType("email", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
+ GenerateRoutingUtilMediaType("message", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("genesyscloud_routing_utilization.routing-util", "call.0.maximum_capacity", maxCapacity2),
@@ -108,30 +109,32 @@ func TestAccResourceRoutingUtilizationWithLabels(t *testing.T) {
greenLabelName = "Terraform Green Label" + uuid.NewString()
)
- CleanupRoutingUtilizationLabel()
+ if err := CleanupRoutingUtilizationLabel(); err != nil {
+ t.Skipf("%v", err) // Skip the test and not fail it
+ }
resource.Test(t, resource.TestCase{
PreCheck: func() {
util.TestAccPreCheck(t)
- if err := checkIfLabelsAreEnabled(); err != nil {
+ if err := routingUtilizationLabel.CheckIfLabelsAreEnabled(); err != nil {
t.Skipf("%v", err) // be sure to skip the test and not fail it
}
},
- ProviderFactories: provider.GetProviderFactories(providerResources, providerDataSources),
+ ProviderFactories: provider.GetProviderFactories(providerResources, nil),
Steps: []resource.TestStep{
{
// Create
- Config: GenerateRoutingUtilizationLabelResource(redLabelResource, redLabelName, "") +
- GenerateRoutingUtilizationLabelResource(blueLabelResource, blueLabelName, redLabelResource) +
- GenerateRoutingUtilizationLabelResource(greenLabelResource, greenLabelName, blueLabelResource) +
+ Config: routingUtilizationLabel.GenerateRoutingUtilizationLabelResource(redLabelResource, redLabelName, "") +
+ routingUtilizationLabel.GenerateRoutingUtilizationLabelResource(blueLabelResource, blueLabelName, redLabelResource) +
+ routingUtilizationLabel.GenerateRoutingUtilizationLabelResource(greenLabelResource, greenLabelName, blueLabelResource) +
generateRoutingUtilizationResource(
- generateRoutingUtilMediaType("call", maxCapacity1, util.FalseValue),
- generateRoutingUtilMediaType("callback", maxCapacity1, util.FalseValue),
- generateRoutingUtilMediaType("chat", maxCapacity1, util.FalseValue),
- generateRoutingUtilMediaType("email", maxCapacity1, util.FalseValue),
- generateRoutingUtilMediaType("message", maxCapacity1, util.FalseValue),
- generateLabelUtilization(redLabelResource, maxCapacity1),
- generateLabelUtilization(blueLabelResource, maxCapacity1, redLabelResource),
+ GenerateRoutingUtilMediaType("call", maxCapacity1, util.FalseValue),
+ GenerateRoutingUtilMediaType("callback", maxCapacity1, util.FalseValue),
+ GenerateRoutingUtilMediaType("chat", maxCapacity1, util.FalseValue),
+ GenerateRoutingUtilMediaType("email", maxCapacity1, util.FalseValue),
+ GenerateRoutingUtilMediaType("message", maxCapacity1, util.FalseValue),
+ routingUtilizationLabel.GenerateLabelUtilization(redLabelResource, maxCapacity1),
+ routingUtilizationLabel.GenerateLabelUtilization(blueLabelResource, maxCapacity1, redLabelResource),
),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("genesyscloud_routing_utilization.routing-util", "call.0.maximum_capacity", maxCapacity1),
@@ -157,17 +160,17 @@ func TestAccResourceRoutingUtilizationWithLabels(t *testing.T) {
},
{
// Update with a new max capacities and interruptible media types
- Config: GenerateRoutingUtilizationLabelResource(redLabelResource, redLabelName, "") +
- GenerateRoutingUtilizationLabelResource(blueLabelResource, blueLabelName, redLabelResource) +
- GenerateRoutingUtilizationLabelResource(greenLabelResource, greenLabelName, blueLabelResource) +
+ Config: routingUtilizationLabel.GenerateRoutingUtilizationLabelResource(redLabelResource, redLabelName, "") +
+ routingUtilizationLabel.GenerateRoutingUtilizationLabelResource(blueLabelResource, blueLabelName, redLabelResource) +
+ routingUtilizationLabel.GenerateRoutingUtilizationLabelResource(greenLabelResource, greenLabelName, blueLabelResource) +
generateRoutingUtilizationResource(
- generateRoutingUtilMediaType("call", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeEmail)),
- generateRoutingUtilMediaType("callback", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
- generateRoutingUtilMediaType("chat", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
- generateRoutingUtilMediaType("email", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
- generateRoutingUtilMediaType("message", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
- generateLabelUtilization(redLabelResource, maxCapacity2),
- generateLabelUtilization(blueLabelResource, maxCapacity2, redLabelResource),
+ GenerateRoutingUtilMediaType("call", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeEmail)),
+ GenerateRoutingUtilMediaType("callback", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
+ GenerateRoutingUtilMediaType("chat", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
+ GenerateRoutingUtilMediaType("email", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
+ GenerateRoutingUtilMediaType("message", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
+ routingUtilizationLabel.GenerateLabelUtilization(redLabelResource, maxCapacity2),
+ routingUtilizationLabel.GenerateLabelUtilization(blueLabelResource, maxCapacity2, redLabelResource),
),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("genesyscloud_routing_utilization.routing-util", "call.0.maximum_capacity", maxCapacity2),
@@ -192,27 +195,27 @@ func TestAccResourceRoutingUtilizationWithLabels(t *testing.T) {
),
},
{ //Delete one by one to avoid conflict
- Config: GenerateRoutingUtilizationLabelResource(redLabelResource, redLabelName, "") +
- GenerateRoutingUtilizationLabelResource(blueLabelResource, blueLabelName, redLabelResource) +
+ Config: routingUtilizationLabel.GenerateRoutingUtilizationLabelResource(redLabelResource, redLabelName, "") +
+ routingUtilizationLabel.GenerateRoutingUtilizationLabelResource(blueLabelResource, blueLabelName, redLabelResource) +
generateRoutingUtilizationResource(
- generateRoutingUtilMediaType("call", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeEmail)),
- generateRoutingUtilMediaType("callback", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
- generateRoutingUtilMediaType("chat", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
- generateRoutingUtilMediaType("email", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
- generateRoutingUtilMediaType("message", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
- generateLabelUtilization(redLabelResource, maxCapacity2),
- generateLabelUtilization(blueLabelResource, maxCapacity2, redLabelResource),
+ GenerateRoutingUtilMediaType("call", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeEmail)),
+ GenerateRoutingUtilMediaType("callback", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
+ GenerateRoutingUtilMediaType("chat", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
+ GenerateRoutingUtilMediaType("email", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
+ GenerateRoutingUtilMediaType("message", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
+ routingUtilizationLabel.GenerateLabelUtilization(redLabelResource, maxCapacity2),
+ routingUtilizationLabel.GenerateLabelUtilization(blueLabelResource, maxCapacity2, redLabelResource),
),
},
{
- Config: GenerateRoutingUtilizationLabelResource(redLabelResource, redLabelName, "") +
+ Config: routingUtilizationLabel.GenerateRoutingUtilizationLabelResource(redLabelResource, redLabelName, "") +
generateRoutingUtilizationResource(
- generateRoutingUtilMediaType("call", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeEmail)),
- generateRoutingUtilMediaType("callback", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
- generateRoutingUtilMediaType("chat", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
- generateRoutingUtilMediaType("email", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
- generateRoutingUtilMediaType("message", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
- generateLabelUtilization(redLabelResource, maxCapacity2),
+ GenerateRoutingUtilMediaType("call", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeEmail)),
+ GenerateRoutingUtilMediaType("callback", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
+ GenerateRoutingUtilMediaType("chat", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
+ GenerateRoutingUtilMediaType("email", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
+ GenerateRoutingUtilMediaType("message", maxCapacity2, util.TrueValue, strconv.Quote(utilTypeCall)),
+ routingUtilizationLabel.GenerateLabelUtilization(redLabelResource, maxCapacity2),
),
},
{
@@ -273,37 +276,6 @@ func assertAttributeEquals(state *terraform.InstanceState, attributeName, expect
}
}
-func generateRoutingUtilMediaType(
- mediaType string,
- maxCapacity string,
- includeNonAcd string,
- interruptTypes ...string) string {
- return fmt.Sprintf(`%s {
- maximum_capacity = %s
- include_non_acd = %s
- interruptible_media_types = [%s]
- }
- `, mediaType, maxCapacity, includeNonAcd, strings.Join(interruptTypes, ","))
-}
-
-func generateLabelUtilization(
- labelResource string,
- maxCapacity string,
- interruptingLabelResourceNames ...string) string {
-
- interruptingLabelResources := make([]string, 0)
- for _, resourceName := range interruptingLabelResourceNames {
- interruptingLabelResources = append(interruptingLabelResources, "genesyscloud_routing_utilization_label."+resourceName+".id")
- }
-
- return fmt.Sprintf(`label_utilizations {
- label_id = genesyscloud_routing_utilization_label.%s.id
- maximum_capacity = %s
- interrupting_label_ids = [%s]
- }
- `, labelResource, maxCapacity, strings.Join(interruptingLabelResources, ","))
-}
-
func generateRoutingUtilizationResource(attributes ...string) string {
return fmt.Sprintf(`resource "genesyscloud_routing_utilization" "routing-util" {
%s
@@ -311,19 +283,24 @@ func generateRoutingUtilizationResource(attributes ...string) string {
`, strings.Join(attributes, "\n"))
}
-func CleanupRoutingUtilizationLabel() {
- routingAPI := platformclientv2.NewRoutingApiWithConfig(sdkConfig)
+func CleanupRoutingUtilizationLabel() error {
+ config, err := provider.AuthorizeSdk()
+ if err != nil {
+ return err
+ }
+
+ routingAPI := platformclientv2.NewRoutingApiWithConfig(config)
for pageNum := 1; ; pageNum++ {
const pageSize = 100
labels, _, getErr := routingAPI.GetRoutingUtilizationLabels(pageSize, pageNum, "", "")
if getErr != nil {
log.Printf("failed to get page %v of routing email domains: %v", pageNum, getErr)
- return
+ return getErr
}
if labels.Entities == nil || len(*labels.Entities) == 0 {
- return
+ return nil
}
for _, label := range *labels.Entities {
diff --git a/genesyscloud/routing_utilization/resource_routing_utilization_utils.go b/genesyscloud/routing_utilization/resource_routing_utilization_utils.go
new file mode 100644
index 000000000..060d857b8
--- /dev/null
+++ b/genesyscloud/routing_utilization/resource_routing_utilization_utils.go
@@ -0,0 +1,135 @@
+package routing_utilization
+
+import (
+ "fmt"
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
+ "sort"
+ "strings"
+ "terraform-provider-genesyscloud/genesyscloud/util/lists"
+)
+
+func buildSdkMediaUtilizations(d *schema.ResourceData) *map[string]platformclientv2.Mediautilization {
+ settings := make(map[string]platformclientv2.Mediautilization)
+
+ for sdkType, schemaType := range UtilizationMediaTypes {
+ mediaSettings := d.Get(schemaType).([]interface{})
+ if mediaSettings != nil && len(mediaSettings) > 0 {
+ settings[sdkType] = BuildSdkMediaUtilization(mediaSettings)
+ }
+ }
+
+ return &settings
+}
+
+func BuildSdkMediaUtilization(settings []interface{}) platformclientv2.Mediautilization {
+ settingsMap := settings[0].(map[string]interface{})
+
+ maxCapacity := settingsMap["maximum_capacity"].(int)
+ includeNonAcd := settingsMap["include_non_acd"].(bool)
+
+ // Optional
+ interruptableMediaTypes := &[]string{}
+ if types, ok := settingsMap["interruptible_media_types"]; ok {
+ interruptableMediaTypes = lists.SetToStringList(types.(*schema.Set))
+ }
+
+ return platformclientv2.Mediautilization{
+ MaximumCapacity: &maxCapacity,
+ IncludeNonAcd: &includeNonAcd,
+ InterruptableMediaTypes: interruptableMediaTypes,
+ }
+}
+
+func BuildLabelUtilizationsRequest(labelUtilizations []interface{}) map[string]LabelUtilization {
+ request := make(map[string]LabelUtilization)
+ for _, labelUtilization := range labelUtilizations {
+ labelUtilizationMap := labelUtilization.(map[string]interface{})
+ interruptingLabelIds := lists.SetToStringList(labelUtilizationMap["interrupting_label_ids"].(*schema.Set))
+
+ request[labelUtilizationMap["label_id"].(string)] = LabelUtilization{
+ MaximumCapacity: int32(labelUtilizationMap["maximum_capacity"].(int)),
+ InterruptingLabelIds: *interruptingLabelIds,
+ }
+ }
+ return request
+}
+
+func FlattenUtilizationSetting(settings MediaUtilization) []interface{} {
+ settingsMap := make(map[string]interface{})
+
+ settingsMap["maximum_capacity"] = settings.MaximumCapacity
+ settingsMap["include_non_acd"] = settings.IncludeNonAcd
+ if settings.InterruptableMediaTypes != nil {
+ settingsMap["interruptible_media_types"] = lists.StringListToSet(settings.InterruptableMediaTypes)
+ }
+
+ return []interface{}{settingsMap}
+}
+
+func FilterAndFlattenLabelUtilizations(labelUtilizations map[string]LabelUtilization, originalLabelUtilizations []interface{}) []interface{} {
+ flattenedLabelUtilizations := make([]interface{}, 0)
+
+ for _, originalLabelUtilization := range originalLabelUtilizations {
+ originalLabelId := (originalLabelUtilization.(map[string]interface{}))["label_id"].(string)
+
+ for currentLabelId, currentLabelUtilization := range labelUtilizations {
+ if currentLabelId == originalLabelId {
+ flattenedLabelUtilizations = append(flattenedLabelUtilizations, flattenLabelUtilization(currentLabelId, currentLabelUtilization))
+ delete(labelUtilizations, currentLabelId)
+ break
+ }
+ }
+ }
+
+ return flattenedLabelUtilizations
+}
+
+func flattenLabelUtilization(labelId string, labelUtilization LabelUtilization) map[string]interface{} {
+ utilizationMap := make(map[string]interface{})
+
+ utilizationMap["label_id"] = labelId
+ utilizationMap["maximum_capacity"] = labelUtilization.MaximumCapacity
+ if labelUtilization.InterruptingLabelIds != nil {
+ utilizationMap["interrupting_label_ids"] = lists.StringListToSet(labelUtilization.InterruptingLabelIds)
+ }
+
+ return utilizationMap
+}
+
+func GenerateRoutingUtilMediaType(
+ mediaType string,
+ maxCapacity string,
+ includeNonAcd string,
+ interruptTypes ...string) string {
+ return fmt.Sprintf(`%s {
+ maximum_capacity = %s
+ include_non_acd = %s
+ interruptible_media_types = [%s]
+ }
+ `, mediaType, maxCapacity, includeNonAcd, strings.Join(interruptTypes, ","))
+}
+
+func getSdkUtilizationTypes() []string {
+ types := make([]string, 0, len(UtilizationMediaTypes))
+ for t := range UtilizationMediaTypes {
+ types = append(types, t)
+ }
+ sort.Strings(types)
+ return types
+}
+
+// TODO: remove when routing skill group is refactored
+func buildHeaderParams(routingAPI *platformclientv2.RoutingApi) map[string]string {
+ headerParams := make(map[string]string)
+
+ for key := range routingAPI.Configuration.DefaultHeader {
+ headerParams[key] = routingAPI.Configuration.DefaultHeader[key]
+ }
+
+ headerParams["Authorization"] = "Bearer " + routingAPI.Configuration.AccessToken
+ headerParams["Content-Type"] = "application/json"
+ headerParams["Accept"] = "application/json"
+
+ return headerParams
+}
diff --git a/genesyscloud/routing_utilization_label/data_source_genesyscloud_routing_utilization_label.go b/genesyscloud/routing_utilization_label/data_source_genesyscloud_routing_utilization_label.go
new file mode 100644
index 000000000..f4c1e55a9
--- /dev/null
+++ b/genesyscloud/routing_utilization_label/data_source_genesyscloud_routing_utilization_label.go
@@ -0,0 +1,33 @@
+package routing_utilization_label
+
+import (
+ "context"
+ "fmt"
+ "terraform-provider-genesyscloud/genesyscloud/provider"
+ "terraform-provider-genesyscloud/genesyscloud/util"
+ "time"
+
+ "github.com/hashicorp/terraform-plugin-sdk/v2/diag"
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
+)
+
+func dataSourceRoutingUtilizationLabelRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
+ sdkConfig := m.(*provider.ProviderMeta).ClientConfig
+ proxy := getRoutingUtilizationLabelProxy(sdkConfig)
+ name := d.Get("name").(string)
+
+ return util.WithRetries(ctx, 15*time.Second, func() *retry.RetryError {
+ label, retryable, resp, getErr := proxy.getRoutingUtilizationLabelByName(ctx, name)
+
+ if getErr != nil && !retryable{
+ return retry.NonRetryableError(util.BuildWithRetriesApiDiagnosticError(resourceName, fmt.Sprintf("Error requesting label %s | error: %s", name, getErr), resp))
+ }
+
+ if retryable {
+ return retry.RetryableError(util.BuildWithRetriesApiDiagnosticError(resourceName, fmt.Sprintf("No labels found with name %s", name), resp))
+ }
+ d.SetId(*label.Id)
+ return nil
+ })
+}
diff --git a/genesyscloud/data_source_genesyscloud_routing_utilization_label_test.go b/genesyscloud/routing_utilization_label/data_source_genesyscloud_routing_utilization_label_test.go
similarity index 95%
rename from genesyscloud/data_source_genesyscloud_routing_utilization_label_test.go
rename to genesyscloud/routing_utilization_label/data_source_genesyscloud_routing_utilization_label_test.go
index 7822c81e5..d30634274 100644
--- a/genesyscloud/data_source_genesyscloud_routing_utilization_label_test.go
+++ b/genesyscloud/routing_utilization_label/data_source_genesyscloud_routing_utilization_label_test.go
@@ -1,4 +1,4 @@
-package genesyscloud
+package routing_utilization_label
import (
"fmt"
@@ -20,7 +20,7 @@ func TestAccDataSourceRoutingUtilizationLabel(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() {
util.TestAccPreCheck(t)
- if err := checkIfLabelsAreEnabled(); err != nil {
+ if err := CheckIfLabelsAreEnabled(); err != nil {
t.Skipf("%v", err) // be sure to skip the test and not fail it
}
},
diff --git a/genesyscloud/routing_utilization_label/genesyscloud_routing_utilization_label_init_test.go b/genesyscloud/routing_utilization_label/genesyscloud_routing_utilization_label_init_test.go
new file mode 100644
index 000000000..4de37bfab
--- /dev/null
+++ b/genesyscloud/routing_utilization_label/genesyscloud_routing_utilization_label_init_test.go
@@ -0,0 +1,52 @@
+package routing_utilization_label
+
+import (
+ "sync"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
+)
+
+var providerDataSources map[string]*schema.Resource
+var providerResources map[string]*schema.Resource
+
+type registerTestInstance struct {
+ resourceMapMutex sync.RWMutex
+ datasourceMapMutex sync.RWMutex
+}
+
+// registerTestResources registers all resources used in the tests
+func (r *registerTestInstance) registerTestResources() {
+ r.resourceMapMutex.Lock()
+ defer r.resourceMapMutex.Unlock()
+
+ providerResources[resourceName] = ResourceRoutingUtilizationLabel()
+}
+
+// registerTestDataSources registers all data sources used in the tests.
+func (r *registerTestInstance) registerTestDataSources() {
+ r.datasourceMapMutex.Lock()
+ defer r.datasourceMapMutex.Unlock()
+
+ providerDataSources[resourceName] = DataSourceRoutingUtilizationLabel()
+}
+
+// initTestResources initializes all test resources and data sources.
+func initTestResources() {
+ providerDataSources = make(map[string]*schema.Resource)
+ providerResources = make(map[string]*schema.Resource)
+
+ regInstance := ®isterTestInstance{}
+
+ regInstance.registerTestDataSources()
+ regInstance.registerTestResources()
+}
+
+// TestMain is a "setup" function called by the testing framework when run the test
+func TestMain(m *testing.M) {
+ // Run setup function before starting the test suite for routing_utilization_label package
+ initTestResources()
+
+ // Run the test suite for the routing_utilization_label package
+ m.Run()
+}
diff --git a/genesyscloud/routing_utilization_label/genesyscloud_routing_utilization_label_proxy.go b/genesyscloud/routing_utilization_label/genesyscloud_routing_utilization_label_proxy.go
new file mode 100644
index 000000000..fc19feb6c
--- /dev/null
+++ b/genesyscloud/routing_utilization_label/genesyscloud_routing_utilization_label_proxy.go
@@ -0,0 +1,149 @@
+package routing_utilization_label
+
+import (
+ "context"
+ "fmt"
+ "log"
+ rc "terraform-provider-genesyscloud/genesyscloud/resource_cache"
+
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
+)
+
+var internalProxy *routingUtilizationLabelProxy
+
+type getAllRoutingUtilizationLabelsFunc func(ctx context.Context, p *routingUtilizationLabelProxy, name string) (*[]platformclientv2.Utilizationlabel, *platformclientv2.APIResponse, error)
+type createRoutingUtilizationLabelFunc func(ctx context.Context, p *routingUtilizationLabelProxy, req *platformclientv2.Createutilizationlabelrequest) (*platformclientv2.Utilizationlabel, *platformclientv2.APIResponse, error)
+type getRoutingUtilizationLabelFunc func(ctx context.Context, p *routingUtilizationLabelProxy, id string) (*platformclientv2.Utilizationlabel, *platformclientv2.APIResponse, error)
+type getRoutingUtilizationLabelByNameFunc func(ctx context.Context, p *routingUtilizationLabelProxy, name string) (*platformclientv2.Utilizationlabel, bool, *platformclientv2.APIResponse, error)
+type updateRoutingUtilizationLabelFunc func(ctx context.Context, p *routingUtilizationLabelProxy, id string, updateutilizationlabelrequest *platformclientv2.Updateutilizationlabelrequest) (*platformclientv2.Utilizationlabel, *platformclientv2.APIResponse, error)
+type deleteRoutingUtilizationLabelFunc func(ctx context.Context, p *routingUtilizationLabelProxy, id string, forceDelete bool) (*platformclientv2.APIResponse, error)
+
+type routingUtilizationLabelProxy struct {
+ clientConfig *platformclientv2.Configuration
+ routingApi *platformclientv2.RoutingApi
+ getAllRoutingUtilizationLabelsAttr getAllRoutingUtilizationLabelsFunc
+ createRoutingUtilizationLabelAttr createRoutingUtilizationLabelFunc
+ getRoutingUtilizationLabelAttr getRoutingUtilizationLabelFunc
+ getRoutingUtilizationLabelByNameAttr getRoutingUtilizationLabelByNameFunc
+ updateRoutingUtilizationLabelAttr updateRoutingUtilizationLabelFunc
+ deleteRoutingUtilizationLabelAttr deleteRoutingUtilizationLabelFunc
+ routingCache rc.CacheInterface[platformclientv2.Utilizationlabel]
+}
+
+func newRoutingUtilizationLabelProxy(clientConfig *platformclientv2.Configuration) *routingUtilizationLabelProxy {
+ api := platformclientv2.NewRoutingApiWithConfig(clientConfig)
+ routingCache := rc.NewResourceCache[platformclientv2.Utilizationlabel]()
+ return &routingUtilizationLabelProxy{
+ clientConfig: clientConfig,
+ routingApi: api,
+ getAllRoutingUtilizationLabelsAttr: getAllRoutingUtilizationLabelsFn,
+ createRoutingUtilizationLabelAttr: createRoutingUtilizationLabelFn,
+ getRoutingUtilizationLabelAttr: getRoutingUtilizationLabelFn,
+ getRoutingUtilizationLabelByNameAttr: getRoutingUtilizationLabelByNameFn,
+ updateRoutingUtilizationLabelAttr: updateRoutingUtilizationLabelFn,
+ deleteRoutingUtilizationLabelAttr: deleteRoutingUtilizationLabelFn,
+ routingCache: routingCache,
+ }
+}
+
+func getRoutingUtilizationLabelProxy(clientConfig *platformclientv2.Configuration) *routingUtilizationLabelProxy {
+ if internalProxy == nil {
+ internalProxy = newRoutingUtilizationLabelProxy(clientConfig)
+ }
+ return internalProxy
+}
+
+func (p *routingUtilizationLabelProxy) getAllRoutingUtilizationLabels(ctx context.Context, name string) (*[]platformclientv2.Utilizationlabel, *platformclientv2.APIResponse, error) {
+ return p.getAllRoutingUtilizationLabelsAttr(ctx, p, name)
+}
+
+func (p *routingUtilizationLabelProxy) createRoutingUtilizationLabel(ctx context.Context, req *platformclientv2.Createutilizationlabelrequest) (*platformclientv2.Utilizationlabel, *platformclientv2.APIResponse, error) {
+ return p.createRoutingUtilizationLabelAttr(ctx, p, req)
+}
+
+func (p *routingUtilizationLabelProxy) getRoutingUtilizationLabel(ctx context.Context, id string) (*platformclientv2.Utilizationlabel, *platformclientv2.APIResponse, error) {
+ return p.getRoutingUtilizationLabelAttr(ctx, p, id)
+}
+
+func (p *routingUtilizationLabelProxy) getRoutingUtilizationLabelByName(ctx context.Context, name string) (*platformclientv2.Utilizationlabel, bool, *platformclientv2.APIResponse, error) {
+ return p.getRoutingUtilizationLabelByNameAttr(ctx, p, name)
+}
+
+func (p *routingUtilizationLabelProxy) updateRoutingUtilizationLabel(ctx context.Context, id string, req *platformclientv2.Updateutilizationlabelrequest) (*platformclientv2.Utilizationlabel, *platformclientv2.APIResponse, error) {
+ return p.updateRoutingUtilizationLabelAttr(ctx, p, id, req)
+}
+
+func (p *routingUtilizationLabelProxy) deleteRoutingUtilizationLabel(ctx context.Context, id string, forceDelete bool) (*platformclientv2.APIResponse, error) {
+ return p.deleteRoutingUtilizationLabelAttr(ctx, p, id, forceDelete)
+}
+
+func getAllRoutingUtilizationLabelsFn(_ context.Context, p *routingUtilizationLabelProxy, name string) (*[]platformclientv2.Utilizationlabel, *platformclientv2.APIResponse, error) {
+ var allUtilizationLabels []platformclientv2.Utilizationlabel
+ const pageSize = 100
+
+ labels, resp, err := p.routingApi.GetRoutingUtilizationLabels(100, 1, "", name)
+ if err != nil {
+ return nil, resp, fmt.Errorf("failed to get routing utilization labels | error: %s", err)
+ }
+
+ if labels.Entities == nil || len(*labels.Entities) == 0 {
+ return &allUtilizationLabels, resp, nil
+ }
+ allUtilizationLabels = append(allUtilizationLabels, *labels.Entities...)
+
+ for pageNum := 2; pageNum <= *labels.PageCount; pageNum++ {
+ labels, resp, err := p.routingApi.GetRoutingUtilizationLabels(pageSize, pageNum, "", name)
+ if err != nil {
+ return nil, resp, fmt.Errorf("failed to get routing utilization labels | error: %s", err)
+ }
+
+ if labels.Entities == nil || len(*labels.Entities) == 0 {
+ break
+ }
+ allUtilizationLabels = append(allUtilizationLabels, *labels.Entities...)
+ }
+
+ for _, label := range allUtilizationLabels {
+ rc.SetCache(p.routingCache, *label.Id, label)
+ }
+
+ return &allUtilizationLabels, resp, nil
+}
+
+func createRoutingUtilizationLabelFn(_ context.Context, p *routingUtilizationLabelProxy, req *platformclientv2.Createutilizationlabelrequest) (*platformclientv2.Utilizationlabel, *platformclientv2.APIResponse, error) {
+ return p.routingApi.PostRoutingUtilizationLabels(*req)
+}
+
+func getRoutingUtilizationLabelFn(_ context.Context, p *routingUtilizationLabelProxy, id string) (*platformclientv2.Utilizationlabel, *platformclientv2.APIResponse, error) {
+ if label := rc.GetCacheItem(p.routingCache, id); label != nil {
+ return label, nil, nil
+ }
+ return p.routingApi.GetRoutingUtilizationLabel(id)
+}
+
+func getRoutingUtilizationLabelByNameFn(ctx context.Context, p *routingUtilizationLabelProxy, name string) (*platformclientv2.Utilizationlabel, bool, *platformclientv2.APIResponse, error) {
+ labels, resp, err := getAllRoutingUtilizationLabelsFn(ctx, p, name)
+ if err != nil {
+ return nil, false, resp, fmt.Errorf("error retrieving routing utilization label by name %s", err)
+ }
+
+ if labels == nil || len(*labels) == 0{
+ return nil, true, resp, fmt.Errorf("no routing utilization labels found with name %s", name)
+ }
+
+ for _, label := range *labels {
+ if *label.Name == name {
+ log.Printf("Retrieved routing utilization label %s by name %s", *label.Id, name)
+ return &label, false, resp, nil
+ }
+ }
+ return nil, true, resp, fmt.Errorf("no routing utilization label found with name: %s", name)
+}
+
+func updateRoutingUtilizationLabelFn(_ context.Context, p *routingUtilizationLabelProxy, id string, req *platformclientv2.Updateutilizationlabelrequest) (*platformclientv2.Utilizationlabel, *platformclientv2.APIResponse, error) {
+ return p.routingApi.PutRoutingUtilizationLabel(id, *req)
+}
+
+func deleteRoutingUtilizationLabelFn(_ context.Context, p *routingUtilizationLabelProxy, id string, forceDelete bool) (*platformclientv2.APIResponse, error) {
+ return p.routingApi.DeleteRoutingUtilizationLabel(id, forceDelete)
+}
diff --git a/genesyscloud/routing_utilization_label/resource_genesyscloud_routing_utilization_label.go b/genesyscloud/routing_utilization_label/resource_genesyscloud_routing_utilization_label.go
new file mode 100644
index 000000000..c4ca7d422
--- /dev/null
+++ b/genesyscloud/routing_utilization_label/resource_genesyscloud_routing_utilization_label.go
@@ -0,0 +1,123 @@
+package routing_utilization_label
+
+import (
+ "context"
+ "fmt"
+ "log"
+ "terraform-provider-genesyscloud/genesyscloud/provider"
+ "terraform-provider-genesyscloud/genesyscloud/util"
+ "terraform-provider-genesyscloud/genesyscloud/util/constants"
+ "time"
+
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
+
+ "terraform-provider-genesyscloud/genesyscloud/consistency_checker"
+
+ resourceExporter "terraform-provider-genesyscloud/genesyscloud/resource_exporter"
+
+ "github.com/hashicorp/terraform-plugin-sdk/v2/diag"
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
+)
+
+func getAllRoutingUtilizationLabels(ctx context.Context, clientConfig *platformclientv2.Configuration) (resourceExporter.ResourceIDMetaMap, diag.Diagnostics) {
+ resources := make(resourceExporter.ResourceIDMetaMap)
+ proxy := getRoutingUtilizationLabelProxy(clientConfig)
+
+ labels, resp, getErr := proxy.getAllRoutingUtilizationLabels(ctx, "")
+ if getErr != nil {
+ return nil, util.BuildAPIDiagnosticError(resourceName, fmt.Sprintf("Failed to get page of labels error: %s", getErr), resp)
+ }
+
+ for _, label := range *labels {
+ resources[*label.Id] = &resourceExporter.ResourceMeta{Name: *label.Name}
+ }
+ return resources, nil
+}
+
+func createRoutingUtilizationLabel(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
+ name := d.Get("name").(string)
+ sdkConfig := meta.(*provider.ProviderMeta).ClientConfig
+ proxy := getRoutingUtilizationLabelProxy(sdkConfig)
+
+ log.Printf("Creating label %s", name)
+
+ label, resp, err := proxy.createRoutingUtilizationLabel(ctx, &platformclientv2.Createutilizationlabelrequest{
+ Name: &name,
+ })
+ if err != nil {
+ return util.BuildAPIDiagnosticError(resourceName, fmt.Sprintf("Failed to create label %s error: %s", name, err), resp)
+ }
+
+ d.SetId(*label.Id)
+
+ log.Printf("Created label %s %s", name, *label.Id)
+ return readRoutingUtilizationLabel(ctx, d, meta)
+}
+
+func readRoutingUtilizationLabel(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
+ sdkConfig := meta.(*provider.ProviderMeta).ClientConfig
+ proxy := getRoutingUtilizationLabelProxy(sdkConfig)
+ cc := consistency_checker.NewConsistencyCheck(ctx, d, meta, ResourceRoutingUtilizationLabel(), constants.DefaultConsistencyChecks, resourceName)
+
+ log.Printf("Reading label %s", d.Id())
+ return util.WithRetriesForRead(ctx, d, func() *retry.RetryError {
+ label, resp, getErr := proxy.getRoutingUtilizationLabel(ctx, d.Id())
+
+ if getErr != nil {
+ if util.IsStatus404(resp) {
+ return retry.RetryableError(util.BuildWithRetriesApiDiagnosticError(resourceName, fmt.Sprintf("Failed to read label %s | error: %s", d.Id(), getErr), resp))
+ }
+ return retry.NonRetryableError(util.BuildWithRetriesApiDiagnosticError(resourceName, fmt.Sprintf("Failed to read label %s | error: %s", d.Id(), getErr), resp))
+ }
+
+ _ = d.Set("name", *label.Name)
+ log.Printf("Read label %s %s", d.Id(), *label.Name)
+ return cc.CheckState(d)
+ })
+}
+
+func updateRoutingUtilizationLabel(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
+ sdkConfig := meta.(*provider.ProviderMeta).ClientConfig
+ proxy := getRoutingUtilizationLabelProxy(sdkConfig)
+
+ id := d.Id()
+ name := d.Get("name").(string)
+
+ log.Printf("Updating label %s with name %s", id, name)
+ _, resp, err := proxy.updateRoutingUtilizationLabel(ctx, id, &platformclientv2.Updateutilizationlabelrequest{
+ Name: &name,
+ })
+ if err != nil {
+ return util.BuildAPIDiagnosticError(resourceName, fmt.Sprintf("Failed to update label %s error: %s", id, err), resp)
+ }
+
+ log.Printf("Updated label %s", id)
+ return readRoutingUtilizationLabel(ctx, d, meta)
+}
+
+func deleteRoutingUtilizationLabel(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
+ name := d.Get("name").(string)
+ sdkConfig := meta.(*provider.ProviderMeta).ClientConfig
+ proxy := getRoutingUtilizationLabelProxy(sdkConfig)
+
+ log.Printf("Deleting label %s %s", d.Id(), name)
+ resp, err := proxy.deleteRoutingUtilizationLabel(ctx, d.Id(), true)
+
+ if err != nil {
+ return util.BuildAPIDiagnosticError(resourceName, fmt.Sprintf("Failed to delete label %s error: %s", name, err), resp)
+ }
+
+ return util.WithRetries(ctx, 30*time.Second, func() *retry.RetryError {
+ _, resp, err := proxy.getRoutingUtilizationLabel(ctx, d.Id())
+
+ if err != nil {
+ if util.IsStatus404(resp) {
+ log.Printf("Deleted Routing label %s", d.Id())
+ return nil
+ }
+ return retry.NonRetryableError(util.BuildWithRetriesApiDiagnosticError(resourceName, fmt.Sprintf("Error deleting Routing label %s: %s", d.Id(), err), resp))
+ }
+ return retry.RetryableError(util.BuildWithRetriesApiDiagnosticError(resourceName, fmt.Sprintf("Routing label %s still exists", d.Id()), resp))
+ })
+}
diff --git a/genesyscloud/routing_utilization_label/resource_genesyscloud_routing_utilization_label_schema.go b/genesyscloud/routing_utilization_label/resource_genesyscloud_routing_utilization_label_schema.go
new file mode 100644
index 000000000..92761f50a
--- /dev/null
+++ b/genesyscloud/routing_utilization_label/resource_genesyscloud_routing_utilization_label_schema.go
@@ -0,0 +1,61 @@
+package routing_utilization_label
+
+import (
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
+ "terraform-provider-genesyscloud/genesyscloud/provider"
+ resourceExporter "terraform-provider-genesyscloud/genesyscloud/resource_exporter"
+ registrar "terraform-provider-genesyscloud/genesyscloud/resource_register"
+)
+
+const resourceName = "genesyscloud_routing_utilization_label"
+
+// SetRegistrar registers all the resources and exporters in the package
+func SetRegistrar(regInstance registrar.Registrar) {
+ regInstance.RegisterResource(resourceName, ResourceRoutingUtilizationLabel())
+ regInstance.RegisterDataSource(resourceName, DataSourceRoutingUtilizationLabel())
+ regInstance.RegisterExporter(resourceName, RoutingUtilizationLabelExporter())
+}
+
+func ResourceRoutingUtilizationLabel() *schema.Resource {
+ return &schema.Resource{
+ Description: "Genesys Cloud Routing Utilization Label. This resource is not yet widely available. Only use it if the feature is enabled.",
+
+ CreateContext: provider.CreateWithPooledClient(createRoutingUtilizationLabel),
+ ReadContext: provider.ReadWithPooledClient(readRoutingUtilizationLabel),
+ UpdateContext: provider.UpdateWithPooledClient(updateRoutingUtilizationLabel),
+ DeleteContext: provider.DeleteWithPooledClient(deleteRoutingUtilizationLabel),
+ Importer: &schema.ResourceImporter{
+ StateContext: schema.ImportStatePassthroughContext,
+ },
+ SchemaVersion: 1,
+ Schema: map[string]*schema.Schema{
+ "name": {
+ Description: "Label name.",
+ Type: schema.TypeString,
+ Required: true,
+ },
+ },
+ }
+}
+
+func DataSourceRoutingUtilizationLabel() *schema.Resource {
+ return &schema.Resource{
+ Description: "Data source for Genesys Cloud Routing Utilization Labels. Select a label by name.",
+ ReadContext: provider.ReadWithPooledClient(dataSourceRoutingUtilizationLabelRead),
+ Schema: map[string]*schema.Schema{
+ "name": {
+ Description: "Label name.",
+ Type: schema.TypeString,
+ ValidateFunc: validation.StringDoesNotContainAny("*"),
+ Required: true,
+ },
+ },
+ }
+}
+
+func RoutingUtilizationLabelExporter() *resourceExporter.ResourceExporter {
+ return &resourceExporter.ResourceExporter{
+ GetResourcesFunc: provider.GetAllWithPooledClient(getAllRoutingUtilizationLabels),
+ }
+}
diff --git a/genesyscloud/resource_genesyscloud_routing_utilization_label_test.go b/genesyscloud/routing_utilization_label/resource_genesyscloud_routing_utilization_label_test.go
similarity index 69%
rename from genesyscloud/resource_genesyscloud_routing_utilization_label_test.go
rename to genesyscloud/routing_utilization_label/resource_genesyscloud_routing_utilization_label_test.go
index f73fbfa58..793fb3f3f 100644
--- a/genesyscloud/resource_genesyscloud_routing_utilization_label_test.go
+++ b/genesyscloud/routing_utilization_label/resource_genesyscloud_routing_utilization_label_test.go
@@ -1,4 +1,4 @@
-package genesyscloud
+package routing_utilization_label
import (
"fmt"
@@ -9,7 +9,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceRoutingUtilizationLabelBasic(t *testing.T) {
@@ -22,7 +22,7 @@ func TestAccResourceRoutingUtilizationLabelBasic(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() {
util.TestAccPreCheck(t)
- if err := checkIfLabelsAreEnabled(); err != nil {
+ if err := CheckIfLabelsAreEnabled(); err != nil {
t.Skipf("%v", err) // be sure to skip the test and not fail it
}
},
@@ -61,20 +61,6 @@ func TestAccResourceRoutingUtilizationLabelBasic(t *testing.T) {
})
}
-func GenerateRoutingUtilizationLabelResource(resourceID string, name string, dependsOnResource string) string {
- dependsOn := ""
-
- if dependsOnResource != "" {
- dependsOn = fmt.Sprintf("depends_on=[genesyscloud_routing_utilization_label.%s]", dependsOnResource)
- }
-
- return fmt.Sprintf(`resource "genesyscloud_routing_utilization_label" "%s" {
- name = "%s"
- %s
- }
- `, resourceID, name, dependsOn)
-}
-
func validateTestLabelDestroyed(state *terraform.State) error {
routingApi := platformclientv2.NewRoutingApi()
@@ -98,12 +84,3 @@ func validateTestLabelDestroyed(state *terraform.State) error {
return fmt.Errorf("No label resource found")
}
-
-func checkIfLabelsAreEnabled() error { // remove once the feature is globally enabled
- api := platformclientv2.NewRoutingApiWithConfig(sdkConfig) // the variable sdkConfig exists at a package level in ./genesyscloud and is already authorized
- _, resp, _ := api.GetRoutingUtilizationLabels(100, 1, "", "")
- if resp.StatusCode == 501 {
- return fmt.Errorf("feature is not yet implemented in this org.")
- }
- return nil
-}
diff --git a/genesyscloud/routing_utilization_label/resource_genesyscloud_routing_utilization_label_utils.go b/genesyscloud/routing_utilization_label/resource_genesyscloud_routing_utilization_label_utils.go
new file mode 100644
index 000000000..22322c59d
--- /dev/null
+++ b/genesyscloud/routing_utilization_label/resource_genesyscloud_routing_utilization_label_utils.go
@@ -0,0 +1,54 @@
+package routing_utilization_label
+
+import (
+ "fmt"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
+ "strings"
+ "terraform-provider-genesyscloud/genesyscloud/provider"
+)
+
+func GenerateRoutingUtilizationLabelResource(resourceID string, name string, dependsOnResource string) string {
+ dependsOn := ""
+
+ if dependsOnResource != "" {
+ dependsOn = fmt.Sprintf("depends_on=[genesyscloud_routing_utilization_label.%s]", dependsOnResource)
+ }
+
+ return fmt.Sprintf(`resource "genesyscloud_routing_utilization_label" "%s" {
+ name = "%s"
+ %s
+ }
+ `, resourceID, name, dependsOn)
+}
+
+func CheckIfLabelsAreEnabled() error { // remove once the feature is globally enabled
+ sdkConfig, err := provider.AuthorizeSdk()
+ if err != nil {
+ return err
+ }
+
+ api := platformclientv2.NewRoutingApiWithConfig(sdkConfig)
+ _, resp, _ := api.GetRoutingUtilizationLabels(100, 1, "", "")
+ if resp.StatusCode == 501 {
+ return fmt.Errorf("feature is not yet implemented in this org.")
+ }
+ return nil
+}
+
+func GenerateLabelUtilization(
+ labelResource string,
+ maxCapacity string,
+ interruptingLabelResourceNames ...string) string {
+
+ interruptingLabelResources := make([]string, 0)
+ for _, resourceName := range interruptingLabelResourceNames {
+ interruptingLabelResources = append(interruptingLabelResources, "genesyscloud_routing_utilization_label."+resourceName+".id")
+ }
+
+ return fmt.Sprintf(`label_utilizations {
+ label_id = genesyscloud_routing_utilization_label.%s.id
+ maximum_capacity = %s
+ interrupting_label_ids = [%s]
+ }
+ `, labelResource, maxCapacity, strings.Join(interruptingLabelResources, ","))
+}
diff --git a/genesyscloud/scripts/genesyscloud_scripts_proxy.go b/genesyscloud/scripts/genesyscloud_scripts_proxy.go
index f69d0ea13..7f5a53860 100644
--- a/genesyscloud/scripts/genesyscloud_scripts_proxy.go
+++ b/genesyscloud/scripts/genesyscloud_scripts_proxy.go
@@ -14,7 +14,7 @@ import (
"terraform-provider-genesyscloud/genesyscloud/util/files"
"time"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/scripts/resource_genesyscloud_script.go b/genesyscloud/scripts/resource_genesyscloud_script.go
index e2f63d14a..53df15885 100644
--- a/genesyscloud/scripts/resource_genesyscloud_script.go
+++ b/genesyscloud/scripts/resource_genesyscloud_script.go
@@ -12,7 +12,7 @@ import (
"terraform-provider-genesyscloud/genesyscloud/util/constants"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
diff --git a/genesyscloud/scripts/resource_genesyscloud_script_test.go b/genesyscloud/scripts/resource_genesyscloud_script_test.go
index 1c7d9d7cf..23d3a7471 100644
--- a/genesyscloud/scripts/resource_genesyscloud_script_test.go
+++ b/genesyscloud/scripts/resource_genesyscloud_script_test.go
@@ -12,7 +12,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/scripts/resource_scripts_schema.go b/genesyscloud/scripts/resource_scripts_schema.go
index 459850ed1..d3381654e 100644
--- a/genesyscloud/scripts/resource_scripts_schema.go
+++ b/genesyscloud/scripts/resource_scripts_schema.go
@@ -5,7 +5,7 @@ import (
"terraform-provider-genesyscloud/genesyscloud/provider"
resourceExporter "terraform-provider-genesyscloud/genesyscloud/resource_exporter"
registrar "terraform-provider-genesyscloud/genesyscloud/resource_register"
- gcloud "terraform-provider-genesyscloud/genesyscloud/validators"
+ "terraform-provider-genesyscloud/genesyscloud/validators"
)
/*
@@ -59,7 +59,7 @@ func ResourceScript() *schema.Resource {
Description: "Path to the script file to upload.",
Type: schema.TypeString,
Required: true,
- ValidateFunc: gcloud.ValidatePath,
+ ValidateFunc: validators.ValidatePath,
},
"file_content_hash": {
Description: "Hash value of the script file content. Used to detect changes.",
diff --git a/genesyscloud/station/genesyscloud_station_init_test.go b/genesyscloud/station/genesyscloud_station_init_test.go
index 3db79e890..9641ffcb3 100644
--- a/genesyscloud/station/genesyscloud_station_init_test.go
+++ b/genesyscloud/station/genesyscloud_station_init_test.go
@@ -6,7 +6,7 @@ import (
"terraform-provider-genesyscloud/genesyscloud/provider"
"testing"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
gcloud "terraform-provider-genesyscloud/genesyscloud"
edgePhone "terraform-provider-genesyscloud/genesyscloud/telephony_providers_edges_phone"
diff --git a/genesyscloud/station/genesyscloud_station_proxy.go b/genesyscloud/station/genesyscloud_station_proxy.go
index 7c53e5b68..7486790e1 100644
--- a/genesyscloud/station/genesyscloud_station_proxy.go
+++ b/genesyscloud/station/genesyscloud_station_proxy.go
@@ -4,7 +4,7 @@ import (
"context"
"fmt"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
// internalProxy holds a proxy instance that can be used throughout the package
diff --git a/genesyscloud/task_management_workbin/genesyscloud_task_management_workbin_proxy.go b/genesyscloud/task_management_workbin/genesyscloud_task_management_workbin_proxy.go
index 29ec9c976..acbe12980 100644
--- a/genesyscloud/task_management_workbin/genesyscloud_task_management_workbin_proxy.go
+++ b/genesyscloud/task_management_workbin/genesyscloud_task_management_workbin_proxy.go
@@ -4,7 +4,7 @@ import (
"context"
"fmt"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/task_management_workbin/resource_genesyscloud_task_management_workbin.go b/genesyscloud/task_management_workbin/resource_genesyscloud_task_management_workbin.go
index fe2f8a596..5b4c8a5f5 100644
--- a/genesyscloud/task_management_workbin/resource_genesyscloud_task_management_workbin.go
+++ b/genesyscloud/task_management_workbin/resource_genesyscloud_task_management_workbin.go
@@ -12,7 +12,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"terraform-provider-genesyscloud/genesyscloud/consistency_checker"
diff --git a/genesyscloud/task_management_workbin/resource_genesyscloud_task_management_workbin_test.go b/genesyscloud/task_management_workbin/resource_genesyscloud_task_management_workbin_test.go
index 42c8ab351..b468918ea 100644
--- a/genesyscloud/task_management_workbin/resource_genesyscloud_task_management_workbin_test.go
+++ b/genesyscloud/task_management_workbin/resource_genesyscloud_task_management_workbin_test.go
@@ -12,7 +12,7 @@ import (
gcloud "terraform-provider-genesyscloud/genesyscloud"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/task_management_workitem/genesyscloud_task_management_workitem_proxy.go b/genesyscloud/task_management_workitem/genesyscloud_task_management_workitem_proxy.go
index fa433e4bf..82aa8f0c4 100644
--- a/genesyscloud/task_management_workitem/genesyscloud_task_management_workitem_proxy.go
+++ b/genesyscloud/task_management_workitem/genesyscloud_task_management_workitem_proxy.go
@@ -5,7 +5,7 @@ import (
"fmt"
"log"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/task_management_workitem/resource_genesyscloud_task_management_workitem.go b/genesyscloud/task_management_workitem/resource_genesyscloud_task_management_workitem.go
index bbff9db3f..9f5494392 100644
--- a/genesyscloud/task_management_workitem/resource_genesyscloud_task_management_workitem.go
+++ b/genesyscloud/task_management_workitem/resource_genesyscloud_task_management_workitem.go
@@ -12,7 +12,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"terraform-provider-genesyscloud/genesyscloud/consistency_checker"
diff --git a/genesyscloud/task_management_workitem/resource_genesyscloud_task_management_workitem_schema.go b/genesyscloud/task_management_workitem/resource_genesyscloud_task_management_workitem_schema.go
index d639b207f..6e1c27978 100644
--- a/genesyscloud/task_management_workitem/resource_genesyscloud_task_management_workitem_schema.go
+++ b/genesyscloud/task_management_workitem/resource_genesyscloud_task_management_workitem_schema.go
@@ -7,7 +7,7 @@ import (
resourceExporter "terraform-provider-genesyscloud/genesyscloud/resource_exporter"
registrar "terraform-provider-genesyscloud/genesyscloud/resource_register"
"terraform-provider-genesyscloud/genesyscloud/util"
- gcloud "terraform-provider-genesyscloud/genesyscloud/validators"
+ "terraform-provider-genesyscloud/genesyscloud/validators"
)
/*
@@ -91,14 +91,14 @@ func ResourceTaskManagementWorkitem() *schema.Resource {
Optional: true,
Computed: true,
Type: schema.TypeString,
- ValidateDiagFunc: gcloud.ValidateLocalDateTimes,
+ ValidateDiagFunc: validators.ValidateLocalDateTimes,
},
`date_expires`: {
Description: `The expiry date of the Workitem. Date time is represented as an ISO-8601 string. For example: yyyy-MM-ddTHH:mm:ss[.mmm]Z`,
Optional: true,
Computed: true,
Type: schema.TypeString,
- ValidateDiagFunc: gcloud.ValidateLocalDateTimes,
+ ValidateDiagFunc: validators.ValidateLocalDateTimes,
},
`duration_seconds`: {
Description: `The estimated duration in seconds to complete the workitem.`,
diff --git a/genesyscloud/task_management_workitem/resource_genesyscloud_task_management_workitem_test.go b/genesyscloud/task_management_workitem/resource_genesyscloud_task_management_workitem_test.go
index 5b74074ae..c9d31132c 100644
--- a/genesyscloud/task_management_workitem/resource_genesyscloud_task_management_workitem_test.go
+++ b/genesyscloud/task_management_workitem/resource_genesyscloud_task_management_workitem_test.go
@@ -23,7 +23,7 @@ import (
"terraform-provider-genesyscloud/genesyscloud/util/resourcedata"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/task_management_workitem/resource_genesyscloud_task_management_workitem_unit_test.go b/genesyscloud/task_management_workitem/resource_genesyscloud_task_management_workitem_unit_test.go
index 15c62f936..591301bbb 100644
--- a/genesyscloud/task_management_workitem/resource_genesyscloud_task_management_workitem_unit_test.go
+++ b/genesyscloud/task_management_workitem/resource_genesyscloud_task_management_workitem_unit_test.go
@@ -16,7 +16,7 @@ import (
lists "terraform-provider-genesyscloud/genesyscloud/util/lists"
"terraform-provider-genesyscloud/genesyscloud/util/resourcedata"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
var (
diff --git a/genesyscloud/task_management_workitem/resource_genesyscloud_task_management_workitem_utils.go b/genesyscloud/task_management_workitem/resource_genesyscloud_task_management_workitem_utils.go
index 9c60e471d..6d3ab7ebf 100644
--- a/genesyscloud/task_management_workitem/resource_genesyscloud_task_management_workitem_utils.go
+++ b/genesyscloud/task_management_workitem/resource_genesyscloud_task_management_workitem_utils.go
@@ -9,7 +9,7 @@ import (
lists "terraform-provider-genesyscloud/genesyscloud/util/lists"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/task_management_workitem_schema/genesyscloud_task_management_workitem_schema_proxy.go b/genesyscloud/task_management_workitem_schema/genesyscloud_task_management_workitem_schema_proxy.go
index 429ce6e42..a93f33c34 100644
--- a/genesyscloud/task_management_workitem_schema/genesyscloud_task_management_workitem_schema_proxy.go
+++ b/genesyscloud/task_management_workitem_schema/genesyscloud_task_management_workitem_schema_proxy.go
@@ -8,7 +8,7 @@ import (
"log"
"net/http"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/task_management_workitem_schema/resource_genesyscloud_task_management_workitem_schema.go b/genesyscloud/task_management_workitem_schema/resource_genesyscloud_task_management_workitem_schema.go
index 15fe49c6c..f96eba1df 100644
--- a/genesyscloud/task_management_workitem_schema/resource_genesyscloud_task_management_workitem_schema.go
+++ b/genesyscloud/task_management_workitem_schema/resource_genesyscloud_task_management_workitem_schema.go
@@ -13,7 +13,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"terraform-provider-genesyscloud/genesyscloud/consistency_checker"
diff --git a/genesyscloud/task_management_workitem_schema/resource_genesyscloud_task_management_workitem_schema_test.go b/genesyscloud/task_management_workitem_schema/resource_genesyscloud_task_management_workitem_schema_test.go
index ae8816ddc..f043ef040 100644
--- a/genesyscloud/task_management_workitem_schema/resource_genesyscloud_task_management_workitem_schema_test.go
+++ b/genesyscloud/task_management_workitem_schema/resource_genesyscloud_task_management_workitem_schema_test.go
@@ -15,7 +15,7 @@ import (
lists "terraform-provider-genesyscloud/genesyscloud/util/lists"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/task_management_workitem_schema/resource_genesyscloud_task_management_workitem_schema_unit_test.go b/genesyscloud/task_management_workitem_schema/resource_genesyscloud_task_management_workitem_schema_unit_test.go
index e61aaa110..d9914e3b1 100644
--- a/genesyscloud/task_management_workitem_schema/resource_genesyscloud_task_management_workitem_schema_unit_test.go
+++ b/genesyscloud/task_management_workitem_schema/resource_genesyscloud_task_management_workitem_schema_unit_test.go
@@ -12,7 +12,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"github.com/stretchr/testify/assert"
)
diff --git a/genesyscloud/task_management_workitem_schema/resource_genesyscloud_task_management_workitem_schema_utils.go b/genesyscloud/task_management_workitem_schema/resource_genesyscloud_task_management_workitem_schema_utils.go
index 8ff481cfe..7594a8ccf 100644
--- a/genesyscloud/task_management_workitem_schema/resource_genesyscloud_task_management_workitem_schema_utils.go
+++ b/genesyscloud/task_management_workitem_schema/resource_genesyscloud_task_management_workitem_schema_utils.go
@@ -5,7 +5,7 @@ import (
"fmt"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
const (
diff --git a/genesyscloud/task_management_worktype/data_source_genesyscloud_task_management_unit_test.go b/genesyscloud/task_management_worktype/data_source_genesyscloud_task_management_unit_test.go
index 40114afbc..6cfd137aa 100644
--- a/genesyscloud/task_management_worktype/data_source_genesyscloud_task_management_unit_test.go
+++ b/genesyscloud/task_management_worktype/data_source_genesyscloud_task_management_unit_test.go
@@ -4,7 +4,7 @@ import (
"context"
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"github.com/stretchr/testify/assert"
"terraform-provider-genesyscloud/genesyscloud/provider"
"testing"
diff --git a/genesyscloud/task_management_worktype/genesyscloud_task_management_worktype_proxy.go b/genesyscloud/task_management_worktype/genesyscloud_task_management_worktype_proxy.go
index 94775d19a..5f5417369 100644
--- a/genesyscloud/task_management_worktype/genesyscloud_task_management_worktype_proxy.go
+++ b/genesyscloud/task_management_worktype/genesyscloud_task_management_worktype_proxy.go
@@ -5,7 +5,7 @@ import (
"fmt"
"log"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/task_management_worktype/resource_genesyscloud_task_management_worktype.go b/genesyscloud/task_management_worktype/resource_genesyscloud_task_management_worktype.go
index 4797b1148..df9a05aa0 100644
--- a/genesyscloud/task_management_worktype/resource_genesyscloud_task_management_worktype.go
+++ b/genesyscloud/task_management_worktype/resource_genesyscloud_task_management_worktype.go
@@ -13,7 +13,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"terraform-provider-genesyscloud/genesyscloud/consistency_checker"
diff --git a/genesyscloud/task_management_worktype/resource_genesyscloud_task_management_worktype_schema.go b/genesyscloud/task_management_worktype/resource_genesyscloud_task_management_worktype_schema.go
index c1b190920..35ea54fce 100644
--- a/genesyscloud/task_management_worktype/resource_genesyscloud_task_management_worktype_schema.go
+++ b/genesyscloud/task_management_worktype/resource_genesyscloud_task_management_worktype_schema.go
@@ -5,7 +5,7 @@ import (
"terraform-provider-genesyscloud/genesyscloud/provider"
resourceExporter "terraform-provider-genesyscloud/genesyscloud/resource_exporter"
registrar "terraform-provider-genesyscloud/genesyscloud/resource_register"
- gcloud "terraform-provider-genesyscloud/genesyscloud/validators"
+ "terraform-provider-genesyscloud/genesyscloud/validators"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
)
@@ -77,7 +77,7 @@ func ResourceTaskManagementWorktype() *schema.Resource {
Optional: true,
Computed: true,
Type: schema.TypeString,
- ValidateDiagFunc: gcloud.ValidateTime,
+ ValidateDiagFunc: validators.ValidateTime,
},
},
}
diff --git a/genesyscloud/task_management_worktype/resource_genesyscloud_task_management_worktype_test.go b/genesyscloud/task_management_worktype/resource_genesyscloud_task_management_worktype_test.go
index 6354c352b..f796b484d 100644
--- a/genesyscloud/task_management_worktype/resource_genesyscloud_task_management_worktype_test.go
+++ b/genesyscloud/task_management_worktype/resource_genesyscloud_task_management_worktype_test.go
@@ -18,7 +18,7 @@ import (
workitemSchema "terraform-provider-genesyscloud/genesyscloud/task_management_workitem_schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/task_management_worktype/resource_genesyscloud_task_management_worktype_unit_test.go b/genesyscloud/task_management_worktype/resource_genesyscloud_task_management_worktype_unit_test.go
index fd10b5a50..aefbe1a22 100644
--- a/genesyscloud/task_management_worktype/resource_genesyscloud_task_management_worktype_unit_test.go
+++ b/genesyscloud/task_management_worktype/resource_genesyscloud_task_management_worktype_unit_test.go
@@ -12,7 +12,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"github.com/stretchr/testify/assert"
)
diff --git a/genesyscloud/task_management_worktype/resource_genesyscloud_task_management_worktype_utils.go b/genesyscloud/task_management_worktype/resource_genesyscloud_task_management_worktype_utils.go
index 3dff7cf51..79284a9b9 100644
--- a/genesyscloud/task_management_worktype/resource_genesyscloud_task_management_worktype_utils.go
+++ b/genesyscloud/task_management_worktype/resource_genesyscloud_task_management_worktype_utils.go
@@ -7,7 +7,7 @@ import (
"terraform-provider-genesyscloud/genesyscloud/util/resourcedata"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
@@ -82,7 +82,7 @@ func getWorktypeupdateFromResourceData(d *schema.ResourceData, statuses *[]platf
worktype := platformclientv2.Worktypeupdate{}
worktype.SetField("Name", platformclientv2.String(d.Get("name").(string)))
- if d.HasChange("Description") {
+ if d.HasChange("description") {
worktype.SetField("Description", platformclientv2.String(d.Get("description").(string)))
}
if d.HasChange("default_workbin_id") {
diff --git a/genesyscloud/team/genesyscloud_team_proxy.go b/genesyscloud/team/genesyscloud_team_proxy.go
index b22b302eb..2880ca8c0 100644
--- a/genesyscloud/team/genesyscloud_team_proxy.go
+++ b/genesyscloud/team/genesyscloud_team_proxy.go
@@ -6,7 +6,7 @@ import (
"log"
"terraform-provider-genesyscloud/genesyscloud/util"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/team/resource_genesyscloud_team.go b/genesyscloud/team/resource_genesyscloud_team.go
index f6c10156b..2c6d8414e 100644
--- a/genesyscloud/team/resource_genesyscloud_team.go
+++ b/genesyscloud/team/resource_genesyscloud_team.go
@@ -13,7 +13,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"terraform-provider-genesyscloud/genesyscloud/util/resourcedata"
diff --git a/genesyscloud/team/resource_genesyscloud_team_test.go b/genesyscloud/team/resource_genesyscloud_team_test.go
index 978b50b0f..03bede55f 100644
--- a/genesyscloud/team/resource_genesyscloud_team_test.go
+++ b/genesyscloud/team/resource_genesyscloud_team_test.go
@@ -4,7 +4,7 @@ import (
"fmt"
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"math/rand"
"strings"
"terraform-provider-genesyscloud/genesyscloud/provider"
diff --git a/genesyscloud/team/resource_genesyscloud_team_unit_test.go b/genesyscloud/team/resource_genesyscloud_team_unit_test.go
index 85b77b13d..3b3e670cb 100644
--- a/genesyscloud/team/resource_genesyscloud_team_unit_test.go
+++ b/genesyscloud/team/resource_genesyscloud_team_unit_test.go
@@ -11,7 +11,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"github.com/stretchr/testify/assert"
)
diff --git a/genesyscloud/team/resource_genesyscloud_team_utils.go b/genesyscloud/team/resource_genesyscloud_team_utils.go
index 8feb15f32..8c926b239 100644
--- a/genesyscloud/team/resource_genesyscloud_team_utils.go
+++ b/genesyscloud/team/resource_genesyscloud_team_utils.go
@@ -6,7 +6,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"strings"
"terraform-provider-genesyscloud/genesyscloud/util"
"terraform-provider-genesyscloud/genesyscloud/util/chunks"
diff --git a/genesyscloud/telephony/resource_genesyscloud_telephony_providers_edges_trunkbasesettings.go b/genesyscloud/telephony/resource_genesyscloud_telephony_providers_edges_trunkbasesettings.go
index 8e7d312bd..e81844e03 100644
--- a/genesyscloud/telephony/resource_genesyscloud_telephony_providers_edges_trunkbasesettings.go
+++ b/genesyscloud/telephony/resource_genesyscloud_telephony_providers_edges_trunkbasesettings.go
@@ -22,7 +22,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
const (
@@ -402,8 +402,10 @@ func ValidateInboundSiteSettings(inboundSiteString string, trunkBaseMetaId strin
func TrunkBaseSettingsExporter() *resourceExporter.ResourceExporter {
return &resourceExporter.ResourceExporter{
- GetResourcesFunc: provider.GetAllWithPooledClient(getAllTrunkBaseSettings),
- RefAttrs: map[string]*resourceExporter.RefAttrSettings{},
+ GetResourcesFunc: provider.GetAllWithPooledClient(getAllTrunkBaseSettings),
+ RefAttrs: map[string]*resourceExporter.RefAttrSettings{
+ //"inbound_site_id": {RefType: "genesyscloud_telephony_providers_edges_site"}, TODO: decide how/if this will be included after DEVTOOLING-676 is resolved
+ },
JsonEncodeAttributes: []string{"properties"},
}
}
diff --git a/genesyscloud/telephony/resource_genesyscloud_telephony_providers_edges_trunkbasesettings_test.go b/genesyscloud/telephony/resource_genesyscloud_telephony_providers_edges_trunkbasesettings_test.go
index 200b798c3..d0a1ecab1 100644
--- a/genesyscloud/telephony/resource_genesyscloud_telephony_providers_edges_trunkbasesettings_test.go
+++ b/genesyscloud/telephony/resource_genesyscloud_telephony_providers_edges_trunkbasesettings_test.go
@@ -13,7 +13,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceTrunkBaseSettings(t *testing.T) {
diff --git a/genesyscloud/telephony_providers_edges_did/genesyscloud_telephony_providers_edges_did_proxy.go b/genesyscloud/telephony_providers_edges_did/genesyscloud_telephony_providers_edges_did_proxy.go
index 9e43bbe64..553f33454 100644
--- a/genesyscloud/telephony_providers_edges_did/genesyscloud_telephony_providers_edges_did_proxy.go
+++ b/genesyscloud/telephony_providers_edges_did/genesyscloud_telephony_providers_edges_did_proxy.go
@@ -4,7 +4,7 @@ import (
"context"
"fmt"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/telephony_providers_edges_did/genesyscloud_telephony_providers_edges_did_schema.go b/genesyscloud/telephony_providers_edges_did/genesyscloud_telephony_providers_edges_did_schema.go
index 7646d8028..10ff98a5e 100644
--- a/genesyscloud/telephony_providers_edges_did/genesyscloud_telephony_providers_edges_did_schema.go
+++ b/genesyscloud/telephony_providers_edges_did/genesyscloud_telephony_providers_edges_did_schema.go
@@ -4,7 +4,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"terraform-provider-genesyscloud/genesyscloud/provider"
registrar "terraform-provider-genesyscloud/genesyscloud/resource_register"
- gcloud "terraform-provider-genesyscloud/genesyscloud/validators"
+ "terraform-provider-genesyscloud/genesyscloud/validators"
)
const resourceName = "genesyscloud_telephony_providers_edges_did"
@@ -24,7 +24,7 @@ func DataSourceDid() *schema.Resource {
Description: "Phone number for the DID.",
Type: schema.TypeString,
Required: true,
- ValidateDiagFunc: gcloud.ValidatePhoneNumber,
+ ValidateDiagFunc: validators.ValidatePhoneNumber,
},
},
}
diff --git a/genesyscloud/telephony_providers_edges_did_pool/genesyscloud_telephony_providers_edges_did_pool_proxy.go b/genesyscloud/telephony_providers_edges_did_pool/genesyscloud_telephony_providers_edges_did_pool_proxy.go
index e34798b05..65d2cdb54 100644
--- a/genesyscloud/telephony_providers_edges_did_pool/genesyscloud_telephony_providers_edges_did_pool_proxy.go
+++ b/genesyscloud/telephony_providers_edges_did_pool/genesyscloud_telephony_providers_edges_did_pool_proxy.go
@@ -4,7 +4,7 @@ import (
"context"
"fmt"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/telephony_providers_edges_did_pool/resource_genesyscloud_telephony_providers_edges_did_pool.go b/genesyscloud/telephony_providers_edges_did_pool/resource_genesyscloud_telephony_providers_edges_did_pool.go
index 5e97624a4..a0a870405 100644
--- a/genesyscloud/telephony_providers_edges_did_pool/resource_genesyscloud_telephony_providers_edges_did_pool.go
+++ b/genesyscloud/telephony_providers_edges_did_pool/resource_genesyscloud_telephony_providers_edges_did_pool.go
@@ -18,7 +18,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
// getAllDidPools retrieves all DID pools and is used for the exporter
diff --git a/genesyscloud/telephony_providers_edges_did_pool/resource_genesyscloud_telephony_providers_edges_did_pool_schema.go b/genesyscloud/telephony_providers_edges_did_pool/resource_genesyscloud_telephony_providers_edges_did_pool_schema.go
index 097a32310..1f88fdc4b 100644
--- a/genesyscloud/telephony_providers_edges_did_pool/resource_genesyscloud_telephony_providers_edges_did_pool_schema.go
+++ b/genesyscloud/telephony_providers_edges_did_pool/resource_genesyscloud_telephony_providers_edges_did_pool_schema.go
@@ -6,7 +6,7 @@ import (
"terraform-provider-genesyscloud/genesyscloud/provider"
resourceExporter "terraform-provider-genesyscloud/genesyscloud/resource_exporter"
registrar "terraform-provider-genesyscloud/genesyscloud/resource_register"
- gcloud "terraform-provider-genesyscloud/genesyscloud/validators"
+ "terraform-provider-genesyscloud/genesyscloud/validators"
)
const resourceName = "genesyscloud_telephony_providers_edges_did_pool"
@@ -44,13 +44,13 @@ func ResourceTelephonyDidPool() *schema.Resource {
Description: "Starting phone number of the DID Pool range. Phone number must be in a E.164 number format. Changing the start_phone_number attribute will cause the did_pool object to be dropped and recreated with a new ID.",
Type: schema.TypeString,
Required: true,
- ValidateDiagFunc: gcloud.ValidatePhoneNumber,
+ ValidateDiagFunc: validators.ValidatePhoneNumber,
},
"end_phone_number": {
Description: "Ending phone number of the DID Pool range. Phone number must be in an E.164 number format. Changing the end_phone_number attribute will cause the did_pool object to be dropped and recreated with a new ID.",
Type: schema.TypeString,
Required: true,
- ValidateDiagFunc: gcloud.ValidatePhoneNumber,
+ ValidateDiagFunc: validators.ValidatePhoneNumber,
},
"description": {
Description: "DID Pool description.",
@@ -83,13 +83,13 @@ func DataSourceDidPool() *schema.Resource {
Description: "Starting phone number of the DID Pool range. Must be in an E.164 number format.",
Type: schema.TypeString,
Required: true,
- ValidateDiagFunc: gcloud.ValidatePhoneNumber,
+ ValidateDiagFunc: validators.ValidatePhoneNumber,
},
"end_phone_number": {
Description: "Ending phone number of the DID Pool range.",
Type: schema.TypeString,
Required: true,
- ValidateDiagFunc: gcloud.ValidatePhoneNumber,
+ ValidateDiagFunc: validators.ValidatePhoneNumber,
},
},
}
diff --git a/genesyscloud/telephony_providers_edges_did_pool/resource_genesyscloud_telephony_providers_edges_did_pool_test.go b/genesyscloud/telephony_providers_edges_did_pool/resource_genesyscloud_telephony_providers_edges_did_pool_test.go
index 25e5b05c6..184070128 100644
--- a/genesyscloud/telephony_providers_edges_did_pool/resource_genesyscloud_telephony_providers_edges_did_pool_test.go
+++ b/genesyscloud/telephony_providers_edges_did_pool/resource_genesyscloud_telephony_providers_edges_did_pool_test.go
@@ -10,7 +10,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceDidPoolBasic(t *testing.T) {
diff --git a/genesyscloud/telephony_providers_edges_did_pool/resource_genesyscloud_telephony_providers_edges_did_pool_utils.go b/genesyscloud/telephony_providers_edges_did_pool/resource_genesyscloud_telephony_providers_edges_did_pool_utils.go
index ecc8d1f93..2f7ffa5c9 100644
--- a/genesyscloud/telephony_providers_edges_did_pool/resource_genesyscloud_telephony_providers_edges_did_pool_utils.go
+++ b/genesyscloud/telephony_providers_edges_did_pool/resource_genesyscloud_telephony_providers_edges_did_pool_utils.go
@@ -4,7 +4,7 @@ import (
"context"
"fmt"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
type DidPoolStruct struct {
diff --git a/genesyscloud/telephony_providers_edges_edge_group/genesyscloud_telephony_providers_edges_edge_group_proxy.go b/genesyscloud/telephony_providers_edges_edge_group/genesyscloud_telephony_providers_edges_edge_group_proxy.go
index 9da50ec91..6db0ceb02 100644
--- a/genesyscloud/telephony_providers_edges_edge_group/genesyscloud_telephony_providers_edges_edge_group_proxy.go
+++ b/genesyscloud/telephony_providers_edges_edge_group/genesyscloud_telephony_providers_edges_edge_group_proxy.go
@@ -5,7 +5,7 @@ import (
"fmt"
"log"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
var internalProxy *edgeGroupProxy
diff --git a/genesyscloud/telephony_providers_edges_edge_group/resource_genesyscloud_telephony_providers_edges_edge_group.go b/genesyscloud/telephony_providers_edges_edge_group/resource_genesyscloud_telephony_providers_edges_edge_group.go
index fd3498481..45882bed4 100644
--- a/genesyscloud/telephony_providers_edges_edge_group/resource_genesyscloud_telephony_providers_edges_edge_group.go
+++ b/genesyscloud/telephony_providers_edges_edge_group/resource_genesyscloud_telephony_providers_edges_edge_group.go
@@ -17,7 +17,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func createEdgeGroup(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
diff --git a/genesyscloud/telephony_providers_edges_edge_group/resource_genesyscloud_telephony_providers_edges_edge_group_test.go b/genesyscloud/telephony_providers_edges_edge_group/resource_genesyscloud_telephony_providers_edges_edge_group_test.go
index 02733951a..6c0968e95 100644
--- a/genesyscloud/telephony_providers_edges_edge_group/resource_genesyscloud_telephony_providers_edges_edge_group_test.go
+++ b/genesyscloud/telephony_providers_edges_edge_group/resource_genesyscloud_telephony_providers_edges_edge_group_test.go
@@ -10,7 +10,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceEdgeGroup(t *testing.T) {
diff --git a/genesyscloud/telephony_providers_edges_edge_group/resource_genesyscloud_telephony_providers_edges_edge_group_utils.go b/genesyscloud/telephony_providers_edges_edge_group/resource_genesyscloud_telephony_providers_edges_edge_group_utils.go
index e6f109eeb..6089618c0 100644
--- a/genesyscloud/telephony_providers_edges_edge_group/resource_genesyscloud_telephony_providers_edges_edge_group_utils.go
+++ b/genesyscloud/telephony_providers_edges_edge_group/resource_genesyscloud_telephony_providers_edges_edge_group_utils.go
@@ -6,7 +6,7 @@ import (
lists "terraform-provider-genesyscloud/genesyscloud/util/lists"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func buildSdkTrunkBases(d *schema.ResourceData) *[]platformclientv2.Trunkbase {
diff --git a/genesyscloud/telephony_providers_edges_extension_pool/genesyscloud_telephony_providers_edges_extension_pool_proxy.go b/genesyscloud/telephony_providers_edges_extension_pool/genesyscloud_telephony_providers_edges_extension_pool_proxy.go
index ebbe202d2..21de47b35 100644
--- a/genesyscloud/telephony_providers_edges_extension_pool/genesyscloud_telephony_providers_edges_extension_pool_proxy.go
+++ b/genesyscloud/telephony_providers_edges_extension_pool/genesyscloud_telephony_providers_edges_extension_pool_proxy.go
@@ -3,7 +3,7 @@ package telephony_providers_edges_extension_pool
import (
"context"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
var internalProxy *extensionPoolProxy
diff --git a/genesyscloud/telephony_providers_edges_extension_pool/genesyscloud_telephony_providers_edges_extension_pool_schema.go b/genesyscloud/telephony_providers_edges_extension_pool/genesyscloud_telephony_providers_edges_extension_pool_schema.go
index 0b8eb37df..929e78bed 100644
--- a/genesyscloud/telephony_providers_edges_extension_pool/genesyscloud_telephony_providers_edges_extension_pool_schema.go
+++ b/genesyscloud/telephony_providers_edges_extension_pool/genesyscloud_telephony_providers_edges_extension_pool_schema.go
@@ -5,7 +5,7 @@ import (
"terraform-provider-genesyscloud/genesyscloud/provider"
resourceExporter "terraform-provider-genesyscloud/genesyscloud/resource_exporter"
registrar "terraform-provider-genesyscloud/genesyscloud/resource_register"
- gcloud "terraform-provider-genesyscloud/genesyscloud/validators"
+ "terraform-provider-genesyscloud/genesyscloud/validators"
)
const (
@@ -29,14 +29,14 @@ func ResourceTelephonyExtensionPool() *schema.Resource {
Type: schema.TypeString,
Required: true,
ForceNew: true,
- ValidateDiagFunc: gcloud.ValidateExtensionPool,
+ ValidateDiagFunc: validators.ValidateExtensionPool,
},
"end_number": {
Description: "Ending phone number of the Extension Pool range. Changing the end_number attribute will cause the extension object to be dropped and recreated with a new ID.",
Type: schema.TypeString,
Required: true,
ForceNew: true,
- ValidateDiagFunc: gcloud.ValidateExtensionPool,
+ ValidateDiagFunc: validators.ValidateExtensionPool,
},
"description": {
Description: "Extension Pool description.",
@@ -56,13 +56,13 @@ func DataSourceExtensionPool() *schema.Resource {
Description: "Starting number of the Extension Pool range.",
Type: schema.TypeString,
Required: true,
- ValidateDiagFunc: gcloud.ValidateExtensionPool,
+ ValidateDiagFunc: validators.ValidateExtensionPool,
},
"end_number": {
Description: "Ending number of the Extension Pool range.",
Type: schema.TypeString,
Required: true,
- ValidateDiagFunc: gcloud.ValidateExtensionPool,
+ ValidateDiagFunc: validators.ValidateExtensionPool,
},
},
}
@@ -76,7 +76,7 @@ func TelephonyExtensionPoolExporter() *resourceExporter.ResourceExporter {
}
func SetRegistrar(l registrar.Registrar) {
- l.RegisterDataSource("genesyscloud_telephony_providers_edges_extension_pool", DataSourceExtensionPool())
- l.RegisterResource("genesyscloud_telephony_providers_edges_extension_pool", ResourceTelephonyExtensionPool())
- l.RegisterExporter("genesyscloud_telephony_providers_edges_extension_pool", TelephonyExtensionPoolExporter())
+ l.RegisterDataSource(resourceName, DataSourceExtensionPool())
+ l.RegisterResource(resourceName, ResourceTelephonyExtensionPool())
+ l.RegisterExporter(resourceName, TelephonyExtensionPoolExporter())
}
diff --git a/genesyscloud/telephony_providers_edges_extension_pool/resource_genesyscloud_telephony_providers_edges_extension_pool.go b/genesyscloud/telephony_providers_edges_extension_pool/resource_genesyscloud_telephony_providers_edges_extension_pool.go
index b87e18f1a..4cbe729b1 100644
--- a/genesyscloud/telephony_providers_edges_extension_pool/resource_genesyscloud_telephony_providers_edges_extension_pool.go
+++ b/genesyscloud/telephony_providers_edges_extension_pool/resource_genesyscloud_telephony_providers_edges_extension_pool.go
@@ -17,7 +17,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func getAllExtensionPools(ctx context.Context, clientConfig *platformclientv2.Configuration) (resourceExporter.ResourceIDMetaMap, diag.Diagnostics) {
diff --git a/genesyscloud/telephony_providers_edges_extension_pool/resource_genesyscloud_telephony_providers_edges_extension_pool_test.go b/genesyscloud/telephony_providers_edges_extension_pool/resource_genesyscloud_telephony_providers_edges_extension_pool_test.go
index 0d1d75364..84a0d93a0 100644
--- a/genesyscloud/telephony_providers_edges_extension_pool/resource_genesyscloud_telephony_providers_edges_extension_pool_test.go
+++ b/genesyscloud/telephony_providers_edges_extension_pool/resource_genesyscloud_telephony_providers_edges_extension_pool_test.go
@@ -11,7 +11,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
type extensionPoolStruct struct {
diff --git a/genesyscloud/telephony_providers_edges_linebasesettings/data_source_genesyscloud_telephony_providers_edges_linebasesettings.go b/genesyscloud/telephony_providers_edges_linebasesettings/data_source_genesyscloud_telephony_providers_edges_linebasesettings.go
index f4926b3e0..912f7a8b7 100644
--- a/genesyscloud/telephony_providers_edges_linebasesettings/data_source_genesyscloud_telephony_providers_edges_linebasesettings.go
+++ b/genesyscloud/telephony_providers_edges_linebasesettings/data_source_genesyscloud_telephony_providers_edges_linebasesettings.go
@@ -11,7 +11,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func dataSourceLineBaseSettingsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
diff --git a/genesyscloud/telephony_providers_edges_phone/genesyscloud_telephony_providers_edges_phone_init_test.go b/genesyscloud/telephony_providers_edges_phone/genesyscloud_telephony_providers_edges_phone_init_test.go
index 3f58aa899..ddfe3a1b9 100644
--- a/genesyscloud/telephony_providers_edges_phone/genesyscloud_telephony_providers_edges_phone_init_test.go
+++ b/genesyscloud/telephony_providers_edges_phone/genesyscloud_telephony_providers_edges_phone_init_test.go
@@ -10,7 +10,7 @@ import (
edgeSite "terraform-provider-genesyscloud/genesyscloud/telephony_providers_edges_site"
"testing"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
diff --git a/genesyscloud/telephony_providers_edges_phone/genesyscloud_telephony_providers_edges_phone_proxy.go b/genesyscloud/telephony_providers_edges_phone/genesyscloud_telephony_providers_edges_phone_proxy.go
index 5fa8a8271..648447fb6 100644
--- a/genesyscloud/telephony_providers_edges_phone/genesyscloud_telephony_providers_edges_phone_proxy.go
+++ b/genesyscloud/telephony_providers_edges_phone/genesyscloud_telephony_providers_edges_phone_proxy.go
@@ -6,7 +6,9 @@ import (
"log"
"net/http"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ rc "terraform-provider-genesyscloud/genesyscloud/resource_cache"
+
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
@@ -53,6 +55,7 @@ type phoneProxy struct {
edgesApi *platformclientv2.TelephonyProvidersEdgeApi
stationsApi *platformclientv2.StationsApi
usersApi *platformclientv2.UsersApi
+ phoneCache rc.CacheInterface[platformclientv2.Phone]
getAllPhonesAttr getAllPhonesFunc
createPhoneAttr createPhoneFunc
@@ -73,12 +76,14 @@ func newPhoneProxy(clientConfig *platformclientv2.Configuration) *phoneProxy {
edgesApi := platformclientv2.NewTelephonyProvidersEdgeApiWithConfig(clientConfig)
stationsApi := platformclientv2.NewStationsApiWithConfig(clientConfig)
usersApi := platformclientv2.NewUsersApiWithConfig(clientConfig)
+ phoneCache := rc.NewResourceCache[platformclientv2.Phone]()
return &phoneProxy{
clientConfig: clientConfig,
edgesApi: edgesApi,
stationsApi: stationsApi,
usersApi: usersApi,
+ phoneCache: phoneCache,
getAllPhonesAttr: getAllPhonesFn,
createPhoneAttr: createPhoneFn,
@@ -116,6 +121,9 @@ func (p *phoneProxy) createPhone(ctx context.Context, phoneConfig *platformclien
// getPhoneById retrieves a Genesys Cloud Phone by id
func (p *phoneProxy) getPhoneById(ctx context.Context, phoneId string) (*platformclientv2.Phone, *platformclientv2.APIResponse, error) {
+ if phone := rc.GetCacheItem(p.phoneCache, phoneId); phone != nil {
+ return phone, nil, nil
+ }
return p.getPhoneByIdAttr(ctx, p, phoneId)
}
@@ -205,6 +213,9 @@ func getAllPhonesFn(ctx context.Context, p *phoneProxy) (*[]platformclientv2.Pho
log.Printf("getAllPhonesFn:: Listing all of the non-deleted phone ids and names that we actually retrieved")
for _, phone := range allPhones {
log.Printf("getAllPhonesFn:: Retrieved phone id %s with phone name: %s\n", *phone.Id, *phone.Name)
+
+ // Cache the phone resource into the p.phoneCache for later use
+ rc.SetCache(p.phoneCache, *phone.Id, phone)
}
return &allPhones, response, nil
diff --git a/genesyscloud/telephony_providers_edges_phone/resource_genesyscloud_telephony_providers_edges_phone.go b/genesyscloud/telephony_providers_edges_phone/resource_genesyscloud_telephony_providers_edges_phone.go
index f35777cd5..64cee7cfa 100644
--- a/genesyscloud/telephony_providers_edges_phone/resource_genesyscloud_telephony_providers_edges_phone.go
+++ b/genesyscloud/telephony_providers_edges_phone/resource_genesyscloud_telephony_providers_edges_phone.go
@@ -17,7 +17,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func getAllPhones(ctx context.Context, sdkConfig *platformclientv2.Configuration) (resourceExporter.ResourceIDMetaMap, diag.Diagnostics) {
@@ -90,10 +90,16 @@ func readPhone(ctx context.Context, d *schema.ResourceData, meta interface{}) di
}
_ = d.Set("name", *currentPhone.Name)
- _ = d.Set("state", *currentPhone.State)
_ = d.Set("site_id", *currentPhone.Site.Id)
_ = d.Set("phone_base_settings_id", *currentPhone.PhoneBaseSettings.Id)
- _ = d.Set("line_base_settings_id", *currentPhone.LineBaseSettings.Id)
+
+ if currentPhone.State != nil {
+ _ = d.Set("state", *currentPhone.State)
+ }
+
+ if currentPhone.LineBaseSettings != nil {
+ _ = d.Set("line_base_settings_id", *currentPhone.LineBaseSettings.Id)
+ }
if currentPhone.PhoneMetaBase != nil {
_ = d.Set("phone_meta_base_id", *currentPhone.PhoneMetaBase.Id)
diff --git a/genesyscloud/telephony_providers_edges_phone/resource_genesyscloud_telephony_providers_edges_phone_schema.go b/genesyscloud/telephony_providers_edges_phone/resource_genesyscloud_telephony_providers_edges_phone_schema.go
index 2e1315b58..489a269b7 100644
--- a/genesyscloud/telephony_providers_edges_phone/resource_genesyscloud_telephony_providers_edges_phone_schema.go
+++ b/genesyscloud/telephony_providers_edges_phone/resource_genesyscloud_telephony_providers_edges_phone_schema.go
@@ -5,7 +5,7 @@ import (
resourceExporter "terraform-provider-genesyscloud/genesyscloud/resource_exporter"
registrar "terraform-provider-genesyscloud/genesyscloud/resource_register"
"terraform-provider-genesyscloud/genesyscloud/util"
- gcloud "terraform-provider-genesyscloud/genesyscloud/validators"
+ "terraform-provider-genesyscloud/genesyscloud/validators"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
@@ -140,7 +140,7 @@ func ResourcePhone() *schema.Resource {
Type: schema.TypeList,
Optional: true,
Computed: true,
- Elem: &schema.Schema{Type: schema.TypeString, ValidateDiagFunc: gcloud.ValidatePhoneNumber},
+ Elem: &schema.Schema{Type: schema.TypeString, ValidateDiagFunc: validators.ValidatePhoneNumber},
},
"properties": {
Description: "phone properties",
diff --git a/genesyscloud/telephony_providers_edges_phone/resource_genesyscloud_telephony_providers_edges_phone_test.go b/genesyscloud/telephony_providers_edges_phone/resource_genesyscloud_telephony_providers_edges_phone_test.go
index eca79cff8..c01d7e3ed 100644
--- a/genesyscloud/telephony_providers_edges_phone/resource_genesyscloud_telephony_providers_edges_phone_test.go
+++ b/genesyscloud/telephony_providers_edges_phone/resource_genesyscloud_telephony_providers_edges_phone_test.go
@@ -17,7 +17,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourcePhoneBasic(t *testing.T) {
@@ -188,6 +188,7 @@ func TestAccResourcePhoneBasic(t *testing.T) {
func TestAccResourcePhoneStandalone(t *testing.T) {
number := "+12005538112"
+ deleteDidPoolWithNumber(number)
didPoolResource1 := "test-didpool1"
lineAddresses := []string{number}
phoneRes := "phone_standalone1234"
@@ -245,29 +246,6 @@ func TestAccResourcePhoneStandalone(t *testing.T) {
"mac",
[]string{},
)
- config := didPool.GenerateDidPoolResource(&didPool.DidPoolStruct{
- ResourceID: didPoolResource1,
- StartPhoneNumber: lineAddresses[0],
- EndPhoneNumber: lineAddresses[0],
- Description: util.NullValue, // No description
- Comments: util.NullValue, // No comments
- PoolProvider: util.NullValue, // No provider
- })
- config += phoneBaseSettings.GeneratePhoneBaseSettingsResourceWithCustomAttrs(
- phoneBaseSettingsRes,
- phoneBaseSettingsName,
- "phoneBaseSettings description",
- "generic_sip.json",
- ) + GeneratePhoneResourceWithCustomAttrs(&PhoneConfig{
- phoneRes,
- name1,
- stateActive,
- "genesyscloud_telephony_providers_edges_site." + siteRes + ".id",
- "genesyscloud_telephony_providers_edges_phonebasesettings." + phoneBaseSettingsRes + ".id",
- lineAddresses,
- "", // no web rtc user
- "genesyscloud_telephony_providers_edges_did_pool." + didPoolResource1,
- }, capabilities, generatePhoneProperties(uuid.NewString()))
resource.Test(t, resource.TestCase{
PreCheck: func() { util.TestAccPreCheck(t) },
@@ -277,7 +255,28 @@ func TestAccResourcePhoneStandalone(t *testing.T) {
PreConfig: func() {
time.Sleep(30 * time.Second)
},
- Config: locationConfig + siteConfig + config,
+ Config: didPool.GenerateDidPoolResource(&didPool.DidPoolStruct{
+ ResourceID: didPoolResource1,
+ StartPhoneNumber: lineAddresses[0],
+ EndPhoneNumber: lineAddresses[0],
+ Description: util.NullValue, // No description
+ Comments: util.NullValue, // No comments
+ PoolProvider: util.NullValue, // No provider
+ }) + locationConfig + siteConfig + phoneBaseSettings.GeneratePhoneBaseSettingsResourceWithCustomAttrs(
+ phoneBaseSettingsRes,
+ phoneBaseSettingsName,
+ "phoneBaseSettings description",
+ "generic_sip.json",
+ ) + GeneratePhoneResourceWithCustomAttrs(&PhoneConfig{
+ phoneRes,
+ name1,
+ stateActive,
+ "genesyscloud_telephony_providers_edges_site." + siteRes + ".id",
+ "genesyscloud_telephony_providers_edges_phonebasesettings." + phoneBaseSettingsRes + ".id",
+ lineAddresses,
+ "", // no web rtc user
+ "genesyscloud_telephony_providers_edges_did_pool." + didPoolResource1,
+ }, capabilities, generatePhoneProperties(uuid.NewString())),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("genesyscloud_telephony_providers_edges_phone."+phoneRes, "name", name1),
resource.TestCheckResourceAttr("genesyscloud_telephony_providers_edges_phone."+phoneRes, "state", stateActive),
@@ -445,7 +444,6 @@ func TestAccResourceHardPhoneStandalone(t *testing.T) {
CheckDestroy: TestVerifyWebRtcPhoneDestroyed,
})
}
-
func generatePhoneCapabilities(
provisions,
registers,
@@ -532,3 +530,32 @@ func deleteDidPool(config *platformclientv2.Configuration, id string) error {
}
return nil
}
+
+func deleteDidPoolWithNumber(number string) {
+ edgesAPI := platformclientv2.NewTelephonyProvidersEdgeApiWithConfig(sdkConfig)
+ var didPoolsToDelete []string
+
+ for pageNum := 1; ; pageNum++ {
+ const pageSize = 100
+ didPools, _, getErr := edgesAPI.GetTelephonyProvidersEdgesDidpools(pageSize, pageNum, "", nil)
+ if getErr != nil {
+ return
+ }
+
+ if didPools.Entities == nil || len(*didPools.Entities) == 0 {
+ break
+ }
+
+ for _, didPool := range *didPools.Entities {
+ if (didPool.StartPhoneNumber != nil && *didPool.StartPhoneNumber == number) ||
+ (didPool.EndPhoneNumber != nil && *didPool.EndPhoneNumber == number) {
+ didPoolsToDelete = append(didPoolsToDelete, *didPool.Id)
+ }
+ }
+ }
+
+ for _, didPoolId := range didPoolsToDelete {
+ edgesAPI.DeleteTelephonyProvidersEdgesDidpool(didPoolId)
+ time.Sleep(5 * time.Second)
+ }
+}
diff --git a/genesyscloud/telephony_providers_edges_phone/resource_genesyscloud_telephony_providers_edges_phone_utils.go b/genesyscloud/telephony_providers_edges_phone/resource_genesyscloud_telephony_providers_edges_phone_utils.go
index 791aed325..7545851fe 100644
--- a/genesyscloud/telephony_providers_edges_phone/resource_genesyscloud_telephony_providers_edges_phone_utils.go
+++ b/genesyscloud/telephony_providers_edges_phone/resource_genesyscloud_telephony_providers_edges_phone_utils.go
@@ -18,7 +18,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
type PhoneConfig struct {
@@ -174,6 +174,9 @@ func flattenPhoneLines(lines *[]platformclientv2.Line) []string {
for i := 0; i < len(*lines); i++ {
line := (*lines)[i]
did := ""
+ if line.Properties == nil {
+ continue
+ }
if k := (*line.Properties)["station_identity_address"]; k != nil {
didI := k.(map[string]interface{})["value"].(map[string]interface{})["instance"]
if didI != nil {
diff --git a/genesyscloud/telephony_providers_edges_phonebasesettings/data_source_genesyscloud_telephony_providers_edges_phonebasesettings.go b/genesyscloud/telephony_providers_edges_phonebasesettings/data_source_genesyscloud_telephony_providers_edges_phonebasesettings.go
index e0f6d3235..ddbafa09b 100644
--- a/genesyscloud/telephony_providers_edges_phonebasesettings/data_source_genesyscloud_telephony_providers_edges_phonebasesettings.go
+++ b/genesyscloud/telephony_providers_edges_phonebasesettings/data_source_genesyscloud_telephony_providers_edges_phonebasesettings.go
@@ -11,7 +11,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func dataSourcePhoneBaseSettingsRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
diff --git a/genesyscloud/telephony_providers_edges_phonebasesettings/genesyscloud_telephony_providers_edges_phonebasesettings_proxy.go b/genesyscloud/telephony_providers_edges_phonebasesettings/genesyscloud_telephony_providers_edges_phonebasesettings_proxy.go
index 047852220..47093078c 100644
--- a/genesyscloud/telephony_providers_edges_phonebasesettings/genesyscloud_telephony_providers_edges_phonebasesettings_proxy.go
+++ b/genesyscloud/telephony_providers_edges_phonebasesettings/genesyscloud_telephony_providers_edges_phonebasesettings_proxy.go
@@ -3,7 +3,7 @@ package telephony_providers_edges_phonebasesettings
import (
"context"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
var internalProxy *phoneBaseProxy
diff --git a/genesyscloud/telephony_providers_edges_phonebasesettings/resource_genesyscloud_telephony_providers_edges_phonebasesettings.go b/genesyscloud/telephony_providers_edges_phonebasesettings/resource_genesyscloud_telephony_providers_edges_phonebasesettings.go
index 99fb59df0..3ac3ed4dd 100644
--- a/genesyscloud/telephony_providers_edges_phonebasesettings/resource_genesyscloud_telephony_providers_edges_phonebasesettings.go
+++ b/genesyscloud/telephony_providers_edges_phonebasesettings/resource_genesyscloud_telephony_providers_edges_phonebasesettings.go
@@ -18,7 +18,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func createPhoneBaseSettings(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
diff --git a/genesyscloud/telephony_providers_edges_phonebasesettings/resource_genesyscloud_telephony_providers_edges_phonebasesettings_test.go b/genesyscloud/telephony_providers_edges_phonebasesettings/resource_genesyscloud_telephony_providers_edges_phonebasesettings_test.go
index 1fc69d1ac..864dc06f4 100644
--- a/genesyscloud/telephony_providers_edges_phonebasesettings/resource_genesyscloud_telephony_providers_edges_phonebasesettings_test.go
+++ b/genesyscloud/telephony_providers_edges_phonebasesettings/resource_genesyscloud_telephony_providers_edges_phonebasesettings_test.go
@@ -11,7 +11,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourcePhoneBaseSettings(t *testing.T) {
diff --git a/genesyscloud/telephony_providers_edges_phonebasesettings/resource_genesyscloud_telephony_providers_edges_phonebasesettings_utils.go b/genesyscloud/telephony_providers_edges_phonebasesettings/resource_genesyscloud_telephony_providers_edges_phonebasesettings_utils.go
index c2ad0afb9..9cd0bc6be 100644
--- a/genesyscloud/telephony_providers_edges_phonebasesettings/resource_genesyscloud_telephony_providers_edges_phonebasesettings_utils.go
+++ b/genesyscloud/telephony_providers_edges_phonebasesettings/resource_genesyscloud_telephony_providers_edges_phonebasesettings_utils.go
@@ -7,7 +7,7 @@ import (
"terraform-provider-genesyscloud/genesyscloud/util/resourcedata"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func generatePhoneBaseSettingsDataSource(
diff --git a/genesyscloud/telephony_providers_edges_site/data_source_genesyscloud_telephony_providers_edges_site_test.go b/genesyscloud/telephony_providers_edges_site/data_source_genesyscloud_telephony_providers_edges_site_test.go
index fd5744d2d..1ca6a3319 100644
--- a/genesyscloud/telephony_providers_edges_site/data_source_genesyscloud_telephony_providers_edges_site_test.go
+++ b/genesyscloud/telephony_providers_edges_site/data_source_genesyscloud_telephony_providers_edges_site_test.go
@@ -7,7 +7,7 @@ import (
"terraform-provider-genesyscloud/genesyscloud/util"
"testing"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
gcloud "terraform-provider-genesyscloud/genesyscloud"
diff --git a/genesyscloud/telephony_providers_edges_site/genesyscloud_telephony_providers_edges_site_proxy.go b/genesyscloud/telephony_providers_edges_site/genesyscloud_telephony_providers_edges_site_proxy.go
index a6f87a171..bd7b487ee 100644
--- a/genesyscloud/telephony_providers_edges_site/genesyscloud_telephony_providers_edges_site_proxy.go
+++ b/genesyscloud/telephony_providers_edges_site/genesyscloud_telephony_providers_edges_site_proxy.go
@@ -5,7 +5,7 @@ import (
"fmt"
rc "terraform-provider-genesyscloud/genesyscloud/resource_cache"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
diff --git a/genesyscloud/telephony_providers_edges_site/resource_genesyscloud_telephony_providers_edges_site.go b/genesyscloud/telephony_providers_edges_site/resource_genesyscloud_telephony_providers_edges_site.go
index dffc909f0..5297248fe 100644
--- a/genesyscloud/telephony_providers_edges_site/resource_genesyscloud_telephony_providers_edges_site.go
+++ b/genesyscloud/telephony_providers_edges_site/resource_genesyscloud_telephony_providers_edges_site.go
@@ -20,7 +20,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func getAllSites(ctx context.Context, sdkConfig *platformclientv2.Configuration) (resourceExporter.ResourceIDMetaMap, diag.Diagnostics) {
@@ -306,14 +306,23 @@ func deleteSite(ctx context.Context, d *schema.ResourceData, meta interface{}) d
sdkConfig := meta.(*provider.ProviderMeta).ClientConfig
sp := GetSiteProxy(sdkConfig)
- log.Printf("Deleting site")
- resp, err := sp.deleteSite(ctx, d.Id())
- if err != nil {
- if util.IsStatus404(resp) {
- log.Printf("Site already deleted %s", d.Id())
- return nil
+ // A site linked to a trunk will not be able to be deleted until that trunk is deleted. Retrying here to make sure it is cleared properly.
+ log.Printf("Deleting site %s", d.Id())
+ diagErr := util.RetryWhen(util.IsStatus409, func() (*platformclientv2.APIResponse, diag.Diagnostics) {
+ log.Printf("Deleting site %s", d.Id())
+ resp, err := sp.deleteSite(ctx, d.Id())
+ if err != nil {
+ if util.IsStatus404(resp) {
+ log.Printf("Site already deleted %s", d.Id())
+ return resp, nil
+ }
+ return resp, util.BuildAPIDiagnosticError(resourceName, fmt.Sprintf("Failed to delete site %s error: %s", d.Id(), err), resp)
}
- return util.BuildAPIDiagnosticError(resourceName, fmt.Sprintf("Failed to delete site %s error: %s", d.Id(), err), resp)
+ return resp, nil
+ })
+
+ if diagErr != nil {
+ return diagErr
}
return util.WithRetries(ctx, 30*time.Second, func() *retry.RetryError {
diff --git a/genesyscloud/telephony_providers_edges_site/resource_genesyscloud_telephony_providers_edges_site_schema.go b/genesyscloud/telephony_providers_edges_site/resource_genesyscloud_telephony_providers_edges_site_schema.go
index 5a952fc84..db12e288d 100644
--- a/genesyscloud/telephony_providers_edges_site/resource_genesyscloud_telephony_providers_edges_site_schema.go
+++ b/genesyscloud/telephony_providers_edges_site/resource_genesyscloud_telephony_providers_edges_site_schema.go
@@ -4,11 +4,11 @@ import (
"fmt"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"terraform-provider-genesyscloud/genesyscloud/provider"
resourceExporter "terraform-provider-genesyscloud/genesyscloud/resource_exporter"
registrar "terraform-provider-genesyscloud/genesyscloud/resource_register"
- gcloud "terraform-provider-genesyscloud/genesyscloud/validators"
+ "terraform-provider-genesyscloud/genesyscloud/validators"
)
/*
@@ -90,7 +90,7 @@ func ResourceSite() *schema.Resource {
Description: "A reoccurring rule for updating the Edges assigned to the site. The only supported frequencies are daily and weekly. Weekly frequencies require a day list with at least oneday specified. All other configurations are not supported.",
Type: schema.TypeString,
Required: true,
- ValidateDiagFunc: gcloud.ValidateRrule,
+ ValidateDiagFunc: validators.ValidateRrule,
},
"start": {
Description: "Date time is represented as an ISO-8601 string without a timezone. For example: yyyy-MM-ddTHH:mm:ss.SSS",
@@ -221,7 +221,7 @@ func ResourceSite() *schema.Resource {
Description: "The caller ID value for the site. The callerID must be a valid E.164 formatted phone number",
Type: schema.TypeString,
Optional: true,
- ValidateDiagFunc: gcloud.ValidatePhoneNumber,
+ ValidateDiagFunc: validators.ValidatePhoneNumber,
},
"caller_name": {
Description: "The caller name for the site",
diff --git a/genesyscloud/telephony_providers_edges_site/resource_genesyscloud_telephony_providers_edges_site_test.go b/genesyscloud/telephony_providers_edges_site/resource_genesyscloud_telephony_providers_edges_site_test.go
index aa1a90ca5..d601105cc 100644
--- a/genesyscloud/telephony_providers_edges_site/resource_genesyscloud_telephony_providers_edges_site_test.go
+++ b/genesyscloud/telephony_providers_edges_site/resource_genesyscloud_telephony_providers_edges_site_test.go
@@ -18,7 +18,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceSite(t *testing.T) {
diff --git a/genesyscloud/telephony_providers_edges_site/resource_genesyscloud_telephony_providers_edges_site_utils.go b/genesyscloud/telephony_providers_edges_site/resource_genesyscloud_telephony_providers_edges_site_utils.go
index 6c90c19a2..4cfd92d46 100644
--- a/genesyscloud/telephony_providers_edges_site/resource_genesyscloud_telephony_providers_edges_site_utils.go
+++ b/genesyscloud/telephony_providers_edges_site/resource_genesyscloud_telephony_providers_edges_site_utils.go
@@ -17,7 +17,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/leekchan/timeutil"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
var (
diff --git a/genesyscloud/telephony_providers_edges_site_outbound_route/genesyscloud_telephony_providers_edges_site_outbound_route_init_test.go b/genesyscloud/telephony_providers_edges_site_outbound_route/genesyscloud_telephony_providers_edges_site_outbound_route_init_test.go
index e8ace3917..dfa9e4042 100644
--- a/genesyscloud/telephony_providers_edges_site_outbound_route/genesyscloud_telephony_providers_edges_site_outbound_route_init_test.go
+++ b/genesyscloud/telephony_providers_edges_site_outbound_route/genesyscloud_telephony_providers_edges_site_outbound_route_init_test.go
@@ -2,7 +2,7 @@ package telephony_providers_edges_site_outbound_route
import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"log"
"sync"
gcloud "terraform-provider-genesyscloud/genesyscloud"
diff --git a/genesyscloud/telephony_providers_edges_site_outbound_route/genesyscloud_telephony_providers_edges_site_outbound_route_proxy.go b/genesyscloud/telephony_providers_edges_site_outbound_route/genesyscloud_telephony_providers_edges_site_outbound_route_proxy.go
index a45e1c589..d9ff5d76c 100644
--- a/genesyscloud/telephony_providers_edges_site_outbound_route/genesyscloud_telephony_providers_edges_site_outbound_route_proxy.go
+++ b/genesyscloud/telephony_providers_edges_site_outbound_route/genesyscloud_telephony_providers_edges_site_outbound_route_proxy.go
@@ -2,7 +2,7 @@ package telephony_providers_edges_site_outbound_route
import (
"context"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
rc "terraform-provider-genesyscloud/genesyscloud/resource_cache"
telephonyProvidersEdgesSite "terraform-provider-genesyscloud/genesyscloud/telephony_providers_edges_site"
)
diff --git a/genesyscloud/telephony_providers_edges_site_outbound_route/resource_genesyscloud_telephony_providers_edges_site_outbound_route.go b/genesyscloud/telephony_providers_edges_site_outbound_route/resource_genesyscloud_telephony_providers_edges_site_outbound_route.go
index 91d094ef3..bcbab805e 100644
--- a/genesyscloud/telephony_providers_edges_site_outbound_route/resource_genesyscloud_telephony_providers_edges_site_outbound_route.go
+++ b/genesyscloud/telephony_providers_edges_site_outbound_route/resource_genesyscloud_telephony_providers_edges_site_outbound_route.go
@@ -6,7 +6,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"log"
"terraform-provider-genesyscloud/genesyscloud/consistency_checker"
"terraform-provider-genesyscloud/genesyscloud/provider"
diff --git a/genesyscloud/telephony_providers_edges_site_outbound_route/resource_genesyscloud_telephony_providers_edges_site_outbound_route_schema.go b/genesyscloud/telephony_providers_edges_site_outbound_route/resource_genesyscloud_telephony_providers_edges_site_outbound_route_schema.go
index 0e424c08c..a16fefc0b 100644
--- a/genesyscloud/telephony_providers_edges_site_outbound_route/resource_genesyscloud_telephony_providers_edges_site_outbound_route_schema.go
+++ b/genesyscloud/telephony_providers_edges_site_outbound_route/resource_genesyscloud_telephony_providers_edges_site_outbound_route_schema.go
@@ -1,11 +1,12 @@
package telephony_providers_edges_site_outbound_route
import (
- "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
"terraform-provider-genesyscloud/genesyscloud/provider"
resourceExporter "terraform-provider-genesyscloud/genesyscloud/resource_exporter"
registrar "terraform-provider-genesyscloud/genesyscloud/resource_register"
+
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
)
/*
@@ -93,7 +94,6 @@ func ResourceSiteOutboundRoute() *schema.Resource {
Required: true,
ConfigMode: schema.SchemaConfigModeAttr,
Elem: outboundRouteSchema,
- MinItems: 1,
},
},
}
diff --git a/genesyscloud/telephony_providers_edges_site_outbound_route/resource_genesyscloud_telephony_providers_edges_site_outbound_route_utils.go b/genesyscloud/telephony_providers_edges_site_outbound_route/resource_genesyscloud_telephony_providers_edges_site_outbound_route_utils.go
index ff069de53..ababd9fe0 100644
--- a/genesyscloud/telephony_providers_edges_site_outbound_route/resource_genesyscloud_telephony_providers_edges_site_outbound_route_utils.go
+++ b/genesyscloud/telephony_providers_edges_site_outbound_route/resource_genesyscloud_telephony_providers_edges_site_outbound_route_utils.go
@@ -2,7 +2,7 @@ package telephony_providers_edges_site_outbound_route
import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"terraform-provider-genesyscloud/genesyscloud/util/resourcedata"
)
diff --git a/genesyscloud/telephony_providers_edges_trunk/data_source_genesyscloud_telephony_providers_edges_trunk.go b/genesyscloud/telephony_providers_edges_trunk/data_source_genesyscloud_telephony_providers_edges_trunk.go
index c6d9bbfc9..de61a6741 100644
--- a/genesyscloud/telephony_providers_edges_trunk/data_source_genesyscloud_telephony_providers_edges_trunk.go
+++ b/genesyscloud/telephony_providers_edges_trunk/data_source_genesyscloud_telephony_providers_edges_trunk.go
@@ -11,7 +11,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func dataSourceTrunkRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
diff --git a/genesyscloud/telephony_providers_edges_trunk/genesyscloud_telephony_providers_edges_trunk_proxy.go b/genesyscloud/telephony_providers_edges_trunk/genesyscloud_telephony_providers_edges_trunk_proxy.go
index 1cefe3a53..4f2138191 100644
--- a/genesyscloud/telephony_providers_edges_trunk/genesyscloud_telephony_providers_edges_trunk_proxy.go
+++ b/genesyscloud/telephony_providers_edges_trunk/genesyscloud_telephony_providers_edges_trunk_proxy.go
@@ -3,7 +3,7 @@ package telephony_providers_edges_trunk
import (
"context"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
//generate a proxy for telephony_providers_edges_trunk
diff --git a/genesyscloud/telephony_providers_edges_trunk/resource_genesyscloud_telephony_providers_edges_trunk.go b/genesyscloud/telephony_providers_edges_trunk/resource_genesyscloud_telephony_providers_edges_trunk.go
index c303bc43f..af15ea366 100644
--- a/genesyscloud/telephony_providers_edges_trunk/resource_genesyscloud_telephony_providers_edges_trunk.go
+++ b/genesyscloud/telephony_providers_edges_trunk/resource_genesyscloud_telephony_providers_edges_trunk.go
@@ -17,7 +17,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func createTrunk(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
diff --git a/genesyscloud/tfexporter/export_common.go b/genesyscloud/tfexporter/export_common.go
index 91fffdc7e..3743ab1a5 100644
--- a/genesyscloud/tfexporter/export_common.go
+++ b/genesyscloud/tfexporter/export_common.go
@@ -129,13 +129,22 @@ func IncludeFilterResourceByRegex(result resourceExporter.ResourceIDMetaMap, nam
return result
}
+ sanitizer := resourceExporter.NewSanitizerProvider()
+
for _, pattern := range newFilters {
for k := range result {
match, _ := regexp.MatchString(pattern, result[k].Name)
+ // If name matches original name
if match {
newResourceMap[k] = result[k]
}
+
+ // If name matches sanitized name
+ sanitizedMatch, _ := regexp.MatchString(pattern, sanitizer.S.SanitizeResourceName(result[k].Name))
+ if sanitizedMatch {
+ newResourceMap[k] = result[k]
+ }
}
}
@@ -157,10 +166,12 @@ func ExcludeFilterResourceByRegex(result resourceExporter.ResourceIDMetaMap, nam
}
newResourceMap := make(resourceExporter.ResourceIDMetaMap)
+ sanitizer := resourceExporter.NewSanitizerProvider()
for k := range result {
for _, pattern := range newFilters {
+ // If name matches original name
match, _ := regexp.MatchString(pattern, result[k].Name)
if !match {
newResourceMap[k] = result[k]
@@ -168,8 +179,16 @@ func ExcludeFilterResourceByRegex(result resourceExporter.ResourceIDMetaMap, nam
delete(newResourceMap, k)
break
}
- }
+ // If name matches sanitized name
+ sanitizedMatch, _ := regexp.MatchString(pattern, sanitizer.S.SanitizeResourceName(result[k].Name))
+ if !sanitizedMatch {
+ newResourceMap[k] = result[k]
+ } else {
+ delete(newResourceMap, k)
+ break
+ }
+ }
}
return newResourceMap
}
diff --git a/genesyscloud/tfexporter/genesyscloud_resource_exporter.go b/genesyscloud/tfexporter/genesyscloud_resource_exporter.go
index 35e878b48..abf75169a 100644
--- a/genesyscloud/tfexporter/genesyscloud_resource_exporter.go
+++ b/genesyscloud/tfexporter/genesyscloud_resource_exporter.go
@@ -1,10 +1,14 @@
package tfexporter
import (
+ "archive/zip"
"context"
"fmt"
"hash/fnv"
+ "io"
"log"
+ "os"
+ "path"
"path/filepath"
"reflect"
"regexp"
@@ -29,11 +33,11 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
"github.com/mohae/deepcopy"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
/*
- This file contains all of the logic associated wite the process of exporting a file.
+ This file contains all logic associated with the process of exporting a file.
*/
// Used to store the TF config block as a string so that it can be ignored when testing the exported HCL config file.
@@ -178,7 +182,7 @@ func (g *GenesysCloudResourceExporter) Export() (diagErr diag.Diagnostics) {
if diagErr != nil {
return diagErr
}
- // Step #2 Retrieve all of the individual resources we are going to export
+ // Step #2 Retrieve all the individual resources we are going to export
diagErr = g.retrieveSanitizedResourceMaps()
if diagErr != nil {
return diagErr
@@ -327,6 +331,7 @@ func (g *GenesysCloudResourceExporter) retrieveGenesysCloudObjectInstances() dia
go func(resType string, exporter *resourceExporter.ResourceExporter) {
defer wg.Done()
+ log.Printf("Getting exported resources for [%s]", resType)
typeResources, err := g.getResourcesForType(resType, g.provider, exporter, g.meta)
if err != nil {
@@ -479,6 +484,57 @@ func (g *GenesysCloudResourceExporter) generateOutputFiles() diag.Diagnostics {
}
}
+ err = g.generateZipForExporter()
+ if err != nil {
+ return err
+ }
+
+ return nil
+}
+
+func (g *GenesysCloudResourceExporter) generateZipForExporter() diag.Diagnostics {
+ zipFileName := "../archive_genesyscloud_tf_export" + uuid.NewString() + ".zip"
+ if compress := g.d.Get("compress").(bool); compress { //if true, compress directory name of where the export is going to occur
+ // read all the files
+ var files []fileMeta
+ ferr := filepath.Walk(g.exportDirPath, func(path string, info os.FileInfo, ferr error) error {
+ files = append(files, fileMeta{Path: path, IsDir: info.IsDir()})
+ return nil
+ })
+ if ferr != nil {
+ return diag.Errorf("Failed to fetch file path %s", ferr)
+ }
+ // create a zip
+ archive, ferr := os.Create(zipFileName)
+ if ferr != nil {
+ return diag.Errorf("Failed to create zip %s", ferr)
+ }
+ defer archive.Close()
+ zipWriter := zip.NewWriter(archive)
+
+ for _, f := range files {
+ if !f.IsDir {
+ fPath := f.Path
+
+ w, ferr := zipWriter.Create(path.Base(fPath))
+ if ferr != nil {
+ return diag.Errorf("Failed to create base path for zip %s", ferr)
+ }
+
+ file, ferr := os.Open(f.Path)
+ if ferr != nil {
+ return diag.Errorf("Failed to open the original file %s", ferr)
+ }
+ defer file.Close()
+
+ if _, ferr = io.Copy(w, file); ferr != nil {
+ return diag.Errorf("Failed to copy the file to zip %s", ferr)
+ }
+ }
+ }
+ zipWriter.Close()
+ }
+
return nil
}
@@ -834,7 +890,7 @@ func (g *GenesysCloudResourceExporter) buildSanitizedResourceMaps(exporters map[
}
if containsPermissionsErrorOnly(err) && logErrors {
log.Printf("%v", err[0].Summary)
- log.Print("log_permission_errors = true. Resuming export...")
+ log.Printf("Logging permission error for %s. Resuming export...", name)
return
}
if err != nil {
@@ -854,6 +910,7 @@ func (g *GenesysCloudResourceExporter) buildSanitizedResourceMaps(exporters map[
go func() {
wg.Wait()
+ log.Print(`Finished building sanitized resource maps`)
close(wgDone)
}()
@@ -1138,7 +1195,7 @@ func (g *GenesysCloudResourceExporter) sanitizeConfigMap(
resourceName string,
configMap map[string]interface{},
prevAttr string,
- exporters map[string]*resourceExporter.ResourceExporter, //Map of all of the exporters
+ exporters map[string]*resourceExporter.ResourceExporter, //Map of all exporters
exportingState bool,
exportingAsHCL bool,
parentKey bool) ([]unresolvableAttributeInfo, bool) {
@@ -1258,7 +1315,7 @@ func (g *GenesysCloudResourceExporter) sanitizeConfigMap(
// This can cause invalid config files due to including attributes with limits that don't allow for zero values, so we remove
// those attributes from the config by default. Attributes can opt-out of this behavior by being added to a ResourceExporter's
// AllowZeroValues list.
- if !exporter.AllowForZeroValues(currAttr) {
+ if !exporter.AllowForZeroValues(currAttr) && !exporter.AllowForZeroValuesInMap(prevAttr) {
removeZeroValues(key, configMap[key], configMap)
}
diff --git a/genesyscloud/tfexporter/genesyscloud_resource_exporter_test.go b/genesyscloud/tfexporter/genesyscloud_resource_exporter_test.go
index e1b4a0619..1f85ff1ff 100644
--- a/genesyscloud/tfexporter/genesyscloud_resource_exporter_test.go
+++ b/genesyscloud/tfexporter/genesyscloud_resource_exporter_test.go
@@ -4,7 +4,7 @@ import (
"context"
"fmt"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"reflect"
"terraform-provider-genesyscloud/genesyscloud/provider"
resourceExporter "terraform-provider-genesyscloud/genesyscloud/resource_exporter"
diff --git a/genesyscloud/tfexporter/resource_genesyscloud_tf_export.go b/genesyscloud/tfexporter/resource_genesyscloud_tf_export.go
index ff21b8582..44b727ab7 100644
--- a/genesyscloud/tfexporter/resource_genesyscloud_tf_export.go
+++ b/genesyscloud/tfexporter/resource_genesyscloud_tf_export.go
@@ -5,17 +5,23 @@ import (
"fmt"
"os"
"path/filepath"
- gcloud "terraform-provider-genesyscloud/genesyscloud/validators"
+ "terraform-provider-genesyscloud/genesyscloud/validators"
resourceExporter "terraform-provider-genesyscloud/genesyscloud/resource_exporter"
registrar "terraform-provider-genesyscloud/genesyscloud/resource_register"
+ "terraform-provider-genesyscloud/genesyscloud/tfexporter_state"
+
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "terraform-provider-genesyscloud/genesyscloud/tfexporter_state"
)
+type fileMeta struct {
+ Path string
+ IsDir bool
+}
+
func SetRegistrar(l registrar.Registrar) {
l.RegisterResource("genesyscloud_tf_export", ResourceTfExport())
@@ -48,7 +54,7 @@ func ResourceTfExport() *schema.Resource {
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
- ValidateFunc: gcloud.ValidateSubStringInSlice(resourceExporter.GetAvailableExporterTypes()),
+ ValidateFunc: validators.ValidateSubStringInSlice(resourceExporter.GetAvailableExporterTypes()),
},
ForceNew: true,
Deprecated: "Use include_filter_resources attribute instead",
@@ -60,7 +66,7 @@ func ResourceTfExport() *schema.Resource {
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
- ValidateFunc: gcloud.ValidateSubStringInSlice(resourceExporter.GetAvailableExporterTypes()),
+ ValidateFunc: validators.ValidateSubStringInSlice(resourceExporter.GetAvailableExporterTypes()),
},
ForceNew: true,
ConflictsWith: []string{"resource_types", "exclude_filter_resources"},
@@ -80,7 +86,7 @@ func ResourceTfExport() *schema.Resource {
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
- ValidateFunc: gcloud.ValidateSubStringInSlice(resourceExporter.GetAvailableExporterTypes()),
+ ValidateFunc: validators.ValidateSubStringInSlice(resourceExporter.GetAvailableExporterTypes()),
},
ForceNew: true,
ConflictsWith: []string{"resource_types", "include_filter_resources"},
@@ -134,6 +140,13 @@ func ResourceTfExport() *schema.Resource {
Default: true,
ForceNew: true,
},
+ "compress": {
+ Description: "Compress exported results using zip format",
+ Type: schema.TypeBool,
+ Optional: true,
+ Default: false,
+ ForceNew: true,
+ },
},
}
}
diff --git a/genesyscloud/tfexporter/resource_genesyscloud_tf_export_test.go b/genesyscloud/tfexporter/resource_genesyscloud_tf_export_test.go
index d225adea1..4b91ebe6d 100644
--- a/genesyscloud/tfexporter/resource_genesyscloud_tf_export_test.go
+++ b/genesyscloud/tfexporter/resource_genesyscloud_tf_export_test.go
@@ -1,6 +1,8 @@
package tfexporter
import (
+ "archive/zip"
+ "bytes"
"encoding/json"
"fmt"
"io"
@@ -23,7 +25,7 @@ import (
"testing"
"time"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"terraform-provider-genesyscloud/genesyscloud/util/testrunner"
@@ -124,6 +126,62 @@ func TestAccResourceTfExportIncludeFilterResourcesByRegEx(t *testing.T) {
})
}
+// TestAccResourceTfExportIncludeFilterResourcesByRegExAndSanitizedNames will create 3 queues (two with foo bar, one to be excluded).
+// The test ensures that resources can be exported directly by their actual name or their sanitized names.
+func TestAccResourceTfExportIncludeFilterResourcesByRegExAndSanitizedNames(t *testing.T) {
+ var (
+ exportTestDir = "../.terraformregex" + uuid.NewString()
+ exportResource = "test-export3_1"
+
+ queueResources = []QueueExport{
+ {ResourceName: "test-queue-test-1", Name: "include filter test - exclude me", Description: "This is an excluded bar test resource", AcwTimeoutMs: 200000},
+ {ResourceName: "test-queue-test-2", Name: "include filter test - foo - bar me", Description: "This is a foo bar test resource", AcwTimeoutMs: 200000},
+ {ResourceName: "test-queue-test-3", Name: "include filter test - fu - barre you", Description: "This is a foo bar test resource", AcwTimeoutMs: 200000},
+ }
+ )
+ defer os.RemoveAll(exportTestDir)
+
+ queueResourceDef := buildQueueResources(queueResources)
+
+ config := queueResourceDef +
+ generateTfExportByIncludeFilterResources(
+ exportResource,
+ exportTestDir,
+ util.TrueValue,
+ []string{
+ strconv.Quote("genesyscloud_routing_queue::include filter test - foo - bar me"), // Unsanitized Named Resource
+ strconv.Quote("genesyscloud_routing_queue::include_filter_test_-_fu_-_barre_you"), // Sanitized Named Resource
+ },
+ util.FalseValue,
+ util.FalseValue,
+ []string{
+ strconv.Quote("genesyscloud_routing_queue." + queueResources[0].ResourceName),
+ strconv.Quote("genesyscloud_routing_queue." + queueResources[1].ResourceName),
+ strconv.Quote("genesyscloud_routing_queue." + queueResources[2].ResourceName),
+ },
+ )
+
+ sanitizer := resourceExporter.NewSanitizerProvider()
+
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { util.TestAccPreCheck(t) },
+ ProviderFactories: provider.GetProviderFactories(providerResources, providerDataSources),
+ Steps: []resource.TestStep{
+ {
+ // Generate a queue as well and export it
+ Config: config,
+ // Wait for a specified duration to avoid runtime error
+ Check: resource.ComposeTestCheckFunc(
+ testQueueExportEqual(exportTestDir+"/"+defaultTfJSONFile, "genesyscloud_routing_queue", sanitizer.S.SanitizeResourceName(queueResources[1].Name), queueResources[1]),
+ testQueueExportEqual(exportTestDir+"/"+defaultTfJSONFile, "genesyscloud_routing_queue", sanitizer.S.SanitizeResourceName(queueResources[2].Name), queueResources[2]),
+ testQueueExportExcludesRegEx(exportTestDir+"/"+defaultTfJSONFile, "genesyscloud_routing_queue", ".*exclude me.*"), //We should not find any "test" queues here because we only wanted to include queues that ended with a -prod
+ ),
+ },
+ },
+ CheckDestroy: testVerifyExportsDestroyedFunc(exportTestDir),
+ })
+}
+
// TestAccResourceTfExportIncludeFilterResourcesByRegExExclusiveToResource
// will create two queues (one with a -prod suffix and one with a -test suffix)
// and two wrap up codes (one with a -prod suffix and one with a -test suffix)
@@ -260,6 +318,78 @@ func TestAccResourceTfExportExcludeFilterResourcesByRegExExclusiveToResource(t *
})
}
+// TestAccResourceTfExportExcludeFilterResourcesByRegExExclusiveToResourceAndSanitizedNames will exclude any test resources that match a
+// regular expression provided for the resource. In this test we check against both sanitized and unsanitized names.
+func TestAccResourceTfExportExcludeFilterResourcesByRegExExclusiveToResourceAndSanitizedNames(t *testing.T) {
+ var (
+ exportTestDir = "../.terraformExclude" + uuid.NewString()
+ exportResource = "test-export6_1"
+
+ queueResources = []QueueExport{
+ {ResourceName: "test-queue-test-1", Name: "exclude filter - exclude me", Description: "This is an excluded bar test resource", AcwTimeoutMs: 200000},
+ {ResourceName: "test-queue-test-2", Name: "exclude filter - foo - bar me", Description: "This is a foo bar test resource", AcwTimeoutMs: 200000},
+ {ResourceName: "test-queue-test-3", Name: "exclude filter - fu - barre you", Description: "This is a foo bar test resource", AcwTimeoutMs: 200000},
+ }
+
+ wrapupCodeResources = []WrapupcodeExport{
+ {ResourceName: "test-wrapupcode-prod", Name: "exclude me"},
+ {ResourceName: "test-wrapupcode-test", Name: "foo + bar me"},
+ {ResourceName: "test-wrapupcode-dev", Name: "fu - barre you"},
+ }
+ )
+ defer os.RemoveAll(exportTestDir)
+
+ queueResourceDef := buildQueueResources(queueResources)
+ wrapupcodeResourceDef := buildWrapupcodeResources(wrapupCodeResources)
+ config := queueResourceDef + wrapupcodeResourceDef +
+ generateTfExportByExcludeFilterResources(
+ exportResource,
+ exportTestDir,
+ util.TrueValue,
+ []string{
+ strconv.Quote("genesyscloud_routing_queue::exclude filter - foo - bar me"),
+ strconv.Quote("genesyscloud_routing_queue::exclude_filter_-_fu_-_barre_you"),
+ strconv.Quote("genesyscloud_outbound_ruleset"),
+ strconv.Quote("genesyscloud_user"),
+ strconv.Quote("genesyscloud_user_roles"),
+ strconv.Quote("genesyscloud_flow"),
+ },
+ util.FalseValue,
+ util.FalseValue,
+ []string{
+ strconv.Quote("genesyscloud_routing_queue." + queueResources[0].ResourceName),
+ strconv.Quote("genesyscloud_routing_queue." + queueResources[1].ResourceName),
+ strconv.Quote("genesyscloud_routing_queue." + queueResources[2].ResourceName),
+ strconv.Quote("genesyscloud_routing_wrapupcode." + wrapupCodeResources[0].ResourceName),
+ strconv.Quote("genesyscloud_routing_wrapupcode." + wrapupCodeResources[1].ResourceName),
+ strconv.Quote("genesyscloud_routing_wrapupcode." + wrapupCodeResources[2].ResourceName),
+ },
+ )
+
+ sanitizer := resourceExporter.NewSanitizerProvider()
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { util.TestAccPreCheck(t) },
+ ProviderFactories: provider.GetProviderFactories(providerResources, providerDataSources),
+ Steps: []resource.TestStep{
+ {
+ PreConfig: func() {
+ time.Sleep(30 * time.Second)
+ },
+ // Generate a queue as well and export it
+ Config: config,
+ Check: resource.ComposeTestCheckFunc(
+ testQueueExportEqual(exportTestDir+"/"+defaultTfJSONFile, "genesyscloud_routing_queue", sanitizer.S.SanitizeResourceName(queueResources[0].Name), queueResources[0]),
+ testWrapupcodeExportEqual(exportTestDir+"/"+defaultTfJSONFile, "genesyscloud_routing_wrapupcode", sanitizer.S.SanitizeResourceName(wrapupCodeResources[0].Name), wrapupCodeResources[0]),
+ testWrapupcodeExportEqual(exportTestDir+"/"+defaultTfJSONFile, "genesyscloud_routing_wrapupcode", sanitizer.S.SanitizeResourceName(wrapupCodeResources[1].Name), wrapupCodeResources[1]),
+ testWrapupcodeExportEqual(exportTestDir+"/"+defaultTfJSONFile, "genesyscloud_routing_wrapupcode", sanitizer.S.SanitizeResourceName(wrapupCodeResources[2].Name), wrapupCodeResources[2]),
+ testQueueExportExcludesRegEx(exportTestDir+"/"+defaultTfJSONFile, "genesyscloud_routing_queue", "(foo|fu)"),
+ ),
+ },
+ },
+ CheckDestroy: testVerifyExportsDestroyedFunc(exportTestDir),
+ })
+}
+
// TestAccResourceTfExportSplitFilesAsJSON will create 2 queues, 2 wrap up codes, and 2 users.
// The exporter will be run in split mode so 3 resource tf.jsons should be created as well as a provider.tf.json
func TestAccResourceTfExportSplitFilesAsJSON(t *testing.T) {
@@ -334,6 +464,39 @@ func TestAccResourceTfExportSplitFilesAsJSON(t *testing.T) {
})
}
+// TestAccResourceTfExportForCompress does a basic test check to make sure the compressed file is created.
+func TestAccResourceTfExportForCompress(t *testing.T) {
+ var (
+ exportTestDir = "../../.terraform" + uuid.NewString()
+ exportResource1 = "test-export1"
+ zipFileName = "../archive_genesyscloud_tf_export*"
+ )
+
+ defer os.RemoveAll(exportTestDir)
+
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { util.TestAccPreCheck(t) },
+ ProviderFactories: provider.GetProviderFactories(providerResources, providerDataSources),
+ Steps: []resource.TestStep{
+ {
+ // Run export without state file
+ Config: generateTfExportResourceForCompress(
+ exportResource1,
+ exportTestDir,
+ util.TrueValue,
+ util.TrueValue,
+ "",
+ ),
+ Check: resource.ComposeTestCheckFunc(
+ validateCompressedCreated(zipFileName),
+ validateCompressedFile(zipFileName),
+ ),
+ },
+ },
+ CheckDestroy: deleteTestCompressedZip(exportTestDir, zipFileName),
+ })
+}
+
// TestAccResourceTfExport does a basic test check to make sure the export file is created.
func TestAccResourceTfExport(t *testing.T) {
var (
@@ -1367,7 +1530,7 @@ resource "genesyscloud_outbound_campaign" "%s" {
resource "genesyscloud_script" "script" {
script_name = "%s"
filepath = "%s"
- file_content_hash = filesha256("%s")
+ file_content_hash = filesha256("%s")
}
data "genesyscloud_auth_division_home" "home" {}
@@ -2129,8 +2292,8 @@ func generateTfExportResource(
"genesyscloud_architect_datatable",
"genesyscloud_architect_datatable_row",
//"genesyscloud_flow",
- "genesyscloud_flow_milestone",
- //"genesyscloud_flow_outcome",
+ "genesyscloud_flow_milestone",
+ //"genesyscloud_flow_outcome",
"genesyscloud_architect_ivr",
"genesyscloud_architect_schedules",
"genesyscloud_architect_schedulegroups",
@@ -2179,6 +2342,25 @@ func generateTfExportResource(
`, resourceID, directory, includeState, excludedAttributes)
}
+// generateTfExportResourceForCompress creates a resource to test compressed exported results
+func generateTfExportResourceForCompress(
+ resourceID string,
+ directory string,
+ includeState string,
+ compressFlag string,
+ excludedAttributes string) string {
+ return fmt.Sprintf(`resource "genesyscloud_tf_export" "%s" {
+ directory = "%s"
+ include_state_file = %s
+ compress=%s
+ resource_types = [
+ "genesyscloud_architect_datatable",
+ ]
+ exclude_attributes = [%s]
+ }
+ `, resourceID, directory, includeState, compressFlag, excludedAttributes)
+}
+
func generateTfExportResourceMin(
resourceID string,
directory string,
@@ -2303,6 +2485,40 @@ func validateFileCreated(filename string) resource.TestCheckFunc {
}
}
+func validateCompressedCreated(filename string) resource.TestCheckFunc {
+ return func(state *terraform.State) error {
+ _, err := filepath.Glob(filename)
+ if err != nil {
+ return fmt.Errorf("Failed to find file")
+ }
+ return nil
+ }
+}
+
+func deleteTestCompressedZip(exportPath string, zipFileName string) resource.TestCheckFunc {
+ return func(state *terraform.State) error {
+ dir, err := os.ReadDir(exportPath)
+ if err != nil {
+ return fmt.Errorf("Failed to read compressed zip %s", exportPath)
+ }
+ for _, d := range dir {
+ os.RemoveAll(filepath.Join(exportPath, d.Name()))
+ }
+ files, err := filepath.Glob(zipFileName)
+
+ if err != nil {
+ return fmt.Errorf("Failed to get zip: %s", err)
+ }
+ for _, f := range files {
+ if err := os.Remove(f); err != nil {
+ return fmt.Errorf("Failed to delete: %s", err)
+ }
+ }
+
+ return nil
+ }
+}
+
func testVerifyExportsDestroyedFunc(exportTestDir string) resource.TestCheckFunc {
return func(state *terraform.State) error {
// Check config file deleted
@@ -2337,6 +2553,56 @@ func validateEvaluationFormAttributes(resourceName string, form gcloud.Evaluatio
)
}
+// validateCompressedFile unzips and validates the exported resulted in the compressed folder
+func validateCompressedFile(path string) resource.TestCheckFunc {
+ return func(state *terraform.State) error {
+ files, err := filepath.Glob(path)
+ if err != nil {
+ return err
+ }
+ for _, f := range files {
+ reader, err := zip.OpenReader(f)
+ if err != nil {
+ return err
+ }
+ for _, file := range reader.File {
+ err = validateCompressedConfigFiles(f, file)
+ if err != nil {
+ return err
+ }
+ }
+ }
+ return nil
+ }
+}
+
+// validateCompressedConfigFiles validates the data inside the compressed json file
+func validateCompressedConfigFiles(dirName string, file *zip.File) error {
+
+ if file.FileInfo().Name() == defaultTfJSONFile {
+ rc, _ := file.Open()
+
+ buf := new(bytes.Buffer)
+ buf.ReadFrom(rc)
+ var data map[string]interface{}
+
+ if err := json.Unmarshal(buf.Bytes(), &data); err != nil {
+ return fmt.Errorf("failed to unmarshal json exportData to map variable: %v", err)
+ }
+
+ if _, ok := data["resource"]; !ok {
+ return fmt.Errorf("config file missing resource attribute")
+ }
+
+ if _, ok := data["terraform"]; !ok {
+ return fmt.Errorf("config file missing terraform attribute")
+ }
+ rc.Close()
+ return nil
+ }
+ return nil
+}
+
func validateConfigFile(path string) resource.TestCheckFunc {
return func(state *terraform.State) error {
result, err := loadJsonFileToMap(path)
diff --git a/genesyscloud/tfexporter/tf_exporter_resource_test.go b/genesyscloud/tfexporter/tf_exporter_resource_test.go
index 3ea8cfa57..e2bb97141 100644
--- a/genesyscloud/tfexporter/tf_exporter_resource_test.go
+++ b/genesyscloud/tfexporter/tf_exporter_resource_test.go
@@ -7,8 +7,11 @@ import (
emergencyGroup "terraform-provider-genesyscloud/genesyscloud/architect_emergencygroup"
flow "terraform-provider-genesyscloud/genesyscloud/architect_flow"
flowLogLevel "terraform-provider-genesyscloud/genesyscloud/flow_loglevel"
+ outboundContactListContact "terraform-provider-genesyscloud/genesyscloud/outbound_contact_list_contact"
+ routingSettings "terraform-provider-genesyscloud/genesyscloud/routing_settings"
+ routingUtilization "terraform-provider-genesyscloud/genesyscloud/routing_utilization"
+ routingUtilizationLabel "terraform-provider-genesyscloud/genesyscloud/routing_utilization_label"
outboundRoute "terraform-provider-genesyscloud/genesyscloud/telephony_providers_edges_site_outbound_route"
-
grammar "terraform-provider-genesyscloud/genesyscloud/architect_grammar"
grammarLanguage "terraform-provider-genesyscloud/genesyscloud/architect_grammar_language"
archIvr "terraform-provider-genesyscloud/genesyscloud/architect_ivr"
@@ -151,9 +154,9 @@ func (r *registerTestInstance) registerTestResources() {
providerResources["genesyscloud_routing_queue_conditional_group_routing"] = routingQueueConditionalGroupRouting.ResourceRoutingQueueConditionalGroupRouting()
providerResources["genesyscloud_routing_queue_outbound_email_address"] = routingQueueOutboundEmailAddress.ResourceRoutingQueueOutboundEmailAddress()
providerResources["genesyscloud_routing_skill"] = gcloud.ResourceRoutingSkill()
- providerResources["genesyscloud_routing_settings"] = gcloud.ResourceRoutingSettings()
- providerResources["genesyscloud_routing_utilization"] = gcloud.ResourceRoutingUtilization()
-
+ providerResources["genesyscloud_routing_settings"] = routingSettings.ResourceRoutingSettings()
+ providerResources["genesyscloud_routing_utilization"] = routingUtilization.ResourceRoutingUtilization()
+ providerResources["genesyscloud_routing_utilization_label"] = routingUtilizationLabel.ResourceRoutingUtilizationLabel()
providerResources["genesyscloud_routing_wrapupcode"] = gcloud.ResourceRoutingWrapupCode()
providerResources["genesyscloud_telephony_providers_edges_extension_pool"] = edgeExtension.ResourceTelephonyExtensionPool()
providerResources["genesyscloud_telephony_providers_edges_phone"] = edgePhone.ResourcePhone()
@@ -175,6 +178,7 @@ func (r *registerTestInstance) registerTestResources() {
providerResources["genesyscloud_outbound_callabletimeset"] = obCallableTimeset.ResourceOutboundCallabletimeset()
providerResources["genesyscloud_outbound_campaign"] = obCampaign.ResourceOutboundCampaign()
providerResources["genesyscloud_outbound_contact_list"] = outboundContactList.ResourceOutboundContactList()
+ providerResources["genesyscloud_outbound_contact_list_contact"] = outboundContactListContact.ResourceOutboundContactListContact()
providerResources["genesyscloud_outbound_contactlistfilter"] = obContactListFilter.ResourceOutboundContactlistfilter()
providerResources["genesyscloud_outbound_messagingcampaign"] = ob.ResourceOutboundMessagingCampaign()
providerResources["genesyscloud_outbound_sequence"] = obSequence.ResourceOutboundSequence()
@@ -240,6 +244,7 @@ func (r *registerTestInstance) registerTestExporters() {
RegisterExporter("genesyscloud_outbound_callabletimeset", obCallableTimeset.OutboundCallableTimesetExporter())
RegisterExporter("genesyscloud_outbound_campaign", obCampaign.OutboundCampaignExporter())
RegisterExporter("genesyscloud_outbound_contact_list", outboundContactList.OutboundContactListExporter())
+ RegisterExporter("genesyscloud_outbound_contact_list_contact", outboundContactListContact.ContactExporter())
RegisterExporter("genesyscloud_outbound_contactlistfilter", obContactListFilter.OutboundContactlistfilterExporter())
RegisterExporter("genesyscloud_outbound_messagingcampaign", ob.OutboundMessagingcampaignExporter())
RegisterExporter("genesyscloud_outbound_sequence", obSequence.OutboundSequenceExporter())
@@ -260,11 +265,12 @@ func (r *registerTestInstance) registerTestExporters() {
RegisterExporter("genesyscloud_routing_queue", routingQueue.RoutingQueueExporter())
RegisterExporter("genesyscloud_routing_queue_conditional_group_routing", routingQueueConditionalGroupRouting.RoutingQueueConditionalGroupRoutingExporter())
RegisterExporter("genesyscloud_routing_queue_outbound_email_address", routingQueueOutboundEmailAddress.OutboundRoutingQueueOutboundEmailAddressExporter())
- RegisterExporter("genesyscloud_routing_settings", gcloud.RoutingSettingsExporter())
+ RegisterExporter("genesyscloud_routing_settings", routingSettings.RoutingSettingsExporter())
RegisterExporter("genesyscloud_routing_skill", gcloud.RoutingSkillExporter())
RegisterExporter("genesyscloud_routing_skill_group", gcloud.ResourceSkillGroupExporter())
RegisterExporter("genesyscloud_routing_sms_address", routingSmsAddress.RoutingSmsAddressExporter())
- RegisterExporter("genesyscloud_routing_utilization", gcloud.RoutingUtilizationExporter())
+ RegisterExporter("genesyscloud_routing_utilization", routingUtilization.RoutingUtilizationExporter())
+ RegisterExporter("genesyscloud_routing_utilization_label", routingUtilizationLabel.RoutingUtilizationLabelExporter())
RegisterExporter("genesyscloud_routing_wrapupcode", gcloud.RoutingWrapupCodeExporter())
RegisterExporter("genesyscloud_telephony_providers_edges_edge_group", edgeGroup.EdgeGroupExporter())
RegisterExporter("genesyscloud_telephony_providers_edges_extension_pool", edgeExtension.TelephonyExtensionPoolExporter())
diff --git a/genesyscloud/user_roles/genesyscloud_user_roles_proxy.go b/genesyscloud/user_roles/genesyscloud_user_roles_proxy.go
index c82c59768..348ca624b 100644
--- a/genesyscloud/user_roles/genesyscloud_user_roles_proxy.go
+++ b/genesyscloud/user_roles/genesyscloud_user_roles_proxy.go
@@ -7,7 +7,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
var internalProxy *userRolesProxy
diff --git a/genesyscloud/user_roles/resource_genesyscloud_user_roles_utils.go b/genesyscloud/user_roles/resource_genesyscloud_user_roles_utils.go
index 629bc643c..9f58a8e8a 100644
--- a/genesyscloud/user_roles/resource_genesyscloud_user_roles_utils.go
+++ b/genesyscloud/user_roles/resource_genesyscloud_user_roles_utils.go
@@ -7,7 +7,7 @@ import (
"terraform-provider-genesyscloud/genesyscloud/util/lists"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func flattenSubjectRoles(d *schema.ResourceData, p *userRolesProxy) (*schema.Set, *platformclientv2.APIResponse, error) {
diff --git a/genesyscloud/util/feature_toggles/outbound_routes.go b/genesyscloud/util/feature_toggles/outbound_routes.go
index d3bf3d035..b2f143601 100644
--- a/genesyscloud/util/feature_toggles/outbound_routes.go
+++ b/genesyscloud/util/feature_toggles/outbound_routes.go
@@ -2,14 +2,14 @@ package feature_toggles
import "os"
-const outboundRotesEnvToggle = "ENABLE_STANDALONE_OUTBOUND_ROUTES"
+const outboundRoutesEnvToggle = "ENABLE_STANDALONE_OUTBOUND_ROUTES"
func OutboundRoutesToggleName() string {
- return outboundRotesEnvToggle
+ return outboundRoutesEnvToggle
}
func OutboundRoutesToggleExists() bool {
var exists bool
- _, exists = os.LookupEnv(outboundRotesEnvToggle)
+ _, exists = os.LookupEnv(outboundRoutesEnvToggle)
return exists
}
diff --git a/genesyscloud/util/lists/util_lists.go b/genesyscloud/util/lists/util_lists.go
index 58c13fdce..916c9b0fe 100644
--- a/genesyscloud/util/lists/util_lists.go
+++ b/genesyscloud/util/lists/util_lists.go
@@ -171,3 +171,15 @@ func Remove[T comparable](s []T, r T) []T {
}
return s
}
+
+// ConvertMapStringAnyToMapStringString converts a map of type map[string]any to type map[string]string
+func ConvertMapStringAnyToMapStringString(m map[string]any) map[string]string {
+ if m == nil {
+ return nil
+ }
+ sm := make(map[string]string)
+ for k, v := range m {
+ sm[k] = v.(string)
+ }
+ return sm
+}
diff --git a/genesyscloud/util/resourcedata/resourcedata.go b/genesyscloud/util/resourcedata/resourcedata.go
index 89bb58ff2..066abcfc9 100644
--- a/genesyscloud/util/resourcedata/resourcedata.go
+++ b/genesyscloud/util/resourcedata/resourcedata.go
@@ -6,7 +6,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/leekchan/timeutil"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
const (
@@ -141,27 +141,27 @@ func SetNillableReferenceDivision(d *schema.ResourceData, key string, value *pla
// SetNillableValue will read a basic type and set it on the schema
func SetNillableValue[T any](d *schema.ResourceData, key string, value *T) {
if value != nil {
- d.Set(key, *value)
+ _ = d.Set(key, *value)
} else {
- d.Set(key, nil)
+ _ = d.Set(key, nil)
}
}
-// SetNillableValueWithInterfaceArrayWithFunc will read the values in a nested resource using the provided function and set it on the schema
+// SetNillableValueWithInterfaceArrayWithFunc will set the value of {key} to an interface array using func {f} if {value} is not nil
func SetNillableValueWithInterfaceArrayWithFunc[T any](d *schema.ResourceData, key string, value *T, f func(*T) []interface{}) {
if value != nil {
- d.Set(key, f(value))
+ _ = d.Set(key, f(value))
} else {
- d.Set(key, nil)
+ _ = d.Set(key, nil)
}
}
-// SetNillableValueWithInterfaceArrayWithFunc will read the values in a nested resource using the provided function and set it on the schema
+// SetNillableValueWithSchemaSetWithFunc will set the value of {key} to a *schema.Set using func {f} if {value} is not nil
func SetNillableValueWithSchemaSetWithFunc[T any](d *schema.ResourceData, key string, value *T, f func(*T) *schema.Set) {
if value != nil {
- d.Set(key, f(value))
+ _ = d.Set(key, f(value))
} else {
- d.Set(key, nil)
+ _ = d.Set(key, nil)
}
}
diff --git a/genesyscloud/util/test_utils.go b/genesyscloud/util/test_utils.go
index ff2e31a2c..a232e5ce0 100644
--- a/genesyscloud/util/test_utils.go
+++ b/genesyscloud/util/test_utils.go
@@ -308,8 +308,7 @@ func GenerateMapProperty(propName string, propValue string) string {
func GenerateMapAttr(name string, properties ...string) string {
return fmt.Sprintf(`%s = {
%s
- }
- `, name, strings.Join(properties, "\n"))
+ }`, name, strings.Join(properties, "\n"))
}
func GenerateMapAttrWithMapProperties(name string, properties map[string]string) string {
diff --git a/genesyscloud/util/util_basesetting_properties.go b/genesyscloud/util/util_basesetting_properties.go
index c442d7681..44c0ea6de 100644
--- a/genesyscloud/util/util_basesetting_properties.go
+++ b/genesyscloud/util/util_basesetting_properties.go
@@ -8,7 +8,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func BuildTelephonyProperties(d *schema.ResourceData) *map[string]interface{} {
diff --git a/genesyscloud/util/util_diagnostic_unit_test.go b/genesyscloud/util/util_diagnostic_unit_test.go
index f6dd193fb..ec9fb4b9f 100644
--- a/genesyscloud/util/util_diagnostic_unit_test.go
+++ b/genesyscloud/util/util_diagnostic_unit_test.go
@@ -2,7 +2,7 @@ package util
import (
"encoding/json"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"github.com/stretchr/testify/assert"
"net/http"
"net/url"
diff --git a/genesyscloud/util/util_diagnostics.go b/genesyscloud/util/util_diagnostics.go
index 8095bf9c7..7a707a3f0 100644
--- a/genesyscloud/util/util_diagnostics.go
+++ b/genesyscloud/util/util_diagnostics.go
@@ -5,7 +5,7 @@ import (
"errors"
"fmt"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
type detailedDiagnosticInfo struct {
diff --git a/genesyscloud/util/util_divisions.go b/genesyscloud/util/util_divisions.go
index ff49af4c9..91f269645 100644
--- a/genesyscloud/util/util_divisions.go
+++ b/genesyscloud/util/util_divisions.go
@@ -9,7 +9,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
type JsonMap map[string]interface{}
diff --git a/genesyscloud/util/util_domainentities.go b/genesyscloud/util/util_domainentities.go
index c06bb345b..a72921b5b 100644
--- a/genesyscloud/util/util_domainentities.go
+++ b/genesyscloud/util/util_domainentities.go
@@ -4,7 +4,7 @@ import (
lists "terraform-provider-genesyscloud/genesyscloud/util/lists"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func BuildSdkDomainEntityRef(d *schema.ResourceData, idAttr string) *platformclientv2.Domainentityref {
diff --git a/genesyscloud/util/util_retries.go b/genesyscloud/util/util_retries.go
index a20568128..8c819c434 100644
--- a/genesyscloud/util/util_retries.go
+++ b/genesyscloud/util/util_retries.go
@@ -14,7 +14,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func WithRetries(ctx context.Context, timeout time.Duration, method func() *retry.RetryError) diag.Diagnostics {
diff --git a/genesyscloud/validators/validators.go b/genesyscloud/validators/validators.go
index 4c4a78a9d..a375e6bd6 100644
--- a/genesyscloud/validators/validators.go
+++ b/genesyscloud/validators/validators.go
@@ -94,7 +94,7 @@ func ValidateRrule(rrule interface{}, _ cty.Path) diag.Diagnostics {
return diag.Errorf("Provided rrule %v is not in string format", rrule)
}
-// Validates a phone extension pool
+// ValidateExtensionPool validates a phone extension pool
func ValidateExtensionPool(number interface{}, _ cty.Path) diag.Diagnostics {
if numberStr, ok := number.(string); ok {
@@ -109,7 +109,7 @@ func ValidateExtensionPool(number interface{}, _ cty.Path) diag.Diagnostics {
return diag.Errorf("Extension provided %v is not a string", number)
}
-// Validates a date string is in the format yyyy-MM-dd
+// ValidateDate validates a date string is in the format yyyy-MM-dd
func ValidateDate(date interface{}, _ cty.Path) diag.Diagnostics {
if dateStr, ok := date.(string); ok {
_, err := time.Parse(resourcedata.DateParseFormat, dateStr)
@@ -121,7 +121,7 @@ func ValidateDate(date interface{}, _ cty.Path) diag.Diagnostics {
return diag.Errorf("Date %v is not a string", date)
}
-// Validates a date string is in the format 2006-01-02T15:04Z
+// ValidateDateTime validates a date string is in the format 2006-01-02T15:04Z
func ValidateDateTime(date interface{}, _ cty.Path) diag.Diagnostics {
if dateStr, ok := date.(string); ok {
_, err := time.Parse("2006-01-02T15:04Z", dateStr)
@@ -133,7 +133,7 @@ func ValidateDateTime(date interface{}, _ cty.Path) diag.Diagnostics {
return diag.Errorf("Date %v is not a string", date)
}
-// Validates a country code is in format ISO 3166-1 alpha-2
+// ValidateCountryCode validates a country code is in format ISO 3166-1 alpha-2
func ValidateCountryCode(code interface{}, _ cty.Path) diag.Diagnostics {
countryCode := code.(string)
if len(countryCode) == 2 {
@@ -144,7 +144,7 @@ func ValidateCountryCode(code interface{}, _ cty.Path) diag.Diagnostics {
return diag.Errorf("Country code %v is not of format ISO 3166-1 alpha-2", code)
}
-// Validates a date string is in format hh:mm:ss
+// ValidateTime validates a date string is in format hh:mm:ss
func ValidateTime(time interface{}, _ cty.Path) diag.Diagnostics {
timeStr := time.(string)
if len(timeStr) > 9 {
@@ -157,7 +157,7 @@ func ValidateTime(time interface{}, _ cty.Path) diag.Diagnostics {
return diag.Errorf("Time %v is not a valid time", time)
}
-// Validates a date string is in format hh:mm
+// ValidateTimeHHMM validates a date string is in format hh:mm
func ValidateTimeHHMM(time interface{}, _ cty.Path) diag.Diagnostics {
timeStr := time.(string)
if timeStr == "" {
@@ -171,7 +171,7 @@ func ValidateTimeHHMM(time interface{}, _ cty.Path) diag.Diagnostics {
return diag.Errorf("Time %v is not a valid time, must use format HH:mm", time)
}
-// Validates a date string is in the format 2006-01-02T15:04:05.000000
+// ValidateLocalDateTimes validates a date string is in the format 2006-01-02T15:04:05.000000
func ValidateLocalDateTimes(date interface{}, _ cty.Path) diag.Diagnostics {
if dateStr, ok := date.(string); ok {
_, err := time.Parse(resourcedata.TimeParseFormat, dateStr)
@@ -183,7 +183,7 @@ func ValidateLocalDateTimes(date interface{}, _ cty.Path) diag.Diagnostics {
return diag.Errorf("Date %v is not a string", date)
}
-// Validates a file path or URL
+// ValidatePath validates a file path or URL
func ValidatePath(i interface{}, k string) (warnings []string, errors []error) {
v, ok := i.(string)
if !ok {
@@ -207,7 +207,7 @@ func ValidatePath(i interface{}, k string) (warnings []string, errors []error) {
return warnings, errors
}
-// Validate a response asset filename matches the criteria outlined in the description
+// ValidateResponseAssetName validate a response asset filename matches the criteria outlined in the description
func ValidateResponseAssetName(name interface{}, _ cty.Path) diag.Diagnostics {
if nameStr, ok := name.(string); ok {
matched, err := regexp.MatchString("^[^\\.][^\\`\\\\{\\^\\}\\% \"\\>\\<\\[\\]\\#\\~|]+[^/]$", nameStr)
@@ -250,7 +250,7 @@ func ValidateSubStringInSlice(valid []string) schema.SchemaValidateFunc {
}
}
-// Validate if a string matches '#FFFFFF' RGB color representation.
+// ValidateHexColor validates if a string matches '#FFFFFF' RGB color representation.
func ValidateHexColor(color interface{}, _ cty.Path) diag.Diagnostics {
if colorStr, ok := color.(string); ok {
matched, err := regexp.MatchString("^#([A-Fa-f0-9]{6})$", colorStr)
diff --git a/genesyscloud/webdeployments_configuration/genesyscloud_webdeployments_configuration_proxy.go b/genesyscloud/webdeployments_configuration/genesyscloud_webdeployments_configuration_proxy.go
index e4609b7d9..ea0671576 100644
--- a/genesyscloud/webdeployments_configuration/genesyscloud_webdeployments_configuration_proxy.go
+++ b/genesyscloud/webdeployments_configuration/genesyscloud_webdeployments_configuration_proxy.go
@@ -9,7 +9,7 @@ import (
"time"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
var internalProxy *webDeploymentsConfigurationProxy
diff --git a/genesyscloud/webdeployments_configuration/resource_genesyscloud_webdeployments_configuration.go b/genesyscloud/webdeployments_configuration/resource_genesyscloud_webdeployments_configuration.go
index 60d879d96..ea88bc60a 100644
--- a/genesyscloud/webdeployments_configuration/resource_genesyscloud_webdeployments_configuration.go
+++ b/genesyscloud/webdeployments_configuration/resource_genesyscloud_webdeployments_configuration.go
@@ -19,7 +19,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func getAllWebDeploymentConfigurations(ctx context.Context, clientConfig *platformclientv2.Configuration) (resourceExporter.ResourceIDMetaMap, diag.Diagnostics) {
diff --git a/genesyscloud/webdeployments_configuration/resource_genesyscloud_webdeployments_configuration_schema.go b/genesyscloud/webdeployments_configuration/resource_genesyscloud_webdeployments_configuration_schema.go
index ba5c38bea..8cb13177c 100644
--- a/genesyscloud/webdeployments_configuration/resource_genesyscloud_webdeployments_configuration_schema.go
+++ b/genesyscloud/webdeployments_configuration/resource_genesyscloud_webdeployments_configuration_schema.go
@@ -4,7 +4,7 @@ import (
"terraform-provider-genesyscloud/genesyscloud/provider"
resourceExporter "terraform-provider-genesyscloud/genesyscloud/resource_exporter"
registrar "terraform-provider-genesyscloud/genesyscloud/resource_register"
- gcloud "terraform-provider-genesyscloud/genesyscloud/validators"
+ "terraform-provider-genesyscloud/genesyscloud/validators"
wdcUtils "terraform-provider-genesyscloud/genesyscloud/webdeployments_configuration/utils"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
@@ -518,13 +518,13 @@ var (
Description: "Background color for hero section, in hexadecimal format, eg #ffffff",
Type: schema.TypeString,
Required: true,
- ValidateDiagFunc: gcloud.ValidateHexColor,
+ ValidateDiagFunc: validators.ValidateHexColor,
},
"text_color": {
Description: "Text color for hero section, in hexadecimal format, eg #ffffff",
Type: schema.TypeString,
Required: true,
- ValidateDiagFunc: gcloud.ValidateHexColor,
+ ValidateDiagFunc: validators.ValidateHexColor,
},
"image_uri": {
Description: "Background image for hero section",
@@ -546,31 +546,31 @@ var (
Description: "Global background color, in hexadecimal format, eg #ffffff",
Type: schema.TypeString,
Required: true,
- ValidateDiagFunc: gcloud.ValidateHexColor,
+ ValidateDiagFunc: validators.ValidateHexColor,
},
"primary_color": {
Description: "Global primary color, in hexadecimal format, eg #ffffff",
Type: schema.TypeString,
Required: true,
- ValidateDiagFunc: gcloud.ValidateHexColor,
+ ValidateDiagFunc: validators.ValidateHexColor,
},
"primary_color_dark": {
Description: "Global dark primary color, in hexadecimal format, eg #ffffff",
Type: schema.TypeString,
Required: true,
- ValidateDiagFunc: gcloud.ValidateHexColor,
+ ValidateDiagFunc: validators.ValidateHexColor,
},
"primary_color_light": {
Description: "Global light primary color, in hexadecimal format, eg #ffffff",
Type: schema.TypeString,
Required: true,
- ValidateDiagFunc: gcloud.ValidateHexColor,
+ ValidateDiagFunc: validators.ValidateHexColor,
},
"text_color": {
Description: "Global text color, in hexadecimal format, eg #ffffff",
Type: schema.TypeString,
Required: true,
- ValidateDiagFunc: gcloud.ValidateHexColor,
+ ValidateDiagFunc: validators.ValidateHexColor,
},
"font_family": {
Description: "Global font family",
diff --git a/genesyscloud/webdeployments_configuration/resource_genesyscloud_webdeployments_configuration_test.go b/genesyscloud/webdeployments_configuration/resource_genesyscloud_webdeployments_configuration_test.go
index d83cb8f42..59984641e 100644
--- a/genesyscloud/webdeployments_configuration/resource_genesyscloud_webdeployments_configuration_test.go
+++ b/genesyscloud/webdeployments_configuration/resource_genesyscloud_webdeployments_configuration_test.go
@@ -14,7 +14,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
type scCustomMessageConfig struct {
diff --git a/genesyscloud/webdeployments_configuration/utils/resource_genesyscloud_webdeployments_configuration_journey.go b/genesyscloud/webdeployments_configuration/utils/resource_genesyscloud_webdeployments_configuration_journey.go
index 9d073a5c1..09edc3979 100644
--- a/genesyscloud/webdeployments_configuration/utils/resource_genesyscloud_webdeployments_configuration_journey.go
+++ b/genesyscloud/webdeployments_configuration/utils/resource_genesyscloud_webdeployments_configuration_journey.go
@@ -4,7 +4,7 @@ import (
"terraform-provider-genesyscloud/genesyscloud/util/lists"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func buildSelectorEventTriggers(triggers []interface{}) *[]platformclientv2.Selectoreventtrigger {
diff --git a/genesyscloud/webdeployments_configuration/utils/resource_genesyscloud_webdeployments_configuration_messenger.go b/genesyscloud/webdeployments_configuration/utils/resource_genesyscloud_webdeployments_configuration_messenger.go
index b5deb12fe..e12d1ae40 100644
--- a/genesyscloud/webdeployments_configuration/utils/resource_genesyscloud_webdeployments_configuration_messenger.go
+++ b/genesyscloud/webdeployments_configuration/utils/resource_genesyscloud_webdeployments_configuration_messenger.go
@@ -2,7 +2,7 @@ package webdeployments_configuration_utils
import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
"terraform-provider-genesyscloud/genesyscloud/util/lists"
)
diff --git a/genesyscloud/webdeployments_configuration/utils/resource_genesyscloud_webdeployments_configuration_support_center.go b/genesyscloud/webdeployments_configuration/utils/resource_genesyscloud_webdeployments_configuration_support_center.go
index 83e53bfcd..f29d7605d 100644
--- a/genesyscloud/webdeployments_configuration/utils/resource_genesyscloud_webdeployments_configuration_support_center.go
+++ b/genesyscloud/webdeployments_configuration/utils/resource_genesyscloud_webdeployments_configuration_support_center.go
@@ -4,7 +4,7 @@ import (
"terraform-provider-genesyscloud/genesyscloud/util/resourcedata"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func buildSupportCenterHeroStyle(styles []interface{}) *platformclientv2.Supportcenterherostyle {
diff --git a/genesyscloud/webdeployments_configuration/utils/resource_genesyscloud_webdeployments_configuration_utils.go b/genesyscloud/webdeployments_configuration/utils/resource_genesyscloud_webdeployments_configuration_utils.go
index 4a61793cd..b12770c46 100644
--- a/genesyscloud/webdeployments_configuration/utils/resource_genesyscloud_webdeployments_configuration_utils.go
+++ b/genesyscloud/webdeployments_configuration/utils/resource_genesyscloud_webdeployments_configuration_utils.go
@@ -7,7 +7,7 @@ import (
"terraform-provider-genesyscloud/genesyscloud/util/resourcedata"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func buildCobrowseSettings(d *schema.ResourceData) *platformclientv2.Cobrowsesettings {
@@ -160,7 +160,7 @@ func FlattenCobrowseSettings(cobrowseSettings *platformclientv2.Cobrowsesettings
return []interface{}{map[string]interface{}{
"enabled": cobrowseSettings.Enabled,
"allow_agent_control": cobrowseSettings.AllowAgentControl,
- "allow_agent_navigation": cobrowseSettings.AllowAgentNavigation,
+ "allow_agent_navigation": cobrowseSettings.AllowAgentNavigation,
"channels": cobrowseSettings.Channels,
"mask_selectors": cobrowseSettings.MaskSelectors,
"readonly_selectors": cobrowseSettings.ReadonlySelectors,
diff --git a/genesyscloud/webdeployments_deployment/genesyscloud_webdeployments_deployment_proxy.go b/genesyscloud/webdeployments_deployment/genesyscloud_webdeployments_deployment_proxy.go
index 1fa51d7e1..5dfb49182 100644
--- a/genesyscloud/webdeployments_deployment/genesyscloud_webdeployments_deployment_proxy.go
+++ b/genesyscloud/webdeployments_deployment/genesyscloud_webdeployments_deployment_proxy.go
@@ -10,7 +10,7 @@ import (
"terraform-provider-genesyscloud/genesyscloud/util"
"time"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
var internalProxy *webDeploymentsProxy
diff --git a/genesyscloud/webdeployments_deployment/resource_genesyscloud_webdeployments_deployment.go b/genesyscloud/webdeployments_deployment/resource_genesyscloud_webdeployments_deployment.go
index 2e0012aa1..d8ce2bff2 100644
--- a/genesyscloud/webdeployments_deployment/resource_genesyscloud_webdeployments_deployment.go
+++ b/genesyscloud/webdeployments_deployment/resource_genesyscloud_webdeployments_deployment.go
@@ -18,7 +18,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func getAllWebDeployments(ctx context.Context, clientConfig *platformclientv2.Configuration) (resourceExporter.ResourceIDMetaMap, diag.Diagnostics) {
diff --git a/genesyscloud/webdeployments_deployment/resource_genesyscloud_webdeployments_deployment_test.go b/genesyscloud/webdeployments_deployment/resource_genesyscloud_webdeployments_deployment_test.go
index 320c085de..0f223d80d 100644
--- a/genesyscloud/webdeployments_deployment/resource_genesyscloud_webdeployments_deployment_test.go
+++ b/genesyscloud/webdeployments_deployment/resource_genesyscloud_webdeployments_deployment_test.go
@@ -13,7 +13,7 @@ import (
"github.com/google/uuid"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func TestAccResourceWebDeploymentsDeployment(t *testing.T) {
diff --git a/genesyscloud/webdeployments_deployment/resource_genesyscloud_webdeployments_deployment_utils.go b/genesyscloud/webdeployments_deployment/resource_genesyscloud_webdeployments_deployment_utils.go
index d0f318b06..358560e1e 100644
--- a/genesyscloud/webdeployments_deployment/resource_genesyscloud_webdeployments_deployment_utils.go
+++ b/genesyscloud/webdeployments_deployment/resource_genesyscloud_webdeployments_deployment_utils.go
@@ -4,7 +4,7 @@ import (
"errors"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
- "github.com/mypurecloud/platform-client-sdk-go/v130/platformclientv2"
+ "github.com/mypurecloud/platform-client-sdk-go/v131/platformclientv2"
)
func alwaysDifferent(k, old, new string, d *schema.ResourceData) bool {
diff --git a/go.mod b/go.mod
index 97d022f1b..641f4f37c 100644
--- a/go.mod
+++ b/go.mod
@@ -6,12 +6,12 @@ require (
github.com/google/go-cmp v0.6.0
github.com/google/uuid v1.6.0
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
- github.com/hashicorp/hcl/v2 v2.20.1
+ github.com/hashicorp/hcl/v2 v2.21.0
github.com/hashicorp/terraform-plugin-docs v0.19.4
github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0
github.com/leekchan/timeutil v0.0.0-20150802142658-28917288c48d
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826
- github.com/mypurecloud/platform-client-sdk-go/v130 v130.0.0
+ github.com/mypurecloud/platform-client-sdk-go/v131 v131.0.0
github.com/nyaruka/phonenumbers v1.3.6
github.com/rjNemo/underscore v0.6.1
github.com/zclconf/go-cty v1.14.4
diff --git a/go.sum b/go.sum
index fc5087feb..ed2d47cac 100644
--- a/go.sum
+++ b/go.sum
@@ -166,8 +166,8 @@ github.com/hashicorp/hc-install v0.7.0 h1:Uu9edVqjKQxxuD28mR5TikkKDd/p55S8vzPC16
github.com/hashicorp/hc-install v0.7.0/go.mod h1:ELmmzZlGnEcqoUMKUuykHaPCIR1sYLYX+KSggWSKZuA=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
-github.com/hashicorp/hcl/v2 v2.20.1 h1:M6hgdyz7HYt1UN9e61j+qKJBqR3orTWbI1HKBJEdxtc=
-github.com/hashicorp/hcl/v2 v2.20.1/go.mod h1:TZDqQ4kNKCbh1iJp99FdPiUaVDDUPivbqxZulxDYqL4=
+github.com/hashicorp/hcl/v2 v2.21.0 h1:lve4q/o/2rqwYOgUg3y3V2YPyD1/zkCLGjIV74Jit14=
+github.com/hashicorp/hcl/v2 v2.21.0/go.mod h1:62ZYHrXgPoX8xBnzl8QzbWq4dyDsDtfCRgIq1rbJEvA=
github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y=
github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=
@@ -257,8 +257,8 @@ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3Rllmb
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw=
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
-github.com/mypurecloud/platform-client-sdk-go/v130 v130.0.0 h1:D6UheKy0j2dFMYMomhx/Qe7IMXeu6fkrUCKUBX11acw=
-github.com/mypurecloud/platform-client-sdk-go/v130 v130.0.0/go.mod h1:iDiiCTL8WLcSaLb1W3Qpmj4fGU0kCATO7nvg7098veQ=
+github.com/mypurecloud/platform-client-sdk-go/v131 v131.0.0 h1:2YkBK/2pSoaehuSTqhFDXb806nxmHIrz7RxKsQSqM/0=
+github.com/mypurecloud/platform-client-sdk-go/v131 v131.0.0/go.mod h1:pWn1ub6TxkdOiI1mgZED+fICo/JiqujY4h+wfgYbOi4=
github.com/nyaruka/phonenumbers v1.3.6 h1:33owXWp4d1U+Tyaj9fpci6PbvaQZcXBUO2FybeKeLwQ=
github.com/nyaruka/phonenumbers v1.3.6/go.mod h1:Ut+eFwikULbmCenH6InMKL9csUNLyxHuBLyfkpum11s=
github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA=
@@ -346,7 +346,7 @@ github.com/yuin/goldmark-meta v1.1.0 h1:pWw+JLHGZe8Rk0EGsMVssiNb/AaPMHfSRszZeUei
github.com/yuin/goldmark-meta v1.1.0/go.mod h1:U4spWENafuA7Zyg+Lj5RqK/MF+ovMYtBvXi1lBb2VP0=
github.com/zclconf/go-cty v1.14.4 h1:uXXczd9QDGsgu0i/QFR/hzI5NYCHLf6NQw/atrbnhq8=
github.com/zclconf/go-cty v1.14.4/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE=
-github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b h1:FosyBZYxY34Wul7O/MSKey3txpPYyCqVO5ZyceuQJEI=
+github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940 h1:4r45xpDWB6ZMSMNJFMOjqrGHynW3DIBuR2H9j0ug+Mo=
go.abhg.dev/goldmark/frontmatter v0.2.0 h1:P8kPG0YkL12+aYk2yU3xHv4tcXzeVnN+gU0tJ5JnxRw=
go.abhg.dev/goldmark/frontmatter v0.2.0/go.mod h1:XqrEkZuM57djk7zrlRUB02x8I5J0px76YjkOzhB4YlU=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
diff --git a/jenkins/tests/Jenkinsfile b/jenkins/tests/Jenkinsfile
index 7fd3f102b..3884e0d17 100644
--- a/jenkins/tests/Jenkinsfile
+++ b/jenkins/tests/Jenkinsfile
@@ -20,7 +20,7 @@ pipeline {
GOPATH = "$HOME/go"
TF_LOG = "DEBUG"
TF_LOG_PATH = "../test.log"
- GENESYSCLOUD_REGION = "${region}"
+ GENESYSCLOUD_REGION = "${region}"
GENESYSCLOUD_SDK_DEBUG = "true"
GENESYSCLOUD_TOKEN_POOL_SIZE = 20
PATH = "${env.PATH}:${HOME}/go/bin:/home/jenkins/.local/bin"
@@ -49,7 +49,7 @@ pipeline {
sh 'go install github.com/nezorflame/junit-merger@latest'
sh 'pip install xmltodict --user'
}
- }
+ }
stage('Terraform Check') {
steps {
@@ -59,6 +59,27 @@ pipeline {
}
}
+ stage('Unit Tests') {
+
+ environment {
+ TF_UNIT=1
+ ENABLE_STANDALONE_EMAIL_ADDRESS=1
+ ENABLE_STANDALONE_CGR=1
+ }
+
+ steps {
+ catchError(buildResult: 'FAILURE', stageResult:'FAILURE'){
+ echo 'Attempting to Run Unit Tests'
+ withCredentials([usernamePassword(credentialsId: CREDENTIALS_ID, usernameVariable: 'GENESYSCLOUD_OAUTHCLIENT_ID',passwordVariable:'GENESYSCLOUD_OAUTHCLIENT_SECRET')])
+ {
+ echo 'Loading Genesys OAuth Credentials'
+ sh "gotestsum --junitfile unit.xml --format standard-verbose ./genesyscloud/... -run 'Test|TestUnit' -skip 'TestAcc' -v -timeout 30m -count=1 -cover -coverprofile=coverageUnit.out"
+
+ }
+ }
+ }
+ }
+
stage('Architect Tests') {
environment {
TF_ACC=1
@@ -330,16 +351,16 @@ pipeline {
sh 'GOBIN=$HOME/bin go install github.com/wadey/gocovmerge@latest'
// Generate merged coverage report
- sh '$HOME/bin/gocovmerge coverageArchitect.out coverageIdp.out coverageAuth.out coverageIntegration.out coverageFlow.out coverageJourney.out coverageKnowledge.out coverageOutbound.out coverageResponseManagement.out coverageRouting.out coverageExport.out coverageLocation.out coverageWebDeployment.out coverageRemaining.out coverageSite.out coverageRoleTeam.out > merged_coverage.out'
+ sh '$HOME/bin/gocovmerge coverageArchitect.out coverageIdp.out coverageAuth.out coverageIntegration.out coverageFlow.out coverageJourney.out coverageKnowledge.out coverageOutbound.out coverageResponseManagement.out coverageRouting.out coverageExport.out coverageLocation.out coverageWebDeployment.out coverageRemaining.out coverageSite.out coverageRoleTeam.out coverageUnit.out > merged_coverage.out'
// Convert merged coverage report to HTML
- sh 'go tool cover -html merged_coverage.out -o coverageAcceptance.html'
+ sh 'go tool cover -html merged_coverage.out -o coverageReport.html'
- sh 'junit-merger -o test-results.xml architect.xml idp.xml auth.xml integration.xml flow.xml journey.xml knowledge.xml outbound.xml response.xml routing.xml location.xml web.xml site.xml team.xml export.xml remaining.xml'
+ sh 'junit-merger -o test-results.xml unit.xml architect.xml idp.xml auth.xml integration.xml flow.xml journey.xml knowledge.xml outbound.xml response.xml routing.xml location.xml web.xml site.xml team.xml export.xml remaining.xml'
script {
// Read the generated HTML file
- def htmlFile = readFile 'coverageAcceptance.html'
+ def htmlFile = readFile 'coverageReport.html'
def selectStart = htmlFile.indexOf('', selectStart)
def fileCoverageSection = htmlFile.substring(selectStart, selectEnd + 9) // +9 to include
@@ -494,7 +515,7 @@ pipeline {
updatedHtmlFile = updatedHtmlFile.replace('', "\n")
updatedHtmlFile = updatedHtmlFile.replace('