Returns new statements contains object actions for given policy.
(policy BucketPolicy, bucketName, prefix string)
| 205 | |
| 206 | // Returns new statements contains object actions for given policy. |
| 207 | func newObjectStatement(policy BucketPolicy, bucketName, prefix string) (statements []Statement) { |
| 208 | statements = []Statement{} |
| 209 | if policy == BucketPolicyNone || bucketName == "" { |
| 210 | return statements |
| 211 | } |
| 212 | |
| 213 | statement := Statement{ |
| 214 | Effect: "Allow", |
| 215 | Principal: User{AWS: set.CreateStringSet("*")}, |
| 216 | Resources: set.CreateStringSet(awsResourcePrefix + bucketName + "/" + prefix + "*"), |
| 217 | Sid: "", |
| 218 | } |
| 219 | |
| 220 | switch policy { |
| 221 | case BucketPolicyReadOnly: |
| 222 | statement.Actions = readOnlyObjectActions |
| 223 | case BucketPolicyWriteOnly: |
| 224 | statement.Actions = writeOnlyObjectActions |
| 225 | case BucketPolicyReadWrite: |
| 226 | statement.Actions = readWriteObjectActions |
| 227 | } |
| 228 | |
| 229 | statements = append(statements, statement) |
| 230 | return statements |
| 231 | } |
| 232 | |
| 233 | // Returns new statements for given policy, bucket and prefix. |
| 234 | func newStatements(policy BucketPolicy, bucketName, prefix string) (statements []Statement) { |
no test coverage detected