Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions docs/resources/s3-vectors-bucket.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
generated: true
---

# S3vectorsBucket


## Resource

```text
S3vectorsBucket
```

## Properties


- `ARN`: No Description
- `Name`: No Description

!!! note - Using Properties
Properties are what [Filters](../config-filtering.md) are written against in your configuration. You use the property
names to write filters for what you want to **keep** and omit from the nuke process.

### String Property

The string representation of a resource is generally the value of the Name, ID or ARN field of the resource. Not all
resources support properties. To write a filter against the string representation, simply omit the `property` field in
the filter.

The string value is always what is used in the output of the log format when a resource is identified.

### DependsOn

!!! important - Experimental Feature
This resource depends on a resource using the experimental feature. This means that the resource will
only be deleted if all the resources of a particular type are deleted first or reach a terminal state.

- [S3vectorsIndex](./s3-vectors-index.md)
- [S3vectorsBucketPolicy](./s3-vectors-bucket-policy.md)


40 changes: 40 additions & 0 deletions docs/resources/s3-vectors-index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
generated: true
---

# S3vectorsIndex


## Resource

```text
S3vectorsIndex
```

## Properties


- `BucketName`: No Description
- `IndexARN`: No Description
- `IndexName`: No Description

!!! note - Using Properties
Properties are what [Filters](../config-filtering.md) are written against in your configuration. You use the property
names to write filters for what you want to **keep** and omit from the nuke process.

### String Property

The string representation of a resource is generally the value of the Name, ID or ARN field of the resource. Not all
resources support properties. To write a filter against the string representation, simply omit the `property` field in
the filter.

The string value is always what is used in the output of the log format when a resource is identified.

### DependsOn

!!! important - Experimental Feature
This resource depends on a resource using the experimental feature. This means that the resource will
only be deleted if all the resources of a particular type are deleted first or reach a terminal state.

- [S3vectorsVector](./s3-vectors-vector.md)

33 changes: 33 additions & 0 deletions docs/resources/s3-vectors-vector.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
generated: true
---

# S3vectorsVector


## Resource

```text
S3vectorsVector
```

## Properties


- `IndexName`: No Description
- `Key`: No Description
- `VectorBucketName`: No Description

!!! note - Using Properties
Properties are what [Filters](../config-filtering.md) are written against in your configuration. You use the property
names to write filters for what you want to **keep** and omit from the nuke process.

### String Property

The string representation of a resource is generally the value of the Name, ID or ARN field of the resource. Not all
resources support properties. To write a filter against the string representation, simply omit the `property` field in
the filter.

The string value is always what is used in the output of the log format when a resource is identified.


7 changes: 4 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ toolchain go1.25.3

