This repository has been archived by the owner on Oct 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 725
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/cloudfront-origin-request-policy
- Loading branch information
Showing
38 changed files
with
484 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package resources | ||
|
||
import ( | ||
"github.com/aws/aws-sdk-go/aws" | ||
"github.com/aws/aws-sdk-go/aws/session" | ||
"github.com/aws/aws-sdk-go/service/appconfig" | ||
"github.com/rebuy-de/aws-nuke/v2/pkg/types" | ||
) | ||
|
||
type AppConfigApplication struct { | ||
svc *appconfig.AppConfig | ||
id *string | ||
name *string | ||
} | ||
|
||
func init() { | ||
register("AppConfigApplication", ListAppConfigApplications) | ||
} | ||
|
||
func ListAppConfigApplications(sess *session.Session) ([]Resource, error) { | ||
svc := appconfig.New(sess) | ||
resources := []Resource{} | ||
params := &appconfig.ListApplicationsInput{ | ||
MaxResults: aws.Int64(100), | ||
} | ||
err := svc.ListApplicationsPages(params, func(page *appconfig.ListApplicationsOutput, lastPage bool) bool { | ||
for _, item := range page.Items { | ||
resources = append(resources, &AppConfigApplication{ | ||
svc: svc, | ||
id: item.Id, | ||
name: item.Name, | ||
}) | ||
} | ||
return true | ||
}) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return resources, nil | ||
} | ||
|
||
func (f *AppConfigApplication) Remove() error { | ||
_, err := f.svc.DeleteApplication(&appconfig.DeleteApplicationInput{ | ||
ApplicationId: f.id, | ||
}) | ||
return err | ||
} | ||
|
||
func (f *AppConfigApplication) Properties() types.Properties { | ||
return types.NewProperties(). | ||
Set("ID", f.id). | ||
Set("Name", f.name) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package resources | ||
|
||
import ( | ||
"github.com/aws/aws-sdk-go/aws" | ||
"github.com/aws/aws-sdk-go/aws/session" | ||
"github.com/aws/aws-sdk-go/service/appconfig" | ||
"github.com/rebuy-de/aws-nuke/v2/pkg/types" | ||
"github.com/sirupsen/logrus" | ||
) | ||
|
||
type AppConfigConfigurationProfile struct { | ||
svc *appconfig.AppConfig | ||
applicationId *string | ||
id *string | ||
name *string | ||
} | ||
|
||
func init() { | ||
register("AppConfigConfigurationProfile", ListAppConfigConfigurationProfiles) | ||
} | ||
|
||
func ListAppConfigConfigurationProfiles(sess *session.Session) ([]Resource, error) { | ||
svc := appconfig.New(sess) | ||
resources := []Resource{} | ||
applications, err := ListAppConfigApplications(sess) | ||
if err != nil { | ||
return nil, err | ||
} | ||
for _, applicationResource := range applications { | ||
application, ok := applicationResource.(*AppConfigApplication) | ||
if !ok { | ||
logrus.Errorf("Unable to cast AppConfigApplication.") | ||
continue | ||
} | ||
params := &appconfig.ListConfigurationProfilesInput{ | ||
ApplicationId: application.id, | ||
MaxResults: aws.Int64(100), | ||
} | ||
err := svc.ListConfigurationProfilesPages(params, func(page *appconfig.ListConfigurationProfilesOutput, lastPage bool) bool { | ||
for _, item := range page.Items { | ||
resources = append(resources, &AppConfigConfigurationProfile{ | ||
svc: svc, | ||
applicationId: application.id, | ||
id: item.Id, | ||
name: item.Name, | ||
}) | ||
} | ||
return true | ||
}) | ||
if err != nil { | ||
return nil, err | ||
} | ||
} | ||
return resources, nil | ||
} | ||
|
||
func (f *AppConfigConfigurationProfile) Remove() error { | ||
_, err := f.svc.DeleteConfigurationProfile(&appconfig.DeleteConfigurationProfileInput{ | ||
ApplicationId: f.applicationId, | ||
ConfigurationProfileId: f.id, | ||
}) | ||
return err | ||
} | ||
|
||
func (f *AppConfigConfigurationProfile) Properties() types.Properties { | ||
return types.NewProperties(). | ||
Set("ApplicationID", f.applicationId). | ||
Set("ID", f.id). | ||
Set("Name", f.name) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package resources | ||
|
||
import ( | ||
"github.com/aws/aws-sdk-go/aws" | ||
"github.com/aws/aws-sdk-go/aws/session" | ||
"github.com/aws/aws-sdk-go/service/appconfig" | ||
"github.com/rebuy-de/aws-nuke/v2/pkg/types" | ||
) | ||
|
||
type AppConfigDeploymentStrategy struct { | ||
svc *appconfig.AppConfig | ||
id *string | ||
name *string | ||
} | ||
|
||
func init() { | ||
register("AppConfigDeploymentStrategy", ListAppConfigDeploymentStrategies) | ||
} | ||
|
||
func ListAppConfigDeploymentStrategies(sess *session.Session) ([]Resource, error) { | ||
svc := appconfig.New(sess) | ||
resources := []Resource{} | ||
params := &appconfig.ListDeploymentStrategiesInput{ | ||
MaxResults: aws.Int64(100), | ||
} | ||
err := svc.ListDeploymentStrategiesPages(params, func(page *appconfig.ListDeploymentStrategiesOutput, lastPage bool) bool { | ||
for _, item := range page.Items { | ||
resources = append(resources, &AppConfigDeploymentStrategy{ | ||
svc: svc, | ||
id: item.Id, | ||
name: item.Name, | ||
}) | ||
} | ||
return true | ||
}) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return resources, nil | ||
} | ||
|
||
func (f *AppConfigDeploymentStrategy) Remove() error { | ||
_, err := f.svc.DeleteDeploymentStrategy(&appconfig.DeleteDeploymentStrategyInput{ | ||
DeploymentStrategyId: f.id, | ||
}) | ||
return err | ||
} | ||
|
||
func (f *AppConfigDeploymentStrategy) Properties() types.Properties { | ||
return types.NewProperties(). | ||
Set("ID", f.id). | ||
Set("Name", f.name) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package resources | ||
|
||
import ( | ||
"github.com/aws/aws-sdk-go/aws" | ||
"github.com/aws/aws-sdk-go/aws/session" | ||
"github.com/aws/aws-sdk-go/service/appconfig" | ||
"github.com/rebuy-de/aws-nuke/v2/pkg/types" | ||
"github.com/sirupsen/logrus" | ||
) | ||
|
||
type AppConfigEnvironment struct { | ||
svc *appconfig.AppConfig | ||
applicationId *string | ||
id *string | ||
name *string | ||
} | ||
|
||
func init() { | ||
register("AppConfigEnvironment", ListAppConfigEnvironments) | ||
} | ||
|
||
func ListAppConfigEnvironments(sess *session.Session) ([]Resource, error) { | ||
svc := appconfig.New(sess) | ||
resources := []Resource{} | ||
applications, err := ListAppConfigApplications(sess) | ||
if err != nil { | ||
return nil, err | ||
} | ||
for _, applicationResource := range applications { | ||
application, ok := applicationResource.(*AppConfigApplication) | ||
if !ok { | ||
logrus.Errorf("Unable to cast AppConfigApplication.") | ||
continue | ||
} | ||
params := &appconfig.ListEnvironmentsInput{ | ||
ApplicationId: application.id, | ||
MaxResults: aws.Int64(100), | ||
} | ||
err := svc.ListEnvironmentsPages(params, func(page *appconfig.ListEnvironmentsOutput, lastPage bool) bool { | ||
for _, item := range page.Items { | ||
resources = append(resources, &AppConfigEnvironment{ | ||
svc: svc, | ||
applicationId: application.id, | ||
id: item.Id, | ||
name: item.Name, | ||
}) | ||
} | ||
return true | ||
}) | ||
if err != nil { | ||
return nil, err | ||
} | ||
} | ||
return resources, nil | ||
} | ||
|
||
func (f *AppConfigEnvironment) Remove() error { | ||
_, err := f.svc.DeleteEnvironment(&appconfig.DeleteEnvironmentInput{ | ||
ApplicationId: f.applicationId, | ||
EnvironmentId: f.id, | ||
}) | ||
return err | ||
} | ||
|
||
func (f *AppConfigEnvironment) Properties() types.Properties { | ||
return types.NewProperties(). | ||
Set("ApplicationID", f.applicationId). | ||
Set("ID", f.id). | ||
Set("Name", f.name) | ||
} |
Oops, something went wrong.