// BuildNameForConfigVersion returns the name of the version-th build
// for the config that has the provided name.
341008
func BuildNameForConfigVersion(name string, version int) string {
	return fmt.Sprintf("%s-%d", name, version)
}
47767
func (c *Client) UploadBuildConfigVersion(v *BuildConfigVersion, metadata map[string]interface{},
	vars BuildVars, data io.Reader, size int64) error {

	log.Printf("[INFO] uploading build configuration version %s (%d bytes), with metadata %q",
		v.Slug(), size, metadata)

	endpoint := fmt.Sprintf("/api/v1/packer/build-configurations/%s/%s/versions",
		v.User, v.Name)

	var bodyData bcCreateWrapper
	bodyData.Version.Builds = v.Builds
	bodyData.Version.Metadata = metadata
	bodyData.Version.Vars = vars
	body, err := json.Marshal(bodyData)
	if err != nil {
		return err
	}

	request, err := c.Request("POST", endpoint, &RequestOptions{
		Body: bytes.NewReader(body),
		Headers: map[string]string{
			"Content-Type": "application/json",
		},
	})
	if err != nil {
		return err
	}

	response, err := checkResp(c.HTTPClient.Do(request))
	if err != nil {
		return err
	}

	var bv bcCreate
	if err := decodeJSON(response, &bv); err != nil {
		return err
	}

	if err := c.putFile(bv.UploadPath, data, size); err != nil {
		return err
	}

	return nil
}
1345903
func Convert_build_BuildConfigList_To_v1_BuildConfigList(in *build.BuildConfigList, out *v1.BuildConfigList, s conversion.Scope) error {
	return autoConvert_build_BuildConfigList_To_v1_BuildConfigList(in, out, s)
}
1273239
func Convert_build_BuildLogOptions_To_v1_BuildLogOptions(in *build.BuildLogOptions, out *v1.BuildLogOptions, s conversion.Scope) error {
	return autoConvert_build_BuildLogOptions_To_v1_BuildLogOptions(in, out, s)
}
1089870
func Convert_build_BuildConfig_To_v1_BuildConfig(in *build.BuildConfig, out *v1.BuildConfig, s conversion.Scope) error {
	return autoConvert_build_BuildConfig_To_v1_BuildConfig(in, out, s)
}
458126
func (s *GetDocumentOutput) SetVersionName(v string) *GetDocumentOutput {
	s.VersionName = &v
	return s
}
1158163
func NewBuildVersion(s string) (string, error) {
	if len(s) == 0 {
		return "", errors.New("Buildversion is empty")
	}
	if !containsOnly(s, alphanum) {
		return "", fmt.Errorf("Invalid character(s) found in build meta data %q", s)
	}
	return s, nil
}
147040
func Convert_build_GitInfo_To_v1_GitInfo(in *build.GitInfo, out *v1.GitInfo, s conversion.Scope) error {
	return autoConvert_build_GitInfo_To_v1_GitInfo(in, out, s)
}
302431
func Convert_v1_Build_To_build_Build(in *v1.Build, out *build.Build, s conversion.Scope) error {
	return autoConvert_v1_Build_To_build_Build(in, out, s)
}
1176649
func (s *DocumentDefaultVersionDescription) SetDefaultVersionName(v string) *DocumentDefaultVersionDescription {
	s.DefaultVersionName = &v
	return s
}
833615
func BuildVersionString() string {
	program := "Hugo Static Site Generator"

	version := "v" + CurrentVersion.String()
	if commitHash != "" {
		version += "-" + strings.ToUpper(commitHash)
	}
	if isExtended {
		version += "/extended"
	}

	osArch := runtime.GOOS + "/" + runtime.GOARCH

	date := buildDate
	if date == "" {
		date = "unknown"
	}

	return fmt.Sprintf("%s %s %s BuildDate: %s", program, version, osArch, date)

}
715959
func (client DefaultClient) CreateVersion(projectID, versionName string) (Version, error) {
	i, err := strconv.Atoi(projectID)
	if err != nil {
		return Version{}, err
	}

	data, err := json.Marshal(&Version{Name: versionName, Description: "Version " + versionName, ProjectID: i, Archived: false, Released: false})
	if err != nil {
		return Version{}, err
	}
	req, err := http.NewRequest("POST", fmt.Sprintf("%s/rest/api/2/version", client.baseURL), bytes.NewBuffer(data))
	if err != nil {
		return Version{}, err
	}
	req.Header.Set("Content-type", "application/json")
	req.SetBasicAuth(client.username, client.password)

	responseCode, data, err := client.consumeResponse(req)
	if err != nil {
		return Version{}, err
	}
	if responseCode != http.StatusCreated {
		logger.Printf("JIRA response: %s\n", string(data))
		return Version{}, fmt.Errorf("error creating project version.  Status code: %d.\n", responseCode)
	}

	var v Version
	if err := json.Unmarshal(data, &v); err != nil {
		return Version{}, err
	}
	return v, nil
}
332716
func (versions *Versions) AddVersion(version *Version) {
	if version.PropertyVersion != 0 {
		for key, v := range versions.Versions.Items {
			if v.PropertyVersion == version.PropertyVersion {
				versions.Versions.Items[key] = version
				return
			}
		}
	}

	versions.Versions.Items = append(versions.Versions.Items, version)
}
1156926
func NewForVersionForConfig(c *rest.Config, mapper meta.RESTMapper, version schema.GroupVersion) (CustomMetricsClient, error) {
	configShallowCopy := *c
	if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
		configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst)
	}
	configShallowCopy.APIPath = "/apis"
	if configShallowCopy.UserAgent == "" {
		configShallowCopy.UserAgent = rest.DefaultKubernetesUserAgent()
	}
	configShallowCopy.GroupVersion = &version
	configShallowCopy.NegotiatedSerializer = scheme.Codecs.WithoutConversion()

	client, err := rest.RESTClientFor(&configShallowCopy)
	if err != nil {
		return nil, err
	}

	return NewForVersion(client, mapper, version), nil
}
1282407
func (DefaultForeignKeyNamer) BuildKeyName(kind, tableName string, fields ...string) string {
	keyName := fmt.Sprintf("%s_%s_%s", kind, tableName, strings.Join(fields, "_"))
	keyName = keyNameRegex.ReplaceAllString(keyName, "_")
	return keyName
}
919397
func Convert_build_ProxyConfig_To_v1_ProxyConfig(in *build.ProxyConfig, out *v1.ProxyConfig, s conversion.Scope) error {
	return autoConvert_build_ProxyConfig_To_v1_ProxyConfig(in, out, s)
}
390241
func versionForBuild(build *buildv1.Build) int {
	if build == nil {
		return 0
	}
	versionString := build.Annotations[buildapi.BuildNumberAnnotation]
	version, err := strconv.Atoi(versionString)
	if err != nil {
		return 0
	}
	return version
}