EvictObject evicts an object specified by bucket/object.
(baseParams BaseParams, bck cmn.Bck, object string)
| 239 | |
| 240 | // EvictObject evicts an object specified by bucket/object. |
| 241 | func EvictObject(baseParams BaseParams, bck cmn.Bck, object string) error { |
| 242 | baseParams.Method = http.MethodDelete |
| 243 | actMsg := apc.ActionMsg{Action: apc.ActEvictObjects, Name: cos.JoinWords(bck.Name, object)} |
| 244 | reqParams := AllocRp() |
| 245 | { |
| 246 | reqParams.BaseParams = baseParams |
| 247 | reqParams.Path = apc.URLPathObjects.Join(bck.Name, object) |
| 248 | reqParams.Body = cos.MustMarshal(actMsg) |
| 249 | reqParams.Header = http.Header{cos.HdrContentType: []string{cos.ContentJSON}} |
| 250 | reqParams.Query = bck.AddToQuery(nil) |
| 251 | } |
| 252 | err := reqParams.DoHTTPRequest() |
| 253 | FreeRp(reqParams) |
| 254 | return err |
| 255 | } |
| 256 | |
| 257 | // GetObject returns the length of the object. Does not validate checksum of the |
| 258 | // object in the response. |