Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kavinbalagen committed Jul 31, 2024
1 parent ceaeeb1 commit 56bcc39
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,9 @@ func getAllPhonesFn(ctx context.Context, p *phoneProxy) (*[]platformclientv2.Pho
const pageSize = 100
const sortBy = "id"
expand := []string{"lines", "properties"}
fields := []string{"webRtcUser"}

phones, response, err := p.edgesApi.GetTelephonyProvidersEdgesPhones(1, pageSize, sortBy, "", "", "", "", "", "", "", "", "", "", "", "", expand, nil)
phones, response, err := p.edgesApi.GetTelephonyProvidersEdgesPhones(1, pageSize, sortBy, "", "", "", "", "", "", "", "", "", "", "", "", expand, fields)
if err != nil || (response != nil && response.StatusCode != http.StatusOK) {
log.Printf("getAllPhonesFn:: error encountered while trying to get first page of phone data #%v statusCode: %d", err, response.StatusCode)
return nil, response, err
Expand All @@ -195,7 +196,7 @@ func getAllPhonesFn(ctx context.Context, p *phoneProxy) (*[]platformclientv2.Pho
}

for pageNum := 2; pageNum <= *phones.PageCount; pageNum++ {
phones, response, err := p.edgesApi.GetTelephonyProvidersEdgesPhones(pageNum, pageSize, sortBy, "", "", "", "", "", "", "", "", "", "", "", "", expand, nil)
phones, response, err := p.edgesApi.GetTelephonyProvidersEdgesPhones(pageNum, pageSize, sortBy, "", "", "", "", "", "", "", "", "", "", "", "", expand, fields)
if err != nil || (response != nil && response.StatusCode != http.StatusOK) {
return nil, response, err
}
Expand Down Expand Up @@ -247,7 +248,9 @@ func getPhoneByIdFn(ctx context.Context, p *phoneProxy, phoneId string) (*platfo
func getPhoneByNameFn(ctx context.Context, p *phoneProxy, phoneName string) (phone *platformclientv2.Phone, retryable bool, resp *platformclientv2.APIResponse, err error) {
const pageSize = 100
expand := []string{"lines", "properties"}
phones, resp, err := p.edgesApi.GetTelephonyProvidersEdgesPhones(1, pageSize, "", "", "", "", "", "", "", "", "", "", phoneName, "", "", expand, nil)
fields := []string{"webRtcUser"}

phones, resp, err := p.edgesApi.GetTelephonyProvidersEdgesPhones(1, pageSize, "", "", "", "", "", "", "", "", "", "", phoneName, "", "", expand, fields)
if err != nil {
return nil, false, resp, err
}
Expand All @@ -262,7 +265,7 @@ func getPhoneByNameFn(ctx context.Context, p *phoneProxy, phoneName string) (pho
}

for pageNum := 2; pageNum <= *phones.PageCount; pageNum++ {
phones, resp, err := p.edgesApi.GetTelephonyProvidersEdgesPhones(pageNum, pageSize, "", "", "", "", "", "", "", "", "", "", phoneName, "", "", expand, nil)
phones, resp, err := p.edgesApi.GetTelephonyProvidersEdgesPhones(pageNum, pageSize, "", "", "", "", "", "", "", "", "", "", phoneName, "", "", expand, fields)
if err != nil {
return nil, false, resp, err
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ func PhoneExporter() *resourceExporter.ResourceExporter {
return &resourceExporter.ResourceExporter{
GetResourcesFunc: provider.GetAllWithPooledClient(getAllPhones),
RefAttrs: map[string]*resourceExporter.RefAttrSettings{
"web_rtc_user_id": {RefType: "genesyscloud_user"},
"site_id": {RefType: "genesyscloud_telephony_providers_edges_site"},
"phone_base_settings_id": {RefType: "genesyscloud_telephony_providers_edges_phonebasesettings"},
},
Expand Down

0 comments on commit 56bcc39

Please sign in to comment.