Skip to content

Commit f1a50fa

Browse files
authored
Merge pull request #91 from chainguard-dev/create-pull-request/patch
Export mono/sdk: refs/heads/main
2 parents 471e781 + f2e078a commit f1a50fa

File tree

8 files changed

+483
-112
lines changed

8 files changed

+483
-112
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ require (
9090
go.uber.org/multierr v1.11.0 // indirect
9191
go.uber.org/zap v1.27.0 // indirect
9292
golang.org/x/crypto v0.36.0 // indirect
93-
golang.org/x/net v0.37.0 // indirect
93+
golang.org/x/net v0.38.0 // indirect
9494
golang.org/x/sys v0.31.0 // indirect
9595
golang.org/x/text v0.23.0 // indirect
9696
google.golang.org/genproto/googleapis/rpc v0.0.0-20250313205543-e70fdf4c4cb4 // indirect

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL
278278
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
279279
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
280280
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
281-
golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c=
282-
golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
281+
golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8=
282+
golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
283283
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
284284
golang.org/x/oauth2 v0.28.0 h1:CrgCKl8PPAVtLnU3c+EDw6x11699EWlsDeWNWKdIOkc=
285285
golang.org/x/oauth2 v0.28.0/go.mod h1:onh5ek6nERTohokkhCD/y2cV4Do3fxFHFuAejCkRWT8=

proto/capabilities/roles.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ var (
3434
Capability_CAP_BUILD_REPORT_LIST,
3535

3636
Capability_CAP_LIBRARIES_ENTITLEMENTS_LIST,
37+
38+
Capability_CAP_REGISTRY_ENTITLEMENTS_LIST,
3739
},
3840
// Viewers can also list repos and tags, and pull images.
3941
RegistryPullCaps...), APKPullCaps...))

proto/platform/registry/v1/registry_entitlements.platform.pb.go

Lines changed: 292 additions & 109 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

proto/platform/registry/v1/registry_entitlements.platform.pb.gw.go

Lines changed: 103 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

proto/platform/registry/v1/registry_entitlements.platform.proto

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ package chainguard.platform.registry;
1010
import "google/protobuf/timestamp.proto";
1111
import "registry.platform.proto";
1212
import "google/api/annotations.proto";
13+
import "google/api/field_behavior.proto";
1314
import "annotations/auth.proto";
1415

1516
// Entitlements is a service for viewing configuration and features enabled on a registry.
@@ -35,6 +36,18 @@ service Entitlements {
3536
}
3637
};
3738
}
39+
40+
// Summary provides a group-level summary of entitlements.
41+
rpc Summary(EntitlementSummaryRequest) returns (EntitlementSummaryResponse) {
42+
option (google.api.http) = {
43+
get: "/registry/v1/entitlements/{parent=**}:summary"
44+
};
45+
option (chainguard.annotations.iam) = {
46+
enabled: {
47+
capabilities: [CAP_REGISTRY_ENTITLEMENTS_LIST]
48+
}
49+
};
50+
}
3851
}
3952

4053
// Entitlement contains information about what an organization is entitled to.
@@ -75,6 +88,9 @@ message EntitlementImage {
7588
string id = 1 ;
7689
// The image repository catalog tier the image is associated with.
7790
chainguard.platform.registry.CatalogTier tier = 2;
91+
92+
// Human-readable image name corresponding to id.
93+
string name = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
7894
}
7995

8096
message EntitlementImagesFilter {
@@ -84,3 +100,14 @@ message EntitlementImagesFilter {
84100
message EntitlementImagesList {
85101
repeated EntitlementImage images = 1;
86102
}
103+
104+
message EntitlementSummaryRequest {
105+
string parent = 1 [(chainguard.annotations.iam_scope) = true];
106+
}
107+
108+
message EntitlementSummaryResponse {
109+
// Keys can't be enum types, but string should match CatalogTier.
110+
map<string, ImageQuota> quota = 1;
111+
// last updated time
112+
google.protobuf.Timestamp last_updated_time = 2;
113+
}

proto/platform/registry/v1/registry_entitlements.platform_grpc.pb.go

Lines changed: 40 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

proto/platform/registry/v1/test/entitlements.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ type MockEntitlementsClient struct {
2222

2323
OnListEntitlements []ListOnEntitlements
2424
OnListEntitlementImages []ListOnEntitlementImages
25+
OnGetEntitlementSummary []GetOnEntitlementSummary
2526
}
2627

2728
type ListOnEntitlements struct {
@@ -36,6 +37,12 @@ type ListOnEntitlementImages struct {
3637
Error error
3738
}
3839

40+
type GetOnEntitlementSummary struct {
41+
Given *registry.EntitlementSummaryRequest
42+
Get *registry.EntitlementSummaryResponse
43+
Error error
44+
}
45+
3946
func (m *MockEntitlementsClient) ListEntitlements(_ context.Context, given *registry.EntitlementFilter, _ ...grpc.CallOption) (*registry.EntitlementList, error) {
4047
for _, o := range m.OnListEntitlements {
4148
if cmp.Equal(o.Given, given, protocmp.Transform()) {
@@ -53,3 +60,12 @@ func (m *MockEntitlementsClient) ListEntitlementImages(_ context.Context, given
5360
}
5461
return nil, fmt.Errorf("mock not found for %v", given)
5562
}
63+
64+
func (m *MockEntitlementsClient) Summary(_ context.Context, given *registry.EntitlementSummaryRequest, _ ...grpc.CallOption) (*registry.EntitlementSummaryResponse, error) {
65+
for _, o := range m.OnGetEntitlementSummary {
66+
if cmp.Equal(o.Given, given, protocmp.Transform()) {
67+
return o.Get, o.Error
68+
}
69+
}
70+
return nil, fmt.Errorf("mock not found for %v", given)
71+
}

0 commit comments

Comments
 (0)