我正在尝试使用AWS开发工具包iOS 2.6.21在存储桶中以编程方式启用清单配置。我正在为存储桶所在的正确区域设置我的凭据(秘密密钥和访问ID)(我已经测试了它的工作原理,因为我能够获取存储桶版本控制等)。但是,当我尝试在存储桶上启用库存配置时,出现错误消息问题:
成品存放区库存(空)-错误错误Domain = com.amazonaws.AWSServiceErrorDomain代码= 3“(空)” UserInfo = {Message =我们计算出的请求签名与您提供的签名不匹配。检查您的密钥和签名方法。
我的猜测是我在配置请求中缺少必需的参数,但是我无法弄清楚哪个参数。我也没有找到任何有关如何执行此操作的示例,因此我希望有人可以查看我的Objective-C代码并将其定向到我所缺少的内容。谢谢。干杯,特隆德
-(AWSTask*) putBucketInventory:(SDS3Bucket*)bucketObject region:(NSString*) region{
AWSS3PutBucketInventoryConfigurationRequest *putBucketInventoryRequest =
[AWSS3PutBucketInventoryConfigurationRequest new];
putBucketInventoryRequest.bucket = bucketObject.name;
putBucketInventoryRequest.identifier=@"TestInventory";
putBucketInventoryRequest.inventoryConfiguration= .
[AWSS3InventoryConfiguration new];
putBucketInventoryRequest.inventoryConfiguration.isEnabled=@(YES);
putBucketInventoryRequest.inventoryConfiguration.identifier=
@"TestInventory";
AWSS3InventoryFilter *filter=[AWSS3InventoryFilter new];
filter.prefix=@"";
putBucketInventoryRequest.inventoryConfiguration.filter=filter;
AWSS3InventoryS3BucketDestination *s3dest=
[AWSS3InventoryS3BucketDestination new];
AWSS3InventoryEncryption *enc = [AWSS3InventoryEncryption new];
AWSS3SSES3 *sses3=[AWSS3SSES3 new];
enc.SSES3=sses3;
s3dest.encryption=enc;
s3dest.accountId=bucketObject.owner.identifier;
s3dest.bucket=[NSString
stringWithFormat:@"arn:aws:s3:::%@",bucketObject.name];
s3dest.format=AWSS3InventoryFormatCsv;
s3dest.prefix=@"inventory";
AWSS3InventoryDestination *destination=[AWSS3InventoryDestination new];
destination.s3BucketDestination=s3dest;
putBucketInventoryRequest.inventoryConfiguration.destination=
destination;
AWSS3InventorySchedule *schedule=[AWSS3InventorySchedule new];
schedule.frequency=AWSS3InventoryFrequencyDaily;
putBucketInventoryRequest.inventoryConfiguration.schedule=schedule;
putBucketInventoryRequest.inventoryConfiguration
.includedObjectVersions=AWSS3InventoryIncludedObjectVersionsCurrent;
putBucketInventoryRequest.inventoryConfiguration.optionalFields=
@[@"Size",
@"LastModifiedDate",
@"StorageClass",@"ETag",
@"IsMultipartUploaded",
@"ReplicationStatus",
@"EncryptionStatus"];
return [[[AWSS3 S3ForKey:region]
putBucketInventoryConfiguration:putBucketInventoryRequest]
continueWithSuccessBlock:^id(AWSTask *task) {
if(task.error != nil){
NSLog(@"The request failed. error: [%@]", task.error);
}
return task;
}];
}
ps。我还在AWS SDK iOS Github site
上问了这个问题