MCPcopy Create free account
hub / github.com/convox/rack / SystemResourceCreate

Method SystemResourceCreate

pkg/api/controllers.go:1304–1326  ·  view source on GitHub ↗
(c *stdapi.Context)

Source from the content-addressed store, hash-verified

1302}
1303
1304func (s *Server) SystemResourceCreate(c *stdapi.Context) error {
1305 if err := s.hook("SystemResourceCreateValidate", c); err != nil {
1306 return err
1307 }
1308
1309 kind := c.Value("kind")
1310
1311 var opts structs.ResourceCreateOptions
1312 if err := stdapi.UnmarshalOptions(c.Request(), &opts); err != nil {
1313 return err
1314 }
1315
1316 v, err := s.provider(c).WithContext(c.Context()).SystemResourceCreate(kind, opts)
1317 if err != nil {
1318 return err
1319 }
1320
1321 if vs, ok := interface{}(v).(Sortable); ok {
1322 sort.Slice(v, vs.Less)
1323 }
1324
1325 return c.RenderJSON(v)
1326}
1327
1328func (s *Server) SystemResourceDelete(c *stdapi.Context) error {
1329 if err := s.hook("SystemResourceDeleteValidate", c); err != nil {

Callers

nothing calls this directly

Calls 7

hookMethod · 0.95
providerMethod · 0.95
RequestMethod · 0.80
ContextMethod · 0.80
SliceMethod · 0.80
SystemResourceCreateMethod · 0.65
WithContextMethod · 0.65

Tested by

no test coverage detected