From de5feb28291eb15c25f776bf1843235d413abee9 Mon Sep 17 00:00:00 2001 From: Erik Kristensen Date: Sat, 4 Jan 2025 11:07:29 -0700 Subject: [PATCH] feat(mobile-project): remove resource, no longer supported by AWS --- resources/mobile-projects.go | 77 ------------------------------------ 1 file changed, 77 deletions(-) delete mode 100644 resources/mobile-projects.go diff --git a/resources/mobile-projects.go b/resources/mobile-projects.go deleted file mode 100644 index 48b5a763..00000000 --- a/resources/mobile-projects.go +++ /dev/null @@ -1,77 +0,0 @@ -package resources - -import ( - "context" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/service/mobile" - - "github.com/ekristen/libnuke/pkg/registry" - "github.com/ekristen/libnuke/pkg/resource" - - "github.com/ekristen/aws-nuke/v3/pkg/nuke" -) - -const MobileProjectResource = "MobileProject" - -func init() { - registry.Register(®istry.Registration{ - Name: MobileProjectResource, - Scope: nuke.Account, - Resource: &MobileProject{}, - Lister: &MobileProjectLister{}, - }) -} - -type MobileProjectLister struct{} - -func (l *MobileProjectLister) List(_ context.Context, o interface{}) ([]resource.Resource, error) { - opts := o.(*nuke.ListerOpts) - - svc := mobile.New(opts.Session) - svc.ClientInfo.SigningName = "AWSMobileHubService" - resources := make([]resource.Resource, 0) - - params := &mobile.ListProjectsInput{ - MaxResults: aws.Int64(100), - } - - for { - output, err := svc.ListProjects(params) - if err != nil { - return nil, err - } - - for _, project := range output.Projects { - resources = append(resources, &MobileProject{ - svc: svc, - projectID: project.ProjectId, - }) - } - - if output.NextToken == nil { - break - } - - params.NextToken = output.NextToken - } - - return resources, nil -} - -type MobileProject struct { - svc *mobile.Mobile - projectID *string -} - -func (f *MobileProject) Remove(_ context.Context) error { - _, err := f.svc.DeleteProject(&mobile.DeleteProjectInput{ - ProjectId: f.projectID, - }) - - return err -} - -func (f *MobileProject) String() string { - return *f.projectID -}