diff --git a/genesyscloud/simple_routing_queue/data_source_genesyscloud_simple_routing_queue.go b/genesyscloud/simple_routing_queue/data_source_genesyscloud_simple_routing_queue.go index 5b8dc4f89..ec7753fb9 100644 --- a/genesyscloud/simple_routing_queue/data_source_genesyscloud_simple_routing_queue.go +++ b/genesyscloud/simple_routing_queue/data_source_genesyscloud_simple_routing_queue.go @@ -30,12 +30,15 @@ func dataSourceSimpleRoutingQueueRead(ctx context.Context, d *schema.ResourceDat log.Printf("Finding queue by name '%s'", name) return util.WithRetries(ctx, 15*time.Second, func() *retry.RetryError { + log.Printf(`Retrieving ID of simple routing queue "%s"`, name) // CREATE-TODO 4: Call to the proxy function proxyInstance.getRoutingQueueIdByName(context.Context, string), passing ctx and our name variable // This function returns values in the following order: queueId (string), response (*platformclientv2.APIResponse), err (error), retryable (bool) queueId, resp, err, retryable := proxy.getSimpleRoutingQueueIdByName(ctx, name) - // CREATE-TODO 5: If the error is not nil, and retryable equals false, return a resource.NonRetryableError - // to let the user know that an error occurred. If retryable is true, return a resource.RetryableError + // CREATE-TODO 5: If the error is not nil, and retryable equals false, return a retry.NonRetryableError + // to let the user know that an error occurred. If retryable is true, return a retry.RetryableError + // We use the BuildWithRetriesApiDiagnosticError to provide as much info to the user as possible + // E.g. return retry.RetryableError(util.BuildWithRetriesApiDiagnosticError(resourceName, fmt.Sprintf("No queue found with name %s", name), resp)) if err != nil { if !retryable { return retry.NonRetryableError(util.BuildWithRetriesApiDiagnosticError(resourceName, err.Error(), resp)) diff --git a/genesyscloud/simple_routing_queue/resource_genesyscloud_simple_routing_queue.go b/genesyscloud/simple_routing_queue/resource_genesyscloud_simple_routing_queue.go index 478c1059f..8f6d8dc74 100644 --- a/genesyscloud/simple_routing_queue/resource_genesyscloud_simple_routing_queue.go +++ b/genesyscloud/simple_routing_queue/resource_genesyscloud_simple_routing_queue.go @@ -149,18 +149,20 @@ func updateSimpleRoutingQueue(ctx context.Context, d *schema.ResourceData, meta callingPartyName := d.Get("calling_party_name").(string) // CREATE-TODO 3: Create a queue struct using the Genesys Cloud platform go sdk + // ** NOTE: We are using Queuerequest this time - not Createqueuerequest ** + // Here is the source code for the struct we will be using - https://github.com/MyPureCloud/platform-client-sdk-go/blob/master/platformclientv2/Queuerequest.go + // (Remember - we only need to worry about the three fields defined in our schema) queueUpdate := &platformclientv2.Queuerequest{ Name: &name, EnableTranscription: &enableTranscription, CallingPartyName: &callingPartyName, } - log.Println("Updating simple routing queue") - // CREATE-TODO 4: Call the proxy function updateSimpleRoutingQueue(context.Context, id string, *platformclientv2.Queuerequest) to update our queue // We should handle our error and response objects the same way as in the createSimpleRoutingQueue method above. // We won't be needing the returned Queue object, so an underscore can go in that variables place. If we were to define it, Go would complain that we're not using it, // so this is our way of telling Go that we don't need it. + log.Println("Updating simple routing queue") _, resp, err := proxy.updateSimpleRoutingQueue(ctx, d.Id(), queueUpdate) if err != nil { return util.BuildAPIDiagnosticError(resourceName, err.Error(), resp)