Skip to content

Commit

Permalink
linting updates, error checking iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
jackofallops committed Aug 11, 2021
1 parent 0df60de commit 5ad1a47
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,7 @@ func (r AppServiceEnvironmentV3DataSource) Read() sdk.ResourceFunc {
model.AllowNewPrivateEndpointConnections = *props.AllowNewPrivateEndpointConnections
}

inboundNetworkDependencies := &[]AppServiceV3InboundDependencies{}
inboundNetworkDependencies, err = flattenInboundNetworkDependencies(ctx, client, &id)
inboundNetworkDependencies, err := flattenInboundNetworkDependencies(ctx, client, &id)
if err != nil {
return err
}
Expand Down
11 changes: 8 additions & 3 deletions internal/services/web/app_service_environment_v3_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,7 @@ func (r AppServiceEnvironmentV3Resource) Read() sdk.ResourceFunc {
model.AllowNewPrivateEndpointConnections = *props.AllowNewPrivateEndpointConnections
}

inboundNetworkDependencies := &[]AppServiceV3InboundDependencies{}
inboundNetworkDependencies, err = flattenInboundNetworkDependencies(ctx, client, id)
inboundNetworkDependencies, err := flattenInboundNetworkDependencies(ctx, client, id)
if err != nil {
return err
}
Expand Down Expand Up @@ -469,7 +468,8 @@ func expandClusterSettingsModel(input []ClusterSettingModel) *[]web.NameValuePai

func flattenInboundNetworkDependencies(ctx context.Context, client *web.AppServiceEnvironmentsClient, id *parse.AppServiceEnvironmentId) (*[]AppServiceV3InboundDependencies, error) {
var results []AppServiceV3InboundDependencies
for inboundNetworking, err := client.GetInboundNetworkDependenciesEndpointsComplete(ctx, id.ResourceGroup, id.HostingEnvironmentName); inboundNetworking.NotDone(); inboundNetworking.NextWithContext(ctx) {
inboundNetworking, err := client.GetInboundNetworkDependenciesEndpointsComplete(ctx, id.ResourceGroup, id.HostingEnvironmentName)
for inboundNetworking.NotDone() {
if err != nil {
return nil, fmt.Errorf("reading Inbound Network dependencies for %s: %+v", id, err)
}
Expand All @@ -487,6 +487,11 @@ func flattenInboundNetworkDependencies(ctx context.Context, client *web.AppServi
}

results = append(results, result)

err = inboundNetworking.NextWithContext(ctx)
if err != nil {
return nil, fmt.Errorf("reading paged results for Inbound Network Dependencies for %s: %+v", id, err)
}
}

return &results, nil
Expand Down

0 comments on commit 5ad1a47

Please sign in to comment.