Skip to content

Commit ea9b76c

Browse files
Merge pull request openshift#925 from jhadvig/OCPBUGS-38549
OCPBUGS-38549: Get externalOrganizationID instead of the organizationID
2 parents 0f85ea7 + ec6d103 commit ea9b76c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

pkg/console/telemetry/telemetry.go

+7-3
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,14 @@ func GetOrganizationID(telemetryConfig map[string]string, cachedOrganizationID,
107107
// https://github.com/openshift-online/ocm-sdk-go/blob/main/accountsmgmt/v1/subscription_client.go - everything private
108108
// https://github.com/openshift-online/ocm-sdk-go/blob/main/accountsmgmt/v1/subscriptions_client.go#L38-L41 - useless client
109109
type OCMAPIResponse struct {
110-
Items []Organization `json:"items"`
110+
Items []Subscription `json:"items"`
111111
}
112+
type Subscription struct {
113+
Organization Organization `json:"organization,omitempty"`
114+
}
115+
112116
type Organization struct {
113-
OrganizationID string `json:"organization_id"`
117+
ExternalId string `json:"external_id,omitempty"`
114118
}
115119

116120
// FetchOrganizationID fetches the organization ID using the cluster ID and access token
@@ -156,7 +160,7 @@ func FetchOrganizationID(clusterID, accessToken string) (string, error) {
156160
return "", fmt.Errorf("empty OCM response")
157161
}
158162

159-
return ocmResponse.Items[0].OrganizationID, nil
163+
return ocmResponse.Items[0].Organization.ExternalId, nil
160164
}
161165

162166
// buildURL constructs the URL for the API request

0 commit comments

Comments
 (0)