def index(self, req, tenant_id): """Return a list of clusters.""" LOG.debug(("Showing a list of clusters for Tenant '%(tenant_id)s'\n" "req : '%(req)s'\n\n") % { "req": req, "tenant_id": tenant_id }) context = req.environ[wsgi.CONTEXT_KEY] # This theoretically allows the Admin tenant list clusters for # only one particular tenant as opposed to listing all clusters for # for all tenants. # * As far as I can tell this is the only call which actually uses the # passed-in 'tenant_id' for anything. if not context.is_admin and context.tenant != tenant_id: raise exception.TroveOperationAuthError(tenant_id=context.tenant) # The rule checks that the currently authenticated tenant can perform # the 'cluster-list' action. policy.authorize_on_tenant(context, 'cluster:index') # load all clusters and instances for the tenant clusters, marker = models.Cluster.load_all(context, tenant_id) view = views.ClustersView(clusters, req=req) paged = pagination.SimplePaginatedDataView(req.url, 'clusters', view, marker) return wsgi.Result(paged.data(), 200)
def index(self, req, tenant_id): """Return a list of clusters.""" LOG.debug("Showing a list of clusters for Tenant '%s'" % tenant_id) LOG.info(_("req : '%s'\n\n") % req) context = req.environ[wsgi.CONTEXT_KEY] if not context.is_admin and context.tenant != tenant_id: raise exception.TroveOperationAuthError(tenant_id=context.tenant) # load all clusters and instances for the tenant clusters, marker = models.Cluster.load_all(context, tenant_id) view = views.ClustersView(clusters, req=req) paged = pagination.SimplePaginatedDataView(req.url, 'clusters', view, marker) return wsgi.Result(paged.data(), 200)