@@ -37,6 +37,9 @@ func (s *OciConfigService) CreateInstances(ctx context.Context, id uint, in oci.
|
||||
if count < 1 || count > maxBatchCreate {
|
||||
return nil, nil, fmt.Errorf("create instances: count must be between 1 and %d", maxBatchCreate)
|
||||
}
|
||||
if in.ReservedPublicIPID != "" && count > 1 {
|
||||
return nil, nil, fmt.Errorf("create instances: reserved public ip only supports single instance")
|
||||
}
|
||||
if err := validateCreateInstance(in); err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
@@ -59,6 +62,10 @@ func (s *OciConfigService) CreateInstances(ctx context.Context, id uint, in oci.
|
||||
failures = append(failures, fmt.Sprintf("%s: %s", one.DisplayName, oci.CompactError(err)))
|
||||
continue
|
||||
}
|
||||
if one.ReservedPublicIPID != "" {
|
||||
region, instanceID, ipID := one.Region, instance.ID, one.ReservedPublicIPID
|
||||
s.goBind(func() { s.bindReservedIPWhenReady(cred, region, instanceID, ipID) })
|
||||
}
|
||||
instances = append(instances, instance)
|
||||
}
|
||||
return instances, failures, nil
|
||||
|
||||
Reference in New Issue
Block a user