@@ -87,24 +87,24 @@ private async Task RunCorsConfigurationAsync(string bucketName)
8787 // Rule for local development
8888 new CorsRule (
8989 new CorsAllowed (
90- Methods : new [ ] { "GET" , "PUT" , "POST" , "DELETE" } ,
91- Origins : new [ ] { "http://localhost:3000" , "http://localhost:5173" } ,
92- Headers : new [ ] { "Content-Type" , "Authorization" }
90+ new [ ] { "GET" , "PUT" , "POST" , "DELETE" } ,
91+ new [ ] { "http://localhost:3000" , "http://localhost:5173" } ,
92+ new [ ] { "Content-Type" , "Authorization" }
9393 ) ,
94- Id : "Local Development" ,
95- ExposeHeaders : new [ ] { "ETag" , "Content-Length" } ,
96- MaxAgeSeconds : 3600
94+ "Local Development" ,
95+ new [ ] { "ETag" , "Content-Length" } ,
96+ 3600
9797 ) ,
9898 // Rule for production
9999 new CorsRule (
100100 new CorsAllowed (
101- Methods : new [ ] { "GET" , "HEAD" } ,
102- Origins : new [ ] { "https://example.com" } ,
103- Headers : new [ ] { "Content-Type" }
101+ new [ ] { "GET" , "HEAD" } ,
102+ new [ ] { "https://example.com" } ,
103+ new [ ] { "Content-Type" }
104104 ) ,
105- Id : "Production" ,
106- ExposeHeaders : new [ ] { "ETag" } ,
107- MaxAgeSeconds : 7200
105+ "Production" ,
106+ new [ ] { "ETag" } ,
107+ 7200
108108 )
109109 }
110110 ) ;
@@ -132,11 +132,11 @@ private async Task RunCorsConfigurationAsync(string bucketName)
132132 {
133133 new CorsRule (
134134 new CorsAllowed (
135- Methods : new [ ] { "GET" } ,
136- Origins : new [ ] { "*" } ,
137- Headers : new [ ] { "Content-Type" }
135+ new [ ] { "GET" } ,
136+ new [ ] { "*" } ,
137+ new [ ] { "Content-Type" }
138138 ) ,
139- Id : "Public Read" ,
139+ "Public Read" ,
140140 MaxAgeSeconds : 86400
141141 )
142142 }
@@ -162,32 +162,32 @@ private async Task RunLifecycleConfigurationAsync(string bucketName)
162162 {
163163 // Rule to delete old log files after 90 days
164164 new LifecycleRule (
165- Id : "Delete old logs" ,
166- Enabled : true ,
167- Conditions : new LifecycleRuleConditions ( "logs/" ) ,
165+ "Delete old logs" ,
166+ true ,
167+ new LifecycleRuleConditions ( "logs/" ) ,
168168 DeleteObjectsTransition : new DeleteObjectsTransition ( LifecycleCondition . AfterDays ( 90 ) )
169169 ) ,
170170 // Rule to abort incomplete multipart uploads after 7 days
171171 new LifecycleRule (
172- Id : "Cleanup incomplete uploads" ,
173- Enabled : true ,
172+ "Cleanup incomplete uploads" ,
173+ true ,
174174 AbortMultipartUploadsTransition : new AbortMultipartUploadsTransition ( LifecycleCondition . AfterDays ( 7 ) )
175175 ) ,
176176 // Rule to transition archived data to Infrequent Access storage class after 30 days
177177 new LifecycleRule (
178- Id : "Archive to Infrequent Access" ,
179- Enabled : true ,
180- Conditions : new LifecycleRuleConditions ( "archive/" ) ,
178+ "Archive to Infrequent Access" ,
179+ true ,
180+ new LifecycleRuleConditions ( "archive/" ) ,
181181 StorageClassTransitions : new [ ]
182182 {
183183 new StorageClassTransition ( LifecycleCondition . AfterDays ( 30 ) , R2StorageClass . InfrequentAccess )
184184 }
185185 ) ,
186186 // Combined rule: transition to IA then delete (for temp files)
187187 new LifecycleRule (
188- Id : "Temp file lifecycle" ,
189- Enabled : true ,
190- Conditions : new LifecycleRuleConditions ( "temp/" ) ,
188+ "Temp file lifecycle" ,
189+ true ,
190+ new LifecycleRuleConditions ( "temp/" ) ,
191191 StorageClassTransitions : new [ ]
192192 {
193193 new StorageClassTransition ( LifecycleCondition . AfterDays ( 14 ) , R2StorageClass . InfrequentAccess )
@@ -220,7 +220,8 @@ private async Task RunLifecycleConfigurationAsync(string bucketName)
220220
221221 if ( rule . StorageClassTransitions != null )
222222 foreach ( var transition in rule . StorageClassTransitions )
223- logger . LogInformation ( " Transition to {StorageClass} after: {Days} days" , transition . StorageClass , transition . Condition . MaxAge ) ;
223+ logger . LogInformation ( " Transition to {StorageClass} after: {Days} days" , transition . StorageClass ,
224+ transition . Condition . MaxAge ) ;
224225 }
225226
226227 // 3. Update Lifecycle Policy (simpler configuration)
@@ -230,8 +231,8 @@ private async Task RunLifecycleConfigurationAsync(string bucketName)
230231 {
231232 // Single rule: delete all objects after 365 days
232233 new LifecycleRule (
233- Id : "Annual cleanup" ,
234- Enabled : true ,
234+ "Annual cleanup" ,
235+ true ,
235236 DeleteObjectsTransition : new DeleteObjectsTransition ( LifecycleCondition . AfterDays ( 365 ) )
236237 )
237238 }
0 commit comments