-
Describe the bugWe can create the s3 access point with different types of network origins 1. While making the NewListAccessPointsPaginator API call it returns the access points which are the only I am using the ListAccessPointsAPIClient, service client, to make the API call. However, the AWS CLI call ( Expected BehaviorThe Current BehaviorThe Reproduction Stepspackage main
import (
"context"
"fmt"
"log"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/service/s3control"
)
func main() {
listAWSS3AccessPoints("ap-south-1") // "us-east-1"
}
func listAWSS3AccessPoints(region string) {
ctx := context.Background()
configOptions := []func(*config.LoadOptions) error{
config.WithRegion(region),
}
cfg, err := config.LoadDefaultConfig(ctx, configOptions...)
if err != nil {
log.Fatalln("getAwsConfigWithMaxRetries", "load_default_config", err)
}
svc := s3control.NewFromConfig(cfg)
params := &s3control.ListAccessPointsInput{
AccountId: aws.String("1234567890"),
MaxResults: int32(100),
}
paginator := s3control.NewListAccessPointsPaginator(svc, params, func(o *s3control.ListAccessPointsPaginatorOptions) {
o.Limit = int32(100)
o.StopOnDuplicateToken = true
})
for paginator.HasMorePages() {
output, err := paginator.NextPage(ctx)
if err != nil {
log.Fatalln("S3 access points", "api_error", err)
break
}
for i, accessPoint := range output.AccessPointList {
fmt.Println(i, accessPoint)
}
}
} Possible SolutionNo response Additional Information/ContextNo response AWS Go SDK V2 Module Versions Usedmodule github.com/turbot/steampipe-plugin-aws go 1.19 require ( require ( Compiler and Version usedgo version go1.19 darwin/arm64 Operating System and versionMacOS Big Sur - Version 11.4 |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments
-
Hi @ParthaI , Not sure how you set your resources. Maybe your internet access point is on a different region. Using your code I'm able to successfully retrieve both VPC and Internet type access points. Only changed this in your Go code to display the results clearly: for paginator.HasMorePages() {
output, err := paginator.NextPage(ctx)
if err != nil {
log.Fatalln("S3 access points", "api_error", err)
break
}
for i, accessPoint := range output.AccessPointList {
fmt.Println(i, *accessPoint.Name, accessPoint.NetworkOrigin) // <- change is here
}
} SDK 2022/11/23 14:56:25 DEBUG Response
HTTP/1.1 200 OK
Content-Length: 1103
Date: Wed, 23 Nov 2022 22:56:26 GMT
Server: AmazonS3
X-Amz-Id-2: REDACTED
X-Amz-Request-Id: REDACTED
<ListAccessPointsResult>
<AccessPointList>
<AccessPoint>
<Bucket>REDACTED</Bucket>
<AccessPointArn>REDACTED</AccessPointArn>
<AccessPointType>Regular</AccessPointType>
<Name>my-internet-access-point</Name>
<Alias>REDACTED</Alias>
<BucketAccountId>REDACTED</BucketAccountId>
<NetworkOrigin>Internet</NetworkOrigin>
</AccessPoint>
<AccessPoint>
<Bucket>REDACTED</Bucket>
<AccessPointArn>REDACTED</AccessPointArn>
<AccessPointType>Regular</AccessPointType>
<Name>vpn-access-point</Name>
<Alias>REDACTED</Alias>
<BucketAccountId>REDACTED</BucketAccountId>
<NetworkOrigin>VPC</NetworkOrigin>
<VpcConfiguration>
<VpcId>vpc-my-access-point</VpcId>
</VpcConfiguration>
</AccessPoint>
</AccessPointList>
</ListAccessPointsResult>
0 my-internet-access-point Internet
1 vpn-access-point VPC
Let me know if that helps, |
Beta Was this translation helpful? Give feedback.
-
This issue has not received a response in 1 week. If you want to keep this issue open, please just leave a comment below and auto-close will be canceled. |
Beta Was this translation helpful? Give feedback.
-
Leaving a comment to keep open. |
Beta Was this translation helpful? Give feedback.
-
Hi @cbruno10 did you have a chance to use my reproduce my code? Since Im positive this isn't a bug, I'm converting this into a discussion. Thanks, |
Beta Was this translation helpful? Give feedback.
-
Hi @RanVaknin, Thanks for the help. I tried the code you mentioned above, the Thanks, |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
Hi @ParthaI ,
Not sure how you set your resources. Maybe your internet access point is on a different region.
Using your code I'm able to successfully retrieve both VPC and Internet type access points.
AWS Console:
Only changed this in your Go code to display the results clearly: