@@ -41,36 +41,30 @@ func (c *Client) SetBucketLifecycle(ctx context.Context, bucketName string, conf
41
41
if config .Empty () {
42
42
return c .removeBucketLifecycle (ctx , bucketName )
43
43
}
44
- expAfterRepl := config .ExpireAfterReplication
45
- config .ExpireAfterReplication = ""
44
+
46
45
buf , err := xml .Marshal (config )
47
46
if err != nil {
48
47
return err
49
48
}
50
49
51
50
// Save the updated lifecycle.
52
- return c .putBucketLifecycle (ctx , bucketName , buf , expAfterRepl )
51
+ return c .putBucketLifecycle (ctx , bucketName , buf )
53
52
}
54
53
55
54
// Saves a new bucket lifecycle.
56
- func (c * Client ) putBucketLifecycle (ctx context.Context , bucketName string , buf []byte , expAfterRepl string ) error {
55
+ func (c * Client ) putBucketLifecycle (ctx context.Context , bucketName string , buf []byte ) error {
57
56
// Get resources properly escaped and lined up before
58
57
// using them in http request.
59
58
urlValues := make (url.Values )
60
59
urlValues .Set ("lifecycle" , "" )
61
- var cheaders http.Header
62
- if expAfterRepl != "" {
63
- cheaders = make (http.Header )
64
- cheaders .Set (minioLifecycleExpiryAfterReplication , expAfterRepl )
65
- }
60
+
66
61
// Content-length is mandatory for put lifecycle request
67
62
reqMetadata := requestMetadata {
68
63
bucketName : bucketName ,
69
64
queryValues : urlValues ,
70
65
contentBody : bytes .NewReader (buf ),
71
66
contentLength : int64 (len (buf )),
72
67
contentMD5Base64 : sumMD5Base64 (buf ),
73
- customHeader : cheaders ,
74
68
}
75
69
76
70
// Execute PUT to upload a new bucket lifecycle.
@@ -120,7 +114,7 @@ func (c *Client) GetBucketLifecycleWithInfo(ctx context.Context, bucketName stri
120
114
return nil , time.Time {}, err
121
115
}
122
116
123
- bucketLifecycle , updatedAt , expAfterRepl , err := c .getBucketLifecycle (ctx , bucketName )
117
+ bucketLifecycle , updatedAt , err := c .getBucketLifecycle (ctx , bucketName )
124
118
if err != nil {
125
119
return nil , time.Time {}, err
126
120
}
@@ -129,12 +123,11 @@ func (c *Client) GetBucketLifecycleWithInfo(ctx context.Context, bucketName stri
129
123
if err = xml .Unmarshal (bucketLifecycle , config ); err != nil {
130
124
return nil , time.Time {}, err
131
125
}
132
- config .ExpireAfterReplication = expAfterRepl
133
126
return config , updatedAt , nil
134
127
}
135
128
136
129
// Request server for current bucket lifecycle.
137
- func (c * Client ) getBucketLifecycle (ctx context.Context , bucketName string ) ([]byte , time.Time , string , error ) {
130
+ func (c * Client ) getBucketLifecycle (ctx context.Context , bucketName string ) ([]byte , time.Time , error ) {
138
131
// Get resources properly escaped and lined up before
139
132
// using them in http request.
140
133
urlValues := make (url.Values )
@@ -149,28 +142,28 @@ func (c *Client) getBucketLifecycle(ctx context.Context, bucketName string) ([]b
149
142
150
143
defer closeResponse (resp )
151
144
if err != nil {
152
- return nil , time.Time {}, "" , err
145
+ return nil , time.Time {}, err
153
146
}
154
147
155
148
if resp != nil {
156
149
if resp .StatusCode != http .StatusOK {
157
- return nil , time.Time {}, "" , httpRespToErrorResponse (resp , bucketName , "" )
150
+ return nil , time.Time {}, httpRespToErrorResponse (resp , bucketName , "" )
158
151
}
159
152
}
160
153
161
154
lcBytes , err := io .ReadAll (resp .Body )
162
155
if err != nil {
163
- return nil , time.Time {}, "" , err
156
+ return nil , time.Time {}, err
164
157
}
165
158
166
159
const minIOLifecycleCfgUpdatedAt = "X-Minio-LifecycleConfig-UpdatedAt"
167
160
var updatedAt time.Time
168
161
if timeStr := resp .Header .Get (minIOLifecycleCfgUpdatedAt ); timeStr != "" {
169
162
updatedAt , err = time .Parse (iso8601DateFormat , timeStr )
170
163
if err != nil {
171
- return nil , time.Time {}, "" , err
164
+ return nil , time.Time {}, err
172
165
}
173
166
}
174
- expAfterRepl := resp . Header . Get ( minioLifecycleExpiryAfterReplication )
175
- return lcBytes , updatedAt , expAfterRepl , nil
167
+
168
+ return lcBytes , updatedAt , nil
176
169
}
0 commit comments