Skip to content

Commit

Permalink
Small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
charliecon committed Sep 11, 2024
1 parent e527f54 commit ee47017
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ee47017

Please sign in to comment.