// mcVersionToReleaseTime - parses a standard official release
// mc version string.
//
// An official binary's version string is the release time formatted
// with RFC3339 (in UTC) - e.g. `2017-09-29T19:16:56Z`
509733
func mcVersionToReleaseTime(version string) (releaseTime time.Time, err *probe.Error) {
	var e error
	releaseTime, e = time.Parse(time.RFC3339, version)
	return releaseTime, probe.NewError(e)
}
548398
func (s *BotMetadata) SetVersion(v string) *BotMetadata {
	s.Version = &v
	return s
}
678562
func (s *Connector) SetVersion(v string) *Connector {
	s.Version = &v
	return s
}
130331
func (s *SimulationSoftwareSuite) SetVersion(v string) *SimulationSoftwareSuite {
	s.Version = &v
	return s
}
1214754
func (s *Application) SetVersion(v string) *Application {
	s.Version = &v
	return s
}
1269288
func (fullFormat *parsedNumberFormat) parseTime(value string, date1904 bool) (string, error) {
	f, err := strconv.ParseFloat(value, 64)
	if err != nil {
		return value, err
	}
	val := TimeFromExcelTime(f, date1904)
	format := fullFormat.numFmt
	// Replace Excel placeholders with Go time placeholders.
	// For example, replace yyyy with 2006. These are in a specific order,
	// due to the fact that m is used in month, minute, and am/pm. It would
	// be easier to fix that with regular expressions, but if it's possible
	// to keep this simple it would be easier to maintain.
	// Full-length month and days (e.g. March, Tuesday) have letters in them that would be replaced
	// by other characters below (such as the 'h' in March, or the 'd' in Tuesday) below.
	// First we convert them to arbitrary characters unused in Excel Date formats, and then at the end,
	// turn them to what they should actually be.
	// Based off: http://www.ozgrid.com/Excel/CustomFormats.htm
	replacements := []struct{ xltime, gotime string }{
		{"yyyy", "2006"},
		{"yy", "06"},
		{"mmmm", "%%%%"},
		{"dddd", "&&&&"},
		{"dd", "02"},
		{"d", "2"},
		{"mmm", "Jan"},
		{"mmss", "0405"},
		{"ss", "05"},
		{"mm:", "04:"},
		{":mm", ":04"},
		{"mm", "01"},
		{"am/pm", "pm"},
		{"m/", "1/"},
		{"%%%%", "January"},
		{"&&&&", "Monday"},
	}
	// It is the presence of the "am/pm" indicator that determins
	// if this is a 12 hour or 24 hours time format, not the
	// number of 'h' characters.
	if is12HourTime(format) {
		format = strings.Replace(format, "hh", "03", 1)
		format = strings.Replace(format, "h", "3", 1)
	} else {
		format = strings.Replace(format, "hh", "15", 1)
		format = strings.Replace(format, "h", "15", 1)
	}
	for _, repl := range replacements {
		format = strings.Replace(format, repl.xltime, repl.gotime, 1)
	}
	// If the hour is optional, strip it out, along with the
	// possible dangling colon that would remain.
	if val.Hour() < 1 {
		format = strings.Replace(format, "]:", "]", 1)
		format = strings.Replace(format, "[03]", "", 1)
		format = strings.Replace(format, "[3]", "", 1)
		format = strings.Replace(format, "[15]", "", 1)
	} else {
		format = strings.Replace(format, "[3]", "3", 1)
		format = strings.Replace(format, "[15]", "15", 1)
	}
	return val.Format(format), nil
}
294239
func (s *UpdateApiInput) SetVersion(v string) *UpdateApiInput {
	s.Version = &v
	return s
}
178303
func (s *PipelineSummary) SetVersion(v int64) *PipelineSummary {
	s.Version = &v
	return s
}
1063433
func (s *CreateApiOutput) SetVersion(v string) *CreateApiOutput {
	s.Version = &v
	return s
}
815285
func (s *RobotApplicationSummary) SetVersion(v string) *RobotApplicationSummary {
	s.Version = &v
	return s
}
551040
func GetCurrentReleaseTime() (releaseTime time.Time, err *probe.Error) {
	if releaseTime, err = mcVersionToReleaseTime(Version); err == nil {
		return releaseTime, nil
	}

	// Looks like version is mc non-standard, we use mc
	// binary's ModTime as release time:
	path, e := os.Executable()
	if e != nil {
		return releaseTime, probe.NewError(e)
	}
	return getModTime(path)
}
149682
func (s *Event) SetVersion(v string) *Event {
	s.Version = &v
	return s
}
609889
func (c *Client) ConfigVarInfoByReleaseVersion(appIdentity, version string) (map[string]string, error) {
	var configVar map[string]string
	return configVar, c.Get(&configVar, fmt.Sprintf("/apps/%s/config-vars/%s", appIdentity, version))
}
403384
func (s *CreateApiInput) SetVersion(v string) *CreateApiInput {
	s.Version = &v
	return s
}
1240771
func (i *VCSInstaller) setVersion(repo vcs.Repo, ref string) error {
	return repo.UpdateVersion(ref)
}
1226934
func (s *FunctionConfiguration) SetVersion(v string) *FunctionConfiguration {
	s.Version = &v
	return s
}
876445
func (s *CreateApplicationOutput) SetVersion(v *Version) *CreateApplicationOutput {
	s.Version = v
	return s
}