// SetCodeHook sets the CodeHook field's value.
772267
func (s *FulfillmentActivity) SetCodeHook(v *CodeHook) *FulfillmentActivity {
	s.CodeHook = v
	return s
}
21672
func (s *Event) SetEventCode(v string) *Event {
	s.EventCode = &v
	return s
}
961299
func (s *CreateWebhookOutput) SetWebhook(v *Webhook) *CreateWebhookOutput {
	s.Webhook = v
	return s
}
763532
func (s *UpdateWebhookOutput) SetWebhook(v *Webhook) *UpdateWebhookOutput {
	s.Webhook = v
	return s
}
614957
func (m *Meta) uiHook() *UiHook {
	return &UiHook{
		Colorize: m.Colorize(),
		Ui:       m.Ui,
	}
}
373942
func (logger *Logger) AddHook(hook Hook) {
	logger.mu.Lock()
	defer logger.mu.Unlock()
	logger.Hooks.Add(hook)
}
54273
func (s *GetIntentOutput) SetDialogCodeHook(v *CodeHook) *GetIntentOutput {
	s.DialogCodeHook = v
	return s
}
373062
func handleHook(a HookAction, err error) {
	if err != nil {
		// TODO: handle errors
	}

	switch a {
	case HookActionContinue:
		return
	case HookActionHalt:
		panic(HookActionHalt)
	}
}
760699
func (s *AudioParameters) SetCodecOptions(v *AudioCodecOptions) *AudioParameters {
	s.CodecOptions = v
	return s
}
885025
func (s *MessageData) SetCode(v string) *MessageData {
	s.Code = &v
	return s
}
1112540
func (s *EventType) SetCode(v string) *EventType {
	s.Code = &v
	return s
}
196293
func (s *AssumeRoleInput) SetTokenCode(v string) *AssumeRoleInput {
	s.TokenCode = &v
	return s
}
684228
func (s *PutWebhookInput) SetWebhook(v *WebhookDefinition) *PutWebhookInput {
	s.Webhook = v
	return s
}
619311
func (bot *BotAPI) SetWebhook(config WebhookConfig) (APIResponse, error) {

	if config.Certificate == nil {
		v := url.Values{}
		v.Add("url", config.URL.String())
		if config.MaxConnections != 0 {
			v.Add("max_connections", strconv.Itoa(config.MaxConnections))
		}

		return bot.MakeRequest("setWebhook", v)
	}

	params := make(map[string]string)
	params["url"] = config.URL.String()
	if config.MaxConnections != 0 {
		params["max_connections"] = strconv.Itoa(config.MaxConnections)
	}

	resp, err := bot.UploadFile("setWebhook", params, "certificate", config.Certificate)
	if err != nil {
		return APIResponse{}, err
	}

	return resp, nil
}
270352
func (s *TransferDomainInput) SetAuthCode(v string) *TransferDomainInput {
	s.AuthCode = &v
	return s
}
1181821
func (p *Plugin) addHook(hookName string, hookConfig HookConfig) error {
	var lgHook logrus.Hook
	var err error

	switch hookName {
	case HookSysLog:
		address := hookConfig.Address
		if hookConfig.Address != "" {
			address = address + ":" + strconv.Itoa(hookConfig.Port)
		}
		lgHook, err = lgSyslog.NewSyslogHook(
			hookConfig.Protocol,
			address,
			syslog.LOG_INFO,
			p.ServiceLabel.GetAgentLabel(),
		)
	case HookLogStash:
		lgHook, err = logrustash.NewHook(
			hookConfig.Protocol,
			hookConfig.Address+":"+strconv.Itoa(hookConfig.Port),
			p.ServiceLabel.GetAgentLabel(),
		)
	case HookFluent:
		lgHook, err = logrus_fluent.NewWithConfig(logrus_fluent.Config{
			Host:       hookConfig.Address,
			Port:       hookConfig.Port,
			DefaultTag: p.ServiceLabel.GetAgentLabel(),
		})
	default:
		return fmt.Errorf("unsupported hook: %q", hookName)
	}
	if err != nil {
		return fmt.Errorf("creating hook for %v failed: %v", hookName, err)
	}
	// create hook
	cHook := &commonHook{Hook: lgHook}
	// fill up defined levels, or use default if not defined
	if len(hookConfig.Levels) == 0 {
		cHook.levels = []logrus.Level{logrus.PanicLevel, logrus.FatalLevel, logrus.ErrorLevel}
	} else {
		for _, level := range hookConfig.Levels {
			if lgl, err := logrus.ParseLevel(level); err == nil {
				cHook.levels = append(cHook.levels, lgl)
			} else {
				p.Log.Warnf("cannot parse hook log level %v : %v", level, err.Error())
			}
		}
	}
	// add hook to existing loggers and store it into registry for late use
	p.LogRegistry.AddHook(cHook)
	return nil
}
280829
func (s *InstanceState) SetCode(v int64) *InstanceState {
	s.Code = &v
	return s
}