-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #160 from darkbitio/build
Build
- Loading branch information
Showing
4 changed files
with
87 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# frozen_string_literal: true | ||
|
||
# | ||
# Collect ECRPublic resources | ||
# | ||
class ECRPublic < Mapper | ||
# | ||
# Returns an array of resources. | ||
# | ||
def collect | ||
resources = [] | ||
|
||
# | ||
# describe_repositories | ||
# | ||
|
||
puts(@client.describe_repositories) | ||
@client.describe_repositories.each_with_index do |response, page| | ||
log(response.context.operation_name, page) | ||
|
||
response.repositories.each do |repo| | ||
struct = OpenStruct.new(repo.to_h) | ||
struct.type = "repository" | ||
struct.arn = repo.repository_arn | ||
struct.policy = @client | ||
.get_repository_policy({ repository_name: repo.repository_name }).policy_text.parse_policy | ||
|
||
struct.images = [] | ||
# | ||
# describe images | ||
# | ||
@client.describe_images({ repository_name: repo.repository_name }).image_details.each_with_index do |image, page| | ||
log(response.context.operation_name, "describe_images", page) | ||
image_hash = image.to_h | ||
struct.images << image_hash | ||
end | ||
rescue Aws::ECR::Errors::ServiceError => e | ||
log_error(e.code) | ||
|
||
raise e unless suppressed_errors.include?(e.code) && !@options.quit_on_exception | ||
ensure | ||
resources.push(struct.to_h) | ||
end | ||
end | ||
|
||
resources | ||
end | ||
|
||
private | ||
|
||
# not an error | ||
def suppressed_errors | ||
%w[ | ||
RepositoryPolicyNotFoundException, | ||
ScanNotFoundException | ||
] | ||
end | ||
end |
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,3 +1,3 @@ | ||
module AwsRecon | ||
VERSION = "0.5.30" | ||
VERSION = "0.5.31" | ||
end |
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