我正在尝试为我的存储桶设置一个新的过期日期,但是我很难将规则添加到存储桶中。这就是我的目标:
S3BucketLifecycleConfigurationRule *testRule = [[S3BucketLifecycleConfigurationRule alloc] initWithId:@"My Rule" andPrefix:self.newRuleTextField.text andExpirationInDays:1 andStatus:@"ENABLE"];
在此之后,我知道我需要将此规则添加到S3BucketLifecycleConfiguration实例,以便最终调用请求方法,但我无法弄清楚如何将其添加到S3BucketLifecycleConfiguration
S3SetBucketLifecycleConfigurationRequest *setBucketLifecycleConfigurationRequest = [[S3SetBucketLifecycleConfigurationRequest alloc] initWithBucketName:self.bucketName withConfiguration:myConfig;
提前感谢yall
答案 0 :(得分:1)
S3BucketLifecycleConfiguration
有一个名为rules
的属性,其中包含S3BucketLifecycleConfigurationRule
个列表。以下应该有效:
S3BucketLifecycleConfiguration *myConfig = [S3BucketLifecycleConfiguration new];
myConfig.rules = [NSArray arrayWithObject:testRule];