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 c6568e2 commit 3edc64c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,18 @@ func dataSourceSimpleRoutingQueueRead(ctx context.Context, d *schema.ResourceDat
// CREATE-TODO 2: Get an instance of our proxy by passing sdkConfig into the method getSimpleRoutingQueueProxy

// CREATE-TODO 3: Grab our queue name from the schema.ResourceData object (this step is already complete)
name := d.Get("name").(string)

log.Printf("Finding queue by 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)

// 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))

// CREATE-TODO 6: If we made it this far, we can call d.SetId(queueId) and return nil

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,15 @@ func updateSimpleRoutingQueue(ctx context.Context, d *schema.ResourceData, meta
// CREATE-TODO 2: Create variables for each field in our schema.ResourceData object

// CREATE-TODO 3: Create a queue struct using the Genesys Cloud platform go sdk

log.Println("Updating simple routing queue")
// ** 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)

// 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")

log.Println("Updated simple routing queue")
return readSimpleRoutingQueue(ctx, d, meta)
Expand Down

0 comments on commit 3edc64c

Please sign in to comment.