Skip to content
This repository has been archived by the owner on Aug 16, 2022. It is now read-only.

Cloudfront implementation #40

Merged
merged 12 commits into from
May 5, 2021
1 change: 1 addition & 0 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ var allRegions = []string{

type Services struct {
Autoscaling AutoscalingClient
Cloudfront CloudfrontClient
Cloudtrail CloudtrailClient
Cloudwatch CloudwatchClient
CloudwatchLogs CloudwatchLogsClient
Expand Down
26 changes: 26 additions & 0 deletions client/mocks/builders_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package mocks_test

import (
"github.com/aws/aws-sdk-go-v2/service/cloudfront"
cloudfrontTypes "github.com/aws/aws-sdk-go-v2/service/cloudfront/types"
"testing"

"github.com/aws/aws-sdk-go-v2/service/autoscaling"
Expand Down Expand Up @@ -88,6 +90,30 @@ func buildEcsClusterMock(t *testing.T, ctrl *gomock.Controller) client.Services
return services
}

func buildCloudfrontDistributionsMock(t *testing.T, ctrl *gomock.Controller) client.Services {
m := mocks.NewMockCloudfrontClient(ctrl)
services := client.Services{
Cloudfront: m,
}

ds := cloudfrontTypes.DistributionSummary{}
err := faker.FakeData(&ds)
if err != nil {
t.Fatal(err)
}
amanenk marked this conversation as resolved.
Show resolved Hide resolved
cloudfrontOutput := &cloudfront.ListDistributionsOutput{
DistributionList: &cloudfrontTypes.DistributionList{
Items: []cloudfrontTypes.DistributionSummary{ds},
},
}

m.EXPECT().ListDistributions(gomock.Any(), gomock.Any(), gomock.Any()).Return(
cloudfrontOutput,
nil,
)
return services
}

func buildCloudtrailTrailsMock(t *testing.T, ctrl *gomock.Controller) client.Services {
m := mocks.NewMockCloudtrailClient(ctrl)
services := client.Services{
Expand Down
Loading