From 9392281176d323d6a611ec6bb7dc3e53b01bae1b Mon Sep 17 00:00:00 2001 From: Elie CHARRA Date: Wed, 6 Jul 2022 10:44:42 +0200 Subject: [PATCH] chore: fix mess with common imports --- enumeration/remote/aws/init.go | 120 +++++++------- .../remote/aws_api_gateway_scanner_test.go | 98 +++++------ .../remote/aws_apigatewayv2_scanner_test.go | 68 ++++---- ...aws_applicationautoscaling_scanner_test.go | 12 +- .../remote/aws_autoscaling_scanner_test.go | 6 +- .../remote/aws_cloudformation_scanner_test.go | 8 +- .../remote/aws_cloudfront_scanner_test.go | 8 +- .../remote/aws_dynamodb_scanner_test.go | 8 +- enumeration/remote/aws_ec2_scanner_test.go | 152 +++++++++--------- enumeration/remote/aws_ecr_scanner_test.go | 10 +- .../remote/aws_elasticache_scanner_test.go | 6 +- enumeration/remote/aws_elb_scanner_test.go | 6 +- enumeration/remote/aws_elbv2_scanner_test.go | 12 +- enumeration/remote/aws_iam_scanner_test.go | 62 +++---- enumeration/remote/aws_kms_scanner_test.go | 14 +- enumeration/remote/aws_lambda_scanner_test.go | 14 +- enumeration/remote/aws_rds_scanner_test.go | 20 +-- .../remote/aws_route53_scanner_test.go | 22 +-- enumeration/remote/aws_s3_scanner_test.go | 50 +++--- enumeration/remote/aws_sns_scanner_test.go | 20 +-- enumeration/remote/aws_sqs_scanner_test.go | 12 +- enumeration/remote/azurerm/init.go | 26 +-- .../remote/azurerm_compute_scanner_test.go | 8 +- .../remote/azurerm_network_scanner_test.go | 24 +-- .../remote/azurerm_privatedns_scanner_test.go | 34 ++-- enumeration/remote/github/init.go | 14 +- .../github_branch_protection_scanner_test.go | 8 +- .../remote/github_membership_scanner_test.go | 8 +- .../remote/github_repository_scanner_test.go | 8 +- .../github_team_membership_scanner_test.go | 8 +- .../remote/github_team_scanner_test.go | 8 +- enumeration/remote/google/init.go | 18 +-- .../remote/google_bigquery_scanner_test.go | 10 +- .../remote/google_bigtable_scanner_test.go | 10 +- .../google_cloudfunctions_scanner_test.go | 6 +- .../remote/google_cloudrun_scanner_test.go | 6 +- .../remote/google_compute_scanner_test.go | 70 ++++---- .../remote/google_network_scanner_test.go | 6 +- .../remote/google_project_scanner_test.go | 6 +- enumeration/remote/google_sql_scanner_test.go | 6 +- .../remote/google_storage_scanner_test.go | 12 +- enumeration/remote/remote.go | 20 +-- enumeration/remote/scanner_test.go | 6 +- 43 files changed, 525 insertions(+), 525 deletions(-) diff --git a/enumeration/remote/aws/init.go b/enumeration/remote/aws/init.go index 3225c1b1..c14a7edd 100644 --- a/enumeration/remote/aws/init.go +++ b/enumeration/remote/aws/init.go @@ -6,7 +6,7 @@ import ( "github.com/snyk/driftctl/enumeration/remote/aws/client" "github.com/snyk/driftctl/enumeration/remote/aws/repository" "github.com/snyk/driftctl/enumeration/remote/cache" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" "github.com/snyk/driftctl/enumeration/resource" "github.com/snyk/driftctl/enumeration/resource/aws" "github.com/snyk/driftctl/enumeration/terraform" @@ -19,7 +19,7 @@ import ( func Init(version string, alerter *alerter.Alerter, providerLibrary *terraform.ProviderLibrary, - remoteLibrary *common2.RemoteLibrary, + remoteLibrary *common.RemoteLibrary, progress enumeration.ProgressCounter, resourceSchemaRepository *resource.SchemaRepository, factory resource.ResourceFactory, @@ -65,139 +65,139 @@ func Init(version string, alerter *alerter.Alerter, providerLibrary.AddProvider(terraform.AWS, provider) remoteLibrary.AddEnumerator(NewS3BucketEnumerator(s3Repository, factory, provider.Config, alerter)) - remoteLibrary.AddDetailsFetcher(aws.AwsS3BucketResourceType, common2.NewGenericDetailsFetcher(aws.AwsS3BucketResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsS3BucketResourceType, common.NewGenericDetailsFetcher(aws.AwsS3BucketResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewS3BucketInventoryEnumerator(s3Repository, factory, provider.Config, alerter)) - remoteLibrary.AddDetailsFetcher(aws.AwsS3BucketInventoryResourceType, common2.NewGenericDetailsFetcher(aws.AwsS3BucketInventoryResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsS3BucketInventoryResourceType, common.NewGenericDetailsFetcher(aws.AwsS3BucketInventoryResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewS3BucketNotificationEnumerator(s3Repository, factory, provider.Config, alerter)) - remoteLibrary.AddDetailsFetcher(aws.AwsS3BucketNotificationResourceType, common2.NewGenericDetailsFetcher(aws.AwsS3BucketNotificationResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsS3BucketNotificationResourceType, common.NewGenericDetailsFetcher(aws.AwsS3BucketNotificationResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewS3BucketMetricsEnumerator(s3Repository, factory, provider.Config, alerter)) - remoteLibrary.AddDetailsFetcher(aws.AwsS3BucketMetricResourceType, common2.NewGenericDetailsFetcher(aws.AwsS3BucketMetricResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsS3BucketMetricResourceType, common.NewGenericDetailsFetcher(aws.AwsS3BucketMetricResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewS3BucketPolicyEnumerator(s3Repository, factory, provider.Config, alerter)) - remoteLibrary.AddDetailsFetcher(aws.AwsS3BucketPolicyResourceType, common2.NewGenericDetailsFetcher(aws.AwsS3BucketPolicyResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsS3BucketPolicyResourceType, common.NewGenericDetailsFetcher(aws.AwsS3BucketPolicyResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewS3BucketAnalyticEnumerator(s3Repository, factory, provider.Config, alerter)) - remoteLibrary.AddDetailsFetcher(aws.AwsS3BucketAnalyticsConfigurationResourceType, common2.NewGenericDetailsFetcher(aws.AwsS3BucketAnalyticsConfigurationResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsS3BucketAnalyticsConfigurationResourceType, common.NewGenericDetailsFetcher(aws.AwsS3BucketAnalyticsConfigurationResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewS3BucketPublicAccessBlockEnumerator(s3Repository, factory, provider.Config, alerter)) remoteLibrary.AddEnumerator(NewEC2EbsVolumeEnumerator(ec2repository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsEbsVolumeResourceType, common2.NewGenericDetailsFetcher(aws.AwsEbsVolumeResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsEbsVolumeResourceType, common.NewGenericDetailsFetcher(aws.AwsEbsVolumeResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewEC2EbsSnapshotEnumerator(ec2repository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsEbsSnapshotResourceType, common2.NewGenericDetailsFetcher(aws.AwsEbsSnapshotResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsEbsSnapshotResourceType, common.NewGenericDetailsFetcher(aws.AwsEbsSnapshotResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewEC2EipEnumerator(ec2repository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsEipResourceType, common2.NewGenericDetailsFetcher(aws.AwsEipResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsEipResourceType, common.NewGenericDetailsFetcher(aws.AwsEipResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewEC2AmiEnumerator(ec2repository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsAmiResourceType, common2.NewGenericDetailsFetcher(aws.AwsAmiResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsAmiResourceType, common.NewGenericDetailsFetcher(aws.AwsAmiResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewEC2KeyPairEnumerator(ec2repository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsKeyPairResourceType, common2.NewGenericDetailsFetcher(aws.AwsKeyPairResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsKeyPairResourceType, common.NewGenericDetailsFetcher(aws.AwsKeyPairResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewEC2EipAssociationEnumerator(ec2repository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsEipAssociationResourceType, common2.NewGenericDetailsFetcher(aws.AwsEipAssociationResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsEipAssociationResourceType, common.NewGenericDetailsFetcher(aws.AwsEipAssociationResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewEC2InstanceEnumerator(ec2repository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsInstanceResourceType, common2.NewGenericDetailsFetcher(aws.AwsInstanceResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsInstanceResourceType, common.NewGenericDetailsFetcher(aws.AwsInstanceResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewEC2InternetGatewayEnumerator(ec2repository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsInternetGatewayResourceType, common2.NewGenericDetailsFetcher(aws.AwsInternetGatewayResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsInternetGatewayResourceType, common.NewGenericDetailsFetcher(aws.AwsInternetGatewayResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewVPCEnumerator(ec2repository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsVpcResourceType, common2.NewGenericDetailsFetcher(aws.AwsVpcResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsVpcResourceType, common.NewGenericDetailsFetcher(aws.AwsVpcResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewDefaultVPCEnumerator(ec2repository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsDefaultVpcResourceType, common2.NewGenericDetailsFetcher(aws.AwsDefaultVpcResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsDefaultVpcResourceType, common.NewGenericDetailsFetcher(aws.AwsDefaultVpcResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewEC2RouteTableEnumerator(ec2repository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsRouteTableResourceType, common2.NewGenericDetailsFetcher(aws.AwsRouteTableResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsRouteTableResourceType, common.NewGenericDetailsFetcher(aws.AwsRouteTableResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewEC2DefaultRouteTableEnumerator(ec2repository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsDefaultRouteTableResourceType, common2.NewGenericDetailsFetcher(aws.AwsDefaultRouteTableResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsDefaultRouteTableResourceType, common.NewGenericDetailsFetcher(aws.AwsDefaultRouteTableResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewEC2RouteTableAssociationEnumerator(ec2repository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsRouteTableAssociationResourceType, common2.NewGenericDetailsFetcher(aws.AwsRouteTableAssociationResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsRouteTableAssociationResourceType, common.NewGenericDetailsFetcher(aws.AwsRouteTableAssociationResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewEC2SubnetEnumerator(ec2repository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsSubnetResourceType, common2.NewGenericDetailsFetcher(aws.AwsSubnetResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsSubnetResourceType, common.NewGenericDetailsFetcher(aws.AwsSubnetResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewEC2DefaultSubnetEnumerator(ec2repository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsDefaultSubnetResourceType, common2.NewGenericDetailsFetcher(aws.AwsDefaultSubnetResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsDefaultSubnetResourceType, common.NewGenericDetailsFetcher(aws.AwsDefaultSubnetResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewVPCSecurityGroupEnumerator(ec2repository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsSecurityGroupResourceType, common2.NewGenericDetailsFetcher(aws.AwsSecurityGroupResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsSecurityGroupResourceType, common.NewGenericDetailsFetcher(aws.AwsSecurityGroupResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewVPCDefaultSecurityGroupEnumerator(ec2repository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsDefaultSecurityGroupResourceType, common2.NewGenericDetailsFetcher(aws.AwsDefaultSecurityGroupResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsDefaultSecurityGroupResourceType, common.NewGenericDetailsFetcher(aws.AwsDefaultSecurityGroupResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewEC2NatGatewayEnumerator(ec2repository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsNatGatewayResourceType, common2.NewGenericDetailsFetcher(aws.AwsNatGatewayResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsNatGatewayResourceType, common.NewGenericDetailsFetcher(aws.AwsNatGatewayResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewEC2NetworkACLEnumerator(ec2repository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsNetworkACLResourceType, common2.NewGenericDetailsFetcher(aws.AwsNetworkACLResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsNetworkACLResourceType, common.NewGenericDetailsFetcher(aws.AwsNetworkACLResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewEC2NetworkACLRuleEnumerator(ec2repository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsNetworkACLRuleResourceType, common2.NewGenericDetailsFetcher(aws.AwsNetworkACLRuleResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsNetworkACLRuleResourceType, common.NewGenericDetailsFetcher(aws.AwsNetworkACLRuleResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewEC2DefaultNetworkACLEnumerator(ec2repository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsDefaultNetworkACLResourceType, common2.NewGenericDetailsFetcher(aws.AwsDefaultNetworkACLResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsDefaultNetworkACLResourceType, common.NewGenericDetailsFetcher(aws.AwsDefaultNetworkACLResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewEC2RouteEnumerator(ec2repository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsRouteResourceType, common2.NewGenericDetailsFetcher(aws.AwsRouteResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsRouteResourceType, common.NewGenericDetailsFetcher(aws.AwsRouteResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewVPCSecurityGroupRuleEnumerator(ec2repository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsSecurityGroupRuleResourceType, common2.NewGenericDetailsFetcher(aws.AwsSecurityGroupRuleResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsSecurityGroupRuleResourceType, common.NewGenericDetailsFetcher(aws.AwsSecurityGroupRuleResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewLaunchTemplateEnumerator(ec2repository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsLaunchTemplateResourceType, common2.NewGenericDetailsFetcher(aws.AwsLaunchTemplateResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsLaunchTemplateResourceType, common.NewGenericDetailsFetcher(aws.AwsLaunchTemplateResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewEC2EbsEncryptionByDefaultEnumerator(ec2repository, factory)) remoteLibrary.AddEnumerator(NewKMSKeyEnumerator(kmsRepository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsKmsKeyResourceType, common2.NewGenericDetailsFetcher(aws.AwsKmsKeyResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsKmsKeyResourceType, common.NewGenericDetailsFetcher(aws.AwsKmsKeyResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewKMSAliasEnumerator(kmsRepository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsKmsAliasResourceType, common2.NewGenericDetailsFetcher(aws.AwsKmsAliasResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsKmsAliasResourceType, common.NewGenericDetailsFetcher(aws.AwsKmsAliasResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewRoute53HealthCheckEnumerator(route53repository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsRoute53HealthCheckResourceType, common2.NewGenericDetailsFetcher(aws.AwsRoute53HealthCheckResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsRoute53HealthCheckResourceType, common.NewGenericDetailsFetcher(aws.AwsRoute53HealthCheckResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewRoute53ZoneEnumerator(route53repository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsRoute53ZoneResourceType, common2.NewGenericDetailsFetcher(aws.AwsRoute53ZoneResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsRoute53ZoneResourceType, common.NewGenericDetailsFetcher(aws.AwsRoute53ZoneResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewRoute53RecordEnumerator(route53repository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsRoute53RecordResourceType, common2.NewGenericDetailsFetcher(aws.AwsRoute53RecordResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsRoute53RecordResourceType, common.NewGenericDetailsFetcher(aws.AwsRoute53RecordResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewCloudfrontDistributionEnumerator(cloudfrontRepository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsCloudfrontDistributionResourceType, common2.NewGenericDetailsFetcher(aws.AwsCloudfrontDistributionResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsCloudfrontDistributionResourceType, common.NewGenericDetailsFetcher(aws.AwsCloudfrontDistributionResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewRDSDBInstanceEnumerator(rdsRepository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsDbInstanceResourceType, common2.NewGenericDetailsFetcher(aws.AwsDbInstanceResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsDbInstanceResourceType, common.NewGenericDetailsFetcher(aws.AwsDbInstanceResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewRDSDBSubnetGroupEnumerator(rdsRepository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsDbSubnetGroupResourceType, common2.NewGenericDetailsFetcher(aws.AwsDbSubnetGroupResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsDbSubnetGroupResourceType, common.NewGenericDetailsFetcher(aws.AwsDbSubnetGroupResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewSQSQueueEnumerator(sqsRepository, factory)) remoteLibrary.AddDetailsFetcher(aws.AwsSqsQueueResourceType, NewSQSQueueDetailsFetcher(provider, deserializer)) remoteLibrary.AddEnumerator(NewSQSQueuePolicyEnumerator(sqsRepository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsSqsQueuePolicyResourceType, common2.NewGenericDetailsFetcher(aws.AwsSqsQueuePolicyResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsSqsQueuePolicyResourceType, common.NewGenericDetailsFetcher(aws.AwsSqsQueuePolicyResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewSNSTopicEnumerator(snsRepository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsSnsTopicResourceType, common2.NewGenericDetailsFetcher(aws.AwsSnsTopicResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsSnsTopicResourceType, common.NewGenericDetailsFetcher(aws.AwsSnsTopicResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewSNSTopicPolicyEnumerator(snsRepository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsSnsTopicPolicyResourceType, common2.NewGenericDetailsFetcher(aws.AwsSnsTopicPolicyResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsSnsTopicPolicyResourceType, common.NewGenericDetailsFetcher(aws.AwsSnsTopicPolicyResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewSNSTopicSubscriptionEnumerator(snsRepository, factory, alerter)) - remoteLibrary.AddDetailsFetcher(aws.AwsSnsTopicSubscriptionResourceType, common2.NewGenericDetailsFetcher(aws.AwsSnsTopicSubscriptionResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsSnsTopicSubscriptionResourceType, common.NewGenericDetailsFetcher(aws.AwsSnsTopicSubscriptionResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewDynamoDBTableEnumerator(dynamoDBRepository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsDynamodbTableResourceType, common2.NewGenericDetailsFetcher(aws.AwsDynamodbTableResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsDynamodbTableResourceType, common.NewGenericDetailsFetcher(aws.AwsDynamodbTableResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewIamPolicyEnumerator(iamRepository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsIamPolicyResourceType, common2.NewGenericDetailsFetcher(aws.AwsIamPolicyResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsIamPolicyResourceType, common.NewGenericDetailsFetcher(aws.AwsIamPolicyResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewLambdaFunctionEnumerator(lambdaRepository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsLambdaFunctionResourceType, common2.NewGenericDetailsFetcher(aws.AwsLambdaFunctionResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsLambdaFunctionResourceType, common.NewGenericDetailsFetcher(aws.AwsLambdaFunctionResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewLambdaEventSourceMappingEnumerator(lambdaRepository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsLambdaEventSourceMappingResourceType, common2.NewGenericDetailsFetcher(aws.AwsLambdaEventSourceMappingResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsLambdaEventSourceMappingResourceType, common.NewGenericDetailsFetcher(aws.AwsLambdaEventSourceMappingResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewIamUserEnumerator(iamRepository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsIamUserResourceType, common2.NewGenericDetailsFetcher(aws.AwsIamUserResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsIamUserResourceType, common.NewGenericDetailsFetcher(aws.AwsIamUserResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewIamUserPolicyEnumerator(iamRepository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsIamUserPolicyResourceType, common2.NewGenericDetailsFetcher(aws.AwsIamUserPolicyResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsIamUserPolicyResourceType, common.NewGenericDetailsFetcher(aws.AwsIamUserPolicyResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewIamRoleEnumerator(iamRepository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsIamRoleResourceType, common2.NewGenericDetailsFetcher(aws.AwsIamRoleResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsIamRoleResourceType, common.NewGenericDetailsFetcher(aws.AwsIamRoleResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewIamAccessKeyEnumerator(iamRepository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsIamAccessKeyResourceType, common2.NewGenericDetailsFetcher(aws.AwsIamAccessKeyResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsIamAccessKeyResourceType, common.NewGenericDetailsFetcher(aws.AwsIamAccessKeyResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewIamRolePolicyAttachmentEnumerator(iamRepository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsIamRolePolicyAttachmentResourceType, common2.NewGenericDetailsFetcher(aws.AwsIamRolePolicyAttachmentResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsIamRolePolicyAttachmentResourceType, common.NewGenericDetailsFetcher(aws.AwsIamRolePolicyAttachmentResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewIamRolePolicyEnumerator(iamRepository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsIamRolePolicyResourceType, common2.NewGenericDetailsFetcher(aws.AwsIamRolePolicyResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsIamRolePolicyResourceType, common.NewGenericDetailsFetcher(aws.AwsIamRolePolicyResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewIamUserPolicyAttachmentEnumerator(iamRepository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsIamUserPolicyAttachmentResourceType, common2.NewGenericDetailsFetcher(aws.AwsIamUserPolicyAttachmentResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsIamUserPolicyAttachmentResourceType, common.NewGenericDetailsFetcher(aws.AwsIamUserPolicyAttachmentResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewIamGroupPolicyEnumerator(iamRepository, factory)) remoteLibrary.AddEnumerator(NewIamGroupEnumerator(iamRepository, factory)) remoteLibrary.AddEnumerator(NewIamGroupPolicyAttachmentEnumerator(iamRepository, factory)) remoteLibrary.AddEnumerator(NewECRRepositoryEnumerator(ecrRepository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsEcrRepositoryResourceType, common2.NewGenericDetailsFetcher(aws.AwsEcrRepositoryResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsEcrRepositoryResourceType, common.NewGenericDetailsFetcher(aws.AwsEcrRepositoryResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewECRRepositoryPolicyEnumerator(ecrRepository, factory)) remoteLibrary.AddEnumerator(NewRDSClusterEnumerator(rdsRepository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsRDSClusterResourceType, common2.NewGenericDetailsFetcher(aws.AwsRDSClusterResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsRDSClusterResourceType, common.NewGenericDetailsFetcher(aws.AwsRDSClusterResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewCloudformationStackEnumerator(cloudformationRepository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsCloudformationStackResourceType, common2.NewGenericDetailsFetcher(aws.AwsCloudformationStackResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsCloudformationStackResourceType, common.NewGenericDetailsFetcher(aws.AwsCloudformationStackResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewApiGatewayRestApiEnumerator(apigatewayRepository, factory)) remoteLibrary.AddEnumerator(NewApiGatewayAccountEnumerator(apigatewayRepository, factory)) @@ -232,10 +232,10 @@ func Init(version string, alerter *alerter.Alerter, remoteLibrary.AddEnumerator(NewApiGatewayV2IntegrationResponseEnumerator(apigatewayv2Repository, factory)) remoteLibrary.AddEnumerator(NewAppAutoscalingTargetEnumerator(appAutoScalingRepository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsAppAutoscalingTargetResourceType, common2.NewGenericDetailsFetcher(aws.AwsAppAutoscalingTargetResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsAppAutoscalingTargetResourceType, common.NewGenericDetailsFetcher(aws.AwsAppAutoscalingTargetResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewAppAutoscalingPolicyEnumerator(appAutoScalingRepository, factory)) - remoteLibrary.AddDetailsFetcher(aws.AwsAppAutoscalingPolicyResourceType, common2.NewGenericDetailsFetcher(aws.AwsAppAutoscalingPolicyResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(aws.AwsAppAutoscalingPolicyResourceType, common.NewGenericDetailsFetcher(aws.AwsAppAutoscalingPolicyResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewAppAutoscalingScheduledActionEnumerator(appAutoScalingRepository, factory)) diff --git a/enumeration/remote/aws_api_gateway_scanner_test.go b/enumeration/remote/aws_api_gateway_scanner_test.go index 041afa86..0545f894 100644 --- a/enumeration/remote/aws_api_gateway_scanner_test.go +++ b/enumeration/remote/aws_api_gateway_scanner_test.go @@ -10,7 +10,7 @@ import ( "github.com/snyk/driftctl/enumeration/remote/alerts" aws2 "github.com/snyk/driftctl/enumeration/remote/aws" "github.com/snyk/driftctl/enumeration/remote/aws/repository" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" remoteerr "github.com/snyk/driftctl/enumeration/remote/error" "github.com/snyk/driftctl/enumeration/resource" resourceaws "github.com/snyk/driftctl/enumeration/resource/aws" @@ -63,7 +63,7 @@ func TestApiGatewayRestApi(t *testing.T) { test: "cannot list api gateway rest apis", mocks: func(repository *repository.MockApiGatewayRepository, alerter *mocks.AlerterInterface) { repository.On("ListAllRestApis").Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayRestApiResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayRestApiResourceType, resourceaws.AwsApiGatewayRestApiResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayRestApiResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayRestApiResourceType, resourceaws.AwsApiGatewayRestApiResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingError(dummyError, resourceaws.AwsApiGatewayRestApiResourceType), }, @@ -77,7 +77,7 @@ func TestApiGatewayRestApi(t *testing.T) { for _, c := range tests { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -140,7 +140,7 @@ func TestApiGatewayAccount(t *testing.T) { test: "cannot get api gateway account", mocks: func(repository *repository.MockApiGatewayRepository, alerter *mocks.AlerterInterface) { repository.On("GetAccount").Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayAccountResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayAccountResourceType, resourceaws.AwsApiGatewayAccountResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayAccountResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayAccountResourceType, resourceaws.AwsApiGatewayAccountResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingError(dummyError, resourceaws.AwsApiGatewayAccountResourceType), }, @@ -154,7 +154,7 @@ func TestApiGatewayAccount(t *testing.T) { for _, c := range tests { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -223,7 +223,7 @@ func TestApiGatewayApiKey(t *testing.T) { test: "cannot list api gateway api keys", mocks: func(repository *repository.MockApiGatewayRepository, alerter *mocks.AlerterInterface) { repository.On("ListAllApiKeys").Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayApiKeyResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayApiKeyResourceType, resourceaws.AwsApiGatewayApiKeyResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayApiKeyResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayApiKeyResourceType, resourceaws.AwsApiGatewayApiKeyResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingError(dummyError, resourceaws.AwsApiGatewayApiKeyResourceType), }, @@ -237,7 +237,7 @@ func TestApiGatewayApiKey(t *testing.T) { for _, c := range tests { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -315,7 +315,7 @@ func TestApiGatewayAuthorizer(t *testing.T) { test: "cannot list rest apis", mocks: func(repo *repository.MockApiGatewayRepository, alerter *mocks.AlerterInterface) { repo.On("ListAllRestApis").Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayAuthorizerResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayAuthorizerResourceType, resourceaws.AwsApiGatewayRestApiResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayAuthorizerResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayAuthorizerResourceType, resourceaws.AwsApiGatewayRestApiResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayAuthorizerResourceType, resourceaws.AwsApiGatewayRestApiResourceType), }, @@ -324,7 +324,7 @@ func TestApiGatewayAuthorizer(t *testing.T) { mocks: func(repo *repository.MockApiGatewayRepository, alerter *mocks.AlerterInterface) { repo.On("ListAllRestApis").Return(apis, nil) repo.On("ListAllRestApiAuthorizers", *apis[0].Id).Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayAuthorizerResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayAuthorizerResourceType, resourceaws.AwsApiGatewayAuthorizerResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayAuthorizerResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayAuthorizerResourceType, resourceaws.AwsApiGatewayAuthorizerResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingError(dummyError, resourceaws.AwsApiGatewayAuthorizerResourceType), }, @@ -338,7 +338,7 @@ func TestApiGatewayAuthorizer(t *testing.T) { for _, c := range tests { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -412,7 +412,7 @@ func TestApiGatewayStage(t *testing.T) { test: "cannot list rest apis", mocks: func(repo *repository.MockApiGatewayRepository, alerter *mocks.AlerterInterface) { repo.On("ListAllRestApis").Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayStageResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayStageResourceType, resourceaws.AwsApiGatewayRestApiResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayStageResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayStageResourceType, resourceaws.AwsApiGatewayRestApiResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayStageResourceType, resourceaws.AwsApiGatewayRestApiResourceType), }, @@ -421,7 +421,7 @@ func TestApiGatewayStage(t *testing.T) { mocks: func(repo *repository.MockApiGatewayRepository, alerter *mocks.AlerterInterface) { repo.On("ListAllRestApis").Return(apis, nil) repo.On("ListAllRestApiStages", *apis[0].Id).Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayStageResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayStageResourceType, resourceaws.AwsApiGatewayStageResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayStageResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayStageResourceType, resourceaws.AwsApiGatewayStageResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingError(dummyError, resourceaws.AwsApiGatewayStageResourceType), }, @@ -435,7 +435,7 @@ func TestApiGatewayStage(t *testing.T) { for _, c := range tests { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -509,7 +509,7 @@ func TestApiGatewayResource(t *testing.T) { test: "cannot list rest apis", mocks: func(repo *repository.MockApiGatewayRepository, alerter *mocks.AlerterInterface) { repo.On("ListAllRestApis").Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayResourceResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayResourceResourceType, resourceaws.AwsApiGatewayRestApiResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayResourceResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayResourceResourceType, resourceaws.AwsApiGatewayRestApiResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayResourceResourceType, resourceaws.AwsApiGatewayRestApiResourceType), }, @@ -518,7 +518,7 @@ func TestApiGatewayResource(t *testing.T) { mocks: func(repo *repository.MockApiGatewayRepository, alerter *mocks.AlerterInterface) { repo.On("ListAllRestApis").Return(apis, nil) repo.On("ListAllRestApiResources", *apis[0].Id).Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayResourceResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayResourceResourceType, resourceaws.AwsApiGatewayResourceResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayResourceResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayResourceResourceType, resourceaws.AwsApiGatewayResourceResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingError(dummyError, resourceaws.AwsApiGatewayResourceResourceType), }, @@ -532,7 +532,7 @@ func TestApiGatewayResource(t *testing.T) { for _, c := range tests { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -597,7 +597,7 @@ func TestApiGatewayDomainName(t *testing.T) { test: "cannot list api gateway domain names", mocks: func(repository *repository.MockApiGatewayRepository, alerter *mocks.AlerterInterface) { repository.On("ListAllDomainNames").Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayDomainNameResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayDomainNameResourceType, resourceaws.AwsApiGatewayDomainNameResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayDomainNameResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayDomainNameResourceType, resourceaws.AwsApiGatewayDomainNameResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingError(dummyError, resourceaws.AwsApiGatewayDomainNameResourceType), }, @@ -611,7 +611,7 @@ func TestApiGatewayDomainName(t *testing.T) { for _, c := range tests { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -676,7 +676,7 @@ func TestApiGatewayVpcLink(t *testing.T) { test: "cannot list api gateway vpc links", mocks: func(repository *repository.MockApiGatewayRepository, alerter *mocks.AlerterInterface) { repository.On("ListAllVpcLinks").Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayVpcLinkResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayVpcLinkResourceType, resourceaws.AwsApiGatewayVpcLinkResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayVpcLinkResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayVpcLinkResourceType, resourceaws.AwsApiGatewayVpcLinkResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingError(dummyError, resourceaws.AwsApiGatewayVpcLinkResourceType), }, @@ -690,7 +690,7 @@ func TestApiGatewayVpcLink(t *testing.T) { for _, c := range tests { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -764,7 +764,7 @@ func TestApiGatewayRequestValidator(t *testing.T) { test: "cannot list rest apis", mocks: func(repo *repository.MockApiGatewayRepository, alerter *mocks.AlerterInterface) { repo.On("ListAllRestApis").Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayRequestValidatorResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayRequestValidatorResourceType, resourceaws.AwsApiGatewayRestApiResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayRequestValidatorResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayRequestValidatorResourceType, resourceaws.AwsApiGatewayRestApiResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayRequestValidatorResourceType, resourceaws.AwsApiGatewayRestApiResourceType), }, @@ -773,7 +773,7 @@ func TestApiGatewayRequestValidator(t *testing.T) { mocks: func(repo *repository.MockApiGatewayRepository, alerter *mocks.AlerterInterface) { repo.On("ListAllRestApis").Return(apis, nil) repo.On("ListAllRestApiRequestValidators", *apis[0].Id).Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayRequestValidatorResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayRequestValidatorResourceType, resourceaws.AwsApiGatewayRequestValidatorResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayRequestValidatorResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayRequestValidatorResourceType, resourceaws.AwsApiGatewayRequestValidatorResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingError(dummyError, resourceaws.AwsApiGatewayRequestValidatorResourceType), }, @@ -787,7 +787,7 @@ func TestApiGatewayRequestValidator(t *testing.T) { for _, c := range tests { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -859,7 +859,7 @@ func TestApiGatewayRestApiPolicy(t *testing.T) { test: "cannot list rest apis", mocks: func(repo *repository.MockApiGatewayRepository, alerter *mocks.AlerterInterface) { repo.On("ListAllRestApis").Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayRestApiPolicyResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayRestApiPolicyResourceType, resourceaws.AwsApiGatewayRestApiResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayRestApiPolicyResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayRestApiPolicyResourceType, resourceaws.AwsApiGatewayRestApiResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayRestApiPolicyResourceType, resourceaws.AwsApiGatewayRestApiResourceType), }, @@ -873,7 +873,7 @@ func TestApiGatewayRestApiPolicy(t *testing.T) { for _, c := range tests { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -947,7 +947,7 @@ func TestApiGatewayBasePathMapping(t *testing.T) { test: "cannot list domain names", mocks: func(repo *repository.MockApiGatewayRepository, alerter *mocks.AlerterInterface) { repo.On("ListAllDomainNames").Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayBasePathMappingResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayBasePathMappingResourceType, resourceaws.AwsApiGatewayDomainNameResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayBasePathMappingResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayBasePathMappingResourceType, resourceaws.AwsApiGatewayDomainNameResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayBasePathMappingResourceType, resourceaws.AwsApiGatewayDomainNameResourceType), }, @@ -956,7 +956,7 @@ func TestApiGatewayBasePathMapping(t *testing.T) { mocks: func(repo *repository.MockApiGatewayRepository, alerter *mocks.AlerterInterface) { repo.On("ListAllDomainNames").Return(domainNames, nil) repo.On("ListAllDomainNameBasePathMappings", *domainNames[0].DomainName).Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayBasePathMappingResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayBasePathMappingResourceType, resourceaws.AwsApiGatewayBasePathMappingResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayBasePathMappingResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayBasePathMappingResourceType, resourceaws.AwsApiGatewayBasePathMappingResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingError(dummyError, resourceaws.AwsApiGatewayBasePathMappingResourceType), }, @@ -970,7 +970,7 @@ func TestApiGatewayBasePathMapping(t *testing.T) { for _, c := range tests { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -1052,7 +1052,7 @@ func TestApiGatewayMethod(t *testing.T) { test: "cannot list rest apis", mocks: func(repo *repository.MockApiGatewayRepository, alerter *mocks.AlerterInterface) { repo.On("ListAllRestApis").Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayMethodResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayMethodResourceType, resourceaws.AwsApiGatewayRestApiResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayMethodResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayMethodResourceType, resourceaws.AwsApiGatewayRestApiResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayMethodResourceType, resourceaws.AwsApiGatewayRestApiResourceType), }, @@ -1061,7 +1061,7 @@ func TestApiGatewayMethod(t *testing.T) { mocks: func(repo *repository.MockApiGatewayRepository, alerter *mocks.AlerterInterface) { repo.On("ListAllRestApis").Return(apis, nil) repo.On("ListAllRestApiResources", *apis[0].Id).Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayMethodResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayMethodResourceType, resourceaws.AwsApiGatewayResourceResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayMethodResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayMethodResourceType, resourceaws.AwsApiGatewayResourceResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayMethodResourceType, resourceaws.AwsApiGatewayResourceResourceType), }, @@ -1075,7 +1075,7 @@ func TestApiGatewayMethod(t *testing.T) { for _, c := range tests { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -1149,7 +1149,7 @@ func TestApiGatewayModel(t *testing.T) { test: "cannot list rest apis", mocks: func(repo *repository.MockApiGatewayRepository, alerter *mocks.AlerterInterface) { repo.On("ListAllRestApis").Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayModelResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayModelResourceType, resourceaws.AwsApiGatewayRestApiResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayModelResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayModelResourceType, resourceaws.AwsApiGatewayRestApiResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayModelResourceType, resourceaws.AwsApiGatewayRestApiResourceType), }, @@ -1158,7 +1158,7 @@ func TestApiGatewayModel(t *testing.T) { mocks: func(repo *repository.MockApiGatewayRepository, alerter *mocks.AlerterInterface) { repo.On("ListAllRestApis").Return(apis, nil) repo.On("ListAllRestApiModels", *apis[0].Id).Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayModelResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayModelResourceType, resourceaws.AwsApiGatewayModelResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayModelResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayModelResourceType, resourceaws.AwsApiGatewayModelResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingError(dummyError, resourceaws.AwsApiGatewayModelResourceType), }, @@ -1172,7 +1172,7 @@ func TestApiGatewayModel(t *testing.T) { for _, c := range tests { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -1258,7 +1258,7 @@ func TestApiGatewayMethodResponse(t *testing.T) { test: "cannot list rest apis", mocks: func(repo *repository.MockApiGatewayRepository, alerter *mocks.AlerterInterface) { repo.On("ListAllRestApis").Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayMethodResponseResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayMethodResponseResourceType, resourceaws.AwsApiGatewayRestApiResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayMethodResponseResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayMethodResponseResourceType, resourceaws.AwsApiGatewayRestApiResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayMethodResponseResourceType, resourceaws.AwsApiGatewayRestApiResourceType), }, @@ -1267,7 +1267,7 @@ func TestApiGatewayMethodResponse(t *testing.T) { mocks: func(repo *repository.MockApiGatewayRepository, alerter *mocks.AlerterInterface) { repo.On("ListAllRestApis").Return(apis, nil) repo.On("ListAllRestApiResources", *apis[0].Id).Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayMethodResponseResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayMethodResponseResourceType, resourceaws.AwsApiGatewayResourceResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayMethodResponseResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayMethodResponseResourceType, resourceaws.AwsApiGatewayResourceResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayMethodResponseResourceType, resourceaws.AwsApiGatewayResourceResourceType), }, @@ -1281,7 +1281,7 @@ func TestApiGatewayMethodResponse(t *testing.T) { for _, c := range tests { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -1355,7 +1355,7 @@ func TestApiGatewayGatewayResponse(t *testing.T) { test: "cannot list rest apis", mocks: func(repo *repository.MockApiGatewayRepository, alerter *mocks.AlerterInterface) { repo.On("ListAllRestApis").Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayGatewayResponseResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayGatewayResponseResourceType, resourceaws.AwsApiGatewayRestApiResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayGatewayResponseResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayGatewayResponseResourceType, resourceaws.AwsApiGatewayRestApiResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayGatewayResponseResourceType, resourceaws.AwsApiGatewayRestApiResourceType), }, @@ -1364,7 +1364,7 @@ func TestApiGatewayGatewayResponse(t *testing.T) { mocks: func(repo *repository.MockApiGatewayRepository, alerter *mocks.AlerterInterface) { repo.On("ListAllRestApis").Return(apis, nil) repo.On("ListAllRestApiGatewayResponses", *apis[0].Id).Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayGatewayResponseResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayGatewayResponseResourceType, resourceaws.AwsApiGatewayGatewayResponseResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayGatewayResponseResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayGatewayResponseResourceType, resourceaws.AwsApiGatewayGatewayResponseResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingError(dummyError, resourceaws.AwsApiGatewayGatewayResponseResourceType), }, @@ -1378,7 +1378,7 @@ func TestApiGatewayGatewayResponse(t *testing.T) { for _, c := range tests { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -1460,7 +1460,7 @@ func TestApiGatewayMethodSettings(t *testing.T) { test: "cannot list rest apis", mocks: func(repo *repository.MockApiGatewayRepository, alerter *mocks.AlerterInterface) { repo.On("ListAllRestApis").Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayMethodSettingsResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayMethodSettingsResourceType, resourceaws.AwsApiGatewayRestApiResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayMethodSettingsResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayMethodSettingsResourceType, resourceaws.AwsApiGatewayRestApiResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayMethodSettingsResourceType, resourceaws.AwsApiGatewayRestApiResourceType), }, @@ -1469,7 +1469,7 @@ func TestApiGatewayMethodSettings(t *testing.T) { mocks: func(repo *repository.MockApiGatewayRepository, alerter *mocks.AlerterInterface) { repo.On("ListAllRestApis").Return(apis, nil) repo.On("ListAllRestApiStages", *apis[0].Id).Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayMethodSettingsResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayMethodSettingsResourceType, resourceaws.AwsApiGatewayStageResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayMethodSettingsResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayMethodSettingsResourceType, resourceaws.AwsApiGatewayStageResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayMethodSettingsResourceType, resourceaws.AwsApiGatewayStageResourceType), }, @@ -1483,7 +1483,7 @@ func TestApiGatewayMethodSettings(t *testing.T) { for _, c := range tests { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -1565,7 +1565,7 @@ func TestApiGatewayIntegration(t *testing.T) { test: "cannot list rest apis", mocks: func(repo *repository.MockApiGatewayRepository, alerter *mocks.AlerterInterface) { repo.On("ListAllRestApis").Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayIntegrationResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayIntegrationResourceType, resourceaws.AwsApiGatewayRestApiResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayIntegrationResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayIntegrationResourceType, resourceaws.AwsApiGatewayRestApiResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayIntegrationResourceType, resourceaws.AwsApiGatewayRestApiResourceType), }, @@ -1574,7 +1574,7 @@ func TestApiGatewayIntegration(t *testing.T) { mocks: func(repo *repository.MockApiGatewayRepository, alerter *mocks.AlerterInterface) { repo.On("ListAllRestApis").Return(apis, nil) repo.On("ListAllRestApiResources", *apis[0].Id).Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayIntegrationResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayIntegrationResourceType, resourceaws.AwsApiGatewayResourceResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayIntegrationResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayIntegrationResourceType, resourceaws.AwsApiGatewayResourceResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayIntegrationResourceType, resourceaws.AwsApiGatewayResourceResourceType), }, @@ -1588,7 +1588,7 @@ func TestApiGatewayIntegration(t *testing.T) { for _, c := range tests { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -1674,7 +1674,7 @@ func TestApiGatewayIntegrationResponse(t *testing.T) { test: "cannot list rest apis", mocks: func(repo *repository.MockApiGatewayRepository, alerter *mocks.AlerterInterface) { repo.On("ListAllRestApis").Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayIntegrationResponseResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayIntegrationResponseResourceType, resourceaws.AwsApiGatewayRestApiResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayIntegrationResponseResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayIntegrationResponseResourceType, resourceaws.AwsApiGatewayRestApiResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayIntegrationResponseResourceType, resourceaws.AwsApiGatewayRestApiResourceType), }, @@ -1683,7 +1683,7 @@ func TestApiGatewayIntegrationResponse(t *testing.T) { mocks: func(repo *repository.MockApiGatewayRepository, alerter *mocks.AlerterInterface) { repo.On("ListAllRestApis").Return(apis, nil) repo.On("ListAllRestApiResources", *apis[0].Id).Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayIntegrationResponseResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayIntegrationResponseResourceType, resourceaws.AwsApiGatewayResourceResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayIntegrationResponseResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayIntegrationResponseResourceType, resourceaws.AwsApiGatewayResourceResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayIntegrationResponseResourceType, resourceaws.AwsApiGatewayResourceResourceType), }, @@ -1697,7 +1697,7 @@ func TestApiGatewayIntegrationResponse(t *testing.T) { for _, c := range tests { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} diff --git a/enumeration/remote/aws_apigatewayv2_scanner_test.go b/enumeration/remote/aws_apigatewayv2_scanner_test.go index e6a07bca..2b87b96a 100644 --- a/enumeration/remote/aws_apigatewayv2_scanner_test.go +++ b/enumeration/remote/aws_apigatewayv2_scanner_test.go @@ -7,7 +7,7 @@ import ( "github.com/snyk/driftctl/enumeration/remote/alerts" aws2 "github.com/snyk/driftctl/enumeration/remote/aws" "github.com/snyk/driftctl/enumeration/remote/aws/repository" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" remoteerr "github.com/snyk/driftctl/enumeration/remote/error" "github.com/snyk/driftctl/enumeration/terraform" @@ -60,7 +60,7 @@ func TestApiGatewayV2Api(t *testing.T) { test: "cannot list api gateway v2 apis", mocks: func(repository *repository.MockApiGatewayV2Repository, alerter *mocks.AlerterInterface) { repository.On("ListAllApis").Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayV2ApiResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2ApiResourceType, resourceaws.AwsApiGatewayV2ApiResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayV2ApiResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2ApiResourceType, resourceaws.AwsApiGatewayV2ApiResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingError(dummyError, resourceaws.AwsApiGatewayV2ApiResourceType), }, @@ -74,7 +74,7 @@ func TestApiGatewayV2Api(t *testing.T) { for _, c := range tests { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -149,7 +149,7 @@ func TestApiGatewayV2Route(t *testing.T) { test: "cannot list api gateway v2 apis", mocks: func(repository *repository.MockApiGatewayV2Repository, alerter *mocks.AlerterInterface) { repository.On("ListAllApis").Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayV2RouteResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2ApiResourceType, resourceaws.AwsApiGatewayV2RouteResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayV2RouteResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2ApiResourceType, resourceaws.AwsApiGatewayV2RouteResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2RouteResourceType, resourceaws.AwsApiGatewayV2ApiResourceType), }, @@ -163,7 +163,7 @@ func TestApiGatewayV2Route(t *testing.T) { for _, c := range tests { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -247,7 +247,7 @@ func TestApiGatewayV2Deployment(t *testing.T) { test: "error listing API gateways", mocks: func(repository *repository.MockApiGatewayV2Repository, alerter *mocks.AlerterInterface) { repository.On("ListAllApis").Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayV2DeploymentResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2ApiResourceType, resourceaws.AwsApiGatewayV2RouteResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayV2DeploymentResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2ApiResourceType, resourceaws.AwsApiGatewayV2RouteResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2DeploymentResourceType, resourceaws.AwsApiGatewayV2ApiResourceType), }, @@ -258,7 +258,7 @@ func TestApiGatewayV2Deployment(t *testing.T) { {ApiId: awssdk.String("a-gateway")}, }, nil) repository.On("ListAllApiDeployments", awssdk.String("a-gateway")).Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayV2DeploymentResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2DeploymentResourceType, resourceaws.AwsApiGatewayV2DeploymentResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayV2DeploymentResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2DeploymentResourceType, resourceaws.AwsApiGatewayV2DeploymentResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2DeploymentResourceType, resourceaws.AwsApiGatewayV2DeploymentResourceType), }, @@ -272,7 +272,7 @@ func TestApiGatewayV2Deployment(t *testing.T) { for _, c := range tests { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -337,7 +337,7 @@ func TestApiGatewayV2VpcLink(t *testing.T) { test: "cannot list api gateway v2 vpc links", mocks: func(repository *repository.MockApiGatewayV2Repository, alerter *mocks.AlerterInterface) { repository.On("ListAllVpcLinks").Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayV2VpcLinkResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2VpcLinkResourceType, resourceaws.AwsApiGatewayV2VpcLinkResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayV2VpcLinkResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2VpcLinkResourceType, resourceaws.AwsApiGatewayV2VpcLinkResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingError(dummyError, resourceaws.AwsApiGatewayV2VpcLinkResourceType), }, @@ -351,7 +351,7 @@ func TestApiGatewayV2VpcLink(t *testing.T) { for _, c := range tests { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -430,7 +430,7 @@ func TestApiGatewayV2Authorizer(t *testing.T) { test: "cannot list apis", mocks: func(repo *repository.MockApiGatewayV2Repository, alerter *mocks.AlerterInterface) { repo.On("ListAllApis").Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayV2AuthorizerResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2AuthorizerResourceType, resourceaws.AwsApiGatewayV2ApiResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayV2AuthorizerResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2AuthorizerResourceType, resourceaws.AwsApiGatewayV2ApiResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2AuthorizerResourceType, resourceaws.AwsApiGatewayV2ApiResourceType), }, @@ -439,7 +439,7 @@ func TestApiGatewayV2Authorizer(t *testing.T) { mocks: func(repo *repository.MockApiGatewayV2Repository, alerter *mocks.AlerterInterface) { repo.On("ListAllApis").Return(apis, nil) repo.On("ListAllApiAuthorizers", *apis[0].ApiId).Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayV2AuthorizerResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2AuthorizerResourceType, resourceaws.AwsApiGatewayV2AuthorizerResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayV2AuthorizerResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2AuthorizerResourceType, resourceaws.AwsApiGatewayV2AuthorizerResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingError(dummyError, resourceaws.AwsApiGatewayV2AuthorizerResourceType), }, @@ -453,7 +453,7 @@ func TestApiGatewayV2Authorizer(t *testing.T) { for _, c := range tests { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -538,7 +538,7 @@ func TestApiGatewayV2Integration(t *testing.T) { test: "cannot list apis", mocks: func(repo *repository.MockApiGatewayV2Repository, alerter *mocks.AlerterInterface) { repo.On("ListAllApis").Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayV2IntegrationResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2IntegrationResourceType, resourceaws.AwsApiGatewayV2ApiResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayV2IntegrationResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2IntegrationResourceType, resourceaws.AwsApiGatewayV2ApiResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2IntegrationResourceType, resourceaws.AwsApiGatewayV2ApiResourceType), }, @@ -547,7 +547,7 @@ func TestApiGatewayV2Integration(t *testing.T) { mocks: func(repo *repository.MockApiGatewayV2Repository, alerter *mocks.AlerterInterface) { repo.On("ListAllApis").Return(apis, nil) repo.On("ListAllApiIntegrations", *apis[0].ApiId).Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayV2IntegrationResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2IntegrationResourceType, resourceaws.AwsApiGatewayV2IntegrationResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayV2IntegrationResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2IntegrationResourceType, resourceaws.AwsApiGatewayV2IntegrationResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingError(dummyError, resourceaws.AwsApiGatewayV2IntegrationResourceType), }, @@ -561,7 +561,7 @@ func TestApiGatewayV2Integration(t *testing.T) { for _, c := range tests { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -649,7 +649,7 @@ func TestApiGatewayV2Model(t *testing.T) { test: "cannot list apis", mocks: func(repo *repository.MockApiGatewayV2Repository, alerter *mocks.AlerterInterface) { repo.On("ListAllApis").Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayV2ModelResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2ModelResourceType, resourceaws.AwsApiGatewayV2ApiResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayV2ModelResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2ModelResourceType, resourceaws.AwsApiGatewayV2ApiResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2ModelResourceType, resourceaws.AwsApiGatewayV2ApiResourceType), }, @@ -658,7 +658,7 @@ func TestApiGatewayV2Model(t *testing.T) { mocks: func(repo *repository.MockApiGatewayV2Repository, alerter *mocks.AlerterInterface) { repo.On("ListAllApis").Return(apis, nil) repo.On("ListAllApiModels", *apis[0].ApiId).Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayV2ModelResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2ModelResourceType, resourceaws.AwsApiGatewayV2ModelResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayV2ModelResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2ModelResourceType, resourceaws.AwsApiGatewayV2ModelResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingError(dummyError, resourceaws.AwsApiGatewayV2ModelResourceType), }, @@ -672,7 +672,7 @@ func TestApiGatewayV2Model(t *testing.T) { for _, c := range tests { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -741,7 +741,7 @@ func TestApiGatewayV2Stage(t *testing.T) { test: "cannot list api gateway v2 apis", mocks: func(repository *repository.MockApiGatewayV2Repository, alerter *mocks.AlerterInterface) { repository.On("ListAllApis").Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayV2StageResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2ApiResourceType, resourceaws.AwsApiGatewayV2StageResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayV2StageResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2ApiResourceType, resourceaws.AwsApiGatewayV2StageResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2StageResourceType, resourceaws.AwsApiGatewayV2ApiResourceType), }, @@ -755,7 +755,7 @@ func TestApiGatewayV2Stage(t *testing.T) { for _, c := range tests { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -836,7 +836,7 @@ func TestApiGatewayV2RouteResponse(t *testing.T) { test: "cannot list api gateway v2 apis", mocks: func(repository *repository.MockApiGatewayV2Repository, alerter *mocks.AlerterInterface) { repository.On("ListAllApis").Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayV2RouteResponseResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2ApiResourceType, resourceaws.AwsApiGatewayV2RouteResponseResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayV2RouteResponseResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2ApiResourceType, resourceaws.AwsApiGatewayV2RouteResponseResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2RouteResponseResourceType, resourceaws.AwsApiGatewayV2ApiResourceType), }, @@ -847,7 +847,7 @@ func TestApiGatewayV2RouteResponse(t *testing.T) { {ApiId: awssdk.String("77ooqulkke")}, }, nil) repository.On("ListAllApiRoutes", awssdk.String("77ooqulkke")).Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayV2RouteResponseResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2RouteResourceType, resourceaws.AwsApiGatewayV2RouteResponseResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayV2RouteResponseResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2RouteResourceType, resourceaws.AwsApiGatewayV2RouteResponseResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2RouteResponseResourceType, resourceaws.AwsApiGatewayV2RouteResourceType), }, @@ -862,7 +862,7 @@ func TestApiGatewayV2RouteResponse(t *testing.T) { {RouteId: awssdk.String("liqc5u4")}, }, nil) repository.On("ListAllApiRouteResponses", "77ooqulkke", "liqc5u4").Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayV2RouteResponseResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2RouteResponseResourceType, resourceaws.AwsApiGatewayV2RouteResponseResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayV2RouteResponseResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2RouteResponseResourceType, resourceaws.AwsApiGatewayV2RouteResponseResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2RouteResponseResourceType, resourceaws.AwsApiGatewayV2RouteResponseResourceType), }, @@ -876,7 +876,7 @@ func TestApiGatewayV2RouteResponse(t *testing.T) { for _, c := range tests { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -947,7 +947,7 @@ func TestApiGatewayV2Mapping(t *testing.T) { test: "cannot list api gateway v2 domains", mocks: func(repositoryV1 *repository.MockApiGatewayRepository, repository *repository.MockApiGatewayV2Repository, alerter *mocks.AlerterInterface) { repositoryV1.On("ListAllDomainNames").Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayV2MappingResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayDomainNameResourceType, resourceaws.AwsApiGatewayV2MappingResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayV2MappingResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayDomainNameResourceType, resourceaws.AwsApiGatewayV2MappingResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2MappingResourceType, resourceaws.AwsApiGatewayDomainNameResourceType), }, @@ -959,7 +959,7 @@ func TestApiGatewayV2Mapping(t *testing.T) { }, nil) repository.On("ListAllApiMappings", "example.com"). Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayV2MappingResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2MappingResourceType, resourceaws.AwsApiGatewayV2MappingResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayV2MappingResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2MappingResourceType, resourceaws.AwsApiGatewayV2MappingResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingError(dummyError, resourceaws.AwsApiGatewayV2MappingResourceType), }, @@ -1001,7 +1001,7 @@ func TestApiGatewayV2Mapping(t *testing.T) { for _, c := range tests { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -1066,7 +1066,7 @@ func TestApiGatewayV2DomainName(t *testing.T) { test: "cannot list api gateway v2 domain names", mocks: func(repository *repository.MockApiGatewayRepository, alerter *mocks.AlerterInterface) { repository.On("ListAllDomainNames").Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayV2DomainNameResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2DomainNameResourceType, resourceaws.AwsApiGatewayV2DomainNameResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayV2DomainNameResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2DomainNameResourceType, resourceaws.AwsApiGatewayV2DomainNameResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingError(dummyError, resourceaws.AwsApiGatewayV2DomainNameResourceType), }, @@ -1080,7 +1080,7 @@ func TestApiGatewayV2DomainName(t *testing.T) { for _, c := range tests { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -1161,7 +1161,7 @@ func TestApiGatewayV2IntegrationResponse(t *testing.T) { test: "cannot list api gateway v2 apis", mocks: func(repository *repository.MockApiGatewayV2Repository, alerter *mocks.AlerterInterface) { repository.On("ListAllApis").Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayV2IntegrationResponseResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2ApiResourceType, resourceaws.AwsApiGatewayV2IntegrationResponseResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayV2IntegrationResponseResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2ApiResourceType, resourceaws.AwsApiGatewayV2IntegrationResponseResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2IntegrationResponseResourceType, resourceaws.AwsApiGatewayV2ApiResourceType), }, @@ -1172,7 +1172,7 @@ func TestApiGatewayV2IntegrationResponse(t *testing.T) { {ApiId: awssdk.String("yw28nwdf34")}, }, nil) repository.On("ListAllApiIntegrations", "yw28nwdf34").Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayV2IntegrationResponseResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2IntegrationResourceType, resourceaws.AwsApiGatewayV2IntegrationResponseResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayV2IntegrationResponseResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2IntegrationResourceType, resourceaws.AwsApiGatewayV2IntegrationResponseResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2IntegrationResponseResourceType, resourceaws.AwsApiGatewayV2IntegrationResourceType), }, @@ -1187,7 +1187,7 @@ func TestApiGatewayV2IntegrationResponse(t *testing.T) { {IntegrationId: awssdk.String("fmezvlh")}, }, nil) repository.On("ListAllApiIntegrationResponses", "yw28nwdf34", "fmezvlh").Return(nil, dummyError) - alerter.On("SendAlert", resourceaws.AwsApiGatewayV2IntegrationResponseResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2IntegrationResponseResourceType, resourceaws.AwsApiGatewayV2IntegrationResponseResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsApiGatewayV2IntegrationResponseResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2IntegrationResponseResourceType, resourceaws.AwsApiGatewayV2IntegrationResponseResourceType), alerts.EnumerationPhase)).Return() }, wantErr: remoteerr.NewResourceListingErrorWithType(dummyError, resourceaws.AwsApiGatewayV2IntegrationResponseResourceType, resourceaws.AwsApiGatewayV2IntegrationResponseResourceType), }, @@ -1201,7 +1201,7 @@ func TestApiGatewayV2IntegrationResponse(t *testing.T) { for _, c := range tests { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} diff --git a/enumeration/remote/aws_applicationautoscaling_scanner_test.go b/enumeration/remote/aws_applicationautoscaling_scanner_test.go index 3b159fca..265139de 100644 --- a/enumeration/remote/aws_applicationautoscaling_scanner_test.go +++ b/enumeration/remote/aws_applicationautoscaling_scanner_test.go @@ -7,7 +7,7 @@ import ( aws2 "github.com/snyk/driftctl/enumeration/remote/aws" "github.com/snyk/driftctl/enumeration/remote/aws/repository" "github.com/snyk/driftctl/enumeration/remote/cache" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" remoteerror "github.com/snyk/driftctl/enumeration/remote/error" terraform3 "github.com/snyk/driftctl/enumeration/terraform" @@ -82,7 +82,7 @@ func TestAppAutoScalingTarget(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -109,7 +109,7 @@ func TestAppAutoScalingTarget(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewAppAutoscalingTargetEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsAppAutoscalingTargetResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsAppAutoscalingTargetResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsAppAutoscalingTargetResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsAppAutoscalingTargetResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -185,7 +185,7 @@ func TestAppAutoScalingPolicy(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -212,7 +212,7 @@ func TestAppAutoScalingPolicy(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewAppAutoscalingPolicyEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsAppAutoscalingPolicyResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsAppAutoscalingPolicyResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsAppAutoscalingPolicyResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsAppAutoscalingPolicyResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -298,7 +298,7 @@ func TestAppAutoScalingScheduledAction(t *testing.T) { for _, c := range tests { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} diff --git a/enumeration/remote/aws_autoscaling_scanner_test.go b/enumeration/remote/aws_autoscaling_scanner_test.go index 4dedb86f..eb66ba72 100644 --- a/enumeration/remote/aws_autoscaling_scanner_test.go +++ b/enumeration/remote/aws_autoscaling_scanner_test.go @@ -7,7 +7,7 @@ import ( "github.com/snyk/driftctl/enumeration/remote/alerts" "github.com/snyk/driftctl/enumeration/remote/aws" "github.com/snyk/driftctl/enumeration/remote/aws/repository" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" remoteerr "github.com/snyk/driftctl/enumeration/remote/error" "github.com/snyk/driftctl/enumeration/terraform" @@ -64,7 +64,7 @@ func TestAutoscaling_LaunchConfiguration(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repository.On("DescribeLaunchConfigurations").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsLaunchConfigurationResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsLaunchConfigurationResourceType, resourceaws.AwsLaunchConfigurationResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsLaunchConfigurationResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsLaunchConfigurationResourceType, resourceaws.AwsLaunchConfigurationResourceType), alerts.EnumerationPhase)).Return() }, assertExpected: func(t *testing.T, got []*resource.Resource) { assert.Len(t, got, 0) @@ -81,7 +81,7 @@ func TestAutoscaling_LaunchConfiguration(t *testing.T) { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} diff --git a/enumeration/remote/aws_cloudformation_scanner_test.go b/enumeration/remote/aws_cloudformation_scanner_test.go index 5a7e588b..778fd7dc 100644 --- a/enumeration/remote/aws_cloudformation_scanner_test.go +++ b/enumeration/remote/aws_cloudformation_scanner_test.go @@ -9,7 +9,7 @@ import ( "github.com/snyk/driftctl/enumeration/remote/aws" "github.com/snyk/driftctl/enumeration/remote/aws/repository" "github.com/snyk/driftctl/enumeration/remote/cache" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" remoteerr "github.com/snyk/driftctl/enumeration/remote/error" terraform3 "github.com/snyk/driftctl/enumeration/terraform" @@ -60,7 +60,7 @@ func TestCloudformationStack(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 400, "") repository.On("ListAllStacks").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsCloudformationStackResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsCloudformationStackResourceType, resourceaws.AwsCloudformationStackResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsCloudformationStackResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsCloudformationStackResourceType, resourceaws.AwsCloudformationStackResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -81,7 +81,7 @@ func TestCloudformationStack(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -108,7 +108,7 @@ func TestCloudformationStack(t *testing.T) { } remoteLibrary.AddEnumerator(aws.NewCloudformationStackEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsCloudformationStackResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsCloudformationStackResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsCloudformationStackResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsCloudformationStackResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) diff --git a/enumeration/remote/aws_cloudfront_scanner_test.go b/enumeration/remote/aws_cloudfront_scanner_test.go index 0521b196..81c9549c 100644 --- a/enumeration/remote/aws_cloudfront_scanner_test.go +++ b/enumeration/remote/aws_cloudfront_scanner_test.go @@ -8,7 +8,7 @@ import ( "github.com/snyk/driftctl/enumeration/remote/aws" "github.com/snyk/driftctl/enumeration/remote/aws/repository" "github.com/snyk/driftctl/enumeration/remote/cache" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" remoteerr "github.com/snyk/driftctl/enumeration/remote/error" terraform3 "github.com/snyk/driftctl/enumeration/terraform" @@ -59,7 +59,7 @@ func TestCloudfrontDistribution(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 400, "") repository.On("ListAllDistributions").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsCloudfrontDistributionResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsCloudfrontDistributionResourceType, resourceaws.AwsCloudfrontDistributionResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsCloudfrontDistributionResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsCloudfrontDistributionResourceType, resourceaws.AwsCloudfrontDistributionResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -80,7 +80,7 @@ func TestCloudfrontDistribution(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -107,7 +107,7 @@ func TestCloudfrontDistribution(t *testing.T) { } remoteLibrary.AddEnumerator(aws.NewCloudfrontDistributionEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsCloudfrontDistributionResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsCloudfrontDistributionResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsCloudfrontDistributionResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsCloudfrontDistributionResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) diff --git a/enumeration/remote/aws_dynamodb_scanner_test.go b/enumeration/remote/aws_dynamodb_scanner_test.go index 6ed7272d..3a19dec2 100644 --- a/enumeration/remote/aws_dynamodb_scanner_test.go +++ b/enumeration/remote/aws_dynamodb_scanner_test.go @@ -9,7 +9,7 @@ import ( "github.com/snyk/driftctl/enumeration/remote/aws" "github.com/snyk/driftctl/enumeration/remote/aws/repository" "github.com/snyk/driftctl/enumeration/remote/cache" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" remoteerr "github.com/snyk/driftctl/enumeration/remote/error" terraform3 "github.com/snyk/driftctl/enumeration/terraform" @@ -61,7 +61,7 @@ func TestDynamoDBTable(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 400, "") client.On("ListAllTables").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsDynamodbTableResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsDynamodbTableResourceType, resourceaws.AwsDynamodbTableResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsDynamodbTableResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsDynamodbTableResourceType, resourceaws.AwsDynamodbTableResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -82,7 +82,7 @@ func TestDynamoDBTable(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -109,7 +109,7 @@ func TestDynamoDBTable(t *testing.T) { } remoteLibrary.AddEnumerator(aws.NewDynamoDBTableEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsDynamodbTableResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsDynamodbTableResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsDynamodbTableResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsDynamodbTableResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) diff --git a/enumeration/remote/aws_ec2_scanner_test.go b/enumeration/remote/aws_ec2_scanner_test.go index 2e91694b..fbdd11fd 100644 --- a/enumeration/remote/aws_ec2_scanner_test.go +++ b/enumeration/remote/aws_ec2_scanner_test.go @@ -8,7 +8,7 @@ import ( aws2 "github.com/snyk/driftctl/enumeration/remote/aws" "github.com/snyk/driftctl/enumeration/remote/aws/repository" "github.com/snyk/driftctl/enumeration/remote/cache" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" remoteerr "github.com/snyk/driftctl/enumeration/remote/error" terraform3 "github.com/snyk/driftctl/enumeration/terraform" @@ -60,7 +60,7 @@ func TestEC2EbsVolume(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repository.On("ListAllVolumes").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsEbsVolumeResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsEbsVolumeResourceType, resourceaws.AwsEbsVolumeResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsEbsVolumeResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsEbsVolumeResourceType, resourceaws.AwsEbsVolumeResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -81,7 +81,7 @@ func TestEC2EbsVolume(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -108,7 +108,7 @@ func TestEC2EbsVolume(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewEC2EbsVolumeEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsEbsVolumeResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsEbsVolumeResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsEbsVolumeResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsEbsVolumeResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -157,7 +157,7 @@ func TestEC2EbsSnapshot(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repository.On("ListAllSnapshots").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsEbsSnapshotResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsEbsSnapshotResourceType, resourceaws.AwsEbsSnapshotResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsEbsSnapshotResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsEbsSnapshotResourceType, resourceaws.AwsEbsSnapshotResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -178,7 +178,7 @@ func TestEC2EbsSnapshot(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -205,7 +205,7 @@ func TestEC2EbsSnapshot(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewEC2EbsSnapshotEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsEbsSnapshotResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsEbsSnapshotResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsEbsSnapshotResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsEbsSnapshotResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -256,7 +256,7 @@ func TestEC2Eip(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repository.On("ListAllAddresses").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsEipResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsEipResourceType, resourceaws.AwsEipResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsEipResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsEipResourceType, resourceaws.AwsEipResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -277,7 +277,7 @@ func TestEC2Eip(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -304,7 +304,7 @@ func TestEC2Eip(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewEC2EipEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsEipResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsEipResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsEipResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsEipResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -353,7 +353,7 @@ func TestEC2Ami(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repository.On("ListAllImages").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsAmiResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsAmiResourceType, resourceaws.AwsAmiResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsAmiResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsAmiResourceType, resourceaws.AwsAmiResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -374,7 +374,7 @@ func TestEC2Ami(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -401,7 +401,7 @@ func TestEC2Ami(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewEC2AmiEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsAmiResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsAmiResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsAmiResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsAmiResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -450,7 +450,7 @@ func TestEC2KeyPair(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repository.On("ListAllKeyPairs").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsKeyPairResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsKeyPairResourceType, resourceaws.AwsKeyPairResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsKeyPairResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsKeyPairResourceType, resourceaws.AwsKeyPairResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -471,7 +471,7 @@ func TestEC2KeyPair(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -498,7 +498,7 @@ func TestEC2KeyPair(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewEC2KeyPairEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsKeyPairResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsKeyPairResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsKeyPairResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsKeyPairResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -549,7 +549,7 @@ func TestEC2EipAssociation(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repository.On("ListAllAddressesAssociation").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsEipAssociationResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsEipAssociationResourceType, resourceaws.AwsEipAssociationResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsEipAssociationResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsEipAssociationResourceType, resourceaws.AwsEipAssociationResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -570,7 +570,7 @@ func TestEC2EipAssociation(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -597,7 +597,7 @@ func TestEC2EipAssociation(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewEC2EipAssociationEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsEipAssociationResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsEipAssociationResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsEipAssociationResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsEipAssociationResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -656,7 +656,7 @@ func TestEC2Instance(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repository.On("ListAllInstances").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsInstanceResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsInstanceResourceType, resourceaws.AwsInstanceResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsInstanceResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsInstanceResourceType, resourceaws.AwsInstanceResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -677,7 +677,7 @@ func TestEC2Instance(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -704,7 +704,7 @@ func TestEC2Instance(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewEC2InstanceEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsInstanceResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsInstanceResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsInstanceResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsInstanceResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -753,7 +753,7 @@ func TestEC2InternetGateway(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repository.On("ListAllInternetGateways").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsInternetGatewayResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsInternetGatewayResourceType, resourceaws.AwsInternetGatewayResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsInternetGatewayResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsInternetGatewayResourceType, resourceaws.AwsInternetGatewayResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -774,7 +774,7 @@ func TestEC2InternetGateway(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -801,7 +801,7 @@ func TestEC2InternetGateway(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewEC2InternetGatewayEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsInternetGatewayResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsInternetGatewayResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsInternetGatewayResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsInternetGatewayResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -867,7 +867,7 @@ func TestVPC(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") client.On("ListAllVPCs").Once().Return(nil, nil, awsError) - alerter.On("SendAlert", resourceaws.AwsVpcResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsVpcResourceType, resourceaws.AwsVpcResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsVpcResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsVpcResourceType, resourceaws.AwsVpcResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -888,7 +888,7 @@ func TestVPC(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -915,7 +915,7 @@ func TestVPC(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewVPCEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsVpcResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsVpcResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsVpcResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsVpcResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -978,7 +978,7 @@ func TestDefaultVPC(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") client.On("ListAllVPCs").Once().Return(nil, nil, awsError) - alerter.On("SendAlert", resourceaws.AwsDefaultVpcResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsDefaultVpcResourceType, resourceaws.AwsDefaultVpcResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsDefaultVpcResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsDefaultVpcResourceType, resourceaws.AwsDefaultVpcResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -999,7 +999,7 @@ func TestDefaultVPC(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -1026,7 +1026,7 @@ func TestDefaultVPC(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewDefaultVPCEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsDefaultVpcResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsDefaultVpcResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsDefaultVpcResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsDefaultVpcResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -1144,7 +1144,7 @@ func TestEC2RouteTableAssociation(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repository.On("ListAllRouteTables").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsRouteTableAssociationResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsRouteTableAssociationResourceType, resourceaws.AwsRouteTableResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsRouteTableAssociationResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsRouteTableAssociationResourceType, resourceaws.AwsRouteTableResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -1165,7 +1165,7 @@ func TestEC2RouteTableAssociation(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -1192,7 +1192,7 @@ func TestEC2RouteTableAssociation(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewEC2RouteTableAssociationEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsRouteTableAssociationResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsRouteTableAssociationResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsRouteTableAssociationResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsRouteTableAssociationResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -1264,7 +1264,7 @@ func TestEC2Subnet(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repository.On("ListAllSubnets").Return(nil, nil, awsError) - alerter.On("SendAlert", resourceaws.AwsSubnetResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsSubnetResourceType, resourceaws.AwsSubnetResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsSubnetResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsSubnetResourceType, resourceaws.AwsSubnetResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -1285,7 +1285,7 @@ func TestEC2Subnet(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -1312,7 +1312,7 @@ func TestEC2Subnet(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewEC2SubnetEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsSubnetResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsSubnetResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsSubnetResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsSubnetResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -1384,7 +1384,7 @@ func TestEC2DefaultSubnet(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repository.On("ListAllSubnets").Return(nil, nil, awsError) - alerter.On("SendAlert", resourceaws.AwsDefaultSubnetResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsDefaultSubnetResourceType, resourceaws.AwsDefaultSubnetResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsDefaultSubnetResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsDefaultSubnetResourceType, resourceaws.AwsDefaultSubnetResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -1405,7 +1405,7 @@ func TestEC2DefaultSubnet(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -1432,7 +1432,7 @@ func TestEC2DefaultSubnet(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewEC2DefaultSubnetEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsDefaultSubnetResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsDefaultSubnetResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsDefaultSubnetResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsDefaultSubnetResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -1491,7 +1491,7 @@ func TestEC2RouteTable(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repository.On("ListAllRouteTables").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsRouteTableResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsRouteTableResourceType, resourceaws.AwsRouteTableResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsRouteTableResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsRouteTableResourceType, resourceaws.AwsRouteTableResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -1512,7 +1512,7 @@ func TestEC2RouteTable(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -1539,7 +1539,7 @@ func TestEC2RouteTable(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewEC2RouteTableEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsRouteTableResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsRouteTableResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsRouteTableResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsRouteTableResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -1598,7 +1598,7 @@ func TestEC2DefaultRouteTable(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repository.On("ListAllRouteTables").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsDefaultRouteTableResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsDefaultRouteTableResourceType, resourceaws.AwsDefaultRouteTableResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsDefaultRouteTableResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsDefaultRouteTableResourceType, resourceaws.AwsDefaultRouteTableResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -1619,7 +1619,7 @@ func TestEC2DefaultRouteTable(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -1646,7 +1646,7 @@ func TestEC2DefaultRouteTable(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewEC2DefaultRouteTableEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsDefaultRouteTableResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsDefaultRouteTableResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsDefaultRouteTableResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsDefaultRouteTableResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -1705,7 +1705,7 @@ func TestVpcSecurityGroup(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") client.On("ListAllSecurityGroups").Return(nil, nil, awsError) - alerter.On("SendAlert", resourceaws.AwsSecurityGroupResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsSecurityGroupResourceType, resourceaws.AwsSecurityGroupResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsSecurityGroupResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsSecurityGroupResourceType, resourceaws.AwsSecurityGroupResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -1726,7 +1726,7 @@ func TestVpcSecurityGroup(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -1753,7 +1753,7 @@ func TestVpcSecurityGroup(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewVPCSecurityGroupEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsSecurityGroupResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsSecurityGroupResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsSecurityGroupResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsSecurityGroupResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -1812,7 +1812,7 @@ func TestVpcDefaultSecurityGroup(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") client.On("ListAllSecurityGroups").Return(nil, nil, awsError) - alerter.On("SendAlert", resourceaws.AwsDefaultSecurityGroupResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsDefaultSecurityGroupResourceType, resourceaws.AwsDefaultSecurityGroupResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsDefaultSecurityGroupResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsDefaultSecurityGroupResourceType, resourceaws.AwsDefaultSecurityGroupResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -1833,7 +1833,7 @@ func TestVpcDefaultSecurityGroup(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -1860,7 +1860,7 @@ func TestVpcDefaultSecurityGroup(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewVPCDefaultSecurityGroupEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsDefaultSecurityGroupResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsDefaultSecurityGroupResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsDefaultSecurityGroupResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsDefaultSecurityGroupResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -1908,7 +1908,7 @@ func TestEC2NatGateway(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repository.On("ListAllNatGateways").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsNatGatewayResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsNatGatewayResourceType, resourceaws.AwsNatGatewayResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsNatGatewayResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsNatGatewayResourceType, resourceaws.AwsNatGatewayResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -1929,7 +1929,7 @@ func TestEC2NatGateway(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -1956,7 +1956,7 @@ func TestEC2NatGateway(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewEC2NatGatewayEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsNatGatewayResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsNatGatewayResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsNatGatewayResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsNatGatewayResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -2018,7 +2018,7 @@ func TestEC2NetworkACL(t *testing.T) { alerter.On("SendAlert", resourceaws.AwsNetworkACLResourceType, alerts.NewRemoteAccessDeniedAlert( - common2.RemoteAWSTerraform, + common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType( awsError, resourceaws.AwsNetworkACLResourceType, @@ -2047,7 +2047,7 @@ func TestEC2NetworkACL(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -2074,7 +2074,7 @@ func TestEC2NetworkACL(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewEC2NetworkACLEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsNetworkACLResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsNetworkACLResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsNetworkACLResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsNetworkACLResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -2171,7 +2171,7 @@ func TestEC2NetworkACLRule(t *testing.T) { alerter.On("SendAlert", resourceaws.AwsNetworkACLRuleResourceType, alerts.NewRemoteAccessDeniedAlert( - common2.RemoteAWSTerraform, + common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType( awsError, resourceaws.AwsNetworkACLRuleResourceType, @@ -2197,7 +2197,7 @@ func TestEC2NetworkACLRule(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -2223,7 +2223,7 @@ func TestEC2NetworkACLRule(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewEC2NetworkACLRuleEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsNetworkACLRuleResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsNetworkACLRuleResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsNetworkACLRuleResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsNetworkACLRuleResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -2285,7 +2285,7 @@ func TestEC2DefaultNetworkACL(t *testing.T) { alerter.On("SendAlert", resourceaws.AwsDefaultNetworkACLResourceType, alerts.NewRemoteAccessDeniedAlert( - common2.RemoteAWSTerraform, + common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType( awsError, resourceaws.AwsDefaultNetworkACLResourceType, @@ -2314,7 +2314,7 @@ func TestEC2DefaultNetworkACL(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -2341,7 +2341,7 @@ func TestEC2DefaultNetworkACL(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewEC2DefaultNetworkACLEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsDefaultNetworkACLResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsDefaultNetworkACLResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsDefaultNetworkACLResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsDefaultNetworkACLResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -2462,7 +2462,7 @@ func TestEC2Route(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repository.On("ListAllRouteTables").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsRouteResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsRouteResourceType, resourceaws.AwsRouteTableResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsRouteResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsRouteResourceType, resourceaws.AwsRouteTableResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -2483,7 +2483,7 @@ func TestEC2Route(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -2510,7 +2510,7 @@ func TestEC2Route(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewEC2RouteEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsRouteResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsRouteResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsRouteResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsRouteResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -2653,7 +2653,7 @@ func TestVpcSecurityGroupRule(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") client.On("ListAllSecurityGroups").Once().Return(nil, nil, awsError) - alerter.On("SendAlert", resourceaws.AwsSecurityGroupRuleResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsSecurityGroupRuleResourceType, resourceaws.AwsSecurityGroupResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsSecurityGroupRuleResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsSecurityGroupRuleResourceType, resourceaws.AwsSecurityGroupResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -2674,7 +2674,7 @@ func TestVpcSecurityGroupRule(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -2701,7 +2701,7 @@ func TestVpcSecurityGroupRule(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewVPCSecurityGroupRuleEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsSecurityGroupRuleResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsSecurityGroupRuleResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsSecurityGroupRuleResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsSecurityGroupRuleResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -2752,7 +2752,7 @@ func TestEC2LaunchTemplate(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repository.On("DescribeLaunchTemplates").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsLaunchTemplateResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsLaunchTemplateResourceType, resourceaws.AwsLaunchTemplateResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsLaunchTemplateResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsLaunchTemplateResourceType, resourceaws.AwsLaunchTemplateResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -2773,7 +2773,7 @@ func TestEC2LaunchTemplate(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -2800,7 +2800,7 @@ func TestEC2LaunchTemplate(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewLaunchTemplateEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsLaunchTemplateResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsLaunchTemplateResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsLaunchTemplateResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsLaunchTemplateResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -2840,7 +2840,7 @@ func TestEC2EbsEncryptionByDefault(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repository.On("IsEbsEncryptionEnabledByDefault").Return(false, awsError) - alerter.On("SendAlert", resourceaws.AwsEbsEncryptionByDefaultResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsEbsEncryptionByDefaultResourceType, resourceaws.AwsEbsEncryptionByDefaultResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsEbsEncryptionByDefaultResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsEbsEncryptionByDefaultResourceType, resourceaws.AwsEbsEncryptionByDefaultResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -2861,7 +2861,7 @@ func TestEC2EbsEncryptionByDefault(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -2888,7 +2888,7 @@ func TestEC2EbsEncryptionByDefault(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewEC2EbsEncryptionByDefaultEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsEbsEncryptionByDefaultResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsEbsEncryptionByDefaultResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsEbsEncryptionByDefaultResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsEbsEncryptionByDefaultResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) diff --git a/enumeration/remote/aws_ecr_scanner_test.go b/enumeration/remote/aws_ecr_scanner_test.go index ad914a40..4cc44eb0 100644 --- a/enumeration/remote/aws_ecr_scanner_test.go +++ b/enumeration/remote/aws_ecr_scanner_test.go @@ -8,7 +8,7 @@ import ( aws2 "github.com/snyk/driftctl/enumeration/remote/aws" "github.com/snyk/driftctl/enumeration/remote/aws/repository" "github.com/snyk/driftctl/enumeration/remote/cache" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" remoteerr "github.com/snyk/driftctl/enumeration/remote/error" terraform3 "github.com/snyk/driftctl/enumeration/terraform" @@ -62,7 +62,7 @@ func TestECRRepository(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") client.On("ListAllRepositories").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsEcrRepositoryResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsEcrRepositoryResourceType, resourceaws.AwsEcrRepositoryResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsEcrRepositoryResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsEcrRepositoryResourceType, resourceaws.AwsEcrRepositoryResourceType), alerts.EnumerationPhase)).Return() }, err: nil, }, @@ -83,7 +83,7 @@ func TestECRRepository(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -110,7 +110,7 @@ func TestECRRepository(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewECRRepositoryEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsEcrRepositoryResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsEcrRepositoryResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsEcrRepositoryResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsEcrRepositoryResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -169,7 +169,7 @@ func TestECRRepositoryPolicy(t *testing.T) { for _, c := range tests { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} diff --git a/enumeration/remote/aws_elasticache_scanner_test.go b/enumeration/remote/aws_elasticache_scanner_test.go index ec4b72f8..05e3a14a 100644 --- a/enumeration/remote/aws_elasticache_scanner_test.go +++ b/enumeration/remote/aws_elasticache_scanner_test.go @@ -8,7 +8,7 @@ import ( "github.com/snyk/driftctl/enumeration/remote/alerts" "github.com/snyk/driftctl/enumeration/remote/aws" "github.com/snyk/driftctl/enumeration/remote/aws/repository" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" remoteerr "github.com/snyk/driftctl/enumeration/remote/error" "github.com/snyk/driftctl/enumeration/terraform" @@ -60,7 +60,7 @@ func TestElastiCacheCluster(t *testing.T) { mocks: func(repository *repository.MockElastiCacheRepository, alerter *mocks.AlerterInterface) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repository.On("ListAllCacheClusters").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsElastiCacheClusterResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsElastiCacheClusterResourceType, resourceaws.AwsElastiCacheClusterResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsElastiCacheClusterResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsElastiCacheClusterResourceType, resourceaws.AwsElastiCacheClusterResourceType), alerts.EnumerationPhase)).Return() }, assertExpected: func(t *testing.T, got []*resource.Resource) { assert.Len(t, got, 0) @@ -86,7 +86,7 @@ func TestElastiCacheCluster(t *testing.T) { for _, c := range tests { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} diff --git a/enumeration/remote/aws_elb_scanner_test.go b/enumeration/remote/aws_elb_scanner_test.go index 4122bfb1..b0243705 100644 --- a/enumeration/remote/aws_elb_scanner_test.go +++ b/enumeration/remote/aws_elb_scanner_test.go @@ -8,7 +8,7 @@ import ( "github.com/snyk/driftctl/enumeration/remote/alerts" "github.com/snyk/driftctl/enumeration/remote/aws" "github.com/snyk/driftctl/enumeration/remote/aws/repository" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" remoteerr "github.com/snyk/driftctl/enumeration/remote/error" "github.com/snyk/driftctl/enumeration/terraform" @@ -63,7 +63,7 @@ func TestELB_LoadBalancer(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repository.On("ListAllLoadBalancers").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsClassicLoadBalancerResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsClassicLoadBalancerResourceType, resourceaws.AwsClassicLoadBalancerResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsClassicLoadBalancerResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsClassicLoadBalancerResourceType, resourceaws.AwsClassicLoadBalancerResourceType), alerts.EnumerationPhase)).Return() }, assertExpected: func(t *testing.T, got []*resource.Resource) { assert.Len(t, got, 0) @@ -89,7 +89,7 @@ func TestELB_LoadBalancer(t *testing.T) { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} diff --git a/enumeration/remote/aws_elbv2_scanner_test.go b/enumeration/remote/aws_elbv2_scanner_test.go index 80739fe4..954e645a 100644 --- a/enumeration/remote/aws_elbv2_scanner_test.go +++ b/enumeration/remote/aws_elbv2_scanner_test.go @@ -8,7 +8,7 @@ import ( "github.com/snyk/driftctl/enumeration/remote/alerts" aws2 "github.com/snyk/driftctl/enumeration/remote/aws" "github.com/snyk/driftctl/enumeration/remote/aws/repository" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" remoteerr "github.com/snyk/driftctl/enumeration/remote/error" "github.com/snyk/driftctl/enumeration/terraform" @@ -64,7 +64,7 @@ func TestELBV2_LoadBalancer(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repository.On("ListAllLoadBalancers").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsLoadBalancerResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsLoadBalancerResourceType, resourceaws.AwsLoadBalancerResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsLoadBalancerResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsLoadBalancerResourceType, resourceaws.AwsLoadBalancerResourceType), alerts.EnumerationPhase)).Return() }, assertExpected: func(t *testing.T, got []*resource.Resource) { assert.Len(t, got, 0) @@ -90,7 +90,7 @@ func TestELBV2_LoadBalancer(t *testing.T) { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -174,7 +174,7 @@ func TestELBV2_LoadBalancerListener(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repository.On("ListAllLoadBalancerListeners", "test-lb").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsLoadBalancerListenerResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingError(awsError, resourceaws.AwsLoadBalancerListenerResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsLoadBalancerListenerResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingError(awsError, resourceaws.AwsLoadBalancerListenerResourceType), alerts.EnumerationPhase)).Return() }, assertExpected: func(t *testing.T, got []*resource.Resource) { assert.Len(t, got, 0) @@ -186,7 +186,7 @@ func TestELBV2_LoadBalancerListener(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repository.On("ListAllLoadBalancers").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsLoadBalancerListenerResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsLoadBalancerListenerResourceType, resourceaws.AwsLoadBalancerResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsLoadBalancerListenerResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsLoadBalancerListenerResourceType, resourceaws.AwsLoadBalancerResourceType), alerts.EnumerationPhase)).Return() }, assertExpected: func(t *testing.T, got []*resource.Resource) { assert.Len(t, got, 0) @@ -218,7 +218,7 @@ func TestELBV2_LoadBalancerListener(t *testing.T) { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} diff --git a/enumeration/remote/aws_iam_scanner_test.go b/enumeration/remote/aws_iam_scanner_test.go index b157de25..69959959 100644 --- a/enumeration/remote/aws_iam_scanner_test.go +++ b/enumeration/remote/aws_iam_scanner_test.go @@ -8,7 +8,7 @@ import ( aws2 "github.com/snyk/driftctl/enumeration/remote/aws" "github.com/snyk/driftctl/enumeration/remote/aws/repository" "github.com/snyk/driftctl/enumeration/remote/cache" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" remoteerr "github.com/snyk/driftctl/enumeration/remote/error" terraform3 "github.com/snyk/driftctl/enumeration/terraform" @@ -70,7 +70,7 @@ func TestIamUser(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repo.On("ListAllUsers").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsIamUserResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsIamUserResourceType, resourceaws.AwsIamUserResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsIamUserResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsIamUserResourceType, resourceaws.AwsIamUserResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -90,7 +90,7 @@ func TestIamUser(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -117,7 +117,7 @@ func TestIamUser(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewIamUserEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsIamUserResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsIamUserResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsIamUserResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsIamUserResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -197,7 +197,7 @@ func TestIamUserPolicy(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repo.On("ListAllUsers").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsIamUserPolicyResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsIamUserPolicyResourceType, resourceaws.AwsIamUserResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsIamUserPolicyResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsIamUserPolicyResourceType, resourceaws.AwsIamUserResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -209,7 +209,7 @@ func TestIamUserPolicy(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repo.On("ListAllUserPolicies", mock.Anything).Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsIamUserPolicyResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsIamUserPolicyResourceType, resourceaws.AwsIamUserPolicyResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsIamUserPolicyResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsIamUserPolicyResourceType, resourceaws.AwsIamUserPolicyResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -229,7 +229,7 @@ func TestIamUserPolicy(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -256,7 +256,7 @@ func TestIamUserPolicy(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewIamUserPolicyEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsIamUserPolicyResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsIamUserPolicyResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsIamUserPolicyResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsIamUserPolicyResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -315,7 +315,7 @@ func TestIamPolicy(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repo.On("ListAllPolicies").Once().Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsIamPolicyResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsIamPolicyResourceType, resourceaws.AwsIamPolicyResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsIamPolicyResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsIamPolicyResourceType, resourceaws.AwsIamPolicyResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -336,7 +336,7 @@ func TestIamPolicy(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -363,7 +363,7 @@ func TestIamPolicy(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewIamPolicyEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsIamPolicyResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsIamPolicyResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsIamPolicyResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsIamPolicyResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -456,7 +456,7 @@ func TestIamRole(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -483,7 +483,7 @@ func TestIamRole(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewIamRoleEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsIamRoleResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsIamRoleResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsIamRoleResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsIamRoleResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -608,7 +608,7 @@ func TestIamRolePolicyAttachment(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repo.On("ListAllRoles").Once().Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsIamRolePolicyAttachmentResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsIamRolePolicyAttachmentResourceType, resourceaws.AwsIamRoleResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsIamRolePolicyAttachmentResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsIamRolePolicyAttachmentResourceType, resourceaws.AwsIamRoleResourceType), alerts.EnumerationPhase)).Return() }, }, { @@ -619,7 +619,7 @@ func TestIamRolePolicyAttachment(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repo.On("ListAllRolePolicyAttachments", mock.Anything).Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsIamRolePolicyAttachmentResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsIamRolePolicyAttachmentResourceType, resourceaws.AwsIamRolePolicyAttachmentResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsIamRolePolicyAttachmentResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsIamRolePolicyAttachmentResourceType, resourceaws.AwsIamRolePolicyAttachmentResourceType), alerts.EnumerationPhase)).Return() }, }, } @@ -639,7 +639,7 @@ func TestIamRolePolicyAttachment(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -666,7 +666,7 @@ func TestIamRolePolicyAttachment(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewIamRolePolicyAttachmentEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsIamRolePolicyAttachmentResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsIamRolePolicyAttachmentResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsIamRolePolicyAttachmentResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsIamRolePolicyAttachmentResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -744,7 +744,7 @@ func TestIamAccessKey(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repo.On("ListAllUsers").Once().Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsIamAccessKeyResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsIamAccessKeyResourceType, resourceaws.AwsIamUserResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsIamAccessKeyResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsIamAccessKeyResourceType, resourceaws.AwsIamUserResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -756,7 +756,7 @@ func TestIamAccessKey(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repo.On("ListAllAccessKeys", mock.Anything).Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsIamAccessKeyResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsIamAccessKeyResourceType, resourceaws.AwsIamAccessKeyResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsIamAccessKeyResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsIamAccessKeyResourceType, resourceaws.AwsIamAccessKeyResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -777,7 +777,7 @@ func TestIamAccessKey(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -804,7 +804,7 @@ func TestIamAccessKey(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewIamAccessKeyEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsIamAccessKeyResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsIamAccessKeyResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsIamAccessKeyResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsIamAccessKeyResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -957,7 +957,7 @@ func TestIamUserPolicyAttachment(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repo.On("ListAllUsers").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsIamUserPolicyAttachmentResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsIamUserPolicyAttachmentResourceType, resourceaws.AwsIamUserResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsIamUserPolicyAttachmentResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsIamUserPolicyAttachmentResourceType, resourceaws.AwsIamUserResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -969,7 +969,7 @@ func TestIamUserPolicyAttachment(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repo.On("ListAllUserPolicyAttachments", mock.Anything).Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsIamUserPolicyAttachmentResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsIamUserPolicyAttachmentResourceType, resourceaws.AwsIamUserPolicyAttachmentResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsIamUserPolicyAttachmentResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsIamUserPolicyAttachmentResourceType, resourceaws.AwsIamUserPolicyAttachmentResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -990,7 +990,7 @@ func TestIamUserPolicyAttachment(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -1017,7 +1017,7 @@ func TestIamUserPolicyAttachment(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewIamUserPolicyAttachmentEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsIamUserPolicyAttachmentResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsIamUserPolicyAttachmentResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsIamUserPolicyAttachmentResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsIamUserPolicyAttachmentResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -1088,7 +1088,7 @@ func TestIamRolePolicy(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repo.On("ListAllRoles").Once().Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsIamRolePolicyResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsIamRolePolicyResourceType, resourceaws.AwsIamRoleResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsIamRolePolicyResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsIamRolePolicyResourceType, resourceaws.AwsIamRoleResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -1100,7 +1100,7 @@ func TestIamRolePolicy(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repo.On("ListAllRolePolicies", mock.Anything).Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsIamRolePolicyResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsIamRolePolicyResourceType, resourceaws.AwsIamRolePolicyResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsIamRolePolicyResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsIamRolePolicyResourceType, resourceaws.AwsIamRolePolicyResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -1121,7 +1121,7 @@ func TestIamRolePolicy(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -1148,7 +1148,7 @@ func TestIamRolePolicy(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewIamRolePolicyEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsIamRolePolicyResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsIamRolePolicyResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsIamRolePolicyResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsIamRolePolicyResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -1215,7 +1215,7 @@ func TestIamGroupPolicy(t *testing.T) { for _, c := range tests { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -1292,7 +1292,7 @@ func TestIamGroup(t *testing.T) { for _, c := range tests { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} diff --git a/enumeration/remote/aws_kms_scanner_test.go b/enumeration/remote/aws_kms_scanner_test.go index 71a40fc4..909be64d 100644 --- a/enumeration/remote/aws_kms_scanner_test.go +++ b/enumeration/remote/aws_kms_scanner_test.go @@ -8,7 +8,7 @@ import ( aws2 "github.com/snyk/driftctl/enumeration/remote/aws" "github.com/snyk/driftctl/enumeration/remote/aws/repository" "github.com/snyk/driftctl/enumeration/remote/cache" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" remoteerr "github.com/snyk/driftctl/enumeration/remote/error" terraform3 "github.com/snyk/driftctl/enumeration/terraform" @@ -61,7 +61,7 @@ func TestKMSKey(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repository.On("ListAllKeys").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsKmsKeyResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsKmsKeyResourceType, resourceaws.AwsKmsKeyResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsKmsKeyResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsKmsKeyResourceType, resourceaws.AwsKmsKeyResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -82,7 +82,7 @@ func TestKMSKey(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -109,7 +109,7 @@ func TestKMSKey(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewKMSKeyEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsKmsKeyResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsKmsKeyResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsKmsKeyResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsKmsKeyResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -159,7 +159,7 @@ func TestKMSAlias(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repository.On("ListAllAliases").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsKmsAliasResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsKmsAliasResourceType, resourceaws.AwsKmsAliasResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsKmsAliasResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsKmsAliasResourceType, resourceaws.AwsKmsAliasResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -180,7 +180,7 @@ func TestKMSAlias(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -207,7 +207,7 @@ func TestKMSAlias(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewKMSAliasEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsKmsAliasResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsKmsAliasResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsKmsAliasResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsKmsAliasResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) diff --git a/enumeration/remote/aws_lambda_scanner_test.go b/enumeration/remote/aws_lambda_scanner_test.go index 047f71d8..6f6bfea5 100644 --- a/enumeration/remote/aws_lambda_scanner_test.go +++ b/enumeration/remote/aws_lambda_scanner_test.go @@ -8,7 +8,7 @@ import ( aws2 "github.com/snyk/driftctl/enumeration/remote/aws" "github.com/snyk/driftctl/enumeration/remote/aws/repository" "github.com/snyk/driftctl/enumeration/remote/cache" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" remoteerr "github.com/snyk/driftctl/enumeration/remote/error" terraform3 "github.com/snyk/driftctl/enumeration/terraform" @@ -81,7 +81,7 @@ func TestScanLambdaFunction(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repo.On("ListAllLambdaFunctions").Return([]*lambda.FunctionConfiguration{}, awsError) - alerter.On("SendAlert", resourceaws.AwsLambdaFunctionResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsLambdaFunctionResourceType, resourceaws.AwsLambdaFunctionResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsLambdaFunctionResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsLambdaFunctionResourceType, resourceaws.AwsLambdaFunctionResourceType), alerts.EnumerationPhase)).Return() }, err: nil, }, @@ -102,7 +102,7 @@ func TestScanLambdaFunction(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -129,7 +129,7 @@ func TestScanLambdaFunction(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewLambdaFunctionEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsLambdaFunctionResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsLambdaFunctionResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsLambdaFunctionResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsLambdaFunctionResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -197,7 +197,7 @@ func TestScanLambdaEventSourceMapping(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repo.On("ListAllLambdaEventSourceMappings").Return([]*lambda.EventSourceMappingConfiguration{}, awsError) - alerter.On("SendAlert", resourceaws.AwsLambdaEventSourceMappingResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsLambdaEventSourceMappingResourceType, resourceaws.AwsLambdaEventSourceMappingResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsLambdaEventSourceMappingResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsLambdaEventSourceMappingResourceType, resourceaws.AwsLambdaEventSourceMappingResourceType), alerts.EnumerationPhase)).Return() }, err: nil, }, @@ -218,7 +218,7 @@ func TestScanLambdaEventSourceMapping(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -245,7 +245,7 @@ func TestScanLambdaEventSourceMapping(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewLambdaEventSourceMappingEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsLambdaEventSourceMappingResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsLambdaEventSourceMappingResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsLambdaEventSourceMappingResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsLambdaEventSourceMappingResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) diff --git a/enumeration/remote/aws_rds_scanner_test.go b/enumeration/remote/aws_rds_scanner_test.go index 2e4ac1bf..278b547c 100644 --- a/enumeration/remote/aws_rds_scanner_test.go +++ b/enumeration/remote/aws_rds_scanner_test.go @@ -8,7 +8,7 @@ import ( aws2 "github.com/snyk/driftctl/enumeration/remote/aws" "github.com/snyk/driftctl/enumeration/remote/aws/repository" "github.com/snyk/driftctl/enumeration/remote/cache" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" remoteerr "github.com/snyk/driftctl/enumeration/remote/error" terraform3 "github.com/snyk/driftctl/enumeration/terraform" @@ -69,7 +69,7 @@ func TestRDSDBInstance(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repository.On("ListAllDBInstances").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsDbInstanceResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsDbInstanceResourceType, resourceaws.AwsDbInstanceResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsDbInstanceResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsDbInstanceResourceType, resourceaws.AwsDbInstanceResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -90,7 +90,7 @@ func TestRDSDBInstance(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -117,7 +117,7 @@ func TestRDSDBInstance(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewRDSDBInstanceEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsDbInstanceResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsDbInstanceResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsDbInstanceResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsDbInstanceResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -166,7 +166,7 @@ func TestRDSDBSubnetGroup(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repository.On("ListAllDBSubnetGroups").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsDbSubnetGroupResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsDbSubnetGroupResourceType, resourceaws.AwsDbSubnetGroupResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsDbSubnetGroupResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsDbSubnetGroupResourceType, resourceaws.AwsDbSubnetGroupResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -187,7 +187,7 @@ func TestRDSDBSubnetGroup(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -214,7 +214,7 @@ func TestRDSDBSubnetGroup(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewRDSDBSubnetGroupEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsDbSubnetGroupResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsDbSubnetGroupResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsDbSubnetGroupResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsDbSubnetGroupResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -268,7 +268,7 @@ func TestRDSCluster(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 400, "") repository.On("ListAllDBClusters").Return(nil, awsError).Once() - alerter.On("SendAlert", resourceaws.AwsRDSClusterResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsRDSClusterResourceType, resourceaws.AwsRDSClusterResourceType), alerts.EnumerationPhase)).Return().Once() + alerter.On("SendAlert", resourceaws.AwsRDSClusterResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsRDSClusterResourceType, resourceaws.AwsRDSClusterResourceType), alerts.EnumerationPhase)).Return().Once() }, wantErr: nil, }, @@ -289,7 +289,7 @@ func TestRDSCluster(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -316,7 +316,7 @@ func TestRDSCluster(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewRDSClusterEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsRDSClusterResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsRDSClusterResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsRDSClusterResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsRDSClusterResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) diff --git a/enumeration/remote/aws_route53_scanner_test.go b/enumeration/remote/aws_route53_scanner_test.go index c3e29d41..78180142 100644 --- a/enumeration/remote/aws_route53_scanner_test.go +++ b/enumeration/remote/aws_route53_scanner_test.go @@ -6,7 +6,7 @@ import ( aws2 "github.com/snyk/driftctl/enumeration/remote/aws" "github.com/snyk/driftctl/enumeration/remote/aws/repository" "github.com/snyk/driftctl/enumeration/remote/cache" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" remoteerr "github.com/snyk/driftctl/enumeration/remote/error" terraform3 "github.com/snyk/driftctl/enumeration/terraform" "testing" @@ -64,7 +64,7 @@ func TestRoute53_HealthCheck(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") client.On("ListAllHealthChecks").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsRoute53HealthCheckResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsRoute53HealthCheckResourceType, resourceaws.AwsRoute53HealthCheckResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsRoute53HealthCheckResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsRoute53HealthCheckResourceType, resourceaws.AwsRoute53HealthCheckResourceType), alerts.EnumerationPhase)).Return() }, err: nil, }, @@ -85,7 +85,7 @@ func TestRoute53_HealthCheck(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -112,7 +112,7 @@ func TestRoute53_HealthCheck(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewRoute53HealthCheckEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsRoute53HealthCheckResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsRoute53HealthCheckResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsRoute53HealthCheckResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsRoute53HealthCheckResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -199,7 +199,7 @@ func TestRoute53_Zone(t *testing.T) { awsError, ) - alerter.On("SendAlert", resourceaws.AwsRoute53ZoneResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsRoute53ZoneResourceType, resourceaws.AwsRoute53ZoneResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsRoute53ZoneResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsRoute53ZoneResourceType, resourceaws.AwsRoute53ZoneResourceType), alerts.EnumerationPhase)).Return() }, err: nil, }, @@ -220,7 +220,7 @@ func TestRoute53_Zone(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -247,7 +247,7 @@ func TestRoute53_Zone(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewRoute53ZoneEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsRoute53ZoneResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsRoute53ZoneResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsRoute53ZoneResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsRoute53ZoneResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -389,7 +389,7 @@ func TestRoute53_Record(t *testing.T) { []*route53.HostedZone{}, awsError) - alerter.On("SendAlert", resourceaws.AwsRoute53RecordResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsRoute53RecordResourceType, resourceaws.AwsRoute53ZoneResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsRoute53RecordResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsRoute53RecordResourceType, resourceaws.AwsRoute53ZoneResourceType), alerts.EnumerationPhase)).Return() }, err: nil, }, @@ -409,7 +409,7 @@ func TestRoute53_Record(t *testing.T) { client.On("ListRecordsForZone", "Z06486383UC8WYSBZTWFM").Return( []*route53.ResourceRecordSet{}, awsError) - alerter.On("SendAlert", resourceaws.AwsRoute53RecordResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsRoute53RecordResourceType, resourceaws.AwsRoute53RecordResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsRoute53RecordResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsRoute53RecordResourceType, resourceaws.AwsRoute53RecordResourceType), alerts.EnumerationPhase)).Return() }, err: nil, }, @@ -430,7 +430,7 @@ func TestRoute53_Record(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -457,7 +457,7 @@ func TestRoute53_Record(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewRoute53RecordEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsRoute53RecordResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsRoute53RecordResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsRoute53RecordResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsRoute53RecordResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) diff --git a/enumeration/remote/aws_s3_scanner_test.go b/enumeration/remote/aws_s3_scanner_test.go index d9f15c02..295c2a41 100644 --- a/enumeration/remote/aws_s3_scanner_test.go +++ b/enumeration/remote/aws_s3_scanner_test.go @@ -9,7 +9,7 @@ import ( "github.com/snyk/driftctl/enumeration/remote/aws/client" "github.com/snyk/driftctl/enumeration/remote/aws/repository" "github.com/snyk/driftctl/enumeration/remote/cache" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" remoteerr "github.com/snyk/driftctl/enumeration/remote/error" tf "github.com/snyk/driftctl/enumeration/remote/terraform" terraform3 "github.com/snyk/driftctl/enumeration/terraform" @@ -83,7 +83,7 @@ func TestS3Bucket(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repository.On("ListAllBuckets").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsS3BucketResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsS3BucketResourceType, resourceaws.AwsS3BucketResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsS3BucketResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsS3BucketResourceType, resourceaws.AwsS3BucketResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -104,7 +104,7 @@ func TestS3Bucket(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -133,7 +133,7 @@ func TestS3Bucket(t *testing.T) { Name: "test", DefaultAlias: "eu-west-3", }, alerter)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsS3BucketResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsS3BucketResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsS3BucketResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsS3BucketResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -213,7 +213,7 @@ func TestS3BucketInventory(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repository.On("ListAllBuckets").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsS3BucketInventoryResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsS3BucketInventoryResourceType, resourceaws.AwsS3BucketResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsS3BucketInventoryResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsS3BucketInventoryResourceType, resourceaws.AwsS3BucketResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -243,7 +243,7 @@ func TestS3BucketInventory(t *testing.T) { awsError, ) - alerter.On("SendAlert", resourceaws.AwsS3BucketInventoryResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsS3BucketInventoryResourceType, resourceaws.AwsS3BucketInventoryResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsS3BucketInventoryResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsS3BucketInventoryResourceType, resourceaws.AwsS3BucketInventoryResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -264,7 +264,7 @@ func TestS3BucketInventory(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -293,7 +293,7 @@ func TestS3BucketInventory(t *testing.T) { Name: "test", DefaultAlias: "eu-west-3", }, alerter)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsS3BucketInventoryResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsS3BucketInventoryResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsS3BucketInventoryResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsS3BucketInventoryResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -419,7 +419,7 @@ func TestS3BucketNotification(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repository.On("GetBucketNotification", "dritftctl-test-notifications-error", "eu-west-3").Return(nil, awsError) - alerter.On("SendAlert", "aws_s3_bucket_notification.dritftctl-test-notifications-error", alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, "aws_s3_bucket_notification.dritftctl-test-notifications-error", resourceaws.AwsS3BucketNotificationResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", "aws_s3_bucket_notification.dritftctl-test-notifications-error", alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, "aws_s3_bucket_notification.dritftctl-test-notifications-error", resourceaws.AwsS3BucketNotificationResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -429,7 +429,7 @@ func TestS3BucketNotification(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repository.On("ListAllBuckets").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsS3BucketNotificationResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsS3BucketNotificationResourceType, resourceaws.AwsS3BucketResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsS3BucketNotificationResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsS3BucketNotificationResourceType, resourceaws.AwsS3BucketResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -450,7 +450,7 @@ func TestS3BucketNotification(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -479,7 +479,7 @@ func TestS3BucketNotification(t *testing.T) { Name: "test", DefaultAlias: "eu-west-3", }, alerter)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsS3BucketNotificationResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsS3BucketNotificationResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsS3BucketNotificationResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsS3BucketNotificationResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -559,7 +559,7 @@ func TestS3BucketMetrics(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repository.On("ListAllBuckets").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsS3BucketMetricResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsS3BucketMetricResourceType, resourceaws.AwsS3BucketResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsS3BucketMetricResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsS3BucketMetricResourceType, resourceaws.AwsS3BucketResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -590,7 +590,7 @@ func TestS3BucketMetrics(t *testing.T) { awsError, ) - alerter.On("SendAlert", resourceaws.AwsS3BucketMetricResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsS3BucketMetricResourceType, resourceaws.AwsS3BucketMetricResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsS3BucketMetricResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsS3BucketMetricResourceType, resourceaws.AwsS3BucketMetricResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -611,7 +611,7 @@ func TestS3BucketMetrics(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -640,7 +640,7 @@ func TestS3BucketMetrics(t *testing.T) { Name: "test", DefaultAlias: "eu-west-3", }, alerter)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsS3BucketMetricResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsS3BucketMetricResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsS3BucketMetricResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsS3BucketMetricResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -748,7 +748,7 @@ func TestS3BucketPolicy(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repository.On("ListAllBuckets").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsS3BucketPolicyResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsS3BucketPolicyResourceType, resourceaws.AwsS3BucketResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsS3BucketPolicyResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsS3BucketPolicyResourceType, resourceaws.AwsS3BucketResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -769,7 +769,7 @@ func TestS3BucketPolicy(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -798,7 +798,7 @@ func TestS3BucketPolicy(t *testing.T) { Name: "test", DefaultAlias: "eu-west-3", }, alerter)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsS3BucketPolicyResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsS3BucketPolicyResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsS3BucketPolicyResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsS3BucketPolicyResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -872,7 +872,7 @@ func TestS3BucketPublicAccessBlock(t *testing.T) { repository.On("ListAllBuckets").Return([]*s3.Bucket{{Name: awssdk.String("foobar")}}, nil) repository.On("GetBucketLocation", "foobar").Return("us-east-1", nil) repository.On("GetBucketPublicAccessBlock", "foobar", "us-east-1").Return(nil, dummyError) - alerter.On("SendAlert", "aws_s3_bucket_public_access_block.foobar", alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceScanningError(dummyError, resourceaws.AwsS3BucketPublicAccessBlockResourceType, "foobar"), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", "aws_s3_bucket_public_access_block.foobar", alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceScanningError(dummyError, resourceaws.AwsS3BucketPublicAccessBlockResourceType, "foobar"), alerts.EnumerationPhase)).Return() }, assertExpected: func(t *testing.T, got []*resource.Resource) { assert.Len(t, got, 0) @@ -888,7 +888,7 @@ func TestS3BucketPublicAccessBlock(t *testing.T) { for _, c := range tests { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -984,7 +984,7 @@ func TestS3BucketAnalytic(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") repository.On("ListAllBuckets").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsS3BucketAnalyticsConfigurationResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsS3BucketAnalyticsConfigurationResourceType, resourceaws.AwsS3BucketResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsS3BucketAnalyticsConfigurationResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsS3BucketAnalyticsConfigurationResourceType, resourceaws.AwsS3BucketResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -1015,7 +1015,7 @@ func TestS3BucketAnalytic(t *testing.T) { awsError, ) - alerter.On("SendAlert", resourceaws.AwsS3BucketAnalyticsConfigurationResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsS3BucketAnalyticsConfigurationResourceType, resourceaws.AwsS3BucketAnalyticsConfigurationResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsS3BucketAnalyticsConfigurationResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsS3BucketAnalyticsConfigurationResourceType, resourceaws.AwsS3BucketAnalyticsConfigurationResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -1036,7 +1036,7 @@ func TestS3BucketAnalytic(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -1065,7 +1065,7 @@ func TestS3BucketAnalytic(t *testing.T) { Name: "test", DefaultAlias: "eu-west-3", }, alerter)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsS3BucketAnalyticsConfigurationResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsS3BucketAnalyticsConfigurationResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsS3BucketAnalyticsConfigurationResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsS3BucketAnalyticsConfigurationResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) diff --git a/enumeration/remote/aws_sns_scanner_test.go b/enumeration/remote/aws_sns_scanner_test.go index ebe6741d..c842f129 100644 --- a/enumeration/remote/aws_sns_scanner_test.go +++ b/enumeration/remote/aws_sns_scanner_test.go @@ -8,7 +8,7 @@ import ( aws2 "github.com/snyk/driftctl/enumeration/remote/aws" "github.com/snyk/driftctl/enumeration/remote/aws/repository" "github.com/snyk/driftctl/enumeration/remote/cache" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" remoteerr "github.com/snyk/driftctl/enumeration/remote/error" terraform3 "github.com/snyk/driftctl/enumeration/terraform" @@ -66,7 +66,7 @@ func TestScanSNSTopic(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") client.On("ListAllTopics").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsSnsTopicResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsSnsTopicResourceType, resourceaws.AwsSnsTopicResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsSnsTopicResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsSnsTopicResourceType, resourceaws.AwsSnsTopicResourceType), alerts.EnumerationPhase)).Return() }, err: nil, }, @@ -87,7 +87,7 @@ func TestScanSNSTopic(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -114,7 +114,7 @@ func TestScanSNSTopic(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewSNSTopicEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsSnsTopicResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsSnsTopicResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsSnsTopicResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsSnsTopicResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -166,7 +166,7 @@ func TestSNSTopicPolicyScan(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") client.On("ListAllTopics").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsSnsTopicPolicyResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsSnsTopicPolicyResourceType, resourceaws.AwsSnsTopicResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsSnsTopicPolicyResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsSnsTopicPolicyResourceType, resourceaws.AwsSnsTopicResourceType), alerts.EnumerationPhase)).Return() }, err: nil, }, @@ -187,7 +187,7 @@ func TestSNSTopicPolicyScan(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -214,7 +214,7 @@ func TestSNSTopicPolicyScan(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewSNSTopicPolicyEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsSnsTopicPolicyResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsSnsTopicPolicyResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsSnsTopicPolicyResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsSnsTopicPolicyResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -283,7 +283,7 @@ func TestSNSTopicSubscriptionScan(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") client.On("ListAllSubscriptions").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsSnsTopicSubscriptionResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsSnsTopicSubscriptionResourceType, resourceaws.AwsSnsTopicSubscriptionResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsSnsTopicSubscriptionResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsSnsTopicSubscriptionResourceType, resourceaws.AwsSnsTopicSubscriptionResourceType), alerts.EnumerationPhase)).Return() }, err: nil, }, @@ -304,7 +304,7 @@ func TestSNSTopicSubscriptionScan(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -331,7 +331,7 @@ func TestSNSTopicSubscriptionScan(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewSNSTopicSubscriptionEnumerator(repo, factory, alerter)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsSnsTopicSubscriptionResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsSnsTopicSubscriptionResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsSnsTopicSubscriptionResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsSnsTopicSubscriptionResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) diff --git a/enumeration/remote/aws_sqs_scanner_test.go b/enumeration/remote/aws_sqs_scanner_test.go index 14a009a5..b7ad002f 100644 --- a/enumeration/remote/aws_sqs_scanner_test.go +++ b/enumeration/remote/aws_sqs_scanner_test.go @@ -8,7 +8,7 @@ import ( aws2 "github.com/snyk/driftctl/enumeration/remote/aws" "github.com/snyk/driftctl/enumeration/remote/aws/repository" "github.com/snyk/driftctl/enumeration/remote/cache" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" remoteerr "github.com/snyk/driftctl/enumeration/remote/error" terraform3 "github.com/snyk/driftctl/enumeration/terraform" @@ -62,7 +62,7 @@ func TestSQSQueue(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") client.On("ListAllQueues").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsSqsQueueResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsSqsQueueResourceType, resourceaws.AwsSqsQueueResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsSqsQueueResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsSqsQueueResourceType, resourceaws.AwsSqsQueueResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -83,7 +83,7 @@ func TestSQSQueue(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -189,7 +189,7 @@ func TestSQSQueuePolicy(t *testing.T) { awsError := awserr.NewRequestFailure(awserr.New("AccessDeniedException", "", errors.New("")), 403, "") client.On("ListAllQueues").Return(nil, awsError) - alerter.On("SendAlert", resourceaws.AwsSqsQueuePolicyResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsSqsQueuePolicyResourceType, resourceaws.AwsSqsQueueResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", resourceaws.AwsSqsQueuePolicyResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteAWSTerraform, remoteerr.NewResourceListingErrorWithType(awsError, resourceaws.AwsSqsQueuePolicyResourceType, resourceaws.AwsSqsQueueResourceType), alerts.EnumerationPhase)).Return() }, wantErr: nil, }, @@ -210,7 +210,7 @@ func TestSQSQueuePolicy(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -236,7 +236,7 @@ func TestSQSQueuePolicy(t *testing.T) { } remoteLibrary.AddEnumerator(aws2.NewSQSQueuePolicyEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceaws.AwsSqsQueuePolicyResourceType, common2.NewGenericDetailsFetcher(resourceaws.AwsSqsQueuePolicyResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceaws.AwsSqsQueuePolicyResourceType, common.NewGenericDetailsFetcher(resourceaws.AwsSqsQueuePolicyResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) diff --git a/enumeration/remote/azurerm/init.go b/enumeration/remote/azurerm/init.go index f74b8e58..e42344a8 100644 --- a/enumeration/remote/azurerm/init.go +++ b/enumeration/remote/azurerm/init.go @@ -7,7 +7,7 @@ import ( "github.com/snyk/driftctl/enumeration/alerter" "github.com/snyk/driftctl/enumeration/remote/azurerm/repository" "github.com/snyk/driftctl/enumeration/remote/cache" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" "github.com/snyk/driftctl/enumeration/resource" "github.com/snyk/driftctl/enumeration/resource/azurerm" "github.com/snyk/driftctl/enumeration/terraform" @@ -17,7 +17,7 @@ func Init( version string, alerter *alerter.Alerter, providerLibrary *terraform.ProviderLibrary, - remoteLibrary *common2.RemoteLibrary, + remoteLibrary *common.RemoteLibrary, progress enumeration.ProgressCounter, resourceSchemaRepository *resource.SchemaRepository, factory resource.ResourceFactory, @@ -69,31 +69,31 @@ func Init( remoteLibrary.AddEnumerator(NewAzurermPublicIPEnumerator(networkRepo, factory)) remoteLibrary.AddEnumerator(NewAzurermPostgresqlDatabaseEnumerator(postgresqlRepo, factory)) remoteLibrary.AddEnumerator(NewAzurermNetworkSecurityGroupEnumerator(networkRepo, factory)) - remoteLibrary.AddDetailsFetcher(azurerm.AzureNetworkSecurityGroupResourceType, common2.NewGenericDetailsFetcher(azurerm.AzureNetworkSecurityGroupResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(azurerm.AzureNetworkSecurityGroupResourceType, common.NewGenericDetailsFetcher(azurerm.AzureNetworkSecurityGroupResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewAzurermLoadBalancerEnumerator(networkRepo, factory)) remoteLibrary.AddEnumerator(NewAzurermLoadBalancerRuleEnumerator(networkRepo, factory)) - remoteLibrary.AddDetailsFetcher(azurerm.AzureLoadBalancerRuleResourceType, common2.NewGenericDetailsFetcher(azurerm.AzureLoadBalancerRuleResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(azurerm.AzureLoadBalancerRuleResourceType, common.NewGenericDetailsFetcher(azurerm.AzureLoadBalancerRuleResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewAzurermPrivateDNSZoneEnumerator(privateDNSRepo, factory)) - remoteLibrary.AddDetailsFetcher(azurerm.AzurePrivateDNSZoneResourceType, common2.NewGenericDetailsFetcher(azurerm.AzurePrivateDNSZoneResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(azurerm.AzurePrivateDNSZoneResourceType, common.NewGenericDetailsFetcher(azurerm.AzurePrivateDNSZoneResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewAzurermPrivateDNSARecordEnumerator(privateDNSRepo, factory)) - remoteLibrary.AddDetailsFetcher(azurerm.AzurePrivateDNSARecordResourceType, common2.NewGenericDetailsFetcher(azurerm.AzurePrivateDNSARecordResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(azurerm.AzurePrivateDNSARecordResourceType, common.NewGenericDetailsFetcher(azurerm.AzurePrivateDNSARecordResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewAzurermPrivateDNSAAAARecordEnumerator(privateDNSRepo, factory)) - remoteLibrary.AddDetailsFetcher(azurerm.AzurePrivateDNSAAAARecordResourceType, common2.NewGenericDetailsFetcher(azurerm.AzurePrivateDNSAAAARecordResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(azurerm.AzurePrivateDNSAAAARecordResourceType, common.NewGenericDetailsFetcher(azurerm.AzurePrivateDNSAAAARecordResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewAzurermPrivateDNSMXRecordEnumerator(privateDNSRepo, factory)) - remoteLibrary.AddDetailsFetcher(azurerm.AzurePrivateDNSMXRecordResourceType, common2.NewGenericDetailsFetcher(azurerm.AzurePrivateDNSMXRecordResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(azurerm.AzurePrivateDNSMXRecordResourceType, common.NewGenericDetailsFetcher(azurerm.AzurePrivateDNSMXRecordResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewAzurermPrivateDNSCNameRecordEnumerator(privateDNSRepo, factory)) - remoteLibrary.AddDetailsFetcher(azurerm.AzurePrivateDNSCNameRecordResourceType, common2.NewGenericDetailsFetcher(azurerm.AzurePrivateDNSCNameRecordResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(azurerm.AzurePrivateDNSCNameRecordResourceType, common.NewGenericDetailsFetcher(azurerm.AzurePrivateDNSCNameRecordResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewAzurermPrivateDNSPTRRecordEnumerator(privateDNSRepo, factory)) - remoteLibrary.AddDetailsFetcher(azurerm.AzurePrivateDNSPTRRecordResourceType, common2.NewGenericDetailsFetcher(azurerm.AzurePrivateDNSPTRRecordResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(azurerm.AzurePrivateDNSPTRRecordResourceType, common.NewGenericDetailsFetcher(azurerm.AzurePrivateDNSPTRRecordResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewAzurermPrivateDNSSRVRecordEnumerator(privateDNSRepo, factory)) - remoteLibrary.AddDetailsFetcher(azurerm.AzurePrivateDNSSRVRecordResourceType, common2.NewGenericDetailsFetcher(azurerm.AzurePrivateDNSSRVRecordResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(azurerm.AzurePrivateDNSSRVRecordResourceType, common.NewGenericDetailsFetcher(azurerm.AzurePrivateDNSSRVRecordResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewAzurermPrivateDNSTXTRecordEnumerator(privateDNSRepo, factory)) - remoteLibrary.AddDetailsFetcher(azurerm.AzurePrivateDNSTXTRecordResourceType, common2.NewGenericDetailsFetcher(azurerm.AzurePrivateDNSTXTRecordResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(azurerm.AzurePrivateDNSTXTRecordResourceType, common.NewGenericDetailsFetcher(azurerm.AzurePrivateDNSTXTRecordResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewAzurermImageEnumerator(computeRepo, factory)) remoteLibrary.AddEnumerator(NewAzurermSSHPublicKeyEnumerator(computeRepo, factory)) - remoteLibrary.AddDetailsFetcher(azurerm.AzureSSHPublicKeyResourceType, common2.NewGenericDetailsFetcher(azurerm.AzureSSHPublicKeyResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(azurerm.AzureSSHPublicKeyResourceType, common.NewGenericDetailsFetcher(azurerm.AzureSSHPublicKeyResourceType, provider, deserializer)) err = resourceSchemaRepository.Init(terraform.AZURE, provider.Version(), provider.Schema()) if err != nil { diff --git a/enumeration/remote/azurerm_compute_scanner_test.go b/enumeration/remote/azurerm_compute_scanner_test.go index 65bfdad6..70fa2ace 100644 --- a/enumeration/remote/azurerm_compute_scanner_test.go +++ b/enumeration/remote/azurerm_compute_scanner_test.go @@ -7,7 +7,7 @@ import ( azurerm2 "github.com/snyk/driftctl/enumeration/remote/azurerm" "github.com/snyk/driftctl/enumeration/remote/azurerm/repository" "github.com/snyk/driftctl/enumeration/remote/cache" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" remoteerr "github.com/snyk/driftctl/enumeration/remote/error" terraform3 "github.com/snyk/driftctl/enumeration/terraform" @@ -98,7 +98,7 @@ func TestAzurermCompute_Image(t *testing.T) { for _, c := range tests { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -183,7 +183,7 @@ func TestAzurermCompute_SSHPublicKey(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -215,7 +215,7 @@ func TestAzurermCompute_SSHPublicKey(t *testing.T) { } remoteLibrary.AddEnumerator(azurerm2.NewAzurermSSHPublicKeyEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceazure.AzureSSHPublicKeyResourceType, common2.NewGenericDetailsFetcher(resourceazure.AzureSSHPublicKeyResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceazure.AzureSSHPublicKeyResourceType, common.NewGenericDetailsFetcher(resourceazure.AzureSSHPublicKeyResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) diff --git a/enumeration/remote/azurerm_network_scanner_test.go b/enumeration/remote/azurerm_network_scanner_test.go index 0197872e..a14040ff 100644 --- a/enumeration/remote/azurerm_network_scanner_test.go +++ b/enumeration/remote/azurerm_network_scanner_test.go @@ -7,7 +7,7 @@ import ( azurerm2 "github.com/snyk/driftctl/enumeration/remote/azurerm" "github.com/snyk/driftctl/enumeration/remote/azurerm/repository" "github.com/snyk/driftctl/enumeration/remote/cache" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" error2 "github.com/snyk/driftctl/enumeration/remote/error" terraform3 "github.com/snyk/driftctl/enumeration/terraform" @@ -93,7 +93,7 @@ func TestAzurermVirtualNetwork(t *testing.T) { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -186,7 +186,7 @@ func TestAzurermRouteTables(t *testing.T) { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -335,7 +335,7 @@ func TestAzurermRoutes(t *testing.T) { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -468,7 +468,7 @@ func TestAzurermSubnets(t *testing.T) { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -561,7 +561,7 @@ func TestAzurermFirewalls(t *testing.T) { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -654,7 +654,7 @@ func TestAzurermPublicIP(t *testing.T) { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -741,7 +741,7 @@ func TestAzurermSecurityGroups(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -773,7 +773,7 @@ func TestAzurermSecurityGroups(t *testing.T) { } remoteLibrary.AddEnumerator(azurerm2.NewAzurermNetworkSecurityGroupEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceazure.AzureNetworkSecurityGroupResourceType, common2.NewGenericDetailsFetcher(resourceazure.AzureNetworkSecurityGroupResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceazure.AzureNetworkSecurityGroupResourceType, common.NewGenericDetailsFetcher(resourceazure.AzureNetworkSecurityGroupResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -857,7 +857,7 @@ func TestAzurermLoadBalancers(t *testing.T) { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -962,7 +962,7 @@ func TestAzurermLoadBalancerRules(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -994,7 +994,7 @@ func TestAzurermLoadBalancerRules(t *testing.T) { } remoteLibrary.AddEnumerator(azurerm2.NewAzurermLoadBalancerRuleEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceazure.AzureLoadBalancerRuleResourceType, common2.NewGenericDetailsFetcher(resourceazure.AzureLoadBalancerRuleResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceazure.AzureLoadBalancerRuleResourceType, common.NewGenericDetailsFetcher(resourceazure.AzureLoadBalancerRuleResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) diff --git a/enumeration/remote/azurerm_privatedns_scanner_test.go b/enumeration/remote/azurerm_privatedns_scanner_test.go index 3f39b8b1..67d755fa 100644 --- a/enumeration/remote/azurerm_privatedns_scanner_test.go +++ b/enumeration/remote/azurerm_privatedns_scanner_test.go @@ -7,7 +7,7 @@ import ( azurerm2 "github.com/snyk/driftctl/enumeration/remote/azurerm" "github.com/snyk/driftctl/enumeration/remote/azurerm/repository" "github.com/snyk/driftctl/enumeration/remote/cache" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" remoteerr "github.com/snyk/driftctl/enumeration/remote/error" terraform2 "github.com/snyk/driftctl/enumeration/terraform" @@ -99,7 +99,7 @@ func TestAzurermPrivateDNSZone(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform2.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -131,7 +131,7 @@ func TestAzurermPrivateDNSZone(t *testing.T) { } remoteLibrary.AddEnumerator(azurerm2.NewAzurermPrivateDNSZoneEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceazure.AzurePrivateDNSZoneResourceType, common2.NewGenericDetailsFetcher(resourceazure.AzurePrivateDNSZoneResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceazure.AzurePrivateDNSZoneResourceType, common.NewGenericDetailsFetcher(resourceazure.AzurePrivateDNSZoneResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -253,7 +253,7 @@ func TestAzurermPrivateDNSARecord(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform2.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -285,7 +285,7 @@ func TestAzurermPrivateDNSARecord(t *testing.T) { } remoteLibrary.AddEnumerator(azurerm2.NewAzurermPrivateDNSARecordEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceazure.AzurePrivateDNSARecordResourceType, common2.NewGenericDetailsFetcher(resourceazure.AzurePrivateDNSARecordResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceazure.AzurePrivateDNSARecordResourceType, common.NewGenericDetailsFetcher(resourceazure.AzurePrivateDNSARecordResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -408,7 +408,7 @@ func TestAzurermPrivateDNSAAAARecord(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform2.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -440,7 +440,7 @@ func TestAzurermPrivateDNSAAAARecord(t *testing.T) { } remoteLibrary.AddEnumerator(azurerm2.NewAzurermPrivateDNSAAAARecordEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceazure.AzurePrivateDNSAAAARecordResourceType, common2.NewGenericDetailsFetcher(resourceazure.AzurePrivateDNSAAAARecordResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceazure.AzurePrivateDNSAAAARecordResourceType, common.NewGenericDetailsFetcher(resourceazure.AzurePrivateDNSAAAARecordResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -551,7 +551,7 @@ func TestAzurermPrivateDNSCNAMERecord(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform2.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -583,7 +583,7 @@ func TestAzurermPrivateDNSCNAMERecord(t *testing.T) { } remoteLibrary.AddEnumerator(azurerm2.NewAzurermPrivateDNSCNameRecordEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceazure.AzurePrivateDNSCNameRecordResourceType, common2.NewGenericDetailsFetcher(resourceazure.AzurePrivateDNSCNameRecordResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceazure.AzurePrivateDNSCNameRecordResourceType, common.NewGenericDetailsFetcher(resourceazure.AzurePrivateDNSCNameRecordResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -705,7 +705,7 @@ func TestAzurermPrivateDNSPTRRecord(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform2.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -737,7 +737,7 @@ func TestAzurermPrivateDNSPTRRecord(t *testing.T) { } remoteLibrary.AddEnumerator(azurerm2.NewAzurermPrivateDNSPTRRecordEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceazure.AzurePrivateDNSPTRRecordResourceType, common2.NewGenericDetailsFetcher(resourceazure.AzurePrivateDNSPTRRecordResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceazure.AzurePrivateDNSPTRRecordResourceType, common.NewGenericDetailsFetcher(resourceazure.AzurePrivateDNSPTRRecordResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -860,7 +860,7 @@ func TestAzurermPrivateDNSMXRecord(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform2.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -892,7 +892,7 @@ func TestAzurermPrivateDNSMXRecord(t *testing.T) { } remoteLibrary.AddEnumerator(azurerm2.NewAzurermPrivateDNSMXRecordEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceazure.AzurePrivateDNSMXRecordResourceType, common2.NewGenericDetailsFetcher(resourceazure.AzurePrivateDNSMXRecordResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceazure.AzurePrivateDNSMXRecordResourceType, common.NewGenericDetailsFetcher(resourceazure.AzurePrivateDNSMXRecordResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -1014,7 +1014,7 @@ func TestAzurermPrivateDNSSRVRecord(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform2.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -1046,7 +1046,7 @@ func TestAzurermPrivateDNSSRVRecord(t *testing.T) { } remoteLibrary.AddEnumerator(azurerm2.NewAzurermPrivateDNSSRVRecordEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceazure.AzurePrivateDNSSRVRecordResourceType, common2.NewGenericDetailsFetcher(resourceazure.AzurePrivateDNSSRVRecordResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceazure.AzurePrivateDNSSRVRecordResourceType, common.NewGenericDetailsFetcher(resourceazure.AzurePrivateDNSSRVRecordResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -1168,7 +1168,7 @@ func TestAzurermPrivateDNSTXTRecord(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform2.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -1200,7 +1200,7 @@ func TestAzurermPrivateDNSTXTRecord(t *testing.T) { } remoteLibrary.AddEnumerator(azurerm2.NewAzurermPrivateDNSTXTRecordEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resourceazure.AzurePrivateDNSTXTRecordResourceType, common2.NewGenericDetailsFetcher(resourceazure.AzurePrivateDNSTXTRecordResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resourceazure.AzurePrivateDNSTXTRecordResourceType, common.NewGenericDetailsFetcher(resourceazure.AzurePrivateDNSTXTRecordResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) diff --git a/enumeration/remote/github/init.go b/enumeration/remote/github/init.go index 64a97851..c2b016e2 100644 --- a/enumeration/remote/github/init.go +++ b/enumeration/remote/github/init.go @@ -4,7 +4,7 @@ import ( "github.com/snyk/driftctl/enumeration" "github.com/snyk/driftctl/enumeration/alerter" "github.com/snyk/driftctl/enumeration/remote/cache" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" "github.com/snyk/driftctl/enumeration/resource" "github.com/snyk/driftctl/enumeration/resource/github" "github.com/snyk/driftctl/enumeration/terraform" @@ -17,7 +17,7 @@ import ( func Init(version string, alerter *alerter.Alerter, providerLibrary *terraform.ProviderLibrary, - remoteLibrary *common2.RemoteLibrary, + remoteLibrary *common.RemoteLibrary, progress enumeration.ProgressCounter, resourceSchemaRepository *resource.SchemaRepository, factory resource.ResourceFactory, @@ -39,19 +39,19 @@ func Init(version string, alerter *alerter.Alerter, providerLibrary.AddProvider(terraform.GITHUB, provider) remoteLibrary.AddEnumerator(NewGithubTeamEnumerator(repository, factory)) - remoteLibrary.AddDetailsFetcher(github.GithubTeamResourceType, common2.NewGenericDetailsFetcher(github.GithubTeamResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(github.GithubTeamResourceType, common.NewGenericDetailsFetcher(github.GithubTeamResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewGithubRepositoryEnumerator(repository, factory)) - remoteLibrary.AddDetailsFetcher(github.GithubRepositoryResourceType, common2.NewGenericDetailsFetcher(github.GithubRepositoryResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(github.GithubRepositoryResourceType, common.NewGenericDetailsFetcher(github.GithubRepositoryResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewGithubMembershipEnumerator(repository, factory)) - remoteLibrary.AddDetailsFetcher(github.GithubMembershipResourceType, common2.NewGenericDetailsFetcher(github.GithubMembershipResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(github.GithubMembershipResourceType, common.NewGenericDetailsFetcher(github.GithubMembershipResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewGithubTeamMembershipEnumerator(repository, factory)) - remoteLibrary.AddDetailsFetcher(github.GithubTeamMembershipResourceType, common2.NewGenericDetailsFetcher(github.GithubTeamMembershipResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(github.GithubTeamMembershipResourceType, common.NewGenericDetailsFetcher(github.GithubTeamMembershipResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewGithubBranchProtectionEnumerator(repository, factory)) - remoteLibrary.AddDetailsFetcher(github.GithubBranchProtectionResourceType, common2.NewGenericDetailsFetcher(github.GithubBranchProtectionResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(github.GithubBranchProtectionResourceType, common.NewGenericDetailsFetcher(github.GithubBranchProtectionResourceType, provider, deserializer)) err = resourceSchemaRepository.Init(terraform.GITHUB, provider.Version(), provider.Schema()) if err != nil { diff --git a/enumeration/remote/github_branch_protection_scanner_test.go b/enumeration/remote/github_branch_protection_scanner_test.go index e2801285..ae97cd25 100644 --- a/enumeration/remote/github_branch_protection_scanner_test.go +++ b/enumeration/remote/github_branch_protection_scanner_test.go @@ -6,7 +6,7 @@ import ( "github.com/snyk/driftctl/enumeration" "github.com/snyk/driftctl/enumeration/remote/alerts" "github.com/snyk/driftctl/enumeration/remote/cache" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" remoteerr "github.com/snyk/driftctl/enumeration/remote/error" github2 "github.com/snyk/driftctl/enumeration/remote/github" terraform2 "github.com/snyk/driftctl/enumeration/terraform" @@ -62,7 +62,7 @@ func TestScanGithubBranchProtection(t *testing.T) { mocks: func(client *github2.MockGithubRepository, alerter *mocks.AlerterInterface) { client.On("ListBranchProtection").Return(nil, errors.New("Your token has not been granted the required scopes to execute this query.")) - alerter.On("SendAlert", githubres.GithubBranchProtectionResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteGithubTerraform, remoteerr.NewResourceListingErrorWithType(errors.New("Your token has not been granted the required scopes to execute this query."), githubres.GithubBranchProtectionResourceType, githubres.GithubBranchProtectionResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", githubres.GithubBranchProtectionResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteGithubTerraform, remoteerr.NewResourceListingErrorWithType(errors.New("Your token has not been granted the required scopes to execute this query."), githubres.GithubBranchProtectionResourceType, githubres.GithubBranchProtectionResourceType), alerts.EnumerationPhase)).Return() }, err: nil, }, @@ -80,7 +80,7 @@ func TestScanGithubBranchProtection(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform2.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -106,7 +106,7 @@ func TestScanGithubBranchProtection(t *testing.T) { } remoteLibrary.AddEnumerator(github2.NewGithubBranchProtectionEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(githubres.GithubBranchProtectionResourceType, common2.NewGenericDetailsFetcher(githubres.GithubBranchProtectionResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(githubres.GithubBranchProtectionResourceType, common.NewGenericDetailsFetcher(githubres.GithubBranchProtectionResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) diff --git a/enumeration/remote/github_membership_scanner_test.go b/enumeration/remote/github_membership_scanner_test.go index acb9a687..cf9e399d 100644 --- a/enumeration/remote/github_membership_scanner_test.go +++ b/enumeration/remote/github_membership_scanner_test.go @@ -7,7 +7,7 @@ import ( "github.com/snyk/driftctl/enumeration" "github.com/snyk/driftctl/enumeration/remote/alerts" "github.com/snyk/driftctl/enumeration/remote/cache" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" remoteerr "github.com/snyk/driftctl/enumeration/remote/error" github2 "github.com/snyk/driftctl/enumeration/remote/github" terraform2 "github.com/snyk/driftctl/enumeration/terraform" @@ -58,7 +58,7 @@ func TestScanGithubMembership(t *testing.T) { mocks: func(client *github2.MockGithubRepository, alerter *mocks.AlerterInterface) { client.On("ListMembership").Return(nil, errors.New("Your token has not been granted the required scopes to execute this query.")) - alerter.On("SendAlert", githubres.GithubMembershipResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteGithubTerraform, remoteerr.NewResourceListingErrorWithType(errors.New("Your token has not been granted the required scopes to execute this query."), githubres.GithubMembershipResourceType, githubres.GithubMembershipResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", githubres.GithubMembershipResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteGithubTerraform, remoteerr.NewResourceListingErrorWithType(errors.New("Your token has not been granted the required scopes to execute this query."), githubres.GithubMembershipResourceType, githubres.GithubMembershipResourceType), alerts.EnumerationPhase)).Return() }, err: nil, }, @@ -76,7 +76,7 @@ func TestScanGithubMembership(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform2.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -102,7 +102,7 @@ func TestScanGithubMembership(t *testing.T) { } remoteLibrary.AddEnumerator(github2.NewGithubMembershipEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(githubres.GithubMembershipResourceType, common2.NewGenericDetailsFetcher(githubres.GithubMembershipResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(githubres.GithubMembershipResourceType, common.NewGenericDetailsFetcher(githubres.GithubMembershipResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) diff --git a/enumeration/remote/github_repository_scanner_test.go b/enumeration/remote/github_repository_scanner_test.go index 14bac7c4..0369813a 100644 --- a/enumeration/remote/github_repository_scanner_test.go +++ b/enumeration/remote/github_repository_scanner_test.go @@ -7,7 +7,7 @@ import ( "github.com/snyk/driftctl/enumeration" "github.com/snyk/driftctl/enumeration/remote/alerts" "github.com/snyk/driftctl/enumeration/remote/cache" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" remoteerr "github.com/snyk/driftctl/enumeration/remote/error" github2 "github.com/snyk/driftctl/enumeration/remote/github" terraform2 "github.com/snyk/driftctl/enumeration/terraform" @@ -58,7 +58,7 @@ func TestScanGithubRepository(t *testing.T) { mocks: func(client *github2.MockGithubRepository, alerter *mocks.AlerterInterface) { client.On("ListRepositories").Return(nil, errors.New("Your token has not been granted the required scopes to execute this query.")) - alerter.On("SendAlert", githubres.GithubRepositoryResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteGithubTerraform, remoteerr.NewResourceListingErrorWithType(errors.New("Your token has not been granted the required scopes to execute this query."), githubres.GithubRepositoryResourceType, githubres.GithubRepositoryResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", githubres.GithubRepositoryResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteGithubTerraform, remoteerr.NewResourceListingErrorWithType(errors.New("Your token has not been granted the required scopes to execute this query."), githubres.GithubRepositoryResourceType, githubres.GithubRepositoryResourceType), alerts.EnumerationPhase)).Return() }, err: nil, }, @@ -76,7 +76,7 @@ func TestScanGithubRepository(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform2.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -102,7 +102,7 @@ func TestScanGithubRepository(t *testing.T) { } remoteLibrary.AddEnumerator(github2.NewGithubRepositoryEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(githubres.GithubRepositoryResourceType, common2.NewGenericDetailsFetcher(githubres.GithubRepositoryResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(githubres.GithubRepositoryResourceType, common.NewGenericDetailsFetcher(githubres.GithubRepositoryResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) diff --git a/enumeration/remote/github_team_membership_scanner_test.go b/enumeration/remote/github_team_membership_scanner_test.go index 5bb078e7..9ae59036 100644 --- a/enumeration/remote/github_team_membership_scanner_test.go +++ b/enumeration/remote/github_team_membership_scanner_test.go @@ -7,7 +7,7 @@ import ( "github.com/snyk/driftctl/enumeration" "github.com/snyk/driftctl/enumeration/remote/alerts" "github.com/snyk/driftctl/enumeration/remote/cache" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" remoteerr "github.com/snyk/driftctl/enumeration/remote/error" github2 "github.com/snyk/driftctl/enumeration/remote/github" terraform2 "github.com/snyk/driftctl/enumeration/terraform" @@ -58,7 +58,7 @@ func TestScanGithubTeamMembership(t *testing.T) { mocks: func(client *github2.MockGithubRepository, alerter *mocks.AlerterInterface) { client.On("ListTeamMemberships").Return(nil, errors.New("Your token has not been granted the required scopes to execute this query.")) - alerter.On("SendAlert", githubres.GithubTeamMembershipResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteGithubTerraform, remoteerr.NewResourceListingErrorWithType(errors.New("Your token has not been granted the required scopes to execute this query."), githubres.GithubTeamMembershipResourceType, githubres.GithubTeamMembershipResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", githubres.GithubTeamMembershipResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteGithubTerraform, remoteerr.NewResourceListingErrorWithType(errors.New("Your token has not been granted the required scopes to execute this query."), githubres.GithubTeamMembershipResourceType, githubres.GithubTeamMembershipResourceType), alerts.EnumerationPhase)).Return() }, err: nil, }, @@ -76,7 +76,7 @@ func TestScanGithubTeamMembership(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform2.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -102,7 +102,7 @@ func TestScanGithubTeamMembership(t *testing.T) { } remoteLibrary.AddEnumerator(github2.NewGithubTeamMembershipEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(githubres.GithubTeamMembershipResourceType, common2.NewGenericDetailsFetcher(githubres.GithubTeamMembershipResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(githubres.GithubTeamMembershipResourceType, common.NewGenericDetailsFetcher(githubres.GithubTeamMembershipResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) diff --git a/enumeration/remote/github_team_scanner_test.go b/enumeration/remote/github_team_scanner_test.go index f99f3c2d..3619f305 100644 --- a/enumeration/remote/github_team_scanner_test.go +++ b/enumeration/remote/github_team_scanner_test.go @@ -7,7 +7,7 @@ import ( "github.com/snyk/driftctl/enumeration" "github.com/snyk/driftctl/enumeration/remote/alerts" "github.com/snyk/driftctl/enumeration/remote/cache" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" remoteerr "github.com/snyk/driftctl/enumeration/remote/error" github2 "github.com/snyk/driftctl/enumeration/remote/github" terraform2 "github.com/snyk/driftctl/enumeration/terraform" @@ -59,7 +59,7 @@ func TestScanGithubTeam(t *testing.T) { mocks: func(client *github2.MockGithubRepository, alerter *mocks.AlerterInterface) { client.On("ListTeams").Return(nil, errors.New("Your token has not been granted the required scopes to execute this query.")) - alerter.On("SendAlert", githubres.GithubTeamResourceType, alerts.NewRemoteAccessDeniedAlert(common2.RemoteGithubTerraform, remoteerr.NewResourceListingErrorWithType(errors.New("Your token has not been granted the required scopes to execute this query."), githubres.GithubTeamResourceType, githubres.GithubTeamResourceType), alerts.EnumerationPhase)).Return() + alerter.On("SendAlert", githubres.GithubTeamResourceType, alerts.NewRemoteAccessDeniedAlert(common.RemoteGithubTerraform, remoteerr.NewResourceListingErrorWithType(errors.New("Your token has not been granted the required scopes to execute this query."), githubres.GithubTeamResourceType, githubres.GithubTeamResourceType), alerts.EnumerationPhase)).Return() }, err: nil, }, @@ -77,7 +77,7 @@ func TestScanGithubTeam(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform2.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -103,7 +103,7 @@ func TestScanGithubTeam(t *testing.T) { } remoteLibrary.AddEnumerator(github2.NewGithubTeamEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(githubres.GithubTeamResourceType, common2.NewGenericDetailsFetcher(githubres.GithubTeamResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(githubres.GithubTeamResourceType, common.NewGenericDetailsFetcher(githubres.GithubTeamResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) diff --git a/enumeration/remote/google/init.go b/enumeration/remote/google/init.go index 99e9deae..0bb89a3e 100644 --- a/enumeration/remote/google/init.go +++ b/enumeration/remote/google/init.go @@ -7,7 +7,7 @@ import ( "github.com/snyk/driftctl/enumeration/alerter" "github.com/snyk/driftctl/enumeration/remote/cache" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" "github.com/snyk/driftctl/enumeration/remote/google/repository" "github.com/snyk/driftctl/enumeration/terraform" @@ -20,7 +20,7 @@ import ( func Init(version string, alerter *alerter.Alerter, providerLibrary *terraform.ProviderLibrary, - remoteLibrary *common2.RemoteLibrary, + remoteLibrary *common.RemoteLibrary, progress enumeration.ProgressCounter, resourceSchemaRepository *resource.SchemaRepository, factory resource.ResourceFactory, @@ -67,31 +67,31 @@ func Init(version string, alerter *alerter.Alerter, deserializer := resource.NewDeserializer(factory) remoteLibrary.AddEnumerator(NewGoogleStorageBucketEnumerator(assetRepository, factory)) - remoteLibrary.AddDetailsFetcher(google.GoogleStorageBucketResourceType, common2.NewGenericDetailsFetcher(google.GoogleStorageBucketResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(google.GoogleStorageBucketResourceType, common.NewGenericDetailsFetcher(google.GoogleStorageBucketResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewGoogleComputeFirewallEnumerator(assetRepository, factory)) - remoteLibrary.AddDetailsFetcher(google.GoogleComputeFirewallResourceType, common2.NewGenericDetailsFetcher(google.GoogleComputeFirewallResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(google.GoogleComputeFirewallResourceType, common.NewGenericDetailsFetcher(google.GoogleComputeFirewallResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewGoogleComputeRouterEnumerator(assetRepository, factory)) remoteLibrary.AddEnumerator(NewGoogleComputeInstanceEnumerator(assetRepository, factory)) remoteLibrary.AddEnumerator(NewGoogleProjectIamMemberEnumerator(iamRepository, factory)) - remoteLibrary.AddDetailsFetcher(google.GoogleProjectIamMemberResourceType, common2.NewGenericDetailsFetcher(google.GoogleProjectIamMemberResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(google.GoogleProjectIamMemberResourceType, common.NewGenericDetailsFetcher(google.GoogleProjectIamMemberResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewGoogleStorageBucketIamMemberEnumerator(assetRepository, storageRepository, factory)) - remoteLibrary.AddDetailsFetcher(google.GoogleStorageBucketIamMemberResourceType, common2.NewGenericDetailsFetcher(google.GoogleStorageBucketIamMemberResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(google.GoogleStorageBucketIamMemberResourceType, common.NewGenericDetailsFetcher(google.GoogleStorageBucketIamMemberResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewGoogleComputeNetworkEnumerator(assetRepository, factory)) - remoteLibrary.AddDetailsFetcher(google.GoogleComputeNetworkResourceType, common2.NewGenericDetailsFetcher(google.GoogleComputeNetworkResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(google.GoogleComputeNetworkResourceType, common.NewGenericDetailsFetcher(google.GoogleComputeNetworkResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewGoogleComputeSubnetworkEnumerator(assetRepository, factory)) - remoteLibrary.AddDetailsFetcher(google.GoogleComputeSubnetworkResourceType, common2.NewGenericDetailsFetcher(google.GoogleComputeSubnetworkResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(google.GoogleComputeSubnetworkResourceType, common.NewGenericDetailsFetcher(google.GoogleComputeSubnetworkResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewGoogleDNSManagedZoneEnumerator(assetRepository, factory)) remoteLibrary.AddEnumerator(NewGoogleComputeInstanceGroupEnumerator(assetRepository, factory)) - remoteLibrary.AddDetailsFetcher(google.GoogleComputeInstanceGroupResourceType, common2.NewGenericDetailsFetcher(google.GoogleComputeInstanceGroupResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(google.GoogleComputeInstanceGroupResourceType, common.NewGenericDetailsFetcher(google.GoogleComputeInstanceGroupResourceType, provider, deserializer)) remoteLibrary.AddEnumerator(NewGoogleBigqueryDatasetEnumerator(assetRepository, factory)) remoteLibrary.AddEnumerator(NewGoogleBigqueryTableEnumerator(assetRepository, factory)) diff --git a/enumeration/remote/google_bigquery_scanner_test.go b/enumeration/remote/google_bigquery_scanner_test.go index 6f8b754e..4ac6493d 100644 --- a/enumeration/remote/google_bigquery_scanner_test.go +++ b/enumeration/remote/google_bigquery_scanner_test.go @@ -6,7 +6,7 @@ import ( "github.com/snyk/driftctl/enumeration" "github.com/snyk/driftctl/enumeration/remote/alerts" "github.com/snyk/driftctl/enumeration/remote/cache" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" remoteerr "github.com/snyk/driftctl/enumeration/remote/error" google2 "github.com/snyk/driftctl/enumeration/remote/google" "github.com/snyk/driftctl/enumeration/remote/google/repository" @@ -68,7 +68,7 @@ func TestGoogleBigqueryDataset(t *testing.T) { "SendAlert", "google_bigquery_dataset", alerts.NewRemoteAccessDeniedAlert( - common2.RemoteGoogleTerraform, + common.RemoteGoogleTerraform, remoteerr.NewResourceListingError( status.Error(codes.PermissionDenied, "The caller does not have permission"), "google_bigquery_dataset", @@ -89,7 +89,7 @@ func TestGoogleBigqueryDataset(t *testing.T) { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -171,7 +171,7 @@ func TestGoogleBigqueryTable(t *testing.T) { "SendAlert", "google_bigquery_table", alerts.NewRemoteAccessDeniedAlert( - common2.RemoteGoogleTerraform, + common.RemoteGoogleTerraform, remoteerr.NewResourceListingError( status.Error(codes.PermissionDenied, "The caller does not have permission"), "google_bigquery_table", @@ -192,7 +192,7 @@ func TestGoogleBigqueryTable(t *testing.T) { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} diff --git a/enumeration/remote/google_bigtable_scanner_test.go b/enumeration/remote/google_bigtable_scanner_test.go index 3bec37ac..dd0ef270 100644 --- a/enumeration/remote/google_bigtable_scanner_test.go +++ b/enumeration/remote/google_bigtable_scanner_test.go @@ -6,7 +6,7 @@ import ( "github.com/snyk/driftctl/enumeration" "github.com/snyk/driftctl/enumeration/remote/alerts" "github.com/snyk/driftctl/enumeration/remote/cache" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" remoteerr "github.com/snyk/driftctl/enumeration/remote/error" google2 "github.com/snyk/driftctl/enumeration/remote/google" "github.com/snyk/driftctl/enumeration/remote/google/repository" @@ -105,7 +105,7 @@ func TestGoogleBigtableInstance(t *testing.T) { "SendAlert", "google_bigtable_instance", alerts.NewRemoteAccessDeniedAlert( - common2.RemoteGoogleTerraform, + common.RemoteGoogleTerraform, remoteerr.NewResourceListingError( status.Error(codes.PermissionDenied, "The caller does not have permission"), "google_bigtable_instance", @@ -126,7 +126,7 @@ func TestGoogleBigtableInstance(t *testing.T) { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -231,7 +231,7 @@ func TestGoogleBigtableTable(t *testing.T) { "SendAlert", "google_bigtable_table", alerts.NewRemoteAccessDeniedAlert( - common2.RemoteGoogleTerraform, + common.RemoteGoogleTerraform, remoteerr.NewResourceListingError( status.Error(codes.PermissionDenied, "The caller does not have permission"), "google_bigtable_table", @@ -252,7 +252,7 @@ func TestGoogleBigtableTable(t *testing.T) { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} diff --git a/enumeration/remote/google_cloudfunctions_scanner_test.go b/enumeration/remote/google_cloudfunctions_scanner_test.go index a0b63170..ccdd2d3d 100644 --- a/enumeration/remote/google_cloudfunctions_scanner_test.go +++ b/enumeration/remote/google_cloudfunctions_scanner_test.go @@ -6,7 +6,7 @@ import ( "github.com/snyk/driftctl/enumeration" "github.com/snyk/driftctl/enumeration/remote/alerts" "github.com/snyk/driftctl/enumeration/remote/cache" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" remoteerr "github.com/snyk/driftctl/enumeration/remote/error" "github.com/snyk/driftctl/enumeration/remote/google" "github.com/snyk/driftctl/enumeration/remote/google/repository" @@ -92,7 +92,7 @@ func TestGoogleCloudFunctionsFunction(t *testing.T) { "SendAlert", "google_cloudfunctions_function", alerts.NewRemoteAccessDeniedAlert( - common2.RemoteGoogleTerraform, + common.RemoteGoogleTerraform, remoteerr.NewResourceListingError( status.Error(codes.PermissionDenied, "The caller does not have permission"), "google_cloudfunctions_function", @@ -113,7 +113,7 @@ func TestGoogleCloudFunctionsFunction(t *testing.T) { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} diff --git a/enumeration/remote/google_cloudrun_scanner_test.go b/enumeration/remote/google_cloudrun_scanner_test.go index 51c7a0f5..3bb77840 100644 --- a/enumeration/remote/google_cloudrun_scanner_test.go +++ b/enumeration/remote/google_cloudrun_scanner_test.go @@ -6,7 +6,7 @@ import ( "github.com/snyk/driftctl/enumeration" "github.com/snyk/driftctl/enumeration/remote/alerts" "github.com/snyk/driftctl/enumeration/remote/cache" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" remoteerr "github.com/snyk/driftctl/enumeration/remote/error" "github.com/snyk/driftctl/enumeration/remote/google" "github.com/snyk/driftctl/enumeration/remote/google/repository" @@ -84,7 +84,7 @@ func TestGoogleCloudRunService(t *testing.T) { "SendAlert", googleresource.GoogleCloudRunServiceResourceType, alerts.NewRemoteAccessDeniedAlert( - common2.RemoteGoogleTerraform, + common.RemoteGoogleTerraform, remoteerr.NewResourceListingError( status.Error(codes.PermissionDenied, "The caller does not have permission"), googleresource.GoogleCloudRunServiceResourceType, @@ -108,7 +108,7 @@ func TestGoogleCloudRunService(t *testing.T) { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} diff --git a/enumeration/remote/google_compute_scanner_test.go b/enumeration/remote/google_compute_scanner_test.go index 27651c6b..2d937d8f 100644 --- a/enumeration/remote/google_compute_scanner_test.go +++ b/enumeration/remote/google_compute_scanner_test.go @@ -6,7 +6,7 @@ import ( "github.com/snyk/driftctl/enumeration" "github.com/snyk/driftctl/enumeration/remote/alerts" "github.com/snyk/driftctl/enumeration/remote/cache" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" remoteerr "github.com/snyk/driftctl/enumeration/remote/error" google2 "github.com/snyk/driftctl/enumeration/remote/google" "github.com/snyk/driftctl/enumeration/remote/google/repository" @@ -76,7 +76,7 @@ func TestGoogleComputeFirewall(t *testing.T) { "SendAlert", "google_compute_firewall", alerts.NewRemoteAccessDeniedAlert( - common2.RemoteGoogleTerraform, + common.RemoteGoogleTerraform, remoteerr.NewResourceListingError( status.Error(codes.PermissionDenied, "The caller does not have permission"), "google_compute_firewall", @@ -102,7 +102,7 @@ func TestGoogleComputeFirewall(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -134,7 +134,7 @@ func TestGoogleComputeFirewall(t *testing.T) { repo := repository.NewAssetRepository(assetClient, realProvider.GetConfig(), cache.New(0)) remoteLibrary.AddEnumerator(google2.NewGoogleComputeFirewallEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resType, common2.NewGenericDetailsFetcher(resType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resType, common.NewGenericDetailsFetcher(resType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -212,7 +212,7 @@ func TestGoogleComputeRouter(t *testing.T) { "SendAlert", googleresource.GoogleComputeRouterResourceType, alerts.NewRemoteAccessDeniedAlert( - common2.RemoteGoogleTerraform, + common.RemoteGoogleTerraform, remoteerr.NewResourceListingError( status.Error(codes.PermissionDenied, "The caller does not have permission"), googleresource.GoogleComputeRouterResourceType, @@ -236,7 +236,7 @@ func TestGoogleComputeRouter(t *testing.T) { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -319,7 +319,7 @@ func TestGoogleComputeInstance(t *testing.T) { "SendAlert", "google_compute_instance", alerts.NewRemoteAccessDeniedAlert( - common2.RemoteGoogleTerraform, + common.RemoteGoogleTerraform, remoteerr.NewResourceListingError( status.Error(codes.PermissionDenied, "The caller does not have permission"), "google_compute_instance", @@ -340,7 +340,7 @@ func TestGoogleComputeInstance(t *testing.T) { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -427,7 +427,7 @@ func TestGoogleComputeNetwork(t *testing.T) { "SendAlert", "google_compute_network", alerts.NewRemoteAccessDeniedAlert( - common2.RemoteGoogleTerraform, + common.RemoteGoogleTerraform, remoteerr.NewResourceListingError( status.Error(codes.PermissionDenied, "The caller does not have permission"), "google_compute_network", @@ -453,7 +453,7 @@ func TestGoogleComputeNetwork(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -485,7 +485,7 @@ func TestGoogleComputeNetwork(t *testing.T) { repo := repository.NewAssetRepository(assetClient, realProvider.GetConfig(), cache.New(0)) remoteLibrary.AddEnumerator(google2.NewGoogleComputeNetworkEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resType, common2.NewGenericDetailsFetcher(resType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resType, common.NewGenericDetailsFetcher(resType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -549,7 +549,7 @@ func TestGoogleComputeInstanceGroup(t *testing.T) { "SendAlert", "google_compute_instance_group", alerts.NewRemoteAccessDeniedAlert( - common2.RemoteGoogleTerraform, + common.RemoteGoogleTerraform, remoteerr.NewResourceListingError( status.Error(codes.PermissionDenied, "The caller does not have permission"), "google_compute_instance_group", @@ -575,7 +575,7 @@ func TestGoogleComputeInstanceGroup(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -607,7 +607,7 @@ func TestGoogleComputeInstanceGroup(t *testing.T) { repo := repository.NewAssetRepository(assetClient, realProvider.GetConfig(), cache.New(0)) remoteLibrary.AddEnumerator(google2.NewGoogleComputeInstanceGroupEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(googleresource.GoogleComputeInstanceGroupResourceType, common2.NewGenericDetailsFetcher(googleresource.GoogleComputeInstanceGroupResourceType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(googleresource.GoogleComputeInstanceGroupResourceType, common.NewGenericDetailsFetcher(googleresource.GoogleComputeInstanceGroupResourceType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -686,7 +686,7 @@ func TestGoogleComputeAddress(t *testing.T) { "SendAlert", "google_compute_address", alerts.NewRemoteAccessDeniedAlert( - common2.RemoteGoogleTerraform, + common.RemoteGoogleTerraform, remoteerr.NewResourceListingError( status.Error(codes.PermissionDenied, "The caller does not have permission"), "google_compute_address", @@ -707,7 +707,7 @@ func TestGoogleComputeAddress(t *testing.T) { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -812,7 +812,7 @@ func TestGoogleComputeGlobalAddress(t *testing.T) { "SendAlert", "google_compute_global_address", alerts.NewRemoteAccessDeniedAlert( - common2.RemoteGoogleTerraform, + common.RemoteGoogleTerraform, remoteerr.NewResourceListingError( status.Error(codes.PermissionDenied, "The caller does not have permission"), "google_compute_global_address", @@ -833,7 +833,7 @@ func TestGoogleComputeGlobalAddress(t *testing.T) { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -920,7 +920,7 @@ func TestGoogleComputeSubnetwork(t *testing.T) { "SendAlert", "google_compute_subnetwork", alerts.NewRemoteAccessDeniedAlert( - common2.RemoteGoogleTerraform, + common.RemoteGoogleTerraform, remoteerr.NewResourceListingError( status.Error(codes.PermissionDenied, "The caller does not have permission"), "google_compute_subnetwork", @@ -946,7 +946,7 @@ func TestGoogleComputeSubnetwork(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -978,7 +978,7 @@ func TestGoogleComputeSubnetwork(t *testing.T) { repo := repository.NewAssetRepository(assetClient, realProvider.GetConfig(), cache.New(0)) remoteLibrary.AddEnumerator(google2.NewGoogleComputeSubnetworkEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resType, common2.NewGenericDetailsFetcher(resType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resType, common.NewGenericDetailsFetcher(resType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -1045,7 +1045,7 @@ func TestGoogleComputeDisk(t *testing.T) { "SendAlert", "google_compute_disk", alerts.NewRemoteAccessDeniedAlert( - common2.RemoteGoogleTerraform, + common.RemoteGoogleTerraform, remoteerr.NewResourceListingError( status.Error(codes.PermissionDenied, "The caller does not have permission"), "google_compute_disk", @@ -1066,7 +1066,7 @@ func TestGoogleComputeDisk(t *testing.T) { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -1155,7 +1155,7 @@ func TestGoogleComputeImage(t *testing.T) { "SendAlert", "google_compute_image", alerts.NewRemoteAccessDeniedAlert( - common2.RemoteGoogleTerraform, + common.RemoteGoogleTerraform, remoteerr.NewResourceListingError( status.Error(codes.PermissionDenied, "The caller does not have permission"), "google_compute_image", @@ -1176,7 +1176,7 @@ func TestGoogleComputeImage(t *testing.T) { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -1265,7 +1265,7 @@ func TestGoogleComputeHealthCheck(t *testing.T) { "SendAlert", "google_compute_health_check", alerts.NewRemoteAccessDeniedAlert( - common2.RemoteGoogleTerraform, + common.RemoteGoogleTerraform, remoteerr.NewResourceListingError( status.Error(codes.PermissionDenied, "The caller does not have permission"), "google_compute_health_check", @@ -1286,7 +1286,7 @@ func TestGoogleComputeHealthCheck(t *testing.T) { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -1375,7 +1375,7 @@ func TestGoogleComputeNodeGroup(t *testing.T) { "SendAlert", "google_compute_node_group", alerts.NewRemoteAccessDeniedAlert( - common2.RemoteGoogleTerraform, + common.RemoteGoogleTerraform, remoteerr.NewResourceListingError( status.Error(codes.PermissionDenied, "The caller does not have permission"), "google_compute_node_group", @@ -1396,7 +1396,7 @@ func TestGoogleComputeNodeGroup(t *testing.T) { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -1484,7 +1484,7 @@ func TestGoogleComputeForwardingRule(t *testing.T) { "SendAlert", "google_compute_forwarding_rule", alerts.NewRemoteAccessDeniedAlert( - common2.RemoteGoogleTerraform, + common.RemoteGoogleTerraform, remoteerr.NewResourceListingError( status.Error(codes.PermissionDenied, "The caller does not have permission"), "google_compute_forwarding_rule", @@ -1505,7 +1505,7 @@ func TestGoogleComputeForwardingRule(t *testing.T) { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -1594,7 +1594,7 @@ func TestGoogleComputeInstanceGroupManager(t *testing.T) { "SendAlert", "google_compute_instance_group_manager", alerts.NewRemoteAccessDeniedAlert( - common2.RemoteGoogleTerraform, + common.RemoteGoogleTerraform, remoteerr.NewResourceListingError( status.Error(codes.PermissionDenied, "The caller does not have permission"), "google_compute_instance_group_manager", @@ -1615,7 +1615,7 @@ func TestGoogleComputeInstanceGroupManager(t *testing.T) { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -1703,7 +1703,7 @@ func TestGoogleComputeGlobalForwardingRule(t *testing.T) { "SendAlert", "google_compute_global_forwarding_rule", alerts.NewRemoteAccessDeniedAlert( - common2.RemoteGoogleTerraform, + common.RemoteGoogleTerraform, remoteerr.NewResourceListingError( status.Error(codes.PermissionDenied, "The caller does not have permission"), "google_compute_global_forwarding_rule", @@ -1724,7 +1724,7 @@ func TestGoogleComputeGlobalForwardingRule(t *testing.T) { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} diff --git a/enumeration/remote/google_network_scanner_test.go b/enumeration/remote/google_network_scanner_test.go index 2956c004..ced0a8e2 100644 --- a/enumeration/remote/google_network_scanner_test.go +++ b/enumeration/remote/google_network_scanner_test.go @@ -6,7 +6,7 @@ import ( "github.com/snyk/driftctl/enumeration" "github.com/snyk/driftctl/enumeration/remote/alerts" "github.com/snyk/driftctl/enumeration/remote/cache" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" remoteerr "github.com/snyk/driftctl/enumeration/remote/error" "github.com/snyk/driftctl/enumeration/remote/google" "github.com/snyk/driftctl/enumeration/remote/google/repository" @@ -90,7 +90,7 @@ func TestGoogleDNSNanagedZone(t *testing.T) { "SendAlert", googleresource.GoogleDNSManagedZoneResourceType, alerts.NewRemoteAccessDeniedAlert( - common2.RemoteGoogleTerraform, + common.RemoteGoogleTerraform, remoteerr.NewResourceListingError( status.Error(codes.PermissionDenied, "The caller does not have permission"), googleresource.GoogleDNSManagedZoneResourceType, @@ -114,7 +114,7 @@ func TestGoogleDNSNanagedZone(t *testing.T) { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} diff --git a/enumeration/remote/google_project_scanner_test.go b/enumeration/remote/google_project_scanner_test.go index c839dc94..76be2a13 100644 --- a/enumeration/remote/google_project_scanner_test.go +++ b/enumeration/remote/google_project_scanner_test.go @@ -5,7 +5,7 @@ import ( "github.com/snyk/driftctl/enumeration" "github.com/snyk/driftctl/enumeration/remote/alerts" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" remoteerr "github.com/snyk/driftctl/enumeration/remote/error" "github.com/snyk/driftctl/enumeration/remote/google" "github.com/snyk/driftctl/enumeration/remote/google/repository" @@ -55,7 +55,7 @@ func TestGoogleProjectIAMMember(t *testing.T) { "SendAlert", "google_project_iam_member", alerts.NewRemoteAccessDeniedAlert( - common2.RemoteGoogleTerraform, + common.RemoteGoogleTerraform, remoteerr.NewResourceListingError( errors.New("googleapi: Error 403: driftctl-acc-circle@driftctl-qa-1.iam.gserviceaccount.com does not have project.getIamPolicy access., forbidden"), "google_project_iam_member", @@ -101,7 +101,7 @@ func TestGoogleProjectIAMMember(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} diff --git a/enumeration/remote/google_sql_scanner_test.go b/enumeration/remote/google_sql_scanner_test.go index bcb05499..d617ae99 100644 --- a/enumeration/remote/google_sql_scanner_test.go +++ b/enumeration/remote/google_sql_scanner_test.go @@ -6,7 +6,7 @@ import ( "github.com/snyk/driftctl/enumeration" "github.com/snyk/driftctl/enumeration/remote/alerts" "github.com/snyk/driftctl/enumeration/remote/cache" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" remoteerr "github.com/snyk/driftctl/enumeration/remote/error" "github.com/snyk/driftctl/enumeration/remote/google" "github.com/snyk/driftctl/enumeration/remote/google/repository" @@ -90,7 +90,7 @@ func TestGoogleSQLDatabaseInstance(t *testing.T) { "SendAlert", "google_sql_database_instance", alerts.NewRemoteAccessDeniedAlert( - common2.RemoteGoogleTerraform, + common.RemoteGoogleTerraform, remoteerr.NewResourceListingError( status.Error(codes.PermissionDenied, "The caller does not have permission"), "google_sql_database_instance", @@ -111,7 +111,7 @@ func TestGoogleSQLDatabaseInstance(t *testing.T) { t.Run(c.test, func(tt *testing.T) { scanOptions := ScannerOptions{} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} diff --git a/enumeration/remote/google_storage_scanner_test.go b/enumeration/remote/google_storage_scanner_test.go index 75027fb7..ce5fe238 100644 --- a/enumeration/remote/google_storage_scanner_test.go +++ b/enumeration/remote/google_storage_scanner_test.go @@ -7,7 +7,7 @@ import ( "github.com/snyk/driftctl/enumeration" "github.com/snyk/driftctl/enumeration/remote/alerts" "github.com/snyk/driftctl/enumeration/remote/cache" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" remoteerr "github.com/snyk/driftctl/enumeration/remote/error" google2 "github.com/snyk/driftctl/enumeration/remote/google" "github.com/snyk/driftctl/enumeration/remote/google/repository" @@ -76,7 +76,7 @@ func TestGoogleStorageBucket(t *testing.T) { "SendAlert", "google_storage_bucket", alerts.NewRemoteAccessDeniedAlert( - common2.RemoteGoogleTerraform, + common.RemoteGoogleTerraform, remoteerr.NewResourceListingError( status.Error(codes.PermissionDenied, "The caller does not have permission"), "google_storage_bucket", @@ -102,7 +102,7 @@ func TestGoogleStorageBucket(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} @@ -143,7 +143,7 @@ func TestGoogleStorageBucket(t *testing.T) { repo := repository.NewAssetRepository(assetClient, realProvider.GetConfig(), cache.New(0)) remoteLibrary.AddEnumerator(google2.NewGoogleStorageBucketEnumerator(repo, factory)) - remoteLibrary.AddDetailsFetcher(resType, common2.NewGenericDetailsFetcher(resType, provider, deserializer)) + remoteLibrary.AddDetailsFetcher(resType, common.NewGenericDetailsFetcher(resType, provider, deserializer)) testFilter := &enumeration.MockFilter{} testFilter.On("IsTypeIgnored", mock.Anything).Return(false) @@ -222,7 +222,7 @@ func TestGoogleStorageBucketIAMMember(t *testing.T) { "SendAlert", "google_storage_bucket_iam_member", alerts.NewRemoteAccessDeniedAlert( - common2.RemoteGoogleTerraform, + common.RemoteGoogleTerraform, remoteerr.NewResourceListingError( errors.New("googleapi: Error 403: driftctl-acc-circle@driftctl-qa-1.iam.gserviceaccount.com does not have storage.buckets.getIamPolicy access to the Google Cloud Storage bucket., forbidden"), "google_storage_bucket_iam_member", @@ -278,7 +278,7 @@ func TestGoogleStorageBucketIAMMember(t *testing.T) { scanOptions := ScannerOptions{Deep: true} providerLibrary := terraform3.NewProviderLibrary() - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() // Initialize mocks alerter := &mocks.AlerterInterface{} diff --git a/enumeration/remote/remote.go b/enumeration/remote/remote.go index eb2f3816..0025d853 100644 --- a/enumeration/remote/remote.go +++ b/enumeration/remote/remote.go @@ -6,7 +6,7 @@ import ( "github.com/snyk/driftctl/enumeration/alerter" "github.com/snyk/driftctl/enumeration/remote/aws" "github.com/snyk/driftctl/enumeration/remote/azurerm" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" "github.com/snyk/driftctl/enumeration/remote/github" "github.com/snyk/driftctl/enumeration/remote/google" "github.com/snyk/driftctl/enumeration/resource" @@ -14,10 +14,10 @@ import ( ) var supportedRemotes = []string{ - common2.RemoteAWSTerraform, - common2.RemoteGithubTerraform, - common2.RemoteGoogleTerraform, - common2.RemoteAzureTerraform, + common.RemoteAWSTerraform, + common.RemoteGithubTerraform, + common.RemoteGoogleTerraform, + common.RemoteAzureTerraform, } func IsSupported(remote string) bool { @@ -31,19 +31,19 @@ func IsSupported(remote string) bool { func Activate(remote, version string, alerter *alerter.Alerter, providerLibrary *terraform.ProviderLibrary, - remoteLibrary *common2.RemoteLibrary, + remoteLibrary *common.RemoteLibrary, progress enumeration.ProgressCounter, resourceSchemaRepository *resource.SchemaRepository, factory resource.ResourceFactory, configDir string) error { switch remote { - case common2.RemoteAWSTerraform: + case common.RemoteAWSTerraform: return aws.Init(version, alerter, providerLibrary, remoteLibrary, progress, resourceSchemaRepository, factory, configDir) - case common2.RemoteGithubTerraform: + case common.RemoteGithubTerraform: return github.Init(version, alerter, providerLibrary, remoteLibrary, progress, resourceSchemaRepository, factory, configDir) - case common2.RemoteGoogleTerraform: + case common.RemoteGoogleTerraform: return google.Init(version, alerter, providerLibrary, remoteLibrary, progress, resourceSchemaRepository, factory, configDir) - case common2.RemoteAzureTerraform: + case common.RemoteAzureTerraform: return azurerm.Init(version, alerter, providerLibrary, remoteLibrary, progress, resourceSchemaRepository, factory, configDir) default: diff --git a/enumeration/remote/scanner_test.go b/enumeration/remote/scanner_test.go index 5e14f1da..b99657ea 100644 --- a/enumeration/remote/scanner_test.go +++ b/enumeration/remote/scanner_test.go @@ -5,7 +5,7 @@ import ( "github.com/snyk/driftctl/enumeration" "github.com/snyk/driftctl/enumeration/alerter" - common2 "github.com/snyk/driftctl/enumeration/remote/common" + "github.com/snyk/driftctl/enumeration/remote/common" "github.com/snyk/driftctl/enumeration/resource" @@ -16,11 +16,11 @@ func TestScannerShouldIgnoreType(t *testing.T) { // Initialize mocks alerter := alerter.NewAlerter() - fakeEnumerator := &common2.MockEnumerator{} + fakeEnumerator := &common.MockEnumerator{} fakeEnumerator.On("SupportedType").Return(resource.ResourceType("FakeType")) fakeEnumerator.AssertNotCalled(t, "Enumerate") - remoteLibrary := common2.NewRemoteLibrary() + remoteLibrary := common.NewRemoteLibrary() remoteLibrary.AddEnumerator(fakeEnumerator) testFilter := &enumeration.MockFilter{}