Skip to content

Commit

Permalink
refactor: remove nested orgs labels route from swagger
Browse files Browse the repository at this point in the history
  • Loading branch information
AlirieGray committed Jul 28, 2020
1 parent 9802ae1 commit 1fc5cb5
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 74 deletions.
2 changes: 1 addition & 1 deletion cmd/influxd/launcher/launcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,7 @@ func (m *Launcher) run(ctx context.Context) (err error) {
sessionHTTPServer = session.NewSessionHandler(m.log.With(zap.String("handler", "session")), sessionSvc, ts.UserSvc, ts.PasswordSvc)
}

orgHTTPServer := ts.NewOrgHTTPHandler(m.log, labelSvc, secret.NewAuthedService(secretSvc))
orgHTTPServer := ts.NewOrgHTTPHandler(m.log, secret.NewAuthedService(secretSvc))

bucketHTTPServer := ts.NewBucketHTTPHandler(m.log, labelSvc)

Expand Down
68 changes: 0 additions & 68 deletions http/swagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4110,74 +4110,6 @@ paths:
application/json:
schema:
$ref: "#/components/schemas/Error"
post:
operationId: PostOrgsIDLabels
tags:
- Organizations
summary: Add a label to an organization
parameters:
- $ref: "#/components/parameters/TraceSpan"
- in: path
name: orgID
schema:
type: string
required: true
description: The organization ID.
requestBody:
description: Label to add
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/LabelMapping"
responses:
"201":
description: Returns the created label
content:
application/json:
schema:
$ref: "#/components/schemas/LabelResponse"
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"/orgs/{orgID}/labels/{labelID}":
delete:
operationId: DeleteOrgsIDLabelsID
tags:
- Organizations
summary: Delete a label from an organization
parameters:
- $ref: "#/components/parameters/TraceSpan"
- in: path
name: orgID
schema:
type: string
required: true
description: The organization ID.
- in: path
name: labelID
schema:
type: string
required: true
description: The label ID.
responses:
"204":
description: Delete has been accepted
"404":
description: Organization not found
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
default:
description: Unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"/orgs/{orgID}/secrets":
get:
operationId: GetOrgsIDSecrets
Expand Down
3 changes: 1 addition & 2 deletions tenant/http_server_org.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (h *OrgHandler) Prefix() string {
}

// NewHTTPOrgHandler constructs a new http server.
func NewHTTPOrgHandler(log *zap.Logger, orgService influxdb.OrganizationService, urm http.Handler, labelHandler http.Handler, secretHandler http.Handler) *OrgHandler {
func NewHTTPOrgHandler(log *zap.Logger, orgService influxdb.OrganizationService, urm http.Handler, secretHandler http.Handler) *OrgHandler {
svr := &OrgHandler{
api: kithttp.NewAPI(kithttp.WithLog(log)),
log: log,
Expand All @@ -56,7 +56,6 @@ func NewHTTPOrgHandler(log *zap.Logger, orgService influxdb.OrganizationService,
mountableRouter := r.With(kithttp.ValidResource(svr.api, svr.lookupOrgByID))
mountableRouter.Mount("/members", urm)
mountableRouter.Mount("/owners", urm)
mountableRouter.Mount("/labels", labelHandler)
mountableRouter.Mount("/secrets", secretHandler)
})
})
Expand Down
5 changes: 2 additions & 3 deletions tenant/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,10 @@ func NewSystem(store *Store, log *zap.Logger, reg prometheus.Registerer, metricO
}
}

func (ts *TenantSystem) NewOrgHTTPHandler(log *zap.Logger, labelSvc influxdb.LabelService, secretSvc influxdb.SecretService) *OrgHandler {
func (ts *TenantSystem) NewOrgHTTPHandler(log *zap.Logger, secretSvc influxdb.SecretService) *OrgHandler {
secretHandler := secret.NewHandler(log, "id", secret.NewAuthedService(secretSvc))
urmHandler := NewURMHandler(log.With(zap.String("handler", "urm")), influxdb.OrgsResourceType, "id", ts.UserSvc, NewAuthedURMService(ts.OrgSvc, ts.UrmSvc))
labelHandler := label.NewHTTPEmbeddedHandler(log.With(zap.String("handler", "label")), influxdb.OrgsResourceType, labelSvc)
return NewHTTPOrgHandler(log.With(zap.String("handler", "org")), NewAuthedOrgService(ts.OrgSvc), urmHandler, labelHandler, secretHandler)
return NewHTTPOrgHandler(log.With(zap.String("handler", "org")), NewAuthedOrgService(ts.OrgSvc), urmHandler, secretHandler)
}

func (ts *TenantSystem) NewBucketHTTPHandler(log *zap.Logger, labelSvc influxdb.LabelService) *BucketHandler {
Expand Down

0 comments on commit 1fc5cb5

Please sign in to comment.