From b4171fcdd2000f17b074cfa7006e5da58817b658 Mon Sep 17 00:00:00 2001 From: Alirie Gray Date: Mon, 27 Jul 2020 15:44:51 -0700 Subject: [PATCH] refactor: remove nested orgs labels route --- cmd/influxd/launcher/launcher.go | 2 +- http/swagger.yml | 68 -------------------------------- tenant/http_server_org.go | 3 +- tenant/service.go | 5 +-- 4 files changed, 4 insertions(+), 74 deletions(-) diff --git a/cmd/influxd/launcher/launcher.go b/cmd/influxd/launcher/launcher.go index 11d05aef6da..7839164abce 100644 --- a/cmd/influxd/launcher/launcher.go +++ b/cmd/influxd/launcher/launcher.go @@ -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) diff --git a/http/swagger.yml b/http/swagger.yml index 290b30bc54e..9935332d0ee 100644 --- a/http/swagger.yml +++ b/http/swagger.yml @@ -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 diff --git a/tenant/http_server_org.go b/tenant/http_server_org.go index 4ab66122320..402803d5f9f 100644 --- a/tenant/http_server_org.go +++ b/tenant/http_server_org.go @@ -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, @@ -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) }) }) diff --git a/tenant/service.go b/tenant/service.go index 15e19585eb1..d1fd597ee76 100644 --- a/tenant/service.go +++ b/tenant/service.go @@ -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 {