| 1 |
// Package internals contains functions for accessing |
| 2 |
// the underlying "releases" and coreos-assembler builds |
| 3 |
// backing streams. General user code should avoid |
| 4 |
// this package and use streams. |
| 5 |
package internals |
| 6 |
|
| 7 |
import ( |
| 8 |
"fmt" |
| 9 |
"net/url" |
| 10 |
) |
| 11 |
|
| 12 |
// GetBaseURL returns the base URL |
| 13 |
func GetBaseURL() url.URL { |
| 14 |
return url.URL{ |
| 15 |
Scheme: "https", |
| 16 |
Host: "builds.coreos.fedoraproject.org", |
| 17 |
} |
| 18 |
} |
| 19 |
|
| 20 |
// GetReleaseIndexURL returns the URL for the release index of a given stream. |
| 21 |
// Avoid this unless you have a specific need to test a specific release. |
| 22 |
func GetReleaseIndexURL(stream string) url.URL { |
| 23 |
u := GetBaseURL() |
| 24 |
u.Path = fmt.Sprintf("prod/streams/%s/releases.json", stream) |
| 25 |
return u |
| 26 |
} |
| 27 |
|
| 28 |
// GetCosaBuild returns the coreos-assembler build URL |
| 29 |
func GetCosaBuild(stream, buildID, arch string) url.URL { |
| 30 |
u := GetBaseURL() |
| 31 |
u.Path = fmt.Sprintf("prod/streams/%s/builds/%s/%s/", stream, buildID, arch) |
| 32 |
return u |
| 33 |
} |