MCPcopy Index your code
hub / github.com/cortexlabs/cortex / setLifecycleRulesOnClusterDown

Function setLifecycleRulesOnClusterDown

cli/cmd/cluster.go:1335–1354  ·  view source on GitHub ↗
(awsClient *awslib.Client, bucket string)

Source from the content-addressed store, hash-verified

1333}
1334
1335func setLifecycleRulesOnClusterDown(awsClient *awslib.Client, bucket string) error {
1336 err := awsClient.DeleteLifecycleRules(bucket)
1337 if err != nil {
1338 return err
1339 }
1340
1341 expirationDate := libtime.GetCurrentUTCDate().Add(-24 * time.Hour)
1342 return awsClient.SetLifecycleRules(bucket, []s3.LifecycleRule{
1343 {
1344 Expiration: &s3.LifecycleExpiration{
1345 Date: &expirationDate,
1346 },
1347 ID: pointer.String("bucket-cleaner"),
1348 Filter: &s3.LifecycleRuleFilter{
1349 Prefix: pointer.String(""),
1350 },
1351 Status: pointer.String("Enabled"),
1352 },
1353 })
1354}
1355
1356func createLogGroupIfNotFound(awsClient *awslib.Client, logGroup string, tags map[string]string) error {
1357 logGroupFound, err := awsClient.DoesLogGroupExist(logGroup)

Callers 1

cluster.goFile · 0.85

Calls 4

StringFunction · 0.92
DeleteLifecycleRulesMethod · 0.80
SetLifecycleRulesMethod · 0.80
AddMethod · 0.45

Tested by

no test coverage detected