@@ -281,7 +281,10 @@ func (ec2i *FakeEC2Impl) DescribeSecurityGroups(ctx context.Context, request *ec
281
281
// CreateSecurityGroup is not implemented but is required for interface
282
282
// conformance
283
283
func (ec2i * FakeEC2Impl ) CreateSecurityGroup (ctx context.Context , request * ec2.CreateSecurityGroupInput , optFns ... func (* ec2.Options )) (* ec2.CreateSecurityGroupOutput , error ) {
284
- panic ("Not implemented" )
284
+ // Mock implementation for testing
285
+ return & ec2.CreateSecurityGroupOutput {
286
+ GroupId : aws .String ("sg-123456" ),
287
+ }, nil
285
288
}
286
289
287
290
// DeleteSecurityGroup is not implemented but is required for interface
@@ -293,7 +296,11 @@ func (ec2i *FakeEC2Impl) DeleteSecurityGroup(ctx context.Context, request *ec2.D
293
296
// AuthorizeSecurityGroupIngress is not implemented but is required for
294
297
// interface conformance
295
298
func (ec2i * FakeEC2Impl ) AuthorizeSecurityGroupIngress (ctx context.Context , request * ec2.AuthorizeSecurityGroupIngressInput , optFns ... func (* ec2.Options )) (* ec2.AuthorizeSecurityGroupIngressOutput , error ) {
296
- panic ("Not implemented" )
299
+ // Mock implementation for testing
300
+ if request .GroupId == nil || len (request .IpPermissions ) == 0 {
301
+ return nil , errors .New ("Invalid input: GroupId or IpPermissions missing" )
302
+ }
303
+ return & ec2.AuthorizeSecurityGroupIngressOutput {}, nil
297
304
}
298
305
299
306
// RevokeSecurityGroupIngress is not implemented but is required for interface
@@ -531,10 +538,14 @@ type FakeELB struct {
531
538
aws * FakeAWSServices
532
539
}
533
540
534
- // CreateLoadBalancer is not implemented but is required for interface
535
- // conformance
541
+ // CreateLoadBalancer is a mock implementation for testing
536
542
func (e * FakeELB ) CreateLoadBalancer (ctx context.Context , input * elb.CreateLoadBalancerInput , opts ... func (* elb.Options )) (* elb.CreateLoadBalancerOutput , error ) {
537
- panic ("Not implemented" )
543
+ if input == nil || input .LoadBalancerName == nil {
544
+ return nil , errors .New ("Invalid input: LoadBalancerName missing" )
545
+ }
546
+ return & elb.CreateLoadBalancerOutput {
547
+ DNSName : aws .String ("mock-dns-name" ),
548
+ }, nil
538
549
}
539
550
540
551
// DeleteLoadBalancer is not implemented but is required for interface
@@ -543,21 +554,33 @@ func (e *FakeELB) DeleteLoadBalancer(ctx context.Context, input *elb.DeleteLoadB
543
554
return & elb.DeleteLoadBalancerOutput {}, nil
544
555
}
545
556
546
- // DescribeLoadBalancers is not implemented but is required for interface
547
- // conformance
557
+ // DescribeLoadBalancers is a mock implementation for testing
548
558
func (e * FakeELB ) DescribeLoadBalancers (ctx context.Context , input * elb.DescribeLoadBalancersInput , opts ... func (* elb.Options )) (* elb.DescribeLoadBalancersOutput , error ) {
549
- panic ("Not implemented" )
559
+ if input == nil || len (input .LoadBalancerNames ) == 0 {
560
+ return nil , errors .New ("Invalid input: LoadBalancerNames missing" )
561
+ }
562
+ return & elb.DescribeLoadBalancersOutput {
563
+ LoadBalancerDescriptions : []elbtypes.LoadBalancerDescription {
564
+ {
565
+ LoadBalancerName : aws .String (input .LoadBalancerNames [0 ]),
566
+ DNSName : aws .String ("mock-dns-name" ),
567
+ VPCId : aws .String ("mock-vpc-id" ),
568
+ },
569
+ },
570
+ }, nil
550
571
}
551
572
552
573
// AddTags is not implemented but is required for interface conformance
553
574
func (e * FakeELB ) AddTags (ctx context.Context , input * elb.AddTagsInput , opts ... func (* elb.Options )) (* elb.AddTagsOutput , error ) {
554
575
panic ("Not implemented" )
555
576
}
556
577
557
- // RegisterInstancesWithLoadBalancer is not implemented but is required for
558
- // interface conformance
578
+ // RegisterInstancesWithLoadBalancer is a mock implementation for testing
559
579
func (e * FakeELB ) RegisterInstancesWithLoadBalancer (ctx context.Context , input * elb.RegisterInstancesWithLoadBalancerInput , opts ... func (* elb.Options )) (* elb.RegisterInstancesWithLoadBalancerOutput , error ) {
560
- panic ("Not implemented" )
580
+ if input == nil || len (input .Instances ) == 0 {
581
+ return nil , errors .New ("Invalid input: Instances missing" )
582
+ }
583
+ return & elb.RegisterInstancesWithLoadBalancerOutput {}, nil
561
584
}
562
585
563
586
// DeregisterInstancesFromLoadBalancer is not implemented but is required for
@@ -572,16 +595,20 @@ func (e *FakeELB) DetachLoadBalancerFromSubnets(ctx context.Context, input *elb.
572
595
panic ("Not implemented" )
573
596
}
574
597
575
- // AttachLoadBalancerToSubnets is not implemented but is required for interface
576
- // conformance
598
+ // AttachLoadBalancerToSubnets is a mock implementation for testing
577
599
func (e * FakeELB ) AttachLoadBalancerToSubnets (ctx context.Context , input * elb.AttachLoadBalancerToSubnetsInput , opts ... func (* elb.Options )) (* elb.AttachLoadBalancerToSubnetsOutput , error ) {
578
- panic ("Not implemented" )
600
+ if input == nil || len (input .Subnets ) == 0 {
601
+ return nil , errors .New ("Invalid input: Subnets missing" )
602
+ }
603
+ return & elb.AttachLoadBalancerToSubnetsOutput {}, nil
579
604
}
580
605
581
- // CreateLoadBalancerListeners is not implemented but is required for interface
582
- // conformance
606
+ // CreateLoadBalancerListeners is a mock implementation for testing
583
607
func (e * FakeELB ) CreateLoadBalancerListeners (ctx context.Context , input * elb.CreateLoadBalancerListenersInput , opts ... func (* elb.Options )) (* elb.CreateLoadBalancerListenersOutput , error ) {
584
- panic ("Not implemented" )
608
+ if input == nil || len (input .Listeners ) == 0 {
609
+ return nil , errors .New ("Invalid input: Listeners missing" )
610
+ }
611
+ return & elb.CreateLoadBalancerListenersOutput {}, nil
585
612
}
586
613
587
614
// DeleteLoadBalancerListeners is not implemented but is required for interface
@@ -590,10 +617,12 @@ func (e *FakeELB) DeleteLoadBalancerListeners(ctx context.Context, input *elb.De
590
617
panic ("Not implemented" )
591
618
}
592
619
593
- // ApplySecurityGroupsToLoadBalancer is not implemented but is required for
594
- // interface conformance
620
+ // ApplySecurityGroupsToLoadBalancer is a mock implementation for testing
595
621
func (e * FakeELB ) ApplySecurityGroupsToLoadBalancer (ctx context.Context , input * elb.ApplySecurityGroupsToLoadBalancerInput , opts ... func (* elb.Options )) (* elb.ApplySecurityGroupsToLoadBalancerOutput , error ) {
596
- panic ("Not implemented" )
622
+ if input == nil || len (input .SecurityGroups ) == 0 {
623
+ return nil , errors .New ("Invalid input: SecurityGroups missing" )
624
+ }
625
+ return & elb.ApplySecurityGroupsToLoadBalancerOutput {}, nil
597
626
}
598
627
599
628
// ConfigureHealthCheck is not implemented but is required for interface
@@ -632,16 +661,22 @@ func (e *FakeELB) DescribeLoadBalancerPolicies(ctx context.Context, input *elb.D
632
661
return & elb.DescribeLoadBalancerPoliciesOutput {}, nil
633
662
}
634
663
635
- // DescribeLoadBalancerAttributes is not implemented but is required for
636
- // interface conformance
664
+ // DescribeLoadBalancerAttributes is a mock implementation for testing
637
665
func (e * FakeELB ) DescribeLoadBalancerAttributes (ctx context.Context , input * elb.DescribeLoadBalancerAttributesInput , opts ... func (* elb.Options )) (* elb.DescribeLoadBalancerAttributesOutput , error ) {
638
- panic ("Not implemented" )
666
+ if input == nil || input .LoadBalancerName == nil {
667
+ return nil , errors .New ("Invalid input: LoadBalancerName missing" )
668
+ }
669
+ return & elb.DescribeLoadBalancerAttributesOutput {
670
+ LoadBalancerAttributes : & elbtypes.LoadBalancerAttributes {},
671
+ }, nil
639
672
}
640
673
641
- // ModifyLoadBalancerAttributes is not implemented but is required for
642
- // interface conformance
674
+ // ModifyLoadBalancerAttributes is a mock implementation for testing
643
675
func (e * FakeELB ) ModifyLoadBalancerAttributes (ctx context.Context , input * elb.ModifyLoadBalancerAttributesInput , opts ... func (* elb.Options )) (* elb.ModifyLoadBalancerAttributesOutput , error ) {
644
- panic ("Not implemented" )
676
+ if input == nil || input .LoadBalancerName == nil {
677
+ return nil , errors .New ("Invalid input: LoadBalancerName missing" )
678
+ }
679
+ return & elb.ModifyLoadBalancerAttributesOutput {}, nil
645
680
}
646
681
647
682
// FakeELBV2 is a fake ELBV2 client used for testing
@@ -659,16 +694,27 @@ func (elb *FakeELBV2) CreateLoadBalancer(ctx context.Context, input *elbv2.Creat
659
694
panic ("Not implemented" )
660
695
}
661
696
662
- // DescribeLoadBalancers is not implemented but is required for interface conformance
663
- func (elb * FakeELBV2 ) DescribeLoadBalancers (ctx context.Context , input * elbv2.DescribeLoadBalancersInput , optFns ... func (* elbv2.Options )) (* elbv2.DescribeLoadBalancersOutput , error ) {
664
- panic ("Not implemented" )
697
+ // DescribeLoadBalancers is a mock implementation for testing
698
+ func (elb * FakeELBV2 ) DescribeLoadBalancers (ctx context.Context , input * elbv2.DescribeLoadBalancersInput , opts ... func (* elbv2.Options )) (* elbv2.DescribeLoadBalancersOutput , error ) {
699
+ if input == nil || len (input .Names ) == 0 {
700
+ return nil , errors .New ("Invalid input: LoadBalancer names missing" )
701
+ }
702
+ if input .Names [0 ] == "aid" {
703
+ return & elbv2.DescribeLoadBalancersOutput {}, nil
704
+ }
705
+ return nil , errors .New ("NLB 'aid' could not be found" )
665
706
}
666
707
667
708
// DeleteLoadBalancer is not implemented but is required for interface conformance
668
709
func (elb * FakeELBV2 ) DeleteLoadBalancer (ctx context.Context , input * elbv2.DeleteLoadBalancerInput , optFns ... func (* elbv2.Options )) (* elbv2.DeleteLoadBalancerOutput , error ) {
669
710
panic ("Not implemented" )
670
711
}
671
712
713
+ // SetSecurityGroups is not implemented but is required for interface conformance
714
+ func (elb * FakeELBV2 ) SetSecurityGroups (ctx context.Context , input * elbv2.SetSecurityGroupsInput , optFns ... func (* elbv2.Options )) (* elbv2.SetSecurityGroupsOutput , error ) {
715
+ panic ("Not implemented" )
716
+ }
717
+
672
718
// ModifyLoadBalancerAttributes is not implemented but is required for interface conformance
673
719
func (elb * FakeELBV2 ) ModifyLoadBalancerAttributes (ctx context.Context , input * elbv2.ModifyLoadBalancerAttributesInput , optFns ... func (* elbv2.Options )) (* elbv2.ModifyLoadBalancerAttributesOutput , error ) {
674
720
panic ("Not implemented" )
@@ -714,9 +760,12 @@ func (elb *FakeELBV2) ModifyTargetGroupAttributes(ctx context.Context, input *el
714
760
panic ("Not implemented" )
715
761
}
716
762
717
- // RegisterTargets is not implemented but is required for interface conformance
718
- func (elb * FakeELBV2 ) RegisterTargets (ctx context.Context , input * elbv2.RegisterTargetsInput , optFns ... func (* elbv2.Options )) (* elbv2.RegisterTargetsOutput , error ) {
719
- panic ("Not implemented" )
763
+ // RegisterTargets is a mock implementation for testing
764
+ func (elb * FakeELBV2 ) RegisterTargets (ctx context.Context , input * elbv2.RegisterTargetsInput , opts ... func (* elbv2.Options )) (* elbv2.RegisterTargetsOutput , error ) {
765
+ if input == nil || len (input .Targets ) == 0 {
766
+ return nil , errors .New ("Invalid input: Targets missing" )
767
+ }
768
+ return & elbv2.RegisterTargetsOutput {}, nil
720
769
}
721
770
722
771
// DeregisterTargets is not implemented but is required for interface conformance
0 commit comments