mirror of
https://github.com/mulgadc/spinifex.git
synced 2026-10-15 09:01:31 +00:00
refactor: move EC2 placementgroup action adapters to domains/ec2/awsapi
This commit is contained in:
@@ -13,12 +13,12 @@ import (
|
||||
"github.com/aws/aws-sdk-go/service/s3"
|
||||
ec2keyapi "github.com/mulgadc/spinifex/spinifex/domains/ec2/awsapi/key"
|
||||
ec2launchtemplateapi "github.com/mulgadc/spinifex/spinifex/domains/ec2/awsapi/launchtemplate"
|
||||
ec2placementgroupapi "github.com/mulgadc/spinifex/spinifex/domains/ec2/awsapi/placementgroup"
|
||||
"github.com/mulgadc/spinifex/spinifex/foundation/aws/errors"
|
||||
gateway_ec2_eip "github.com/mulgadc/spinifex/spinifex/gateway/ec2/eip"
|
||||
gateway_ec2_igw "github.com/mulgadc/spinifex/spinifex/gateway/ec2/igw"
|
||||
gateway_ec2_image "github.com/mulgadc/spinifex/spinifex/gateway/ec2/image"
|
||||
gateway_ec2_instance "github.com/mulgadc/spinifex/spinifex/gateway/ec2/instance"
|
||||
gateway_ec2_placementgroup "github.com/mulgadc/spinifex/spinifex/gateway/ec2/placementgroup"
|
||||
gateway_ec2_routetable "github.com/mulgadc/spinifex/spinifex/gateway/ec2/routetable"
|
||||
gateway_ec2_snapshot "github.com/mulgadc/spinifex/spinifex/gateway/ec2/snapshot"
|
||||
gateway_ec2_volume "github.com/mulgadc/spinifex/spinifex/gateway/ec2/volume"
|
||||
@@ -596,7 +596,7 @@ func (r *placementGroupReaper) Kind() string { return "placement-group" }
|
||||
func (r *placementGroupReaper) Stage() Stage { return StagePlatform }
|
||||
|
||||
func (r *placementGroupReaper) List(ctx context.Context, accountID string) ([]Resource, error) {
|
||||
out, err := gateway_ec2_placementgroup.DescribePlacementGroups(ctx, &ec2.DescribePlacementGroupsInput{}, r.nc, accountID)
|
||||
out, err := ec2placementgroupapi.DescribePlacementGroups(ctx, &ec2.DescribePlacementGroupsInput{}, r.nc, accountID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -612,7 +612,7 @@ func (r *placementGroupReaper) List(ctx context.Context, accountID string) ([]Re
|
||||
}
|
||||
|
||||
func (r *placementGroupReaper) Delete(ctx context.Context, accountID string, resource Resource, _ bool) error {
|
||||
_, err := gateway_ec2_placementgroup.DeletePlacementGroup(ctx, &ec2.DeletePlacementGroupInput{
|
||||
_, err := ec2placementgroupapi.DeletePlacementGroup(ctx, &ec2.DeletePlacementGroupInput{
|
||||
GroupName: aws.String(resource.ID),
|
||||
}, r.nc, accountID)
|
||||
return ignoreAlreadyGone(err)
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package gateway_ec2_placementgroup
|
||||
package placementgroup
|
||||
|
||||
import (
|
||||
"context"
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package gateway_ec2_placementgroup
|
||||
package placementgroup
|
||||
|
||||
import (
|
||||
"context"
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package gateway_ec2_placementgroup
|
||||
package placementgroup
|
||||
|
||||
import (
|
||||
"context"
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package gateway_ec2_placementgroup
|
||||
package placementgroup
|
||||
|
||||
import (
|
||||
"context"
|
||||
@@ -17,6 +17,7 @@ import (
|
||||
ec2capacityreservationapi "github.com/mulgadc/spinifex/spinifex/domains/ec2/awsapi/capacityreservation"
|
||||
ec2keyapi "github.com/mulgadc/spinifex/spinifex/domains/ec2/awsapi/key"
|
||||
ec2launchtemplateapi "github.com/mulgadc/spinifex/spinifex/domains/ec2/awsapi/launchtemplate"
|
||||
ec2placementgroupapi "github.com/mulgadc/spinifex/spinifex/domains/ec2/awsapi/placementgroup"
|
||||
"github.com/mulgadc/spinifex/spinifex/foundation/aws/errors"
|
||||
awsxml "github.com/mulgadc/spinifex/spinifex/foundation/aws/xml"
|
||||
"github.com/mulgadc/spinifex/spinifex/foundation/lifecycle/idempotency"
|
||||
@@ -27,7 +28,6 @@ import (
|
||||
gateway_ec2_image "github.com/mulgadc/spinifex/spinifex/gateway/ec2/image"
|
||||
gateway_ec2_instance "github.com/mulgadc/spinifex/spinifex/gateway/ec2/instance"
|
||||
gateway_ec2_natgw "github.com/mulgadc/spinifex/spinifex/gateway/ec2/natgw"
|
||||
gateway_ec2_placementgroup "github.com/mulgadc/spinifex/spinifex/gateway/ec2/placementgroup"
|
||||
gateway_ec2_routetable "github.com/mulgadc/spinifex/spinifex/gateway/ec2/routetable"
|
||||
gateway_ec2_snapshot "github.com/mulgadc/spinifex/spinifex/gateway/ec2/snapshot"
|
||||
gateway_ec2_spotinstance "github.com/mulgadc/spinifex/spinifex/gateway/ec2/spotinstance"
|
||||
@@ -434,13 +434,13 @@ var ec2Actions = map[string]ec2Action{
|
||||
return gateway_ec2_eigw.DescribeEgressOnlyInternetGateways(ctx, input, gw.NATSConn, accountID)
|
||||
}),
|
||||
"CreatePlacementGroup": ec2Handler(func(ctx context.Context, input *ec2.CreatePlacementGroupInput, gw *GatewayConfig, accountID string) (any, error) {
|
||||
return gateway_ec2_placementgroup.CreatePlacementGroup(ctx, input, gw.NATSConn, accountID)
|
||||
return ec2placementgroupapi.CreatePlacementGroup(ctx, input, gw.NATSConn, accountID)
|
||||
}),
|
||||
"DeletePlacementGroup": ec2Handler(func(ctx context.Context, input *ec2.DeletePlacementGroupInput, gw *GatewayConfig, accountID string) (any, error) {
|
||||
return gateway_ec2_placementgroup.DeletePlacementGroup(ctx, input, gw.NATSConn, accountID)
|
||||
return ec2placementgroupapi.DeletePlacementGroup(ctx, input, gw.NATSConn, accountID)
|
||||
}),
|
||||
"DescribePlacementGroups": ec2Handler(func(ctx context.Context, input *ec2.DescribePlacementGroupsInput, gw *GatewayConfig, accountID string) (any, error) {
|
||||
return gateway_ec2_placementgroup.DescribePlacementGroups(ctx, input, gw.NATSConn, accountID)
|
||||
return ec2placementgroupapi.DescribePlacementGroups(ctx, input, gw.NATSConn, accountID)
|
||||
}),
|
||||
"CreateCapacityReservation": ec2IdempotentHandler(func(ctx context.Context, input *ec2.CreateCapacityReservationInput, gw *GatewayConfig, accountID string) (ec2.CreateCapacityReservationOutput, error) {
|
||||
return ec2capacityreservationapi.CreateCapacityReservation(ctx, input, gw.NATSConn, gw.ExpectedNodes, accountID)
|
||||
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
// ec2placementgroup.PlacementGroupServiceImpl — the same production
|
||||
// code a live daemon runs — to every ec2.*PlacementGroup*/ec2.Reserve*/
|
||||
// ec2.Finalize*/ec2.Release* subject the gateway's NATSPlacementGroupService
|
||||
// client calls (gateway/ec2/placementgroup/*.go and RunInstances.go's spread/
|
||||
// client calls (domains/ec2/awsapi/placementgroup/*.go and RunInstances.go's spread/
|
||||
// cluster routing in gateway/ec2/instance/placement.go). Unlike a StubSubject
|
||||
// canned reply, this exercises the real KV-backed CAS reservation logic, so a
|
||||
// test that checks placement-group strategy routing actually proves the
|
||||
|
||||
Reference in New Issue
Block a user