Skip to content

Commit

Permalink
rename InitV2 function to Init, part of AWS SDK v2 resource migra…
Browse files Browse the repository at this point in the history
…tion (#770).
  • Loading branch information
wakeful committed Dec 21, 2024
1 parent 9b0cc9d commit d7e0c23
Show file tree
Hide file tree
Showing 116 changed files with 119 additions and 119 deletions.
2 changes: 1 addition & 1 deletion aws/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

// AwsResource is an interface that represents a single AWS resource
type AwsResource interface {
InitV2(cfg aws.Config)
Init(cfg aws.Config)
ResourceName() string
ResourceIdentifiers() []string
MaxBatchSize() int
Expand Down
2 changes: 1 addition & 1 deletion aws/resource_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func toAwsResourcesPointer(resources []AwsResource) []*AwsResource {

func initRegisteredResources(resources []*AwsResource, session aws.Config, region string) []*AwsResource {
for _, resource := range resources {
(*resource).InitV2(session)
(*resource).Init(session)

// Note: only regional resources have the field `Region`, which is used for logging purposes only
setRegionForRegionalResource(resource, region)
Expand Down
2 changes: 1 addition & 1 deletion aws/resources/access_analyzer_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type AccessAnalyzer struct {
AnalyzerNames []string
}

func (analyzer *AccessAnalyzer) InitV2(cfg aws.Config) {
func (analyzer *AccessAnalyzer) Init(cfg aws.Config) {
analyzer.Client = accessanalyzer.NewFromConfig(cfg)
}

Expand Down
2 changes: 1 addition & 1 deletion aws/resources/acm_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type ACM struct {
ARNs []string
}

func (a *ACM) InitV2(cfg aws.Config) {
func (a *ACM) Init(cfg aws.Config) {
a.Client = acm.NewFromConfig(cfg)
}

Expand Down
2 changes: 1 addition & 1 deletion aws/resources/acmpca_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type ACMPCA struct {
ARNs []string
}

func (ap *ACMPCA) InitV2(cfg aws.Config) {
func (ap *ACMPCA) Init(cfg aws.Config) {
ap.Client = acmpca.NewFromConfig(cfg)
}

Expand Down
2 changes: 1 addition & 1 deletion aws/resources/ami_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type AMIs struct {
ImageIds []string
}

func (ami *AMIs) InitV2(cfg aws.Config) {
func (ami *AMIs) Init(cfg aws.Config) {
ami.Client = ec2.NewFromConfig(cfg)
}

Expand Down
2 changes: 1 addition & 1 deletion aws/resources/apigateway_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type ApiGateway struct {
Ids []string
}

func (gateway *ApiGateway) InitV2(cfg aws.Config) {
func (gateway *ApiGateway) Init(cfg aws.Config) {
gateway.Client = apigateway.NewFromConfig(cfg)
}

Expand Down
2 changes: 1 addition & 1 deletion aws/resources/apigatewayv2_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type ApiGatewayV2 struct {
Ids []string
}

func (gw *ApiGatewayV2) InitV2(cfg aws.Config) {
func (gw *ApiGatewayV2) Init(cfg aws.Config) {
gw.Client = apigatewayv2.NewFromConfig(cfg)
}

Expand Down
2 changes: 1 addition & 1 deletion aws/resources/apprunner_service_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (a *AppRunnerService) GetAndSetResourceConfig(configObj config.Config) conf
return configObj.AppRunnerService
}

func (a *AppRunnerService) InitV2(cfg aws.Config) {
func (a *AppRunnerService) Init(cfg aws.Config) {
a.Client = apprunner.NewFromConfig(cfg)
}

Expand Down
2 changes: 1 addition & 1 deletion aws/resources/asg_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type ASGroups struct {
GroupNames []string
}

func (ag *ASGroups) InitV2(cfg aws.Config) {
func (ag *ASGroups) Init(cfg aws.Config) {
ag.Client = autoscaling.NewFromConfig(cfg)
}

Expand Down
2 changes: 1 addition & 1 deletion aws/resources/backup_vault_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type BackupVault struct {
Names []string
}

func (bv *BackupVault) InitV2(cfg aws.Config) {
func (bv *BackupVault) Init(cfg aws.Config) {
bv.Client = backup.NewFromConfig(cfg)
}

Expand Down
2 changes: 1 addition & 1 deletion aws/resources/base_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type BaseAwsResource struct {
cancel context.CancelFunc
}

func (br *BaseAwsResource) InitV2(cfg aws.Config) {
func (br *BaseAwsResource) Init(cfg aws.Config) {
br.Nukables = make(map[string]error)
}

Expand Down
2 changes: 1 addition & 1 deletion aws/resources/cloudtrail_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type CloudtrailTrail struct {
Arns []string
}

func (ct *CloudtrailTrail) InitV2(cfg aws.Config) {
func (ct *CloudtrailTrail) Init(cfg aws.Config) {
ct.Client = cloudtrail.NewFromConfig(cfg)
}

Expand Down
2 changes: 1 addition & 1 deletion aws/resources/cloudwatch_alarm_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type CloudWatchAlarms struct {
AlarmNames []string
}

func (cw *CloudWatchAlarms) InitV2(cfg aws.Config) {
func (cw *CloudWatchAlarms) Init(cfg aws.Config) {
cw.Client = cloudwatch.NewFromConfig(cfg)
}

Expand Down
2 changes: 1 addition & 1 deletion aws/resources/cloudwatch_dashboard_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type CloudWatchDashboards struct {
DashboardNames []string
}

func (cwdb *CloudWatchDashboards) InitV2(cfg aws.Config) {
func (cwdb *CloudWatchDashboards) Init(cfg aws.Config) {
cwdb.Client = cloudwatch.NewFromConfig(cfg)
}

Expand Down
2 changes: 1 addition & 1 deletion aws/resources/cloudwatch_loggroup_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type CloudWatchLogGroups struct {
Names []string
}

func (csr *CloudWatchLogGroups) InitV2(cfg aws.Config) {
func (csr *CloudWatchLogGroups) Init(cfg aws.Config) {
csr.Client = cloudwatchlogs.NewFromConfig(cfg)
}

Expand Down
2 changes: 1 addition & 1 deletion aws/resources/codedeploy_application_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type CodeDeployApplications struct {
AppNames []string
}

func (cda *CodeDeployApplications) InitV2(cfg aws.Config) {
func (cda *CodeDeployApplications) Init(cfg aws.Config) {
cda.Client = codedeploy.NewFromConfig(cfg)
}

Expand Down
2 changes: 1 addition & 1 deletion aws/resources/config_recorder_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type ConfigServiceRecorders struct {
RecorderNames []string
}

func (csr *ConfigServiceRecorders) InitV2(cfg aws.Config) {
func (csr *ConfigServiceRecorders) Init(cfg aws.Config) {
csr.Client = configservice.NewFromConfig(cfg)
}

Expand Down
2 changes: 1 addition & 1 deletion aws/resources/config_service_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type ConfigServiceRule struct {
RuleNames []string
}

func (csr *ConfigServiceRule) InitV2(cfg aws.Config) {
func (csr *ConfigServiceRule) Init(cfg aws.Config) {
csr.Client = configservice.NewFromConfig(cfg)
}

Expand Down
2 changes: 1 addition & 1 deletion aws/resources/datasync_location_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (dsl *DataSyncLocation) GetAndSetResourceConfig(configObj config.Config) co
return configObj.DataSyncLocation
}

func (dsl *DataSyncLocation) InitV2(cfg aws.Config) {
func (dsl *DataSyncLocation) Init(cfg aws.Config) {
dsl.Client = datasync.NewFromConfig(cfg)
}

Expand Down
2 changes: 1 addition & 1 deletion aws/resources/datasync_task_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (dst *DataSyncTask) GetAndSetResourceConfig(configObj config.Config) config
return configObj.DataSyncTask
}

func (dst *DataSyncTask) InitV2(cfg aws.Config) {
func (dst *DataSyncTask) Init(cfg aws.Config) {
dst.Client = datasync.NewFromConfig(cfg)
}

Expand Down
2 changes: 1 addition & 1 deletion aws/resources/dynamodb_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type DynamoDB struct {
DynamoTableNames []string
}

func (ddb *DynamoDB) InitV2(cfg aws.Config) {
func (ddb *DynamoDB) Init(cfg aws.Config) {
ddb.Client = dynamodb.NewFromConfig(cfg)
}

Expand Down
2 changes: 1 addition & 1 deletion aws/resources/ebs_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type EBSVolumes struct {
VolumeIds []string
}

func (ev *EBSVolumes) InitV2(cfg aws.Config) {
func (ev *EBSVolumes) Init(cfg aws.Config) {
ev.Client = ec2.NewFromConfig(cfg)
}

Expand Down
2 changes: 1 addition & 1 deletion aws/resources/ec2_dedicated_host_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type EC2DedicatedHosts struct {
HostIds []string
}

func (h *EC2DedicatedHosts) InitV2(cfg aws.Config) {
func (h *EC2DedicatedHosts) Init(cfg aws.Config) {
h.Client = ec2.NewFromConfig(cfg)
}

Expand Down
2 changes: 1 addition & 1 deletion aws/resources/ec2_dhcp_option_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type EC2DhcpOption struct {
DhcpOptions map[string]DHCPOption
}

func (v *EC2DhcpOption) InitV2(cfg aws.Config) {
func (v *EC2DhcpOption) Init(cfg aws.Config) {
v.Client = ec2.NewFromConfig(cfg)
v.DhcpOptions = make(map[string]DHCPOption)
}
Expand Down
2 changes: 1 addition & 1 deletion aws/resources/ec2_egress_only_igw_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type EgressOnlyInternetGateway struct {
Pools []string
}

func (egigw *EgressOnlyInternetGateway) InitV2(cfg aws.Config) {
func (egigw *EgressOnlyInternetGateway) Init(cfg aws.Config) {
egigw.Client = ec2.NewFromConfig(cfg)
}

Expand Down
2 changes: 1 addition & 1 deletion aws/resources/ec2_endpoints_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type EC2Endpoints struct {
Endpoints []string
}

func (e *EC2Endpoints) InitV2(cfg aws.Config) {
func (e *EC2Endpoints) Init(cfg aws.Config) {
e.Client = ec2.NewFromConfig(cfg)
}

Expand Down
2 changes: 1 addition & 1 deletion aws/resources/ec2_internet_gateway_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type InternetGateway struct {
GatewayVPCMap map[string]string
}

func (igw *InternetGateway) InitV2(cfg aws.Config) {
func (igw *InternetGateway) Init(cfg aws.Config) {
igw.Client = ec2.NewFromConfig(cfg)
// Since the nuking of the internet gateway requires the VPC ID, and to avoid redundant API calls for this information within the nuke method,
// we utilize the getAll method to retrieve it.
Expand Down
2 changes: 1 addition & 1 deletion aws/resources/ec2_ipam_byoasn_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type EC2IPAMByoasn struct {

var MaxResultCount = int32(10)

func (byoasn *EC2IPAMByoasn) InitV2(cfg aws.Config) {
func (byoasn *EC2IPAMByoasn) Init(cfg aws.Config) {
byoasn.Client = ec2.NewFromConfig(cfg)
}

Expand Down
2 changes: 1 addition & 1 deletion aws/resources/ec2_ipam_custom_allocation_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type EC2IPAMCustomAllocation struct {
PoolAndAllocationMap map[string]string
}

func (cs *EC2IPAMCustomAllocation) InitV2(cfg aws.Config) {
func (cs *EC2IPAMCustomAllocation) Init(cfg aws.Config) {
cs.Client = ec2.NewFromConfig(cfg)
cs.PoolAndAllocationMap = make(map[string]string)
}
Expand Down
2 changes: 1 addition & 1 deletion aws/resources/ec2_ipam_pool_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type EC2IPAMPool struct {
Pools []string
}

func (pool *EC2IPAMPool) InitV2(cfg aws.Config) {
func (pool *EC2IPAMPool) Init(cfg aws.Config) {
pool.Client = ec2.NewFromConfig(cfg)
}

Expand Down
2 changes: 1 addition & 1 deletion aws/resources/ec2_ipam_resource_discovery_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type EC2IPAMResourceDiscovery struct {
DiscoveryIDs []string
}

func (ipam *EC2IPAMResourceDiscovery) InitV2(cfg aws.Config) {
func (ipam *EC2IPAMResourceDiscovery) Init(cfg aws.Config) {
ipam.Client = ec2.NewFromConfig(cfg)
}

Expand Down
2 changes: 1 addition & 1 deletion aws/resources/ec2_ipam_scope_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type EC2IpamScopes struct {
ScopreIDs []string
}

func (scope *EC2IpamScopes) InitV2(cfg aws.Config) {
func (scope *EC2IpamScopes) Init(cfg aws.Config) {
scope.Client = ec2.NewFromConfig(cfg)
}

Expand Down
2 changes: 1 addition & 1 deletion aws/resources/ec2_ipam_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type EC2IPAMs struct {
IDs []string
}

func (ipam *EC2IPAMs) InitV2(cfg aws.Config) {
func (ipam *EC2IPAMs) Init(cfg aws.Config) {
ipam.Client = ec2.NewFromConfig(cfg)
}

Expand Down
2 changes: 1 addition & 1 deletion aws/resources/ec2_key_pair_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type EC2KeyPairs struct {
KeyPairIds []string
}

func (k *EC2KeyPairs) InitV2(cfg aws.Config) {
func (k *EC2KeyPairs) Init(cfg aws.Config) {
k.Client = ec2.NewFromConfig(cfg)
}

Expand Down
2 changes: 1 addition & 1 deletion aws/resources/ec2_network_acl_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type NetworkACL struct {
Ids []string
}

func (nacl *NetworkACL) InitV2(cfg aws.Config) {
func (nacl *NetworkACL) Init(cfg aws.Config) {
nacl.Client = ec2.NewFromConfig(cfg)
}

Expand Down
2 changes: 1 addition & 1 deletion aws/resources/ec2_network_interface_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type NetworkInterface struct {
InterfaceIds []string
}

func (ni *NetworkInterface) InitV2(cfg aws.Config) {
func (ni *NetworkInterface) Init(cfg aws.Config) {
ni.Client = ec2.NewFromConfig(cfg)
}

Expand Down
2 changes: 1 addition & 1 deletion aws/resources/ec2_placement_group_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type EC2PlacementGroups struct {
PlacementGroupNames []string
}

func (k *EC2PlacementGroups) InitV2(cfg aws.Config) {
func (k *EC2PlacementGroups) Init(cfg aws.Config) {
k.Client = ec2.NewFromConfig(cfg)
}

Expand Down
2 changes: 1 addition & 1 deletion aws/resources/ec2_subnet_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type EC2Subnet struct {
Subnets []string
}

func (es *EC2Subnet) InitV2(cfg aws.Config) {
func (es *EC2Subnet) Init(cfg aws.Config) {
es.Client = ec2.NewFromConfig(cfg)
}

Expand Down
2 changes: 1 addition & 1 deletion aws/resources/ec2_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type EC2Instances struct {
InstanceIds []string
}

func (ei *EC2Instances) InitV2(cfg aws.Config) {
func (ei *EC2Instances) Init(cfg aws.Config) {
ei.Client = ec2.NewFromConfig(cfg)
}

Expand Down
2 changes: 1 addition & 1 deletion aws/resources/ec2_vpc_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ type EC2VPCs struct {
VPCIds []string
}

func (v *EC2VPCs) InitV2(cfg aws.Config) {
func (v *EC2VPCs) Init(cfg aws.Config) {
v.Client = ec2.NewFromConfig(cfg)
v.ELBClient = elbv2.NewFromConfig(cfg)
}
Expand Down
2 changes: 1 addition & 1 deletion aws/resources/ecr_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type ECR struct {
RepositoryNames []string
}

func (registry *ECR) InitV2(cfg aws.Config) {
func (registry *ECR) Init(cfg aws.Config) {
registry.Client = ecr.NewFromConfig(cfg)
}

Expand Down
2 changes: 1 addition & 1 deletion aws/resources/ecs_cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type ECSClusters struct {
ClusterArns []string
}

func (clusters *ECSClusters) InitV2(cfg aws.Config) {
func (clusters *ECSClusters) Init(cfg aws.Config) {
clusters.Client = ecs.NewFromConfig(cfg)
}

Expand Down
2 changes: 1 addition & 1 deletion aws/resources/ecs_service_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type ECSServices struct {
ServiceClusterMap map[string]string
}

func (services *ECSServices) InitV2(cfg aws.Config) {
func (services *ECSServices) Init(cfg aws.Config) {
services.Client = ecs.NewFromConfig(cfg)
}

Expand Down
Loading

0 comments on commit d7e0c23

Please sign in to comment.