diff --git a/api/tangled/modban.go b/api/tangled/modban.go index a398fcfc..ee6e1e8d 100644 --- a/api/tangled/modban.go +++ b/api/tangled/modban.go @@ -2,7 +2,7 @@ package tangled -// schema: sh.tangled.spindle.mod.ban +// schema: org.tangled.temp.spindle.mod.ban import ( "context" @@ -11,18 +11,18 @@ import ( ) const ( - SpindleModBanNSID = "sh.tangled.spindle.mod.ban" + TempSpindleModBanNSID = "org.tangled.temp.spindle.mod.ban" ) -// SpindleModBan_Input is the input argument to a sh.tangled.spindle.mod.ban call. -type SpindleModBan_Input struct { - // did: DID of the repository or owner to ban. +// TempSpindleModBan_Input is the input argument to a org.tangled.temp.spindle.mod.ban call. +type TempSpindleModBan_Input struct { + // did: DID of the repository or account owner to ban Did string `json:"did" cborgen:"did"` } -// SpindleModBan calls the XRPC method "sh.tangled.spindle.mod.ban". -func SpindleModBan(ctx context.Context, c util.LexClient, input *SpindleModBan_Input) error { - if err := c.LexDo(ctx, util.Procedure, "application/json", "sh.tangled.spindle.mod.ban", nil, input, nil); err != nil { +// TempSpindleModBan calls the XRPC method "org.tangled.temp.spindle.mod.ban". +func TempSpindleModBan(ctx context.Context, c util.LexClient, input *TempSpindleModBan_Input) error { + if err := c.LexDo(ctx, util.Procedure, "application/json", "org.tangled.temp.spindle.mod.ban", nil, input, nil); err != nil { return err } diff --git a/api/tangled/moddefs.go b/api/tangled/moddefs.go index d89ee009..18edb550 100644 --- a/api/tangled/moddefs.go +++ b/api/tangled/moddefs.go @@ -2,14 +2,16 @@ package tangled -// schema: sh.tangled.spindle.mod.defs +// schema: org.tangled.temp.spindle.mod.defs const () -// SpindleModDefs_Ban is a "ban" in the sh.tangled.spindle.mod.defs schema. -type SpindleModDefs_Ban struct { - // createdAt: Timestamp when the ban was created. +// TempSpindleModDefs_Ban is a "ban" in the org.tangled.temp.spindle.mod.defs schema. +// +// an active ban for a repository or account owner +type TempSpindleModDefs_Ban struct { + // createdAt: time at which the ban was created CreatedAt string `json:"createdAt" cborgen:"createdAt"` - // did: DID of the banned repository or owner. + // did: DID of the banned subject, either a repository or its owner Did string `json:"did" cborgen:"did"` } diff --git a/api/tangled/modgetBan.go b/api/tangled/modgetBan.go index abf6ece4..fd427dff 100644 --- a/api/tangled/modgetBan.go +++ b/api/tangled/modgetBan.go @@ -2,7 +2,7 @@ package tangled -// schema: sh.tangled.spindle.mod.getBan +// schema: org.tangled.temp.spindle.mod.getBan import ( "context" @@ -11,23 +11,24 @@ import ( ) const ( - SpindleModGetBanNSID = "sh.tangled.spindle.mod.getBan" + TempSpindleModGetBanNSID = "org.tangled.temp.spindle.mod.getBan" ) -// SpindleModGetBan_Output is the output of a sh.tangled.spindle.mod.getBan call. -type SpindleModGetBan_Output struct { - Ban *SpindleModDefs_Ban `json:"ban" cborgen:"ban"` +// TempSpindleModGetBan_Output is the output of a org.tangled.temp.spindle.mod.getBan call. +type TempSpindleModGetBan_Output struct { + // ban: active ban matching the requested DID + Ban *TempSpindleModDefs_Ban `json:"ban" cborgen:"ban"` } -// SpindleModGetBan calls the XRPC method "sh.tangled.spindle.mod.getBan". +// TempSpindleModGetBan calls the XRPC method "org.tangled.temp.spindle.mod.getBan". // -// did: DID of the repository or owner. -func SpindleModGetBan(ctx context.Context, c util.LexClient, did string) (*SpindleModGetBan_Output, error) { - var out SpindleModGetBan_Output +// did: DID of the repository or account owner to look up +func TempSpindleModGetBan(ctx context.Context, c util.LexClient, did string) (*TempSpindleModGetBan_Output, error) { + var out TempSpindleModGetBan_Output params := map[string]interface{}{} params["did"] = did - if err := c.LexDo(ctx, util.Query, "", "sh.tangled.spindle.mod.getBan", params, nil, &out); err != nil { + if err := c.LexDo(ctx, util.Query, "", "org.tangled.temp.spindle.mod.getBan", params, nil, &out); err != nil { return nil, err } diff --git a/api/tangled/modlistBans.go b/api/tangled/modlistBans.go index 1a6126e1..cc7f2ae7 100644 --- a/api/tangled/modlistBans.go +++ b/api/tangled/modlistBans.go @@ -2,7 +2,7 @@ package tangled -// schema: sh.tangled.spindle.mod.listBans +// schema: org.tangled.temp.spindle.mod.listBans import ( "context" @@ -11,18 +11,19 @@ import ( ) const ( - SpindleModListBansNSID = "sh.tangled.spindle.mod.listBans" + TempSpindleModListBansNSID = "org.tangled.temp.spindle.mod.listBans" ) -// SpindleModListBans_Output is the output of a sh.tangled.spindle.mod.listBans call. -type SpindleModListBans_Output struct { - Bans []*SpindleModDefs_Ban `json:"bans" cborgen:"bans"` +// TempSpindleModListBans_Output is the output of a org.tangled.temp.spindle.mod.listBans call. +type TempSpindleModListBans_Output struct { + // bans: active bans ordered by subject DID + Bans []*TempSpindleModDefs_Ban `json:"bans" cborgen:"bans"` } -// SpindleModListBans calls the XRPC method "sh.tangled.spindle.mod.listBans". -func SpindleModListBans(ctx context.Context, c util.LexClient) (*SpindleModListBans_Output, error) { - var out SpindleModListBans_Output - if err := c.LexDo(ctx, util.Query, "", "sh.tangled.spindle.mod.listBans", nil, nil, &out); err != nil { +// TempSpindleModListBans calls the XRPC method "org.tangled.temp.spindle.mod.listBans". +func TempSpindleModListBans(ctx context.Context, c util.LexClient) (*TempSpindleModListBans_Output, error) { + var out TempSpindleModListBans_Output + if err := c.LexDo(ctx, util.Query, "", "org.tangled.temp.spindle.mod.listBans", nil, nil, &out); err != nil { return nil, err } diff --git a/api/tangled/modunban.go b/api/tangled/modunban.go index 07451016..6e970062 100644 --- a/api/tangled/modunban.go +++ b/api/tangled/modunban.go @@ -2,7 +2,7 @@ package tangled -// schema: sh.tangled.spindle.mod.unban +// schema: org.tangled.temp.spindle.mod.unban import ( "context" @@ -11,18 +11,18 @@ import ( ) const ( - SpindleModUnbanNSID = "sh.tangled.spindle.mod.unban" + TempSpindleModUnbanNSID = "org.tangled.temp.spindle.mod.unban" ) -// SpindleModUnban_Input is the input argument to a sh.tangled.spindle.mod.unban call. -type SpindleModUnban_Input struct { - // did: DID of the repository or owner to unban. +// TempSpindleModUnban_Input is the input argument to a org.tangled.temp.spindle.mod.unban call. +type TempSpindleModUnban_Input struct { + // did: DID of the repository or account owner to unban Did string `json:"did" cborgen:"did"` } -// SpindleModUnban calls the XRPC method "sh.tangled.spindle.mod.unban". -func SpindleModUnban(ctx context.Context, c util.LexClient, input *SpindleModUnban_Input) error { - if err := c.LexDo(ctx, util.Procedure, "application/json", "sh.tangled.spindle.mod.unban", nil, input, nil); err != nil { +// TempSpindleModUnban calls the XRPC method "org.tangled.temp.spindle.mod.unban". +func TempSpindleModUnban(ctx context.Context, c util.LexClient, input *TempSpindleModUnban_Input) error { + if err := c.LexDo(ctx, util.Procedure, "application/json", "org.tangled.temp.spindle.mod.unban", nil, input, nil); err != nil { return err } diff --git a/api/tangled/quotadefs.go b/api/tangled/quotadefs.go index 1c0a51c6..efbe9060 100644 --- a/api/tangled/quotadefs.go +++ b/api/tangled/quotadefs.go @@ -2,28 +2,32 @@ package tangled -// schema: sh.tangled.spindle.quota.defs +// schema: org.tangled.temp.spindle.quota.defs const () -// SpindleQuotaDefs_Limit is a "limit" in the sh.tangled.spindle.quota.defs schema. -type SpindleQuotaDefs_Limit struct { - // did: DID of the user or repository. +// TempSpindleQuotaDefs_Limit is a "limit" in the org.tangled.temp.spindle.quota.defs schema. +// +// a per-subject override for one quota resource +type TempSpindleQuotaDefs_Limit struct { + // did: DID whose quota is overridden, either a repository or an account owner Did string `json:"did" cborgen:"did"` - // limit: Limit amount in raw units (-1 if unlimited). + // limit: maximum amount in the resource's native units; -1 means unlimited Limit int64 `json:"limit" cborgen:"limit"` - // resource: Resource name. + // resource: quota resource name Resource string `json:"resource" cborgen:"resource"` } -// SpindleQuotaDefs_Usage is a "usage" in the sh.tangled.spindle.quota.defs schema. -type SpindleQuotaDefs_Usage struct { - // did: DID of the user or repository. +// TempSpindleQuotaDefs_Usage is a "usage" in the org.tangled.temp.spindle.quota.defs schema. +// +// current usage aggregated for one subject and resource +type TempSpindleQuotaDefs_Usage struct { + // did: DID for the user or repository scope Did string `json:"did" cborgen:"did"` - // resource: Resource name. + // resource: quota resource name Resource string `json:"resource" cborgen:"resource"` - // scope: Measurement axis the row belongs to. + // scope: aggregation axis for this row: user or repo Scope string `json:"scope" cborgen:"scope"` - // used: Current used amount in raw units. + // used: amount currently allocated or reserved in native resource units Used int64 `json:"used" cborgen:"used"` } diff --git a/api/tangled/quotaget.go b/api/tangled/quotaget.go index 6b3309ff..afb0d588 100644 --- a/api/tangled/quotaget.go +++ b/api/tangled/quotaget.go @@ -2,7 +2,7 @@ package tangled -// schema: sh.tangled.spindle.quota.get +// schema: org.tangled.temp.spindle.quota.get import ( "context" @@ -11,25 +11,26 @@ import ( ) const ( - SpindleQuotaGetNSID = "sh.tangled.spindle.quota.get" + TempSpindleQuotaGetNSID = "org.tangled.temp.spindle.quota.get" ) -// SpindleQuotaGet_Output is the output of a sh.tangled.spindle.quota.get call. -type SpindleQuotaGet_Output struct { - Limit *SpindleQuotaDefs_Limit `json:"limit" cborgen:"limit"` +// TempSpindleQuotaGet_Output is the output of a org.tangled.temp.spindle.quota.get call. +type TempSpindleQuotaGet_Output struct { + // limit: quota override for the requested DID and resource + Limit *TempSpindleQuotaDefs_Limit `json:"limit" cborgen:"limit"` } -// SpindleQuotaGet calls the XRPC method "sh.tangled.spindle.quota.get". +// TempSpindleQuotaGet calls the XRPC method "org.tangled.temp.spindle.quota.get". // -// did: DID of the user or repository. -// resource: Resource name. -func SpindleQuotaGet(ctx context.Context, c util.LexClient, did string, resource string) (*SpindleQuotaGet_Output, error) { - var out SpindleQuotaGet_Output +// did: DID of the repository or account owner +// resource: quota resource to look up +func TempSpindleQuotaGet(ctx context.Context, c util.LexClient, did string, resource string) (*TempSpindleQuotaGet_Output, error) { + var out TempSpindleQuotaGet_Output params := map[string]interface{}{} params["did"] = did params["resource"] = resource - if err := c.LexDo(ctx, util.Query, "", "sh.tangled.spindle.quota.get", params, nil, &out); err != nil { + if err := c.LexDo(ctx, util.Query, "", "org.tangled.temp.spindle.quota.get", params, nil, &out); err != nil { return nil, err } diff --git a/api/tangled/quotalist.go b/api/tangled/quotalist.go index acf17ea2..e66e080a 100644 --- a/api/tangled/quotalist.go +++ b/api/tangled/quotalist.go @@ -2,7 +2,7 @@ package tangled -// schema: sh.tangled.spindle.quota.list +// schema: org.tangled.temp.spindle.quota.list import ( "context" @@ -11,18 +11,19 @@ import ( ) const ( - SpindleQuotaListNSID = "sh.tangled.spindle.quota.list" + TempSpindleQuotaListNSID = "org.tangled.temp.spindle.quota.list" ) -// SpindleQuotaList_Output is the output of a sh.tangled.spindle.quota.list call. -type SpindleQuotaList_Output struct { - Limits []*SpindleQuotaDefs_Limit `json:"limits" cborgen:"limits"` +// TempSpindleQuotaList_Output is the output of a org.tangled.temp.spindle.quota.list call. +type TempSpindleQuotaList_Output struct { + // limits: quota overrides ordered by DID and resource + Limits []*TempSpindleQuotaDefs_Limit `json:"limits" cborgen:"limits"` } -// SpindleQuotaList calls the XRPC method "sh.tangled.spindle.quota.list". -func SpindleQuotaList(ctx context.Context, c util.LexClient) (*SpindleQuotaList_Output, error) { - var out SpindleQuotaList_Output - if err := c.LexDo(ctx, util.Query, "", "sh.tangled.spindle.quota.list", nil, nil, &out); err != nil { +// TempSpindleQuotaList calls the XRPC method "org.tangled.temp.spindle.quota.list". +func TempSpindleQuotaList(ctx context.Context, c util.LexClient) (*TempSpindleQuotaList_Output, error) { + var out TempSpindleQuotaList_Output + if err := c.LexDo(ctx, util.Query, "", "org.tangled.temp.spindle.quota.list", nil, nil, &out); err != nil { return nil, err } diff --git a/api/tangled/quotaset.go b/api/tangled/quotaset.go index eb72c795..65bfb31f 100644 --- a/api/tangled/quotaset.go +++ b/api/tangled/quotaset.go @@ -2,7 +2,7 @@ package tangled -// schema: sh.tangled.spindle.quota.set +// schema: org.tangled.temp.spindle.quota.set import ( "context" @@ -11,24 +11,24 @@ import ( ) const ( - SpindleQuotaSetNSID = "sh.tangled.spindle.quota.set" + TempSpindleQuotaSetNSID = "org.tangled.temp.spindle.quota.set" ) -// SpindleQuotaSet_Input is the input argument to a sh.tangled.spindle.quota.set call. -type SpindleQuotaSet_Input struct { - // did: DID of the user or repository. +// TempSpindleQuotaSet_Input is the input argument to a org.tangled.temp.spindle.quota.set call. +type TempSpindleQuotaSet_Input struct { + // did: DID of the repository or account owner Did string `json:"did" cborgen:"did"` - // limit: Override limit in raw units (bytes for cache_storage_bytes, counts or MiB for others). Must be positive; unlimited=true is the way to clear enforcement. Conflicting with unlimited. + // limit: positive maximum in the resource's native units; cannot be combined with unlimited Limit *int64 `json:"limit,omitempty" cborgen:"limit,omitempty"` - // resource: Resource name (workflows, vcpus, memory_mib, disk_mib, cache_storage_bytes). + // resource: quota resource name, such as workflows, vcpus, memory_mib, disk_mib, or cache_storage_bytes Resource string `json:"resource" cborgen:"resource"` - // unlimited: Set override limit to unlimited. Conflicting with limit. + // unlimited: store an unlimited override; cannot be combined with limit Unlimited *bool `json:"unlimited,omitempty" cborgen:"unlimited,omitempty"` } -// SpindleQuotaSet calls the XRPC method "sh.tangled.spindle.quota.set". -func SpindleQuotaSet(ctx context.Context, c util.LexClient, input *SpindleQuotaSet_Input) error { - if err := c.LexDo(ctx, util.Procedure, "application/json", "sh.tangled.spindle.quota.set", nil, input, nil); err != nil { +// TempSpindleQuotaSet calls the XRPC method "org.tangled.temp.spindle.quota.set". +func TempSpindleQuotaSet(ctx context.Context, c util.LexClient, input *TempSpindleQuotaSet_Input) error { + if err := c.LexDo(ctx, util.Procedure, "application/json", "org.tangled.temp.spindle.quota.set", nil, input, nil); err != nil { return err } diff --git a/api/tangled/quotaunset.go b/api/tangled/quotaunset.go index f09429f7..bb3b810f 100644 --- a/api/tangled/quotaunset.go +++ b/api/tangled/quotaunset.go @@ -2,7 +2,7 @@ package tangled -// schema: sh.tangled.spindle.quota.unset +// schema: org.tangled.temp.spindle.quota.unset import ( "context" @@ -11,20 +11,20 @@ import ( ) const ( - SpindleQuotaUnsetNSID = "sh.tangled.spindle.quota.unset" + TempSpindleQuotaUnsetNSID = "org.tangled.temp.spindle.quota.unset" ) -// SpindleQuotaUnset_Input is the input argument to a sh.tangled.spindle.quota.unset call. -type SpindleQuotaUnset_Input struct { - // did: DID of the user or repository. +// TempSpindleQuotaUnset_Input is the input argument to a org.tangled.temp.spindle.quota.unset call. +type TempSpindleQuotaUnset_Input struct { + // did: DID of the repository or account owner Did string `json:"did" cborgen:"did"` - // resource: Resource name to unset. + // resource: quota resource whose override to remove Resource string `json:"resource" cborgen:"resource"` } -// SpindleQuotaUnset calls the XRPC method "sh.tangled.spindle.quota.unset". -func SpindleQuotaUnset(ctx context.Context, c util.LexClient, input *SpindleQuotaUnset_Input) error { - if err := c.LexDo(ctx, util.Procedure, "application/json", "sh.tangled.spindle.quota.unset", nil, input, nil); err != nil { +// TempSpindleQuotaUnset calls the XRPC method "org.tangled.temp.spindle.quota.unset". +func TempSpindleQuotaUnset(ctx context.Context, c util.LexClient, input *TempSpindleQuotaUnset_Input) error { + if err := c.LexDo(ctx, util.Procedure, "application/json", "org.tangled.temp.spindle.quota.unset", nil, input, nil); err != nil { return err } diff --git a/api/tangled/quotausage.go b/api/tangled/quotausage.go index 9614e4ef..b7003ff7 100644 --- a/api/tangled/quotausage.go +++ b/api/tangled/quotausage.go @@ -2,7 +2,7 @@ package tangled -// schema: sh.tangled.spindle.quota.usage +// schema: org.tangled.temp.spindle.quota.usage import ( "context" @@ -11,20 +11,21 @@ import ( ) const ( - SpindleQuotaUsageNSID = "sh.tangled.spindle.quota.usage" + TempSpindleQuotaUsageNSID = "org.tangled.temp.spindle.quota.usage" ) -// SpindleQuotaUsage_Output is the output of a sh.tangled.spindle.quota.usage call. -type SpindleQuotaUsage_Output struct { - Usages []*SpindleQuotaDefs_Usage `json:"usages" cborgen:"usages"` +// TempSpindleQuotaUsage_Output is the output of a org.tangled.temp.spindle.quota.usage call. +type TempSpindleQuotaUsage_Output struct { + // usages: non-zero usage rows, including active reservations and committed allocations + Usages []*TempSpindleQuotaDefs_Usage `json:"usages" cborgen:"usages"` } -// SpindleQuotaUsage calls the XRPC method "sh.tangled.spindle.quota.usage". +// TempSpindleQuotaUsage calls the XRPC method "org.tangled.temp.spindle.quota.usage". // -// did: Filter usage rows by DID. -// scope: Filter usage rows by scope (user or repo). -func SpindleQuotaUsage(ctx context.Context, c util.LexClient, did string, scope string) (*SpindleQuotaUsage_Output, error) { - var out SpindleQuotaUsage_Output +// did: limit results to rows for this subject DID +// scope: limit results to one aggregation axis: user or repo +func TempSpindleQuotaUsage(ctx context.Context, c util.LexClient, did string, scope string) (*TempSpindleQuotaUsage_Output, error) { + var out TempSpindleQuotaUsage_Output params := map[string]interface{}{} if did != "" { @@ -33,7 +34,7 @@ func SpindleQuotaUsage(ctx context.Context, c util.LexClient, did string, scope if scope != "" { params["scope"] = scope } - if err := c.LexDo(ctx, util.Query, "", "sh.tangled.spindle.quota.usage", params, nil, &out); err != nil { + if err := c.LexDo(ctx, util.Query, "", "org.tangled.temp.spindle.quota.usage", params, nil, &out); err != nil { return nil, err } diff --git a/lexicons/spindle/mod/ban.json b/lexicons/temp/spindle/mod/ban.json similarity index 93% rename from lexicons/spindle/mod/ban.json rename to lexicons/temp/spindle/mod/ban.json index e6bc6c33..6bb51a50 100644 --- a/lexicons/spindle/mod/ban.json +++ b/lexicons/temp/spindle/mod/ban.json @@ -1,6 +1,6 @@ { "lexicon": 1, - "id": "sh.tangled.spindle.mod.ban", + "id": "org.tangled.temp.spindle.mod.ban", "defs": { "main": { "type": "procedure", diff --git a/lexicons/spindle/mod/defs.json b/lexicons/temp/spindle/mod/defs.json similarity index 92% rename from lexicons/spindle/mod/defs.json rename to lexicons/temp/spindle/mod/defs.json index c23e567b..b50350b2 100644 --- a/lexicons/spindle/mod/defs.json +++ b/lexicons/temp/spindle/mod/defs.json @@ -1,6 +1,6 @@ { "lexicon": 1, - "id": "sh.tangled.spindle.mod.defs", + "id": "org.tangled.temp.spindle.mod.defs", "defs": { "ban": { "description": "an active ban for a repository or account owner", diff --git a/lexicons/spindle/mod/getBan.json b/lexicons/temp/spindle/mod/getBan.json similarity index 88% rename from lexicons/spindle/mod/getBan.json rename to lexicons/temp/spindle/mod/getBan.json index c580a8d7..485d7f65 100644 --- a/lexicons/spindle/mod/getBan.json +++ b/lexicons/temp/spindle/mod/getBan.json @@ -1,6 +1,6 @@ { "lexicon": 1, - "id": "sh.tangled.spindle.mod.getBan", + "id": "org.tangled.temp.spindle.mod.getBan", "defs": { "main": { "type": "query", @@ -29,7 +29,7 @@ "ban": { "description": "active ban matching the requested DID", "type": "ref", - "ref": "sh.tangled.spindle.mod.defs#ban" + "ref": "org.tangled.temp.spindle.mod.defs#ban" } } } diff --git a/lexicons/spindle/mod/listBans.json b/lexicons/temp/spindle/mod/listBans.json similarity index 83% rename from lexicons/spindle/mod/listBans.json rename to lexicons/temp/spindle/mod/listBans.json index 693159e9..986bed08 100644 --- a/lexicons/spindle/mod/listBans.json +++ b/lexicons/temp/spindle/mod/listBans.json @@ -1,6 +1,6 @@ { "lexicon": 1, - "id": "sh.tangled.spindle.mod.listBans", + "id": "org.tangled.temp.spindle.mod.listBans", "defs": { "main": { "type": "query", @@ -18,7 +18,7 @@ "type": "array", "items": { "type": "ref", - "ref": "sh.tangled.spindle.mod.defs#ban" + "ref": "org.tangled.temp.spindle.mod.defs#ban" } } } diff --git a/lexicons/spindle/mod/unban.json b/lexicons/temp/spindle/mod/unban.json similarity index 93% rename from lexicons/spindle/mod/unban.json rename to lexicons/temp/spindle/mod/unban.json index 4b68e976..4b8ac8b5 100644 --- a/lexicons/spindle/mod/unban.json +++ b/lexicons/temp/spindle/mod/unban.json @@ -1,6 +1,6 @@ { "lexicon": 1, - "id": "sh.tangled.spindle.mod.unban", + "id": "org.tangled.temp.spindle.mod.unban", "defs": { "main": { "type": "procedure", diff --git a/lexicons/spindle/quota/defs.json b/lexicons/temp/spindle/quota/defs.json similarity index 97% rename from lexicons/spindle/quota/defs.json rename to lexicons/temp/spindle/quota/defs.json index 896edbe0..2b235271 100644 --- a/lexicons/spindle/quota/defs.json +++ b/lexicons/temp/spindle/quota/defs.json @@ -1,6 +1,6 @@ { "lexicon": 1, - "id": "sh.tangled.spindle.quota.defs", + "id": "org.tangled.temp.spindle.quota.defs", "defs": { "limit": { "description": "a per-subject override for one quota resource", diff --git a/lexicons/spindle/quota/get.json b/lexicons/temp/spindle/quota/get.json similarity index 89% rename from lexicons/spindle/quota/get.json rename to lexicons/temp/spindle/quota/get.json index 46a96755..11e8b1ed 100644 --- a/lexicons/spindle/quota/get.json +++ b/lexicons/temp/spindle/quota/get.json @@ -1,6 +1,6 @@ { "lexicon": 1, - "id": "sh.tangled.spindle.quota.get", + "id": "org.tangled.temp.spindle.quota.get", "defs": { "main": { "type": "query", @@ -34,7 +34,7 @@ "limit": { "description": "quota override for the requested DID and resource", "type": "ref", - "ref": "sh.tangled.spindle.quota.defs#limit" + "ref": "org.tangled.temp.spindle.quota.defs#limit" } } } diff --git a/lexicons/spindle/quota/list.json b/lexicons/temp/spindle/quota/list.json similarity index 83% rename from lexicons/spindle/quota/list.json rename to lexicons/temp/spindle/quota/list.json index cc9a2197..836d0d7a 100644 --- a/lexicons/spindle/quota/list.json +++ b/lexicons/temp/spindle/quota/list.json @@ -1,6 +1,6 @@ { "lexicon": 1, - "id": "sh.tangled.spindle.quota.list", + "id": "org.tangled.temp.spindle.quota.list", "defs": { "main": { "type": "query", @@ -18,7 +18,7 @@ "type": "array", "items": { "type": "ref", - "ref": "sh.tangled.spindle.quota.defs#limit" + "ref": "org.tangled.temp.spindle.quota.defs#limit" } } } diff --git a/lexicons/spindle/quota/set.json b/lexicons/temp/spindle/quota/set.json similarity index 96% rename from lexicons/spindle/quota/set.json rename to lexicons/temp/spindle/quota/set.json index 27df160d..5411ecf7 100644 --- a/lexicons/spindle/quota/set.json +++ b/lexicons/temp/spindle/quota/set.json @@ -1,6 +1,6 @@ { "lexicon": 1, - "id": "sh.tangled.spindle.quota.set", + "id": "org.tangled.temp.spindle.quota.set", "defs": { "main": { "type": "procedure", diff --git a/lexicons/spindle/quota/unset.json b/lexicons/temp/spindle/quota/unset.json similarity index 93% rename from lexicons/spindle/quota/unset.json rename to lexicons/temp/spindle/quota/unset.json index d3151dff..31002941 100644 --- a/lexicons/spindle/quota/unset.json +++ b/lexicons/temp/spindle/quota/unset.json @@ -1,6 +1,6 @@ { "lexicon": 1, - "id": "sh.tangled.spindle.quota.unset", + "id": "org.tangled.temp.spindle.quota.unset", "defs": { "main": { "type": "procedure", diff --git a/lexicons/spindle/quota/usage.json b/lexicons/temp/spindle/quota/usage.json similarity index 90% rename from lexicons/spindle/quota/usage.json rename to lexicons/temp/spindle/quota/usage.json index 7637bf47..0b18b6d8 100644 --- a/lexicons/spindle/quota/usage.json +++ b/lexicons/temp/spindle/quota/usage.json @@ -1,6 +1,6 @@ { "lexicon": 1, - "id": "sh.tangled.spindle.quota.usage", + "id": "org.tangled.temp.spindle.quota.usage", "defs": { "main": { "type": "query", @@ -36,7 +36,7 @@ "type": "array", "items": { "type": "ref", - "ref": "sh.tangled.spindle.quota.defs#usage" + "ref": "org.tangled.temp.spindle.quota.defs#usage" } } } diff --git a/spindle/xrpc/ban.go b/spindle/xrpc/ban.go index 65663ee4..803d0152 100644 --- a/spindle/xrpc/ban.go +++ b/spindle/xrpc/ban.go @@ -24,7 +24,7 @@ func (x *Xrpc) Ban(w http.ResponseWriter, r *http.Request) { return } - var data tangled.SpindleModBan_Input + var data tangled.TempSpindleModBan_Input if err := json.NewDecoder(r.Body).Decode(&data); err != nil { fail(xrpcerr.GenericError(err), http.StatusBadRequest) return @@ -78,7 +78,7 @@ func (x *Xrpc) Unban(w http.ResponseWriter, r *http.Request) { return } - var data tangled.SpindleModUnban_Input + var data tangled.TempSpindleModUnban_Input if err := json.NewDecoder(r.Body).Decode(&data); err != nil { fail(xrpcerr.GenericError(err), http.StatusBadRequest) return @@ -143,8 +143,8 @@ func (x *Xrpc) GetBan(w http.ResponseWriter, r *http.Request) { return } - out := tangled.SpindleModGetBan_Output{ - Ban: &tangled.SpindleModDefs_Ban{ + out := tangled.TempSpindleModGetBan_Output{ + Ban: &tangled.TempSpindleModDefs_Ban{ Did: ban.SubjectDid.String(), CreatedAt: ban.CreatedAt, }, @@ -174,11 +174,11 @@ func (x *Xrpc) ListBans(w http.ResponseWriter, r *http.Request) { return } - out := tangled.SpindleModListBans_Output{ - Bans: make([]*tangled.SpindleModDefs_Ban, 0, len(bans)), + out := tangled.TempSpindleModListBans_Output{ + Bans: make([]*tangled.TempSpindleModDefs_Ban, 0, len(bans)), } for _, b := range bans { - out.Bans = append(out.Bans, &tangled.SpindleModDefs_Ban{ + out.Bans = append(out.Bans, &tangled.TempSpindleModDefs_Ban{ Did: b.SubjectDid.String(), CreatedAt: b.CreatedAt, }) diff --git a/spindle/xrpc/ban_test.go b/spindle/xrpc/ban_test.go index f3c4ba02..98ecc2b9 100644 --- a/spindle/xrpc/ban_test.go +++ b/spindle/xrpc/ban_test.go @@ -62,9 +62,9 @@ func setupBanTestXrpc(t *testing.T) (*Xrpc, *fakeRepoWiper, syntax.DID, syntax.D return x, wiper, ownerDid, nonOwnerDid } -func sendBan(x *Xrpc, actor syntax.DID, input tangled.SpindleModBan_Input) (*httptest.ResponseRecorder, int) { +func sendBan(x *Xrpc, actor syntax.DID, input tangled.TempSpindleModBan_Input) (*httptest.ResponseRecorder, int) { body, _ := json.Marshal(input) - req := httptest.NewRequest(http.MethodPost, "/"+tangled.SpindleModBanNSID, bytes.NewReader(body)) + req := httptest.NewRequest(http.MethodPost, "/"+tangled.TempSpindleModBanNSID, bytes.NewReader(body)) if actor != "" { ctx := context.WithValue(req.Context(), ActorDid, actor) req = req.WithContext(ctx) @@ -74,9 +74,9 @@ func sendBan(x *Xrpc, actor syntax.DID, input tangled.SpindleModBan_Input) (*htt return w, w.Code } -func sendUnban(x *Xrpc, actor syntax.DID, input tangled.SpindleModUnban_Input) (*httptest.ResponseRecorder, int) { +func sendUnban(x *Xrpc, actor syntax.DID, input tangled.TempSpindleModUnban_Input) (*httptest.ResponseRecorder, int) { body, _ := json.Marshal(input) - req := httptest.NewRequest(http.MethodPost, "/"+tangled.SpindleModUnbanNSID, bytes.NewReader(body)) + req := httptest.NewRequest(http.MethodPost, "/"+tangled.TempSpindleModUnbanNSID, bytes.NewReader(body)) if actor != "" { ctx := context.WithValue(req.Context(), ActorDid, actor) req = req.WithContext(ctx) @@ -87,7 +87,7 @@ func sendUnban(x *Xrpc, actor syntax.DID, input tangled.SpindleModUnban_Input) ( } func sendListBans(x *Xrpc, actor syntax.DID) (*httptest.ResponseRecorder, int) { - req := httptest.NewRequest(http.MethodGet, "/"+tangled.SpindleModListBansNSID, nil) + req := httptest.NewRequest(http.MethodGet, "/"+tangled.TempSpindleModListBansNSID, nil) if actor != "" { ctx := context.WithValue(req.Context(), ActorDid, actor) req = req.WithContext(ctx) @@ -98,7 +98,7 @@ func sendListBans(x *Xrpc, actor syntax.DID) (*httptest.ResponseRecorder, int) { } func sendGetBan(x *Xrpc, actor syntax.DID, query string) (*httptest.ResponseRecorder, int) { - path := "/" + tangled.SpindleModGetBanNSID + path := "/" + tangled.TempSpindleModGetBanNSID if query != "" { path += "?" + query } @@ -115,7 +115,7 @@ func sendGetBan(x *Xrpc, actor syntax.DID, query string) (*httptest.ResponseReco func TestBan_OwnerAuth(t *testing.T) { x, _, ownerDid, nonOwnerDid := setupBanTestXrpc(t) - addInput := tangled.SpindleModBan_Input{ + addInput := tangled.TempSpindleModBan_Input{ Did: "did:plc:targetrepo", } @@ -149,7 +149,7 @@ func TestBan_OwnerAuth(t *testing.T) { t.Fatalf("expected 200 for owner ban list, got %d", code) } - removeInput := tangled.SpindleModUnban_Input{ + removeInput := tangled.TempSpindleModUnban_Input{ Did: "did:plc:targetrepo", } @@ -174,17 +174,17 @@ func TestBan_ValidationErrors(t *testing.T) { tests := []struct { name string - input tangled.SpindleModBan_Input + input tangled.TempSpindleModBan_Input }{ { name: "invalid did", - input: tangled.SpindleModBan_Input{ + input: tangled.TempSpindleModBan_Input{ Did: "notadid", }, }, { name: "empty did", - input: tangled.SpindleModBan_Input{ + input: tangled.TempSpindleModBan_Input{ Did: "", }, }, @@ -208,17 +208,17 @@ func TestBan_ValidationErrors(t *testing.T) { removeTests := []struct { name string - input tangled.SpindleModUnban_Input + input tangled.TempSpindleModUnban_Input }{ { name: "invalid did remove", - input: tangled.SpindleModUnban_Input{ + input: tangled.TempSpindleModUnban_Input{ Did: "notadid", }, }, { name: "ban not found", - input: tangled.SpindleModUnban_Input{ + input: tangled.TempSpindleModUnban_Input{ Did: "did:plc:nonexistent", }, }, @@ -234,7 +234,7 @@ func TestBan_ValidationErrors(t *testing.T) { } wiper.err = errors.New("wipe network error") - _, code := sendBan(x, ownerDid, tangled.SpindleModBan_Input{ + _, code := sendBan(x, ownerDid, tangled.TempSpindleModBan_Input{ Did: "did:plc:errorrepo", }) if code != http.StatusInternalServerError { @@ -245,7 +245,7 @@ func TestBan_ValidationErrors(t *testing.T) { func TestBan_RoundTrip(t *testing.T) { x, wiper, ownerDid, _ := setupBanTestXrpc(t) - w, code := sendBan(x, ownerDid, tangled.SpindleModBan_Input{ + w, code := sendBan(x, ownerDid, tangled.TempSpindleModBan_Input{ Did: "did:plc:repo123", }) if code != http.StatusOK { @@ -261,7 +261,7 @@ func TestBan_RoundTrip(t *testing.T) { t.Fatalf("expected wipe reason 'banned', got %v", wiper.repoReasons) } - w, code = sendBan(x, ownerDid, tangled.SpindleModBan_Input{ + w, code = sendBan(x, ownerDid, tangled.TempSpindleModBan_Input{ Did: "did:plc:badactor", }) if code != http.StatusOK { @@ -278,7 +278,7 @@ func TestBan_RoundTrip(t *testing.T) { if code != http.StatusOK { t.Fatalf("expected 200 for ban list, got %d", code) } - var listOut tangled.SpindleModListBans_Output + var listOut tangled.TempSpindleModListBans_Output if err := json.Unmarshal(w.Body.Bytes(), &listOut); err != nil { t.Fatalf("failed to decode ban list output: %v", err) } @@ -300,14 +300,14 @@ func TestBan_RoundTrip(t *testing.T) { t.Fatalf("expected both repo and owner bans in list, got %+v", listOut.Bans) } - w, code = sendUnban(x, ownerDid, tangled.SpindleModUnban_Input{ + w, code = sendUnban(x, ownerDid, tangled.TempSpindleModUnban_Input{ Did: "did:plc:repo123", }) if code != http.StatusOK { t.Fatalf("expected 200 for repo ban remove, got %d", code) } - w, code = sendUnban(x, ownerDid, tangled.SpindleModUnban_Input{ + w, code = sendUnban(x, ownerDid, tangled.TempSpindleModUnban_Input{ Did: "did:plc:repo123", }) if code != http.StatusBadRequest { @@ -318,7 +318,7 @@ func TestBan_RoundTrip(t *testing.T) { if code != http.StatusOK { t.Fatalf("expected 200 for ban list after remove, got %d", code) } - var afterRemoveOut tangled.SpindleModListBans_Output + var afterRemoveOut tangled.TempSpindleModListBans_Output if err := json.Unmarshal(w.Body.Bytes(), &afterRemoveOut); err != nil { t.Fatalf("failed to decode ban list output: %v", err) } @@ -335,7 +335,7 @@ func TestGetBan(t *testing.T) { t.Fatalf("expected 404 before the ban, got %d", code) } - if _, code := sendBan(x, ownerDid, tangled.SpindleModBan_Input{Did: banned.String()}); code != http.StatusOK { + if _, code := sendBan(x, ownerDid, tangled.TempSpindleModBan_Input{Did: banned.String()}); code != http.StatusOK { t.Fatalf("ban add: expected 200, got %d", code) } @@ -343,7 +343,7 @@ func TestGetBan(t *testing.T) { if code != http.StatusOK { t.Fatalf("expected 200 after the ban, got %d", code) } - var out tangled.SpindleModGetBan_Output + var out tangled.TempSpindleModGetBan_Output if err := json.Unmarshal(w.Body.Bytes(), &out); err != nil { t.Fatalf("decode: %v", err) } diff --git a/spindle/xrpc/quota.go b/spindle/xrpc/quota.go index b889649e..0a88fede 100644 --- a/spindle/xrpc/quota.go +++ b/spindle/xrpc/quota.go @@ -58,7 +58,7 @@ func (x *Xrpc) SetLimit(w http.ResponseWriter, r *http.Request) { return } - var data tangled.SpindleQuotaSet_Input + var data tangled.TempSpindleQuotaSet_Input if err := json.NewDecoder(r.Body).Decode(&data); err != nil { fail(xrpcerr.GenericError(err), http.StatusBadRequest) return @@ -122,7 +122,7 @@ func (x *Xrpc) UnsetLimit(w http.ResponseWriter, r *http.Request) { return } - var data tangled.SpindleQuotaUnset_Input + var data tangled.TempSpindleQuotaUnset_Input if err := json.NewDecoder(r.Body).Decode(&data); err != nil { fail(xrpcerr.GenericError(err), http.StatusBadRequest) return @@ -190,8 +190,8 @@ func (x *Xrpc) GetLimit(w http.ResponseWriter, r *http.Request) { return } - out := tangled.SpindleQuotaGet_Output{ - Limit: &tangled.SpindleQuotaDefs_Limit{ + out := tangled.TempSpindleQuotaGet_Output{ + Limit: &tangled.TempSpindleQuotaDefs_Limit{ Did: lim.DID, Resource: lim.Resource, Limit: lim.Limit, @@ -228,11 +228,11 @@ func (x *Xrpc) ListLimits(w http.ResponseWriter, r *http.Request) { return } - out := tangled.SpindleQuotaList_Output{ - Limits: make([]*tangled.SpindleQuotaDefs_Limit, 0, len(limits)), + out := tangled.TempSpindleQuotaList_Output{ + Limits: make([]*tangled.TempSpindleQuotaDefs_Limit, 0, len(limits)), } for _, lim := range limits { - out.Limits = append(out.Limits, &tangled.SpindleQuotaDefs_Limit{ + out.Limits = append(out.Limits, &tangled.TempSpindleQuotaDefs_Limit{ Did: lim.DID, Resource: lim.Resource, Limit: lim.Limit, @@ -283,8 +283,8 @@ func (x *Xrpc) GetUsage(w http.ResponseWriter, r *http.Request) { return } - out := tangled.SpindleQuotaUsage_Output{ - Usages: make([]*tangled.SpindleQuotaDefs_Usage, 0), + out := tangled.TempSpindleQuotaUsage_Output{ + Usages: make([]*tangled.TempSpindleQuotaDefs_Usage, 0), } for _, u := range usages { if scopeFilter != "" && string(u.Scope) != scopeFilter { @@ -293,7 +293,7 @@ func (x *Xrpc) GetUsage(w http.ResponseWriter, r *http.Request) { if didFilter != "" && u.DID != didFilter { continue } - out.Usages = append(out.Usages, &tangled.SpindleQuotaDefs_Usage{ + out.Usages = append(out.Usages, &tangled.TempSpindleQuotaDefs_Usage{ Scope: string(u.Scope), Did: u.DID, Resource: u.Resource, diff --git a/spindle/xrpc/quota_test.go b/spindle/xrpc/quota_test.go index 9aee95ce..fa20d973 100644 --- a/spindle/xrpc/quota_test.go +++ b/spindle/xrpc/quota_test.go @@ -45,9 +45,9 @@ func setupQuotaTestXrpc(t *testing.T) (*Xrpc, syntax.DID, syntax.DID) { return x, ownerDid, nonOwnerDid } -func sendSetLimit(x *Xrpc, actor syntax.DID, input tangled.SpindleQuotaSet_Input) (*httptest.ResponseRecorder, int) { +func sendSetLimit(x *Xrpc, actor syntax.DID, input tangled.TempSpindleQuotaSet_Input) (*httptest.ResponseRecorder, int) { body, _ := json.Marshal(input) - req := httptest.NewRequest(http.MethodPost, "/"+tangled.SpindleQuotaSetNSID, bytes.NewReader(body)) + req := httptest.NewRequest(http.MethodPost, "/"+tangled.TempSpindleQuotaSetNSID, bytes.NewReader(body)) if actor != "" { ctx := context.WithValue(req.Context(), ActorDid, actor) req = req.WithContext(ctx) @@ -57,9 +57,9 @@ func sendSetLimit(x *Xrpc, actor syntax.DID, input tangled.SpindleQuotaSet_Input return w, w.Code } -func sendUnsetLimit(x *Xrpc, actor syntax.DID, input tangled.SpindleQuotaUnset_Input) (*httptest.ResponseRecorder, int) { +func sendUnsetLimit(x *Xrpc, actor syntax.DID, input tangled.TempSpindleQuotaUnset_Input) (*httptest.ResponseRecorder, int) { body, _ := json.Marshal(input) - req := httptest.NewRequest(http.MethodPost, "/"+tangled.SpindleQuotaUnsetNSID, bytes.NewReader(body)) + req := httptest.NewRequest(http.MethodPost, "/"+tangled.TempSpindleQuotaUnsetNSID, bytes.NewReader(body)) if actor != "" { ctx := context.WithValue(req.Context(), ActorDid, actor) req = req.WithContext(ctx) @@ -70,7 +70,7 @@ func sendUnsetLimit(x *Xrpc, actor syntax.DID, input tangled.SpindleQuotaUnset_I } func sendListLimits(x *Xrpc, actor syntax.DID) (*httptest.ResponseRecorder, int) { - req := httptest.NewRequest(http.MethodGet, "/"+tangled.SpindleQuotaListNSID, nil) + req := httptest.NewRequest(http.MethodGet, "/"+tangled.TempSpindleQuotaListNSID, nil) if actor != "" { ctx := context.WithValue(req.Context(), ActorDid, actor) req = req.WithContext(ctx) @@ -81,7 +81,7 @@ func sendListLimits(x *Xrpc, actor syntax.DID) (*httptest.ResponseRecorder, int) } func sendGetLimit(x *Xrpc, actor syntax.DID, query string) (*httptest.ResponseRecorder, int) { - path := "/" + tangled.SpindleQuotaGetNSID + path := "/" + tangled.TempSpindleQuotaGetNSID if query != "" { path += "?" + query } @@ -96,7 +96,7 @@ func sendGetLimit(x *Xrpc, actor syntax.DID, query string) (*httptest.ResponseRe } func sendGetUsage(x *Xrpc, actor syntax.DID, query string) (*httptest.ResponseRecorder, int) { - path := "/" + tangled.SpindleQuotaUsageNSID + path := "/" + tangled.TempSpindleQuotaUsageNSID if query != "" { path += "?" + query } @@ -114,7 +114,7 @@ func TestQuota_OwnerAuth(t *testing.T) { x, ownerDid, nonOwnerDid := setupQuotaTestXrpc(t) limitVal := int64(10) - setInput := tangled.SpindleQuotaSet_Input{ + setInput := tangled.TempSpindleQuotaSet_Input{ Did: "did:plc:alice", Resource: "workflows", Limit: &limitVal, @@ -161,7 +161,7 @@ func TestQuota_OwnerAuth(t *testing.T) { t.Fatalf("expected 401 for missing actor usage, got %d", code) } - unsetInput := tangled.SpindleQuotaUnset_Input{ + unsetInput := tangled.TempSpindleQuotaUnset_Input{ Did: "did:plc:alice", Resource: "workflows", } @@ -202,11 +202,11 @@ func TestQuota_ValidationErrors(t *testing.T) { tests := []struct { name string - input tangled.SpindleQuotaSet_Input + input tangled.TempSpindleQuotaSet_Input }{ { name: "invalid DID", - input: tangled.SpindleQuotaSet_Input{ + input: tangled.TempSpindleQuotaSet_Input{ Did: "alice", Resource: "workflows", Limit: &limitVal, @@ -214,7 +214,7 @@ func TestQuota_ValidationErrors(t *testing.T) { }, { name: "malformed DID did:", - input: tangled.SpindleQuotaSet_Input{ + input: tangled.TempSpindleQuotaSet_Input{ Did: "did:", Resource: "workflows", Limit: &limitVal, @@ -222,7 +222,7 @@ func TestQuota_ValidationErrors(t *testing.T) { }, { name: "malformed DID notadid", - input: tangled.SpindleQuotaSet_Input{ + input: tangled.TempSpindleQuotaSet_Input{ Did: "notadid", Resource: "workflows", Limit: &limitVal, @@ -230,7 +230,7 @@ func TestQuota_ValidationErrors(t *testing.T) { }, { name: "empty resource", - input: tangled.SpindleQuotaSet_Input{ + input: tangled.TempSpindleQuotaSet_Input{ Did: "did:plc:alice", Resource: "", Limit: &limitVal, @@ -238,7 +238,7 @@ func TestQuota_ValidationErrors(t *testing.T) { }, { name: "resource too long", - input: tangled.SpindleQuotaSet_Input{ + input: tangled.TempSpindleQuotaSet_Input{ Did: "did:plc:alice", Resource: strings.Repeat("a", 65), Limit: &limitVal, @@ -246,14 +246,14 @@ func TestQuota_ValidationErrors(t *testing.T) { }, { name: "missing limit and unlimited", - input: tangled.SpindleQuotaSet_Input{ + input: tangled.TempSpindleQuotaSet_Input{ Did: "did:plc:alice", Resource: "workflows", }, }, { name: "conflicting limit and unlimited", - input: tangled.SpindleQuotaSet_Input{ + input: tangled.TempSpindleQuotaSet_Input{ Did: "did:plc:alice", Resource: "workflows", Limit: &limitVal, @@ -262,9 +262,9 @@ func TestQuota_ValidationErrors(t *testing.T) { }, { name: "negative limit", - input: func() tangled.SpindleQuotaSet_Input { + input: func() tangled.TempSpindleQuotaSet_Input { neg := int64(-5) - return tangled.SpindleQuotaSet_Input{ + return tangled.TempSpindleQuotaSet_Input{ Did: "did:plc:alice", Resource: "workflows", Limit: &neg, @@ -273,9 +273,9 @@ func TestQuota_ValidationErrors(t *testing.T) { }, { name: "zero limit", - input: func() tangled.SpindleQuotaSet_Input { + input: func() tangled.TempSpindleQuotaSet_Input { zero := int64(0) - return tangled.SpindleQuotaSet_Input{ + return tangled.TempSpindleQuotaSet_Input{ Did: "did:plc:alice", Resource: "workflows", Limit: &zero, @@ -295,32 +295,32 @@ func TestQuota_ValidationErrors(t *testing.T) { unsetTests := []struct { name string - input tangled.SpindleQuotaUnset_Input + input tangled.TempSpindleQuotaUnset_Input }{ { name: "invalid did unset", - input: tangled.SpindleQuotaUnset_Input{ + input: tangled.TempSpindleQuotaUnset_Input{ Did: "not-a-did", Resource: "workflows", }, }, { name: "malformed DID did: unset", - input: tangled.SpindleQuotaUnset_Input{ + input: tangled.TempSpindleQuotaUnset_Input{ Did: "did:", Resource: "workflows", }, }, { name: "malformed DID notadid unset", - input: tangled.SpindleQuotaUnset_Input{ + input: tangled.TempSpindleQuotaUnset_Input{ Did: "notadid", Resource: "workflows", }, }, { name: "empty resource unset", - input: tangled.SpindleQuotaUnset_Input{ + input: tangled.TempSpindleQuotaUnset_Input{ Did: "did:plc:alice", Resource: "", }, @@ -375,7 +375,7 @@ func TestQuota_RoundTrip(t *testing.T) { limit2 := int64(524288000) // 500 MiB in raw bytes unlimited := true - w, code := sendSetLimit(x, ownerDid, tangled.SpindleQuotaSet_Input{ + w, code := sendSetLimit(x, ownerDid, tangled.TempSpindleQuotaSet_Input{ Did: "did:plc:alice", Resource: "workflows", Limit: &limit1, @@ -384,7 +384,7 @@ func TestQuota_RoundTrip(t *testing.T) { t.Fatalf("expected 200 for set workflows, got %d (body: %s)", code, w.Body.String()) } - w, code = sendSetLimit(x, ownerDid, tangled.SpindleQuotaSet_Input{ + w, code = sendSetLimit(x, ownerDid, tangled.TempSpindleQuotaSet_Input{ Did: "did:plc:alice", Resource: "cache_storage_bytes", Limit: &limit2, @@ -393,7 +393,7 @@ func TestQuota_RoundTrip(t *testing.T) { t.Fatalf("expected 200 for set cache_storage_bytes, got %d", code) } - w, code = sendSetLimit(x, ownerDid, tangled.SpindleQuotaSet_Input{ + w, code = sendSetLimit(x, ownerDid, tangled.TempSpindleQuotaSet_Input{ Did: "did:plc:repo123", Resource: "vcpus", Unlimited: &unlimited, @@ -406,7 +406,7 @@ func TestQuota_RoundTrip(t *testing.T) { if code != http.StatusOK { t.Fatalf("expected 200 for list limits, got %d", code) } - var listOut tangled.SpindleQuotaList_Output + var listOut tangled.TempSpindleQuotaList_Output if err := json.Unmarshal(w.Body.Bytes(), &listOut); err != nil { t.Fatalf("failed to unmarshal list limits output: %v", err) } @@ -462,7 +462,7 @@ func TestQuota_RoundTrip(t *testing.T) { if code != http.StatusOK { t.Fatalf("expected 200 for usage query, got %d", code) } - var usageOut tangled.SpindleQuotaUsage_Output + var usageOut tangled.TempSpindleQuotaUsage_Output if err := json.Unmarshal(w.Body.Bytes(), &usageOut); err != nil { t.Fatalf("failed to unmarshal usage output: %v", err) } @@ -474,7 +474,7 @@ func TestQuota_RoundTrip(t *testing.T) { if code != http.StatusOK { t.Fatalf("expected 200 for filtered usage, got %d", code) } - var userUsageOut tangled.SpindleQuotaUsage_Output + var userUsageOut tangled.TempSpindleQuotaUsage_Output if err := json.Unmarshal(w.Body.Bytes(), &userUsageOut); err != nil { t.Fatalf("failed to unmarshal filtered usage: %v", err) } @@ -486,7 +486,7 @@ func TestQuota_RoundTrip(t *testing.T) { if code != http.StatusOK { t.Fatalf("expected 200 for empty filtered usage, got %d", code) } - var emptyUsageOut tangled.SpindleQuotaUsage_Output + var emptyUsageOut tangled.TempSpindleQuotaUsage_Output if err := json.Unmarshal(w.Body.Bytes(), &emptyUsageOut); err != nil { t.Fatalf("failed to unmarshal empty usage output: %v", err) } @@ -494,7 +494,7 @@ func TestQuota_RoundTrip(t *testing.T) { t.Fatalf("expected 0 usages for nonexistent did, got %d", len(emptyUsageOut.Usages)) } - w, code = sendUnsetLimit(x, ownerDid, tangled.SpindleQuotaUnset_Input{ + w, code = sendUnsetLimit(x, ownerDid, tangled.TempSpindleQuotaUnset_Input{ Did: "did:plc:alice", Resource: "workflows", }) @@ -506,7 +506,7 @@ func TestQuota_RoundTrip(t *testing.T) { if code != http.StatusOK { t.Fatalf("expected 200 for list limits after unset, got %d", code) } - var afterUnsetOut tangled.SpindleQuotaList_Output + var afterUnsetOut tangled.TempSpindleQuotaList_Output if err := json.Unmarshal(w.Body.Bytes(), &afterUnsetOut); err != nil { t.Fatalf("failed to unmarshal list limits output: %v", err) } @@ -530,7 +530,7 @@ func TestGetLimit(t *testing.T) { } limit := int64(7) - if _, code := sendSetLimit(x, ownerDid, tangled.SpindleQuotaSet_Input{Did: did, Resource: "workflows", Limit: &limit}); code != http.StatusOK { + if _, code := sendSetLimit(x, ownerDid, tangled.TempSpindleQuotaSet_Input{Did: did, Resource: "workflows", Limit: &limit}); code != http.StatusOK { t.Fatal("set limit failed") } @@ -538,7 +538,7 @@ func TestGetLimit(t *testing.T) { if code != http.StatusOK { t.Fatalf("expected 200 for a set override, got %d", code) } - var out tangled.SpindleQuotaGet_Output + var out tangled.TempSpindleQuotaGet_Output if err := json.Unmarshal(w.Body.Bytes(), &out); err != nil { t.Fatalf("decode: %v", err) } @@ -547,14 +547,14 @@ func TestGetLimit(t *testing.T) { } unlimited := true - if _, code := sendSetLimit(x, ownerDid, tangled.SpindleQuotaSet_Input{Did: did, Resource: "workflows", Unlimited: &unlimited}); code != http.StatusOK { + if _, code := sendSetLimit(x, ownerDid, tangled.TempSpindleQuotaSet_Input{Did: did, Resource: "workflows", Unlimited: &unlimited}); code != http.StatusOK { t.Fatal("set unlimited failed") } w, code = sendGetLimit(x, ownerDid, "did="+did+"&resource=workflows") if code != http.StatusOK { t.Fatalf("expected 200 for an unlimited override, got %d", code) } - out = tangled.SpindleQuotaGet_Output{} + out = tangled.TempSpindleQuotaGet_Output{} if err := json.Unmarshal(w.Body.Bytes(), &out); err != nil { t.Fatalf("decode: %v", err) } diff --git a/spindle/xrpc/xrpc.go b/spindle/xrpc/xrpc.go index 48155a01..9db427b4 100644 --- a/spindle/xrpc/xrpc.go +++ b/spindle/xrpc/xrpc.go @@ -83,15 +83,15 @@ func (x *Xrpc) Router() http.Handler { r.Get("/"+tangled.RepoListSecretsNSID, x.ListSecrets) r.Post("/"+tangled.CiCancelPipelineNSID, x.CancelPipeline) r.Post("/"+tangled.CiTriggerPipelineNSID, x.TriggerPipeline) - r.Post("/"+tangled.SpindleQuotaSetNSID, x.SetLimit) - r.Post("/"+tangled.SpindleQuotaUnsetNSID, x.UnsetLimit) - r.Get("/"+tangled.SpindleQuotaGetNSID, x.GetLimit) - r.Get("/"+tangled.SpindleQuotaListNSID, x.ListLimits) - r.Get("/"+tangled.SpindleQuotaUsageNSID, x.GetUsage) - r.Post("/"+tangled.SpindleModBanNSID, x.Ban) - r.Post("/"+tangled.SpindleModUnbanNSID, x.Unban) - r.Get("/"+tangled.SpindleModGetBanNSID, x.GetBan) - r.Get("/"+tangled.SpindleModListBansNSID, x.ListBans) + r.Post("/"+tangled.TempSpindleQuotaSetNSID, x.SetLimit) + r.Post("/"+tangled.TempSpindleQuotaUnsetNSID, x.UnsetLimit) + r.Get("/"+tangled.TempSpindleQuotaGetNSID, x.GetLimit) + r.Get("/"+tangled.TempSpindleQuotaListNSID, x.ListLimits) + r.Get("/"+tangled.TempSpindleQuotaUsageNSID, x.GetUsage) + r.Post("/"+tangled.TempSpindleModBanNSID, x.Ban) + r.Post("/"+tangled.TempSpindleModUnbanNSID, x.Unban) + r.Get("/"+tangled.TempSpindleModGetBanNSID, x.GetBan) + r.Get("/"+tangled.TempSpindleModListBansNSID, x.ListBans) }) // service query endpoints (no auth required)