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.
Add formatting check to GitHub Actions (#1063)
* Add formatting check to GitHub Actions * Fix pre-existing formatting issues
- Loading branch information
1 parent
34899fb
commit 47fc6c7
Showing
23 changed files
with
114 additions
and
109 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,58 @@ | ||
package resources | ||
|
||
import ( | ||
"github.com/aws/aws-sdk-go/aws/session" | ||
"github.com/aws/aws-sdk-go/service/cloudfront" | ||
"github.com/aws/aws-sdk-go/aws/session" | ||
"github.com/aws/aws-sdk-go/service/cloudfront" | ||
"github.com/rebuy-de/aws-nuke/v2/pkg/types" | ||
) | ||
|
||
type CloudFrontOriginAccessIdentity struct { | ||
svc *cloudfront.CloudFront | ||
ID *string | ||
svc *cloudfront.CloudFront | ||
ID *string | ||
} | ||
|
||
func init() { | ||
register("CloudFrontOriginAccessIdentity", ListCloudFrontOriginAccessIdentities) | ||
register("CloudFrontOriginAccessIdentity", ListCloudFrontOriginAccessIdentities) | ||
} | ||
|
||
func ListCloudFrontOriginAccessIdentities(sess *session.Session) ([]Resource, error) { | ||
svc := cloudfront.New(sess) | ||
resources := []Resource{} | ||
|
||
for { | ||
resp, err := svc.ListCloudFrontOriginAccessIdentities(nil) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
for _, item := range resp.CloudFrontOriginAccessIdentityList.Items { | ||
resources = append(resources,&CloudFrontOriginAccessIdentity{ | ||
svc: svc, | ||
ID: item.Id, | ||
}) | ||
} | ||
return resources, nil | ||
} | ||
svc := cloudfront.New(sess) | ||
resources := []Resource{} | ||
|
||
for { | ||
resp, err := svc.ListCloudFrontOriginAccessIdentities(nil) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
for _, item := range resp.CloudFrontOriginAccessIdentityList.Items { | ||
resources = append(resources, &CloudFrontOriginAccessIdentity{ | ||
svc: svc, | ||
ID: item.Id, | ||
}) | ||
} | ||
return resources, nil | ||
} | ||
} | ||
|
||
func (f *CloudFrontOriginAccessIdentity) Remove() error { | ||
resp, err := f.svc.GetCloudFrontOriginAccessIdentity(&cloudfront.GetCloudFrontOriginAccessIdentityInput{ | ||
Id: f.ID, | ||
}) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
_, err = f.svc.DeleteCloudFrontOriginAccessIdentity(&cloudfront.DeleteCloudFrontOriginAccessIdentityInput{ | ||
Id: f.ID, | ||
IfMatch: resp.ETag, | ||
}) | ||
|
||
return err | ||
resp, err := f.svc.GetCloudFrontOriginAccessIdentity(&cloudfront.GetCloudFrontOriginAccessIdentityInput{ | ||
Id: f.ID, | ||
}) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
_, err = f.svc.DeleteCloudFrontOriginAccessIdentity(&cloudfront.DeleteCloudFrontOriginAccessIdentityInput{ | ||
Id: f.ID, | ||
IfMatch: resp.ETag, | ||
}) | ||
|
||
return err | ||
} | ||
|
||
func (f *CloudFrontOriginAccessIdentity) Properties() types.Properties { | ||
properties := types.NewProperties() | ||
properties.Set("ID", f.ID) | ||
return properties | ||
properties := types.NewProperties() | ||
properties.Set("ID", f.ID) | ||
return properties | ||
} |
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
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
Oops, something went wrong.