require (
github.com/aws/aws-sdk-go v1.55.8
github.com/aws/aws-sdk-go-v2 v1.39.3
github.com/aws/aws-sdk-go-v2 v1.39.4
github.com/aws/aws-sdk-go-v2/config v1.28.11
github.com/aws/aws-sdk-go-v2/credentials v1.17.71
github.com/aws/aws-sdk-go-v2/service/amp v1.36.0
Expand All @@ -28,6 +28,7 @@ require (
github.com/aws/aws-sdk-go-v2/service/route53profiles v1.4.17
github.com/aws/aws-sdk-go-v2/service/s3 v1.72.3
github.com/aws/aws-sdk-go-v2/service/s3control v1.52.7
github.com/aws/aws-sdk-go-v2/service/s3vectors v1.4.10
github.com/aws/aws-sdk-go-v2/service/shield v1.34.6
github.com/aws/aws-sdk-go-v2/service/ssmquicksetup v1.3.10
github.com/aws/aws-sdk-go-v2/service/sts v1.34.1
Expand All @@ -51,8 +52,8 @@ require (
require (
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.7 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.33 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.10 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.10 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.11 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.11 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.27 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.0 // indirect
Expand Down
14 changes: 8 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
github.com/aws/aws-sdk-go v1.55.8 h1:JRmEUbU52aJQZ2AjX4q4Wu7t4uZjOu71uyNmaWlUkJQ=
github.com/aws/aws-sdk-go v1.55.8/go.mod h1:ZkViS9AqA6otK+JBBNH2++sx1sgxrPKcSzPPvQkUtXk=
github.com/aws/aws-sdk-go-v2 v1.39.3 h1:h7xSsanJ4EQJXG5iuW4UqgP7qBopLpj84mpkNx3wPjM=
github.com/aws/aws-sdk-go-v2 v1.39.3/go.mod h1:yWSxrnioGUZ4WVv9TgMrNUeLV3PFESn/v+6T/Su8gnM=
github.com/aws/aws-sdk-go-v2 v1.39.4 h1:qTsQKcdQPHnfGYBBs+Btl8QwxJeoWcOcPcixK90mRhg=
github.com/aws/aws-sdk-go-v2 v1.39.4/go.mod h1:yWSxrnioGUZ4WVv9TgMrNUeLV3PFESn/v+6T/Su8gnM=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.7 h1:lL7IfaFzngfx0ZwUGOZdsFFnQ5uLvR0hWqqhyE7Q9M8=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.7/go.mod h1:QraP0UcVlQJsmHfioCrveWOC1nbiWUl3ej08h4mXWoc=
github.com/aws/aws-sdk-go-v2/config v1.28.11 h1:7Ekru0IkRHRnSRWGQLnLN6i0o1Jncd0rHo2T130+tEQ=
Expand All @@ -10,10 +10,10 @@ github.com/aws/aws-sdk-go-v2/credentials v1.17.71 h1:r2w4mQWnrTMJjOyIsZtGp3R3XGY
github.com/aws/aws-sdk-go-v2/credentials v1.17.71/go.mod h1:E7VF3acIup4GB5ckzbKFrCK0vTvEQxOxgdq4U3vcMCY=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.33 h1:D9ixiWSG4lyUBL2DDNK924Px9V/NBVpML90MHqyTADY=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.33/go.mod h1:caS/m4DI+cij2paz3rtProRBI4s/+TCiWoaWZuQ9010=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.10 h1:mj/bdWleWEh81DtpdHKkw41IrS+r3uw1J/VQtbwYYp8=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.10/go.mod h1:7+oEMxAZWP8gZCyjcm9VicI0M61Sx4DJtcGfKYv2yKQ=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.10 h1:wh+/mn57yhUrFtLIxyFPh2RgxgQz/u+Yrf7hiHGHqKY=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.10/go.mod h1:7zirD+ryp5gitJJ2m1BBux56ai8RIRDykXZrJSp540w=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.11 h1:7AANQZkF3ihM8fbdftpjhken0TP9sBzFbV/Ze/Y4HXA=
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.11/go.mod h1:NTF4QCGkm6fzVwncpkFQqoquQyOolcyXfbpC98urj+c=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.11 h1:ShdtWUZT37LCAA4Mw2kJAJtzaszfSHFb5n25sdcv4YE=
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.11/go.mod h1:7bUb2sSr2MZ3M/N+VyETLTQtInemHXb/Fl3s8CLzm0Y=
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 h1:VaRN3TlFdd6KxX1x3ILT5ynH6HvKgqdiXoTxAF4HQcQ=
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1/go.mod h1:FbtygfRFze9usAadmnGJNc8KsP346kEe+y2/oyhGAGc=
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.27 h1:AmB5QxnD+fBFrg9LcqzkgF/CaYvMyU/BTlejG4t1S7Q=
Expand Down Expand Up @@ -64,6 +64,8 @@ github.com/aws/aws-sdk-go-v2/service/s3 v1.72.3 h1:WZOmJfCDV+4tYacLxpiojoAdT5sxT
github.com/aws/aws-sdk-go-v2/service/s3 v1.72.3/go.mod h1:xMekrnhmJ5aqmyxtmALs7mlvXw5xRh+eYjOjvrIIFJ4=
github.com/aws/aws-sdk-go-v2/service/s3control v1.52.7 h1:cewH1fJ35N26pujUo8pXtqngf0QZio0ko62rT1x2Uak=
github.com/aws/aws-sdk-go-v2/service/s3control v1.52.7/go.mod h1:zZ6ah0Hp8TqLZERFcwSQ2T5A4lMkX5vujkDvSkFiXh8=
github.com/aws/aws-sdk-go-v2/service/s3vectors v1.4.10 h1:hgJrhznAL6SjFZAqNIexiE9L7Zjc5PMGmwPWNtTE3zc=
github.com/aws/aws-sdk-go-v2/service/s3vectors v1.4.10/go.mod h1:gJNoydxeaa5Av62mqcKTcA/9oFJnnZRseWfDmPKfGv8=
github.com/aws/aws-sdk-go-v2/service/shield v1.34.6 h1:AWKt4pVqiqzLIT3xoOThd0xT6dY1lSB+7yDcn0N3I48=
github.com/aws/aws-sdk-go-v2/service/shield v1.34.6/go.mod h1:Io5NYTndCqsmL+vdfoQEkInZkbZn8gLloqEjGvng+7M=
github.com/aws/aws-sdk-go-v2/service/ssmquicksetup v1.3.10 h1:3e9ZvkZB5NsDellLxPuaCJSeA5Hg7SeHY+Godotzizc=
Expand Down
3 changes: 3 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,9 @@ nav:
- S3 Bucket: resources/s3-bucket.md
- S3 Multipart Upload: resources/s3-multipart-upload.md
- S3 Object: resources/s3-object.md
- S3 Vectors Bucket: resources/s3-vectors-bucket.md
- S3 Vectors Index: resources/s3-vectors-index.md
- S3 Vectors Vector: resources/s3-vectors-vector.md
- SNS Endpoint: resources/sns-endpoint.md
- SNS Platform Application: resources/sns-platform-application.md
- SNS Subscription: resources/sns-subscription.md
Expand Down
76 changes: 76 additions & 0 deletions resources/s3vectors-bucket.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package resources

import (
"context"

"github.com/aws/aws-sdk-go-v2/service/s3vectors"

"github.com/ekristen/libnuke/pkg/registry"
"github.com/ekristen/libnuke/pkg/resource"
"github.com/ekristen/libnuke/pkg/types"

"github.com/ekristen/aws-nuke/v3/pkg/nuke"
)

const S3vectorsBucketResource = "S3vectorsBucket"

func init() {
registry.Register(&registry.Registration{
Name: S3vectorsBucketResource,
Scope: nuke.Account,
Resource: &S3vectorsBucket{},
Lister: &S3vectorsBucketLister{},
DependsOn: []string{
S3vectorsIndexResource,
},
})
}

type S3vectorsBucketLister struct{}

func (l *S3vectorsBucketLister) List(ctx context.Context, o interface{}) ([]resource.Resource, error) {
opts := o.(*nuke.ListerOpts)
svc := s3vectors.NewFromConfig(*opts.Config)

var resources []resource.Resource
params := &s3vectors.ListVectorBucketsInput{}

paginator := s3vectors.NewListVectorBucketsPaginator(svc, params)
for paginator.HasMorePages() {
page, err := paginator.NextPage(ctx)
if err != nil {
return nil, err
}

for _, bucket := range page.VectorBuckets {
resources = append(resources, &S3vectorsBucket{
svc: svc,
Name: bucket.VectorBucketName,
ARN: bucket.VectorBucketArn,
})
}
}

return resources, nil
}

type S3vectorsBucket struct {
svc *s3vectors.Client
Name *string
ARN *string
}

func (r *S3vectorsBucket) Remove(ctx context.Context) error {
_, err := r.svc.DeleteVectorBucket(ctx, &s3vectors.DeleteVectorBucketInput{
VectorBucketName: r.Name,
})
return err
}

func (r *S3vectorsBucket) Properties() types.Properties {
return types.NewPropertiesFromStruct(r)
}

func (r *S3vectorsBucket) String() string {
return *r.Name
}
28 changes: 28 additions & 0 deletions resources/s3vectors-bucket_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package resources

import (
"testing"

"github.com/gotidy/ptr"
"github.com/stretchr/testify/assert"
)

func Test_S3vectorsBucket_Properties(t *testing.T) {
bucket := &S3vectorsBucket{
Name: ptr.String("my-vector-bucket"),
ARN: ptr.String("arn:aws:s3vectors:us-east-1:123456789012:bucket/my-vector-bucket"),
}

properties := bucket.Properties()

assert.Equal(t, "my-vector-bucket", properties.Get("Name"))
assert.Equal(t, "arn:aws:s3vectors:us-east-1:123456789012:bucket/my-vector-bucket", properties.Get("ARN"))
}

func Test_S3vectorsBucket_String(t *testing.T) {
bucket := &S3vectorsBucket{
Name: ptr.String("test-vector-bucket"),
}

assert.Equal(t, "test-vector-bucket", bucket.String())
}
96 changes: 96 additions & 0 deletions resources/s3vectors-index.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
package resources

import (
"context"

"github.com/aws/aws-sdk-go-v2/service/s3vectors"

"github.com/ekristen/libnuke/pkg/registry"
"github.com/ekristen/libnuke/pkg/resource"
"github.com/ekristen/libnuke/pkg/types"

"github.com/ekristen/aws-nuke/v3/pkg/nuke"
)

const S3vectorsIndexResource = "S3vectorsIndex"

func init() {
registry.Register(&registry.Registration{
Name: S3vectorsIndexResource,
Scope: nuke.Account,
Resource: &S3vectorsIndex{},
Lister: &S3vectorsIndexLister{},
DependsOn: []string{
S3vectorsVectorResource,
},
})
}

type S3vectorsIndexLister struct{}

func (l *S3vectorsIndexLister) List(ctx context.Context, o interface{}) ([]resource.Resource, error) {
opts := o.(*nuke.ListerOpts)
svc := s3vectors.NewFromConfig(*opts.Config)

var resources []resource.Resource

// First, list all vector buckets
bucketsParams := &s3vectors.ListVectorBucketsInput{}
bucketsPaginator := s3vectors.NewListVectorBucketsPaginator(svc, bucketsParams)

for bucketsPaginator.HasMorePages() {
bucketsPage, err := bucketsPaginator.NextPage(ctx)
if err != nil {
return nil, err
}

// For each bucket, list all indexes
for _, bucket := range bucketsPage.VectorBuckets {
indexParams := &s3vectors.ListIndexesInput{
VectorBucketName: bucket.VectorBucketName,
}

paginator := s3vectors.NewListIndexesPaginator(svc, indexParams)
for paginator.HasMorePages() {
page, err := paginator.NextPage(ctx)
if err != nil {
return nil, err
}

for _, index := range page.Indexes {
resources = append(resources, &S3vectorsIndex{
svc: svc,
BucketName: bucket.VectorBucketName,
IndexName: index.IndexName,
IndexARN: index.IndexArn,
})
}
}
}
}

return resources, nil
}

type S3vectorsIndex struct {
svc *s3vectors.Client
BucketName *string
IndexName *string
IndexARN *string
}

func (r *S3vectorsIndex) Remove(ctx context.Context) error {
_, err := r.svc.DeleteIndex(ctx, &s3vectors.DeleteIndexInput{
VectorBucketName: r.BucketName,
IndexName: r.IndexName,
})
return err
}

func (r *S3vectorsIndex) Properties() types.Properties {
return types.NewPropertiesFromStruct(r)
}

func (r *S3vectorsIndex) String() string {
return *r.IndexName
}
Loading