@@ -15,6 +15,10 @@ import (
1515 openapi "github.com/brevdev/cloud/v1/providers/launchpad/gen/launchpad"
1616)
1717
18+ const (
19+ brevDGXCWorkshopID = "brev-dgxc"
20+ )
21+
1822func (c * LaunchpadClient ) GetInstanceTypes (ctx context.Context , args v1.GetInstanceTypeArgs ) ([]v1.InstanceType , error ) {
1923 launchpadInstanceTypes , err := c .paginateInstanceTypes (ctx , 100 )
2024 if err != nil {
@@ -208,20 +212,29 @@ func launchpadInstanceTypeToInstanceType(launchpadInstanceType openapi.InstanceT
208212 BasePrice : hourlyPrice ,
209213 Provider : CloudProviderID ,
210214 Cloud : launchpadInstanceType .Cloud ,
211- }
212-
213- // Set the reservation this instance type is for, if relevant
214- if info .workshopID != "" {
215- it .Reservation = & v1.Reservation {
216- ID : info .workshopID ,
217- }
215+ ReservedInstancePoolID : launchpadWorkshopIDToReservedInstancePoolID (info .workshopID ),
218216 }
219217
220218 // Make the instance type ID
221219 it .ID = v1 .MakeGenericInstanceTypeID (* it )
222220 return it , nil
223221}
224222
223+ func launchpadWorkshopIDToReservedInstancePoolID (workshopID string ) string {
224+ // If the workshop is empty, consider this to be a public instance type
225+ if workshopID == "" {
226+ return ""
227+ }
228+
229+ // If the workshop is the Brev DGXC workshop, consider this to be a public instance type
230+ if workshopID == brevDGXCWorkshopID {
231+ return ""
232+ }
233+
234+ // Otherwise, use the workshop ID as the reserved instance pool ID
235+ return workshopID
236+ }
237+
225238func launchpadStorageToStorages (launchpadStorage []openapi.InstanceTypeStorage ) []v1.Storage {
226239 if len (launchpadStorage ) == 0 {
227240 return nil
0 commit comments