// ApplyDefaults applies configured build defaults to a build pod
176482
func (b BuildDefaults) ApplyDefaults(pod *corev1.Pod) error {
	build, err := common.GetBuildFromPod(pod)
	if err != nil {
		return nil
	}

	if b.DefaultProxy != nil {
		b.applyPodProxyDefaults(pod, build.Spec.Strategy.CustomStrategy != nil)
	}

	if b.Config != nil {
		klog.V(4).Infof("Applying defaults to build %s/%s", build.Namespace, build.Name)
		b.applyBuildDefaults(build)

		klog.V(4).Infof("Applying defaults to pod %s/%s", pod.Namespace, pod.Name)
		b.applyPodDefaults(pod, build.Spec.Strategy.CustomStrategy != nil)
	}

	err = setPodLogLevelFromBuild(pod, build)
	if err != nil {
		return err
	}

	return common.SetBuildInPod(pod, build)
}
666963
func (s *CreateStackInput) SetDefaultOs(v string) *CreateStackInput {
	s.DefaultOs = &v
	return s
}
1251772
func (c *defaultsCommand) setDefaults(client defaultsCommandAPI, ctx *cmd.Context) error {
	attrs, err := c.setOptions.ReadAttrs(ctx)
	if err != nil {
		return errors.Trace(err)
	}
	var keys []string
	values := make(attributes)
	for k, v := range attrs {
		if k == config.AgentVersionKey {
			return errors.Errorf(`"agent-version" must be set via "upgrade-model"`)
		}
		values[k] = v
		keys = append(keys, k)
	}

	for _, k := range c.resetKeys {
		if _, ok := values[k]; ok {
			return errors.Errorf(
				"key %q cannot be both set and unset in the same command", k)
		}
	}

	if err := c.verifyKnownKeys(client, keys); err != nil {
		return errors.Trace(err)
	}
	return block.ProcessBlockedError(
		client.SetModelDefaults(
			c.cloudName, c.regionName, values), block.BlockChange)
}
1148563
func setDefaults() {
	formats = defaultFormats()
	tests = defaultTests()
	codecs = defaultCodecs()
	paths = defaultPaths()
	globs = []string{"*.txt", "*.bin"}
	levels = []int{1, 6, 9}
	sizes = []int{1e4, 1e5, 1e6}
}
76955
func SetConfigDefaults(cfg *Config) {
	if len(cfg.LevelColors) == 0 {
		cfg.LevelColors = DefaultLevelColors
	}
	if cfg.UnknownColor == "" {
		cfg.UnknownColor = DefaultUnknownColor
	}
}
1303814
func (s *UpdateStackInput) SetDefaultOs(v string) *UpdateStackInput {
	s.DefaultOs = &v
	return s
}
1090196
func (o *Options) SetDefaults() {
	// Set the socket type.
	if o.HTTPSocketType != HTTPSocketTypeNone &&
		o.HTTPSocketType != HTTPSocketTypeTCP &&
		o.HTTPSocketType != HTTPSocketTypeUnix {
		o.HTTPSocketType = HTTPSocketTypeTCP
	}

	// Set the listen address.
	if len(o.HTTPListenAddress) == 0 {
		o.HTTPListenAddress = ":80"
	}

	// Set the handle URL.
	if len(o.HTTPHandleURL) == 0 {
		o.HTTPHandleURL = "/glue/"
	}

	// Be sure that the handle URL ends with a slash.
	if !strings.HasSuffix(o.HTTPHandleURL, "/") {
		o.HTTPHandleURL += "/"
	}

	// Set the default check origin function if not set.
	if o.CheckOrigin == nil {
		o.CheckOrigin = checkSameOrigin
	}
}
814636
func (c *Connection) setDefaults() {
	if c.UserAgent == "" {
		c.UserAgent = DefaultUserAgent
	}
	if c.Retries == 0 {
		c.Retries = DefaultRetries
	}
	if c.ConnectTimeout == 0 {
		c.ConnectTimeout = 10 * time.Second
	}
	if c.Timeout == 0 {
		c.Timeout = 60 * time.Second
	}
	if c.Transport == nil {
		t := &http.Transport{
			//		TLSClientConfig:    &tls.Config{RootCAs: pool},
			//		DisableCompression: true,
			Proxy: http.ProxyFromEnvironment,
			// Half of linux's default open files limit (1024).
			MaxIdleConnsPerHost: 512,
		}
		SetExpectContinueTimeout(t, 5*time.Second)
		c.Transport = t
	}
	if c.client == nil {
		c.client = &http.Client{
			//		CheckRedirect: redirectPolicyFunc,
			Transport: c.Transport,
		}
	}
}
166310
func (c *HeadersConfig) ApplyDefaults() *HeadersConfig {
	if c.JaegerBaggageHeader == "" {
		c.JaegerBaggageHeader = JaegerBaggageHeader
	}
	if c.JaegerDebugHeader == "" {
		c.JaegerDebugHeader = JaegerDebugHeader
	}
	if c.TraceBaggageHeaderPrefix == "" {
		c.TraceBaggageHeaderPrefix = TraceBaggageHeaderPrefix
	}
	if c.TraceContextHeaderName == "" {
		c.TraceContextHeaderName = TraceContextHeaderName
	}
	return c
}
1281349
func (m *ModelManagerAPI) SetModelDefaults(args params.SetModelDefaults) (params.ErrorResults, error) {
	results := params.ErrorResults{Results: make([]params.ErrorResult, len(args.Config))}
	if err := m.check.ChangeAllowed(); err != nil {
		return results, errors.Trace(err)
	}
	for i, arg := range args.Config {
		results.Results[i].Error = common.ServerError(
			m.setModelDefaults(arg),
		)
	}
	return results, nil
}
972968
func (s *Layer) SetDefaultRecipes(v *Recipes) *Layer {
	s.DefaultRecipes = v
	return s
}
209826
func (l *Logger) SetDefaults(d map[string]interface{}) error {
	for key := range d {
		if !IsValidKey(key) {
			return ErrInvalidKey
		}
	}

	l.defaults.Store(d)
	return nil
}
1117927
func SetDefaults_FileDiscovery(obj *FileDiscovery) {
	// Make sure file URL becomes path
	if len(obj.KubeConfigPath) != 0 {
		u, err := url.Parse(obj.KubeConfigPath)
		if err == nil && u.Scheme == "file" {
			obj.KubeConfigPath = u.Path
		}
	}
}
231248
func (s *CreateStageInput) SetDefaultRouteSettings(v *RouteSettings) *CreateStageInput {
	s.DefaultRouteSettings = v
	return s
}
79096
func RegisterDefaults(scheme *runtime.Scheme) error {
	scheme.AddTypeDefaultingFunc(&v1.Build{}, func(obj interface{}) { SetObjectDefaults_Build(obj.(*v1.Build)) })
	scheme.AddTypeDefaultingFunc(&v1.BuildConfig{}, func(obj interface{}) { SetObjectDefaults_BuildConfig(obj.(*v1.BuildConfig)) })
	scheme.AddTypeDefaultingFunc(&v1.BuildConfigList{}, func(obj interface{}) { SetObjectDefaults_BuildConfigList(obj.(*v1.BuildConfigList)) })
	scheme.AddTypeDefaultingFunc(&v1.BuildList{}, func(obj interface{}) { SetObjectDefaults_BuildList(obj.(*v1.BuildList)) })
	scheme.AddTypeDefaultingFunc(&v1.BuildRequest{}, func(obj interface{}) { SetObjectDefaults_BuildRequest(obj.(*v1.BuildRequest)) })
	return nil
}
107753
func RegisterDefaults(scheme *runtime.Scheme) error {
	scheme.AddTypeDefaultingFunc(&v2beta1.HorizontalPodAutoscaler{}, func(obj interface{}) {
		SetObjectDefaults_HorizontalPodAutoscaler(obj.(*v2beta1.HorizontalPodAutoscaler))
	})
	scheme.AddTypeDefaultingFunc(&v2beta1.HorizontalPodAutoscalerList{}, func(obj interface{}) {
		SetObjectDefaults_HorizontalPodAutoscalerList(obj.(*v2beta1.HorizontalPodAutoscalerList))
	})
	return nil
}
57261
func (a *AttributeDefinition) SetDefault(def interface{}) {
	switch actual := def.(type) {
	case HashVal:
		a.DefaultValue = actual.ToMap()
	case ArrayVal:
		a.DefaultValue = actual.ToSlice()
	default:
		a.DefaultValue = actual
	}
}