Malformed XML when setting bucket lifecycle with Go SDK

0

I have been trying to use the Go SDK to put a lifecycle configuration for a bucket but I keep getting Malformed XML errors. This is the relevant section of the code:

	rule := types.LifecycleRule{
		Status: types.ExpirationStatusDisabled,
		ID:     aws.String("testid2"),
		NoncurrentVersionExpiration: &types.NoncurrentVersionExpiration{
			NewerNoncurrentVersions: 4,
			NoncurrentDays:          1,
		},
		Filter: filter,
	}
	bucketConfig := types.BucketLifecycleConfiguration{
		Rules: []types.LifecycleRule{rule},
	}
	putBucketConfigInput := &s3.PutBucketLifecycleConfigurationInput{
		Bucket:                 aws.String("beer-sample-default-default-test5"),
		LifecycleConfiguration: &bucketConfig,
	}

	bucketLifecycleOutput, err := client.PutBucketLifecycleConfiguration(aws.BackgroundContext(),
		putBucketConfigInput, func(*s3.Options) {})

Would love to get some idea on where I'm going wrong. Thanks!

  • Hi Did you try this ?

    NoncurrentDays: aws.Int64(int64(1))

    Just to be sure .. and in 2 times : first step the NoncurrentDays then the NewerNoncurrentVersions

    ++

Aditi
已提问 2 年前439 查看次数
1 回答
0

Hello,

We need some more details on this use case. Therefore, could you please provide the following information:

  1. SDK Version being used.
  2. Complete Error message
  3. If there are any further code level debug logs, that would help us too.

Further, you can also raise an issue directly at the Go SDK github community: https://github.com/aws/aws-sdk-go/issues

Looking forward for your response.

Thank you.

AWS
支持工程师
已回答 2 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则