func serviceAddDoc(w http.ResponseWriter, r *http.Request, t auth.Token) (err error) {
	serviceName := r.URL.Query().Get(":name")
	s, err := getService(serviceName)
	if err != nil {
		return err
	}
	allowed := permission.Check(t, permission.PermServiceUpdateDoc,
		contextsForServiceProvision(&s)...,
	)
	if !allowed {
		return permission.ErrUnauthorized
	}
	s.Doc = InputValue(r, "doc")
	evt, err := event.New(&event.Opts{
		Target:     serviceTarget(s.Name),
		Kind:       permission.PermServiceUpdateDoc,
		Owner:      t,
		CustomData: event.FormToCustomData(InputFields(r)),
		Allowed:    event.Allowed(permission.PermServiceReadEvents, contextsForServiceProvision(&s)...),
	})
	if err != nil {
		return err
	}
	defer func() { evt.Done(err) }()
	return service.Update(s)
}
func serviceAddDoc(w http.ResponseWriter, r *http.Request, t auth.Token) (err error) {
	serviceName := r.URL.Query().Get(":name")
	s, err := getService(serviceName)
	if err != nil {
		return err
	}
	allowed := permission.Check(t, permission.PermServiceUpdateDoc,
		contextsForServiceProvision(&s)...,
	)
	if !allowed {
		return permission.ErrUnauthorized
	}
	s.Doc = InputValue(r, "doc")
	evt, err := event.New(&event.Opts{
		Target:     serviceTarget(s.Name),
		Kind:       permission.PermServiceUpdateDoc,
		Owner:      t,
		CustomData: event.FormToCustomData(InputFields(r)),
		Allowed:    event.Allowed(permission.PermServiceReadEvents, contextsForServiceProvision(&s)...),
	})
	if err != nil {
		return err
	}
	defer func() { evt.Done(err) }()
	return service.Update(s)
}
func serviceAddDoc ( w http . ResponseWriter , r * http . Request , t auth . Token ) ( err error ) { serviceName := r . URL . Query ( ) . Get ( " " ) s , err := getService ( serviceName ) if err != nil { return err } allowed := permission . Check ( t , permission . PermServiceUpdateDoc , contextsForServiceProvision ( & s ) ... , ) if ! allowed { return permission . ErrUnauthorized } s . Doc = InputValue ( r , " " ) evt , err := event . New ( & event . Opts { Target : serviceTarget ( s . Name ) , Kind : permission . PermServiceUpdateDoc , Owner : t , CustomData : event . FormToCustomData ( InputFields ( r ) ) , Allowed : event . Allowed ( permission . PermServiceReadEvents , contextsForServiceProvision ( & s ) ... ) , } ) if err != nil { return err } defer func ( ) { evt . Done ( err ) } ( ) return service . Update ( s ) }
// title: change service documentation
// path: /services/{name}/doc
// consume: application/x-www-form-urlencoded
// method: PUT
// responses:
//   200: Documentation updated
//   401: Unauthorized
//   403: Forbidden (team is not the owner or service with instances)
title : change service documentation path : / services / { name } / doc consume : application / x - www - form - urlencoded method : PUT responses : 200 : Documentation updated 401 : Unauthorized 403 : Forbidden ( team is not the owner or service with instances )