forked from MyPureCloud/terraform-provider-genesyscloud
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Refactor users package (MyPureCloud#1129)" (MyPureCloud#1191)
This reverts commit ceaeeb1.
- Loading branch information
1 parent
ceaeeb1
commit db9af99
Showing
47 changed files
with
2,198 additions
and
2,349 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
examples/resources/genesyscloud_flow/inboundcall_flow_example.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
examples/resources/genesyscloud_flow/inboundcall_flow_example2.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
examples/resources/genesyscloud_flow/inboundcall_flow_example3.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
genesyscloud/data_source_genesyscloud_architect_schedules.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
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/diag" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" | ||
"github.com/mypurecloud/platform-client-sdk-go/v133/platformclientv2" | ||
) | ||
|
||
func DataSourceSchedule() *schema.Resource { | ||
return &schema.Resource{ | ||
Description: "Data source for Genesys Cloud Schedule. Select a schedule by name", | ||
ReadContext: provider.ReadWithPooledClient(dataSourceScheduleRead), | ||
Schema: map[string]*schema.Schema{ | ||
"name": { | ||
Description: "Schedule name.", | ||
Type: schema.TypeString, | ||
Required: true, | ||
}, | ||
}, | ||
} | ||
} | ||
|
||
func dataSourceScheduleRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { | ||
sdkConfig := m.(*provider.ProviderMeta).ClientConfig | ||
archAPI := platformclientv2.NewArchitectApiWithConfig(sdkConfig) | ||
|
||
name := d.Get("name").(string) | ||
|
||
return util.WithRetries(ctx, 15*time.Second, func() *retry.RetryError { | ||
const pageSize = 100 | ||
for pageNum := 1; ; pageNum++ { | ||
schedule, resp, getErr := archAPI.GetArchitectSchedules(pageNum, pageSize, "", "", name, nil) | ||
|
||
if getErr != nil { | ||
return retry.NonRetryableError(util.BuildWithRetriesApiDiagnosticError("genesyscloud_architect_schedules", fmt.Sprintf("Error requesting schedule %s | error: %s", name, getErr), resp)) | ||
} | ||
|
||
if schedule.Entities == nil || len(*schedule.Entities) == 0 { | ||
return retry.RetryableError(util.BuildWithRetriesApiDiagnosticError("genesyscloud_architect_schedules", fmt.Sprintf("No schedule found with name %s", name), resp)) | ||
} | ||
|
||
d.SetId(*(*schedule.Entities)[0].Id) | ||
return nil | ||
} | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.