()
| 13 | } |
| 14 | |
| 15 | function getLifecycleXml() { |
| 16 | const id1 = 'test-id1'; |
| 17 | const id2 = 'test-id2'; |
| 18 | const id3 = 'test-id3'; |
| 19 | const prefix = 'test-prefix'; |
| 20 | const tags = [ |
| 21 | { |
| 22 | key: 'test-key1', |
| 23 | value: 'test-value1', |
| 24 | }, |
| 25 | { |
| 26 | key: 'test-key2', |
| 27 | value: 'test-value2', |
| 28 | }, |
| 29 | ]; |
| 30 | const action1 = 'Expiration'; |
| 31 | const days1 = 365; |
| 32 | const action2 = 'NoncurrentVersionExpiration'; |
| 33 | const days2 = 1; |
| 34 | const action3 = 'AbortIncompleteMultipartUpload'; |
| 35 | const days3 = 30; |
| 36 | return '<LifecycleConfiguration ' + |
| 37 | 'xmlns="http://s3.amazonaws.com/doc/2006-03-01/">' + |
| 38 | '<Rule>' + |
| 39 | `<ID>${id1}</ID>` + |
| 40 | '<Status>Enabled</Status>' + |
| 41 | `<Prefix>${prefix}</Prefix>` + |
| 42 | `<${action3}><DaysAfterInitiation>${days3}` + |
| 43 | `</DaysAfterInitiation></${action3}>` + |
| 44 | '</Rule>' + |
| 45 | '<Rule>' + |
| 46 | `<ID>${id2}</ID>` + |
| 47 | '<Status>Enabled</Status>' + |
| 48 | '<Filter><And>' + |
| 49 | `<Prefix>${prefix}</Prefix>` + |
| 50 | `<Tag><Key>${tags[0].key}</Key>` + |
| 51 | `<Value>${tags[0].value}</Value></Tag>` + |
| 52 | `<Tag><Key>${tags[1].key}</Key>` + |
| 53 | `<Value>${tags[1].value}</Value></Tag>` + |
| 54 | '</And></Filter>' + |
| 55 | `<${action2}><NoncurrentDays>${days2}</NoncurrentDays></${action2}>` + |
| 56 | '</Rule>' + |
| 57 | '<Rule>' + |
| 58 | `<ID>${id3}</ID>` + |
| 59 | '<Status>Disabled</Status>' + |
| 60 | `<Filter><Tag><Key>${tags[0].key}</Key>` + |
| 61 | `<Value>${tags[0].value}</Value></Tag></Filter>` + |
| 62 | `<${action1}><Days>${days1}</Days></${action1}>` + |
| 63 | '</Rule>' + |
| 64 | '</LifecycleConfiguration>'; |
| 65 | } |
| 66 | |
| 67 | module.exports = { |
| 68 | getLifecycleRequest, |
no outgoing calls
no test coverage detected