From 4b8ea2ed049954127642d5ed068c61ce7be75221 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 5 Jun 2024 08:55:10 +0200 Subject: [PATCH 1/9] Bump github.com/aws/aws-sdk-go from 1.53.10 to 1.53.15 in the golang group (#1229) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index efd776983..2664a0f51 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/rebuy-de/aws-nuke/v2 go 1.21 require ( - github.com/aws/aws-sdk-go v1.53.10 + github.com/aws/aws-sdk-go v1.53.15 github.com/fatih/color v1.17.0 github.com/golang/mock v1.6.0 github.com/google/uuid v1.6.0 diff --git a/go.sum b/go.sum index 243b890e0..490f52452 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -github.com/aws/aws-sdk-go v1.53.10 h1:3enP5l5WtezT9Ql+XZqs56JBf5YUd/FEzTCg///OIGY= -github.com/aws/aws-sdk-go v1.53.10/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= +github.com/aws/aws-sdk-go v1.53.15 h1:FtZmkg7xM8RfP2oY6p7xdKBYrRgkITk9yve2QV7N938= +github.com/aws/aws-sdk-go v1.53.15/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= From 18db9ccd147796d84e974643e99c8bb0b991ce6b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 25 Jun 2024 10:19:27 +0200 Subject: [PATCH 2/9] Bump the golang group across 1 directory with 2 updates (#1238) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 4 ++-- go.sum | 14 +++++--------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/go.mod b/go.mod index 2664a0f51..0af0337ea 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/rebuy-de/aws-nuke/v2 go 1.21 require ( - github.com/aws/aws-sdk-go v1.53.15 + github.com/aws/aws-sdk-go v1.54.7 github.com/fatih/color v1.17.0 github.com/golang/mock v1.6.0 github.com/google/uuid v1.6.0 @@ -11,7 +11,7 @@ require ( github.com/pkg/errors v0.9.1 github.com/rebuy-de/rebuy-go-sdk/v4 v4.5.1 github.com/sirupsen/logrus v1.9.3 - github.com/spf13/cobra v1.8.0 + github.com/spf13/cobra v1.8.1 github.com/stretchr/testify v1.9.0 golang.org/x/sync v0.7.0 gopkg.in/yaml.v3 v3.0.1 diff --git a/go.sum b/go.sum index 490f52452..4b53e37ef 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,6 @@ -github.com/aws/aws-sdk-go v1.53.15 h1:FtZmkg7xM8RfP2oY6p7xdKBYrRgkITk9yve2QV7N938= -github.com/aws/aws-sdk-go v1.53.15/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= -github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/aws/aws-sdk-go v1.54.7 h1:k1wJ+NMOsXgq/Lsa0y1mS0DFoDeHFPcz2OjCq5H5Mjg= +github.com/aws/aws-sdk-go v1.54.7/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= +github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -44,8 +44,8 @@ github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD github.com/sirupsen/logrus v1.3.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= -github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= +github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= +github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -64,8 +64,6 @@ golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= @@ -84,8 +82,6 @@ golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= From c24e39364935ccb6397c3d87363e5e6a9b152944 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 16 Jul 2024 11:08:15 +0200 Subject: [PATCH 3/9] Bump github.com/aws/aws-sdk-go from 1.54.7 to 1.54.19 in the golang group across 1 directory (#1246) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 0af0337ea..5aedbdbc3 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/rebuy-de/aws-nuke/v2 go 1.21 require ( - github.com/aws/aws-sdk-go v1.54.7 + github.com/aws/aws-sdk-go v1.54.19 github.com/fatih/color v1.17.0 github.com/golang/mock v1.6.0 github.com/google/uuid v1.6.0 diff --git a/go.sum b/go.sum index 4b53e37ef..1cd1603ea 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -github.com/aws/aws-sdk-go v1.54.7 h1:k1wJ+NMOsXgq/Lsa0y1mS0DFoDeHFPcz2OjCq5H5Mjg= -github.com/aws/aws-sdk-go v1.54.7/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= +github.com/aws/aws-sdk-go v1.54.19 h1:tyWV+07jagrNiCcGRzRhdtVjQs7Vy41NwsuOcl0IbVI= +github.com/aws/aws-sdk-go v1.54.19/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= From bc5b576365682946ed90e45bbd1c2da3d9e6201c Mon Sep 17 00:00:00 2001 From: "terraform-cluster-config[bot]" <72873023+terraform-cluster-config[bot]@users.noreply.github.com> Date: Wed, 17 Jul 2024 09:03:01 +0000 Subject: [PATCH 4/9] Add .editorconfig --- .editorconfig | 132 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..64bd5cee2 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,132 @@ +# Distributed via https://github.com/rebuy-de/terraform-cluster-config +# Modify only there, changes in project repos will be overwritten + +root = true + +[openapi-spec.yaml] +ij_formatter_enabled = false + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 4 +indent_style = space +insert_final_newline = true +max_line_length = 120 +tab_width = 4 +trim_trailing_whitespace = true +ij_continuation_indent_size = 8 +ij_formatter_off_tag = @formatter:off +ij_formatter_on_tag = @formatter:on +ij_formatter_tags_enabled = true +ij_smart_tabs = false +ij_visual_guides = +ij_wrap_on_typing = false + +[{*.htm,*.html,*.sht,*.shtm,*.shtml}] +ij_html_attribute_wrap = off +ij_html_do_not_indent_children_of_tags = +ij_html_keep_blank_lines = 1 +ij_html_text_wrap = off + +[{*.cjs,*.js}] +ij_javascript_do_while_brace_force = always +ij_javascript_for_brace_force = always +ij_javascript_if_brace_force = always +ij_javascript_keep_blank_lines_in_code = 1 +ij_javascript_use_double_quotes = false +ij_javascript_while_brace_force = always + +[{*.ats,*.cts,*.mts,*.ts}] +ij_typescript_do_while_brace_force = always +ij_typescript_for_brace_force = always +ij_typescript_if_brace_force = always +ij_typescript_import_prefer_absolute_path = true +ij_typescript_keep_blank_lines_in_code = 1 +ij_typescript_space_before_function_left_parenth = false +ij_typescript_use_double_quotes = false +ij_typescript_while_brace_force = always + +[*.coffee] +indent_size = 2 + +[*.java] +ij_continuation_indent_size = 4 +ij_java_blank_lines_around_field = 1 +ij_java_blank_lines_around_initializer = 0 +ij_java_class_brace_style = next_line +ij_java_class_count_to_use_import_on_demand = 99 +ij_java_do_while_brace_force = always +ij_java_doc_add_blank_line_after_param_comments = true +ij_java_doc_add_blank_line_after_return = true +ij_java_for_brace_force = always +ij_java_if_brace_force = always +ij_java_keep_blank_lines_before_right_brace = 0 +ij_java_keep_blank_lines_in_code = 1 +ij_java_keep_blank_lines_in_declarations = 0 +ij_java_keep_simple_classes_in_one_line = true +ij_java_keep_simple_lambdas_in_one_line = true +ij_java_method_brace_style = next_line +ij_java_names_count_to_use_import_on_demand = 99 +ij_java_new_line_after_lparen_in_record_header = true +ij_java_packages_to_use_import_on_demand = +ij_java_record_components_wrap = on_every_item +ij_java_rparen_on_new_line_in_record_header = true +ij_java_while_brace_force = always + +[{*.kt,*.kts}] +ij_continuation_indent_size = 4 +ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL +ij_kotlin_name_count_to_use_star_import = 2147483647 +ij_kotlin_name_count_to_use_star_import_for_members = 2147483647 +ij_kotlin_packages_to_use_import_on_demand = + +[{*.ctp,*.hphp,*.inc,*.module,*.php,*.php4,*.php5,*.phtml}] +ij_php_align_multiline_parameters = false +ij_php_blank_lines_around_field = 1 +ij_php_blank_lines_before_return_statement = 1 +ij_php_comma_after_last_array_element = true +ij_php_force_short_declaration_array_style = true +ij_php_keep_blank_lines_before_right_brace = 0 +ij_php_keep_blank_lines_in_code = 1 +ij_php_keep_blank_lines_in_declarations = 0 +ij_php_keep_rparen_and_lbrace_on_one_line = true +ij_php_lower_case_boolean_const = true +ij_php_lower_case_null_const = true +ij_php_method_parameters_new_line_after_left_paren = true +ij_php_method_parameters_right_paren_on_new_line = true +ij_php_phpdoc_blank_line_before_tags = true +ij_php_phpdoc_blank_lines_around_parameters = true +ij_php_space_after_type_cast = true +ij_php_space_before_short_closure_left_parenthesis = true + +[{*.ant,*.fxml,*.jhm,*.jnlp,*.jrxml,*.pom,*.rng,*.tld,*.wadl,*.wsdl,*.xml,*.xsd,*.xsl,*.xslt,*.xul,phpunit.xml.dist}] +ij_xml_space_inside_empty_tag = true + +[{*.tf,*.tfvars,*.hcl}] +tab_width = 2 +ij_continuation_indent_size = 4 + +[*.less] +tab_width = 2 +ij_continuation_indent_size = 2 + +[*.sass] +tab_width = 2 +ij_continuation_indent_size = 2 + +[*.scala] +ij_scala_do_while_brace_force = always +ij_scala_for_brace_force = always +ij_scala_if_brace_force = always +ij_scala_keep_blank_lines_before_right_brace = 0 +ij_scala_keep_blank_lines_in_code = 0 +ij_scala_keep_blank_lines_in_declarations = 0 +ij_scala_multiline_string_closing_quotes_on_new_line = false + +[*.scss] +ij_continuation_indent_size = 4 + +[{*.yaml,*.yml}] +ij_yaml_spaces_within_braces = false +ij_yaml_spaces_within_brackets = false From 0856ebfb6cd8166b157cd9ce5b70f4eaa854f09a Mon Sep 17 00:00:00 2001 From: Cory Bekker Date: Wed, 11 Sep 2024 13:58:33 -0700 Subject: [PATCH 5/9] added bedrock agent alias module --- resources/bedrock-agentalias.go | 95 +++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 resources/bedrock-agentalias.go diff --git a/resources/bedrock-agentalias.go b/resources/bedrock-agentalias.go new file mode 100644 index 000000000..5607e61c4 --- /dev/null +++ b/resources/bedrock-agentalias.go @@ -0,0 +1,95 @@ +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/bedrockagent" +) + +type BedrockAgentAlias struct { + svc *bedrockagent.BedrockAgent + AgentId *string + AgentAliasId *string + AgentAliasName *string +} + +func init() { + register("BedrockAgentAlias", ListBedrockAgentAliases) +} + +func ListBedrockAgentAliases(sess *session.Session) ([]Resource, error) { + svc := bedrockagent.New(sess) + resources := []Resource{} + + agentIds, err := ListBedrockAgentIds(svc) + if err != nil { + return nil, err + } + + for _, agentId := range agentIds { + params := &bedrockagent.ListAgentAliasesInput{ + MaxResults: aws.Int64(100), + AgentId: aws.String(agentId), + } + for { + output, err := svc.ListAgentAliases(params) + if err != nil { + return nil, err + } + + for _, agentAliasInfo := range output.AgentAliasSummaries { + resources = append(resources, &BedrockAgentAlias{ + svc: svc, + AgentId: aws.String(agentId), + AgentAliasName: agentAliasInfo.AgentAliasName, + AgentAliasId: agentAliasInfo.AgentAliasId, + }) + } + + if output.NextToken == nil { + break + } + params.NextToken = output.NextToken + } + + } + + return resources, nil +} + +func ListBedrockAgentIds(svc *bedrockagent.BedrockAgent) ([]string, error) { + + agentIds := []string{} + params := &bedrockagent.ListAgentsInput{ + MaxResults: aws.Int64(100), + } + for { + output, err := svc.ListAgents(params) + if err != nil { + return nil, err + } + + for _, agent := range output.AgentSummaries { + agentIds = append(agentIds, *agent.AgentId) + } + + if output.NextToken == nil { + break + } + params.NextToken = output.NextToken + } + + return agentIds, nil +} + +func (f *BedrockAgentAlias) Remove() error { + _, err := f.svc.DeleteAgentAlias(&bedrockagent.DeleteAgentAliasInput{ + AgentAliasId: f.AgentAliasId, + AgentId: f.AgentId, + }) + return err +} + +func (f *BedrockAgentAlias) String() string { + return *f.AgentAliasName +} From 1a5034effa13595fa6ec2df1a37c01b75a127af0 Mon Sep 17 00:00:00 2001 From: Cory Bekker Date: Wed, 11 Sep 2024 13:58:51 -0700 Subject: [PATCH 6/9] added bedrock flow alias module --- resources/bedrock-flowalias.go | 95 ++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 resources/bedrock-flowalias.go diff --git a/resources/bedrock-flowalias.go b/resources/bedrock-flowalias.go new file mode 100644 index 000000000..e0914143a --- /dev/null +++ b/resources/bedrock-flowalias.go @@ -0,0 +1,95 @@ +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/bedrockagent" +) + +type BedrockFlowAlias struct { + svc *bedrockagent.BedrockAgent + FlowId *string + FlowAliasId *string + FlowAliasName *string +} + +func init() { + register("BedrockFlowAlias", ListBedrockFlowAliases) +} + +func ListBedrockFlowAliases(sess *session.Session) ([]Resource, error) { + svc := bedrockagent.New(sess) + resources := []Resource{} + + flowIds, err := ListBedrockFlowIds(svc) + if err != nil { + return nil, err + } + + for _, flowId := range flowIds { + params := &bedrockagent.ListFlowAliasesInput{ + MaxResults: aws.Int64(100), + FlowIdentifier: aws.String(flowId), + } + for { + output, err := svc.ListFlowAliases(params) + if err != nil { + return nil, err + } + + for _, flowAliasInfo := range output.FlowAliasSummaries { + resources = append(resources, &BedrockFlowAlias{ + svc: svc, + FlowId: flowAliasInfo.FlowId, + FlowAliasId: flowAliasInfo.Id, + FlowAliasName: flowAliasInfo.Name, + }) + } + + if output.NextToken == nil { + break + } + params.NextToken = output.NextToken + } + + } + + return resources, nil +} + +func ListBedrockFlowIds(svc *bedrockagent.BedrockAgent) ([]string, error) { + + flowIds := []string{} + params := &bedrockagent.ListFlowsInput{ + MaxResults: aws.Int64(100), + } + for { + output, err := svc.ListFlows(params) + if err != nil { + return nil, err + } + + for _, flow := range output.FlowSummaries { + flowIds = append(flowIds, *flow.Id) + } + + if output.NextToken == nil { + break + } + params.NextToken = output.NextToken + } + + return flowIds, nil +} + +func (f *BedrockFlowAlias) Remove() error { + _, err := f.svc.DeleteFlowAlias(&bedrockagent.DeleteFlowAliasInput{ + AliasIdentifier: f.FlowAliasId, + FlowIdentifier: f.FlowId, + }) + return err +} + +func (f *BedrockFlowAlias) String() string { + return *f.FlowAliasName +} From 5ea0b67aff036a46f0afa7d1a3dc8899771c7e6e Mon Sep 17 00:00:00 2001 From: Cory Bekker Date: Mon, 16 Sep 2024 09:39:32 -0700 Subject: [PATCH 7/9] added filters for aws managed aliases --- resources/bedrock-agentalias.go | 10 ++++++++++ resources/bedrock-flowalias.go | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/resources/bedrock-agentalias.go b/resources/bedrock-agentalias.go index 5607e61c4..0ec47cb87 100644 --- a/resources/bedrock-agentalias.go +++ b/resources/bedrock-agentalias.go @@ -1,6 +1,9 @@ package resources import ( + "fmt" + "strings" + "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/bedrockagent" @@ -82,6 +85,13 @@ func ListBedrockAgentIds(svc *bedrockagent.BedrockAgent) ([]string, error) { return agentIds, nil } +func (f *BedrockAgentAlias) Filter() error { + if strings.HasPrefix(*f.AgentAliasName, "AgentTestAlias") { + return fmt.Errorf("cannot delete AWS managed Agent Alias") + } + return nil +} + func (f *BedrockAgentAlias) Remove() error { _, err := f.svc.DeleteAgentAlias(&bedrockagent.DeleteAgentAliasInput{ AgentAliasId: f.AgentAliasId, diff --git a/resources/bedrock-flowalias.go b/resources/bedrock-flowalias.go index e0914143a..196235008 100644 --- a/resources/bedrock-flowalias.go +++ b/resources/bedrock-flowalias.go @@ -1,6 +1,9 @@ package resources import ( + "fmt" + "strings" + "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/bedrockagent" @@ -82,6 +85,13 @@ func ListBedrockFlowIds(svc *bedrockagent.BedrockAgent) ([]string, error) { return flowIds, nil } +func (f *BedrockFlowAlias) Filter() error { + if strings.HasPrefix(*f.FlowAliasName, "TSTALIASID") { + return fmt.Errorf("cannot delete AWS managed Flow Alias") + } + return nil +} + func (f *BedrockFlowAlias) Remove() error { _, err := f.svc.DeleteFlowAlias(&bedrockagent.DeleteFlowAliasInput{ AliasIdentifier: f.FlowAliasId, From 1e5142c557313859030a5c977afd3aeb36546988 Mon Sep 17 00:00:00 2001 From: Cory Bekker Date: Mon, 16 Sep 2024 09:52:48 -0700 Subject: [PATCH 8/9] remove agent alias filter --- resources/bedrock-agentalias.go | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/resources/bedrock-agentalias.go b/resources/bedrock-agentalias.go index 0ec47cb87..5607e61c4 100644 --- a/resources/bedrock-agentalias.go +++ b/resources/bedrock-agentalias.go @@ -1,9 +1,6 @@ package resources import ( - "fmt" - "strings" - "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/bedrockagent" @@ -85,13 +82,6 @@ func ListBedrockAgentIds(svc *bedrockagent.BedrockAgent) ([]string, error) { return agentIds, nil } -func (f *BedrockAgentAlias) Filter() error { - if strings.HasPrefix(*f.AgentAliasName, "AgentTestAlias") { - return fmt.Errorf("cannot delete AWS managed Agent Alias") - } - return nil -} - func (f *BedrockAgentAlias) Remove() error { _, err := f.svc.DeleteAgentAlias(&bedrockagent.DeleteAgentAliasInput{ AgentAliasId: f.AgentAliasId, From 2e67160a8e57815d8236949f189724ef6a99ed9f Mon Sep 17 00:00:00 2001 From: Cory Bekker Date: Mon, 16 Sep 2024 10:49:51 -0700 Subject: [PATCH 9/9] added alias properties --- resources/bedrock-agentalias.go | 10 ++++++++++ resources/bedrock-flowalias.go | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/resources/bedrock-agentalias.go b/resources/bedrock-agentalias.go index 5607e61c4..63e0edba7 100644 --- a/resources/bedrock-agentalias.go +++ b/resources/bedrock-agentalias.go @@ -4,6 +4,7 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/bedrockagent" + "github.com/rebuy-de/aws-nuke/v2/pkg/types" ) type BedrockAgentAlias struct { @@ -90,6 +91,15 @@ func (f *BedrockAgentAlias) Remove() error { return err } +func (f *BedrockAgentAlias) Properties() types.Properties { + properties := types.NewProperties(). + Set("AgentId", f.AgentId). + Set("AgentAliasId", f.AgentAliasId). + Set("AgentAliasName", f.AgentAliasName) + + return properties +} + func (f *BedrockAgentAlias) String() string { return *f.AgentAliasName } diff --git a/resources/bedrock-flowalias.go b/resources/bedrock-flowalias.go index 196235008..eca852ca6 100644 --- a/resources/bedrock-flowalias.go +++ b/resources/bedrock-flowalias.go @@ -7,6 +7,7 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/bedrockagent" + "github.com/rebuy-de/aws-nuke/v2/pkg/types" ) type BedrockFlowAlias struct { @@ -100,6 +101,15 @@ func (f *BedrockFlowAlias) Remove() error { return err } +func (f *BedrockFlowAlias) Properties() types.Properties { + properties := types.NewProperties(). + Set("FlowId", f.FlowId). + Set("FlowAliasId", f.FlowAliasId). + Set("FlowAliasName", f.FlowAliasName) + + return properties +} + func (f *BedrockFlowAlias) String() string { return *f.FlowAliasName }