diff --git a/interfaces/astm-utm/Protocol b/interfaces/astm-utm/Protocol index 962024be8..fd6a3fe96 160000 --- a/interfaces/astm-utm/Protocol +++ b/interfaces/astm-utm/Protocol @@ -1 +1 @@ -Subproject commit 962024be8835bddaed87a17390062836d994754c +Subproject commit fd6a3fe96e0d7d086e34bdbf5bd7c37d6c5f3f5b diff --git a/interfaces/openapi-to-go-server/example/api/scd/types.gen.go b/interfaces/openapi-to-go-server/example/api/scd/types.gen.go index 2c1813f3f..477e27c3d 100644 --- a/interfaces/openapi-to-go-server/example/api/scd/types.gen.go +++ b/interfaces/openapi-to-go-server/example/api/scd/types.gen.go @@ -117,6 +117,9 @@ type SubscriberToNotify struct { // Subscription(s) prompting this notification. Subscriptions []SubscriptionState `json:"subscriptions"` + // Created by the DSS based on creating client's ID (via access token) + Manager string `json:"manager"` + UssBaseUrl SubscriptionUssBaseURL `json:"uss_base_url"` } @@ -124,6 +127,9 @@ type SubscriberToNotify struct { type Subscription struct { Id SubscriptionID `json:"id"` + // Created by the DSS based on creating client's ID (via access token). Used internal to the DSS for restricting read, mutation and deletion operations to manager. + Manager string `json:"manager"` + // Version of the subscription that the DSS changes every time a USS changes the subscription. The DSS incrementing the notification_index does not constitute a change that triggers a new version. A USS must specify this version when modifying an existing subscription to ensure consistency in read-modify-write operations and distributed systems. Version string `json:"version"` diff --git a/pkg/api/scdv1/types.gen.go b/pkg/api/scdv1/types.gen.go index b14deb25b..0572423fe 100644 --- a/pkg/api/scdv1/types.gen.go +++ b/pkg/api/scdv1/types.gen.go @@ -117,6 +117,9 @@ type SubscriberToNotify struct { // Subscription(s) prompting this notification. Subscriptions []SubscriptionState `json:"subscriptions"` + // Created by the DSS based on creating client's ID (via access token) + Manager string `json:"manager"` + UssBaseUrl SubscriptionUssBaseURL `json:"uss_base_url"` } @@ -124,6 +127,9 @@ type SubscriberToNotify struct { type Subscription struct { Id SubscriptionID `json:"id"` + // Created by the DSS based on creating client's ID (via access token). Used internal to the DSS for restricting read, mutation and deletion operations to manager. + Manager string `json:"manager"` + // Version of the subscription that the DSS changes every time a USS changes the subscription. The DSS incrementing the notification_index does not constitute a change that triggers a new version. A USS must specify this version when modifying an existing subscription to ensure consistency in read-modify-write operations and distributed systems. Version string `json:"version"` diff --git a/pkg/scd/models/subscriptions.go b/pkg/scd/models/subscriptions.go index aa66ecb5f..647072adb 100644 --- a/pkg/scd/models/subscriptions.go +++ b/pkg/scd/models/subscriptions.go @@ -42,6 +42,7 @@ type Subscription struct { func (s *Subscription) ToRest(dependentOperationalIntents []dssmodels.ID) (*restapi.Subscription, error) { result := &restapi.Subscription{ Id: restapi.SubscriptionID(s.ID.String()), + Manager: s.Manager.String(), Version: s.Version.String(), NotificationIndex: restapi.SubscriptionNotificationIndex(s.NotificationIndex), UssBaseUrl: restapi.SubscriptionUssBaseURL(s.USSBaseURL), diff --git a/pkg/scd/server.go b/pkg/scd/server.go index a8eab0aaa..7282e78fd 100644 --- a/pkg/scd/server.go +++ b/pkg/scd/server.go @@ -9,17 +9,26 @@ import ( func makeSubscribersToNotify(subscriptions []*scdmodels.Subscription) []restapi.SubscriberToNotify { result := []restapi.SubscriberToNotify{} - subscriptionsByURL := map[string][]restapi.SubscriptionState{} + type uss struct { + manager string + baseUrl restapi.SubscriptionUssBaseURL + } + subscriptionsByUSS := map[uss][]restapi.SubscriptionState{} for _, sub := range subscriptions { subState := restapi.SubscriptionState{ SubscriptionId: restapi.SubscriptionID(sub.ID.String()), NotificationIndex: restapi.SubscriptionNotificationIndex(sub.NotificationIndex), } - subscriptionsByURL[sub.USSBaseURL] = append(subscriptionsByURL[sub.USSBaseURL], subState) + uss := uss{ + manager: sub.Manager.String(), + baseUrl: restapi.SubscriptionUssBaseURL(sub.USSBaseURL), + } + subscriptionsByUSS[uss] = append(subscriptionsByUSS[uss], subState) } - for url, states := range subscriptionsByURL { + for uss, states := range subscriptionsByUSS { result = append(result, restapi.SubscriberToNotify{ - UssBaseUrl: restapi.SubscriptionUssBaseURL(url), + Manager: uss.manager, + UssBaseUrl: uss.baseUrl, Subscriptions: states, }) }